Skip to content

Commit ade4794

Browse files
Amir Tzinkuba-moo
authored andcommitted
net/mlx5: fw reset, check bridge accessibility at earlier stage
Currently, mlx5_is_reset_now_capable() checks whether the pci bridge is accessible only on bridge hot plug capability check. If the pci bridge is not accessible, reset now will fail regardless of bridge hotplug capability. Move this check to function mlx5_is_reset_now_capable() which, in such case, aborts the reset and does so in the request phase instead of the reset now phase. Signed-off-by: Aya Levin <ayal@nvidia.com> Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Signed-off-by: Amir Tzin <amirtz@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/1742392983-153050-3-git-send-email-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 16ad839 commit ade4794

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,12 @@ static void mlx5_fw_live_patch_event(struct work_struct *work)
345345
}
346346

347347
#if IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE)
348-
static int mlx5_check_hotplug_interrupt(struct mlx5_core_dev *dev)
348+
static int mlx5_check_hotplug_interrupt(struct mlx5_core_dev *dev,
349+
struct pci_dev *bridge)
349350
{
350-
struct pci_dev *bridge = dev->pdev->bus->self;
351351
u16 reg16;
352352
int err;
353353

354-
if (!bridge)
355-
return -EOPNOTSUPP;
356-
357354
err = pcie_capability_read_word(bridge, PCI_EXP_SLTCTL, &reg16);
358355
if (err)
359356
return err;
@@ -416,17 +413,23 @@ static int mlx5_check_dev_ids(struct mlx5_core_dev *dev, u16 dev_id)
416413
static bool mlx5_is_reset_now_capable(struct mlx5_core_dev *dev,
417414
u8 reset_method)
418415
{
416+
struct pci_dev *bridge = dev->pdev->bus->self;
419417
u16 dev_id;
420418
int err;
421419

420+
if (!bridge) {
421+
mlx5_core_warn(dev, "PCI bus bridge is not accessible\n");
422+
return false;
423+
}
424+
422425
if (!MLX5_CAP_GEN(dev, fast_teardown)) {
423426
mlx5_core_warn(dev, "fast teardown is not supported by firmware\n");
424427
return false;
425428
}
426429

427430
#if IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE)
428431
if (reset_method != MLX5_MFRL_REG_PCI_RESET_METHOD_HOT_RESET) {
429-
err = mlx5_check_hotplug_interrupt(dev);
432+
err = mlx5_check_hotplug_interrupt(dev, bridge);
430433
if (err)
431434
return false;
432435
}

0 commit comments

Comments
 (0)