Skip to contentSkip to conversation

net/mlx5: use private structure for internal tag item

PATCH New Bing Zhao 1 participant 3 messages Nov 17, 2025 Network drivers

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 2/2 net/mlx5: use private structure for internal tag item

The legacy DV API is used to translate the mask of a matcher and the value of a rule on the root table, no matter it is in SWS or HWS mode. The structure "mlx5_rte_flow_item_tag" is used instead of public "rte_flow_item_tag". This is used internally to speed up and simplify the usage of the available REG_Cs.

Since the offsets of the fields are different, the DV API would get the incorrect value when constructuing the matcher and value. The private structure should be used for the DV API. Also, in the validation stage, the proper structure should be used.

Fixes 483181f7b6dd ("net/mlx5: support device control of representor matching")
Fixes ddb68e47331e ("net/mlx5: add extended metadata mode for HWS")
Fixes 26e1eaf2dac4 ("net/mlx5: support device control for E-Switch default rule")
---
 drivers/net/mlx5/mlx5.h         |  4 ++--
 drivers/net/mlx5/mlx5_flow_hw.c | 41 ++++++++++++++++-----------------
 2 files changed, 22 insertions(+), 23 deletions(-)
drivers/net/mlx5/mlx5.h +2 -2
index 7e4bfacd11..3d1b5371f0 100644
@@ -469,8 +469,8 @@ struct mlx5_flow_hw_pattern_params {
 	struct rte_flow_item items[MLX5_HW_MAX_ITEMS];
 	/** Temporary REPRESENTED_PORT item generated by PMD. */
 	struct rte_flow_item_ethdev port_spec;
-	/** Temporary TAG item generated by PMD. */
-	struct rte_flow_item_tag tag_spec;
+	/** Temporary internal MLX5_TAG item generated by PMD, no more than 2 DWs. */
+	uint8_t mlx5_tag_spec[sizeof(uint32_t) * 2];
 };
 
 /* HW steering flow management job descriptor. */
drivers/net/mlx5/mlx5_flow_hw.c +20 -21

98 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 2/2 net/mlx5: use private structure for internal tag item

The legacy DV API is used to translate the mask of a matcher and the value of a rule on the root table, no matter it is in SWS or HWS mode. The structure "mlx5_rte_flow_item_tag" is used instead of public "rte_flow_item_tag". This is used internally to speed up and simplify the usage of the available REG_Cs.

Since the offsets of the fields are different, the DV API would get the incorrect value when constructuing the matcher and value. The private structure should be used for the DV API. Also, in the validation stage, the proper structure should be used.

Fixes 483181f7b6dd ("net/mlx5: support device control of representor matching")
Fixes ddb68e47331e ("net/mlx5: add extended metadata mode for HWS")
Fixes 26e1eaf2dac4 ("net/mlx5: support device control for E-Switch default rule")

---
v2: fix the building failure of the unknown private structure size by using memcpy

---
 drivers/net/mlx5/mlx5.h         |  4 +--
 drivers/net/mlx5/mlx5_flow_hw.c | 46 ++++++++++++++++-----------------
 2 files changed, 25 insertions(+), 25 deletions(-)
drivers/net/mlx5/mlx5.h +2 -2
index 7e4bfacd11..3d1b5371f0 100644
@@ -469,8 +469,8 @@ struct mlx5_flow_hw_pattern_params {
 	struct rte_flow_item items[MLX5_HW_MAX_ITEMS];
 	/** Temporary REPRESENTED_PORT item generated by PMD. */
 	struct rte_flow_item_ethdev port_spec;
-	/** Temporary TAG item generated by PMD. */
-	struct rte_flow_item_tag tag_spec;
+	/** Temporary internal MLX5_TAG item generated by PMD, no more than 2 DWs. */
+	uint8_t mlx5_tag_spec[sizeof(uint32_t) * 2];
 };
 
 /* HW steering flow management job descriptor. */
drivers/net/mlx5/mlx5_flow_hw.c +23 -23

107 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v3 1/1 net/mlx5: use private structure for internal tag item

The legacy DV API is used to translate the mask of a matcher and the value of a rule on the root table, no matter it is in SWS or HWS mode. The structure "mlx5_rte_flow_item_tag" is used instead of public "rte_flow_item_tag". This is used internally to speed up and simplify the usage of the available REG_Cs.

Since the offsets of the fields are different, the DV API would get the incorrect value when constructuing the matcher and value. The private structure should be used for the DV API. Also, in the validation stage, the proper structure should be used.

Fixes 483181f7b6dd ("net/mlx5: support device control of representor matching")
Fixes ddb68e47331e ("net/mlx5: add extended metadata mode for HWS")
Fixes 26e1eaf2dac4 ("net/mlx5: support device control for E-Switch default rule")

---
v2: fix the building failure of the unknown private structure size by using memcpy
v3: some compiler may not consider the structure name as a pointer address

---
 drivers/net/mlx5/mlx5.h         |  4 +--
 drivers/net/mlx5/mlx5_flow_hw.c | 46 ++++++++++++++++-----------------
 2 files changed, 25 insertions(+), 25 deletions(-)
drivers/net/mlx5/mlx5.h +2 -2
index 7e4bfacd11..3d1b5371f0 100644
@@ -469,8 +469,8 @@ struct mlx5_flow_hw_pattern_params {
 	struct rte_flow_item items[MLX5_HW_MAX_ITEMS];
 	/** Temporary REPRESENTED_PORT item generated by PMD. */
 	struct rte_flow_item_ethdev port_spec;
-	/** Temporary TAG item generated by PMD. */
-	struct rte_flow_item_tag tag_spec;
+	/** Temporary internal MLX5_TAG item generated by PMD, no more than 2 DWs. */
+	uint8_t mlx5_tag_spec[sizeof(uint32_t) * 2];
 };
 
 /* HW steering flow management job descriptor. */
drivers/net/mlx5/mlx5_flow_hw.c +23 -23

107 lines not on this page · raw message

Signature · 1 line
2.34.1