diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index d507289096c2..45bda7b226e9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -1028,7 +1028,7 @@ struct mlx5e_profile { void (*cleanup_rx)(struct mlx5e_priv *priv); int (*init_tx)(struct mlx5e_priv *priv); void (*cleanup_tx)(struct mlx5e_priv *priv); - void (*enable)(struct mlx5e_priv *priv); + int (*enable)(struct mlx5e_priv *priv); void (*disable)(struct mlx5e_priv *priv); int (*update_rx)(struct mlx5e_priv *priv); void (*update_stats)(struct mlx5e_priv *priv); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index aa8610cedaa8..c9bcb8738f17 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -6193,7 +6193,7 @@ static int mlx5e_init_nic_tx(struct mlx5e_priv *priv) return 0; } -static void mlx5e_nic_enable(struct mlx5e_priv *priv) +static int mlx5e_nic_enable(struct mlx5e_priv *priv) { struct net_device *netdev = priv->netdev; struct mlx5_core_dev *mdev = priv->mdev; @@ -6224,7 +6224,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv) mlx5e_pcie_cong_event_init(priv); mlx5e_hv_vhca_stats_create(priv); if (netdev->reg_state != NETREG_REGISTERED) - return; + return 0; mlx5e_dcbnl_init_app(priv); mlx5e_nic_set_rx_mode(priv); @@ -6237,6 +6237,8 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv) netdev_unlock(netdev); netif_device_attach(netdev); rtnl_unlock(); + + return 0; } static void mlx5e_nic_disable(struct mlx5e_priv *priv) @@ -6618,13 +6620,18 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv) if (err) goto err_cleanup_tx; - if (profile->enable) - profile->enable(priv); + if (profile->enable) { + err = profile->enable(priv); + if (err) + goto err_cleanup_rx; + } mlx5e_update_features(priv->netdev); return 0; +err_cleanup_rx: + profile->cleanup_rx(priv); err_cleanup_tx: profile->cleanup_tx(priv); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index c8b76d301c92..603051ab1eaa 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -1262,9 +1262,11 @@ static void mlx5e_cleanup_rep_tx(struct mlx5e_priv *priv) mlx5e_rep_neigh_cleanup(rpriv); } -static void mlx5e_rep_enable(struct mlx5e_priv *priv) +static int mlx5e_rep_enable(struct mlx5e_priv *priv) { mlx5e_set_netdev_mtu_boundaries(priv); + + return 0; } static void mlx5e_rep_disable(struct mlx5e_priv *priv) @@ -1322,7 +1324,7 @@ static int uplink_rep_async_event(struct notifier_block *nb, unsigned long event return NOTIFY_DONE; } -static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv) +static int mlx5e_uplink_rep_enable(struct mlx5e_priv *priv) { struct net_device *netdev = priv->netdev; struct mlx5_core_dev *mdev = priv->mdev; @@ -1357,6 +1359,8 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv) netdev_unlock(netdev); netif_device_attach(netdev); rtnl_unlock(); + + return 0; } static void mlx5e_uplink_rep_disable(struct mlx5e_priv *priv)