Skip to content

Commit 72ed5d5

Browse files
Jiri PirkoSaeed Mahameed
authored andcommitted
net/mlx5: Suspend auxiliary devices only in case of PCI device suspend
The original behavior introduced by commit c6acd62 ("net/mlx5e: Add support for devlink-port in non-representors mode") correctly re-instantiated uplink devlink port and related netdevice during devlink reload. However with migration to auxiliary devices, this behaviour changed. Restore the original behaviour and tear down auxiliary devices completely during devlink reload. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 5977ac3 commit 72ed5d5

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ int mlx5_attach_device(struct mlx5_core_dev *dev)
396396
return ret;
397397
}
398398

399-
void mlx5_detach_device(struct mlx5_core_dev *dev)
399+
void mlx5_detach_device(struct mlx5_core_dev *dev, bool suspend)
400400
{
401401
struct mlx5_priv *priv = &dev->priv;
402402
struct auxiliary_device *adev;
@@ -425,7 +425,7 @@ void mlx5_detach_device(struct mlx5_core_dev *dev)
425425

426426
adrv = to_auxiliary_drv(adev->dev.driver);
427427

428-
if (adrv->suspend) {
428+
if (adrv->suspend && suspend) {
429429
adrv->suspend(adev, pm);
430430
continue;
431431
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static int mlx5_devlink_reload_fw_activate(struct devlink *devlink, struct netli
105105
if (err)
106106
return err;
107107

108-
mlx5_unload_one_devl_locked(dev);
108+
mlx5_unload_one_devl_locked(dev, true);
109109
err = mlx5_health_wait_pci_up(dev);
110110
if (err)
111111
NL_SET_ERR_MSG_MOD(extack, "FW activate aborted, PCI reads fail after reset");
@@ -168,7 +168,7 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change,
168168

169169
switch (action) {
170170
case DEVLINK_RELOAD_ACTION_DRIVER_REINIT:
171-
mlx5_unload_one_devl_locked(dev);
171+
mlx5_unload_one_devl_locked(dev, false);
172172
break;
173173
case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
174174
if (limit == DEVLINK_RELOAD_LIMIT_NO_RESET)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev)
163163
if (test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags)) {
164164
complete(&fw_reset->done);
165165
} else {
166-
mlx5_unload_one(dev);
166+
mlx5_unload_one(dev, false);
167167
if (mlx5_health_wait_pci_up(dev))
168168
mlx5_core_err(dev, "reset reload flow aborted, PCI reads still not working\n");
169169
else
@@ -498,7 +498,7 @@ int mlx5_fw_reset_wait_reset_done(struct mlx5_core_dev *dev)
498498
}
499499
err = fw_reset->ret;
500500
if (test_and_clear_bit(MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED, &fw_reset->reset_flags)) {
501-
mlx5_unload_one_devl_locked(dev);
501+
mlx5_unload_one_devl_locked(dev, false);
502502
mlx5_load_one_devl_locked(dev, false);
503503
}
504504
out:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ static void mlx5_fw_fatal_reporter_err_work(struct work_struct *work)
699699
* requests from the kernel.
700700
*/
701701
mlx5_core_err(dev, "Driver is in error state. Unloading\n");
702-
mlx5_unload_one(dev);
702+
mlx5_unload_one(dev, false);
703703
}
704704
}
705705

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,12 +1520,12 @@ int mlx5_load_one(struct mlx5_core_dev *dev)
15201520
return ret;
15211521
}
15221522

1523-
void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev)
1523+
void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev, bool suspend)
15241524
{
15251525
devl_assert_locked(priv_to_devlink(dev));
15261526
mutex_lock(&dev->intf_state_mutex);
15271527

1528-
mlx5_detach_device(dev);
1528+
mlx5_detach_device(dev, suspend);
15291529

15301530
if (!test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) {
15311531
mlx5_core_warn(dev, "%s: interface is down, NOP\n",
@@ -1540,12 +1540,12 @@ void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev)
15401540
mutex_unlock(&dev->intf_state_mutex);
15411541
}
15421542

1543-
void mlx5_unload_one(struct mlx5_core_dev *dev)
1543+
void mlx5_unload_one(struct mlx5_core_dev *dev, bool suspend)
15441544
{
15451545
struct devlink *devlink = priv_to_devlink(dev);
15461546

15471547
devl_lock(devlink);
1548-
mlx5_unload_one_devl_locked(dev);
1548+
mlx5_unload_one_devl_locked(dev, suspend);
15491549
devl_unlock(devlink);
15501550
}
15511551

@@ -1830,7 +1830,7 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
18301830

18311831
mlx5_enter_error_state(dev, false);
18321832
mlx5_error_sw_reset(dev);
1833-
mlx5_unload_one(dev);
1833+
mlx5_unload_one(dev, true);
18341834
mlx5_drain_health_wq(dev);
18351835
mlx5_pci_disable_device(dev);
18361836

@@ -1986,15 +1986,15 @@ static void shutdown(struct pci_dev *pdev)
19861986
set_bit(MLX5_BREAK_FW_WAIT, &dev->intf_state);
19871987
err = mlx5_try_fast_unload(dev);
19881988
if (err)
1989-
mlx5_unload_one(dev);
1989+
mlx5_unload_one(dev, false);
19901990
mlx5_pci_disable_device(dev);
19911991
}
19921992

19931993
static int mlx5_suspend(struct pci_dev *pdev, pm_message_t state)
19941994
{
19951995
struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
19961996

1997-
mlx5_unload_one(dev);
1997+
mlx5_unload_one(dev, true);
19981998

19991999
return 0;
20002000
}
@@ -2037,7 +2037,7 @@ MODULE_DEVICE_TABLE(pci, mlx5_core_pci_table);
20372037
void mlx5_disable_device(struct mlx5_core_dev *dev)
20382038
{
20392039
mlx5_error_sw_reset(dev);
2040-
mlx5_unload_one_devl_locked(dev);
2040+
mlx5_unload_one_devl_locked(dev, false);
20412041
}
20422042

20432043
int mlx5_recover_device(struct mlx5_core_dev *dev)

drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void mlx5_adev_cleanup(struct mlx5_core_dev *dev);
236236
int mlx5_adev_init(struct mlx5_core_dev *dev);
237237

238238
int mlx5_attach_device(struct mlx5_core_dev *dev);
239-
void mlx5_detach_device(struct mlx5_core_dev *dev);
239+
void mlx5_detach_device(struct mlx5_core_dev *dev, bool suspend);
240240
int mlx5_register_device(struct mlx5_core_dev *dev);
241241
void mlx5_unregister_device(struct mlx5_core_dev *dev);
242242
struct mlx5_core_dev *mlx5_get_next_phys_dev_lag(struct mlx5_core_dev *dev);
@@ -319,8 +319,8 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx);
319319
void mlx5_mdev_uninit(struct mlx5_core_dev *dev);
320320
int mlx5_init_one(struct mlx5_core_dev *dev);
321321
void mlx5_uninit_one(struct mlx5_core_dev *dev);
322-
void mlx5_unload_one(struct mlx5_core_dev *dev);
323-
void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev);
322+
void mlx5_unload_one(struct mlx5_core_dev *dev, bool suspend);
323+
void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev, bool suspend);
324324
int mlx5_load_one(struct mlx5_core_dev *dev);
325325
int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery);
326326

drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static void mlx5_sf_dev_shutdown(struct auxiliary_device *adev)
7474
{
7575
struct mlx5_sf_dev *sf_dev = container_of(adev, struct mlx5_sf_dev, adev);
7676

77-
mlx5_unload_one(sf_dev->mdev);
77+
mlx5_unload_one(sf_dev->mdev, false);
7878
}
7979

8080
static const struct auxiliary_device_id mlx5_sf_dev_id_table[] = {

0 commit comments

Comments
 (0)