Skip to content

Commit

Permalink
net/mlx5e: Create EN core HW resources for all secondary devices
Browse files Browse the repository at this point in the history
Traffic queues will be created on all devices, including the
secondaries. Create the needed core layer resources for them as well.

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
  • Loading branch information
Tariq Toukan authored and Saeed Mahameed committed Dec 21, 2023
1 parent e2578b4 commit c4fb94a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include "lib/clock.h"
#include "en/rx_res.h"
#include "en/selq.h"
#include "lib/sd.h"

extern const struct net_device_ops mlx5e_netdev_ops;
struct page_pool;
Expand Down
32 changes: 22 additions & 10 deletions drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5988,22 +5988,29 @@ static int _mlx5e_resume(struct auxiliary_device *adev)
struct mlx5e_priv *priv = mlx5e_dev->priv;
struct net_device *netdev = priv->netdev;
struct mlx5_core_dev *mdev = edev->mdev;
int err;
struct mlx5_core_dev *pos, *to;
int err, i;

if (netif_device_present(netdev))
return 0;

err = mlx5e_create_mdev_resources(mdev, true);
if (err)
return err;
mlx5_sd_for_each_dev(i, mdev, pos) {
err = mlx5e_create_mdev_resources(pos, true);
if (err)
goto err_destroy_mdev_res;
}

err = mlx5e_attach_netdev(priv);
if (err) {
mlx5e_destroy_mdev_resources(mdev);
return err;
}
if (err)
goto err_destroy_mdev_res;

return 0;

err_destroy_mdev_res:
to = pos;
mlx5_sd_for_each_dev_to(i, mdev, to, pos)
mlx5e_destroy_mdev_resources(pos);
return err;
}

static int mlx5e_resume(struct auxiliary_device *adev)
Expand All @@ -6029,15 +6036,20 @@ static int _mlx5e_suspend(struct auxiliary_device *adev)
struct mlx5e_priv *priv = mlx5e_dev->priv;
struct net_device *netdev = priv->netdev;
struct mlx5_core_dev *mdev = priv->mdev;
struct mlx5_core_dev *pos;
int i;

if (!netif_device_present(netdev)) {
if (test_bit(MLX5E_STATE_DESTROYING, &priv->state))
mlx5e_destroy_mdev_resources(mdev);
mlx5_sd_for_each_dev(i, mdev, pos)
mlx5e_destroy_mdev_resources(pos);
return -ENODEV;
}

mlx5e_detach_netdev(priv);
mlx5e_destroy_mdev_resources(mdev);
mlx5_sd_for_each_dev(i, mdev, pos)
mlx5e_destroy_mdev_resources(pos);

return 0;
}

Expand Down

0 comments on commit c4fb94a

Please sign in to comment.