Destroy indirect action */
| 1821 | |
| 1822 | /** Destroy indirect action */ |
| 1823 | int |
| 1824 | port_action_handle_destroy(portid_t port_id, |
| 1825 | uint32_t n, |
| 1826 | const uint32_t *actions) |
| 1827 | { |
| 1828 | struct rte_port *port; |
| 1829 | struct port_indirect_action **tmp; |
| 1830 | int ret = 0; |
| 1831 | |
| 1832 | if (port_id_is_invalid(port_id, ENABLED_WARN) || |
| 1833 | port_id == (portid_t)RTE_PORT_ALL) |
| 1834 | return -EINVAL; |
| 1835 | port = &ports[port_id]; |
| 1836 | tmp = &port->actions_list; |
| 1837 | while (*tmp) { |
| 1838 | uint32_t i; |
| 1839 | |
| 1840 | for (i = 0; i != n; ++i) { |
| 1841 | struct rte_flow_error error; |
| 1842 | struct port_indirect_action *pia = *tmp; |
| 1843 | |
| 1844 | if (actions[i] != pia->id) |
| 1845 | continue; |
| 1846 | /* |
| 1847 | * Poisoning to make sure PMDs update it in case |
| 1848 | * of error. |
| 1849 | */ |
| 1850 | memset(&error, 0x33, sizeof(error)); |
| 1851 | |
| 1852 | if (pia->handle) { |
| 1853 | ret = pia->type == |
| 1854 | RTE_FLOW_ACTION_TYPE_INDIRECT_LIST ? |
| 1855 | rte_flow_action_list_handle_destroy |
| 1856 | (port_id, pia->list_handle, &error) : |
| 1857 | rte_flow_action_handle_destroy |
| 1858 | (port_id, pia->handle, &error); |
| 1859 | if (ret) { |
| 1860 | ret = port_flow_complain(&error); |
| 1861 | continue; |
| 1862 | } |
| 1863 | } |
| 1864 | *tmp = pia->next; |
| 1865 | printf("Indirect action #%u destroyed\n", pia->id); |
| 1866 | free(pia); |
| 1867 | break; |
| 1868 | } |
| 1869 | if (i == n) |
| 1870 | tmp = &(*tmp)->next; |
| 1871 | } |
| 1872 | return ret; |
| 1873 | } |
| 1874 | |
| 1875 | int |
| 1876 | port_action_handle_flush(portid_t port_id) |
no test coverage detected