net/mlx5: fix VID assignment in VLAN modify
PATCH 1/1 net/mlx5: fix VID assignment in VLAN modify
PMD uses MODIFY_FIELD to implement standalone OF_SET_VLAN_VID flow action.
PMD assigned immediate VLAN Id value to the .level member of the rte_flow_action_modify_data structure instead of .value. That assignment has worked because both members had the same offset in the hosting structure.
The patch assigns VLAN Id directly to .value
--- drivers/net/mlx5/mlx5_flow_hw.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +7 -7
@@ -6863,7 +6863,6 @@ flow_hw_set_vlan_vid(struct rte_eth_dev *dev, rm[set_vlan_vid_ix].conf)->vlan_vid != 0);const struct rte_flow_action_of_set_vlan_vid *conf = ra[set_vlan_vid_ix].conf; -rte_be16_t vid = masked ? conf->vlan_vid :0 ;int width =mlx5_flow_item_field_width (dev,RTE_FLOW_FIELD_VLAN_ID ,0 ,NULL , &error); *spec = (typeof(*spec)) {
@@ -6874,8 +6873,6 @@ flow_hw_set_vlan_vid(struct rte_eth_dev *dev, }, .src = { .field = RTE_FLOW_FIELD_VALUE, - .level = vid, - .offset = 0, }, .width = width, };
@@ -6887,11 +6884,15 @@ flow_hw_set_vlan_vid(struct rte_eth_dev *dev, }, .src = { .field = RTE_FLOW_FIELD_VALUE, - .level = masked ? (1U << width) - 1 : 0, - .offset = 0, }, .width = 0xffffffff, }; +if (masked) { +uint32_t mask_val =0xffffffff ; + +rte_memcpy (spec->src.value, &conf->vlan_vid,sizeof (conf->vlan_vid)); +rte_memcpy (mask->src.value, &mask_val,sizeof (mask_val)); + } ra[set_vlan_vid_ix].type =RTE_FLOW_ACTION_TYPE_MODIFY_FIELD ; ra[set_vlan_vid_ix].conf = spec; rm[set_vlan_vid_ix].type =RTE_FLOW_ACTION_TYPE_MODIFY_FIELD ;
@@ -6918,8 +6919,6 @@ flow_hw_set_vlan_vid_construct(struct rte_eth_dev *dev, }, .src = { .field = RTE_FLOW_FIELD_VALUE, - .level = vid, - .offset = 0, }, .width = width, };
@@ -6928,6 +6927,7 @@ flow_hw_set_vlan_vid_construct(struct rte_eth_dev *dev, .conf = &conf }; +rte_memcpy (conf.src.value, &vid,sizeof (vid));return flow_hw_modify_field_construct (mhdr_cmd, act_data, hw_acts, &modify_action); }
Signature · 1 line
2.39.2
Hi,
Quoted 19 lines
-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Friday, March 1, 2024 8:05 AM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Maayan Kashani <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; Dariusz Sosnowski <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Subject: [PATCH] net/mlx5: fix VID assignment in VLAN modifyPMD uses
MODIFY_FIELDto implement standaloneOF_SET_VLAN_VIDflow action.
PMD assigned immediate VLAN Id value to the.levelmember of therte_flow_action_modify_datastructure instead of.value. That assignment has worked because both members had the same offset in the hosting structure.
Quoted 8 lines
The patch assigns VLAN Id directly to
.valueFixes 773ca0e91ba1 ("net/mlx5: support VLAN push/pop/modify withHWS")
Cc: [email protected] (backport)Signed-off-by Gregory Etelson <[email protected]>
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh