diff options
53 files changed, 2396 insertions, 2144 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 2291ff620d93..676b7981adb7 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -59,6 +59,15 @@ Who: Dan Dennedy <dan@dennedy.org>, Stefan Richter <stefanr@s5r6.in-berlin.de> | |||
59 | 59 | ||
60 | --------------------------- | 60 | --------------------------- |
61 | 61 | ||
62 | What: old NCR53C9x driver | ||
63 | When: October 2007 | ||
64 | Why: Replaced by the much better esp_scsi driver. Actual low-level | ||
65 | driver can ported over almost trivially. | ||
66 | Who: David Miller <davem@davemloft.net> | ||
67 | Christoph Hellwig <hch@lst.de> | ||
68 | |||
69 | --------------------------- | ||
70 | |||
62 | What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. | 71 | What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. |
63 | When: December 2006 | 72 | When: December 2006 |
64 | Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 | 73 | Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 |
diff --git a/Documentation/scsi/aacraid.txt b/Documentation/scsi/aacraid.txt index 2368e7e4a8cf..ce3cb42507bd 100644 --- a/Documentation/scsi/aacraid.txt +++ b/Documentation/scsi/aacraid.txt | |||
@@ -98,8 +98,8 @@ Supported Cards/Chipsets | |||
98 | 9005:0285:9005:02b0 (Sunrise Lake ARK) | 98 | 9005:0285:9005:02b0 (Sunrise Lake ARK) |
99 | 9005:0285:9005:02b1 Adaptec (Voodoo 8 internal 8 external) | 99 | 9005:0285:9005:02b1 Adaptec (Voodoo 8 internal 8 external) |
100 | 9005:0285:108e:7aac SUN STK RAID REM (Voodoo44 Coyote) | 100 | 9005:0285:108e:7aac SUN STK RAID REM (Voodoo44 Coyote) |
101 | 9005:0285:108e:0286 SUN SG-XPCIESAS-R-IN (Cougar) | 101 | 9005:0285:108e:0286 SUN STK RAID INT (Cougar) |
102 | 9005:0285:108e:0287 SUN SG-XPCIESAS-R-EX (Prometheus) | 102 | 9005:0285:108e:0287 SUN STK RAID EXT (Prometheus) |
103 | 103 | ||
104 | People | 104 | People |
105 | ------------------------- | 105 | ------------------------- |
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 1f9554e08013..324899c96efe 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -118,97 +118,32 @@ _zfcp_hex_dump(char *addr, int count) | |||
118 | 118 | ||
119 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_FSF | 119 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_FSF |
120 | 120 | ||
121 | static int zfcp_reqlist_init(struct zfcp_adapter *adapter) | 121 | static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter) |
122 | { | 122 | { |
123 | int i; | 123 | int idx; |
124 | 124 | ||
125 | adapter->req_list = kcalloc(REQUEST_LIST_SIZE, sizeof(struct list_head), | 125 | adapter->req_list = kcalloc(REQUEST_LIST_SIZE, sizeof(struct list_head), |
126 | GFP_KERNEL); | 126 | GFP_KERNEL); |
127 | |||
128 | if (!adapter->req_list) | 127 | if (!adapter->req_list) |
129 | return -ENOMEM; | 128 | return -ENOMEM; |
130 | 129 | ||
131 | for (i=0; i<REQUEST_LIST_SIZE; i++) | 130 | for (idx = 0; idx < REQUEST_LIST_SIZE; idx++) |
132 | INIT_LIST_HEAD(&adapter->req_list[i]); | 131 | INIT_LIST_HEAD(&adapter->req_list[idx]); |
133 | |||
134 | return 0; | 132 | return 0; |
135 | } | 133 | } |
136 | 134 | ||
137 | static void zfcp_reqlist_free(struct zfcp_adapter *adapter) | 135 | static void zfcp_reqlist_free(struct zfcp_adapter *adapter) |
138 | { | 136 | { |
139 | struct zfcp_fsf_req *request, *tmp; | ||
140 | unsigned int i; | ||
141 | |||
142 | for (i=0; i<REQUEST_LIST_SIZE; i++) { | ||
143 | if (list_empty(&adapter->req_list[i])) | ||
144 | continue; | ||
145 | |||
146 | list_for_each_entry_safe(request, tmp, | ||
147 | &adapter->req_list[i], list) | ||
148 | list_del(&request->list); | ||
149 | } | ||
150 | |||
151 | kfree(adapter->req_list); | 137 | kfree(adapter->req_list); |
152 | } | 138 | } |
153 | 139 | ||
154 | void zfcp_reqlist_add(struct zfcp_adapter *adapter, | ||
155 | struct zfcp_fsf_req *fsf_req) | ||
156 | { | ||
157 | unsigned int i; | ||
158 | |||
159 | i = fsf_req->req_id % REQUEST_LIST_SIZE; | ||
160 | list_add_tail(&fsf_req->list, &adapter->req_list[i]); | ||
161 | } | ||
162 | |||
163 | void zfcp_reqlist_remove(struct zfcp_adapter *adapter, unsigned long req_id) | ||
164 | { | ||
165 | struct zfcp_fsf_req *request, *tmp; | ||
166 | unsigned int i, counter; | ||
167 | u64 dbg_tmp[2]; | ||
168 | |||
169 | i = req_id % REQUEST_LIST_SIZE; | ||
170 | BUG_ON(list_empty(&adapter->req_list[i])); | ||
171 | |||
172 | counter = 0; | ||
173 | list_for_each_entry_safe(request, tmp, &adapter->req_list[i], list) { | ||
174 | if (request->req_id == req_id) { | ||
175 | dbg_tmp[0] = (u64) atomic_read(&adapter->reqs_active); | ||
176 | dbg_tmp[1] = (u64) counter; | ||
177 | debug_event(adapter->erp_dbf, 4, (void *) dbg_tmp, 16); | ||
178 | list_del(&request->list); | ||
179 | break; | ||
180 | } | ||
181 | counter++; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | struct zfcp_fsf_req *zfcp_reqlist_ismember(struct zfcp_adapter *adapter, | ||
186 | unsigned long req_id) | ||
187 | { | ||
188 | struct zfcp_fsf_req *request, *tmp; | ||
189 | unsigned int i; | ||
190 | |||
191 | /* 0 is reserved as an invalid req_id */ | ||
192 | if (req_id == 0) | ||
193 | return NULL; | ||
194 | |||
195 | i = req_id % REQUEST_LIST_SIZE; | ||
196 | |||
197 | list_for_each_entry_safe(request, tmp, &adapter->req_list[i], list) | ||
198 | if (request->req_id == req_id) | ||
199 | return request; | ||
200 | |||
201 | return NULL; | ||
202 | } | ||
203 | |||
204 | int zfcp_reqlist_isempty(struct zfcp_adapter *adapter) | 140 | int zfcp_reqlist_isempty(struct zfcp_adapter *adapter) |
205 | { | 141 | { |
206 | unsigned int i; | 142 | unsigned int idx; |
207 | 143 | ||
208 | for (i=0; i<REQUEST_LIST_SIZE; i++) | 144 | for (idx = 0; idx < REQUEST_LIST_SIZE; idx++) |
209 | if (!list_empty(&adapter->req_list[i])) | 145 | if (!list_empty(&adapter->req_list[idx])) |
210 | return 0; | 146 | return 0; |
211 | |||
212 | return 1; | 147 | return 1; |
213 | } | 148 | } |
214 | 149 | ||
@@ -913,6 +848,8 @@ zfcp_unit_enqueue(struct zfcp_port *port, fcp_lun_t fcp_lun) | |||
913 | unit->sysfs_device.release = zfcp_sysfs_unit_release; | 848 | unit->sysfs_device.release = zfcp_sysfs_unit_release; |
914 | dev_set_drvdata(&unit->sysfs_device, unit); | 849 | dev_set_drvdata(&unit->sysfs_device, unit); |
915 | 850 | ||
851 | init_waitqueue_head(&unit->scsi_scan_wq); | ||
852 | |||
916 | /* mark unit unusable as long as sysfs registration is not complete */ | 853 | /* mark unit unusable as long as sysfs registration is not complete */ |
917 | atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status); | 854 | atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status); |
918 | 855 | ||
@@ -1104,7 +1041,7 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
1104 | 1041 | ||
1105 | /* initialize list of fsf requests */ | 1042 | /* initialize list of fsf requests */ |
1106 | spin_lock_init(&adapter->req_list_lock); | 1043 | spin_lock_init(&adapter->req_list_lock); |
1107 | retval = zfcp_reqlist_init(adapter); | 1044 | retval = zfcp_reqlist_alloc(adapter); |
1108 | if (retval) { | 1045 | if (retval) { |
1109 | ZFCP_LOG_INFO("request list initialization failed\n"); | 1046 | ZFCP_LOG_INFO("request list initialization failed\n"); |
1110 | goto failed_low_mem_buffers; | 1047 | goto failed_low_mem_buffers; |
@@ -1165,6 +1102,7 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
1165 | zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev); | 1102 | zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev); |
1166 | sysfs_failed: | 1103 | sysfs_failed: |
1167 | dev_set_drvdata(&ccw_device->dev, NULL); | 1104 | dev_set_drvdata(&ccw_device->dev, NULL); |
1105 | zfcp_reqlist_free(adapter); | ||
1168 | failed_low_mem_buffers: | 1106 | failed_low_mem_buffers: |
1169 | zfcp_free_low_mem_buffers(adapter); | 1107 | zfcp_free_low_mem_buffers(adapter); |
1170 | if (qdio_free(ccw_device) != 0) | 1108 | if (qdio_free(ccw_device) != 0) |
@@ -1497,7 +1435,7 @@ zfcp_fsf_incoming_els_plogi(struct zfcp_adapter *adapter, | |||
1497 | 1435 | ||
1498 | if (!port || (port->wwpn != (*(wwn_t *) &els_plogi->serv_param.wwpn))) { | 1436 | if (!port || (port->wwpn != (*(wwn_t *) &els_plogi->serv_param.wwpn))) { |
1499 | ZFCP_LOG_DEBUG("ignored incoming PLOGI for nonexisting port " | 1437 | ZFCP_LOG_DEBUG("ignored incoming PLOGI for nonexisting port " |
1500 | "with d_id 0x%08x on adapter %s\n", | 1438 | "with d_id 0x%06x on adapter %s\n", |
1501 | status_buffer->d_id, | 1439 | status_buffer->d_id, |
1502 | zfcp_get_busid_by_adapter(adapter)); | 1440 | zfcp_get_busid_by_adapter(adapter)); |
1503 | } else { | 1441 | } else { |
@@ -1522,7 +1460,7 @@ zfcp_fsf_incoming_els_logo(struct zfcp_adapter *adapter, | |||
1522 | 1460 | ||
1523 | if (!port || (port->wwpn != els_logo->nport_wwpn)) { | 1461 | if (!port || (port->wwpn != els_logo->nport_wwpn)) { |
1524 | ZFCP_LOG_DEBUG("ignored incoming LOGO for nonexisting port " | 1462 | ZFCP_LOG_DEBUG("ignored incoming LOGO for nonexisting port " |
1525 | "with d_id 0x%08x on adapter %s\n", | 1463 | "with d_id 0x%06x on adapter %s\n", |
1526 | status_buffer->d_id, | 1464 | status_buffer->d_id, |
1527 | zfcp_get_busid_by_adapter(adapter)); | 1465 | zfcp_get_busid_by_adapter(adapter)); |
1528 | } else { | 1466 | } else { |
@@ -1704,7 +1642,7 @@ static void zfcp_ns_gid_pn_handler(unsigned long data) | |||
1704 | /* looks like a valid d_id */ | 1642 | /* looks like a valid d_id */ |
1705 | port->d_id = ct_iu_resp->d_id & ZFCP_DID_MASK; | 1643 | port->d_id = ct_iu_resp->d_id & ZFCP_DID_MASK; |
1706 | atomic_set_mask(ZFCP_STATUS_PORT_DID_DID, &port->status); | 1644 | atomic_set_mask(ZFCP_STATUS_PORT_DID_DID, &port->status); |
1707 | ZFCP_LOG_DEBUG("adapter %s: wwpn=0x%016Lx ---> d_id=0x%08x\n", | 1645 | ZFCP_LOG_DEBUG("adapter %s: wwpn=0x%016Lx ---> d_id=0x%06x\n", |
1708 | zfcp_get_busid_by_port(port), port->wwpn, port->d_id); | 1646 | zfcp_get_busid_by_port(port), port->wwpn, port->d_id); |
1709 | goto out; | 1647 | goto out; |
1710 | 1648 | ||
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 32933ed54b8a..22649639230b 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h | |||
@@ -637,6 +637,7 @@ do { \ | |||
637 | #define ZFCP_STATUS_UNIT_SHARED 0x00000004 | 637 | #define ZFCP_STATUS_UNIT_SHARED 0x00000004 |
638 | #define ZFCP_STATUS_UNIT_READONLY 0x00000008 | 638 | #define ZFCP_STATUS_UNIT_READONLY 0x00000008 |
639 | #define ZFCP_STATUS_UNIT_REGISTERED 0x00000010 | 639 | #define ZFCP_STATUS_UNIT_REGISTERED 0x00000010 |
640 | #define ZFCP_STATUS_UNIT_SCSI_WORK_PENDING 0x00000020 | ||
640 | 641 | ||
641 | /* FSF request status (this does not have a common part) */ | 642 | /* FSF request status (this does not have a common part) */ |
642 | #define ZFCP_STATUS_FSFREQ_NOT_INIT 0x00000000 | 643 | #define ZFCP_STATUS_FSFREQ_NOT_INIT 0x00000000 |
@@ -980,6 +981,10 @@ struct zfcp_unit { | |||
980 | struct scsi_device *device; /* scsi device struct pointer */ | 981 | struct scsi_device *device; /* scsi device struct pointer */ |
981 | struct zfcp_erp_action erp_action; /* pending error recovery */ | 982 | struct zfcp_erp_action erp_action; /* pending error recovery */ |
982 | atomic_t erp_counter; | 983 | atomic_t erp_counter; |
984 | wait_queue_head_t scsi_scan_wq; /* can be used to wait until | ||
985 | all scsi_scan_target | ||
986 | requests have been | ||
987 | completed. */ | ||
983 | }; | 988 | }; |
984 | 989 | ||
985 | /* FSF request */ | 990 | /* FSF request */ |
@@ -1085,6 +1090,42 @@ extern void _zfcp_hex_dump(char *, int); | |||
1085 | #define zfcp_get_busid_by_unit(unit) (zfcp_get_busid_by_port(unit->port)) | 1090 | #define zfcp_get_busid_by_unit(unit) (zfcp_get_busid_by_port(unit->port)) |
1086 | 1091 | ||
1087 | /* | 1092 | /* |
1093 | * Helper functions for request ID management. | ||
1094 | */ | ||
1095 | static inline int zfcp_reqlist_hash(unsigned long req_id) | ||
1096 | { | ||
1097 | return req_id % REQUEST_LIST_SIZE; | ||
1098 | } | ||
1099 | |||
1100 | static inline void zfcp_reqlist_add(struct zfcp_adapter *adapter, | ||
1101 | struct zfcp_fsf_req *fsf_req) | ||
1102 | { | ||
1103 | unsigned int idx; | ||
1104 | |||
1105 | idx = zfcp_reqlist_hash(fsf_req->req_id); | ||
1106 | list_add_tail(&fsf_req->list, &adapter->req_list[idx]); | ||
1107 | } | ||
1108 | |||
1109 | static inline void zfcp_reqlist_remove(struct zfcp_adapter *adapter, | ||
1110 | struct zfcp_fsf_req *fsf_req) | ||
1111 | { | ||
1112 | list_del(&fsf_req->list); | ||
1113 | } | ||
1114 | |||
1115 | static inline struct zfcp_fsf_req * | ||
1116 | zfcp_reqlist_find(struct zfcp_adapter *adapter, unsigned long req_id) | ||
1117 | { | ||
1118 | struct zfcp_fsf_req *request; | ||
1119 | unsigned int idx; | ||
1120 | |||
1121 | idx = zfcp_reqlist_hash(req_id); | ||
1122 | list_for_each_entry(request, &adapter->req_list[idx], list) | ||
1123 | if (request->req_id == req_id) | ||
1124 | return request; | ||
1125 | return NULL; | ||
1126 | } | ||
1127 | |||
1128 | /* | ||
1088 | * functions needed for reference/usage counting | 1129 | * functions needed for reference/usage counting |
1089 | */ | 1130 | */ |
1090 | 1131 | ||
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index c1f2d4b14c2b..aef66bc2b6ca 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -179,7 +179,7 @@ static void zfcp_close_fsf(struct zfcp_adapter *adapter) | |||
179 | static void zfcp_fsf_request_timeout_handler(unsigned long data) | 179 | static void zfcp_fsf_request_timeout_handler(unsigned long data) |
180 | { | 180 | { |
181 | struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; | 181 | struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; |
182 | zfcp_erp_adapter_reopen(adapter, 0); | 182 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); |
183 | } | 183 | } |
184 | 184 | ||
185 | void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout) | 185 | void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout) |
@@ -342,9 +342,9 @@ zfcp_erp_adisc(struct zfcp_port *port) | |||
342 | adisc->wwpn = fc_host_port_name(adapter->scsi_host); | 342 | adisc->wwpn = fc_host_port_name(adapter->scsi_host); |
343 | adisc->wwnn = fc_host_node_name(adapter->scsi_host); | 343 | adisc->wwnn = fc_host_node_name(adapter->scsi_host); |
344 | adisc->nport_id = fc_host_port_id(adapter->scsi_host); | 344 | adisc->nport_id = fc_host_port_id(adapter->scsi_host); |
345 | ZFCP_LOG_INFO("ADISC request from s_id 0x%08x to d_id 0x%08x " | 345 | ZFCP_LOG_INFO("ADISC request from s_id 0x%06x to d_id 0x%06x " |
346 | "(wwpn=0x%016Lx, wwnn=0x%016Lx, " | 346 | "(wwpn=0x%016Lx, wwnn=0x%016Lx, " |
347 | "hard_nport_id=0x%08x, nport_id=0x%08x)\n", | 347 | "hard_nport_id=0x%06x, nport_id=0x%06x)\n", |
348 | adisc->nport_id, send_els->d_id, (wwn_t) adisc->wwpn, | 348 | adisc->nport_id, send_els->d_id, (wwn_t) adisc->wwpn, |
349 | (wwn_t) adisc->wwnn, adisc->hard_nport_id, | 349 | (wwn_t) adisc->wwnn, adisc->hard_nport_id, |
350 | adisc->nport_id); | 350 | adisc->nport_id); |
@@ -352,7 +352,7 @@ zfcp_erp_adisc(struct zfcp_port *port) | |||
352 | retval = zfcp_fsf_send_els(send_els); | 352 | retval = zfcp_fsf_send_els(send_els); |
353 | if (retval != 0) { | 353 | if (retval != 0) { |
354 | ZFCP_LOG_NORMAL("error: initiation of Send ELS failed for port " | 354 | ZFCP_LOG_NORMAL("error: initiation of Send ELS failed for port " |
355 | "0x%08x on adapter %s\n", send_els->d_id, | 355 | "0x%06x on adapter %s\n", send_els->d_id, |
356 | zfcp_get_busid_by_adapter(adapter)); | 356 | zfcp_get_busid_by_adapter(adapter)); |
357 | goto freemem; | 357 | goto freemem; |
358 | } | 358 | } |
@@ -398,7 +398,7 @@ zfcp_erp_adisc_handler(unsigned long data) | |||
398 | if (send_els->status != 0) { | 398 | if (send_els->status != 0) { |
399 | ZFCP_LOG_NORMAL("ELS request rejected/timed out, " | 399 | ZFCP_LOG_NORMAL("ELS request rejected/timed out, " |
400 | "force physical port reopen " | 400 | "force physical port reopen " |
401 | "(adapter %s, port d_id=0x%08x)\n", | 401 | "(adapter %s, port d_id=0x%06x)\n", |
402 | zfcp_get_busid_by_adapter(adapter), d_id); | 402 | zfcp_get_busid_by_adapter(adapter), d_id); |
403 | debug_text_event(adapter->erp_dbf, 3, "forcreop"); | 403 | debug_text_event(adapter->erp_dbf, 3, "forcreop"); |
404 | if (zfcp_erp_port_forced_reopen(port, 0)) | 404 | if (zfcp_erp_port_forced_reopen(port, 0)) |
@@ -411,9 +411,9 @@ zfcp_erp_adisc_handler(unsigned long data) | |||
411 | 411 | ||
412 | adisc = zfcp_sg_to_address(send_els->resp); | 412 | adisc = zfcp_sg_to_address(send_els->resp); |
413 | 413 | ||
414 | ZFCP_LOG_INFO("ADISC response from d_id 0x%08x to s_id " | 414 | ZFCP_LOG_INFO("ADISC response from d_id 0x%06x to s_id " |
415 | "0x%08x (wwpn=0x%016Lx, wwnn=0x%016Lx, " | 415 | "0x%06x (wwpn=0x%016Lx, wwnn=0x%016Lx, " |
416 | "hard_nport_id=0x%08x, nport_id=0x%08x)\n", | 416 | "hard_nport_id=0x%06x, nport_id=0x%06x)\n", |
417 | d_id, fc_host_port_id(adapter->scsi_host), | 417 | d_id, fc_host_port_id(adapter->scsi_host), |
418 | (wwn_t) adisc->wwpn, (wwn_t) adisc->wwnn, | 418 | (wwn_t) adisc->wwpn, (wwn_t) adisc->wwnn, |
419 | adisc->hard_nport_id, adisc->nport_id); | 419 | adisc->hard_nport_id, adisc->nport_id); |
@@ -847,8 +847,7 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action) | |||
847 | if (erp_action->fsf_req) { | 847 | if (erp_action->fsf_req) { |
848 | /* take lock to ensure that request is not deleted meanwhile */ | 848 | /* take lock to ensure that request is not deleted meanwhile */ |
849 | spin_lock(&adapter->req_list_lock); | 849 | spin_lock(&adapter->req_list_lock); |
850 | if (zfcp_reqlist_ismember(adapter, | 850 | if (zfcp_reqlist_find(adapter, erp_action->fsf_req->req_id)) { |
851 | erp_action->fsf_req->req_id)) { | ||
852 | /* fsf_req still exists */ | 851 | /* fsf_req still exists */ |
853 | debug_text_event(adapter->erp_dbf, 3, "a_ca_req"); | 852 | debug_text_event(adapter->erp_dbf, 3, "a_ca_req"); |
854 | debug_event(adapter->erp_dbf, 3, &erp_action->fsf_req, | 853 | debug_event(adapter->erp_dbf, 3, &erp_action->fsf_req, |
@@ -1377,7 +1376,7 @@ zfcp_erp_port_failed(struct zfcp_port *port) | |||
1377 | 1376 | ||
1378 | if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) | 1377 | if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) |
1379 | ZFCP_LOG_NORMAL("port erp failed (adapter %s, " | 1378 | ZFCP_LOG_NORMAL("port erp failed (adapter %s, " |
1380 | "port d_id=0x%08x)\n", | 1379 | "port d_id=0x%06x)\n", |
1381 | zfcp_get_busid_by_port(port), port->d_id); | 1380 | zfcp_get_busid_by_port(port), port->d_id); |
1382 | else | 1381 | else |
1383 | ZFCP_LOG_NORMAL("port erp failed (adapter %s, wwpn=0x%016Lx)\n", | 1382 | ZFCP_LOG_NORMAL("port erp failed (adapter %s, wwpn=0x%016Lx)\n", |
@@ -1591,6 +1590,62 @@ zfcp_erp_strategy_check_adapter(struct zfcp_adapter *adapter, int result) | |||
1591 | return result; | 1590 | return result; |
1592 | } | 1591 | } |
1593 | 1592 | ||
1593 | struct zfcp_erp_add_work { | ||
1594 | struct zfcp_unit *unit; | ||
1595 | struct work_struct work; | ||
1596 | }; | ||
1597 | |||
1598 | /** | ||
1599 | * zfcp_erp_scsi_scan | ||
1600 | * @data: pointer to a struct zfcp_erp_add_work | ||
1601 | * | ||
1602 | * Registers a logical unit with the SCSI stack. | ||
1603 | */ | ||
1604 | static void zfcp_erp_scsi_scan(struct work_struct *work) | ||
1605 | { | ||
1606 | struct zfcp_erp_add_work *p = | ||
1607 | container_of(work, struct zfcp_erp_add_work, work); | ||
1608 | struct zfcp_unit *unit = p->unit; | ||
1609 | struct fc_rport *rport = unit->port->rport; | ||
1610 | scsi_scan_target(&rport->dev, 0, rport->scsi_target_id, | ||
1611 | unit->scsi_lun, 0); | ||
1612 | atomic_clear_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status); | ||
1613 | wake_up(&unit->scsi_scan_wq); | ||
1614 | zfcp_unit_put(unit); | ||
1615 | kfree(p); | ||
1616 | } | ||
1617 | |||
1618 | /** | ||
1619 | * zfcp_erp_schedule_work | ||
1620 | * @unit: pointer to unit which should be registered with SCSI stack | ||
1621 | * | ||
1622 | * Schedules work which registers a unit with the SCSI stack | ||
1623 | */ | ||
1624 | static void | ||
1625 | zfcp_erp_schedule_work(struct zfcp_unit *unit) | ||
1626 | { | ||
1627 | struct zfcp_erp_add_work *p; | ||
1628 | |||
1629 | p = kmalloc(sizeof(*p), GFP_KERNEL); | ||
1630 | if (!p) { | ||
1631 | ZFCP_LOG_NORMAL("error: Out of resources. Could not register " | ||
1632 | "the FCP-LUN 0x%Lx connected to " | ||
1633 | "the port with WWPN 0x%Lx connected to " | ||
1634 | "the adapter %s with the SCSI stack.\n", | ||
1635 | unit->fcp_lun, | ||
1636 | unit->port->wwpn, | ||
1637 | zfcp_get_busid_by_unit(unit)); | ||
1638 | return; | ||
1639 | } | ||
1640 | |||
1641 | zfcp_unit_get(unit); | ||
1642 | memset(p, 0, sizeof(*p)); | ||
1643 | atomic_set_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status); | ||
1644 | INIT_WORK(&p->work, zfcp_erp_scsi_scan); | ||
1645 | p->unit = unit; | ||
1646 | schedule_work(&p->work); | ||
1647 | } | ||
1648 | |||
1594 | /* | 1649 | /* |
1595 | * function: | 1650 | * function: |
1596 | * | 1651 | * |
@@ -2401,7 +2456,7 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action) | |||
2401 | retval = ZFCP_ERP_FAILED; | 2456 | retval = ZFCP_ERP_FAILED; |
2402 | } | 2457 | } |
2403 | } else { | 2458 | } else { |
2404 | ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%08x -> " | 2459 | ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%06x -> " |
2405 | "trying open\n", port->wwpn, port->d_id); | 2460 | "trying open\n", port->wwpn, port->d_id); |
2406 | retval = zfcp_erp_port_strategy_open_port(erp_action); | 2461 | retval = zfcp_erp_port_strategy_open_port(erp_action); |
2407 | } | 2462 | } |
@@ -2441,7 +2496,7 @@ zfcp_erp_port_strategy_open_nameserver(struct zfcp_erp_action *erp_action) | |||
2441 | case ZFCP_ERP_STEP_UNINITIALIZED: | 2496 | case ZFCP_ERP_STEP_UNINITIALIZED: |
2442 | case ZFCP_ERP_STEP_PHYS_PORT_CLOSING: | 2497 | case ZFCP_ERP_STEP_PHYS_PORT_CLOSING: |
2443 | case ZFCP_ERP_STEP_PORT_CLOSING: | 2498 | case ZFCP_ERP_STEP_PORT_CLOSING: |
2444 | ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%08x -> trying open\n", | 2499 | ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%06x -> trying open\n", |
2445 | port->wwpn, port->d_id); | 2500 | port->wwpn, port->d_id); |
2446 | retval = zfcp_erp_port_strategy_open_port(erp_action); | 2501 | retval = zfcp_erp_port_strategy_open_port(erp_action); |
2447 | break; | 2502 | break; |
@@ -3092,9 +3147,9 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter, | |||
3092 | && port->rport) { | 3147 | && port->rport) { |
3093 | atomic_set_mask(ZFCP_STATUS_UNIT_REGISTERED, | 3148 | atomic_set_mask(ZFCP_STATUS_UNIT_REGISTERED, |
3094 | &unit->status); | 3149 | &unit->status); |
3095 | scsi_scan_target(&port->rport->dev, 0, | 3150 | if (atomic_test_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, |
3096 | port->rport->scsi_target_id, | 3151 | &unit->status) == 0) |
3097 | unit->scsi_lun, 0); | 3152 | zfcp_erp_schedule_work(unit); |
3098 | } | 3153 | } |
3099 | zfcp_unit_put(unit); | 3154 | zfcp_unit_put(unit); |
3100 | break; | 3155 | break; |
@@ -3121,7 +3176,7 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter, | |||
3121 | zfcp_get_busid_by_port(port), | 3176 | zfcp_get_busid_by_port(port), |
3122 | port->wwpn); | 3177 | port->wwpn); |
3123 | else { | 3178 | else { |
3124 | scsi_flush_work(adapter->scsi_host); | 3179 | scsi_target_unblock(&port->rport->dev); |
3125 | port->rport->maxframe_size = port->maxframe_size; | 3180 | port->rport->maxframe_size = port->maxframe_size; |
3126 | port->rport->supported_classes = | 3181 | port->rport->supported_classes = |
3127 | port->supported_classes; | 3182 | port->supported_classes; |
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index 01386ac688a2..991d45667a44 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h | |||
@@ -184,10 +184,6 @@ extern void zfcp_scsi_dbf_event_abort(const char *, struct zfcp_adapter *, | |||
184 | unsigned long); | 184 | unsigned long); |
185 | extern void zfcp_scsi_dbf_event_devreset(const char *, u8, struct zfcp_unit *, | 185 | extern void zfcp_scsi_dbf_event_devreset(const char *, u8, struct zfcp_unit *, |
186 | struct scsi_cmnd *); | 186 | struct scsi_cmnd *); |
187 | extern void zfcp_reqlist_add(struct zfcp_adapter *, struct zfcp_fsf_req *); | ||
188 | extern void zfcp_reqlist_remove(struct zfcp_adapter *, unsigned long); | ||
189 | extern struct zfcp_fsf_req *zfcp_reqlist_ismember(struct zfcp_adapter *, | ||
190 | unsigned long); | ||
191 | extern int zfcp_reqlist_isempty(struct zfcp_adapter *); | 187 | extern int zfcp_reqlist_isempty(struct zfcp_adapter *); |
192 | 188 | ||
193 | #endif /* ZFCP_EXT_H */ | 189 | #endif /* ZFCP_EXT_H */ |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 4c0a59afd5c8..a8b02542ac2d 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -828,7 +828,7 @@ zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *fsf_req) | |||
828 | 828 | ||
829 | if (!port || (port->d_id != (status_buffer->d_id & ZFCP_DID_MASK))) { | 829 | if (!port || (port->d_id != (status_buffer->d_id & ZFCP_DID_MASK))) { |
830 | ZFCP_LOG_NORMAL("bug: Reopen port indication received for" | 830 | ZFCP_LOG_NORMAL("bug: Reopen port indication received for" |
831 | "nonexisting port with d_id 0x%08x on " | 831 | "nonexisting port with d_id 0x%06x on " |
832 | "adapter %s. Ignored.\n", | 832 | "adapter %s. Ignored.\n", |
833 | status_buffer->d_id & ZFCP_DID_MASK, | 833 | status_buffer->d_id & ZFCP_DID_MASK, |
834 | zfcp_get_busid_by_adapter(adapter)); | 834 | zfcp_get_busid_by_adapter(adapter)); |
@@ -853,7 +853,7 @@ zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *fsf_req) | |||
853 | &status_buffer->status_subtype, sizeof (u32)); | 853 | &status_buffer->status_subtype, sizeof (u32)); |
854 | ZFCP_LOG_NORMAL("bug: Undefined status subtype received " | 854 | ZFCP_LOG_NORMAL("bug: Undefined status subtype received " |
855 | "for a reopen indication on port with " | 855 | "for a reopen indication on port with " |
856 | "d_id 0x%08x on the adapter %s. " | 856 | "d_id 0x%06x on the adapter %s. " |
857 | "Ignored. (debug info 0x%x)\n", | 857 | "Ignored. (debug info 0x%x)\n", |
858 | status_buffer->d_id, | 858 | status_buffer->d_id, |
859 | zfcp_get_busid_by_adapter(adapter), | 859 | zfcp_get_busid_by_adapter(adapter), |
@@ -1156,7 +1156,7 @@ zfcp_fsf_abort_fcp_command(unsigned long old_req_id, | |||
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | ZFCP_LOG_DEBUG("Abort FCP Command request initiated " | 1158 | ZFCP_LOG_DEBUG("Abort FCP Command request initiated " |
1159 | "(adapter%s, port d_id=0x%08x, " | 1159 | "(adapter%s, port d_id=0x%06x, " |
1160 | "unit x%016Lx, old_req_id=0x%lx)\n", | 1160 | "unit x%016Lx, old_req_id=0x%lx)\n", |
1161 | zfcp_get_busid_by_adapter(adapter), | 1161 | zfcp_get_busid_by_adapter(adapter), |
1162 | unit->port->d_id, | 1162 | unit->port->d_id, |
@@ -1554,7 +1554,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req) | |||
1554 | 1554 | ||
1555 | case FSF_ACCESS_DENIED: | 1555 | case FSF_ACCESS_DENIED: |
1556 | ZFCP_LOG_NORMAL("access denied, cannot send generic service " | 1556 | ZFCP_LOG_NORMAL("access denied, cannot send generic service " |
1557 | "command (adapter %s, port d_id=0x%08x)\n", | 1557 | "command (adapter %s, port d_id=0x%06x)\n", |
1558 | zfcp_get_busid_by_port(port), port->d_id); | 1558 | zfcp_get_busid_by_port(port), port->d_id); |
1559 | for (counter = 0; counter < 2; counter++) { | 1559 | for (counter = 0; counter < 2; counter++) { |
1560 | subtable = header->fsf_status_qual.halfword[counter * 2]; | 1560 | subtable = header->fsf_status_qual.halfword[counter * 2]; |
@@ -1576,7 +1576,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req) | |||
1576 | 1576 | ||
1577 | case FSF_GENERIC_COMMAND_REJECTED: | 1577 | case FSF_GENERIC_COMMAND_REJECTED: |
1578 | ZFCP_LOG_INFO("generic service command rejected " | 1578 | ZFCP_LOG_INFO("generic service command rejected " |
1579 | "(adapter %s, port d_id=0x%08x)\n", | 1579 | "(adapter %s, port d_id=0x%06x)\n", |
1580 | zfcp_get_busid_by_port(port), port->d_id); | 1580 | zfcp_get_busid_by_port(port), port->d_id); |
1581 | ZFCP_LOG_INFO("status qualifier:\n"); | 1581 | ZFCP_LOG_INFO("status qualifier:\n"); |
1582 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO, | 1582 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO, |
@@ -1602,7 +1602,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req) | |||
1602 | 1602 | ||
1603 | case FSF_PORT_BOXED: | 1603 | case FSF_PORT_BOXED: |
1604 | ZFCP_LOG_INFO("port needs to be reopened " | 1604 | ZFCP_LOG_INFO("port needs to be reopened " |
1605 | "(adapter %s, port d_id=0x%08x)\n", | 1605 | "(adapter %s, port d_id=0x%06x)\n", |
1606 | zfcp_get_busid_by_port(port), port->d_id); | 1606 | zfcp_get_busid_by_port(port), port->d_id); |
1607 | debug_text_event(adapter->erp_dbf, 2, "fsf_s_pboxed"); | 1607 | debug_text_event(adapter->erp_dbf, 2, "fsf_s_pboxed"); |
1608 | zfcp_erp_port_boxed(port); | 1608 | zfcp_erp_port_boxed(port); |
@@ -1683,7 +1683,7 @@ zfcp_fsf_send_els(struct zfcp_send_els *els) | |||
1683 | NULL, &lock_flags, &fsf_req); | 1683 | NULL, &lock_flags, &fsf_req); |
1684 | if (ret < 0) { | 1684 | if (ret < 0) { |
1685 | ZFCP_LOG_INFO("error: creation of ELS request failed " | 1685 | ZFCP_LOG_INFO("error: creation of ELS request failed " |
1686 | "(adapter %s, port d_id: 0x%08x)\n", | 1686 | "(adapter %s, port d_id: 0x%06x)\n", |
1687 | zfcp_get_busid_by_adapter(adapter), d_id); | 1687 | zfcp_get_busid_by_adapter(adapter), d_id); |
1688 | goto failed_req; | 1688 | goto failed_req; |
1689 | } | 1689 | } |
@@ -1708,7 +1708,7 @@ zfcp_fsf_send_els(struct zfcp_send_els *els) | |||
1708 | ZFCP_MAX_SBALS_PER_ELS_REQ); | 1708 | ZFCP_MAX_SBALS_PER_ELS_REQ); |
1709 | if (bytes <= 0) { | 1709 | if (bytes <= 0) { |
1710 | ZFCP_LOG_INFO("error: creation of ELS request failed " | 1710 | ZFCP_LOG_INFO("error: creation of ELS request failed " |
1711 | "(adapter %s, port d_id: 0x%08x)\n", | 1711 | "(adapter %s, port d_id: 0x%06x)\n", |
1712 | zfcp_get_busid_by_adapter(adapter), d_id); | 1712 | zfcp_get_busid_by_adapter(adapter), d_id); |
1713 | if (bytes == 0) { | 1713 | if (bytes == 0) { |
1714 | ret = -ENOMEM; | 1714 | ret = -ENOMEM; |
@@ -1725,7 +1725,7 @@ zfcp_fsf_send_els(struct zfcp_send_els *els) | |||
1725 | ZFCP_MAX_SBALS_PER_ELS_REQ); | 1725 | ZFCP_MAX_SBALS_PER_ELS_REQ); |
1726 | if (bytes <= 0) { | 1726 | if (bytes <= 0) { |
1727 | ZFCP_LOG_INFO("error: creation of ELS request failed " | 1727 | ZFCP_LOG_INFO("error: creation of ELS request failed " |
1728 | "(adapter %s, port d_id: 0x%08x)\n", | 1728 | "(adapter %s, port d_id: 0x%06x)\n", |
1729 | zfcp_get_busid_by_adapter(adapter), d_id); | 1729 | zfcp_get_busid_by_adapter(adapter), d_id); |
1730 | if (bytes == 0) { | 1730 | if (bytes == 0) { |
1731 | ret = -ENOMEM; | 1731 | ret = -ENOMEM; |
@@ -1739,7 +1739,7 @@ zfcp_fsf_send_els(struct zfcp_send_els *els) | |||
1739 | /* reject request */ | 1739 | /* reject request */ |
1740 | ZFCP_LOG_INFO("error: microcode does not support chained SBALs" | 1740 | ZFCP_LOG_INFO("error: microcode does not support chained SBALs" |
1741 | ", ELS request too big (adapter %s, " | 1741 | ", ELS request too big (adapter %s, " |
1742 | "port d_id: 0x%08x)\n", | 1742 | "port d_id: 0x%06x)\n", |
1743 | zfcp_get_busid_by_adapter(adapter), d_id); | 1743 | zfcp_get_busid_by_adapter(adapter), d_id); |
1744 | ret = -EOPNOTSUPP; | 1744 | ret = -EOPNOTSUPP; |
1745 | goto failed_send; | 1745 | goto failed_send; |
@@ -1760,13 +1760,13 @@ zfcp_fsf_send_els(struct zfcp_send_els *els) | |||
1760 | ret = zfcp_fsf_req_send(fsf_req); | 1760 | ret = zfcp_fsf_req_send(fsf_req); |
1761 | if (ret) { | 1761 | if (ret) { |
1762 | ZFCP_LOG_DEBUG("error: initiation of ELS request failed " | 1762 | ZFCP_LOG_DEBUG("error: initiation of ELS request failed " |
1763 | "(adapter %s, port d_id: 0x%08x)\n", | 1763 | "(adapter %s, port d_id: 0x%06x)\n", |
1764 | zfcp_get_busid_by_adapter(adapter), d_id); | 1764 | zfcp_get_busid_by_adapter(adapter), d_id); |
1765 | goto failed_send; | 1765 | goto failed_send; |
1766 | } | 1766 | } |
1767 | 1767 | ||
1768 | ZFCP_LOG_DEBUG("ELS request initiated (adapter %s, port d_id: " | 1768 | ZFCP_LOG_DEBUG("ELS request initiated (adapter %s, port d_id: " |
1769 | "0x%08x)\n", zfcp_get_busid_by_adapter(adapter), d_id); | 1769 | "0x%06x)\n", zfcp_get_busid_by_adapter(adapter), d_id); |
1770 | goto out; | 1770 | goto out; |
1771 | 1771 | ||
1772 | failed_send: | 1772 | failed_send: |
@@ -1859,7 +1859,7 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req) | |||
1859 | case FSF_ELS_COMMAND_REJECTED: | 1859 | case FSF_ELS_COMMAND_REJECTED: |
1860 | ZFCP_LOG_INFO("ELS has been rejected because command filter " | 1860 | ZFCP_LOG_INFO("ELS has been rejected because command filter " |
1861 | "prohibited sending " | 1861 | "prohibited sending " |
1862 | "(adapter: %s, port d_id: 0x%08x)\n", | 1862 | "(adapter: %s, port d_id: 0x%06x)\n", |
1863 | zfcp_get_busid_by_adapter(adapter), d_id); | 1863 | zfcp_get_busid_by_adapter(adapter), d_id); |
1864 | 1864 | ||
1865 | break; | 1865 | break; |
@@ -1907,7 +1907,7 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req) | |||
1907 | 1907 | ||
1908 | case FSF_ACCESS_DENIED: | 1908 | case FSF_ACCESS_DENIED: |
1909 | ZFCP_LOG_NORMAL("access denied, cannot send ELS command " | 1909 | ZFCP_LOG_NORMAL("access denied, cannot send ELS command " |
1910 | "(adapter %s, port d_id=0x%08x)\n", | 1910 | "(adapter %s, port d_id=0x%06x)\n", |
1911 | zfcp_get_busid_by_adapter(adapter), d_id); | 1911 | zfcp_get_busid_by_adapter(adapter), d_id); |
1912 | for (counter = 0; counter < 2; counter++) { | 1912 | for (counter = 0; counter < 2; counter++) { |
1913 | subtable = header->fsf_status_qual.halfword[counter * 2]; | 1913 | subtable = header->fsf_status_qual.halfword[counter * 2]; |
@@ -2070,7 +2070,7 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok) | |||
2070 | ZFCP_LOG_NORMAL("The adapter %s reported the following characteristics:\n" | 2070 | ZFCP_LOG_NORMAL("The adapter %s reported the following characteristics:\n" |
2071 | "WWNN 0x%016Lx, " | 2071 | "WWNN 0x%016Lx, " |
2072 | "WWPN 0x%016Lx, " | 2072 | "WWPN 0x%016Lx, " |
2073 | "S_ID 0x%08x,\n" | 2073 | "S_ID 0x%06x,\n" |
2074 | "adapter version 0x%x, " | 2074 | "adapter version 0x%x, " |
2075 | "LIC version 0x%x, " | 2075 | "LIC version 0x%x, " |
2076 | "FC link speed %d Gb/s\n", | 2076 | "FC link speed %d Gb/s\n", |
@@ -3043,6 +3043,7 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3043 | queue_designator = &header->fsf_status_qual.fsf_queue_designator; | 3043 | queue_designator = &header->fsf_status_qual.fsf_queue_designator; |
3044 | 3044 | ||
3045 | atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED | | 3045 | atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED | |
3046 | ZFCP_STATUS_COMMON_ACCESS_BOXED | | ||
3046 | ZFCP_STATUS_UNIT_SHARED | | 3047 | ZFCP_STATUS_UNIT_SHARED | |
3047 | ZFCP_STATUS_UNIT_READONLY, | 3048 | ZFCP_STATUS_UNIT_READONLY, |
3048 | &unit->status); | 3049 | &unit->status); |
@@ -4645,23 +4646,22 @@ zfcp_fsf_req_create(struct zfcp_adapter *adapter, u32 fsf_cmd, int req_flags, | |||
4645 | fsf_req->adapter = adapter; | 4646 | fsf_req->adapter = adapter; |
4646 | fsf_req->fsf_command = fsf_cmd; | 4647 | fsf_req->fsf_command = fsf_cmd; |
4647 | INIT_LIST_HEAD(&fsf_req->list); | 4648 | INIT_LIST_HEAD(&fsf_req->list); |
4648 | |||
4649 | /* this is serialized (we are holding req_queue-lock of adapter */ | ||
4650 | if (adapter->req_no == 0) | ||
4651 | adapter->req_no++; | ||
4652 | fsf_req->req_id = adapter->req_no++; | ||
4653 | |||
4654 | init_timer(&fsf_req->timer); | 4649 | init_timer(&fsf_req->timer); |
4655 | zfcp_fsf_req_qtcb_init(fsf_req); | ||
4656 | 4650 | ||
4657 | /* initialize waitqueue which may be used to wait on | 4651 | /* initialize waitqueue which may be used to wait on |
4658 | this request completion */ | 4652 | this request completion */ |
4659 | init_waitqueue_head(&fsf_req->completion_wq); | 4653 | init_waitqueue_head(&fsf_req->completion_wq); |
4660 | 4654 | ||
4661 | ret = zfcp_fsf_req_sbal_get(adapter, req_flags, lock_flags); | 4655 | ret = zfcp_fsf_req_sbal_get(adapter, req_flags, lock_flags); |
4662 | if(ret < 0) { | 4656 | if (ret < 0) |
4663 | goto failed_sbals; | 4657 | goto failed_sbals; |
4664 | } | 4658 | |
4659 | /* this is serialized (we are holding req_queue-lock of adapter) */ | ||
4660 | if (adapter->req_no == 0) | ||
4661 | adapter->req_no++; | ||
4662 | fsf_req->req_id = adapter->req_no++; | ||
4663 | |||
4664 | zfcp_fsf_req_qtcb_init(fsf_req); | ||
4665 | 4665 | ||
4666 | /* | 4666 | /* |
4667 | * We hold queue_lock here. Check if QDIOUP is set and let request fail | 4667 | * We hold queue_lock here. Check if QDIOUP is set and let request fail |
@@ -4788,7 +4788,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req) | |||
4788 | retval = -EIO; | 4788 | retval = -EIO; |
4789 | del_timer(&fsf_req->timer); | 4789 | del_timer(&fsf_req->timer); |
4790 | spin_lock(&adapter->req_list_lock); | 4790 | spin_lock(&adapter->req_list_lock); |
4791 | zfcp_reqlist_remove(adapter, fsf_req->req_id); | 4791 | zfcp_reqlist_remove(adapter, fsf_req); |
4792 | spin_unlock(&adapter->req_list_lock); | 4792 | spin_unlock(&adapter->req_list_lock); |
4793 | /* undo changes in request queue made for this request */ | 4793 | /* undo changes in request queue made for this request */ |
4794 | zfcp_qdio_zero_sbals(req_queue->buffer, | 4794 | zfcp_qdio_zero_sbals(req_queue->buffer, |
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c index 1e12a78e8edd..cb08ca3cc0f9 100644 --- a/drivers/s390/scsi/zfcp_qdio.c +++ b/drivers/s390/scsi/zfcp_qdio.c | |||
@@ -283,10 +283,10 @@ zfcp_qdio_request_handler(struct ccw_device *ccw_device, | |||
283 | } | 283 | } |
284 | 284 | ||
285 | /** | 285 | /** |
286 | * zfcp_qdio_reqid_check - checks for valid reqids or unsolicited status | 286 | * zfcp_qdio_reqid_check - checks for valid reqids. |
287 | */ | 287 | */ |
288 | static int zfcp_qdio_reqid_check(struct zfcp_adapter *adapter, | 288 | static void zfcp_qdio_reqid_check(struct zfcp_adapter *adapter, |
289 | unsigned long req_id) | 289 | unsigned long req_id) |
290 | { | 290 | { |
291 | struct zfcp_fsf_req *fsf_req; | 291 | struct zfcp_fsf_req *fsf_req; |
292 | unsigned long flags; | 292 | unsigned long flags; |
@@ -294,23 +294,22 @@ static int zfcp_qdio_reqid_check(struct zfcp_adapter *adapter, | |||
294 | debug_long_event(adapter->erp_dbf, 4, req_id); | 294 | debug_long_event(adapter->erp_dbf, 4, req_id); |
295 | 295 | ||
296 | spin_lock_irqsave(&adapter->req_list_lock, flags); | 296 | spin_lock_irqsave(&adapter->req_list_lock, flags); |
297 | fsf_req = zfcp_reqlist_ismember(adapter, req_id); | 297 | fsf_req = zfcp_reqlist_find(adapter, req_id); |
298 | 298 | ||
299 | if (!fsf_req) { | 299 | if (!fsf_req) |
300 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); | 300 | /* |
301 | ZFCP_LOG_NORMAL("error: unknown request id (%ld).\n", req_id); | 301 | * Unknown request means that we have potentially memory |
302 | zfcp_erp_adapter_reopen(adapter, 0); | 302 | * corruption and must stop the machine immediatly. |
303 | return -EINVAL; | 303 | */ |
304 | } | 304 | panic("error: unknown request id (%ld) on adapter %s.\n", |
305 | req_id, zfcp_get_busid_by_adapter(adapter)); | ||
305 | 306 | ||
306 | zfcp_reqlist_remove(adapter, req_id); | 307 | zfcp_reqlist_remove(adapter, fsf_req); |
307 | atomic_dec(&adapter->reqs_active); | 308 | atomic_dec(&adapter->reqs_active); |
308 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); | 309 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); |
309 | 310 | ||
310 | /* finish the FSF request */ | 311 | /* finish the FSF request */ |
311 | zfcp_fsf_req_complete(fsf_req); | 312 | zfcp_fsf_req_complete(fsf_req); |
312 | |||
313 | return 0; | ||
314 | } | 313 | } |
315 | 314 | ||
316 | /* | 315 | /* |
@@ -374,27 +373,9 @@ zfcp_qdio_response_handler(struct ccw_device *ccw_device, | |||
374 | 373 | ||
375 | /* look for QDIO request identifiers in SB */ | 374 | /* look for QDIO request identifiers in SB */ |
376 | buffere = &buffer->element[buffere_index]; | 375 | buffere = &buffer->element[buffere_index]; |
377 | retval = zfcp_qdio_reqid_check(adapter, | 376 | zfcp_qdio_reqid_check(adapter, |
378 | (unsigned long) buffere->addr); | 377 | (unsigned long) buffere->addr); |
379 | 378 | ||
380 | if (retval) { | ||
381 | ZFCP_LOG_NORMAL("bug: unexpected inbound " | ||
382 | "packet on adapter %s " | ||
383 | "(reqid=0x%lx, " | ||
384 | "first_element=%d, " | ||
385 | "elements_processed=%d)\n", | ||
386 | zfcp_get_busid_by_adapter(adapter), | ||
387 | (unsigned long) buffere->addr, | ||
388 | first_element, | ||
389 | elements_processed); | ||
390 | ZFCP_LOG_NORMAL("hex dump of inbound buffer " | ||
391 | "at address %p " | ||
392 | "(buffer_index=%d, " | ||
393 | "buffere_index=%d)\n", buffer, | ||
394 | buffer_index, buffere_index); | ||
395 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL, | ||
396 | (char *) buffer, SBAL_SIZE); | ||
397 | } | ||
398 | /* | 379 | /* |
399 | * A single used SBALE per inbound SBALE has been | 380 | * A single used SBALE per inbound SBALE has been |
400 | * implemented by QDIO so far. Hope they will | 381 | * implemented by QDIO so far. Hope they will |
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 99db02062c3b..16e2d64658af 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_SCSI | 22 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_SCSI |
23 | 23 | ||
24 | #include "zfcp_ext.h" | 24 | #include "zfcp_ext.h" |
25 | #include <asm/atomic.h> | ||
25 | 26 | ||
26 | static void zfcp_scsi_slave_destroy(struct scsi_device *sdp); | 27 | static void zfcp_scsi_slave_destroy(struct scsi_device *sdp); |
27 | static int zfcp_scsi_slave_alloc(struct scsi_device *sdp); | 28 | static int zfcp_scsi_slave_alloc(struct scsi_device *sdp); |
@@ -179,6 +180,10 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt) | |||
179 | struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata; | 180 | struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata; |
180 | 181 | ||
181 | if (unit) { | 182 | if (unit) { |
183 | zfcp_erp_wait(unit->port->adapter); | ||
184 | wait_event(unit->scsi_scan_wq, | ||
185 | atomic_test_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, | ||
186 | &unit->status) == 0); | ||
182 | atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status); | 187 | atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status); |
183 | sdpnt->hostdata = NULL; | 188 | sdpnt->hostdata = NULL; |
184 | unit->device = NULL; | 189 | unit->device = NULL; |
@@ -402,8 +407,8 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt) | |||
402 | 407 | ||
403 | /* Check whether corresponding fsf_req is still pending */ | 408 | /* Check whether corresponding fsf_req is still pending */ |
404 | spin_lock(&adapter->req_list_lock); | 409 | spin_lock(&adapter->req_list_lock); |
405 | fsf_req = zfcp_reqlist_ismember(adapter, (unsigned long) | 410 | fsf_req = zfcp_reqlist_find(adapter, |
406 | scpnt->host_scribble); | 411 | (unsigned long) scpnt->host_scribble); |
407 | spin_unlock(&adapter->req_list_lock); | 412 | spin_unlock(&adapter->req_list_lock); |
408 | if (!fsf_req) { | 413 | if (!fsf_req) { |
409 | write_unlock_irqrestore(&adapter->abort_lock, flags); | 414 | write_unlock_irqrestore(&adapter->abort_lock, flags); |
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 33682ce96a5d..3009ad8c4073 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c | |||
@@ -387,12 +387,11 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) | |||
387 | * Ok now init the communication subsystem | 387 | * Ok now init the communication subsystem |
388 | */ | 388 | */ |
389 | 389 | ||
390 | dev->queues = kmalloc(sizeof(struct aac_queue_block), GFP_KERNEL); | 390 | dev->queues = kzalloc(sizeof(struct aac_queue_block), GFP_KERNEL); |
391 | if (dev->queues == NULL) { | 391 | if (dev->queues == NULL) { |
392 | printk(KERN_ERR "Error could not allocate comm region.\n"); | 392 | printk(KERN_ERR "Error could not allocate comm region.\n"); |
393 | return NULL; | 393 | return NULL; |
394 | } | 394 | } |
395 | memset(dev->queues, 0, sizeof(struct aac_queue_block)); | ||
396 | 395 | ||
397 | if (aac_comm_init(dev)<0){ | 396 | if (aac_comm_init(dev)<0){ |
398 | kfree(dev->queues); | 397 | kfree(dev->queues); |
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 5824a757a753..9aca57eda943 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c | |||
@@ -1223,13 +1223,11 @@ int aac_check_health(struct aac_dev * aac) | |||
1223 | * Warning: no sleep allowed while | 1223 | * Warning: no sleep allowed while |
1224 | * holding spinlock | 1224 | * holding spinlock |
1225 | */ | 1225 | */ |
1226 | hw_fib = kmalloc(sizeof(struct hw_fib), GFP_ATOMIC); | 1226 | hw_fib = kzalloc(sizeof(struct hw_fib), GFP_ATOMIC); |
1227 | fib = kmalloc(sizeof(struct fib), GFP_ATOMIC); | 1227 | fib = kzalloc(sizeof(struct fib), GFP_ATOMIC); |
1228 | if (fib && hw_fib) { | 1228 | if (fib && hw_fib) { |
1229 | struct aac_aifcmd * aif; | 1229 | struct aac_aifcmd * aif; |
1230 | 1230 | ||
1231 | memset(hw_fib, 0, sizeof(struct hw_fib)); | ||
1232 | memset(fib, 0, sizeof(struct fib)); | ||
1233 | fib->hw_fib_va = hw_fib; | 1231 | fib->hw_fib_va = hw_fib; |
1234 | fib->dev = aac; | 1232 | fib->dev = aac; |
1235 | aac_fib_init(fib); | 1233 | aac_fib_init(fib); |
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c index 42c7dcda6d9b..fcd25f7d0bc6 100644 --- a/drivers/scsi/aacraid/dpcsup.c +++ b/drivers/scsi/aacraid/dpcsup.c | |||
@@ -248,16 +248,14 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index) | |||
248 | * manage the linked lists. | 248 | * manage the linked lists. |
249 | */ | 249 | */ |
250 | if ((!dev->aif_thread) | 250 | if ((!dev->aif_thread) |
251 | || (!(fib = kmalloc(sizeof(struct fib),GFP_ATOMIC)))) | 251 | || (!(fib = kzalloc(sizeof(struct fib),GFP_ATOMIC)))) |
252 | return 1; | 252 | return 1; |
253 | if (!(hw_fib = kmalloc(sizeof(struct hw_fib),GFP_ATOMIC))) { | 253 | if (!(hw_fib = kzalloc(sizeof(struct hw_fib),GFP_ATOMIC))) { |
254 | kfree (fib); | 254 | kfree (fib); |
255 | return 1; | 255 | return 1; |
256 | } | 256 | } |
257 | memset(hw_fib, 0, sizeof(struct hw_fib)); | ||
258 | memcpy(hw_fib, (struct hw_fib *)(((ptrdiff_t)(dev->regs.sa)) + | 257 | memcpy(hw_fib, (struct hw_fib *)(((ptrdiff_t)(dev->regs.sa)) + |
259 | (index & ~0x00000002L)), sizeof(struct hw_fib)); | 258 | (index & ~0x00000002L)), sizeof(struct hw_fib)); |
260 | memset(fib, 0, sizeof(struct fib)); | ||
261 | INIT_LIST_HEAD(&fib->fiblink); | 259 | INIT_LIST_HEAD(&fib->fiblink); |
262 | fib->type = FSAFS_NTC_FIB_CONTEXT; | 260 | fib->type = FSAFS_NTC_FIB_CONTEXT; |
263 | fib->size = sizeof(struct fib); | 261 | fib->size = sizeof(struct fib); |
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c index 0c71315cbf1a..291cd14f4e98 100644 --- a/drivers/scsi/aacraid/rx.c +++ b/drivers/scsi/aacraid/rx.c | |||
@@ -539,8 +539,10 @@ int _aac_rx_init(struct aac_dev *dev) | |||
539 | } | 539 | } |
540 | 540 | ||
541 | /* Failure to reset here is an option ... */ | 541 | /* Failure to reset here is an option ... */ |
542 | dev->a_ops.adapter_sync_cmd = rx_sync_cmd; | ||
543 | dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt; | ||
542 | dev->OIMR = status = rx_readb (dev, MUnit.OIMR); | 544 | dev->OIMR = status = rx_readb (dev, MUnit.OIMR); |
543 | if ((((status & 0xff) != 0xff) || reset_devices) && | 545 | if ((((status & 0x0c) != 0x0c) || reset_devices) && |
544 | !aac_rx_restart_adapter(dev, 0)) | 546 | !aac_rx_restart_adapter(dev, 0)) |
545 | ++restart; | 547 | ++restart; |
546 | /* | 548 | /* |
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 2a2cc6cf1182..2311019304c0 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c | |||
@@ -319,10 +319,9 @@ ch_readconfig(scsi_changer *ch) | |||
319 | int result,id,lun,i; | 319 | int result,id,lun,i; |
320 | u_int elem; | 320 | u_int elem; |
321 | 321 | ||
322 | buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); | 322 | buffer = kzalloc(512, GFP_KERNEL | GFP_DMA); |
323 | if (!buffer) | 323 | if (!buffer) |
324 | return -ENOMEM; | 324 | return -ENOMEM; |
325 | memset(buffer,0,512); | ||
326 | 325 | ||
327 | memset(cmd,0,sizeof(cmd)); | 326 | memset(cmd,0,sizeof(cmd)); |
328 | cmd[0] = MODE_SENSE; | 327 | cmd[0] = MODE_SENSE; |
@@ -530,10 +529,9 @@ ch_set_voltag(scsi_changer *ch, u_int elem, | |||
530 | u_char *buffer; | 529 | u_char *buffer; |
531 | int result; | 530 | int result; |
532 | 531 | ||
533 | buffer = kmalloc(512, GFP_KERNEL); | 532 | buffer = kzalloc(512, GFP_KERNEL); |
534 | if (!buffer) | 533 | if (!buffer) |
535 | return -ENOMEM; | 534 | return -ENOMEM; |
536 | memset(buffer,0,512); | ||
537 | 535 | ||
538 | dprintk("%s %s voltag: 0x%x => \"%s\"\n", | 536 | dprintk("%s %s voltag: 0x%x => \"%s\"\n", |
539 | clear ? "clear" : "set", | 537 | clear ? "clear" : "set", |
@@ -922,11 +920,10 @@ static int ch_probe(struct device *dev) | |||
922 | if (sd->type != TYPE_MEDIUM_CHANGER) | 920 | if (sd->type != TYPE_MEDIUM_CHANGER) |
923 | return -ENODEV; | 921 | return -ENODEV; |
924 | 922 | ||
925 | ch = kmalloc(sizeof(*ch), GFP_KERNEL); | 923 | ch = kzalloc(sizeof(*ch), GFP_KERNEL); |
926 | if (NULL == ch) | 924 | if (NULL == ch) |
927 | return -ENOMEM; | 925 | return -ENOMEM; |
928 | 926 | ||
929 | memset(ch,0,sizeof(*ch)); | ||
930 | ch->minor = ch_devcount; | 927 | ch->minor = ch_devcount; |
931 | sprintf(ch->name,"ch%d",ch->minor); | 928 | sprintf(ch->name,"ch%d",ch->minor); |
932 | mutex_init(&ch->lock); | 929 | mutex_init(&ch->lock); |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index fb6433a56989..8c7d2bbf9b1a 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -1308,13 +1308,12 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba) | |||
1308 | schedule_timeout_uninterruptible(1); | 1308 | schedule_timeout_uninterruptible(1); |
1309 | } while (m == EMPTY_QUEUE); | 1309 | } while (m == EMPTY_QUEUE); |
1310 | 1310 | ||
1311 | status = kmalloc(4, GFP_KERNEL|ADDR32); | 1311 | status = kzalloc(4, GFP_KERNEL|ADDR32); |
1312 | if(status == NULL) { | 1312 | if(status == NULL) { |
1313 | adpt_send_nop(pHba, m); | 1313 | adpt_send_nop(pHba, m); |
1314 | printk(KERN_ERR"IOP reset failed - no free memory.\n"); | 1314 | printk(KERN_ERR"IOP reset failed - no free memory.\n"); |
1315 | return -ENOMEM; | 1315 | return -ENOMEM; |
1316 | } | 1316 | } |
1317 | memset(status,0,4); | ||
1318 | 1317 | ||
1319 | msg[0]=EIGHT_WORD_MSG_SIZE|SGL_OFFSET_0; | 1318 | msg[0]=EIGHT_WORD_MSG_SIZE|SGL_OFFSET_0; |
1320 | msg[1]=I2O_CMD_ADAPTER_RESET<<24|HOST_TID<<12|ADAPTER_TID; | 1319 | msg[1]=I2O_CMD_ADAPTER_RESET<<24|HOST_TID<<12|ADAPTER_TID; |
@@ -1504,21 +1503,19 @@ static int adpt_i2o_parse_lct(adpt_hba* pHba) | |||
1504 | continue; | 1503 | continue; |
1505 | } | 1504 | } |
1506 | if( pHba->channel[bus_no].device[scsi_id] == NULL){ | 1505 | if( pHba->channel[bus_no].device[scsi_id] == NULL){ |
1507 | pDev = kmalloc(sizeof(struct adpt_device),GFP_KERNEL); | 1506 | pDev = kzalloc(sizeof(struct adpt_device),GFP_KERNEL); |
1508 | if(pDev == NULL) { | 1507 | if(pDev == NULL) { |
1509 | return -ENOMEM; | 1508 | return -ENOMEM; |
1510 | } | 1509 | } |
1511 | pHba->channel[bus_no].device[scsi_id] = pDev; | 1510 | pHba->channel[bus_no].device[scsi_id] = pDev; |
1512 | memset(pDev,0,sizeof(struct adpt_device)); | ||
1513 | } else { | 1511 | } else { |
1514 | for( pDev = pHba->channel[bus_no].device[scsi_id]; | 1512 | for( pDev = pHba->channel[bus_no].device[scsi_id]; |
1515 | pDev->next_lun; pDev = pDev->next_lun){ | 1513 | pDev->next_lun; pDev = pDev->next_lun){ |
1516 | } | 1514 | } |
1517 | pDev->next_lun = kmalloc(sizeof(struct adpt_device),GFP_KERNEL); | 1515 | pDev->next_lun = kzalloc(sizeof(struct adpt_device),GFP_KERNEL); |
1518 | if(pDev->next_lun == NULL) { | 1516 | if(pDev->next_lun == NULL) { |
1519 | return -ENOMEM; | 1517 | return -ENOMEM; |
1520 | } | 1518 | } |
1521 | memset(pDev->next_lun,0,sizeof(struct adpt_device)); | ||
1522 | pDev = pDev->next_lun; | 1519 | pDev = pDev->next_lun; |
1523 | } | 1520 | } |
1524 | pDev->tid = tid; | 1521 | pDev->tid = tid; |
@@ -1667,12 +1664,11 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg) | |||
1667 | reply_size = REPLY_FRAME_SIZE; | 1664 | reply_size = REPLY_FRAME_SIZE; |
1668 | } | 1665 | } |
1669 | reply_size *= 4; | 1666 | reply_size *= 4; |
1670 | reply = kmalloc(REPLY_FRAME_SIZE*4, GFP_KERNEL); | 1667 | reply = kzalloc(REPLY_FRAME_SIZE*4, GFP_KERNEL); |
1671 | if(reply == NULL) { | 1668 | if(reply == NULL) { |
1672 | printk(KERN_WARNING"%s: Could not allocate reply buffer\n",pHba->name); | 1669 | printk(KERN_WARNING"%s: Could not allocate reply buffer\n",pHba->name); |
1673 | return -ENOMEM; | 1670 | return -ENOMEM; |
1674 | } | 1671 | } |
1675 | memset(reply,0,REPLY_FRAME_SIZE*4); | ||
1676 | sg_offset = (msg[0]>>4)&0xf; | 1672 | sg_offset = (msg[0]>>4)&0xf; |
1677 | msg[2] = 0x40000000; // IOCTL context | 1673 | msg[2] = 0x40000000; // IOCTL context |
1678 | msg[3] = (u32)reply; | 1674 | msg[3] = (u32)reply; |
@@ -2444,7 +2440,7 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) | |||
2444 | } | 2440 | } |
2445 | pDev = pHba->channel[bus_no].device[scsi_id]; | 2441 | pDev = pHba->channel[bus_no].device[scsi_id]; |
2446 | if( pDev == NULL){ | 2442 | if( pDev == NULL){ |
2447 | pDev = kmalloc(sizeof(struct adpt_device),GFP_KERNEL); | 2443 | pDev = kzalloc(sizeof(struct adpt_device),GFP_KERNEL); |
2448 | if(pDev == NULL) { | 2444 | if(pDev == NULL) { |
2449 | return -ENOMEM; | 2445 | return -ENOMEM; |
2450 | } | 2446 | } |
@@ -2453,12 +2449,11 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) | |||
2453 | while (pDev->next_lun) { | 2449 | while (pDev->next_lun) { |
2454 | pDev = pDev->next_lun; | 2450 | pDev = pDev->next_lun; |
2455 | } | 2451 | } |
2456 | pDev = pDev->next_lun = kmalloc(sizeof(struct adpt_device),GFP_KERNEL); | 2452 | pDev = pDev->next_lun = kzalloc(sizeof(struct adpt_device),GFP_KERNEL); |
2457 | if(pDev == NULL) { | 2453 | if(pDev == NULL) { |
2458 | return -ENOMEM; | 2454 | return -ENOMEM; |
2459 | } | 2455 | } |
2460 | } | 2456 | } |
2461 | memset(pDev,0,sizeof(struct adpt_device)); | ||
2462 | pDev->tid = d->lct_data.tid; | 2457 | pDev->tid = d->lct_data.tid; |
2463 | pDev->scsi_channel = bus_no; | 2458 | pDev->scsi_channel = bus_no; |
2464 | pDev->scsi_id = scsi_id; | 2459 | pDev->scsi_id = scsi_id; |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 2c7b77e833f9..4baa79e68679 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -92,6 +92,7 @@ static unsigned int ipr_fastfail = 0; | |||
92 | static unsigned int ipr_transop_timeout = 0; | 92 | static unsigned int ipr_transop_timeout = 0; |
93 | static unsigned int ipr_enable_cache = 1; | 93 | static unsigned int ipr_enable_cache = 1; |
94 | static unsigned int ipr_debug = 0; | 94 | static unsigned int ipr_debug = 0; |
95 | static unsigned int ipr_dual_ioa_raid = 1; | ||
95 | static DEFINE_SPINLOCK(ipr_driver_lock); | 96 | static DEFINE_SPINLOCK(ipr_driver_lock); |
96 | 97 | ||
97 | /* This table describes the differences between DMA controller chips */ | 98 | /* This table describes the differences between DMA controller chips */ |
@@ -158,6 +159,8 @@ module_param_named(enable_cache, ipr_enable_cache, int, 0); | |||
158 | MODULE_PARM_DESC(enable_cache, "Enable adapter's non-volatile write cache (default: 1)"); | 159 | MODULE_PARM_DESC(enable_cache, "Enable adapter's non-volatile write cache (default: 1)"); |
159 | module_param_named(debug, ipr_debug, int, 0); | 160 | module_param_named(debug, ipr_debug, int, 0); |
160 | MODULE_PARM_DESC(debug, "Enable device driver debugging logging. Set to 1 to enable. (default: 0)"); | 161 | MODULE_PARM_DESC(debug, "Enable device driver debugging logging. Set to 1 to enable. (default: 0)"); |
162 | module_param_named(dual_ioa_raid, ipr_dual_ioa_raid, int, 0); | ||
163 | MODULE_PARM_DESC(dual_ioa_raid, "Enable dual adapter RAID support. Set to 1 to enable. (default: 1)"); | ||
161 | MODULE_LICENSE("GPL"); | 164 | MODULE_LICENSE("GPL"); |
162 | MODULE_VERSION(IPR_DRIVER_VERSION); | 165 | MODULE_VERSION(IPR_DRIVER_VERSION); |
163 | 166 | ||
@@ -206,6 +209,8 @@ struct ipr_error_table_t ipr_error_table[] = { | |||
206 | "8009: Impending cache battery pack failure"}, | 209 | "8009: Impending cache battery pack failure"}, |
207 | {0x02040400, 0, 0, | 210 | {0x02040400, 0, 0, |
208 | "34FF: Disk device format in progress"}, | 211 | "34FF: Disk device format in progress"}, |
212 | {0x02048000, 0, IPR_DEFAULT_LOG_LEVEL, | ||
213 | "9070: IOA requested reset"}, | ||
209 | {0x023F0000, 0, 0, | 214 | {0x023F0000, 0, 0, |
210 | "Synchronization required"}, | 215 | "Synchronization required"}, |
211 | {0x024E0000, 0, 0, | 216 | {0x024E0000, 0, 0, |
@@ -951,6 +956,53 @@ static void ipr_process_ccn(struct ipr_cmnd *ipr_cmd) | |||
951 | } | 956 | } |
952 | 957 | ||
953 | /** | 958 | /** |
959 | * strip_and_pad_whitespace - Strip and pad trailing whitespace. | ||
960 | * @i: index into buffer | ||
961 | * @buf: string to modify | ||
962 | * | ||
963 | * This function will strip all trailing whitespace, pad the end | ||
964 | * of the string with a single space, and NULL terminate the string. | ||
965 | * | ||
966 | * Return value: | ||
967 | * new length of string | ||
968 | **/ | ||
969 | static int strip_and_pad_whitespace(int i, char *buf) | ||
970 | { | ||
971 | while (i && buf[i] == ' ') | ||
972 | i--; | ||
973 | buf[i+1] = ' '; | ||
974 | buf[i+2] = '\0'; | ||
975 | return i + 2; | ||
976 | } | ||
977 | |||
978 | /** | ||
979 | * ipr_log_vpd_compact - Log the passed extended VPD compactly. | ||
980 | * @prefix: string to print at start of printk | ||
981 | * @hostrcb: hostrcb pointer | ||
982 | * @vpd: vendor/product id/sn struct | ||
983 | * | ||
984 | * Return value: | ||
985 | * none | ||
986 | **/ | ||
987 | static void ipr_log_vpd_compact(char *prefix, struct ipr_hostrcb *hostrcb, | ||
988 | struct ipr_vpd *vpd) | ||
989 | { | ||
990 | char buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN + IPR_SERIAL_NUM_LEN + 3]; | ||
991 | int i = 0; | ||
992 | |||
993 | memcpy(buffer, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN); | ||
994 | i = strip_and_pad_whitespace(IPR_VENDOR_ID_LEN - 1, buffer); | ||
995 | |||
996 | memcpy(&buffer[i], vpd->vpids.product_id, IPR_PROD_ID_LEN); | ||
997 | i = strip_and_pad_whitespace(i + IPR_PROD_ID_LEN - 1, buffer); | ||
998 | |||
999 | memcpy(&buffer[i], vpd->sn, IPR_SERIAL_NUM_LEN); | ||
1000 | buffer[IPR_SERIAL_NUM_LEN + i] = '\0'; | ||
1001 | |||
1002 | ipr_hcam_err(hostrcb, "%s VPID/SN: %s\n", prefix, buffer); | ||
1003 | } | ||
1004 | |||
1005 | /** | ||
954 | * ipr_log_vpd - Log the passed VPD to the error log. | 1006 | * ipr_log_vpd - Log the passed VPD to the error log. |
955 | * @vpd: vendor/product id/sn struct | 1007 | * @vpd: vendor/product id/sn struct |
956 | * | 1008 | * |
@@ -974,6 +1026,23 @@ static void ipr_log_vpd(struct ipr_vpd *vpd) | |||
974 | } | 1026 | } |
975 | 1027 | ||
976 | /** | 1028 | /** |
1029 | * ipr_log_ext_vpd_compact - Log the passed extended VPD compactly. | ||
1030 | * @prefix: string to print at start of printk | ||
1031 | * @hostrcb: hostrcb pointer | ||
1032 | * @vpd: vendor/product id/sn/wwn struct | ||
1033 | * | ||
1034 | * Return value: | ||
1035 | * none | ||
1036 | **/ | ||
1037 | static void ipr_log_ext_vpd_compact(char *prefix, struct ipr_hostrcb *hostrcb, | ||
1038 | struct ipr_ext_vpd *vpd) | ||
1039 | { | ||
1040 | ipr_log_vpd_compact(prefix, hostrcb, &vpd->vpd); | ||
1041 | ipr_hcam_err(hostrcb, "%s WWN: %08X%08X\n", prefix, | ||
1042 | be32_to_cpu(vpd->wwid[0]), be32_to_cpu(vpd->wwid[1])); | ||
1043 | } | ||
1044 | |||
1045 | /** | ||
977 | * ipr_log_ext_vpd - Log the passed extended VPD to the error log. | 1046 | * ipr_log_ext_vpd - Log the passed extended VPD to the error log. |
978 | * @vpd: vendor/product id/sn/wwn struct | 1047 | * @vpd: vendor/product id/sn/wwn struct |
979 | * | 1048 | * |
@@ -1287,10 +1356,11 @@ static void ipr_log_enhanced_dual_ioa_error(struct ipr_ioa_cfg *ioa_cfg, | |||
1287 | 1356 | ||
1288 | error = &hostrcb->hcam.u.error.u.type_17_error; | 1357 | error = &hostrcb->hcam.u.error.u.type_17_error; |
1289 | error->failure_reason[sizeof(error->failure_reason) - 1] = '\0'; | 1358 | error->failure_reason[sizeof(error->failure_reason) - 1] = '\0'; |
1359 | strstrip(error->failure_reason); | ||
1290 | 1360 | ||
1291 | ipr_err("%s\n", error->failure_reason); | 1361 | ipr_hcam_err(hostrcb, "%s [PRC: %08X]\n", error->failure_reason, |
1292 | ipr_err("Remote Adapter VPD:\n"); | 1362 | be32_to_cpu(hostrcb->hcam.u.error.prc)); |
1293 | ipr_log_ext_vpd(&error->vpd); | 1363 | ipr_log_ext_vpd_compact("Remote IOA", hostrcb, &error->vpd); |
1294 | ipr_log_hex_data(ioa_cfg, error->data, | 1364 | ipr_log_hex_data(ioa_cfg, error->data, |
1295 | be32_to_cpu(hostrcb->hcam.length) - | 1365 | be32_to_cpu(hostrcb->hcam.length) - |
1296 | (offsetof(struct ipr_hostrcb_error, u) + | 1366 | (offsetof(struct ipr_hostrcb_error, u) + |
@@ -1312,10 +1382,11 @@ static void ipr_log_dual_ioa_error(struct ipr_ioa_cfg *ioa_cfg, | |||
1312 | 1382 | ||
1313 | error = &hostrcb->hcam.u.error.u.type_07_error; | 1383 | error = &hostrcb->hcam.u.error.u.type_07_error; |
1314 | error->failure_reason[sizeof(error->failure_reason) - 1] = '\0'; | 1384 | error->failure_reason[sizeof(error->failure_reason) - 1] = '\0'; |
1385 | strstrip(error->failure_reason); | ||
1315 | 1386 | ||
1316 | ipr_err("%s\n", error->failure_reason); | 1387 | ipr_hcam_err(hostrcb, "%s [PRC: %08X]\n", error->failure_reason, |
1317 | ipr_err("Remote Adapter VPD:\n"); | 1388 | be32_to_cpu(hostrcb->hcam.u.error.prc)); |
1318 | ipr_log_vpd(&error->vpd); | 1389 | ipr_log_vpd_compact("Remote IOA", hostrcb, &error->vpd); |
1319 | ipr_log_hex_data(ioa_cfg, error->data, | 1390 | ipr_log_hex_data(ioa_cfg, error->data, |
1320 | be32_to_cpu(hostrcb->hcam.length) - | 1391 | be32_to_cpu(hostrcb->hcam.length) - |
1321 | (offsetof(struct ipr_hostrcb_error, u) + | 1392 | (offsetof(struct ipr_hostrcb_error, u) + |
@@ -1672,12 +1743,15 @@ static void ipr_process_error(struct ipr_cmnd *ipr_cmd) | |||
1672 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; | 1743 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; |
1673 | struct ipr_hostrcb *hostrcb = ipr_cmd->u.hostrcb; | 1744 | struct ipr_hostrcb *hostrcb = ipr_cmd->u.hostrcb; |
1674 | u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc); | 1745 | u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc); |
1746 | u32 fd_ioasc = be32_to_cpu(hostrcb->hcam.u.error.failing_dev_ioasc); | ||
1675 | 1747 | ||
1676 | list_del(&hostrcb->queue); | 1748 | list_del(&hostrcb->queue); |
1677 | list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q); | 1749 | list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q); |
1678 | 1750 | ||
1679 | if (!ioasc) { | 1751 | if (!ioasc) { |
1680 | ipr_handle_log_data(ioa_cfg, hostrcb); | 1752 | ipr_handle_log_data(ioa_cfg, hostrcb); |
1753 | if (fd_ioasc == IPR_IOASC_NR_IOA_RESET_REQUIRED) | ||
1754 | ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_ABBREV); | ||
1681 | } else if (ioasc != IPR_IOASC_IOA_WAS_RESET) { | 1755 | } else if (ioasc != IPR_IOASC_IOA_WAS_RESET) { |
1682 | dev_err(&ioa_cfg->pdev->dev, | 1756 | dev_err(&ioa_cfg->pdev->dev, |
1683 | "Host RCB failed with IOASC: 0x%08X\n", ioasc); | 1757 | "Host RCB failed with IOASC: 0x%08X\n", ioasc); |
@@ -2635,8 +2709,13 @@ static ssize_t ipr_store_diagnostics(struct class_device *class_dev, | |||
2635 | if (!capable(CAP_SYS_ADMIN)) | 2709 | if (!capable(CAP_SYS_ADMIN)) |
2636 | return -EACCES; | 2710 | return -EACCES; |
2637 | 2711 | ||
2638 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | ||
2639 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | 2712 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
2713 | while(ioa_cfg->in_reset_reload) { | ||
2714 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | ||
2715 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | ||
2716 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | ||
2717 | } | ||
2718 | |||
2640 | ioa_cfg->errors_logged = 0; | 2719 | ioa_cfg->errors_logged = 0; |
2641 | ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NORMAL); | 2720 | ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NORMAL); |
2642 | 2721 | ||
@@ -2958,6 +3037,11 @@ static int ipr_update_ioa_ucode(struct ipr_ioa_cfg *ioa_cfg, | |||
2958 | unsigned long lock_flags; | 3037 | unsigned long lock_flags; |
2959 | 3038 | ||
2960 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | 3039 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
3040 | while(ioa_cfg->in_reset_reload) { | ||
3041 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | ||
3042 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | ||
3043 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | ||
3044 | } | ||
2961 | 3045 | ||
2962 | if (ioa_cfg->ucode_sglist) { | 3046 | if (ioa_cfg->ucode_sglist) { |
2963 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | 3047 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
@@ -4656,18 +4740,19 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg, | |||
4656 | struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; | 4740 | struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; |
4657 | struct ipr_resource_entry *res = scsi_cmd->device->hostdata; | 4741 | struct ipr_resource_entry *res = scsi_cmd->device->hostdata; |
4658 | u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc); | 4742 | u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc); |
4743 | u32 masked_ioasc = ioasc & IPR_IOASC_IOASC_MASK; | ||
4659 | 4744 | ||
4660 | if (!res) { | 4745 | if (!res) { |
4661 | ipr_scsi_eh_done(ipr_cmd); | 4746 | ipr_scsi_eh_done(ipr_cmd); |
4662 | return; | 4747 | return; |
4663 | } | 4748 | } |
4664 | 4749 | ||
4665 | if (!ipr_is_gscsi(res)) | 4750 | if (!ipr_is_gscsi(res) && masked_ioasc != IPR_IOASC_HW_DEV_BUS_STATUS) |
4666 | ipr_gen_sense(ipr_cmd); | 4751 | ipr_gen_sense(ipr_cmd); |
4667 | 4752 | ||
4668 | ipr_dump_ioasa(ioa_cfg, ipr_cmd, res); | 4753 | ipr_dump_ioasa(ioa_cfg, ipr_cmd, res); |
4669 | 4754 | ||
4670 | switch (ioasc & IPR_IOASC_IOASC_MASK) { | 4755 | switch (masked_ioasc) { |
4671 | case IPR_IOASC_ABORTED_CMD_TERM_BY_HOST: | 4756 | case IPR_IOASC_ABORTED_CMD_TERM_BY_HOST: |
4672 | if (ipr_is_naca_model(res)) | 4757 | if (ipr_is_naca_model(res)) |
4673 | scsi_cmd->result |= (DID_ABORT << 16); | 4758 | scsi_cmd->result |= (DID_ABORT << 16); |
@@ -5363,6 +5448,7 @@ static int ipr_ioa_reset_done(struct ipr_cmnd *ipr_cmd) | |||
5363 | ipr_send_hcam(ioa_cfg, IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE, hostrcb); | 5448 | ipr_send_hcam(ioa_cfg, IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE, hostrcb); |
5364 | } | 5449 | } |
5365 | 5450 | ||
5451 | scsi_report_bus_reset(ioa_cfg->host, IPR_VSET_BUS); | ||
5366 | dev_info(&ioa_cfg->pdev->dev, "IOA initialized.\n"); | 5452 | dev_info(&ioa_cfg->pdev->dev, "IOA initialized.\n"); |
5367 | 5453 | ||
5368 | ioa_cfg->reset_retries = 0; | 5454 | ioa_cfg->reset_retries = 0; |
@@ -5799,6 +5885,94 @@ static int ipr_ioafp_mode_sense_page28(struct ipr_cmnd *ipr_cmd) | |||
5799 | } | 5885 | } |
5800 | 5886 | ||
5801 | /** | 5887 | /** |
5888 | * ipr_ioafp_mode_select_page24 - Issue Mode Select to IOA | ||
5889 | * @ipr_cmd: ipr command struct | ||
5890 | * | ||
5891 | * This function enables dual IOA RAID support if possible. | ||
5892 | * | ||
5893 | * Return value: | ||
5894 | * IPR_RC_JOB_RETURN | ||
5895 | **/ | ||
5896 | static int ipr_ioafp_mode_select_page24(struct ipr_cmnd *ipr_cmd) | ||
5897 | { | ||
5898 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; | ||
5899 | struct ipr_mode_pages *mode_pages = &ioa_cfg->vpd_cbs->mode_pages; | ||
5900 | struct ipr_mode_page24 *mode_page; | ||
5901 | int length; | ||
5902 | |||
5903 | ENTER; | ||
5904 | mode_page = ipr_get_mode_page(mode_pages, 0x24, | ||
5905 | sizeof(struct ipr_mode_page24)); | ||
5906 | |||
5907 | if (mode_page) | ||
5908 | mode_page->flags |= IPR_ENABLE_DUAL_IOA_AF; | ||
5909 | |||
5910 | length = mode_pages->hdr.length + 1; | ||
5911 | mode_pages->hdr.length = 0; | ||
5912 | |||
5913 | ipr_build_mode_select(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), 0x11, | ||
5914 | ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, mode_pages), | ||
5915 | length); | ||
5916 | |||
5917 | ipr_cmd->job_step = ipr_ioafp_mode_sense_page28; | ||
5918 | ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT); | ||
5919 | |||
5920 | LEAVE; | ||
5921 | return IPR_RC_JOB_RETURN; | ||
5922 | } | ||
5923 | |||
5924 | /** | ||
5925 | * ipr_reset_mode_sense_page24_failed - Handle failure of IOAFP mode sense | ||
5926 | * @ipr_cmd: ipr command struct | ||
5927 | * | ||
5928 | * This function handles the failure of a Mode Sense to the IOAFP. | ||
5929 | * Some adapters do not handle all mode pages. | ||
5930 | * | ||
5931 | * Return value: | ||
5932 | * IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN | ||
5933 | **/ | ||
5934 | static int ipr_reset_mode_sense_page24_failed(struct ipr_cmnd *ipr_cmd) | ||
5935 | { | ||
5936 | u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc); | ||
5937 | |||
5938 | if (ioasc == IPR_IOASC_IR_INVALID_REQ_TYPE_OR_PKT) { | ||
5939 | ipr_cmd->job_step = ipr_ioafp_mode_sense_page28; | ||
5940 | return IPR_RC_JOB_CONTINUE; | ||
5941 | } | ||
5942 | |||
5943 | return ipr_reset_cmd_failed(ipr_cmd); | ||
5944 | } | ||
5945 | |||
5946 | /** | ||
5947 | * ipr_ioafp_mode_sense_page24 - Issue Page 24 Mode Sense to IOA | ||
5948 | * @ipr_cmd: ipr command struct | ||
5949 | * | ||
5950 | * This function send a mode sense to the IOA to retrieve | ||
5951 | * the IOA Advanced Function Control mode page. | ||
5952 | * | ||
5953 | * Return value: | ||
5954 | * IPR_RC_JOB_RETURN | ||
5955 | **/ | ||
5956 | static int ipr_ioafp_mode_sense_page24(struct ipr_cmnd *ipr_cmd) | ||
5957 | { | ||
5958 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; | ||
5959 | |||
5960 | ENTER; | ||
5961 | ipr_build_mode_sense(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), | ||
5962 | 0x24, ioa_cfg->vpd_cbs_dma + | ||
5963 | offsetof(struct ipr_misc_cbs, mode_pages), | ||
5964 | sizeof(struct ipr_mode_pages)); | ||
5965 | |||
5966 | ipr_cmd->job_step = ipr_ioafp_mode_select_page24; | ||
5967 | ipr_cmd->job_step_failed = ipr_reset_mode_sense_page24_failed; | ||
5968 | |||
5969 | ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT); | ||
5970 | |||
5971 | LEAVE; | ||
5972 | return IPR_RC_JOB_RETURN; | ||
5973 | } | ||
5974 | |||
5975 | /** | ||
5802 | * ipr_init_res_table - Initialize the resource table | 5976 | * ipr_init_res_table - Initialize the resource table |
5803 | * @ipr_cmd: ipr command struct | 5977 | * @ipr_cmd: ipr command struct |
5804 | * | 5978 | * |
@@ -5866,7 +6040,10 @@ static int ipr_init_res_table(struct ipr_cmnd *ipr_cmd) | |||
5866 | } | 6040 | } |
5867 | } | 6041 | } |
5868 | 6042 | ||
5869 | ipr_cmd->job_step = ipr_ioafp_mode_sense_page28; | 6043 | if (ioa_cfg->dual_raid && ipr_dual_ioa_raid) |
6044 | ipr_cmd->job_step = ipr_ioafp_mode_sense_page24; | ||
6045 | else | ||
6046 | ipr_cmd->job_step = ipr_ioafp_mode_sense_page28; | ||
5870 | 6047 | ||
5871 | LEAVE; | 6048 | LEAVE; |
5872 | return IPR_RC_JOB_CONTINUE; | 6049 | return IPR_RC_JOB_CONTINUE; |
@@ -5888,8 +6065,11 @@ static int ipr_ioafp_query_ioa_cfg(struct ipr_cmnd *ipr_cmd) | |||
5888 | struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; | 6065 | struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; |
5889 | struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl; | 6066 | struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl; |
5890 | struct ipr_inquiry_page3 *ucode_vpd = &ioa_cfg->vpd_cbs->page3_data; | 6067 | struct ipr_inquiry_page3 *ucode_vpd = &ioa_cfg->vpd_cbs->page3_data; |
6068 | struct ipr_inquiry_cap *cap = &ioa_cfg->vpd_cbs->cap; | ||
5891 | 6069 | ||
5892 | ENTER; | 6070 | ENTER; |
6071 | if (cap->cap & IPR_CAP_DUAL_IOA_RAID) | ||
6072 | ioa_cfg->dual_raid = 1; | ||
5893 | dev_info(&ioa_cfg->pdev->dev, "Adapter firmware version: %02X%02X%02X%02X\n", | 6073 | dev_info(&ioa_cfg->pdev->dev, "Adapter firmware version: %02X%02X%02X%02X\n", |
5894 | ucode_vpd->major_release, ucode_vpd->card_type, | 6074 | ucode_vpd->major_release, ucode_vpd->card_type, |
5895 | ucode_vpd->minor_release[0], ucode_vpd->minor_release[1]); | 6075 | ucode_vpd->minor_release[0], ucode_vpd->minor_release[1]); |
@@ -5973,6 +6153,37 @@ static int ipr_inquiry_page_supported(struct ipr_inquiry_page0 *page0, u8 page) | |||
5973 | } | 6153 | } |
5974 | 6154 | ||
5975 | /** | 6155 | /** |
6156 | * ipr_ioafp_cap_inquiry - Send a Page 0xD0 Inquiry to the adapter. | ||
6157 | * @ipr_cmd: ipr command struct | ||
6158 | * | ||
6159 | * This function sends a Page 0xD0 inquiry to the adapter | ||
6160 | * to retrieve adapter capabilities. | ||
6161 | * | ||
6162 | * Return value: | ||
6163 | * IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN | ||
6164 | **/ | ||
6165 | static int ipr_ioafp_cap_inquiry(struct ipr_cmnd *ipr_cmd) | ||
6166 | { | ||
6167 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; | ||
6168 | struct ipr_inquiry_page0 *page0 = &ioa_cfg->vpd_cbs->page0_data; | ||
6169 | struct ipr_inquiry_cap *cap = &ioa_cfg->vpd_cbs->cap; | ||
6170 | |||
6171 | ENTER; | ||
6172 | ipr_cmd->job_step = ipr_ioafp_query_ioa_cfg; | ||
6173 | memset(cap, 0, sizeof(*cap)); | ||
6174 | |||
6175 | if (ipr_inquiry_page_supported(page0, 0xD0)) { | ||
6176 | ipr_ioafp_inquiry(ipr_cmd, 1, 0xD0, | ||
6177 | ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, cap), | ||
6178 | sizeof(struct ipr_inquiry_cap)); | ||
6179 | return IPR_RC_JOB_RETURN; | ||
6180 | } | ||
6181 | |||
6182 | LEAVE; | ||
6183 | return IPR_RC_JOB_CONTINUE; | ||
6184 | } | ||
6185 | |||
6186 | /** | ||
5976 | * ipr_ioafp_page3_inquiry - Send a Page 3 Inquiry to the adapter. | 6187 | * ipr_ioafp_page3_inquiry - Send a Page 3 Inquiry to the adapter. |
5977 | * @ipr_cmd: ipr command struct | 6188 | * @ipr_cmd: ipr command struct |
5978 | * | 6189 | * |
@@ -5992,7 +6203,7 @@ static int ipr_ioafp_page3_inquiry(struct ipr_cmnd *ipr_cmd) | |||
5992 | if (!ipr_inquiry_page_supported(page0, 1)) | 6203 | if (!ipr_inquiry_page_supported(page0, 1)) |
5993 | ioa_cfg->cache_state = CACHE_NONE; | 6204 | ioa_cfg->cache_state = CACHE_NONE; |
5994 | 6205 | ||
5995 | ipr_cmd->job_step = ipr_ioafp_query_ioa_cfg; | 6206 | ipr_cmd->job_step = ipr_ioafp_cap_inquiry; |
5996 | 6207 | ||
5997 | ipr_ioafp_inquiry(ipr_cmd, 1, 3, | 6208 | ipr_ioafp_inquiry(ipr_cmd, 1, 3, |
5998 | ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, page3_data), | 6209 | ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, page3_data), |
@@ -6278,6 +6489,7 @@ static void ipr_get_unit_check_buffer(struct ipr_ioa_cfg *ioa_cfg) | |||
6278 | struct ipr_hostrcb *hostrcb; | 6489 | struct ipr_hostrcb *hostrcb; |
6279 | struct ipr_uc_sdt sdt; | 6490 | struct ipr_uc_sdt sdt; |
6280 | int rc, length; | 6491 | int rc, length; |
6492 | u32 ioasc; | ||
6281 | 6493 | ||
6282 | mailbox = readl(ioa_cfg->ioa_mailbox); | 6494 | mailbox = readl(ioa_cfg->ioa_mailbox); |
6283 | 6495 | ||
@@ -6310,9 +6522,13 @@ static void ipr_get_unit_check_buffer(struct ipr_ioa_cfg *ioa_cfg) | |||
6310 | (__be32 *)&hostrcb->hcam, | 6522 | (__be32 *)&hostrcb->hcam, |
6311 | min(length, (int)sizeof(hostrcb->hcam)) / sizeof(__be32)); | 6523 | min(length, (int)sizeof(hostrcb->hcam)) / sizeof(__be32)); |
6312 | 6524 | ||
6313 | if (!rc) | 6525 | if (!rc) { |
6314 | ipr_handle_log_data(ioa_cfg, hostrcb); | 6526 | ipr_handle_log_data(ioa_cfg, hostrcb); |
6315 | else | 6527 | ioasc = be32_to_cpu(hostrcb->hcam.u.error.failing_dev_ioasc); |
6528 | if (ioasc == IPR_IOASC_NR_IOA_RESET_REQUIRED && | ||
6529 | ioa_cfg->sdt_state == GET_DUMP) | ||
6530 | ioa_cfg->sdt_state = WAIT_FOR_DUMP; | ||
6531 | } else | ||
6316 | ipr_unit_check_no_data(ioa_cfg); | 6532 | ipr_unit_check_no_data(ioa_cfg); |
6317 | 6533 | ||
6318 | list_add_tail(&hostrcb->queue, &ioa_cfg->hostrcb_free_q); | 6534 | list_add_tail(&hostrcb->queue, &ioa_cfg->hostrcb_free_q); |
@@ -6425,6 +6641,48 @@ static int ipr_reset_start_bist(struct ipr_cmnd *ipr_cmd) | |||
6425 | } | 6641 | } |
6426 | 6642 | ||
6427 | /** | 6643 | /** |
6644 | * ipr_reset_slot_reset_done - Clear PCI reset to the adapter | ||
6645 | * @ipr_cmd: ipr command struct | ||
6646 | * | ||
6647 | * Description: This clears PCI reset to the adapter and delays two seconds. | ||
6648 | * | ||
6649 | * Return value: | ||
6650 | * IPR_RC_JOB_RETURN | ||
6651 | **/ | ||
6652 | static int ipr_reset_slot_reset_done(struct ipr_cmnd *ipr_cmd) | ||
6653 | { | ||
6654 | ENTER; | ||
6655 | pci_set_pcie_reset_state(ipr_cmd->ioa_cfg->pdev, pcie_deassert_reset); | ||
6656 | ipr_cmd->job_step = ipr_reset_bist_done; | ||
6657 | ipr_reset_start_timer(ipr_cmd, IPR_WAIT_FOR_BIST_TIMEOUT); | ||
6658 | LEAVE; | ||
6659 | return IPR_RC_JOB_RETURN; | ||
6660 | } | ||
6661 | |||
6662 | /** | ||
6663 | * ipr_reset_slot_reset - Reset the PCI slot of the adapter. | ||
6664 | * @ipr_cmd: ipr command struct | ||
6665 | * | ||
6666 | * Description: This asserts PCI reset to the adapter. | ||
6667 | * | ||
6668 | * Return value: | ||
6669 | * IPR_RC_JOB_RETURN | ||
6670 | **/ | ||
6671 | static int ipr_reset_slot_reset(struct ipr_cmnd *ipr_cmd) | ||
6672 | { | ||
6673 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; | ||
6674 | struct pci_dev *pdev = ioa_cfg->pdev; | ||
6675 | |||
6676 | ENTER; | ||
6677 | pci_block_user_cfg_access(pdev); | ||
6678 | pci_set_pcie_reset_state(pdev, pcie_warm_reset); | ||
6679 | ipr_cmd->job_step = ipr_reset_slot_reset_done; | ||
6680 | ipr_reset_start_timer(ipr_cmd, IPR_PCI_RESET_TIMEOUT); | ||
6681 | LEAVE; | ||
6682 | return IPR_RC_JOB_RETURN; | ||
6683 | } | ||
6684 | |||
6685 | /** | ||
6428 | * ipr_reset_allowed - Query whether or not IOA can be reset | 6686 | * ipr_reset_allowed - Query whether or not IOA can be reset |
6429 | * @ioa_cfg: ioa config struct | 6687 | * @ioa_cfg: ioa config struct |
6430 | * | 6688 | * |
@@ -6463,7 +6721,7 @@ static int ipr_reset_wait_to_start_bist(struct ipr_cmnd *ipr_cmd) | |||
6463 | ipr_cmd->u.time_left -= IPR_CHECK_FOR_RESET_TIMEOUT; | 6721 | ipr_cmd->u.time_left -= IPR_CHECK_FOR_RESET_TIMEOUT; |
6464 | ipr_reset_start_timer(ipr_cmd, IPR_CHECK_FOR_RESET_TIMEOUT); | 6722 | ipr_reset_start_timer(ipr_cmd, IPR_CHECK_FOR_RESET_TIMEOUT); |
6465 | } else { | 6723 | } else { |
6466 | ipr_cmd->job_step = ipr_reset_start_bist; | 6724 | ipr_cmd->job_step = ioa_cfg->reset; |
6467 | rc = IPR_RC_JOB_CONTINUE; | 6725 | rc = IPR_RC_JOB_CONTINUE; |
6468 | } | 6726 | } |
6469 | 6727 | ||
@@ -6496,7 +6754,7 @@ static int ipr_reset_alert(struct ipr_cmnd *ipr_cmd) | |||
6496 | writel(IPR_UPROCI_RESET_ALERT, ioa_cfg->regs.set_uproc_interrupt_reg); | 6754 | writel(IPR_UPROCI_RESET_ALERT, ioa_cfg->regs.set_uproc_interrupt_reg); |
6497 | ipr_cmd->job_step = ipr_reset_wait_to_start_bist; | 6755 | ipr_cmd->job_step = ipr_reset_wait_to_start_bist; |
6498 | } else { | 6756 | } else { |
6499 | ipr_cmd->job_step = ipr_reset_start_bist; | 6757 | ipr_cmd->job_step = ioa_cfg->reset; |
6500 | } | 6758 | } |
6501 | 6759 | ||
6502 | ipr_cmd->u.time_left = IPR_WAIT_FOR_RESET_TIMEOUT; | 6760 | ipr_cmd->u.time_left = IPR_WAIT_FOR_RESET_TIMEOUT; |
@@ -6591,12 +6849,14 @@ static int ipr_reset_shutdown_ioa(struct ipr_cmnd *ipr_cmd) | |||
6591 | ipr_cmd->ioarcb.cmd_pkt.cdb[0] = IPR_IOA_SHUTDOWN; | 6849 | ipr_cmd->ioarcb.cmd_pkt.cdb[0] = IPR_IOA_SHUTDOWN; |
6592 | ipr_cmd->ioarcb.cmd_pkt.cdb[1] = shutdown_type; | 6850 | ipr_cmd->ioarcb.cmd_pkt.cdb[1] = shutdown_type; |
6593 | 6851 | ||
6594 | if (shutdown_type == IPR_SHUTDOWN_ABBREV) | 6852 | if (shutdown_type == IPR_SHUTDOWN_NORMAL) |
6595 | timeout = IPR_ABBREV_SHUTDOWN_TIMEOUT; | 6853 | timeout = IPR_SHUTDOWN_TIMEOUT; |
6596 | else if (shutdown_type == IPR_SHUTDOWN_PREPARE_FOR_NORMAL) | 6854 | else if (shutdown_type == IPR_SHUTDOWN_PREPARE_FOR_NORMAL) |
6597 | timeout = IPR_INTERNAL_TIMEOUT; | 6855 | timeout = IPR_INTERNAL_TIMEOUT; |
6856 | else if (ioa_cfg->dual_raid && ipr_dual_ioa_raid) | ||
6857 | timeout = IPR_DUAL_IOA_ABBR_SHUTDOWN_TO; | ||
6598 | else | 6858 | else |
6599 | timeout = IPR_SHUTDOWN_TIMEOUT; | 6859 | timeout = IPR_ABBREV_SHUTDOWN_TIMEOUT; |
6600 | 6860 | ||
6601 | ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, timeout); | 6861 | ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, timeout); |
6602 | 6862 | ||
@@ -6776,8 +7036,11 @@ static pci_ers_result_t ipr_pci_slot_reset(struct pci_dev *pdev) | |||
6776 | struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev); | 7036 | struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev); |
6777 | 7037 | ||
6778 | spin_lock_irqsave(ioa_cfg->host->host_lock, flags); | 7038 | spin_lock_irqsave(ioa_cfg->host->host_lock, flags); |
6779 | _ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_restore_cfg_space, | 7039 | if (ioa_cfg->needs_warm_reset) |
6780 | IPR_SHUTDOWN_NONE); | 7040 | ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE); |
7041 | else | ||
7042 | _ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_restore_cfg_space, | ||
7043 | IPR_SHUTDOWN_NONE); | ||
6781 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags); | 7044 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags); |
6782 | return PCI_ERS_RESULT_RECOVERED; | 7045 | return PCI_ERS_RESULT_RECOVERED; |
6783 | } | 7046 | } |
@@ -7226,7 +7489,7 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev, | |||
7226 | unsigned long ipr_regs_pci; | 7489 | unsigned long ipr_regs_pci; |
7227 | void __iomem *ipr_regs; | 7490 | void __iomem *ipr_regs; |
7228 | int rc = PCIBIOS_SUCCESSFUL; | 7491 | int rc = PCIBIOS_SUCCESSFUL; |
7229 | volatile u32 mask, uproc; | 7492 | volatile u32 mask, uproc, interrupts; |
7230 | 7493 | ||
7231 | ENTER; | 7494 | ENTER; |
7232 | 7495 | ||
@@ -7265,6 +7528,14 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev, | |||
7265 | else | 7528 | else |
7266 | ioa_cfg->transop_timeout = IPR_OPERATIONAL_TIMEOUT; | 7529 | ioa_cfg->transop_timeout = IPR_OPERATIONAL_TIMEOUT; |
7267 | 7530 | ||
7531 | rc = pci_read_config_byte(pdev, PCI_REVISION_ID, &ioa_cfg->revid); | ||
7532 | |||
7533 | if (rc != PCIBIOS_SUCCESSFUL) { | ||
7534 | dev_err(&pdev->dev, "Failed to read PCI revision ID\n"); | ||
7535 | rc = -EIO; | ||
7536 | goto out_scsi_host_put; | ||
7537 | } | ||
7538 | |||
7268 | ipr_regs_pci = pci_resource_start(pdev, 0); | 7539 | ipr_regs_pci = pci_resource_start(pdev, 0); |
7269 | 7540 | ||
7270 | rc = pci_request_regions(pdev, IPR_NAME); | 7541 | rc = pci_request_regions(pdev, IPR_NAME); |
@@ -7333,9 +7604,14 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev, | |||
7333 | * the card is in an unknown state and needs a hard reset | 7604 | * the card is in an unknown state and needs a hard reset |
7334 | */ | 7605 | */ |
7335 | mask = readl(ioa_cfg->regs.sense_interrupt_mask_reg); | 7606 | mask = readl(ioa_cfg->regs.sense_interrupt_mask_reg); |
7607 | interrupts = readl(ioa_cfg->regs.sense_interrupt_reg); | ||
7336 | uproc = readl(ioa_cfg->regs.sense_uproc_interrupt_reg); | 7608 | uproc = readl(ioa_cfg->regs.sense_uproc_interrupt_reg); |
7337 | if ((mask & IPR_PCII_HRRQ_UPDATED) == 0 || (uproc & IPR_UPROCI_RESET_ALERT)) | 7609 | if ((mask & IPR_PCII_HRRQ_UPDATED) == 0 || (uproc & IPR_UPROCI_RESET_ALERT)) |
7338 | ioa_cfg->needs_hard_reset = 1; | 7610 | ioa_cfg->needs_hard_reset = 1; |
7611 | if (interrupts & IPR_PCII_ERROR_INTERRUPTS) | ||
7612 | ioa_cfg->needs_hard_reset = 1; | ||
7613 | if (interrupts & IPR_PCII_IOA_UNIT_CHECKED) | ||
7614 | ioa_cfg->ioa_unit_checked = 1; | ||
7339 | 7615 | ||
7340 | ipr_mask_and_clear_interrupts(ioa_cfg, ~IPR_PCII_IOA_TRANS_TO_OPER); | 7616 | ipr_mask_and_clear_interrupts(ioa_cfg, ~IPR_PCII_IOA_TRANS_TO_OPER); |
7341 | rc = request_irq(pdev->irq, ipr_isr, IRQF_SHARED, IPR_NAME, ioa_cfg); | 7617 | rc = request_irq(pdev->irq, ipr_isr, IRQF_SHARED, IPR_NAME, ioa_cfg); |
@@ -7346,6 +7622,13 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev, | |||
7346 | goto cleanup_nolog; | 7622 | goto cleanup_nolog; |
7347 | } | 7623 | } |
7348 | 7624 | ||
7625 | if ((dev_id->driver_data & IPR_USE_PCI_WARM_RESET) || | ||
7626 | (dev_id->device == PCI_DEVICE_ID_IBM_OBSIDIAN_E && !ioa_cfg->revid)) { | ||
7627 | ioa_cfg->needs_warm_reset = 1; | ||
7628 | ioa_cfg->reset = ipr_reset_slot_reset; | ||
7629 | } else | ||
7630 | ioa_cfg->reset = ipr_reset_start_bist; | ||
7631 | |||
7349 | spin_lock(&ipr_driver_lock); | 7632 | spin_lock(&ipr_driver_lock); |
7350 | list_add_tail(&ioa_cfg->queue, &ipr_ioa_head); | 7633 | list_add_tail(&ioa_cfg->queue, &ipr_ioa_head); |
7351 | spin_unlock(&ipr_driver_lock); | 7634 | spin_unlock(&ipr_driver_lock); |
@@ -7428,6 +7711,12 @@ static void __ipr_remove(struct pci_dev *pdev) | |||
7428 | ENTER; | 7711 | ENTER; |
7429 | 7712 | ||
7430 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); | 7713 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); |
7714 | while(ioa_cfg->in_reset_reload) { | ||
7715 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags); | ||
7716 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | ||
7717 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); | ||
7718 | } | ||
7719 | |||
7431 | ipr_initiate_ioa_bringdown(ioa_cfg, IPR_SHUTDOWN_NORMAL); | 7720 | ipr_initiate_ioa_bringdown(ioa_cfg, IPR_SHUTDOWN_NORMAL); |
7432 | 7721 | ||
7433 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags); | 7722 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags); |
@@ -7551,6 +7840,12 @@ static void ipr_shutdown(struct pci_dev *pdev) | |||
7551 | unsigned long lock_flags = 0; | 7840 | unsigned long lock_flags = 0; |
7552 | 7841 | ||
7553 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | 7842 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
7843 | while(ioa_cfg->in_reset_reload) { | ||
7844 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | ||
7845 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | ||
7846 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | ||
7847 | } | ||
7848 | |||
7554 | ipr_initiate_ioa_bringdown(ioa_cfg, IPR_SHUTDOWN_NORMAL); | 7849 | ipr_initiate_ioa_bringdown(ioa_cfg, IPR_SHUTDOWN_NORMAL); |
7555 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | 7850 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
7556 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | 7851 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); |
@@ -7577,19 +7872,22 @@ static struct pci_device_id ipr_pci_table[] __devinitdata = { | |||
7577 | { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, | 7872 | { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, |
7578 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A, 0, 0, 0 }, | 7873 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A, 0, 0, 0 }, |
7579 | { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, | 7874 | { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, |
7580 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B, 0, 0, 0 }, | 7875 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B, 0, 0, |
7876 | IPR_USE_LONG_TRANSOP_TIMEOUT }, | ||
7581 | { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, | 7877 | { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, |
7582 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C, 0, 0, | 7878 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C, 0, 0, |
7583 | IPR_USE_LONG_TRANSOP_TIMEOUT }, | 7879 | IPR_USE_LONG_TRANSOP_TIMEOUT }, |
7584 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, | 7880 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, |
7585 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A, 0, 0, 0 }, | 7881 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A, 0, 0, 0 }, |
7586 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, | 7882 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, |
7587 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B, 0, 0, 0 }, | 7883 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B, 0, 0, |
7884 | IPR_USE_LONG_TRANSOP_TIMEOUT}, | ||
7588 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, | 7885 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, |
7589 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C, 0, 0, | 7886 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C, 0, 0, |
7590 | IPR_USE_LONG_TRANSOP_TIMEOUT }, | 7887 | IPR_USE_LONG_TRANSOP_TIMEOUT }, |
7591 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E, | 7888 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E, |
7592 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_574E, 0, 0, 0 }, | 7889 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_574E, 0, 0, |
7890 | IPR_USE_LONG_TRANSOP_TIMEOUT }, | ||
7593 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E, | 7891 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E, |
7594 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575D, 0, 0, | 7892 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575D, 0, 0, |
7595 | IPR_USE_LONG_TRANSOP_TIMEOUT }, | 7893 | IPR_USE_LONG_TRANSOP_TIMEOUT }, |
@@ -7597,7 +7895,7 @@ static struct pci_device_id ipr_pci_table[] __devinitdata = { | |||
7597 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57B3, 0, 0, 0 }, | 7895 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57B3, 0, 0, 0 }, |
7598 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E, | 7896 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E, |
7599 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57B7, 0, 0, | 7897 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57B7, 0, 0, |
7600 | IPR_USE_LONG_TRANSOP_TIMEOUT }, | 7898 | IPR_USE_LONG_TRANSOP_TIMEOUT | IPR_USE_PCI_WARM_RESET }, |
7601 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE, | 7899 | { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE, |
7602 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2780, 0, 0, 0 }, | 7900 | PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2780, 0, 0, 0 }, |
7603 | { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP, | 7901 | { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP, |
@@ -7627,6 +7925,7 @@ static struct pci_driver ipr_driver = { | |||
7627 | .remove = ipr_remove, | 7925 | .remove = ipr_remove, |
7628 | .shutdown = ipr_shutdown, | 7926 | .shutdown = ipr_shutdown, |
7629 | .err_handler = &ipr_err_handler, | 7927 | .err_handler = &ipr_err_handler, |
7928 | .dynids.use_driver_data = 1 | ||
7630 | }; | 7929 | }; |
7631 | 7930 | ||
7632 | /** | 7931 | /** |
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h index bc53d7cebe0a..d93156671e93 100644 --- a/drivers/scsi/ipr.h +++ b/drivers/scsi/ipr.h | |||
@@ -37,8 +37,8 @@ | |||
37 | /* | 37 | /* |
38 | * Literals | 38 | * Literals |
39 | */ | 39 | */ |
40 | #define IPR_DRIVER_VERSION "2.3.2" | 40 | #define IPR_DRIVER_VERSION "2.4.1" |
41 | #define IPR_DRIVER_DATE "(March 23, 2007)" | 41 | #define IPR_DRIVER_DATE "(April 24, 2007)" |
42 | 42 | ||
43 | /* | 43 | /* |
44 | * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding | 44 | * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding |
@@ -91,6 +91,7 @@ | |||
91 | * IOASCs | 91 | * IOASCs |
92 | */ | 92 | */ |
93 | #define IPR_IOASC_NR_INIT_CMD_REQUIRED 0x02040200 | 93 | #define IPR_IOASC_NR_INIT_CMD_REQUIRED 0x02040200 |
94 | #define IPR_IOASC_NR_IOA_RESET_REQUIRED 0x02048000 | ||
94 | #define IPR_IOASC_SYNC_REQUIRED 0x023f0000 | 95 | #define IPR_IOASC_SYNC_REQUIRED 0x023f0000 |
95 | #define IPR_IOASC_MED_DO_NOT_REALLOC 0x03110C00 | 96 | #define IPR_IOASC_MED_DO_NOT_REALLOC 0x03110C00 |
96 | #define IPR_IOASC_HW_SEL_TIMEOUT 0x04050000 | 97 | #define IPR_IOASC_HW_SEL_TIMEOUT 0x04050000 |
@@ -111,6 +112,7 @@ | |||
111 | 112 | ||
112 | /* Driver data flags */ | 113 | /* Driver data flags */ |
113 | #define IPR_USE_LONG_TRANSOP_TIMEOUT 0x00000001 | 114 | #define IPR_USE_LONG_TRANSOP_TIMEOUT 0x00000001 |
115 | #define IPR_USE_PCI_WARM_RESET 0x00000002 | ||
114 | 116 | ||
115 | #define IPR_DEFAULT_MAX_ERROR_DUMP 984 | 117 | #define IPR_DEFAULT_MAX_ERROR_DUMP 984 |
116 | #define IPR_NUM_LOG_HCAMS 2 | 118 | #define IPR_NUM_LOG_HCAMS 2 |
@@ -179,6 +181,7 @@ | |||
179 | #define IPR_SHUTDOWN_TIMEOUT (ipr_fastfail ? 60 * HZ : 10 * 60 * HZ) | 181 | #define IPR_SHUTDOWN_TIMEOUT (ipr_fastfail ? 60 * HZ : 10 * 60 * HZ) |
180 | #define IPR_VSET_RW_TIMEOUT (ipr_fastfail ? 30 * HZ : 2 * 60 * HZ) | 182 | #define IPR_VSET_RW_TIMEOUT (ipr_fastfail ? 30 * HZ : 2 * 60 * HZ) |
181 | #define IPR_ABBREV_SHUTDOWN_TIMEOUT (10 * HZ) | 183 | #define IPR_ABBREV_SHUTDOWN_TIMEOUT (10 * HZ) |
184 | #define IPR_DUAL_IOA_ABBR_SHUTDOWN_TO (2 * 60 * HZ) | ||
182 | #define IPR_DEVICE_RESET_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ) | 185 | #define IPR_DEVICE_RESET_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ) |
183 | #define IPR_CANCEL_ALL_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ) | 186 | #define IPR_CANCEL_ALL_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ) |
184 | #define IPR_ABORT_TASK_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ) | 187 | #define IPR_ABORT_TASK_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ) |
@@ -191,6 +194,7 @@ | |||
191 | #define IPR_WAIT_FOR_RESET_TIMEOUT (2 * HZ) | 194 | #define IPR_WAIT_FOR_RESET_TIMEOUT (2 * HZ) |
192 | #define IPR_CHECK_FOR_RESET_TIMEOUT (HZ / 10) | 195 | #define IPR_CHECK_FOR_RESET_TIMEOUT (HZ / 10) |
193 | #define IPR_WAIT_FOR_BIST_TIMEOUT (2 * HZ) | 196 | #define IPR_WAIT_FOR_BIST_TIMEOUT (2 * HZ) |
197 | #define IPR_PCI_RESET_TIMEOUT (HZ / 2) | ||
194 | #define IPR_DUMP_TIMEOUT (15 * HZ) | 198 | #define IPR_DUMP_TIMEOUT (15 * HZ) |
195 | 199 | ||
196 | /* | 200 | /* |
@@ -602,6 +606,12 @@ struct ipr_mode_page28 { | |||
602 | struct ipr_dev_bus_entry bus[0]; | 606 | struct ipr_dev_bus_entry bus[0]; |
603 | }__attribute__((packed)); | 607 | }__attribute__((packed)); |
604 | 608 | ||
609 | struct ipr_mode_page24 { | ||
610 | struct ipr_mode_page_hdr hdr; | ||
611 | u8 flags; | ||
612 | #define IPR_ENABLE_DUAL_IOA_AF 0x80 | ||
613 | }__attribute__((packed)); | ||
614 | |||
605 | struct ipr_ioa_vpd { | 615 | struct ipr_ioa_vpd { |
606 | struct ipr_std_inq_data std_inq_data; | 616 | struct ipr_std_inq_data std_inq_data; |
607 | u8 ascii_part_num[12]; | 617 | u8 ascii_part_num[12]; |
@@ -624,6 +634,19 @@ struct ipr_inquiry_page3 { | |||
624 | u8 patch_number[4]; | 634 | u8 patch_number[4]; |
625 | }__attribute__((packed)); | 635 | }__attribute__((packed)); |
626 | 636 | ||
637 | struct ipr_inquiry_cap { | ||
638 | u8 peri_qual_dev_type; | ||
639 | u8 page_code; | ||
640 | u8 reserved1; | ||
641 | u8 page_length; | ||
642 | u8 ascii_len; | ||
643 | u8 reserved2; | ||
644 | u8 sis_version[2]; | ||
645 | u8 cap; | ||
646 | #define IPR_CAP_DUAL_IOA_RAID 0x80 | ||
647 | u8 reserved3[15]; | ||
648 | }__attribute__((packed)); | ||
649 | |||
627 | #define IPR_INQUIRY_PAGE0_ENTRIES 20 | 650 | #define IPR_INQUIRY_PAGE0_ENTRIES 20 |
628 | struct ipr_inquiry_page0 { | 651 | struct ipr_inquiry_page0 { |
629 | u8 peri_qual_dev_type; | 652 | u8 peri_qual_dev_type; |
@@ -962,6 +985,7 @@ struct ipr_misc_cbs { | |||
962 | struct ipr_ioa_vpd ioa_vpd; | 985 | struct ipr_ioa_vpd ioa_vpd; |
963 | struct ipr_inquiry_page0 page0_data; | 986 | struct ipr_inquiry_page0 page0_data; |
964 | struct ipr_inquiry_page3 page3_data; | 987 | struct ipr_inquiry_page3 page3_data; |
988 | struct ipr_inquiry_cap cap; | ||
965 | struct ipr_mode_pages mode_pages; | 989 | struct ipr_mode_pages mode_pages; |
966 | struct ipr_supported_device supp_dev; | 990 | struct ipr_supported_device supp_dev; |
967 | }; | 991 | }; |
@@ -1068,6 +1092,10 @@ struct ipr_ioa_cfg { | |||
1068 | u8 allow_cmds:1; | 1092 | u8 allow_cmds:1; |
1069 | u8 allow_ml_add_del:1; | 1093 | u8 allow_ml_add_del:1; |
1070 | u8 needs_hard_reset:1; | 1094 | u8 needs_hard_reset:1; |
1095 | u8 dual_raid:1; | ||
1096 | u8 needs_warm_reset:1; | ||
1097 | |||
1098 | u8 revid; | ||
1071 | 1099 | ||
1072 | enum ipr_cache_state cache_state; | 1100 | enum ipr_cache_state cache_state; |
1073 | u16 type; /* CCIN of the card */ | 1101 | u16 type; /* CCIN of the card */ |
@@ -1161,6 +1189,7 @@ struct ipr_ioa_cfg { | |||
1161 | struct pci_pool *ipr_cmd_pool; | 1189 | struct pci_pool *ipr_cmd_pool; |
1162 | 1190 | ||
1163 | struct ipr_cmnd *reset_cmd; | 1191 | struct ipr_cmnd *reset_cmd; |
1192 | int (*reset) (struct ipr_cmnd *); | ||
1164 | 1193 | ||
1165 | struct ata_host ata_host; | 1194 | struct ata_host ata_host; |
1166 | char ipr_cmd_label[8]; | 1195 | char ipr_cmd_label[8]; |
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 897a5e2c55e4..b4b52694497c 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c | |||
@@ -23,6 +23,8 @@ | |||
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/kthread.h> | ||
27 | |||
26 | #include "sas_internal.h" | 28 | #include "sas_internal.h" |
27 | 29 | ||
28 | #include <scsi/scsi_host.h> | 30 | #include <scsi/scsi_host.h> |
@@ -184,7 +186,7 @@ static int sas_queue_up(struct sas_task *task) | |||
184 | list_add_tail(&task->list, &core->task_queue); | 186 | list_add_tail(&task->list, &core->task_queue); |
185 | core->task_queue_size += 1; | 187 | core->task_queue_size += 1; |
186 | spin_unlock_irqrestore(&core->task_queue_lock, flags); | 188 | spin_unlock_irqrestore(&core->task_queue_lock, flags); |
187 | up(&core->queue_thread_sema); | 189 | wake_up_process(core->queue_thread); |
188 | 190 | ||
189 | return 0; | 191 | return 0; |
190 | } | 192 | } |
@@ -819,7 +821,7 @@ static void sas_queue(struct sas_ha_struct *sas_ha) | |||
819 | struct sas_internal *i = to_sas_internal(core->shost->transportt); | 821 | struct sas_internal *i = to_sas_internal(core->shost->transportt); |
820 | 822 | ||
821 | spin_lock_irqsave(&core->task_queue_lock, flags); | 823 | spin_lock_irqsave(&core->task_queue_lock, flags); |
822 | while (!core->queue_thread_kill && | 824 | while (!kthread_should_stop() && |
823 | !list_empty(&core->task_queue)) { | 825 | !list_empty(&core->task_queue)) { |
824 | 826 | ||
825 | can_queue = sas_ha->lldd_queue_size - core->task_queue_size; | 827 | can_queue = sas_ha->lldd_queue_size - core->task_queue_size; |
@@ -858,8 +860,6 @@ static void sas_queue(struct sas_ha_struct *sas_ha) | |||
858 | spin_unlock_irqrestore(&core->task_queue_lock, flags); | 860 | spin_unlock_irqrestore(&core->task_queue_lock, flags); |
859 | } | 861 | } |
860 | 862 | ||
861 | static DECLARE_COMPLETION(queue_th_comp); | ||
862 | |||
863 | /** | 863 | /** |
864 | * sas_queue_thread -- The Task Collector thread | 864 | * sas_queue_thread -- The Task Collector thread |
865 | * @_sas_ha: pointer to struct sas_ha | 865 | * @_sas_ha: pointer to struct sas_ha |
@@ -867,40 +867,33 @@ static DECLARE_COMPLETION(queue_th_comp); | |||
867 | static int sas_queue_thread(void *_sas_ha) | 867 | static int sas_queue_thread(void *_sas_ha) |
868 | { | 868 | { |
869 | struct sas_ha_struct *sas_ha = _sas_ha; | 869 | struct sas_ha_struct *sas_ha = _sas_ha; |
870 | struct scsi_core *core = &sas_ha->core; | ||
871 | 870 | ||
872 | daemonize("sas_queue_%d", core->shost->host_no); | ||
873 | current->flags |= PF_NOFREEZE; | 871 | current->flags |= PF_NOFREEZE; |
874 | 872 | ||
875 | complete(&queue_th_comp); | ||
876 | |||
877 | while (1) { | 873 | while (1) { |
878 | down_interruptible(&core->queue_thread_sema); | 874 | set_current_state(TASK_INTERRUPTIBLE); |
875 | schedule(); | ||
879 | sas_queue(sas_ha); | 876 | sas_queue(sas_ha); |
880 | if (core->queue_thread_kill) | 877 | if (kthread_should_stop()) |
881 | break; | 878 | break; |
882 | } | 879 | } |
883 | 880 | ||
884 | complete(&queue_th_comp); | ||
885 | |||
886 | return 0; | 881 | return 0; |
887 | } | 882 | } |
888 | 883 | ||
889 | int sas_init_queue(struct sas_ha_struct *sas_ha) | 884 | int sas_init_queue(struct sas_ha_struct *sas_ha) |
890 | { | 885 | { |
891 | int res; | ||
892 | struct scsi_core *core = &sas_ha->core; | 886 | struct scsi_core *core = &sas_ha->core; |
893 | 887 | ||
894 | spin_lock_init(&core->task_queue_lock); | 888 | spin_lock_init(&core->task_queue_lock); |
895 | core->task_queue_size = 0; | 889 | core->task_queue_size = 0; |
896 | INIT_LIST_HEAD(&core->task_queue); | 890 | INIT_LIST_HEAD(&core->task_queue); |
897 | init_MUTEX_LOCKED(&core->queue_thread_sema); | ||
898 | 891 | ||
899 | res = kernel_thread(sas_queue_thread, sas_ha, 0); | 892 | core->queue_thread = kthread_run(sas_queue_thread, sas_ha, |
900 | if (res >= 0) | 893 | "sas_queue_%d", core->shost->host_no); |
901 | wait_for_completion(&queue_th_comp); | 894 | if (IS_ERR(core->queue_thread)) |
902 | 895 | return PTR_ERR(core->queue_thread); | |
903 | return res < 0 ? res : 0; | 896 | return 0; |
904 | } | 897 | } |
905 | 898 | ||
906 | void sas_shutdown_queue(struct sas_ha_struct *sas_ha) | 899 | void sas_shutdown_queue(struct sas_ha_struct *sas_ha) |
@@ -909,10 +902,7 @@ void sas_shutdown_queue(struct sas_ha_struct *sas_ha) | |||
909 | struct scsi_core *core = &sas_ha->core; | 902 | struct scsi_core *core = &sas_ha->core; |
910 | struct sas_task *task, *n; | 903 | struct sas_task *task, *n; |
911 | 904 | ||
912 | init_completion(&queue_th_comp); | 905 | kthread_stop(core->queue_thread); |
913 | core->queue_thread_kill = 1; | ||
914 | up(&core->queue_thread_sema); | ||
915 | wait_for_completion(&queue_th_comp); | ||
916 | 906 | ||
917 | if (!list_empty(&core->task_queue)) | 907 | if (!list_empty(&core->task_queue)) |
918 | SAS_DPRINTK("HA: %llx: scsi core task queue is NOT empty!?\n", | 908 | SAS_DPRINTK("HA: %llx: scsi core task queue is NOT empty!?\n", |
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index a7de0bca5bdd..82e8f90c4617 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -27,10 +27,6 @@ struct lpfc_sli2_slim; | |||
27 | requests */ | 27 | requests */ |
28 | #define LPFC_MAX_NS_RETRY 3 /* Number of retry attempts to contact | 28 | #define LPFC_MAX_NS_RETRY 3 /* Number of retry attempts to contact |
29 | the NameServer before giving up. */ | 29 | the NameServer before giving up. */ |
30 | #define LPFC_DFT_HBA_Q_DEPTH 2048 /* max cmds per hba */ | ||
31 | #define LPFC_LC_HBA_Q_DEPTH 1024 /* max cmds per low cost hba */ | ||
32 | #define LPFC_LP101_HBA_Q_DEPTH 128 /* max cmds per low cost hba */ | ||
33 | |||
34 | #define LPFC_CMD_PER_LUN 3 /* max outstanding cmds per lun */ | 30 | #define LPFC_CMD_PER_LUN 3 /* max outstanding cmds per lun */ |
35 | #define LPFC_SG_SEG_CNT 64 /* sg element count per scsi cmnd */ | 31 | #define LPFC_SG_SEG_CNT 64 /* sg element count per scsi cmnd */ |
36 | #define LPFC_IOCB_LIST_CNT 2250 /* list of IOCBs for fast-path usage. */ | 32 | #define LPFC_IOCB_LIST_CNT 2250 /* list of IOCBs for fast-path usage. */ |
@@ -244,28 +240,23 @@ struct lpfc_hba { | |||
244 | #define FC_FABRIC 0x100 /* We are fabric attached */ | 240 | #define FC_FABRIC 0x100 /* We are fabric attached */ |
245 | #define FC_ESTABLISH_LINK 0x200 /* Reestablish Link */ | 241 | #define FC_ESTABLISH_LINK 0x200 /* Reestablish Link */ |
246 | #define FC_RSCN_DISCOVERY 0x400 /* Authenticate all devices after RSCN*/ | 242 | #define FC_RSCN_DISCOVERY 0x400 /* Authenticate all devices after RSCN*/ |
243 | #define FC_BLOCK_MGMT_IO 0x800 /* Don't allow mgmt mbx or iocb cmds */ | ||
247 | #define FC_LOADING 0x1000 /* HBA in process of loading drvr */ | 244 | #define FC_LOADING 0x1000 /* HBA in process of loading drvr */ |
248 | #define FC_UNLOADING 0x2000 /* HBA in process of unloading drvr */ | 245 | #define FC_UNLOADING 0x2000 /* HBA in process of unloading drvr */ |
249 | #define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */ | 246 | #define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */ |
250 | #define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */ | 247 | #define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */ |
251 | #define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */ | 248 | #define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */ |
252 | #define FC_BYPASSED_MODE 0x20000 /* NPort is in bypassed mode */ | 249 | #define FC_BYPASSED_MODE 0x20000 /* NPort is in bypassed mode */ |
250 | #define FC_LOOPBACK_MODE 0x40000 /* NPort is in Loopback mode */ | ||
251 | /* This flag is set while issuing */ | ||
252 | /* INIT_LINK mailbox command */ | ||
253 | #define FC_IGNORE_ERATT 0x80000 /* intr handler should ignore ERATT */ | ||
253 | 254 | ||
254 | uint32_t fc_topology; /* link topology, from LINK INIT */ | 255 | uint32_t fc_topology; /* link topology, from LINK INIT */ |
255 | 256 | ||
256 | struct lpfc_stats fc_stat; | 257 | struct lpfc_stats fc_stat; |
257 | 258 | ||
258 | /* These are the head/tail pointers for the bind, plogi, adisc, unmap, | 259 | struct list_head fc_nodes; |
259 | * and map lists. Their counters are immediately following. | ||
260 | */ | ||
261 | struct list_head fc_plogi_list; | ||
262 | struct list_head fc_adisc_list; | ||
263 | struct list_head fc_reglogin_list; | ||
264 | struct list_head fc_prli_list; | ||
265 | struct list_head fc_nlpunmap_list; | ||
266 | struct list_head fc_nlpmap_list; | ||
267 | struct list_head fc_npr_list; | ||
268 | struct list_head fc_unused_list; | ||
269 | 260 | ||
270 | /* Keep counters for the number of entries in each list. */ | 261 | /* Keep counters for the number of entries in each list. */ |
271 | uint16_t fc_plogi_cnt; | 262 | uint16_t fc_plogi_cnt; |
@@ -387,13 +378,17 @@ struct lpfc_hba { | |||
387 | 378 | ||
388 | mempool_t *mbox_mem_pool; | 379 | mempool_t *mbox_mem_pool; |
389 | mempool_t *nlp_mem_pool; | 380 | mempool_t *nlp_mem_pool; |
390 | struct list_head freebufList; | ||
391 | struct list_head ctrspbuflist; | ||
392 | struct list_head rnidrspbuflist; | ||
393 | 381 | ||
394 | struct fc_host_statistics link_stats; | 382 | struct fc_host_statistics link_stats; |
395 | }; | 383 | }; |
396 | 384 | ||
385 | static inline void | ||
386 | lpfc_set_loopback_flag(struct lpfc_hba *phba) { | ||
387 | if (phba->cfg_topology == FLAGS_LOCAL_LB) | ||
388 | phba->fc_flag |= FC_LOOPBACK_MODE; | ||
389 | else | ||
390 | phba->fc_flag &= ~FC_LOOPBACK_MODE; | ||
391 | } | ||
397 | 392 | ||
398 | struct rnidrsp { | 393 | struct rnidrsp { |
399 | void *buf; | 394 | void *buf; |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index f247e786af99..95fe77e816f8 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -20,6 +20,7 @@ | |||
20 | *******************************************************************/ | 20 | *******************************************************************/ |
21 | 21 | ||
22 | #include <linux/ctype.h> | 22 | #include <linux/ctype.h> |
23 | #include <linux/delay.h> | ||
23 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
24 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
25 | 26 | ||
@@ -213,6 +214,7 @@ lpfc_issue_lip(struct Scsi_Host *host) | |||
213 | int mbxstatus = MBXERR_ERROR; | 214 | int mbxstatus = MBXERR_ERROR; |
214 | 215 | ||
215 | if ((phba->fc_flag & FC_OFFLINE_MODE) || | 216 | if ((phba->fc_flag & FC_OFFLINE_MODE) || |
217 | (phba->fc_flag & FC_BLOCK_MGMT_IO) || | ||
216 | (phba->hba_state != LPFC_HBA_READY)) | 218 | (phba->hba_state != LPFC_HBA_READY)) |
217 | return -EPERM; | 219 | return -EPERM; |
218 | 220 | ||
@@ -235,6 +237,7 @@ lpfc_issue_lip(struct Scsi_Host *host) | |||
235 | phba->fc_ratov * 2); | 237 | phba->fc_ratov * 2); |
236 | } | 238 | } |
237 | 239 | ||
240 | lpfc_set_loopback_flag(phba); | ||
238 | if (mbxstatus == MBX_TIMEOUT) | 241 | if (mbxstatus == MBX_TIMEOUT) |
239 | pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 242 | pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
240 | else | 243 | else |
@@ -247,19 +250,62 @@ lpfc_issue_lip(struct Scsi_Host *host) | |||
247 | } | 250 | } |
248 | 251 | ||
249 | static int | 252 | static int |
250 | lpfc_selective_reset(struct lpfc_hba *phba) | 253 | lpfc_do_offline(struct lpfc_hba *phba, uint32_t type) |
251 | { | 254 | { |
252 | struct completion online_compl; | 255 | struct completion online_compl; |
256 | struct lpfc_sli_ring *pring; | ||
257 | struct lpfc_sli *psli; | ||
253 | int status = 0; | 258 | int status = 0; |
259 | int cnt = 0; | ||
260 | int i; | ||
254 | 261 | ||
255 | init_completion(&online_compl); | 262 | init_completion(&online_compl); |
256 | lpfc_workq_post_event(phba, &status, &online_compl, | 263 | lpfc_workq_post_event(phba, &status, &online_compl, |
257 | LPFC_EVT_OFFLINE); | 264 | LPFC_EVT_OFFLINE_PREP); |
265 | wait_for_completion(&online_compl); | ||
266 | |||
267 | if (status != 0) | ||
268 | return -EIO; | ||
269 | |||
270 | psli = &phba->sli; | ||
271 | |||
272 | for (i = 0; i < psli->num_rings; i++) { | ||
273 | pring = &psli->ring[i]; | ||
274 | /* The linkdown event takes 30 seconds to timeout. */ | ||
275 | while (pring->txcmplq_cnt) { | ||
276 | msleep(10); | ||
277 | if (cnt++ > 3000) { | ||
278 | lpfc_printf_log(phba, | ||
279 | KERN_WARNING, LOG_INIT, | ||
280 | "%d:0466 Outstanding IO when " | ||
281 | "bringing Adapter offline\n", | ||
282 | phba->brd_no); | ||
283 | break; | ||
284 | } | ||
285 | } | ||
286 | } | ||
287 | |||
288 | init_completion(&online_compl); | ||
289 | lpfc_workq_post_event(phba, &status, &online_compl, type); | ||
258 | wait_for_completion(&online_compl); | 290 | wait_for_completion(&online_compl); |
259 | 291 | ||
260 | if (status != 0) | 292 | if (status != 0) |
261 | return -EIO; | 293 | return -EIO; |
262 | 294 | ||
295 | return 0; | ||
296 | } | ||
297 | |||
298 | static int | ||
299 | lpfc_selective_reset(struct lpfc_hba *phba) | ||
300 | { | ||
301 | struct completion online_compl; | ||
302 | int status = 0; | ||
303 | |||
304 | status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); | ||
305 | |||
306 | if (status != 0) | ||
307 | return status; | ||
308 | |||
263 | init_completion(&online_compl); | 309 | init_completion(&online_compl); |
264 | lpfc_workq_post_event(phba, &status, &online_compl, | 310 | lpfc_workq_post_event(phba, &status, &online_compl, |
265 | LPFC_EVT_ONLINE); | 311 | LPFC_EVT_ONLINE); |
@@ -324,23 +370,19 @@ lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count) | |||
324 | 370 | ||
325 | init_completion(&online_compl); | 371 | init_completion(&online_compl); |
326 | 372 | ||
327 | if(strncmp(buf, "online", sizeof("online") - 1) == 0) | 373 | if(strncmp(buf, "online", sizeof("online") - 1) == 0) { |
328 | lpfc_workq_post_event(phba, &status, &online_compl, | 374 | lpfc_workq_post_event(phba, &status, &online_compl, |
329 | LPFC_EVT_ONLINE); | 375 | LPFC_EVT_ONLINE); |
330 | else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) | 376 | wait_for_completion(&online_compl); |
331 | lpfc_workq_post_event(phba, &status, &online_compl, | 377 | } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) |
332 | LPFC_EVT_OFFLINE); | 378 | status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); |
333 | else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) | 379 | else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) |
334 | lpfc_workq_post_event(phba, &status, &online_compl, | 380 | status = lpfc_do_offline(phba, LPFC_EVT_WARM_START); |
335 | LPFC_EVT_WARM_START); | 381 | else if (strncmp(buf, "error", sizeof("error") - 1) == 0) |
336 | else if (strncmp(buf, "error", sizeof("error") - 1) == 0) | 382 | status = lpfc_do_offline(phba, LPFC_EVT_KILL); |
337 | lpfc_workq_post_event(phba, &status, &online_compl, | ||
338 | LPFC_EVT_KILL); | ||
339 | else | 383 | else |
340 | return -EINVAL; | 384 | return -EINVAL; |
341 | 385 | ||
342 | wait_for_completion(&online_compl); | ||
343 | |||
344 | if (!status) | 386 | if (!status) |
345 | return strlen(buf); | 387 | return strlen(buf); |
346 | else | 388 | else |
@@ -645,9 +687,7 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count) | |||
645 | dev_printk(KERN_NOTICE, &phba->pcidev->dev, | 687 | dev_printk(KERN_NOTICE, &phba->pcidev->dev, |
646 | "lpfc%d: Reinitializing to use soft_wwpn\n", phba->brd_no); | 688 | "lpfc%d: Reinitializing to use soft_wwpn\n", phba->brd_no); |
647 | 689 | ||
648 | init_completion(&online_compl); | 690 | stat1 = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); |
649 | lpfc_workq_post_event(phba, &stat1, &online_compl, LPFC_EVT_OFFLINE); | ||
650 | wait_for_completion(&online_compl); | ||
651 | if (stat1) | 691 | if (stat1) |
652 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 692 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
653 | "%d:0463 lpfc_soft_wwpn attribute set failed to reinit " | 693 | "%d:0463 lpfc_soft_wwpn attribute set failed to reinit " |
@@ -789,6 +829,18 @@ lpfc_nodev_tmo_init(struct lpfc_hba *phba, int val) | |||
789 | return -EINVAL; | 829 | return -EINVAL; |
790 | } | 830 | } |
791 | 831 | ||
832 | static void | ||
833 | lpfc_update_rport_devloss_tmo(struct lpfc_hba *phba) | ||
834 | { | ||
835 | struct lpfc_nodelist *ndlp; | ||
836 | |||
837 | spin_lock_irq(phba->host->host_lock); | ||
838 | list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) | ||
839 | if (ndlp->rport) | ||
840 | ndlp->rport->dev_loss_tmo = phba->cfg_devloss_tmo; | ||
841 | spin_unlock_irq(phba->host->host_lock); | ||
842 | } | ||
843 | |||
792 | static int | 844 | static int |
793 | lpfc_nodev_tmo_set(struct lpfc_hba *phba, int val) | 845 | lpfc_nodev_tmo_set(struct lpfc_hba *phba, int val) |
794 | { | 846 | { |
@@ -804,6 +856,7 @@ lpfc_nodev_tmo_set(struct lpfc_hba *phba, int val) | |||
804 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { | 856 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { |
805 | phba->cfg_nodev_tmo = val; | 857 | phba->cfg_nodev_tmo = val; |
806 | phba->cfg_devloss_tmo = val; | 858 | phba->cfg_devloss_tmo = val; |
859 | lpfc_update_rport_devloss_tmo(phba); | ||
807 | return 0; | 860 | return 0; |
808 | } | 861 | } |
809 | 862 | ||
@@ -839,6 +892,7 @@ lpfc_devloss_tmo_set(struct lpfc_hba *phba, int val) | |||
839 | phba->cfg_nodev_tmo = val; | 892 | phba->cfg_nodev_tmo = val; |
840 | phba->cfg_devloss_tmo = val; | 893 | phba->cfg_devloss_tmo = val; |
841 | phba->dev_loss_tmo_changed = 1; | 894 | phba->dev_loss_tmo_changed = 1; |
895 | lpfc_update_rport_devloss_tmo(phba); | ||
842 | return 0; | 896 | return 0; |
843 | } | 897 | } |
844 | 898 | ||
@@ -931,9 +985,10 @@ LPFC_ATTR_RW(topology, 0, 0, 6, "Select Fibre Channel topology"); | |||
931 | # 1 = 1 Gigabaud | 985 | # 1 = 1 Gigabaud |
932 | # 2 = 2 Gigabaud | 986 | # 2 = 2 Gigabaud |
933 | # 4 = 4 Gigabaud | 987 | # 4 = 4 Gigabaud |
934 | # Value range is [0,4]. Default value is 0. | 988 | # 8 = 8 Gigabaud |
989 | # Value range is [0,8]. Default value is 0. | ||
935 | */ | 990 | */ |
936 | LPFC_ATTR_R(link_speed, 0, 0, 4, "Select link speed"); | 991 | LPFC_ATTR_R(link_speed, 0, 0, 8, "Select link speed"); |
937 | 992 | ||
938 | /* | 993 | /* |
939 | # lpfc_fcp_class: Determines FC class to use for the FCP protocol. | 994 | # lpfc_fcp_class: Determines FC class to use for the FCP protocol. |
@@ -958,7 +1013,7 @@ LPFC_ATTR_R(ack0, 0, 0, 1, "Enable ACK0 support"); | |||
958 | /* | 1013 | /* |
959 | # lpfc_cr_delay & lpfc_cr_count: Default values for I/O colaesing | 1014 | # lpfc_cr_delay & lpfc_cr_count: Default values for I/O colaesing |
960 | # cr_delay (msec) or cr_count outstanding commands. cr_delay can take | 1015 | # cr_delay (msec) or cr_count outstanding commands. cr_delay can take |
961 | # value [0,63]. cr_count can take value [0,255]. Default value of cr_delay | 1016 | # value [0,63]. cr_count can take value [1,255]. Default value of cr_delay |
962 | # is 0. Default value of cr_count is 1. The cr_count feature is disabled if | 1017 | # is 0. Default value of cr_count is 1. The cr_count feature is disabled if |
963 | # cr_delay is set to 0. | 1018 | # cr_delay is set to 0. |
964 | */ | 1019 | */ |
@@ -1227,11 +1282,11 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1227 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; | 1282 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
1228 | int rc; | 1283 | int rc; |
1229 | 1284 | ||
1230 | if (off > sizeof(MAILBOX_t)) | 1285 | if (off > MAILBOX_CMD_SIZE) |
1231 | return -ERANGE; | 1286 | return -ERANGE; |
1232 | 1287 | ||
1233 | if ((count + off) > sizeof(MAILBOX_t)) | 1288 | if ((count + off) > MAILBOX_CMD_SIZE) |
1234 | count = sizeof(MAILBOX_t) - off; | 1289 | count = MAILBOX_CMD_SIZE - off; |
1235 | 1290 | ||
1236 | if (off % 4 || count % 4 || (unsigned long)buf % 4) | 1291 | if (off % 4 || count % 4 || (unsigned long)buf % 4) |
1237 | return -EINVAL; | 1292 | return -EINVAL; |
@@ -1307,6 +1362,12 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1307 | return -EPERM; | 1362 | return -EPERM; |
1308 | } | 1363 | } |
1309 | 1364 | ||
1365 | if (phba->fc_flag & FC_BLOCK_MGMT_IO) { | ||
1366 | sysfs_mbox_idle(phba); | ||
1367 | spin_unlock_irq(host->host_lock); | ||
1368 | return -EAGAIN; | ||
1369 | } | ||
1370 | |||
1310 | if ((phba->fc_flag & FC_OFFLINE_MODE) || | 1371 | if ((phba->fc_flag & FC_OFFLINE_MODE) || |
1311 | (!(phba->sli.sli_flag & LPFC_SLI2_ACTIVE))){ | 1372 | (!(phba->sli.sli_flag & LPFC_SLI2_ACTIVE))){ |
1312 | 1373 | ||
@@ -1326,6 +1387,11 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1326 | } | 1387 | } |
1327 | 1388 | ||
1328 | if (rc != MBX_SUCCESS) { | 1389 | if (rc != MBX_SUCCESS) { |
1390 | if (rc == MBX_TIMEOUT) { | ||
1391 | phba->sysfs_mbox.mbox->mbox_cmpl = | ||
1392 | lpfc_sli_def_mbox_cmpl; | ||
1393 | phba->sysfs_mbox.mbox = NULL; | ||
1394 | } | ||
1329 | sysfs_mbox_idle(phba); | 1395 | sysfs_mbox_idle(phba); |
1330 | spin_unlock_irq(host->host_lock); | 1396 | spin_unlock_irq(host->host_lock); |
1331 | return (rc == MBX_TIMEOUT) ? -ETIME : -ENODEV; | 1397 | return (rc == MBX_TIMEOUT) ? -ETIME : -ENODEV; |
@@ -1344,7 +1410,7 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1344 | 1410 | ||
1345 | phba->sysfs_mbox.offset = off + count; | 1411 | phba->sysfs_mbox.offset = off + count; |
1346 | 1412 | ||
1347 | if (phba->sysfs_mbox.offset == sizeof(MAILBOX_t)) | 1413 | if (phba->sysfs_mbox.offset == MAILBOX_CMD_SIZE) |
1348 | sysfs_mbox_idle(phba); | 1414 | sysfs_mbox_idle(phba); |
1349 | 1415 | ||
1350 | spin_unlock_irq(phba->host->host_lock); | 1416 | spin_unlock_irq(phba->host->host_lock); |
@@ -1358,7 +1424,7 @@ static struct bin_attribute sysfs_mbox_attr = { | |||
1358 | .mode = S_IRUSR | S_IWUSR, | 1424 | .mode = S_IRUSR | S_IWUSR, |
1359 | .owner = THIS_MODULE, | 1425 | .owner = THIS_MODULE, |
1360 | }, | 1426 | }, |
1361 | .size = sizeof(MAILBOX_t), | 1427 | .size = MAILBOX_CMD_SIZE, |
1362 | .read = sysfs_mbox_read, | 1428 | .read = sysfs_mbox_read, |
1363 | .write = sysfs_mbox_write, | 1429 | .write = sysfs_mbox_write, |
1364 | }; | 1430 | }; |
@@ -1494,6 +1560,9 @@ lpfc_get_host_speed(struct Scsi_Host *shost) | |||
1494 | case LA_4GHZ_LINK: | 1560 | case LA_4GHZ_LINK: |
1495 | fc_host_speed(shost) = FC_PORTSPEED_4GBIT; | 1561 | fc_host_speed(shost) = FC_PORTSPEED_4GBIT; |
1496 | break; | 1562 | break; |
1563 | case LA_8GHZ_LINK: | ||
1564 | fc_host_speed(shost) = FC_PORTSPEED_8GBIT; | ||
1565 | break; | ||
1497 | default: | 1566 | default: |
1498 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; | 1567 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; |
1499 | break; | 1568 | break; |
@@ -1546,6 +1615,9 @@ lpfc_get_stats(struct Scsi_Host *shost) | |||
1546 | unsigned long seconds; | 1615 | unsigned long seconds; |
1547 | int rc = 0; | 1616 | int rc = 0; |
1548 | 1617 | ||
1618 | if (phba->fc_flag & FC_BLOCK_MGMT_IO) | ||
1619 | return NULL; | ||
1620 | |||
1549 | pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 1621 | pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
1550 | if (!pmboxq) | 1622 | if (!pmboxq) |
1551 | return NULL; | 1623 | return NULL; |
@@ -1631,6 +1703,8 @@ lpfc_get_stats(struct Scsi_Host *shost) | |||
1631 | else | 1703 | else |
1632 | hs->seconds_since_last_reset = seconds - psli->stats_start; | 1704 | hs->seconds_since_last_reset = seconds - psli->stats_start; |
1633 | 1705 | ||
1706 | mempool_free(pmboxq, phba->mbox_mem_pool); | ||
1707 | |||
1634 | return hs; | 1708 | return hs; |
1635 | } | 1709 | } |
1636 | 1710 | ||
@@ -1644,6 +1718,9 @@ lpfc_reset_stats(struct Scsi_Host *shost) | |||
1644 | MAILBOX_t *pmb; | 1718 | MAILBOX_t *pmb; |
1645 | int rc = 0; | 1719 | int rc = 0; |
1646 | 1720 | ||
1721 | if (phba->fc_flag & FC_BLOCK_MGMT_IO) | ||
1722 | return; | ||
1723 | |||
1647 | pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 1724 | pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
1648 | if (!pmboxq) | 1725 | if (!pmboxq) |
1649 | return; | 1726 | return; |
@@ -1699,6 +1776,8 @@ lpfc_reset_stats(struct Scsi_Host *shost) | |||
1699 | 1776 | ||
1700 | psli->stats_start = get_seconds(); | 1777 | psli->stats_start = get_seconds(); |
1701 | 1778 | ||
1779 | mempool_free(pmboxq, phba->mbox_mem_pool); | ||
1780 | |||
1702 | return; | 1781 | return; |
1703 | } | 1782 | } |
1704 | 1783 | ||
@@ -1706,67 +1785,51 @@ lpfc_reset_stats(struct Scsi_Host *shost) | |||
1706 | * The LPFC driver treats linkdown handling as target loss events so there | 1785 | * The LPFC driver treats linkdown handling as target loss events so there |
1707 | * are no sysfs handlers for link_down_tmo. | 1786 | * are no sysfs handlers for link_down_tmo. |
1708 | */ | 1787 | */ |
1709 | static void | 1788 | |
1710 | lpfc_get_starget_port_id(struct scsi_target *starget) | 1789 | static struct lpfc_nodelist * |
1790 | lpfc_get_node_by_target(struct scsi_target *starget) | ||
1711 | { | 1791 | { |
1712 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1792 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
1713 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; | 1793 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; |
1714 | uint32_t did = -1; | 1794 | struct lpfc_nodelist *ndlp; |
1715 | struct lpfc_nodelist *ndlp = NULL; | ||
1716 | 1795 | ||
1717 | spin_lock_irq(shost->host_lock); | 1796 | spin_lock_irq(shost->host_lock); |
1718 | /* Search the mapped list for this target ID */ | 1797 | /* Search for this, mapped, target ID */ |
1719 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { | 1798 | list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) { |
1720 | if (starget->id == ndlp->nlp_sid) { | 1799 | if (ndlp->nlp_state == NLP_STE_MAPPED_NODE && |
1721 | did = ndlp->nlp_DID; | 1800 | starget->id == ndlp->nlp_sid) { |
1722 | break; | 1801 | spin_unlock_irq(shost->host_lock); |
1802 | return ndlp; | ||
1723 | } | 1803 | } |
1724 | } | 1804 | } |
1725 | spin_unlock_irq(shost->host_lock); | 1805 | spin_unlock_irq(shost->host_lock); |
1806 | return NULL; | ||
1807 | } | ||
1808 | |||
1809 | static void | ||
1810 | lpfc_get_starget_port_id(struct scsi_target *starget) | ||
1811 | { | ||
1812 | struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget); | ||
1726 | 1813 | ||
1727 | fc_starget_port_id(starget) = did; | 1814 | fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1; |
1728 | } | 1815 | } |
1729 | 1816 | ||
1730 | static void | 1817 | static void |
1731 | lpfc_get_starget_node_name(struct scsi_target *starget) | 1818 | lpfc_get_starget_node_name(struct scsi_target *starget) |
1732 | { | 1819 | { |
1733 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1820 | struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget); |
1734 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; | ||
1735 | u64 node_name = 0; | ||
1736 | struct lpfc_nodelist *ndlp = NULL; | ||
1737 | |||
1738 | spin_lock_irq(shost->host_lock); | ||
1739 | /* Search the mapped list for this target ID */ | ||
1740 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { | ||
1741 | if (starget->id == ndlp->nlp_sid) { | ||
1742 | node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn); | ||
1743 | break; | ||
1744 | } | ||
1745 | } | ||
1746 | spin_unlock_irq(shost->host_lock); | ||
1747 | 1821 | ||
1748 | fc_starget_node_name(starget) = node_name; | 1822 | fc_starget_node_name(starget) = |
1823 | ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0; | ||
1749 | } | 1824 | } |
1750 | 1825 | ||
1751 | static void | 1826 | static void |
1752 | lpfc_get_starget_port_name(struct scsi_target *starget) | 1827 | lpfc_get_starget_port_name(struct scsi_target *starget) |
1753 | { | 1828 | { |
1754 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1829 | struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget); |
1755 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; | ||
1756 | u64 port_name = 0; | ||
1757 | struct lpfc_nodelist *ndlp = NULL; | ||
1758 | |||
1759 | spin_lock_irq(shost->host_lock); | ||
1760 | /* Search the mapped list for this target ID */ | ||
1761 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { | ||
1762 | if (starget->id == ndlp->nlp_sid) { | ||
1763 | port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn); | ||
1764 | break; | ||
1765 | } | ||
1766 | } | ||
1767 | spin_unlock_irq(shost->host_lock); | ||
1768 | 1830 | ||
1769 | fc_starget_port_name(starget) = port_name; | 1831 | fc_starget_port_name(starget) = |
1832 | ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0; | ||
1770 | } | 1833 | } |
1771 | 1834 | ||
1772 | static void | 1835 | static void |
@@ -1895,25 +1958,8 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) | |||
1895 | sizeof(struct fcp_rsp) + | 1958 | sizeof(struct fcp_rsp) + |
1896 | (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); | 1959 | (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); |
1897 | 1960 | ||
1898 | switch (phba->pcidev->device) { | ||
1899 | case PCI_DEVICE_ID_LP101: | ||
1900 | case PCI_DEVICE_ID_BSMB: | ||
1901 | case PCI_DEVICE_ID_ZSMB: | ||
1902 | phba->cfg_hba_queue_depth = LPFC_LP101_HBA_Q_DEPTH; | ||
1903 | break; | ||
1904 | case PCI_DEVICE_ID_RFLY: | ||
1905 | case PCI_DEVICE_ID_PFLY: | ||
1906 | case PCI_DEVICE_ID_BMID: | ||
1907 | case PCI_DEVICE_ID_ZMID: | ||
1908 | case PCI_DEVICE_ID_TFLY: | ||
1909 | phba->cfg_hba_queue_depth = LPFC_LC_HBA_Q_DEPTH; | ||
1910 | break; | ||
1911 | default: | ||
1912 | phba->cfg_hba_queue_depth = LPFC_DFT_HBA_Q_DEPTH; | ||
1913 | } | ||
1914 | 1961 | ||
1915 | if (phba->cfg_hba_queue_depth > lpfc_hba_queue_depth) | 1962 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); |
1916 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); | ||
1917 | 1963 | ||
1918 | return; | 1964 | return; |
1919 | } | 1965 | } |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 1251788ce2a3..b8c2a8862d8c 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
@@ -18,6 +18,8 @@ | |||
18 | * included with this package. * | 18 | * included with this package. * |
19 | *******************************************************************/ | 19 | *******************************************************************/ |
20 | 20 | ||
21 | typedef int (*node_filter)(struct lpfc_nodelist *ndlp, void *param); | ||
22 | |||
21 | struct fc_rport; | 23 | struct fc_rport; |
22 | void lpfc_dump_mem(struct lpfc_hba *, LPFC_MBOXQ_t *, uint16_t); | 24 | void lpfc_dump_mem(struct lpfc_hba *, LPFC_MBOXQ_t *, uint16_t); |
23 | void lpfc_read_nv(struct lpfc_hba *, LPFC_MBOXQ_t *); | 25 | void lpfc_read_nv(struct lpfc_hba *, LPFC_MBOXQ_t *); |
@@ -43,20 +45,24 @@ void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); | |||
43 | void lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); | 45 | void lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); |
44 | void lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); | 46 | void lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); |
45 | void lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); | 47 | void lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); |
46 | int lpfc_nlp_list(struct lpfc_hba *, struct lpfc_nodelist *, int); | 48 | void lpfc_dequeue_node(struct lpfc_hba *, struct lpfc_nodelist *); |
49 | void lpfc_nlp_set_state(struct lpfc_hba *, struct lpfc_nodelist *, int); | ||
50 | void lpfc_drop_node(struct lpfc_hba *, struct lpfc_nodelist *); | ||
47 | void lpfc_set_disctmo(struct lpfc_hba *); | 51 | void lpfc_set_disctmo(struct lpfc_hba *); |
48 | int lpfc_can_disctmo(struct lpfc_hba *); | 52 | int lpfc_can_disctmo(struct lpfc_hba *); |
49 | int lpfc_unreg_rpi(struct lpfc_hba *, struct lpfc_nodelist *); | 53 | int lpfc_unreg_rpi(struct lpfc_hba *, struct lpfc_nodelist *); |
50 | int lpfc_check_sli_ndlp(struct lpfc_hba *, struct lpfc_sli_ring *, | 54 | int lpfc_check_sli_ndlp(struct lpfc_hba *, struct lpfc_sli_ring *, |
51 | struct lpfc_iocbq *, struct lpfc_nodelist *); | 55 | struct lpfc_iocbq *, struct lpfc_nodelist *); |
52 | int lpfc_nlp_remove(struct lpfc_hba *, struct lpfc_nodelist *); | ||
53 | void lpfc_nlp_init(struct lpfc_hba *, struct lpfc_nodelist *, uint32_t); | 56 | void lpfc_nlp_init(struct lpfc_hba *, struct lpfc_nodelist *, uint32_t); |
57 | struct lpfc_nodelist *lpfc_nlp_get(struct lpfc_nodelist *); | ||
58 | int lpfc_nlp_put(struct lpfc_nodelist *); | ||
54 | struct lpfc_nodelist *lpfc_setup_disc_node(struct lpfc_hba *, uint32_t); | 59 | struct lpfc_nodelist *lpfc_setup_disc_node(struct lpfc_hba *, uint32_t); |
55 | void lpfc_disc_list_loopmap(struct lpfc_hba *); | 60 | void lpfc_disc_list_loopmap(struct lpfc_hba *); |
56 | void lpfc_disc_start(struct lpfc_hba *); | 61 | void lpfc_disc_start(struct lpfc_hba *); |
57 | void lpfc_disc_flush_list(struct lpfc_hba *); | 62 | void lpfc_disc_flush_list(struct lpfc_hba *); |
58 | void lpfc_disc_timeout(unsigned long); | 63 | void lpfc_disc_timeout(unsigned long); |
59 | 64 | ||
65 | struct lpfc_nodelist *__lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi); | ||
60 | struct lpfc_nodelist *lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi); | 66 | struct lpfc_nodelist *lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi); |
61 | 67 | ||
62 | int lpfc_workq_post_event(struct lpfc_hba *, void *, void *, uint32_t); | 68 | int lpfc_workq_post_event(struct lpfc_hba *, void *, void *, uint32_t); |
@@ -66,8 +72,7 @@ int lpfc_disc_state_machine(struct lpfc_hba *, struct lpfc_nodelist *, void *, | |||
66 | 72 | ||
67 | int lpfc_check_sparm(struct lpfc_hba *, struct lpfc_nodelist *, | 73 | int lpfc_check_sparm(struct lpfc_hba *, struct lpfc_nodelist *, |
68 | struct serv_parm *, uint32_t); | 74 | struct serv_parm *, uint32_t); |
69 | int lpfc_els_abort(struct lpfc_hba *, struct lpfc_nodelist * ndlp, | 75 | int lpfc_els_abort(struct lpfc_hba *, struct lpfc_nodelist * ndlp); |
70 | int); | ||
71 | int lpfc_els_abort_flogi(struct lpfc_hba *); | 76 | int lpfc_els_abort_flogi(struct lpfc_hba *); |
72 | int lpfc_initial_flogi(struct lpfc_hba *); | 77 | int lpfc_initial_flogi(struct lpfc_hba *); |
73 | int lpfc_issue_els_plogi(struct lpfc_hba *, uint32_t, uint8_t); | 78 | int lpfc_issue_els_plogi(struct lpfc_hba *, uint32_t, uint8_t); |
@@ -113,7 +118,10 @@ void lpfc_hba_init(struct lpfc_hba *, uint32_t *); | |||
113 | int lpfc_post_buffer(struct lpfc_hba *, struct lpfc_sli_ring *, int, int); | 118 | int lpfc_post_buffer(struct lpfc_hba *, struct lpfc_sli_ring *, int, int); |
114 | void lpfc_decode_firmware_rev(struct lpfc_hba *, char *, int); | 119 | void lpfc_decode_firmware_rev(struct lpfc_hba *, char *, int); |
115 | int lpfc_online(struct lpfc_hba *); | 120 | int lpfc_online(struct lpfc_hba *); |
116 | int lpfc_offline(struct lpfc_hba *); | 121 | void lpfc_block_mgmt_io(struct lpfc_hba *); |
122 | void lpfc_unblock_mgmt_io(struct lpfc_hba *); | ||
123 | void lpfc_offline_prep(struct lpfc_hba *); | ||
124 | void lpfc_offline(struct lpfc_hba *); | ||
117 | 125 | ||
118 | int lpfc_sli_setup(struct lpfc_hba *); | 126 | int lpfc_sli_setup(struct lpfc_hba *); |
119 | int lpfc_sli_queue_setup(struct lpfc_hba *); | 127 | int lpfc_sli_queue_setup(struct lpfc_hba *); |
@@ -162,8 +170,8 @@ int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *, | |||
162 | struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *, | 170 | struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *, |
163 | struct lpfc_sli_ring *, | 171 | struct lpfc_sli_ring *, |
164 | dma_addr_t); | 172 | dma_addr_t); |
165 | int lpfc_sli_issue_abort_iotag32(struct lpfc_hba *, struct lpfc_sli_ring *, | 173 | int lpfc_sli_issue_abort_iotag(struct lpfc_hba *, struct lpfc_sli_ring *, |
166 | struct lpfc_iocbq *); | 174 | struct lpfc_iocbq *); |
167 | int lpfc_sli_sum_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, | 175 | int lpfc_sli_sum_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, |
168 | uint64_t, lpfc_ctx_cmd); | 176 | uint64_t, lpfc_ctx_cmd); |
169 | int lpfc_sli_abort_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, | 177 | int lpfc_sli_abort_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, |
@@ -172,9 +180,8 @@ int lpfc_sli_abort_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, | |||
172 | void lpfc_mbox_timeout(unsigned long); | 180 | void lpfc_mbox_timeout(unsigned long); |
173 | void lpfc_mbox_timeout_handler(struct lpfc_hba *); | 181 | void lpfc_mbox_timeout_handler(struct lpfc_hba *); |
174 | 182 | ||
175 | struct lpfc_nodelist *lpfc_findnode_did(struct lpfc_hba *, uint32_t, uint32_t); | 183 | struct lpfc_nodelist *lpfc_findnode_did(struct lpfc_hba *, uint32_t); |
176 | struct lpfc_nodelist *lpfc_findnode_wwpn(struct lpfc_hba *, uint32_t, | 184 | struct lpfc_nodelist *lpfc_findnode_wwpn(struct lpfc_hba *, struct lpfc_name *); |
177 | struct lpfc_name *); | ||
178 | 185 | ||
179 | int lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq, | 186 | int lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq, |
180 | uint32_t timeout); | 187 | uint32_t timeout); |
@@ -193,6 +200,9 @@ void lpfc_mbuf_free(struct lpfc_hba *, void *, dma_addr_t); | |||
193 | 200 | ||
194 | /* Function prototypes. */ | 201 | /* Function prototypes. */ |
195 | const char* lpfc_info(struct Scsi_Host *); | 202 | const char* lpfc_info(struct Scsi_Host *); |
203 | void lpfc_scan_start(struct Scsi_Host *); | ||
204 | int lpfc_scan_finished(struct Scsi_Host *, unsigned long); | ||
205 | |||
196 | void lpfc_get_cfgparam(struct lpfc_hba *); | 206 | void lpfc_get_cfgparam(struct lpfc_hba *); |
197 | int lpfc_alloc_sysfs_attr(struct lpfc_hba *); | 207 | int lpfc_alloc_sysfs_attr(struct lpfc_hba *); |
198 | void lpfc_free_sysfs_attr(struct lpfc_hba *); | 208 | void lpfc_free_sysfs_attr(struct lpfc_hba *); |
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index a51a41b7f15d..34a9e3bb2614 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
@@ -334,21 +334,22 @@ lpfc_ns_rsp(struct lpfc_hba * phba, struct lpfc_dmabuf * mp, uint32_t Size) | |||
334 | 334 | ||
335 | lpfc_set_disctmo(phba); | 335 | lpfc_set_disctmo(phba); |
336 | 336 | ||
337 | Cnt = Size > FCELSSIZE ? FCELSSIZE : Size; | ||
338 | 337 | ||
339 | list_add_tail(&head, &mp->list); | 338 | list_add_tail(&head, &mp->list); |
340 | list_for_each_entry_safe(mp, next_mp, &head, list) { | 339 | list_for_each_entry_safe(mp, next_mp, &head, list) { |
341 | mlast = mp; | 340 | mlast = mp; |
342 | 341 | ||
342 | Cnt = Size > FCELSSIZE ? FCELSSIZE : Size; | ||
343 | |||
343 | Size -= Cnt; | 344 | Size -= Cnt; |
344 | 345 | ||
345 | if (!ctptr) | 346 | if (!ctptr) { |
346 | ctptr = (uint32_t *) mlast->virt; | 347 | ctptr = (uint32_t *) mlast->virt; |
347 | else | 348 | } else |
348 | Cnt -= 16; /* subtract length of CT header */ | 349 | Cnt -= 16; /* subtract length of CT header */ |
349 | 350 | ||
350 | /* Loop through entire NameServer list of DIDs */ | 351 | /* Loop through entire NameServer list of DIDs */ |
351 | while (Cnt) { | 352 | while (Cnt >= sizeof (uint32_t)) { |
352 | 353 | ||
353 | /* Get next DID from NameServer List */ | 354 | /* Get next DID from NameServer List */ |
354 | CTentry = *ctptr++; | 355 | CTentry = *ctptr++; |
@@ -442,10 +443,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
442 | if (phba->fc_ns_retry < LPFC_MAX_NS_RETRY) { | 443 | if (phba->fc_ns_retry < LPFC_MAX_NS_RETRY) { |
443 | phba->fc_ns_retry++; | 444 | phba->fc_ns_retry++; |
444 | /* CT command is being retried */ | 445 | /* CT command is being retried */ |
445 | ndlp = | 446 | ndlp = lpfc_findnode_did(phba, NameServer_DID); |
446 | lpfc_findnode_did(phba, NLP_SEARCH_UNMAPPED, | 447 | if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { |
447 | NameServer_DID); | ||
448 | if (ndlp) { | ||
449 | if (lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT) == | 448 | if (lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT) == |
450 | 0) { | 449 | 0) { |
451 | goto out; | 450 | goto out; |
@@ -729,7 +728,7 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba * phba, | |||
729 | uint16_t fdmi_cmd = CTcmd->CommandResponse.bits.CmdRsp; | 728 | uint16_t fdmi_cmd = CTcmd->CommandResponse.bits.CmdRsp; |
730 | uint16_t fdmi_rsp = CTrsp->CommandResponse.bits.CmdRsp; | 729 | uint16_t fdmi_rsp = CTrsp->CommandResponse.bits.CmdRsp; |
731 | 730 | ||
732 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, FDMI_DID); | 731 | ndlp = lpfc_findnode_did(phba, FDMI_DID); |
733 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { | 732 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { |
734 | /* FDMI rsp failed */ | 733 | /* FDMI rsp failed */ |
735 | lpfc_printf_log(phba, | 734 | lpfc_printf_log(phba, |
@@ -1039,6 +1038,9 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
1039 | case LA_4GHZ_LINK: | 1038 | case LA_4GHZ_LINK: |
1040 | ae->un.PortSpeed = HBA_PORTSPEED_4GBIT; | 1039 | ae->un.PortSpeed = HBA_PORTSPEED_4GBIT; |
1041 | break; | 1040 | break; |
1041 | case LA_8GHZ_LINK: | ||
1042 | ae->un.PortSpeed = HBA_PORTSPEED_8GBIT; | ||
1043 | break; | ||
1042 | default: | 1044 | default: |
1043 | ae->un.PortSpeed = | 1045 | ae->un.PortSpeed = |
1044 | HBA_PORTSPEED_UNKNOWN; | 1046 | HBA_PORTSPEED_UNKNOWN; |
@@ -1161,7 +1163,7 @@ lpfc_fdmi_tmo_handler(struct lpfc_hba *phba) | |||
1161 | { | 1163 | { |
1162 | struct lpfc_nodelist *ndlp; | 1164 | struct lpfc_nodelist *ndlp; |
1163 | 1165 | ||
1164 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, FDMI_DID); | 1166 | ndlp = lpfc_findnode_did(phba, FDMI_DID); |
1165 | if (ndlp) { | 1167 | if (ndlp) { |
1166 | if (init_utsname()->nodename[0] != '\0') { | 1168 | if (init_utsname()->nodename[0] != '\0') { |
1167 | lpfc_fdmi_cmd(phba, ndlp, SLI_MGMT_DHBA); | 1169 | lpfc_fdmi_cmd(phba, ndlp, SLI_MGMT_DHBA); |
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h index 9766f909c9c6..498059f3f7f4 100644 --- a/drivers/scsi/lpfc/lpfc_disc.h +++ b/drivers/scsi/lpfc/lpfc_disc.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
@@ -31,6 +31,7 @@ | |||
31 | /* worker thread events */ | 31 | /* worker thread events */ |
32 | enum lpfc_work_type { | 32 | enum lpfc_work_type { |
33 | LPFC_EVT_ONLINE, | 33 | LPFC_EVT_ONLINE, |
34 | LPFC_EVT_OFFLINE_PREP, | ||
34 | LPFC_EVT_OFFLINE, | 35 | LPFC_EVT_OFFLINE, |
35 | LPFC_EVT_WARM_START, | 36 | LPFC_EVT_WARM_START, |
36 | LPFC_EVT_KILL, | 37 | LPFC_EVT_KILL, |
@@ -68,7 +69,6 @@ struct lpfc_nodelist { | |||
68 | uint16_t nlp_maxframe; /* Max RCV frame size */ | 69 | uint16_t nlp_maxframe; /* Max RCV frame size */ |
69 | uint8_t nlp_class_sup; /* Supported Classes */ | 70 | uint8_t nlp_class_sup; /* Supported Classes */ |
70 | uint8_t nlp_retry; /* used for ELS retries */ | 71 | uint8_t nlp_retry; /* used for ELS retries */ |
71 | uint8_t nlp_disc_refcnt; /* used for DSM */ | ||
72 | uint8_t nlp_fcp_info; /* class info, bits 0-3 */ | 72 | uint8_t nlp_fcp_info; /* class info, bits 0-3 */ |
73 | #define NLP_FCP_2_DEVICE 0x10 /* FCP-2 device */ | 73 | #define NLP_FCP_2_DEVICE 0x10 /* FCP-2 device */ |
74 | 74 | ||
@@ -79,20 +79,10 @@ struct lpfc_nodelist { | |||
79 | struct lpfc_work_evt els_retry_evt; | 79 | struct lpfc_work_evt els_retry_evt; |
80 | unsigned long last_ramp_up_time; /* jiffy of last ramp up */ | 80 | unsigned long last_ramp_up_time; /* jiffy of last ramp up */ |
81 | unsigned long last_q_full_time; /* jiffy of last queue full */ | 81 | unsigned long last_q_full_time; /* jiffy of last queue full */ |
82 | struct kref kref; | ||
82 | }; | 83 | }; |
83 | 84 | ||
84 | /* Defines for nlp_flag (uint32) */ | 85 | /* Defines for nlp_flag (uint32) */ |
85 | #define NLP_NO_LIST 0x0 /* Indicates immediately free node */ | ||
86 | #define NLP_UNUSED_LIST 0x1 /* Flg to indicate node will be freed */ | ||
87 | #define NLP_PLOGI_LIST 0x2 /* Flg to indicate sent PLOGI */ | ||
88 | #define NLP_ADISC_LIST 0x3 /* Flg to indicate sent ADISC */ | ||
89 | #define NLP_REGLOGIN_LIST 0x4 /* Flg to indicate sent REG_LOGIN */ | ||
90 | #define NLP_PRLI_LIST 0x5 /* Flg to indicate sent PRLI */ | ||
91 | #define NLP_UNMAPPED_LIST 0x6 /* Node is now unmapped */ | ||
92 | #define NLP_MAPPED_LIST 0x7 /* Node is now mapped */ | ||
93 | #define NLP_NPR_LIST 0x8 /* Node is in NPort Recovery state */ | ||
94 | #define NLP_JUST_DQ 0x9 /* just deque ndlp in lpfc_nlp_list */ | ||
95 | #define NLP_LIST_MASK 0xf /* mask to see what list node is on */ | ||
96 | #define NLP_PLOGI_SND 0x20 /* sent PLOGI request for this entry */ | 86 | #define NLP_PLOGI_SND 0x20 /* sent PLOGI request for this entry */ |
97 | #define NLP_PRLI_SND 0x40 /* sent PRLI request for this entry */ | 87 | #define NLP_PRLI_SND 0x40 /* sent PRLI request for this entry */ |
98 | #define NLP_ADISC_SND 0x80 /* sent ADISC request for this entry */ | 88 | #define NLP_ADISC_SND 0x80 /* sent ADISC request for this entry */ |
@@ -108,20 +98,8 @@ struct lpfc_nodelist { | |||
108 | ACC */ | 98 | ACC */ |
109 | #define NLP_NPR_ADISC 0x2000000 /* Issue ADISC when dq'ed from | 99 | #define NLP_NPR_ADISC 0x2000000 /* Issue ADISC when dq'ed from |
110 | NPR list */ | 100 | NPR list */ |
111 | #define NLP_DELAY_REMOVE 0x4000000 /* Defer removal till end of DSM */ | ||
112 | #define NLP_NODEV_REMOVE 0x8000000 /* Defer removal till discovery ends */ | 101 | #define NLP_NODEV_REMOVE 0x8000000 /* Defer removal till discovery ends */ |
113 | 102 | ||
114 | /* Defines for list searchs */ | ||
115 | #define NLP_SEARCH_MAPPED 0x1 /* search mapped */ | ||
116 | #define NLP_SEARCH_UNMAPPED 0x2 /* search unmapped */ | ||
117 | #define NLP_SEARCH_PLOGI 0x4 /* search plogi */ | ||
118 | #define NLP_SEARCH_ADISC 0x8 /* search adisc */ | ||
119 | #define NLP_SEARCH_REGLOGIN 0x10 /* search reglogin */ | ||
120 | #define NLP_SEARCH_PRLI 0x20 /* search prli */ | ||
121 | #define NLP_SEARCH_NPR 0x40 /* search npr */ | ||
122 | #define NLP_SEARCH_UNUSED 0x80 /* search mapped */ | ||
123 | #define NLP_SEARCH_ALL 0xff /* search all lists */ | ||
124 | |||
125 | /* There are 4 different double linked lists nodelist entries can reside on. | 103 | /* There are 4 different double linked lists nodelist entries can reside on. |
126 | * The Port Login (PLOGI) list and Address Discovery (ADISC) list are used | 104 | * The Port Login (PLOGI) list and Address Discovery (ADISC) list are used |
127 | * when Link Up discovery or Registered State Change Notification (RSCN) | 105 | * when Link Up discovery or Registered State Change Notification (RSCN) |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index a5f33a0dd4e7..638b3cd677bd 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -182,6 +182,7 @@ lpfc_prep_els_iocb(struct lpfc_hba * phba, uint8_t expectRsp, | |||
182 | icmd->un.elsreq64.bdl.bdeSize = (2 * sizeof (struct ulp_bde64)); | 182 | icmd->un.elsreq64.bdl.bdeSize = (2 * sizeof (struct ulp_bde64)); |
183 | icmd->un.elsreq64.remoteID = did; /* DID */ | 183 | icmd->un.elsreq64.remoteID = did; /* DID */ |
184 | icmd->ulpCommand = CMD_ELS_REQUEST64_CR; | 184 | icmd->ulpCommand = CMD_ELS_REQUEST64_CR; |
185 | icmd->ulpTimeout = phba->fc_ratov * 2; | ||
185 | } else { | 186 | } else { |
186 | icmd->un.elsreq64.bdl.bdeSize = sizeof (struct ulp_bde64); | 187 | icmd->un.elsreq64.bdl.bdeSize = sizeof (struct ulp_bde64); |
187 | icmd->ulpCommand = CMD_XMIT_ELS_RSP64_CX; | 188 | icmd->ulpCommand = CMD_XMIT_ELS_RSP64_CX; |
@@ -208,9 +209,9 @@ lpfc_prep_els_iocb(struct lpfc_hba * phba, uint8_t expectRsp, | |||
208 | } | 209 | } |
209 | 210 | ||
210 | /* Save for completion so we can release these resources */ | 211 | /* Save for completion so we can release these resources */ |
211 | elsiocb->context1 = (uint8_t *) ndlp; | 212 | elsiocb->context1 = lpfc_nlp_get(ndlp); |
212 | elsiocb->context2 = (uint8_t *) pcmd; | 213 | elsiocb->context2 = pcmd; |
213 | elsiocb->context3 = (uint8_t *) pbuflist; | 214 | elsiocb->context3 = pbuflist; |
214 | elsiocb->retry = retry; | 215 | elsiocb->retry = retry; |
215 | elsiocb->drvrTimeout = (phba->fc_ratov << 1) + LPFC_DRVR_TIMEOUT; | 216 | elsiocb->drvrTimeout = (phba->fc_ratov << 1) + LPFC_DRVR_TIMEOUT; |
216 | 217 | ||
@@ -222,16 +223,16 @@ lpfc_prep_els_iocb(struct lpfc_hba * phba, uint8_t expectRsp, | |||
222 | /* Xmit ELS command <elsCmd> to remote NPORT <did> */ | 223 | /* Xmit ELS command <elsCmd> to remote NPORT <did> */ |
223 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 224 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
224 | "%d:0116 Xmit ELS command x%x to remote " | 225 | "%d:0116 Xmit ELS command x%x to remote " |
225 | "NPORT x%x Data: x%x x%x\n", | 226 | "NPORT x%x I/O tag: x%x, HBA state: x%x\n", |
226 | phba->brd_no, elscmd, | 227 | phba->brd_no, elscmd, |
227 | did, icmd->ulpIoTag, phba->hba_state); | 228 | did, elsiocb->iotag, phba->hba_state); |
228 | } else { | 229 | } else { |
229 | /* Xmit ELS response <elsCmd> to remote NPORT <did> */ | 230 | /* Xmit ELS response <elsCmd> to remote NPORT <did> */ |
230 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 231 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
231 | "%d:0117 Xmit ELS response x%x to remote " | 232 | "%d:0117 Xmit ELS response x%x to remote " |
232 | "NPORT x%x Data: x%x x%x\n", | 233 | "NPORT x%x I/O tag: x%x, size: x%x\n", |
233 | phba->brd_no, elscmd, | 234 | phba->brd_no, elscmd, |
234 | ndlp->nlp_DID, icmd->ulpIoTag, cmdSize); | 235 | ndlp->nlp_DID, elsiocb->iotag, cmdSize); |
235 | } | 236 | } |
236 | 237 | ||
237 | return elsiocb; | 238 | return elsiocb; |
@@ -304,7 +305,7 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
304 | goto fail_free_mbox; | 305 | goto fail_free_mbox; |
305 | 306 | ||
306 | mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login; | 307 | mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login; |
307 | mbox->context2 = ndlp; | 308 | mbox->context2 = lpfc_nlp_get(ndlp); |
308 | 309 | ||
309 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT | MBX_STOP_IOCB); | 310 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT | MBX_STOP_IOCB); |
310 | if (rc == MBX_NOT_FINISHED) | 311 | if (rc == MBX_NOT_FINISHED) |
@@ -313,6 +314,7 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
313 | return 0; | 314 | return 0; |
314 | 315 | ||
315 | fail_issue_reg_login: | 316 | fail_issue_reg_login: |
317 | lpfc_nlp_put(ndlp); | ||
316 | mp = (struct lpfc_dmabuf *) mbox->context1; | 318 | mp = (struct lpfc_dmabuf *) mbox->context1; |
317 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 319 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
318 | kfree(mp); | 320 | kfree(mp); |
@@ -368,9 +370,9 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
368 | mempool_free(mbox, phba->mbox_mem_pool); | 370 | mempool_free(mbox, phba->mbox_mem_pool); |
369 | goto fail; | 371 | goto fail; |
370 | } | 372 | } |
371 | mempool_free(ndlp, phba->nlp_mem_pool); | 373 | lpfc_nlp_put(ndlp); |
372 | 374 | ||
373 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, PT2PT_RemoteID); | 375 | ndlp = lpfc_findnode_did(phba, PT2PT_RemoteID); |
374 | if (!ndlp) { | 376 | if (!ndlp) { |
375 | /* | 377 | /* |
376 | * Cannot find existing Fabric ndlp, so allocate a | 378 | * Cannot find existing Fabric ndlp, so allocate a |
@@ -387,12 +389,11 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
387 | sizeof(struct lpfc_name)); | 389 | sizeof(struct lpfc_name)); |
388 | memcpy(&ndlp->nlp_nodename, &sp->nodeName, | 390 | memcpy(&ndlp->nlp_nodename, &sp->nodeName, |
389 | sizeof(struct lpfc_name)); | 391 | sizeof(struct lpfc_name)); |
390 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 392 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
391 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
392 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; | 393 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; |
393 | } else { | 394 | } else { |
394 | /* This side will wait for the PLOGI */ | 395 | /* This side will wait for the PLOGI */ |
395 | mempool_free( ndlp, phba->nlp_mem_pool); | 396 | lpfc_nlp_put(ndlp); |
396 | } | 397 | } |
397 | 398 | ||
398 | spin_lock_irq(phba->host->host_lock); | 399 | spin_lock_irq(phba->host->host_lock); |
@@ -407,8 +408,8 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
407 | } | 408 | } |
408 | 409 | ||
409 | static void | 410 | static void |
410 | lpfc_cmpl_els_flogi(struct lpfc_hba * phba, | 411 | lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
411 | struct lpfc_iocbq * cmdiocb, struct lpfc_iocbq * rspiocb) | 412 | struct lpfc_iocbq *rspiocb) |
412 | { | 413 | { |
413 | IOCB_t *irsp = &rspiocb->iocb; | 414 | IOCB_t *irsp = &rspiocb->iocb; |
414 | struct lpfc_nodelist *ndlp = cmdiocb->context1; | 415 | struct lpfc_nodelist *ndlp = cmdiocb->context1; |
@@ -418,7 +419,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba * phba, | |||
418 | 419 | ||
419 | /* Check to see if link went down during discovery */ | 420 | /* Check to see if link went down during discovery */ |
420 | if (lpfc_els_chk_latt(phba)) { | 421 | if (lpfc_els_chk_latt(phba)) { |
421 | lpfc_nlp_remove(phba, ndlp); | 422 | lpfc_nlp_put(ndlp); |
422 | goto out; | 423 | goto out; |
423 | } | 424 | } |
424 | 425 | ||
@@ -433,13 +434,12 @@ lpfc_cmpl_els_flogi(struct lpfc_hba * phba, | |||
433 | phba->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); | 434 | phba->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); |
434 | spin_unlock_irq(phba->host->host_lock); | 435 | spin_unlock_irq(phba->host->host_lock); |
435 | 436 | ||
436 | /* If private loop, then allow max outstandting els to be | 437 | /* If private loop, then allow max outstanding els to be |
437 | * LPFC_MAX_DISC_THREADS (32). Scanning in the case of no | 438 | * LPFC_MAX_DISC_THREADS (32). Scanning in the case of no |
438 | * alpa map would take too long otherwise. | 439 | * alpa map would take too long otherwise. |
439 | */ | 440 | */ |
440 | if (phba->alpa_map[0] == 0) { | 441 | if (phba->alpa_map[0] == 0) { |
441 | phba->cfg_discovery_threads = | 442 | phba->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; |
442 | LPFC_MAX_DISC_THREADS; | ||
443 | } | 443 | } |
444 | 444 | ||
445 | /* FLOGI failure */ | 445 | /* FLOGI failure */ |
@@ -484,7 +484,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba * phba, | |||
484 | } | 484 | } |
485 | 485 | ||
486 | flogifail: | 486 | flogifail: |
487 | lpfc_nlp_remove(phba, ndlp); | 487 | lpfc_nlp_put(ndlp); |
488 | 488 | ||
489 | if (irsp->ulpStatus != IOSTAT_LOCAL_REJECT || | 489 | if (irsp->ulpStatus != IOSTAT_LOCAL_REJECT || |
490 | (irsp->un.ulpWord[4] != IOERR_SLI_ABORTED && | 490 | (irsp->un.ulpWord[4] != IOERR_SLI_ABORTED && |
@@ -582,24 +582,8 @@ lpfc_els_abort_flogi(struct lpfc_hba * phba) | |||
582 | icmd = &iocb->iocb; | 582 | icmd = &iocb->iocb; |
583 | if (icmd->ulpCommand == CMD_ELS_REQUEST64_CR) { | 583 | if (icmd->ulpCommand == CMD_ELS_REQUEST64_CR) { |
584 | ndlp = (struct lpfc_nodelist *)(iocb->context1); | 584 | ndlp = (struct lpfc_nodelist *)(iocb->context1); |
585 | if (ndlp && (ndlp->nlp_DID == Fabric_DID)) { | 585 | if (ndlp && (ndlp->nlp_DID == Fabric_DID)) |
586 | list_del(&iocb->list); | 586 | lpfc_sli_issue_abort_iotag(phba, pring, iocb); |
587 | pring->txcmplq_cnt--; | ||
588 | |||
589 | if ((icmd->un.elsreq64.bdl.ulpIoTag32)) { | ||
590 | lpfc_sli_issue_abort_iotag32 | ||
591 | (phba, pring, iocb); | ||
592 | } | ||
593 | if (iocb->iocb_cmpl) { | ||
594 | icmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
595 | icmd->un.ulpWord[4] = | ||
596 | IOERR_SLI_ABORTED; | ||
597 | spin_unlock_irq(phba->host->host_lock); | ||
598 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
599 | spin_lock_irq(phba->host->host_lock); | ||
600 | } else | ||
601 | lpfc_sli_release_iocbq(phba, iocb); | ||
602 | } | ||
603 | } | 587 | } |
604 | } | 588 | } |
605 | spin_unlock_irq(phba->host->host_lock); | 589 | spin_unlock_irq(phba->host->host_lock); |
@@ -608,12 +592,12 @@ lpfc_els_abort_flogi(struct lpfc_hba * phba) | |||
608 | } | 592 | } |
609 | 593 | ||
610 | int | 594 | int |
611 | lpfc_initial_flogi(struct lpfc_hba * phba) | 595 | lpfc_initial_flogi(struct lpfc_hba *phba) |
612 | { | 596 | { |
613 | struct lpfc_nodelist *ndlp; | 597 | struct lpfc_nodelist *ndlp; |
614 | 598 | ||
615 | /* First look for the Fabric ndlp */ | 599 | /* First look for the Fabric ndlp */ |
616 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, Fabric_DID); | 600 | ndlp = lpfc_findnode_did(phba, Fabric_DID); |
617 | if (!ndlp) { | 601 | if (!ndlp) { |
618 | /* Cannot find existing Fabric ndlp, so allocate a new one */ | 602 | /* Cannot find existing Fabric ndlp, so allocate a new one */ |
619 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); | 603 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); |
@@ -621,10 +605,10 @@ lpfc_initial_flogi(struct lpfc_hba * phba) | |||
621 | return 0; | 605 | return 0; |
622 | lpfc_nlp_init(phba, ndlp, Fabric_DID); | 606 | lpfc_nlp_init(phba, ndlp, Fabric_DID); |
623 | } else { | 607 | } else { |
624 | lpfc_nlp_list(phba, ndlp, NLP_JUST_DQ); | 608 | lpfc_dequeue_node(phba, ndlp); |
625 | } | 609 | } |
626 | if (lpfc_issue_els_flogi(phba, ndlp, 0)) { | 610 | if (lpfc_issue_els_flogi(phba, ndlp, 0)) { |
627 | mempool_free( ndlp, phba->nlp_mem_pool); | 611 | lpfc_nlp_put(ndlp); |
628 | } | 612 | } |
629 | return 1; | 613 | return 1; |
630 | } | 614 | } |
@@ -653,7 +637,7 @@ lpfc_more_plogi(struct lpfc_hba * phba) | |||
653 | } | 637 | } |
654 | 638 | ||
655 | static struct lpfc_nodelist * | 639 | static struct lpfc_nodelist * |
656 | lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_dmabuf *prsp, | 640 | lpfc_plogi_confirm_nport(struct lpfc_hba *phba, struct lpfc_dmabuf *prsp, |
657 | struct lpfc_nodelist *ndlp) | 641 | struct lpfc_nodelist *ndlp) |
658 | { | 642 | { |
659 | struct lpfc_nodelist *new_ndlp; | 643 | struct lpfc_nodelist *new_ndlp; |
@@ -670,12 +654,12 @@ lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_dmabuf *prsp, | |||
670 | 654 | ||
671 | lp = (uint32_t *) prsp->virt; | 655 | lp = (uint32_t *) prsp->virt; |
672 | sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); | 656 | sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); |
673 | memset(name, 0, sizeof (struct lpfc_name)); | 657 | memset(name, 0, sizeof(struct lpfc_name)); |
674 | 658 | ||
675 | /* Now we to find out if the NPort we are logging into, matches the WWPN | 659 | /* Now we find out if the NPort we are logging into, matches the WWPN |
676 | * we have for that ndlp. If not, we have some work to do. | 660 | * we have for that ndlp. If not, we have some work to do. |
677 | */ | 661 | */ |
678 | new_ndlp = lpfc_findnode_wwpn(phba, NLP_SEARCH_ALL, &sp->portName); | 662 | new_ndlp = lpfc_findnode_wwpn(phba, &sp->portName); |
679 | 663 | ||
680 | if (new_ndlp == ndlp) | 664 | if (new_ndlp == ndlp) |
681 | return ndlp; | 665 | return ndlp; |
@@ -695,18 +679,15 @@ lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_dmabuf *prsp, | |||
695 | lpfc_unreg_rpi(phba, new_ndlp); | 679 | lpfc_unreg_rpi(phba, new_ndlp); |
696 | new_ndlp->nlp_DID = ndlp->nlp_DID; | 680 | new_ndlp->nlp_DID = ndlp->nlp_DID; |
697 | new_ndlp->nlp_prev_state = ndlp->nlp_prev_state; | 681 | new_ndlp->nlp_prev_state = ndlp->nlp_prev_state; |
698 | new_ndlp->nlp_state = ndlp->nlp_state; | 682 | lpfc_nlp_set_state(phba, new_ndlp, ndlp->nlp_state); |
699 | lpfc_nlp_list(phba, new_ndlp, ndlp->nlp_flag & NLP_LIST_MASK); | ||
700 | 683 | ||
701 | /* Move this back to NPR list */ | 684 | /* Move this back to NPR list */ |
702 | if (memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)) == 0) { | 685 | if (memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)) == 0) |
703 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 686 | lpfc_drop_node(phba, ndlp); |
704 | } | ||
705 | else { | 687 | else { |
706 | lpfc_unreg_rpi(phba, ndlp); | 688 | lpfc_unreg_rpi(phba, ndlp); |
707 | ndlp->nlp_DID = 0; /* Two ndlps cannot have the same did */ | 689 | ndlp->nlp_DID = 0; /* Two ndlps cannot have the same did */ |
708 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 690 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
709 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
710 | } | 691 | } |
711 | return new_ndlp; | 692 | return new_ndlp; |
712 | } | 693 | } |
@@ -720,13 +701,11 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
720 | struct lpfc_dmabuf *prsp; | 701 | struct lpfc_dmabuf *prsp; |
721 | int disc, rc, did, type; | 702 | int disc, rc, did, type; |
722 | 703 | ||
723 | |||
724 | /* we pass cmdiocb to state machine which needs rspiocb as well */ | 704 | /* we pass cmdiocb to state machine which needs rspiocb as well */ |
725 | cmdiocb->context_un.rsp_iocb = rspiocb; | 705 | cmdiocb->context_un.rsp_iocb = rspiocb; |
726 | 706 | ||
727 | irsp = &rspiocb->iocb; | 707 | irsp = &rspiocb->iocb; |
728 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, | 708 | ndlp = lpfc_findnode_did(phba, irsp->un.elsreq64.remoteID); |
729 | irsp->un.elsreq64.remoteID); | ||
730 | if (!ndlp) | 709 | if (!ndlp) |
731 | goto out; | 710 | goto out; |
732 | 711 | ||
@@ -1354,7 +1333,7 @@ lpfc_issue_els_scr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry) | |||
1354 | elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, | 1333 | elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, |
1355 | ndlp->nlp_DID, ELS_CMD_SCR); | 1334 | ndlp->nlp_DID, ELS_CMD_SCR); |
1356 | if (!elsiocb) { | 1335 | if (!elsiocb) { |
1357 | mempool_free( ndlp, phba->nlp_mem_pool); | 1336 | lpfc_nlp_put(ndlp); |
1358 | return 1; | 1337 | return 1; |
1359 | } | 1338 | } |
1360 | 1339 | ||
@@ -1373,12 +1352,12 @@ lpfc_issue_els_scr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry) | |||
1373 | spin_lock_irq(phba->host->host_lock); | 1352 | spin_lock_irq(phba->host->host_lock); |
1374 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { | 1353 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { |
1375 | spin_unlock_irq(phba->host->host_lock); | 1354 | spin_unlock_irq(phba->host->host_lock); |
1376 | mempool_free( ndlp, phba->nlp_mem_pool); | 1355 | lpfc_nlp_put(ndlp); |
1377 | lpfc_els_free_iocb(phba, elsiocb); | 1356 | lpfc_els_free_iocb(phba, elsiocb); |
1378 | return 1; | 1357 | return 1; |
1379 | } | 1358 | } |
1380 | spin_unlock_irq(phba->host->host_lock); | 1359 | spin_unlock_irq(phba->host->host_lock); |
1381 | mempool_free( ndlp, phba->nlp_mem_pool); | 1360 | lpfc_nlp_put(ndlp); |
1382 | return 0; | 1361 | return 0; |
1383 | } | 1362 | } |
1384 | 1363 | ||
@@ -1407,7 +1386,7 @@ lpfc_issue_els_farpr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry) | |||
1407 | elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, | 1386 | elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, |
1408 | ndlp->nlp_DID, ELS_CMD_RNID); | 1387 | ndlp->nlp_DID, ELS_CMD_RNID); |
1409 | if (!elsiocb) { | 1388 | if (!elsiocb) { |
1410 | mempool_free( ndlp, phba->nlp_mem_pool); | 1389 | lpfc_nlp_put(ndlp); |
1411 | return 1; | 1390 | return 1; |
1412 | } | 1391 | } |
1413 | 1392 | ||
@@ -1428,7 +1407,7 @@ lpfc_issue_els_farpr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry) | |||
1428 | 1407 | ||
1429 | memcpy(&fp->RportName, &phba->fc_portname, sizeof (struct lpfc_name)); | 1408 | memcpy(&fp->RportName, &phba->fc_portname, sizeof (struct lpfc_name)); |
1430 | memcpy(&fp->RnodeName, &phba->fc_nodename, sizeof (struct lpfc_name)); | 1409 | memcpy(&fp->RnodeName, &phba->fc_nodename, sizeof (struct lpfc_name)); |
1431 | if ((ondlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, nportid))) { | 1410 | if ((ondlp = lpfc_findnode_did(phba, nportid))) { |
1432 | memcpy(&fp->OportName, &ondlp->nlp_portname, | 1411 | memcpy(&fp->OportName, &ondlp->nlp_portname, |
1433 | sizeof (struct lpfc_name)); | 1412 | sizeof (struct lpfc_name)); |
1434 | memcpy(&fp->OnodeName, &ondlp->nlp_nodename, | 1413 | memcpy(&fp->OnodeName, &ondlp->nlp_nodename, |
@@ -1440,12 +1419,12 @@ lpfc_issue_els_farpr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry) | |||
1440 | spin_lock_irq(phba->host->host_lock); | 1419 | spin_lock_irq(phba->host->host_lock); |
1441 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { | 1420 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { |
1442 | spin_unlock_irq(phba->host->host_lock); | 1421 | spin_unlock_irq(phba->host->host_lock); |
1443 | mempool_free( ndlp, phba->nlp_mem_pool); | 1422 | lpfc_nlp_put(ndlp); |
1444 | lpfc_els_free_iocb(phba, elsiocb); | 1423 | lpfc_els_free_iocb(phba, elsiocb); |
1445 | return 1; | 1424 | return 1; |
1446 | } | 1425 | } |
1447 | spin_unlock_irq(phba->host->host_lock); | 1426 | spin_unlock_irq(phba->host->host_lock); |
1448 | mempool_free( ndlp, phba->nlp_mem_pool); | 1427 | lpfc_nlp_put(ndlp); |
1449 | return 0; | 1428 | return 0; |
1450 | } | 1429 | } |
1451 | 1430 | ||
@@ -1554,29 +1533,25 @@ lpfc_els_retry_delay_handler(struct lpfc_nodelist *ndlp) | |||
1554 | case ELS_CMD_PLOGI: | 1533 | case ELS_CMD_PLOGI: |
1555 | if(!lpfc_issue_els_plogi(phba, ndlp->nlp_DID, retry)) { | 1534 | if(!lpfc_issue_els_plogi(phba, ndlp->nlp_DID, retry)) { |
1556 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1535 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1557 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 1536 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
1558 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
1559 | } | 1537 | } |
1560 | break; | 1538 | break; |
1561 | case ELS_CMD_ADISC: | 1539 | case ELS_CMD_ADISC: |
1562 | if (!lpfc_issue_els_adisc(phba, ndlp, retry)) { | 1540 | if (!lpfc_issue_els_adisc(phba, ndlp, retry)) { |
1563 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1541 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1564 | ndlp->nlp_state = NLP_STE_ADISC_ISSUE; | 1542 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE); |
1565 | lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST); | ||
1566 | } | 1543 | } |
1567 | break; | 1544 | break; |
1568 | case ELS_CMD_PRLI: | 1545 | case ELS_CMD_PRLI: |
1569 | if (!lpfc_issue_els_prli(phba, ndlp, retry)) { | 1546 | if (!lpfc_issue_els_prli(phba, ndlp, retry)) { |
1570 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1547 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1571 | ndlp->nlp_state = NLP_STE_PRLI_ISSUE; | 1548 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PRLI_ISSUE); |
1572 | lpfc_nlp_list(phba, ndlp, NLP_PRLI_LIST); | ||
1573 | } | 1549 | } |
1574 | break; | 1550 | break; |
1575 | case ELS_CMD_LOGO: | 1551 | case ELS_CMD_LOGO: |
1576 | if (!lpfc_issue_els_logo(phba, ndlp, retry)) { | 1552 | if (!lpfc_issue_els_logo(phba, ndlp, retry)) { |
1577 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1553 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1578 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1554 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1579 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1580 | } | 1555 | } |
1581 | break; | 1556 | break; |
1582 | } | 1557 | } |
@@ -1614,12 +1589,12 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1614 | cmd = *elscmd++; | 1589 | cmd = *elscmd++; |
1615 | } | 1590 | } |
1616 | 1591 | ||
1617 | if(ndlp) | 1592 | if (ndlp) |
1618 | did = ndlp->nlp_DID; | 1593 | did = ndlp->nlp_DID; |
1619 | else { | 1594 | else { |
1620 | /* We should only hit this case for retrying PLOGI */ | 1595 | /* We should only hit this case for retrying PLOGI */ |
1621 | did = irsp->un.elsreq64.remoteID; | 1596 | did = irsp->un.elsreq64.remoteID; |
1622 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, did); | 1597 | ndlp = lpfc_findnode_did(phba, did); |
1623 | if (!ndlp && (cmd != ELS_CMD_PLOGI)) | 1598 | if (!ndlp && (cmd != ELS_CMD_PLOGI)) |
1624 | return 1; | 1599 | return 1; |
1625 | } | 1600 | } |
@@ -1746,8 +1721,7 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1746 | ndlp->nlp_flag |= NLP_DELAY_TMO; | 1721 | ndlp->nlp_flag |= NLP_DELAY_TMO; |
1747 | 1722 | ||
1748 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1723 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1749 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1724 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1750 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1751 | ndlp->nlp_last_elscmd = cmd; | 1725 | ndlp->nlp_last_elscmd = cmd; |
1752 | 1726 | ||
1753 | return 1; | 1727 | return 1; |
@@ -1759,27 +1733,24 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1759 | case ELS_CMD_PLOGI: | 1733 | case ELS_CMD_PLOGI: |
1760 | if (ndlp) { | 1734 | if (ndlp) { |
1761 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1735 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1762 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 1736 | lpfc_nlp_set_state(phba, ndlp, |
1763 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | 1737 | NLP_STE_PLOGI_ISSUE); |
1764 | } | 1738 | } |
1765 | lpfc_issue_els_plogi(phba, did, cmdiocb->retry); | 1739 | lpfc_issue_els_plogi(phba, did, cmdiocb->retry); |
1766 | return 1; | 1740 | return 1; |
1767 | case ELS_CMD_ADISC: | 1741 | case ELS_CMD_ADISC: |
1768 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1742 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1769 | ndlp->nlp_state = NLP_STE_ADISC_ISSUE; | 1743 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE); |
1770 | lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST); | ||
1771 | lpfc_issue_els_adisc(phba, ndlp, cmdiocb->retry); | 1744 | lpfc_issue_els_adisc(phba, ndlp, cmdiocb->retry); |
1772 | return 1; | 1745 | return 1; |
1773 | case ELS_CMD_PRLI: | 1746 | case ELS_CMD_PRLI: |
1774 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1747 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1775 | ndlp->nlp_state = NLP_STE_PRLI_ISSUE; | 1748 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PRLI_ISSUE); |
1776 | lpfc_nlp_list(phba, ndlp, NLP_PRLI_LIST); | ||
1777 | lpfc_issue_els_prli(phba, ndlp, cmdiocb->retry); | 1749 | lpfc_issue_els_prli(phba, ndlp, cmdiocb->retry); |
1778 | return 1; | 1750 | return 1; |
1779 | case ELS_CMD_LOGO: | 1751 | case ELS_CMD_LOGO: |
1780 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1752 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1781 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1753 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1782 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1783 | lpfc_issue_els_logo(phba, ndlp, cmdiocb->retry); | 1754 | lpfc_issue_els_logo(phba, ndlp, cmdiocb->retry); |
1784 | return 1; | 1755 | return 1; |
1785 | } | 1756 | } |
@@ -1796,10 +1767,14 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1796 | } | 1767 | } |
1797 | 1768 | ||
1798 | int | 1769 | int |
1799 | lpfc_els_free_iocb(struct lpfc_hba * phba, struct lpfc_iocbq * elsiocb) | 1770 | lpfc_els_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *elsiocb) |
1800 | { | 1771 | { |
1801 | struct lpfc_dmabuf *buf_ptr, *buf_ptr1; | 1772 | struct lpfc_dmabuf *buf_ptr, *buf_ptr1; |
1802 | 1773 | ||
1774 | if (elsiocb->context1) { | ||
1775 | lpfc_nlp_put(elsiocb->context1); | ||
1776 | elsiocb->context1 = NULL; | ||
1777 | } | ||
1803 | /* context2 = cmd, context2->next = rsp, context3 = bpl */ | 1778 | /* context2 = cmd, context2->next = rsp, context3 = bpl */ |
1804 | if (elsiocb->context2) { | 1779 | if (elsiocb->context2) { |
1805 | buf_ptr1 = (struct lpfc_dmabuf *) elsiocb->context2; | 1780 | buf_ptr1 = (struct lpfc_dmabuf *) elsiocb->context2; |
@@ -1843,7 +1818,7 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1843 | 1818 | ||
1844 | switch (ndlp->nlp_state) { | 1819 | switch (ndlp->nlp_state) { |
1845 | case NLP_STE_UNUSED_NODE: /* node is just allocated */ | 1820 | case NLP_STE_UNUSED_NODE: /* node is just allocated */ |
1846 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1821 | lpfc_drop_node(phba, ndlp); |
1847 | break; | 1822 | break; |
1848 | case NLP_STE_NPR_NODE: /* NPort Recovery mode */ | 1823 | case NLP_STE_NPR_NODE: /* NPort Recovery mode */ |
1849 | lpfc_unreg_rpi(phba, ndlp); | 1824 | lpfc_unreg_rpi(phba, ndlp); |
@@ -1856,8 +1831,8 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1856 | } | 1831 | } |
1857 | 1832 | ||
1858 | static void | 1833 | static void |
1859 | lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | 1834 | lpfc_cmpl_els_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
1860 | struct lpfc_iocbq * rspiocb) | 1835 | struct lpfc_iocbq *rspiocb) |
1861 | { | 1836 | { |
1862 | IOCB_t *irsp; | 1837 | IOCB_t *irsp; |
1863 | struct lpfc_nodelist *ndlp; | 1838 | struct lpfc_nodelist *ndlp; |
@@ -1872,14 +1847,14 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1872 | 1847 | ||
1873 | 1848 | ||
1874 | /* Check to see if link went down during discovery */ | 1849 | /* Check to see if link went down during discovery */ |
1875 | if ((lpfc_els_chk_latt(phba)) || !ndlp) { | 1850 | if (lpfc_els_chk_latt(phba) || !ndlp) { |
1876 | if (mbox) { | 1851 | if (mbox) { |
1877 | mp = (struct lpfc_dmabuf *) mbox->context1; | 1852 | mp = (struct lpfc_dmabuf *) mbox->context1; |
1878 | if (mp) { | 1853 | if (mp) { |
1879 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 1854 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
1880 | kfree(mp); | 1855 | kfree(mp); |
1881 | } | 1856 | } |
1882 | mempool_free( mbox, phba->mbox_mem_pool); | 1857 | mempool_free(mbox, phba->mbox_mem_pool); |
1883 | } | 1858 | } |
1884 | goto out; | 1859 | goto out; |
1885 | } | 1860 | } |
@@ -1899,15 +1874,15 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1899 | && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { | 1874 | && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { |
1900 | lpfc_unreg_rpi(phba, ndlp); | 1875 | lpfc_unreg_rpi(phba, ndlp); |
1901 | mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; | 1876 | mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; |
1902 | mbox->context2 = ndlp; | 1877 | mbox->context2 = lpfc_nlp_get(ndlp); |
1903 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1878 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1904 | ndlp->nlp_state = NLP_STE_REG_LOGIN_ISSUE; | 1879 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_REG_LOGIN_ISSUE); |
1905 | lpfc_nlp_list(phba, ndlp, NLP_REGLOGIN_LIST); | ||
1906 | if (lpfc_sli_issue_mbox(phba, mbox, | 1880 | if (lpfc_sli_issue_mbox(phba, mbox, |
1907 | (MBX_NOWAIT | MBX_STOP_IOCB)) | 1881 | (MBX_NOWAIT | MBX_STOP_IOCB)) |
1908 | != MBX_NOT_FINISHED) { | 1882 | != MBX_NOT_FINISHED) { |
1909 | goto out; | 1883 | goto out; |
1910 | } | 1884 | } |
1885 | lpfc_nlp_put(ndlp); | ||
1911 | /* NOTE: we should have messages for unsuccessful | 1886 | /* NOTE: we should have messages for unsuccessful |
1912 | reglogin */ | 1887 | reglogin */ |
1913 | } else { | 1888 | } else { |
@@ -1917,7 +1892,7 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1917 | (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || | 1892 | (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || |
1918 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN)))) { | 1893 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN)))) { |
1919 | if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) { | 1894 | if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) { |
1920 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1895 | lpfc_drop_node(phba, ndlp); |
1921 | ndlp = NULL; | 1896 | ndlp = NULL; |
1922 | } | 1897 | } |
1923 | } | 1898 | } |
@@ -2012,15 +1987,16 @@ lpfc_els_rsp_acc(struct lpfc_hba * phba, uint32_t flag, | |||
2012 | return 1; | 1987 | return 1; |
2013 | } | 1988 | } |
2014 | 1989 | ||
2015 | if (newnode) | 1990 | if (newnode) { |
1991 | lpfc_nlp_put(ndlp); | ||
2016 | elsiocb->context1 = NULL; | 1992 | elsiocb->context1 = NULL; |
1993 | } | ||
2017 | 1994 | ||
2018 | /* Xmit ELS ACC response tag <ulpIoTag> */ | 1995 | /* Xmit ELS ACC response tag <ulpIoTag> */ |
2019 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 1996 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2020 | "%d:0128 Xmit ELS ACC response tag x%x " | 1997 | "%d:0128 Xmit ELS ACC response tag x%x, XRI: x%x, " |
2021 | "Data: x%x x%x x%x x%x x%x\n", | 1998 | "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x\n", |
2022 | phba->brd_no, | 1999 | phba->brd_no, elsiocb->iotag, |
2023 | elsiocb->iocb.ulpIoTag, | ||
2024 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2000 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2025 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2001 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2026 | 2002 | ||
@@ -2077,10 +2053,9 @@ lpfc_els_rsp_reject(struct lpfc_hba * phba, uint32_t rejectError, | |||
2077 | 2053 | ||
2078 | /* Xmit ELS RJT <err> response tag <ulpIoTag> */ | 2054 | /* Xmit ELS RJT <err> response tag <ulpIoTag> */ |
2079 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2055 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2080 | "%d:0129 Xmit ELS RJT x%x response tag x%x " | 2056 | "%d:0129 Xmit ELS RJT x%x response tag x%x xri x%x, " |
2081 | "Data: x%x x%x x%x x%x x%x\n", | 2057 | "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", |
2082 | phba->brd_no, | 2058 | phba->brd_no, rejectError, elsiocb->iotag, |
2083 | rejectError, elsiocb->iocb.ulpIoTag, | ||
2084 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2059 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2085 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2060 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2086 | 2061 | ||
@@ -2119,18 +2094,18 @@ lpfc_els_rsp_adisc_acc(struct lpfc_hba * phba, | |||
2119 | if (!elsiocb) | 2094 | if (!elsiocb) |
2120 | return 1; | 2095 | return 1; |
2121 | 2096 | ||
2097 | icmd = &elsiocb->iocb; | ||
2098 | oldcmd = &oldiocb->iocb; | ||
2099 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2100 | |||
2122 | /* Xmit ADISC ACC response tag <ulpIoTag> */ | 2101 | /* Xmit ADISC ACC response tag <ulpIoTag> */ |
2123 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2102 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2124 | "%d:0130 Xmit ADISC ACC response tag x%x " | 2103 | "%d:0130 Xmit ADISC ACC response iotag x%x xri: " |
2125 | "Data: x%x x%x x%x x%x x%x\n", | 2104 | "x%x, did x%x, nlp_flag x%x, nlp_state x%x rpi x%x\n", |
2126 | phba->brd_no, | 2105 | phba->brd_no, elsiocb->iotag, |
2127 | elsiocb->iocb.ulpIoTag, | ||
2128 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2106 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2129 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2107 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2130 | 2108 | ||
2131 | icmd = &elsiocb->iocb; | ||
2132 | oldcmd = &oldiocb->iocb; | ||
2133 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2134 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); | 2109 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); |
2135 | 2110 | ||
2136 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; | 2111 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; |
@@ -2155,8 +2130,8 @@ lpfc_els_rsp_adisc_acc(struct lpfc_hba * phba, | |||
2155 | } | 2130 | } |
2156 | 2131 | ||
2157 | int | 2132 | int |
2158 | lpfc_els_rsp_prli_acc(struct lpfc_hba * phba, | 2133 | lpfc_els_rsp_prli_acc(struct lpfc_hba *phba, struct lpfc_iocbq *oldiocb, |
2159 | struct lpfc_iocbq * oldiocb, struct lpfc_nodelist * ndlp) | 2134 | struct lpfc_nodelist *ndlp) |
2160 | { | 2135 | { |
2161 | PRLI *npr; | 2136 | PRLI *npr; |
2162 | lpfc_vpd_t *vpd; | 2137 | lpfc_vpd_t *vpd; |
@@ -2178,18 +2153,18 @@ lpfc_els_rsp_prli_acc(struct lpfc_hba * phba, | |||
2178 | if (!elsiocb) | 2153 | if (!elsiocb) |
2179 | return 1; | 2154 | return 1; |
2180 | 2155 | ||
2156 | icmd = &elsiocb->iocb; | ||
2157 | oldcmd = &oldiocb->iocb; | ||
2158 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2159 | |||
2181 | /* Xmit PRLI ACC response tag <ulpIoTag> */ | 2160 | /* Xmit PRLI ACC response tag <ulpIoTag> */ |
2182 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2161 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2183 | "%d:0131 Xmit PRLI ACC response tag x%x " | 2162 | "%d:0131 Xmit PRLI ACC response tag x%x xri x%x, " |
2184 | "Data: x%x x%x x%x x%x x%x\n", | 2163 | "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", |
2185 | phba->brd_no, | 2164 | phba->brd_no, elsiocb->iotag, |
2186 | elsiocb->iocb.ulpIoTag, | ||
2187 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2165 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2188 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2166 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2189 | 2167 | ||
2190 | icmd = &elsiocb->iocb; | ||
2191 | oldcmd = &oldiocb->iocb; | ||
2192 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2193 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); | 2168 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); |
2194 | 2169 | ||
2195 | *((uint32_t *) (pcmd)) = (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK)); | 2170 | *((uint32_t *) (pcmd)) = (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK)); |
@@ -2232,9 +2207,8 @@ lpfc_els_rsp_prli_acc(struct lpfc_hba * phba, | |||
2232 | } | 2207 | } |
2233 | 2208 | ||
2234 | static int | 2209 | static int |
2235 | lpfc_els_rsp_rnid_acc(struct lpfc_hba * phba, | 2210 | lpfc_els_rsp_rnid_acc(struct lpfc_hba *phba, uint8_t format, |
2236 | uint8_t format, | 2211 | struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp) |
2237 | struct lpfc_iocbq * oldiocb, struct lpfc_nodelist * ndlp) | ||
2238 | { | 2212 | { |
2239 | RNID *rn; | 2213 | RNID *rn; |
2240 | IOCB_t *icmd; | 2214 | IOCB_t *icmd; |
@@ -2259,17 +2233,17 @@ lpfc_els_rsp_rnid_acc(struct lpfc_hba * phba, | |||
2259 | if (!elsiocb) | 2233 | if (!elsiocb) |
2260 | return 1; | 2234 | return 1; |
2261 | 2235 | ||
2236 | icmd = &elsiocb->iocb; | ||
2237 | oldcmd = &oldiocb->iocb; | ||
2238 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2239 | |||
2262 | /* Xmit RNID ACC response tag <ulpIoTag> */ | 2240 | /* Xmit RNID ACC response tag <ulpIoTag> */ |
2263 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2241 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2264 | "%d:0132 Xmit RNID ACC response tag x%x " | 2242 | "%d:0132 Xmit RNID ACC response tag x%x " |
2265 | "Data: x%x\n", | 2243 | "xri x%x\n", |
2266 | phba->brd_no, | 2244 | phba->brd_no, elsiocb->iotag, |
2267 | elsiocb->iocb.ulpIoTag, | ||
2268 | elsiocb->iocb.ulpContext); | 2245 | elsiocb->iocb.ulpContext); |
2269 | 2246 | ||
2270 | icmd = &elsiocb->iocb; | ||
2271 | oldcmd = &oldiocb->iocb; | ||
2272 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2273 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); | 2247 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); |
2274 | 2248 | ||
2275 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; | 2249 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; |
@@ -2301,6 +2275,7 @@ lpfc_els_rsp_rnid_acc(struct lpfc_hba * phba, | |||
2301 | 2275 | ||
2302 | phba->fc_stat.elsXmitACC++; | 2276 | phba->fc_stat.elsXmitACC++; |
2303 | elsiocb->iocb_cmpl = lpfc_cmpl_els_acc; | 2277 | elsiocb->iocb_cmpl = lpfc_cmpl_els_acc; |
2278 | lpfc_nlp_put(ndlp); | ||
2304 | elsiocb->context1 = NULL; /* Don't need ndlp for cmpl, | 2279 | elsiocb->context1 = NULL; /* Don't need ndlp for cmpl, |
2305 | * it could be freed */ | 2280 | * it could be freed */ |
2306 | 2281 | ||
@@ -2315,32 +2290,31 @@ lpfc_els_rsp_rnid_acc(struct lpfc_hba * phba, | |||
2315 | } | 2290 | } |
2316 | 2291 | ||
2317 | int | 2292 | int |
2318 | lpfc_els_disc_adisc(struct lpfc_hba * phba) | 2293 | lpfc_els_disc_adisc(struct lpfc_hba *phba) |
2319 | { | 2294 | { |
2320 | int sentadisc; | 2295 | int sentadisc; |
2321 | struct lpfc_nodelist *ndlp, *next_ndlp; | 2296 | struct lpfc_nodelist *ndlp, *next_ndlp; |
2322 | 2297 | ||
2323 | sentadisc = 0; | 2298 | sentadisc = 0; |
2324 | /* go thru NPR list and issue any remaining ELS ADISCs */ | 2299 | /* go thru NPR nodes and issue any remaining ELS ADISCs */ |
2325 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list, | 2300 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp) { |
2326 | nlp_listp) { | 2301 | if (ndlp->nlp_state == NLP_STE_NPR_NODE && |
2327 | if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { | 2302 | (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 && |
2328 | if (ndlp->nlp_flag & NLP_NPR_ADISC) { | 2303 | (ndlp->nlp_flag & NLP_NPR_ADISC) != 0) { |
2329 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; | 2304 | spin_lock_irq(phba->host->host_lock); |
2330 | ndlp->nlp_prev_state = ndlp->nlp_state; | 2305 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; |
2331 | ndlp->nlp_state = NLP_STE_ADISC_ISSUE; | 2306 | spin_unlock_irq(phba->host->host_lock); |
2332 | lpfc_nlp_list(phba, ndlp, | 2307 | ndlp->nlp_prev_state = ndlp->nlp_state; |
2333 | NLP_ADISC_LIST); | 2308 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE); |
2334 | lpfc_issue_els_adisc(phba, ndlp, 0); | 2309 | lpfc_issue_els_adisc(phba, ndlp, 0); |
2335 | sentadisc++; | 2310 | sentadisc++; |
2336 | phba->num_disc_nodes++; | 2311 | phba->num_disc_nodes++; |
2337 | if (phba->num_disc_nodes >= | 2312 | if (phba->num_disc_nodes >= |
2338 | phba->cfg_discovery_threads) { | 2313 | phba->cfg_discovery_threads) { |
2339 | spin_lock_irq(phba->host->host_lock); | 2314 | spin_lock_irq(phba->host->host_lock); |
2340 | phba->fc_flag |= FC_NLP_MORE; | 2315 | phba->fc_flag |= FC_NLP_MORE; |
2341 | spin_unlock_irq(phba->host->host_lock); | 2316 | spin_unlock_irq(phba->host->host_lock); |
2342 | break; | 2317 | break; |
2343 | } | ||
2344 | } | 2318 | } |
2345 | } | 2319 | } |
2346 | } | 2320 | } |
@@ -2360,24 +2334,22 @@ lpfc_els_disc_plogi(struct lpfc_hba * phba) | |||
2360 | 2334 | ||
2361 | sentplogi = 0; | 2335 | sentplogi = 0; |
2362 | /* go thru NPR list and issue any remaining ELS PLOGIs */ | 2336 | /* go thru NPR list and issue any remaining ELS PLOGIs */ |
2363 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list, | 2337 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp) { |
2364 | nlp_listp) { | 2338 | if (ndlp->nlp_state == NLP_STE_NPR_NODE && |
2365 | if ((ndlp->nlp_flag & NLP_NPR_2B_DISC) && | 2339 | (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 && |
2366 | (!(ndlp->nlp_flag & NLP_DELAY_TMO))) { | 2340 | (ndlp->nlp_flag & NLP_DELAY_TMO) == 0 && |
2367 | if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { | 2341 | (ndlp->nlp_flag & NLP_NPR_ADISC) == 0) { |
2368 | ndlp->nlp_prev_state = ndlp->nlp_state; | 2342 | ndlp->nlp_prev_state = ndlp->nlp_state; |
2369 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 2343 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
2370 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | 2344 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); |
2371 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); | 2345 | sentplogi++; |
2372 | sentplogi++; | 2346 | phba->num_disc_nodes++; |
2373 | phba->num_disc_nodes++; | 2347 | if (phba->num_disc_nodes >= |
2374 | if (phba->num_disc_nodes >= | 2348 | phba->cfg_discovery_threads) { |
2375 | phba->cfg_discovery_threads) { | 2349 | spin_lock_irq(phba->host->host_lock); |
2376 | spin_lock_irq(phba->host->host_lock); | 2350 | phba->fc_flag |= FC_NLP_MORE; |
2377 | phba->fc_flag |= FC_NLP_MORE; | 2351 | spin_unlock_irq(phba->host->host_lock); |
2378 | spin_unlock_irq(phba->host->host_lock); | 2352 | break; |
2379 | break; | ||
2380 | } | ||
2381 | } | 2353 | } |
2382 | } | 2354 | } |
2383 | } | 2355 | } |
@@ -2479,42 +2451,30 @@ lpfc_rscn_payload_check(struct lpfc_hba * phba, uint32_t did) | |||
2479 | } | 2451 | } |
2480 | 2452 | ||
2481 | static int | 2453 | static int |
2482 | lpfc_rscn_recovery_check(struct lpfc_hba * phba) | 2454 | lpfc_rscn_recovery_check(struct lpfc_hba *phba) |
2483 | { | 2455 | { |
2484 | struct lpfc_nodelist *ndlp = NULL, *next_ndlp; | 2456 | struct lpfc_nodelist *ndlp = NULL; |
2485 | struct list_head *listp; | ||
2486 | struct list_head *node_list[7]; | ||
2487 | int i; | ||
2488 | 2457 | ||
2489 | /* Look at all nodes effected by pending RSCNs and move | 2458 | /* Look at all nodes effected by pending RSCNs and move |
2490 | * them to NPR list. | 2459 | * them to NPR state. |
2491 | */ | 2460 | */ |
2492 | node_list[0] = &phba->fc_npr_list; /* MUST do this list first */ | ||
2493 | node_list[1] = &phba->fc_nlpmap_list; | ||
2494 | node_list[2] = &phba->fc_nlpunmap_list; | ||
2495 | node_list[3] = &phba->fc_prli_list; | ||
2496 | node_list[4] = &phba->fc_reglogin_list; | ||
2497 | node_list[5] = &phba->fc_adisc_list; | ||
2498 | node_list[6] = &phba->fc_plogi_list; | ||
2499 | for (i = 0; i < 7; i++) { | ||
2500 | listp = node_list[i]; | ||
2501 | if (list_empty(listp)) | ||
2502 | continue; | ||
2503 | 2461 | ||
2504 | list_for_each_entry_safe(ndlp, next_ndlp, listp, nlp_listp) { | 2462 | list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) { |
2505 | if (!(lpfc_rscn_payload_check(phba, ndlp->nlp_DID))) | 2463 | if (ndlp->nlp_state == NLP_STE_UNUSED_NODE || |
2506 | continue; | 2464 | lpfc_rscn_payload_check(phba, ndlp->nlp_DID) == 0) |
2465 | continue; | ||
2507 | 2466 | ||
2508 | lpfc_disc_state_machine(phba, ndlp, NULL, | 2467 | lpfc_disc_state_machine(phba, ndlp, NULL, |
2509 | NLP_EVT_DEVICE_RECOVERY); | 2468 | NLP_EVT_DEVICE_RECOVERY); |
2510 | 2469 | ||
2511 | /* Make sure NLP_DELAY_TMO is NOT running | 2470 | /* |
2512 | * after a device recovery event. | 2471 | * Make sure NLP_DELAY_TMO is NOT running after a device |
2513 | */ | 2472 | * recovery event. |
2514 | if (ndlp->nlp_flag & NLP_DELAY_TMO) | 2473 | */ |
2515 | lpfc_cancel_retry_delay_tmo(phba, ndlp); | 2474 | if (ndlp->nlp_flag & NLP_DELAY_TMO) |
2516 | } | 2475 | lpfc_cancel_retry_delay_tmo(phba, ndlp); |
2517 | } | 2476 | } |
2477 | |||
2518 | return 0; | 2478 | return 0; |
2519 | } | 2479 | } |
2520 | 2480 | ||
@@ -2639,8 +2599,8 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba) | |||
2639 | 2599 | ||
2640 | /* To process RSCN, first compare RSCN data with NameServer */ | 2600 | /* To process RSCN, first compare RSCN data with NameServer */ |
2641 | phba->fc_ns_retry = 0; | 2601 | phba->fc_ns_retry = 0; |
2642 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_UNMAPPED, NameServer_DID); | 2602 | ndlp = lpfc_findnode_did(phba, NameServer_DID); |
2643 | if (ndlp) { | 2603 | if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { |
2644 | /* Good ndlp, issue CT Request to NameServer */ | 2604 | /* Good ndlp, issue CT Request to NameServer */ |
2645 | if (lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT) == 0) { | 2605 | if (lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT) == 0) { |
2646 | /* Wait for NameServer query cmpl before we can | 2606 | /* Wait for NameServer query cmpl before we can |
@@ -2650,7 +2610,7 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba) | |||
2650 | } else { | 2610 | } else { |
2651 | /* If login to NameServer does not exist, issue one */ | 2611 | /* If login to NameServer does not exist, issue one */ |
2652 | /* Good status, issue PLOGI to NameServer */ | 2612 | /* Good status, issue PLOGI to NameServer */ |
2653 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, NameServer_DID); | 2613 | ndlp = lpfc_findnode_did(phba, NameServer_DID); |
2654 | if (ndlp) { | 2614 | if (ndlp) { |
2655 | /* Wait for NameServer login cmpl before we can | 2615 | /* Wait for NameServer login cmpl before we can |
2656 | continue */ | 2616 | continue */ |
@@ -2664,8 +2624,7 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba) | |||
2664 | lpfc_nlp_init(phba, ndlp, NameServer_DID); | 2624 | lpfc_nlp_init(phba, ndlp, NameServer_DID); |
2665 | ndlp->nlp_type |= NLP_FABRIC; | 2625 | ndlp->nlp_type |= NLP_FABRIC; |
2666 | ndlp->nlp_prev_state = ndlp->nlp_state; | 2626 | ndlp->nlp_prev_state = ndlp->nlp_state; |
2667 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 2627 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
2668 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
2669 | lpfc_issue_els_plogi(phba, NameServer_DID, 0); | 2628 | lpfc_issue_els_plogi(phba, NameServer_DID, 0); |
2670 | /* Wait for NameServer login cmpl before we can | 2629 | /* Wait for NameServer login cmpl before we can |
2671 | continue */ | 2630 | continue */ |
@@ -2734,8 +2693,9 @@ lpfc_els_rcv_flogi(struct lpfc_hba * phba, | |||
2734 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 2693 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
2735 | rc = lpfc_sli_issue_mbox | 2694 | rc = lpfc_sli_issue_mbox |
2736 | (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); | 2695 | (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); |
2696 | lpfc_set_loopback_flag(phba); | ||
2737 | if (rc == MBX_NOT_FINISHED) { | 2697 | if (rc == MBX_NOT_FINISHED) { |
2738 | mempool_free( mbox, phba->mbox_mem_pool); | 2698 | mempool_free(mbox, phba->mbox_mem_pool); |
2739 | } | 2699 | } |
2740 | return 1; | 2700 | return 1; |
2741 | } else if (rc > 0) { /* greater than */ | 2701 | } else if (rc > 0) { /* greater than */ |
@@ -2800,8 +2760,8 @@ lpfc_els_rcv_rnid(struct lpfc_hba * phba, | |||
2800 | } | 2760 | } |
2801 | 2761 | ||
2802 | static int | 2762 | static int |
2803 | lpfc_els_rcv_lirr(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | 2763 | lpfc_els_rcv_lirr(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
2804 | struct lpfc_nodelist * ndlp) | 2764 | struct lpfc_nodelist *ndlp) |
2805 | { | 2765 | { |
2806 | struct ls_rjt stat; | 2766 | struct ls_rjt stat; |
2807 | 2767 | ||
@@ -2815,7 +2775,7 @@ lpfc_els_rcv_lirr(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
2815 | } | 2775 | } |
2816 | 2776 | ||
2817 | static void | 2777 | static void |
2818 | lpfc_els_rsp_rps_acc(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | 2778 | lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
2819 | { | 2779 | { |
2820 | struct lpfc_sli *psli; | 2780 | struct lpfc_sli *psli; |
2821 | struct lpfc_sli_ring *pring; | 2781 | struct lpfc_sli_ring *pring; |
@@ -2838,14 +2798,15 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
2838 | pmb->context2 = NULL; | 2798 | pmb->context2 = NULL; |
2839 | 2799 | ||
2840 | if (mb->mbxStatus) { | 2800 | if (mb->mbxStatus) { |
2841 | mempool_free( pmb, phba->mbox_mem_pool); | 2801 | mempool_free(pmb, phba->mbox_mem_pool); |
2842 | return; | 2802 | return; |
2843 | } | 2803 | } |
2844 | 2804 | ||
2845 | cmdsize = sizeof(RPS_RSP) + sizeof(uint32_t); | 2805 | cmdsize = sizeof(RPS_RSP) + sizeof(uint32_t); |
2846 | mempool_free( pmb, phba->mbox_mem_pool); | 2806 | mempool_free(pmb, phba->mbox_mem_pool); |
2847 | elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, lpfc_max_els_tries, ndlp, | 2807 | elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, lpfc_max_els_tries, ndlp, |
2848 | ndlp->nlp_DID, ELS_CMD_ACC); | 2808 | ndlp->nlp_DID, ELS_CMD_ACC); |
2809 | lpfc_nlp_put(ndlp); | ||
2849 | if (!elsiocb) | 2810 | if (!elsiocb) |
2850 | return; | 2811 | return; |
2851 | 2812 | ||
@@ -2875,15 +2836,15 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
2875 | 2836 | ||
2876 | /* Xmit ELS RPS ACC response tag <ulpIoTag> */ | 2837 | /* Xmit ELS RPS ACC response tag <ulpIoTag> */ |
2877 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2838 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2878 | "%d:0118 Xmit ELS RPS ACC response tag x%x " | 2839 | "%d:0118 Xmit ELS RPS ACC response tag x%x xri x%x, " |
2879 | "Data: x%x x%x x%x x%x x%x\n", | 2840 | "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", |
2880 | phba->brd_no, | 2841 | phba->brd_no, elsiocb->iotag, |
2881 | elsiocb->iocb.ulpIoTag, | ||
2882 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2842 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2883 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2843 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2884 | 2844 | ||
2885 | elsiocb->iocb_cmpl = lpfc_cmpl_els_acc; | 2845 | elsiocb->iocb_cmpl = lpfc_cmpl_els_acc; |
2886 | phba->fc_stat.elsXmitACC++; | 2846 | phba->fc_stat.elsXmitACC++; |
2847 | |||
2887 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { | 2848 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { |
2888 | lpfc_els_free_iocb(phba, elsiocb); | 2849 | lpfc_els_free_iocb(phba, elsiocb); |
2889 | } | 2850 | } |
@@ -2923,13 +2884,14 @@ lpfc_els_rcv_rps(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
2923 | lpfc_read_lnk_stat(phba, mbox); | 2884 | lpfc_read_lnk_stat(phba, mbox); |
2924 | mbox->context1 = | 2885 | mbox->context1 = |
2925 | (void *)((unsigned long)cmdiocb->iocb.ulpContext); | 2886 | (void *)((unsigned long)cmdiocb->iocb.ulpContext); |
2926 | mbox->context2 = ndlp; | 2887 | mbox->context2 = lpfc_nlp_get(ndlp); |
2927 | mbox->mbox_cmpl = lpfc_els_rsp_rps_acc; | 2888 | mbox->mbox_cmpl = lpfc_els_rsp_rps_acc; |
2928 | if (lpfc_sli_issue_mbox (phba, mbox, | 2889 | if (lpfc_sli_issue_mbox (phba, mbox, |
2929 | (MBX_NOWAIT | MBX_STOP_IOCB)) != MBX_NOT_FINISHED) { | 2890 | (MBX_NOWAIT | MBX_STOP_IOCB)) != MBX_NOT_FINISHED) { |
2930 | /* Mbox completion will send ELS Response */ | 2891 | /* Mbox completion will send ELS Response */ |
2931 | return 0; | 2892 | return 0; |
2932 | } | 2893 | } |
2894 | lpfc_nlp_put(ndlp); | ||
2933 | mempool_free(mbox, phba->mbox_mem_pool); | 2895 | mempool_free(mbox, phba->mbox_mem_pool); |
2934 | } | 2896 | } |
2935 | } | 2897 | } |
@@ -2984,10 +2946,9 @@ lpfc_els_rsp_rpl_acc(struct lpfc_hba * phba, uint16_t cmdsize, | |||
2984 | 2946 | ||
2985 | /* Xmit ELS RPL ACC response tag <ulpIoTag> */ | 2947 | /* Xmit ELS RPL ACC response tag <ulpIoTag> */ |
2986 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2948 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2987 | "%d:0120 Xmit ELS RPL ACC response tag x%x " | 2949 | "%d:0120 Xmit ELS RPL ACC response tag x%x xri x%x, " |
2988 | "Data: x%x x%x x%x x%x x%x\n", | 2950 | "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", |
2989 | phba->brd_no, | 2951 | phba->brd_no, elsiocb->iotag, |
2990 | elsiocb->iocb.ulpIoTag, | ||
2991 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2952 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2992 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2953 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2993 | 2954 | ||
@@ -3091,8 +3052,8 @@ lpfc_els_rcv_farp(struct lpfc_hba * phba, | |||
3091 | /* Log back into the node before sending the FARP. */ | 3052 | /* Log back into the node before sending the FARP. */ |
3092 | if (fp->Rflags & FARP_REQUEST_PLOGI) { | 3053 | if (fp->Rflags & FARP_REQUEST_PLOGI) { |
3093 | ndlp->nlp_prev_state = ndlp->nlp_state; | 3054 | ndlp->nlp_prev_state = ndlp->nlp_state; |
3094 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 3055 | lpfc_nlp_set_state(phba, ndlp, |
3095 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | 3056 | NLP_STE_PLOGI_ISSUE); |
3096 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); | 3057 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); |
3097 | } | 3058 | } |
3098 | 3059 | ||
@@ -3169,14 +3130,15 @@ lpfc_els_rcv_fan(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
3169 | */ | 3130 | */ |
3170 | 3131 | ||
3171 | list_for_each_entry_safe(ndlp, next_ndlp, | 3132 | list_for_each_entry_safe(ndlp, next_ndlp, |
3172 | &phba->fc_npr_list, nlp_listp) { | 3133 | &phba->fc_nodes, nlp_listp) { |
3173 | 3134 | if (ndlp->nlp_state != NLP_STE_NPR_NODE) | |
3135 | continue; | ||
3174 | if (ndlp->nlp_type & NLP_FABRIC) { | 3136 | if (ndlp->nlp_type & NLP_FABRIC) { |
3175 | /* | 3137 | /* |
3176 | * Clean up old Fabric, Nameserver and | 3138 | * Clean up old Fabric, Nameserver and |
3177 | * other NLP_FABRIC logins | 3139 | * other NLP_FABRIC logins |
3178 | */ | 3140 | */ |
3179 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3141 | lpfc_drop_node(phba, ndlp); |
3180 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { | 3142 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { |
3181 | /* Fail outstanding I/O now since this | 3143 | /* Fail outstanding I/O now since this |
3182 | * device is marked for PLOGI | 3144 | * device is marked for PLOGI |
@@ -3193,20 +3155,22 @@ lpfc_els_rcv_fan(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
3193 | /* Discovery not needed, | 3155 | /* Discovery not needed, |
3194 | * move the nodes to their original state. | 3156 | * move the nodes to their original state. |
3195 | */ | 3157 | */ |
3196 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list, | 3158 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, |
3197 | nlp_listp) { | 3159 | nlp_listp) { |
3160 | if (ndlp->nlp_state != NLP_STE_NPR_NODE) | ||
3161 | continue; | ||
3198 | 3162 | ||
3199 | switch (ndlp->nlp_prev_state) { | 3163 | switch (ndlp->nlp_prev_state) { |
3200 | case NLP_STE_UNMAPPED_NODE: | 3164 | case NLP_STE_UNMAPPED_NODE: |
3201 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; | 3165 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; |
3202 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 3166 | lpfc_nlp_set_state(phba, ndlp, |
3203 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | 3167 | NLP_STE_UNMAPPED_NODE); |
3204 | break; | 3168 | break; |
3205 | 3169 | ||
3206 | case NLP_STE_MAPPED_NODE: | 3170 | case NLP_STE_MAPPED_NODE: |
3207 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; | 3171 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; |
3208 | ndlp->nlp_state = NLP_STE_MAPPED_NODE; | 3172 | lpfc_nlp_set_state(phba, ndlp, |
3209 | lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST); | 3173 | NLP_STE_MAPPED_NODE); |
3210 | break; | 3174 | break; |
3211 | 3175 | ||
3212 | default: | 3176 | default: |
@@ -3246,9 +3210,8 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba) | |||
3246 | struct lpfc_iocbq *tmp_iocb, *piocb; | 3210 | struct lpfc_iocbq *tmp_iocb, *piocb; |
3247 | IOCB_t *cmd = NULL; | 3211 | IOCB_t *cmd = NULL; |
3248 | struct lpfc_dmabuf *pcmd; | 3212 | struct lpfc_dmabuf *pcmd; |
3249 | struct list_head *dlp; | ||
3250 | uint32_t *elscmd; | 3213 | uint32_t *elscmd; |
3251 | uint32_t els_command; | 3214 | uint32_t els_command=0; |
3252 | uint32_t timeout; | 3215 | uint32_t timeout; |
3253 | uint32_t remote_ID; | 3216 | uint32_t remote_ID; |
3254 | 3217 | ||
@@ -3263,17 +3226,20 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba) | |||
3263 | timeout = (uint32_t)(phba->fc_ratov << 1); | 3226 | timeout = (uint32_t)(phba->fc_ratov << 1); |
3264 | 3227 | ||
3265 | pring = &phba->sli.ring[LPFC_ELS_RING]; | 3228 | pring = &phba->sli.ring[LPFC_ELS_RING]; |
3266 | dlp = &pring->txcmplq; | ||
3267 | 3229 | ||
3268 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { | 3230 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { |
3269 | cmd = &piocb->iocb; | 3231 | cmd = &piocb->iocb; |
3270 | 3232 | ||
3271 | if (piocb->iocb_flag & LPFC_IO_LIBDFC) { | 3233 | if ((piocb->iocb_flag & LPFC_IO_LIBDFC) || |
3234 | (piocb->iocb.ulpCommand == CMD_ABORT_XRI_CN) || | ||
3235 | (piocb->iocb.ulpCommand == CMD_CLOSE_XRI_CN)) { | ||
3272 | continue; | 3236 | continue; |
3273 | } | 3237 | } |
3274 | pcmd = (struct lpfc_dmabuf *) piocb->context2; | 3238 | pcmd = (struct lpfc_dmabuf *) piocb->context2; |
3275 | elscmd = (uint32_t *) (pcmd->virt); | 3239 | if (pcmd) { |
3276 | els_command = *elscmd; | 3240 | elscmd = (uint32_t *) (pcmd->virt); |
3241 | els_command = *elscmd; | ||
3242 | } | ||
3277 | 3243 | ||
3278 | if ((els_command == ELS_CMD_FARP) | 3244 | if ((els_command == ELS_CMD_FARP) |
3279 | || (els_command == ELS_CMD_FARPR)) { | 3245 | || (els_command == ELS_CMD_FARPR)) { |
@@ -3289,19 +3255,10 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba) | |||
3289 | continue; | 3255 | continue; |
3290 | } | 3256 | } |
3291 | 3257 | ||
3292 | list_del(&piocb->list); | ||
3293 | pring->txcmplq_cnt--; | ||
3294 | |||
3295 | if (cmd->ulpCommand == CMD_GEN_REQUEST64_CR) { | 3258 | if (cmd->ulpCommand == CMD_GEN_REQUEST64_CR) { |
3296 | struct lpfc_nodelist *ndlp; | 3259 | struct lpfc_nodelist *ndlp; |
3297 | spin_unlock_irq(phba->host->host_lock); | 3260 | ndlp = __lpfc_findnode_rpi(phba, cmd->ulpContext); |
3298 | ndlp = lpfc_findnode_rpi(phba, cmd->ulpContext); | ||
3299 | spin_lock_irq(phba->host->host_lock); | ||
3300 | remote_ID = ndlp->nlp_DID; | 3261 | remote_ID = ndlp->nlp_DID; |
3301 | if (cmd->un.elsreq64.bdl.ulpIoTag32) { | ||
3302 | lpfc_sli_issue_abort_iotag32(phba, | ||
3303 | pring, piocb); | ||
3304 | } | ||
3305 | } else { | 3262 | } else { |
3306 | remote_ID = cmd->un.elsreq64.remoteID; | 3263 | remote_ID = cmd->un.elsreq64.remoteID; |
3307 | } | 3264 | } |
@@ -3313,17 +3270,7 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba) | |||
3313 | phba->brd_no, els_command, | 3270 | phba->brd_no, els_command, |
3314 | remote_ID, cmd->ulpCommand, cmd->ulpIoTag); | 3271 | remote_ID, cmd->ulpCommand, cmd->ulpIoTag); |
3315 | 3272 | ||
3316 | /* | 3273 | lpfc_sli_issue_abort_iotag(phba, pring, piocb); |
3317 | * The iocb has timed out; abort it. | ||
3318 | */ | ||
3319 | if (piocb->iocb_cmpl) { | ||
3320 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
3321 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
3322 | spin_unlock_irq(phba->host->host_lock); | ||
3323 | (piocb->iocb_cmpl) (phba, piocb, piocb); | ||
3324 | spin_lock_irq(phba->host->host_lock); | ||
3325 | } else | ||
3326 | lpfc_sli_release_iocbq(phba, piocb); | ||
3327 | } | 3274 | } |
3328 | if (phba->sli.ring[LPFC_ELS_RING].txcmplq_cnt) | 3275 | if (phba->sli.ring[LPFC_ELS_RING].txcmplq_cnt) |
3329 | mod_timer(&phba->els_tmofunc, jiffies + HZ * timeout); | 3276 | mod_timer(&phba->els_tmofunc, jiffies + HZ * timeout); |
@@ -3332,16 +3279,13 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba) | |||
3332 | } | 3279 | } |
3333 | 3280 | ||
3334 | void | 3281 | void |
3335 | lpfc_els_flush_cmd(struct lpfc_hba * phba) | 3282 | lpfc_els_flush_cmd(struct lpfc_hba *phba) |
3336 | { | 3283 | { |
3337 | struct lpfc_sli_ring *pring; | 3284 | LIST_HEAD(completions); |
3285 | struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; | ||
3338 | struct lpfc_iocbq *tmp_iocb, *piocb; | 3286 | struct lpfc_iocbq *tmp_iocb, *piocb; |
3339 | IOCB_t *cmd = NULL; | 3287 | IOCB_t *cmd = NULL; |
3340 | struct lpfc_dmabuf *pcmd; | ||
3341 | uint32_t *elscmd; | ||
3342 | uint32_t els_command; | ||
3343 | 3288 | ||
3344 | pring = &phba->sli.ring[LPFC_ELS_RING]; | ||
3345 | spin_lock_irq(phba->host->host_lock); | 3289 | spin_lock_irq(phba->host->host_lock); |
3346 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txq, list) { | 3290 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txq, list) { |
3347 | cmd = &piocb->iocb; | 3291 | cmd = &piocb->iocb; |
@@ -3351,29 +3295,15 @@ lpfc_els_flush_cmd(struct lpfc_hba * phba) | |||
3351 | } | 3295 | } |
3352 | 3296 | ||
3353 | /* Do not flush out the QUE_RING and ABORT/CLOSE iocbs */ | 3297 | /* Do not flush out the QUE_RING and ABORT/CLOSE iocbs */ |
3354 | if ((cmd->ulpCommand == CMD_QUE_RING_BUF_CN) || | 3298 | if (cmd->ulpCommand == CMD_QUE_RING_BUF_CN || |
3355 | (cmd->ulpCommand == CMD_QUE_RING_BUF64_CN) || | 3299 | cmd->ulpCommand == CMD_QUE_RING_BUF64_CN || |
3356 | (cmd->ulpCommand == CMD_CLOSE_XRI_CN) || | 3300 | cmd->ulpCommand == CMD_CLOSE_XRI_CN || |
3357 | (cmd->ulpCommand == CMD_ABORT_XRI_CN)) { | 3301 | cmd->ulpCommand == CMD_ABORT_XRI_CN) |
3358 | continue; | 3302 | continue; |
3359 | } | ||
3360 | 3303 | ||
3361 | pcmd = (struct lpfc_dmabuf *) piocb->context2; | 3304 | list_move_tail(&piocb->list, &completions); |
3362 | elscmd = (uint32_t *) (pcmd->virt); | 3305 | pring->txq_cnt--; |
3363 | els_command = *elscmd; | ||
3364 | 3306 | ||
3365 | list_del(&piocb->list); | ||
3366 | pring->txcmplq_cnt--; | ||
3367 | |||
3368 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
3369 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
3370 | |||
3371 | if (piocb->iocb_cmpl) { | ||
3372 | spin_unlock_irq(phba->host->host_lock); | ||
3373 | (piocb->iocb_cmpl) (phba, piocb, piocb); | ||
3374 | spin_lock_irq(phba->host->host_lock); | ||
3375 | } else | ||
3376 | lpfc_sli_release_iocbq(phba, piocb); | ||
3377 | } | 3307 | } |
3378 | 3308 | ||
3379 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { | 3309 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { |
@@ -3382,24 +3312,24 @@ lpfc_els_flush_cmd(struct lpfc_hba * phba) | |||
3382 | if (piocb->iocb_flag & LPFC_IO_LIBDFC) { | 3312 | if (piocb->iocb_flag & LPFC_IO_LIBDFC) { |
3383 | continue; | 3313 | continue; |
3384 | } | 3314 | } |
3385 | pcmd = (struct lpfc_dmabuf *) piocb->context2; | ||
3386 | elscmd = (uint32_t *) (pcmd->virt); | ||
3387 | els_command = *elscmd; | ||
3388 | 3315 | ||
3389 | list_del(&piocb->list); | 3316 | lpfc_sli_issue_abort_iotag(phba, pring, piocb); |
3390 | pring->txcmplq_cnt--; | 3317 | } |
3318 | spin_unlock_irq(phba->host->host_lock); | ||
3391 | 3319 | ||
3392 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | 3320 | while(!list_empty(&completions)) { |
3393 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | 3321 | piocb = list_get_first(&completions, struct lpfc_iocbq, list); |
3322 | cmd = &piocb->iocb; | ||
3323 | list_del(&piocb->list); | ||
3394 | 3324 | ||
3395 | if (piocb->iocb_cmpl) { | 3325 | if (piocb->iocb_cmpl) { |
3396 | spin_unlock_irq(phba->host->host_lock); | 3326 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; |
3327 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
3397 | (piocb->iocb_cmpl) (phba, piocb, piocb); | 3328 | (piocb->iocb_cmpl) (phba, piocb, piocb); |
3398 | spin_lock_irq(phba->host->host_lock); | ||
3399 | } else | 3329 | } else |
3400 | lpfc_sli_release_iocbq(phba, piocb); | 3330 | lpfc_sli_release_iocbq(phba, piocb); |
3401 | } | 3331 | } |
3402 | spin_unlock_irq(phba->host->host_lock); | 3332 | |
3403 | return; | 3333 | return; |
3404 | } | 3334 | } |
3405 | 3335 | ||
@@ -3468,7 +3398,7 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3468 | } | 3398 | } |
3469 | 3399 | ||
3470 | did = icmd->un.rcvels.remoteID; | 3400 | did = icmd->un.rcvels.remoteID; |
3471 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, did); | 3401 | ndlp = lpfc_findnode_did(phba, did); |
3472 | if (!ndlp) { | 3402 | if (!ndlp) { |
3473 | /* Cannot find existing Fabric ndlp, so allocate a new one */ | 3403 | /* Cannot find existing Fabric ndlp, so allocate a new one */ |
3474 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); | 3404 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); |
@@ -3484,12 +3414,13 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3484 | if ((did & Fabric_DID_MASK) == Fabric_DID_MASK) { | 3414 | if ((did & Fabric_DID_MASK) == Fabric_DID_MASK) { |
3485 | ndlp->nlp_type |= NLP_FABRIC; | 3415 | ndlp->nlp_type |= NLP_FABRIC; |
3486 | } | 3416 | } |
3487 | ndlp->nlp_state = NLP_STE_UNUSED_NODE; | 3417 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE); |
3488 | lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); | ||
3489 | } | 3418 | } |
3490 | 3419 | ||
3491 | phba->fc_stat.elsRcvFrame++; | 3420 | phba->fc_stat.elsRcvFrame++; |
3492 | elsiocb->context1 = ndlp; | 3421 | if (elsiocb->context1) |
3422 | lpfc_nlp_put(elsiocb->context1); | ||
3423 | elsiocb->context1 = lpfc_nlp_get(ndlp); | ||
3493 | elsiocb->context2 = mp; | 3424 | elsiocb->context2 = mp; |
3494 | 3425 | ||
3495 | if ((cmd & ELS_CMD_MASK) == ELS_CMD_RSCN) { | 3426 | if ((cmd & ELS_CMD_MASK) == ELS_CMD_RSCN) { |
@@ -3513,9 +3444,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3513 | case ELS_CMD_FLOGI: | 3444 | case ELS_CMD_FLOGI: |
3514 | phba->fc_stat.elsRcvFLOGI++; | 3445 | phba->fc_stat.elsRcvFLOGI++; |
3515 | lpfc_els_rcv_flogi(phba, elsiocb, ndlp, newnode); | 3446 | lpfc_els_rcv_flogi(phba, elsiocb, ndlp, newnode); |
3516 | if (newnode) { | 3447 | if (newnode) |
3517 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3448 | lpfc_drop_node(phba, ndlp); |
3518 | } | ||
3519 | break; | 3449 | break; |
3520 | case ELS_CMD_LOGO: | 3450 | case ELS_CMD_LOGO: |
3521 | phba->fc_stat.elsRcvLOGO++; | 3451 | phba->fc_stat.elsRcvLOGO++; |
@@ -3536,9 +3466,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3536 | case ELS_CMD_RSCN: | 3466 | case ELS_CMD_RSCN: |
3537 | phba->fc_stat.elsRcvRSCN++; | 3467 | phba->fc_stat.elsRcvRSCN++; |
3538 | lpfc_els_rcv_rscn(phba, elsiocb, ndlp, newnode); | 3468 | lpfc_els_rcv_rscn(phba, elsiocb, ndlp, newnode); |
3539 | if (newnode) { | 3469 | if (newnode) |
3540 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3470 | lpfc_drop_node(phba, ndlp); |
3541 | } | ||
3542 | break; | 3471 | break; |
3543 | case ELS_CMD_ADISC: | 3472 | case ELS_CMD_ADISC: |
3544 | phba->fc_stat.elsRcvADISC++; | 3473 | phba->fc_stat.elsRcvADISC++; |
@@ -3579,30 +3508,26 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3579 | case ELS_CMD_LIRR: | 3508 | case ELS_CMD_LIRR: |
3580 | phba->fc_stat.elsRcvLIRR++; | 3509 | phba->fc_stat.elsRcvLIRR++; |
3581 | lpfc_els_rcv_lirr(phba, elsiocb, ndlp); | 3510 | lpfc_els_rcv_lirr(phba, elsiocb, ndlp); |
3582 | if (newnode) { | 3511 | if (newnode) |
3583 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3512 | lpfc_drop_node(phba, ndlp); |
3584 | } | ||
3585 | break; | 3513 | break; |
3586 | case ELS_CMD_RPS: | 3514 | case ELS_CMD_RPS: |
3587 | phba->fc_stat.elsRcvRPS++; | 3515 | phba->fc_stat.elsRcvRPS++; |
3588 | lpfc_els_rcv_rps(phba, elsiocb, ndlp); | 3516 | lpfc_els_rcv_rps(phba, elsiocb, ndlp); |
3589 | if (newnode) { | 3517 | if (newnode) |
3590 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3518 | lpfc_drop_node(phba, ndlp); |
3591 | } | ||
3592 | break; | 3519 | break; |
3593 | case ELS_CMD_RPL: | 3520 | case ELS_CMD_RPL: |
3594 | phba->fc_stat.elsRcvRPL++; | 3521 | phba->fc_stat.elsRcvRPL++; |
3595 | lpfc_els_rcv_rpl(phba, elsiocb, ndlp); | 3522 | lpfc_els_rcv_rpl(phba, elsiocb, ndlp); |
3596 | if (newnode) { | 3523 | if (newnode) |
3597 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3524 | lpfc_drop_node(phba, ndlp); |
3598 | } | ||
3599 | break; | 3525 | break; |
3600 | case ELS_CMD_RNID: | 3526 | case ELS_CMD_RNID: |
3601 | phba->fc_stat.elsRcvRNID++; | 3527 | phba->fc_stat.elsRcvRNID++; |
3602 | lpfc_els_rcv_rnid(phba, elsiocb, ndlp); | 3528 | lpfc_els_rcv_rnid(phba, elsiocb, ndlp); |
3603 | if (newnode) { | 3529 | if (newnode) |
3604 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3530 | lpfc_drop_node(phba, ndlp); |
3605 | } | ||
3606 | break; | 3531 | break; |
3607 | default: | 3532 | default: |
3608 | /* Unsupported ELS command, reject */ | 3533 | /* Unsupported ELS command, reject */ |
@@ -3612,9 +3537,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3612 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 3537 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, |
3613 | "%d:0115 Unknown ELS command x%x received from " | 3538 | "%d:0115 Unknown ELS command x%x received from " |
3614 | "NPORT x%x\n", phba->brd_no, cmd, did); | 3539 | "NPORT x%x\n", phba->brd_no, cmd, did); |
3615 | if (newnode) { | 3540 | if (newnode) |
3616 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3541 | lpfc_drop_node(phba, ndlp); |
3617 | } | ||
3618 | break; | 3542 | break; |
3619 | } | 3543 | } |
3620 | 3544 | ||
@@ -3627,6 +3551,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3627 | lpfc_els_rsp_reject(phba, stat.un.lsRjtError, elsiocb, ndlp); | 3551 | lpfc_els_rsp_reject(phba, stat.un.lsRjtError, elsiocb, ndlp); |
3628 | } | 3552 | } |
3629 | 3553 | ||
3554 | lpfc_nlp_put(elsiocb->context1); | ||
3555 | elsiocb->context1 = NULL; | ||
3630 | if (elsiocb->context2) { | 3556 | if (elsiocb->context2) { |
3631 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 3557 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
3632 | kfree(mp); | 3558 | kfree(mp); |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index c39564e85e94..61caa8d379e2 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -109,6 +109,9 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) | |||
109 | return; | 109 | return; |
110 | } | 110 | } |
111 | 111 | ||
112 | if (ndlp->nlp_state == NLP_STE_MAPPED_NODE) | ||
113 | return; | ||
114 | |||
112 | name = (uint8_t *)&ndlp->nlp_portname; | 115 | name = (uint8_t *)&ndlp->nlp_portname; |
113 | phba = ndlp->nlp_phba; | 116 | phba = ndlp->nlp_phba; |
114 | 117 | ||
@@ -147,11 +150,17 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) | |||
147 | ndlp->nlp_state, ndlp->nlp_rpi); | 150 | ndlp->nlp_state, ndlp->nlp_rpi); |
148 | } | 151 | } |
149 | 152 | ||
150 | ndlp->rport = NULL; | 153 | if (!(phba->fc_flag & FC_UNLOADING) && |
151 | rdata->pnode = NULL; | 154 | !(ndlp->nlp_flag & NLP_DELAY_TMO) && |
152 | 155 | !(ndlp->nlp_flag & NLP_NPR_2B_DISC) && | |
153 | if (!(phba->fc_flag & FC_UNLOADING)) | 156 | (ndlp->nlp_state != NLP_STE_UNMAPPED_NODE)) |
154 | lpfc_disc_state_machine(phba, ndlp, NULL, NLP_EVT_DEVICE_RM); | 157 | lpfc_disc_state_machine(phba, ndlp, NULL, NLP_EVT_DEVICE_RM); |
158 | else { | ||
159 | rdata->pnode = NULL; | ||
160 | ndlp->rport = NULL; | ||
161 | lpfc_nlp_put(ndlp); | ||
162 | put_device(&rport->dev); | ||
163 | } | ||
155 | 164 | ||
156 | return; | 165 | return; |
157 | } | 166 | } |
@@ -182,29 +191,35 @@ lpfc_work_list_done(struct lpfc_hba * phba) | |||
182 | *(int *)(evtp->evt_arg1) = 0; | 191 | *(int *)(evtp->evt_arg1) = 0; |
183 | complete((struct completion *)(evtp->evt_arg2)); | 192 | complete((struct completion *)(evtp->evt_arg2)); |
184 | break; | 193 | break; |
185 | case LPFC_EVT_OFFLINE: | 194 | case LPFC_EVT_OFFLINE_PREP: |
186 | if (phba->hba_state >= LPFC_LINK_DOWN) | 195 | if (phba->hba_state >= LPFC_LINK_DOWN) |
187 | lpfc_offline(phba); | 196 | lpfc_offline_prep(phba); |
197 | *(int *)(evtp->evt_arg1) = 0; | ||
198 | complete((struct completion *)(evtp->evt_arg2)); | ||
199 | break; | ||
200 | case LPFC_EVT_OFFLINE: | ||
201 | lpfc_offline(phba); | ||
188 | lpfc_sli_brdrestart(phba); | 202 | lpfc_sli_brdrestart(phba); |
189 | *(int *)(evtp->evt_arg1) = | 203 | *(int *)(evtp->evt_arg1) = |
190 | lpfc_sli_brdready(phba,HS_FFRDY | HS_MBRDY); | 204 | lpfc_sli_brdready(phba, HS_FFRDY | HS_MBRDY); |
205 | lpfc_unblock_mgmt_io(phba); | ||
191 | complete((struct completion *)(evtp->evt_arg2)); | 206 | complete((struct completion *)(evtp->evt_arg2)); |
192 | break; | 207 | break; |
193 | case LPFC_EVT_WARM_START: | 208 | case LPFC_EVT_WARM_START: |
194 | if (phba->hba_state >= LPFC_LINK_DOWN) | 209 | lpfc_offline(phba); |
195 | lpfc_offline(phba); | ||
196 | lpfc_reset_barrier(phba); | 210 | lpfc_reset_barrier(phba); |
197 | lpfc_sli_brdreset(phba); | 211 | lpfc_sli_brdreset(phba); |
198 | lpfc_hba_down_post(phba); | 212 | lpfc_hba_down_post(phba); |
199 | *(int *)(evtp->evt_arg1) = | 213 | *(int *)(evtp->evt_arg1) = |
200 | lpfc_sli_brdready(phba, HS_MBRDY); | 214 | lpfc_sli_brdready(phba, HS_MBRDY); |
215 | lpfc_unblock_mgmt_io(phba); | ||
201 | complete((struct completion *)(evtp->evt_arg2)); | 216 | complete((struct completion *)(evtp->evt_arg2)); |
202 | break; | 217 | break; |
203 | case LPFC_EVT_KILL: | 218 | case LPFC_EVT_KILL: |
204 | if (phba->hba_state >= LPFC_LINK_DOWN) | 219 | lpfc_offline(phba); |
205 | lpfc_offline(phba); | ||
206 | *(int *)(evtp->evt_arg1) | 220 | *(int *)(evtp->evt_arg1) |
207 | = (phba->stopped) ? 0 : lpfc_sli_brdkill(phba); | 221 | = (phba->stopped) ? 0 : lpfc_sli_brdkill(phba); |
222 | lpfc_unblock_mgmt_io(phba); | ||
208 | complete((struct completion *)(evtp->evt_arg2)); | 223 | complete((struct completion *)(evtp->evt_arg2)); |
209 | break; | 224 | break; |
210 | } | 225 | } |
@@ -359,13 +374,12 @@ lpfc_workq_post_event(struct lpfc_hba * phba, void *arg1, void *arg2, | |||
359 | } | 374 | } |
360 | 375 | ||
361 | int | 376 | int |
362 | lpfc_linkdown(struct lpfc_hba * phba) | 377 | lpfc_linkdown(struct lpfc_hba *phba) |
363 | { | 378 | { |
364 | struct lpfc_sli *psli; | 379 | struct lpfc_sli *psli; |
365 | struct lpfc_nodelist *ndlp, *next_ndlp; | 380 | struct lpfc_nodelist *ndlp, *next_ndlp; |
366 | struct list_head *listp, *node_list[7]; | 381 | LPFC_MBOXQ_t *mb; |
367 | LPFC_MBOXQ_t *mb; | 382 | int rc; |
368 | int rc, i; | ||
369 | 383 | ||
370 | psli = &phba->sli; | 384 | psli = &phba->sli; |
371 | /* sysfs or selective reset may call this routine to clean up */ | 385 | /* sysfs or selective reset may call this routine to clean up */ |
@@ -397,31 +411,16 @@ lpfc_linkdown(struct lpfc_hba * phba) | |||
397 | /* Cleanup any outstanding ELS commands */ | 411 | /* Cleanup any outstanding ELS commands */ |
398 | lpfc_els_flush_cmd(phba); | 412 | lpfc_els_flush_cmd(phba); |
399 | 413 | ||
400 | /* Issue a LINK DOWN event to all nodes */ | 414 | /* |
401 | node_list[0] = &phba->fc_npr_list; /* MUST do this list first */ | 415 | * Issue a LINK DOWN event to all nodes. |
402 | node_list[1] = &phba->fc_nlpmap_list; | 416 | */ |
403 | node_list[2] = &phba->fc_nlpunmap_list; | 417 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp) { |
404 | node_list[3] = &phba->fc_prli_list; | 418 | /* free any ndlp's on unused list */ |
405 | node_list[4] = &phba->fc_reglogin_list; | 419 | if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) |
406 | node_list[5] = &phba->fc_adisc_list; | 420 | lpfc_drop_node(phba, ndlp); |
407 | node_list[6] = &phba->fc_plogi_list; | 421 | else /* otherwise, force node recovery. */ |
408 | for (i = 0; i < 7; i++) { | ||
409 | listp = node_list[i]; | ||
410 | if (list_empty(listp)) | ||
411 | continue; | ||
412 | |||
413 | list_for_each_entry_safe(ndlp, next_ndlp, listp, nlp_listp) { | ||
414 | |||
415 | rc = lpfc_disc_state_machine(phba, ndlp, NULL, | 422 | rc = lpfc_disc_state_machine(phba, ndlp, NULL, |
416 | NLP_EVT_DEVICE_RECOVERY); | 423 | NLP_EVT_DEVICE_RECOVERY); |
417 | |||
418 | } | ||
419 | } | ||
420 | |||
421 | /* free any ndlp's on unused list */ | ||
422 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_unused_list, | ||
423 | nlp_listp) { | ||
424 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | ||
425 | } | 424 | } |
426 | 425 | ||
427 | /* Setup myDID for link up if we are in pt2pt mode */ | 426 | /* Setup myDID for link up if we are in pt2pt mode */ |
@@ -452,11 +451,9 @@ lpfc_linkdown(struct lpfc_hba * phba) | |||
452 | } | 451 | } |
453 | 452 | ||
454 | static int | 453 | static int |
455 | lpfc_linkup(struct lpfc_hba * phba) | 454 | lpfc_linkup(struct lpfc_hba *phba) |
456 | { | 455 | { |
457 | struct lpfc_nodelist *ndlp, *next_ndlp; | 456 | struct lpfc_nodelist *ndlp, *next_ndlp; |
458 | struct list_head *listp, *node_list[7]; | ||
459 | int i; | ||
460 | 457 | ||
461 | fc_host_post_event(phba->host, fc_get_event_number(), | 458 | fc_host_post_event(phba->host, fc_get_event_number(), |
462 | FCH_EVT_LINKUP, 0); | 459 | FCH_EVT_LINKUP, 0); |
@@ -470,29 +467,20 @@ lpfc_linkup(struct lpfc_hba * phba) | |||
470 | spin_unlock_irq(phba->host->host_lock); | 467 | spin_unlock_irq(phba->host->host_lock); |
471 | 468 | ||
472 | 469 | ||
473 | node_list[0] = &phba->fc_plogi_list; | 470 | if (phba->fc_flag & FC_LBIT) { |
474 | node_list[1] = &phba->fc_adisc_list; | 471 | list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) { |
475 | node_list[2] = &phba->fc_reglogin_list; | 472 | if (ndlp->nlp_state != NLP_STE_UNUSED_NODE) { |
476 | node_list[3] = &phba->fc_prli_list; | ||
477 | node_list[4] = &phba->fc_nlpunmap_list; | ||
478 | node_list[5] = &phba->fc_nlpmap_list; | ||
479 | node_list[6] = &phba->fc_npr_list; | ||
480 | for (i = 0; i < 7; i++) { | ||
481 | listp = node_list[i]; | ||
482 | if (list_empty(listp)) | ||
483 | continue; | ||
484 | |||
485 | list_for_each_entry_safe(ndlp, next_ndlp, listp, nlp_listp) { | ||
486 | if (phba->fc_flag & FC_LBIT) { | ||
487 | if (ndlp->nlp_type & NLP_FABRIC) { | 473 | if (ndlp->nlp_type & NLP_FABRIC) { |
488 | /* On Linkup its safe to clean up the | 474 | /* |
475 | * On Linkup its safe to clean up the | ||
489 | * ndlp from Fabric connections. | 476 | * ndlp from Fabric connections. |
490 | */ | 477 | */ |
491 | lpfc_nlp_list(phba, ndlp, | 478 | lpfc_nlp_set_state(phba, ndlp, |
492 | NLP_UNUSED_LIST); | 479 | NLP_STE_UNUSED_NODE); |
493 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { | 480 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { |
494 | /* Fail outstanding IO now since device | 481 | /* |
495 | * is marked for PLOGI. | 482 | * Fail outstanding IO now since |
483 | * device is marked for PLOGI. | ||
496 | */ | 484 | */ |
497 | lpfc_unreg_rpi(phba, ndlp); | 485 | lpfc_unreg_rpi(phba, ndlp); |
498 | } | 486 | } |
@@ -501,9 +489,10 @@ lpfc_linkup(struct lpfc_hba * phba) | |||
501 | } | 489 | } |
502 | 490 | ||
503 | /* free any ndlp's on unused list */ | 491 | /* free any ndlp's on unused list */ |
504 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_unused_list, | 492 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, |
505 | nlp_listp) { | 493 | nlp_listp) { |
506 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 494 | if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) |
495 | lpfc_drop_node(phba, ndlp); | ||
507 | } | 496 | } |
508 | 497 | ||
509 | return 0; | 498 | return 0; |
@@ -734,6 +723,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) | |||
734 | case LA_4GHZ_LINK: | 723 | case LA_4GHZ_LINK: |
735 | phba->fc_linkspeed = LA_4GHZ_LINK; | 724 | phba->fc_linkspeed = LA_4GHZ_LINK; |
736 | break; | 725 | break; |
726 | case LA_8GHZ_LINK: | ||
727 | phba->fc_linkspeed = LA_8GHZ_LINK; | ||
728 | break; | ||
737 | default: | 729 | default: |
738 | phba->fc_linkspeed = LA_UNKNW_LINK; | 730 | phba->fc_linkspeed = LA_UNKNW_LINK; |
739 | break; | 731 | break; |
@@ -889,12 +881,21 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
889 | 881 | ||
890 | if (la->attType == AT_LINK_UP) { | 882 | if (la->attType == AT_LINK_UP) { |
891 | phba->fc_stat.LinkUp++; | 883 | phba->fc_stat.LinkUp++; |
892 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | 884 | if (phba->fc_flag & FC_LOOPBACK_MODE) { |
885 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, | ||
886 | "%d:1306 Link Up Event in loop back mode " | ||
887 | "x%x received Data: x%x x%x x%x x%x\n", | ||
888 | phba->brd_no, la->eventTag, phba->fc_eventTag, | ||
889 | la->granted_AL_PA, la->UlnkSpeed, | ||
890 | phba->alpa_map[0]); | ||
891 | } else { | ||
892 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | ||
893 | "%d:1303 Link Up Event x%x received " | 893 | "%d:1303 Link Up Event x%x received " |
894 | "Data: x%x x%x x%x x%x\n", | 894 | "Data: x%x x%x x%x x%x\n", |
895 | phba->brd_no, la->eventTag, phba->fc_eventTag, | 895 | phba->brd_no, la->eventTag, phba->fc_eventTag, |
896 | la->granted_AL_PA, la->UlnkSpeed, | 896 | la->granted_AL_PA, la->UlnkSpeed, |
897 | phba->alpa_map[0]); | 897 | phba->alpa_map[0]); |
898 | } | ||
898 | lpfc_mbx_process_link_up(phba, la); | 899 | lpfc_mbx_process_link_up(phba, la); |
899 | } else { | 900 | } else { |
900 | phba->fc_stat.LinkDown++; | 901 | phba->fc_stat.LinkDown++; |
@@ -940,6 +941,7 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
940 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 941 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
941 | kfree(mp); | 942 | kfree(mp); |
942 | mempool_free( pmb, phba->mbox_mem_pool); | 943 | mempool_free( pmb, phba->mbox_mem_pool); |
944 | lpfc_nlp_put(ndlp); | ||
943 | 945 | ||
944 | return; | 946 | return; |
945 | } | 947 | } |
@@ -966,11 +968,14 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
966 | ndlp = (struct lpfc_nodelist *) pmb->context2; | 968 | ndlp = (struct lpfc_nodelist *) pmb->context2; |
967 | mp = (struct lpfc_dmabuf *) (pmb->context1); | 969 | mp = (struct lpfc_dmabuf *) (pmb->context1); |
968 | 970 | ||
971 | pmb->context1 = NULL; | ||
972 | pmb->context2 = NULL; | ||
973 | |||
969 | if (mb->mbxStatus) { | 974 | if (mb->mbxStatus) { |
970 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 975 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
971 | kfree(mp); | 976 | kfree(mp); |
972 | mempool_free( pmb, phba->mbox_mem_pool); | 977 | mempool_free(pmb, phba->mbox_mem_pool); |
973 | mempool_free( ndlp, phba->nlp_mem_pool); | 978 | lpfc_nlp_put(ndlp); |
974 | 979 | ||
975 | /* FLOGI failed, so just use loop map to make discovery list */ | 980 | /* FLOGI failed, so just use loop map to make discovery list */ |
976 | lpfc_disc_list_loopmap(phba); | 981 | lpfc_disc_list_loopmap(phba); |
@@ -980,12 +985,11 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
980 | return; | 985 | return; |
981 | } | 986 | } |
982 | 987 | ||
983 | pmb->context1 = NULL; | ||
984 | |||
985 | ndlp->nlp_rpi = mb->un.varWords[0]; | 988 | ndlp->nlp_rpi = mb->un.varWords[0]; |
986 | ndlp->nlp_type |= NLP_FABRIC; | 989 | ndlp->nlp_type |= NLP_FABRIC; |
987 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 990 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE); |
988 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | 991 | |
992 | lpfc_nlp_put(ndlp); /* Drop the reference from the mbox */ | ||
989 | 993 | ||
990 | if (phba->hba_state == LPFC_FABRIC_CFG_LINK) { | 994 | if (phba->hba_state == LPFC_FABRIC_CFG_LINK) { |
991 | /* This NPort has been assigned an NPort_ID by the fabric as a | 995 | /* This NPort has been assigned an NPort_ID by the fabric as a |
@@ -996,7 +1000,7 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
996 | */ | 1000 | */ |
997 | lpfc_issue_els_scr(phba, SCR_DID, 0); | 1001 | lpfc_issue_els_scr(phba, SCR_DID, 0); |
998 | 1002 | ||
999 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, NameServer_DID); | 1003 | ndlp = lpfc_findnode_did(phba, NameServer_DID); |
1000 | if (!ndlp) { | 1004 | if (!ndlp) { |
1001 | /* Allocate a new node instance. If the pool is empty, | 1005 | /* Allocate a new node instance. If the pool is empty, |
1002 | * start the discovery process and skip the Nameserver | 1006 | * start the discovery process and skip the Nameserver |
@@ -1008,15 +1012,14 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
1008 | lpfc_disc_start(phba); | 1012 | lpfc_disc_start(phba); |
1009 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 1013 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
1010 | kfree(mp); | 1014 | kfree(mp); |
1011 | mempool_free( pmb, phba->mbox_mem_pool); | 1015 | mempool_free(pmb, phba->mbox_mem_pool); |
1012 | return; | 1016 | return; |
1013 | } else { | 1017 | } else { |
1014 | lpfc_nlp_init(phba, ndlp, NameServer_DID); | 1018 | lpfc_nlp_init(phba, ndlp, NameServer_DID); |
1015 | ndlp->nlp_type |= NLP_FABRIC; | 1019 | ndlp->nlp_type |= NLP_FABRIC; |
1016 | } | 1020 | } |
1017 | } | 1021 | } |
1018 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 1022 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
1019 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
1020 | lpfc_issue_els_plogi(phba, NameServer_DID, 0); | 1023 | lpfc_issue_els_plogi(phba, NameServer_DID, 0); |
1021 | if (phba->cfg_fdmi_on) { | 1024 | if (phba->cfg_fdmi_on) { |
1022 | ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool, | 1025 | ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool, |
@@ -1032,7 +1035,7 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
1032 | 1035 | ||
1033 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 1036 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
1034 | kfree(mp); | 1037 | kfree(mp); |
1035 | mempool_free( pmb, phba->mbox_mem_pool); | 1038 | mempool_free(pmb, phba->mbox_mem_pool); |
1036 | return; | 1039 | return; |
1037 | } | 1040 | } |
1038 | 1041 | ||
@@ -1057,10 +1060,11 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
1057 | mp = (struct lpfc_dmabuf *) (pmb->context1); | 1060 | mp = (struct lpfc_dmabuf *) (pmb->context1); |
1058 | 1061 | ||
1059 | if (mb->mbxStatus) { | 1062 | if (mb->mbxStatus) { |
1063 | lpfc_nlp_put(ndlp); | ||
1060 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 1064 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
1061 | kfree(mp); | 1065 | kfree(mp); |
1062 | mempool_free( pmb, phba->mbox_mem_pool); | 1066 | mempool_free(pmb, phba->mbox_mem_pool); |
1063 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1067 | lpfc_drop_node(phba, ndlp); |
1064 | 1068 | ||
1065 | /* RegLogin failed, so just use loop map to make discovery | 1069 | /* RegLogin failed, so just use loop map to make discovery |
1066 | list */ | 1070 | list */ |
@@ -1075,8 +1079,7 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
1075 | 1079 | ||
1076 | ndlp->nlp_rpi = mb->un.varWords[0]; | 1080 | ndlp->nlp_rpi = mb->un.varWords[0]; |
1077 | ndlp->nlp_type |= NLP_FABRIC; | 1081 | ndlp->nlp_type |= NLP_FABRIC; |
1078 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 1082 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE); |
1079 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | ||
1080 | 1083 | ||
1081 | if (phba->hba_state < LPFC_HBA_READY) { | 1084 | if (phba->hba_state < LPFC_HBA_READY) { |
1082 | /* Link up discovery requires Fabrib registration. */ | 1085 | /* Link up discovery requires Fabrib registration. */ |
@@ -1093,6 +1096,7 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
1093 | lpfc_disc_start(phba); | 1096 | lpfc_disc_start(phba); |
1094 | } | 1097 | } |
1095 | 1098 | ||
1099 | lpfc_nlp_put(ndlp); | ||
1096 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 1100 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
1097 | kfree(mp); | 1101 | kfree(mp); |
1098 | mempool_free( pmb, phba->mbox_mem_pool); | 1102 | mempool_free( pmb, phba->mbox_mem_pool); |
@@ -1101,8 +1105,7 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
1101 | } | 1105 | } |
1102 | 1106 | ||
1103 | static void | 1107 | static void |
1104 | lpfc_register_remote_port(struct lpfc_hba * phba, | 1108 | lpfc_register_remote_port(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) |
1105 | struct lpfc_nodelist * ndlp) | ||
1106 | { | 1109 | { |
1107 | struct fc_rport *rport; | 1110 | struct fc_rport *rport; |
1108 | struct lpfc_rport_data *rdata; | 1111 | struct lpfc_rport_data *rdata; |
@@ -1114,8 +1117,19 @@ lpfc_register_remote_port(struct lpfc_hba * phba, | |||
1114 | rport_ids.port_id = ndlp->nlp_DID; | 1117 | rport_ids.port_id = ndlp->nlp_DID; |
1115 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; | 1118 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; |
1116 | 1119 | ||
1120 | /* | ||
1121 | * We leave our node pointer in rport->dd_data when we unregister a | ||
1122 | * FCP target port. But fc_remote_port_add zeros the space to which | ||
1123 | * rport->dd_data points. So, if we're reusing a previously | ||
1124 | * registered port, drop the reference that we took the last time we | ||
1125 | * registered the port. | ||
1126 | */ | ||
1127 | if (ndlp->rport && ndlp->rport->dd_data && | ||
1128 | *(struct lpfc_rport_data **) ndlp->rport->dd_data) { | ||
1129 | lpfc_nlp_put(ndlp); | ||
1130 | } | ||
1117 | ndlp->rport = rport = fc_remote_port_add(phba->host, 0, &rport_ids); | 1131 | ndlp->rport = rport = fc_remote_port_add(phba->host, 0, &rport_ids); |
1118 | if (!rport) { | 1132 | if (!rport || !get_device(&rport->dev)) { |
1119 | dev_printk(KERN_WARNING, &phba->pcidev->dev, | 1133 | dev_printk(KERN_WARNING, &phba->pcidev->dev, |
1120 | "Warning: fc_remote_port_add failed\n"); | 1134 | "Warning: fc_remote_port_add failed\n"); |
1121 | return; | 1135 | return; |
@@ -1125,7 +1139,7 @@ lpfc_register_remote_port(struct lpfc_hba * phba, | |||
1125 | rport->maxframe_size = ndlp->nlp_maxframe; | 1139 | rport->maxframe_size = ndlp->nlp_maxframe; |
1126 | rport->supported_classes = ndlp->nlp_class_sup; | 1140 | rport->supported_classes = ndlp->nlp_class_sup; |
1127 | rdata = rport->dd_data; | 1141 | rdata = rport->dd_data; |
1128 | rdata->pnode = ndlp; | 1142 | rdata->pnode = lpfc_nlp_get(ndlp); |
1129 | 1143 | ||
1130 | if (ndlp->nlp_type & NLP_FCP_TARGET) | 1144 | if (ndlp->nlp_type & NLP_FCP_TARGET) |
1131 | rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET; | 1145 | rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET; |
@@ -1145,8 +1159,7 @@ lpfc_register_remote_port(struct lpfc_hba * phba, | |||
1145 | } | 1159 | } |
1146 | 1160 | ||
1147 | static void | 1161 | static void |
1148 | lpfc_unregister_remote_port(struct lpfc_hba * phba, | 1162 | lpfc_unregister_remote_port(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) |
1149 | struct lpfc_nodelist * ndlp) | ||
1150 | { | 1163 | { |
1151 | struct fc_rport *rport = ndlp->rport; | 1164 | struct fc_rport *rport = ndlp->rport; |
1152 | struct lpfc_rport_data *rdata = rport->dd_data; | 1165 | struct lpfc_rport_data *rdata = rport->dd_data; |
@@ -1154,6 +1167,8 @@ lpfc_unregister_remote_port(struct lpfc_hba * phba, | |||
1154 | if (rport->scsi_target_id == -1) { | 1167 | if (rport->scsi_target_id == -1) { |
1155 | ndlp->rport = NULL; | 1168 | ndlp->rport = NULL; |
1156 | rdata->pnode = NULL; | 1169 | rdata->pnode = NULL; |
1170 | lpfc_nlp_put(ndlp); | ||
1171 | put_device(&rport->dev); | ||
1157 | } | 1172 | } |
1158 | 1173 | ||
1159 | fc_remote_port_delete(rport); | 1174 | fc_remote_port_delete(rport); |
@@ -1161,178 +1176,70 @@ lpfc_unregister_remote_port(struct lpfc_hba * phba, | |||
1161 | return; | 1176 | return; |
1162 | } | 1177 | } |
1163 | 1178 | ||
1164 | int | 1179 | static void |
1165 | lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list) | 1180 | lpfc_nlp_counters(struct lpfc_hba *phba, int state, int count) |
1166 | { | 1181 | { |
1167 | enum { none, unmapped, mapped } rport_add = none, rport_del = none; | ||
1168 | struct lpfc_sli *psli; | ||
1169 | |||
1170 | psli = &phba->sli; | ||
1171 | /* Sanity check to ensure we are not moving to / from the same list */ | ||
1172 | if ((nlp->nlp_flag & NLP_LIST_MASK) == list) | ||
1173 | if (list != NLP_NO_LIST) | ||
1174 | return 0; | ||
1175 | |||
1176 | spin_lock_irq(phba->host->host_lock); | 1182 | spin_lock_irq(phba->host->host_lock); |
1177 | switch (nlp->nlp_flag & NLP_LIST_MASK) { | 1183 | switch (state) { |
1178 | case NLP_NO_LIST: /* Not on any list */ | 1184 | case NLP_STE_UNUSED_NODE: |
1185 | phba->fc_unused_cnt += count; | ||
1179 | break; | 1186 | break; |
1180 | case NLP_UNUSED_LIST: | 1187 | case NLP_STE_PLOGI_ISSUE: |
1181 | phba->fc_unused_cnt--; | 1188 | phba->fc_plogi_cnt += count; |
1182 | list_del(&nlp->nlp_listp); | ||
1183 | break; | 1189 | break; |
1184 | case NLP_PLOGI_LIST: | 1190 | case NLP_STE_ADISC_ISSUE: |
1185 | phba->fc_plogi_cnt--; | 1191 | phba->fc_adisc_cnt += count; |
1186 | list_del(&nlp->nlp_listp); | ||
1187 | break; | 1192 | break; |
1188 | case NLP_ADISC_LIST: | 1193 | case NLP_STE_REG_LOGIN_ISSUE: |
1189 | phba->fc_adisc_cnt--; | 1194 | phba->fc_reglogin_cnt += count; |
1190 | list_del(&nlp->nlp_listp); | ||
1191 | break; | 1195 | break; |
1192 | case NLP_REGLOGIN_LIST: | 1196 | case NLP_STE_PRLI_ISSUE: |
1193 | phba->fc_reglogin_cnt--; | 1197 | phba->fc_prli_cnt += count; |
1194 | list_del(&nlp->nlp_listp); | ||
1195 | break; | 1198 | break; |
1196 | case NLP_PRLI_LIST: | 1199 | case NLP_STE_UNMAPPED_NODE: |
1197 | phba->fc_prli_cnt--; | 1200 | phba->fc_unmap_cnt += count; |
1198 | list_del(&nlp->nlp_listp); | ||
1199 | break; | 1201 | break; |
1200 | case NLP_UNMAPPED_LIST: | 1202 | case NLP_STE_MAPPED_NODE: |
1201 | phba->fc_unmap_cnt--; | 1203 | phba->fc_map_cnt += count; |
1202 | list_del(&nlp->nlp_listp); | ||
1203 | nlp->nlp_flag &= ~NLP_TGT_NO_SCSIID; | ||
1204 | nlp->nlp_type &= ~NLP_FC_NODE; | ||
1205 | phba->nport_event_cnt++; | ||
1206 | if (nlp->rport) | ||
1207 | rport_del = unmapped; | ||
1208 | break; | 1204 | break; |
1209 | case NLP_MAPPED_LIST: | 1205 | case NLP_STE_NPR_NODE: |
1210 | phba->fc_map_cnt--; | 1206 | phba->fc_npr_cnt += count; |
1211 | list_del(&nlp->nlp_listp); | ||
1212 | phba->nport_event_cnt++; | ||
1213 | if (nlp->rport) | ||
1214 | rport_del = mapped; | ||
1215 | break; | ||
1216 | case NLP_NPR_LIST: | ||
1217 | phba->fc_npr_cnt--; | ||
1218 | list_del(&nlp->nlp_listp); | ||
1219 | /* Stop delay tmo if taking node off NPR list */ | ||
1220 | if ((nlp->nlp_flag & NLP_DELAY_TMO) && | ||
1221 | (list != NLP_NPR_LIST)) { | ||
1222 | spin_unlock_irq(phba->host->host_lock); | ||
1223 | lpfc_cancel_retry_delay_tmo(phba, nlp); | ||
1224 | spin_lock_irq(phba->host->host_lock); | ||
1225 | } | ||
1226 | break; | 1207 | break; |
1227 | } | 1208 | } |
1209 | spin_unlock_irq(phba->host->host_lock); | ||
1210 | } | ||
1228 | 1211 | ||
1229 | nlp->nlp_flag &= ~NLP_LIST_MASK; | 1212 | static void |
1230 | 1213 | lpfc_nlp_state_cleanup(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |
1231 | /* Add NPort <did> to <num> list */ | 1214 | int old_state, int new_state) |
1232 | lpfc_printf_log(phba, | 1215 | { |
1233 | KERN_INFO, | 1216 | if (new_state == NLP_STE_UNMAPPED_NODE) { |
1234 | LOG_NODE, | 1217 | ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); |
1235 | "%d:0904 Add NPort x%x to %d list Data: x%x\n", | 1218 | ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; |
1236 | phba->brd_no, | 1219 | ndlp->nlp_type |= NLP_FC_NODE; |
1237 | nlp->nlp_DID, list, nlp->nlp_flag); | 1220 | } |
1238 | 1221 | if (new_state == NLP_STE_MAPPED_NODE) | |
1239 | switch (list) { | 1222 | ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; |
1240 | case NLP_NO_LIST: /* No list, just remove it */ | 1223 | if (new_state == NLP_STE_NPR_NODE) |
1241 | spin_unlock_irq(phba->host->host_lock); | 1224 | ndlp->nlp_flag &= ~NLP_RCV_PLOGI; |
1242 | lpfc_nlp_remove(phba, nlp); | 1225 | |
1243 | spin_lock_irq(phba->host->host_lock); | 1226 | /* Transport interface */ |
1244 | /* as node removed - stop further transport calls */ | 1227 | if (ndlp->rport && (old_state == NLP_STE_MAPPED_NODE || |
1245 | rport_del = none; | 1228 | old_state == NLP_STE_UNMAPPED_NODE)) { |
1246 | break; | ||
1247 | case NLP_UNUSED_LIST: | ||
1248 | nlp->nlp_flag |= list; | ||
1249 | /* Put it at the end of the unused list */ | ||
1250 | list_add_tail(&nlp->nlp_listp, &phba->fc_unused_list); | ||
1251 | phba->fc_unused_cnt++; | ||
1252 | break; | ||
1253 | case NLP_PLOGI_LIST: | ||
1254 | nlp->nlp_flag |= list; | ||
1255 | /* Put it at the end of the plogi list */ | ||
1256 | list_add_tail(&nlp->nlp_listp, &phba->fc_plogi_list); | ||
1257 | phba->fc_plogi_cnt++; | ||
1258 | break; | ||
1259 | case NLP_ADISC_LIST: | ||
1260 | nlp->nlp_flag |= list; | ||
1261 | /* Put it at the end of the adisc list */ | ||
1262 | list_add_tail(&nlp->nlp_listp, &phba->fc_adisc_list); | ||
1263 | phba->fc_adisc_cnt++; | ||
1264 | break; | ||
1265 | case NLP_REGLOGIN_LIST: | ||
1266 | nlp->nlp_flag |= list; | ||
1267 | /* Put it at the end of the reglogin list */ | ||
1268 | list_add_tail(&nlp->nlp_listp, &phba->fc_reglogin_list); | ||
1269 | phba->fc_reglogin_cnt++; | ||
1270 | break; | ||
1271 | case NLP_PRLI_LIST: | ||
1272 | nlp->nlp_flag |= list; | ||
1273 | /* Put it at the end of the prli list */ | ||
1274 | list_add_tail(&nlp->nlp_listp, &phba->fc_prli_list); | ||
1275 | phba->fc_prli_cnt++; | ||
1276 | break; | ||
1277 | case NLP_UNMAPPED_LIST: | ||
1278 | rport_add = unmapped; | ||
1279 | /* ensure all vestiges of "mapped" significance are gone */ | ||
1280 | nlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); | ||
1281 | nlp->nlp_flag |= list; | ||
1282 | /* Put it at the end of the unmap list */ | ||
1283 | list_add_tail(&nlp->nlp_listp, &phba->fc_nlpunmap_list); | ||
1284 | phba->fc_unmap_cnt++; | ||
1285 | phba->nport_event_cnt++; | ||
1286 | nlp->nlp_flag &= ~NLP_NODEV_REMOVE; | ||
1287 | nlp->nlp_type |= NLP_FC_NODE; | ||
1288 | break; | ||
1289 | case NLP_MAPPED_LIST: | ||
1290 | rport_add = mapped; | ||
1291 | nlp->nlp_flag |= list; | ||
1292 | /* Put it at the end of the map list */ | ||
1293 | list_add_tail(&nlp->nlp_listp, &phba->fc_nlpmap_list); | ||
1294 | phba->fc_map_cnt++; | ||
1295 | phba->nport_event_cnt++; | 1229 | phba->nport_event_cnt++; |
1296 | nlp->nlp_flag &= ~NLP_NODEV_REMOVE; | 1230 | lpfc_unregister_remote_port(phba, ndlp); |
1297 | break; | ||
1298 | case NLP_NPR_LIST: | ||
1299 | nlp->nlp_flag |= list; | ||
1300 | /* Put it at the end of the npr list */ | ||
1301 | list_add_tail(&nlp->nlp_listp, &phba->fc_npr_list); | ||
1302 | phba->fc_npr_cnt++; | ||
1303 | |||
1304 | nlp->nlp_flag &= ~NLP_RCV_PLOGI; | ||
1305 | break; | ||
1306 | case NLP_JUST_DQ: | ||
1307 | break; | ||
1308 | } | 1231 | } |
1309 | 1232 | ||
1310 | spin_unlock_irq(phba->host->host_lock); | 1233 | if (new_state == NLP_STE_MAPPED_NODE || |
1311 | 1234 | new_state == NLP_STE_UNMAPPED_NODE) { | |
1312 | /* | 1235 | phba->nport_event_cnt++; |
1313 | * We make all the calls into the transport after we have | ||
1314 | * moved the node between lists. This so that we don't | ||
1315 | * release the lock while in-between lists. | ||
1316 | */ | ||
1317 | |||
1318 | /* Don't upcall midlayer if we're unloading */ | ||
1319 | if (!(phba->fc_flag & FC_UNLOADING)) { | ||
1320 | /* | ||
1321 | * We revalidate the rport pointer as the "add" function | ||
1322 | * may have removed the remote port. | ||
1323 | */ | ||
1324 | if ((rport_del != none) && nlp->rport) | ||
1325 | lpfc_unregister_remote_port(phba, nlp); | ||
1326 | |||
1327 | if (rport_add != none) { | ||
1328 | /* | 1236 | /* |
1329 | * Tell the fc transport about the port, if we haven't | 1237 | * Tell the fc transport about the port, if we haven't |
1330 | * already. If we have, and it's a scsi entity, be | 1238 | * already. If we have, and it's a scsi entity, be |
1331 | * sure to unblock any attached scsi devices | 1239 | * sure to unblock any attached scsi devices |
1332 | */ | 1240 | */ |
1333 | if ((!nlp->rport) || (nlp->rport->port_state == | 1241 | lpfc_register_remote_port(phba, ndlp); |
1334 | FC_PORTSTATE_BLOCKED)) | 1242 | } |
1335 | lpfc_register_remote_port(phba, nlp); | ||
1336 | 1243 | ||
1337 | /* | 1244 | /* |
1338 | * if we added to Mapped list, but the remote port | 1245 | * if we added to Mapped list, but the remote port |
@@ -1340,19 +1247,95 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list) | |||
1340 | * our presentable range - move the node to the | 1247 | * our presentable range - move the node to the |
1341 | * Unmapped List | 1248 | * Unmapped List |
1342 | */ | 1249 | */ |
1343 | if ((rport_add == mapped) && | 1250 | if (new_state == NLP_STE_MAPPED_NODE && |
1344 | ((!nlp->rport) || | 1251 | (!ndlp->rport || |
1345 | (nlp->rport->scsi_target_id == -1) || | 1252 | ndlp->rport->scsi_target_id == -1 || |
1346 | (nlp->rport->scsi_target_id >= LPFC_MAX_TARGET))) { | 1253 | ndlp->rport->scsi_target_id >= LPFC_MAX_TARGET)) { |
1347 | nlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 1254 | spin_lock_irq(phba->host->host_lock); |
1348 | spin_lock_irq(phba->host->host_lock); | 1255 | ndlp->nlp_flag |= NLP_TGT_NO_SCSIID; |
1349 | nlp->nlp_flag |= NLP_TGT_NO_SCSIID; | 1256 | spin_unlock_irq(phba->host->host_lock); |
1350 | spin_unlock_irq(phba->host->host_lock); | 1257 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE); |
1351 | lpfc_nlp_list(phba, nlp, NLP_UNMAPPED_LIST); | ||
1352 | } | ||
1353 | } | ||
1354 | } | 1258 | } |
1355 | return 0; | 1259 | } |
1260 | |||
1261 | static char * | ||
1262 | lpfc_nlp_state_name(char *buffer, size_t size, int state) | ||
1263 | { | ||
1264 | static char *states[] = { | ||
1265 | [NLP_STE_UNUSED_NODE] = "UNUSED", | ||
1266 | [NLP_STE_PLOGI_ISSUE] = "PLOGI", | ||
1267 | [NLP_STE_ADISC_ISSUE] = "ADISC", | ||
1268 | [NLP_STE_REG_LOGIN_ISSUE] = "REGLOGIN", | ||
1269 | [NLP_STE_PRLI_ISSUE] = "PRLI", | ||
1270 | [NLP_STE_UNMAPPED_NODE] = "UNMAPPED", | ||
1271 | [NLP_STE_MAPPED_NODE] = "MAPPED", | ||
1272 | [NLP_STE_NPR_NODE] = "NPR", | ||
1273 | }; | ||
1274 | |||
1275 | if (state < ARRAY_SIZE(states) && states[state]) | ||
1276 | strlcpy(buffer, states[state], size); | ||
1277 | else | ||
1278 | snprintf(buffer, size, "unknown (%d)", state); | ||
1279 | return buffer; | ||
1280 | } | ||
1281 | |||
1282 | void | ||
1283 | lpfc_nlp_set_state(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, int state) | ||
1284 | { | ||
1285 | int old_state = ndlp->nlp_state; | ||
1286 | char name1[16], name2[16]; | ||
1287 | |||
1288 | lpfc_printf_log(phba, KERN_INFO, LOG_NODE, | ||
1289 | "%d:0904 NPort state transition x%06x, %s -> %s\n", | ||
1290 | phba->brd_no, | ||
1291 | ndlp->nlp_DID, | ||
1292 | lpfc_nlp_state_name(name1, sizeof(name1), old_state), | ||
1293 | lpfc_nlp_state_name(name2, sizeof(name2), state)); | ||
1294 | if (old_state == NLP_STE_NPR_NODE && | ||
1295 | (ndlp->nlp_flag & NLP_DELAY_TMO) != 0 && | ||
1296 | state != NLP_STE_NPR_NODE) | ||
1297 | lpfc_cancel_retry_delay_tmo(phba, ndlp); | ||
1298 | if (old_state == NLP_STE_UNMAPPED_NODE) { | ||
1299 | ndlp->nlp_flag &= ~NLP_TGT_NO_SCSIID; | ||
1300 | ndlp->nlp_type &= ~NLP_FC_NODE; | ||
1301 | } | ||
1302 | |||
1303 | if (list_empty(&ndlp->nlp_listp)) { | ||
1304 | spin_lock_irq(phba->host->host_lock); | ||
1305 | list_add_tail(&ndlp->nlp_listp, &phba->fc_nodes); | ||
1306 | spin_unlock_irq(phba->host->host_lock); | ||
1307 | } else if (old_state) | ||
1308 | lpfc_nlp_counters(phba, old_state, -1); | ||
1309 | |||
1310 | ndlp->nlp_state = state; | ||
1311 | lpfc_nlp_counters(phba, state, 1); | ||
1312 | lpfc_nlp_state_cleanup(phba, ndlp, old_state, state); | ||
1313 | } | ||
1314 | |||
1315 | void | ||
1316 | lpfc_dequeue_node(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | ||
1317 | { | ||
1318 | if ((ndlp->nlp_flag & NLP_DELAY_TMO) != 0) | ||
1319 | lpfc_cancel_retry_delay_tmo(phba, ndlp); | ||
1320 | if (ndlp->nlp_state && !list_empty(&ndlp->nlp_listp)) | ||
1321 | lpfc_nlp_counters(phba, ndlp->nlp_state, -1); | ||
1322 | spin_lock_irq(phba->host->host_lock); | ||
1323 | list_del_init(&ndlp->nlp_listp); | ||
1324 | spin_unlock_irq(phba->host->host_lock); | ||
1325 | lpfc_nlp_state_cleanup(phba, ndlp, ndlp->nlp_state, 0); | ||
1326 | } | ||
1327 | |||
1328 | void | ||
1329 | lpfc_drop_node(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | ||
1330 | { | ||
1331 | if ((ndlp->nlp_flag & NLP_DELAY_TMO) != 0) | ||
1332 | lpfc_cancel_retry_delay_tmo(phba, ndlp); | ||
1333 | if (ndlp->nlp_state && !list_empty(&ndlp->nlp_listp)) | ||
1334 | lpfc_nlp_counters(phba, ndlp->nlp_state, -1); | ||
1335 | spin_lock_irq(phba->host->host_lock); | ||
1336 | list_del_init(&ndlp->nlp_listp); | ||
1337 | spin_unlock_irq(phba->host->host_lock); | ||
1338 | lpfc_nlp_put(ndlp); | ||
1356 | } | 1339 | } |
1357 | 1340 | ||
1358 | /* | 1341 | /* |
@@ -1464,6 +1447,7 @@ lpfc_check_sli_ndlp(struct lpfc_hba * phba, | |||
1464 | static int | 1447 | static int |
1465 | lpfc_no_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | 1448 | lpfc_no_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) |
1466 | { | 1449 | { |
1450 | LIST_HEAD(completions); | ||
1467 | struct lpfc_sli *psli; | 1451 | struct lpfc_sli *psli; |
1468 | struct lpfc_sli_ring *pring; | 1452 | struct lpfc_sli_ring *pring; |
1469 | struct lpfc_iocbq *iocb, *next_iocb; | 1453 | struct lpfc_iocbq *iocb, *next_iocb; |
@@ -1492,29 +1476,29 @@ lpfc_no_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | |||
1492 | (phba, pring, iocb, ndlp))) { | 1476 | (phba, pring, iocb, ndlp))) { |
1493 | /* It matches, so deque and call compl | 1477 | /* It matches, so deque and call compl |
1494 | with an error */ | 1478 | with an error */ |
1495 | list_del(&iocb->list); | 1479 | list_move_tail(&iocb->list, |
1480 | &completions); | ||
1496 | pring->txq_cnt--; | 1481 | pring->txq_cnt--; |
1497 | if (iocb->iocb_cmpl) { | ||
1498 | icmd = &iocb->iocb; | ||
1499 | icmd->ulpStatus = | ||
1500 | IOSTAT_LOCAL_REJECT; | ||
1501 | icmd->un.ulpWord[4] = | ||
1502 | IOERR_SLI_ABORTED; | ||
1503 | spin_unlock_irq(phba->host-> | ||
1504 | host_lock); | ||
1505 | (iocb->iocb_cmpl) (phba, | ||
1506 | iocb, iocb); | ||
1507 | spin_lock_irq(phba->host-> | ||
1508 | host_lock); | ||
1509 | } else | ||
1510 | lpfc_sli_release_iocbq(phba, | ||
1511 | iocb); | ||
1512 | } | 1482 | } |
1513 | } | 1483 | } |
1514 | spin_unlock_irq(phba->host->host_lock); | 1484 | spin_unlock_irq(phba->host->host_lock); |
1515 | 1485 | ||
1516 | } | 1486 | } |
1517 | } | 1487 | } |
1488 | |||
1489 | while (!list_empty(&completions)) { | ||
1490 | iocb = list_get_first(&completions, struct lpfc_iocbq, list); | ||
1491 | list_del(&iocb->list); | ||
1492 | |||
1493 | if (iocb->iocb_cmpl) { | ||
1494 | icmd = &iocb->iocb; | ||
1495 | icmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
1496 | icmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
1497 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
1498 | } else | ||
1499 | lpfc_sli_release_iocbq(phba, iocb); | ||
1500 | } | ||
1501 | |||
1518 | return 0; | 1502 | return 0; |
1519 | } | 1503 | } |
1520 | 1504 | ||
@@ -1554,7 +1538,7 @@ lpfc_unreg_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | |||
1554 | * so it can be freed. | 1538 | * so it can be freed. |
1555 | */ | 1539 | */ |
1556 | static int | 1540 | static int |
1557 | lpfc_freenode(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | 1541 | lpfc_cleanup_node(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) |
1558 | { | 1542 | { |
1559 | LPFC_MBOXQ_t *mb; | 1543 | LPFC_MBOXQ_t *mb; |
1560 | LPFC_MBOXQ_t *nextmb; | 1544 | LPFC_MBOXQ_t *nextmb; |
@@ -1567,17 +1551,7 @@ lpfc_freenode(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | |||
1567 | phba->brd_no, ndlp->nlp_DID, ndlp->nlp_flag, | 1551 | phba->brd_no, ndlp->nlp_DID, ndlp->nlp_flag, |
1568 | ndlp->nlp_state, ndlp->nlp_rpi); | 1552 | ndlp->nlp_state, ndlp->nlp_rpi); |
1569 | 1553 | ||
1570 | lpfc_nlp_list(phba, ndlp, NLP_JUST_DQ); | 1554 | lpfc_dequeue_node(phba, ndlp); |
1571 | |||
1572 | /* | ||
1573 | * if unloading the driver - just leave the remote port in place. | ||
1574 | * The driver unload will force the attached devices to detach | ||
1575 | * and flush cache's w/o generating flush errors. | ||
1576 | */ | ||
1577 | if ((ndlp->rport) && !(phba->fc_flag & FC_UNLOADING)) { | ||
1578 | lpfc_unregister_remote_port(phba, ndlp); | ||
1579 | ndlp->nlp_sid = NLP_NO_SID; | ||
1580 | } | ||
1581 | 1555 | ||
1582 | /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ | 1556 | /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ |
1583 | if ((mb = phba->sli.mbox_active)) { | 1557 | if ((mb = phba->sli.mbox_active)) { |
@@ -1599,11 +1573,12 @@ lpfc_freenode(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | |||
1599 | } | 1573 | } |
1600 | list_del(&mb->list); | 1574 | list_del(&mb->list); |
1601 | mempool_free(mb, phba->mbox_mem_pool); | 1575 | mempool_free(mb, phba->mbox_mem_pool); |
1576 | lpfc_nlp_put(ndlp); | ||
1602 | } | 1577 | } |
1603 | } | 1578 | } |
1604 | spin_unlock_irq(phba->host->host_lock); | 1579 | spin_unlock_irq(phba->host->host_lock); |
1605 | 1580 | ||
1606 | lpfc_els_abort(phba,ndlp,0); | 1581 | lpfc_els_abort(phba,ndlp); |
1607 | spin_lock_irq(phba->host->host_lock); | 1582 | spin_lock_irq(phba->host->host_lock); |
1608 | ndlp->nlp_flag &= ~NLP_DELAY_TMO; | 1583 | ndlp->nlp_flag &= ~NLP_DELAY_TMO; |
1609 | spin_unlock_irq(phba->host->host_lock); | 1584 | spin_unlock_irq(phba->host->host_lock); |
@@ -1624,27 +1599,27 @@ lpfc_freenode(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | |||
1624 | * If we are in the middle of using the nlp in the discovery state | 1599 | * If we are in the middle of using the nlp in the discovery state |
1625 | * machine, defer the free till we reach the end of the state machine. | 1600 | * machine, defer the free till we reach the end of the state machine. |
1626 | */ | 1601 | */ |
1627 | int | 1602 | static void |
1628 | lpfc_nlp_remove(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | 1603 | lpfc_nlp_remove(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) |
1629 | { | 1604 | { |
1605 | struct lpfc_rport_data *rdata; | ||
1630 | 1606 | ||
1631 | if (ndlp->nlp_flag & NLP_DELAY_TMO) { | 1607 | if (ndlp->nlp_flag & NLP_DELAY_TMO) { |
1632 | lpfc_cancel_retry_delay_tmo(phba, ndlp); | 1608 | lpfc_cancel_retry_delay_tmo(phba, ndlp); |
1633 | } | 1609 | } |
1634 | 1610 | ||
1635 | if (ndlp->nlp_disc_refcnt) { | 1611 | lpfc_cleanup_node(phba, ndlp); |
1636 | spin_lock_irq(phba->host->host_lock); | 1612 | |
1637 | ndlp->nlp_flag |= NLP_DELAY_REMOVE; | 1613 | if ((ndlp->rport) && !(phba->fc_flag & FC_UNLOADING)) { |
1638 | spin_unlock_irq(phba->host->host_lock); | 1614 | put_device(&ndlp->rport->dev); |
1639 | } else { | 1615 | rdata = ndlp->rport->dd_data; |
1640 | lpfc_freenode(phba, ndlp); | 1616 | rdata->pnode = NULL; |
1641 | mempool_free( ndlp, phba->nlp_mem_pool); | 1617 | ndlp->rport = NULL; |
1642 | } | 1618 | } |
1643 | return 0; | ||
1644 | } | 1619 | } |
1645 | 1620 | ||
1646 | static int | 1621 | static int |
1647 | lpfc_matchdid(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, uint32_t did) | 1622 | lpfc_matchdid(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, uint32_t did) |
1648 | { | 1623 | { |
1649 | D_ID mydid; | 1624 | D_ID mydid; |
1650 | D_ID ndlpdid; | 1625 | D_ID ndlpdid; |
@@ -1693,57 +1668,36 @@ lpfc_matchdid(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, uint32_t did) | |||
1693 | return 0; | 1668 | return 0; |
1694 | } | 1669 | } |
1695 | 1670 | ||
1696 | /* Search for a nodelist entry on a specific list */ | 1671 | /* Search for a nodelist entry */ |
1697 | struct lpfc_nodelist * | 1672 | struct lpfc_nodelist * |
1698 | lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did) | 1673 | lpfc_findnode_did(struct lpfc_hba *phba, uint32_t did) |
1699 | { | 1674 | { |
1700 | struct lpfc_nodelist *ndlp; | 1675 | struct lpfc_nodelist *ndlp; |
1701 | struct list_head *lists[]={&phba->fc_nlpunmap_list, | ||
1702 | &phba->fc_nlpmap_list, | ||
1703 | &phba->fc_plogi_list, | ||
1704 | &phba->fc_adisc_list, | ||
1705 | &phba->fc_reglogin_list, | ||
1706 | &phba->fc_prli_list, | ||
1707 | &phba->fc_npr_list, | ||
1708 | &phba->fc_unused_list}; | ||
1709 | uint32_t search[]={NLP_SEARCH_UNMAPPED, | ||
1710 | NLP_SEARCH_MAPPED, | ||
1711 | NLP_SEARCH_PLOGI, | ||
1712 | NLP_SEARCH_ADISC, | ||
1713 | NLP_SEARCH_REGLOGIN, | ||
1714 | NLP_SEARCH_PRLI, | ||
1715 | NLP_SEARCH_NPR, | ||
1716 | NLP_SEARCH_UNUSED}; | ||
1717 | int i; | ||
1718 | uint32_t data1; | 1676 | uint32_t data1; |
1719 | 1677 | ||
1720 | spin_lock_irq(phba->host->host_lock); | 1678 | spin_lock_irq(phba->host->host_lock); |
1721 | for (i = 0; i < ARRAY_SIZE(lists); i++ ) { | 1679 | list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) { |
1722 | if (!(order & search[i])) | 1680 | if (lpfc_matchdid(phba, ndlp, did)) { |
1723 | continue; | 1681 | data1 = (((uint32_t) ndlp->nlp_state << 24) | |
1724 | list_for_each_entry(ndlp, lists[i], nlp_listp) { | 1682 | ((uint32_t) ndlp->nlp_xri << 16) | |
1725 | if (lpfc_matchdid(phba, ndlp, did)) { | 1683 | ((uint32_t) ndlp->nlp_type << 8) | |
1726 | data1 = (((uint32_t) ndlp->nlp_state << 24) | | 1684 | ((uint32_t) ndlp->nlp_rpi & 0xff)); |
1727 | ((uint32_t) ndlp->nlp_xri << 16) | | 1685 | lpfc_printf_log(phba, KERN_INFO, LOG_NODE, |
1728 | ((uint32_t) ndlp->nlp_type << 8) | | 1686 | "%d:0929 FIND node DID " |
1729 | ((uint32_t) ndlp->nlp_rpi & 0xff)); | 1687 | " Data: x%p x%x x%x x%x\n", |
1730 | lpfc_printf_log(phba, KERN_INFO, LOG_NODE, | 1688 | phba->brd_no, |
1731 | "%d:0929 FIND node DID " | 1689 | ndlp, ndlp->nlp_DID, |
1732 | " Data: x%p x%x x%x x%x\n", | 1690 | ndlp->nlp_flag, data1); |
1733 | phba->brd_no, | 1691 | spin_unlock_irq(phba->host->host_lock); |
1734 | ndlp, ndlp->nlp_DID, | 1692 | return ndlp; |
1735 | ndlp->nlp_flag, data1); | ||
1736 | spin_unlock_irq(phba->host->host_lock); | ||
1737 | return ndlp; | ||
1738 | } | ||
1739 | } | 1693 | } |
1740 | } | 1694 | } |
1741 | spin_unlock_irq(phba->host->host_lock); | 1695 | spin_unlock_irq(phba->host->host_lock); |
1742 | 1696 | ||
1743 | /* FIND node did <did> NOT FOUND */ | 1697 | /* FIND node did <did> NOT FOUND */ |
1744 | lpfc_printf_log(phba, KERN_INFO, LOG_NODE, | 1698 | lpfc_printf_log(phba, KERN_INFO, LOG_NODE, |
1745 | "%d:0932 FIND node did x%x NOT FOUND Data: x%x\n", | 1699 | "%d:0932 FIND node did x%x NOT FOUND.\n", |
1746 | phba->brd_no, did, order); | 1700 | phba->brd_no, did); |
1747 | return NULL; | 1701 | return NULL; |
1748 | } | 1702 | } |
1749 | 1703 | ||
@@ -1751,9 +1705,8 @@ struct lpfc_nodelist * | |||
1751 | lpfc_setup_disc_node(struct lpfc_hba * phba, uint32_t did) | 1705 | lpfc_setup_disc_node(struct lpfc_hba * phba, uint32_t did) |
1752 | { | 1706 | { |
1753 | struct lpfc_nodelist *ndlp; | 1707 | struct lpfc_nodelist *ndlp; |
1754 | uint32_t flg; | ||
1755 | 1708 | ||
1756 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, did); | 1709 | ndlp = lpfc_findnode_did(phba, did); |
1757 | if (!ndlp) { | 1710 | if (!ndlp) { |
1758 | if ((phba->fc_flag & FC_RSCN_MODE) && | 1711 | if ((phba->fc_flag & FC_RSCN_MODE) && |
1759 | ((lpfc_rscn_payload_check(phba, did) == 0))) | 1712 | ((lpfc_rscn_payload_check(phba, did) == 0))) |
@@ -1763,8 +1716,7 @@ lpfc_setup_disc_node(struct lpfc_hba * phba, uint32_t did) | |||
1763 | if (!ndlp) | 1716 | if (!ndlp) |
1764 | return NULL; | 1717 | return NULL; |
1765 | lpfc_nlp_init(phba, ndlp, did); | 1718 | lpfc_nlp_init(phba, ndlp, did); |
1766 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1719 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1767 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1768 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; | 1720 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; |
1769 | return ndlp; | 1721 | return ndlp; |
1770 | } | 1722 | } |
@@ -1780,11 +1732,10 @@ lpfc_setup_disc_node(struct lpfc_hba * phba, uint32_t did) | |||
1780 | } else | 1732 | } else |
1781 | ndlp = NULL; | 1733 | ndlp = NULL; |
1782 | } else { | 1734 | } else { |
1783 | flg = ndlp->nlp_flag & NLP_LIST_MASK; | 1735 | if (ndlp->nlp_state == NLP_STE_ADISC_ISSUE || |
1784 | if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST)) | 1736 | ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) |
1785 | return NULL; | 1737 | return NULL; |
1786 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1738 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1787 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1788 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; | 1739 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; |
1789 | } | 1740 | } |
1790 | return ndlp; | 1741 | return ndlp; |
@@ -1842,8 +1793,9 @@ lpfc_disc_start(struct lpfc_hba * phba) | |||
1842 | struct lpfc_sli *psli; | 1793 | struct lpfc_sli *psli; |
1843 | LPFC_MBOXQ_t *mbox; | 1794 | LPFC_MBOXQ_t *mbox; |
1844 | struct lpfc_nodelist *ndlp, *next_ndlp; | 1795 | struct lpfc_nodelist *ndlp, *next_ndlp; |
1845 | uint32_t did_changed, num_sent; | 1796 | uint32_t num_sent; |
1846 | uint32_t clear_la_pending; | 1797 | uint32_t clear_la_pending; |
1798 | int did_changed; | ||
1847 | int rc; | 1799 | int rc; |
1848 | 1800 | ||
1849 | psli = &phba->sli; | 1801 | psli = &phba->sli; |
@@ -1877,14 +1829,13 @@ lpfc_disc_start(struct lpfc_hba * phba) | |||
1877 | phba->fc_plogi_cnt, phba->fc_adisc_cnt); | 1829 | phba->fc_plogi_cnt, phba->fc_adisc_cnt); |
1878 | 1830 | ||
1879 | /* If our did changed, we MUST do PLOGI */ | 1831 | /* If our did changed, we MUST do PLOGI */ |
1880 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list, | 1832 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp) { |
1881 | nlp_listp) { | 1833 | if (ndlp->nlp_state == NLP_STE_NPR_NODE && |
1882 | if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { | 1834 | (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 && |
1883 | if (did_changed) { | 1835 | did_changed) { |
1884 | spin_lock_irq(phba->host->host_lock); | 1836 | spin_lock_irq(phba->host->host_lock); |
1885 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; | 1837 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; |
1886 | spin_unlock_irq(phba->host->host_lock); | 1838 | spin_unlock_irq(phba->host->host_lock); |
1887 | } | ||
1888 | } | 1839 | } |
1889 | } | 1840 | } |
1890 | 1841 | ||
@@ -1944,11 +1895,11 @@ lpfc_disc_start(struct lpfc_hba * phba) | |||
1944 | static void | 1895 | static void |
1945 | lpfc_free_tx(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | 1896 | lpfc_free_tx(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) |
1946 | { | 1897 | { |
1898 | LIST_HEAD(completions); | ||
1947 | struct lpfc_sli *psli; | 1899 | struct lpfc_sli *psli; |
1948 | IOCB_t *icmd; | 1900 | IOCB_t *icmd; |
1949 | struct lpfc_iocbq *iocb, *next_iocb; | 1901 | struct lpfc_iocbq *iocb, *next_iocb; |
1950 | struct lpfc_sli_ring *pring; | 1902 | struct lpfc_sli_ring *pring; |
1951 | struct lpfc_dmabuf *mp; | ||
1952 | 1903 | ||
1953 | psli = &phba->sli; | 1904 | psli = &phba->sli; |
1954 | pring = &psli->ring[LPFC_ELS_RING]; | 1905 | pring = &psli->ring[LPFC_ELS_RING]; |
@@ -1956,6 +1907,7 @@ lpfc_free_tx(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | |||
1956 | /* Error matching iocb on txq or txcmplq | 1907 | /* Error matching iocb on txq or txcmplq |
1957 | * First check the txq. | 1908 | * First check the txq. |
1958 | */ | 1909 | */ |
1910 | spin_lock_irq(phba->host->host_lock); | ||
1959 | list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) { | 1911 | list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) { |
1960 | if (iocb->context1 != ndlp) { | 1912 | if (iocb->context1 != ndlp) { |
1961 | continue; | 1913 | continue; |
@@ -1964,9 +1916,8 @@ lpfc_free_tx(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | |||
1964 | if ((icmd->ulpCommand == CMD_ELS_REQUEST64_CR) || | 1916 | if ((icmd->ulpCommand == CMD_ELS_REQUEST64_CR) || |
1965 | (icmd->ulpCommand == CMD_XMIT_ELS_RSP64_CX)) { | 1917 | (icmd->ulpCommand == CMD_XMIT_ELS_RSP64_CX)) { |
1966 | 1918 | ||
1967 | list_del(&iocb->list); | 1919 | list_move_tail(&iocb->list, &completions); |
1968 | pring->txq_cnt--; | 1920 | pring->txq_cnt--; |
1969 | lpfc_els_free_iocb(phba, iocb); | ||
1970 | } | 1921 | } |
1971 | } | 1922 | } |
1972 | 1923 | ||
@@ -1978,43 +1929,22 @@ lpfc_free_tx(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | |||
1978 | icmd = &iocb->iocb; | 1929 | icmd = &iocb->iocb; |
1979 | if ((icmd->ulpCommand == CMD_ELS_REQUEST64_CR) || | 1930 | if ((icmd->ulpCommand == CMD_ELS_REQUEST64_CR) || |
1980 | (icmd->ulpCommand == CMD_XMIT_ELS_RSP64_CX)) { | 1931 | (icmd->ulpCommand == CMD_XMIT_ELS_RSP64_CX)) { |
1932 | lpfc_sli_issue_abort_iotag(phba, pring, iocb); | ||
1933 | } | ||
1934 | } | ||
1935 | spin_unlock_irq(phba->host->host_lock); | ||
1981 | 1936 | ||
1982 | iocb->iocb_cmpl = NULL; | 1937 | while (!list_empty(&completions)) { |
1983 | /* context2 = cmd, context2->next = rsp, context3 = | 1938 | iocb = list_get_first(&completions, struct lpfc_iocbq, list); |
1984 | bpl */ | 1939 | list_del(&iocb->list); |
1985 | if (iocb->context2) { | ||
1986 | /* Free the response IOCB before handling the | ||
1987 | command. */ | ||
1988 | |||
1989 | mp = (struct lpfc_dmabuf *) (iocb->context2); | ||
1990 | mp = list_get_first(&mp->list, | ||
1991 | struct lpfc_dmabuf, | ||
1992 | list); | ||
1993 | if (mp) { | ||
1994 | /* Delay before releasing rsp buffer to | ||
1995 | * give UNREG mbox a chance to take | ||
1996 | * effect. | ||
1997 | */ | ||
1998 | list_add(&mp->list, | ||
1999 | &phba->freebufList); | ||
2000 | } | ||
2001 | lpfc_mbuf_free(phba, | ||
2002 | ((struct lpfc_dmabuf *) | ||
2003 | iocb->context2)->virt, | ||
2004 | ((struct lpfc_dmabuf *) | ||
2005 | iocb->context2)->phys); | ||
2006 | kfree(iocb->context2); | ||
2007 | } | ||
2008 | 1940 | ||
2009 | if (iocb->context3) { | 1941 | if (iocb->iocb_cmpl) { |
2010 | lpfc_mbuf_free(phba, | 1942 | icmd = &iocb->iocb; |
2011 | ((struct lpfc_dmabuf *) | 1943 | icmd->ulpStatus = IOSTAT_LOCAL_REJECT; |
2012 | iocb->context3)->virt, | 1944 | icmd->un.ulpWord[4] = IOERR_SLI_ABORTED; |
2013 | ((struct lpfc_dmabuf *) | 1945 | (iocb->iocb_cmpl) (phba, iocb, iocb); |
2014 | iocb->context3)->phys); | 1946 | } else |
2015 | kfree(iocb->context3); | 1947 | lpfc_sli_release_iocbq(phba, iocb); |
2016 | } | ||
2017 | } | ||
2018 | } | 1948 | } |
2019 | 1949 | ||
2020 | return; | 1950 | return; |
@@ -2025,21 +1955,16 @@ lpfc_disc_flush_list(struct lpfc_hba * phba) | |||
2025 | { | 1955 | { |
2026 | struct lpfc_nodelist *ndlp, *next_ndlp; | 1956 | struct lpfc_nodelist *ndlp, *next_ndlp; |
2027 | 1957 | ||
2028 | if (phba->fc_plogi_cnt) { | 1958 | if (phba->fc_plogi_cnt || phba->fc_adisc_cnt) { |
2029 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_plogi_list, | 1959 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, |
2030 | nlp_listp) { | 1960 | nlp_listp) { |
2031 | lpfc_free_tx(phba, ndlp); | 1961 | if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE || |
2032 | lpfc_nlp_remove(phba, ndlp); | 1962 | ndlp->nlp_state == NLP_STE_ADISC_ISSUE) { |
2033 | } | 1963 | lpfc_free_tx(phba, ndlp); |
2034 | } | 1964 | lpfc_nlp_put(ndlp); |
2035 | if (phba->fc_adisc_cnt) { | 1965 | } |
2036 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_adisc_list, | ||
2037 | nlp_listp) { | ||
2038 | lpfc_free_tx(phba, ndlp); | ||
2039 | lpfc_nlp_remove(phba, ndlp); | ||
2040 | } | 1966 | } |
2041 | } | 1967 | } |
2042 | return; | ||
2043 | } | 1968 | } |
2044 | 1969 | ||
2045 | /*****************************************************************************/ | 1970 | /*****************************************************************************/ |
@@ -2108,11 +2033,13 @@ lpfc_disc_timeout_handler(struct lpfc_hba *phba) | |||
2108 | phba->brd_no); | 2033 | phba->brd_no); |
2109 | 2034 | ||
2110 | /* Start discovery by sending FLOGI, clean up old rpis */ | 2035 | /* Start discovery by sending FLOGI, clean up old rpis */ |
2111 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list, | 2036 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, |
2112 | nlp_listp) { | 2037 | nlp_listp) { |
2038 | if (ndlp->nlp_state != NLP_STE_NPR_NODE) | ||
2039 | continue; | ||
2113 | if (ndlp->nlp_type & NLP_FABRIC) { | 2040 | if (ndlp->nlp_type & NLP_FABRIC) { |
2114 | /* Clean up the ndlp on Fabric connections */ | 2041 | /* Clean up the ndlp on Fabric connections */ |
2115 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 2042 | lpfc_drop_node(phba, ndlp); |
2116 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { | 2043 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { |
2117 | /* Fail outstanding IO now since device | 2044 | /* Fail outstanding IO now since device |
2118 | * is marked for PLOGI. | 2045 | * is marked for PLOGI. |
@@ -2153,9 +2080,9 @@ lpfc_disc_timeout_handler(struct lpfc_hba *phba) | |||
2153 | "login\n", phba->brd_no); | 2080 | "login\n", phba->brd_no); |
2154 | 2081 | ||
2155 | /* Next look for NameServer ndlp */ | 2082 | /* Next look for NameServer ndlp */ |
2156 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, NameServer_DID); | 2083 | ndlp = lpfc_findnode_did(phba, NameServer_DID); |
2157 | if (ndlp) | 2084 | if (ndlp) |
2158 | lpfc_nlp_remove(phba, ndlp); | 2085 | lpfc_nlp_put(ndlp); |
2159 | /* Start discovery */ | 2086 | /* Start discovery */ |
2160 | lpfc_disc_start(phba); | 2087 | lpfc_disc_start(phba); |
2161 | break; | 2088 | break; |
@@ -2168,9 +2095,8 @@ lpfc_disc_timeout_handler(struct lpfc_hba *phba) | |||
2168 | phba->brd_no, | 2095 | phba->brd_no, |
2169 | phba->fc_ns_retry, LPFC_MAX_NS_RETRY); | 2096 | phba->fc_ns_retry, LPFC_MAX_NS_RETRY); |
2170 | 2097 | ||
2171 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_UNMAPPED, | 2098 | ndlp = lpfc_findnode_did(phba, NameServer_DID); |
2172 | NameServer_DID); | 2099 | if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { |
2173 | if (ndlp) { | ||
2174 | if (phba->fc_ns_retry < LPFC_MAX_NS_RETRY) { | 2100 | if (phba->fc_ns_retry < LPFC_MAX_NS_RETRY) { |
2175 | /* Try it one more time */ | 2101 | /* Try it one more time */ |
2176 | rc = lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT); | 2102 | rc = lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT); |
@@ -2220,6 +2146,7 @@ lpfc_disc_timeout_handler(struct lpfc_hba *phba) | |||
2220 | initlinkmbox->mb.un.varInitLnk.lipsr_AL_PA = 0; | 2146 | initlinkmbox->mb.un.varInitLnk.lipsr_AL_PA = 0; |
2221 | rc = lpfc_sli_issue_mbox(phba, initlinkmbox, | 2147 | rc = lpfc_sli_issue_mbox(phba, initlinkmbox, |
2222 | (MBX_NOWAIT | MBX_STOP_IOCB)); | 2148 | (MBX_NOWAIT | MBX_STOP_IOCB)); |
2149 | lpfc_set_loopback_flag(phba); | ||
2223 | if (rc == MBX_NOT_FINISHED) | 2150 | if (rc == MBX_NOT_FINISHED) |
2224 | mempool_free(initlinkmbox, phba->mbox_mem_pool); | 2151 | mempool_free(initlinkmbox, phba->mbox_mem_pool); |
2225 | 2152 | ||
@@ -2317,8 +2244,7 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
2317 | 2244 | ||
2318 | ndlp->nlp_rpi = mb->un.varWords[0]; | 2245 | ndlp->nlp_rpi = mb->un.varWords[0]; |
2319 | ndlp->nlp_type |= NLP_FABRIC; | 2246 | ndlp->nlp_type |= NLP_FABRIC; |
2320 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 2247 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE); |
2321 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | ||
2322 | 2248 | ||
2323 | /* Start issuing Fabric-Device Management Interface (FDMI) | 2249 | /* Start issuing Fabric-Device Management Interface (FDMI) |
2324 | * command to 0xfffffa (FDMI well known port) | 2250 | * command to 0xfffffa (FDMI well known port) |
@@ -2333,87 +2259,100 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
2333 | mod_timer(&phba->fc_fdmitmo, jiffies + HZ * 60); | 2259 | mod_timer(&phba->fc_fdmitmo, jiffies + HZ * 60); |
2334 | } | 2260 | } |
2335 | 2261 | ||
2262 | /* Mailbox took a reference to the node */ | ||
2263 | lpfc_nlp_put(ndlp); | ||
2336 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 2264 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
2337 | kfree(mp); | 2265 | kfree(mp); |
2338 | mempool_free( pmb, phba->mbox_mem_pool); | 2266 | mempool_free(pmb, phba->mbox_mem_pool); |
2339 | 2267 | ||
2340 | return; | 2268 | return; |
2341 | } | 2269 | } |
2342 | 2270 | ||
2271 | static int | ||
2272 | lpfc_filter_by_rpi(struct lpfc_nodelist *ndlp, void *param) | ||
2273 | { | ||
2274 | uint16_t *rpi = param; | ||
2275 | |||
2276 | return ndlp->nlp_rpi == *rpi; | ||
2277 | } | ||
2278 | |||
2279 | static int | ||
2280 | lpfc_filter_by_wwpn(struct lpfc_nodelist *ndlp, void *param) | ||
2281 | { | ||
2282 | return memcmp(&ndlp->nlp_portname, param, | ||
2283 | sizeof(ndlp->nlp_portname)) == 0; | ||
2284 | } | ||
2285 | |||
2286 | /* | ||
2287 | * Search node lists for a remote port matching filter criteria | ||
2288 | * Caller needs to hold host_lock before calling this routine. | ||
2289 | */ | ||
2290 | struct lpfc_nodelist * | ||
2291 | __lpfc_find_node(struct lpfc_hba *phba, node_filter filter, void *param) | ||
2292 | { | ||
2293 | struct lpfc_nodelist *ndlp; | ||
2294 | |||
2295 | list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) { | ||
2296 | if (ndlp->nlp_state != NLP_STE_UNUSED_NODE && | ||
2297 | filter(ndlp, param)) | ||
2298 | return ndlp; | ||
2299 | } | ||
2300 | return NULL; | ||
2301 | } | ||
2302 | |||
2343 | /* | 2303 | /* |
2344 | * This routine looks up the ndlp lists | 2304 | * Search node lists for a remote port matching filter criteria |
2345 | * for the given RPI. If rpi found | 2305 | * This routine is used when the caller does NOT have host_lock. |
2346 | * it return the node list pointer | ||
2347 | * else return NULL. | ||
2348 | */ | 2306 | */ |
2349 | struct lpfc_nodelist * | 2307 | struct lpfc_nodelist * |
2308 | lpfc_find_node(struct lpfc_hba *phba, node_filter filter, void *param) | ||
2309 | { | ||
2310 | struct lpfc_nodelist *ndlp; | ||
2311 | |||
2312 | spin_lock_irq(phba->host->host_lock); | ||
2313 | ndlp = __lpfc_find_node(phba, filter, param); | ||
2314 | spin_unlock_irq(phba->host->host_lock); | ||
2315 | return ndlp; | ||
2316 | } | ||
2317 | |||
2318 | /* | ||
2319 | * This routine looks up the ndlp lists for the given RPI. If rpi found it | ||
2320 | * returns the node list pointer else return NULL. | ||
2321 | */ | ||
2322 | struct lpfc_nodelist * | ||
2323 | __lpfc_findnode_rpi(struct lpfc_hba *phba, uint16_t rpi) | ||
2324 | { | ||
2325 | return __lpfc_find_node(phba, lpfc_filter_by_rpi, &rpi); | ||
2326 | } | ||
2327 | |||
2328 | struct lpfc_nodelist * | ||
2350 | lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi) | 2329 | lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi) |
2351 | { | 2330 | { |
2352 | struct lpfc_nodelist *ndlp; | 2331 | struct lpfc_nodelist *ndlp; |
2353 | struct list_head * lists[]={&phba->fc_nlpunmap_list, | ||
2354 | &phba->fc_nlpmap_list, | ||
2355 | &phba->fc_plogi_list, | ||
2356 | &phba->fc_adisc_list, | ||
2357 | &phba->fc_reglogin_list}; | ||
2358 | int i; | ||
2359 | 2332 | ||
2360 | spin_lock_irq(phba->host->host_lock); | 2333 | spin_lock_irq(phba->host->host_lock); |
2361 | for (i = 0; i < ARRAY_SIZE(lists); i++ ) | 2334 | ndlp = __lpfc_findnode_rpi(phba, rpi); |
2362 | list_for_each_entry(ndlp, lists[i], nlp_listp) | ||
2363 | if (ndlp->nlp_rpi == rpi) { | ||
2364 | spin_unlock_irq(phba->host->host_lock); | ||
2365 | return ndlp; | ||
2366 | } | ||
2367 | spin_unlock_irq(phba->host->host_lock); | 2335 | spin_unlock_irq(phba->host->host_lock); |
2368 | return NULL; | 2336 | return ndlp; |
2369 | } | 2337 | } |
2370 | 2338 | ||
2371 | /* | 2339 | /* |
2372 | * This routine looks up the ndlp lists | 2340 | * This routine looks up the ndlp lists for the given WWPN. If WWPN found it |
2373 | * for the given WWPN. If WWPN found | 2341 | * returns the node list pointer else return NULL. |
2374 | * it return the node list pointer | ||
2375 | * else return NULL. | ||
2376 | */ | 2342 | */ |
2377 | struct lpfc_nodelist * | 2343 | struct lpfc_nodelist * |
2378 | lpfc_findnode_wwpn(struct lpfc_hba * phba, uint32_t order, | 2344 | lpfc_findnode_wwpn(struct lpfc_hba *phba, struct lpfc_name *wwpn) |
2379 | struct lpfc_name * wwpn) | ||
2380 | { | 2345 | { |
2381 | struct lpfc_nodelist *ndlp; | 2346 | struct lpfc_nodelist *ndlp; |
2382 | struct list_head * lists[]={&phba->fc_nlpunmap_list, | ||
2383 | &phba->fc_nlpmap_list, | ||
2384 | &phba->fc_npr_list, | ||
2385 | &phba->fc_plogi_list, | ||
2386 | &phba->fc_adisc_list, | ||
2387 | &phba->fc_reglogin_list, | ||
2388 | &phba->fc_prli_list}; | ||
2389 | uint32_t search[]={NLP_SEARCH_UNMAPPED, | ||
2390 | NLP_SEARCH_MAPPED, | ||
2391 | NLP_SEARCH_NPR, | ||
2392 | NLP_SEARCH_PLOGI, | ||
2393 | NLP_SEARCH_ADISC, | ||
2394 | NLP_SEARCH_REGLOGIN, | ||
2395 | NLP_SEARCH_PRLI}; | ||
2396 | int i; | ||
2397 | 2347 | ||
2398 | spin_lock_irq(phba->host->host_lock); | 2348 | spin_lock_irq(phba->host->host_lock); |
2399 | for (i = 0; i < ARRAY_SIZE(lists); i++ ) { | 2349 | ndlp = __lpfc_find_node(phba, lpfc_filter_by_wwpn, wwpn); |
2400 | if (!(order & search[i])) | ||
2401 | continue; | ||
2402 | list_for_each_entry(ndlp, lists[i], nlp_listp) { | ||
2403 | if (memcmp(&ndlp->nlp_portname, wwpn, | ||
2404 | sizeof(struct lpfc_name)) == 0) { | ||
2405 | spin_unlock_irq(phba->host->host_lock); | ||
2406 | return ndlp; | ||
2407 | } | ||
2408 | } | ||
2409 | } | ||
2410 | spin_unlock_irq(phba->host->host_lock); | 2350 | spin_unlock_irq(phba->host->host_lock); |
2411 | return NULL; | 2351 | return NULL; |
2412 | } | 2352 | } |
2413 | 2353 | ||
2414 | void | 2354 | void |
2415 | lpfc_nlp_init(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, | 2355 | lpfc_nlp_init(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, uint32_t did) |
2416 | uint32_t did) | ||
2417 | { | 2356 | { |
2418 | memset(ndlp, 0, sizeof (struct lpfc_nodelist)); | 2357 | memset(ndlp, 0, sizeof (struct lpfc_nodelist)); |
2419 | INIT_LIST_HEAD(&ndlp->els_retry_evt.evt_listp); | 2358 | INIT_LIST_HEAD(&ndlp->els_retry_evt.evt_listp); |
@@ -2423,5 +2362,30 @@ lpfc_nlp_init(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, | |||
2423 | ndlp->nlp_DID = did; | 2362 | ndlp->nlp_DID = did; |
2424 | ndlp->nlp_phba = phba; | 2363 | ndlp->nlp_phba = phba; |
2425 | ndlp->nlp_sid = NLP_NO_SID; | 2364 | ndlp->nlp_sid = NLP_NO_SID; |
2365 | INIT_LIST_HEAD(&ndlp->nlp_listp); | ||
2366 | kref_init(&ndlp->kref); | ||
2426 | return; | 2367 | return; |
2427 | } | 2368 | } |
2369 | |||
2370 | void | ||
2371 | lpfc_nlp_release(struct kref *kref) | ||
2372 | { | ||
2373 | struct lpfc_nodelist *ndlp = container_of(kref, struct lpfc_nodelist, | ||
2374 | kref); | ||
2375 | lpfc_nlp_remove(ndlp->nlp_phba, ndlp); | ||
2376 | mempool_free(ndlp, ndlp->nlp_phba->nlp_mem_pool); | ||
2377 | } | ||
2378 | |||
2379 | struct lpfc_nodelist * | ||
2380 | lpfc_nlp_get(struct lpfc_nodelist *ndlp) | ||
2381 | { | ||
2382 | if (ndlp) | ||
2383 | kref_get(&ndlp->kref); | ||
2384 | return ndlp; | ||
2385 | } | ||
2386 | |||
2387 | int | ||
2388 | lpfc_nlp_put(struct lpfc_nodelist *ndlp) | ||
2389 | { | ||
2390 | return ndlp ? kref_put(&ndlp->kref, lpfc_nlp_release) : 0; | ||
2391 | } | ||
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index f79cb6136906..2623a9bc7775 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
@@ -1078,6 +1078,8 @@ typedef struct { | |||
1078 | /* Start FireFly Register definitions */ | 1078 | /* Start FireFly Register definitions */ |
1079 | #define PCI_VENDOR_ID_EMULEX 0x10df | 1079 | #define PCI_VENDOR_ID_EMULEX 0x10df |
1080 | #define PCI_DEVICE_ID_FIREFLY 0x1ae5 | 1080 | #define PCI_DEVICE_ID_FIREFLY 0x1ae5 |
1081 | #define PCI_DEVICE_ID_SAT_SMB 0xf011 | ||
1082 | #define PCI_DEVICE_ID_SAT_MID 0xf015 | ||
1081 | #define PCI_DEVICE_ID_RFLY 0xf095 | 1083 | #define PCI_DEVICE_ID_RFLY 0xf095 |
1082 | #define PCI_DEVICE_ID_PFLY 0xf098 | 1084 | #define PCI_DEVICE_ID_PFLY 0xf098 |
1083 | #define PCI_DEVICE_ID_LP101 0xf0a1 | 1085 | #define PCI_DEVICE_ID_LP101 0xf0a1 |
@@ -1089,6 +1091,9 @@ typedef struct { | |||
1089 | #define PCI_DEVICE_ID_NEPTUNE 0xf0f5 | 1091 | #define PCI_DEVICE_ID_NEPTUNE 0xf0f5 |
1090 | #define PCI_DEVICE_ID_NEPTUNE_SCSP 0xf0f6 | 1092 | #define PCI_DEVICE_ID_NEPTUNE_SCSP 0xf0f6 |
1091 | #define PCI_DEVICE_ID_NEPTUNE_DCSP 0xf0f7 | 1093 | #define PCI_DEVICE_ID_NEPTUNE_DCSP 0xf0f7 |
1094 | #define PCI_DEVICE_ID_SAT 0xf100 | ||
1095 | #define PCI_DEVICE_ID_SAT_SCSP 0xf111 | ||
1096 | #define PCI_DEVICE_ID_SAT_DCSP 0xf112 | ||
1092 | #define PCI_DEVICE_ID_SUPERFLY 0xf700 | 1097 | #define PCI_DEVICE_ID_SUPERFLY 0xf700 |
1093 | #define PCI_DEVICE_ID_DRAGONFLY 0xf800 | 1098 | #define PCI_DEVICE_ID_DRAGONFLY 0xf800 |
1094 | #define PCI_DEVICE_ID_CENTAUR 0xf900 | 1099 | #define PCI_DEVICE_ID_CENTAUR 0xf900 |
@@ -1098,6 +1103,7 @@ typedef struct { | |||
1098 | #define PCI_DEVICE_ID_LP10000S 0xfc00 | 1103 | #define PCI_DEVICE_ID_LP10000S 0xfc00 |
1099 | #define PCI_DEVICE_ID_LP11000S 0xfc10 | 1104 | #define PCI_DEVICE_ID_LP11000S 0xfc10 |
1100 | #define PCI_DEVICE_ID_LPE11000S 0xfc20 | 1105 | #define PCI_DEVICE_ID_LPE11000S 0xfc20 |
1106 | #define PCI_DEVICE_ID_SAT_S 0xfc40 | ||
1101 | #define PCI_DEVICE_ID_HELIOS 0xfd00 | 1107 | #define PCI_DEVICE_ID_HELIOS 0xfd00 |
1102 | #define PCI_DEVICE_ID_HELIOS_SCSP 0xfd11 | 1108 | #define PCI_DEVICE_ID_HELIOS_SCSP 0xfd11 |
1103 | #define PCI_DEVICE_ID_HELIOS_DCSP 0xfd12 | 1109 | #define PCI_DEVICE_ID_HELIOS_DCSP 0xfd12 |
@@ -1118,6 +1124,7 @@ typedef struct { | |||
1118 | #define HELIOS_JEDEC_ID 0x0364 | 1124 | #define HELIOS_JEDEC_ID 0x0364 |
1119 | #define ZEPHYR_JEDEC_ID 0x0577 | 1125 | #define ZEPHYR_JEDEC_ID 0x0577 |
1120 | #define VIPER_JEDEC_ID 0x4838 | 1126 | #define VIPER_JEDEC_ID 0x4838 |
1127 | #define SATURN_JEDEC_ID 0x1004 | ||
1121 | 1128 | ||
1122 | #define JEDEC_ID_MASK 0x0FFFF000 | 1129 | #define JEDEC_ID_MASK 0x0FFFF000 |
1123 | #define JEDEC_ID_SHIFT 12 | 1130 | #define JEDEC_ID_SHIFT 12 |
@@ -1565,7 +1572,7 @@ typedef struct { | |||
1565 | #define LINK_SPEED_1G 1 /* 1 Gigabaud */ | 1572 | #define LINK_SPEED_1G 1 /* 1 Gigabaud */ |
1566 | #define LINK_SPEED_2G 2 /* 2 Gigabaud */ | 1573 | #define LINK_SPEED_2G 2 /* 2 Gigabaud */ |
1567 | #define LINK_SPEED_4G 4 /* 4 Gigabaud */ | 1574 | #define LINK_SPEED_4G 4 /* 4 Gigabaud */ |
1568 | #define LINK_SPEED_8G 8 /* 4 Gigabaud */ | 1575 | #define LINK_SPEED_8G 8 /* 8 Gigabaud */ |
1569 | #define LINK_SPEED_10G 16 /* 10 Gigabaud */ | 1576 | #define LINK_SPEED_10G 16 /* 10 Gigabaud */ |
1570 | 1577 | ||
1571 | } INIT_LINK_VAR; | 1578 | } INIT_LINK_VAR; |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index dcf6106f557a..dcb4ba0ecee1 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -386,12 +386,12 @@ lpfc_config_port_post(struct lpfc_hba * phba) | |||
386 | * Setup the ring 0 (els) timeout handler | 386 | * Setup the ring 0 (els) timeout handler |
387 | */ | 387 | */ |
388 | timeout = phba->fc_ratov << 1; | 388 | timeout = phba->fc_ratov << 1; |
389 | phba->els_tmofunc.expires = jiffies + HZ * timeout; | 389 | mod_timer(&phba->els_tmofunc, jiffies + HZ * timeout); |
390 | add_timer(&phba->els_tmofunc); | ||
391 | 390 | ||
392 | lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed); | 391 | lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed); |
393 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 392 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
394 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); | 393 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); |
394 | lpfc_set_loopback_flag(phba); | ||
395 | if (rc != MBX_SUCCESS) { | 395 | if (rc != MBX_SUCCESS) { |
396 | lpfc_printf_log(phba, | 396 | lpfc_printf_log(phba, |
397 | KERN_ERR, | 397 | KERN_ERR, |
@@ -418,33 +418,6 @@ lpfc_config_port_post(struct lpfc_hba * phba) | |||
418 | return (0); | 418 | return (0); |
419 | } | 419 | } |
420 | 420 | ||
421 | static int | ||
422 | lpfc_discovery_wait(struct lpfc_hba *phba) | ||
423 | { | ||
424 | int i = 0; | ||
425 | |||
426 | while ((phba->hba_state != LPFC_HBA_READY) || | ||
427 | (phba->num_disc_nodes) || (phba->fc_prli_sent) || | ||
428 | ((phba->fc_map_cnt == 0) && (i<2)) || | ||
429 | (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE)) { | ||
430 | /* Check every second for 30 retries. */ | ||
431 | i++; | ||
432 | if (i > 30) { | ||
433 | return -ETIMEDOUT; | ||
434 | } | ||
435 | if ((i >= 15) && (phba->hba_state <= LPFC_LINK_DOWN)) { | ||
436 | /* The link is down. Set linkdown timeout */ | ||
437 | return -ETIMEDOUT; | ||
438 | } | ||
439 | |||
440 | /* Delay for 1 second to give discovery time to complete. */ | ||
441 | msleep(1000); | ||
442 | |||
443 | } | ||
444 | |||
445 | return 0; | ||
446 | } | ||
447 | |||
448 | /************************************************************************/ | 421 | /************************************************************************/ |
449 | /* */ | 422 | /* */ |
450 | /* lpfc_hba_down_prep */ | 423 | /* lpfc_hba_down_prep */ |
@@ -550,12 +523,15 @@ lpfc_handle_eratt(struct lpfc_hba * phba) | |||
550 | * There was a firmware error. Take the hba offline and then | 523 | * There was a firmware error. Take the hba offline and then |
551 | * attempt to restart it. | 524 | * attempt to restart it. |
552 | */ | 525 | */ |
526 | lpfc_offline_prep(phba); | ||
553 | lpfc_offline(phba); | 527 | lpfc_offline(phba); |
554 | lpfc_sli_brdrestart(phba); | 528 | lpfc_sli_brdrestart(phba); |
555 | if (lpfc_online(phba) == 0) { /* Initialize the HBA */ | 529 | if (lpfc_online(phba) == 0) { /* Initialize the HBA */ |
556 | mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); | 530 | mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); |
531 | lpfc_unblock_mgmt_io(phba); | ||
557 | return; | 532 | return; |
558 | } | 533 | } |
534 | lpfc_unblock_mgmt_io(phba); | ||
559 | } else { | 535 | } else { |
560 | /* The if clause above forces this code path when the status | 536 | /* The if clause above forces this code path when the status |
561 | * failure is a value other than FFER6. Do not call the offline | 537 | * failure is a value other than FFER6. Do not call the offline |
@@ -573,7 +549,9 @@ lpfc_handle_eratt(struct lpfc_hba * phba) | |||
573 | SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX); | 549 | SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX); |
574 | 550 | ||
575 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; | 551 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; |
552 | lpfc_offline_prep(phba); | ||
576 | lpfc_offline(phba); | 553 | lpfc_offline(phba); |
554 | lpfc_unblock_mgmt_io(phba); | ||
577 | phba->hba_state = LPFC_HBA_ERROR; | 555 | phba->hba_state = LPFC_HBA_ERROR; |
578 | lpfc_hba_down_post(phba); | 556 | lpfc_hba_down_post(phba); |
579 | } | 557 | } |
@@ -633,7 +611,7 @@ lpfc_handle_latt_free_mbuf: | |||
633 | lpfc_handle_latt_free_mp: | 611 | lpfc_handle_latt_free_mp: |
634 | kfree(mp); | 612 | kfree(mp); |
635 | lpfc_handle_latt_free_pmb: | 613 | lpfc_handle_latt_free_pmb: |
636 | kfree(pmb); | 614 | mempool_free(pmb, phba->mbox_mem_pool); |
637 | lpfc_handle_latt_err_exit: | 615 | lpfc_handle_latt_err_exit: |
638 | /* Enable Link attention interrupts */ | 616 | /* Enable Link attention interrupts */ |
639 | spin_lock_irq(phba->host->host_lock); | 617 | spin_lock_irq(phba->host->host_lock); |
@@ -925,6 +903,24 @@ lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp) | |||
925 | m = (typeof(m)){"LPe11000-S", max_speed, | 903 | m = (typeof(m)){"LPe11000-S", max_speed, |
926 | "PCIe"}; | 904 | "PCIe"}; |
927 | break; | 905 | break; |
906 | case PCI_DEVICE_ID_SAT: | ||
907 | m = (typeof(m)){"LPe12000", max_speed, "PCIe"}; | ||
908 | break; | ||
909 | case PCI_DEVICE_ID_SAT_MID: | ||
910 | m = (typeof(m)){"LPe1250", max_speed, "PCIe"}; | ||
911 | break; | ||
912 | case PCI_DEVICE_ID_SAT_SMB: | ||
913 | m = (typeof(m)){"LPe121", max_speed, "PCIe"}; | ||
914 | break; | ||
915 | case PCI_DEVICE_ID_SAT_DCSP: | ||
916 | m = (typeof(m)){"LPe12002-SP", max_speed, "PCIe"}; | ||
917 | break; | ||
918 | case PCI_DEVICE_ID_SAT_SCSP: | ||
919 | m = (typeof(m)){"LPe12000-SP", max_speed, "PCIe"}; | ||
920 | break; | ||
921 | case PCI_DEVICE_ID_SAT_S: | ||
922 | m = (typeof(m)){"LPe12000-S", max_speed, "PCIe"}; | ||
923 | break; | ||
928 | default: | 924 | default: |
929 | m = (typeof(m)){ NULL }; | 925 | m = (typeof(m)){ NULL }; |
930 | break; | 926 | break; |
@@ -1174,69 +1170,17 @@ lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit) | |||
1174 | } | 1170 | } |
1175 | 1171 | ||
1176 | static void | 1172 | static void |
1177 | lpfc_cleanup(struct lpfc_hba * phba, uint32_t save_bind) | 1173 | lpfc_cleanup(struct lpfc_hba * phba) |
1178 | { | 1174 | { |
1179 | struct lpfc_nodelist *ndlp, *next_ndlp; | 1175 | struct lpfc_nodelist *ndlp, *next_ndlp; |
1180 | 1176 | ||
1181 | /* clean up phba - lpfc specific */ | 1177 | /* clean up phba - lpfc specific */ |
1182 | lpfc_can_disctmo(phba); | 1178 | lpfc_can_disctmo(phba); |
1183 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nlpunmap_list, | 1179 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp) |
1184 | nlp_listp) { | 1180 | lpfc_nlp_put(ndlp); |
1185 | lpfc_nlp_remove(phba, ndlp); | ||
1186 | } | ||
1187 | 1181 | ||
1188 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nlpmap_list, | 1182 | INIT_LIST_HEAD(&phba->fc_nodes); |
1189 | nlp_listp) { | ||
1190 | lpfc_nlp_remove(phba, ndlp); | ||
1191 | } | ||
1192 | |||
1193 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_unused_list, | ||
1194 | nlp_listp) { | ||
1195 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | ||
1196 | } | ||
1197 | |||
1198 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_plogi_list, | ||
1199 | nlp_listp) { | ||
1200 | lpfc_nlp_remove(phba, ndlp); | ||
1201 | } | ||
1202 | |||
1203 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_adisc_list, | ||
1204 | nlp_listp) { | ||
1205 | lpfc_nlp_remove(phba, ndlp); | ||
1206 | } | ||
1207 | |||
1208 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_reglogin_list, | ||
1209 | nlp_listp) { | ||
1210 | lpfc_nlp_remove(phba, ndlp); | ||
1211 | } | ||
1212 | 1183 | ||
1213 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_prli_list, | ||
1214 | nlp_listp) { | ||
1215 | lpfc_nlp_remove(phba, ndlp); | ||
1216 | } | ||
1217 | |||
1218 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list, | ||
1219 | nlp_listp) { | ||
1220 | lpfc_nlp_remove(phba, ndlp); | ||
1221 | } | ||
1222 | |||
1223 | INIT_LIST_HEAD(&phba->fc_nlpmap_list); | ||
1224 | INIT_LIST_HEAD(&phba->fc_nlpunmap_list); | ||
1225 | INIT_LIST_HEAD(&phba->fc_unused_list); | ||
1226 | INIT_LIST_HEAD(&phba->fc_plogi_list); | ||
1227 | INIT_LIST_HEAD(&phba->fc_adisc_list); | ||
1228 | INIT_LIST_HEAD(&phba->fc_reglogin_list); | ||
1229 | INIT_LIST_HEAD(&phba->fc_prli_list); | ||
1230 | INIT_LIST_HEAD(&phba->fc_npr_list); | ||
1231 | |||
1232 | phba->fc_map_cnt = 0; | ||
1233 | phba->fc_unmap_cnt = 0; | ||
1234 | phba->fc_plogi_cnt = 0; | ||
1235 | phba->fc_adisc_cnt = 0; | ||
1236 | phba->fc_reglogin_cnt = 0; | ||
1237 | phba->fc_prli_cnt = 0; | ||
1238 | phba->fc_npr_cnt = 0; | ||
1239 | phba->fc_unused_cnt= 0; | ||
1240 | return; | 1184 | return; |
1241 | } | 1185 | } |
1242 | 1186 | ||
@@ -1262,21 +1206,6 @@ lpfc_stop_timer(struct lpfc_hba * phba) | |||
1262 | { | 1206 | { |
1263 | struct lpfc_sli *psli = &phba->sli; | 1207 | struct lpfc_sli *psli = &phba->sli; |
1264 | 1208 | ||
1265 | /* Instead of a timer, this has been converted to a | ||
1266 | * deferred procedding list. | ||
1267 | */ | ||
1268 | while (!list_empty(&phba->freebufList)) { | ||
1269 | |||
1270 | struct lpfc_dmabuf *mp = NULL; | ||
1271 | |||
1272 | list_remove_head((&phba->freebufList), mp, | ||
1273 | struct lpfc_dmabuf, list); | ||
1274 | if (mp) { | ||
1275 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | ||
1276 | kfree(mp); | ||
1277 | } | ||
1278 | } | ||
1279 | |||
1280 | del_timer_sync(&phba->fcp_poll_timer); | 1209 | del_timer_sync(&phba->fcp_poll_timer); |
1281 | del_timer_sync(&phba->fc_estabtmo); | 1210 | del_timer_sync(&phba->fc_estabtmo); |
1282 | del_timer_sync(&phba->fc_disctmo); | 1211 | del_timer_sync(&phba->fc_disctmo); |
@@ -1302,60 +1231,76 @@ lpfc_online(struct lpfc_hba * phba) | |||
1302 | "%d:0458 Bring Adapter online\n", | 1231 | "%d:0458 Bring Adapter online\n", |
1303 | phba->brd_no); | 1232 | phba->brd_no); |
1304 | 1233 | ||
1305 | if (!lpfc_sli_queue_setup(phba)) | 1234 | lpfc_block_mgmt_io(phba); |
1235 | |||
1236 | if (!lpfc_sli_queue_setup(phba)) { | ||
1237 | lpfc_unblock_mgmt_io(phba); | ||
1306 | return 1; | 1238 | return 1; |
1239 | } | ||
1307 | 1240 | ||
1308 | if (lpfc_sli_hba_setup(phba)) /* Initialize the HBA */ | 1241 | if (lpfc_sli_hba_setup(phba)) { /* Initialize the HBA */ |
1242 | lpfc_unblock_mgmt_io(phba); | ||
1309 | return 1; | 1243 | return 1; |
1244 | } | ||
1310 | 1245 | ||
1311 | spin_lock_irq(phba->host->host_lock); | 1246 | spin_lock_irq(phba->host->host_lock); |
1312 | phba->fc_flag &= ~FC_OFFLINE_MODE; | 1247 | phba->fc_flag &= ~FC_OFFLINE_MODE; |
1313 | spin_unlock_irq(phba->host->host_lock); | 1248 | spin_unlock_irq(phba->host->host_lock); |
1314 | 1249 | ||
1250 | lpfc_unblock_mgmt_io(phba); | ||
1315 | return 0; | 1251 | return 0; |
1316 | } | 1252 | } |
1317 | 1253 | ||
1318 | int | 1254 | void |
1319 | lpfc_offline(struct lpfc_hba * phba) | 1255 | lpfc_block_mgmt_io(struct lpfc_hba * phba) |
1320 | { | 1256 | { |
1321 | struct lpfc_sli_ring *pring; | ||
1322 | struct lpfc_sli *psli; | ||
1323 | unsigned long iflag; | 1257 | unsigned long iflag; |
1324 | int i; | ||
1325 | int cnt = 0; | ||
1326 | 1258 | ||
1327 | if (!phba) | 1259 | spin_lock_irqsave(phba->host->host_lock, iflag); |
1328 | return 0; | 1260 | phba->fc_flag |= FC_BLOCK_MGMT_IO; |
1261 | spin_unlock_irqrestore(phba->host->host_lock, iflag); | ||
1262 | } | ||
1263 | |||
1264 | void | ||
1265 | lpfc_unblock_mgmt_io(struct lpfc_hba * phba) | ||
1266 | { | ||
1267 | unsigned long iflag; | ||
1268 | |||
1269 | spin_lock_irqsave(phba->host->host_lock, iflag); | ||
1270 | phba->fc_flag &= ~FC_BLOCK_MGMT_IO; | ||
1271 | spin_unlock_irqrestore(phba->host->host_lock, iflag); | ||
1272 | } | ||
1273 | |||
1274 | void | ||
1275 | lpfc_offline_prep(struct lpfc_hba * phba) | ||
1276 | { | ||
1277 | struct lpfc_nodelist *ndlp, *next_ndlp; | ||
1329 | 1278 | ||
1330 | if (phba->fc_flag & FC_OFFLINE_MODE) | 1279 | if (phba->fc_flag & FC_OFFLINE_MODE) |
1331 | return 0; | 1280 | return; |
1332 | 1281 | ||
1333 | psli = &phba->sli; | 1282 | lpfc_block_mgmt_io(phba); |
1334 | 1283 | ||
1335 | lpfc_linkdown(phba); | 1284 | lpfc_linkdown(phba); |
1285 | |||
1286 | /* Issue an unreg_login to all nodes */ | ||
1287 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp) | ||
1288 | if (ndlp->nlp_state != NLP_STE_UNUSED_NODE) | ||
1289 | lpfc_unreg_rpi(phba, ndlp); | ||
1290 | |||
1336 | lpfc_sli_flush_mbox_queue(phba); | 1291 | lpfc_sli_flush_mbox_queue(phba); |
1292 | } | ||
1337 | 1293 | ||
1338 | for (i = 0; i < psli->num_rings; i++) { | 1294 | void |
1339 | pring = &psli->ring[i]; | 1295 | lpfc_offline(struct lpfc_hba * phba) |
1340 | /* The linkdown event takes 30 seconds to timeout. */ | 1296 | { |
1341 | while (pring->txcmplq_cnt) { | 1297 | unsigned long iflag; |
1342 | mdelay(10); | ||
1343 | if (cnt++ > 3000) { | ||
1344 | lpfc_printf_log(phba, | ||
1345 | KERN_WARNING, LOG_INIT, | ||
1346 | "%d:0466 Outstanding IO when " | ||
1347 | "bringing Adapter offline\n", | ||
1348 | phba->brd_no); | ||
1349 | break; | ||
1350 | } | ||
1351 | } | ||
1352 | } | ||
1353 | 1298 | ||
1299 | if (phba->fc_flag & FC_OFFLINE_MODE) | ||
1300 | return; | ||
1354 | 1301 | ||
1355 | /* stop all timers associated with this hba */ | 1302 | /* stop all timers associated with this hba */ |
1356 | lpfc_stop_timer(phba); | 1303 | lpfc_stop_timer(phba); |
1357 | phba->work_hba_events = 0; | ||
1358 | phba->work_ha = 0; | ||
1359 | 1304 | ||
1360 | lpfc_printf_log(phba, | 1305 | lpfc_printf_log(phba, |
1361 | KERN_WARNING, | 1306 | KERN_WARNING, |
@@ -1366,11 +1311,12 @@ lpfc_offline(struct lpfc_hba * phba) | |||
1366 | /* Bring down the SLI Layer and cleanup. The HBA is offline | 1311 | /* Bring down the SLI Layer and cleanup. The HBA is offline |
1367 | now. */ | 1312 | now. */ |
1368 | lpfc_sli_hba_down(phba); | 1313 | lpfc_sli_hba_down(phba); |
1369 | lpfc_cleanup(phba, 1); | 1314 | lpfc_cleanup(phba); |
1370 | spin_lock_irqsave(phba->host->host_lock, iflag); | 1315 | spin_lock_irqsave(phba->host->host_lock, iflag); |
1316 | phba->work_hba_events = 0; | ||
1317 | phba->work_ha = 0; | ||
1371 | phba->fc_flag |= FC_OFFLINE_MODE; | 1318 | phba->fc_flag |= FC_OFFLINE_MODE; |
1372 | spin_unlock_irqrestore(phba->host->host_lock, iflag); | 1319 | spin_unlock_irqrestore(phba->host->host_lock, iflag); |
1373 | return 0; | ||
1374 | } | 1320 | } |
1375 | 1321 | ||
1376 | /****************************************************************************** | 1322 | /****************************************************************************** |
@@ -1407,6 +1353,156 @@ lpfc_scsi_free(struct lpfc_hba * phba) | |||
1407 | return 0; | 1353 | return 0; |
1408 | } | 1354 | } |
1409 | 1355 | ||
1356 | void lpfc_remove_device(struct lpfc_hba *phba) | ||
1357 | { | ||
1358 | unsigned long iflag; | ||
1359 | |||
1360 | lpfc_free_sysfs_attr(phba); | ||
1361 | |||
1362 | spin_lock_irqsave(phba->host->host_lock, iflag); | ||
1363 | phba->fc_flag |= FC_UNLOADING; | ||
1364 | |||
1365 | spin_unlock_irqrestore(phba->host->host_lock, iflag); | ||
1366 | |||
1367 | fc_remove_host(phba->host); | ||
1368 | scsi_remove_host(phba->host); | ||
1369 | |||
1370 | kthread_stop(phba->worker_thread); | ||
1371 | |||
1372 | /* | ||
1373 | * Bring down the SLI Layer. This step disable all interrupts, | ||
1374 | * clears the rings, discards all mailbox commands, and resets | ||
1375 | * the HBA. | ||
1376 | */ | ||
1377 | lpfc_sli_hba_down(phba); | ||
1378 | lpfc_sli_brdrestart(phba); | ||
1379 | |||
1380 | /* Release the irq reservation */ | ||
1381 | free_irq(phba->pcidev->irq, phba); | ||
1382 | pci_disable_msi(phba->pcidev); | ||
1383 | |||
1384 | lpfc_cleanup(phba); | ||
1385 | lpfc_stop_timer(phba); | ||
1386 | phba->work_hba_events = 0; | ||
1387 | |||
1388 | /* | ||
1389 | * Call scsi_free before mem_free since scsi bufs are released to their | ||
1390 | * corresponding pools here. | ||
1391 | */ | ||
1392 | lpfc_scsi_free(phba); | ||
1393 | lpfc_mem_free(phba); | ||
1394 | |||
1395 | /* Free resources associated with SLI2 interface */ | ||
1396 | dma_free_coherent(&phba->pcidev->dev, SLI2_SLIM_SIZE, | ||
1397 | phba->slim2p, phba->slim2p_mapping); | ||
1398 | |||
1399 | /* unmap adapter SLIM and Control Registers */ | ||
1400 | iounmap(phba->ctrl_regs_memmap_p); | ||
1401 | iounmap(phba->slim_memmap_p); | ||
1402 | |||
1403 | pci_release_regions(phba->pcidev); | ||
1404 | pci_disable_device(phba->pcidev); | ||
1405 | |||
1406 | idr_remove(&lpfc_hba_index, phba->brd_no); | ||
1407 | scsi_host_put(phba->host); | ||
1408 | } | ||
1409 | |||
1410 | void lpfc_scan_start(struct Scsi_Host *host) | ||
1411 | { | ||
1412 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; | ||
1413 | |||
1414 | if (lpfc_alloc_sysfs_attr(phba)) | ||
1415 | goto error; | ||
1416 | |||
1417 | phba->MBslimaddr = phba->slim_memmap_p; | ||
1418 | phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; | ||
1419 | phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; | ||
1420 | phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; | ||
1421 | phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; | ||
1422 | |||
1423 | if (lpfc_sli_hba_setup(phba)) | ||
1424 | goto error; | ||
1425 | |||
1426 | /* | ||
1427 | * hba setup may have changed the hba_queue_depth so we need to adjust | ||
1428 | * the value of can_queue. | ||
1429 | */ | ||
1430 | host->can_queue = phba->cfg_hba_queue_depth - 10; | ||
1431 | return; | ||
1432 | |||
1433 | error: | ||
1434 | lpfc_remove_device(phba); | ||
1435 | } | ||
1436 | |||
1437 | int lpfc_scan_finished(struct Scsi_Host *shost, unsigned long time) | ||
1438 | { | ||
1439 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata; | ||
1440 | |||
1441 | if (!phba->host) | ||
1442 | return 1; | ||
1443 | if (time >= 30 * HZ) | ||
1444 | goto finished; | ||
1445 | |||
1446 | if (phba->hba_state != LPFC_HBA_READY) | ||
1447 | return 0; | ||
1448 | if (phba->num_disc_nodes || phba->fc_prli_sent) | ||
1449 | return 0; | ||
1450 | if ((phba->fc_map_cnt == 0) && (time < 2 * HZ)) | ||
1451 | return 0; | ||
1452 | if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) | ||
1453 | return 0; | ||
1454 | if ((phba->hba_state > LPFC_LINK_DOWN) || (time < 15 * HZ)) | ||
1455 | return 0; | ||
1456 | |||
1457 | finished: | ||
1458 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) { | ||
1459 | spin_lock_irq(shost->host_lock); | ||
1460 | lpfc_poll_start_timer(phba); | ||
1461 | spin_unlock_irq(shost->host_lock); | ||
1462 | } | ||
1463 | |||
1464 | /* | ||
1465 | * set fixed host attributes | ||
1466 | * Must done after lpfc_sli_hba_setup() | ||
1467 | */ | ||
1468 | |||
1469 | fc_host_node_name(shost) = wwn_to_u64(phba->fc_nodename.u.wwn); | ||
1470 | fc_host_port_name(shost) = wwn_to_u64(phba->fc_portname.u.wwn); | ||
1471 | fc_host_supported_classes(shost) = FC_COS_CLASS3; | ||
1472 | |||
1473 | memset(fc_host_supported_fc4s(shost), 0, | ||
1474 | sizeof(fc_host_supported_fc4s(shost))); | ||
1475 | fc_host_supported_fc4s(shost)[2] = 1; | ||
1476 | fc_host_supported_fc4s(shost)[7] = 1; | ||
1477 | |||
1478 | lpfc_get_hba_sym_node_name(phba, fc_host_symbolic_name(shost)); | ||
1479 | |||
1480 | fc_host_supported_speeds(shost) = 0; | ||
1481 | if (phba->lmt & LMT_10Gb) | ||
1482 | fc_host_supported_speeds(shost) |= FC_PORTSPEED_10GBIT; | ||
1483 | if (phba->lmt & LMT_4Gb) | ||
1484 | fc_host_supported_speeds(shost) |= FC_PORTSPEED_4GBIT; | ||
1485 | if (phba->lmt & LMT_2Gb) | ||
1486 | fc_host_supported_speeds(shost) |= FC_PORTSPEED_2GBIT; | ||
1487 | if (phba->lmt & LMT_1Gb) | ||
1488 | fc_host_supported_speeds(shost) |= FC_PORTSPEED_1GBIT; | ||
1489 | |||
1490 | fc_host_maxframe_size(shost) = | ||
1491 | ((((uint32_t) phba->fc_sparam.cmn.bbRcvSizeMsb & 0x0F) << 8) | | ||
1492 | (uint32_t) phba->fc_sparam.cmn.bbRcvSizeLsb); | ||
1493 | |||
1494 | /* This value is also unchanging */ | ||
1495 | memset(fc_host_active_fc4s(shost), 0, | ||
1496 | sizeof(fc_host_active_fc4s(shost))); | ||
1497 | fc_host_active_fc4s(shost)[2] = 1; | ||
1498 | fc_host_active_fc4s(shost)[7] = 1; | ||
1499 | |||
1500 | spin_lock_irq(shost->host_lock); | ||
1501 | phba->fc_flag &= ~FC_LOADING; | ||
1502 | spin_unlock_irq(shost->host_lock); | ||
1503 | |||
1504 | return 1; | ||
1505 | } | ||
1410 | 1506 | ||
1411 | static int __devinit | 1507 | static int __devinit |
1412 | lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | 1508 | lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) |
@@ -1445,9 +1541,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1445 | goto out_put_host; | 1541 | goto out_put_host; |
1446 | 1542 | ||
1447 | host->unique_id = phba->brd_no; | 1543 | host->unique_id = phba->brd_no; |
1448 | INIT_LIST_HEAD(&phba->ctrspbuflist); | ||
1449 | INIT_LIST_HEAD(&phba->rnidrspbuflist); | ||
1450 | INIT_LIST_HEAD(&phba->freebufList); | ||
1451 | 1544 | ||
1452 | /* Initialize timers used by driver */ | 1545 | /* Initialize timers used by driver */ |
1453 | init_timer(&phba->fc_estabtmo); | 1546 | init_timer(&phba->fc_estabtmo); |
@@ -1482,16 +1575,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1482 | host->max_lun = phba->cfg_max_luns; | 1575 | host->max_lun = phba->cfg_max_luns; |
1483 | host->this_id = -1; | 1576 | host->this_id = -1; |
1484 | 1577 | ||
1485 | /* Initialize all internally managed lists. */ | 1578 | INIT_LIST_HEAD(&phba->fc_nodes); |
1486 | INIT_LIST_HEAD(&phba->fc_nlpmap_list); | ||
1487 | INIT_LIST_HEAD(&phba->fc_nlpunmap_list); | ||
1488 | INIT_LIST_HEAD(&phba->fc_unused_list); | ||
1489 | INIT_LIST_HEAD(&phba->fc_plogi_list); | ||
1490 | INIT_LIST_HEAD(&phba->fc_adisc_list); | ||
1491 | INIT_LIST_HEAD(&phba->fc_reglogin_list); | ||
1492 | INIT_LIST_HEAD(&phba->fc_prli_list); | ||
1493 | INIT_LIST_HEAD(&phba->fc_npr_list); | ||
1494 | |||
1495 | 1579 | ||
1496 | pci_set_master(pdev); | 1580 | pci_set_master(pdev); |
1497 | retval = pci_set_mwi(pdev); | 1581 | retval = pci_set_mwi(pdev); |
@@ -1609,13 +1693,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1609 | 1693 | ||
1610 | host->transportt = lpfc_transport_template; | 1694 | host->transportt = lpfc_transport_template; |
1611 | pci_set_drvdata(pdev, host); | 1695 | pci_set_drvdata(pdev, host); |
1612 | error = scsi_add_host(host, &pdev->dev); | ||
1613 | if (error) | ||
1614 | goto out_kthread_stop; | ||
1615 | |||
1616 | error = lpfc_alloc_sysfs_attr(phba); | ||
1617 | if (error) | ||
1618 | goto out_remove_host; | ||
1619 | 1696 | ||
1620 | if (phba->cfg_use_msi) { | 1697 | if (phba->cfg_use_msi) { |
1621 | error = pci_enable_msi(phba->pcidev); | 1698 | error = pci_enable_msi(phba->pcidev); |
@@ -1631,73 +1708,15 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1631 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1708 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
1632 | "%d:0451 Enable interrupt handler failed\n", | 1709 | "%d:0451 Enable interrupt handler failed\n", |
1633 | phba->brd_no); | 1710 | phba->brd_no); |
1634 | goto out_free_sysfs_attr; | 1711 | goto out_kthread_stop; |
1635 | } | 1712 | } |
1636 | phba->MBslimaddr = phba->slim_memmap_p; | ||
1637 | phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; | ||
1638 | phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; | ||
1639 | phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; | ||
1640 | phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; | ||
1641 | 1713 | ||
1642 | error = lpfc_sli_hba_setup(phba); | 1714 | error = scsi_add_host(host, &pdev->dev); |
1643 | if (error) { | 1715 | if (error) |
1644 | error = -ENODEV; | ||
1645 | goto out_free_irq; | 1716 | goto out_free_irq; |
1646 | } | ||
1647 | |||
1648 | /* | ||
1649 | * hba setup may have changed the hba_queue_depth so we need to adjust | ||
1650 | * the value of can_queue. | ||
1651 | */ | ||
1652 | host->can_queue = phba->cfg_hba_queue_depth - 10; | ||
1653 | |||
1654 | lpfc_discovery_wait(phba); | ||
1655 | 1717 | ||
1656 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) { | 1718 | scsi_scan_host(host); |
1657 | spin_lock_irq(phba->host->host_lock); | ||
1658 | lpfc_poll_start_timer(phba); | ||
1659 | spin_unlock_irq(phba->host->host_lock); | ||
1660 | } | ||
1661 | 1719 | ||
1662 | /* | ||
1663 | * set fixed host attributes | ||
1664 | * Must done after lpfc_sli_hba_setup() | ||
1665 | */ | ||
1666 | |||
1667 | fc_host_node_name(host) = wwn_to_u64(phba->fc_nodename.u.wwn); | ||
1668 | fc_host_port_name(host) = wwn_to_u64(phba->fc_portname.u.wwn); | ||
1669 | fc_host_supported_classes(host) = FC_COS_CLASS3; | ||
1670 | |||
1671 | memset(fc_host_supported_fc4s(host), 0, | ||
1672 | sizeof(fc_host_supported_fc4s(host))); | ||
1673 | fc_host_supported_fc4s(host)[2] = 1; | ||
1674 | fc_host_supported_fc4s(host)[7] = 1; | ||
1675 | |||
1676 | lpfc_get_hba_sym_node_name(phba, fc_host_symbolic_name(host)); | ||
1677 | |||
1678 | fc_host_supported_speeds(host) = 0; | ||
1679 | if (phba->lmt & LMT_10Gb) | ||
1680 | fc_host_supported_speeds(host) |= FC_PORTSPEED_10GBIT; | ||
1681 | if (phba->lmt & LMT_4Gb) | ||
1682 | fc_host_supported_speeds(host) |= FC_PORTSPEED_4GBIT; | ||
1683 | if (phba->lmt & LMT_2Gb) | ||
1684 | fc_host_supported_speeds(host) |= FC_PORTSPEED_2GBIT; | ||
1685 | if (phba->lmt & LMT_1Gb) | ||
1686 | fc_host_supported_speeds(host) |= FC_PORTSPEED_1GBIT; | ||
1687 | |||
1688 | fc_host_maxframe_size(host) = | ||
1689 | ((((uint32_t) phba->fc_sparam.cmn.bbRcvSizeMsb & 0x0F) << 8) | | ||
1690 | (uint32_t) phba->fc_sparam.cmn.bbRcvSizeLsb); | ||
1691 | |||
1692 | /* This value is also unchanging */ | ||
1693 | memset(fc_host_active_fc4s(host), 0, | ||
1694 | sizeof(fc_host_active_fc4s(host))); | ||
1695 | fc_host_active_fc4s(host)[2] = 1; | ||
1696 | fc_host_active_fc4s(host)[7] = 1; | ||
1697 | |||
1698 | spin_lock_irq(phba->host->host_lock); | ||
1699 | phba->fc_flag &= ~FC_LOADING; | ||
1700 | spin_unlock_irq(phba->host->host_lock); | ||
1701 | return 0; | 1720 | return 0; |
1702 | 1721 | ||
1703 | out_free_irq: | 1722 | out_free_irq: |
@@ -1705,11 +1724,6 @@ out_free_irq: | |||
1705 | phba->work_hba_events = 0; | 1724 | phba->work_hba_events = 0; |
1706 | free_irq(phba->pcidev->irq, phba); | 1725 | free_irq(phba->pcidev->irq, phba); |
1707 | pci_disable_msi(phba->pcidev); | 1726 | pci_disable_msi(phba->pcidev); |
1708 | out_free_sysfs_attr: | ||
1709 | lpfc_free_sysfs_attr(phba); | ||
1710 | out_remove_host: | ||
1711 | fc_remove_host(phba->host); | ||
1712 | scsi_remove_host(phba->host); | ||
1713 | out_kthread_stop: | 1727 | out_kthread_stop: |
1714 | kthread_stop(phba->worker_thread); | 1728 | kthread_stop(phba->worker_thread); |
1715 | out_free_iocbq: | 1729 | out_free_iocbq: |
@@ -1747,56 +1761,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev) | |||
1747 | { | 1761 | { |
1748 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 1762 | struct Scsi_Host *host = pci_get_drvdata(pdev); |
1749 | struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; | 1763 | struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; |
1750 | unsigned long iflag; | ||
1751 | |||
1752 | lpfc_free_sysfs_attr(phba); | ||
1753 | |||
1754 | spin_lock_irqsave(phba->host->host_lock, iflag); | ||
1755 | phba->fc_flag |= FC_UNLOADING; | ||
1756 | |||
1757 | spin_unlock_irqrestore(phba->host->host_lock, iflag); | ||
1758 | 1764 | ||
1759 | fc_remove_host(phba->host); | 1765 | lpfc_remove_device(phba); |
1760 | scsi_remove_host(phba->host); | ||
1761 | |||
1762 | kthread_stop(phba->worker_thread); | ||
1763 | |||
1764 | /* | ||
1765 | * Bring down the SLI Layer. This step disable all interrupts, | ||
1766 | * clears the rings, discards all mailbox commands, and resets | ||
1767 | * the HBA. | ||
1768 | */ | ||
1769 | lpfc_sli_hba_down(phba); | ||
1770 | lpfc_sli_brdrestart(phba); | ||
1771 | |||
1772 | /* Release the irq reservation */ | ||
1773 | free_irq(phba->pcidev->irq, phba); | ||
1774 | pci_disable_msi(phba->pcidev); | ||
1775 | |||
1776 | lpfc_cleanup(phba, 0); | ||
1777 | lpfc_stop_timer(phba); | ||
1778 | phba->work_hba_events = 0; | ||
1779 | |||
1780 | /* | ||
1781 | * Call scsi_free before mem_free since scsi bufs are released to their | ||
1782 | * corresponding pools here. | ||
1783 | */ | ||
1784 | lpfc_scsi_free(phba); | ||
1785 | lpfc_mem_free(phba); | ||
1786 | |||
1787 | /* Free resources associated with SLI2 interface */ | ||
1788 | dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, | ||
1789 | phba->slim2p, phba->slim2p_mapping); | ||
1790 | |||
1791 | /* unmap adapter SLIM and Control Registers */ | ||
1792 | iounmap(phba->ctrl_regs_memmap_p); | ||
1793 | iounmap(phba->slim_memmap_p); | ||
1794 | |||
1795 | pci_release_regions(phba->pcidev); | ||
1796 | pci_disable_device(phba->pcidev); | ||
1797 | |||
1798 | idr_remove(&lpfc_hba_index, phba->brd_no); | ||
1799 | scsi_host_put(phba->host); | ||
1800 | 1766 | ||
1801 | pci_set_drvdata(pdev, NULL); | 1767 | pci_set_drvdata(pdev, NULL); |
1802 | } | 1768 | } |
@@ -1941,6 +1907,18 @@ static struct pci_device_id lpfc_id_table[] = { | |||
1941 | PCI_ANY_ID, PCI_ANY_ID, }, | 1907 | PCI_ANY_ID, PCI_ANY_ID, }, |
1942 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LPE11000S, | 1908 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LPE11000S, |
1943 | PCI_ANY_ID, PCI_ANY_ID, }, | 1909 | PCI_ANY_ID, PCI_ANY_ID, }, |
1910 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT, | ||
1911 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1912 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT_MID, | ||
1913 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1914 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT_SMB, | ||
1915 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1916 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT_DCSP, | ||
1917 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1918 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT_SCSP, | ||
1919 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1920 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT_S, | ||
1921 | PCI_ANY_ID, PCI_ANY_ID, }, | ||
1944 | { 0 } | 1922 | { 0 } |
1945 | }; | 1923 | }; |
1946 | 1924 | ||
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index 4d016c2a1b26..8041c3f06f7b 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -212,6 +212,7 @@ lpfc_init_link(struct lpfc_hba * phba, | |||
212 | case LINK_SPEED_1G: | 212 | case LINK_SPEED_1G: |
213 | case LINK_SPEED_2G: | 213 | case LINK_SPEED_2G: |
214 | case LINK_SPEED_4G: | 214 | case LINK_SPEED_4G: |
215 | case LINK_SPEED_8G: | ||
215 | mb->un.varInitLnk.link_flags |= | 216 | mb->un.varInitLnk.link_flags |= |
216 | FLAGS_LINK_SPEED; | 217 | FLAGS_LINK_SPEED; |
217 | mb->un.varInitLnk.link_speed = linkspeed; | 218 | mb->un.varInitLnk.link_speed = linkspeed; |
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 0c7e731dc45a..b309841e3846 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -168,14 +168,13 @@ lpfc_check_elscmpl_iocb(struct lpfc_hba * phba, | |||
168 | * routine effectively results in a "software abort". | 168 | * routine effectively results in a "software abort". |
169 | */ | 169 | */ |
170 | int | 170 | int |
171 | lpfc_els_abort(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, | 171 | lpfc_els_abort(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) |
172 | int send_abts) | ||
173 | { | 172 | { |
173 | LIST_HEAD(completions); | ||
174 | struct lpfc_sli *psli; | 174 | struct lpfc_sli *psli; |
175 | struct lpfc_sli_ring *pring; | 175 | struct lpfc_sli_ring *pring; |
176 | struct lpfc_iocbq *iocb, *next_iocb; | 176 | struct lpfc_iocbq *iocb, *next_iocb; |
177 | IOCB_t *icmd; | 177 | IOCB_t *cmd; |
178 | int found = 0; | ||
179 | 178 | ||
180 | /* Abort outstanding I/O on NPort <nlp_DID> */ | 179 | /* Abort outstanding I/O on NPort <nlp_DID> */ |
181 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 180 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
@@ -188,75 +187,39 @@ lpfc_els_abort(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, | |||
188 | pring = &psli->ring[LPFC_ELS_RING]; | 187 | pring = &psli->ring[LPFC_ELS_RING]; |
189 | 188 | ||
190 | /* First check the txq */ | 189 | /* First check the txq */ |
191 | do { | 190 | spin_lock_irq(phba->host->host_lock); |
192 | found = 0; | 191 | list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) { |
193 | spin_lock_irq(phba->host->host_lock); | 192 | /* Check to see if iocb matches the nport we are looking |
194 | list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) { | 193 | for */ |
195 | /* Check to see if iocb matches the nport we are looking | 194 | if (lpfc_check_sli_ndlp(phba, pring, iocb, ndlp)) { |
196 | for */ | 195 | /* It matches, so deque and call compl with an |
197 | if ((lpfc_check_sli_ndlp(phba, pring, iocb, ndlp))) { | 196 | error */ |
198 | found = 1; | 197 | list_move_tail(&iocb->list, &completions); |
199 | /* It matches, so deque and call compl with an | 198 | pring->txq_cnt--; |
200 | error */ | ||
201 | list_del(&iocb->list); | ||
202 | pring->txq_cnt--; | ||
203 | if (iocb->iocb_cmpl) { | ||
204 | icmd = &iocb->iocb; | ||
205 | icmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
206 | icmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
207 | spin_unlock_irq(phba->host->host_lock); | ||
208 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
209 | spin_lock_irq(phba->host->host_lock); | ||
210 | } else | ||
211 | lpfc_sli_release_iocbq(phba, iocb); | ||
212 | break; | ||
213 | } | ||
214 | } | 199 | } |
215 | spin_unlock_irq(phba->host->host_lock); | 200 | } |
216 | } while (found); | ||
217 | 201 | ||
218 | /* Everything on txcmplq will be returned by firmware | ||
219 | * with a no rpi / linkdown / abort error. For ring 0, | ||
220 | * ELS discovery, we want to get rid of it right here. | ||
221 | */ | ||
222 | /* Next check the txcmplq */ | 202 | /* Next check the txcmplq */ |
223 | do { | 203 | list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) { |
224 | found = 0; | 204 | /* Check to see if iocb matches the nport we are looking |
225 | spin_lock_irq(phba->host->host_lock); | 205 | for */ |
226 | list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, | 206 | if (lpfc_check_sli_ndlp(phba, pring, iocb, ndlp)) |
227 | list) { | 207 | lpfc_sli_issue_abort_iotag(phba, pring, iocb); |
228 | /* Check to see if iocb matches the nport we are looking | 208 | } |
229 | for */ | 209 | spin_unlock_irq(phba->host->host_lock); |
230 | if ((lpfc_check_sli_ndlp (phba, pring, iocb, ndlp))) { | 210 | |
231 | found = 1; | 211 | while (!list_empty(&completions)) { |
232 | /* It matches, so deque and call compl with an | 212 | iocb = list_get_first(&completions, struct lpfc_iocbq, list); |
233 | error */ | 213 | cmd = &iocb->iocb; |
234 | list_del(&iocb->list); | 214 | list_del(&iocb->list); |
235 | pring->txcmplq_cnt--; | 215 | |
236 | 216 | if (iocb->iocb_cmpl) { | |
237 | icmd = &iocb->iocb; | 217 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; |
238 | /* If the driver is completing an ELS | 218 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; |
239 | * command early, flush it out of the firmware. | 219 | (iocb->iocb_cmpl) (phba, iocb, iocb); |
240 | */ | 220 | } else |
241 | if (send_abts && | 221 | lpfc_sli_release_iocbq(phba, iocb); |
242 | (icmd->ulpCommand == CMD_ELS_REQUEST64_CR) && | 222 | } |
243 | (icmd->un.elsreq64.bdl.ulpIoTag32)) { | ||
244 | lpfc_sli_issue_abort_iotag32(phba, | ||
245 | pring, iocb); | ||
246 | } | ||
247 | if (iocb->iocb_cmpl) { | ||
248 | icmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
249 | icmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
250 | spin_unlock_irq(phba->host->host_lock); | ||
251 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
252 | spin_lock_irq(phba->host->host_lock); | ||
253 | } else | ||
254 | lpfc_sli_release_iocbq(phba, iocb); | ||
255 | break; | ||
256 | } | ||
257 | } | ||
258 | spin_unlock_irq(phba->host->host_lock); | ||
259 | } while(found); | ||
260 | 223 | ||
261 | /* If we are delaying issuing an ELS command, cancel it */ | 224 | /* If we are delaying issuing an ELS command, cancel it */ |
262 | if (ndlp->nlp_flag & NLP_DELAY_TMO) | 225 | if (ndlp->nlp_flag & NLP_DELAY_TMO) |
@@ -390,7 +353,10 @@ lpfc_rcv_plogi(struct lpfc_hba * phba, | |||
390 | * queue this mbox command to be processed later. | 353 | * queue this mbox command to be processed later. |
391 | */ | 354 | */ |
392 | mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; | 355 | mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; |
393 | mbox->context2 = ndlp; | 356 | /* |
357 | * mbox->context2 = lpfc_nlp_get(ndlp) deferred until mailbox | ||
358 | * command issued in lpfc_cmpl_els_acc(). | ||
359 | */ | ||
394 | ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI); | 360 | ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI); |
395 | 361 | ||
396 | /* | 362 | /* |
@@ -404,7 +370,7 @@ lpfc_rcv_plogi(struct lpfc_hba * phba, | |||
404 | */ | 370 | */ |
405 | if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) { | 371 | if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) { |
406 | /* software abort outstanding PLOGI */ | 372 | /* software abort outstanding PLOGI */ |
407 | lpfc_els_abort(phba, ndlp, 1); | 373 | lpfc_els_abort(phba, ndlp); |
408 | } | 374 | } |
409 | 375 | ||
410 | lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0); | 376 | lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0); |
@@ -471,8 +437,7 @@ lpfc_rcv_padisc(struct lpfc_hba * phba, | |||
471 | spin_unlock_irq(phba->host->host_lock); | 437 | spin_unlock_irq(phba->host->host_lock); |
472 | ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; | 438 | ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; |
473 | ndlp->nlp_prev_state = ndlp->nlp_state; | 439 | ndlp->nlp_prev_state = ndlp->nlp_state; |
474 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 440 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
475 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
476 | return 0; | 441 | return 0; |
477 | } | 442 | } |
478 | 443 | ||
@@ -502,12 +467,10 @@ lpfc_rcv_logo(struct lpfc_hba * phba, | |||
502 | 467 | ||
503 | ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; | 468 | ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; |
504 | ndlp->nlp_prev_state = ndlp->nlp_state; | 469 | ndlp->nlp_prev_state = ndlp->nlp_state; |
505 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 470 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
506 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
507 | } else { | 471 | } else { |
508 | ndlp->nlp_prev_state = ndlp->nlp_state; | 472 | ndlp->nlp_prev_state = ndlp->nlp_state; |
509 | ndlp->nlp_state = NLP_STE_UNUSED_NODE; | 473 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE); |
510 | lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); | ||
511 | } | 474 | } |
512 | 475 | ||
513 | spin_lock_irq(phba->host->host_lock); | 476 | spin_lock_irq(phba->host->host_lock); |
@@ -601,11 +564,10 @@ lpfc_rcv_plogi_unused_node(struct lpfc_hba * phba, | |||
601 | 564 | ||
602 | if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) { | 565 | if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) { |
603 | ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE; | 566 | ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE; |
604 | ndlp->nlp_state = NLP_STE_UNUSED_NODE; | 567 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE); |
605 | lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); | ||
606 | return ndlp->nlp_state; | 568 | return ndlp->nlp_state; |
607 | } | 569 | } |
608 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 570 | lpfc_drop_node(phba, ndlp); |
609 | return NLP_STE_FREED_NODE; | 571 | return NLP_STE_FREED_NODE; |
610 | } | 572 | } |
611 | 573 | ||
@@ -614,7 +576,7 @@ lpfc_rcv_els_unused_node(struct lpfc_hba * phba, | |||
614 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) | 576 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) |
615 | { | 577 | { |
616 | lpfc_issue_els_logo(phba, ndlp, 0); | 578 | lpfc_issue_els_logo(phba, ndlp, 0); |
617 | lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); | 579 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE); |
618 | return ndlp->nlp_state; | 580 | return ndlp->nlp_state; |
619 | } | 581 | } |
620 | 582 | ||
@@ -630,7 +592,7 @@ lpfc_rcv_logo_unused_node(struct lpfc_hba * phba, | |||
630 | ndlp->nlp_flag |= NLP_LOGO_ACC; | 592 | ndlp->nlp_flag |= NLP_LOGO_ACC; |
631 | spin_unlock_irq(phba->host->host_lock); | 593 | spin_unlock_irq(phba->host->host_lock); |
632 | lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 594 | lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); |
633 | lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); | 595 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE); |
634 | 596 | ||
635 | return ndlp->nlp_state; | 597 | return ndlp->nlp_state; |
636 | } | 598 | } |
@@ -639,7 +601,7 @@ static uint32_t | |||
639 | lpfc_cmpl_logo_unused_node(struct lpfc_hba * phba, | 601 | lpfc_cmpl_logo_unused_node(struct lpfc_hba * phba, |
640 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) | 602 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) |
641 | { | 603 | { |
642 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 604 | lpfc_drop_node(phba, ndlp); |
643 | return NLP_STE_FREED_NODE; | 605 | return NLP_STE_FREED_NODE; |
644 | } | 606 | } |
645 | 607 | ||
@@ -647,7 +609,7 @@ static uint32_t | |||
647 | lpfc_device_rm_unused_node(struct lpfc_hba * phba, | 609 | lpfc_device_rm_unused_node(struct lpfc_hba * phba, |
648 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) | 610 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) |
649 | { | 611 | { |
650 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 612 | lpfc_drop_node(phba, ndlp); |
651 | return NLP_STE_FREED_NODE; | 613 | return NLP_STE_FREED_NODE; |
652 | } | 614 | } |
653 | 615 | ||
@@ -697,7 +659,7 @@ lpfc_rcv_logo_plogi_issue(struct lpfc_hba * phba, | |||
697 | cmdiocb = (struct lpfc_iocbq *) arg; | 659 | cmdiocb = (struct lpfc_iocbq *) arg; |
698 | 660 | ||
699 | /* software abort outstanding PLOGI */ | 661 | /* software abort outstanding PLOGI */ |
700 | lpfc_els_abort(phba, ndlp, 1); | 662 | lpfc_els_abort(phba, ndlp); |
701 | 663 | ||
702 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); | 664 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); |
703 | return ndlp->nlp_state; | 665 | return ndlp->nlp_state; |
@@ -712,7 +674,7 @@ lpfc_rcv_els_plogi_issue(struct lpfc_hba * phba, | |||
712 | cmdiocb = (struct lpfc_iocbq *) arg; | 674 | cmdiocb = (struct lpfc_iocbq *) arg; |
713 | 675 | ||
714 | /* software abort outstanding PLOGI */ | 676 | /* software abort outstanding PLOGI */ |
715 | lpfc_els_abort(phba, ndlp, 1); | 677 | lpfc_els_abort(phba, ndlp); |
716 | 678 | ||
717 | if (evt == NLP_EVT_RCV_LOGO) { | 679 | if (evt == NLP_EVT_RCV_LOGO) { |
718 | lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 680 | lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); |
@@ -727,8 +689,7 @@ lpfc_rcv_els_plogi_issue(struct lpfc_hba * phba, | |||
727 | spin_unlock_irq(phba->host->host_lock); | 689 | spin_unlock_irq(phba->host->host_lock); |
728 | ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; | 690 | ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; |
729 | ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE; | 691 | ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE; |
730 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 692 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
731 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
732 | 693 | ||
733 | return ndlp->nlp_state; | 694 | return ndlp->nlp_state; |
734 | } | 695 | } |
@@ -803,32 +764,26 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba, | |||
803 | goto out; | 764 | goto out; |
804 | 765 | ||
805 | lpfc_unreg_rpi(phba, ndlp); | 766 | lpfc_unreg_rpi(phba, ndlp); |
806 | if (lpfc_reg_login | 767 | if (lpfc_reg_login(phba, irsp->un.elsreq64.remoteID, (uint8_t *) sp, |
807 | (phba, irsp->un.elsreq64.remoteID, | 768 | mbox, 0) == 0) { |
808 | (uint8_t *) sp, mbox, 0) == 0) { | ||
809 | switch (ndlp->nlp_DID) { | 769 | switch (ndlp->nlp_DID) { |
810 | case NameServer_DID: | 770 | case NameServer_DID: |
811 | mbox->mbox_cmpl = | 771 | mbox->mbox_cmpl = lpfc_mbx_cmpl_ns_reg_login; |
812 | lpfc_mbx_cmpl_ns_reg_login; | ||
813 | break; | 772 | break; |
814 | case FDMI_DID: | 773 | case FDMI_DID: |
815 | mbox->mbox_cmpl = | 774 | mbox->mbox_cmpl = lpfc_mbx_cmpl_fdmi_reg_login; |
816 | lpfc_mbx_cmpl_fdmi_reg_login; | ||
817 | break; | 775 | break; |
818 | default: | 776 | default: |
819 | mbox->mbox_cmpl = | 777 | mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; |
820 | lpfc_mbx_cmpl_reg_login; | ||
821 | } | 778 | } |
822 | mbox->context2 = ndlp; | 779 | mbox->context2 = lpfc_nlp_get(ndlp); |
823 | if (lpfc_sli_issue_mbox(phba, mbox, | 780 | if (lpfc_sli_issue_mbox(phba, mbox, |
824 | (MBX_NOWAIT | MBX_STOP_IOCB)) | 781 | (MBX_NOWAIT | MBX_STOP_IOCB)) |
825 | != MBX_NOT_FINISHED) { | 782 | != MBX_NOT_FINISHED) { |
826 | ndlp->nlp_state = | 783 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_REG_LOGIN_ISSUE); |
827 | NLP_STE_REG_LOGIN_ISSUE; | ||
828 | lpfc_nlp_list(phba, ndlp, | ||
829 | NLP_REGLOGIN_LIST); | ||
830 | return ndlp->nlp_state; | 784 | return ndlp->nlp_state; |
831 | } | 785 | } |
786 | lpfc_nlp_put(ndlp); | ||
832 | mp = (struct lpfc_dmabuf *)mbox->context1; | 787 | mp = (struct lpfc_dmabuf *)mbox->context1; |
833 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 788 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
834 | kfree(mp); | 789 | kfree(mp); |
@@ -841,7 +796,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba, | |||
841 | out: | 796 | out: |
842 | /* Free this node since the driver cannot login or has the wrong | 797 | /* Free this node since the driver cannot login or has the wrong |
843 | sparm */ | 798 | sparm */ |
844 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 799 | lpfc_drop_node(phba, ndlp); |
845 | return NLP_STE_FREED_NODE; | 800 | return NLP_STE_FREED_NODE; |
846 | } | 801 | } |
847 | 802 | ||
@@ -855,9 +810,9 @@ lpfc_device_rm_plogi_issue(struct lpfc_hba * phba, | |||
855 | } | 810 | } |
856 | else { | 811 | else { |
857 | /* software abort outstanding PLOGI */ | 812 | /* software abort outstanding PLOGI */ |
858 | lpfc_els_abort(phba, ndlp, 1); | 813 | lpfc_els_abort(phba, ndlp); |
859 | 814 | ||
860 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 815 | lpfc_drop_node(phba, ndlp); |
861 | return NLP_STE_FREED_NODE; | 816 | return NLP_STE_FREED_NODE; |
862 | } | 817 | } |
863 | } | 818 | } |
@@ -868,11 +823,10 @@ lpfc_device_recov_plogi_issue(struct lpfc_hba * phba, | |||
868 | uint32_t evt) | 823 | uint32_t evt) |
869 | { | 824 | { |
870 | /* software abort outstanding PLOGI */ | 825 | /* software abort outstanding PLOGI */ |
871 | lpfc_els_abort(phba, ndlp, 1); | 826 | lpfc_els_abort(phba, ndlp); |
872 | 827 | ||
873 | ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE; | 828 | ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE; |
874 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 829 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
875 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
876 | spin_lock_irq(phba->host->host_lock); | 830 | spin_lock_irq(phba->host->host_lock); |
877 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); | 831 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
878 | spin_unlock_irq(phba->host->host_lock); | 832 | spin_unlock_irq(phba->host->host_lock); |
@@ -888,7 +842,7 @@ lpfc_rcv_plogi_adisc_issue(struct lpfc_hba * phba, | |||
888 | struct lpfc_iocbq *cmdiocb; | 842 | struct lpfc_iocbq *cmdiocb; |
889 | 843 | ||
890 | /* software abort outstanding ADISC */ | 844 | /* software abort outstanding ADISC */ |
891 | lpfc_els_abort(phba, ndlp, 1); | 845 | lpfc_els_abort(phba, ndlp); |
892 | 846 | ||
893 | cmdiocb = (struct lpfc_iocbq *) arg; | 847 | cmdiocb = (struct lpfc_iocbq *) arg; |
894 | 848 | ||
@@ -896,8 +850,7 @@ lpfc_rcv_plogi_adisc_issue(struct lpfc_hba * phba, | |||
896 | return ndlp->nlp_state; | 850 | return ndlp->nlp_state; |
897 | } | 851 | } |
898 | ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; | 852 | ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; |
899 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 853 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
900 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
901 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); | 854 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); |
902 | 855 | ||
903 | return ndlp->nlp_state; | 856 | return ndlp->nlp_state; |
@@ -926,7 +879,7 @@ lpfc_rcv_logo_adisc_issue(struct lpfc_hba * phba, | |||
926 | cmdiocb = (struct lpfc_iocbq *) arg; | 879 | cmdiocb = (struct lpfc_iocbq *) arg; |
927 | 880 | ||
928 | /* software abort outstanding ADISC */ | 881 | /* software abort outstanding ADISC */ |
929 | lpfc_els_abort(phba, ndlp, 0); | 882 | lpfc_els_abort(phba, ndlp); |
930 | 883 | ||
931 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); | 884 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); |
932 | return ndlp->nlp_state; | 885 | return ndlp->nlp_state; |
@@ -987,20 +940,17 @@ lpfc_cmpl_adisc_adisc_issue(struct lpfc_hba * phba, | |||
987 | memset(&ndlp->nlp_portname, 0, sizeof (struct lpfc_name)); | 940 | memset(&ndlp->nlp_portname, 0, sizeof (struct lpfc_name)); |
988 | 941 | ||
989 | ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; | 942 | ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; |
990 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 943 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
991 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
992 | lpfc_unreg_rpi(phba, ndlp); | 944 | lpfc_unreg_rpi(phba, ndlp); |
993 | return ndlp->nlp_state; | 945 | return ndlp->nlp_state; |
994 | } | 946 | } |
995 | 947 | ||
996 | if (ndlp->nlp_type & NLP_FCP_TARGET) { | 948 | if (ndlp->nlp_type & NLP_FCP_TARGET) { |
997 | ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; | 949 | ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; |
998 | ndlp->nlp_state = NLP_STE_MAPPED_NODE; | 950 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_MAPPED_NODE); |
999 | lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST); | ||
1000 | } else { | 951 | } else { |
1001 | ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; | 952 | ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; |
1002 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 953 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE); |
1003 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | ||
1004 | } | 954 | } |
1005 | return ndlp->nlp_state; | 955 | return ndlp->nlp_state; |
1006 | } | 956 | } |
@@ -1016,9 +966,9 @@ lpfc_device_rm_adisc_issue(struct lpfc_hba * phba, | |||
1016 | } | 966 | } |
1017 | else { | 967 | else { |
1018 | /* software abort outstanding ADISC */ | 968 | /* software abort outstanding ADISC */ |
1019 | lpfc_els_abort(phba, ndlp, 1); | 969 | lpfc_els_abort(phba, ndlp); |
1020 | 970 | ||
1021 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 971 | lpfc_drop_node(phba, ndlp); |
1022 | return NLP_STE_FREED_NODE; | 972 | return NLP_STE_FREED_NODE; |
1023 | } | 973 | } |
1024 | } | 974 | } |
@@ -1029,11 +979,10 @@ lpfc_device_recov_adisc_issue(struct lpfc_hba * phba, | |||
1029 | uint32_t evt) | 979 | uint32_t evt) |
1030 | { | 980 | { |
1031 | /* software abort outstanding ADISC */ | 981 | /* software abort outstanding ADISC */ |
1032 | lpfc_els_abort(phba, ndlp, 1); | 982 | lpfc_els_abort(phba, ndlp); |
1033 | 983 | ||
1034 | ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; | 984 | ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; |
1035 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 985 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1036 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1037 | spin_lock_irq(phba->host->host_lock); | 986 | spin_lock_irq(phba->host->host_lock); |
1038 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); | 987 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
1039 | ndlp->nlp_flag |= NLP_NPR_ADISC; | 988 | ndlp->nlp_flag |= NLP_NPR_ADISC; |
@@ -1074,9 +1023,36 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_hba * phba, | |||
1074 | uint32_t evt) | 1023 | uint32_t evt) |
1075 | { | 1024 | { |
1076 | struct lpfc_iocbq *cmdiocb; | 1025 | struct lpfc_iocbq *cmdiocb; |
1026 | LPFC_MBOXQ_t *mb; | ||
1027 | LPFC_MBOXQ_t *nextmb; | ||
1028 | struct lpfc_dmabuf *mp; | ||
1077 | 1029 | ||
1078 | cmdiocb = (struct lpfc_iocbq *) arg; | 1030 | cmdiocb = (struct lpfc_iocbq *) arg; |
1079 | 1031 | ||
1032 | /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ | ||
1033 | if ((mb = phba->sli.mbox_active)) { | ||
1034 | if ((mb->mb.mbxCommand == MBX_REG_LOGIN64) && | ||
1035 | (ndlp == (struct lpfc_nodelist *) mb->context2)) { | ||
1036 | mb->context2 = NULL; | ||
1037 | mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | ||
1038 | } | ||
1039 | } | ||
1040 | |||
1041 | spin_lock_irq(phba->host->host_lock); | ||
1042 | list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { | ||
1043 | if ((mb->mb.mbxCommand == MBX_REG_LOGIN64) && | ||
1044 | (ndlp == (struct lpfc_nodelist *) mb->context2)) { | ||
1045 | mp = (struct lpfc_dmabuf *) (mb->context1); | ||
1046 | if (mp) { | ||
1047 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | ||
1048 | kfree(mp); | ||
1049 | } | ||
1050 | list_del(&mb->list); | ||
1051 | mempool_free(mb, phba->mbox_mem_pool); | ||
1052 | } | ||
1053 | } | ||
1054 | spin_unlock_irq(phba->host->host_lock); | ||
1055 | |||
1080 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); | 1056 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); |
1081 | return ndlp->nlp_state; | 1057 | return ndlp->nlp_state; |
1082 | } | 1058 | } |
@@ -1133,8 +1109,7 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba, | |||
1133 | */ | 1109 | */ |
1134 | if (mb->mbxStatus == MBXERR_RPI_FULL) { | 1110 | if (mb->mbxStatus == MBXERR_RPI_FULL) { |
1135 | ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE; | 1111 | ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE; |
1136 | ndlp->nlp_state = NLP_STE_UNUSED_NODE; | 1112 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE); |
1137 | lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); | ||
1138 | return ndlp->nlp_state; | 1113 | return ndlp->nlp_state; |
1139 | } | 1114 | } |
1140 | 1115 | ||
@@ -1147,8 +1122,7 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba, | |||
1147 | 1122 | ||
1148 | lpfc_issue_els_logo(phba, ndlp, 0); | 1123 | lpfc_issue_els_logo(phba, ndlp, 0); |
1149 | ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; | 1124 | ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; |
1150 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1125 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1151 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1152 | return ndlp->nlp_state; | 1126 | return ndlp->nlp_state; |
1153 | } | 1127 | } |
1154 | 1128 | ||
@@ -1157,13 +1131,11 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba, | |||
1157 | /* Only if we are not a fabric nport do we issue PRLI */ | 1131 | /* Only if we are not a fabric nport do we issue PRLI */ |
1158 | if (!(ndlp->nlp_type & NLP_FABRIC)) { | 1132 | if (!(ndlp->nlp_type & NLP_FABRIC)) { |
1159 | ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; | 1133 | ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; |
1160 | ndlp->nlp_state = NLP_STE_PRLI_ISSUE; | 1134 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PRLI_ISSUE); |
1161 | lpfc_nlp_list(phba, ndlp, NLP_PRLI_LIST); | ||
1162 | lpfc_issue_els_prli(phba, ndlp, 0); | 1135 | lpfc_issue_els_prli(phba, ndlp, 0); |
1163 | } else { | 1136 | } else { |
1164 | ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; | 1137 | ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; |
1165 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 1138 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE); |
1166 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | ||
1167 | } | 1139 | } |
1168 | return ndlp->nlp_state; | 1140 | return ndlp->nlp_state; |
1169 | } | 1141 | } |
@@ -1178,7 +1150,7 @@ lpfc_device_rm_reglogin_issue(struct lpfc_hba * phba, | |||
1178 | return ndlp->nlp_state; | 1150 | return ndlp->nlp_state; |
1179 | } | 1151 | } |
1180 | else { | 1152 | else { |
1181 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1153 | lpfc_drop_node(phba, ndlp); |
1182 | return NLP_STE_FREED_NODE; | 1154 | return NLP_STE_FREED_NODE; |
1183 | } | 1155 | } |
1184 | } | 1156 | } |
@@ -1189,8 +1161,7 @@ lpfc_device_recov_reglogin_issue(struct lpfc_hba * phba, | |||
1189 | uint32_t evt) | 1161 | uint32_t evt) |
1190 | { | 1162 | { |
1191 | ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; | 1163 | ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; |
1192 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1164 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1193 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1194 | spin_lock_irq(phba->host->host_lock); | 1165 | spin_lock_irq(phba->host->host_lock); |
1195 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); | 1166 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
1196 | spin_unlock_irq(phba->host->host_lock); | 1167 | spin_unlock_irq(phba->host->host_lock); |
@@ -1230,7 +1201,7 @@ lpfc_rcv_logo_prli_issue(struct lpfc_hba * phba, | |||
1230 | cmdiocb = (struct lpfc_iocbq *) arg; | 1201 | cmdiocb = (struct lpfc_iocbq *) arg; |
1231 | 1202 | ||
1232 | /* Software abort outstanding PRLI before sending acc */ | 1203 | /* Software abort outstanding PRLI before sending acc */ |
1233 | lpfc_els_abort(phba, ndlp, 1); | 1204 | lpfc_els_abort(phba, ndlp); |
1234 | 1205 | ||
1235 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); | 1206 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); |
1236 | return ndlp->nlp_state; | 1207 | return ndlp->nlp_state; |
@@ -1279,8 +1250,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_hba * phba, | |||
1279 | irsp = &rspiocb->iocb; | 1250 | irsp = &rspiocb->iocb; |
1280 | if (irsp->ulpStatus) { | 1251 | if (irsp->ulpStatus) { |
1281 | ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; | 1252 | ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; |
1282 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 1253 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE); |
1283 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | ||
1284 | return ndlp->nlp_state; | 1254 | return ndlp->nlp_state; |
1285 | } | 1255 | } |
1286 | 1256 | ||
@@ -1298,8 +1268,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_hba * phba, | |||
1298 | } | 1268 | } |
1299 | 1269 | ||
1300 | ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; | 1270 | ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; |
1301 | ndlp->nlp_state = NLP_STE_MAPPED_NODE; | 1271 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_MAPPED_NODE); |
1302 | lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST); | ||
1303 | return ndlp->nlp_state; | 1272 | return ndlp->nlp_state; |
1304 | } | 1273 | } |
1305 | 1274 | ||
@@ -1330,9 +1299,9 @@ lpfc_device_rm_prli_issue(struct lpfc_hba * phba, | |||
1330 | } | 1299 | } |
1331 | else { | 1300 | else { |
1332 | /* software abort outstanding PLOGI */ | 1301 | /* software abort outstanding PLOGI */ |
1333 | lpfc_els_abort(phba, ndlp, 1); | 1302 | lpfc_els_abort(phba, ndlp); |
1334 | 1303 | ||
1335 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1304 | lpfc_drop_node(phba, ndlp); |
1336 | return NLP_STE_FREED_NODE; | 1305 | return NLP_STE_FREED_NODE; |
1337 | } | 1306 | } |
1338 | } | 1307 | } |
@@ -1359,11 +1328,10 @@ lpfc_device_recov_prli_issue(struct lpfc_hba * phba, | |||
1359 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) | 1328 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) |
1360 | { | 1329 | { |
1361 | /* software abort outstanding PRLI */ | 1330 | /* software abort outstanding PRLI */ |
1362 | lpfc_els_abort(phba, ndlp, 1); | 1331 | lpfc_els_abort(phba, ndlp); |
1363 | 1332 | ||
1364 | ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; | 1333 | ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; |
1365 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1334 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1366 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1367 | spin_lock_irq(phba->host->host_lock); | 1335 | spin_lock_irq(phba->host->host_lock); |
1368 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); | 1336 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
1369 | spin_unlock_irq(phba->host->host_lock); | 1337 | spin_unlock_irq(phba->host->host_lock); |
@@ -1436,8 +1404,7 @@ lpfc_device_recov_unmap_node(struct lpfc_hba * phba, | |||
1436 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) | 1404 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) |
1437 | { | 1405 | { |
1438 | ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE; | 1406 | ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE; |
1439 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1407 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1440 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1441 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); | 1408 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
1442 | lpfc_disc_set_adisc(phba, ndlp); | 1409 | lpfc_disc_set_adisc(phba, ndlp); |
1443 | 1410 | ||
@@ -1518,8 +1485,7 @@ lpfc_device_recov_mapped_node(struct lpfc_hba * phba, | |||
1518 | uint32_t evt) | 1485 | uint32_t evt) |
1519 | { | 1486 | { |
1520 | ndlp->nlp_prev_state = NLP_STE_MAPPED_NODE; | 1487 | ndlp->nlp_prev_state = NLP_STE_MAPPED_NODE; |
1521 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1488 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1522 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1523 | spin_lock_irq(phba->host->host_lock); | 1489 | spin_lock_irq(phba->host->host_lock); |
1524 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); | 1490 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
1525 | spin_unlock_irq(phba->host->host_lock); | 1491 | spin_unlock_irq(phba->host->host_lock); |
@@ -1551,8 +1517,7 @@ lpfc_rcv_plogi_npr_node(struct lpfc_hba * phba, | |||
1551 | /* send PLOGI immediately, move to PLOGI issue state */ | 1517 | /* send PLOGI immediately, move to PLOGI issue state */ |
1552 | if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { | 1518 | if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { |
1553 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; | 1519 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; |
1554 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 1520 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
1555 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
1556 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); | 1521 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); |
1557 | } | 1522 | } |
1558 | 1523 | ||
@@ -1580,16 +1545,13 @@ lpfc_rcv_prli_npr_node(struct lpfc_hba * phba, | |||
1580 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; | 1545 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; |
1581 | spin_unlock_irq(phba->host->host_lock); | 1546 | spin_unlock_irq(phba->host->host_lock); |
1582 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; | 1547 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; |
1583 | ndlp->nlp_state = NLP_STE_ADISC_ISSUE; | 1548 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE); |
1584 | lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST); | ||
1585 | lpfc_issue_els_adisc(phba, ndlp, 0); | 1549 | lpfc_issue_els_adisc(phba, ndlp, 0); |
1586 | } else { | 1550 | } else { |
1587 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; | 1551 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; |
1588 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 1552 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
1589 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
1590 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); | 1553 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); |
1591 | } | 1554 | } |
1592 | |||
1593 | } | 1555 | } |
1594 | return ndlp->nlp_state; | 1556 | return ndlp->nlp_state; |
1595 | } | 1557 | } |
@@ -1627,13 +1589,11 @@ lpfc_rcv_padisc_npr_node(struct lpfc_hba * phba, | |||
1627 | !(ndlp->nlp_flag & NLP_NPR_2B_DISC)){ | 1589 | !(ndlp->nlp_flag & NLP_NPR_2B_DISC)){ |
1628 | if (ndlp->nlp_flag & NLP_NPR_ADISC) { | 1590 | if (ndlp->nlp_flag & NLP_NPR_ADISC) { |
1629 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; | 1591 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; |
1630 | ndlp->nlp_state = NLP_STE_ADISC_ISSUE; | 1592 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE); |
1631 | lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST); | ||
1632 | lpfc_issue_els_adisc(phba, ndlp, 0); | 1593 | lpfc_issue_els_adisc(phba, ndlp, 0); |
1633 | } else { | 1594 | } else { |
1634 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; | 1595 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; |
1635 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 1596 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
1636 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
1637 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); | 1597 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); |
1638 | } | 1598 | } |
1639 | } | 1599 | } |
@@ -1682,7 +1642,7 @@ lpfc_cmpl_plogi_npr_node(struct lpfc_hba * phba, | |||
1682 | 1642 | ||
1683 | irsp = &rspiocb->iocb; | 1643 | irsp = &rspiocb->iocb; |
1684 | if (irsp->ulpStatus) { | 1644 | if (irsp->ulpStatus) { |
1685 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1645 | lpfc_drop_node(phba, ndlp); |
1686 | return NLP_STE_FREED_NODE; | 1646 | return NLP_STE_FREED_NODE; |
1687 | } | 1647 | } |
1688 | return ndlp->nlp_state; | 1648 | return ndlp->nlp_state; |
@@ -1700,7 +1660,7 @@ lpfc_cmpl_prli_npr_node(struct lpfc_hba * phba, | |||
1700 | 1660 | ||
1701 | irsp = &rspiocb->iocb; | 1661 | irsp = &rspiocb->iocb; |
1702 | if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { | 1662 | if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { |
1703 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1663 | lpfc_drop_node(phba, ndlp); |
1704 | return NLP_STE_FREED_NODE; | 1664 | return NLP_STE_FREED_NODE; |
1705 | } | 1665 | } |
1706 | return ndlp->nlp_state; | 1666 | return ndlp->nlp_state; |
@@ -1728,7 +1688,7 @@ lpfc_cmpl_adisc_npr_node(struct lpfc_hba * phba, | |||
1728 | 1688 | ||
1729 | irsp = &rspiocb->iocb; | 1689 | irsp = &rspiocb->iocb; |
1730 | if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { | 1690 | if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { |
1731 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1691 | lpfc_drop_node(phba, ndlp); |
1732 | return NLP_STE_FREED_NODE; | 1692 | return NLP_STE_FREED_NODE; |
1733 | } | 1693 | } |
1734 | return ndlp->nlp_state; | 1694 | return ndlp->nlp_state; |
@@ -1749,7 +1709,7 @@ lpfc_cmpl_reglogin_npr_node(struct lpfc_hba * phba, | |||
1749 | ndlp->nlp_rpi = mb->un.varWords[0]; | 1709 | ndlp->nlp_rpi = mb->un.varWords[0]; |
1750 | else { | 1710 | else { |
1751 | if (ndlp->nlp_flag & NLP_NODEV_REMOVE) { | 1711 | if (ndlp->nlp_flag & NLP_NODEV_REMOVE) { |
1752 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1712 | lpfc_drop_node(phba, ndlp); |
1753 | return NLP_STE_FREED_NODE; | 1713 | return NLP_STE_FREED_NODE; |
1754 | } | 1714 | } |
1755 | } | 1715 | } |
@@ -1765,7 +1725,7 @@ lpfc_device_rm_npr_node(struct lpfc_hba * phba, | |||
1765 | ndlp->nlp_flag |= NLP_NODEV_REMOVE; | 1725 | ndlp->nlp_flag |= NLP_NODEV_REMOVE; |
1766 | return ndlp->nlp_state; | 1726 | return ndlp->nlp_state; |
1767 | } | 1727 | } |
1768 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1728 | lpfc_drop_node(phba, ndlp); |
1769 | return NLP_STE_FREED_NODE; | 1729 | return NLP_STE_FREED_NODE; |
1770 | } | 1730 | } |
1771 | 1731 | ||
@@ -1964,7 +1924,7 @@ lpfc_disc_state_machine(struct lpfc_hba * phba, | |||
1964 | uint32_t(*func) (struct lpfc_hba *, struct lpfc_nodelist *, void *, | 1924 | uint32_t(*func) (struct lpfc_hba *, struct lpfc_nodelist *, void *, |
1965 | uint32_t); | 1925 | uint32_t); |
1966 | 1926 | ||
1967 | ndlp->nlp_disc_refcnt++; | 1927 | lpfc_nlp_get(ndlp); |
1968 | cur_state = ndlp->nlp_state; | 1928 | cur_state = ndlp->nlp_state; |
1969 | 1929 | ||
1970 | /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ | 1930 | /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ |
@@ -1987,18 +1947,7 @@ lpfc_disc_state_machine(struct lpfc_hba * phba, | |||
1987 | phba->brd_no, | 1947 | phba->brd_no, |
1988 | rc, ndlp->nlp_DID, ndlp->nlp_flag); | 1948 | rc, ndlp->nlp_DID, ndlp->nlp_flag); |
1989 | 1949 | ||
1990 | ndlp->nlp_disc_refcnt--; | 1950 | lpfc_nlp_put(ndlp); |
1991 | 1951 | ||
1992 | /* Check to see if ndlp removal is deferred */ | ||
1993 | if ((ndlp->nlp_disc_refcnt == 0) | ||
1994 | && (ndlp->nlp_flag & NLP_DELAY_REMOVE)) { | ||
1995 | spin_lock_irq(phba->host->host_lock); | ||
1996 | ndlp->nlp_flag &= ~NLP_DELAY_REMOVE; | ||
1997 | spin_unlock_irq(phba->host->host_lock); | ||
1998 | lpfc_nlp_remove(phba, ndlp); | ||
1999 | return NLP_STE_FREED_NODE; | ||
2000 | } | ||
2001 | if (rc == NLP_STE_FREED_NODE) | ||
2002 | return NLP_STE_FREED_NODE; | ||
2003 | return rc; | 1952 | return rc; |
2004 | } | 1953 | } |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index c3e68e0d8f74..9a12d05e99e4 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -146,6 +146,10 @@ lpfc_get_scsi_buf(struct lpfc_hba * phba) | |||
146 | 146 | ||
147 | spin_lock_irqsave(&phba->scsi_buf_list_lock, iflag); | 147 | spin_lock_irqsave(&phba->scsi_buf_list_lock, iflag); |
148 | list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list); | 148 | list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list); |
149 | if (lpfc_cmd) { | ||
150 | lpfc_cmd->seg_cnt = 0; | ||
151 | lpfc_cmd->nonsg_phys = 0; | ||
152 | } | ||
149 | spin_unlock_irqrestore(&phba->scsi_buf_list_lock, iflag); | 153 | spin_unlock_irqrestore(&phba->scsi_buf_list_lock, iflag); |
150 | return lpfc_cmd; | 154 | return lpfc_cmd; |
151 | } | 155 | } |
@@ -288,13 +292,13 @@ lpfc_scsi_unprep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb) | |||
288 | } | 292 | } |
289 | 293 | ||
290 | static void | 294 | static void |
291 | lpfc_handle_fcp_err(struct lpfc_scsi_buf *lpfc_cmd) | 295 | lpfc_handle_fcp_err(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_iocbq *rsp_iocb) |
292 | { | 296 | { |
293 | struct scsi_cmnd *cmnd = lpfc_cmd->pCmd; | 297 | struct scsi_cmnd *cmnd = lpfc_cmd->pCmd; |
294 | struct fcp_cmnd *fcpcmd = lpfc_cmd->fcp_cmnd; | 298 | struct fcp_cmnd *fcpcmd = lpfc_cmd->fcp_cmnd; |
295 | struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp; | 299 | struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp; |
296 | struct lpfc_hba *phba = lpfc_cmd->scsi_hba; | 300 | struct lpfc_hba *phba = lpfc_cmd->scsi_hba; |
297 | uint32_t fcpi_parm = lpfc_cmd->cur_iocbq.iocb.un.fcpi.fcpi_parm; | 301 | uint32_t fcpi_parm = rsp_iocb->iocb.un.fcpi.fcpi_parm; |
298 | uint32_t resp_info = fcprsp->rspStatus2; | 302 | uint32_t resp_info = fcprsp->rspStatus2; |
299 | uint32_t scsi_status = fcprsp->rspStatus3; | 303 | uint32_t scsi_status = fcprsp->rspStatus3; |
300 | uint32_t *lp; | 304 | uint32_t *lp; |
@@ -356,6 +360,24 @@ lpfc_handle_fcp_err(struct lpfc_scsi_buf *lpfc_cmd) | |||
356 | fcpi_parm, cmnd->cmnd[0], cmnd->underflow); | 360 | fcpi_parm, cmnd->cmnd[0], cmnd->underflow); |
357 | 361 | ||
358 | /* | 362 | /* |
363 | * If there is an under run check if under run reported by | ||
364 | * storage array is same as the under run reported by HBA. | ||
365 | * If this is not same, there is a dropped frame. | ||
366 | */ | ||
367 | if ((cmnd->sc_data_direction == DMA_FROM_DEVICE) && | ||
368 | fcpi_parm && | ||
369 | (cmnd->resid != fcpi_parm)) { | ||
370 | lpfc_printf_log(phba, KERN_WARNING, | ||
371 | LOG_FCP | LOG_FCP_ERROR, | ||
372 | "%d:0735 FCP Read Check Error and Underrun " | ||
373 | "Data: x%x x%x x%x x%x\n", phba->brd_no, | ||
374 | be32_to_cpu(fcpcmd->fcpDl), | ||
375 | cmnd->resid, | ||
376 | fcpi_parm, cmnd->cmnd[0]); | ||
377 | cmnd->resid = cmnd->request_bufflen; | ||
378 | host_status = DID_ERROR; | ||
379 | } | ||
380 | /* | ||
359 | * The cmnd->underflow is the minimum number of bytes that must | 381 | * The cmnd->underflow is the minimum number of bytes that must |
360 | * be transfered for this command. Provided a sense condition | 382 | * be transfered for this command. Provided a sense condition |
361 | * is not present, make sure the actual amount transferred is at | 383 | * is not present, make sure the actual amount transferred is at |
@@ -435,7 +457,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
435 | switch (lpfc_cmd->status) { | 457 | switch (lpfc_cmd->status) { |
436 | case IOSTAT_FCP_RSP_ERROR: | 458 | case IOSTAT_FCP_RSP_ERROR: |
437 | /* Call FCP RSP handler to determine result */ | 459 | /* Call FCP RSP handler to determine result */ |
438 | lpfc_handle_fcp_err(lpfc_cmd); | 460 | lpfc_handle_fcp_err(lpfc_cmd,pIocbOut); |
439 | break; | 461 | break; |
440 | case IOSTAT_NPORT_BSY: | 462 | case IOSTAT_NPORT_BSY: |
441 | case IOSTAT_FABRIC_BSY: | 463 | case IOSTAT_FABRIC_BSY: |
@@ -466,10 +488,10 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
466 | 488 | ||
467 | result = cmd->result; | 489 | result = cmd->result; |
468 | sdev = cmd->device; | 490 | sdev = cmd->device; |
491 | lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); | ||
469 | cmd->scsi_done(cmd); | 492 | cmd->scsi_done(cmd); |
470 | 493 | ||
471 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { | 494 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { |
472 | lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); | ||
473 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 495 | lpfc_release_scsi_buf(phba, lpfc_cmd); |
474 | return; | 496 | return; |
475 | } | 497 | } |
@@ -527,7 +549,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
527 | } | 549 | } |
528 | } | 550 | } |
529 | 551 | ||
530 | lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); | ||
531 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 552 | lpfc_release_scsi_buf(phba, lpfc_cmd); |
532 | } | 553 | } |
533 | 554 | ||
@@ -670,6 +691,18 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba, | |||
670 | return (1); | 691 | return (1); |
671 | } | 692 | } |
672 | 693 | ||
694 | static void | ||
695 | lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba, | ||
696 | struct lpfc_iocbq *cmdiocbq, | ||
697 | struct lpfc_iocbq *rspiocbq) | ||
698 | { | ||
699 | struct lpfc_scsi_buf *lpfc_cmd = | ||
700 | (struct lpfc_scsi_buf *) cmdiocbq->context1; | ||
701 | if (lpfc_cmd) | ||
702 | lpfc_release_scsi_buf(phba, lpfc_cmd); | ||
703 | return; | ||
704 | } | ||
705 | |||
673 | static int | 706 | static int |
674 | lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba, | 707 | lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba, |
675 | unsigned tgt_id, unsigned int lun, | 708 | unsigned tgt_id, unsigned int lun, |
@@ -706,8 +739,9 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba, | |||
706 | &phba->sli.ring[phba->sli.fcp_ring], | 739 | &phba->sli.ring[phba->sli.fcp_ring], |
707 | iocbq, iocbqrsp, lpfc_cmd->timeout); | 740 | iocbq, iocbqrsp, lpfc_cmd->timeout); |
708 | if (ret != IOCB_SUCCESS) { | 741 | if (ret != IOCB_SUCCESS) { |
742 | if (ret == IOCB_TIMEDOUT) | ||
743 | iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl; | ||
709 | lpfc_cmd->status = IOSTAT_DRIVER_REJECT; | 744 | lpfc_cmd->status = IOSTAT_DRIVER_REJECT; |
710 | ret = FAILED; | ||
711 | } else { | 745 | } else { |
712 | ret = SUCCESS; | 746 | ret = SUCCESS; |
713 | lpfc_cmd->result = iocbqrsp->iocb.un.ulpWord[4]; | 747 | lpfc_cmd->result = iocbqrsp->iocb.un.ulpWord[4]; |
@@ -974,7 +1008,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
974 | } | 1008 | } |
975 | 1009 | ||
976 | static int | 1010 | static int |
977 | lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | 1011 | lpfc_device_reset_handler(struct scsi_cmnd *cmnd) |
978 | { | 1012 | { |
979 | struct Scsi_Host *shost = cmnd->device->host; | 1013 | struct Scsi_Host *shost = cmnd->device->host; |
980 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata; | 1014 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata; |
@@ -984,6 +1018,7 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
984 | struct lpfc_nodelist *pnode = rdata->pnode; | 1018 | struct lpfc_nodelist *pnode = rdata->pnode; |
985 | uint32_t cmd_result = 0, cmd_status = 0; | 1019 | uint32_t cmd_result = 0, cmd_status = 0; |
986 | int ret = FAILED; | 1020 | int ret = FAILED; |
1021 | int iocb_status = IOCB_SUCCESS; | ||
987 | int cnt, loopcnt; | 1022 | int cnt, loopcnt; |
988 | 1023 | ||
989 | lpfc_block_error_handler(cmnd); | 1024 | lpfc_block_error_handler(cmnd); |
@@ -995,7 +1030,7 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
995 | */ | 1030 | */ |
996 | while ( 1 ) { | 1031 | while ( 1 ) { |
997 | if (!pnode) | 1032 | if (!pnode) |
998 | return FAILED; | 1033 | goto out; |
999 | 1034 | ||
1000 | if (pnode->nlp_state != NLP_STE_MAPPED_NODE) { | 1035 | if (pnode->nlp_state != NLP_STE_MAPPED_NODE) { |
1001 | spin_unlock_irq(phba->host->host_lock); | 1036 | spin_unlock_irq(phba->host->host_lock); |
@@ -1013,7 +1048,7 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
1013 | } | 1048 | } |
1014 | pnode = rdata->pnode; | 1049 | pnode = rdata->pnode; |
1015 | if (!pnode) | 1050 | if (!pnode) |
1016 | return FAILED; | 1051 | goto out; |
1017 | } | 1052 | } |
1018 | if (pnode->nlp_state == NLP_STE_MAPPED_NODE) | 1053 | if (pnode->nlp_state == NLP_STE_MAPPED_NODE) |
1019 | break; | 1054 | break; |
@@ -1028,7 +1063,7 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
1028 | lpfc_cmd->rdata = rdata; | 1063 | lpfc_cmd->rdata = rdata; |
1029 | 1064 | ||
1030 | ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, cmnd->device->lun, | 1065 | ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, cmnd->device->lun, |
1031 | FCP_LUN_RESET); | 1066 | FCP_TARGET_RESET); |
1032 | if (!ret) | 1067 | if (!ret) |
1033 | goto out_free_scsi_buf; | 1068 | goto out_free_scsi_buf; |
1034 | 1069 | ||
@@ -1040,16 +1075,21 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
1040 | goto out_free_scsi_buf; | 1075 | goto out_free_scsi_buf; |
1041 | 1076 | ||
1042 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | 1077 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, |
1043 | "%d:0703 Issue LUN Reset to TGT %d LUN %d " | 1078 | "%d:0703 Issue target reset to TGT %d LUN %d rpi x%x " |
1044 | "Data: x%x x%x\n", phba->brd_no, cmnd->device->id, | 1079 | "nlp_flag x%x\n", phba->brd_no, cmnd->device->id, |
1045 | cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag); | 1080 | cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag); |
1046 | 1081 | ||
1047 | ret = lpfc_sli_issue_iocb_wait(phba, | 1082 | iocb_status = lpfc_sli_issue_iocb_wait(phba, |
1048 | &phba->sli.ring[phba->sli.fcp_ring], | 1083 | &phba->sli.ring[phba->sli.fcp_ring], |
1049 | iocbq, iocbqrsp, lpfc_cmd->timeout); | 1084 | iocbq, iocbqrsp, lpfc_cmd->timeout); |
1050 | if (ret == IOCB_SUCCESS) | ||
1051 | ret = SUCCESS; | ||
1052 | 1085 | ||
1086 | if (iocb_status == IOCB_TIMEDOUT) | ||
1087 | iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl; | ||
1088 | |||
1089 | if (iocb_status == IOCB_SUCCESS) | ||
1090 | ret = SUCCESS; | ||
1091 | else | ||
1092 | ret = iocb_status; | ||
1053 | 1093 | ||
1054 | cmd_result = iocbqrsp->iocb.un.ulpWord[4]; | 1094 | cmd_result = iocbqrsp->iocb.un.ulpWord[4]; |
1055 | cmd_status = iocbqrsp->iocb.ulpStatus; | 1095 | cmd_status = iocbqrsp->iocb.ulpStatus; |
@@ -1087,18 +1127,19 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
1087 | 1127 | ||
1088 | if (cnt) { | 1128 | if (cnt) { |
1089 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1129 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
1090 | "%d:0719 LUN Reset I/O flush failure: cnt x%x\n", | 1130 | "%d:0719 device reset I/O flush failure: cnt x%x\n", |
1091 | phba->brd_no, cnt); | 1131 | phba->brd_no, cnt); |
1092 | ret = FAILED; | 1132 | ret = FAILED; |
1093 | } | 1133 | } |
1094 | 1134 | ||
1095 | out_free_scsi_buf: | 1135 | out_free_scsi_buf: |
1096 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 1136 | if (iocb_status != IOCB_TIMEDOUT) { |
1097 | 1137 | lpfc_release_scsi_buf(phba, lpfc_cmd); | |
1138 | } | ||
1098 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1139 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
1099 | "%d:0713 SCSI layer issued LUN reset (%d, %d) " | 1140 | "%d:0713 SCSI layer issued device reset (%d, %d) " |
1100 | "Data: x%x x%x x%x\n", | 1141 | "return x%x status x%x result x%x\n", |
1101 | phba->brd_no, cmnd->device->id,cmnd->device->lun, | 1142 | phba->brd_no, cmnd->device->id, cmnd->device->lun, |
1102 | ret, cmd_status, cmd_result); | 1143 | ret, cmd_status, cmd_result); |
1103 | 1144 | ||
1104 | out: | 1145 | out: |
@@ -1107,7 +1148,7 @@ out: | |||
1107 | } | 1148 | } |
1108 | 1149 | ||
1109 | static int | 1150 | static int |
1110 | lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | 1151 | lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) |
1111 | { | 1152 | { |
1112 | struct Scsi_Host *shost = cmnd->device->host; | 1153 | struct Scsi_Host *shost = cmnd->device->host; |
1113 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata; | 1154 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata; |
@@ -1134,10 +1175,12 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
1134 | * fail, this routine returns failure to the midlayer. | 1175 | * fail, this routine returns failure to the midlayer. |
1135 | */ | 1176 | */ |
1136 | for (i = 0; i < LPFC_MAX_TARGET; i++) { | 1177 | for (i = 0; i < LPFC_MAX_TARGET; i++) { |
1137 | /* Search the mapped list for this target ID */ | 1178 | /* Search for mapped node by target ID */ |
1138 | match = 0; | 1179 | match = 0; |
1139 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { | 1180 | list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) { |
1140 | if ((i == ndlp->nlp_sid) && ndlp->rport) { | 1181 | if (ndlp->nlp_state == NLP_STE_MAPPED_NODE && |
1182 | i == ndlp->nlp_sid && | ||
1183 | ndlp->rport) { | ||
1141 | match = 1; | 1184 | match = 1; |
1142 | break; | 1185 | break; |
1143 | } | 1186 | } |
@@ -1152,13 +1195,17 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
1152 | "%d:0700 Bus Reset on target %d failed\n", | 1195 | "%d:0700 Bus Reset on target %d failed\n", |
1153 | phba->brd_no, i); | 1196 | phba->brd_no, i); |
1154 | err_count++; | 1197 | err_count++; |
1198 | break; | ||
1155 | } | 1199 | } |
1156 | } | 1200 | } |
1157 | 1201 | ||
1202 | if (ret != IOCB_TIMEDOUT) | ||
1203 | lpfc_release_scsi_buf(phba, lpfc_cmd); | ||
1204 | |||
1158 | if (err_count == 0) | 1205 | if (err_count == 0) |
1159 | ret = SUCCESS; | 1206 | ret = SUCCESS; |
1160 | 1207 | else | |
1161 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 1208 | ret = FAILED; |
1162 | 1209 | ||
1163 | /* | 1210 | /* |
1164 | * All outstanding txcmplq I/Os should have been aborted by | 1211 | * All outstanding txcmplq I/Os should have been aborted by |
@@ -1299,11 +1346,13 @@ struct scsi_host_template lpfc_template = { | |||
1299 | .info = lpfc_info, | 1346 | .info = lpfc_info, |
1300 | .queuecommand = lpfc_queuecommand, | 1347 | .queuecommand = lpfc_queuecommand, |
1301 | .eh_abort_handler = lpfc_abort_handler, | 1348 | .eh_abort_handler = lpfc_abort_handler, |
1302 | .eh_device_reset_handler= lpfc_reset_lun_handler, | 1349 | .eh_device_reset_handler= lpfc_device_reset_handler, |
1303 | .eh_bus_reset_handler = lpfc_reset_bus_handler, | 1350 | .eh_bus_reset_handler = lpfc_bus_reset_handler, |
1304 | .slave_alloc = lpfc_slave_alloc, | 1351 | .slave_alloc = lpfc_slave_alloc, |
1305 | .slave_configure = lpfc_slave_configure, | 1352 | .slave_configure = lpfc_slave_configure, |
1306 | .slave_destroy = lpfc_slave_destroy, | 1353 | .slave_destroy = lpfc_slave_destroy, |
1354 | .scan_finished = lpfc_scan_finished, | ||
1355 | .scan_start = lpfc_scan_start, | ||
1307 | .this_id = -1, | 1356 | .this_id = -1, |
1308 | .sg_tablesize = LPFC_SG_SEG_CNT, | 1357 | .sg_tablesize = LPFC_SG_SEG_CNT, |
1309 | .cmd_per_lun = LPFC_CMD_PER_LUN, | 1358 | .cmd_per_lun = LPFC_CMD_PER_LUN, |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 9fb6960a8ada..a1e721459e2b 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -528,6 +528,7 @@ lpfc_sli_wake_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) | |||
528 | * If pdone_q is empty, the driver thread gave up waiting and | 528 | * If pdone_q is empty, the driver thread gave up waiting and |
529 | * continued running. | 529 | * continued running. |
530 | */ | 530 | */ |
531 | pmboxq->mbox_flag |= LPFC_MBX_WAKE; | ||
531 | pdone_q = (wait_queue_head_t *) pmboxq->context1; | 532 | pdone_q = (wait_queue_head_t *) pmboxq->context1; |
532 | if (pdone_q) | 533 | if (pdone_q) |
533 | wake_up_interruptible(pdone_q); | 534 | wake_up_interruptible(pdone_q); |
@@ -538,11 +539,32 @@ void | |||
538 | lpfc_sli_def_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | 539 | lpfc_sli_def_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) |
539 | { | 540 | { |
540 | struct lpfc_dmabuf *mp; | 541 | struct lpfc_dmabuf *mp; |
542 | uint16_t rpi; | ||
543 | int rc; | ||
544 | |||
541 | mp = (struct lpfc_dmabuf *) (pmb->context1); | 545 | mp = (struct lpfc_dmabuf *) (pmb->context1); |
546 | |||
542 | if (mp) { | 547 | if (mp) { |
543 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 548 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
544 | kfree(mp); | 549 | kfree(mp); |
545 | } | 550 | } |
551 | |||
552 | /* | ||
553 | * If a REG_LOGIN succeeded after node is destroyed or node | ||
554 | * is in re-discovery driver need to cleanup the RPI. | ||
555 | */ | ||
556 | if (!(phba->fc_flag & FC_UNLOADING) && | ||
557 | (pmb->mb.mbxCommand == MBX_REG_LOGIN64) && | ||
558 | (!pmb->mb.mbxStatus)) { | ||
559 | |||
560 | rpi = pmb->mb.un.varWords[0]; | ||
561 | lpfc_unreg_login(phba, rpi, pmb); | ||
562 | pmb->mbox_cmpl=lpfc_sli_def_mbox_cmpl; | ||
563 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); | ||
564 | if (rc != MBX_NOT_FINISHED) | ||
565 | return; | ||
566 | } | ||
567 | |||
546 | mempool_free( pmb, phba->mbox_mem_pool); | 568 | mempool_free( pmb, phba->mbox_mem_pool); |
547 | return; | 569 | return; |
548 | } | 570 | } |
@@ -693,25 +715,8 @@ lpfc_sli_handle_mb_event(struct lpfc_hba * phba) | |||
693 | } else { | 715 | } else { |
694 | spin_unlock_irq(phba->host->host_lock); | 716 | spin_unlock_irq(phba->host->host_lock); |
695 | /* Turn on IOCB processing */ | 717 | /* Turn on IOCB processing */ |
696 | for (i = 0; i < phba->sli.num_rings; i++) { | 718 | for (i = 0; i < phba->sli.num_rings; i++) |
697 | lpfc_sli_turn_on_ring(phba, i); | 719 | lpfc_sli_turn_on_ring(phba, i); |
698 | } | ||
699 | |||
700 | /* Free any lpfc_dmabuf's waiting for mbox cmd cmpls */ | ||
701 | while (!list_empty(&phba->freebufList)) { | ||
702 | struct lpfc_dmabuf *mp; | ||
703 | |||
704 | mp = NULL; | ||
705 | list_remove_head((&phba->freebufList), | ||
706 | mp, | ||
707 | struct lpfc_dmabuf, | ||
708 | list); | ||
709 | if (mp) { | ||
710 | lpfc_mbuf_free(phba, mp->virt, | ||
711 | mp->phys); | ||
712 | kfree(mp); | ||
713 | } | ||
714 | } | ||
715 | } | 720 | } |
716 | 721 | ||
717 | } while (process_next); | 722 | } while (process_next); |
@@ -833,6 +838,14 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba * phba, struct lpfc_sli_ring * pring, | |||
833 | * All other are passed to the completion callback. | 838 | * All other are passed to the completion callback. |
834 | */ | 839 | */ |
835 | if (pring->ringno == LPFC_ELS_RING) { | 840 | if (pring->ringno == LPFC_ELS_RING) { |
841 | if (cmdiocbp->iocb_flag & LPFC_DRIVER_ABORTED) { | ||
842 | cmdiocbp->iocb_flag &= | ||
843 | ~LPFC_DRIVER_ABORTED; | ||
844 | saveq->iocb.ulpStatus = | ||
845 | IOSTAT_LOCAL_REJECT; | ||
846 | saveq->iocb.un.ulpWord[4] = | ||
847 | IOERR_SLI_ABORTED; | ||
848 | } | ||
836 | spin_unlock_irqrestore(phba->host->host_lock, | 849 | spin_unlock_irqrestore(phba->host->host_lock, |
837 | iflag); | 850 | iflag); |
838 | (cmdiocbp->iocb_cmpl) (phba, cmdiocbp, saveq); | 851 | (cmdiocbp->iocb_cmpl) (phba, cmdiocbp, saveq); |
@@ -1464,8 +1477,9 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba * phba, | |||
1464 | int | 1477 | int |
1465 | lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | 1478 | lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) |
1466 | { | 1479 | { |
1480 | LIST_HEAD(completions); | ||
1467 | struct lpfc_iocbq *iocb, *next_iocb; | 1481 | struct lpfc_iocbq *iocb, *next_iocb; |
1468 | IOCB_t *icmd = NULL, *cmd = NULL; | 1482 | IOCB_t *cmd = NULL; |
1469 | int errcnt; | 1483 | int errcnt; |
1470 | 1484 | ||
1471 | errcnt = 0; | 1485 | errcnt = 0; |
@@ -1474,46 +1488,28 @@ lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
1474 | * First do the txq. | 1488 | * First do the txq. |
1475 | */ | 1489 | */ |
1476 | spin_lock_irq(phba->host->host_lock); | 1490 | spin_lock_irq(phba->host->host_lock); |
1477 | list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) { | 1491 | list_splice_init(&pring->txq, &completions); |
1478 | list_del_init(&iocb->list); | ||
1479 | if (iocb->iocb_cmpl) { | ||
1480 | icmd = &iocb->iocb; | ||
1481 | icmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
1482 | icmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
1483 | spin_unlock_irq(phba->host->host_lock); | ||
1484 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
1485 | spin_lock_irq(phba->host->host_lock); | ||
1486 | } else | ||
1487 | lpfc_sli_release_iocbq(phba, iocb); | ||
1488 | } | ||
1489 | pring->txq_cnt = 0; | 1492 | pring->txq_cnt = 0; |
1490 | INIT_LIST_HEAD(&(pring->txq)); | ||
1491 | 1493 | ||
1492 | /* Next issue ABTS for everything on the txcmplq */ | 1494 | /* Next issue ABTS for everything on the txcmplq */ |
1493 | list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) { | 1495 | list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) |
1494 | cmd = &iocb->iocb; | 1496 | lpfc_sli_issue_abort_iotag(phba, pring, iocb); |
1495 | 1497 | ||
1496 | /* | 1498 | spin_unlock_irq(phba->host->host_lock); |
1497 | * Imediate abort of IOCB, deque and call compl | ||
1498 | */ | ||
1499 | 1499 | ||
1500 | list_del_init(&iocb->list); | 1500 | while (!list_empty(&completions)) { |
1501 | pring->txcmplq_cnt--; | 1501 | iocb = list_get_first(&completions, struct lpfc_iocbq, list); |
1502 | cmd = &iocb->iocb; | ||
1503 | list_del(&iocb->list); | ||
1502 | 1504 | ||
1503 | if (iocb->iocb_cmpl) { | 1505 | if (iocb->iocb_cmpl) { |
1504 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | 1506 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; |
1505 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | 1507 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; |
1506 | spin_unlock_irq(phba->host->host_lock); | ||
1507 | (iocb->iocb_cmpl) (phba, iocb, iocb); | 1508 | (iocb->iocb_cmpl) (phba, iocb, iocb); |
1508 | spin_lock_irq(phba->host->host_lock); | ||
1509 | } else | 1509 | } else |
1510 | lpfc_sli_release_iocbq(phba, iocb); | 1510 | lpfc_sli_release_iocbq(phba, iocb); |
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | INIT_LIST_HEAD(&pring->txcmplq); | ||
1514 | pring->txcmplq_cnt = 0; | ||
1515 | spin_unlock_irq(phba->host->host_lock); | ||
1516 | |||
1517 | return errcnt; | 1513 | return errcnt; |
1518 | } | 1514 | } |
1519 | 1515 | ||
@@ -1588,6 +1584,7 @@ void lpfc_reset_barrier(struct lpfc_hba * phba) | |||
1588 | hc_copy = readl(phba->HCregaddr); | 1584 | hc_copy = readl(phba->HCregaddr); |
1589 | writel((hc_copy & ~HC_ERINT_ENA), phba->HCregaddr); | 1585 | writel((hc_copy & ~HC_ERINT_ENA), phba->HCregaddr); |
1590 | readl(phba->HCregaddr); /* flush */ | 1586 | readl(phba->HCregaddr); /* flush */ |
1587 | phba->fc_flag |= FC_IGNORE_ERATT; | ||
1591 | 1588 | ||
1592 | if (readl(phba->HAregaddr) & HA_ERATT) { | 1589 | if (readl(phba->HAregaddr) & HA_ERATT) { |
1593 | /* Clear Chip error bit */ | 1590 | /* Clear Chip error bit */ |
@@ -1630,6 +1627,7 @@ clear_errat: | |||
1630 | } | 1627 | } |
1631 | 1628 | ||
1632 | restore_hc: | 1629 | restore_hc: |
1630 | phba->fc_flag &= ~FC_IGNORE_ERATT; | ||
1633 | writel(hc_copy, phba->HCregaddr); | 1631 | writel(hc_copy, phba->HCregaddr); |
1634 | readl(phba->HCregaddr); /* flush */ | 1632 | readl(phba->HCregaddr); /* flush */ |
1635 | } | 1633 | } |
@@ -1665,6 +1663,7 @@ lpfc_sli_brdkill(struct lpfc_hba * phba) | |||
1665 | status &= ~HC_ERINT_ENA; | 1663 | status &= ~HC_ERINT_ENA; |
1666 | writel(status, phba->HCregaddr); | 1664 | writel(status, phba->HCregaddr); |
1667 | readl(phba->HCregaddr); /* flush */ | 1665 | readl(phba->HCregaddr); /* flush */ |
1666 | phba->fc_flag |= FC_IGNORE_ERATT; | ||
1668 | spin_unlock_irq(phba->host->host_lock); | 1667 | spin_unlock_irq(phba->host->host_lock); |
1669 | 1668 | ||
1670 | lpfc_kill_board(phba, pmb); | 1669 | lpfc_kill_board(phba, pmb); |
@@ -1674,6 +1673,9 @@ lpfc_sli_brdkill(struct lpfc_hba * phba) | |||
1674 | if (retval != MBX_SUCCESS) { | 1673 | if (retval != MBX_SUCCESS) { |
1675 | if (retval != MBX_BUSY) | 1674 | if (retval != MBX_BUSY) |
1676 | mempool_free(pmb, phba->mbox_mem_pool); | 1675 | mempool_free(pmb, phba->mbox_mem_pool); |
1676 | spin_lock_irq(phba->host->host_lock); | ||
1677 | phba->fc_flag &= ~FC_IGNORE_ERATT; | ||
1678 | spin_unlock_irq(phba->host->host_lock); | ||
1677 | return 1; | 1679 | return 1; |
1678 | } | 1680 | } |
1679 | 1681 | ||
@@ -1700,6 +1702,7 @@ lpfc_sli_brdkill(struct lpfc_hba * phba) | |||
1700 | } | 1702 | } |
1701 | spin_lock_irq(phba->host->host_lock); | 1703 | spin_lock_irq(phba->host->host_lock); |
1702 | psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; | 1704 | psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; |
1705 | phba->fc_flag &= ~FC_IGNORE_ERATT; | ||
1703 | spin_unlock_irq(phba->host->host_lock); | 1706 | spin_unlock_irq(phba->host->host_lock); |
1704 | 1707 | ||
1705 | psli->mbox_active = NULL; | 1708 | psli->mbox_active = NULL; |
@@ -1985,42 +1988,6 @@ lpfc_sli_hba_setup_exit: | |||
1985 | return rc; | 1988 | return rc; |
1986 | } | 1989 | } |
1987 | 1990 | ||
1988 | static void | ||
1989 | lpfc_mbox_abort(struct lpfc_hba * phba) | ||
1990 | { | ||
1991 | LPFC_MBOXQ_t *pmbox; | ||
1992 | MAILBOX_t *mb; | ||
1993 | |||
1994 | if (phba->sli.mbox_active) { | ||
1995 | del_timer_sync(&phba->sli.mbox_tmo); | ||
1996 | phba->work_hba_events &= ~WORKER_MBOX_TMO; | ||
1997 | pmbox = phba->sli.mbox_active; | ||
1998 | mb = &pmbox->mb; | ||
1999 | phba->sli.mbox_active = NULL; | ||
2000 | if (pmbox->mbox_cmpl) { | ||
2001 | mb->mbxStatus = MBX_NOT_FINISHED; | ||
2002 | (pmbox->mbox_cmpl) (phba, pmbox); | ||
2003 | } | ||
2004 | phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; | ||
2005 | } | ||
2006 | |||
2007 | /* Abort all the non active mailbox commands. */ | ||
2008 | spin_lock_irq(phba->host->host_lock); | ||
2009 | pmbox = lpfc_mbox_get(phba); | ||
2010 | while (pmbox) { | ||
2011 | mb = &pmbox->mb; | ||
2012 | if (pmbox->mbox_cmpl) { | ||
2013 | mb->mbxStatus = MBX_NOT_FINISHED; | ||
2014 | spin_unlock_irq(phba->host->host_lock); | ||
2015 | (pmbox->mbox_cmpl) (phba, pmbox); | ||
2016 | spin_lock_irq(phba->host->host_lock); | ||
2017 | } | ||
2018 | pmbox = lpfc_mbox_get(phba); | ||
2019 | } | ||
2020 | spin_unlock_irq(phba->host->host_lock); | ||
2021 | return; | ||
2022 | } | ||
2023 | |||
2024 | /*! lpfc_mbox_timeout | 1991 | /*! lpfc_mbox_timeout |
2025 | * | 1992 | * |
2026 | * \pre | 1993 | * \pre |
@@ -2055,6 +2022,8 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | |||
2055 | { | 2022 | { |
2056 | LPFC_MBOXQ_t *pmbox; | 2023 | LPFC_MBOXQ_t *pmbox; |
2057 | MAILBOX_t *mb; | 2024 | MAILBOX_t *mb; |
2025 | struct lpfc_sli *psli = &phba->sli; | ||
2026 | struct lpfc_sli_ring *pring; | ||
2058 | 2027 | ||
2059 | spin_lock_irq(phba->host->host_lock); | 2028 | spin_lock_irq(phba->host->host_lock); |
2060 | if (!(phba->work_hba_events & WORKER_MBOX_TMO)) { | 2029 | if (!(phba->work_hba_events & WORKER_MBOX_TMO)) { |
@@ -2062,8 +2031,6 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | |||
2062 | return; | 2031 | return; |
2063 | } | 2032 | } |
2064 | 2033 | ||
2065 | phba->work_hba_events &= ~WORKER_MBOX_TMO; | ||
2066 | |||
2067 | pmbox = phba->sli.mbox_active; | 2034 | pmbox = phba->sli.mbox_active; |
2068 | mb = &pmbox->mb; | 2035 | mb = &pmbox->mb; |
2069 | 2036 | ||
@@ -2078,17 +2045,32 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | |||
2078 | phba->sli.sli_flag, | 2045 | phba->sli.sli_flag, |
2079 | phba->sli.mbox_active); | 2046 | phba->sli.mbox_active); |
2080 | 2047 | ||
2081 | phba->sli.mbox_active = NULL; | 2048 | /* Setting state unknown so lpfc_sli_abort_iocb_ring |
2082 | if (pmbox->mbox_cmpl) { | 2049 | * would get IOCB_ERROR from lpfc_sli_issue_iocb, allowing |
2083 | mb->mbxStatus = MBX_NOT_FINISHED; | 2050 | * it to fail all oustanding SCSI IO. |
2084 | spin_unlock_irq(phba->host->host_lock); | 2051 | */ |
2085 | (pmbox->mbox_cmpl) (phba, pmbox); | 2052 | phba->hba_state = LPFC_STATE_UNKNOWN; |
2086 | spin_lock_irq(phba->host->host_lock); | 2053 | phba->work_hba_events &= ~WORKER_MBOX_TMO; |
2087 | } | 2054 | phba->fc_flag |= FC_ESTABLISH_LINK; |
2088 | phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; | 2055 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; |
2089 | |||
2090 | spin_unlock_irq(phba->host->host_lock); | 2056 | spin_unlock_irq(phba->host->host_lock); |
2091 | lpfc_mbox_abort(phba); | 2057 | |
2058 | pring = &psli->ring[psli->fcp_ring]; | ||
2059 | lpfc_sli_abort_iocb_ring(phba, pring); | ||
2060 | |||
2061 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, | ||
2062 | "%d:0316 Resetting board due to mailbox timeout\n", | ||
2063 | phba->brd_no); | ||
2064 | /* | ||
2065 | * lpfc_offline calls lpfc_sli_hba_down which will clean up | ||
2066 | * on oustanding mailbox commands. | ||
2067 | */ | ||
2068 | lpfc_offline_prep(phba); | ||
2069 | lpfc_offline(phba); | ||
2070 | lpfc_sli_brdrestart(phba); | ||
2071 | if (lpfc_online(phba) == 0) /* Initialize the HBA */ | ||
2072 | mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); | ||
2073 | lpfc_unblock_mgmt_io(phba); | ||
2092 | return; | 2074 | return; |
2093 | } | 2075 | } |
2094 | 2076 | ||
@@ -2320,9 +2302,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag) | |||
2320 | spin_unlock_irqrestore(phba->host->host_lock, | 2302 | spin_unlock_irqrestore(phba->host->host_lock, |
2321 | drvr_flag); | 2303 | drvr_flag); |
2322 | 2304 | ||
2323 | /* Can be in interrupt context, do not sleep */ | 2305 | msleep(1); |
2324 | /* (or might be called with interrupts disabled) */ | ||
2325 | mdelay(1); | ||
2326 | 2306 | ||
2327 | spin_lock_irqsave(phba->host->host_lock, drvr_flag); | 2307 | spin_lock_irqsave(phba->host->host_lock, drvr_flag); |
2328 | 2308 | ||
@@ -2430,7 +2410,7 @@ lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
2430 | 2410 | ||
2431 | if (unlikely(phba->hba_state == LPFC_LINK_DOWN)) { | 2411 | if (unlikely(phba->hba_state == LPFC_LINK_DOWN)) { |
2432 | /* | 2412 | /* |
2433 | * Only CREATE_XRI, CLOSE_XRI, ABORT_XRI, and QUE_RING_BUF | 2413 | * Only CREATE_XRI, CLOSE_XRI, and QUE_RING_BUF |
2434 | * can be issued if the link is not up. | 2414 | * can be issued if the link is not up. |
2435 | */ | 2415 | */ |
2436 | switch (piocb->iocb.ulpCommand) { | 2416 | switch (piocb->iocb.ulpCommand) { |
@@ -2444,6 +2424,8 @@ lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
2444 | piocb->iocb_cmpl = NULL; | 2424 | piocb->iocb_cmpl = NULL; |
2445 | /*FALLTHROUGH*/ | 2425 | /*FALLTHROUGH*/ |
2446 | case CMD_CREATE_XRI_CR: | 2426 | case CMD_CREATE_XRI_CR: |
2427 | case CMD_CLOSE_XRI_CN: | ||
2428 | case CMD_CLOSE_XRI_CX: | ||
2447 | break; | 2429 | break; |
2448 | default: | 2430 | default: |
2449 | goto iocb_busy; | 2431 | goto iocb_busy; |
@@ -2637,11 +2619,12 @@ lpfc_sli_queue_setup(struct lpfc_hba * phba) | |||
2637 | int | 2619 | int |
2638 | lpfc_sli_hba_down(struct lpfc_hba * phba) | 2620 | lpfc_sli_hba_down(struct lpfc_hba * phba) |
2639 | { | 2621 | { |
2622 | LIST_HEAD(completions); | ||
2640 | struct lpfc_sli *psli; | 2623 | struct lpfc_sli *psli; |
2641 | struct lpfc_sli_ring *pring; | 2624 | struct lpfc_sli_ring *pring; |
2642 | LPFC_MBOXQ_t *pmb; | 2625 | LPFC_MBOXQ_t *pmb; |
2643 | struct lpfc_iocbq *iocb, *next_iocb; | 2626 | struct lpfc_iocbq *iocb; |
2644 | IOCB_t *icmd = NULL; | 2627 | IOCB_t *cmd = NULL; |
2645 | int i; | 2628 | int i; |
2646 | unsigned long flags = 0; | 2629 | unsigned long flags = 0; |
2647 | 2630 | ||
@@ -2649,7 +2632,6 @@ lpfc_sli_hba_down(struct lpfc_hba * phba) | |||
2649 | lpfc_hba_down_prep(phba); | 2632 | lpfc_hba_down_prep(phba); |
2650 | 2633 | ||
2651 | spin_lock_irqsave(phba->host->host_lock, flags); | 2634 | spin_lock_irqsave(phba->host->host_lock, flags); |
2652 | |||
2653 | for (i = 0; i < psli->num_rings; i++) { | 2635 | for (i = 0; i < psli->num_rings; i++) { |
2654 | pring = &psli->ring[i]; | 2636 | pring = &psli->ring[i]; |
2655 | pring->flag |= LPFC_DEFERRED_RING_EVENT; | 2637 | pring->flag |= LPFC_DEFERRED_RING_EVENT; |
@@ -2658,28 +2640,25 @@ lpfc_sli_hba_down(struct lpfc_hba * phba) | |||
2658 | * Error everything on the txq since these iocbs have not been | 2640 | * Error everything on the txq since these iocbs have not been |
2659 | * given to the FW yet. | 2641 | * given to the FW yet. |
2660 | */ | 2642 | */ |
2643 | list_splice_init(&pring->txq, &completions); | ||
2661 | pring->txq_cnt = 0; | 2644 | pring->txq_cnt = 0; |
2662 | 2645 | ||
2663 | list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) { | 2646 | } |
2664 | list_del_init(&iocb->list); | 2647 | spin_unlock_irqrestore(phba->host->host_lock, flags); |
2665 | if (iocb->iocb_cmpl) { | ||
2666 | icmd = &iocb->iocb; | ||
2667 | icmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
2668 | icmd->un.ulpWord[4] = IOERR_SLI_DOWN; | ||
2669 | spin_unlock_irqrestore(phba->host->host_lock, | ||
2670 | flags); | ||
2671 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
2672 | spin_lock_irqsave(phba->host->host_lock, flags); | ||
2673 | } else | ||
2674 | lpfc_sli_release_iocbq(phba, iocb); | ||
2675 | } | ||
2676 | 2648 | ||
2677 | INIT_LIST_HEAD(&(pring->txq)); | 2649 | while (!list_empty(&completions)) { |
2650 | iocb = list_get_first(&completions, struct lpfc_iocbq, list); | ||
2651 | cmd = &iocb->iocb; | ||
2652 | list_del(&iocb->list); | ||
2678 | 2653 | ||
2654 | if (iocb->iocb_cmpl) { | ||
2655 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
2656 | cmd->un.ulpWord[4] = IOERR_SLI_DOWN; | ||
2657 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
2658 | } else | ||
2659 | lpfc_sli_release_iocbq(phba, iocb); | ||
2679 | } | 2660 | } |
2680 | 2661 | ||
2681 | spin_unlock_irqrestore(phba->host->host_lock, flags); | ||
2682 | |||
2683 | /* Return any active mbox cmds */ | 2662 | /* Return any active mbox cmds */ |
2684 | del_timer_sync(&psli->mbox_tmo); | 2663 | del_timer_sync(&psli->mbox_tmo); |
2685 | spin_lock_irqsave(phba->host->host_lock, flags); | 2664 | spin_lock_irqsave(phba->host->host_lock, flags); |
@@ -2768,85 +2747,138 @@ lpfc_sli_ringpostbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
2768 | } | 2747 | } |
2769 | 2748 | ||
2770 | static void | 2749 | static void |
2771 | lpfc_sli_abort_elsreq_cmpl(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | 2750 | lpfc_sli_abort_els_cmpl(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, |
2772 | struct lpfc_iocbq * rspiocb) | 2751 | struct lpfc_iocbq * rspiocb) |
2773 | { | 2752 | { |
2774 | struct lpfc_dmabuf *buf_ptr, *buf_ptr1; | 2753 | IOCB_t *irsp; |
2775 | /* Free the resources associated with the ELS_REQUEST64 IOCB the driver | 2754 | uint16_t abort_iotag, abort_context; |
2776 | * just aborted. | 2755 | struct lpfc_iocbq *abort_iocb, *rsp_ab_iocb; |
2777 | * In this case, context2 = cmd, context2->next = rsp, context3 = bpl | 2756 | struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; |
2778 | */ | 2757 | |
2779 | if (cmdiocb->context2) { | 2758 | abort_iocb = NULL; |
2780 | buf_ptr1 = (struct lpfc_dmabuf *) cmdiocb->context2; | 2759 | irsp = &rspiocb->iocb; |
2781 | 2760 | ||
2782 | /* Free the response IOCB before completing the abort | 2761 | spin_lock_irq(phba->host->host_lock); |
2783 | command. */ | ||
2784 | buf_ptr = NULL; | ||
2785 | list_remove_head((&buf_ptr1->list), buf_ptr, | ||
2786 | struct lpfc_dmabuf, list); | ||
2787 | if (buf_ptr) { | ||
2788 | lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); | ||
2789 | kfree(buf_ptr); | ||
2790 | } | ||
2791 | lpfc_mbuf_free(phba, buf_ptr1->virt, buf_ptr1->phys); | ||
2792 | kfree(buf_ptr1); | ||
2793 | } | ||
2794 | 2762 | ||
2795 | if (cmdiocb->context3) { | 2763 | if (irsp->ulpStatus) { |
2796 | buf_ptr = (struct lpfc_dmabuf *) cmdiocb->context3; | 2764 | abort_context = cmdiocb->iocb.un.acxri.abortContextTag; |
2797 | lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); | 2765 | abort_iotag = cmdiocb->iocb.un.acxri.abortIoTag; |
2798 | kfree(buf_ptr); | 2766 | |
2767 | if (abort_iotag != 0 && abort_iotag <= phba->sli.last_iotag) | ||
2768 | abort_iocb = phba->sli.iocbq_lookup[abort_iotag]; | ||
2769 | |||
2770 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
2771 | "%d:0327 Cannot abort els iocb %p" | ||
2772 | " with tag %x context %x\n", | ||
2773 | phba->brd_no, abort_iocb, | ||
2774 | abort_iotag, abort_context); | ||
2775 | |||
2776 | /* | ||
2777 | * make sure we have the right iocbq before taking it | ||
2778 | * off the txcmplq and try to call completion routine. | ||
2779 | */ | ||
2780 | if (abort_iocb && | ||
2781 | abort_iocb->iocb.ulpContext == abort_context && | ||
2782 | abort_iocb->iocb_flag & LPFC_DRIVER_ABORTED) { | ||
2783 | list_del(&abort_iocb->list); | ||
2784 | pring->txcmplq_cnt--; | ||
2785 | |||
2786 | rsp_ab_iocb = lpfc_sli_get_iocbq(phba); | ||
2787 | if (rsp_ab_iocb == NULL) | ||
2788 | lpfc_sli_release_iocbq(phba, abort_iocb); | ||
2789 | else { | ||
2790 | abort_iocb->iocb_flag &= | ||
2791 | ~LPFC_DRIVER_ABORTED; | ||
2792 | rsp_ab_iocb->iocb.ulpStatus = | ||
2793 | IOSTAT_LOCAL_REJECT; | ||
2794 | rsp_ab_iocb->iocb.un.ulpWord[4] = | ||
2795 | IOERR_SLI_ABORTED; | ||
2796 | spin_unlock_irq(phba->host->host_lock); | ||
2797 | (abort_iocb->iocb_cmpl) | ||
2798 | (phba, abort_iocb, rsp_ab_iocb); | ||
2799 | spin_lock_irq(phba->host->host_lock); | ||
2800 | lpfc_sli_release_iocbq(phba, rsp_ab_iocb); | ||
2801 | } | ||
2802 | } | ||
2799 | } | 2803 | } |
2800 | 2804 | ||
2801 | lpfc_sli_release_iocbq(phba, cmdiocb); | 2805 | lpfc_sli_release_iocbq(phba, cmdiocb); |
2806 | spin_unlock_irq(phba->host->host_lock); | ||
2802 | return; | 2807 | return; |
2803 | } | 2808 | } |
2804 | 2809 | ||
2805 | int | 2810 | int |
2806 | lpfc_sli_issue_abort_iotag32(struct lpfc_hba * phba, | 2811 | lpfc_sli_issue_abort_iotag(struct lpfc_hba * phba, |
2807 | struct lpfc_sli_ring * pring, | 2812 | struct lpfc_sli_ring * pring, |
2808 | struct lpfc_iocbq * cmdiocb) | 2813 | struct lpfc_iocbq * cmdiocb) |
2809 | { | 2814 | { |
2810 | struct lpfc_iocbq *abtsiocbp; | 2815 | struct lpfc_iocbq *abtsiocbp; |
2811 | IOCB_t *icmd = NULL; | 2816 | IOCB_t *icmd = NULL; |
2812 | IOCB_t *iabt = NULL; | 2817 | IOCB_t *iabt = NULL; |
2818 | int retval = IOCB_ERROR; | ||
2819 | |||
2820 | /* There are certain command types we don't want | ||
2821 | * to abort. | ||
2822 | */ | ||
2823 | icmd = &cmdiocb->iocb; | ||
2824 | if ((icmd->ulpCommand == CMD_ABORT_XRI_CN) || | ||
2825 | (icmd->ulpCommand == CMD_CLOSE_XRI_CN)) | ||
2826 | return 0; | ||
2827 | |||
2828 | /* If we're unloading, interrupts are disabled so we | ||
2829 | * need to cleanup the iocb here. | ||
2830 | */ | ||
2831 | if (phba->fc_flag & FC_UNLOADING) | ||
2832 | goto abort_iotag_exit; | ||
2813 | 2833 | ||
2814 | /* issue ABTS for this IOCB based on iotag */ | 2834 | /* issue ABTS for this IOCB based on iotag */ |
2815 | abtsiocbp = lpfc_sli_get_iocbq(phba); | 2835 | abtsiocbp = lpfc_sli_get_iocbq(phba); |
2816 | if (abtsiocbp == NULL) | 2836 | if (abtsiocbp == NULL) |
2817 | return 0; | 2837 | return 0; |
2818 | 2838 | ||
2839 | /* This signals the response to set the correct status | ||
2840 | * before calling the completion handler. | ||
2841 | */ | ||
2842 | cmdiocb->iocb_flag |= LPFC_DRIVER_ABORTED; | ||
2843 | |||
2819 | iabt = &abtsiocbp->iocb; | 2844 | iabt = &abtsiocbp->iocb; |
2820 | icmd = &cmdiocb->iocb; | 2845 | iabt->un.acxri.abortType = ABORT_TYPE_ABTS; |
2821 | switch (icmd->ulpCommand) { | 2846 | iabt->un.acxri.abortContextTag = icmd->ulpContext; |
2822 | case CMD_ELS_REQUEST64_CR: | 2847 | iabt->un.acxri.abortIoTag = icmd->ulpIoTag; |
2823 | /* Even though we abort the ELS command, the firmware may access | 2848 | iabt->ulpLe = 1; |
2824 | * the BPL or other resources before it processes our | 2849 | iabt->ulpClass = icmd->ulpClass; |
2825 | * ABORT_MXRI64. Thus we must delay reusing the cmdiocb | ||
2826 | * resources till the actual abort request completes. | ||
2827 | */ | ||
2828 | abtsiocbp->context1 = (void *)((unsigned long)icmd->ulpCommand); | ||
2829 | abtsiocbp->context2 = cmdiocb->context2; | ||
2830 | abtsiocbp->context3 = cmdiocb->context3; | ||
2831 | cmdiocb->context2 = NULL; | ||
2832 | cmdiocb->context3 = NULL; | ||
2833 | abtsiocbp->iocb_cmpl = lpfc_sli_abort_elsreq_cmpl; | ||
2834 | break; | ||
2835 | default: | ||
2836 | lpfc_sli_release_iocbq(phba, abtsiocbp); | ||
2837 | return 0; | ||
2838 | } | ||
2839 | 2850 | ||
2840 | iabt->un.amxri.abortType = ABORT_TYPE_ABTS; | 2851 | if (phba->hba_state >= LPFC_LINK_UP) |
2841 | iabt->un.amxri.iotag32 = icmd->un.elsreq64.bdl.ulpIoTag32; | 2852 | iabt->ulpCommand = CMD_ABORT_XRI_CN; |
2853 | else | ||
2854 | iabt->ulpCommand = CMD_CLOSE_XRI_CN; | ||
2842 | 2855 | ||
2843 | iabt->ulpLe = 1; | 2856 | abtsiocbp->iocb_cmpl = lpfc_sli_abort_els_cmpl; |
2844 | iabt->ulpClass = CLASS3; | ||
2845 | iabt->ulpCommand = CMD_ABORT_MXRI64_CN; | ||
2846 | 2857 | ||
2847 | if (lpfc_sli_issue_iocb(phba, pring, abtsiocbp, 0) == IOCB_ERROR) { | 2858 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
2848 | lpfc_sli_release_iocbq(phba, abtsiocbp); | 2859 | "%d:0339 Abort xri x%x, original iotag x%x, abort " |
2849 | return 0; | 2860 | "cmd iotag x%x\n", |
2861 | phba->brd_no, iabt->un.acxri.abortContextTag, | ||
2862 | iabt->un.acxri.abortIoTag, abtsiocbp->iotag); | ||
2863 | retval = lpfc_sli_issue_iocb(phba, pring, abtsiocbp, 0); | ||
2864 | |||
2865 | abort_iotag_exit: | ||
2866 | |||
2867 | /* If we could not issue an abort dequeue the iocb and handle | ||
2868 | * the completion here. | ||
2869 | */ | ||
2870 | if (retval == IOCB_ERROR) { | ||
2871 | list_del(&cmdiocb->list); | ||
2872 | pring->txcmplq_cnt--; | ||
2873 | |||
2874 | if (cmdiocb->iocb_cmpl) { | ||
2875 | icmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
2876 | icmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
2877 | spin_unlock_irq(phba->host->host_lock); | ||
2878 | (cmdiocb->iocb_cmpl) (phba, cmdiocb, cmdiocb); | ||
2879 | spin_lock_irq(phba->host->host_lock); | ||
2880 | } else | ||
2881 | lpfc_sli_release_iocbq(phba, cmdiocb); | ||
2850 | } | 2882 | } |
2851 | 2883 | ||
2852 | return 1; | 2884 | return 1; |
@@ -2918,9 +2950,11 @@ void | |||
2918 | lpfc_sli_abort_fcp_cmpl(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | 2950 | lpfc_sli_abort_fcp_cmpl(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, |
2919 | struct lpfc_iocbq * rspiocb) | 2951 | struct lpfc_iocbq * rspiocb) |
2920 | { | 2952 | { |
2921 | spin_lock_irq(phba->host->host_lock); | 2953 | unsigned long iflags; |
2954 | |||
2955 | spin_lock_irqsave(phba->host->host_lock, iflags); | ||
2922 | lpfc_sli_release_iocbq(phba, cmdiocb); | 2956 | lpfc_sli_release_iocbq(phba, cmdiocb); |
2923 | spin_unlock_irq(phba->host->host_lock); | 2957 | spin_unlock_irqrestore(phba->host->host_lock, iflags); |
2924 | return; | 2958 | return; |
2925 | } | 2959 | } |
2926 | 2960 | ||
@@ -3043,22 +3077,22 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba * phba, | |||
3043 | timeout_req); | 3077 | timeout_req); |
3044 | spin_lock_irq(phba->host->host_lock); | 3078 | spin_lock_irq(phba->host->host_lock); |
3045 | 3079 | ||
3046 | if (timeleft == 0) { | 3080 | if (piocb->iocb_flag & LPFC_IO_WAKE) { |
3081 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | ||
3082 | "%d:0331 IOCB wake signaled\n", | ||
3083 | phba->brd_no); | ||
3084 | } else if (timeleft == 0) { | ||
3047 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 3085 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
3048 | "%d:0338 IOCB wait timeout error - no " | 3086 | "%d:0338 IOCB wait timeout error - no " |
3049 | "wake response Data x%x\n", | 3087 | "wake response Data x%x\n", |
3050 | phba->brd_no, timeout); | 3088 | phba->brd_no, timeout); |
3051 | retval = IOCB_TIMEDOUT; | 3089 | retval = IOCB_TIMEDOUT; |
3052 | } else if (!(piocb->iocb_flag & LPFC_IO_WAKE)) { | 3090 | } else { |
3053 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 3091 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
3054 | "%d:0330 IOCB wake NOT set, " | 3092 | "%d:0330 IOCB wake NOT set, " |
3055 | "Data x%x x%lx\n", phba->brd_no, | 3093 | "Data x%x x%lx\n", phba->brd_no, |
3056 | timeout, (timeleft / jiffies)); | 3094 | timeout, (timeleft / jiffies)); |
3057 | retval = IOCB_TIMEDOUT; | 3095 | retval = IOCB_TIMEDOUT; |
3058 | } else { | ||
3059 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | ||
3060 | "%d:0331 IOCB wake signaled\n", | ||
3061 | phba->brd_no); | ||
3062 | } | 3096 | } |
3063 | } else { | 3097 | } else { |
3064 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3098 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
@@ -3087,8 +3121,6 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq, | |||
3087 | uint32_t timeout) | 3121 | uint32_t timeout) |
3088 | { | 3122 | { |
3089 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_q); | 3123 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_q); |
3090 | DECLARE_WAITQUEUE(wq_entry, current); | ||
3091 | uint32_t timeleft = 0; | ||
3092 | int retval; | 3124 | int retval; |
3093 | 3125 | ||
3094 | /* The caller must leave context1 empty. */ | 3126 | /* The caller must leave context1 empty. */ |
@@ -3101,27 +3133,25 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq, | |||
3101 | /* setup context field to pass wait_queue pointer to wake function */ | 3133 | /* setup context field to pass wait_queue pointer to wake function */ |
3102 | pmboxq->context1 = &done_q; | 3134 | pmboxq->context1 = &done_q; |
3103 | 3135 | ||
3104 | /* start to sleep before we wait, to avoid races */ | ||
3105 | set_current_state(TASK_INTERRUPTIBLE); | ||
3106 | add_wait_queue(&done_q, &wq_entry); | ||
3107 | |||
3108 | /* now issue the command */ | 3136 | /* now issue the command */ |
3109 | retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); | 3137 | retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); |
3110 | 3138 | ||
3111 | if (retval == MBX_BUSY || retval == MBX_SUCCESS) { | 3139 | if (retval == MBX_BUSY || retval == MBX_SUCCESS) { |
3112 | timeleft = schedule_timeout(timeout * HZ); | 3140 | wait_event_interruptible_timeout(done_q, |
3141 | pmboxq->mbox_flag & LPFC_MBX_WAKE, | ||
3142 | timeout * HZ); | ||
3143 | |||
3113 | pmboxq->context1 = NULL; | 3144 | pmboxq->context1 = NULL; |
3114 | /* if schedule_timeout returns 0, we timed out and were not | 3145 | /* |
3115 | woken up */ | 3146 | * if LPFC_MBX_WAKE flag is set the mailbox is completed |
3116 | if ((timeleft == 0) || signal_pending(current)) | 3147 | * else do not free the resources. |
3117 | retval = MBX_TIMEOUT; | 3148 | */ |
3118 | else | 3149 | if (pmboxq->mbox_flag & LPFC_MBX_WAKE) |
3119 | retval = MBX_SUCCESS; | 3150 | retval = MBX_SUCCESS; |
3151 | else | ||
3152 | retval = MBX_TIMEOUT; | ||
3120 | } | 3153 | } |
3121 | 3154 | ||
3122 | |||
3123 | set_current_state(TASK_RUNNING); | ||
3124 | remove_wait_queue(&done_q, &wq_entry); | ||
3125 | return retval; | 3155 | return retval; |
3126 | } | 3156 | } |
3127 | 3157 | ||
@@ -3184,6 +3214,11 @@ lpfc_intr_handler(int irq, void *dev_id) | |||
3184 | */ | 3214 | */ |
3185 | spin_lock(phba->host->host_lock); | 3215 | spin_lock(phba->host->host_lock); |
3186 | ha_copy = readl(phba->HAregaddr); | 3216 | ha_copy = readl(phba->HAregaddr); |
3217 | /* If somebody is waiting to handle an eratt don't process it | ||
3218 | * here. The brdkill function will do this. | ||
3219 | */ | ||
3220 | if (phba->fc_flag & FC_IGNORE_ERATT) | ||
3221 | ha_copy &= ~HA_ERATT; | ||
3187 | writel((ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr); | 3222 | writel((ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr); |
3188 | readl(phba->HAregaddr); /* flush */ | 3223 | readl(phba->HAregaddr); /* flush */ |
3189 | spin_unlock(phba->host->host_lock); | 3224 | spin_unlock(phba->host->host_lock); |
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index a43549959dc7..41c38d324ab0 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
@@ -39,9 +39,10 @@ struct lpfc_iocbq { | |||
39 | IOCB_t iocb; /* IOCB cmd */ | 39 | IOCB_t iocb; /* IOCB cmd */ |
40 | uint8_t retry; /* retry counter for IOCB cmd - if needed */ | 40 | uint8_t retry; /* retry counter for IOCB cmd - if needed */ |
41 | uint8_t iocb_flag; | 41 | uint8_t iocb_flag; |
42 | #define LPFC_IO_LIBDFC 1 /* libdfc iocb */ | 42 | #define LPFC_IO_LIBDFC 1 /* libdfc iocb */ |
43 | #define LPFC_IO_WAKE 2 /* High Priority Queue signal flag */ | 43 | #define LPFC_IO_WAKE 2 /* High Priority Queue signal flag */ |
44 | #define LPFC_IO_FCP 4 /* FCP command -- iocbq in scsi_buf */ | 44 | #define LPFC_IO_FCP 4 /* FCP command -- iocbq in scsi_buf */ |
45 | #define LPFC_DRIVER_ABORTED 8 /* driver aborted this request */ | ||
45 | 46 | ||
46 | uint8_t abort_count; | 47 | uint8_t abort_count; |
47 | uint8_t rsvd2; | 48 | uint8_t rsvd2; |
@@ -67,6 +68,8 @@ struct lpfc_iocbq { | |||
67 | #define IOCB_ERROR 2 | 68 | #define IOCB_ERROR 2 |
68 | #define IOCB_TIMEDOUT 3 | 69 | #define IOCB_TIMEDOUT 3 |
69 | 70 | ||
71 | #define LPFC_MBX_WAKE 1 | ||
72 | |||
70 | typedef struct lpfcMboxq { | 73 | typedef struct lpfcMboxq { |
71 | /* MBOXQs are used in single linked lists */ | 74 | /* MBOXQs are used in single linked lists */ |
72 | struct list_head list; /* ptr to next mailbox command */ | 75 | struct list_head list; /* ptr to next mailbox command */ |
@@ -75,6 +78,7 @@ typedef struct lpfcMboxq { | |||
75 | void *context2; /* caller context information */ | 78 | void *context2; /* caller context information */ |
76 | 79 | ||
77 | void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *); | 80 | void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *); |
81 | uint8_t mbox_flag; | ||
78 | 82 | ||
79 | } LPFC_MBOXQ_t; | 83 | } LPFC_MBOXQ_t; |
80 | 84 | ||
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index a61ef3d1e7f1..92a9107019d2 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * * | 7 | * * |
@@ -18,12 +18,12 @@ | |||
18 | * included with this package. * | 18 | * included with this package. * |
19 | *******************************************************************/ | 19 | *******************************************************************/ |
20 | 20 | ||
21 | #define LPFC_DRIVER_VERSION "8.1.11" | 21 | #define LPFC_DRIVER_VERSION "8.1.12" |
22 | 22 | ||
23 | #define LPFC_DRIVER_NAME "lpfc" | 23 | #define LPFC_DRIVER_NAME "lpfc" |
24 | 24 | ||
25 | #define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ | 25 | #define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ |
26 | LPFC_DRIVER_VERSION | 26 | LPFC_DRIVER_VERSION |
27 | #define LPFC_COPYRIGHT "Copyright(c) 2004-2006 Emulex. All rights reserved." | 27 | #define LPFC_COPYRIGHT "Copyright(c) 2004-2007 Emulex. All rights reserved." |
28 | 28 | ||
29 | #define DFC_API_VERSION "0.0.0" | 29 | #define DFC_API_VERSION "0.0.0" |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 7fc6e06ea7e1..3cce75d70263 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -1754,7 +1754,8 @@ __mega_busywait_mbox (adapter_t *adapter) | |||
1754 | for (counter = 0; counter < 10000; counter++) { | 1754 | for (counter = 0; counter < 10000; counter++) { |
1755 | if (!mbox->m_in.busy) | 1755 | if (!mbox->m_in.busy) |
1756 | return 0; | 1756 | return 0; |
1757 | udelay(100); yield(); | 1757 | udelay(100); |
1758 | cond_resched(); | ||
1758 | } | 1759 | } |
1759 | return -1; /* give up after 1 second */ | 1760 | return -1; /* give up after 1 second */ |
1760 | } | 1761 | } |
@@ -3177,7 +3178,10 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
3177 | 3178 | ||
3178 | return len; | 3179 | return len; |
3179 | } | 3180 | } |
3180 | 3181 | #else | |
3182 | static inline void mega_create_proc_entry(int index, struct proc_dir_entry *parent) | ||
3183 | { | ||
3184 | } | ||
3181 | #endif | 3185 | #endif |
3182 | 3186 | ||
3183 | 3187 | ||
@@ -4342,7 +4346,7 @@ mega_support_cluster(adapter_t *adapter) | |||
4342 | return 0; | 4346 | return 0; |
4343 | } | 4347 | } |
4344 | 4348 | ||
4345 | 4349 | #ifdef CONFIG_PROC_FS | |
4346 | /** | 4350 | /** |
4347 | * mega_adapinq() | 4351 | * mega_adapinq() |
4348 | * @adapter - pointer to our soft state | 4352 | * @adapter - pointer to our soft state |
@@ -4447,7 +4451,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt, | |||
4447 | 4451 | ||
4448 | return rval; | 4452 | return rval; |
4449 | } | 4453 | } |
4450 | 4454 | #endif | |
4451 | 4455 | ||
4452 | /** | 4456 | /** |
4453 | * mega_internal_command() | 4457 | * mega_internal_command() |
@@ -4965,7 +4969,6 @@ megaraid_remove_one(struct pci_dev *pdev) | |||
4965 | { | 4969 | { |
4966 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 4970 | struct Scsi_Host *host = pci_get_drvdata(pdev); |
4967 | adapter_t *adapter = (adapter_t *)host->hostdata; | 4971 | adapter_t *adapter = (adapter_t *)host->hostdata; |
4968 | char buf[12] = { 0 }; | ||
4969 | 4972 | ||
4970 | scsi_remove_host(host); | 4973 | scsi_remove_host(host); |
4971 | 4974 | ||
@@ -5011,8 +5014,11 @@ megaraid_remove_one(struct pci_dev *pdev) | |||
5011 | remove_proc_entry("raiddrives-30-39", | 5014 | remove_proc_entry("raiddrives-30-39", |
5012 | adapter->controller_proc_dir_entry); | 5015 | adapter->controller_proc_dir_entry); |
5013 | #endif | 5016 | #endif |
5014 | sprintf(buf, "hba%d", adapter->host->host_no); | 5017 | { |
5015 | remove_proc_entry(buf, mega_proc_dir_entry); | 5018 | char buf[12] = { 0 }; |
5019 | sprintf(buf, "hba%d", adapter->host->host_no); | ||
5020 | remove_proc_entry(buf, mega_proc_dir_entry); | ||
5021 | } | ||
5016 | } | 5022 | } |
5017 | #endif | 5023 | #endif |
5018 | 5024 | ||
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h index c6e74643abe2..ee70bd4ae4ba 100644 --- a/drivers/scsi/megaraid.h +++ b/drivers/scsi/megaraid.h | |||
@@ -1002,7 +1002,6 @@ static int megaraid_reset(Scsi_Cmnd *); | |||
1002 | static int megaraid_abort_and_reset(adapter_t *, Scsi_Cmnd *, int); | 1002 | static int megaraid_abort_and_reset(adapter_t *, Scsi_Cmnd *, int); |
1003 | static int megaraid_biosparam(struct scsi_device *, struct block_device *, | 1003 | static int megaraid_biosparam(struct scsi_device *, struct block_device *, |
1004 | sector_t, int []); | 1004 | sector_t, int []); |
1005 | static int mega_print_inquiry(char *, char *); | ||
1006 | 1005 | ||
1007 | static int mega_build_sglist (adapter_t *adapter, scb_t *scb, | 1006 | static int mega_build_sglist (adapter_t *adapter, scb_t *scb, |
1008 | u32 *buffer, u32 *length); | 1007 | u32 *buffer, u32 *length); |
@@ -1024,6 +1023,7 @@ static int mega_init_scb (adapter_t *); | |||
1024 | static int mega_is_bios_enabled (adapter_t *); | 1023 | static int mega_is_bios_enabled (adapter_t *); |
1025 | 1024 | ||
1026 | #ifdef CONFIG_PROC_FS | 1025 | #ifdef CONFIG_PROC_FS |
1026 | static int mega_print_inquiry(char *, char *); | ||
1027 | static void mega_create_proc_entry(int, struct proc_dir_entry *); | 1027 | static void mega_create_proc_entry(int, struct proc_dir_entry *); |
1028 | static int proc_read_config(char *, char **, off_t, int, int *, void *); | 1028 | static int proc_read_config(char *, char **, off_t, int, int *, void *); |
1029 | static int proc_read_stat(char *, char **, off_t, int, int *, void *); | 1029 | static int proc_read_stat(char *, char **, off_t, int, int *, void *); |
@@ -1040,10 +1040,10 @@ static int proc_rdrv_20(char *, char **, off_t, int, int *, void *); | |||
1040 | static int proc_rdrv_30(char *, char **, off_t, int, int *, void *); | 1040 | static int proc_rdrv_30(char *, char **, off_t, int, int *, void *); |
1041 | static int proc_rdrv_40(char *, char **, off_t, int, int *, void *); | 1041 | static int proc_rdrv_40(char *, char **, off_t, int, int *, void *); |
1042 | static int proc_rdrv(adapter_t *, char *, int, int); | 1042 | static int proc_rdrv(adapter_t *, char *, int, int); |
1043 | #endif | ||
1044 | 1043 | ||
1045 | static int mega_adapinq(adapter_t *, dma_addr_t); | 1044 | static int mega_adapinq(adapter_t *, dma_addr_t); |
1046 | static int mega_internal_dev_inquiry(adapter_t *, u8, u8, dma_addr_t); | 1045 | static int mega_internal_dev_inquiry(adapter_t *, u8, u8, dma_addr_t); |
1046 | #endif | ||
1047 | 1047 | ||
1048 | static int mega_support_ext_cdb(adapter_t *); | 1048 | static int mega_support_ext_cdb(adapter_t *); |
1049 | static mega_passthru* mega_prepare_passthru(adapter_t *, scb_t *, | 1049 | static mega_passthru* mega_prepare_passthru(adapter_t *, scb_t *, |
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index f33a678f0897..e075a52ac104 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c | |||
@@ -60,7 +60,7 @@ EXPORT_SYMBOL(mraid_mm_unregister_adp); | |||
60 | EXPORT_SYMBOL(mraid_mm_adapter_app_handle); | 60 | EXPORT_SYMBOL(mraid_mm_adapter_app_handle); |
61 | 61 | ||
62 | static int majorno; | 62 | static int majorno; |
63 | static uint32_t drvr_ver = 0x02200206; | 63 | static uint32_t drvr_ver = 0x02200207; |
64 | 64 | ||
65 | static int adapters_count_g; | 65 | static int adapters_count_g; |
66 | static struct list_head adapters_list_g; | 66 | static struct list_head adapters_list_g; |
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index cf3666d7d97a..e64d1a19d8d7 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c | |||
@@ -185,7 +185,7 @@ struct mesh_state { | |||
185 | * Driver is too messy, we need a few prototypes... | 185 | * Driver is too messy, we need a few prototypes... |
186 | */ | 186 | */ |
187 | static void mesh_done(struct mesh_state *ms, int start_next); | 187 | static void mesh_done(struct mesh_state *ms, int start_next); |
188 | static void mesh_interrupt(int irq, void *dev_id); | 188 | static void mesh_interrupt(struct mesh_state *ms); |
189 | static void cmd_complete(struct mesh_state *ms); | 189 | static void cmd_complete(struct mesh_state *ms); |
190 | static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd); | 190 | static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd); |
191 | static void halt_dma(struct mesh_state *ms); | 191 | static void halt_dma(struct mesh_state *ms); |
@@ -466,7 +466,7 @@ static void mesh_start_cmd(struct mesh_state *ms, struct scsi_cmnd *cmd) | |||
466 | dlog(ms, "intr b4 arb, intr/exc/err/fc=%.8x", | 466 | dlog(ms, "intr b4 arb, intr/exc/err/fc=%.8x", |
467 | MKWORD(mr->interrupt, mr->exception, | 467 | MKWORD(mr->interrupt, mr->exception, |
468 | mr->error, mr->fifo_count)); | 468 | mr->error, mr->fifo_count)); |
469 | mesh_interrupt(0, (void *)ms); | 469 | mesh_interrupt(ms); |
470 | if (ms->phase != arbitrating) | 470 | if (ms->phase != arbitrating) |
471 | return; | 471 | return; |
472 | } | 472 | } |
@@ -504,7 +504,7 @@ static void mesh_start_cmd(struct mesh_state *ms, struct scsi_cmnd *cmd) | |||
504 | dlog(ms, "intr after disresel, intr/exc/err/fc=%.8x", | 504 | dlog(ms, "intr after disresel, intr/exc/err/fc=%.8x", |
505 | MKWORD(mr->interrupt, mr->exception, | 505 | MKWORD(mr->interrupt, mr->exception, |
506 | mr->error, mr->fifo_count)); | 506 | mr->error, mr->fifo_count)); |
507 | mesh_interrupt(0, (void *)ms); | 507 | mesh_interrupt(ms); |
508 | if (ms->phase != arbitrating) | 508 | if (ms->phase != arbitrating) |
509 | return; | 509 | return; |
510 | dlog(ms, "after intr after disresel, intr/exc/err/fc=%.8x", | 510 | dlog(ms, "after intr after disresel, intr/exc/err/fc=%.8x", |
@@ -1018,10 +1018,11 @@ static void handle_reset(struct mesh_state *ms) | |||
1018 | static irqreturn_t do_mesh_interrupt(int irq, void *dev_id) | 1018 | static irqreturn_t do_mesh_interrupt(int irq, void *dev_id) |
1019 | { | 1019 | { |
1020 | unsigned long flags; | 1020 | unsigned long flags; |
1021 | struct Scsi_Host *dev = ((struct mesh_state *)dev_id)->host; | 1021 | struct mesh_state *ms = dev_id; |
1022 | struct Scsi_Host *dev = ms->host; | ||
1022 | 1023 | ||
1023 | spin_lock_irqsave(dev->host_lock, flags); | 1024 | spin_lock_irqsave(dev->host_lock, flags); |
1024 | mesh_interrupt(irq, dev_id); | 1025 | mesh_interrupt(ms); |
1025 | spin_unlock_irqrestore(dev->host_lock, flags); | 1026 | spin_unlock_irqrestore(dev->host_lock, flags); |
1026 | return IRQ_HANDLED; | 1027 | return IRQ_HANDLED; |
1027 | } | 1028 | } |
@@ -1661,9 +1662,8 @@ static int mesh_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
1661 | * handler (do_mesh_interrupt) or by other functions in | 1662 | * handler (do_mesh_interrupt) or by other functions in |
1662 | * exceptional circumstances | 1663 | * exceptional circumstances |
1663 | */ | 1664 | */ |
1664 | static void mesh_interrupt(int irq, void *dev_id) | 1665 | static void mesh_interrupt(struct mesh_state *ms) |
1665 | { | 1666 | { |
1666 | struct mesh_state *ms = (struct mesh_state *) dev_id; | ||
1667 | volatile struct mesh_regs __iomem *mr = ms->mesh; | 1667 | volatile struct mesh_regs __iomem *mr = ms->mesh; |
1668 | int intr; | 1668 | int intr; |
1669 | 1669 | ||
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 6777e8a69153..54d8bdf86852 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -4293,7 +4293,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
4293 | ha->devnum = devnum; /* specifies microcode load address */ | 4293 | ha->devnum = devnum; /* specifies microcode load address */ |
4294 | 4294 | ||
4295 | #ifdef QLA_64BIT_PTR | 4295 | #ifdef QLA_64BIT_PTR |
4296 | if (pci_set_dma_mask(ha->pdev, (dma_addr_t) ~ 0ULL)) { | 4296 | if (pci_set_dma_mask(ha->pdev, DMA_64BIT_MASK)) { |
4297 | if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK)) { | 4297 | if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK)) { |
4298 | printk(KERN_WARNING "scsi(%li): Unable to set a " | 4298 | printk(KERN_WARNING "scsi(%li): Unable to set a " |
4299 | "suitable DMA mask - aborting\n", ha->host_no); | 4299 | "suitable DMA mask - aborting\n", ha->host_no); |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 3e296ab845b6..db998d84cd40 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -130,18 +130,17 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha) | |||
130 | int | 130 | int |
131 | qla2100_pci_config(scsi_qla_host_t *ha) | 131 | qla2100_pci_config(scsi_qla_host_t *ha) |
132 | { | 132 | { |
133 | uint16_t w, mwi; | 133 | int ret; |
134 | uint16_t w; | ||
134 | uint32_t d; | 135 | uint32_t d; |
135 | unsigned long flags; | 136 | unsigned long flags; |
136 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | 137 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; |
137 | 138 | ||
138 | pci_set_master(ha->pdev); | 139 | pci_set_master(ha->pdev); |
139 | mwi = 0; | 140 | ret = pci_set_mwi(ha->pdev); |
140 | if (pci_set_mwi(ha->pdev)) | ||
141 | mwi = PCI_COMMAND_INVALIDATE; | ||
142 | 141 | ||
143 | pci_read_config_word(ha->pdev, PCI_COMMAND, &w); | 142 | pci_read_config_word(ha->pdev, PCI_COMMAND, &w); |
144 | w |= mwi | (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); | 143 | w |= (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); |
145 | pci_write_config_word(ha->pdev, PCI_COMMAND, w); | 144 | pci_write_config_word(ha->pdev, PCI_COMMAND, w); |
146 | 145 | ||
147 | /* Reset expansion ROM address decode enable */ | 146 | /* Reset expansion ROM address decode enable */ |
@@ -166,22 +165,22 @@ qla2100_pci_config(scsi_qla_host_t *ha) | |||
166 | int | 165 | int |
167 | qla2300_pci_config(scsi_qla_host_t *ha) | 166 | qla2300_pci_config(scsi_qla_host_t *ha) |
168 | { | 167 | { |
169 | uint16_t w, mwi; | 168 | int ret; |
169 | uint16_t w; | ||
170 | uint32_t d; | 170 | uint32_t d; |
171 | unsigned long flags = 0; | 171 | unsigned long flags = 0; |
172 | uint32_t cnt; | 172 | uint32_t cnt; |
173 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | 173 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; |
174 | 174 | ||
175 | pci_set_master(ha->pdev); | 175 | pci_set_master(ha->pdev); |
176 | mwi = 0; | 176 | ret = pci_set_mwi(ha->pdev); |
177 | if (pci_set_mwi(ha->pdev)) | ||
178 | mwi = PCI_COMMAND_INVALIDATE; | ||
179 | 177 | ||
180 | pci_read_config_word(ha->pdev, PCI_COMMAND, &w); | 178 | pci_read_config_word(ha->pdev, PCI_COMMAND, &w); |
181 | w |= mwi | (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); | 179 | w |= (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); |
182 | 180 | ||
183 | if (IS_QLA2322(ha) || IS_QLA6322(ha)) | 181 | if (IS_QLA2322(ha) || IS_QLA6322(ha)) |
184 | w &= ~PCI_COMMAND_INTX_DISABLE; | 182 | w &= ~PCI_COMMAND_INTX_DISABLE; |
183 | pci_write_config_word(ha->pdev, PCI_COMMAND, w); | ||
185 | 184 | ||
186 | /* | 185 | /* |
187 | * If this is a 2300 card and not 2312, reset the | 186 | * If this is a 2300 card and not 2312, reset the |
@@ -210,7 +209,7 @@ qla2300_pci_config(scsi_qla_host_t *ha) | |||
210 | ha->fb_rev = RD_FB_CMD_REG(ha, reg); | 209 | ha->fb_rev = RD_FB_CMD_REG(ha, reg); |
211 | 210 | ||
212 | if (ha->fb_rev == FPM_2300) | 211 | if (ha->fb_rev == FPM_2300) |
213 | w &= ~PCI_COMMAND_INVALIDATE; | 212 | pci_clear_mwi(ha->pdev); |
214 | 213 | ||
215 | /* Deselect FPM registers. */ | 214 | /* Deselect FPM registers. */ |
216 | WRT_REG_WORD(®->ctrl_status, 0x0); | 215 | WRT_REG_WORD(®->ctrl_status, 0x0); |
@@ -227,7 +226,6 @@ qla2300_pci_config(scsi_qla_host_t *ha) | |||
227 | 226 | ||
228 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 227 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
229 | } | 228 | } |
230 | pci_write_config_word(ha->pdev, PCI_COMMAND, w); | ||
231 | 229 | ||
232 | pci_write_config_byte(ha->pdev, PCI_LATENCY_TIMER, 0x80); | 230 | pci_write_config_byte(ha->pdev, PCI_LATENCY_TIMER, 0x80); |
233 | 231 | ||
@@ -253,19 +251,18 @@ qla2300_pci_config(scsi_qla_host_t *ha) | |||
253 | int | 251 | int |
254 | qla24xx_pci_config(scsi_qla_host_t *ha) | 252 | qla24xx_pci_config(scsi_qla_host_t *ha) |
255 | { | 253 | { |
256 | uint16_t w, mwi; | 254 | int ret; |
255 | uint16_t w; | ||
257 | uint32_t d; | 256 | uint32_t d; |
258 | unsigned long flags = 0; | 257 | unsigned long flags = 0; |
259 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; | 258 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; |
260 | int pcix_cmd_reg, pcie_dctl_reg; | 259 | int pcix_cmd_reg, pcie_dctl_reg; |
261 | 260 | ||
262 | pci_set_master(ha->pdev); | 261 | pci_set_master(ha->pdev); |
263 | mwi = 0; | 262 | ret = pci_set_mwi(ha->pdev); |
264 | if (pci_set_mwi(ha->pdev)) | ||
265 | mwi = PCI_COMMAND_INVALIDATE; | ||
266 | 263 | ||
267 | pci_read_config_word(ha->pdev, PCI_COMMAND, &w); | 264 | pci_read_config_word(ha->pdev, PCI_COMMAND, &w); |
268 | w |= mwi | (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); | 265 | w |= (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); |
269 | w &= ~PCI_COMMAND_INTX_DISABLE; | 266 | w &= ~PCI_COMMAND_INTX_DISABLE; |
270 | pci_write_config_word(ha->pdev, PCI_COMMAND, w); | 267 | pci_write_config_word(ha->pdev, PCI_COMMAND, w); |
271 | 268 | ||
@@ -3931,6 +3928,8 @@ qla2x00_try_to_stop_firmware(scsi_qla_host_t *ha) | |||
3931 | 3928 | ||
3932 | if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha)) | 3929 | if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha)) |
3933 | return; | 3930 | return; |
3931 | if (!ha->fw_major_version) | ||
3932 | return; | ||
3934 | 3933 | ||
3935 | ret = qla2x00_stop_firmware(ha); | 3934 | ret = qla2x00_stop_firmware(ha); |
3936 | for (retries = 5; ret != QLA_SUCCESS && retries ; retries--) { | 3935 | for (retries = 5; ret != QLA_SUCCESS && retries ; retries--) { |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index d4885616cd39..ca463469063d 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -1726,6 +1726,17 @@ qla2x00_request_irqs(scsi_qla_host_t *ha) | |||
1726 | qla_printk(KERN_WARNING, ha, | 1726 | qla_printk(KERN_WARNING, ha, |
1727 | "MSI-X: Falling back-to INTa mode -- %d.\n", ret); | 1727 | "MSI-X: Falling back-to INTa mode -- %d.\n", ret); |
1728 | skip_msix: | 1728 | skip_msix: |
1729 | |||
1730 | if (!IS_QLA24XX(ha)) | ||
1731 | goto skip_msi; | ||
1732 | |||
1733 | ret = pci_enable_msi(ha->pdev); | ||
1734 | if (!ret) { | ||
1735 | DEBUG2(qla_printk(KERN_INFO, ha, "MSI: Enabled.\n")); | ||
1736 | ha->flags.msi_enabled = 1; | ||
1737 | } | ||
1738 | skip_msi: | ||
1739 | |||
1729 | ret = request_irq(ha->pdev->irq, ha->isp_ops.intr_handler, | 1740 | ret = request_irq(ha->pdev->irq, ha->isp_ops.intr_handler, |
1730 | IRQF_DISABLED|IRQF_SHARED, QLA2XXX_DRIVER_NAME, ha); | 1741 | IRQF_DISABLED|IRQF_SHARED, QLA2XXX_DRIVER_NAME, ha); |
1731 | if (!ret) { | 1742 | if (!ret) { |
@@ -1746,6 +1757,8 @@ qla2x00_free_irqs(scsi_qla_host_t *ha) | |||
1746 | 1757 | ||
1747 | if (ha->flags.msix_enabled) | 1758 | if (ha->flags.msix_enabled) |
1748 | qla24xx_disable_msix(ha); | 1759 | qla24xx_disable_msix(ha); |
1749 | else if (ha->flags.inta_enabled) | 1760 | else if (ha->flags.inta_enabled) { |
1750 | free_irq(ha->host->irq, ha); | 1761 | free_irq(ha->host->irq, ha); |
1762 | pci_disable_msi(ha->pdev); | ||
1763 | } | ||
1751 | } | 1764 | } |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index b78919a318e2..dd076da86a46 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -36,7 +36,7 @@ module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR); | |||
36 | MODULE_PARM_DESC(ql2xlogintimeout, | 36 | MODULE_PARM_DESC(ql2xlogintimeout, |
37 | "Login timeout value in seconds."); | 37 | "Login timeout value in seconds."); |
38 | 38 | ||
39 | int qlport_down_retry = 30; | 39 | int qlport_down_retry; |
40 | module_param(qlport_down_retry, int, S_IRUGO|S_IRUSR); | 40 | module_param(qlport_down_retry, int, S_IRUGO|S_IRUSR); |
41 | MODULE_PARM_DESC(qlport_down_retry, | 41 | MODULE_PARM_DESC(qlport_down_retry, |
42 | "Maximum number of command retries to a port that returns " | 42 | "Maximum number of command retries to a port that returns " |
@@ -1577,9 +1577,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1577 | goto probe_failed; | 1577 | goto probe_failed; |
1578 | } | 1578 | } |
1579 | 1579 | ||
1580 | if (qla2x00_initialize_adapter(ha) && | 1580 | if (qla2x00_initialize_adapter(ha)) { |
1581 | !(ha->device_flags & DFLG_NO_CABLE)) { | ||
1582 | |||
1583 | qla_printk(KERN_WARNING, ha, | 1581 | qla_printk(KERN_WARNING, ha, |
1584 | "Failed to initialize adapter\n"); | 1582 | "Failed to initialize adapter\n"); |
1585 | 1583 | ||
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index dc85495c337f..c375a4efbc71 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
@@ -7,7 +7,7 @@ | |||
7 | /* | 7 | /* |
8 | * Driver version | 8 | * Driver version |
9 | */ | 9 | */ |
10 | #define QLA2XXX_VERSION "8.01.07-k6" | 10 | #define QLA2XXX_VERSION "8.01.07-k7" |
11 | 11 | ||
12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
13 | #define QLA_DRIVER_MINOR_VER 1 | 13 | #define QLA_DRIVER_MINOR_VER 1 |
diff --git a/drivers/scsi/qla4xxx/ql4_dbg.c b/drivers/scsi/qla4xxx/ql4_dbg.c index 7b4e077a39c1..6437d024b0dd 100644 --- a/drivers/scsi/qla4xxx/ql4_dbg.c +++ b/drivers/scsi/qla4xxx/ql4_dbg.c | |||
@@ -8,6 +8,8 @@ | |||
8 | #include "ql4_def.h" | 8 | #include "ql4_def.h" |
9 | #include <scsi/scsi_dbg.h> | 9 | #include <scsi/scsi_dbg.h> |
10 | 10 | ||
11 | #if 0 | ||
12 | |||
11 | static void qla4xxx_print_srb_info(struct srb * srb) | 13 | static void qla4xxx_print_srb_info(struct srb * srb) |
12 | { | 14 | { |
13 | printk("%s: srb = 0x%p, flags=0x%02x\n", __func__, srb, srb->flags); | 15 | printk("%s: srb = 0x%p, flags=0x%02x\n", __func__, srb, srb->flags); |
@@ -195,3 +197,5 @@ void qla4xxx_dump_buffer(void *b, uint32_t size) | |||
195 | if (cnt % 16) | 197 | if (cnt % 16) |
196 | printk(KERN_DEBUG "\n"); | 198 | printk(KERN_DEBUG "\n"); |
197 | } | 199 | } |
200 | |||
201 | #endif /* 0 */ | ||
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h index e021eb5db2b2..5b00cb04e7c0 100644 --- a/drivers/scsi/qla4xxx/ql4_glbl.h +++ b/drivers/scsi/qla4xxx/ql4_glbl.h | |||
@@ -43,8 +43,6 @@ int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha, | |||
43 | uint16_t *tcp_source_port_num, | 43 | uint16_t *tcp_source_port_num, |
44 | uint16_t *connection_id); | 44 | uint16_t *connection_id); |
45 | 45 | ||
46 | struct ddb_entry * qla4xxx_alloc_ddb(struct scsi_qla_host * ha, | ||
47 | uint32_t fw_ddb_index); | ||
48 | int qla4xxx_set_ddb_entry(struct scsi_qla_host * ha, uint16_t fw_ddb_index, | 46 | int qla4xxx_set_ddb_entry(struct scsi_qla_host * ha, uint16_t fw_ddb_index, |
49 | dma_addr_t fw_ddb_entry_dma); | 47 | dma_addr_t fw_ddb_entry_dma); |
50 | 48 | ||
@@ -55,18 +53,11 @@ void qla4xxx_get_crash_record(struct scsi_qla_host * ha); | |||
55 | struct ddb_entry *qla4xxx_alloc_sess(struct scsi_qla_host *ha); | 53 | struct ddb_entry *qla4xxx_alloc_sess(struct scsi_qla_host *ha); |
56 | int qla4xxx_add_sess(struct ddb_entry *); | 54 | int qla4xxx_add_sess(struct ddb_entry *); |
57 | void qla4xxx_destroy_sess(struct ddb_entry *ddb_entry); | 55 | void qla4xxx_destroy_sess(struct ddb_entry *ddb_entry); |
58 | int qla4xxx_conn_close_sess_logout(struct scsi_qla_host * ha, | ||
59 | uint16_t fw_ddb_index, | ||
60 | uint16_t connection_id, | ||
61 | uint16_t option); | ||
62 | int qla4xxx_clear_database_entry(struct scsi_qla_host * ha, | ||
63 | uint16_t fw_ddb_index); | ||
64 | int qla4xxx_is_nvram_configuration_valid(struct scsi_qla_host * ha); | 56 | int qla4xxx_is_nvram_configuration_valid(struct scsi_qla_host * ha); |
65 | int qla4xxx_get_fw_version(struct scsi_qla_host * ha); | 57 | int qla4xxx_get_fw_version(struct scsi_qla_host * ha); |
66 | void qla4xxx_interrupt_service_routine(struct scsi_qla_host * ha, | 58 | void qla4xxx_interrupt_service_routine(struct scsi_qla_host * ha, |
67 | uint32_t intr_status); | 59 | uint32_t intr_status); |
68 | int qla4xxx_init_rings(struct scsi_qla_host * ha); | 60 | int qla4xxx_init_rings(struct scsi_qla_host * ha); |
69 | void qla4xxx_dump_buffer(void *b, uint32_t size); | ||
70 | struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha, uint32_t index); | 61 | struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha, uint32_t index); |
71 | void qla4xxx_srb_compl(struct scsi_qla_host *ha, struct srb *srb); | 62 | void qla4xxx_srb_compl(struct scsi_qla_host *ha, struct srb *srb); |
72 | int qla4xxx_reinitialize_ddb_list(struct scsi_qla_host * ha); | 63 | int qla4xxx_reinitialize_ddb_list(struct scsi_qla_host * ha); |
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c index b907b06d72ab..6365df268612 100644 --- a/drivers/scsi/qla4xxx/ql4_init.c +++ b/drivers/scsi/qla4xxx/ql4_init.c | |||
@@ -7,9 +7,8 @@ | |||
7 | 7 | ||
8 | #include "ql4_def.h" | 8 | #include "ql4_def.h" |
9 | 9 | ||
10 | /* | 10 | static struct ddb_entry * qla4xxx_alloc_ddb(struct scsi_qla_host *ha, |
11 | * QLogic ISP4xxx Hardware Support Function Prototypes. | 11 | uint32_t fw_ddb_index); |
12 | */ | ||
13 | 12 | ||
14 | static void ql4xxx_set_mac_number(struct scsi_qla_host *ha) | 13 | static void ql4xxx_set_mac_number(struct scsi_qla_host *ha) |
15 | { | 14 | { |
@@ -48,7 +47,8 @@ static void ql4xxx_set_mac_number(struct scsi_qla_host *ha) | |||
48 | * This routine deallocates and unlinks the specified ddb_entry from the | 47 | * This routine deallocates and unlinks the specified ddb_entry from the |
49 | * adapter's | 48 | * adapter's |
50 | **/ | 49 | **/ |
51 | void qla4xxx_free_ddb(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry) | 50 | static void qla4xxx_free_ddb(struct scsi_qla_host *ha, |
51 | struct ddb_entry *ddb_entry) | ||
52 | { | 52 | { |
53 | /* Remove device entry from list */ | 53 | /* Remove device entry from list */ |
54 | list_del_init(&ddb_entry->list); | 54 | list_del_init(&ddb_entry->list); |
@@ -370,9 +370,9 @@ static struct ddb_entry* qla4xxx_get_ddb_entry(struct scsi_qla_host *ha, | |||
370 | * must be initialized prior to calling this routine | 370 | * must be initialized prior to calling this routine |
371 | * | 371 | * |
372 | **/ | 372 | **/ |
373 | int qla4xxx_update_ddb_entry(struct scsi_qla_host *ha, | 373 | static int qla4xxx_update_ddb_entry(struct scsi_qla_host *ha, |
374 | struct ddb_entry *ddb_entry, | 374 | struct ddb_entry *ddb_entry, |
375 | uint32_t fw_ddb_index) | 375 | uint32_t fw_ddb_index) |
376 | { | 376 | { |
377 | struct dev_db_entry *fw_ddb_entry = NULL; | 377 | struct dev_db_entry *fw_ddb_entry = NULL; |
378 | dma_addr_t fw_ddb_entry_dma; | 378 | dma_addr_t fw_ddb_entry_dma; |
@@ -450,8 +450,8 @@ int qla4xxx_update_ddb_entry(struct scsi_qla_host *ha, | |||
450 | * This routine allocates a ddb_entry, ititializes some values, and | 450 | * This routine allocates a ddb_entry, ititializes some values, and |
451 | * inserts it into the ddb list. | 451 | * inserts it into the ddb list. |
452 | **/ | 452 | **/ |
453 | struct ddb_entry * qla4xxx_alloc_ddb(struct scsi_qla_host *ha, | 453 | static struct ddb_entry * qla4xxx_alloc_ddb(struct scsi_qla_host *ha, |
454 | uint32_t fw_ddb_index) | 454 | uint32_t fw_ddb_index) |
455 | { | 455 | { |
456 | struct ddb_entry *ddb_entry; | 456 | struct ddb_entry *ddb_entry; |
457 | 457 | ||
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c index d41ce380eedc..a216a1781afb 100644 --- a/drivers/scsi/qla4xxx/ql4_iocb.c +++ b/drivers/scsi/qla4xxx/ql4_iocb.c | |||
@@ -19,8 +19,8 @@ | |||
19 | * - advances the request_in pointer | 19 | * - advances the request_in pointer |
20 | * - checks for queue full | 20 | * - checks for queue full |
21 | **/ | 21 | **/ |
22 | int qla4xxx_get_req_pkt(struct scsi_qla_host *ha, | 22 | static int qla4xxx_get_req_pkt(struct scsi_qla_host *ha, |
23 | struct queue_entry **queue_entry) | 23 | struct queue_entry **queue_entry) |
24 | { | 24 | { |
25 | uint16_t request_in; | 25 | uint16_t request_in; |
26 | uint8_t status = QLA_SUCCESS; | 26 | uint8_t status = QLA_SUCCESS; |
@@ -62,8 +62,8 @@ int qla4xxx_get_req_pkt(struct scsi_qla_host *ha, | |||
62 | * | 62 | * |
63 | * This routine issues a marker IOCB. | 63 | * This routine issues a marker IOCB. |
64 | **/ | 64 | **/ |
65 | int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha, | 65 | static int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha, |
66 | struct ddb_entry *ddb_entry, int lun) | 66 | struct ddb_entry *ddb_entry, int lun) |
67 | { | 67 | { |
68 | struct marker_entry *marker_entry; | 68 | struct marker_entry *marker_entry; |
69 | unsigned long flags = 0; | 69 | unsigned long flags = 0; |
@@ -96,7 +96,7 @@ exit_send_marker: | |||
96 | return status; | 96 | return status; |
97 | } | 97 | } |
98 | 98 | ||
99 | struct continuation_t1_entry* qla4xxx_alloc_cont_entry( | 99 | static struct continuation_t1_entry* qla4xxx_alloc_cont_entry( |
100 | struct scsi_qla_host *ha) | 100 | struct scsi_qla_host *ha) |
101 | { | 101 | { |
102 | struct continuation_t1_entry *cont_entry; | 102 | struct continuation_t1_entry *cont_entry; |
@@ -120,7 +120,7 @@ struct continuation_t1_entry* qla4xxx_alloc_cont_entry( | |||
120 | return cont_entry; | 120 | return cont_entry; |
121 | } | 121 | } |
122 | 122 | ||
123 | uint16_t qla4xxx_calc_request_entries(uint16_t dsds) | 123 | static uint16_t qla4xxx_calc_request_entries(uint16_t dsds) |
124 | { | 124 | { |
125 | uint16_t iocbs; | 125 | uint16_t iocbs; |
126 | 126 | ||
@@ -133,9 +133,9 @@ uint16_t qla4xxx_calc_request_entries(uint16_t dsds) | |||
133 | return iocbs; | 133 | return iocbs; |
134 | } | 134 | } |
135 | 135 | ||
136 | void qla4xxx_build_scsi_iocbs(struct srb *srb, | 136 | static void qla4xxx_build_scsi_iocbs(struct srb *srb, |
137 | struct command_t3_entry *cmd_entry, | 137 | struct command_t3_entry *cmd_entry, |
138 | uint16_t tot_dsds) | 138 | uint16_t tot_dsds) |
139 | { | 139 | { |
140 | struct scsi_qla_host *ha; | 140 | struct scsi_qla_host *ha; |
141 | uint16_t avail_dsds; | 141 | uint16_t avail_dsds; |
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index 7f28657eef3f..f116ff917237 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c | |||
@@ -20,9 +20,9 @@ | |||
20 | * If outCount is 0, this routine completes successfully WITHOUT waiting | 20 | * If outCount is 0, this routine completes successfully WITHOUT waiting |
21 | * for the mailbox command to complete. | 21 | * for the mailbox command to complete. |
22 | **/ | 22 | **/ |
23 | int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, | 23 | static int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, |
24 | uint8_t outCount, uint32_t *mbx_cmd, | 24 | uint8_t outCount, uint32_t *mbx_cmd, |
25 | uint32_t *mbx_sts) | 25 | uint32_t *mbx_sts) |
26 | { | 26 | { |
27 | int status = QLA_ERROR; | 27 | int status = QLA_ERROR; |
28 | uint8_t i; | 28 | uint8_t i; |
@@ -170,6 +170,8 @@ mbox_exit: | |||
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | #if 0 | ||
174 | |||
173 | /** | 175 | /** |
174 | * qla4xxx_issue_iocb - issue mailbox iocb command | 176 | * qla4xxx_issue_iocb - issue mailbox iocb command |
175 | * @ha: adapter state pointer. | 177 | * @ha: adapter state pointer. |
@@ -243,6 +245,8 @@ int qla4xxx_clear_database_entry(struct scsi_qla_host * ha, | |||
243 | return QLA_SUCCESS; | 245 | return QLA_SUCCESS; |
244 | } | 246 | } |
245 | 247 | ||
248 | #endif /* 0 */ | ||
249 | |||
246 | /** | 250 | /** |
247 | * qla4xxx_initialize_fw_cb - initializes firmware control block. | 251 | * qla4xxx_initialize_fw_cb - initializes firmware control block. |
248 | * @ha: Pointer to host adapter structure. | 252 | * @ha: Pointer to host adapter structure. |
@@ -570,6 +574,7 @@ int qla4xxx_set_ddb_entry(struct scsi_qla_host * ha, uint16_t fw_ddb_index, | |||
570 | return qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]); | 574 | return qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]); |
571 | } | 575 | } |
572 | 576 | ||
577 | #if 0 | ||
573 | int qla4xxx_conn_open_session_login(struct scsi_qla_host * ha, | 578 | int qla4xxx_conn_open_session_login(struct scsi_qla_host * ha, |
574 | uint16_t fw_ddb_index) | 579 | uint16_t fw_ddb_index) |
575 | { | 580 | { |
@@ -594,6 +599,7 @@ int qla4xxx_conn_open_session_login(struct scsi_qla_host * ha, | |||
594 | 599 | ||
595 | return status; | 600 | return status; |
596 | } | 601 | } |
602 | #endif /* 0 */ | ||
597 | 603 | ||
598 | /** | 604 | /** |
599 | * qla4xxx_get_crash_record - retrieves crash record. | 605 | * qla4xxx_get_crash_record - retrieves crash record. |
@@ -649,6 +655,7 @@ exit_get_crash_record: | |||
649 | crash_record, crash_record_dma); | 655 | crash_record, crash_record_dma); |
650 | } | 656 | } |
651 | 657 | ||
658 | #if 0 | ||
652 | /** | 659 | /** |
653 | * qla4xxx_get_conn_event_log - retrieves connection event log | 660 | * qla4xxx_get_conn_event_log - retrieves connection event log |
654 | * @ha: Pointer to host adapter structure. | 661 | * @ha: Pointer to host adapter structure. |
@@ -738,6 +745,7 @@ exit_get_event_log: | |||
738 | dma_free_coherent(&ha->pdev->dev, event_log_size, event_log, | 745 | dma_free_coherent(&ha->pdev->dev, event_log_size, event_log, |
739 | event_log_dma); | 746 | event_log_dma); |
740 | } | 747 | } |
748 | #endif /* 0 */ | ||
741 | 749 | ||
742 | /** | 750 | /** |
743 | * qla4xxx_reset_lun - issues LUN Reset | 751 | * qla4xxx_reset_lun - issues LUN Reset |
@@ -834,7 +842,8 @@ int qla4xxx_get_fw_version(struct scsi_qla_host * ha) | |||
834 | return QLA_SUCCESS; | 842 | return QLA_SUCCESS; |
835 | } | 843 | } |
836 | 844 | ||
837 | int qla4xxx_get_default_ddb(struct scsi_qla_host *ha, dma_addr_t dma_addr) | 845 | static int qla4xxx_get_default_ddb(struct scsi_qla_host *ha, |
846 | dma_addr_t dma_addr) | ||
838 | { | 847 | { |
839 | uint32_t mbox_cmd[MBOX_REG_COUNT]; | 848 | uint32_t mbox_cmd[MBOX_REG_COUNT]; |
840 | uint32_t mbox_sts[MBOX_REG_COUNT]; | 849 | uint32_t mbox_sts[MBOX_REG_COUNT]; |
@@ -855,7 +864,7 @@ int qla4xxx_get_default_ddb(struct scsi_qla_host *ha, dma_addr_t dma_addr) | |||
855 | return QLA_SUCCESS; | 864 | return QLA_SUCCESS; |
856 | } | 865 | } |
857 | 866 | ||
858 | int qla4xxx_req_ddb_entry(struct scsi_qla_host *ha, uint32_t *ddb_index) | 867 | static int qla4xxx_req_ddb_entry(struct scsi_qla_host *ha, uint32_t *ddb_index) |
859 | { | 868 | { |
860 | uint32_t mbox_cmd[MBOX_REG_COUNT]; | 869 | uint32_t mbox_cmd[MBOX_REG_COUNT]; |
861 | uint32_t mbox_sts[MBOX_REG_COUNT]; | 870 | uint32_t mbox_sts[MBOX_REG_COUNT]; |
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 0bfddf893ed0..da21f5fbbf87 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -14,7 +14,7 @@ | |||
14 | /* | 14 | /* |
15 | * Driver version | 15 | * Driver version |
16 | */ | 16 | */ |
17 | char qla4xxx_version_str[40]; | 17 | static char qla4xxx_version_str[40]; |
18 | 18 | ||
19 | /* | 19 | /* |
20 | * SRB allocation cache | 20 | * SRB allocation cache |
@@ -45,8 +45,7 @@ int ql4_mod_unload = 0; | |||
45 | /* | 45 | /* |
46 | * SCSI host template entry points | 46 | * SCSI host template entry points |
47 | */ | 47 | */ |
48 | 48 | static void qla4xxx_config_dma_addressing(struct scsi_qla_host *ha); | |
49 | void qla4xxx_config_dma_addressing(struct scsi_qla_host *ha); | ||
50 | 49 | ||
51 | /* | 50 | /* |
52 | * iSCSI template entry points | 51 | * iSCSI template entry points |
@@ -1352,7 +1351,7 @@ static void __devexit qla4xxx_remove_adapter(struct pci_dev *pdev) | |||
1352 | * At exit, the @ha's flags.enable_64bit_addressing set to indicated | 1351 | * At exit, the @ha's flags.enable_64bit_addressing set to indicated |
1353 | * supported addressing method. | 1352 | * supported addressing method. |
1354 | */ | 1353 | */ |
1355 | void qla4xxx_config_dma_addressing(struct scsi_qla_host *ha) | 1354 | static void qla4xxx_config_dma_addressing(struct scsi_qla_host *ha) |
1356 | { | 1355 | { |
1357 | int retval; | 1356 | int retval; |
1358 | 1357 | ||
@@ -1627,7 +1626,7 @@ static struct pci_device_id qla4xxx_pci_tbl[] = { | |||
1627 | }; | 1626 | }; |
1628 | MODULE_DEVICE_TABLE(pci, qla4xxx_pci_tbl); | 1627 | MODULE_DEVICE_TABLE(pci, qla4xxx_pci_tbl); |
1629 | 1628 | ||
1630 | struct pci_driver qla4xxx_pci_driver = { | 1629 | static struct pci_driver qla4xxx_pci_driver = { |
1631 | .name = DRIVER_NAME, | 1630 | .name = DRIVER_NAME, |
1632 | .id_table = qla4xxx_pci_tbl, | 1631 | .id_table = qla4xxx_pci_tbl, |
1633 | .probe = qla4xxx_probe_adapter, | 1632 | .probe = qla4xxx_probe_adapter, |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 3963e7013bd9..e8350c562d24 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include "scsi_logging.h" | 38 | #include "scsi_logging.h" |
39 | 39 | ||
40 | #define SENSE_TIMEOUT (10*HZ) | 40 | #define SENSE_TIMEOUT (10*HZ) |
41 | #define START_UNIT_TIMEOUT (30*HZ) | ||
42 | 41 | ||
43 | /* | 42 | /* |
44 | * These should *probably* be handled by the host itself. | 43 | * These should *probably* be handled by the host itself. |
@@ -936,7 +935,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd) | |||
936 | 935 | ||
937 | for (i = 0; rtn == NEEDS_RETRY && i < 2; i++) | 936 | for (i = 0; rtn == NEEDS_RETRY && i < 2; i++) |
938 | rtn = scsi_send_eh_cmnd(scmd, stu_command, 6, | 937 | rtn = scsi_send_eh_cmnd(scmd, stu_command, 6, |
939 | START_UNIT_TIMEOUT, 0); | 938 | scmd->device->timeout, 0); |
940 | 939 | ||
941 | if (rtn == SUCCESS) | 940 | if (rtn == SUCCESS) |
942 | return 0; | 941 | return 0; |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 14c4f065b2b8..b4d1ece46f78 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -1718,31 +1718,12 @@ fc_starget_delete(struct work_struct *work) | |||
1718 | struct fc_rport *rport = | 1718 | struct fc_rport *rport = |
1719 | container_of(work, struct fc_rport, stgt_delete_work); | 1719 | container_of(work, struct fc_rport, stgt_delete_work); |
1720 | struct Scsi_Host *shost = rport_to_shost(rport); | 1720 | struct Scsi_Host *shost = rport_to_shost(rport); |
1721 | unsigned long flags; | ||
1722 | struct fc_internal *i = to_fc_internal(shost->transportt); | 1721 | struct fc_internal *i = to_fc_internal(shost->transportt); |
1723 | 1722 | ||
1724 | /* | 1723 | /* Involve the LLDD if possible to terminate all io on the rport. */ |
1725 | * Involve the LLDD if possible. All io on the rport is to | 1724 | if (i->f->terminate_rport_io) |
1726 | * be terminated, either as part of the dev_loss_tmo callback | ||
1727 | * processing, or via the terminate_rport_io function. | ||
1728 | */ | ||
1729 | if (i->f->dev_loss_tmo_callbk) | ||
1730 | i->f->dev_loss_tmo_callbk(rport); | ||
1731 | else if (i->f->terminate_rport_io) | ||
1732 | i->f->terminate_rport_io(rport); | 1725 | i->f->terminate_rport_io(rport); |
1733 | 1726 | ||
1734 | spin_lock_irqsave(shost->host_lock, flags); | ||
1735 | if (rport->flags & FC_RPORT_DEVLOSS_PENDING) { | ||
1736 | spin_unlock_irqrestore(shost->host_lock, flags); | ||
1737 | if (!cancel_delayed_work(&rport->fail_io_work)) | ||
1738 | fc_flush_devloss(shost); | ||
1739 | if (!cancel_delayed_work(&rport->dev_loss_work)) | ||
1740 | fc_flush_devloss(shost); | ||
1741 | spin_lock_irqsave(shost->host_lock, flags); | ||
1742 | rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; | ||
1743 | } | ||
1744 | spin_unlock_irqrestore(shost->host_lock, flags); | ||
1745 | |||
1746 | scsi_remove_target(&rport->dev); | 1727 | scsi_remove_target(&rport->dev); |
1747 | } | 1728 | } |
1748 | 1729 | ||
@@ -1760,6 +1741,7 @@ fc_rport_final_delete(struct work_struct *work) | |||
1760 | struct device *dev = &rport->dev; | 1741 | struct device *dev = &rport->dev; |
1761 | struct Scsi_Host *shost = rport_to_shost(rport); | 1742 | struct Scsi_Host *shost = rport_to_shost(rport); |
1762 | struct fc_internal *i = to_fc_internal(shost->transportt); | 1743 | struct fc_internal *i = to_fc_internal(shost->transportt); |
1744 | unsigned long flags; | ||
1763 | 1745 | ||
1764 | /* | 1746 | /* |
1765 | * if a scan is pending, flush the SCSI Host work_q so that | 1747 | * if a scan is pending, flush the SCSI Host work_q so that |
@@ -1768,13 +1750,37 @@ fc_rport_final_delete(struct work_struct *work) | |||
1768 | if (rport->flags & FC_RPORT_SCAN_PENDING) | 1750 | if (rport->flags & FC_RPORT_SCAN_PENDING) |
1769 | scsi_flush_work(shost); | 1751 | scsi_flush_work(shost); |
1770 | 1752 | ||
1753 | /* involve the LLDD to terminate all pending i/o */ | ||
1754 | if (i->f->terminate_rport_io) | ||
1755 | i->f->terminate_rport_io(rport); | ||
1756 | |||
1757 | /* | ||
1758 | * Cancel any outstanding timers. These should really exist | ||
1759 | * only when rmmod'ing the LLDD and we're asking for | ||
1760 | * immediate termination of the rports | ||
1761 | */ | ||
1762 | spin_lock_irqsave(shost->host_lock, flags); | ||
1763 | if (rport->flags & FC_RPORT_DEVLOSS_PENDING) { | ||
1764 | spin_unlock_irqrestore(shost->host_lock, flags); | ||
1765 | if (!cancel_delayed_work(&rport->fail_io_work)) | ||
1766 | fc_flush_devloss(shost); | ||
1767 | if (!cancel_delayed_work(&rport->dev_loss_work)) | ||
1768 | fc_flush_devloss(shost); | ||
1769 | spin_lock_irqsave(shost->host_lock, flags); | ||
1770 | rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; | ||
1771 | } | ||
1772 | spin_unlock_irqrestore(shost->host_lock, flags); | ||
1773 | |||
1771 | /* Delete SCSI target and sdevs */ | 1774 | /* Delete SCSI target and sdevs */ |
1772 | if (rport->scsi_target_id != -1) | 1775 | if (rport->scsi_target_id != -1) |
1773 | fc_starget_delete(&rport->stgt_delete_work); | 1776 | fc_starget_delete(&rport->stgt_delete_work); |
1774 | else if (i->f->dev_loss_tmo_callbk) | 1777 | |
1778 | /* | ||
1779 | * Notify the driver that the rport is now dead. The LLDD will | ||
1780 | * also guarantee that any communication to the rport is terminated | ||
1781 | */ | ||
1782 | if (i->f->dev_loss_tmo_callbk) | ||
1775 | i->f->dev_loss_tmo_callbk(rport); | 1783 | i->f->dev_loss_tmo_callbk(rport); |
1776 | else if (i->f->terminate_rport_io) | ||
1777 | i->f->terminate_rport_io(rport); | ||
1778 | 1784 | ||
1779 | transport_remove_device(dev); | 1785 | transport_remove_device(dev); |
1780 | device_del(dev); | 1786 | device_del(dev); |
@@ -1963,8 +1969,6 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel, | |||
1963 | } | 1969 | } |
1964 | 1970 | ||
1965 | if (match) { | 1971 | if (match) { |
1966 | struct delayed_work *work = | ||
1967 | &rport->dev_loss_work; | ||
1968 | 1972 | ||
1969 | memcpy(&rport->node_name, &ids->node_name, | 1973 | memcpy(&rport->node_name, &ids->node_name, |
1970 | sizeof(rport->node_name)); | 1974 | sizeof(rport->node_name)); |
@@ -1982,46 +1986,61 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel, | |||
1982 | fci->f->dd_fcrport_size); | 1986 | fci->f->dd_fcrport_size); |
1983 | 1987 | ||
1984 | /* | 1988 | /* |
1985 | * If we were blocked, we were a target. | 1989 | * If we were not a target, cancel the |
1986 | * If no longer a target, we leave the timer | 1990 | * io terminate and rport timers, and |
1987 | * running in case the port changes roles | 1991 | * we're done. |
1988 | * prior to the timer expiring. If the timer | 1992 | * |
1989 | * fires, the target will be torn down. | 1993 | * If we were a target, but our new role |
1994 | * doesn't indicate a target, leave the | ||
1995 | * timers running expecting the role to | ||
1996 | * change as the target fully logs in. If | ||
1997 | * it doesn't, the target will be torn down. | ||
1998 | * | ||
1999 | * If we were a target, and our role shows | ||
2000 | * we're still a target, cancel the timers | ||
2001 | * and kick off a scan. | ||
1990 | */ | 2002 | */ |
1991 | if (!(ids->roles & FC_RPORT_ROLE_FCP_TARGET)) | ||
1992 | return rport; | ||
1993 | 2003 | ||
1994 | /* restart the target */ | 2004 | /* was a target, not in roles */ |
2005 | if ((rport->scsi_target_id != -1) && | ||
2006 | (!(ids->roles & FC_RPORT_ROLE_FCP_TARGET))) | ||
2007 | return rport; | ||
1995 | 2008 | ||
1996 | /* | 2009 | /* |
1997 | * Stop the target timers first. Take no action | 2010 | * Stop the fail io and dev_loss timers. |
1998 | * on the del_timer failure as the state | 2011 | * If they flush, the port_state will |
1999 | * machine state change will validate the | 2012 | * be checked and will NOOP the function. |
2000 | * transaction. | ||
2001 | */ | 2013 | */ |
2002 | if (!cancel_delayed_work(&rport->fail_io_work)) | 2014 | if (!cancel_delayed_work(&rport->fail_io_work)) |
2003 | fc_flush_devloss(shost); | 2015 | fc_flush_devloss(shost); |
2004 | if (!cancel_delayed_work(work)) | 2016 | if (!cancel_delayed_work(&rport->dev_loss_work)) |
2005 | fc_flush_devloss(shost); | 2017 | fc_flush_devloss(shost); |
2006 | 2018 | ||
2007 | spin_lock_irqsave(shost->host_lock, flags); | 2019 | spin_lock_irqsave(shost->host_lock, flags); |
2008 | 2020 | ||
2009 | rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; | 2021 | rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; |
2010 | 2022 | ||
2011 | /* initiate a scan of the target */ | 2023 | /* if target, initiate a scan */ |
2012 | rport->flags |= FC_RPORT_SCAN_PENDING; | 2024 | if (rport->scsi_target_id != -1) { |
2013 | scsi_queue_work(shost, &rport->scan_work); | 2025 | rport->flags |= FC_RPORT_SCAN_PENDING; |
2014 | 2026 | scsi_queue_work(shost, | |
2015 | spin_unlock_irqrestore(shost->host_lock, flags); | 2027 | &rport->scan_work); |
2016 | 2028 | spin_unlock_irqrestore(shost->host_lock, | |
2017 | scsi_target_unblock(&rport->dev); | 2029 | flags); |
2030 | scsi_target_unblock(&rport->dev); | ||
2031 | } else | ||
2032 | spin_unlock_irqrestore(shost->host_lock, | ||
2033 | flags); | ||
2018 | 2034 | ||
2019 | return rport; | 2035 | return rport; |
2020 | } | 2036 | } |
2021 | } | 2037 | } |
2022 | } | 2038 | } |
2023 | 2039 | ||
2024 | /* Search the bindings array */ | 2040 | /* |
2041 | * Search the bindings array | ||
2042 | * Note: if never a FCP target, you won't be on this list | ||
2043 | */ | ||
2025 | if (fc_host->tgtid_bind_type != FC_TGTID_BIND_NONE) { | 2044 | if (fc_host->tgtid_bind_type != FC_TGTID_BIND_NONE) { |
2026 | 2045 | ||
2027 | /* search for a matching consistent binding */ | 2046 | /* search for a matching consistent binding */ |
@@ -2158,15 +2177,24 @@ fc_remote_port_delete(struct fc_rport *rport) | |||
2158 | 2177 | ||
2159 | spin_lock_irqsave(shost->host_lock, flags); | 2178 | spin_lock_irqsave(shost->host_lock, flags); |
2160 | 2179 | ||
2161 | /* If no scsi target id mapping, delete it */ | 2180 | if (rport->port_state != FC_PORTSTATE_ONLINE) { |
2162 | if (rport->scsi_target_id == -1) { | ||
2163 | list_del(&rport->peers); | ||
2164 | rport->port_state = FC_PORTSTATE_DELETED; | ||
2165 | fc_queue_work(shost, &rport->rport_delete_work); | ||
2166 | spin_unlock_irqrestore(shost->host_lock, flags); | 2181 | spin_unlock_irqrestore(shost->host_lock, flags); |
2167 | return; | 2182 | return; |
2168 | } | 2183 | } |
2169 | 2184 | ||
2185 | /* | ||
2186 | * In the past, we if this was not an FCP-Target, we would | ||
2187 | * unconditionally just jump to deleting the rport. | ||
2188 | * However, rports can be used as node containers by the LLDD, | ||
2189 | * and its not appropriate to just terminate the rport at the | ||
2190 | * first sign of a loss in connectivity. The LLDD may want to | ||
2191 | * send ELS traffic to re-validate the login. If the rport is | ||
2192 | * immediately deleted, it makes it inappropriate for a node | ||
2193 | * container. | ||
2194 | * So... we now unconditionally wait dev_loss_tmo before | ||
2195 | * destroying an rport. | ||
2196 | */ | ||
2197 | |||
2170 | rport->port_state = FC_PORTSTATE_BLOCKED; | 2198 | rport->port_state = FC_PORTSTATE_BLOCKED; |
2171 | 2199 | ||
2172 | rport->flags |= FC_RPORT_DEVLOSS_PENDING; | 2200 | rport->flags |= FC_RPORT_DEVLOSS_PENDING; |
@@ -2263,11 +2291,11 @@ fc_remote_port_rolechg(struct fc_rport *rport, u32 roles) | |||
2263 | EXPORT_SYMBOL(fc_remote_port_rolechg); | 2291 | EXPORT_SYMBOL(fc_remote_port_rolechg); |
2264 | 2292 | ||
2265 | /** | 2293 | /** |
2266 | * fc_timeout_deleted_rport - Timeout handler for a deleted remote port that | 2294 | * fc_timeout_deleted_rport - Timeout handler for a deleted remote port, |
2267 | * was a SCSI target (thus was blocked), and failed | 2295 | * which we blocked, and has now failed to return |
2268 | * to return in the alloted time. | 2296 | * in the allotted time. |
2269 | * | 2297 | * |
2270 | * @work: rport target that failed to reappear in the alloted time. | 2298 | * @work: rport target that failed to reappear in the allotted time. |
2271 | **/ | 2299 | **/ |
2272 | static void | 2300 | static void |
2273 | fc_timeout_deleted_rport(struct work_struct *work) | 2301 | fc_timeout_deleted_rport(struct work_struct *work) |
@@ -2283,10 +2311,12 @@ fc_timeout_deleted_rport(struct work_struct *work) | |||
2283 | rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; | 2311 | rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; |
2284 | 2312 | ||
2285 | /* | 2313 | /* |
2286 | * If the port is ONLINE, then it came back. Validate it's still an | 2314 | * If the port is ONLINE, then it came back. If it was a SCSI |
2287 | * FCP target. If not, tear down the scsi_target on it. | 2315 | * target, validate it still is. If not, tear down the |
2316 | * scsi_target on it. | ||
2288 | */ | 2317 | */ |
2289 | if ((rport->port_state == FC_PORTSTATE_ONLINE) && | 2318 | if ((rport->port_state == FC_PORTSTATE_ONLINE) && |
2319 | (rport->scsi_target_id != -1) && | ||
2290 | !(rport->roles & FC_RPORT_ROLE_FCP_TARGET)) { | 2320 | !(rport->roles & FC_RPORT_ROLE_FCP_TARGET)) { |
2291 | dev_printk(KERN_ERR, &rport->dev, | 2321 | dev_printk(KERN_ERR, &rport->dev, |
2292 | "blocked FC remote port time out: no longer" | 2322 | "blocked FC remote port time out: no longer" |
@@ -2297,18 +2327,24 @@ fc_timeout_deleted_rport(struct work_struct *work) | |||
2297 | return; | 2327 | return; |
2298 | } | 2328 | } |
2299 | 2329 | ||
2330 | /* NOOP state - we're flushing workq's */ | ||
2300 | if (rport->port_state != FC_PORTSTATE_BLOCKED) { | 2331 | if (rport->port_state != FC_PORTSTATE_BLOCKED) { |
2301 | spin_unlock_irqrestore(shost->host_lock, flags); | 2332 | spin_unlock_irqrestore(shost->host_lock, flags); |
2302 | dev_printk(KERN_ERR, &rport->dev, | 2333 | dev_printk(KERN_ERR, &rport->dev, |
2303 | "blocked FC remote port time out: leaving target alone\n"); | 2334 | "blocked FC remote port time out: leaving" |
2335 | " rport%s alone\n", | ||
2336 | (rport->scsi_target_id != -1) ? " and starget" : ""); | ||
2304 | return; | 2337 | return; |
2305 | } | 2338 | } |
2306 | 2339 | ||
2307 | if (fc_host->tgtid_bind_type == FC_TGTID_BIND_NONE) { | 2340 | if ((fc_host->tgtid_bind_type == FC_TGTID_BIND_NONE) || |
2341 | (rport->scsi_target_id == -1)) { | ||
2308 | list_del(&rport->peers); | 2342 | list_del(&rport->peers); |
2309 | rport->port_state = FC_PORTSTATE_DELETED; | 2343 | rport->port_state = FC_PORTSTATE_DELETED; |
2310 | dev_printk(KERN_ERR, &rport->dev, | 2344 | dev_printk(KERN_ERR, &rport->dev, |
2311 | "blocked FC remote port time out: removing target\n"); | 2345 | "blocked FC remote port time out: removing" |
2346 | " rport%s\n", | ||
2347 | (rport->scsi_target_id != -1) ? " and starget" : ""); | ||
2312 | fc_queue_work(shost, &rport->rport_delete_work); | 2348 | fc_queue_work(shost, &rport->rport_delete_work); |
2313 | spin_unlock_irqrestore(shost->host_lock, flags); | 2349 | spin_unlock_irqrestore(shost->host_lock, flags); |
2314 | return; | 2350 | return; |
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c index 3158949ffa62..e7b85e832eb5 100644 --- a/drivers/scsi/tmscsim.c +++ b/drivers/scsi/tmscsim.c | |||
@@ -351,6 +351,27 @@ static u8 dc390_clock_speed[] = {100,80,67,57,50, 40, 31, 20}; | |||
351 | * (DCBs, SRBs, Queueing) | 351 | * (DCBs, SRBs, Queueing) |
352 | * | 352 | * |
353 | **********************************************************************/ | 353 | **********************************************************************/ |
354 | static void inline dc390_start_segment(struct dc390_srb* pSRB) | ||
355 | { | ||
356 | struct scatterlist *psgl = pSRB->pSegmentList; | ||
357 | |||
358 | /* start new sg segment */ | ||
359 | pSRB->SGBusAddr = sg_dma_address(psgl); | ||
360 | pSRB->SGToBeXferLen = sg_dma_len(psgl); | ||
361 | } | ||
362 | |||
363 | static unsigned long inline dc390_advance_segment(struct dc390_srb* pSRB, u32 residue) | ||
364 | { | ||
365 | unsigned long xfer = pSRB->SGToBeXferLen - residue; | ||
366 | |||
367 | /* xfer more bytes transferred */ | ||
368 | pSRB->SGBusAddr += xfer; | ||
369 | pSRB->TotalXferredLen += xfer; | ||
370 | pSRB->SGToBeXferLen = residue; | ||
371 | |||
372 | return xfer; | ||
373 | } | ||
374 | |||
354 | static struct dc390_dcb __inline__ *dc390_findDCB ( struct dc390_acb* pACB, u8 id, u8 lun) | 375 | static struct dc390_dcb __inline__ *dc390_findDCB ( struct dc390_acb* pACB, u8 id, u8 lun) |
355 | { | 376 | { |
356 | struct dc390_dcb* pDCB = pACB->pLinkDCB; if (!pDCB) return NULL; | 377 | struct dc390_dcb* pDCB = pACB->pLinkDCB; if (!pDCB) return NULL; |
@@ -625,70 +646,6 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr | |||
625 | return 0; | 646 | return 0; |
626 | } | 647 | } |
627 | 648 | ||
628 | //#define DMA_INT EN_DMA_INT /*| EN_PAGE_INT*/ | ||
629 | #define DMA_INT 0 | ||
630 | |||
631 | #if DMA_INT | ||
632 | /* This is similar to AM53C974.c ... */ | ||
633 | static u8 | ||
634 | dc390_dma_intr (struct dc390_acb* pACB) | ||
635 | { | ||
636 | struct dc390_srb* pSRB; | ||
637 | u8 dstate; | ||
638 | DEBUG0(u16 pstate; struct pci_dev *pdev = pACB->pdev); | ||
639 | |||
640 | DEBUG0(pci_read_config_word(pdev, PCI_STATUS, &pstate)); | ||
641 | DEBUG0(if (pstate & (PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY))\ | ||
642 | { printk(KERN_WARNING "DC390: PCI state = %04x!\n", pstate); \ | ||
643 | pci_write_config_word(pdev, PCI_STATUS, (PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY));}); | ||
644 | |||
645 | dstate = DC390_read8 (DMA_Status); | ||
646 | |||
647 | if (! pACB->pActiveDCB || ! pACB->pActiveDCB->pActiveSRB) return dstate; | ||
648 | else pSRB = pACB->pActiveDCB->pActiveSRB; | ||
649 | |||
650 | if (dstate & (DMA_XFER_ABORT | DMA_XFER_ERROR | POWER_DOWN | PCI_MS_ABORT)) | ||
651 | { | ||
652 | printk (KERN_ERR "DC390: DMA error (%02x)!\n", dstate); | ||
653 | return dstate; | ||
654 | } | ||
655 | if (dstate & DMA_XFER_DONE) | ||
656 | { | ||
657 | u32 residual, xferCnt; int ctr = 6000000; | ||
658 | if (! (DC390_read8 (DMA_Cmd) & READ_DIRECTION)) | ||
659 | { | ||
660 | do | ||
661 | { | ||
662 | DEBUG1(printk (KERN_DEBUG "DC390: read residual bytes ... \n")); | ||
663 | dstate = DC390_read8 (DMA_Status); | ||
664 | residual = DC390_read8 (CtcReg_Low) | DC390_read8 (CtcReg_Mid) << 8 | | ||
665 | DC390_read8 (CtcReg_High) << 16; | ||
666 | residual += DC390_read8 (Current_Fifo) & 0x1f; | ||
667 | } while (residual && ! (dstate & SCSI_INTERRUPT) && --ctr); | ||
668 | if (!ctr) printk (KERN_CRIT "DC390: dma_intr: DMA aborted unfinished: %06x bytes remain!!\n", DC390_read32 (DMA_Wk_ByteCntr)); | ||
669 | /* residual = ... */ | ||
670 | } | ||
671 | else | ||
672 | residual = 0; | ||
673 | |||
674 | /* ??? */ | ||
675 | |||
676 | xferCnt = pSRB->SGToBeXferLen - residual; | ||
677 | pSRB->SGBusAddr += xferCnt; | ||
678 | pSRB->TotalXferredLen += xferCnt; | ||
679 | pSRB->SGToBeXferLen = residual; | ||
680 | # ifdef DC390_DEBUG0 | ||
681 | printk (KERN_INFO "DC390: DMA: residual = %i, xfer = %i\n", | ||
682 | (unsigned int)residual, (unsigned int)xferCnt); | ||
683 | # endif | ||
684 | |||
685 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD); | ||
686 | } | ||
687 | dc390_laststatus &= ~0xff000000; dc390_laststatus |= dstate << 24; | ||
688 | return dstate; | ||
689 | } | ||
690 | #endif | ||
691 | |||
692 | 649 | ||
693 | static void __inline__ | 650 | static void __inline__ |
694 | dc390_InvalidCmd(struct dc390_acb* pACB) | 651 | dc390_InvalidCmd(struct dc390_acb* pACB) |
@@ -708,9 +665,6 @@ DC390_Interrupt(void *dev_id) | |||
708 | u8 phase; | 665 | u8 phase; |
709 | void (*stateV)( struct dc390_acb*, struct dc390_srb*, u8 *); | 666 | void (*stateV)( struct dc390_acb*, struct dc390_srb*, u8 *); |
710 | u8 istate, istatus; | 667 | u8 istate, istatus; |
711 | #if DMA_INT | ||
712 | u8 dstatus; | ||
713 | #endif | ||
714 | 668 | ||
715 | sstatus = DC390_read8 (Scsi_Status); | 669 | sstatus = DC390_read8 (Scsi_Status); |
716 | if( !(sstatus & INTERRUPT) ) | 670 | if( !(sstatus & INTERRUPT) ) |
@@ -718,22 +672,9 @@ DC390_Interrupt(void *dev_id) | |||
718 | 672 | ||
719 | DEBUG1(printk (KERN_DEBUG "sstatus=%02x,", sstatus)); | 673 | DEBUG1(printk (KERN_DEBUG "sstatus=%02x,", sstatus)); |
720 | 674 | ||
721 | #if DMA_INT | ||
722 | spin_lock_irq(pACB->pScsiHost->host_lock); | ||
723 | dstatus = dc390_dma_intr (pACB); | ||
724 | spin_unlock_irq(pACB->pScsiHost->host_lock); | ||
725 | |||
726 | DEBUG1(printk (KERN_DEBUG "dstatus=%02x,", dstatus)); | ||
727 | if (! (dstatus & SCSI_INTERRUPT)) | ||
728 | { | ||
729 | DEBUG0(printk (KERN_WARNING "DC390 Int w/o SCSI actions (only DMA?)\n")); | ||
730 | return IRQ_NONE; | ||
731 | } | ||
732 | #else | ||
733 | //DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT); | 675 | //DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT); |
734 | //dstatus = DC390_read8 (DMA_Status); | 676 | //dstatus = DC390_read8 (DMA_Status); |
735 | //DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT); | 677 | //DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT); |
736 | #endif | ||
737 | 678 | ||
738 | spin_lock_irq(pACB->pScsiHost->host_lock); | 679 | spin_lock_irq(pACB->pScsiHost->host_lock); |
739 | 680 | ||
@@ -821,11 +762,10 @@ static irqreturn_t do_DC390_Interrupt(int irq, void *dev_id) | |||
821 | } | 762 | } |
822 | 763 | ||
823 | static void | 764 | static void |
824 | dc390_DataOut_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | 765 | dc390_DataOut_0(struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) |
825 | { | 766 | { |
826 | u8 sstatus; | 767 | u8 sstatus; |
827 | struct scatterlist *psgl; | 768 | u32 ResidCnt; |
828 | u32 ResidCnt, xferCnt; | ||
829 | u8 dstate = 0; | 769 | u8 dstate = 0; |
830 | 770 | ||
831 | sstatus = *psstatus; | 771 | sstatus = *psstatus; |
@@ -856,42 +796,35 @@ dc390_DataOut_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | |||
856 | if( pSRB->SGIndex < pSRB->SGcount ) | 796 | if( pSRB->SGIndex < pSRB->SGcount ) |
857 | { | 797 | { |
858 | pSRB->pSegmentList++; | 798 | pSRB->pSegmentList++; |
859 | psgl = pSRB->pSegmentList; | ||
860 | 799 | ||
861 | pSRB->SGBusAddr = cpu_to_le32(pci_dma_lo32(sg_dma_address(psgl))); | 800 | dc390_start_segment(pSRB); |
862 | pSRB->SGToBeXferLen = cpu_to_le32(sg_dma_len(psgl)); | ||
863 | } | 801 | } |
864 | else | 802 | else |
865 | pSRB->SGToBeXferLen = 0; | 803 | pSRB->SGToBeXferLen = 0; |
866 | } | 804 | } |
867 | else | 805 | else |
868 | { | 806 | { |
869 | ResidCnt = (u32) DC390_read8 (Current_Fifo) & 0x1f; | 807 | ResidCnt = ((u32) DC390_read8 (Current_Fifo) & 0x1f) + |
870 | ResidCnt |= (u32) DC390_read8 (CtcReg_High) << 16; | 808 | (((u32) DC390_read8 (CtcReg_High) << 16) | |
871 | ResidCnt |= (u32) DC390_read8 (CtcReg_Mid) << 8; | 809 | ((u32) DC390_read8 (CtcReg_Mid) << 8) | |
872 | ResidCnt += (u32) DC390_read8 (CtcReg_Low); | 810 | (u32) DC390_read8 (CtcReg_Low)); |
873 | 811 | ||
874 | xferCnt = pSRB->SGToBeXferLen - ResidCnt; | 812 | dc390_advance_segment(pSRB, ResidCnt); |
875 | pSRB->SGBusAddr += xferCnt; | ||
876 | pSRB->TotalXferredLen += xferCnt; | ||
877 | pSRB->SGToBeXferLen = ResidCnt; | ||
878 | } | 813 | } |
879 | } | 814 | } |
880 | if ((*psstatus & 7) != SCSI_DATA_OUT) | 815 | if ((*psstatus & 7) != SCSI_DATA_OUT) |
881 | { | 816 | { |
882 | DC390_write8 (DMA_Cmd, WRITE_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 817 | DC390_write8 (DMA_Cmd, WRITE_DIRECTION+DMA_IDLE_CMD); |
883 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); | 818 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); |
884 | } | 819 | } |
885 | } | 820 | } |
886 | 821 | ||
887 | static void | 822 | static void |
888 | dc390_DataIn_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | 823 | dc390_DataIn_0(struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) |
889 | { | 824 | { |
890 | u8 sstatus, residual, bval; | 825 | u8 sstatus, residual, bval; |
891 | struct scatterlist *psgl; | 826 | u32 ResidCnt, i; |
892 | u32 ResidCnt, i; | ||
893 | unsigned long xferCnt; | 827 | unsigned long xferCnt; |
894 | u8 *ptr; | ||
895 | 828 | ||
896 | sstatus = *psstatus; | 829 | sstatus = *psstatus; |
897 | 830 | ||
@@ -922,19 +855,17 @@ dc390_DataIn_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | |||
922 | DEBUG1(ResidCnt = ((unsigned long) DC390_read8 (CtcReg_High) << 16) \ | 855 | DEBUG1(ResidCnt = ((unsigned long) DC390_read8 (CtcReg_High) << 16) \ |
923 | + ((unsigned long) DC390_read8 (CtcReg_Mid) << 8) \ | 856 | + ((unsigned long) DC390_read8 (CtcReg_Mid) << 8) \ |
924 | + ((unsigned long) DC390_read8 (CtcReg_Low))); | 857 | + ((unsigned long) DC390_read8 (CtcReg_Low))); |
925 | DEBUG1(printk (KERN_DEBUG "Count_2_Zero (ResidCnt=%i,ToBeXfer=%li),", ResidCnt, pSRB->SGToBeXferLen)); | 858 | DEBUG1(printk (KERN_DEBUG "Count_2_Zero (ResidCnt=%u,ToBeXfer=%lu),", ResidCnt, pSRB->SGToBeXferLen)); |
926 | 859 | ||
927 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 860 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); |
928 | 861 | ||
929 | pSRB->TotalXferredLen += pSRB->SGToBeXferLen; | 862 | pSRB->TotalXferredLen += pSRB->SGToBeXferLen; |
930 | pSRB->SGIndex++; | 863 | pSRB->SGIndex++; |
931 | if( pSRB->SGIndex < pSRB->SGcount ) | 864 | if( pSRB->SGIndex < pSRB->SGcount ) |
932 | { | 865 | { |
933 | pSRB->pSegmentList++; | 866 | pSRB->pSegmentList++; |
934 | psgl = pSRB->pSegmentList; | ||
935 | 867 | ||
936 | pSRB->SGBusAddr = cpu_to_le32(pci_dma_lo32(sg_dma_address(psgl))); | 868 | dc390_start_segment(pSRB); |
937 | pSRB->SGToBeXferLen = cpu_to_le32(sg_dma_len(psgl)); | ||
938 | } | 869 | } |
939 | else | 870 | else |
940 | pSRB->SGToBeXferLen = 0; | 871 | pSRB->SGToBeXferLen = 0; |
@@ -973,47 +904,45 @@ din_1: | |||
973 | } | 904 | } |
974 | /* It seems a DMA Blast abort isn't that bad ... */ | 905 | /* It seems a DMA Blast abort isn't that bad ... */ |
975 | if (!i) printk (KERN_ERR "DC390: DMA Blast aborted unfinished!\n"); | 906 | if (!i) printk (KERN_ERR "DC390: DMA Blast aborted unfinished!\n"); |
976 | //DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 907 | //DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); |
977 | dc390_laststatus &= ~0xff000000; dc390_laststatus |= bval << 24; | 908 | dc390_laststatus &= ~0xff000000; |
909 | dc390_laststatus |= bval << 24; | ||
978 | 910 | ||
979 | DEBUG1(printk (KERN_DEBUG "Blast: Read %i times DMA_Status %02x", 0xa000-i, bval)); | 911 | DEBUG1(printk (KERN_DEBUG "Blast: Read %i times DMA_Status %02x", 0xa000-i, bval)); |
980 | ResidCnt = (u32) DC390_read8 (CtcReg_High); | 912 | ResidCnt = (((u32) DC390_read8 (CtcReg_High) << 16) | |
981 | ResidCnt <<= 8; | 913 | ((u32) DC390_read8 (CtcReg_Mid) << 8)) | |
982 | ResidCnt |= (u32) DC390_read8 (CtcReg_Mid); | 914 | (u32) DC390_read8 (CtcReg_Low); |
983 | ResidCnt <<= 8; | 915 | |
984 | ResidCnt |= (u32) DC390_read8 (CtcReg_Low); | 916 | xferCnt = dc390_advance_segment(pSRB, ResidCnt); |
985 | 917 | ||
986 | xferCnt = pSRB->SGToBeXferLen - ResidCnt; | 918 | if (residual) { |
987 | pSRB->SGBusAddr += xferCnt; | 919 | size_t count = 1; |
988 | pSRB->TotalXferredLen += xferCnt; | 920 | size_t offset = pSRB->SGBusAddr - sg_dma_address(pSRB->pSegmentList); |
989 | pSRB->SGToBeXferLen = ResidCnt; | 921 | unsigned long flags; |
990 | 922 | u8 *ptr; | |
991 | if( residual ) | 923 | |
992 | { | ||
993 | static int feedback_requested; | ||
994 | bval = DC390_read8 (ScsiFifo); /* get one residual byte */ | 924 | bval = DC390_read8 (ScsiFifo); /* get one residual byte */ |
995 | 925 | ||
996 | if (!feedback_requested) { | 926 | local_irq_save(flags); |
997 | feedback_requested = 1; | 927 | ptr = scsi_kmap_atomic_sg(pSRB->pSegmentList, pSRB->SGcount, &offset, &count); |
998 | printk(KERN_WARNING "%s: Please, contact <linux-scsi@vger.kernel.org> " | 928 | if (likely(ptr)) { |
999 | "to help improve support for your system.\n", __FILE__); | 929 | *(ptr + offset) = bval; |
930 | scsi_kunmap_atomic_sg(ptr); | ||
1000 | } | 931 | } |
932 | local_irq_restore(flags); | ||
933 | WARN_ON(!ptr); | ||
1001 | 934 | ||
1002 | ptr = (u8 *) bus_to_virt( pSRB->SGBusAddr ); | 935 | /* 1 more byte read */ |
1003 | *ptr = bval; | 936 | xferCnt += dc390_advance_segment(pSRB, pSRB->SGToBeXferLen - 1); |
1004 | pSRB->SGBusAddr++; xferCnt++; | ||
1005 | pSRB->TotalXferredLen++; | ||
1006 | pSRB->SGToBeXferLen--; | ||
1007 | } | 937 | } |
1008 | DEBUG1(printk (KERN_DEBUG "Xfered: %li, Total: %li, Remaining: %li\n", xferCnt,\ | 938 | DEBUG1(printk (KERN_DEBUG "Xfered: %lu, Total: %lu, Remaining: %lu\n", xferCnt,\ |
1009 | pSRB->TotalXferredLen, pSRB->SGToBeXferLen)); | 939 | pSRB->TotalXferredLen, pSRB->SGToBeXferLen)); |
1010 | |||
1011 | } | 940 | } |
1012 | } | 941 | } |
1013 | if ((*psstatus & 7) != SCSI_DATA_IN) | 942 | if ((*psstatus & 7) != SCSI_DATA_IN) |
1014 | { | 943 | { |
1015 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); | 944 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); |
1016 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 945 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); |
1017 | } | 946 | } |
1018 | } | 947 | } |
1019 | 948 | ||
@@ -1216,7 +1145,7 @@ dc390_MsgIn_set_sync (struct dc390_acb* pACB, struct dc390_srb* pSRB) | |||
1216 | 1145 | ||
1217 | 1146 | ||
1218 | /* handle RESTORE_PTR */ | 1147 | /* handle RESTORE_PTR */ |
1219 | /* I presume, this command is already mapped, so, have to remap. */ | 1148 | /* This doesn't look very healthy... to-be-fixed */ |
1220 | static void | 1149 | static void |
1221 | dc390_restore_ptr (struct dc390_acb* pACB, struct dc390_srb* pSRB) | 1150 | dc390_restore_ptr (struct dc390_acb* pACB, struct dc390_srb* pSRB) |
1222 | { | 1151 | { |
@@ -1225,6 +1154,7 @@ dc390_restore_ptr (struct dc390_acb* pACB, struct dc390_srb* pSRB) | |||
1225 | pSRB->TotalXferredLen = 0; | 1154 | pSRB->TotalXferredLen = 0; |
1226 | pSRB->SGIndex = 0; | 1155 | pSRB->SGIndex = 0; |
1227 | if (pcmd->use_sg) { | 1156 | if (pcmd->use_sg) { |
1157 | size_t saved; | ||
1228 | pSRB->pSegmentList = (struct scatterlist *)pcmd->request_buffer; | 1158 | pSRB->pSegmentList = (struct scatterlist *)pcmd->request_buffer; |
1229 | psgl = pSRB->pSegmentList; | 1159 | psgl = pSRB->pSegmentList; |
1230 | //dc390_pci_sync(pSRB); | 1160 | //dc390_pci_sync(pSRB); |
@@ -1236,15 +1166,16 @@ dc390_restore_ptr (struct dc390_acb* pACB, struct dc390_srb* pSRB) | |||
1236 | if( pSRB->SGIndex < pSRB->SGcount ) | 1166 | if( pSRB->SGIndex < pSRB->SGcount ) |
1237 | { | 1167 | { |
1238 | pSRB->pSegmentList++; | 1168 | pSRB->pSegmentList++; |
1239 | psgl = pSRB->pSegmentList; | 1169 | |
1240 | pSRB->SGBusAddr = cpu_to_le32(pci_dma_lo32(sg_dma_address(psgl))); | 1170 | dc390_start_segment(pSRB); |
1241 | pSRB->SGToBeXferLen = cpu_to_le32(sg_dma_len(psgl)); | ||
1242 | } | 1171 | } |
1243 | else | 1172 | else |
1244 | pSRB->SGToBeXferLen = 0; | 1173 | pSRB->SGToBeXferLen = 0; |
1245 | } | 1174 | } |
1246 | pSRB->SGToBeXferLen -= (pSRB->Saved_Ptr - pSRB->TotalXferredLen); | 1175 | |
1247 | pSRB->SGBusAddr += (pSRB->Saved_Ptr - pSRB->TotalXferredLen); | 1176 | saved = pSRB->Saved_Ptr - pSRB->TotalXferredLen; |
1177 | pSRB->SGToBeXferLen -= saved; | ||
1178 | pSRB->SGBusAddr += saved; | ||
1248 | printk (KERN_INFO "DC390: Pointer restored. Segment %i, Total %li, Bus %08lx\n", | 1179 | printk (KERN_INFO "DC390: Pointer restored. Segment %i, Total %li, Bus %08lx\n", |
1249 | pSRB->SGIndex, pSRB->Saved_Ptr, pSRB->SGBusAddr); | 1180 | pSRB->SGIndex, pSRB->Saved_Ptr, pSRB->SGBusAddr); |
1250 | 1181 | ||
@@ -1365,7 +1296,6 @@ dc390_MsgIn_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | |||
1365 | static void | 1296 | static void |
1366 | dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) | 1297 | dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) |
1367 | { | 1298 | { |
1368 | struct scatterlist *psgl; | ||
1369 | unsigned long lval; | 1299 | unsigned long lval; |
1370 | struct dc390_dcb* pDCB = pACB->pActiveDCB; | 1300 | struct dc390_dcb* pDCB = pACB->pActiveDCB; |
1371 | 1301 | ||
@@ -1391,12 +1321,11 @@ dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) | |||
1391 | 1321 | ||
1392 | if( pSRB->SGIndex < pSRB->SGcount ) | 1322 | if( pSRB->SGIndex < pSRB->SGcount ) |
1393 | { | 1323 | { |
1394 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir /* | DMA_INT */); | 1324 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); |
1395 | if( !pSRB->SGToBeXferLen ) | 1325 | if( !pSRB->SGToBeXferLen ) |
1396 | { | 1326 | { |
1397 | psgl = pSRB->pSegmentList; | 1327 | dc390_start_segment(pSRB); |
1398 | pSRB->SGBusAddr = cpu_to_le32(pci_dma_lo32(sg_dma_address(psgl))); | 1328 | |
1399 | pSRB->SGToBeXferLen = cpu_to_le32(sg_dma_len(psgl)); | ||
1400 | DEBUG1(printk (KERN_DEBUG " DC390: Next SG segment.")); | 1329 | DEBUG1(printk (KERN_DEBUG " DC390: Next SG segment.")); |
1401 | } | 1330 | } |
1402 | lval = pSRB->SGToBeXferLen; | 1331 | lval = pSRB->SGToBeXferLen; |
@@ -1410,12 +1339,12 @@ dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) | |||
1410 | DC390_write32 (DMA_XferCnt, pSRB->SGToBeXferLen); | 1339 | DC390_write32 (DMA_XferCnt, pSRB->SGToBeXferLen); |
1411 | DC390_write32 (DMA_XferAddr, pSRB->SGBusAddr); | 1340 | DC390_write32 (DMA_XferAddr, pSRB->SGBusAddr); |
1412 | 1341 | ||
1413 | //DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); /* | DMA_INT; */ | 1342 | //DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); |
1414 | pSRB->SRBState = SRB_DATA_XFER; | 1343 | pSRB->SRBState = SRB_DATA_XFER; |
1415 | 1344 | ||
1416 | DC390_write8 (ScsiCmd, DMA_COMMAND+INFO_XFER_CMD); | 1345 | DC390_write8 (ScsiCmd, DMA_COMMAND+INFO_XFER_CMD); |
1417 | 1346 | ||
1418 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir | DMA_INT); | 1347 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir); |
1419 | //DEBUG1(DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT)); | 1348 | //DEBUG1(DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT)); |
1420 | //DEBUG1(printk (KERN_DEBUG "DC390: DMA_Status: %02x\n", DC390_read8 (DMA_Status))); | 1349 | //DEBUG1(printk (KERN_DEBUG "DC390: DMA_Status: %02x\n", DC390_read8 (DMA_Status))); |
1421 | //DEBUG1(DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT)); | 1350 | //DEBUG1(DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT)); |
@@ -1436,8 +1365,8 @@ dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) | |||
1436 | pSRB->SRBState |= SRB_XFERPAD; | 1365 | pSRB->SRBState |= SRB_XFERPAD; |
1437 | DC390_write8 (ScsiCmd, DMA_COMMAND+XFER_PAD_BYTE); | 1366 | DC390_write8 (ScsiCmd, DMA_COMMAND+XFER_PAD_BYTE); |
1438 | /* | 1367 | /* |
1439 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); // | DMA_INT; | 1368 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); |
1440 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir | DMA_INT); | 1369 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir); |
1441 | */ | 1370 | */ |
1442 | } | 1371 | } |
1443 | } | 1372 | } |
diff --git a/drivers/scsi/tmscsim.h b/drivers/scsi/tmscsim.h index 9b66fa8d38d9..c3d8c80cfb38 100644 --- a/drivers/scsi/tmscsim.h +++ b/drivers/scsi/tmscsim.h | |||
@@ -19,14 +19,6 @@ | |||
19 | 19 | ||
20 | #define SEL_TIMEOUT 153 /* 250 ms selection timeout (@ 40 MHz) */ | 20 | #define SEL_TIMEOUT 153 /* 250 ms selection timeout (@ 40 MHz) */ |
21 | 21 | ||
22 | #define pci_dma_lo32(a) (a & 0xffffffff) | ||
23 | |||
24 | typedef u8 UCHAR; /* 8 bits */ | ||
25 | typedef u16 USHORT; /* 16 bits */ | ||
26 | typedef u32 UINT; /* 32 bits */ | ||
27 | typedef unsigned long ULONG; /* 32/64 bits */ | ||
28 | |||
29 | |||
30 | /* | 22 | /* |
31 | ;----------------------------------------------------------------------- | 23 | ;----------------------------------------------------------------------- |
32 | ; SCSI Request Block | 24 | ; SCSI Request Block |
@@ -43,7 +35,9 @@ struct scatterlist *pSegmentList; | |||
43 | 35 | ||
44 | struct scatterlist Segmentx; /* make a one entry of S/G list table */ | 36 | struct scatterlist Segmentx; /* make a one entry of S/G list table */ |
45 | 37 | ||
46 | unsigned long SGBusAddr; /*;a segment starting address as seen by AM53C974A*/ | 38 | unsigned long SGBusAddr; /*;a segment starting address as seen by AM53C974A |
39 | in CPU endianness. We're only getting 32-bit bus | ||
40 | addresses by default */ | ||
47 | unsigned long SGToBeXferLen; /*; to be xfer length */ | 41 | unsigned long SGToBeXferLen; /*; to be xfer length */ |
48 | unsigned long TotalXferredLen; | 42 | unsigned long TotalXferredLen; |
49 | unsigned long SavedTotXLen; | 43 | unsigned long SavedTotXLen; |
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index ad0182ef7809..2e6bdc4e7a0a 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h | |||
@@ -314,8 +314,7 @@ struct scsi_core { | |||
314 | struct list_head task_queue; | 314 | struct list_head task_queue; |
315 | int task_queue_size; | 315 | int task_queue_size; |
316 | 316 | ||
317 | struct semaphore queue_thread_sema; | 317 | struct task_struct *queue_thread; |
318 | int queue_thread_kill; | ||
319 | }; | 318 | }; |
320 | 319 | ||
321 | struct sas_ha_event { | 320 | struct sas_ha_event { |