Skip to contentSkip to conversation

net/mlx5: fix the eCPRI match on HWS root table

PATCH In review Bing Zhao 2 participants 2 messages Jun 4 Network drivers

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 net/mlx5: fix the eCPRI match on HWS root table

When inserting a rule on the root table in HWS mode, the DV interfaces are still being used for the matcher and value translation.

For item eCPRI in HWS mode, the DWs of message header and body may be 0 for a valid rule. So we need to use some flags on root table to decide if the sample ID and matching value should be set for the rule. Since the table and rule may be created in turn for asynchronous flow API, the flags should be per table to avoid over-written. In SWS mode, nothing would be done separately for the matcher itself.

On the non-root table in HWS, the callbacks to fill the WQE will handle such case automatically.

Fixes 93c7d4c22628 ("net/mlx5: support eCPRI with HWS")
---
 drivers/net/mlx5/hws/mlx5dr_matcher.c |  1 +
 drivers/net/mlx5/hws/mlx5dr_matcher.h |  1 +
 drivers/net/mlx5/hws/mlx5dr_rule.c    |  1 +
 drivers/net/mlx5/mlx5_flow.h          |  7 +++
 drivers/net/mlx5/mlx5_flow_dv.c       | 77 +++++++++++++++++++++------
 5 files changed, 70 insertions(+), 17 deletions(-)
drivers/net/mlx5/hws/mlx5dr_matcher.c +1 -0
index 8c07ea8882..511f394448 100644
@@ -1381,6 +1381,7 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher)
 	LIST_INSERT_HEAD(&matcher->tbl->head, matcher, next);
 	pthread_spin_unlock(&ctx->ctrl_lock);
 
+	matcher->hws_root_match_flags = flow_attr.hws_root_match_flags;
 	return 0;
 
 free_mask:
drivers/net/mlx5/hws/mlx5dr_matcher.h +1 -0
index ef42b7de6b..fbcf9fe09e 100644
@@ -82,6 +82,7 @@ struct mlx5dr_matcher {
 	uint8_t num_of_at;
 	/* enum mlx5dr_matcher_flags */
 	uint8_t flags;
+	uint32_t hws_root_match_flags;
 	struct mlx5dr_devx_obj *end_ft;
 	struct mlx5dr_matcher *col_matcher;
 	struct mlx5dr_matcher *resize_dst;
drivers/net/mlx5/hws/mlx5dr_rule.c +1 -0
index 0fda0a2d71..fe69721c92 100644
@@ -741,6 +741,7 @@ int mlx5dr_rule_create_root_no_comp(struct mlx5dr_rule *rule,
 	}
 
 	flow_attr.tbl_type = rule->matcher->tbl->type;
+	flow_attr.hws_root_match_flags = rule->matcher->hws_root_match_flags;
 
 	ret = mlx5_flow_dv_translate_items_hws(items, &flow_attr, value->match_buf,
 					       MLX5_SET_MATCHER_HS_V, NULL,
drivers/net/mlx5/mlx5_flow.h +7 -0
index c9e72a33d6..39c85eb9a4 100644
@@ -117,6 +117,9 @@ enum mlx5_indirect_type {
 	((struct rte_flow_action_handle *)(uintptr_t) \
 	 ((MLX5_INDIRECT_ACTION_TYPE_CT << MLX5_INDIRECT_ACTION_TYPE_OFFSET) | (index)))
 
+#define MLX5_EMPTY_ECPRI_TYPE_MASK RTE_BIT32(0)
+#define MLX5_EMPTY_ECPRI_BODY_MASK RTE_BIT32(1)
+
 enum mlx5_indirect_list_type {
 	MLX5_INDIRECT_ACTION_LIST_TYPE_ERR = 0,
 	MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY = 1,
@@ -1264,6 +1267,7 @@ struct mlx5_flow_attr {
 	/* Action flags, used by priority adjustment. */
 	uint32_t act_flags;
 	uint32_t tbl_type; /* Flow table type. */
+	uint32_t hws_root_match_flags;
 };
 
 /* Flow structure. */
@@ -1985,6 +1989,8 @@ struct mlx5_flow_workspace {
 	uint32_t skip_matcher_reg:1;
 	/* Indicates if need to skip matcher register in translate. */
 	uint32_t mark:1; /* Indicates if flow contains mark action. */
+	uint32_t empty_ecpri_type_mask:1; /* Indicates if eCPRI type was not masked. */
+	uint32_t empty_ecpri_body_mask:1; /* Indicates if 1st DW of eCPRI payload was not masked. */
 	uint32_t vport_meta_tag; /* Used for vport index match. */
 };
 
@@ -2018,6 +2024,7 @@ struct mlx5_dv_matcher_workspace {
 	const struct rte_flow_item *tunnel_item; /* Flow tunnel item. */
 	const struct rte_flow_item *gre_item; /* Flow GRE item. */
 	const struct rte_flow_item *integrity_items[2];
+	uint32_t *p_root_flags;
 };
 
 struct mlx5_flow_split_info {
drivers/net/mlx5/mlx5_flow_dv.c +60 -17

137 lines not on this page · raw message

Signature · 1 line
2.21.0
#1 lore raw

Hi,

Quoted 12 lines · Bing Zhao

When inserting a rule on the root table in HWS mode, the DV interfaces are still being used for the matcher and value translation.

For item eCPRI in HWS mode, the DWs of message header and body may be 0 for a valid rule. So we need to use some flags on root table to decide if the sample ID and matching value should be set for the rule. Since the table and rule may be created in turn for asynchronous flow API, the flags should be per table to avoid over-written. In SWS mode, nothing would be done separately for the matcher itself.

Quoted 7 lines

On the non-root table in HWS, the callbacks to fill the WQE will handle such case automatically.

Fixes 93c7d4c22628 ("net/mlx5: support eCPRI with HWS")

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh