net/mlx5: Do not query pci info while pci disabled
authorRoy Novich <royno@nvidia.com>
Sun, 24 Jul 2022 06:49:07 +0000 (09:49 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:41:05 +0000 (17:41 +0100)
[ Upstream commit 394164f9d5a3020a7fd719d228386d48d544ec67 ]

The driver should not interact with PCI while PCI is disabled. Trying to
do so may result in being unable to get vital signs during PCI reset,
driver gets timed out and fails to recover.

Fixes: fad1783a6d66 ("net/mlx5: Print more info on pci error handlers")
Signed-off-by: Roy Novich <royno@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Aya Levin <ayal@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/main.c

index d092261e96c3402c7811c4eea742b2a46a77d0eb..19c11d33f4b684062de11af7dee78aee376a1eaa 100644 (file)
@@ -1608,7 +1608,8 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
        res = state == pci_channel_io_perm_failure ?
                PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_NEED_RESET;
 
-       mlx5_pci_trace(dev, "Exit, result = %d, %s\n",  res, result2str(res));
+       mlx5_core_info(dev, "%s Device state = %d pci_status: %d. Exit, result = %d, %s\n",
+                      __func__, dev->state, dev->pci_status, res, result2str(res));
        return res;
 }
 
@@ -1647,7 +1648,8 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev)
        struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
        int err;
 
-       mlx5_pci_trace(dev, "Enter\n");
+       mlx5_core_info(dev, "%s Device state = %d pci_status: %d. Enter\n",
+                      __func__, dev->state, dev->pci_status);
 
        err = mlx5_pci_enable_device(dev);
        if (err) {
@@ -1669,7 +1671,8 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev)
 
        res = PCI_ERS_RESULT_RECOVERED;
 out:
-       mlx5_pci_trace(dev, "Exit, err = %d, result = %d, %s\n", err, res, result2str(res));
+       mlx5_core_info(dev, "%s Device state = %d pci_status: %d. Exit, err = %d, result = %d, %s\n",
+                      __func__, dev->state, dev->pci_status, err, res, result2str(res));
        return res;
 }