aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3
diff options
context:
space:
mode:
authorDivy Le Ray <divy@chelsio.com>2009-01-27 01:21:59 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-27 01:21:59 -0500
commitcb0bc205959bf8c60acae9c71f3da0597e756f8e (patch)
treeb17980de266cf103d14cea0152fa37cffe45dba0 /drivers/net/cxgb3
parent1373c0fdbc5b477f5597a3ca9f2c782f15b56886 (diff)
cxgb3: Notify fatal errors
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>
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c13
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c12
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.h7
3 files changed, 28 insertions, 4 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 7381f378b4e6..f2c7cc3e263a 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2542,6 +2542,12 @@ static int t3_adapter_error(struct adapter *adapter, int reset)
2542{ 2542{
2543 int i, ret = 0; 2543 int i, ret = 0;
2544 2544
2545 if (is_offload(adapter) &&
2546 test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map)) {
2547 cxgb3_err_notify(&adapter->tdev, OFFLOAD_STATUS_DOWN, 0);
2548 offload_close(&adapter->tdev);
2549 }
2550
2545 /* Stop all ports */ 2551 /* Stop all ports */
2546 for_each_port(adapter, i) { 2552 for_each_port(adapter, i) {
2547 struct net_device *netdev = adapter->port[i]; 2553 struct net_device *netdev = adapter->port[i];
@@ -2550,10 +2556,6 @@ static int t3_adapter_error(struct adapter *adapter, int reset)
2550 cxgb_close(netdev); 2556 cxgb_close(netdev);
2551 } 2557 }
2552 2558
2553 if (is_offload(adapter) &&
2554 test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map))
2555 offload_close(&adapter->tdev);
2556
2557 /* Stop SGE timers */ 2559 /* Stop SGE timers */
2558 t3_stop_sge_timers(adapter); 2560 t3_stop_sge_timers(adapter);
2559 2561
@@ -2605,6 +2607,9 @@ static void t3_resume_ports(struct adapter *adapter)
2605 } 2607 }
2606 } 2608 }
2607 } 2609 }
2610
2611 if (is_offload(adapter) && !ofld_disable)
2612 cxgb3_err_notify(&adapter->tdev, OFFLOAD_STATUS_UP, 0);
2608} 2613}
2609 2614
2610/* 2615/*
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index 2d7f69aff1d9..620d80be6aac 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -153,6 +153,18 @@ void cxgb3_remove_clients(struct t3cdev *tdev)
153 mutex_unlock(&cxgb3_db_lock); 153 mutex_unlock(&cxgb3_db_lock);
154} 154}
155 155
156void cxgb3_err_notify(struct t3cdev *tdev, u32 status, u32 error)
157{
158 struct cxgb3_client *client;
159
160 mutex_lock(&cxgb3_db_lock);
161 list_for_each_entry(client, &client_list, client_list) {
162 if (client->err_handler)
163 client->err_handler(tdev, status, error);
164 }
165 mutex_unlock(&cxgb3_db_lock);
166}
167
156static struct net_device *get_iff_from_mac(struct adapter *adapter, 168static struct net_device *get_iff_from_mac(struct adapter *adapter,
157 const unsigned char *mac, 169 const unsigned char *mac,
158 unsigned int vlan) 170 unsigned int vlan)
diff --git a/drivers/net/cxgb3/cxgb3_offload.h b/drivers/net/cxgb3/cxgb3_offload.h
index d514e5019dfc..a8e8e5fcdf84 100644
--- a/drivers/net/cxgb3/cxgb3_offload.h
+++ b/drivers/net/cxgb3/cxgb3_offload.h
@@ -64,10 +64,16 @@ void cxgb3_register_client(struct cxgb3_client *client);
64void cxgb3_unregister_client(struct cxgb3_client *client); 64void cxgb3_unregister_client(struct cxgb3_client *client);
65void cxgb3_add_clients(struct t3cdev *tdev); 65void cxgb3_add_clients(struct t3cdev *tdev);
66void cxgb3_remove_clients(struct t3cdev *tdev); 66void cxgb3_remove_clients(struct t3cdev *tdev);
67void cxgb3_err_notify(struct t3cdev *tdev, u32 status, u32 error);
67 68
68typedef int (*cxgb3_cpl_handler_func)(struct t3cdev *dev, 69typedef int (*cxgb3_cpl_handler_func)(struct t3cdev *dev,
69 struct sk_buff *skb, void *ctx); 70 struct sk_buff *skb, void *ctx);
70 71
72enum {
73 OFFLOAD_STATUS_UP,
74 OFFLOAD_STATUS_DOWN
75};
76
71struct cxgb3_client { 77struct cxgb3_client {
72 char *name; 78 char *name;
73 void (*add) (struct t3cdev *); 79 void (*add) (struct t3cdev *);
@@ -76,6 +82,7 @@ struct cxgb3_client {
76 int (*redirect)(void *ctx, struct dst_entry *old, 82 int (*redirect)(void *ctx, struct dst_entry *old,
77 struct dst_entry *new, struct l2t_entry *l2t); 83 struct dst_entry *new, struct l2t_entry *l2t);
78 struct list_head client_list; 84 struct list_head client_list;
85 void (*err_handler)(struct t3cdev *tdev, u32 status, u32 error);
79}; 86};
80 87
81/* 88/*