Skip to content

Commit

Permalink
net: ocelot: fix switchdev objects synced for wrong netdev with LAG o…
Browse files Browse the repository at this point in the history
…ffload

[ Upstream commit e56c6bb ]

The point with a *dev and a *brport_dev is that when we have a LAG net
device that is a bridge port, *dev is an ocelot net device and
*brport_dev is the bonding/team net device. The ocelot net device
beneath the LAG does not exist from the bridge's perspective, so we need
to sync the switchdev objects belonging to the brport_dev and not to the
dev.

Fixes: e4bd44e ("net: ocelot: replay switchdev events when joining bridge")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
vladimiroltean authored and gregkh committed Jul 28, 2021
1 parent d1f7e50 commit 14a3ed8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/net/ethernet/mscc/ocelot_net.c
Expand Up @@ -1287,6 +1287,7 @@ static int ocelot_netdevice_lag_leave(struct net_device *dev,
}

static int ocelot_netdevice_changeupper(struct net_device *dev,
struct net_device *brport_dev,
struct netdev_notifier_changeupper_info *info)
{
struct netlink_ext_ack *extack;
Expand All @@ -1296,11 +1297,11 @@ static int ocelot_netdevice_changeupper(struct net_device *dev,

if (netif_is_bridge_master(info->upper_dev)) {
if (info->linking)
err = ocelot_netdevice_bridge_join(dev, dev,
err = ocelot_netdevice_bridge_join(dev, brport_dev,
info->upper_dev,
extack);
else
err = ocelot_netdevice_bridge_leave(dev, dev,
err = ocelot_netdevice_bridge_leave(dev, brport_dev,
info->upper_dev);
}
if (netif_is_lag_master(info->upper_dev)) {
Expand Down Expand Up @@ -1335,7 +1336,7 @@ ocelot_netdevice_lag_changeupper(struct net_device *dev,
if (ocelot_port->bond != dev)
return NOTIFY_OK;

err = ocelot_netdevice_changeupper(lower, info);
err = ocelot_netdevice_changeupper(lower, dev, info);
if (err)
return notifier_from_errno(err);
}
Expand Down Expand Up @@ -1374,7 +1375,7 @@ static int ocelot_netdevice_event(struct notifier_block *unused,
struct netdev_notifier_changeupper_info *info = ptr;

if (ocelot_netdevice_dev_check(dev))
return ocelot_netdevice_changeupper(dev, info);
return ocelot_netdevice_changeupper(dev, dev, info);

if (netif_is_lag_master(dev))
return ocelot_netdevice_lag_changeupper(dev, info);
Expand Down

0 comments on commit 14a3ed8

Please sign in to comment.