net/mlx5: Bridge, verify LAG state when adding bond to bridge
Mlx5 LAG is initialized asynchronously on a workqueue which means that for
a brief moment after setting mlx5 UL representors as lower devices of a
bond netdevice the LAG itself is not fully initialized in the driver. When
adding such bond device to a bridge mlx5 bridge code will not consider it
as offload-capable, skip creating necessary bookkeeping and fail any
further bridge offload-related commands with it (setting VLANs, offloading
FDBs, etc.). In order to make the error explicit during bridge
initialization stage implement the code that detects such condition during
NETDEV_PRECHANGEUPPER event and returns an error.
Fixes: ff9b752146
("net/mlx5: Bridge, support LAG")
Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
27c064ae14
commit
15f8f16895
|
@ -164,6 +164,36 @@ static int mlx5_esw_bridge_port_changeupper(struct notifier_block *nb, void *ptr
|
|||
return err;
|
||||
}
|
||||
|
||||
static int
|
||||
mlx5_esw_bridge_changeupper_validate_netdev(void *ptr)
|
||||
{
|
||||
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
|
||||
struct netdev_notifier_changeupper_info *info = ptr;
|
||||
struct net_device *upper = info->upper_dev;
|
||||
struct net_device *lower;
|
||||
struct list_head *iter;
|
||||
|
||||
if (!netif_is_bridge_master(upper) || !netif_is_lag_master(dev))
|
||||
return 0;
|
||||
|
||||
netdev_for_each_lower_dev(dev, lower, iter) {
|
||||
struct mlx5_core_dev *mdev;
|
||||
struct mlx5e_priv *priv;
|
||||
|
||||
if (!mlx5e_eswitch_rep(lower))
|
||||
continue;
|
||||
|
||||
priv = netdev_priv(lower);
|
||||
mdev = priv->mdev;
|
||||
if (!mlx5_lag_is_active(mdev))
|
||||
return -EAGAIN;
|
||||
if (!mlx5_lag_is_shared_fdb(mdev))
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mlx5_esw_bridge_switchdev_port_event(struct notifier_block *nb,
|
||||
unsigned long event, void *ptr)
|
||||
{
|
||||
|
@ -171,6 +201,7 @@ static int mlx5_esw_bridge_switchdev_port_event(struct notifier_block *nb,
|
|||
|
||||
switch (event) {
|
||||
case NETDEV_PRECHANGEUPPER:
|
||||
err = mlx5_esw_bridge_changeupper_validate_netdev(ptr);
|
||||
break;
|
||||
|
||||
case NETDEV_CHANGEUPPER:
|
||||
|
|
Loading…
Reference in New Issue