summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Britstein <elibr@mellanox.com>2019-03-14 15:55:09 +0100
committerSaeed Mahameed <saeedm@mellanox.com>2019-04-05 23:10:34 +0200
commit6fca9d1e603aa86e4902ccb0ab17995c2c34f82a (patch)
tree1df79da887b667be62bc51af9b3226ee4577dc02
parentnet/mlx5e: Deny VLAN rewrite if there is no VLAN header match (diff)
downloadlinux-6fca9d1e603aa86e4902ccb0ab17995c2c34f82a.tar.xz
linux-6fca9d1e603aa86e4902ccb0ab17995c2c34f82a.zip
net/mlx5e: Allow VLAN rewrite of prio field with the same match
Changing the prio field of the VLAN is not supported. With commit 37410902874c ("net/mlx5e: Support VLAN modify action") zero value indicated "no-change". Allow the vid rewrite if the prio match is the same as the prio set value. Fixes: 37410902874c ("net/mlx5e: Support VLAN modify action") Signed-off-by: Eli Britstein <elibr@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 3a0854fbcfd4..611b636c603e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2292,6 +2292,7 @@ static int add_vlan_rewrite_action(struct mlx5e_priv *priv, int namespace,
.mangle.mask = ~(u32)be16_to_cpu(*(__be16 *)&mask16),
.mangle.val = (u32)be16_to_cpu(*(__be16 *)&val16),
};
+ u8 match_prio_mask, match_prio_val;
void *headers_c, *headers_v;
int err;
@@ -2305,8 +2306,11 @@ static int add_vlan_rewrite_action(struct mlx5e_priv *priv, int namespace,
return -EOPNOTSUPP;
}
- if (act->vlan.prio) {
- NL_SET_ERR_MSG_MOD(extack, "Setting VLAN prio is not supported");
+ match_prio_mask = MLX5_GET(fte_match_set_lyr_2_4, headers_c, first_prio);
+ match_prio_val = MLX5_GET(fte_match_set_lyr_2_4, headers_v, first_prio);
+ if (act->vlan.prio != (match_prio_val & match_prio_mask)) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Changing VLAN prio is not supported");
return -EOPNOTSUPP;
}