Commit 4bbd1a19 authored by Ron Mercer's avatar Ron Mercer Committed by David S. Miller
Browse files

qlge: Add check for eeh failure when closing device.



Fix crash where resources are freed twice on an eeh recovery failure.
If eeh recovery fails we set a flag to indicate to close() that
resources have been freed.
Signed-off-by: default avatarRon Mercer <ron.mercer@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a112fd4c
...@@ -2005,6 +2005,7 @@ enum { ...@@ -2005,6 +2005,7 @@ enum {
QL_SELFTEST = 9, QL_SELFTEST = 9,
QL_LB_LINK_UP = 10, QL_LB_LINK_UP = 10,
QL_FRC_COREDUMP = 11, QL_FRC_COREDUMP = 11,
QL_EEH_FATAL = 12,
}; };
/* link_status bit definitions */ /* link_status bit definitions */
......
...@@ -3929,6 +3929,16 @@ static int qlge_close(struct net_device *ndev) ...@@ -3929,6 +3929,16 @@ static int qlge_close(struct net_device *ndev)
{ {
struct ql_adapter *qdev = netdev_priv(ndev); struct ql_adapter *qdev = netdev_priv(ndev);
/* If we hit pci_channel_io_perm_failure
* failure condition, then we already
* brought the adapter down.
*/
if (test_bit(QL_EEH_FATAL, &qdev->flags)) {
QPRINTK(qdev, DRV, ERR, "EEH fatal did unload.\n");
clear_bit(QL_EEH_FATAL, &qdev->flags);
return 0;
}
/* /*
* Wait for device to recover from a reset. * Wait for device to recover from a reset.
* (Rarely happens, but possible.) * (Rarely happens, but possible.)
...@@ -4677,6 +4687,7 @@ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev, ...@@ -4677,6 +4687,7 @@ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev,
enum pci_channel_state state) enum pci_channel_state state)
{ {
struct net_device *ndev = pci_get_drvdata(pdev); struct net_device *ndev = pci_get_drvdata(pdev);
struct ql_adapter *qdev = netdev_priv(ndev);
switch (state) { switch (state) {
case pci_channel_io_normal: case pci_channel_io_normal:
...@@ -4690,6 +4701,8 @@ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev, ...@@ -4690,6 +4701,8 @@ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev,
case pci_channel_io_perm_failure: case pci_channel_io_perm_failure:
dev_err(&pdev->dev, dev_err(&pdev->dev,
"%s: pci_channel_io_perm_failure.\n", __func__); "%s: pci_channel_io_perm_failure.\n", __func__);
ql_eeh_close(ndev);
set_bit(QL_EEH_FATAL, &qdev->flags);
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
} }
...@@ -4720,6 +4733,7 @@ static pci_ers_result_t qlge_io_slot_reset(struct pci_dev *pdev) ...@@ -4720,6 +4733,7 @@ static pci_ers_result_t qlge_io_slot_reset(struct pci_dev *pdev)
if (ql_adapter_reset(qdev)) { if (ql_adapter_reset(qdev)) {
QPRINTK(qdev, DRV, ERR, "reset FAILED!\n"); QPRINTK(qdev, DRV, ERR, "reset FAILED!\n");
set_bit(QL_EEH_FATAL, &qdev->flags);
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment