Destroy table */
| 2617 | |
| 2618 | /** Destroy table */ |
| 2619 | int |
| 2620 | port_flow_template_table_destroy(portid_t port_id, |
| 2621 | uint32_t n, const uint32_t *table) |
| 2622 | { |
| 2623 | struct rte_port *port; |
| 2624 | struct port_table **tmp; |
| 2625 | int ret = 0; |
| 2626 | |
| 2627 | if (port_id_is_invalid(port_id, ENABLED_WARN) || |
| 2628 | port_id == (portid_t)RTE_PORT_ALL) |
| 2629 | return -EINVAL; |
| 2630 | port = &ports[port_id]; |
| 2631 | tmp = &port->table_list; |
| 2632 | while (*tmp) { |
| 2633 | uint32_t i; |
| 2634 | |
| 2635 | for (i = 0; i != n; ++i) { |
| 2636 | struct rte_flow_error error; |
| 2637 | struct port_table *pt = *tmp; |
| 2638 | |
| 2639 | if (table[i] != pt->id) |
| 2640 | continue; |
| 2641 | /* |
| 2642 | * Poisoning to make sure PMDs update it in case |
| 2643 | * of error. |
| 2644 | */ |
| 2645 | memset(&error, 0x33, sizeof(error)); |
| 2646 | |
| 2647 | if (pt->table && |
| 2648 | rte_flow_template_table_destroy(port_id, |
| 2649 | pt->table, |
| 2650 | &error)) { |
| 2651 | ret = port_flow_complain(&error); |
| 2652 | continue; |
| 2653 | } |
| 2654 | *tmp = pt->next; |
| 2655 | printf("Template table #%u destroyed\n", pt->id); |
| 2656 | free(pt); |
| 2657 | break; |
| 2658 | } |
| 2659 | if (i == n) |
| 2660 | tmp = &(*tmp)->next; |
| 2661 | } |
| 2662 | return ret; |
| 2663 | } |
| 2664 | |
| 2665 | /** Flush table */ |
| 2666 | int |
no test coverage detected