Destroy actions template */
| 2453 | |
| 2454 | /** Destroy actions template */ |
| 2455 | int |
| 2456 | port_flow_actions_template_destroy(portid_t port_id, uint32_t n, |
| 2457 | const uint32_t *template) |
| 2458 | { |
| 2459 | struct rte_port *port; |
| 2460 | struct port_template **tmp; |
| 2461 | int ret = 0; |
| 2462 | |
| 2463 | if (port_id_is_invalid(port_id, ENABLED_WARN) || |
| 2464 | port_id == (portid_t)RTE_PORT_ALL) |
| 2465 | return -EINVAL; |
| 2466 | port = &ports[port_id]; |
| 2467 | tmp = &port->actions_templ_list; |
| 2468 | while (*tmp) { |
| 2469 | uint32_t i; |
| 2470 | |
| 2471 | for (i = 0; i != n; ++i) { |
| 2472 | struct rte_flow_error error; |
| 2473 | struct port_template *pat = *tmp; |
| 2474 | |
| 2475 | if (template[i] != pat->id) |
| 2476 | continue; |
| 2477 | /* |
| 2478 | * Poisoning to make sure PMDs update it in case |
| 2479 | * of error. |
| 2480 | */ |
| 2481 | memset(&error, 0x33, sizeof(error)); |
| 2482 | |
| 2483 | if (pat->template.actions_template && |
| 2484 | rte_flow_actions_template_destroy(port_id, |
| 2485 | pat->template.actions_template, &error)) { |
| 2486 | ret = port_flow_complain(&error); |
| 2487 | continue; |
| 2488 | } |
| 2489 | *tmp = pat->next; |
| 2490 | printf("Actions template #%u destroyed\n", pat->id); |
| 2491 | free(pat); |
| 2492 | break; |
| 2493 | } |
| 2494 | if (i == n) |
| 2495 | tmp = &(*tmp)->next; |
| 2496 | } |
| 2497 | return ret; |
| 2498 | } |
| 2499 | |
| 2500 | /** Flush actions template */ |
| 2501 | int |
no test coverage detected