- flow.offset = sizeof(struct ibv_flow_attr);
- *flow.ibv_attr = (struct ibv_flow_attr){
- .comp_mask = 0,
- .type = IBV_FLOW_ATTR_NORMAL,
- .size = sizeof(struct ibv_flow_attr),
- .priority = attr->priority,
- .num_of_specs = 0,
- .port = priv->port,
- .flags = 0,
- };
- claim_zero(mlx4_flow_prepare(priv, attr, pattern, actions,
- error, &flow));
- target = (struct mlx4_flow_target){
- .queue = 0,
- .drop = 0,
- };
- for (action = actions; action->type; ++action) {
- switch (action->type) {
- const struct rte_flow_action_queue *queue;
-
- case RTE_FLOW_ACTION_TYPE_VOID:
- continue;
- case RTE_FLOW_ACTION_TYPE_QUEUE:
- queue = action->conf;
- target.queue = 1;
- target.queue_id = queue->index;
- break;
- case RTE_FLOW_ACTION_TYPE_DROP:
- target.drop = 1;
- break;
- default:
- rte_flow_error_set(error, ENOTSUP,
- RTE_FLOW_ERROR_TYPE_ACTION,
- action, "unsupported action");
- goto exit;
- }
- }
- rte_flow = mlx4_flow_create_target_queue(priv, flow.ibv_attr,
- &target, error);
- if (rte_flow) {
- LIST_INSERT_HEAD(&priv->flows, rte_flow, next);
- DEBUG("Flow created %p", (void *)rte_flow);
- return rte_flow;
- }
-exit:
- rte_free(flow.ibv_attr);