Skip to content

Commit

Permalink
net/mlx5/hws: fix VLAN item in non-relaxed mode
Browse files Browse the repository at this point in the history
[ upstream commit 0aacd886e93df862f010a45ed333d08355f4bca8 ]

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: c55c2bf ("net/mlx5/hws: add definer layer")

Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
  • Loading branch information
hamdanigbaria authored and bluca committed Mar 13, 2024
1 parent d458f6a commit c3d7cee
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions drivers/net/mlx5/hws/mlx5dr_definer.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ struct mlx5dr_definer_conv_data {
X(SET_BE32, gre_opt_key, v->key.key, rte_flow_item_gre_opt) \
X(SET_BE32, gre_opt_seq, v->sequence.sequence, rte_flow_item_gre_opt) \
X(SET_BE16, gre_opt_checksum, v->checksum_rsvd.checksum, rte_flow_item_gre_opt) \
X(SET, meter_color, rte_col_2_mlx5_col(v->color), rte_flow_item_meter_color)
X(SET, meter_color, rte_col_2_mlx5_col(v->color), rte_flow_item_meter_color) \
X(SET, cvlan, STE_CVLAN, rte_flow_item_vlan)

/* Item set function format */
#define X(set_type, func_name, value, item_type) \
Expand Down Expand Up @@ -477,6 +478,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;

Expand All @@ -485,8 +495,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;
Expand Down

0 comments on commit c3d7cee

Please sign in to comment.