cxgb3: Notify fatal errors
authorDivy Le Ray <divy@chelsio.com>
Tue, 27 Jan 2009 06:21:59 +0000 (22:21 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Jan 2009 06:21:59 +0000 (22:21 -0800)
Set up a notification mechanism to inform upper layer modules
(iWARP, iSCSI) of a chip reset due to an EEH event or a fatal error.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/cxgb3/cxgb3_main.c
drivers/net/cxgb3/cxgb3_offload.c
drivers/net/cxgb3/cxgb3_offload.h

index 7381f378b4e6c8dd863a07f6edd5f298815af066..f2c7cc3e263afffade80281415ff1f560bf7d6a2 100644 (file)
@@ -2542,6 +2542,12 @@ static int t3_adapter_error(struct adapter *adapter, int reset)
 {
        int i, ret = 0;
 
+       if (is_offload(adapter) &&
+           test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map)) {
+               cxgb3_err_notify(&adapter->tdev, OFFLOAD_STATUS_DOWN, 0);
+               offload_close(&adapter->tdev);
+       }
+
        /* Stop all ports */
        for_each_port(adapter, i) {
                struct net_device *netdev = adapter->port[i];
@@ -2550,10 +2556,6 @@ static int t3_adapter_error(struct adapter *adapter, int reset)
                        cxgb_close(netdev);
        }
 
-       if (is_offload(adapter) &&
-           test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map))
-               offload_close(&adapter->tdev);
-
        /* Stop SGE timers */
        t3_stop_sge_timers(adapter);
 
@@ -2605,6 +2607,9 @@ static void t3_resume_ports(struct adapter *adapter)
                        }
                }
        }
+
+       if (is_offload(adapter) && !ofld_disable)
+               cxgb3_err_notify(&adapter->tdev, OFFLOAD_STATUS_UP, 0);
 }
 
 /*
index 2d7f69aff1d949a47e952997932800593444338e..620d80be6aacb1d3806d3f42f786c9f5b52bc6a3 100644 (file)
@@ -153,6 +153,18 @@ void cxgb3_remove_clients(struct t3cdev *tdev)
        mutex_unlock(&cxgb3_db_lock);
 }
 
+void cxgb3_err_notify(struct t3cdev *tdev, u32 status, u32 error)
+{
+       struct cxgb3_client *client;
+
+       mutex_lock(&cxgb3_db_lock);
+       list_for_each_entry(client, &client_list, client_list) {
+               if (client->err_handler)
+                       client->err_handler(tdev, status, error);
+       }
+       mutex_unlock(&cxgb3_db_lock);
+}
+
 static struct net_device *get_iff_from_mac(struct adapter *adapter,
                                           const unsigned char *mac,
                                           unsigned int vlan)
index d514e5019dfc36b0935bace2be32056b0ee4f272..a8e8e5fcdf84d55c5daa3aafd0f4d1081cab4f5a 100644 (file)
@@ -64,10 +64,16 @@ void cxgb3_register_client(struct cxgb3_client *client);
 void cxgb3_unregister_client(struct cxgb3_client *client);
 void cxgb3_add_clients(struct t3cdev *tdev);
 void cxgb3_remove_clients(struct t3cdev *tdev);
+void cxgb3_err_notify(struct t3cdev *tdev, u32 status, u32 error);
 
 typedef int (*cxgb3_cpl_handler_func)(struct t3cdev *dev,
                                      struct sk_buff *skb, void *ctx);
 
+enum {
+       OFFLOAD_STATUS_UP,
+       OFFLOAD_STATUS_DOWN
+};
+
 struct cxgb3_client {
        char *name;
        void (*add) (struct t3cdev *);
@@ -76,6 +82,7 @@ struct cxgb3_client {
        int (*redirect)(void *ctx, struct dst_entry *old,
                        struct dst_entry *new, struct l2t_entry *l2t);
        struct list_head client_list;
+       void (*err_handler)(struct t3cdev *tdev, u32 status, u32 error);
 };
 
 /*