cxgb4: notify fatal error to uld drivers
authorGanesh Goudar <ganeshgr@chelsio.com>
Fri, 16 Mar 2018 08:52:57 +0000 (14:22 +0530)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Mar 2018 18:46:57 +0000 (14:46 -0400)
notify uld drivers if the adapter encounters fatal
error.

Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/infiniband/hw/cxgb4/device.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h

index 7a9d0de89d6a3f1afc0560a08e43918a2f539c1c..e96771ddc9a7274ba4174c3c68206be1626cd10d 100644 (file)
@@ -1217,6 +1217,7 @@ static int c4iw_uld_state_change(void *handle, enum cxgb4_state new_state)
                if (ctx->dev)
                        c4iw_remove(ctx);
                break;
+       case CXGB4_STATE_FATAL_ERROR:
        case CXGB4_STATE_START_RECOVERY:
                pr_info("%s: Fatal Error\n", pci_name(ctx->lldi.pdev));
                if (ctx->dev) {
index b2df0ffb7c9487c88ec21dc7733995777d35afef..a5c0a649f3c7a22b3949dccd36f07f8b5de4b212 100644 (file)
@@ -917,6 +917,7 @@ struct adapter {
        struct work_struct tid_release_task;
        struct work_struct db_full_task;
        struct work_struct db_drop_task;
+       struct work_struct fatal_err_notify_task;
        bool tid_release_task_busy;
 
        /* lock for mailbox cmd list */
index 5a349e1576cbfa42a8f023ea3f53aca3d7437d98..72ec3f7dccbb9507e3a0f6b688e3f31470e59329 100644 (file)
@@ -3255,6 +3255,14 @@ static const struct ethtool_ops cxgb4_mgmt_ethtool_ops = {
        .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)
 {
        int port;
@@ -3279,6 +3287,7 @@ void t4_fatal_err(struct adapter *adap)
                netif_carrier_off(dev);
        }
        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)
@@ -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->db_full_task, process_db_full);
        INIT_WORK(&adapter->db_drop_task, process_db_drop);
+       INIT_WORK(&adapter->fatal_err_notify_task, notify_fatal_err);
 
        err = t4_prep_adapter(adapter);
        if (err)
index a14e8db51cdc17c1e091eb4e18746f50193200f1..788146c081514abadb7c470c27f00334e67d7e8c 100644 (file)
@@ -257,7 +257,8 @@ enum cxgb4_state {
        CXGB4_STATE_UP,
        CXGB4_STATE_START_RECOVERY,
        CXGB4_STATE_DOWN,
-       CXGB4_STATE_DETACH
+       CXGB4_STATE_DETACH,
+       CXGB4_STATE_FATAL_ERROR
 };
 
 enum cxgb4_control {