Create table */
| 2536 | |
| 2537 | /** Create table */ |
| 2538 | int |
| 2539 | port_flow_template_table_create(portid_t port_id, uint32_t id, |
| 2540 | const struct rte_flow_template_table_attr *table_attr, |
| 2541 | uint32_t nb_pattern_templates, uint32_t *pattern_templates, |
| 2542 | uint32_t nb_actions_templates, uint32_t *actions_templates) |
| 2543 | { |
| 2544 | struct rte_port *port; |
| 2545 | struct port_table *pt; |
| 2546 | struct port_template *temp = NULL; |
| 2547 | int ret; |
| 2548 | uint32_t i; |
| 2549 | struct rte_flow_error error; |
| 2550 | struct rte_flow_pattern_template |
| 2551 | *flow_pattern_templates[nb_pattern_templates]; |
| 2552 | struct rte_flow_actions_template |
| 2553 | *flow_actions_templates[nb_actions_templates]; |
| 2554 | |
| 2555 | if (port_id_is_invalid(port_id, ENABLED_WARN) || |
| 2556 | port_id == (portid_t)RTE_PORT_ALL) |
| 2557 | return -EINVAL; |
| 2558 | port = &ports[port_id]; |
| 2559 | for (i = 0; i < nb_pattern_templates; ++i) { |
| 2560 | bool found = false; |
| 2561 | temp = port->pattern_templ_list; |
| 2562 | while (temp) { |
| 2563 | if (pattern_templates[i] == temp->id) { |
| 2564 | flow_pattern_templates[i] = |
| 2565 | temp->template.pattern_template; |
| 2566 | found = true; |
| 2567 | break; |
| 2568 | } |
| 2569 | temp = temp->next; |
| 2570 | } |
| 2571 | if (!found) { |
| 2572 | printf("Pattern template #%u is invalid\n", |
| 2573 | pattern_templates[i]); |
| 2574 | return -EINVAL; |
| 2575 | } |
| 2576 | } |
| 2577 | for (i = 0; i < nb_actions_templates; ++i) { |
| 2578 | bool found = false; |
| 2579 | temp = port->actions_templ_list; |
| 2580 | while (temp) { |
| 2581 | if (actions_templates[i] == temp->id) { |
| 2582 | flow_actions_templates[i] = |
| 2583 | temp->template.actions_template; |
| 2584 | found = true; |
| 2585 | break; |
| 2586 | } |
| 2587 | temp = temp->next; |
| 2588 | } |
| 2589 | if (!found) { |
| 2590 | printf("Actions template #%u is invalid\n", |
| 2591 | actions_templates[i]); |
| 2592 | return -EINVAL; |
| 2593 | } |
| 2594 | } |
| 2595 | ret = table_alloc(id, &pt, &port->table_list); |
no test coverage detected