Skip to content

Commit 272c447

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum: Add support for VLAN devices on top of LAG
When creating a VLAN device on top of LAG, we are basically creating a vPort on top of each of the port netdevs member in the LAG. Therefore, these vPorts should inherit both the LAG status and LAG ID from the underlying port netdevs. In addition, when the VLAN device joins or leaves a bridge each of the underlying vPorts should know about it and act accordingly. This is achieved by propagating the VLAN event down to the lower devices. Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 64771e3 commit 272c447

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,8 @@ mlxsw_sp_port_vport_create(struct mlxsw_sp_port *mlxsw_sp_port,
626626
mlxsw_sp_vport->mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
627627
mlxsw_sp_vport->local_port = mlxsw_sp_port->local_port;
628628
mlxsw_sp_vport->stp_state = BR_STATE_FORWARDING;
629+
mlxsw_sp_vport->lagged = mlxsw_sp_port->lagged;
630+
mlxsw_sp_vport->lag_id = mlxsw_sp_port->lag_id;
629631
mlxsw_sp_vport->vport.vfid = vfid;
630632
mlxsw_sp_vport->vport.vid = vfid->vid;
631633

@@ -2774,16 +2776,40 @@ static int mlxsw_sp_netdevice_vport_event(struct net_device *dev,
27742776
return NOTIFY_DONE;
27752777
}
27762778

2779+
static int mlxsw_sp_netdevice_lag_vport_event(struct net_device *lag_dev,
2780+
unsigned long event, void *ptr,
2781+
u16 vid)
2782+
{
2783+
struct net_device *dev;
2784+
struct list_head *iter;
2785+
int ret;
2786+
2787+
netdev_for_each_lower_dev(lag_dev, dev, iter) {
2788+
if (mlxsw_sp_port_dev_check(dev)) {
2789+
ret = mlxsw_sp_netdevice_vport_event(dev, event, ptr,
2790+
vid);
2791+
if (ret == NOTIFY_BAD)
2792+
return ret;
2793+
}
2794+
}
2795+
2796+
return NOTIFY_DONE;
2797+
}
2798+
27772799
static int mlxsw_sp_netdevice_vlan_event(struct net_device *vlan_dev,
27782800
unsigned long event, void *ptr)
27792801
{
27802802
struct net_device *real_dev = vlan_dev_real_dev(vlan_dev);
27812803
u16 vid = vlan_dev_vlan_id(vlan_dev);
27822804

2783-
if (!mlxsw_sp_port_dev_check(real_dev))
2784-
return NOTIFY_DONE;
2805+
if (mlxsw_sp_port_dev_check(real_dev))
2806+
return mlxsw_sp_netdevice_vport_event(real_dev, event, ptr,
2807+
vid);
2808+
else if (netif_is_lag_master(real_dev))
2809+
return mlxsw_sp_netdevice_lag_vport_event(real_dev, event, ptr,
2810+
vid);
27852811

2786-
return mlxsw_sp_netdevice_vport_event(real_dev, event, ptr, vid);
2812+
return NOTIFY_DONE;
27872813
}
27882814

27892815
static int mlxsw_sp_netdevice_event(struct notifier_block *unused,

0 commit comments

Comments
 (0)