aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_fsf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_fsf.c')
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c1557
1 files changed, 277 insertions, 1280 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index cc48a6462e6c..01ed5fb46c44 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -1,22 +1,9 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * Implementation of FSF commands.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#include "zfcp_ext.h" 9#include "zfcp_ext.h"
@@ -71,12 +58,58 @@ static const char zfcp_act_subtable_type[5][8] = {
71 "unknown", "OS", "WWPN", "DID", "LUN" 58 "unknown", "OS", "WWPN", "DID", "LUN"
72}; 59};
73 60
61static void zfcp_act_eval_err(struct zfcp_adapter *adapter, u32 table)
62{
63 u16 subtable = (table & 0xffff0000) >> 16;
64 u16 rule = table & 0xffff;
65
66 if (subtable > 0 &&
67 subtable < ARRAY_SIZE(zfcp_act_subtable_type)) {
68 dev_warn(&adapter->ccw_device->dev,
69 "Access denied in subtable %s, rule %d.\n",
70 zfcp_act_subtable_type[subtable], rule);
71 }
72}
73
74static void zfcp_fsf_access_denied_port(struct zfcp_fsf_req *req,
75 struct zfcp_port *port)
76{
77 struct fsf_qtcb_header *header = &req->qtcb->header;
78 dev_warn(&req->adapter->ccw_device->dev,
79 "Access denied, cannot send command to port 0x%016Lx.\n",
80 port->wwpn);
81 zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[0]);
82 zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[1]);
83 zfcp_erp_port_access_denied(port, 55, req);
84 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
85}
86
87static void zfcp_fsf_access_denied_unit(struct zfcp_fsf_req *req,
88 struct zfcp_unit *unit)
89{
90 struct fsf_qtcb_header *header = &req->qtcb->header;
91 dev_warn(&req->adapter->ccw_device->dev,
92 "Access denied for unit 0x%016Lx on port 0x%016Lx.\n",
93 unit->fcp_lun, unit->port->wwpn);
94 zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[0]);
95 zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[1]);
96 zfcp_erp_unit_access_denied(unit, 59, req);
97 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
98}
99
100static void zfcp_fsf_class_not_supp(struct zfcp_fsf_req *req)
101{
102 dev_err(&req->adapter->ccw_device->dev,
103 "Required FC class not supported by adapter, "
104 "shutting down adapter.\n");
105 zfcp_erp_adapter_shutdown(req->adapter, 0, 123, req);
106 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
107}
108
74/****************************************************************/ 109/****************************************************************/
75/*************** FSF related Functions *************************/ 110/*************** FSF related Functions *************************/
76/****************************************************************/ 111/****************************************************************/
77 112
78#define ZFCP_LOG_AREA ZFCP_LOG_AREA_FSF
79
80/* 113/*
81 * function: zfcp_fsf_req_alloc 114 * function: zfcp_fsf_req_alloc
82 * 115 *
@@ -200,7 +233,6 @@ zfcp_fsf_req_complete(struct zfcp_fsf_req *fsf_req)
200 int cleanup; 233 int cleanup;
201 234
202 if (unlikely(fsf_req->fsf_command == FSF_QTCB_UNSOLICITED_STATUS)) { 235 if (unlikely(fsf_req->fsf_command == FSF_QTCB_UNSOLICITED_STATUS)) {
203 ZFCP_LOG_DEBUG("Status read response received\n");
204 /* 236 /*
205 * Note: all cleanup handling is done in the callchain of 237 * Note: all cleanup handling is done in the callchain of
206 * the function call-chain below. 238 * the function call-chain below.
@@ -225,7 +257,6 @@ zfcp_fsf_req_complete(struct zfcp_fsf_req *fsf_req)
225 257
226 /* cleanup request if requested by initiator */ 258 /* cleanup request if requested by initiator */
227 if (likely(cleanup)) { 259 if (likely(cleanup)) {
228 ZFCP_LOG_TRACE("removing FSF request %p\n", fsf_req);
229 /* 260 /*
230 * lock must not be held here since it will be 261 * lock must not be held here since it will be
231 * grabed by the called routine, too 262 * grabed by the called routine, too
@@ -233,7 +264,6 @@ zfcp_fsf_req_complete(struct zfcp_fsf_req *fsf_req)
233 zfcp_fsf_req_free(fsf_req); 264 zfcp_fsf_req_free(fsf_req);
234 } else { 265 } else {
235 /* notify initiator waiting for the requests completion */ 266 /* notify initiator waiting for the requests completion */
236 ZFCP_LOG_TRACE("waking initiator of FSF request %p\n",fsf_req);
237 /* 267 /*
238 * FIXME: Race! We must not access fsf_req here as it might have been 268 * FIXME: Race! We must not access fsf_req here as it might have been
239 * cleaned up already due to the set ZFCP_STATUS_FSFREQ_COMPLETED 269 * cleaned up already due to the set ZFCP_STATUS_FSFREQ_COMPLETED
@@ -276,8 +306,6 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
276 zfcp_hba_dbf_event_fsf_response(fsf_req); 306 zfcp_hba_dbf_event_fsf_response(fsf_req);
277 307
278 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { 308 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) {
279 ZFCP_LOG_DEBUG("fsf_req 0x%lx has been dismissed\n",
280 (unsigned long) fsf_req);
281 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 309 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
282 ZFCP_STATUS_FSFREQ_RETRY; /* only for SCSI cmnds. */ 310 ZFCP_STATUS_FSFREQ_RETRY; /* only for SCSI cmnds. */
283 goto skip_protstatus; 311 goto skip_protstatus;
@@ -291,34 +319,26 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
291 break; 319 break;
292 320
293 case FSF_PROT_QTCB_VERSION_ERROR: 321 case FSF_PROT_QTCB_VERSION_ERROR:
294 ZFCP_LOG_NORMAL("error: The adapter %s contains " 322 dev_err(&adapter->ccw_device->dev,
295 "microcode of version 0x%x, the device driver " 323 "The QTCB version requested by zfcp (0x%x) is not "
296 "only supports 0x%x. Aborting.\n", 324 "supported by the FCP adapter (lowest supported 0x%x, "
297 zfcp_get_busid_by_adapter(adapter), 325 "highest supported 0x%x).\n",
298 prot_status_qual->version_error.fsf_version, 326 ZFCP_QTCB_VERSION, prot_status_qual->word[0],
299 ZFCP_QTCB_VERSION); 327 prot_status_qual->word[1]);
300 zfcp_erp_adapter_shutdown(adapter, 0, 117, fsf_req); 328 zfcp_erp_adapter_shutdown(adapter, 0, 117, fsf_req);
301 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 329 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
302 break; 330 break;
303 331
304 case FSF_PROT_SEQ_NUMB_ERROR: 332 case FSF_PROT_SEQ_NUMB_ERROR:
305 ZFCP_LOG_NORMAL("bug: Sequence number mismatch between "
306 "driver (0x%x) and adapter %s (0x%x). "
307 "Restarting all operations on this adapter.\n",
308 qtcb->prefix.req_seq_no,
309 zfcp_get_busid_by_adapter(adapter),
310 prot_status_qual->sequence_error.exp_req_seq_no);
311 zfcp_erp_adapter_reopen(adapter, 0, 98, fsf_req); 333 zfcp_erp_adapter_reopen(adapter, 0, 98, fsf_req);
312 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; 334 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY;
313 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 335 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
314 break; 336 break;
315 337
316 case FSF_PROT_UNSUPP_QTCB_TYPE: 338 case FSF_PROT_UNSUPP_QTCB_TYPE:
317 ZFCP_LOG_NORMAL("error: Packet header type used by the " 339 dev_err(&adapter->ccw_device->dev,
318 "device driver is incompatible with " 340 "Packet header type used by the device driver is "
319 "that used on adapter %s. " 341 "incompatible with that used on the adapter.\n");
320 "Stopping all operations on this adapter.\n",
321 zfcp_get_busid_by_adapter(adapter));
322 zfcp_erp_adapter_shutdown(adapter, 0, 118, fsf_req); 342 zfcp_erp_adapter_shutdown(adapter, 0, 118, fsf_req);
323 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 343 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
324 break; 344 break;
@@ -330,12 +350,9 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
330 break; 350 break;
331 351
332 case FSF_PROT_DUPLICATE_REQUEST_ID: 352 case FSF_PROT_DUPLICATE_REQUEST_ID:
333 ZFCP_LOG_NORMAL("bug: The request identifier 0x%Lx " 353 dev_err(&adapter->ccw_device->dev,
334 "to the adapter %s is ambiguous. " 354 "The request identifier 0x%Lx is ambiguous.\n",
335 "Stopping all operations on this adapter.\n", 355 (unsigned long long)qtcb->bottom.support.req_handle);
336 *(unsigned long long*)
337 (&qtcb->bottom.support.req_handle),
338 zfcp_get_busid_by_adapter(adapter));
339 zfcp_erp_adapter_shutdown(adapter, 0, 78, fsf_req); 356 zfcp_erp_adapter_shutdown(adapter, 0, 78, fsf_req);
340 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 357 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
341 break; 358 break;
@@ -349,10 +366,6 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
349 break; 366 break;
350 367
351 case FSF_PROT_REEST_QUEUE: 368 case FSF_PROT_REEST_QUEUE:
352 ZFCP_LOG_NORMAL("The local link to adapter with "
353 "%s was re-plugged. "
354 "Re-starting operations on this adapter.\n",
355 zfcp_get_busid_by_adapter(adapter));
356 /* All ports should be marked as ready to run again */ 369 /* All ports should be marked as ready to run again */
357 zfcp_erp_modify_adapter_status(adapter, 28, NULL, 370 zfcp_erp_modify_adapter_status(adapter, 28, NULL,
358 ZFCP_STATUS_COMMON_RUNNING, 371 ZFCP_STATUS_COMMON_RUNNING,
@@ -365,24 +378,17 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
365 break; 378 break;
366 379
367 case FSF_PROT_ERROR_STATE: 380 case FSF_PROT_ERROR_STATE:
368 ZFCP_LOG_NORMAL("error: The adapter %s "
369 "has entered the error state. "
370 "Restarting all operations on this "
371 "adapter.\n",
372 zfcp_get_busid_by_adapter(adapter));
373 zfcp_erp_adapter_reopen(adapter, 0, 100, fsf_req); 381 zfcp_erp_adapter_reopen(adapter, 0, 100, fsf_req);
374 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; 382 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY;
375 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 383 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
376 break; 384 break;
377 385
378 default: 386 default:
379 ZFCP_LOG_NORMAL("bug: Transfer protocol status information " 387 dev_err(&adapter->ccw_device->dev,
380 "provided by the adapter %s " 388 "Transfer protocol status information"
381 "is not compatible with the device driver. " 389 "provided by the adapter (0x%x) "
382 "Stopping all operations on this adapter. " 390 "is not compatible with the device driver.\n",
383 "(debug info 0x%x).\n", 391 qtcb->prefix.prot_status);
384 zfcp_get_busid_by_adapter(adapter),
385 qtcb->prefix.prot_status);
386 zfcp_erp_adapter_shutdown(adapter, 0, 119, fsf_req); 392 zfcp_erp_adapter_shutdown(adapter, 0, 119, fsf_req);
387 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 393 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
388 } 394 }
@@ -416,21 +422,14 @@ zfcp_fsf_fsfstatus_eval(struct zfcp_fsf_req *fsf_req)
416 /* evaluate FSF Status */ 422 /* evaluate FSF Status */
417 switch (fsf_req->qtcb->header.fsf_status) { 423 switch (fsf_req->qtcb->header.fsf_status) {
418 case FSF_UNKNOWN_COMMAND: 424 case FSF_UNKNOWN_COMMAND:
419 ZFCP_LOG_NORMAL("bug: Command issued by the device driver is " 425 dev_err(&fsf_req->adapter->ccw_device->dev,
420 "not known by the adapter %s " 426 "Command issued by the device driver (0x%x) is "
421 "Stopping all operations on this adapter. " 427 "not known by the adapter.\n",
422 "(debug info 0x%x).\n", 428 fsf_req->qtcb->header.fsf_command);
423 zfcp_get_busid_by_adapter(fsf_req->adapter),
424 fsf_req->qtcb->header.fsf_command);
425 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 120, fsf_req); 429 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 120, fsf_req);
426 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 430 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
427 break; 431 break;
428 432
429 case FSF_FCP_RSP_AVAILABLE:
430 ZFCP_LOG_DEBUG("FCP Sense data will be presented to the "
431 "SCSI stack.\n");
432 break;
433
434 case FSF_ADAPTER_STATUS_AVAILABLE: 433 case FSF_ADAPTER_STATUS_AVAILABLE:
435 zfcp_fsf_fsfstatus_qual_eval(fsf_req); 434 zfcp_fsf_fsfstatus_qual_eval(fsf_req);
436 break; 435 break;
@@ -472,17 +471,13 @@ zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *fsf_req)
472 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 471 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
473 break; 472 break;
474 case FSF_SQ_NO_RECOM: 473 case FSF_SQ_NO_RECOM:
475 ZFCP_LOG_NORMAL("bug: No recommendation could be given for a " 474 dev_err(&fsf_req->adapter->ccw_device->dev,
476 "problem on the adapter %s " 475 "No recommendation could be given for a "
477 "Stopping all operations on this adapter. ", 476 "problem on the adapter.\n");
478 zfcp_get_busid_by_adapter(fsf_req->adapter));
479 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 121, fsf_req); 477 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 121, fsf_req);
480 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 478 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
481 break; 479 break;
482 case FSF_SQ_ULP_PROGRAMMING_ERROR: 480 case FSF_SQ_ULP_PROGRAMMING_ERROR:
483 ZFCP_LOG_NORMAL("error: not enough SBALs for data transfer "
484 "(adapter %s)\n",
485 zfcp_get_busid_by_adapter(fsf_req->adapter));
486 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 481 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
487 break; 482 break;
488 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: 483 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE:
@@ -491,11 +486,6 @@ zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *fsf_req)
491 /* dealt with in the respective functions */ 486 /* dealt with in the respective functions */
492 break; 487 break;
493 default: 488 default:
494 ZFCP_LOG_NORMAL("bug: Additional status info could "
495 "not be interpreted properly.\n");
496 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
497 (char *) &fsf_req->qtcb->header.fsf_status_qual,
498 sizeof (union fsf_status_qual));
499 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 489 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
500 break; 490 break;
501 } 491 }
@@ -523,84 +513,67 @@ zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *fsf_req, u8 id,
523 513
524 switch (link_down->error_code) { 514 switch (link_down->error_code) {
525 case FSF_PSQ_LINK_NO_LIGHT: 515 case FSF_PSQ_LINK_NO_LIGHT:
526 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 516 dev_warn(&fsf_req->adapter->ccw_device->dev,
527 "(no light detected)\n", 517 "The local link is down: "
528 zfcp_get_busid_by_adapter(adapter)); 518 "no light detected.\n");
529 break; 519 break;
530 case FSF_PSQ_LINK_WRAP_PLUG: 520 case FSF_PSQ_LINK_WRAP_PLUG:
531 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 521 dev_warn(&fsf_req->adapter->ccw_device->dev,
532 "(wrap plug detected)\n", 522 "The local link is down: "
533 zfcp_get_busid_by_adapter(adapter)); 523 "wrap plug detected.\n");
534 break; 524 break;
535 case FSF_PSQ_LINK_NO_FCP: 525 case FSF_PSQ_LINK_NO_FCP:
536 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 526 dev_warn(&fsf_req->adapter->ccw_device->dev,
537 "(adjacent node on link does not support FCP)\n", 527 "The local link is down: "
538 zfcp_get_busid_by_adapter(adapter)); 528 "adjacent node on link does not support FCP.\n");
539 break; 529 break;
540 case FSF_PSQ_LINK_FIRMWARE_UPDATE: 530 case FSF_PSQ_LINK_FIRMWARE_UPDATE:
541 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 531 dev_warn(&fsf_req->adapter->ccw_device->dev,
542 "(firmware update in progress)\n", 532 "The local link is down: "
543 zfcp_get_busid_by_adapter(adapter)); 533 "firmware update in progress.\n");
544 break; 534 break;
545 case FSF_PSQ_LINK_INVALID_WWPN: 535 case FSF_PSQ_LINK_INVALID_WWPN:
546 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 536 dev_warn(&fsf_req->adapter->ccw_device->dev,
547 "(duplicate or invalid WWPN detected)\n", 537 "The local link is down: "
548 zfcp_get_busid_by_adapter(adapter)); 538 "duplicate or invalid WWPN detected.\n");
549 break; 539 break;
550 case FSF_PSQ_LINK_NO_NPIV_SUPPORT: 540 case FSF_PSQ_LINK_NO_NPIV_SUPPORT:
551 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 541 dev_warn(&fsf_req->adapter->ccw_device->dev,
552 "(no support for NPIV by Fabric)\n", 542 "The local link is down: "
553 zfcp_get_busid_by_adapter(adapter)); 543 "no support for NPIV by Fabric.\n");
554 break; 544 break;
555 case FSF_PSQ_LINK_NO_FCP_RESOURCES: 545 case FSF_PSQ_LINK_NO_FCP_RESOURCES:
556 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 546 dev_warn(&fsf_req->adapter->ccw_device->dev,
557 "(out of resource in FCP daughtercard)\n", 547 "The local link is down: "
558 zfcp_get_busid_by_adapter(adapter)); 548 "out of resource in FCP daughtercard.\n");
559 break; 549 break;
560 case FSF_PSQ_LINK_NO_FABRIC_RESOURCES: 550 case FSF_PSQ_LINK_NO_FABRIC_RESOURCES:
561 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 551 dev_warn(&fsf_req->adapter->ccw_device->dev,
562 "(out of resource in Fabric)\n", 552 "The local link is down: "
563 zfcp_get_busid_by_adapter(adapter)); 553 "out of resource in Fabric.\n");
564 break; 554 break;
565 case FSF_PSQ_LINK_FABRIC_LOGIN_UNABLE: 555 case FSF_PSQ_LINK_FABRIC_LOGIN_UNABLE:
566 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 556 dev_warn(&fsf_req->adapter->ccw_device->dev,
567 "(unable to Fabric login)\n", 557 "The local link is down: "
568 zfcp_get_busid_by_adapter(adapter)); 558 "unable to login to Fabric.\n");
569 break; 559 break;
570 case FSF_PSQ_LINK_WWPN_ASSIGNMENT_CORRUPTED: 560 case FSF_PSQ_LINK_WWPN_ASSIGNMENT_CORRUPTED:
571 ZFCP_LOG_NORMAL("WWPN assignment file corrupted on adapter %s\n", 561 dev_warn(&fsf_req->adapter->ccw_device->dev,
572 zfcp_get_busid_by_adapter(adapter)); 562 "WWPN assignment file corrupted on adapter.\n");
573 break; 563 break;
574 case FSF_PSQ_LINK_MODE_TABLE_CURRUPTED: 564 case FSF_PSQ_LINK_MODE_TABLE_CURRUPTED:
575 ZFCP_LOG_NORMAL("Mode table corrupted on adapter %s\n", 565 dev_warn(&fsf_req->adapter->ccw_device->dev,
576 zfcp_get_busid_by_adapter(adapter)); 566 "Mode table corrupted on adapter.\n");
577 break; 567 break;
578 case FSF_PSQ_LINK_NO_WWPN_ASSIGNMENT: 568 case FSF_PSQ_LINK_NO_WWPN_ASSIGNMENT:
579 ZFCP_LOG_NORMAL("No WWPN for assignment table on adapter %s\n", 569 dev_warn(&fsf_req->adapter->ccw_device->dev,
580 zfcp_get_busid_by_adapter(adapter)); 570 "No WWPN for assignment table on adapter.\n");
581 break; 571 break;
582 default: 572 default:
583 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 573 dev_warn(&fsf_req->adapter->ccw_device->dev,
584 "(warning: unknown reason code %d)\n", 574 "The local link to adapter is down.\n");
585 zfcp_get_busid_by_adapter(adapter),
586 link_down->error_code);
587 } 575 }
588 576
589 if (adapter->connection_features & FSF_FEATURE_NPIV_MODE)
590 ZFCP_LOG_DEBUG("Debug information to link down: "
591 "primary_status=0x%02x "
592 "ioerr_code=0x%02x "
593 "action_code=0x%02x "
594 "reason_code=0x%02x "
595 "explanation_code=0x%02x "
596 "vendor_specific_code=0x%02x\n",
597 link_down->primary_status,
598 link_down->ioerr_code,
599 link_down->action_code,
600 link_down->reason_code,
601 link_down->explanation_code,
602 link_down->vendor_specific_code);
603
604 out: 577 out:
605 zfcp_erp_adapter_failed(adapter, id, fsf_req); 578 zfcp_erp_adapter_failed(adapter, id, fsf_req);
606} 579}
@@ -616,7 +589,6 @@ static int
616zfcp_fsf_req_dispatch(struct zfcp_fsf_req *fsf_req) 589zfcp_fsf_req_dispatch(struct zfcp_fsf_req *fsf_req)
617{ 590{
618 struct zfcp_erp_action *erp_action = fsf_req->erp_action; 591 struct zfcp_erp_action *erp_action = fsf_req->erp_action;
619 struct zfcp_adapter *adapter = fsf_req->adapter;
620 int retval = 0; 592 int retval = 0;
621 593
622 594
@@ -673,20 +645,6 @@ zfcp_fsf_req_dispatch(struct zfcp_fsf_req *fsf_req)
673 case FSF_QTCB_UPLOAD_CONTROL_FILE: 645 case FSF_QTCB_UPLOAD_CONTROL_FILE:
674 zfcp_fsf_control_file_handler(fsf_req); 646 zfcp_fsf_control_file_handler(fsf_req);
675 break; 647 break;
676
677 default:
678 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
679 ZFCP_LOG_NORMAL("bug: Command issued by the device driver is "
680 "not supported by the adapter %s\n",
681 zfcp_get_busid_by_adapter(adapter));
682 if (fsf_req->fsf_command != fsf_req->qtcb->header.fsf_command)
683 ZFCP_LOG_NORMAL
684 ("bug: Command issued by the device driver differs "
685 "from the command returned by the adapter %s "
686 "(debug info 0x%x, 0x%x).\n",
687 zfcp_get_busid_by_adapter(adapter),
688 fsf_req->fsf_command,
689 fsf_req->qtcb->header.fsf_command);
690 } 648 }
691 649
692 if (!erp_action) 650 if (!erp_action)
@@ -718,12 +676,8 @@ zfcp_fsf_status_read(struct zfcp_adapter *adapter, int req_flags)
718 req_flags | ZFCP_REQ_NO_QTCB, 676 req_flags | ZFCP_REQ_NO_QTCB,
719 adapter->pool.fsf_req_status_read, 677 adapter->pool.fsf_req_status_read,
720 &lock_flags, &fsf_req); 678 &lock_flags, &fsf_req);
721 if (retval < 0) { 679 if (retval < 0)
722 ZFCP_LOG_INFO("error: Could not create unsolicited status "
723 "buffer for adapter %s.\n",
724 zfcp_get_busid_by_adapter(adapter));
725 goto failed_req_create; 680 goto failed_req_create;
726 }
727 681
728 sbale = zfcp_qdio_sbale_req(fsf_req); 682 sbale = zfcp_qdio_sbale_req(fsf_req);
729 sbale[0].flags |= SBAL_FLAGS0_TYPE_STATUS; 683 sbale[0].flags |= SBAL_FLAGS0_TYPE_STATUS;
@@ -744,14 +698,9 @@ zfcp_fsf_status_read(struct zfcp_adapter *adapter, int req_flags)
744 sbale->length = sizeof(struct fsf_status_read_buffer); 698 sbale->length = sizeof(struct fsf_status_read_buffer);
745 699
746 retval = zfcp_fsf_req_send(fsf_req); 700 retval = zfcp_fsf_req_send(fsf_req);
747 if (retval) { 701 if (retval)
748 ZFCP_LOG_DEBUG("error: Could not set-up unsolicited status "
749 "environment.\n");
750 goto failed_req_send; 702 goto failed_req_send;
751 }
752 703
753 ZFCP_LOG_TRACE("Status Read request initiated (adapter%s)\n",
754 zfcp_get_busid_by_adapter(adapter));
755 goto out; 704 goto out;
756 705
757 failed_req_send: 706 failed_req_send:
@@ -783,14 +732,8 @@ zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *fsf_req)
783 break; 732 break;
784 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 733 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
785 734
786 if (!port || (port->d_id != (status_buffer->d_id & ZFCP_DID_MASK))) { 735 if (!port || (port->d_id != (status_buffer->d_id & ZFCP_DID_MASK)))
787 ZFCP_LOG_NORMAL("bug: Reopen port indication received for "
788 "nonexisting port with d_id 0x%06x on "
789 "adapter %s. Ignored.\n",
790 status_buffer->d_id & ZFCP_DID_MASK,
791 zfcp_get_busid_by_adapter(adapter));
792 goto out; 736 goto out;
793 }
794 737
795 switch (status_buffer->status_subtype) { 738 switch (status_buffer->status_subtype) {
796 739
@@ -801,20 +744,48 @@ zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *fsf_req)
801 case FSF_STATUS_READ_SUB_ERROR_PORT: 744 case FSF_STATUS_READ_SUB_ERROR_PORT:
802 zfcp_erp_port_shutdown(port, 0, 122, fsf_req); 745 zfcp_erp_port_shutdown(port, 0, 122, fsf_req);
803 break; 746 break;
804
805 default:
806 ZFCP_LOG_NORMAL("bug: Undefined status subtype received "
807 "for a reopen indication on port with "
808 "d_id 0x%06x on the adapter %s. "
809 "Ignored. (debug info 0x%x)\n",
810 status_buffer->d_id,
811 zfcp_get_busid_by_adapter(adapter),
812 status_buffer->status_subtype);
813 } 747 }
814 out: 748 out:
815 return 0; 749 return 0;
816} 750}
817 751
752static void zfcp_fsf_bit_error_threshold(struct zfcp_fsf_req *req)
753{
754 struct zfcp_adapter *adapter = req->adapter;
755 struct fsf_status_read_buffer *buf =
756 (struct fsf_status_read_buffer *) req->data;
757 struct fsf_bit_error_payload *err =
758 (struct fsf_bit_error_payload *) buf->payload;
759 dev_warn(&adapter->ccw_device->dev,
760 "Warning: bit error threshold data "
761 "received for the adapter: "
762 "link failures = %i, loss of sync errors = %i, "
763 "loss of signal errors = %i, "
764 "primitive sequence errors = %i, "
765 "invalid transmission word errors = %i, "
766 "CRC errors = %i).\n",
767 err->link_failure_error_count,
768 err->loss_of_sync_error_count,
769 err->loss_of_signal_error_count,
770 err->primitive_sequence_error_count,
771 err->invalid_transmission_word_error_count,
772 err->crc_error_count);
773 dev_warn(&adapter->ccw_device->dev,
774 "Additional bit error threshold data of the adapter: "
775 "primitive sequence event time-outs = %i, "
776 "elastic buffer overrun errors = %i, "
777 "advertised receive buffer-to-buffer credit = %i, "
778 "current receice buffer-to-buffer credit = %i, "
779 "advertised transmit buffer-to-buffer credit = %i, "
780 "current transmit buffer-to-buffer credit = %i).\n",
781 err->primitive_sequence_event_timeout_count,
782 err->elastic_buffer_overrun_error_count,
783 err->advertised_receive_b2b_credit,
784 err->current_receive_b2b_credit,
785 err->advertised_transmit_b2b_credit,
786 err->current_transmit_b2b_credit);
787}
788
818/* 789/*
819 * function: zfcp_fsf_status_read_handler 790 * function: zfcp_fsf_status_read_handler
820 * 791 *
@@ -829,7 +800,6 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
829 struct zfcp_adapter *adapter = fsf_req->adapter; 800 struct zfcp_adapter *adapter = fsf_req->adapter;
830 struct fsf_status_read_buffer *status_buffer = 801 struct fsf_status_read_buffer *status_buffer =
831 (struct fsf_status_read_buffer *) fsf_req->data; 802 (struct fsf_status_read_buffer *) fsf_req->data;
832 struct fsf_bit_error_payload *fsf_bit_error;
833 803
834 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { 804 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) {
835 zfcp_hba_dbf_event_fsf_unsol("dism", adapter, status_buffer); 805 zfcp_hba_dbf_event_fsf_unsol("dism", adapter, status_buffer);
@@ -851,79 +821,45 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
851 break; 821 break;
852 822
853 case FSF_STATUS_READ_SENSE_DATA_AVAIL: 823 case FSF_STATUS_READ_SENSE_DATA_AVAIL:
854 ZFCP_LOG_INFO("unsolicited sense data received (adapter %s)\n",
855 zfcp_get_busid_by_adapter(adapter));
856 break; 824 break;
857 825
858 case FSF_STATUS_READ_BIT_ERROR_THRESHOLD: 826 case FSF_STATUS_READ_BIT_ERROR_THRESHOLD:
859 fsf_bit_error = (struct fsf_bit_error_payload *) 827 zfcp_fsf_bit_error_threshold(fsf_req);
860 status_buffer->payload;
861 ZFCP_LOG_NORMAL("Warning: bit error threshold data "
862 "received (adapter %s, "
863 "link failures = %i, loss of sync errors = %i, "
864 "loss of signal errors = %i, "
865 "primitive sequence errors = %i, "
866 "invalid transmission word errors = %i, "
867 "CRC errors = %i)\n",
868 zfcp_get_busid_by_adapter(adapter),
869 fsf_bit_error->link_failure_error_count,
870 fsf_bit_error->loss_of_sync_error_count,
871 fsf_bit_error->loss_of_signal_error_count,
872 fsf_bit_error->primitive_sequence_error_count,
873 fsf_bit_error->invalid_transmission_word_error_count,
874 fsf_bit_error->crc_error_count);
875 ZFCP_LOG_INFO("Additional bit error threshold data "
876 "(adapter %s, "
877 "primitive sequence event time-outs = %i, "
878 "elastic buffer overrun errors = %i, "
879 "advertised receive buffer-to-buffer credit = %i, "
880 "current receice buffer-to-buffer credit = %i, "
881 "advertised transmit buffer-to-buffer credit = %i, "
882 "current transmit buffer-to-buffer credit = %i)\n",
883 zfcp_get_busid_by_adapter(adapter),
884 fsf_bit_error->primitive_sequence_event_timeout_count,
885 fsf_bit_error->elastic_buffer_overrun_error_count,
886 fsf_bit_error->advertised_receive_b2b_credit,
887 fsf_bit_error->current_receive_b2b_credit,
888 fsf_bit_error->advertised_transmit_b2b_credit,
889 fsf_bit_error->current_transmit_b2b_credit);
890 break; 828 break;
891 829
892 case FSF_STATUS_READ_LINK_DOWN: 830 case FSF_STATUS_READ_LINK_DOWN:
893 switch (status_buffer->status_subtype) { 831 switch (status_buffer->status_subtype) {
894 case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: 832 case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK:
895 ZFCP_LOG_INFO("Physical link to adapter %s is down\n", 833 dev_warn(&adapter->ccw_device->dev,
896 zfcp_get_busid_by_adapter(adapter)); 834 "Physical link is down.\n");
897 zfcp_fsf_link_down_info_eval(fsf_req, 38, 835 zfcp_fsf_link_down_info_eval(fsf_req, 38,
898 (struct fsf_link_down_info *) 836 (struct fsf_link_down_info *)
899 &status_buffer->payload); 837 &status_buffer->payload);
900 break; 838 break;
901 case FSF_STATUS_READ_SUB_FDISC_FAILED: 839 case FSF_STATUS_READ_SUB_FDISC_FAILED:
902 ZFCP_LOG_INFO("Local link to adapter %s is down " 840 dev_warn(&adapter->ccw_device->dev,
903 "due to failed FDISC login\n", 841 "Local link is down "
904 zfcp_get_busid_by_adapter(adapter)); 842 "due to failed FDISC login.\n");
905 zfcp_fsf_link_down_info_eval(fsf_req, 39, 843 zfcp_fsf_link_down_info_eval(fsf_req, 39,
906 (struct fsf_link_down_info *) 844 (struct fsf_link_down_info *)
907 &status_buffer->payload); 845 &status_buffer->payload);
908 break; 846 break;
909 case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE: 847 case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE:
910 ZFCP_LOG_INFO("Local link to adapter %s is down " 848 dev_warn(&adapter->ccw_device->dev,
911 "due to firmware update on adapter\n", 849 "Local link is down "
912 zfcp_get_busid_by_adapter(adapter)); 850 "due to firmware update on adapter.\n");
913 zfcp_fsf_link_down_info_eval(fsf_req, 40, NULL); 851 zfcp_fsf_link_down_info_eval(fsf_req, 40, NULL);
914 break; 852 break;
915 default: 853 default:
916 ZFCP_LOG_INFO("Local link to adapter %s is down " 854 dev_warn(&adapter->ccw_device->dev,
917 "due to unknown reason\n", 855 "Local link is down.\n");
918 zfcp_get_busid_by_adapter(adapter));
919 zfcp_fsf_link_down_info_eval(fsf_req, 41, NULL); 856 zfcp_fsf_link_down_info_eval(fsf_req, 41, NULL);
920 }; 857 };
921 break; 858 break;
922 859
923 case FSF_STATUS_READ_LINK_UP: 860 case FSF_STATUS_READ_LINK_UP:
924 ZFCP_LOG_NORMAL("Local link to adapter %s was replugged. " 861 dev_info(&adapter->ccw_device->dev,
925 "Restarting operations on this adapter\n", 862 "Local link was replugged.\n");
926 zfcp_get_busid_by_adapter(adapter));
927 /* All ports should be marked as ready to run again */ 863 /* All ports should be marked as ready to run again */
928 zfcp_erp_modify_adapter_status(adapter, 30, NULL, 864 zfcp_erp_modify_adapter_status(adapter, 30, NULL,
929 ZFCP_STATUS_COMMON_RUNNING, 865 ZFCP_STATUS_COMMON_RUNNING,
@@ -935,81 +871,18 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
935 break; 871 break;
936 872
937 case FSF_STATUS_READ_NOTIFICATION_LOST: 873 case FSF_STATUS_READ_NOTIFICATION_LOST:
938 ZFCP_LOG_NORMAL("Unsolicited status notification(s) lost: "
939 "adapter %s%s%s%s%s%s%s%s%s\n",
940 zfcp_get_busid_by_adapter(adapter),
941 (status_buffer->status_subtype &
942 FSF_STATUS_READ_SUB_INCOMING_ELS) ?
943 ", incoming ELS" : "",
944 (status_buffer->status_subtype &
945 FSF_STATUS_READ_SUB_SENSE_DATA) ?
946 ", sense data" : "",
947 (status_buffer->status_subtype &
948 FSF_STATUS_READ_SUB_LINK_STATUS) ?
949 ", link status change" : "",
950 (status_buffer->status_subtype &
951 FSF_STATUS_READ_SUB_PORT_CLOSED) ?
952 ", port close" : "",
953 (status_buffer->status_subtype &
954 FSF_STATUS_READ_SUB_BIT_ERROR_THRESHOLD) ?
955 ", bit error exception" : "",
956 (status_buffer->status_subtype &
957 FSF_STATUS_READ_SUB_ACT_UPDATED) ?
958 ", ACT update" : "",
959 (status_buffer->status_subtype &
960 FSF_STATUS_READ_SUB_ACT_HARDENED) ?
961 ", ACT hardening" : "",
962 (status_buffer->status_subtype &
963 FSF_STATUS_READ_SUB_FEATURE_UPDATE_ALERT) ?
964 ", adapter feature change" : "");
965
966 if (status_buffer->status_subtype & 874 if (status_buffer->status_subtype &
967 FSF_STATUS_READ_SUB_ACT_UPDATED) 875 FSF_STATUS_READ_SUB_ACT_UPDATED)
968 zfcp_erp_adapter_access_changed(adapter, 135, fsf_req); 876 zfcp_erp_adapter_access_changed(adapter, 135, fsf_req);
969 break; 877 break;
970 878
971 case FSF_STATUS_READ_CFDC_UPDATED: 879 case FSF_STATUS_READ_CFDC_UPDATED:
972 ZFCP_LOG_NORMAL("CFDC has been updated on the adapter %s\n",
973 zfcp_get_busid_by_adapter(adapter));
974 zfcp_erp_adapter_access_changed(adapter, 136, fsf_req); 880 zfcp_erp_adapter_access_changed(adapter, 136, fsf_req);
975 break; 881 break;
976 882
977 case FSF_STATUS_READ_CFDC_HARDENED:
978 switch (status_buffer->status_subtype) {
979 case FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE:
980 ZFCP_LOG_NORMAL("CFDC of adapter %s saved on SE\n",
981 zfcp_get_busid_by_adapter(adapter));
982 break;
983 case FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE2:
984 ZFCP_LOG_NORMAL("CFDC of adapter %s has been copied "
985 "to the secondary SE\n",
986 zfcp_get_busid_by_adapter(adapter));
987 break;
988 default:
989 ZFCP_LOG_NORMAL("CFDC of adapter %s has been hardened\n",
990 zfcp_get_busid_by_adapter(adapter));
991 }
992 break;
993
994 case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: 883 case FSF_STATUS_READ_FEATURE_UPDATE_ALERT:
995 ZFCP_LOG_INFO("List of supported features on adapter %s has "
996 "been changed from 0x%08X to 0x%08X\n",
997 zfcp_get_busid_by_adapter(adapter),
998 *(u32*) (status_buffer->payload + 4),
999 *(u32*) (status_buffer->payload));
1000 adapter->adapter_features = *(u32*) status_buffer->payload; 884 adapter->adapter_features = *(u32*) status_buffer->payload;
1001 break; 885 break;
1002
1003 default:
1004 ZFCP_LOG_NORMAL("warning: An unsolicited status packet of unknown "
1005 "type was received (debug info 0x%x)\n",
1006 status_buffer->status_type);
1007 ZFCP_LOG_DEBUG("Dump of status_read_buffer %p:\n",
1008 status_buffer);
1009 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
1010 (char *) status_buffer,
1011 sizeof (struct fsf_status_read_buffer));
1012 break;
1013 } 886 }
1014 mempool_free(status_buffer, adapter->pool.data_status_read); 887 mempool_free(status_buffer, adapter->pool.data_status_read);
1015 zfcp_fsf_req_free(fsf_req); 888 zfcp_fsf_req_free(fsf_req);
@@ -1060,15 +933,8 @@ zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
1060 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND, 933 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND,
1061 req_flags, adapter->pool.fsf_req_abort, 934 req_flags, adapter->pool.fsf_req_abort,
1062 &lock_flags, &fsf_req); 935 &lock_flags, &fsf_req);
1063 if (retval < 0) { 936 if (retval < 0)
1064 ZFCP_LOG_INFO("error: Failed to create an abort command "
1065 "request for lun 0x%016Lx on port 0x%016Lx "
1066 "on adapter %s.\n",
1067 unit->fcp_lun,
1068 unit->port->wwpn,
1069 zfcp_get_busid_by_adapter(adapter));
1070 goto out; 937 goto out;
1071 }
1072 938
1073 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, 939 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
1074 &unit->status))) 940 &unit->status)))
@@ -1134,17 +1000,6 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1134 * fine. 1000 * fine.
1135 */ 1001 */
1136 } else { 1002 } else {
1137 ZFCP_LOG_INFO("Temporary port identifier 0x%x for "
1138 "port 0x%016Lx on adapter %s invalid. "
1139 "This may happen occasionally.\n",
1140 unit->port->handle,
1141 unit->port->wwpn,
1142 zfcp_get_busid_by_unit(unit));
1143 ZFCP_LOG_INFO("status qualifier:\n");
1144 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO,
1145 (char *) &new_fsf_req->qtcb->header.
1146 fsf_status_qual,
1147 sizeof (union fsf_status_qual));
1148 /* Let's hope this sorts out the mess */ 1003 /* Let's hope this sorts out the mess */
1149 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 104, 1004 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 104,
1150 new_fsf_req); 1005 new_fsf_req);
@@ -1160,20 +1015,6 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1160 * This is fine. 1015 * This is fine.
1161 */ 1016 */
1162 } else { 1017 } else {
1163 ZFCP_LOG_INFO
1164 ("Warning: Temporary LUN identifier 0x%x of LUN "
1165 "0x%016Lx on port 0x%016Lx on adapter %s is "
1166 "invalid. This may happen in rare cases. "
1167 "Trying to re-establish link.\n",
1168 unit->handle,
1169 unit->fcp_lun,
1170 unit->port->wwpn,
1171 zfcp_get_busid_by_unit(unit));
1172 ZFCP_LOG_DEBUG("Status qualifier data:\n");
1173 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
1174 (char *) &new_fsf_req->qtcb->header.
1175 fsf_status_qual,
1176 sizeof (union fsf_status_qual));
1177 /* Let's hope this sorts out the mess */ 1018 /* Let's hope this sorts out the mess */
1178 zfcp_erp_port_reopen(unit->port, 0, 105, new_fsf_req); 1019 zfcp_erp_port_reopen(unit->port, 0, 105, new_fsf_req);
1179 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1020 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
@@ -1186,20 +1027,12 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1186 break; 1027 break;
1187 1028
1188 case FSF_PORT_BOXED: 1029 case FSF_PORT_BOXED:
1189 ZFCP_LOG_INFO("Remote port 0x%016Lx on adapter %s needs to "
1190 "be reopened\n", unit->port->wwpn,
1191 zfcp_get_busid_by_unit(unit));
1192 zfcp_erp_port_boxed(unit->port, 47, new_fsf_req); 1030 zfcp_erp_port_boxed(unit->port, 47, new_fsf_req);
1193 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 1031 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR
1194 | ZFCP_STATUS_FSFREQ_RETRY; 1032 | ZFCP_STATUS_FSFREQ_RETRY;
1195 break; 1033 break;
1196 1034
1197 case FSF_LUN_BOXED: 1035 case FSF_LUN_BOXED:
1198 ZFCP_LOG_INFO(
1199 "unit 0x%016Lx on port 0x%016Lx on adapter %s needs "
1200 "to be reopened\n",
1201 unit->fcp_lun, unit->port->wwpn,
1202 zfcp_get_busid_by_unit(unit));
1203 zfcp_erp_unit_boxed(unit, 48, new_fsf_req); 1036 zfcp_erp_unit_boxed(unit, 48, new_fsf_req);
1204 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 1037 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR
1205 | ZFCP_STATUS_FSFREQ_RETRY; 1038 | ZFCP_STATUS_FSFREQ_RETRY;
@@ -1215,11 +1048,6 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1215 /* SCSI stack will escalate */ 1048 /* SCSI stack will escalate */
1216 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1049 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1217 break; 1050 break;
1218 default:
1219 ZFCP_LOG_NORMAL
1220 ("bug: Wrong status qualifier 0x%x arrived.\n",
1221 new_fsf_req->qtcb->header.fsf_status_qual.word[0]);
1222 break;
1223 } 1051 }
1224 break; 1052 break;
1225 1053
@@ -1227,12 +1055,6 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1227 retval = 0; 1055 retval = 0;
1228 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED; 1056 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED;
1229 break; 1057 break;
1230
1231 default:
1232 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
1233 "(debug info 0x%x)\n",
1234 new_fsf_req->qtcb->header.fsf_status);
1235 break;
1236 } 1058 }
1237 skip_fsfstatus: 1059 skip_fsfstatus:
1238 return retval; 1060 return retval;
@@ -1287,12 +1109,8 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1287 ret = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_GENERIC, 1109 ret = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_GENERIC,
1288 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 1110 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
1289 pool, &lock_flags, &fsf_req); 1111 pool, &lock_flags, &fsf_req);
1290 if (ret < 0) { 1112 if (ret < 0)
1291 ZFCP_LOG_INFO("error: Could not create CT request (FC-GS) for "
1292 "adapter: %s\n",
1293 zfcp_get_busid_by_adapter(adapter));
1294 goto failed_req; 1113 goto failed_req;
1295 }
1296 1114
1297 sbale = zfcp_qdio_sbale_req(fsf_req); 1115 sbale = zfcp_qdio_sbale_req(fsf_req);
1298 if (zfcp_use_one_sbal(ct->req, ct->req_count, 1116 if (zfcp_use_one_sbal(ct->req, ct->req_count,
@@ -1313,9 +1131,6 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1313 ct->req, 1131 ct->req,
1314 ZFCP_MAX_SBALS_PER_CT_REQ); 1132 ZFCP_MAX_SBALS_PER_CT_REQ);
1315 if (bytes <= 0) { 1133 if (bytes <= 0) {
1316 ZFCP_LOG_INFO("error: creation of CT request failed "
1317 "on adapter %s\n",
1318 zfcp_get_busid_by_adapter(adapter));
1319 if (bytes == 0) 1134 if (bytes == 0)
1320 ret = -ENOMEM; 1135 ret = -ENOMEM;
1321 else 1136 else
@@ -1330,9 +1145,6 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1330 ct->resp, 1145 ct->resp,
1331 ZFCP_MAX_SBALS_PER_CT_REQ); 1146 ZFCP_MAX_SBALS_PER_CT_REQ);
1332 if (bytes <= 0) { 1147 if (bytes <= 0) {
1333 ZFCP_LOG_INFO("error: creation of CT request failed "
1334 "on adapter %s\n",
1335 zfcp_get_busid_by_adapter(adapter));
1336 if (bytes == 0) 1148 if (bytes == 0)
1337 ret = -ENOMEM; 1149 ret = -ENOMEM;
1338 else 1150 else
@@ -1343,10 +1155,6 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1343 fsf_req->qtcb->bottom.support.resp_buf_length = bytes; 1155 fsf_req->qtcb->bottom.support.resp_buf_length = bytes;
1344 } else { 1156 } else {
1345 /* reject send generic request */ 1157 /* reject send generic request */
1346 ZFCP_LOG_INFO(
1347 "error: microcode does not support chained SBALs,"
1348 "CT request too big (adapter %s)\n",
1349 zfcp_get_busid_by_adapter(adapter));
1350 ret = -EOPNOTSUPP; 1158 ret = -EOPNOTSUPP;
1351 goto failed_send; 1159 goto failed_send;
1352 } 1160 }
@@ -1368,15 +1176,9 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1368 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT); 1176 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT);
1369 1177
1370 ret = zfcp_fsf_req_send(fsf_req); 1178 ret = zfcp_fsf_req_send(fsf_req);
1371 if (ret) { 1179 if (ret)
1372 ZFCP_LOG_DEBUG("error: initiation of CT request failed "
1373 "(adapter %s, port 0x%016Lx)\n",
1374 zfcp_get_busid_by_adapter(adapter), port->wwpn);
1375 goto failed_send; 1180 goto failed_send;
1376 }
1377 1181
1378 ZFCP_LOG_DEBUG("CT request initiated (adapter %s, port 0x%016Lx)\n",
1379 zfcp_get_busid_by_adapter(adapter), port->wwpn);
1380 goto out; 1182 goto out;
1381 1183
1382 failed_send: 1184 failed_send:
@@ -1408,7 +1210,6 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1408 struct fsf_qtcb_header *header; 1210 struct fsf_qtcb_header *header;
1409 struct fsf_qtcb_bottom_support *bottom; 1211 struct fsf_qtcb_bottom_support *bottom;
1410 int retval = -EINVAL; 1212 int retval = -EINVAL;
1411 u16 subtable, rule, counter;
1412 1213
1413 adapter = fsf_req->adapter; 1214 adapter = fsf_req->adapter;
1414 send_ct = (struct zfcp_send_ct *) fsf_req->data; 1215 send_ct = (struct zfcp_send_ct *) fsf_req->data;
@@ -1428,13 +1229,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1428 break; 1229 break;
1429 1230
1430 case FSF_SERVICE_CLASS_NOT_SUPPORTED: 1231 case FSF_SERVICE_CLASS_NOT_SUPPORTED:
1431 ZFCP_LOG_INFO("error: adapter %s does not support fc " 1232 zfcp_fsf_class_not_supp(fsf_req);
1432 "class %d.\n",
1433 zfcp_get_busid_by_port(port),
1434 ZFCP_FC_SERVICE_CLASS_DEFAULT);
1435 /* stop operation for this adapter */
1436 zfcp_erp_adapter_shutdown(adapter, 0, 123, fsf_req);
1437 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1438 break; 1233 break;
1439 1234
1440 case FSF_ADAPTER_STATUS_AVAILABLE: 1235 case FSF_ADAPTER_STATUS_AVAILABLE:
@@ -1448,63 +1243,23 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1448 /* ERP strategy will escalate */ 1243 /* ERP strategy will escalate */
1449 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1244 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1450 break; 1245 break;
1451 default:
1452 ZFCP_LOG_INFO("bug: Wrong status qualifier 0x%x "
1453 "arrived.\n",
1454 header->fsf_status_qual.word[0]);
1455 break;
1456 } 1246 }
1457 break; 1247 break;
1458 1248
1459 case FSF_ACCESS_DENIED: 1249 case FSF_ACCESS_DENIED:
1460 ZFCP_LOG_NORMAL("access denied, cannot send generic service " 1250 zfcp_fsf_access_denied_port(fsf_req, port);
1461 "command (adapter %s, port d_id=0x%06x)\n",
1462 zfcp_get_busid_by_port(port), port->d_id);
1463 for (counter = 0; counter < 2; counter++) {
1464 subtable = header->fsf_status_qual.halfword[counter * 2];
1465 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
1466 switch (subtable) {
1467 case FSF_SQ_CFDC_SUBTABLE_OS:
1468 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
1469 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
1470 case FSF_SQ_CFDC_SUBTABLE_LUN:
1471 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
1472 zfcp_act_subtable_type[subtable], rule);
1473 break;
1474 }
1475 }
1476 zfcp_erp_port_access_denied(port, 55, fsf_req);
1477 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1478 break; 1251 break;
1479 1252
1480 case FSF_GENERIC_COMMAND_REJECTED: 1253 case FSF_GENERIC_COMMAND_REJECTED:
1481 ZFCP_LOG_INFO("generic service command rejected "
1482 "(adapter %s, port d_id=0x%06x)\n",
1483 zfcp_get_busid_by_port(port), port->d_id);
1484 ZFCP_LOG_INFO("status qualifier:\n");
1485 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO,
1486 (char *) &header->fsf_status_qual,
1487 sizeof (union fsf_status_qual));
1488 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1254 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1489 break; 1255 break;
1490 1256
1491 case FSF_PORT_HANDLE_NOT_VALID: 1257 case FSF_PORT_HANDLE_NOT_VALID:
1492 ZFCP_LOG_DEBUG("Temporary port identifier 0x%x for port "
1493 "0x%016Lx on adapter %s invalid. This may "
1494 "happen occasionally.\n", port->handle,
1495 port->wwpn, zfcp_get_busid_by_port(port));
1496 ZFCP_LOG_INFO("status qualifier:\n");
1497 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO,
1498 (char *) &header->fsf_status_qual,
1499 sizeof (union fsf_status_qual));
1500 zfcp_erp_adapter_reopen(adapter, 0, 106, fsf_req); 1258 zfcp_erp_adapter_reopen(adapter, 0, 106, fsf_req);
1501 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1259 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1502 break; 1260 break;
1503 1261
1504 case FSF_PORT_BOXED: 1262 case FSF_PORT_BOXED:
1505 ZFCP_LOG_INFO("port needs to be reopened "
1506 "(adapter %s, port d_id=0x%06x)\n",
1507 zfcp_get_busid_by_port(port), port->d_id);
1508 zfcp_erp_port_boxed(port, 49, fsf_req); 1263 zfcp_erp_port_boxed(port, 49, fsf_req);
1509 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 1264 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR
1510 | ZFCP_STATUS_FSFREQ_RETRY; 1265 | ZFCP_STATUS_FSFREQ_RETRY;
@@ -1513,37 +1268,13 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1513 /* following states should never occure, all cases avoided 1268 /* following states should never occure, all cases avoided
1514 in zfcp_fsf_send_ct - but who knows ... */ 1269 in zfcp_fsf_send_ct - but who knows ... */
1515 case FSF_PAYLOAD_SIZE_MISMATCH: 1270 case FSF_PAYLOAD_SIZE_MISMATCH:
1516 ZFCP_LOG_INFO("payload size mismatch (adapter: %s, "
1517 "req_buf_length=%d, resp_buf_length=%d)\n",
1518 zfcp_get_busid_by_adapter(adapter),
1519 bottom->req_buf_length, bottom->resp_buf_length);
1520 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1521 break;
1522 case FSF_REQUEST_SIZE_TOO_LARGE: 1271 case FSF_REQUEST_SIZE_TOO_LARGE:
1523 ZFCP_LOG_INFO("request size too large (adapter: %s, "
1524 "req_buf_length=%d)\n",
1525 zfcp_get_busid_by_adapter(adapter),
1526 bottom->req_buf_length);
1527 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1528 break;
1529 case FSF_RESPONSE_SIZE_TOO_LARGE: 1272 case FSF_RESPONSE_SIZE_TOO_LARGE:
1530 ZFCP_LOG_INFO("response size too large (adapter: %s, "
1531 "resp_buf_length=%d)\n",
1532 zfcp_get_busid_by_adapter(adapter),
1533 bottom->resp_buf_length);
1534 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1535 break;
1536 case FSF_SBAL_MISMATCH: 1273 case FSF_SBAL_MISMATCH:
1537 ZFCP_LOG_INFO("SBAL mismatch (adapter: %s, req_buf_length=%d, "
1538 "resp_buf_length=%d)\n",
1539 zfcp_get_busid_by_adapter(adapter),
1540 bottom->req_buf_length, bottom->resp_buf_length);
1541 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1274 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1542 break; 1275 break;
1543 1276
1544 default: 1277 default:
1545 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
1546 "(debug info 0x%x)\n", header->fsf_status);
1547 break; 1278 break;
1548 } 1279 }
1549 1280
@@ -1578,12 +1309,8 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1578 ret = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS, 1309 ret = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS,
1579 ZFCP_REQ_AUTO_CLEANUP, 1310 ZFCP_REQ_AUTO_CLEANUP,
1580 NULL, &lock_flags, &fsf_req); 1311 NULL, &lock_flags, &fsf_req);
1581 if (ret < 0) { 1312 if (ret < 0)
1582 ZFCP_LOG_INFO("error: creation of ELS request failed "
1583 "(adapter %s, port d_id: 0x%06x)\n",
1584 zfcp_get_busid_by_adapter(adapter), d_id);
1585 goto failed_req; 1313 goto failed_req;
1586 }
1587 1314
1588 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, 1315 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
1589 &els->port->status))) { 1316 &els->port->status))) {
@@ -1610,9 +1337,6 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1610 els->req, 1337 els->req,
1611 ZFCP_MAX_SBALS_PER_ELS_REQ); 1338 ZFCP_MAX_SBALS_PER_ELS_REQ);
1612 if (bytes <= 0) { 1339 if (bytes <= 0) {
1613 ZFCP_LOG_INFO("error: creation of ELS request failed "
1614 "(adapter %s, port d_id: 0x%06x)\n",
1615 zfcp_get_busid_by_adapter(adapter), d_id);
1616 if (bytes == 0) { 1340 if (bytes == 0) {
1617 ret = -ENOMEM; 1341 ret = -ENOMEM;
1618 } else { 1342 } else {
@@ -1627,9 +1351,6 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1627 els->resp, 1351 els->resp,
1628 ZFCP_MAX_SBALS_PER_ELS_REQ); 1352 ZFCP_MAX_SBALS_PER_ELS_REQ);
1629 if (bytes <= 0) { 1353 if (bytes <= 0) {
1630 ZFCP_LOG_INFO("error: creation of ELS request failed "
1631 "(adapter %s, port d_id: 0x%06x)\n",
1632 zfcp_get_busid_by_adapter(adapter), d_id);
1633 if (bytes == 0) { 1354 if (bytes == 0) {
1634 ret = -ENOMEM; 1355 ret = -ENOMEM;
1635 } else { 1356 } else {
@@ -1640,10 +1361,6 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1640 fsf_req->qtcb->bottom.support.resp_buf_length = bytes; 1361 fsf_req->qtcb->bottom.support.resp_buf_length = bytes;
1641 } else { 1362 } else {
1642 /* reject request */ 1363 /* reject request */
1643 ZFCP_LOG_INFO("error: microcode does not support chained SBALs"
1644 ", ELS request too big (adapter %s, "
1645 "port d_id: 0x%06x)\n",
1646 zfcp_get_busid_by_adapter(adapter), d_id);
1647 ret = -EOPNOTSUPP; 1364 ret = -EOPNOTSUPP;
1648 goto failed_send; 1365 goto failed_send;
1649 } 1366 }
@@ -1661,15 +1378,9 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1661 1378
1662 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT); 1379 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT);
1663 ret = zfcp_fsf_req_send(fsf_req); 1380 ret = zfcp_fsf_req_send(fsf_req);
1664 if (ret) { 1381 if (ret)
1665 ZFCP_LOG_DEBUG("error: initiation of ELS request failed "
1666 "(adapter %s, port d_id: 0x%06x)\n",
1667 zfcp_get_busid_by_adapter(adapter), d_id);
1668 goto failed_send; 1382 goto failed_send;
1669 }
1670 1383
1671 ZFCP_LOG_DEBUG("ELS request initiated (adapter %s, port d_id: "
1672 "0x%06x)\n", zfcp_get_busid_by_adapter(adapter), d_id);
1673 goto out; 1384 goto out;
1674 1385
1675 port_blocked: 1386 port_blocked:
@@ -1701,7 +1412,6 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
1701 struct fsf_qtcb_bottom_support *bottom; 1412 struct fsf_qtcb_bottom_support *bottom;
1702 struct zfcp_send_els *send_els; 1413 struct zfcp_send_els *send_els;
1703 int retval = -EINVAL; 1414 int retval = -EINVAL;
1704 u16 subtable, rule, counter;
1705 1415
1706 send_els = (struct zfcp_send_els *) fsf_req->data; 1416 send_els = (struct zfcp_send_els *) fsf_req->data;
1707 adapter = send_els->adapter; 1417 adapter = send_els->adapter;
@@ -1721,13 +1431,7 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
1721 break; 1431 break;
1722 1432
1723 case FSF_SERVICE_CLASS_NOT_SUPPORTED: 1433 case FSF_SERVICE_CLASS_NOT_SUPPORTED:
1724 ZFCP_LOG_INFO("error: adapter %s does not support fc " 1434 zfcp_fsf_class_not_supp(fsf_req);
1725 "class %d.\n",
1726 zfcp_get_busid_by_adapter(adapter),
1727 ZFCP_FC_SERVICE_CLASS_DEFAULT);
1728 /* stop operation for this adapter */
1729 zfcp_erp_adapter_shutdown(adapter, 0, 124, fsf_req);
1730 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1731 break; 1435 break;
1732 1436
1733 case FSF_ADAPTER_STATUS_AVAILABLE: 1437 case FSF_ADAPTER_STATUS_AVAILABLE:
@@ -1743,91 +1447,25 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
1743 case FSF_SQ_RETRY_IF_POSSIBLE: 1447 case FSF_SQ_RETRY_IF_POSSIBLE:
1744 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1448 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1745 break; 1449 break;
1746 default:
1747 ZFCP_LOG_INFO("bug: Wrong status qualifier 0x%x\n",
1748 header->fsf_status_qual.word[0]);
1749 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO,
1750 (char*)header->fsf_status_qual.word, 16);
1751 } 1450 }
1752 break; 1451 break;
1753 1452
1754 case FSF_ELS_COMMAND_REJECTED: 1453 case FSF_ELS_COMMAND_REJECTED:
1755 ZFCP_LOG_INFO("ELS has been rejected because command filter "
1756 "prohibited sending "
1757 "(adapter: %s, port d_id: 0x%06x)\n",
1758 zfcp_get_busid_by_adapter(adapter), d_id);
1759
1760 break;
1761
1762 case FSF_PAYLOAD_SIZE_MISMATCH: 1454 case FSF_PAYLOAD_SIZE_MISMATCH:
1763 ZFCP_LOG_INFO(
1764 "ELS request size and ELS response size must be either "
1765 "both 0, or both greater than 0 "
1766 "(adapter: %s, req_buf_length=%d resp_buf_length=%d)\n",
1767 zfcp_get_busid_by_adapter(adapter),
1768 bottom->req_buf_length,
1769 bottom->resp_buf_length);
1770 break;
1771
1772 case FSF_REQUEST_SIZE_TOO_LARGE: 1455 case FSF_REQUEST_SIZE_TOO_LARGE:
1773 ZFCP_LOG_INFO(
1774 "Length of the ELS request buffer, "
1775 "specified in QTCB bottom, "
1776 "exceeds the size of the buffers "
1777 "that have been allocated for ELS request data "
1778 "(adapter: %s, req_buf_length=%d)\n",
1779 zfcp_get_busid_by_adapter(adapter),
1780 bottom->req_buf_length);
1781 break;
1782
1783 case FSF_RESPONSE_SIZE_TOO_LARGE: 1456 case FSF_RESPONSE_SIZE_TOO_LARGE:
1784 ZFCP_LOG_INFO(
1785 "Length of the ELS response buffer, "
1786 "specified in QTCB bottom, "
1787 "exceeds the size of the buffers "
1788 "that have been allocated for ELS response data "
1789 "(adapter: %s, resp_buf_length=%d)\n",
1790 zfcp_get_busid_by_adapter(adapter),
1791 bottom->resp_buf_length);
1792 break; 1457 break;
1793 1458
1794 case FSF_SBAL_MISMATCH: 1459 case FSF_SBAL_MISMATCH:
1795 /* should never occure, avoided in zfcp_fsf_send_els */ 1460 /* should never occure, avoided in zfcp_fsf_send_els */
1796 ZFCP_LOG_INFO("SBAL mismatch (adapter: %s, req_buf_length=%d, "
1797 "resp_buf_length=%d)\n",
1798 zfcp_get_busid_by_adapter(adapter),
1799 bottom->req_buf_length, bottom->resp_buf_length);
1800 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1461 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1801 break; 1462 break;
1802 1463
1803 case FSF_ACCESS_DENIED: 1464 case FSF_ACCESS_DENIED:
1804 ZFCP_LOG_NORMAL("access denied, cannot send ELS command " 1465 zfcp_fsf_access_denied_port(fsf_req, port);
1805 "(adapter %s, port d_id=0x%06x)\n",
1806 zfcp_get_busid_by_adapter(adapter), d_id);
1807 for (counter = 0; counter < 2; counter++) {
1808 subtable = header->fsf_status_qual.halfword[counter * 2];
1809 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
1810 switch (subtable) {
1811 case FSF_SQ_CFDC_SUBTABLE_OS:
1812 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
1813 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
1814 case FSF_SQ_CFDC_SUBTABLE_LUN:
1815 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
1816 zfcp_act_subtable_type[subtable], rule);
1817 break;
1818 }
1819 }
1820 if (port != NULL)
1821 zfcp_erp_port_access_denied(port, 56, fsf_req);
1822 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1823 break; 1466 break;
1824 1467
1825 default: 1468 default:
1826 ZFCP_LOG_NORMAL(
1827 "bug: An unknown FSF Status was presented "
1828 "(adapter: %s, fsf_status=0x%08x)\n",
1829 zfcp_get_busid_by_adapter(adapter),
1830 header->fsf_status);
1831 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1469 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1832 break; 1470 break;
1833 } 1471 }
@@ -1857,9 +1495,6 @@ zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1857 adapter->pool.fsf_req_erp, 1495 adapter->pool.fsf_req_erp,
1858 &lock_flags, &fsf_req); 1496 &lock_flags, &fsf_req);
1859 if (retval) { 1497 if (retval) {
1860 ZFCP_LOG_INFO("error: Could not create exchange configuration "
1861 "data request for adapter %s.\n",
1862 zfcp_get_busid_by_adapter(adapter));
1863 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1498 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
1864 return retval; 1499 return retval;
1865 } 1500 }
@@ -1880,16 +1515,9 @@ zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1880 retval = zfcp_fsf_req_send(fsf_req); 1515 retval = zfcp_fsf_req_send(fsf_req);
1881 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1516 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
1882 if (retval) { 1517 if (retval) {
1883 ZFCP_LOG_INFO("error: Could not send exchange configuration "
1884 "data command on the adapter %s\n",
1885 zfcp_get_busid_by_adapter(adapter));
1886 zfcp_fsf_req_free(fsf_req); 1518 zfcp_fsf_req_free(fsf_req);
1887 erp_action->fsf_req = NULL; 1519 erp_action->fsf_req = NULL;
1888 } 1520 }
1889 else
1890 ZFCP_LOG_DEBUG("exchange configuration data request initiated "
1891 "(adapter %s)\n",
1892 zfcp_get_busid_by_adapter(adapter));
1893 1521
1894 return retval; 1522 return retval;
1895} 1523}
@@ -1908,9 +1536,6 @@ zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter,
1908 ZFCP_WAIT_FOR_SBAL, NULL, &lock_flags, 1536 ZFCP_WAIT_FOR_SBAL, NULL, &lock_flags,
1909 &fsf_req); 1537 &fsf_req);
1910 if (retval) { 1538 if (retval) {
1911 ZFCP_LOG_INFO("error: Could not create exchange configuration "
1912 "data request for adapter %s.\n",
1913 zfcp_get_busid_by_adapter(adapter));
1914 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1539 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
1915 return retval; 1540 return retval;
1916 } 1541 }
@@ -1931,11 +1556,7 @@ zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter,
1931 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT); 1556 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT);
1932 retval = zfcp_fsf_req_send(fsf_req); 1557 retval = zfcp_fsf_req_send(fsf_req);
1933 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1558 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
1934 if (retval) 1559 if (!retval)
1935 ZFCP_LOG_INFO("error: Could not send exchange configuration "
1936 "data command on the adapter %s\n",
1937 zfcp_get_busid_by_adapter(adapter));
1938 else
1939 wait_event(fsf_req->completion_wq, 1560 wait_event(fsf_req->completion_wq,
1940 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 1561 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
1941 1562
@@ -1959,8 +1580,6 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
1959 struct Scsi_Host *shost = adapter->scsi_host; 1580 struct Scsi_Host *shost = adapter->scsi_host;
1960 1581
1961 bottom = &fsf_req->qtcb->bottom.config; 1582 bottom = &fsf_req->qtcb->bottom.config;
1962 ZFCP_LOG_DEBUG("low/high QTCB version 0x%x/0x%x of FSF\n",
1963 bottom->low_qtcb_version, bottom->high_qtcb_version);
1964 adapter->fsf_lic_version = bottom->lic_version; 1583 adapter->fsf_lic_version = bottom->lic_version;
1965 adapter->adapter_features = bottom->adapter_features; 1584 adapter->adapter_features = bottom->adapter_features;
1966 adapter->connection_features = bottom->connection_features; 1585 adapter->connection_features = bottom->connection_features;
@@ -2013,36 +1632,17 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
2013 min(FC_SERIAL_NUMBER_SIZE, 17)); 1632 min(FC_SERIAL_NUMBER_SIZE, 17));
2014 } 1633 }
2015 1634
2016 if (fsf_req->erp_action)
2017 ZFCP_LOG_NORMAL("The adapter %s reported the following "
2018 "characteristics:\n"
2019 "WWNN 0x%016Lx, WWPN 0x%016Lx, "
2020 "S_ID 0x%06x,\n"
2021 "adapter version 0x%x, "
2022 "LIC version 0x%x, "
2023 "FC link speed %d Gb/s\n",
2024 zfcp_get_busid_by_adapter(adapter),
2025 (wwn_t) fc_host_node_name(shost),
2026 (wwn_t) fc_host_port_name(shost),
2027 fc_host_port_id(shost),
2028 adapter->hydra_version,
2029 adapter->fsf_lic_version,
2030 fc_host_speed(shost));
2031 if (ZFCP_QTCB_VERSION < bottom->low_qtcb_version) { 1635 if (ZFCP_QTCB_VERSION < bottom->low_qtcb_version) {
2032 ZFCP_LOG_NORMAL("error: the adapter %s " 1636 dev_err(&adapter->ccw_device->dev,
2033 "only supports newer control block " 1637 "The adapter only supports newer control block "
2034 "versions in comparison to this device " 1638 "versions, try updated device driver.\n");
2035 "driver (try updated device driver)\n",
2036 zfcp_get_busid_by_adapter(adapter));
2037 zfcp_erp_adapter_shutdown(adapter, 0, 125, fsf_req); 1639 zfcp_erp_adapter_shutdown(adapter, 0, 125, fsf_req);
2038 return -EIO; 1640 return -EIO;
2039 } 1641 }
2040 if (ZFCP_QTCB_VERSION > bottom->high_qtcb_version) { 1642 if (ZFCP_QTCB_VERSION > bottom->high_qtcb_version) {
2041 ZFCP_LOG_NORMAL("error: the adapter %s " 1643 dev_err(&adapter->ccw_device->dev,
2042 "only supports older control block " 1644 "The adapter only supports older control block "
2043 "versions than this device driver uses" 1645 "versions, consider a microcode upgrade.\n");
2044 "(consider a microcode upgrade)\n",
2045 zfcp_get_busid_by_adapter(adapter));
2046 zfcp_erp_adapter_shutdown(adapter, 0, 126, fsf_req); 1646 zfcp_erp_adapter_shutdown(adapter, 0, 126, fsf_req);
2047 return -EIO; 1647 return -EIO;
2048 } 1648 }
@@ -2074,50 +1674,38 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
2074 1674
2075 switch (fc_host_port_type(adapter->scsi_host)) { 1675 switch (fc_host_port_type(adapter->scsi_host)) {
2076 case FC_PORTTYPE_PTP: 1676 case FC_PORTTYPE_PTP:
2077 ZFCP_LOG_NORMAL("Point-to-Point fibrechannel " 1677 if (fsf_req->erp_action)
2078 "configuration detected at adapter %s\n" 1678 dev_info(&adapter->ccw_device->dev,
2079 "Peer WWNN 0x%016llx, " 1679 "Point-to-Point fibrechannel "
2080 "peer WWPN 0x%016llx, " 1680 "configuration detected.\n");
2081 "peer d_id 0x%06x\n",
2082 zfcp_get_busid_by_adapter(adapter),
2083 adapter->peer_wwnn,
2084 adapter->peer_wwpn,
2085 adapter->peer_d_id);
2086 break; 1681 break;
2087 case FC_PORTTYPE_NLPORT: 1682 case FC_PORTTYPE_NLPORT:
2088 ZFCP_LOG_NORMAL("error: Arbitrated loop fibrechannel " 1683 dev_err(&adapter->ccw_device->dev,
2089 "topology detected at adapter %s " 1684 "Unsupported arbitrated loop fibrechannel "
2090 "unsupported, shutting down adapter\n", 1685 "topology detected, shutting down adapter\n");
2091 zfcp_get_busid_by_adapter(adapter));
2092 zfcp_erp_adapter_shutdown(adapter, 0, 127, fsf_req); 1686 zfcp_erp_adapter_shutdown(adapter, 0, 127, fsf_req);
2093 return -EIO; 1687 return -EIO;
2094 case FC_PORTTYPE_NPORT: 1688 case FC_PORTTYPE_NPORT:
2095 if (fsf_req->erp_action) 1689 if (fsf_req->erp_action)
2096 ZFCP_LOG_NORMAL("Switched fabric fibrechannel " 1690 dev_info(&adapter->ccw_device->dev,
2097 "network detected at adapter " 1691 "Switched fabric fibrechannel "
2098 "%s.\n", 1692 "network detected.\n");
2099 zfcp_get_busid_by_adapter(adapter));
2100 break; 1693 break;
2101 default: 1694 default:
2102 ZFCP_LOG_NORMAL("bug: The fibrechannel topology " 1695 dev_err(&adapter->ccw_device->dev,
2103 "reported by the exchange " 1696 "The fibrechannel topology reported by the "
2104 "configuration command for " 1697 "adapter is not known by the zfcp driver, "
2105 "the adapter %s is not " 1698 "shutting down adapter.\n");
2106 "of a type known to the zfcp "
2107 "driver, shutting down adapter\n",
2108 zfcp_get_busid_by_adapter(adapter));
2109 zfcp_erp_adapter_shutdown(adapter, 0, 128, fsf_req); 1699 zfcp_erp_adapter_shutdown(adapter, 0, 128, fsf_req);
2110 return -EIO; 1700 return -EIO;
2111 } 1701 }
2112 bottom = &qtcb->bottom.config; 1702 bottom = &qtcb->bottom.config;
2113 if (bottom->max_qtcb_size < sizeof(struct fsf_qtcb)) { 1703 if (bottom->max_qtcb_size < sizeof(struct fsf_qtcb)) {
2114 ZFCP_LOG_NORMAL("bug: Maximum QTCB size (%d bytes) " 1704 dev_err(&adapter->ccw_device->dev,
2115 "allowed by the adapter %s " 1705 "Maximum QTCB size (%d bytes) allowed by "
2116 "is lower than the minimum " 1706 "the adapter is lower than the minimum "
2117 "required by the driver (%ld bytes).\n", 1707 "required by the driver (%ld bytes).\n",
2118 bottom->max_qtcb_size, 1708 bottom->max_qtcb_size, sizeof(struct fsf_qtcb));
2119 zfcp_get_busid_by_adapter(adapter),
2120 sizeof(struct fsf_qtcb));
2121 zfcp_erp_adapter_shutdown(adapter, 0, 129, fsf_req); 1709 zfcp_erp_adapter_shutdown(adapter, 0, 129, fsf_req);
2122 return -EIO; 1710 return -EIO;
2123 } 1711 }
@@ -2154,12 +1742,8 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
2154 unsigned long lock_flags; 1742 unsigned long lock_flags;
2155 int retval; 1743 int retval;
2156 1744
2157 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) { 1745 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
2158 ZFCP_LOG_INFO("error: exchange port data "
2159 "command not supported by adapter %s\n",
2160 zfcp_get_busid_by_adapter(adapter));
2161 return -EOPNOTSUPP; 1746 return -EOPNOTSUPP;
2162 }
2163 1747
2164 /* setup new FSF request */ 1748 /* setup new FSF request */
2165 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 1749 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA,
@@ -2167,10 +1751,6 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
2167 adapter->pool.fsf_req_erp, 1751 adapter->pool.fsf_req_erp,
2168 &lock_flags, &fsf_req); 1752 &lock_flags, &fsf_req);
2169 if (retval) { 1753 if (retval) {
2170 ZFCP_LOG_INFO("error: Out of resources. Could not create an "
2171 "exchange port data request for "
2172 "the adapter %s.\n",
2173 zfcp_get_busid_by_adapter(adapter));
2174 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1754 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
2175 return retval; 1755 return retval;
2176 } 1756 }
@@ -2187,16 +1767,9 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
2187 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1767 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
2188 1768
2189 if (retval) { 1769 if (retval) {
2190 ZFCP_LOG_INFO("error: Could not send an exchange port data "
2191 "command on the adapter %s\n",
2192 zfcp_get_busid_by_adapter(adapter));
2193 zfcp_fsf_req_free(fsf_req); 1770 zfcp_fsf_req_free(fsf_req);
2194 erp_action->fsf_req = NULL; 1771 erp_action->fsf_req = NULL;
2195 } 1772 }
2196 else
2197 ZFCP_LOG_DEBUG("exchange port data request initiated "
2198 "(adapter %s)\n",
2199 zfcp_get_busid_by_adapter(adapter));
2200 return retval; 1773 return retval;
2201} 1774}
2202 1775
@@ -2214,21 +1787,13 @@ zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter,
2214 unsigned long lock_flags; 1787 unsigned long lock_flags;
2215 int retval; 1788 int retval;
2216 1789
2217 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) { 1790 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
2218 ZFCP_LOG_INFO("error: exchange port data "
2219 "command not supported by adapter %s\n",
2220 zfcp_get_busid_by_adapter(adapter));
2221 return -EOPNOTSUPP; 1791 return -EOPNOTSUPP;
2222 }
2223 1792
2224 /* setup new FSF request */ 1793 /* setup new FSF request */
2225 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 1794 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA,
2226 0, NULL, &lock_flags, &fsf_req); 1795 0, NULL, &lock_flags, &fsf_req);
2227 if (retval) { 1796 if (retval) {
2228 ZFCP_LOG_INFO("error: Out of resources. Could not create an "
2229 "exchange port data request for "
2230 "the adapter %s.\n",
2231 zfcp_get_busid_by_adapter(adapter));
2232 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1797 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
2233 return retval; 1798 return retval;
2234 } 1799 }
@@ -2244,11 +1809,7 @@ zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter,
2244 retval = zfcp_fsf_req_send(fsf_req); 1809 retval = zfcp_fsf_req_send(fsf_req);
2245 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1810 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
2246 1811
2247 if (retval) 1812 if (!retval)
2248 ZFCP_LOG_INFO("error: Could not send an exchange port data "
2249 "command on the adapter %s\n",
2250 zfcp_get_busid_by_adapter(adapter));
2251 else
2252 wait_event(fsf_req->completion_wq, 1813 wait_event(fsf_req->completion_wq,
2253 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 1814 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
2254 1815
@@ -2338,13 +1899,8 @@ zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
2338 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 1899 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
2339 erp_action->adapter->pool.fsf_req_erp, 1900 erp_action->adapter->pool.fsf_req_erp,
2340 &lock_flags, &fsf_req); 1901 &lock_flags, &fsf_req);
2341 if (retval < 0) { 1902 if (retval < 0)
2342 ZFCP_LOG_INFO("error: Could not create open port request "
2343 "for port 0x%016Lx on adapter %s.\n",
2344 erp_action->port->wwpn,
2345 zfcp_get_busid_by_adapter(erp_action->adapter));
2346 goto out; 1903 goto out;
2347 }
2348 1904
2349 sbale = zfcp_qdio_sbale_req(fsf_req); 1905 sbale = zfcp_qdio_sbale_req(fsf_req);
2350 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1906 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
@@ -2359,19 +1915,11 @@ zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
2359 zfcp_erp_start_timer(fsf_req); 1915 zfcp_erp_start_timer(fsf_req);
2360 retval = zfcp_fsf_req_send(fsf_req); 1916 retval = zfcp_fsf_req_send(fsf_req);
2361 if (retval) { 1917 if (retval) {
2362 ZFCP_LOG_INFO("error: Could not send open port request for "
2363 "port 0x%016Lx on adapter %s.\n",
2364 erp_action->port->wwpn,
2365 zfcp_get_busid_by_adapter(erp_action->adapter));
2366 zfcp_fsf_req_free(fsf_req); 1918 zfcp_fsf_req_free(fsf_req);
2367 erp_action->fsf_req = NULL; 1919 erp_action->fsf_req = NULL;
2368 goto out; 1920 goto out;
2369 } 1921 }
2370 1922
2371 ZFCP_LOG_DEBUG("open port request initiated "
2372 "(adapter %s, port 0x%016Lx)\n",
2373 zfcp_get_busid_by_adapter(erp_action->adapter),
2374 erp_action->port->wwpn);
2375 out: 1923 out:
2376 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags); 1924 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags);
2377 return retval; 1925 return retval;
@@ -2391,7 +1939,6 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2391 struct zfcp_port *port; 1939 struct zfcp_port *port;
2392 struct fsf_plogi *plogi; 1940 struct fsf_plogi *plogi;
2393 struct fsf_qtcb_header *header; 1941 struct fsf_qtcb_header *header;
2394 u16 subtable, rule, counter;
2395 1942
2396 port = (struct zfcp_port *) fsf_req->data; 1943 port = (struct zfcp_port *) fsf_req->data;
2397 header = &fsf_req->qtcb->header; 1944 header = &fsf_req->qtcb->header;
@@ -2405,9 +1952,6 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2405 switch (header->fsf_status) { 1952 switch (header->fsf_status) {
2406 1953
2407 case FSF_PORT_ALREADY_OPEN: 1954 case FSF_PORT_ALREADY_OPEN:
2408 ZFCP_LOG_NORMAL("bug: remote port 0x%016Lx on adapter %s "
2409 "is already open.\n",
2410 port->wwpn, zfcp_get_busid_by_port(port));
2411 /* 1955 /*
2412 * This is a bug, however operation should continue normally 1956 * This is a bug, however operation should continue normally
2413 * if it is simply ignored 1957 * if it is simply ignored
@@ -2415,31 +1959,14 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2415 break; 1959 break;
2416 1960
2417 case FSF_ACCESS_DENIED: 1961 case FSF_ACCESS_DENIED:
2418 ZFCP_LOG_NORMAL("Access denied, cannot open port 0x%016Lx " 1962 zfcp_fsf_access_denied_port(fsf_req, port);
2419 "on adapter %s\n",
2420 port->wwpn, zfcp_get_busid_by_port(port));
2421 for (counter = 0; counter < 2; counter++) {
2422 subtable = header->fsf_status_qual.halfword[counter * 2];
2423 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
2424 switch (subtable) {
2425 case FSF_SQ_CFDC_SUBTABLE_OS:
2426 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
2427 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
2428 case FSF_SQ_CFDC_SUBTABLE_LUN:
2429 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
2430 zfcp_act_subtable_type[subtable], rule);
2431 break;
2432 }
2433 }
2434 zfcp_erp_port_access_denied(port, 57, fsf_req);
2435 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2436 break; 1963 break;
2437 1964
2438 case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED: 1965 case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED:
2439 ZFCP_LOG_INFO("error: The FSF adapter is out of resources. " 1966 dev_warn(&fsf_req->adapter->ccw_device->dev,
2440 "The remote port 0x%016Lx on adapter %s " 1967 "The adapter is out of resources. The remote port "
2441 "could not be opened. Disabling it.\n", 1968 "0x%016Lx could not be opened, disabling it.\n",
2442 port->wwpn, zfcp_get_busid_by_port(port)); 1969 port->wwpn);
2443 zfcp_erp_port_failed(port, 31, fsf_req); 1970 zfcp_erp_port_failed(port, 31, fsf_req);
2444 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1971 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2445 break; 1972 break;
@@ -2455,18 +1982,13 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2455 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1982 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2456 break; 1983 break;
2457 case FSF_SQ_NO_RETRY_POSSIBLE: 1984 case FSF_SQ_NO_RETRY_POSSIBLE:
2458 ZFCP_LOG_NORMAL("The remote port 0x%016Lx on " 1985 dev_warn(&fsf_req->adapter->ccw_device->dev,
2459 "adapter %s could not be opened. " 1986 "The remote port 0x%016Lx could not be "
2460 "Disabling it.\n", 1987 "opened. Disabling it.\n", port->wwpn);
2461 port->wwpn,
2462 zfcp_get_busid_by_port(port));
2463 zfcp_erp_port_failed(port, 32, fsf_req); 1988 zfcp_erp_port_failed(port, 32, fsf_req);
2464 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1989 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2465 break; 1990 break;
2466 default: 1991 default:
2467 ZFCP_LOG_NORMAL
2468 ("bug: Wrong status qualifier 0x%x arrived.\n",
2469 header->fsf_status_qual.word[0]);
2470 break; 1992 break;
2471 } 1993 }
2472 break; 1994 break;
@@ -2474,10 +1996,6 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2474 case FSF_GOOD: 1996 case FSF_GOOD:
2475 /* save port handle assigned by FSF */ 1997 /* save port handle assigned by FSF */
2476 port->handle = header->port_handle; 1998 port->handle = header->port_handle;
2477 ZFCP_LOG_INFO("The remote port 0x%016Lx via adapter %s "
2478 "was opened, it's port handle is 0x%x\n",
2479 port->wwpn, zfcp_get_busid_by_port(port),
2480 port->handle);
2481 /* mark port as open */ 1999 /* mark port as open */
2482 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN | 2000 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN |
2483 ZFCP_STATUS_PORT_PHYS_OPEN, &port->status); 2001 ZFCP_STATUS_PORT_PHYS_OPEN, &port->status);
@@ -2505,16 +2023,9 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2505 { 2023 {
2506 if (fsf_req->qtcb->bottom.support.els1_length < 2024 if (fsf_req->qtcb->bottom.support.els1_length <
2507 sizeof (struct fsf_plogi)) { 2025 sizeof (struct fsf_plogi)) {
2508 ZFCP_LOG_INFO(
2509 "warning: insufficient length of "
2510 "PLOGI payload (%i)\n",
2511 fsf_req->qtcb->bottom.support.els1_length);
2512 /* skip sanity check and assume wwpn is ok */ 2026 /* skip sanity check and assume wwpn is ok */
2513 } else { 2027 } else {
2514 if (plogi->serv_param.wwpn != port->wwpn) { 2028 if (plogi->serv_param.wwpn != port->wwpn) {
2515 ZFCP_LOG_INFO("warning: d_id of port "
2516 "0x%016Lx changed during "
2517 "open\n", port->wwpn);
2518 atomic_clear_mask( 2029 atomic_clear_mask(
2519 ZFCP_STATUS_PORT_DID_DID, 2030 ZFCP_STATUS_PORT_DID_DID,
2520 &port->status); 2031 &port->status);
@@ -2528,17 +2039,10 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2528 2039
2529 case FSF_UNKNOWN_OP_SUBTYPE: 2040 case FSF_UNKNOWN_OP_SUBTYPE:
2530 /* should never occure, subtype not set in zfcp_fsf_open_port */ 2041 /* should never occure, subtype not set in zfcp_fsf_open_port */
2531 ZFCP_LOG_INFO("unknown operation subtype (adapter: %s, "
2532 "op_subtype=0x%x)\n",
2533 zfcp_get_busid_by_port(port),
2534 fsf_req->qtcb->bottom.support.operation_subtype);
2535 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2042 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2536 break; 2043 break;
2537 2044
2538 default: 2045 default:
2539 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
2540 "(debug info 0x%x)\n",
2541 header->fsf_status);
2542 break; 2046 break;
2543 } 2047 }
2544 2048
@@ -2569,13 +2073,8 @@ zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
2569 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 2073 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
2570 erp_action->adapter->pool.fsf_req_erp, 2074 erp_action->adapter->pool.fsf_req_erp,
2571 &lock_flags, &fsf_req); 2075 &lock_flags, &fsf_req);
2572 if (retval < 0) { 2076 if (retval < 0)
2573 ZFCP_LOG_INFO("error: Could not create a close port request "
2574 "for port 0x%016Lx on adapter %s.\n",
2575 erp_action->port->wwpn,
2576 zfcp_get_busid_by_adapter(erp_action->adapter));
2577 goto out; 2077 goto out;
2578 }
2579 2078
2580 sbale = zfcp_qdio_sbale_req(fsf_req); 2079 sbale = zfcp_qdio_sbale_req(fsf_req);
2581 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 2080 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
@@ -2591,19 +2090,11 @@ zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
2591 zfcp_erp_start_timer(fsf_req); 2090 zfcp_erp_start_timer(fsf_req);
2592 retval = zfcp_fsf_req_send(fsf_req); 2091 retval = zfcp_fsf_req_send(fsf_req);
2593 if (retval) { 2092 if (retval) {
2594 ZFCP_LOG_INFO("error: Could not send a close port request for "
2595 "port 0x%016Lx on adapter %s.\n",
2596 erp_action->port->wwpn,
2597 zfcp_get_busid_by_adapter(erp_action->adapter));
2598 zfcp_fsf_req_free(fsf_req); 2093 zfcp_fsf_req_free(fsf_req);
2599 erp_action->fsf_req = NULL; 2094 erp_action->fsf_req = NULL;
2600 goto out; 2095 goto out;
2601 } 2096 }
2602 2097
2603 ZFCP_LOG_TRACE("close port request initiated "
2604 "(adapter %s, port 0x%016Lx)\n",
2605 zfcp_get_busid_by_adapter(erp_action->adapter),
2606 erp_action->port->wwpn);
2607 out: 2098 out:
2608 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags); 2099 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags);
2609 return retval; 2100 return retval;
@@ -2633,14 +2124,6 @@ zfcp_fsf_close_port_handler(struct zfcp_fsf_req *fsf_req)
2633 switch (fsf_req->qtcb->header.fsf_status) { 2124 switch (fsf_req->qtcb->header.fsf_status) {
2634 2125
2635 case FSF_PORT_HANDLE_NOT_VALID: 2126 case FSF_PORT_HANDLE_NOT_VALID:
2636 ZFCP_LOG_INFO("Temporary port identifier 0x%x for port "
2637 "0x%016Lx on adapter %s invalid. This may happen "
2638 "occasionally.\n", port->handle,
2639 port->wwpn, zfcp_get_busid_by_port(port));
2640 ZFCP_LOG_DEBUG("status qualifier:\n");
2641 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
2642 (char *) &fsf_req->qtcb->header.fsf_status_qual,
2643 sizeof (union fsf_status_qual));
2644 zfcp_erp_adapter_reopen(port->adapter, 0, 107, fsf_req); 2127 zfcp_erp_adapter_reopen(port->adapter, 0, 107, fsf_req);
2645 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2128 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2646 break; 2129 break;
@@ -2653,20 +2136,11 @@ zfcp_fsf_close_port_handler(struct zfcp_fsf_req *fsf_req)
2653 break; 2136 break;
2654 2137
2655 case FSF_GOOD: 2138 case FSF_GOOD:
2656 ZFCP_LOG_TRACE("remote port 0x016%Lx on adapter %s closed, "
2657 "port handle 0x%x\n", port->wwpn,
2658 zfcp_get_busid_by_port(port), port->handle);
2659 zfcp_erp_modify_port_status(port, 33, fsf_req, 2139 zfcp_erp_modify_port_status(port, 33, fsf_req,
2660 ZFCP_STATUS_COMMON_OPEN, 2140 ZFCP_STATUS_COMMON_OPEN,
2661 ZFCP_CLEAR); 2141 ZFCP_CLEAR);
2662 retval = 0; 2142 retval = 0;
2663 break; 2143 break;
2664
2665 default:
2666 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
2667 "(debug info 0x%x)\n",
2668 fsf_req->qtcb->header.fsf_status);
2669 break;
2670 } 2144 }
2671 2145
2672 skip_fsfstatus: 2146 skip_fsfstatus:
@@ -2696,14 +2170,8 @@ zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
2696 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 2170 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
2697 erp_action->adapter->pool.fsf_req_erp, 2171 erp_action->adapter->pool.fsf_req_erp,
2698 &lock_flags, &fsf_req); 2172 &lock_flags, &fsf_req);
2699 if (retval < 0) { 2173 if (retval < 0)
2700 ZFCP_LOG_INFO("error: Could not create close physical port "
2701 "request (adapter %s, port 0x%016Lx)\n",
2702 zfcp_get_busid_by_adapter(erp_action->adapter),
2703 erp_action->port->wwpn);
2704
2705 goto out; 2174 goto out;
2706 }
2707 2175
2708 sbale = zfcp_qdio_sbale_req(fsf_req); 2176 sbale = zfcp_qdio_sbale_req(fsf_req);
2709 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 2177 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
@@ -2721,19 +2189,11 @@ zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
2721 zfcp_erp_start_timer(fsf_req); 2189 zfcp_erp_start_timer(fsf_req);
2722 retval = zfcp_fsf_req_send(fsf_req); 2190 retval = zfcp_fsf_req_send(fsf_req);
2723 if (retval) { 2191 if (retval) {
2724 ZFCP_LOG_INFO("error: Could not send close physical port "
2725 "request (adapter %s, port 0x%016Lx)\n",
2726 zfcp_get_busid_by_adapter(erp_action->adapter),
2727 erp_action->port->wwpn);
2728 zfcp_fsf_req_free(fsf_req); 2192 zfcp_fsf_req_free(fsf_req);
2729 erp_action->fsf_req = NULL; 2193 erp_action->fsf_req = NULL;
2730 goto out; 2194 goto out;
2731 } 2195 }
2732 2196
2733 ZFCP_LOG_TRACE("close physical port request initiated "
2734 "(adapter %s, port 0x%016Lx)\n",
2735 zfcp_get_busid_by_adapter(erp_action->adapter),
2736 erp_action->port->wwpn);
2737 out: 2197 out:
2738 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags); 2198 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags);
2739 return retval; 2199 return retval;
@@ -2753,7 +2213,6 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req)
2753 struct zfcp_port *port; 2213 struct zfcp_port *port;
2754 struct zfcp_unit *unit; 2214 struct zfcp_unit *unit;
2755 struct fsf_qtcb_header *header; 2215 struct fsf_qtcb_header *header;
2756 u16 subtable, rule, counter;
2757 2216
2758 port = (struct zfcp_port *) fsf_req->data; 2217 port = (struct zfcp_port *) fsf_req->data;
2759 header = &fsf_req->qtcb->header; 2218 header = &fsf_req->qtcb->header;
@@ -2767,47 +2226,15 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req)
2767 switch (header->fsf_status) { 2226 switch (header->fsf_status) {
2768 2227
2769 case FSF_PORT_HANDLE_NOT_VALID: 2228 case FSF_PORT_HANDLE_NOT_VALID:
2770 ZFCP_LOG_INFO("Temporary port identifier 0x%x invalid"
2771 "(adapter %s, port 0x%016Lx). "
2772 "This may happen occasionally.\n",
2773 port->handle,
2774 zfcp_get_busid_by_port(port),
2775 port->wwpn);
2776 ZFCP_LOG_DEBUG("status qualifier:\n");
2777 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
2778 (char *) &header->fsf_status_qual,
2779 sizeof (union fsf_status_qual));
2780 zfcp_erp_adapter_reopen(port->adapter, 0, 108, fsf_req); 2229 zfcp_erp_adapter_reopen(port->adapter, 0, 108, fsf_req);
2781 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2230 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2782 break; 2231 break;
2783 2232
2784 case FSF_ACCESS_DENIED: 2233 case FSF_ACCESS_DENIED:
2785 ZFCP_LOG_NORMAL("Access denied, cannot close " 2234 zfcp_fsf_access_denied_port(fsf_req, port);
2786 "physical port 0x%016Lx on adapter %s\n",
2787 port->wwpn, zfcp_get_busid_by_port(port));
2788 for (counter = 0; counter < 2; counter++) {
2789 subtable = header->fsf_status_qual.halfword[counter * 2];
2790 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
2791 switch (subtable) {
2792 case FSF_SQ_CFDC_SUBTABLE_OS:
2793 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
2794 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
2795 case FSF_SQ_CFDC_SUBTABLE_LUN:
2796 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
2797 zfcp_act_subtable_type[subtable], rule);
2798 break;
2799 }
2800 }
2801 zfcp_erp_port_access_denied(port, 58, fsf_req);
2802 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2803 break; 2235 break;
2804 2236
2805 case FSF_PORT_BOXED: 2237 case FSF_PORT_BOXED:
2806 ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter "
2807 "%s needs to be reopened but it was attempted "
2808 "to close it physically.\n",
2809 port->wwpn,
2810 zfcp_get_busid_by_port(port));
2811 zfcp_erp_port_boxed(port, 50, fsf_req); 2238 zfcp_erp_port_boxed(port, 50, fsf_req);
2812 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 2239 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
2813 ZFCP_STATUS_FSFREQ_RETRY; 2240 ZFCP_STATUS_FSFREQ_RETRY;
@@ -2830,19 +2257,10 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req)
2830 /* ERP strategy will escalate */ 2257 /* ERP strategy will escalate */
2831 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2258 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2832 break; 2259 break;
2833 default:
2834 ZFCP_LOG_NORMAL
2835 ("bug: Wrong status qualifier 0x%x arrived.\n",
2836 header->fsf_status_qual.word[0]);
2837 break;
2838 } 2260 }
2839 break; 2261 break;
2840 2262
2841 case FSF_GOOD: 2263 case FSF_GOOD:
2842 ZFCP_LOG_DEBUG("Remote port 0x%016Lx via adapter %s "
2843 "physically closed, port handle 0x%x\n",
2844 port->wwpn,
2845 zfcp_get_busid_by_port(port), port->handle);
2846 /* can't use generic zfcp_erp_modify_port_status because 2264 /* can't use generic zfcp_erp_modify_port_status because
2847 * ZFCP_STATUS_COMMON_OPEN must not be reset for the port 2265 * ZFCP_STATUS_COMMON_OPEN must not be reset for the port
2848 */ 2266 */
@@ -2851,12 +2269,6 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req)
2851 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status); 2269 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status);
2852 retval = 0; 2270 retval = 0;
2853 break; 2271 break;
2854
2855 default:
2856 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
2857 "(debug info 0x%x)\n",
2858 header->fsf_status);
2859 break;
2860 } 2272 }
2861 2273
2862 skip_fsfstatus: 2274 skip_fsfstatus:
@@ -2890,14 +2302,8 @@ zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
2890 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 2302 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
2891 erp_action->adapter->pool.fsf_req_erp, 2303 erp_action->adapter->pool.fsf_req_erp,
2892 &lock_flags, &fsf_req); 2304 &lock_flags, &fsf_req);
2893 if (retval < 0) { 2305 if (retval < 0)
2894 ZFCP_LOG_INFO("error: Could not create open unit request for "
2895 "unit 0x%016Lx on port 0x%016Lx on adapter %s.\n",
2896 erp_action->unit->fcp_lun,
2897 erp_action->unit->port->wwpn,
2898 zfcp_get_busid_by_adapter(erp_action->adapter));
2899 goto out; 2306 goto out;
2900 }
2901 2307
2902 sbale = zfcp_qdio_sbale_req(fsf_req); 2308 sbale = zfcp_qdio_sbale_req(fsf_req);
2903 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 2309 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
@@ -2916,21 +2322,10 @@ zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
2916 zfcp_erp_start_timer(fsf_req); 2322 zfcp_erp_start_timer(fsf_req);
2917 retval = zfcp_fsf_req_send(erp_action->fsf_req); 2323 retval = zfcp_fsf_req_send(erp_action->fsf_req);
2918 if (retval) { 2324 if (retval) {
2919 ZFCP_LOG_INFO("error: Could not send an open unit request "
2920 "on the adapter %s, port 0x%016Lx for "
2921 "unit 0x%016Lx\n",
2922 zfcp_get_busid_by_adapter(erp_action->adapter),
2923 erp_action->port->wwpn,
2924 erp_action->unit->fcp_lun);
2925 zfcp_fsf_req_free(fsf_req); 2325 zfcp_fsf_req_free(fsf_req);
2926 erp_action->fsf_req = NULL; 2326 erp_action->fsf_req = NULL;
2927 goto out; 2327 goto out;
2928 } 2328 }
2929
2930 ZFCP_LOG_TRACE("Open LUN request initiated (adapter %s, "
2931 "port 0x%016Lx, unit 0x%016Lx)\n",
2932 zfcp_get_busid_by_adapter(erp_action->adapter),
2933 erp_action->port->wwpn, erp_action->unit->fcp_lun);
2934 out: 2329 out:
2935 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags); 2330 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags);
2936 return retval; 2331 return retval;
@@ -2952,7 +2347,6 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
2952 struct fsf_qtcb_header *header; 2347 struct fsf_qtcb_header *header;
2953 struct fsf_qtcb_bottom_support *bottom; 2348 struct fsf_qtcb_bottom_support *bottom;
2954 struct fsf_queue_designator *queue_designator; 2349 struct fsf_queue_designator *queue_designator;
2955 u16 subtable, rule, counter;
2956 int exclusive, readwrite; 2350 int exclusive, readwrite;
2957 2351
2958 unit = (struct zfcp_unit *) fsf_req->data; 2352 unit = (struct zfcp_unit *) fsf_req->data;
@@ -2977,55 +2371,21 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
2977 switch (header->fsf_status) { 2371 switch (header->fsf_status) {
2978 2372
2979 case FSF_PORT_HANDLE_NOT_VALID: 2373 case FSF_PORT_HANDLE_NOT_VALID:
2980 ZFCP_LOG_INFO("Temporary port identifier 0x%x "
2981 "for port 0x%016Lx on adapter %s invalid "
2982 "This may happen occasionally\n",
2983 unit->port->handle,
2984 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
2985 ZFCP_LOG_DEBUG("status qualifier:\n");
2986 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
2987 (char *) &header->fsf_status_qual,
2988 sizeof (union fsf_status_qual));
2989 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 109, fsf_req); 2374 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 109, fsf_req);
2990 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2375 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2991 break; 2376 break;
2992 2377
2993 case FSF_LUN_ALREADY_OPEN: 2378 case FSF_LUN_ALREADY_OPEN:
2994 ZFCP_LOG_NORMAL("bug: Attempted to open unit 0x%016Lx on "
2995 "remote port 0x%016Lx on adapter %s twice.\n",
2996 unit->fcp_lun,
2997 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
2998 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2379 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2999 break; 2380 break;
3000 2381
3001 case FSF_ACCESS_DENIED: 2382 case FSF_ACCESS_DENIED:
3002 ZFCP_LOG_NORMAL("Access denied, cannot open unit 0x%016Lx on " 2383 zfcp_fsf_access_denied_unit(fsf_req, unit);
3003 "remote port 0x%016Lx on adapter %s\n",
3004 unit->fcp_lun, unit->port->wwpn,
3005 zfcp_get_busid_by_unit(unit));
3006 for (counter = 0; counter < 2; counter++) {
3007 subtable = header->fsf_status_qual.halfword[counter * 2];
3008 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
3009 switch (subtable) {
3010 case FSF_SQ_CFDC_SUBTABLE_OS:
3011 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
3012 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
3013 case FSF_SQ_CFDC_SUBTABLE_LUN:
3014 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
3015 zfcp_act_subtable_type[subtable], rule);
3016 break;
3017 }
3018 }
3019 zfcp_erp_unit_access_denied(unit, 59, fsf_req);
3020 atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status); 2384 atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status);
3021 atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status); 2385 atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status);
3022 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3023 break; 2386 break;
3024 2387
3025 case FSF_PORT_BOXED: 2388 case FSF_PORT_BOXED:
3026 ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter %s "
3027 "needs to be reopened\n",
3028 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
3029 zfcp_erp_port_boxed(unit->port, 51, fsf_req); 2389 zfcp_erp_port_boxed(unit->port, 51, fsf_req);
3030 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 2390 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
3031 ZFCP_STATUS_FSFREQ_RETRY; 2391 ZFCP_STATUS_FSFREQ_RETRY;
@@ -3033,39 +2393,18 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3033 2393
3034 case FSF_LUN_SHARING_VIOLATION: 2394 case FSF_LUN_SHARING_VIOLATION:
3035 if (header->fsf_status_qual.word[0] != 0) { 2395 if (header->fsf_status_qual.word[0] != 0) {
3036 ZFCP_LOG_NORMAL("FCP-LUN 0x%Lx at the remote port " 2396 dev_warn(&adapter->ccw_device->dev,
3037 "with WWPN 0x%Lx " 2397 "FCP-LUN 0x%Lx at the remote port "
3038 "connected to the adapter %s " 2398 "with WWPN 0x%Lx "
3039 "is already in use in LPAR%d, CSS%d\n", 2399 "connected to the adapter "
3040 unit->fcp_lun, 2400 "is already in use in LPAR%d, CSS%d.\n",
3041 unit->port->wwpn, 2401 unit->fcp_lun,
3042 zfcp_get_busid_by_unit(unit), 2402 unit->port->wwpn,
3043 queue_designator->hla, 2403 queue_designator->hla,
3044 queue_designator->cssid); 2404 queue_designator->cssid);
3045 } else { 2405 } else
3046 subtable = header->fsf_status_qual.halfword[4]; 2406 zfcp_act_eval_err(adapter,
3047 rule = header->fsf_status_qual.halfword[5]; 2407 header->fsf_status_qual.word[2]);
3048 switch (subtable) {
3049 case FSF_SQ_CFDC_SUBTABLE_OS:
3050 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
3051 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
3052 case FSF_SQ_CFDC_SUBTABLE_LUN:
3053 ZFCP_LOG_NORMAL("Access to FCP-LUN 0x%Lx at the "
3054 "remote port with WWPN 0x%Lx "
3055 "connected to the adapter %s "
3056 "is denied (%s rule %d)\n",
3057 unit->fcp_lun,
3058 unit->port->wwpn,
3059 zfcp_get_busid_by_unit(unit),
3060 zfcp_act_subtable_type[subtable],
3061 rule);
3062 break;
3063 }
3064 }
3065 ZFCP_LOG_DEBUG("status qualifier:\n");
3066 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3067 (char *) &header->fsf_status_qual,
3068 sizeof (union fsf_status_qual));
3069 zfcp_erp_unit_access_denied(unit, 60, fsf_req); 2408 zfcp_erp_unit_access_denied(unit, 60, fsf_req);
3070 atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status); 2409 atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status);
3071 atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status); 2410 atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status);
@@ -3073,13 +2412,10 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3073 break; 2412 break;
3074 2413
3075 case FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED: 2414 case FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED:
3076 ZFCP_LOG_INFO("error: The adapter ran out of resources. " 2415 dev_warn(&fsf_req->adapter->ccw_device->dev,
3077 "There is no handle (temporary port identifier) " 2416 "The adapter ran out of resources. There is no "
3078 "available for unit 0x%016Lx on port 0x%016Lx " 2417 "handle available for unit 0x%016Lx on port 0x%016Lx.",
3079 "on adapter %s\n", 2418 unit->fcp_lun, unit->port->wwpn);
3080 unit->fcp_lun,
3081 unit->port->wwpn,
3082 zfcp_get_busid_by_unit(unit));
3083 zfcp_erp_unit_failed(unit, 34, fsf_req); 2419 zfcp_erp_unit_failed(unit, 34, fsf_req);
3084 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2420 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3085 break; 2421 break;
@@ -3095,19 +2431,10 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3095 /* ERP strategy will escalate */ 2431 /* ERP strategy will escalate */
3096 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2432 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3097 break; 2433 break;
3098 default:
3099 ZFCP_LOG_NORMAL
3100 ("bug: Wrong status qualifier 0x%x arrived.\n",
3101 header->fsf_status_qual.word[0]);
3102 } 2434 }
3103 break; 2435 break;
3104 2436
3105 case FSF_INVALID_COMMAND_OPTION: 2437 case FSF_INVALID_COMMAND_OPTION:
3106 ZFCP_LOG_NORMAL(
3107 "Invalid option 0x%x has been specified "
3108 "in QTCB bottom sent to the adapter %s\n",
3109 bottom->option,
3110 zfcp_get_busid_by_adapter(adapter));
3111 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2438 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3112 retval = -EINVAL; 2439 retval = -EINVAL;
3113 break; 2440 break;
@@ -3115,12 +2442,6 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3115 case FSF_GOOD: 2442 case FSF_GOOD:
3116 /* save LUN handle assigned by FSF */ 2443 /* save LUN handle assigned by FSF */
3117 unit->handle = header->lun_handle; 2444 unit->handle = header->lun_handle;
3118 ZFCP_LOG_TRACE("unit 0x%016Lx on remote port 0x%016Lx on "
3119 "adapter %s opened, port handle 0x%x\n",
3120 unit->fcp_lun,
3121 unit->port->wwpn,
3122 zfcp_get_busid_by_unit(unit),
3123 unit->handle);
3124 /* mark unit as open */ 2445 /* mark unit as open */
3125 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status); 2446 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status);
3126 2447
@@ -3139,23 +2460,27 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3139 if (!readwrite) { 2460 if (!readwrite) {
3140 atomic_set_mask(ZFCP_STATUS_UNIT_READONLY, 2461 atomic_set_mask(ZFCP_STATUS_UNIT_READONLY,
3141 &unit->status); 2462 &unit->status);
3142 ZFCP_LOG_NORMAL("read-only access for unit " 2463 dev_info(&fsf_req->adapter->ccw_device->dev,
3143 "(adapter %s, wwpn=0x%016Lx, " 2464 "Read-only access for unit 0x%016Lx "
3144 "fcp_lun=0x%016Lx)\n", 2465 "on port 0x%016Lx.\n",
3145 zfcp_get_busid_by_unit(unit), 2466 unit->fcp_lun, unit->port->wwpn);
3146 unit->port->wwpn,
3147 unit->fcp_lun);
3148 } 2467 }
3149 2468
3150 if (exclusive && !readwrite) { 2469 if (exclusive && !readwrite) {
3151 ZFCP_LOG_NORMAL("exclusive access of read-only " 2470 dev_err(&fsf_req->adapter->ccw_device->dev,
3152 "unit not supported\n"); 2471 "Exclusive access of read-only unit "
2472 "0x%016Lx on port 0x%016Lx not "
2473 "supported, disabling unit.\n",
2474 unit->fcp_lun, unit->port->wwpn);
3153 zfcp_erp_unit_failed(unit, 35, fsf_req); 2475 zfcp_erp_unit_failed(unit, 35, fsf_req);
3154 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2476 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3155 zfcp_erp_unit_shutdown(unit, 0, 80, fsf_req); 2477 zfcp_erp_unit_shutdown(unit, 0, 80, fsf_req);
3156 } else if (!exclusive && readwrite) { 2478 } else if (!exclusive && readwrite) {
3157 ZFCP_LOG_NORMAL("shared access of read-write " 2479 dev_err(&fsf_req->adapter->ccw_device->dev,
3158 "unit not supported\n"); 2480 "Shared access of read-write unit "
2481 "0x%016Lx on port 0x%016Lx not "
2482 "supported, disabling unit.\n",
2483 unit->fcp_lun, unit->port->wwpn);
3159 zfcp_erp_unit_failed(unit, 36, fsf_req); 2484 zfcp_erp_unit_failed(unit, 36, fsf_req);
3160 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2485 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3161 zfcp_erp_unit_shutdown(unit, 0, 81, fsf_req); 2486 zfcp_erp_unit_shutdown(unit, 0, 81, fsf_req);
@@ -3164,12 +2489,6 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3164 2489
3165 retval = 0; 2490 retval = 0;
3166 break; 2491 break;
3167
3168 default:
3169 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
3170 "(debug info 0x%x)\n",
3171 header->fsf_status);
3172 break;
3173 } 2492 }
3174 2493
3175 skip_fsfstatus: 2494 skip_fsfstatus:
@@ -3204,14 +2523,8 @@ zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
3204 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 2523 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
3205 erp_action->adapter->pool.fsf_req_erp, 2524 erp_action->adapter->pool.fsf_req_erp,
3206 &lock_flags, &fsf_req); 2525 &lock_flags, &fsf_req);
3207 if (retval < 0) { 2526 if (retval < 0)
3208 ZFCP_LOG_INFO("error: Could not create close unit request for "
3209 "unit 0x%016Lx on port 0x%016Lx on adapter %s.\n",
3210 erp_action->unit->fcp_lun,
3211 erp_action->port->wwpn,
3212 zfcp_get_busid_by_adapter(erp_action->adapter));
3213 goto out; 2527 goto out;
3214 }
3215 2528
3216 sbale = zfcp_qdio_sbale_req(fsf_req); 2529 sbale = zfcp_qdio_sbale_req(fsf_req);
3217 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 2530 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
@@ -3227,20 +2540,11 @@ zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
3227 zfcp_erp_start_timer(fsf_req); 2540 zfcp_erp_start_timer(fsf_req);
3228 retval = zfcp_fsf_req_send(erp_action->fsf_req); 2541 retval = zfcp_fsf_req_send(erp_action->fsf_req);
3229 if (retval) { 2542 if (retval) {
3230 ZFCP_LOG_INFO("error: Could not send a close unit request for "
3231 "unit 0x%016Lx on port 0x%016Lx onadapter %s.\n",
3232 erp_action->unit->fcp_lun,
3233 erp_action->port->wwpn,
3234 zfcp_get_busid_by_adapter(erp_action->adapter));
3235 zfcp_fsf_req_free(fsf_req); 2543 zfcp_fsf_req_free(fsf_req);
3236 erp_action->fsf_req = NULL; 2544 erp_action->fsf_req = NULL;
3237 goto out; 2545 goto out;
3238 } 2546 }
3239 2547
3240 ZFCP_LOG_TRACE("Close LUN request initiated (adapter %s, "
3241 "port 0x%016Lx, unit 0x%016Lx)\n",
3242 zfcp_get_busid_by_adapter(erp_action->adapter),
3243 erp_action->port->wwpn, erp_action->unit->fcp_lun);
3244 out: 2548 out:
3245 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags); 2549 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags);
3246 return retval; 2550 return retval;
@@ -3270,41 +2574,16 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req)
3270 switch (fsf_req->qtcb->header.fsf_status) { 2574 switch (fsf_req->qtcb->header.fsf_status) {
3271 2575
3272 case FSF_PORT_HANDLE_NOT_VALID: 2576 case FSF_PORT_HANDLE_NOT_VALID:
3273 ZFCP_LOG_INFO("Temporary port identifier 0x%x for port "
3274 "0x%016Lx on adapter %s invalid. This may "
3275 "happen in rare circumstances\n",
3276 unit->port->handle,
3277 unit->port->wwpn,
3278 zfcp_get_busid_by_unit(unit));
3279 ZFCP_LOG_DEBUG("status qualifier:\n");
3280 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3281 (char *) &fsf_req->qtcb->header.fsf_status_qual,
3282 sizeof (union fsf_status_qual));
3283 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 110, fsf_req); 2577 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 110, fsf_req);
3284 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2578 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3285 break; 2579 break;
3286 2580
3287 case FSF_LUN_HANDLE_NOT_VALID: 2581 case FSF_LUN_HANDLE_NOT_VALID:
3288 ZFCP_LOG_INFO("Temporary LUN identifier 0x%x of unit "
3289 "0x%016Lx on port 0x%016Lx on adapter %s is "
3290 "invalid. This may happen occasionally.\n",
3291 unit->handle,
3292 unit->fcp_lun,
3293 unit->port->wwpn,
3294 zfcp_get_busid_by_unit(unit));
3295 ZFCP_LOG_DEBUG("Status qualifier data:\n");
3296 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3297 (char *) &fsf_req->qtcb->header.fsf_status_qual,
3298 sizeof (union fsf_status_qual));
3299 zfcp_erp_port_reopen(unit->port, 0, 111, fsf_req); 2582 zfcp_erp_port_reopen(unit->port, 0, 111, fsf_req);
3300 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2583 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3301 break; 2584 break;
3302 2585
3303 case FSF_PORT_BOXED: 2586 case FSF_PORT_BOXED:
3304 ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter %s "
3305 "needs to be reopened\n",
3306 unit->port->wwpn,
3307 zfcp_get_busid_by_unit(unit));
3308 zfcp_erp_port_boxed(unit->port, 52, fsf_req); 2587 zfcp_erp_port_boxed(unit->port, 52, fsf_req);
3309 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 2588 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
3310 ZFCP_STATUS_FSFREQ_RETRY; 2589 ZFCP_STATUS_FSFREQ_RETRY;
@@ -3322,30 +2601,15 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req)
3322 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2601 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3323 break; 2602 break;
3324 default: 2603 default:
3325 ZFCP_LOG_NORMAL
3326 ("bug: Wrong status qualifier 0x%x arrived.\n",
3327 fsf_req->qtcb->header.fsf_status_qual.word[0]);
3328 break; 2604 break;
3329 } 2605 }
3330 break; 2606 break;
3331 2607
3332 case FSF_GOOD: 2608 case FSF_GOOD:
3333 ZFCP_LOG_TRACE("unit 0x%016Lx on port 0x%016Lx on adapter %s "
3334 "closed, port handle 0x%x\n",
3335 unit->fcp_lun,
3336 unit->port->wwpn,
3337 zfcp_get_busid_by_unit(unit),
3338 unit->handle);
3339 /* mark unit as closed */ 2609 /* mark unit as closed */
3340 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status); 2610 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status);
3341 retval = 0; 2611 retval = 0;
3342 break; 2612 break;
3343
3344 default:
3345 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
3346 "(debug info 0x%x)\n",
3347 fsf_req->qtcb->header.fsf_status);
3348 break;
3349 } 2613 }
3350 2614
3351 skip_fsfstatus: 2615 skip_fsfstatus:
@@ -3379,15 +2643,8 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
3379 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, 2643 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags,
3380 adapter->pool.fsf_req_scsi, 2644 adapter->pool.fsf_req_scsi,
3381 &lock_flags, &fsf_req); 2645 &lock_flags, &fsf_req);
3382 if (unlikely(retval < 0)) { 2646 if (unlikely(retval < 0))
3383 ZFCP_LOG_DEBUG("error: Could not create FCP command request "
3384 "for unit 0x%016Lx on port 0x%016Lx on "
3385 "adapter %s\n",
3386 unit->fcp_lun,
3387 unit->port->wwpn,
3388 zfcp_get_busid_by_adapter(adapter));
3389 goto failed_req_create; 2647 goto failed_req_create;
3390 }
3391 2648
3392 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, 2649 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
3393 &unit->status))) { 2650 &unit->status))) {
@@ -3463,15 +2720,9 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
3463 fcp_cmnd_iu->task_attribute = UNTAGGED; 2720 fcp_cmnd_iu->task_attribute = UNTAGGED;
3464 2721
3465 /* set additional length of FCP_CDB in FCP_CMND IU in QTCB, if needed */ 2722 /* set additional length of FCP_CDB in FCP_CMND IU in QTCB, if needed */
3466 if (unlikely(scsi_cmnd->cmd_len > FCP_CDB_LENGTH)) { 2723 if (unlikely(scsi_cmnd->cmd_len > FCP_CDB_LENGTH))
3467 fcp_cmnd_iu->add_fcp_cdb_length 2724 fcp_cmnd_iu->add_fcp_cdb_length
3468 = (scsi_cmnd->cmd_len - FCP_CDB_LENGTH) >> 2; 2725 = (scsi_cmnd->cmd_len - FCP_CDB_LENGTH) >> 2;
3469 ZFCP_LOG_TRACE("SCSI CDB length is 0x%x, "
3470 "additional FCP_CDB length is 0x%x "
3471 "(shifted right 2 bits)\n",
3472 scsi_cmnd->cmd_len,
3473 fcp_cmnd_iu->add_fcp_cdb_length);
3474 }
3475 /* 2726 /*
3476 * copy SCSI CDB (including additional length, if any) to 2727 * copy SCSI CDB (including additional length, if any) to
3477 * FCP_CDB in FCP_CMND IU in QTCB 2728 * FCP_CDB in FCP_CMND IU in QTCB
@@ -3488,19 +2739,14 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
3488 scsi_sglist(scsi_cmnd), 2739 scsi_sglist(scsi_cmnd),
3489 ZFCP_MAX_SBALS_PER_REQ); 2740 ZFCP_MAX_SBALS_PER_REQ);
3490 if (unlikely(real_bytes < 0)) { 2741 if (unlikely(real_bytes < 0)) {
3491 if (fsf_req->sbal_number < ZFCP_MAX_SBALS_PER_REQ) { 2742 if (fsf_req->sbal_number < ZFCP_MAX_SBALS_PER_REQ)
3492 ZFCP_LOG_DEBUG(
3493 "Data did not fit into available buffer(s), "
3494 "waiting for more...\n");
3495 retval = -EIO; 2743 retval = -EIO;
3496 } else { 2744 else {
3497 ZFCP_LOG_NORMAL("error: No truncation implemented but " 2745 dev_err(&adapter->ccw_device->dev,
3498 "required. Shutting down unit " 2746 "SCSI request too large. "
3499 "(adapter %s, port 0x%016Lx, " 2747 "Shutting down unit 0x%016Lx on port "
3500 "unit 0x%016Lx)\n", 2748 "0x%016Lx.\n", unit->fcp_lun,
3501 zfcp_get_busid_by_unit(unit), 2749 unit->port->wwpn);
3502 unit->port->wwpn,
3503 unit->fcp_lun);
3504 zfcp_erp_unit_shutdown(unit, 0, 131, fsf_req); 2750 zfcp_erp_unit_shutdown(unit, 0, 131, fsf_req);
3505 retval = -EINVAL; 2751 retval = -EINVAL;
3506 } 2752 }
@@ -3510,28 +2756,13 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
3510 /* set length of FCP data length in FCP_CMND IU in QTCB */ 2756 /* set length of FCP data length in FCP_CMND IU in QTCB */
3511 zfcp_set_fcp_dl(fcp_cmnd_iu, real_bytes); 2757 zfcp_set_fcp_dl(fcp_cmnd_iu, real_bytes);
3512 2758
3513 ZFCP_LOG_DEBUG("Sending SCSI command:\n");
3514 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3515 (char *) scsi_cmnd->cmnd, scsi_cmnd->cmd_len);
3516
3517 if (use_timer) 2759 if (use_timer)
3518 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT); 2760 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT);
3519 2761
3520 retval = zfcp_fsf_req_send(fsf_req); 2762 retval = zfcp_fsf_req_send(fsf_req);
3521 if (unlikely(retval < 0)) { 2763 if (unlikely(retval < 0))
3522 ZFCP_LOG_INFO("error: Could not send FCP command request "
3523 "on adapter %s, port 0x%016Lx, unit 0x%016Lx\n",
3524 zfcp_get_busid_by_adapter(adapter),
3525 unit->port->wwpn,
3526 unit->fcp_lun);
3527 goto send_failed; 2764 goto send_failed;
3528 }
3529 2765
3530 ZFCP_LOG_TRACE("Send FCP Command initiated (adapter %s, "
3531 "port 0x%016Lx, unit 0x%016Lx)\n",
3532 zfcp_get_busid_by_adapter(adapter),
3533 unit->port->wwpn,
3534 unit->fcp_lun);
3535 goto success; 2766 goto success;
3536 2767
3537 send_failed: 2768 send_failed:
@@ -3563,14 +2794,8 @@ zfcp_fsf_send_fcp_command_task_management(struct zfcp_adapter *adapter,
3563 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, 2794 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags,
3564 adapter->pool.fsf_req_scsi, 2795 adapter->pool.fsf_req_scsi,
3565 &lock_flags, &fsf_req); 2796 &lock_flags, &fsf_req);
3566 if (retval < 0) { 2797 if (retval < 0)
3567 ZFCP_LOG_INFO("error: Could not create FCP command (task "
3568 "management) request for adapter %s, port "
3569 " 0x%016Lx, unit 0x%016Lx.\n",
3570 zfcp_get_busid_by_adapter(adapter),
3571 unit->port->wwpn, unit->fcp_lun);
3572 goto out; 2798 goto out;
3573 }
3574 2799
3575 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, 2800 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
3576 &unit->status))) 2801 &unit->status)))
@@ -3674,7 +2899,6 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3674 int retval = -EINVAL; 2899 int retval = -EINVAL;
3675 struct zfcp_unit *unit; 2900 struct zfcp_unit *unit;
3676 struct fsf_qtcb_header *header; 2901 struct fsf_qtcb_header *header;
3677 u16 subtable, rule, counter;
3678 2902
3679 header = &fsf_req->qtcb->header; 2903 header = &fsf_req->qtcb->header;
3680 2904
@@ -3692,137 +2916,61 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3692 switch (header->fsf_status) { 2916 switch (header->fsf_status) {
3693 2917
3694 case FSF_PORT_HANDLE_NOT_VALID: 2918 case FSF_PORT_HANDLE_NOT_VALID:
3695 ZFCP_LOG_INFO("Temporary port identifier 0x%x for port "
3696 "0x%016Lx on adapter %s invalid\n",
3697 unit->port->handle,
3698 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
3699 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3700 (char *) &header->fsf_status_qual,
3701 sizeof (union fsf_status_qual));
3702 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 112, fsf_req); 2919 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 112, fsf_req);
3703 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2920 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3704 break; 2921 break;
3705 2922
3706 case FSF_LUN_HANDLE_NOT_VALID: 2923 case FSF_LUN_HANDLE_NOT_VALID:
3707 ZFCP_LOG_INFO("Temporary LUN identifier 0x%x for unit "
3708 "0x%016Lx on port 0x%016Lx on adapter %s is "
3709 "invalid. This may happen occasionally.\n",
3710 unit->handle,
3711 unit->fcp_lun,
3712 unit->port->wwpn,
3713 zfcp_get_busid_by_unit(unit));
3714 ZFCP_LOG_NORMAL("Status qualifier data:\n");
3715 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
3716 (char *) &header->fsf_status_qual,
3717 sizeof (union fsf_status_qual));
3718 zfcp_erp_port_reopen(unit->port, 0, 113, fsf_req); 2924 zfcp_erp_port_reopen(unit->port, 0, 113, fsf_req);
3719 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2925 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3720 break; 2926 break;
3721 2927
3722 case FSF_HANDLE_MISMATCH: 2928 case FSF_HANDLE_MISMATCH:
3723 ZFCP_LOG_NORMAL("bug: The port handle 0x%x has changed "
3724 "unexpectedly. (adapter %s, port 0x%016Lx, "
3725 "unit 0x%016Lx)\n",
3726 unit->port->handle,
3727 zfcp_get_busid_by_unit(unit),
3728 unit->port->wwpn,
3729 unit->fcp_lun);
3730 ZFCP_LOG_NORMAL("status qualifier:\n");
3731 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
3732 (char *) &header->fsf_status_qual,
3733 sizeof (union fsf_status_qual));
3734 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 114, fsf_req); 2929 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 114, fsf_req);
3735 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2930 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3736 break; 2931 break;
3737 2932
3738 case FSF_SERVICE_CLASS_NOT_SUPPORTED: 2933 case FSF_SERVICE_CLASS_NOT_SUPPORTED:
3739 ZFCP_LOG_INFO("error: adapter %s does not support fc " 2934 zfcp_fsf_class_not_supp(fsf_req);
3740 "class %d.\n",
3741 zfcp_get_busid_by_unit(unit),
3742 ZFCP_FC_SERVICE_CLASS_DEFAULT);
3743 /* stop operation for this adapter */
3744 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 132, fsf_req);
3745 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3746 break; 2935 break;
3747 2936
3748 case FSF_FCPLUN_NOT_VALID: 2937 case FSF_FCPLUN_NOT_VALID:
3749 ZFCP_LOG_NORMAL("bug: unit 0x%016Lx on port 0x%016Lx on "
3750 "adapter %s does not have correct unit "
3751 "handle 0x%x\n",
3752 unit->fcp_lun,
3753 unit->port->wwpn,
3754 zfcp_get_busid_by_unit(unit),
3755 unit->handle);
3756 ZFCP_LOG_DEBUG("status qualifier:\n");
3757 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3758 (char *) &header->fsf_status_qual,
3759 sizeof (union fsf_status_qual));
3760 zfcp_erp_port_reopen(unit->port, 0, 115, fsf_req); 2938 zfcp_erp_port_reopen(unit->port, 0, 115, fsf_req);
3761 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2939 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3762 break; 2940 break;
3763 2941
3764 case FSF_ACCESS_DENIED: 2942 case FSF_ACCESS_DENIED:
3765 ZFCP_LOG_NORMAL("Access denied, cannot send FCP command to " 2943 zfcp_fsf_access_denied_unit(fsf_req, unit);
3766 "unit 0x%016Lx on port 0x%016Lx on "
3767 "adapter %s\n", unit->fcp_lun, unit->port->wwpn,
3768 zfcp_get_busid_by_unit(unit));
3769 for (counter = 0; counter < 2; counter++) {
3770 subtable = header->fsf_status_qual.halfword[counter * 2];
3771 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
3772 switch (subtable) {
3773 case FSF_SQ_CFDC_SUBTABLE_OS:
3774 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
3775 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
3776 case FSF_SQ_CFDC_SUBTABLE_LUN:
3777 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
3778 zfcp_act_subtable_type[subtable], rule);
3779 break;
3780 }
3781 }
3782 zfcp_erp_unit_access_denied(unit, 61, fsf_req);
3783 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3784 break; 2944 break;
3785 2945
3786 case FSF_DIRECTION_INDICATOR_NOT_VALID: 2946 case FSF_DIRECTION_INDICATOR_NOT_VALID:
3787 ZFCP_LOG_INFO("bug: Invalid data direction given for unit " 2947 dev_err(&fsf_req->adapter->ccw_device->dev,
3788 "0x%016Lx on port 0x%016Lx on adapter %s " 2948 "Invalid data direction (%d) given for unit 0x%016Lx "
3789 "(debug info %d)\n", 2949 "on port 0x%016Lx, shutting down adapter.\n",
3790 unit->fcp_lun, 2950 fsf_req->qtcb->bottom.io.data_direction,
3791 unit->port->wwpn, 2951 unit->fcp_lun, unit->port->wwpn);
3792 zfcp_get_busid_by_unit(unit),
3793 fsf_req->qtcb->bottom.io.data_direction);
3794 /* stop operation for this adapter */
3795 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 133, fsf_req); 2952 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 133, fsf_req);
3796 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2953 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3797 break; 2954 break;
3798 2955
3799 case FSF_CMND_LENGTH_NOT_VALID: 2956 case FSF_CMND_LENGTH_NOT_VALID:
3800 ZFCP_LOG_NORMAL 2957 dev_err(&fsf_req->adapter->ccw_device->dev,
3801 ("bug: An invalid control-data-block length field " 2958 "An invalid control-data-block length field (%d) "
3802 "was found in a command for unit 0x%016Lx on port " 2959 "was found in a command for unit 0x%016Lx on port "
3803 "0x%016Lx on adapter %s " "(debug info %d)\n", 2960 "0x%016Lx. Shutting down adapter.\n",
3804 unit->fcp_lun, unit->port->wwpn, 2961 fsf_req->qtcb->bottom.io.fcp_cmnd_length,
3805 zfcp_get_busid_by_unit(unit), 2962 unit->fcp_lun, unit->port->wwpn);
3806 fsf_req->qtcb->bottom.io.fcp_cmnd_length);
3807 /* stop operation for this adapter */
3808 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 134, fsf_req); 2963 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 134, fsf_req);
3809 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2964 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3810 break; 2965 break;
3811 2966
3812 case FSF_PORT_BOXED: 2967 case FSF_PORT_BOXED:
3813 ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter %s "
3814 "needs to be reopened\n",
3815 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
3816 zfcp_erp_port_boxed(unit->port, 53, fsf_req); 2968 zfcp_erp_port_boxed(unit->port, 53, fsf_req);
3817 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 2969 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
3818 ZFCP_STATUS_FSFREQ_RETRY; 2970 ZFCP_STATUS_FSFREQ_RETRY;
3819 break; 2971 break;
3820 2972
3821 case FSF_LUN_BOXED: 2973 case FSF_LUN_BOXED:
3822 ZFCP_LOG_NORMAL("unit needs to be reopened (adapter %s, "
3823 "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n",
3824 zfcp_get_busid_by_unit(unit),
3825 unit->port->wwpn, unit->fcp_lun);
3826 zfcp_erp_unit_boxed(unit, 54, fsf_req); 2974 zfcp_erp_unit_boxed(unit, 54, fsf_req);
3827 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 2975 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR
3828 | ZFCP_STATUS_FSFREQ_RETRY; 2976 | ZFCP_STATUS_FSFREQ_RETRY;
@@ -3838,11 +2986,6 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3838 /* FIXME(hw) need proper specs for proper action */ 2986 /* FIXME(hw) need proper specs for proper action */
3839 /* let scsi stack deal with retries and escalation */ 2987 /* let scsi stack deal with retries and escalation */
3840 break; 2988 break;
3841 default:
3842 ZFCP_LOG_NORMAL
3843 ("Unknown status qualifier 0x%x arrived.\n",
3844 header->fsf_status_qual.word[0]);
3845 break;
3846 } 2989 }
3847 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2990 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3848 break; 2991 break;
@@ -3880,34 +3023,26 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
3880 struct scsi_cmnd *scpnt; 3023 struct scsi_cmnd *scpnt;
3881 struct fcp_rsp_iu *fcp_rsp_iu = (struct fcp_rsp_iu *) 3024 struct fcp_rsp_iu *fcp_rsp_iu = (struct fcp_rsp_iu *)
3882 &(fsf_req->qtcb->bottom.io.fcp_rsp); 3025 &(fsf_req->qtcb->bottom.io.fcp_rsp);
3883 struct fcp_cmnd_iu *fcp_cmnd_iu = (struct fcp_cmnd_iu *)
3884 &(fsf_req->qtcb->bottom.io.fcp_cmnd);
3885 u32 sns_len; 3026 u32 sns_len;
3886 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu); 3027 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu);
3887 unsigned long flags; 3028 unsigned long flags;
3888 struct zfcp_unit *unit = fsf_req->unit;
3889 3029
3890 read_lock_irqsave(&fsf_req->adapter->abort_lock, flags); 3030 read_lock_irqsave(&fsf_req->adapter->abort_lock, flags);
3891 scpnt = (struct scsi_cmnd *) fsf_req->data; 3031 scpnt = (struct scsi_cmnd *) fsf_req->data;
3892 if (unlikely(!scpnt)) { 3032 if (unlikely(!scpnt))
3893 ZFCP_LOG_DEBUG
3894 ("Command with fsf_req %p is not associated to "
3895 "a scsi command anymore. Aborted?\n", fsf_req);
3896 goto out; 3033 goto out;
3897 } 3034
3898 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTED)) { 3035 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTED)) {
3899 /* FIXME: (design) mid-layer should handle DID_ABORT like 3036 /* FIXME: (design) mid-layer should handle DID_ABORT like
3900 * DID_SOFT_ERROR by retrying the request for devices 3037 * DID_SOFT_ERROR by retrying the request for devices
3901 * that allow retries. 3038 * that allow retries.
3902 */ 3039 */
3903 ZFCP_LOG_DEBUG("Setting DID_SOFT_ERROR and SUGGEST_RETRY\n");
3904 set_host_byte(&scpnt->result, DID_SOFT_ERROR); 3040 set_host_byte(&scpnt->result, DID_SOFT_ERROR);
3905 set_driver_byte(&scpnt->result, SUGGEST_RETRY); 3041 set_driver_byte(&scpnt->result, SUGGEST_RETRY);
3906 goto skip_fsfstatus; 3042 goto skip_fsfstatus;
3907 } 3043 }
3908 3044
3909 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)) { 3045 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
3910 ZFCP_LOG_DEBUG("Setting DID_ERROR\n");
3911 set_host_byte(&scpnt->result, DID_ERROR); 3046 set_host_byte(&scpnt->result, DID_ERROR);
3912 goto skip_fsfstatus; 3047 goto skip_fsfstatus;
3913 } 3048 }
@@ -3920,97 +3055,31 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
3920 * of result in SCSI command 3055 * of result in SCSI command
3921 */ 3056 */
3922 scpnt->result |= fcp_rsp_iu->scsi_status; 3057 scpnt->result |= fcp_rsp_iu->scsi_status;
3923 if (unlikely(fcp_rsp_iu->scsi_status)) {
3924 /* DEBUG */
3925 ZFCP_LOG_DEBUG("status for SCSI Command:\n");
3926 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3927 scpnt->cmnd, scpnt->cmd_len);
3928 ZFCP_LOG_DEBUG("SCSI status code 0x%x\n",
3929 fcp_rsp_iu->scsi_status);
3930 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3931 (void *) fcp_rsp_iu, sizeof (struct fcp_rsp_iu));
3932 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3933 zfcp_get_fcp_sns_info_ptr(fcp_rsp_iu),
3934 fcp_rsp_iu->fcp_sns_len);
3935 }
3936 3058
3937 if (fsf_req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) 3059 if (fsf_req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA)
3938 zfcp_fsf_req_latency(fsf_req); 3060 zfcp_fsf_req_latency(fsf_req);
3939 3061
3940 /* check FCP_RSP_INFO */ 3062 /* check FCP_RSP_INFO */
3941 if (unlikely(fcp_rsp_iu->validity.bits.fcp_rsp_len_valid)) { 3063 if (unlikely(fcp_rsp_iu->validity.bits.fcp_rsp_len_valid)) {
3942 ZFCP_LOG_DEBUG("rsp_len is valid\n");
3943 switch (fcp_rsp_info[3]) { 3064 switch (fcp_rsp_info[3]) {
3944 case RSP_CODE_GOOD: 3065 case RSP_CODE_GOOD:
3945 /* ok, continue */ 3066 /* ok, continue */
3946 ZFCP_LOG_TRACE("no failure or Task Management "
3947 "Function complete\n");
3948 set_host_byte(&scpnt->result, DID_OK); 3067 set_host_byte(&scpnt->result, DID_OK);
3949 break; 3068 break;
3950 case RSP_CODE_LENGTH_MISMATCH: 3069 case RSP_CODE_LENGTH_MISMATCH:
3951 /* hardware bug */ 3070 /* hardware bug */
3952 ZFCP_LOG_NORMAL("bug: FCP response code indictates "
3953 "that the fibrechannel protocol data "
3954 "length differs from the burst length. "
3955 "The problem occured on unit 0x%016Lx "
3956 "on port 0x%016Lx on adapter %s",
3957 unit->fcp_lun,
3958 unit->port->wwpn,
3959 zfcp_get_busid_by_unit(unit));
3960 /* dump SCSI CDB as prepared by zfcp */
3961 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3962 (char *) &fsf_req->qtcb->
3963 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
3964 set_host_byte(&scpnt->result, DID_ERROR); 3071 set_host_byte(&scpnt->result, DID_ERROR);
3965 goto skip_fsfstatus; 3072 goto skip_fsfstatus;
3966 case RSP_CODE_FIELD_INVALID: 3073 case RSP_CODE_FIELD_INVALID:
3967 /* driver or hardware bug */ 3074 /* driver or hardware bug */
3968 ZFCP_LOG_NORMAL("bug: FCP response code indictates "
3969 "that the fibrechannel protocol data "
3970 "fields were incorrectly set up. "
3971 "The problem occured on the unit "
3972 "0x%016Lx on port 0x%016Lx on "
3973 "adapter %s",
3974 unit->fcp_lun,
3975 unit->port->wwpn,
3976 zfcp_get_busid_by_unit(unit));
3977 /* dump SCSI CDB as prepared by zfcp */
3978 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3979 (char *) &fsf_req->qtcb->
3980 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
3981 set_host_byte(&scpnt->result, DID_ERROR); 3075 set_host_byte(&scpnt->result, DID_ERROR);
3982 goto skip_fsfstatus; 3076 goto skip_fsfstatus;
3983 case RSP_CODE_RO_MISMATCH: 3077 case RSP_CODE_RO_MISMATCH:
3984 /* hardware bug */ 3078 /* hardware bug */
3985 ZFCP_LOG_NORMAL("bug: The FCP response code indicates "
3986 "that conflicting values for the "
3987 "fibrechannel payload offset from the "
3988 "header were found. "
3989 "The problem occured on unit 0x%016Lx "
3990 "on port 0x%016Lx on adapter %s.\n",
3991 unit->fcp_lun,
3992 unit->port->wwpn,
3993 zfcp_get_busid_by_unit(unit));
3994 /* dump SCSI CDB as prepared by zfcp */
3995 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3996 (char *) &fsf_req->qtcb->
3997 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
3998 set_host_byte(&scpnt->result, DID_ERROR); 3079 set_host_byte(&scpnt->result, DID_ERROR);
3999 goto skip_fsfstatus; 3080 goto skip_fsfstatus;
4000 default: 3081 default:
4001 ZFCP_LOG_NORMAL("bug: An invalid FCP response " 3082 /* invalid FCP response code */
4002 "code was detected for a command. "
4003 "The problem occured on the unit "
4004 "0x%016Lx on port 0x%016Lx on "
4005 "adapter %s (debug info 0x%x)\n",
4006 unit->fcp_lun,
4007 unit->port->wwpn,
4008 zfcp_get_busid_by_unit(unit),
4009 fcp_rsp_info[3]);
4010 /* dump SCSI CDB as prepared by zfcp */
4011 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
4012 (char *) &fsf_req->qtcb->
4013 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
4014 set_host_byte(&scpnt->result, DID_ERROR); 3083 set_host_byte(&scpnt->result, DID_ERROR);
4015 goto skip_fsfstatus; 3084 goto skip_fsfstatus;
4016 } 3085 }
@@ -4020,50 +3089,15 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
4020 if (unlikely(fcp_rsp_iu->validity.bits.fcp_sns_len_valid)) { 3089 if (unlikely(fcp_rsp_iu->validity.bits.fcp_sns_len_valid)) {
4021 sns_len = FSF_FCP_RSP_SIZE - 3090 sns_len = FSF_FCP_RSP_SIZE -
4022 sizeof (struct fcp_rsp_iu) + fcp_rsp_iu->fcp_rsp_len; 3091 sizeof (struct fcp_rsp_iu) + fcp_rsp_iu->fcp_rsp_len;
4023 ZFCP_LOG_TRACE("room for %i bytes sense data in QTCB\n",
4024 sns_len);
4025 sns_len = min(sns_len, (u32) SCSI_SENSE_BUFFERSIZE); 3092 sns_len = min(sns_len, (u32) SCSI_SENSE_BUFFERSIZE);
4026 ZFCP_LOG_TRACE("room for %i bytes sense data in SCSI command\n",
4027 SCSI_SENSE_BUFFERSIZE);
4028 sns_len = min(sns_len, fcp_rsp_iu->fcp_sns_len); 3093 sns_len = min(sns_len, fcp_rsp_iu->fcp_sns_len);
4029 ZFCP_LOG_TRACE("scpnt->result =0x%x, command was:\n",
4030 scpnt->result);
4031 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE,
4032 scpnt->cmnd, scpnt->cmd_len);
4033 3094
4034 ZFCP_LOG_TRACE("%i bytes sense data provided by FCP\n",
4035 fcp_rsp_iu->fcp_sns_len);
4036 memcpy(scpnt->sense_buffer, 3095 memcpy(scpnt->sense_buffer,
4037 zfcp_get_fcp_sns_info_ptr(fcp_rsp_iu), sns_len); 3096 zfcp_get_fcp_sns_info_ptr(fcp_rsp_iu), sns_len);
4038 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE,
4039 (void *)scpnt->sense_buffer, sns_len);
4040 }
4041
4042 /* check for overrun */
4043 if (unlikely(fcp_rsp_iu->validity.bits.fcp_resid_over)) {
4044 ZFCP_LOG_INFO("A data overrun was detected for a command. "
4045 "unit 0x%016Lx, port 0x%016Lx, adapter %s. "
4046 "The response data length is "
4047 "%d, the original length was %d.\n",
4048 unit->fcp_lun,
4049 unit->port->wwpn,
4050 zfcp_get_busid_by_unit(unit),
4051 fcp_rsp_iu->fcp_resid,
4052 (int) zfcp_get_fcp_dl(fcp_cmnd_iu));
4053 } 3097 }
4054 3098
4055 /* check for underrun */ 3099 /* check for underrun */
4056 if (unlikely(fcp_rsp_iu->validity.bits.fcp_resid_under)) { 3100 if (unlikely(fcp_rsp_iu->validity.bits.fcp_resid_under)) {
4057 ZFCP_LOG_INFO("A data underrun was detected for a command. "
4058 "unit 0x%016Lx, port 0x%016Lx, adapter %s. "
4059 "The response data length is "
4060 "%d, the original length was %d.\n",
4061 unit->fcp_lun,
4062 unit->port->wwpn,
4063 zfcp_get_busid_by_unit(unit),
4064 fcp_rsp_iu->fcp_resid,
4065 (int) zfcp_get_fcp_dl(fcp_cmnd_iu));
4066
4067 scsi_set_resid(scpnt, fcp_rsp_iu->fcp_resid); 3101 scsi_set_resid(scpnt, fcp_rsp_iu->fcp_resid);
4068 if (scsi_bufflen(scpnt) - scsi_get_resid(scpnt) < 3102 if (scsi_bufflen(scpnt) - scsi_get_resid(scpnt) <
4069 scpnt->underflow) 3103 scpnt->underflow)
@@ -4071,8 +3105,6 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
4071 } 3105 }
4072 3106
4073 skip_fsfstatus: 3107 skip_fsfstatus:
4074 ZFCP_LOG_DEBUG("scpnt->result =0x%x\n", scpnt->result);
4075
4076 if (scpnt->result != 0) 3108 if (scpnt->result != 0)
4077 zfcp_scsi_dbf_event_result("erro", 3, fsf_req->adapter, scpnt, fsf_req); 3109 zfcp_scsi_dbf_event_result("erro", 3, fsf_req->adapter, scpnt, fsf_req);
4078 else if (scpnt->retries > 0) 3110 else if (scpnt->retries > 0)
@@ -4111,7 +3143,6 @@ zfcp_fsf_send_fcp_command_task_management_handler(struct zfcp_fsf_req *fsf_req)
4111 struct fcp_rsp_iu *fcp_rsp_iu = (struct fcp_rsp_iu *) 3143 struct fcp_rsp_iu *fcp_rsp_iu = (struct fcp_rsp_iu *)
4112 &(fsf_req->qtcb->bottom.io.fcp_rsp); 3144 &(fsf_req->qtcb->bottom.io.fcp_rsp);
4113 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu); 3145 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu);
4114 struct zfcp_unit *unit = (struct zfcp_unit *) fsf_req->data;
4115 3146
4116 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) { 3147 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) {
4117 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED; 3148 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED;
@@ -4122,36 +3153,15 @@ zfcp_fsf_send_fcp_command_task_management_handler(struct zfcp_fsf_req *fsf_req)
4122 switch (fcp_rsp_info[3]) { 3153 switch (fcp_rsp_info[3]) {
4123 case RSP_CODE_GOOD: 3154 case RSP_CODE_GOOD:
4124 /* ok, continue */ 3155 /* ok, continue */
4125 ZFCP_LOG_DEBUG("no failure or Task Management "
4126 "Function complete\n");
4127 break; 3156 break;
4128 case RSP_CODE_TASKMAN_UNSUPP: 3157 case RSP_CODE_TASKMAN_UNSUPP:
4129 ZFCP_LOG_NORMAL("bug: A reuested task management function "
4130 "is not supported on the target device "
4131 "unit 0x%016Lx, port 0x%016Lx, adapter %s\n ",
4132 unit->fcp_lun,
4133 unit->port->wwpn,
4134 zfcp_get_busid_by_unit(unit));
4135 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP; 3158 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP;
4136 break; 3159 break;
4137 case RSP_CODE_TASKMAN_FAILED: 3160 case RSP_CODE_TASKMAN_FAILED:
4138 ZFCP_LOG_NORMAL("bug: A reuested task management function "
4139 "failed to complete successfully. "
4140 "unit 0x%016Lx, port 0x%016Lx, adapter %s.\n",
4141 unit->fcp_lun,
4142 unit->port->wwpn,
4143 zfcp_get_busid_by_unit(unit));
4144 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED; 3161 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED;
4145 break; 3162 break;
4146 default: 3163 default:
4147 ZFCP_LOG_NORMAL("bug: An invalid FCP response " 3164 /* invalid FCP response code */
4148 "code was detected for a command. "
4149 "unit 0x%016Lx, port 0x%016Lx, adapter %s "
4150 "(debug info 0x%x)\n",
4151 unit->fcp_lun,
4152 unit->port->wwpn,
4153 zfcp_get_busid_by_unit(unit),
4154 fcp_rsp_info[3]);
4155 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED; 3165 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED;
4156 } 3166 }
4157 3167
@@ -4332,9 +3342,7 @@ zfcp_fsf_req_create(struct zfcp_adapter *adapter, u32 fsf_cmd, int req_flags,
4332 3342
4333 /* allocate new FSF request */ 3343 /* allocate new FSF request */
4334 fsf_req = zfcp_fsf_req_alloc(pool, req_flags); 3344 fsf_req = zfcp_fsf_req_alloc(pool, req_flags);
4335 if (unlikely(NULL == fsf_req)) { 3345 if (unlikely(!fsf_req)) {
4336 ZFCP_LOG_DEBUG("error: Could not put an FSF request into "
4337 "the outbound (send) queue.\n");
4338 ret = -ENOMEM; 3346 ret = -ENOMEM;
4339 goto failed_fsf_req; 3347 goto failed_fsf_req;
4340 } 3348 }
@@ -4393,9 +3401,6 @@ zfcp_fsf_req_create(struct zfcp_adapter *adapter, u32 fsf_cmd, int req_flags,
4393 sbale[1].length = sizeof(struct fsf_qtcb); 3401 sbale[1].length = sizeof(struct fsf_qtcb);
4394 } 3402 }
4395 3403
4396 ZFCP_LOG_TRACE("got %i free BUFFERs starting at index %i\n",
4397 fsf_req->sbal_number, fsf_req->sbal_first);
4398
4399 goto success; 3404 goto success;
4400 3405
4401 failed_sbals: 3406 failed_sbals:
@@ -4429,13 +3434,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req)
4429 adapter = fsf_req->adapter; 3434 adapter = fsf_req->adapter;
4430 req_q = &adapter->req_q; 3435 req_q = &adapter->req_q;
4431 3436
4432
4433 /* FIXME(debug): remove it later */
4434 sbale = zfcp_qdio_sbale_req(fsf_req); 3437 sbale = zfcp_qdio_sbale_req(fsf_req);
4435 ZFCP_LOG_DEBUG("SBALE0 flags=0x%x\n", sbale[0].flags);
4436 ZFCP_LOG_TRACE("HEX DUMP OF SBALE1 PAYLOAD:\n");
4437 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE, (char *) sbale[1].addr,
4438 sbale[1].length);
4439 3438
4440 /* put allocated FSF request into hash table */ 3439 /* put allocated FSF request into hash table */
4441 spin_lock(&adapter->req_list_lock); 3440 spin_lock(&adapter->req_list_lock);
@@ -4476,5 +3475,3 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req)
4476 } 3475 }
4477 return retval; 3476 return retval;
4478} 3477}
4479
4480#undef ZFCP_LOG_AREA