- flow.inner = 0;
- flow.hash_fields = 0;
- claim_zero(priv_flow_validate(priv, attr, items, actions,
- error, &flow));
- if (flow.actions.mark && !flow.actions.drop) {
- mlx5_flow_create_flag_mark(&flow, flow.actions.mark_id);
- flow.offset += sizeof(struct ibv_flow_spec_action_tag);
- }
- if (flow.actions.drop)
- rte_flow =
- priv_flow_create_action_queue_drop(priv, &flow, error);
+ err = priv_flow_convert(priv, attr, items, actions, error, parser);
+ if (err || parser->create)
+ goto exit;
+ if (parser->actions.mark)
+ mlx5_flow_create_flag_mark(parser, parser->actions.mark_id);
+ return 0;
+exit:
+ if (parser->ibv_attr)
+ rte_free(parser->ibv_attr);
+ return err;
+}
+
+/**
+ * Convert a flow.
+ *
+ * @param priv
+ * Pointer to private structure.
+ * @param list
+ * Pointer to a TAILQ flow list.
+ * @param[in] attr
+ * Flow rule attributes.
+ * @param[in] pattern
+ * Pattern specification (list terminated by the END pattern item).
+ * @param[in] actions
+ * Associated actions (list terminated by the END action).
+ * @param[out] error
+ * Perform verbose error reporting if not NULL.
+ *
+ * @return
+ * A flow on success, NULL otherwise.
+ */
+static struct rte_flow *
+priv_flow_create(struct priv *priv,
+ struct mlx5_flows *list,
+ const struct rte_flow_attr *attr,
+ const struct rte_flow_item items[],
+ const struct rte_flow_action actions[],
+ struct rte_flow_error *error)
+{
+ struct mlx5_flow_parse parser = { .create = 1, };
+ struct rte_flow *flow;
+ int err;
+
+ err = priv_flow_validate(priv, attr, items, actions, error, &parser);
+ if (err)
+ goto exit;
+ if (parser.actions.drop)
+ flow = priv_flow_create_action_queue_drop(priv, &parser, error);