Commit 8b7372c1 authored by Ganesh Goudar's avatar Ganesh Goudar Committed by David S. Miller

cxgb4: notify fatal error to uld drivers

notify uld drivers if the adapter encounters fatal
error.
Signed-off-by: default avatarGanesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ce627a1b
...@@ -1217,6 +1217,7 @@ static int c4iw_uld_state_change(void *handle, enum cxgb4_state new_state) ...@@ -1217,6 +1217,7 @@ static int c4iw_uld_state_change(void *handle, enum cxgb4_state new_state)
if (ctx->dev) if (ctx->dev)
c4iw_remove(ctx); c4iw_remove(ctx);
break; break;
case CXGB4_STATE_FATAL_ERROR:
case CXGB4_STATE_START_RECOVERY: case CXGB4_STATE_START_RECOVERY:
pr_info("%s: Fatal Error\n", pci_name(ctx->lldi.pdev)); pr_info("%s: Fatal Error\n", pci_name(ctx->lldi.pdev));
if (ctx->dev) { if (ctx->dev) {
......
...@@ -917,6 +917,7 @@ struct adapter { ...@@ -917,6 +917,7 @@ struct adapter {
struct work_struct tid_release_task; struct work_struct tid_release_task;
struct work_struct db_full_task; struct work_struct db_full_task;
struct work_struct db_drop_task; struct work_struct db_drop_task;
struct work_struct fatal_err_notify_task;
bool tid_release_task_busy; bool tid_release_task_busy;
/* lock for mailbox cmd list */ /* lock for mailbox cmd list */
......
...@@ -3255,6 +3255,14 @@ static const struct ethtool_ops cxgb4_mgmt_ethtool_ops = { ...@@ -3255,6 +3255,14 @@ static const struct ethtool_ops cxgb4_mgmt_ethtool_ops = {
.get_drvinfo = cxgb4_mgmt_get_drvinfo, .get_drvinfo = cxgb4_mgmt_get_drvinfo,
}; };
static void notify_fatal_err(struct work_struct *work)
{
struct adapter *adap;
adap = container_of(work, struct adapter, fatal_err_notify_task);
notify_ulds(adap, CXGB4_STATE_FATAL_ERROR);
}
void t4_fatal_err(struct adapter *adap) void t4_fatal_err(struct adapter *adap)
{ {
int port; int port;
...@@ -3279,6 +3287,7 @@ void t4_fatal_err(struct adapter *adap) ...@@ -3279,6 +3287,7 @@ void t4_fatal_err(struct adapter *adap)
netif_carrier_off(dev); netif_carrier_off(dev);
} }
dev_alert(adap->pdev_dev, "encountered fatal error, adapter stopped\n"); dev_alert(adap->pdev_dev, "encountered fatal error, adapter stopped\n");
queue_work(adap->workq, &adap->fatal_err_notify_task);
} }
static void setup_memwin(struct adapter *adap) static void setup_memwin(struct adapter *adap)
...@@ -5479,6 +5488,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -5479,6 +5488,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
INIT_WORK(&adapter->tid_release_task, process_tid_release_list); INIT_WORK(&adapter->tid_release_task, process_tid_release_list);
INIT_WORK(&adapter->db_full_task, process_db_full); INIT_WORK(&adapter->db_full_task, process_db_full);
INIT_WORK(&adapter->db_drop_task, process_db_drop); INIT_WORK(&adapter->db_drop_task, process_db_drop);
INIT_WORK(&adapter->fatal_err_notify_task, notify_fatal_err);
err = t4_prep_adapter(adapter); err = t4_prep_adapter(adapter);
if (err) if (err)
......
...@@ -257,7 +257,8 @@ enum cxgb4_state { ...@@ -257,7 +257,8 @@ enum cxgb4_state {
CXGB4_STATE_UP, CXGB4_STATE_UP,
CXGB4_STATE_START_RECOVERY, CXGB4_STATE_START_RECOVERY,
CXGB4_STATE_DOWN, CXGB4_STATE_DOWN,
CXGB4_STATE_DETACH CXGB4_STATE_DETACH,
CXGB4_STATE_FATAL_ERROR
}; };
enum cxgb4_control { enum cxgb4_control {
......
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