[6/9] net/mlx5/hws: fix VLAN item handling on non relaxed mode

Message ID 20240213095038.451299-6-igozlan@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series [1/9] net/mlx5/hws: skip RTE item when inserting rules by index |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Itamar Gozlan Feb. 13, 2024, 9:50 a.m. UTC
  From: Hamdan Igbaria <hamdani@nvidia.com>

If a VLAN item was passed with null mask, the item handler would
return immediately and thus won't set default values for non relax
mode.
Also change the non relax default set to single-tagged (CVLAN).

Fixes: c55c2bf35333 ("net/mlx5/hws: add definer layer")
Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index eb788a772a..b8a546989a 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -223,6 +223,7 @@  struct mlx5dr_definer_conv_data {
 	X(SET,		ib_l4_opcode,		v->hdr.opcode,		rte_flow_item_ib_bth) \
 	X(SET,		random_number,		v->value,		rte_flow_item_random) \
 	X(SET,		ib_l4_bth_a,		v->hdr.a,		rte_flow_item_ib_bth) \
+	X(SET,		cvlan,			STE_CVLAN,		rte_flow_item_vlan) \
 
 /* Item set function format */
 #define X(set_type, func_name, value, item_type) \
@@ -864,6 +865,15 @@  mlx5dr_definer_conv_item_vlan(struct mlx5dr_definer_conv_data *cd,
 	struct mlx5dr_definer_fc *fc;
 	bool inner = cd->tunnel;
 
+	if (!cd->relaxed) {
+		/* Mark packet as tagged (CVLAN) */
+		fc = &cd->fc[DR_CALC_FNAME(VLAN_TYPE, inner)];
+		fc->item_idx = item_idx;
+		fc->tag_mask_set = &mlx5dr_definer_ones_set;
+		fc->tag_set = &mlx5dr_definer_cvlan_set;
+		DR_CALC_SET(fc, eth_l2, first_vlan_qualifier, inner);
+	}
+
 	if (!m)
 		return 0;
 
@@ -872,8 +882,7 @@  mlx5dr_definer_conv_item_vlan(struct mlx5dr_definer_conv_data *cd,
 		return rte_errno;
 	}
 
-	if (!cd->relaxed || m->has_more_vlan) {
-		/* Mark packet as tagged (CVLAN or SVLAN) even if TCI is not specified.*/
+	if (m->has_more_vlan) {
 		fc = &cd->fc[DR_CALC_FNAME(VLAN_TYPE, inner)];
 		fc->item_idx = item_idx;
 		fc->tag_mask_set = &mlx5dr_definer_ones_set;