aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2009-09-05 23:22:38 -0400
committerRoland Dreier <rolandd@cisco.com>2009-09-05 23:22:38 -0400
commitfa0d4c11c4b6eb49708b82b638ceb0761152f46a (patch)
tree3e1cdc905a64d532cbf7d2fa6b58413c698f6f31 /drivers
parentb496fe82d4075847a1c42efba2e81d28f6467b3a (diff)
RDMA/cxgb3: Handle port events properly
Massage the err_handler upcall into an event handler upcall, pass netdev port events to the cxgb3 ULPs and generate RDMA port events based on LLD port events. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch.c28
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c6
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c6
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.h8
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_init.c12
5 files changed, 38 insertions, 22 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch.c b/drivers/infiniband/hw/cxgb3/iwch.c
index 26fc0a4eaa74..5796170b0b25 100644
--- a/drivers/infiniband/hw/cxgb3/iwch.c
+++ b/drivers/infiniband/hw/cxgb3/iwch.c
@@ -51,7 +51,7 @@ cxgb3_cpl_handler_func t3c_handlers[NUM_CPL_CMDS];
51 51
52static void open_rnic_dev(struct t3cdev *); 52static void open_rnic_dev(struct t3cdev *);
53static void close_rnic_dev(struct t3cdev *); 53static void close_rnic_dev(struct t3cdev *);
54static void iwch_err_handler(struct t3cdev *, u32, u32); 54static void iwch_event_handler(struct t3cdev *, u32, u32);
55 55
56struct cxgb3_client t3c_client = { 56struct cxgb3_client t3c_client = {
57 .name = "iw_cxgb3", 57 .name = "iw_cxgb3",
@@ -59,7 +59,7 @@ struct cxgb3_client t3c_client = {
59 .remove = close_rnic_dev, 59 .remove = close_rnic_dev,
60 .handlers = t3c_handlers, 60 .handlers = t3c_handlers,
61 .redirect = iwch_ep_redirect, 61 .redirect = iwch_ep_redirect,
62 .err_handler = iwch_err_handler 62 .event_handler = iwch_event_handler
63}; 63};
64 64
65static LIST_HEAD(dev_list); 65static LIST_HEAD(dev_list);
@@ -162,21 +162,33 @@ static void close_rnic_dev(struct t3cdev *tdev)
162 mutex_unlock(&dev_mutex); 162 mutex_unlock(&dev_mutex);
163} 163}
164 164
165static void iwch_err_handler(struct t3cdev *tdev, u32 status, u32 error) 165static void iwch_event_handler(struct t3cdev *tdev, u32 evt, u32 port_id)
166{ 166{
167 struct cxio_rdev *rdev = tdev->ulp; 167 struct cxio_rdev *rdev = tdev->ulp;
168 struct iwch_dev *rnicp = rdev_to_iwch_dev(rdev); 168 struct iwch_dev *rnicp = rdev_to_iwch_dev(rdev);
169 struct ib_event event; 169 struct ib_event event;
170 u32 portnum = port_id + 1;
170 171
171 if (status == OFFLOAD_STATUS_DOWN) { 172 switch (evt) {
173 case OFFLOAD_STATUS_DOWN: {
172 rdev->flags = CXIO_ERROR_FATAL; 174 rdev->flags = CXIO_ERROR_FATAL;
173
174 event.device = &rnicp->ibdev;
175 event.event = IB_EVENT_DEVICE_FATAL; 175 event.event = IB_EVENT_DEVICE_FATAL;
176 event.element.port_num = 0; 176 break;
177 ib_dispatch_event(&event); 177 }
178 case OFFLOAD_PORT_DOWN: {
179 event.event = IB_EVENT_PORT_ERR;
180 break;
181 }
182 case OFFLOAD_PORT_UP: {
183 event.event = IB_EVENT_PORT_ACTIVE;
184 break;
185 }
178 } 186 }
179 187
188 event.device = &rnicp->ibdev;
189 event.element.port_num = portnum;
190 ib_dispatch_event(&event);
191
180 return; 192 return;
181} 193}
182 194
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index fb5df5c6203e..c97ab82ec743 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1286,6 +1286,7 @@ static int cxgb_open(struct net_device *dev)
1286 if (!other_ports) 1286 if (!other_ports)
1287 schedule_chk_task(adapter); 1287 schedule_chk_task(adapter);
1288 1288
1289 cxgb3_event_notify(&adapter->tdev, OFFLOAD_PORT_UP, pi->port_id);
1289 return 0; 1290 return 0;
1290} 1291}
1291 1292
@@ -1318,6 +1319,7 @@ static int cxgb_close(struct net_device *dev)
1318 if (!adapter->open_device_map) 1319 if (!adapter->open_device_map)
1319 cxgb_down(adapter); 1320 cxgb_down(adapter);
1320 1321
1322 cxgb3_event_notify(&adapter->tdev, OFFLOAD_PORT_DOWN, pi->port_id);
1321 return 0; 1323 return 0;
1322} 1324}
1323 1325
@@ -2717,7 +2719,7 @@ static int t3_adapter_error(struct adapter *adapter, int reset)
2717 2719
2718 if (is_offload(adapter) && 2720 if (is_offload(adapter) &&
2719 test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map)) { 2721 test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map)) {
2720 cxgb3_err_notify(&adapter->tdev, OFFLOAD_STATUS_DOWN, 0); 2722 cxgb3_event_notify(&adapter->tdev, OFFLOAD_STATUS_DOWN, 0);
2721 offload_close(&adapter->tdev); 2723 offload_close(&adapter->tdev);
2722 } 2724 }
2723 2725
@@ -2782,7 +2784,7 @@ static void t3_resume_ports(struct adapter *adapter)
2782 } 2784 }
2783 2785
2784 if (is_offload(adapter) && !ofld_disable) 2786 if (is_offload(adapter) && !ofld_disable)
2785 cxgb3_err_notify(&adapter->tdev, OFFLOAD_STATUS_UP, 0); 2787 cxgb3_event_notify(&adapter->tdev, OFFLOAD_STATUS_UP, 0);
2786} 2788}
2787 2789
2788/* 2790/*
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index f9f54b57b28c..75064eea1d87 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -153,14 +153,14 @@ 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) 156void cxgb3_event_notify(struct t3cdev *tdev, u32 event, u32 port)
157{ 157{
158 struct cxgb3_client *client; 158 struct cxgb3_client *client;
159 159
160 mutex_lock(&cxgb3_db_lock); 160 mutex_lock(&cxgb3_db_lock);
161 list_for_each_entry(client, &client_list, client_list) { 161 list_for_each_entry(client, &client_list, client_list) {
162 if (client->err_handler) 162 if (client->event_handler)
163 client->err_handler(tdev, status, error); 163 client->event_handler(tdev, event, port);
164 } 164 }
165 mutex_unlock(&cxgb3_db_lock); 165 mutex_unlock(&cxgb3_db_lock);
166} 166}
diff --git a/drivers/net/cxgb3/cxgb3_offload.h b/drivers/net/cxgb3/cxgb3_offload.h
index 55945f422aec..670aa62042da 100644
--- a/drivers/net/cxgb3/cxgb3_offload.h
+++ b/drivers/net/cxgb3/cxgb3_offload.h
@@ -64,14 +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); 67void cxgb3_event_notify(struct t3cdev *tdev, u32 event, u32 port);
68 68
69typedef int (*cxgb3_cpl_handler_func)(struct t3cdev *dev, 69typedef int (*cxgb3_cpl_handler_func)(struct t3cdev *dev,
70 struct sk_buff *skb, void *ctx); 70 struct sk_buff *skb, void *ctx);
71 71
72enum { 72enum {
73 OFFLOAD_STATUS_UP, 73 OFFLOAD_STATUS_UP,
74 OFFLOAD_STATUS_DOWN 74 OFFLOAD_STATUS_DOWN,
75 OFFLOAD_PORT_DOWN,
76 OFFLOAD_PORT_UP
75}; 77};
76 78
77struct cxgb3_client { 79struct cxgb3_client {
@@ -82,7 +84,7 @@ struct cxgb3_client {
82 int (*redirect)(void *ctx, struct dst_entry *old, 84 int (*redirect)(void *ctx, struct dst_entry *old,
83 struct dst_entry *new, struct l2t_entry *l2t); 85 struct dst_entry *new, struct l2t_entry *l2t);
84 struct list_head client_list; 86 struct list_head client_list;
85 void (*err_handler)(struct t3cdev *tdev, u32 status, u32 error); 87 void (*event_handler)(struct t3cdev *tdev, u32 event, u32 port);
86}; 88};
87 89
88/* 90/*
diff --git a/drivers/scsi/cxgb3i/cxgb3i_init.c b/drivers/scsi/cxgb3i/cxgb3i_init.c
index 042d9bce9914..d0ab23a58355 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_init.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_init.c
@@ -26,7 +26,7 @@ MODULE_VERSION(DRV_MODULE_VERSION);
26 26
27static void open_s3_dev(struct t3cdev *); 27static void open_s3_dev(struct t3cdev *);
28static void close_s3_dev(struct t3cdev *); 28static void close_s3_dev(struct t3cdev *);
29static void s3_err_handler(struct t3cdev *tdev, u32 status, u32 error); 29static void s3_event_handler(struct t3cdev *tdev, u32 event, u32 port);
30 30
31static cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS]; 31static cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS];
32static struct cxgb3_client t3c_client = { 32static struct cxgb3_client t3c_client = {
@@ -34,7 +34,7 @@ static struct cxgb3_client t3c_client = {
34 .handlers = cxgb3i_cpl_handlers, 34 .handlers = cxgb3i_cpl_handlers,
35 .add = open_s3_dev, 35 .add = open_s3_dev,
36 .remove = close_s3_dev, 36 .remove = close_s3_dev,
37 .err_handler = s3_err_handler, 37 .event_handler = s3_event_handler,
38}; 38};
39 39
40/** 40/**
@@ -66,16 +66,16 @@ static void close_s3_dev(struct t3cdev *t3dev)
66 cxgb3i_ddp_cleanup(t3dev); 66 cxgb3i_ddp_cleanup(t3dev);
67} 67}
68 68
69static void s3_err_handler(struct t3cdev *tdev, u32 status, u32 error) 69static void s3_event_handler(struct t3cdev *tdev, u32 event, u32 port)
70{ 70{
71 struct cxgb3i_adapter *snic = cxgb3i_adapter_find_by_tdev(tdev); 71 struct cxgb3i_adapter *snic = cxgb3i_adapter_find_by_tdev(tdev);
72 72
73 cxgb3i_log_info("snic 0x%p, tdev 0x%p, status 0x%x, err 0x%x.\n", 73 cxgb3i_log_info("snic 0x%p, tdev 0x%p, event 0x%x, port 0x%x.\n",
74 snic, tdev, status, error); 74 snic, tdev, event, port);
75 if (!snic) 75 if (!snic)
76 return; 76 return;
77 77
78 switch (status) { 78 switch (event) {
79 case OFFLOAD_STATUS_DOWN: 79 case OFFLOAD_STATUS_DOWN:
80 snic->flags |= CXGB3I_ADAPTER_FLAG_RESET; 80 snic->flags |= CXGB3I_ADAPTER_FLAG_RESET;
81 break; 81 break;