Create actions template */
| 2421 | |
| 2422 | /** Create actions template */ |
| 2423 | int |
| 2424 | port_flow_actions_template_create(portid_t port_id, uint32_t id, |
| 2425 | const struct rte_flow_actions_template_attr *attr, |
| 2426 | const struct rte_flow_action *actions, |
| 2427 | const struct rte_flow_action *masks) |
| 2428 | { |
| 2429 | struct rte_port *port; |
| 2430 | struct port_template *pat; |
| 2431 | int ret; |
| 2432 | struct rte_flow_error error; |
| 2433 | |
| 2434 | if (port_id_is_invalid(port_id, ENABLED_WARN) || |
| 2435 | port_id == (portid_t)RTE_PORT_ALL) |
| 2436 | return -EINVAL; |
| 2437 | port = &ports[port_id]; |
| 2438 | ret = template_alloc(id, &pat, &port->actions_templ_list); |
| 2439 | if (ret) |
| 2440 | return ret; |
| 2441 | /* Poisoning to make sure PMDs update it in case of error. */ |
| 2442 | memset(&error, 0x22, sizeof(error)); |
| 2443 | pat->template.actions_template = rte_flow_actions_template_create(port_id, |
| 2444 | attr, actions, masks, &error); |
| 2445 | if (!pat->template.actions_template) { |
| 2446 | uint32_t destroy_id = pat->id; |
| 2447 | port_flow_actions_template_destroy(port_id, 1, &destroy_id); |
| 2448 | return port_flow_complain(&error); |
| 2449 | } |
| 2450 | printf("Actions template #%u created\n", pat->id); |
| 2451 | return 0; |
| 2452 | } |
| 2453 | |
| 2454 | /** Destroy actions template */ |
| 2455 | int |
no test coverage detected