Commit 1babbad4 authored by Padmanabh Ratnakar's avatar Padmanabh Ratnakar Committed by David S. Miller

be2net: Fix Lancer error recovery

After error is detected, wait for adapter to move to ready state
before destroying queues and cleanup of other resources. Also
skip performing any cleanup for non-Lancer chips and move debug
messages to correct routine.
Signed-off-by: default avatarPadmanabh Ratnakar <padmanabh.ratnakar@broadcom.com>
Signed-off-by: default avatarSriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2e365b1b
...@@ -4859,21 +4859,27 @@ static int be_resume(struct be_adapter *adapter) ...@@ -4859,21 +4859,27 @@ static int be_resume(struct be_adapter *adapter)
static int be_err_recover(struct be_adapter *adapter) static int be_err_recover(struct be_adapter *adapter)
{ {
struct device *dev = &adapter->pdev->dev;
int status; int status;
/* Error recovery is supported only Lancer as of now */
if (!lancer_chip(adapter))
return -EIO;
/* Wait for adapter to reach quiescent state before
* destroying queues
*/
status = be_fw_wait_ready(adapter);
if (status)
goto err;
be_cleanup(adapter);
status = be_resume(adapter); status = be_resume(adapter);
if (status) if (status)
goto err; goto err;
dev_info(dev, "Adapter recovery successful\n");
return 0; return 0;
err: err:
if (be_physfn(adapter))
dev_err(dev, "Adapter recovery failed\n");
else
dev_err(dev, "Re-trying adapter recovery\n");
return status; return status;
} }
...@@ -4882,21 +4888,32 @@ static void be_err_detection_task(struct work_struct *work) ...@@ -4882,21 +4888,32 @@ static void be_err_detection_task(struct work_struct *work)
struct be_adapter *adapter = struct be_adapter *adapter =
container_of(work, struct be_adapter, container_of(work, struct be_adapter,
be_err_detection_work.work); be_err_detection_work.work);
int status = 0; struct device *dev = &adapter->pdev->dev;
int recovery_status;
be_detect_error(adapter); be_detect_error(adapter);
if (be_check_error(adapter, BE_ERROR_HW)) { if (be_check_error(adapter, BE_ERROR_HW))
be_cleanup(adapter); recovery_status = be_err_recover(adapter);
else
/* As of now error recovery support is in Lancer only */ goto reschedule_task;
if (lancer_chip(adapter))
status = be_err_recover(adapter); if (!recovery_status) {
dev_info(dev, "Adapter recovery successful\n");
goto reschedule_task;
} else if (be_virtfn(adapter)) {
/* For VFs, check if PF have allocated resources
* every second.
*/
dev_err(dev, "Re-trying adapter recovery\n");
goto reschedule_task;
} else {
dev_err(dev, "Adapter recovery failed\n");
} }
/* Always attempt recovery on VFs */ return;
if (!status || be_virtfn(adapter)) reschedule_task:
be_schedule_err_detection(adapter); be_schedule_err_detection(adapter);
} }
static void be_log_sfp_info(struct be_adapter *adapter) static void be_log_sfp_info(struct be_adapter *adapter)
......
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