diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/s390/scsi/zfcp_fsf.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/s390/scsi/zfcp_fsf.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_fsf.c | 758 |
1 files changed, 340 insertions, 418 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 9d1d7d1842ce..022fb6a8cb83 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -18,12 +18,14 @@ | |||
18 | #include "zfcp_qdio.h" | 18 | #include "zfcp_qdio.h" |
19 | #include "zfcp_reqlist.h" | 19 | #include "zfcp_reqlist.h" |
20 | 20 | ||
21 | struct kmem_cache *zfcp_fsf_qtcb_cache; | ||
22 | |||
21 | static void zfcp_fsf_request_timeout_handler(unsigned long data) | 23 | static void zfcp_fsf_request_timeout_handler(unsigned long data) |
22 | { | 24 | { |
23 | struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; | 25 | struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; |
24 | zfcp_qdio_siosl(adapter); | 26 | zfcp_qdio_siosl(adapter); |
25 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, | 27 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, |
26 | "fsrth_1", NULL); | 28 | "fsrth_1"); |
27 | } | 29 | } |
28 | 30 | ||
29 | static void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, | 31 | static void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, |
@@ -61,50 +63,11 @@ static u32 fsf_qtcb_type[] = { | |||
61 | [FSF_QTCB_UPLOAD_CONTROL_FILE] = FSF_SUPPORT_COMMAND | 63 | [FSF_QTCB_UPLOAD_CONTROL_FILE] = FSF_SUPPORT_COMMAND |
62 | }; | 64 | }; |
63 | 65 | ||
64 | static void zfcp_act_eval_err(struct zfcp_adapter *adapter, u32 table) | ||
65 | { | ||
66 | u16 subtable = table >> 16; | ||
67 | u16 rule = table & 0xffff; | ||
68 | const char *act_type[] = { "unknown", "OS", "WWPN", "DID", "LUN" }; | ||
69 | |||
70 | if (subtable && subtable < ARRAY_SIZE(act_type)) | ||
71 | dev_warn(&adapter->ccw_device->dev, | ||
72 | "Access denied according to ACT rule type %s, " | ||
73 | "rule %d\n", act_type[subtable], rule); | ||
74 | } | ||
75 | |||
76 | static void zfcp_fsf_access_denied_port(struct zfcp_fsf_req *req, | ||
77 | struct zfcp_port *port) | ||
78 | { | ||
79 | struct fsf_qtcb_header *header = &req->qtcb->header; | ||
80 | dev_warn(&req->adapter->ccw_device->dev, | ||
81 | "Access denied to port 0x%016Lx\n", | ||
82 | (unsigned long long)port->wwpn); | ||
83 | zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[0]); | ||
84 | zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[1]); | ||
85 | zfcp_erp_port_access_denied(port, "fspad_1", req); | ||
86 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
87 | } | ||
88 | |||
89 | static void zfcp_fsf_access_denied_unit(struct zfcp_fsf_req *req, | ||
90 | struct zfcp_unit *unit) | ||
91 | { | ||
92 | struct fsf_qtcb_header *header = &req->qtcb->header; | ||
93 | dev_warn(&req->adapter->ccw_device->dev, | ||
94 | "Access denied to unit 0x%016Lx on port 0x%016Lx\n", | ||
95 | (unsigned long long)unit->fcp_lun, | ||
96 | (unsigned long long)unit->port->wwpn); | ||
97 | zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[0]); | ||
98 | zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[1]); | ||
99 | zfcp_erp_unit_access_denied(unit, "fsuad_1", req); | ||
100 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
101 | } | ||
102 | |||
103 | static void zfcp_fsf_class_not_supp(struct zfcp_fsf_req *req) | 66 | static void zfcp_fsf_class_not_supp(struct zfcp_fsf_req *req) |
104 | { | 67 | { |
105 | dev_err(&req->adapter->ccw_device->dev, "FCP device not " | 68 | dev_err(&req->adapter->ccw_device->dev, "FCP device not " |
106 | "operational because of an unsupported FC class\n"); | 69 | "operational because of an unsupported FC class\n"); |
107 | zfcp_erp_adapter_shutdown(req->adapter, 0, "fscns_1", req); | 70 | zfcp_erp_adapter_shutdown(req->adapter, 0, "fscns_1"); |
108 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 71 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
109 | } | 72 | } |
110 | 73 | ||
@@ -122,7 +85,7 @@ void zfcp_fsf_req_free(struct zfcp_fsf_req *req) | |||
122 | } | 85 | } |
123 | 86 | ||
124 | if (likely(req->qtcb)) | 87 | if (likely(req->qtcb)) |
125 | kmem_cache_free(zfcp_data.qtcb_cache, req->qtcb); | 88 | kmem_cache_free(zfcp_fsf_qtcb_cache, req->qtcb); |
126 | kfree(req); | 89 | kfree(req); |
127 | } | 90 | } |
128 | 91 | ||
@@ -137,13 +100,13 @@ static void zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *req) | |||
137 | read_lock_irqsave(&adapter->port_list_lock, flags); | 100 | read_lock_irqsave(&adapter->port_list_lock, flags); |
138 | list_for_each_entry(port, &adapter->port_list, list) | 101 | list_for_each_entry(port, &adapter->port_list, list) |
139 | if (port->d_id == d_id) { | 102 | if (port->d_id == d_id) { |
140 | zfcp_erp_port_reopen(port, 0, "fssrpc1", req); | 103 | zfcp_erp_port_reopen(port, 0, "fssrpc1"); |
141 | break; | 104 | break; |
142 | } | 105 | } |
143 | read_unlock_irqrestore(&adapter->port_list_lock, flags); | 106 | read_unlock_irqrestore(&adapter->port_list_lock, flags); |
144 | } | 107 | } |
145 | 108 | ||
146 | static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req, char *id, | 109 | static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req, |
147 | struct fsf_link_down_info *link_down) | 110 | struct fsf_link_down_info *link_down) |
148 | { | 111 | { |
149 | struct zfcp_adapter *adapter = req->adapter; | 112 | struct zfcp_adapter *adapter = req->adapter; |
@@ -223,7 +186,7 @@ static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req, char *id, | |||
223 | "the FC fabric is down\n"); | 186 | "the FC fabric is down\n"); |
224 | } | 187 | } |
225 | out: | 188 | out: |
226 | zfcp_erp_adapter_failed(adapter, id, req); | 189 | zfcp_erp_set_adapter_status(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); |
227 | } | 190 | } |
228 | 191 | ||
229 | static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req) | 192 | static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req) |
@@ -234,13 +197,13 @@ static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req) | |||
234 | 197 | ||
235 | switch (sr_buf->status_subtype) { | 198 | switch (sr_buf->status_subtype) { |
236 | case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: | 199 | case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: |
237 | zfcp_fsf_link_down_info_eval(req, "fssrld1", ldi); | 200 | zfcp_fsf_link_down_info_eval(req, ldi); |
238 | break; | 201 | break; |
239 | case FSF_STATUS_READ_SUB_FDISC_FAILED: | 202 | case FSF_STATUS_READ_SUB_FDISC_FAILED: |
240 | zfcp_fsf_link_down_info_eval(req, "fssrld2", ldi); | 203 | zfcp_fsf_link_down_info_eval(req, ldi); |
241 | break; | 204 | break; |
242 | case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE: | 205 | case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE: |
243 | zfcp_fsf_link_down_info_eval(req, "fssrld3", NULL); | 206 | zfcp_fsf_link_down_info_eval(req, NULL); |
244 | }; | 207 | }; |
245 | } | 208 | } |
246 | 209 | ||
@@ -250,13 +213,13 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) | |||
250 | struct fsf_status_read_buffer *sr_buf = req->data; | 213 | struct fsf_status_read_buffer *sr_buf = req->data; |
251 | 214 | ||
252 | if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { | 215 | if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { |
253 | zfcp_dbf_hba_fsf_unsol("dism", adapter->dbf, sr_buf); | 216 | zfcp_dbf_hba_fsf_uss("fssrh_1", req); |
254 | mempool_free(sr_buf, adapter->pool.status_read_data); | 217 | mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data); |
255 | zfcp_fsf_req_free(req); | 218 | zfcp_fsf_req_free(req); |
256 | return; | 219 | return; |
257 | } | 220 | } |
258 | 221 | ||
259 | zfcp_dbf_hba_fsf_unsol("read", adapter->dbf, sr_buf); | 222 | zfcp_dbf_hba_fsf_uss("fssrh_2", req); |
260 | 223 | ||
261 | switch (sr_buf->status_type) { | 224 | switch (sr_buf->status_type) { |
262 | case FSF_STATUS_READ_PORT_CLOSED: | 225 | case FSF_STATUS_READ_PORT_CLOSED: |
@@ -271,7 +234,7 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) | |||
271 | dev_warn(&adapter->ccw_device->dev, | 234 | dev_warn(&adapter->ccw_device->dev, |
272 | "The error threshold for checksum statistics " | 235 | "The error threshold for checksum statistics " |
273 | "has been exceeded\n"); | 236 | "has been exceeded\n"); |
274 | zfcp_dbf_hba_berr(adapter->dbf, req); | 237 | zfcp_dbf_hba_bit_err("fssrh_3", req); |
275 | break; | 238 | break; |
276 | case FSF_STATUS_READ_LINK_DOWN: | 239 | case FSF_STATUS_READ_LINK_DOWN: |
277 | zfcp_fsf_status_read_link_down(req); | 240 | zfcp_fsf_status_read_link_down(req); |
@@ -281,32 +244,30 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) | |||
281 | dev_info(&adapter->ccw_device->dev, | 244 | dev_info(&adapter->ccw_device->dev, |
282 | "The local link has been restored\n"); | 245 | "The local link has been restored\n"); |
283 | /* All ports should be marked as ready to run again */ | 246 | /* All ports should be marked as ready to run again */ |
284 | zfcp_erp_modify_adapter_status(adapter, "fssrh_1", NULL, | 247 | zfcp_erp_set_adapter_status(adapter, |
285 | ZFCP_STATUS_COMMON_RUNNING, | 248 | ZFCP_STATUS_COMMON_RUNNING); |
286 | ZFCP_SET); | ||
287 | zfcp_erp_adapter_reopen(adapter, | 249 | zfcp_erp_adapter_reopen(adapter, |
288 | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | | 250 | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | |
289 | ZFCP_STATUS_COMMON_ERP_FAILED, | 251 | ZFCP_STATUS_COMMON_ERP_FAILED, |
290 | "fssrh_2", req); | 252 | "fssrh_2"); |
291 | zfcp_fc_enqueue_event(adapter, FCH_EVT_LINKUP, 0); | 253 | zfcp_fc_enqueue_event(adapter, FCH_EVT_LINKUP, 0); |
292 | 254 | ||
293 | break; | 255 | break; |
294 | case FSF_STATUS_READ_NOTIFICATION_LOST: | 256 | case FSF_STATUS_READ_NOTIFICATION_LOST: |
295 | if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_ACT_UPDATED) | 257 | if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_ACT_UPDATED) |
296 | zfcp_erp_adapter_access_changed(adapter, "fssrh_3", | 258 | zfcp_cfdc_adapter_access_changed(adapter); |
297 | req); | ||
298 | if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_INCOMING_ELS) | 259 | if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_INCOMING_ELS) |
299 | queue_work(adapter->work_queue, &adapter->scan_work); | 260 | queue_work(adapter->work_queue, &adapter->scan_work); |
300 | break; | 261 | break; |
301 | case FSF_STATUS_READ_CFDC_UPDATED: | 262 | case FSF_STATUS_READ_CFDC_UPDATED: |
302 | zfcp_erp_adapter_access_changed(adapter, "fssrh_4", req); | 263 | zfcp_cfdc_adapter_access_changed(adapter); |
303 | break; | 264 | break; |
304 | case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: | 265 | case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: |
305 | adapter->adapter_features = sr_buf->payload.word[0]; | 266 | adapter->adapter_features = sr_buf->payload.word[0]; |
306 | break; | 267 | break; |
307 | } | 268 | } |
308 | 269 | ||
309 | mempool_free(sr_buf, adapter->pool.status_read_data); | 270 | mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data); |
310 | zfcp_fsf_req_free(req); | 271 | zfcp_fsf_req_free(req); |
311 | 272 | ||
312 | atomic_inc(&adapter->stat_miss); | 273 | atomic_inc(&adapter->stat_miss); |
@@ -328,7 +289,7 @@ static void zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *req) | |||
328 | "The FCP adapter reported a problem " | 289 | "The FCP adapter reported a problem " |
329 | "that cannot be recovered\n"); | 290 | "that cannot be recovered\n"); |
330 | zfcp_qdio_siosl(req->adapter); | 291 | zfcp_qdio_siosl(req->adapter); |
331 | zfcp_erp_adapter_shutdown(req->adapter, 0, "fsfsqe1", req); | 292 | zfcp_erp_adapter_shutdown(req->adapter, 0, "fsfsqe1"); |
332 | break; | 293 | break; |
333 | } | 294 | } |
334 | /* all non-return stats set FSFREQ_ERROR*/ | 295 | /* all non-return stats set FSFREQ_ERROR*/ |
@@ -345,7 +306,7 @@ static void zfcp_fsf_fsfstatus_eval(struct zfcp_fsf_req *req) | |||
345 | dev_err(&req->adapter->ccw_device->dev, | 306 | dev_err(&req->adapter->ccw_device->dev, |
346 | "The FCP adapter does not recognize the command 0x%x\n", | 307 | "The FCP adapter does not recognize the command 0x%x\n", |
347 | req->qtcb->header.fsf_command); | 308 | req->qtcb->header.fsf_command); |
348 | zfcp_erp_adapter_shutdown(req->adapter, 0, "fsfse_1", req); | 309 | zfcp_erp_adapter_shutdown(req->adapter, 0, "fsfse_1"); |
349 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 310 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
350 | break; | 311 | break; |
351 | case FSF_ADAPTER_STATUS_AVAILABLE: | 312 | case FSF_ADAPTER_STATUS_AVAILABLE: |
@@ -376,17 +337,17 @@ static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req) | |||
376 | "QTCB version 0x%x not supported by FCP adapter " | 337 | "QTCB version 0x%x not supported by FCP adapter " |
377 | "(0x%x to 0x%x)\n", FSF_QTCB_CURRENT_VERSION, | 338 | "(0x%x to 0x%x)\n", FSF_QTCB_CURRENT_VERSION, |
378 | psq->word[0], psq->word[1]); | 339 | psq->word[0], psq->word[1]); |
379 | zfcp_erp_adapter_shutdown(adapter, 0, "fspse_1", req); | 340 | zfcp_erp_adapter_shutdown(adapter, 0, "fspse_1"); |
380 | break; | 341 | break; |
381 | case FSF_PROT_ERROR_STATE: | 342 | case FSF_PROT_ERROR_STATE: |
382 | case FSF_PROT_SEQ_NUMB_ERROR: | 343 | case FSF_PROT_SEQ_NUMB_ERROR: |
383 | zfcp_erp_adapter_reopen(adapter, 0, "fspse_2", req); | 344 | zfcp_erp_adapter_reopen(adapter, 0, "fspse_2"); |
384 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 345 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
385 | break; | 346 | break; |
386 | case FSF_PROT_UNSUPP_QTCB_TYPE: | 347 | case FSF_PROT_UNSUPP_QTCB_TYPE: |
387 | dev_err(&adapter->ccw_device->dev, | 348 | dev_err(&adapter->ccw_device->dev, |
388 | "The QTCB type is not supported by the FCP adapter\n"); | 349 | "The QTCB type is not supported by the FCP adapter\n"); |
389 | zfcp_erp_adapter_shutdown(adapter, 0, "fspse_3", req); | 350 | zfcp_erp_adapter_shutdown(adapter, 0, "fspse_3"); |
390 | break; | 351 | break; |
391 | case FSF_PROT_HOST_CONNECTION_INITIALIZING: | 352 | case FSF_PROT_HOST_CONNECTION_INITIALIZING: |
392 | atomic_set_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT, | 353 | atomic_set_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT, |
@@ -396,30 +357,28 @@ static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req) | |||
396 | dev_err(&adapter->ccw_device->dev, | 357 | dev_err(&adapter->ccw_device->dev, |
397 | "0x%Lx is an ambiguous request identifier\n", | 358 | "0x%Lx is an ambiguous request identifier\n", |
398 | (unsigned long long)qtcb->bottom.support.req_handle); | 359 | (unsigned long long)qtcb->bottom.support.req_handle); |
399 | zfcp_erp_adapter_shutdown(adapter, 0, "fspse_4", req); | 360 | zfcp_erp_adapter_shutdown(adapter, 0, "fspse_4"); |
400 | break; | 361 | break; |
401 | case FSF_PROT_LINK_DOWN: | 362 | case FSF_PROT_LINK_DOWN: |
402 | zfcp_fsf_link_down_info_eval(req, "fspse_5", | 363 | zfcp_fsf_link_down_info_eval(req, &psq->link_down_info); |
403 | &psq->link_down_info); | ||
404 | /* go through reopen to flush pending requests */ | 364 | /* go through reopen to flush pending requests */ |
405 | zfcp_erp_adapter_reopen(adapter, 0, "fspse_6", req); | 365 | zfcp_erp_adapter_reopen(adapter, 0, "fspse_6"); |
406 | break; | 366 | break; |
407 | case FSF_PROT_REEST_QUEUE: | 367 | case FSF_PROT_REEST_QUEUE: |
408 | /* All ports should be marked as ready to run again */ | 368 | /* All ports should be marked as ready to run again */ |
409 | zfcp_erp_modify_adapter_status(adapter, "fspse_7", NULL, | 369 | zfcp_erp_set_adapter_status(adapter, |
410 | ZFCP_STATUS_COMMON_RUNNING, | 370 | ZFCP_STATUS_COMMON_RUNNING); |
411 | ZFCP_SET); | ||
412 | zfcp_erp_adapter_reopen(adapter, | 371 | zfcp_erp_adapter_reopen(adapter, |
413 | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | | 372 | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | |
414 | ZFCP_STATUS_COMMON_ERP_FAILED, | 373 | ZFCP_STATUS_COMMON_ERP_FAILED, |
415 | "fspse_8", req); | 374 | "fspse_8"); |
416 | break; | 375 | break; |
417 | default: | 376 | default: |
418 | dev_err(&adapter->ccw_device->dev, | 377 | dev_err(&adapter->ccw_device->dev, |
419 | "0x%x is not a valid transfer protocol status\n", | 378 | "0x%x is not a valid transfer protocol status\n", |
420 | qtcb->prefix.prot_status); | 379 | qtcb->prefix.prot_status); |
421 | zfcp_qdio_siosl(adapter); | 380 | zfcp_qdio_siosl(adapter); |
422 | zfcp_erp_adapter_shutdown(adapter, 0, "fspse_9", req); | 381 | zfcp_erp_adapter_shutdown(adapter, 0, "fspse_9"); |
423 | } | 382 | } |
424 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 383 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
425 | } | 384 | } |
@@ -525,7 +484,7 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req) | |||
525 | dev_err(&adapter->ccw_device->dev, | 484 | dev_err(&adapter->ccw_device->dev, |
526 | "Unknown or unsupported arbitrated loop " | 485 | "Unknown or unsupported arbitrated loop " |
527 | "fibre channel topology detected\n"); | 486 | "fibre channel topology detected\n"); |
528 | zfcp_erp_adapter_shutdown(adapter, 0, "fsece_1", req); | 487 | zfcp_erp_adapter_shutdown(adapter, 0, "fsece_1"); |
529 | return -EIO; | 488 | return -EIO; |
530 | } | 489 | } |
531 | 490 | ||
@@ -561,7 +520,7 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req) | |||
561 | "FCP adapter maximum QTCB size (%d bytes) " | 520 | "FCP adapter maximum QTCB size (%d bytes) " |
562 | "is too small\n", | 521 | "is too small\n", |
563 | bottom->max_qtcb_size); | 522 | bottom->max_qtcb_size); |
564 | zfcp_erp_adapter_shutdown(adapter, 0, "fsecdh1", req); | 523 | zfcp_erp_adapter_shutdown(adapter, 0, "fsecdh1"); |
565 | return; | 524 | return; |
566 | } | 525 | } |
567 | atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, | 526 | atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, |
@@ -575,14 +534,11 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req) | |||
575 | fc_host_port_type(shost) = FC_PORTTYPE_UNKNOWN; | 534 | fc_host_port_type(shost) = FC_PORTTYPE_UNKNOWN; |
576 | adapter->hydra_version = 0; | 535 | adapter->hydra_version = 0; |
577 | 536 | ||
578 | atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, | 537 | zfcp_fsf_link_down_info_eval(req, |
579 | &adapter->status); | ||
580 | |||
581 | zfcp_fsf_link_down_info_eval(req, "fsecdh2", | ||
582 | &qtcb->header.fsf_status_qual.link_down_info); | 538 | &qtcb->header.fsf_status_qual.link_down_info); |
583 | break; | 539 | break; |
584 | default: | 540 | default: |
585 | zfcp_erp_adapter_shutdown(adapter, 0, "fsecdh3", req); | 541 | zfcp_erp_adapter_shutdown(adapter, 0, "fsecdh3"); |
586 | return; | 542 | return; |
587 | } | 543 | } |
588 | 544 | ||
@@ -598,14 +554,14 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req) | |||
598 | dev_err(&adapter->ccw_device->dev, | 554 | dev_err(&adapter->ccw_device->dev, |
599 | "The FCP adapter only supports newer " | 555 | "The FCP adapter only supports newer " |
600 | "control block versions\n"); | 556 | "control block versions\n"); |
601 | zfcp_erp_adapter_shutdown(adapter, 0, "fsecdh4", req); | 557 | zfcp_erp_adapter_shutdown(adapter, 0, "fsecdh4"); |
602 | return; | 558 | return; |
603 | } | 559 | } |
604 | if (FSF_QTCB_CURRENT_VERSION > bottom->high_qtcb_version) { | 560 | if (FSF_QTCB_CURRENT_VERSION > bottom->high_qtcb_version) { |
605 | dev_err(&adapter->ccw_device->dev, | 561 | dev_err(&adapter->ccw_device->dev, |
606 | "The FCP adapter only supports older " | 562 | "The FCP adapter only supports older " |
607 | "control block versions\n"); | 563 | "control block versions\n"); |
608 | zfcp_erp_adapter_shutdown(adapter, 0, "fsecdh5", req); | 564 | zfcp_erp_adapter_shutdown(adapter, 0, "fsecdh5"); |
609 | } | 565 | } |
610 | } | 566 | } |
611 | 567 | ||
@@ -644,7 +600,7 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req) | |||
644 | break; | 600 | break; |
645 | case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE: | 601 | case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE: |
646 | zfcp_fsf_exchange_port_evaluate(req); | 602 | zfcp_fsf_exchange_port_evaluate(req); |
647 | zfcp_fsf_link_down_info_eval(req, "fsepdh1", | 603 | zfcp_fsf_link_down_info_eval(req, |
648 | &qtcb->header.fsf_status_qual.link_down_info); | 604 | &qtcb->header.fsf_status_qual.link_down_info); |
649 | break; | 605 | break; |
650 | } | 606 | } |
@@ -674,7 +630,7 @@ static struct fsf_qtcb *zfcp_qtcb_alloc(mempool_t *pool) | |||
674 | if (likely(pool)) | 630 | if (likely(pool)) |
675 | qtcb = mempool_alloc(pool, GFP_ATOMIC); | 631 | qtcb = mempool_alloc(pool, GFP_ATOMIC); |
676 | else | 632 | else |
677 | qtcb = kmem_cache_alloc(zfcp_data.qtcb_cache, GFP_ATOMIC); | 633 | qtcb = kmem_cache_alloc(zfcp_fsf_qtcb_cache, GFP_ATOMIC); |
678 | 634 | ||
679 | if (unlikely(!qtcb)) | 635 | if (unlikely(!qtcb)) |
680 | return NULL; | 636 | return NULL; |
@@ -684,7 +640,7 @@ static struct fsf_qtcb *zfcp_qtcb_alloc(mempool_t *pool) | |||
684 | } | 640 | } |
685 | 641 | ||
686 | static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio, | 642 | static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio, |
687 | u32 fsf_cmd, u32 sbtype, | 643 | u32 fsf_cmd, u8 sbtype, |
688 | mempool_t *pool) | 644 | mempool_t *pool) |
689 | { | 645 | { |
690 | struct zfcp_adapter *adapter = qdio->adapter; | 646 | struct zfcp_adapter *adapter = qdio->adapter; |
@@ -746,7 +702,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req) | |||
746 | del_timer(&req->timer); | 702 | del_timer(&req->timer); |
747 | /* lookup request again, list might have changed */ | 703 | /* lookup request again, list might have changed */ |
748 | zfcp_reqlist_find_rm(adapter->req_list, req_id); | 704 | zfcp_reqlist_find_rm(adapter->req_list, req_id); |
749 | zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1", req); | 705 | zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1"); |
750 | return -EIO; | 706 | return -EIO; |
751 | } | 707 | } |
752 | 708 | ||
@@ -769,9 +725,10 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio) | |||
769 | struct zfcp_adapter *adapter = qdio->adapter; | 725 | struct zfcp_adapter *adapter = qdio->adapter; |
770 | struct zfcp_fsf_req *req; | 726 | struct zfcp_fsf_req *req; |
771 | struct fsf_status_read_buffer *sr_buf; | 727 | struct fsf_status_read_buffer *sr_buf; |
728 | struct page *page; | ||
772 | int retval = -EIO; | 729 | int retval = -EIO; |
773 | 730 | ||
774 | spin_lock_bh(&qdio->req_q_lock); | 731 | spin_lock_irq(&qdio->req_q_lock); |
775 | if (zfcp_qdio_sbal_get(qdio)) | 732 | if (zfcp_qdio_sbal_get(qdio)) |
776 | goto out; | 733 | goto out; |
777 | 734 | ||
@@ -782,11 +739,12 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio) | |||
782 | goto out; | 739 | goto out; |
783 | } | 740 | } |
784 | 741 | ||
785 | sr_buf = mempool_alloc(adapter->pool.status_read_data, GFP_ATOMIC); | 742 | page = mempool_alloc(adapter->pool.sr_data, GFP_ATOMIC); |
786 | if (!sr_buf) { | 743 | if (!page) { |
787 | retval = -ENOMEM; | 744 | retval = -ENOMEM; |
788 | goto failed_buf; | 745 | goto failed_buf; |
789 | } | 746 | } |
747 | sr_buf = page_address(page); | ||
790 | memset(sr_buf, 0, sizeof(*sr_buf)); | 748 | memset(sr_buf, 0, sizeof(*sr_buf)); |
791 | req->data = sr_buf; | 749 | req->data = sr_buf; |
792 | 750 | ||
@@ -800,18 +758,20 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio) | |||
800 | goto out; | 758 | goto out; |
801 | 759 | ||
802 | failed_req_send: | 760 | failed_req_send: |
803 | mempool_free(sr_buf, adapter->pool.status_read_data); | 761 | req->data = NULL; |
762 | mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data); | ||
804 | failed_buf: | 763 | failed_buf: |
764 | zfcp_dbf_hba_fsf_uss("fssr__1", req); | ||
805 | zfcp_fsf_req_free(req); | 765 | zfcp_fsf_req_free(req); |
806 | zfcp_dbf_hba_fsf_unsol("fail", adapter->dbf, NULL); | ||
807 | out: | 766 | out: |
808 | spin_unlock_bh(&qdio->req_q_lock); | 767 | spin_unlock_irq(&qdio->req_q_lock); |
809 | return retval; | 768 | return retval; |
810 | } | 769 | } |
811 | 770 | ||
812 | static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req) | 771 | static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req) |
813 | { | 772 | { |
814 | struct zfcp_unit *unit = req->data; | 773 | struct scsi_device *sdev = req->data; |
774 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | ||
815 | union fsf_status_qual *fsq = &req->qtcb->header.fsf_status_qual; | 775 | union fsf_status_qual *fsq = &req->qtcb->header.fsf_status_qual; |
816 | 776 | ||
817 | if (req->status & ZFCP_STATUS_FSFREQ_ERROR) | 777 | if (req->status & ZFCP_STATUS_FSFREQ_ERROR) |
@@ -820,14 +780,14 @@ static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req) | |||
820 | switch (req->qtcb->header.fsf_status) { | 780 | switch (req->qtcb->header.fsf_status) { |
821 | case FSF_PORT_HANDLE_NOT_VALID: | 781 | case FSF_PORT_HANDLE_NOT_VALID: |
822 | if (fsq->word[0] == fsq->word[1]) { | 782 | if (fsq->word[0] == fsq->word[1]) { |
823 | zfcp_erp_adapter_reopen(unit->port->adapter, 0, | 783 | zfcp_erp_adapter_reopen(zfcp_sdev->port->adapter, 0, |
824 | "fsafch1", req); | 784 | "fsafch1"); |
825 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 785 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
826 | } | 786 | } |
827 | break; | 787 | break; |
828 | case FSF_LUN_HANDLE_NOT_VALID: | 788 | case FSF_LUN_HANDLE_NOT_VALID: |
829 | if (fsq->word[0] == fsq->word[1]) { | 789 | if (fsq->word[0] == fsq->word[1]) { |
830 | zfcp_erp_port_reopen(unit->port, 0, "fsafch2", req); | 790 | zfcp_erp_port_reopen(zfcp_sdev->port, 0, "fsafch2"); |
831 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 791 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
832 | } | 792 | } |
833 | break; | 793 | break; |
@@ -835,17 +795,22 @@ static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req) | |||
835 | req->status |= ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED; | 795 | req->status |= ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED; |
836 | break; | 796 | break; |
837 | case FSF_PORT_BOXED: | 797 | case FSF_PORT_BOXED: |
838 | zfcp_erp_port_boxed(unit->port, "fsafch3", req); | 798 | zfcp_erp_set_port_status(zfcp_sdev->port, |
799 | ZFCP_STATUS_COMMON_ACCESS_BOXED); | ||
800 | zfcp_erp_port_reopen(zfcp_sdev->port, | ||
801 | ZFCP_STATUS_COMMON_ERP_FAILED, "fsafch3"); | ||
839 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 802 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
840 | break; | 803 | break; |
841 | case FSF_LUN_BOXED: | 804 | case FSF_LUN_BOXED: |
842 | zfcp_erp_unit_boxed(unit, "fsafch4", req); | 805 | zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ACCESS_BOXED); |
806 | zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED, | ||
807 | "fsafch4"); | ||
843 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 808 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
844 | break; | 809 | break; |
845 | case FSF_ADAPTER_STATUS_AVAILABLE: | 810 | case FSF_ADAPTER_STATUS_AVAILABLE: |
846 | switch (fsq->word[0]) { | 811 | switch (fsq->word[0]) { |
847 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: | 812 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: |
848 | zfcp_fc_test_link(unit->port); | 813 | zfcp_fc_test_link(zfcp_sdev->port); |
849 | /* fall through */ | 814 | /* fall through */ |
850 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: | 815 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: |
851 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 816 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
@@ -859,39 +824,40 @@ static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req) | |||
859 | } | 824 | } |
860 | 825 | ||
861 | /** | 826 | /** |
862 | * zfcp_fsf_abort_fcp_command - abort running SCSI command | 827 | * zfcp_fsf_abort_fcp_cmnd - abort running SCSI command |
863 | * @old_req_id: unsigned long | 828 | * @scmnd: The SCSI command to abort |
864 | * @unit: pointer to struct zfcp_unit | ||
865 | * Returns: pointer to struct zfcp_fsf_req | 829 | * Returns: pointer to struct zfcp_fsf_req |
866 | */ | 830 | */ |
867 | 831 | ||
868 | struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id, | 832 | struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd) |
869 | struct zfcp_unit *unit) | ||
870 | { | 833 | { |
871 | struct zfcp_fsf_req *req = NULL; | 834 | struct zfcp_fsf_req *req = NULL; |
872 | struct zfcp_qdio *qdio = unit->port->adapter->qdio; | 835 | struct scsi_device *sdev = scmnd->device; |
836 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | ||
837 | struct zfcp_qdio *qdio = zfcp_sdev->port->adapter->qdio; | ||
838 | unsigned long old_req_id = (unsigned long) scmnd->host_scribble; | ||
873 | 839 | ||
874 | spin_lock_bh(&qdio->req_q_lock); | 840 | spin_lock_irq(&qdio->req_q_lock); |
875 | if (zfcp_qdio_sbal_get(qdio)) | 841 | if (zfcp_qdio_sbal_get(qdio)) |
876 | goto out; | 842 | goto out; |
877 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_ABORT_FCP_CMND, | 843 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_ABORT_FCP_CMND, |
878 | SBAL_FLAGS0_TYPE_READ, | 844 | SBAL_SFLAGS0_TYPE_READ, |
879 | qdio->adapter->pool.scsi_abort); | 845 | qdio->adapter->pool.scsi_abort); |
880 | if (IS_ERR(req)) { | 846 | if (IS_ERR(req)) { |
881 | req = NULL; | 847 | req = NULL; |
882 | goto out; | 848 | goto out; |
883 | } | 849 | } |
884 | 850 | ||
885 | if (unlikely(!(atomic_read(&unit->status) & | 851 | if (unlikely(!(atomic_read(&zfcp_sdev->status) & |
886 | ZFCP_STATUS_COMMON_UNBLOCKED))) | 852 | ZFCP_STATUS_COMMON_UNBLOCKED))) |
887 | goto out_error_free; | 853 | goto out_error_free; |
888 | 854 | ||
889 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); | 855 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); |
890 | 856 | ||
891 | req->data = unit; | 857 | req->data = sdev; |
892 | req->handler = zfcp_fsf_abort_fcp_command_handler; | 858 | req->handler = zfcp_fsf_abort_fcp_command_handler; |
893 | req->qtcb->header.lun_handle = unit->handle; | 859 | req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; |
894 | req->qtcb->header.port_handle = unit->port->handle; | 860 | req->qtcb->header.port_handle = zfcp_sdev->port->handle; |
895 | req->qtcb->bottom.support.req_handle = (u64) old_req_id; | 861 | req->qtcb->bottom.support.req_handle = (u64) old_req_id; |
896 | 862 | ||
897 | zfcp_fsf_start_timer(req, ZFCP_SCSI_ER_TIMEOUT); | 863 | zfcp_fsf_start_timer(req, ZFCP_SCSI_ER_TIMEOUT); |
@@ -902,7 +868,7 @@ out_error_free: | |||
902 | zfcp_fsf_req_free(req); | 868 | zfcp_fsf_req_free(req); |
903 | req = NULL; | 869 | req = NULL; |
904 | out: | 870 | out: |
905 | spin_unlock_bh(&qdio->req_q_lock); | 871 | spin_unlock_irq(&qdio->req_q_lock); |
906 | return req; | 872 | return req; |
907 | } | 873 | } |
908 | 874 | ||
@@ -919,7 +885,7 @@ static void zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *req) | |||
919 | 885 | ||
920 | switch (header->fsf_status) { | 886 | switch (header->fsf_status) { |
921 | case FSF_GOOD: | 887 | case FSF_GOOD: |
922 | zfcp_dbf_san_ct_response(req); | 888 | zfcp_dbf_san_res("fsscth1", req); |
923 | ct->status = 0; | 889 | ct->status = 0; |
924 | break; | 890 | break; |
925 | case FSF_SERVICE_CLASS_NOT_SUPPORTED: | 891 | case FSF_SERVICE_CLASS_NOT_SUPPORTED: |
@@ -939,7 +905,7 @@ static void zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *req) | |||
939 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 905 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
940 | break; | 906 | break; |
941 | case FSF_PORT_HANDLE_NOT_VALID: | 907 | case FSF_PORT_HANDLE_NOT_VALID: |
942 | zfcp_erp_adapter_reopen(adapter, 0, "fsscth1", req); | 908 | zfcp_erp_adapter_reopen(adapter, 0, "fsscth1"); |
943 | /* fall through */ | 909 | /* fall through */ |
944 | case FSF_GENERIC_COMMAND_REJECTED: | 910 | case FSF_GENERIC_COMMAND_REJECTED: |
945 | case FSF_PAYLOAD_SIZE_MISMATCH: | 911 | case FSF_PAYLOAD_SIZE_MISMATCH: |
@@ -1041,12 +1007,12 @@ int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port, | |||
1041 | struct zfcp_fsf_req *req; | 1007 | struct zfcp_fsf_req *req; |
1042 | int ret = -EIO; | 1008 | int ret = -EIO; |
1043 | 1009 | ||
1044 | spin_lock_bh(&qdio->req_q_lock); | 1010 | spin_lock_irq(&qdio->req_q_lock); |
1045 | if (zfcp_qdio_sbal_get(qdio)) | 1011 | if (zfcp_qdio_sbal_get(qdio)) |
1046 | goto out; | 1012 | goto out; |
1047 | 1013 | ||
1048 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_GENERIC, | 1014 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_GENERIC, |
1049 | SBAL_FLAGS0_TYPE_WRITE_READ, pool); | 1015 | SBAL_SFLAGS0_TYPE_WRITE_READ, pool); |
1050 | 1016 | ||
1051 | if (IS_ERR(req)) { | 1017 | if (IS_ERR(req)) { |
1052 | ret = PTR_ERR(req); | 1018 | ret = PTR_ERR(req); |
@@ -1062,7 +1028,7 @@ int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port, | |||
1062 | req->qtcb->header.port_handle = wka_port->handle; | 1028 | req->qtcb->header.port_handle = wka_port->handle; |
1063 | req->data = ct; | 1029 | req->data = ct; |
1064 | 1030 | ||
1065 | zfcp_dbf_san_ct_request(req, wka_port->d_id); | 1031 | zfcp_dbf_san_req("fssct_1", req, wka_port->d_id); |
1066 | 1032 | ||
1067 | ret = zfcp_fsf_req_send(req); | 1033 | ret = zfcp_fsf_req_send(req); |
1068 | if (ret) | 1034 | if (ret) |
@@ -1073,7 +1039,7 @@ int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port, | |||
1073 | failed_send: | 1039 | failed_send: |
1074 | zfcp_fsf_req_free(req); | 1040 | zfcp_fsf_req_free(req); |
1075 | out: | 1041 | out: |
1076 | spin_unlock_bh(&qdio->req_q_lock); | 1042 | spin_unlock_irq(&qdio->req_q_lock); |
1077 | return ret; | 1043 | return ret; |
1078 | } | 1044 | } |
1079 | 1045 | ||
@@ -1090,7 +1056,7 @@ static void zfcp_fsf_send_els_handler(struct zfcp_fsf_req *req) | |||
1090 | 1056 | ||
1091 | switch (header->fsf_status) { | 1057 | switch (header->fsf_status) { |
1092 | case FSF_GOOD: | 1058 | case FSF_GOOD: |
1093 | zfcp_dbf_san_els_response(req); | 1059 | zfcp_dbf_san_res("fsselh1", req); |
1094 | send_els->status = 0; | 1060 | send_els->status = 0; |
1095 | break; | 1061 | break; |
1096 | case FSF_SERVICE_CLASS_NOT_SUPPORTED: | 1062 | case FSF_SERVICE_CLASS_NOT_SUPPORTED: |
@@ -1111,11 +1077,13 @@ static void zfcp_fsf_send_els_handler(struct zfcp_fsf_req *req) | |||
1111 | case FSF_RESPONSE_SIZE_TOO_LARGE: | 1077 | case FSF_RESPONSE_SIZE_TOO_LARGE: |
1112 | break; | 1078 | break; |
1113 | case FSF_ACCESS_DENIED: | 1079 | case FSF_ACCESS_DENIED: |
1114 | if (port) | 1080 | if (port) { |
1115 | zfcp_fsf_access_denied_port(req, port); | 1081 | zfcp_cfdc_port_denied(port, &header->fsf_status_qual); |
1082 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
1083 | } | ||
1116 | break; | 1084 | break; |
1117 | case FSF_SBAL_MISMATCH: | 1085 | case FSF_SBAL_MISMATCH: |
1118 | /* should never occure, avoided in zfcp_fsf_send_els */ | 1086 | /* should never occur, avoided in zfcp_fsf_send_els */ |
1119 | /* fall through */ | 1087 | /* fall through */ |
1120 | default: | 1088 | default: |
1121 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1089 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
@@ -1137,12 +1105,12 @@ int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id, | |||
1137 | struct zfcp_qdio *qdio = adapter->qdio; | 1105 | struct zfcp_qdio *qdio = adapter->qdio; |
1138 | int ret = -EIO; | 1106 | int ret = -EIO; |
1139 | 1107 | ||
1140 | spin_lock_bh(&qdio->req_q_lock); | 1108 | spin_lock_irq(&qdio->req_q_lock); |
1141 | if (zfcp_qdio_sbal_get(qdio)) | 1109 | if (zfcp_qdio_sbal_get(qdio)) |
1142 | goto out; | 1110 | goto out; |
1143 | 1111 | ||
1144 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_ELS, | 1112 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_ELS, |
1145 | SBAL_FLAGS0_TYPE_WRITE_READ, NULL); | 1113 | SBAL_SFLAGS0_TYPE_WRITE_READ, NULL); |
1146 | 1114 | ||
1147 | if (IS_ERR(req)) { | 1115 | if (IS_ERR(req)) { |
1148 | ret = PTR_ERR(req); | 1116 | ret = PTR_ERR(req); |
@@ -1162,7 +1130,7 @@ int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id, | |||
1162 | req->handler = zfcp_fsf_send_els_handler; | 1130 | req->handler = zfcp_fsf_send_els_handler; |
1163 | req->data = els; | 1131 | req->data = els; |
1164 | 1132 | ||
1165 | zfcp_dbf_san_els_request(req); | 1133 | zfcp_dbf_san_req("fssels1", req, d_id); |
1166 | 1134 | ||
1167 | ret = zfcp_fsf_req_send(req); | 1135 | ret = zfcp_fsf_req_send(req); |
1168 | if (ret) | 1136 | if (ret) |
@@ -1173,7 +1141,7 @@ int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id, | |||
1173 | failed_send: | 1141 | failed_send: |
1174 | zfcp_fsf_req_free(req); | 1142 | zfcp_fsf_req_free(req); |
1175 | out: | 1143 | out: |
1176 | spin_unlock_bh(&qdio->req_q_lock); | 1144 | spin_unlock_irq(&qdio->req_q_lock); |
1177 | return ret; | 1145 | return ret; |
1178 | } | 1146 | } |
1179 | 1147 | ||
@@ -1183,12 +1151,12 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) | |||
1183 | struct zfcp_qdio *qdio = erp_action->adapter->qdio; | 1151 | struct zfcp_qdio *qdio = erp_action->adapter->qdio; |
1184 | int retval = -EIO; | 1152 | int retval = -EIO; |
1185 | 1153 | ||
1186 | spin_lock_bh(&qdio->req_q_lock); | 1154 | spin_lock_irq(&qdio->req_q_lock); |
1187 | if (zfcp_qdio_sbal_get(qdio)) | 1155 | if (zfcp_qdio_sbal_get(qdio)) |
1188 | goto out; | 1156 | goto out; |
1189 | 1157 | ||
1190 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, | 1158 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, |
1191 | SBAL_FLAGS0_TYPE_READ, | 1159 | SBAL_SFLAGS0_TYPE_READ, |
1192 | qdio->adapter->pool.erp_req); | 1160 | qdio->adapter->pool.erp_req); |
1193 | 1161 | ||
1194 | if (IS_ERR(req)) { | 1162 | if (IS_ERR(req)) { |
@@ -1215,7 +1183,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) | |||
1215 | erp_action->fsf_req_id = 0; | 1183 | erp_action->fsf_req_id = 0; |
1216 | } | 1184 | } |
1217 | out: | 1185 | out: |
1218 | spin_unlock_bh(&qdio->req_q_lock); | 1186 | spin_unlock_irq(&qdio->req_q_lock); |
1219 | return retval; | 1187 | return retval; |
1220 | } | 1188 | } |
1221 | 1189 | ||
@@ -1225,12 +1193,12 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio, | |||
1225 | struct zfcp_fsf_req *req = NULL; | 1193 | struct zfcp_fsf_req *req = NULL; |
1226 | int retval = -EIO; | 1194 | int retval = -EIO; |
1227 | 1195 | ||
1228 | spin_lock_bh(&qdio->req_q_lock); | 1196 | spin_lock_irq(&qdio->req_q_lock); |
1229 | if (zfcp_qdio_sbal_get(qdio)) | 1197 | if (zfcp_qdio_sbal_get(qdio)) |
1230 | goto out_unlock; | 1198 | goto out_unlock; |
1231 | 1199 | ||
1232 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, | 1200 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, |
1233 | SBAL_FLAGS0_TYPE_READ, NULL); | 1201 | SBAL_SFLAGS0_TYPE_READ, NULL); |
1234 | 1202 | ||
1235 | if (IS_ERR(req)) { | 1203 | if (IS_ERR(req)) { |
1236 | retval = PTR_ERR(req); | 1204 | retval = PTR_ERR(req); |
@@ -1251,7 +1219,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio, | |||
1251 | 1219 | ||
1252 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); | 1220 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); |
1253 | retval = zfcp_fsf_req_send(req); | 1221 | retval = zfcp_fsf_req_send(req); |
1254 | spin_unlock_bh(&qdio->req_q_lock); | 1222 | spin_unlock_irq(&qdio->req_q_lock); |
1255 | if (!retval) | 1223 | if (!retval) |
1256 | wait_for_completion(&req->completion); | 1224 | wait_for_completion(&req->completion); |
1257 | 1225 | ||
@@ -1259,7 +1227,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio, | |||
1259 | return retval; | 1227 | return retval; |
1260 | 1228 | ||
1261 | out_unlock: | 1229 | out_unlock: |
1262 | spin_unlock_bh(&qdio->req_q_lock); | 1230 | spin_unlock_irq(&qdio->req_q_lock); |
1263 | return retval; | 1231 | return retval; |
1264 | } | 1232 | } |
1265 | 1233 | ||
@@ -1277,12 +1245,12 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) | |||
1277 | if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) | 1245 | if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) |
1278 | return -EOPNOTSUPP; | 1246 | return -EOPNOTSUPP; |
1279 | 1247 | ||
1280 | spin_lock_bh(&qdio->req_q_lock); | 1248 | spin_lock_irq(&qdio->req_q_lock); |
1281 | if (zfcp_qdio_sbal_get(qdio)) | 1249 | if (zfcp_qdio_sbal_get(qdio)) |
1282 | goto out; | 1250 | goto out; |
1283 | 1251 | ||
1284 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, | 1252 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, |
1285 | SBAL_FLAGS0_TYPE_READ, | 1253 | SBAL_SFLAGS0_TYPE_READ, |
1286 | qdio->adapter->pool.erp_req); | 1254 | qdio->adapter->pool.erp_req); |
1287 | 1255 | ||
1288 | if (IS_ERR(req)) { | 1256 | if (IS_ERR(req)) { |
@@ -1304,7 +1272,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) | |||
1304 | erp_action->fsf_req_id = 0; | 1272 | erp_action->fsf_req_id = 0; |
1305 | } | 1273 | } |
1306 | out: | 1274 | out: |
1307 | spin_unlock_bh(&qdio->req_q_lock); | 1275 | spin_unlock_irq(&qdio->req_q_lock); |
1308 | return retval; | 1276 | return retval; |
1309 | } | 1277 | } |
1310 | 1278 | ||
@@ -1323,12 +1291,12 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio, | |||
1323 | if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) | 1291 | if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) |
1324 | return -EOPNOTSUPP; | 1292 | return -EOPNOTSUPP; |
1325 | 1293 | ||
1326 | spin_lock_bh(&qdio->req_q_lock); | 1294 | spin_lock_irq(&qdio->req_q_lock); |
1327 | if (zfcp_qdio_sbal_get(qdio)) | 1295 | if (zfcp_qdio_sbal_get(qdio)) |
1328 | goto out_unlock; | 1296 | goto out_unlock; |
1329 | 1297 | ||
1330 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, | 1298 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, |
1331 | SBAL_FLAGS0_TYPE_READ, NULL); | 1299 | SBAL_SFLAGS0_TYPE_READ, NULL); |
1332 | 1300 | ||
1333 | if (IS_ERR(req)) { | 1301 | if (IS_ERR(req)) { |
1334 | retval = PTR_ERR(req); | 1302 | retval = PTR_ERR(req); |
@@ -1343,7 +1311,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio, | |||
1343 | req->handler = zfcp_fsf_exchange_port_data_handler; | 1311 | req->handler = zfcp_fsf_exchange_port_data_handler; |
1344 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); | 1312 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); |
1345 | retval = zfcp_fsf_req_send(req); | 1313 | retval = zfcp_fsf_req_send(req); |
1346 | spin_unlock_bh(&qdio->req_q_lock); | 1314 | spin_unlock_irq(&qdio->req_q_lock); |
1347 | 1315 | ||
1348 | if (!retval) | 1316 | if (!retval) |
1349 | wait_for_completion(&req->completion); | 1317 | wait_for_completion(&req->completion); |
@@ -1353,7 +1321,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio, | |||
1353 | return retval; | 1321 | return retval; |
1354 | 1322 | ||
1355 | out_unlock: | 1323 | out_unlock: |
1356 | spin_unlock_bh(&qdio->req_q_lock); | 1324 | spin_unlock_irq(&qdio->req_q_lock); |
1357 | return retval; | 1325 | return retval; |
1358 | } | 1326 | } |
1359 | 1327 | ||
@@ -1370,14 +1338,16 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req) | |||
1370 | case FSF_PORT_ALREADY_OPEN: | 1338 | case FSF_PORT_ALREADY_OPEN: |
1371 | break; | 1339 | break; |
1372 | case FSF_ACCESS_DENIED: | 1340 | case FSF_ACCESS_DENIED: |
1373 | zfcp_fsf_access_denied_port(req, port); | 1341 | zfcp_cfdc_port_denied(port, &header->fsf_status_qual); |
1342 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
1374 | break; | 1343 | break; |
1375 | case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED: | 1344 | case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED: |
1376 | dev_warn(&req->adapter->ccw_device->dev, | 1345 | dev_warn(&req->adapter->ccw_device->dev, |
1377 | "Not enough FCP adapter resources to open " | 1346 | "Not enough FCP adapter resources to open " |
1378 | "remote port 0x%016Lx\n", | 1347 | "remote port 0x%016Lx\n", |
1379 | (unsigned long long)port->wwpn); | 1348 | (unsigned long long)port->wwpn); |
1380 | zfcp_erp_port_failed(port, "fsoph_1", req); | 1349 | zfcp_erp_set_port_status(port, |
1350 | ZFCP_STATUS_COMMON_ERP_FAILED); | ||
1381 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1351 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1382 | break; | 1352 | break; |
1383 | case FSF_ADAPTER_STATUS_AVAILABLE: | 1353 | case FSF_ADAPTER_STATUS_AVAILABLE: |
@@ -1437,12 +1407,12 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) | |||
1437 | struct zfcp_fsf_req *req; | 1407 | struct zfcp_fsf_req *req; |
1438 | int retval = -EIO; | 1408 | int retval = -EIO; |
1439 | 1409 | ||
1440 | spin_lock_bh(&qdio->req_q_lock); | 1410 | spin_lock_irq(&qdio->req_q_lock); |
1441 | if (zfcp_qdio_sbal_get(qdio)) | 1411 | if (zfcp_qdio_sbal_get(qdio)) |
1442 | goto out; | 1412 | goto out; |
1443 | 1413 | ||
1444 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, | 1414 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, |
1445 | SBAL_FLAGS0_TYPE_READ, | 1415 | SBAL_SFLAGS0_TYPE_READ, |
1446 | qdio->adapter->pool.erp_req); | 1416 | qdio->adapter->pool.erp_req); |
1447 | 1417 | ||
1448 | if (IS_ERR(req)) { | 1418 | if (IS_ERR(req)) { |
@@ -1468,7 +1438,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) | |||
1468 | put_device(&port->dev); | 1438 | put_device(&port->dev); |
1469 | } | 1439 | } |
1470 | out: | 1440 | out: |
1471 | spin_unlock_bh(&qdio->req_q_lock); | 1441 | spin_unlock_irq(&qdio->req_q_lock); |
1472 | return retval; | 1442 | return retval; |
1473 | } | 1443 | } |
1474 | 1444 | ||
@@ -1481,15 +1451,13 @@ static void zfcp_fsf_close_port_handler(struct zfcp_fsf_req *req) | |||
1481 | 1451 | ||
1482 | switch (req->qtcb->header.fsf_status) { | 1452 | switch (req->qtcb->header.fsf_status) { |
1483 | case FSF_PORT_HANDLE_NOT_VALID: | 1453 | case FSF_PORT_HANDLE_NOT_VALID: |
1484 | zfcp_erp_adapter_reopen(port->adapter, 0, "fscph_1", req); | 1454 | zfcp_erp_adapter_reopen(port->adapter, 0, "fscph_1"); |
1485 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1455 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1486 | break; | 1456 | break; |
1487 | case FSF_ADAPTER_STATUS_AVAILABLE: | 1457 | case FSF_ADAPTER_STATUS_AVAILABLE: |
1488 | break; | 1458 | break; |
1489 | case FSF_GOOD: | 1459 | case FSF_GOOD: |
1490 | zfcp_erp_modify_port_status(port, "fscph_2", req, | 1460 | zfcp_erp_clear_port_status(port, ZFCP_STATUS_COMMON_OPEN); |
1491 | ZFCP_STATUS_COMMON_OPEN, | ||
1492 | ZFCP_CLEAR); | ||
1493 | break; | 1461 | break; |
1494 | } | 1462 | } |
1495 | } | 1463 | } |
@@ -1505,12 +1473,12 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) | |||
1505 | struct zfcp_fsf_req *req; | 1473 | struct zfcp_fsf_req *req; |
1506 | int retval = -EIO; | 1474 | int retval = -EIO; |
1507 | 1475 | ||
1508 | spin_lock_bh(&qdio->req_q_lock); | 1476 | spin_lock_irq(&qdio->req_q_lock); |
1509 | if (zfcp_qdio_sbal_get(qdio)) | 1477 | if (zfcp_qdio_sbal_get(qdio)) |
1510 | goto out; | 1478 | goto out; |
1511 | 1479 | ||
1512 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, | 1480 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, |
1513 | SBAL_FLAGS0_TYPE_READ, | 1481 | SBAL_SFLAGS0_TYPE_READ, |
1514 | qdio->adapter->pool.erp_req); | 1482 | qdio->adapter->pool.erp_req); |
1515 | 1483 | ||
1516 | if (IS_ERR(req)) { | 1484 | if (IS_ERR(req)) { |
@@ -1534,7 +1502,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) | |||
1534 | erp_action->fsf_req_id = 0; | 1502 | erp_action->fsf_req_id = 0; |
1535 | } | 1503 | } |
1536 | out: | 1504 | out: |
1537 | spin_unlock_bh(&qdio->req_q_lock); | 1505 | spin_unlock_irq(&qdio->req_q_lock); |
1538 | return retval; | 1506 | return retval; |
1539 | } | 1507 | } |
1540 | 1508 | ||
@@ -1580,15 +1548,15 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port) | |||
1580 | struct zfcp_fsf_req *req; | 1548 | struct zfcp_fsf_req *req; |
1581 | int retval = -EIO; | 1549 | int retval = -EIO; |
1582 | 1550 | ||
1583 | spin_lock_bh(&qdio->req_q_lock); | 1551 | spin_lock_irq(&qdio->req_q_lock); |
1584 | if (zfcp_qdio_sbal_get(qdio)) | 1552 | if (zfcp_qdio_sbal_get(qdio)) |
1585 | goto out; | 1553 | goto out; |
1586 | 1554 | ||
1587 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, | 1555 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, |
1588 | SBAL_FLAGS0_TYPE_READ, | 1556 | SBAL_SFLAGS0_TYPE_READ, |
1589 | qdio->adapter->pool.erp_req); | 1557 | qdio->adapter->pool.erp_req); |
1590 | 1558 | ||
1591 | if (unlikely(IS_ERR(req))) { | 1559 | if (IS_ERR(req)) { |
1592 | retval = PTR_ERR(req); | 1560 | retval = PTR_ERR(req); |
1593 | goto out; | 1561 | goto out; |
1594 | } | 1562 | } |
@@ -1605,7 +1573,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port) | |||
1605 | if (retval) | 1573 | if (retval) |
1606 | zfcp_fsf_req_free(req); | 1574 | zfcp_fsf_req_free(req); |
1607 | out: | 1575 | out: |
1608 | spin_unlock_bh(&qdio->req_q_lock); | 1576 | spin_unlock_irq(&qdio->req_q_lock); |
1609 | return retval; | 1577 | return retval; |
1610 | } | 1578 | } |
1611 | 1579 | ||
@@ -1615,7 +1583,7 @@ static void zfcp_fsf_close_wka_port_handler(struct zfcp_fsf_req *req) | |||
1615 | 1583 | ||
1616 | if (req->qtcb->header.fsf_status == FSF_PORT_HANDLE_NOT_VALID) { | 1584 | if (req->qtcb->header.fsf_status == FSF_PORT_HANDLE_NOT_VALID) { |
1617 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1585 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1618 | zfcp_erp_adapter_reopen(wka_port->adapter, 0, "fscwph1", req); | 1586 | zfcp_erp_adapter_reopen(wka_port->adapter, 0, "fscwph1"); |
1619 | } | 1587 | } |
1620 | 1588 | ||
1621 | wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE; | 1589 | wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE; |
@@ -1633,15 +1601,15 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port) | |||
1633 | struct zfcp_fsf_req *req; | 1601 | struct zfcp_fsf_req *req; |
1634 | int retval = -EIO; | 1602 | int retval = -EIO; |
1635 | 1603 | ||
1636 | spin_lock_bh(&qdio->req_q_lock); | 1604 | spin_lock_irq(&qdio->req_q_lock); |
1637 | if (zfcp_qdio_sbal_get(qdio)) | 1605 | if (zfcp_qdio_sbal_get(qdio)) |
1638 | goto out; | 1606 | goto out; |
1639 | 1607 | ||
1640 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, | 1608 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, |
1641 | SBAL_FLAGS0_TYPE_READ, | 1609 | SBAL_SFLAGS0_TYPE_READ, |
1642 | qdio->adapter->pool.erp_req); | 1610 | qdio->adapter->pool.erp_req); |
1643 | 1611 | ||
1644 | if (unlikely(IS_ERR(req))) { | 1612 | if (IS_ERR(req)) { |
1645 | retval = PTR_ERR(req); | 1613 | retval = PTR_ERR(req); |
1646 | goto out; | 1614 | goto out; |
1647 | } | 1615 | } |
@@ -1658,7 +1626,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port) | |||
1658 | if (retval) | 1626 | if (retval) |
1659 | zfcp_fsf_req_free(req); | 1627 | zfcp_fsf_req_free(req); |
1660 | out: | 1628 | out: |
1661 | spin_unlock_bh(&qdio->req_q_lock); | 1629 | spin_unlock_irq(&qdio->req_q_lock); |
1662 | return retval; | 1630 | return retval; |
1663 | } | 1631 | } |
1664 | 1632 | ||
@@ -1666,29 +1634,30 @@ static void zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *req) | |||
1666 | { | 1634 | { |
1667 | struct zfcp_port *port = req->data; | 1635 | struct zfcp_port *port = req->data; |
1668 | struct fsf_qtcb_header *header = &req->qtcb->header; | 1636 | struct fsf_qtcb_header *header = &req->qtcb->header; |
1669 | struct zfcp_unit *unit; | 1637 | struct scsi_device *sdev; |
1670 | 1638 | ||
1671 | if (req->status & ZFCP_STATUS_FSFREQ_ERROR) | 1639 | if (req->status & ZFCP_STATUS_FSFREQ_ERROR) |
1672 | return; | 1640 | return; |
1673 | 1641 | ||
1674 | switch (header->fsf_status) { | 1642 | switch (header->fsf_status) { |
1675 | case FSF_PORT_HANDLE_NOT_VALID: | 1643 | case FSF_PORT_HANDLE_NOT_VALID: |
1676 | zfcp_erp_adapter_reopen(port->adapter, 0, "fscpph1", req); | 1644 | zfcp_erp_adapter_reopen(port->adapter, 0, "fscpph1"); |
1677 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1645 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1678 | break; | 1646 | break; |
1679 | case FSF_ACCESS_DENIED: | 1647 | case FSF_ACCESS_DENIED: |
1680 | zfcp_fsf_access_denied_port(req, port); | 1648 | zfcp_cfdc_port_denied(port, &header->fsf_status_qual); |
1681 | break; | 1649 | break; |
1682 | case FSF_PORT_BOXED: | 1650 | case FSF_PORT_BOXED: |
1683 | /* can't use generic zfcp_erp_modify_port_status because | 1651 | /* can't use generic zfcp_erp_modify_port_status because |
1684 | * ZFCP_STATUS_COMMON_OPEN must not be reset for the port */ | 1652 | * ZFCP_STATUS_COMMON_OPEN must not be reset for the port */ |
1685 | atomic_clear_mask(ZFCP_STATUS_PORT_PHYS_OPEN, &port->status); | 1653 | atomic_clear_mask(ZFCP_STATUS_PORT_PHYS_OPEN, &port->status); |
1686 | read_lock(&port->unit_list_lock); | 1654 | shost_for_each_device(sdev, port->adapter->scsi_host) |
1687 | list_for_each_entry(unit, &port->unit_list, list) | 1655 | if (sdev_to_zfcp(sdev)->port == port) |
1688 | atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, | 1656 | atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, |
1689 | &unit->status); | 1657 | &sdev_to_zfcp(sdev)->status); |
1690 | read_unlock(&port->unit_list_lock); | 1658 | zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ACCESS_BOXED); |
1691 | zfcp_erp_port_boxed(port, "fscpph2", req); | 1659 | zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, |
1660 | "fscpph2"); | ||
1692 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1661 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1693 | break; | 1662 | break; |
1694 | case FSF_ADAPTER_STATUS_AVAILABLE: | 1663 | case FSF_ADAPTER_STATUS_AVAILABLE: |
@@ -1705,11 +1674,10 @@ static void zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *req) | |||
1705 | * ZFCP_STATUS_COMMON_OPEN must not be reset for the port | 1674 | * ZFCP_STATUS_COMMON_OPEN must not be reset for the port |
1706 | */ | 1675 | */ |
1707 | atomic_clear_mask(ZFCP_STATUS_PORT_PHYS_OPEN, &port->status); | 1676 | atomic_clear_mask(ZFCP_STATUS_PORT_PHYS_OPEN, &port->status); |
1708 | read_lock(&port->unit_list_lock); | 1677 | shost_for_each_device(sdev, port->adapter->scsi_host) |
1709 | list_for_each_entry(unit, &port->unit_list, list) | 1678 | if (sdev_to_zfcp(sdev)->port == port) |
1710 | atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, | 1679 | atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, |
1711 | &unit->status); | 1680 | &sdev_to_zfcp(sdev)->status); |
1712 | read_unlock(&port->unit_list_lock); | ||
1713 | break; | 1681 | break; |
1714 | } | 1682 | } |
1715 | } | 1683 | } |
@@ -1725,12 +1693,12 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) | |||
1725 | struct zfcp_fsf_req *req; | 1693 | struct zfcp_fsf_req *req; |
1726 | int retval = -EIO; | 1694 | int retval = -EIO; |
1727 | 1695 | ||
1728 | spin_lock_bh(&qdio->req_q_lock); | 1696 | spin_lock_irq(&qdio->req_q_lock); |
1729 | if (zfcp_qdio_sbal_get(qdio)) | 1697 | if (zfcp_qdio_sbal_get(qdio)) |
1730 | goto out; | 1698 | goto out; |
1731 | 1699 | ||
1732 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PHYSICAL_PORT, | 1700 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PHYSICAL_PORT, |
1733 | SBAL_FLAGS0_TYPE_READ, | 1701 | SBAL_SFLAGS0_TYPE_READ, |
1734 | qdio->adapter->pool.erp_req); | 1702 | qdio->adapter->pool.erp_req); |
1735 | 1703 | ||
1736 | if (IS_ERR(req)) { | 1704 | if (IS_ERR(req)) { |
@@ -1754,69 +1722,56 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) | |||
1754 | erp_action->fsf_req_id = 0; | 1722 | erp_action->fsf_req_id = 0; |
1755 | } | 1723 | } |
1756 | out: | 1724 | out: |
1757 | spin_unlock_bh(&qdio->req_q_lock); | 1725 | spin_unlock_irq(&qdio->req_q_lock); |
1758 | return retval; | 1726 | return retval; |
1759 | } | 1727 | } |
1760 | 1728 | ||
1761 | static void zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *req) | 1729 | static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req) |
1762 | { | 1730 | { |
1763 | struct zfcp_adapter *adapter = req->adapter; | 1731 | struct zfcp_adapter *adapter = req->adapter; |
1764 | struct zfcp_unit *unit = req->data; | 1732 | struct scsi_device *sdev = req->data; |
1733 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | ||
1765 | struct fsf_qtcb_header *header = &req->qtcb->header; | 1734 | struct fsf_qtcb_header *header = &req->qtcb->header; |
1766 | struct fsf_qtcb_bottom_support *bottom = &req->qtcb->bottom.support; | 1735 | struct fsf_qtcb_bottom_support *bottom = &req->qtcb->bottom.support; |
1767 | struct fsf_queue_designator *queue_designator = | ||
1768 | &header->fsf_status_qual.fsf_queue_designator; | ||
1769 | int exclusive, readwrite; | ||
1770 | 1736 | ||
1771 | if (req->status & ZFCP_STATUS_FSFREQ_ERROR) | 1737 | if (req->status & ZFCP_STATUS_FSFREQ_ERROR) |
1772 | return; | 1738 | return; |
1773 | 1739 | ||
1774 | atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED | | 1740 | atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED | |
1775 | ZFCP_STATUS_COMMON_ACCESS_BOXED | | 1741 | ZFCP_STATUS_COMMON_ACCESS_BOXED | |
1776 | ZFCP_STATUS_UNIT_SHARED | | 1742 | ZFCP_STATUS_LUN_SHARED | |
1777 | ZFCP_STATUS_UNIT_READONLY, | 1743 | ZFCP_STATUS_LUN_READONLY, |
1778 | &unit->status); | 1744 | &zfcp_sdev->status); |
1779 | 1745 | ||
1780 | switch (header->fsf_status) { | 1746 | switch (header->fsf_status) { |
1781 | 1747 | ||
1782 | case FSF_PORT_HANDLE_NOT_VALID: | 1748 | case FSF_PORT_HANDLE_NOT_VALID: |
1783 | zfcp_erp_adapter_reopen(unit->port->adapter, 0, "fsouh_1", req); | 1749 | zfcp_erp_adapter_reopen(adapter, 0, "fsouh_1"); |
1784 | /* fall through */ | 1750 | /* fall through */ |
1785 | case FSF_LUN_ALREADY_OPEN: | 1751 | case FSF_LUN_ALREADY_OPEN: |
1786 | break; | 1752 | break; |
1787 | case FSF_ACCESS_DENIED: | 1753 | case FSF_ACCESS_DENIED: |
1788 | zfcp_fsf_access_denied_unit(req, unit); | 1754 | zfcp_cfdc_lun_denied(sdev, &header->fsf_status_qual); |
1789 | atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status); | 1755 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1790 | atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status); | ||
1791 | break; | 1756 | break; |
1792 | case FSF_PORT_BOXED: | 1757 | case FSF_PORT_BOXED: |
1793 | zfcp_erp_port_boxed(unit->port, "fsouh_2", req); | 1758 | zfcp_erp_set_port_status(zfcp_sdev->port, |
1759 | ZFCP_STATUS_COMMON_ACCESS_BOXED); | ||
1760 | zfcp_erp_port_reopen(zfcp_sdev->port, | ||
1761 | ZFCP_STATUS_COMMON_ERP_FAILED, "fsouh_2"); | ||
1794 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1762 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1795 | break; | 1763 | break; |
1796 | case FSF_LUN_SHARING_VIOLATION: | 1764 | case FSF_LUN_SHARING_VIOLATION: |
1797 | if (header->fsf_status_qual.word[0]) | 1765 | zfcp_cfdc_lun_shrng_vltn(sdev, &header->fsf_status_qual); |
1798 | dev_warn(&adapter->ccw_device->dev, | ||
1799 | "LUN 0x%Lx on port 0x%Lx is already in " | ||
1800 | "use by CSS%d, MIF Image ID %x\n", | ||
1801 | (unsigned long long)unit->fcp_lun, | ||
1802 | (unsigned long long)unit->port->wwpn, | ||
1803 | queue_designator->cssid, | ||
1804 | queue_designator->hla); | ||
1805 | else | ||
1806 | zfcp_act_eval_err(adapter, | ||
1807 | header->fsf_status_qual.word[2]); | ||
1808 | zfcp_erp_unit_access_denied(unit, "fsouh_3", req); | ||
1809 | atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status); | ||
1810 | atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status); | ||
1811 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1766 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1812 | break; | 1767 | break; |
1813 | case FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED: | 1768 | case FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED: |
1814 | dev_warn(&adapter->ccw_device->dev, | 1769 | dev_warn(&adapter->ccw_device->dev, |
1815 | "No handle is available for LUN " | 1770 | "No handle is available for LUN " |
1816 | "0x%016Lx on port 0x%016Lx\n", | 1771 | "0x%016Lx on port 0x%016Lx\n", |
1817 | (unsigned long long)unit->fcp_lun, | 1772 | (unsigned long long)zfcp_scsi_dev_lun(sdev), |
1818 | (unsigned long long)unit->port->wwpn); | 1773 | (unsigned long long)zfcp_sdev->port->wwpn); |
1819 | zfcp_erp_unit_failed(unit, "fsouh_4", req); | 1774 | zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ERP_FAILED); |
1820 | /* fall through */ | 1775 | /* fall through */ |
1821 | case FSF_INVALID_COMMAND_OPTION: | 1776 | case FSF_INVALID_COMMAND_OPTION: |
1822 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1777 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
@@ -1824,7 +1779,7 @@ static void zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *req) | |||
1824 | case FSF_ADAPTER_STATUS_AVAILABLE: | 1779 | case FSF_ADAPTER_STATUS_AVAILABLE: |
1825 | switch (header->fsf_status_qual.word[0]) { | 1780 | switch (header->fsf_status_qual.word[0]) { |
1826 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: | 1781 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: |
1827 | zfcp_fc_test_link(unit->port); | 1782 | zfcp_fc_test_link(zfcp_sdev->port); |
1828 | /* fall through */ | 1783 | /* fall through */ |
1829 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: | 1784 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: |
1830 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1785 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
@@ -1833,75 +1788,31 @@ static void zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *req) | |||
1833 | break; | 1788 | break; |
1834 | 1789 | ||
1835 | case FSF_GOOD: | 1790 | case FSF_GOOD: |
1836 | unit->handle = header->lun_handle; | 1791 | zfcp_sdev->lun_handle = header->lun_handle; |
1837 | atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status); | 1792 | atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &zfcp_sdev->status); |
1838 | 1793 | zfcp_cfdc_open_lun_eval(sdev, bottom); | |
1839 | if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE) && | ||
1840 | (adapter->adapter_features & FSF_FEATURE_LUN_SHARING) && | ||
1841 | !zfcp_ccw_priv_sch(adapter)) { | ||
1842 | exclusive = (bottom->lun_access_info & | ||
1843 | FSF_UNIT_ACCESS_EXCLUSIVE); | ||
1844 | readwrite = (bottom->lun_access_info & | ||
1845 | FSF_UNIT_ACCESS_OUTBOUND_TRANSFER); | ||
1846 | |||
1847 | if (!exclusive) | ||
1848 | atomic_set_mask(ZFCP_STATUS_UNIT_SHARED, | ||
1849 | &unit->status); | ||
1850 | |||
1851 | if (!readwrite) { | ||
1852 | atomic_set_mask(ZFCP_STATUS_UNIT_READONLY, | ||
1853 | &unit->status); | ||
1854 | dev_info(&adapter->ccw_device->dev, | ||
1855 | "SCSI device at LUN 0x%016Lx on port " | ||
1856 | "0x%016Lx opened read-only\n", | ||
1857 | (unsigned long long)unit->fcp_lun, | ||
1858 | (unsigned long long)unit->port->wwpn); | ||
1859 | } | ||
1860 | |||
1861 | if (exclusive && !readwrite) { | ||
1862 | dev_err(&adapter->ccw_device->dev, | ||
1863 | "Exclusive read-only access not " | ||
1864 | "supported (unit 0x%016Lx, " | ||
1865 | "port 0x%016Lx)\n", | ||
1866 | (unsigned long long)unit->fcp_lun, | ||
1867 | (unsigned long long)unit->port->wwpn); | ||
1868 | zfcp_erp_unit_failed(unit, "fsouh_5", req); | ||
1869 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
1870 | zfcp_erp_unit_shutdown(unit, 0, "fsouh_6", req); | ||
1871 | } else if (!exclusive && readwrite) { | ||
1872 | dev_err(&adapter->ccw_device->dev, | ||
1873 | "Shared read-write access not " | ||
1874 | "supported (unit 0x%016Lx, port " | ||
1875 | "0x%016Lx)\n", | ||
1876 | (unsigned long long)unit->fcp_lun, | ||
1877 | (unsigned long long)unit->port->wwpn); | ||
1878 | zfcp_erp_unit_failed(unit, "fsouh_7", req); | ||
1879 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
1880 | zfcp_erp_unit_shutdown(unit, 0, "fsouh_8", req); | ||
1881 | } | ||
1882 | } | ||
1883 | break; | 1794 | break; |
1884 | } | 1795 | } |
1885 | } | 1796 | } |
1886 | 1797 | ||
1887 | /** | 1798 | /** |
1888 | * zfcp_fsf_open_unit - open unit | 1799 | * zfcp_fsf_open_lun - open LUN |
1889 | * @erp_action: pointer to struct zfcp_erp_action | 1800 | * @erp_action: pointer to struct zfcp_erp_action |
1890 | * Returns: 0 on success, error otherwise | 1801 | * Returns: 0 on success, error otherwise |
1891 | */ | 1802 | */ |
1892 | int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action) | 1803 | int zfcp_fsf_open_lun(struct zfcp_erp_action *erp_action) |
1893 | { | 1804 | { |
1894 | struct zfcp_adapter *adapter = erp_action->adapter; | 1805 | struct zfcp_adapter *adapter = erp_action->adapter; |
1895 | struct zfcp_qdio *qdio = adapter->qdio; | 1806 | struct zfcp_qdio *qdio = adapter->qdio; |
1896 | struct zfcp_fsf_req *req; | 1807 | struct zfcp_fsf_req *req; |
1897 | int retval = -EIO; | 1808 | int retval = -EIO; |
1898 | 1809 | ||
1899 | spin_lock_bh(&qdio->req_q_lock); | 1810 | spin_lock_irq(&qdio->req_q_lock); |
1900 | if (zfcp_qdio_sbal_get(qdio)) | 1811 | if (zfcp_qdio_sbal_get(qdio)) |
1901 | goto out; | 1812 | goto out; |
1902 | 1813 | ||
1903 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_LUN, | 1814 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_LUN, |
1904 | SBAL_FLAGS0_TYPE_READ, | 1815 | SBAL_SFLAGS0_TYPE_READ, |
1905 | adapter->pool.erp_req); | 1816 | adapter->pool.erp_req); |
1906 | 1817 | ||
1907 | if (IS_ERR(req)) { | 1818 | if (IS_ERR(req)) { |
@@ -1913,9 +1824,9 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action) | |||
1913 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); | 1824 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); |
1914 | 1825 | ||
1915 | req->qtcb->header.port_handle = erp_action->port->handle; | 1826 | req->qtcb->header.port_handle = erp_action->port->handle; |
1916 | req->qtcb->bottom.support.fcp_lun = erp_action->unit->fcp_lun; | 1827 | req->qtcb->bottom.support.fcp_lun = zfcp_scsi_dev_lun(erp_action->sdev); |
1917 | req->handler = zfcp_fsf_open_unit_handler; | 1828 | req->handler = zfcp_fsf_open_lun_handler; |
1918 | req->data = erp_action->unit; | 1829 | req->data = erp_action->sdev; |
1919 | req->erp_action = erp_action; | 1830 | req->erp_action = erp_action; |
1920 | erp_action->fsf_req_id = req->req_id; | 1831 | erp_action->fsf_req_id = req->req_id; |
1921 | 1832 | ||
@@ -1929,34 +1840,38 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action) | |||
1929 | erp_action->fsf_req_id = 0; | 1840 | erp_action->fsf_req_id = 0; |
1930 | } | 1841 | } |
1931 | out: | 1842 | out: |
1932 | spin_unlock_bh(&qdio->req_q_lock); | 1843 | spin_unlock_irq(&qdio->req_q_lock); |
1933 | return retval; | 1844 | return retval; |
1934 | } | 1845 | } |
1935 | 1846 | ||
1936 | static void zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *req) | 1847 | static void zfcp_fsf_close_lun_handler(struct zfcp_fsf_req *req) |
1937 | { | 1848 | { |
1938 | struct zfcp_unit *unit = req->data; | 1849 | struct scsi_device *sdev = req->data; |
1850 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | ||
1939 | 1851 | ||
1940 | if (req->status & ZFCP_STATUS_FSFREQ_ERROR) | 1852 | if (req->status & ZFCP_STATUS_FSFREQ_ERROR) |
1941 | return; | 1853 | return; |
1942 | 1854 | ||
1943 | switch (req->qtcb->header.fsf_status) { | 1855 | switch (req->qtcb->header.fsf_status) { |
1944 | case FSF_PORT_HANDLE_NOT_VALID: | 1856 | case FSF_PORT_HANDLE_NOT_VALID: |
1945 | zfcp_erp_adapter_reopen(unit->port->adapter, 0, "fscuh_1", req); | 1857 | zfcp_erp_adapter_reopen(zfcp_sdev->port->adapter, 0, "fscuh_1"); |
1946 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1858 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1947 | break; | 1859 | break; |
1948 | case FSF_LUN_HANDLE_NOT_VALID: | 1860 | case FSF_LUN_HANDLE_NOT_VALID: |
1949 | zfcp_erp_port_reopen(unit->port, 0, "fscuh_2", req); | 1861 | zfcp_erp_port_reopen(zfcp_sdev->port, 0, "fscuh_2"); |
1950 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1862 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1951 | break; | 1863 | break; |
1952 | case FSF_PORT_BOXED: | 1864 | case FSF_PORT_BOXED: |
1953 | zfcp_erp_port_boxed(unit->port, "fscuh_3", req); | 1865 | zfcp_erp_set_port_status(zfcp_sdev->port, |
1866 | ZFCP_STATUS_COMMON_ACCESS_BOXED); | ||
1867 | zfcp_erp_port_reopen(zfcp_sdev->port, | ||
1868 | ZFCP_STATUS_COMMON_ERP_FAILED, "fscuh_3"); | ||
1954 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1869 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1955 | break; | 1870 | break; |
1956 | case FSF_ADAPTER_STATUS_AVAILABLE: | 1871 | case FSF_ADAPTER_STATUS_AVAILABLE: |
1957 | switch (req->qtcb->header.fsf_status_qual.word[0]) { | 1872 | switch (req->qtcb->header.fsf_status_qual.word[0]) { |
1958 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: | 1873 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: |
1959 | zfcp_fc_test_link(unit->port); | 1874 | zfcp_fc_test_link(zfcp_sdev->port); |
1960 | /* fall through */ | 1875 | /* fall through */ |
1961 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: | 1876 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: |
1962 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1877 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
@@ -1964,28 +1879,29 @@ static void zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *req) | |||
1964 | } | 1879 | } |
1965 | break; | 1880 | break; |
1966 | case FSF_GOOD: | 1881 | case FSF_GOOD: |
1967 | atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status); | 1882 | atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, &zfcp_sdev->status); |
1968 | break; | 1883 | break; |
1969 | } | 1884 | } |
1970 | } | 1885 | } |
1971 | 1886 | ||
1972 | /** | 1887 | /** |
1973 | * zfcp_fsf_close_unit - close zfcp unit | 1888 | * zfcp_fsf_close_LUN - close LUN |
1974 | * @erp_action: pointer to struct zfcp_unit | 1889 | * @erp_action: pointer to erp_action triggering the "close LUN" |
1975 | * Returns: 0 on success, error otherwise | 1890 | * Returns: 0 on success, error otherwise |
1976 | */ | 1891 | */ |
1977 | int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) | 1892 | int zfcp_fsf_close_lun(struct zfcp_erp_action *erp_action) |
1978 | { | 1893 | { |
1979 | struct zfcp_qdio *qdio = erp_action->adapter->qdio; | 1894 | struct zfcp_qdio *qdio = erp_action->adapter->qdio; |
1895 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(erp_action->sdev); | ||
1980 | struct zfcp_fsf_req *req; | 1896 | struct zfcp_fsf_req *req; |
1981 | int retval = -EIO; | 1897 | int retval = -EIO; |
1982 | 1898 | ||
1983 | spin_lock_bh(&qdio->req_q_lock); | 1899 | spin_lock_irq(&qdio->req_q_lock); |
1984 | if (zfcp_qdio_sbal_get(qdio)) | 1900 | if (zfcp_qdio_sbal_get(qdio)) |
1985 | goto out; | 1901 | goto out; |
1986 | 1902 | ||
1987 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_LUN, | 1903 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_LUN, |
1988 | SBAL_FLAGS0_TYPE_READ, | 1904 | SBAL_SFLAGS0_TYPE_READ, |
1989 | qdio->adapter->pool.erp_req); | 1905 | qdio->adapter->pool.erp_req); |
1990 | 1906 | ||
1991 | if (IS_ERR(req)) { | 1907 | if (IS_ERR(req)) { |
@@ -1997,9 +1913,9 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) | |||
1997 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); | 1913 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); |
1998 | 1914 | ||
1999 | req->qtcb->header.port_handle = erp_action->port->handle; | 1915 | req->qtcb->header.port_handle = erp_action->port->handle; |
2000 | req->qtcb->header.lun_handle = erp_action->unit->handle; | 1916 | req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; |
2001 | req->handler = zfcp_fsf_close_unit_handler; | 1917 | req->handler = zfcp_fsf_close_lun_handler; |
2002 | req->data = erp_action->unit; | 1918 | req->data = erp_action->sdev; |
2003 | req->erp_action = erp_action; | 1919 | req->erp_action = erp_action; |
2004 | erp_action->fsf_req_id = req->req_id; | 1920 | erp_action->fsf_req_id = req->req_id; |
2005 | 1921 | ||
@@ -2010,7 +1926,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) | |||
2010 | erp_action->fsf_req_id = 0; | 1926 | erp_action->fsf_req_id = 0; |
2011 | } | 1927 | } |
2012 | out: | 1928 | out: |
2013 | spin_unlock_bh(&qdio->req_q_lock); | 1929 | spin_unlock_irq(&qdio->req_q_lock); |
2014 | return retval; | 1930 | return retval; |
2015 | } | 1931 | } |
2016 | 1932 | ||
@@ -2025,7 +1941,7 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi) | |||
2025 | { | 1941 | { |
2026 | struct fsf_qual_latency_info *lat_in; | 1942 | struct fsf_qual_latency_info *lat_in; |
2027 | struct latency_cont *lat = NULL; | 1943 | struct latency_cont *lat = NULL; |
2028 | struct zfcp_unit *unit = req->unit; | 1944 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scsi->device); |
2029 | struct zfcp_blk_drv_data blktrc; | 1945 | struct zfcp_blk_drv_data blktrc; |
2030 | int ticks = req->adapter->timer_ticks; | 1946 | int ticks = req->adapter->timer_ticks; |
2031 | 1947 | ||
@@ -2048,24 +1964,24 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi) | |||
2048 | case FSF_DATADIR_DIF_READ_STRIP: | 1964 | case FSF_DATADIR_DIF_READ_STRIP: |
2049 | case FSF_DATADIR_DIF_READ_CONVERT: | 1965 | case FSF_DATADIR_DIF_READ_CONVERT: |
2050 | case FSF_DATADIR_READ: | 1966 | case FSF_DATADIR_READ: |
2051 | lat = &unit->latencies.read; | 1967 | lat = &zfcp_sdev->latencies.read; |
2052 | break; | 1968 | break; |
2053 | case FSF_DATADIR_DIF_WRITE_INSERT: | 1969 | case FSF_DATADIR_DIF_WRITE_INSERT: |
2054 | case FSF_DATADIR_DIF_WRITE_CONVERT: | 1970 | case FSF_DATADIR_DIF_WRITE_CONVERT: |
2055 | case FSF_DATADIR_WRITE: | 1971 | case FSF_DATADIR_WRITE: |
2056 | lat = &unit->latencies.write; | 1972 | lat = &zfcp_sdev->latencies.write; |
2057 | break; | 1973 | break; |
2058 | case FSF_DATADIR_CMND: | 1974 | case FSF_DATADIR_CMND: |
2059 | lat = &unit->latencies.cmd; | 1975 | lat = &zfcp_sdev->latencies.cmd; |
2060 | break; | 1976 | break; |
2061 | } | 1977 | } |
2062 | 1978 | ||
2063 | if (lat) { | 1979 | if (lat) { |
2064 | spin_lock(&unit->latencies.lock); | 1980 | spin_lock(&zfcp_sdev->latencies.lock); |
2065 | zfcp_fsf_update_lat(&lat->channel, lat_in->channel_lat); | 1981 | zfcp_fsf_update_lat(&lat->channel, lat_in->channel_lat); |
2066 | zfcp_fsf_update_lat(&lat->fabric, lat_in->fabric_lat); | 1982 | zfcp_fsf_update_lat(&lat->fabric, lat_in->fabric_lat); |
2067 | lat->counter++; | 1983 | lat->counter++; |
2068 | spin_unlock(&unit->latencies.lock); | 1984 | spin_unlock(&zfcp_sdev->latencies.lock); |
2069 | } | 1985 | } |
2070 | } | 1986 | } |
2071 | 1987 | ||
@@ -2073,7 +1989,79 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi) | |||
2073 | sizeof(blktrc)); | 1989 | sizeof(blktrc)); |
2074 | } | 1990 | } |
2075 | 1991 | ||
2076 | static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req) | 1992 | static void zfcp_fsf_fcp_handler_common(struct zfcp_fsf_req *req) |
1993 | { | ||
1994 | struct scsi_cmnd *scmnd = req->data; | ||
1995 | struct scsi_device *sdev = scmnd->device; | ||
1996 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | ||
1997 | struct fsf_qtcb_header *header = &req->qtcb->header; | ||
1998 | |||
1999 | if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) | ||
2000 | return; | ||
2001 | |||
2002 | switch (header->fsf_status) { | ||
2003 | case FSF_HANDLE_MISMATCH: | ||
2004 | case FSF_PORT_HANDLE_NOT_VALID: | ||
2005 | zfcp_erp_adapter_reopen(zfcp_sdev->port->adapter, 0, "fssfch1"); | ||
2006 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2007 | break; | ||
2008 | case FSF_FCPLUN_NOT_VALID: | ||
2009 | case FSF_LUN_HANDLE_NOT_VALID: | ||
2010 | zfcp_erp_port_reopen(zfcp_sdev->port, 0, "fssfch2"); | ||
2011 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2012 | break; | ||
2013 | case FSF_SERVICE_CLASS_NOT_SUPPORTED: | ||
2014 | zfcp_fsf_class_not_supp(req); | ||
2015 | break; | ||
2016 | case FSF_ACCESS_DENIED: | ||
2017 | zfcp_cfdc_lun_denied(sdev, &header->fsf_status_qual); | ||
2018 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2019 | break; | ||
2020 | case FSF_DIRECTION_INDICATOR_NOT_VALID: | ||
2021 | dev_err(&req->adapter->ccw_device->dev, | ||
2022 | "Incorrect direction %d, LUN 0x%016Lx on port " | ||
2023 | "0x%016Lx closed\n", | ||
2024 | req->qtcb->bottom.io.data_direction, | ||
2025 | (unsigned long long)zfcp_scsi_dev_lun(sdev), | ||
2026 | (unsigned long long)zfcp_sdev->port->wwpn); | ||
2027 | zfcp_erp_adapter_shutdown(zfcp_sdev->port->adapter, 0, | ||
2028 | "fssfch3"); | ||
2029 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2030 | break; | ||
2031 | case FSF_CMND_LENGTH_NOT_VALID: | ||
2032 | dev_err(&req->adapter->ccw_device->dev, | ||
2033 | "Incorrect CDB length %d, LUN 0x%016Lx on " | ||
2034 | "port 0x%016Lx closed\n", | ||
2035 | req->qtcb->bottom.io.fcp_cmnd_length, | ||
2036 | (unsigned long long)zfcp_scsi_dev_lun(sdev), | ||
2037 | (unsigned long long)zfcp_sdev->port->wwpn); | ||
2038 | zfcp_erp_adapter_shutdown(zfcp_sdev->port->adapter, 0, | ||
2039 | "fssfch4"); | ||
2040 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2041 | break; | ||
2042 | case FSF_PORT_BOXED: | ||
2043 | zfcp_erp_set_port_status(zfcp_sdev->port, | ||
2044 | ZFCP_STATUS_COMMON_ACCESS_BOXED); | ||
2045 | zfcp_erp_port_reopen(zfcp_sdev->port, | ||
2046 | ZFCP_STATUS_COMMON_ERP_FAILED, "fssfch5"); | ||
2047 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2048 | break; | ||
2049 | case FSF_LUN_BOXED: | ||
2050 | zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ACCESS_BOXED); | ||
2051 | zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED, | ||
2052 | "fssfch6"); | ||
2053 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2054 | break; | ||
2055 | case FSF_ADAPTER_STATUS_AVAILABLE: | ||
2056 | if (header->fsf_status_qual.word[0] == | ||
2057 | FSF_SQ_INVOKE_LINK_TEST_PROCEDURE) | ||
2058 | zfcp_fc_test_link(zfcp_sdev->port); | ||
2059 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2060 | break; | ||
2061 | } | ||
2062 | } | ||
2063 | |||
2064 | static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req) | ||
2077 | { | 2065 | { |
2078 | struct scsi_cmnd *scpnt; | 2066 | struct scsi_cmnd *scpnt; |
2079 | struct fcp_resp_with_ext *fcp_rsp; | 2067 | struct fcp_resp_with_ext *fcp_rsp; |
@@ -2087,6 +2075,8 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req) | |||
2087 | return; | 2075 | return; |
2088 | } | 2076 | } |
2089 | 2077 | ||
2078 | zfcp_fsf_fcp_handler_common(req); | ||
2079 | |||
2090 | if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) { | 2080 | if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) { |
2091 | set_host_byte(scpnt, DID_TRANSPORT_DISRUPTED); | 2081 | set_host_byte(scpnt, DID_TRANSPORT_DISRUPTED); |
2092 | goto skip_fsfstatus; | 2082 | goto skip_fsfstatus; |
@@ -2112,7 +2102,7 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req) | |||
2112 | 2102 | ||
2113 | skip_fsfstatus: | 2103 | skip_fsfstatus: |
2114 | zfcp_fsf_req_trace(req, scpnt); | 2104 | zfcp_fsf_req_trace(req, scpnt); |
2115 | zfcp_dbf_scsi_result(req->adapter->dbf, scpnt, req); | 2105 | zfcp_dbf_scsi_result(scpnt, req); |
2116 | 2106 | ||
2117 | scpnt->host_scribble = NULL; | 2107 | scpnt->host_scribble = NULL; |
2118 | (scpnt->scsi_done) (scpnt); | 2108 | (scpnt->scsi_done) (scpnt); |
@@ -2125,97 +2115,6 @@ skip_fsfstatus: | |||
2125 | read_unlock_irqrestore(&req->adapter->abort_lock, flags); | 2115 | read_unlock_irqrestore(&req->adapter->abort_lock, flags); |
2126 | } | 2116 | } |
2127 | 2117 | ||
2128 | static void zfcp_fsf_send_fcp_ctm_handler(struct zfcp_fsf_req *req) | ||
2129 | { | ||
2130 | struct fcp_resp_with_ext *fcp_rsp; | ||
2131 | struct fcp_resp_rsp_info *rsp_info; | ||
2132 | |||
2133 | fcp_rsp = (struct fcp_resp_with_ext *) &req->qtcb->bottom.io.fcp_rsp; | ||
2134 | rsp_info = (struct fcp_resp_rsp_info *) &fcp_rsp[1]; | ||
2135 | |||
2136 | if ((rsp_info->rsp_code != FCP_TMF_CMPL) || | ||
2137 | (req->status & ZFCP_STATUS_FSFREQ_ERROR)) | ||
2138 | req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED; | ||
2139 | } | ||
2140 | |||
2141 | |||
2142 | static void zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *req) | ||
2143 | { | ||
2144 | struct zfcp_unit *unit; | ||
2145 | struct fsf_qtcb_header *header = &req->qtcb->header; | ||
2146 | |||
2147 | if (unlikely(req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT)) | ||
2148 | unit = req->data; | ||
2149 | else | ||
2150 | unit = req->unit; | ||
2151 | |||
2152 | if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) | ||
2153 | goto skip_fsfstatus; | ||
2154 | |||
2155 | switch (header->fsf_status) { | ||
2156 | case FSF_HANDLE_MISMATCH: | ||
2157 | case FSF_PORT_HANDLE_NOT_VALID: | ||
2158 | zfcp_erp_adapter_reopen(unit->port->adapter, 0, "fssfch1", req); | ||
2159 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2160 | break; | ||
2161 | case FSF_FCPLUN_NOT_VALID: | ||
2162 | case FSF_LUN_HANDLE_NOT_VALID: | ||
2163 | zfcp_erp_port_reopen(unit->port, 0, "fssfch2", req); | ||
2164 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2165 | break; | ||
2166 | case FSF_SERVICE_CLASS_NOT_SUPPORTED: | ||
2167 | zfcp_fsf_class_not_supp(req); | ||
2168 | break; | ||
2169 | case FSF_ACCESS_DENIED: | ||
2170 | zfcp_fsf_access_denied_unit(req, unit); | ||
2171 | break; | ||
2172 | case FSF_DIRECTION_INDICATOR_NOT_VALID: | ||
2173 | dev_err(&req->adapter->ccw_device->dev, | ||
2174 | "Incorrect direction %d, unit 0x%016Lx on port " | ||
2175 | "0x%016Lx closed\n", | ||
2176 | req->qtcb->bottom.io.data_direction, | ||
2177 | (unsigned long long)unit->fcp_lun, | ||
2178 | (unsigned long long)unit->port->wwpn); | ||
2179 | zfcp_erp_adapter_shutdown(unit->port->adapter, 0, "fssfch3", | ||
2180 | req); | ||
2181 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2182 | break; | ||
2183 | case FSF_CMND_LENGTH_NOT_VALID: | ||
2184 | dev_err(&req->adapter->ccw_device->dev, | ||
2185 | "Incorrect CDB length %d, unit 0x%016Lx on " | ||
2186 | "port 0x%016Lx closed\n", | ||
2187 | req->qtcb->bottom.io.fcp_cmnd_length, | ||
2188 | (unsigned long long)unit->fcp_lun, | ||
2189 | (unsigned long long)unit->port->wwpn); | ||
2190 | zfcp_erp_adapter_shutdown(unit->port->adapter, 0, "fssfch4", | ||
2191 | req); | ||
2192 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2193 | break; | ||
2194 | case FSF_PORT_BOXED: | ||
2195 | zfcp_erp_port_boxed(unit->port, "fssfch5", req); | ||
2196 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2197 | break; | ||
2198 | case FSF_LUN_BOXED: | ||
2199 | zfcp_erp_unit_boxed(unit, "fssfch6", req); | ||
2200 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2201 | break; | ||
2202 | case FSF_ADAPTER_STATUS_AVAILABLE: | ||
2203 | if (header->fsf_status_qual.word[0] == | ||
2204 | FSF_SQ_INVOKE_LINK_TEST_PROCEDURE) | ||
2205 | zfcp_fc_test_link(unit->port); | ||
2206 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2207 | break; | ||
2208 | } | ||
2209 | skip_fsfstatus: | ||
2210 | if (req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) | ||
2211 | zfcp_fsf_send_fcp_ctm_handler(req); | ||
2212 | else { | ||
2213 | zfcp_fsf_send_fcp_command_task_handler(req); | ||
2214 | req->unit = NULL; | ||
2215 | put_device(&unit->dev); | ||
2216 | } | ||
2217 | } | ||
2218 | |||
2219 | static int zfcp_fsf_set_data_dir(struct scsi_cmnd *scsi_cmnd, u32 *data_dir) | 2118 | static int zfcp_fsf_set_data_dir(struct scsi_cmnd *scsi_cmnd, u32 *data_dir) |
2220 | { | 2119 | { |
2221 | switch (scsi_get_prot_op(scsi_cmnd)) { | 2120 | switch (scsi_get_prot_op(scsi_cmnd)) { |
@@ -2255,33 +2154,34 @@ static int zfcp_fsf_set_data_dir(struct scsi_cmnd *scsi_cmnd, u32 *data_dir) | |||
2255 | } | 2154 | } |
2256 | 2155 | ||
2257 | /** | 2156 | /** |
2258 | * zfcp_fsf_send_fcp_command_task - initiate an FCP command (for a SCSI command) | 2157 | * zfcp_fsf_fcp_cmnd - initiate an FCP command (for a SCSI command) |
2259 | * @unit: unit where command is sent to | ||
2260 | * @scsi_cmnd: scsi command to be sent | 2158 | * @scsi_cmnd: scsi command to be sent |
2261 | */ | 2159 | */ |
2262 | int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit, | 2160 | int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd) |
2263 | struct scsi_cmnd *scsi_cmnd) | ||
2264 | { | 2161 | { |
2265 | struct zfcp_fsf_req *req; | 2162 | struct zfcp_fsf_req *req; |
2266 | struct fcp_cmnd *fcp_cmnd; | 2163 | struct fcp_cmnd *fcp_cmnd; |
2267 | unsigned int sbtype = SBAL_FLAGS0_TYPE_READ; | 2164 | u8 sbtype = SBAL_SFLAGS0_TYPE_READ; |
2268 | int real_bytes, retval = -EIO, dix_bytes = 0; | 2165 | int real_bytes, retval = -EIO, dix_bytes = 0; |
2269 | struct zfcp_adapter *adapter = unit->port->adapter; | 2166 | struct scsi_device *sdev = scsi_cmnd->device; |
2167 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | ||
2168 | struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; | ||
2270 | struct zfcp_qdio *qdio = adapter->qdio; | 2169 | struct zfcp_qdio *qdio = adapter->qdio; |
2271 | struct fsf_qtcb_bottom_io *io; | 2170 | struct fsf_qtcb_bottom_io *io; |
2171 | unsigned long flags; | ||
2272 | 2172 | ||
2273 | if (unlikely(!(atomic_read(&unit->status) & | 2173 | if (unlikely(!(atomic_read(&zfcp_sdev->status) & |
2274 | ZFCP_STATUS_COMMON_UNBLOCKED))) | 2174 | ZFCP_STATUS_COMMON_UNBLOCKED))) |
2275 | return -EBUSY; | 2175 | return -EBUSY; |
2276 | 2176 | ||
2277 | spin_lock(&qdio->req_q_lock); | 2177 | spin_lock_irqsave(&qdio->req_q_lock, flags); |
2278 | if (atomic_read(&qdio->req_q_free) <= 0) { | 2178 | if (atomic_read(&qdio->req_q_free) <= 0) { |
2279 | atomic_inc(&qdio->req_q_full); | 2179 | atomic_inc(&qdio->req_q_full); |
2280 | goto out; | 2180 | goto out; |
2281 | } | 2181 | } |
2282 | 2182 | ||
2283 | if (scsi_cmnd->sc_data_direction == DMA_TO_DEVICE) | 2183 | if (scsi_cmnd->sc_data_direction == DMA_TO_DEVICE) |
2284 | sbtype = SBAL_FLAGS0_TYPE_WRITE; | 2184 | sbtype = SBAL_SFLAGS0_TYPE_WRITE; |
2285 | 2185 | ||
2286 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, | 2186 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, |
2287 | sbtype, adapter->pool.scsi_req); | 2187 | sbtype, adapter->pool.scsi_req); |
@@ -2295,11 +2195,10 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit, | |||
2295 | 2195 | ||
2296 | io = &req->qtcb->bottom.io; | 2196 | io = &req->qtcb->bottom.io; |
2297 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; | 2197 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; |
2298 | req->unit = unit; | ||
2299 | req->data = scsi_cmnd; | 2198 | req->data = scsi_cmnd; |
2300 | req->handler = zfcp_fsf_send_fcp_command_handler; | 2199 | req->handler = zfcp_fsf_fcp_cmnd_handler; |
2301 | req->qtcb->header.lun_handle = unit->handle; | 2200 | req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; |
2302 | req->qtcb->header.port_handle = unit->port->handle; | 2201 | req->qtcb->header.port_handle = zfcp_sdev->port->handle; |
2303 | io->service_class = FSF_CLASS_3; | 2202 | io->service_class = FSF_CLASS_3; |
2304 | io->fcp_cmnd_length = FCP_CMND_LEN; | 2203 | io->fcp_cmnd_length = FCP_CMND_LEN; |
2305 | 2204 | ||
@@ -2310,10 +2209,8 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit, | |||
2310 | 2209 | ||
2311 | zfcp_fsf_set_data_dir(scsi_cmnd, &io->data_direction); | 2210 | zfcp_fsf_set_data_dir(scsi_cmnd, &io->data_direction); |
2312 | 2211 | ||
2313 | get_device(&unit->dev); | ||
2314 | |||
2315 | fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; | 2212 | fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; |
2316 | zfcp_fc_scsi_to_fcp(fcp_cmnd, scsi_cmnd); | 2213 | zfcp_fc_scsi_to_fcp(fcp_cmnd, scsi_cmnd, 0); |
2317 | 2214 | ||
2318 | if (scsi_prot_sg_count(scsi_cmnd)) { | 2215 | if (scsi_prot_sg_count(scsi_cmnd)) { |
2319 | zfcp_qdio_set_data_div(qdio, &req->qdio_req, | 2216 | zfcp_qdio_set_data_div(qdio, &req->qdio_req, |
@@ -2338,36 +2235,52 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit, | |||
2338 | goto out; | 2235 | goto out; |
2339 | 2236 | ||
2340 | failed_scsi_cmnd: | 2237 | failed_scsi_cmnd: |
2341 | put_device(&unit->dev); | ||
2342 | zfcp_fsf_req_free(req); | 2238 | zfcp_fsf_req_free(req); |
2343 | scsi_cmnd->host_scribble = NULL; | 2239 | scsi_cmnd->host_scribble = NULL; |
2344 | out: | 2240 | out: |
2345 | spin_unlock(&qdio->req_q_lock); | 2241 | spin_unlock_irqrestore(&qdio->req_q_lock, flags); |
2346 | return retval; | 2242 | return retval; |
2347 | } | 2243 | } |
2348 | 2244 | ||
2245 | static void zfcp_fsf_fcp_task_mgmt_handler(struct zfcp_fsf_req *req) | ||
2246 | { | ||
2247 | struct fcp_resp_with_ext *fcp_rsp; | ||
2248 | struct fcp_resp_rsp_info *rsp_info; | ||
2249 | |||
2250 | zfcp_fsf_fcp_handler_common(req); | ||
2251 | |||
2252 | fcp_rsp = (struct fcp_resp_with_ext *) &req->qtcb->bottom.io.fcp_rsp; | ||
2253 | rsp_info = (struct fcp_resp_rsp_info *) &fcp_rsp[1]; | ||
2254 | |||
2255 | if ((rsp_info->rsp_code != FCP_TMF_CMPL) || | ||
2256 | (req->status & ZFCP_STATUS_FSFREQ_ERROR)) | ||
2257 | req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED; | ||
2258 | } | ||
2259 | |||
2349 | /** | 2260 | /** |
2350 | * zfcp_fsf_send_fcp_ctm - send SCSI task management command | 2261 | * zfcp_fsf_fcp_task_mgmt - send SCSI task management command |
2351 | * @unit: pointer to struct zfcp_unit | 2262 | * @scmnd: SCSI command to send the task management command for |
2352 | * @tm_flags: unsigned byte for task management flags | 2263 | * @tm_flags: unsigned byte for task management flags |
2353 | * Returns: on success pointer to struct fsf_req, NULL otherwise | 2264 | * Returns: on success pointer to struct fsf_req, NULL otherwise |
2354 | */ | 2265 | */ |
2355 | struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags) | 2266 | struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct scsi_cmnd *scmnd, |
2267 | u8 tm_flags) | ||
2356 | { | 2268 | { |
2357 | struct zfcp_fsf_req *req = NULL; | 2269 | struct zfcp_fsf_req *req = NULL; |
2358 | struct fcp_cmnd *fcp_cmnd; | 2270 | struct fcp_cmnd *fcp_cmnd; |
2359 | struct zfcp_qdio *qdio = unit->port->adapter->qdio; | 2271 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scmnd->device); |
2272 | struct zfcp_qdio *qdio = zfcp_sdev->port->adapter->qdio; | ||
2360 | 2273 | ||
2361 | if (unlikely(!(atomic_read(&unit->status) & | 2274 | if (unlikely(!(atomic_read(&zfcp_sdev->status) & |
2362 | ZFCP_STATUS_COMMON_UNBLOCKED))) | 2275 | ZFCP_STATUS_COMMON_UNBLOCKED))) |
2363 | return NULL; | 2276 | return NULL; |
2364 | 2277 | ||
2365 | spin_lock_bh(&qdio->req_q_lock); | 2278 | spin_lock_irq(&qdio->req_q_lock); |
2366 | if (zfcp_qdio_sbal_get(qdio)) | 2279 | if (zfcp_qdio_sbal_get(qdio)) |
2367 | goto out; | 2280 | goto out; |
2368 | 2281 | ||
2369 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, | 2282 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, |
2370 | SBAL_FLAGS0_TYPE_WRITE, | 2283 | SBAL_SFLAGS0_TYPE_WRITE, |
2371 | qdio->adapter->pool.scsi_req); | 2284 | qdio->adapter->pool.scsi_req); |
2372 | 2285 | ||
2373 | if (IS_ERR(req)) { | 2286 | if (IS_ERR(req)) { |
@@ -2375,11 +2288,10 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags) | |||
2375 | goto out; | 2288 | goto out; |
2376 | } | 2289 | } |
2377 | 2290 | ||
2378 | req->status |= ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT; | 2291 | req->data = scmnd; |
2379 | req->data = unit; | 2292 | req->handler = zfcp_fsf_fcp_task_mgmt_handler; |
2380 | req->handler = zfcp_fsf_send_fcp_command_handler; | 2293 | req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; |
2381 | req->qtcb->header.lun_handle = unit->handle; | 2294 | req->qtcb->header.port_handle = zfcp_sdev->port->handle; |
2382 | req->qtcb->header.port_handle = unit->port->handle; | ||
2383 | req->qtcb->bottom.io.data_direction = FSF_DATADIR_CMND; | 2295 | req->qtcb->bottom.io.data_direction = FSF_DATADIR_CMND; |
2384 | req->qtcb->bottom.io.service_class = FSF_CLASS_3; | 2296 | req->qtcb->bottom.io.service_class = FSF_CLASS_3; |
2385 | req->qtcb->bottom.io.fcp_cmnd_length = FCP_CMND_LEN; | 2297 | req->qtcb->bottom.io.fcp_cmnd_length = FCP_CMND_LEN; |
@@ -2387,7 +2299,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags) | |||
2387 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); | 2299 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); |
2388 | 2300 | ||
2389 | fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; | 2301 | fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; |
2390 | zfcp_fc_fcp_tm(fcp_cmnd, unit->device, tm_flags); | 2302 | zfcp_fc_scsi_to_fcp(fcp_cmnd, scmnd, tm_flags); |
2391 | 2303 | ||
2392 | zfcp_fsf_start_timer(req, ZFCP_SCSI_ER_TIMEOUT); | 2304 | zfcp_fsf_start_timer(req, ZFCP_SCSI_ER_TIMEOUT); |
2393 | if (!zfcp_fsf_req_send(req)) | 2305 | if (!zfcp_fsf_req_send(req)) |
@@ -2396,7 +2308,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags) | |||
2396 | zfcp_fsf_req_free(req); | 2308 | zfcp_fsf_req_free(req); |
2397 | req = NULL; | 2309 | req = NULL; |
2398 | out: | 2310 | out: |
2399 | spin_unlock_bh(&qdio->req_q_lock); | 2311 | spin_unlock_irq(&qdio->req_q_lock); |
2400 | return req; | 2312 | return req; |
2401 | } | 2313 | } |
2402 | 2314 | ||
@@ -2416,23 +2328,24 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter, | |||
2416 | struct zfcp_qdio *qdio = adapter->qdio; | 2328 | struct zfcp_qdio *qdio = adapter->qdio; |
2417 | struct zfcp_fsf_req *req = NULL; | 2329 | struct zfcp_fsf_req *req = NULL; |
2418 | struct fsf_qtcb_bottom_support *bottom; | 2330 | struct fsf_qtcb_bottom_support *bottom; |
2419 | int direction, retval = -EIO, bytes; | 2331 | int retval = -EIO, bytes; |
2332 | u8 direction; | ||
2420 | 2333 | ||
2421 | if (!(adapter->adapter_features & FSF_FEATURE_CFDC)) | 2334 | if (!(adapter->adapter_features & FSF_FEATURE_CFDC)) |
2422 | return ERR_PTR(-EOPNOTSUPP); | 2335 | return ERR_PTR(-EOPNOTSUPP); |
2423 | 2336 | ||
2424 | switch (fsf_cfdc->command) { | 2337 | switch (fsf_cfdc->command) { |
2425 | case FSF_QTCB_DOWNLOAD_CONTROL_FILE: | 2338 | case FSF_QTCB_DOWNLOAD_CONTROL_FILE: |
2426 | direction = SBAL_FLAGS0_TYPE_WRITE; | 2339 | direction = SBAL_SFLAGS0_TYPE_WRITE; |
2427 | break; | 2340 | break; |
2428 | case FSF_QTCB_UPLOAD_CONTROL_FILE: | 2341 | case FSF_QTCB_UPLOAD_CONTROL_FILE: |
2429 | direction = SBAL_FLAGS0_TYPE_READ; | 2342 | direction = SBAL_SFLAGS0_TYPE_READ; |
2430 | break; | 2343 | break; |
2431 | default: | 2344 | default: |
2432 | return ERR_PTR(-EINVAL); | 2345 | return ERR_PTR(-EINVAL); |
2433 | } | 2346 | } |
2434 | 2347 | ||
2435 | spin_lock_bh(&qdio->req_q_lock); | 2348 | spin_lock_irq(&qdio->req_q_lock); |
2436 | if (zfcp_qdio_sbal_get(qdio)) | 2349 | if (zfcp_qdio_sbal_get(qdio)) |
2437 | goto out; | 2350 | goto out; |
2438 | 2351 | ||
@@ -2459,7 +2372,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter, | |||
2459 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); | 2372 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); |
2460 | retval = zfcp_fsf_req_send(req); | 2373 | retval = zfcp_fsf_req_send(req); |
2461 | out: | 2374 | out: |
2462 | spin_unlock_bh(&qdio->req_q_lock); | 2375 | spin_unlock_irq(&qdio->req_q_lock); |
2463 | 2376 | ||
2464 | if (!retval) { | 2377 | if (!retval) { |
2465 | wait_for_completion(&req->completion); | 2378 | wait_for_completion(&req->completion); |
@@ -2501,7 +2414,16 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx) | |||
2501 | fsf_req->qdio_req.sbal_response = sbal_idx; | 2414 | fsf_req->qdio_req.sbal_response = sbal_idx; |
2502 | zfcp_fsf_req_complete(fsf_req); | 2415 | zfcp_fsf_req_complete(fsf_req); |
2503 | 2416 | ||
2504 | if (likely(sbale->flags & SBAL_FLAGS_LAST_ENTRY)) | 2417 | if (likely(sbale->eflags & SBAL_EFLAGS_LAST_ENTRY)) |
2505 | break; | 2418 | break; |
2506 | } | 2419 | } |
2507 | } | 2420 | } |
2421 | |||
2422 | struct zfcp_fsf_req *zfcp_fsf_get_req(struct zfcp_qdio *qdio, | ||
2423 | struct qdio_buffer *sbal) | ||
2424 | { | ||
2425 | struct qdio_buffer_element *sbale = &sbal->element[0]; | ||
2426 | u64 req_id = (unsigned long) sbale->addr; | ||
2427 | |||
2428 | return zfcp_reqlist_find(qdio->adapter->req_list, req_id); | ||
2429 | } | ||