Skip to content

Commit 381978d

Browse files
Tariq ToukanSaeed Mahameed
authored andcommitted
net/mlx5e: Create single netdev per SD group
Integrate the SD library calls into the auxiliary_driver ops in preparation for creating a single netdev for the multiple PFs belonging to the same SD group. SD is still disabled at this stage. It is enabled by a downstream patch when all needed parts are implemented. The netdev is created whenever the SD group, with all its participants, are ready. It is later destroyed whenever any of the participating PFs drops. Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Gal Pressman <gal@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent 4375130 commit 381978d

File tree

1 file changed

+62
-7
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+62
-7
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
#include "qos.h"
7171
#include "en/trap.h"
7272
#include "lib/devcom.h"
73+
#include "lib/sd.h"
7374

7475
bool mlx5e_check_fragmented_striding_rq_cap(struct mlx5_core_dev *mdev, u8 page_shift,
7576
enum mlx5e_mpwrq_umr_mode umr_mode)
@@ -5987,7 +5988,7 @@ void mlx5e_destroy_netdev(struct mlx5e_priv *priv)
59875988
free_netdev(netdev);
59885989
}
59895990

5990-
static int mlx5e_resume(struct auxiliary_device *adev)
5991+
static int _mlx5e_resume(struct auxiliary_device *adev)
59915992
{
59925993
struct mlx5_adev *edev = container_of(adev, struct mlx5_adev, adev);
59935994
struct mlx5e_dev *mlx5e_dev = auxiliary_get_drvdata(adev);
@@ -6012,6 +6013,23 @@ static int mlx5e_resume(struct auxiliary_device *adev)
60126013
return 0;
60136014
}
60146015

6016+
static int mlx5e_resume(struct auxiliary_device *adev)
6017+
{
6018+
struct mlx5_adev *edev = container_of(adev, struct mlx5_adev, adev);
6019+
struct mlx5_core_dev *mdev = edev->mdev;
6020+
struct auxiliary_device *actual_adev;
6021+
int err;
6022+
6023+
err = mlx5_sd_init(mdev);
6024+
if (err)
6025+
return err;
6026+
6027+
actual_adev = mlx5_sd_get_adev(mdev, adev, edev->idx);
6028+
if (actual_adev)
6029+
return _mlx5e_resume(actual_adev);
6030+
return 0;
6031+
}
6032+
60156033
static int _mlx5e_suspend(struct auxiliary_device *adev)
60166034
{
60176035
struct mlx5e_dev *mlx5e_dev = auxiliary_get_drvdata(adev);
@@ -6032,7 +6050,17 @@ static int _mlx5e_suspend(struct auxiliary_device *adev)
60326050

60336051
static int mlx5e_suspend(struct auxiliary_device *adev, pm_message_t state)
60346052
{
6035-
return _mlx5e_suspend(adev);
6053+
struct mlx5_adev *edev = container_of(adev, struct mlx5_adev, adev);
6054+
struct mlx5_core_dev *mdev = edev->mdev;
6055+
struct auxiliary_device *actual_adev;
6056+
int err = 0;
6057+
6058+
actual_adev = mlx5_sd_get_adev(mdev, adev, edev->idx);
6059+
if (actual_adev)
6060+
err = _mlx5e_suspend(actual_adev);
6061+
6062+
mlx5_sd_cleanup(mdev);
6063+
return err;
60366064
}
60376065

60386066
static int _mlx5e_probe(struct auxiliary_device *adev)
@@ -6078,9 +6106,9 @@ static int _mlx5e_probe(struct auxiliary_device *adev)
60786106
goto err_destroy_netdev;
60796107
}
60806108

6081-
err = mlx5e_resume(adev);
6109+
err = _mlx5e_resume(adev);
60826110
if (err) {
6083-
mlx5_core_err(mdev, "mlx5e_resume failed, %d\n", err);
6111+
mlx5_core_err(mdev, "_mlx5e_resume failed, %d\n", err);
60846112
goto err_profile_cleanup;
60856113
}
60866114

@@ -6111,15 +6139,29 @@ static int _mlx5e_probe(struct auxiliary_device *adev)
61116139
static int mlx5e_probe(struct auxiliary_device *adev,
61126140
const struct auxiliary_device_id *id)
61136141
{
6114-
return _mlx5e_probe(adev);
6142+
struct mlx5_adev *edev = container_of(adev, struct mlx5_adev, adev);
6143+
struct mlx5_core_dev *mdev = edev->mdev;
6144+
struct auxiliary_device *actual_adev;
6145+
int err;
6146+
6147+
err = mlx5_sd_init(mdev);
6148+
if (err)
6149+
return err;
6150+
6151+
actual_adev = mlx5_sd_get_adev(mdev, adev, edev->idx);
6152+
if (actual_adev)
6153+
return _mlx5e_probe(actual_adev);
6154+
return 0;
61156155
}
61166156

6117-
static void mlx5e_remove(struct auxiliary_device *adev)
6157+
static void _mlx5e_remove(struct auxiliary_device *adev)
61186158
{
6159+
struct mlx5_adev *edev = container_of(adev, struct mlx5_adev, adev);
61196160
struct mlx5e_dev *mlx5e_dev = auxiliary_get_drvdata(adev);
61206161
struct mlx5e_priv *priv = mlx5e_dev->priv;
6162+
struct mlx5_core_dev *mdev = edev->mdev;
61216163

6122-
mlx5_core_uplink_netdev_set(priv->mdev, NULL);
6164+
mlx5_core_uplink_netdev_set(mdev, NULL);
61236165
mlx5e_dcbnl_delete_app(priv);
61246166
unregister_netdev(priv->netdev);
61256167
_mlx5e_suspend(adev);
@@ -6129,6 +6171,19 @@ static void mlx5e_remove(struct auxiliary_device *adev)
61296171
mlx5e_destroy_devlink(mlx5e_dev);
61306172
}
61316173

6174+
static void mlx5e_remove(struct auxiliary_device *adev)
6175+
{
6176+
struct mlx5_adev *edev = container_of(adev, struct mlx5_adev, adev);
6177+
struct mlx5_core_dev *mdev = edev->mdev;
6178+
struct auxiliary_device *actual_adev;
6179+
6180+
actual_adev = mlx5_sd_get_adev(mdev, adev, edev->idx);
6181+
if (actual_adev)
6182+
_mlx5e_remove(actual_adev);
6183+
6184+
mlx5_sd_cleanup(mdev);
6185+
}
6186+
61326187
static const struct auxiliary_device_id mlx5e_id_table[] = {
61336188
{ .name = MLX5_ADEV_NAME ".eth", },
61346189
{},

0 commit comments

Comments
 (0)