You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kmod-redhat-mlx5_core/SOURCES/0234-netdrv-net-mlx5e-Disal...

89 lines
3.4 KiB

From ac5bd9adb75cdce1a63983928583ca614781f712 Mon Sep 17 00:00:00 2001
From: Alaa Hleihel <ahleihel@redhat.com>
Date: Tue, 19 May 2020 07:48:56 -0400
Subject: [PATCH 234/312] [netdrv] net/mlx5e: Disallow inserting vxlan/vlan
egress rules without decap/pop
Message-id: <20200519074934.6303-26-ahleihel@redhat.com>
Patchwork-id: 310528
Patchwork-instance: patchwork
O-Subject: [RHEL8.3 BZ 1663246 25/63] net/mlx5e: Disallow inserting vxlan/vlan egress rules without decap/pop
Bugzilla: 1790219 1790218 1663246
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
RH-Acked-by: John Linville <linville@redhat.com>
RH-Acked-by: Ivan Vecera <ivecera@redhat.com>
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
RH-Acked-by: Kamal Heib <kheib@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1663246
Bugzilla: http://bugzilla.redhat.com/1790219
Bugzilla: http://bugzilla.redhat.com/1790218
Upstream: v5.7-rc1
commit 7f2fd0a5f8d859d71e710a664a113c4a2620dc4f
Author: Paul Blakey <paulb@mellanox.com>
Date: Sun Feb 16 12:01:33 2020 +0200
net/mlx5e: Disallow inserting vxlan/vlan egress rules without decap/pop
Currently, rules on tunnel devices can be offloaded without decap action
when a vlan pop action exists. Similarly, the driver will offload rules
on vlan interfaces with no pop action when a decap action exists.
Disallow the faulty behavior by checking that vlan egress rules do pop or
drop and vxlan egress rules do decap, as intended.
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 3d0a5c63d083..b3b006230b89 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2673,6 +2673,8 @@ static bool actions_match_supported(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
struct netlink_ext_ack *extack)
{
+ struct net_device *filter_dev = parse_attr->filter_dev;
+ bool drop_action, decap_action, pop_action;
u32 actions;
if (mlx5e_is_eswitch_flow(flow))
@@ -2680,11 +2682,19 @@ static bool actions_match_supported(struct mlx5e_priv *priv,
else
actions = flow->nic_attr->action;
- if (flow_flag_test(flow, EGRESS) &&
- !((actions & MLX5_FLOW_CONTEXT_ACTION_DECAP) ||
- (actions & MLX5_FLOW_CONTEXT_ACTION_VLAN_POP) ||
- (actions & MLX5_FLOW_CONTEXT_ACTION_DROP)))
- return false;
+ drop_action = actions & MLX5_FLOW_CONTEXT_ACTION_DROP;
+ decap_action = actions & MLX5_FLOW_CONTEXT_ACTION_DECAP;
+ pop_action = actions & MLX5_FLOW_CONTEXT_ACTION_VLAN_POP;
+
+ if (flow_flag_test(flow, EGRESS) && !drop_action) {
+ /* If no drop, we must decap (vxlan) or pop (vlan) */
+ if (mlx5e_get_tc_tun(filter_dev) && !decap_action)
+ return false;
+ else if (is_vlan_dev(filter_dev) && !pop_action)
+ return false;
+ else
+ return false; /* Sanity */
+ }
if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
return modify_header_match_supported(&parse_attr->spec,
--
2.13.6