Enqueue create flow rule operation. */
| 2702 | |
| 2703 | /** Enqueue create flow rule operation. */ |
| 2704 | int |
| 2705 | port_queue_flow_create(portid_t port_id, queueid_t queue_id, |
| 2706 | bool postpone, uint32_t table_id, uint32_t rule_idx, |
| 2707 | uint32_t pattern_idx, uint32_t actions_idx, |
| 2708 | const struct rte_flow_item *pattern, |
| 2709 | const struct rte_flow_action *actions) |
| 2710 | { |
| 2711 | struct rte_flow_op_attr op_attr = { .postpone = postpone }; |
| 2712 | struct rte_flow *flow; |
| 2713 | struct rte_port *port; |
| 2714 | struct port_flow *pf; |
| 2715 | struct port_table *pt; |
| 2716 | uint32_t id = 0; |
| 2717 | bool found; |
| 2718 | struct rte_flow_error error = { RTE_FLOW_ERROR_TYPE_NONE, NULL, NULL }; |
| 2719 | struct rte_flow_action_age *age = age_action_get(actions); |
| 2720 | struct queue_job *job; |
| 2721 | |
| 2722 | port = &ports[port_id]; |
| 2723 | if (port->flow_list) { |
| 2724 | if (port->flow_list->id == UINT32_MAX) { |
| 2725 | printf("Highest rule ID is already assigned," |
| 2726 | " delete it first"); |
| 2727 | return -ENOMEM; |
| 2728 | } |
| 2729 | id = port->flow_list->id + 1; |
| 2730 | } |
| 2731 | |
| 2732 | if (queue_id >= port->queue_nb) { |
| 2733 | printf("Queue #%u is invalid\n", queue_id); |
| 2734 | return -EINVAL; |
| 2735 | } |
| 2736 | |
| 2737 | found = false; |
| 2738 | pt = port->table_list; |
| 2739 | while (pt) { |
| 2740 | if (table_id == pt->id) { |
| 2741 | found = true; |
| 2742 | break; |
| 2743 | } |
| 2744 | pt = pt->next; |
| 2745 | } |
| 2746 | if (!found) { |
| 2747 | printf("Table #%u is invalid\n", table_id); |
| 2748 | return -EINVAL; |
| 2749 | } |
| 2750 | |
| 2751 | if (pattern_idx >= pt->nb_pattern_templates) { |
| 2752 | printf("Pattern template index #%u is invalid," |
| 2753 | " %u templates present in the table\n", |
| 2754 | pattern_idx, pt->nb_pattern_templates); |
| 2755 | return -EINVAL; |
| 2756 | } |
| 2757 | if (actions_idx >= pt->nb_actions_templates) { |
| 2758 | printf("Actions template index #%u is invalid," |
| 2759 | " %u templates present in the table\n", |
| 2760 | actions_idx, pt->nb_actions_templates); |
| 2761 | return -EINVAL; |
no test coverage detected