[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210720134655.892334-5-vladimir.oltean@nxp.com>
Date: Tue, 20 Jul 2021 16:46:49 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>
Cc: Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
Ido Schimmel <idosch@...sch.org>,
Tobias Waldekranz <tobias@...dekranz.com>,
Roopa Prabhu <roopa@...dia.com>,
Nikolay Aleksandrov <nikolay@...dia.com>,
Stephen Hemminger <stephen@...workplumber.org>,
bridge@...ts.linux-foundation.org,
Grygorii Strashko <grygorii.strashko@...com>,
Marek Behun <kabel@...ckhole.sk>,
DENG Qingfang <dqfext@...il.com>
Subject: [PATCH v5 net-next 04/10] mlxsw: spectrum: refactor leaving an 8021q upper that is a bridge port
For symmetry with mlxsw_sp_port_lag_leave(), introduce a small function
called mlxsw_sp_port_vlan_leave() which checks whether the 8021q upper
we're leaving is a bridge port, and if it is, stop offloading that
bridge too.
Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
---
v3->v4: patch is new
v4->v5: none
.../net/ethernet/mellanox/mlxsw/spectrum.c | 25 +++++++++++--------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index c1b78878e5cf..b3d1fdc2d094 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -3994,6 +3994,19 @@ static void mlxsw_sp_port_ovs_leave(struct mlxsw_sp_port *mlxsw_sp_port)
mlxsw_sp_port_vp_mode_set(mlxsw_sp_port, false);
}
+static void mlxsw_sp_port_vlan_leave(struct mlxsw_sp_port *mlxsw_sp_port,
+ struct net_device *vlan_dev)
+{
+ struct net_device *br_dev;
+
+ if (!netif_is_bridge_port(vlan_dev))
+ return;
+
+ br_dev = netdev_master_upper_dev_get(vlan_dev);
+
+ mlxsw_sp_port_bridge_leave(mlxsw_sp_port, vlan_dev, br_dev);
+}
+
static bool mlxsw_sp_bridge_has_multiple_vxlans(struct net_device *br_dev)
{
unsigned int num_vxlans = 0;
@@ -4225,16 +4238,8 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev,
} else if (netif_is_macvlan(upper_dev)) {
if (!info->linking)
mlxsw_sp_rif_macvlan_del(mlxsw_sp, upper_dev);
- } else if (is_vlan_dev(upper_dev)) {
- struct net_device *br_dev;
-
- if (!netif_is_bridge_port(upper_dev))
- break;
- if (info->linking)
- break;
- br_dev = netdev_master_upper_dev_get(upper_dev);
- mlxsw_sp_port_bridge_leave(mlxsw_sp_port, upper_dev,
- br_dev);
+ } else if (is_vlan_dev(upper_dev) && !info->linking) {
+ mlxsw_sp_port_vlan_leave(mlxsw_sp_port, upper_dev);
}
break;
}
--
2.25.1
Powered by blists - more mailing lists