aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_fsf.c
diff options
context:
space:
mode:
authorMaxim Shchetynin <maxim@de.ibm.com>2005-09-13 15:50:38 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-09-19 14:03:00 -0400
commit8a36e4532ea10471f0a8605207d071361d7be2c3 (patch)
treef34e5928de7d73b9aaf385f3fb0847a6c52c297b /drivers/s390/scsi/zfcp_fsf.c
parent810f1e3ea5cc0a812816af97020a27c73441f8e9 (diff)
[SCSI] zfcp: enhancement of zfcp debug features
Debug features (DBFs) els_dbf, cmd_dbf and abt_dbf were removed and san_dbf, hba_dbf and scsi_dbf were introduced. The erp_dbf did not change. The new traces improve debugging of problems with zfcp, scsi-stack, multipath and hardware in the SAN. san_dbf traces things like ELS and CT commands, hba_dbf saves HBA specific information of requests, and scsi_dbf saves FCP and SCSI specific information of requests. Common to all new DBFs is that they provide a so called structured view. This significantly improves readability of the traces. Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_fsf.c')
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c241
1 files changed, 62 insertions, 179 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 929f6c9cad39..80ab721ddfff 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -285,51 +285,51 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
285{ 285{
286 int retval = 0; 286 int retval = 0;
287 struct zfcp_adapter *adapter = fsf_req->adapter; 287 struct zfcp_adapter *adapter = fsf_req->adapter;
288 struct fsf_qtcb *qtcb = fsf_req->qtcb;
289 union fsf_prot_status_qual *prot_status_qual =
290 &qtcb->prefix.prot_status_qual;
288 291
289 ZFCP_LOG_DEBUG("QTCB is at %p\n", fsf_req->qtcb); 292 zfcp_hba_dbf_event_fsf_response(fsf_req);
290 293
291 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { 294 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) {
292 ZFCP_LOG_DEBUG("fsf_req 0x%lx has been dismissed\n", 295 ZFCP_LOG_DEBUG("fsf_req 0x%lx has been dismissed\n",
293 (unsigned long) fsf_req); 296 (unsigned long) fsf_req);
294 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 297 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
295 ZFCP_STATUS_FSFREQ_RETRY; /* only for SCSI cmnds. */ 298 ZFCP_STATUS_FSFREQ_RETRY; /* only for SCSI cmnds. */
296 zfcp_cmd_dbf_event_fsf("dismiss", fsf_req, NULL, 0);
297 goto skip_protstatus; 299 goto skip_protstatus;
298 } 300 }
299 301
300 /* log additional information provided by FSF (if any) */ 302 /* log additional information provided by FSF (if any) */
301 if (unlikely(fsf_req->qtcb->header.log_length)) { 303 if (unlikely(qtcb->header.log_length)) {
302 /* do not trust them ;-) */ 304 /* do not trust them ;-) */
303 if (fsf_req->qtcb->header.log_start > sizeof(struct fsf_qtcb)) { 305 if (qtcb->header.log_start > sizeof(struct fsf_qtcb)) {
304 ZFCP_LOG_NORMAL 306 ZFCP_LOG_NORMAL
305 ("bug: ULP (FSF logging) log data starts " 307 ("bug: ULP (FSF logging) log data starts "
306 "beyond end of packet header. Ignored. " 308 "beyond end of packet header. Ignored. "
307 "(start=%i, size=%li)\n", 309 "(start=%i, size=%li)\n",
308 fsf_req->qtcb->header.log_start, 310 qtcb->header.log_start,
309 sizeof(struct fsf_qtcb)); 311 sizeof(struct fsf_qtcb));
310 goto forget_log; 312 goto forget_log;
311 } 313 }
312 if ((size_t) (fsf_req->qtcb->header.log_start + 314 if ((size_t) (qtcb->header.log_start + qtcb->header.log_length)
313 fsf_req->qtcb->header.log_length)
314 > sizeof(struct fsf_qtcb)) { 315 > sizeof(struct fsf_qtcb)) {
315 ZFCP_LOG_NORMAL("bug: ULP (FSF logging) log data ends " 316 ZFCP_LOG_NORMAL("bug: ULP (FSF logging) log data ends "
316 "beyond end of packet header. Ignored. " 317 "beyond end of packet header. Ignored. "
317 "(start=%i, length=%i, size=%li)\n", 318 "(start=%i, length=%i, size=%li)\n",
318 fsf_req->qtcb->header.log_start, 319 qtcb->header.log_start,
319 fsf_req->qtcb->header.log_length, 320 qtcb->header.log_length,
320 sizeof(struct fsf_qtcb)); 321 sizeof(struct fsf_qtcb));
321 goto forget_log; 322 goto forget_log;
322 } 323 }
323 ZFCP_LOG_TRACE("ULP log data: \n"); 324 ZFCP_LOG_TRACE("ULP log data: \n");
324 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE, 325 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE,
325 (char *) fsf_req->qtcb + 326 (char *) qtcb + qtcb->header.log_start,
326 fsf_req->qtcb->header.log_start, 327 qtcb->header.log_length);
327 fsf_req->qtcb->header.log_length);
328 } 328 }
329 forget_log: 329 forget_log:
330 330
331 /* evaluate FSF Protocol Status */ 331 /* evaluate FSF Protocol Status */
332 switch (fsf_req->qtcb->prefix.prot_status) { 332 switch (qtcb->prefix.prot_status) {
333 333
334 case FSF_PROT_GOOD: 334 case FSF_PROT_GOOD:
335 case FSF_PROT_FSF_STATUS_PRESENTED: 335 case FSF_PROT_FSF_STATUS_PRESENTED:
@@ -340,14 +340,9 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
340 "microcode of version 0x%x, the device driver " 340 "microcode of version 0x%x, the device driver "
341 "only supports 0x%x. Aborting.\n", 341 "only supports 0x%x. Aborting.\n",
342 zfcp_get_busid_by_adapter(adapter), 342 zfcp_get_busid_by_adapter(adapter),
343 fsf_req->qtcb->prefix.prot_status_qual. 343 prot_status_qual->version_error.fsf_version,
344 version_error.fsf_version, ZFCP_QTCB_VERSION); 344 ZFCP_QTCB_VERSION);
345 /* stop operation for this adapter */
346 debug_text_exception(adapter->erp_dbf, 0, "prot_ver_err");
347 zfcp_erp_adapter_shutdown(adapter, 0); 345 zfcp_erp_adapter_shutdown(adapter, 0);
348 zfcp_cmd_dbf_event_fsf("qverserr", fsf_req,
349 &fsf_req->qtcb->prefix.prot_status_qual,
350 sizeof (union fsf_prot_status_qual));
351 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 346 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
352 break; 347 break;
353 348
@@ -355,16 +350,10 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
355 ZFCP_LOG_NORMAL("bug: Sequence number mismatch between " 350 ZFCP_LOG_NORMAL("bug: Sequence number mismatch between "
356 "driver (0x%x) and adapter %s (0x%x). " 351 "driver (0x%x) and adapter %s (0x%x). "
357 "Restarting all operations on this adapter.\n", 352 "Restarting all operations on this adapter.\n",
358 fsf_req->qtcb->prefix.req_seq_no, 353 qtcb->prefix.req_seq_no,
359 zfcp_get_busid_by_adapter(adapter), 354 zfcp_get_busid_by_adapter(adapter),
360 fsf_req->qtcb->prefix.prot_status_qual. 355 prot_status_qual->sequence_error.exp_req_seq_no);
361 sequence_error.exp_req_seq_no);
362 debug_text_exception(adapter->erp_dbf, 0, "prot_seq_err");
363 /* restart operation on this adapter */
364 zfcp_erp_adapter_reopen(adapter, 0); 356 zfcp_erp_adapter_reopen(adapter, 0);
365 zfcp_cmd_dbf_event_fsf("seqnoerr", fsf_req,
366 &fsf_req->qtcb->prefix.prot_status_qual,
367 sizeof (union fsf_prot_status_qual));
368 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; 357 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY;
369 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 358 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
370 break; 359 break;
@@ -375,22 +364,14 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
375 "that used on adapter %s. " 364 "that used on adapter %s. "
376 "Stopping all operations on this adapter.\n", 365 "Stopping all operations on this adapter.\n",
377 zfcp_get_busid_by_adapter(adapter)); 366 zfcp_get_busid_by_adapter(adapter));
378 debug_text_exception(adapter->erp_dbf, 0, "prot_unsup_qtcb");
379 zfcp_erp_adapter_shutdown(adapter, 0); 367 zfcp_erp_adapter_shutdown(adapter, 0);
380 zfcp_cmd_dbf_event_fsf("unsqtcbt", fsf_req,
381 &fsf_req->qtcb->prefix.prot_status_qual,
382 sizeof (union fsf_prot_status_qual));
383 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 368 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
384 break; 369 break;
385 370
386 case FSF_PROT_HOST_CONNECTION_INITIALIZING: 371 case FSF_PROT_HOST_CONNECTION_INITIALIZING:
387 zfcp_cmd_dbf_event_fsf("hconinit", fsf_req,
388 &fsf_req->qtcb->prefix.prot_status_qual,
389 sizeof (union fsf_prot_status_qual));
390 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 372 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
391 atomic_set_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT, 373 atomic_set_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
392 &(adapter->status)); 374 &(adapter->status));
393 debug_text_event(adapter->erp_dbf, 3, "prot_con_init");
394 break; 375 break;
395 376
396 case FSF_PROT_DUPLICATE_REQUEST_ID: 377 case FSF_PROT_DUPLICATE_REQUEST_ID:
@@ -413,11 +394,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
413 fsf_req, 394 fsf_req,
414 zfcp_get_busid_by_adapter(adapter)); 395 zfcp_get_busid_by_adapter(adapter));
415 } 396 }
416 debug_text_exception(adapter->erp_dbf, 0, "prot_dup_id");
417 zfcp_erp_adapter_shutdown(adapter, 0); 397 zfcp_erp_adapter_shutdown(adapter, 0);
418 zfcp_cmd_dbf_event_fsf("dupreqid", fsf_req,
419 &fsf_req->qtcb->prefix.prot_status_qual,
420 sizeof (union fsf_prot_status_qual));
421 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 398 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
422 break; 399 break;
423 400
@@ -483,8 +460,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
483 break; 460 break;
484 461
485 case FSF_PROT_REEST_QUEUE: 462 case FSF_PROT_REEST_QUEUE:
486 debug_text_event(adapter->erp_dbf, 1, "prot_reest_queue"); 463 ZFCP_LOG_NORMAL("The local link to adapter with "
487 ZFCP_LOG_INFO("The local link to adapter with "
488 "%s was re-plugged. " 464 "%s was re-plugged. "
489 "Re-starting operations on this adapter.\n", 465 "Re-starting operations on this adapter.\n",
490 zfcp_get_busid_by_adapter(adapter)); 466 zfcp_get_busid_by_adapter(adapter));
@@ -495,9 +471,6 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
495 zfcp_erp_adapter_reopen(adapter, 471 zfcp_erp_adapter_reopen(adapter,
496 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED 472 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED
497 | ZFCP_STATUS_COMMON_ERP_FAILED); 473 | ZFCP_STATUS_COMMON_ERP_FAILED);
498 zfcp_cmd_dbf_event_fsf("reestque", fsf_req,
499 &fsf_req->qtcb->prefix.prot_status_qual,
500 sizeof (union fsf_prot_status_qual));
501 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 474 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
502 break; 475 break;
503 476
@@ -507,12 +480,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
507 "Restarting all operations on this " 480 "Restarting all operations on this "
508 "adapter.\n", 481 "adapter.\n",
509 zfcp_get_busid_by_adapter(adapter)); 482 zfcp_get_busid_by_adapter(adapter));
510 debug_text_event(adapter->erp_dbf, 0, "prot_err_sta");
511 /* restart operation on this adapter */
512 zfcp_erp_adapter_reopen(adapter, 0); 483 zfcp_erp_adapter_reopen(adapter, 0);
513 zfcp_cmd_dbf_event_fsf("proterrs", fsf_req,
514 &fsf_req->qtcb->prefix.prot_status_qual,
515 sizeof (union fsf_prot_status_qual));
516 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; 484 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY;
517 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 485 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
518 break; 486 break;
@@ -524,11 +492,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
524 "Stopping all operations on this adapter. " 492 "Stopping all operations on this adapter. "
525 "(debug info 0x%x).\n", 493 "(debug info 0x%x).\n",
526 zfcp_get_busid_by_adapter(adapter), 494 zfcp_get_busid_by_adapter(adapter),
527 fsf_req->qtcb->prefix.prot_status); 495 qtcb->prefix.prot_status);
528 debug_text_event(adapter->erp_dbf, 0, "prot_inval:");
529 debug_exception(adapter->erp_dbf, 0,
530 &fsf_req->qtcb->prefix.prot_status,
531 sizeof (u32));
532 zfcp_erp_adapter_shutdown(adapter, 0); 496 zfcp_erp_adapter_shutdown(adapter, 0);
533 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 497 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
534 } 498 }
@@ -568,28 +532,18 @@ zfcp_fsf_fsfstatus_eval(struct zfcp_fsf_req *fsf_req)
568 "(debug info 0x%x).\n", 532 "(debug info 0x%x).\n",
569 zfcp_get_busid_by_adapter(fsf_req->adapter), 533 zfcp_get_busid_by_adapter(fsf_req->adapter),
570 fsf_req->qtcb->header.fsf_command); 534 fsf_req->qtcb->header.fsf_command);
571 debug_text_exception(fsf_req->adapter->erp_dbf, 0,
572 "fsf_s_unknown");
573 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0); 535 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0);
574 zfcp_cmd_dbf_event_fsf("unknownc", fsf_req,
575 &fsf_req->qtcb->header.fsf_status_qual,
576 sizeof (union fsf_status_qual));
577 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 536 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
578 break; 537 break;
579 538
580 case FSF_FCP_RSP_AVAILABLE: 539 case FSF_FCP_RSP_AVAILABLE:
581 ZFCP_LOG_DEBUG("FCP Sense data will be presented to the " 540 ZFCP_LOG_DEBUG("FCP Sense data will be presented to the "
582 "SCSI stack.\n"); 541 "SCSI stack.\n");
583 debug_text_event(fsf_req->adapter->erp_dbf, 3, "fsf_s_rsp");
584 break; 542 break;
585 543
586 case FSF_ADAPTER_STATUS_AVAILABLE: 544 case FSF_ADAPTER_STATUS_AVAILABLE:
587 debug_text_event(fsf_req->adapter->erp_dbf, 2, "fsf_s_astatus");
588 zfcp_fsf_fsfstatus_qual_eval(fsf_req); 545 zfcp_fsf_fsfstatus_qual_eval(fsf_req);
589 break; 546 break;
590
591 default:
592 break;
593 } 547 }
594 548
595 skip_fsfstatus: 549 skip_fsfstatus:
@@ -617,44 +571,28 @@ zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *fsf_req)
617 571
618 switch (fsf_req->qtcb->header.fsf_status_qual.word[0]) { 572 switch (fsf_req->qtcb->header.fsf_status_qual.word[0]) {
619 case FSF_SQ_FCP_RSP_AVAILABLE: 573 case FSF_SQ_FCP_RSP_AVAILABLE:
620 debug_text_event(fsf_req->adapter->erp_dbf, 4, "fsf_sq_rsp");
621 break; 574 break;
622 case FSF_SQ_RETRY_IF_POSSIBLE: 575 case FSF_SQ_RETRY_IF_POSSIBLE:
623 /* The SCSI-stack may now issue retries or escalate */ 576 /* The SCSI-stack may now issue retries or escalate */
624 debug_text_event(fsf_req->adapter->erp_dbf, 2, "fsf_sq_retry");
625 zfcp_cmd_dbf_event_fsf("sqretry", fsf_req,
626 &fsf_req->qtcb->header.fsf_status_qual,
627 sizeof (union fsf_status_qual));
628 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 577 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
629 break; 578 break;
630 case FSF_SQ_COMMAND_ABORTED: 579 case FSF_SQ_COMMAND_ABORTED:
631 /* Carry the aborted state on to upper layer */ 580 /* Carry the aborted state on to upper layer */
632 debug_text_event(fsf_req->adapter->erp_dbf, 2, "fsf_sq_abort");
633 zfcp_cmd_dbf_event_fsf("sqabort", fsf_req,
634 &fsf_req->qtcb->header.fsf_status_qual,
635 sizeof (union fsf_status_qual));
636 fsf_req->status |= ZFCP_STATUS_FSFREQ_ABORTED; 581 fsf_req->status |= ZFCP_STATUS_FSFREQ_ABORTED;
637 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 582 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
638 break; 583 break;
639 case FSF_SQ_NO_RECOM: 584 case FSF_SQ_NO_RECOM:
640 debug_text_exception(fsf_req->adapter->erp_dbf, 0,
641 "fsf_sq_no_rec");
642 ZFCP_LOG_NORMAL("bug: No recommendation could be given for a" 585 ZFCP_LOG_NORMAL("bug: No recommendation could be given for a"
643 "problem on the adapter %s " 586 "problem on the adapter %s "
644 "Stopping all operations on this adapter. ", 587 "Stopping all operations on this adapter. ",
645 zfcp_get_busid_by_adapter(fsf_req->adapter)); 588 zfcp_get_busid_by_adapter(fsf_req->adapter));
646 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0); 589 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0);
647 zfcp_cmd_dbf_event_fsf("sqnrecom", fsf_req,
648 &fsf_req->qtcb->header.fsf_status_qual,
649 sizeof (union fsf_status_qual));
650 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 590 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
651 break; 591 break;
652 case FSF_SQ_ULP_PROGRAMMING_ERROR: 592 case FSF_SQ_ULP_PROGRAMMING_ERROR:
653 ZFCP_LOG_NORMAL("error: not enough SBALs for data transfer " 593 ZFCP_LOG_NORMAL("error: not enough SBALs for data transfer "
654 "(adapter %s)\n", 594 "(adapter %s)\n",
655 zfcp_get_busid_by_adapter(fsf_req->adapter)); 595 zfcp_get_busid_by_adapter(fsf_req->adapter));
656 debug_text_exception(fsf_req->adapter->erp_dbf, 0,
657 "fsf_sq_ulp_err");
658 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 596 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
659 break; 597 break;
660 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: 598 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE:
@@ -668,13 +606,6 @@ zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *fsf_req)
668 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL, 606 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
669 (char *) &fsf_req->qtcb->header.fsf_status_qual, 607 (char *) &fsf_req->qtcb->header.fsf_status_qual,
670 sizeof (union fsf_status_qual)); 608 sizeof (union fsf_status_qual));
671 debug_text_event(fsf_req->adapter->erp_dbf, 0, "fsf_sq_inval:");
672 debug_exception(fsf_req->adapter->erp_dbf, 0,
673 &fsf_req->qtcb->header.fsf_status_qual.word[0],
674 sizeof (u32));
675 zfcp_cmd_dbf_event_fsf("squndef", fsf_req,
676 &fsf_req->qtcb->header.fsf_status_qual,
677 sizeof (union fsf_status_qual));
678 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 609 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
679 break; 610 break;
680 } 611 }
@@ -696,11 +627,6 @@ zfcp_fsf_req_dispatch(struct zfcp_fsf_req *fsf_req)
696 struct zfcp_adapter *adapter = fsf_req->adapter; 627 struct zfcp_adapter *adapter = fsf_req->adapter;
697 int retval = 0; 628 int retval = 0;
698 629
699 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
700 ZFCP_LOG_TRACE("fsf_req=%p, QTCB=%p\n", fsf_req, fsf_req->qtcb);
701 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE,
702 (char *) fsf_req->qtcb, sizeof(struct fsf_qtcb));
703 }
704 630
705 switch (fsf_req->fsf_command) { 631 switch (fsf_req->fsf_command) {
706 632
@@ -760,13 +686,13 @@ zfcp_fsf_req_dispatch(struct zfcp_fsf_req *fsf_req)
760 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 686 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
761 ZFCP_LOG_NORMAL("bug: Command issued by the device driver is " 687 ZFCP_LOG_NORMAL("bug: Command issued by the device driver is "
762 "not supported by the adapter %s\n", 688 "not supported by the adapter %s\n",
763 zfcp_get_busid_by_adapter(fsf_req->adapter)); 689 zfcp_get_busid_by_adapter(adapter));
764 if (fsf_req->fsf_command != fsf_req->qtcb->header.fsf_command) 690 if (fsf_req->fsf_command != fsf_req->qtcb->header.fsf_command)
765 ZFCP_LOG_NORMAL 691 ZFCP_LOG_NORMAL
766 ("bug: Command issued by the device driver differs " 692 ("bug: Command issued by the device driver differs "
767 "from the command returned by the adapter %s " 693 "from the command returned by the adapter %s "
768 "(debug info 0x%x, 0x%x).\n", 694 "(debug info 0x%x, 0x%x).\n",
769 zfcp_get_busid_by_adapter(fsf_req->adapter), 695 zfcp_get_busid_by_adapter(adapter),
770 fsf_req->fsf_command, 696 fsf_req->fsf_command,
771 fsf_req->qtcb->header.fsf_command); 697 fsf_req->qtcb->header.fsf_command);
772 } 698 }
@@ -774,8 +700,6 @@ zfcp_fsf_req_dispatch(struct zfcp_fsf_req *fsf_req)
774 if (!erp_action) 700 if (!erp_action)
775 return retval; 701 return retval;
776 702
777 debug_text_event(adapter->erp_dbf, 3, "a_frh");
778 debug_event(adapter->erp_dbf, 3, &erp_action->action, sizeof (int));
779 zfcp_erp_async_handler(erp_action, 0); 703 zfcp_erp_async_handler(erp_action, 0);
780 704
781 return retval; 705 return retval;
@@ -846,6 +770,7 @@ zfcp_fsf_status_read(struct zfcp_adapter *adapter, int req_flags)
846 failed_buf: 770 failed_buf:
847 zfcp_fsf_req_free(fsf_req); 771 zfcp_fsf_req_free(fsf_req);
848 failed_req_create: 772 failed_req_create:
773 zfcp_hba_dbf_event_fsf_unsol("fail", adapter, NULL);
849 out: 774 out:
850 write_unlock_irqrestore(&adapter->request_queue.queue_lock, lock_flags); 775 write_unlock_irqrestore(&adapter->request_queue.queue_lock, lock_flags);
851 return retval; 776 return retval;
@@ -921,35 +846,30 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
921 (struct fsf_status_read_buffer *) fsf_req->data; 846 (struct fsf_status_read_buffer *) fsf_req->data;
922 847
923 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { 848 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) {
849 zfcp_hba_dbf_event_fsf_unsol("dism", adapter, status_buffer);
924 mempool_free(status_buffer, adapter->pool.data_status_read); 850 mempool_free(status_buffer, adapter->pool.data_status_read);
925 zfcp_fsf_req_free(fsf_req); 851 zfcp_fsf_req_free(fsf_req);
926 goto out; 852 goto out;
927 } 853 }
928 854
855 zfcp_hba_dbf_event_fsf_unsol("read", adapter, status_buffer);
856
929 switch (status_buffer->status_type) { 857 switch (status_buffer->status_type) {
930 858
931 case FSF_STATUS_READ_PORT_CLOSED: 859 case FSF_STATUS_READ_PORT_CLOSED:
932 debug_text_event(adapter->erp_dbf, 3, "unsol_pclosed:");
933 debug_event(adapter->erp_dbf, 3,
934 &status_buffer->d_id, sizeof (u32));
935 zfcp_fsf_status_read_port_closed(fsf_req); 860 zfcp_fsf_status_read_port_closed(fsf_req);
936 break; 861 break;
937 862
938 case FSF_STATUS_READ_INCOMING_ELS: 863 case FSF_STATUS_READ_INCOMING_ELS:
939 debug_text_event(adapter->erp_dbf, 3, "unsol_els:");
940 zfcp_fsf_incoming_els(fsf_req); 864 zfcp_fsf_incoming_els(fsf_req);
941 break; 865 break;
942 866
943 case FSF_STATUS_READ_SENSE_DATA_AVAIL: 867 case FSF_STATUS_READ_SENSE_DATA_AVAIL:
944 debug_text_event(adapter->erp_dbf, 3, "unsol_sense:");
945 ZFCP_LOG_INFO("unsolicited sense data received (adapter %s)\n", 868 ZFCP_LOG_INFO("unsolicited sense data received (adapter %s)\n",
946 zfcp_get_busid_by_adapter(adapter)); 869 zfcp_get_busid_by_adapter(adapter));
947 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL, (char *) status_buffer,
948 sizeof(struct fsf_status_read_buffer));
949 break; 870 break;
950 871
951 case FSF_STATUS_READ_BIT_ERROR_THRESHOLD: 872 case FSF_STATUS_READ_BIT_ERROR_THRESHOLD:
952 debug_text_event(adapter->erp_dbf, 3, "unsol_bit_err:");
953 ZFCP_LOG_NORMAL("Bit error threshold data received:\n"); 873 ZFCP_LOG_NORMAL("Bit error threshold data received:\n");
954 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL, 874 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
955 (char *) status_buffer, 875 (char *) status_buffer,
@@ -980,35 +900,30 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
980 break; 900 break;
981 901
982 case FSF_STATUS_READ_CFDC_UPDATED: 902 case FSF_STATUS_READ_CFDC_UPDATED:
983 debug_text_event(adapter->erp_dbf, 2, "unsol_cfdc_update:"); 903 ZFCP_LOG_NORMAL("CFDC has been updated on the adapter %s\n",
984 ZFCP_LOG_INFO("CFDC has been updated on the adapter %s\n",
985 zfcp_get_busid_by_adapter(adapter)); 904 zfcp_get_busid_by_adapter(adapter));
986 zfcp_erp_adapter_access_changed(adapter); 905 zfcp_erp_adapter_access_changed(adapter);
987 break; 906 break;
988 907
989 case FSF_STATUS_READ_CFDC_HARDENED: 908 case FSF_STATUS_READ_CFDC_HARDENED:
990 debug_text_event(adapter->erp_dbf, 2, "unsol_cfdc_harden:");
991 switch (status_buffer->status_subtype) { 909 switch (status_buffer->status_subtype) {
992 case FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE: 910 case FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE:
993 ZFCP_LOG_INFO("CFDC of adapter %s saved on SE\n", 911 ZFCP_LOG_NORMAL("CFDC of adapter %s saved on SE\n",
994 zfcp_get_busid_by_adapter(adapter)); 912 zfcp_get_busid_by_adapter(adapter));
995 break; 913 break;
996 case FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE2: 914 case FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE2:
997 ZFCP_LOG_INFO("CFDC of adapter %s has been copied " 915 ZFCP_LOG_NORMAL("CFDC of adapter %s has been copied "
998 "to the secondary SE\n", 916 "to the secondary SE\n",
999 zfcp_get_busid_by_adapter(adapter)); 917 zfcp_get_busid_by_adapter(adapter));
1000 break; 918 break;
1001 default: 919 default:
1002 ZFCP_LOG_INFO("CFDC of adapter %s has been hardened\n", 920 ZFCP_LOG_NORMAL("CFDC of adapter %s has been hardened\n",
1003 zfcp_get_busid_by_adapter(adapter)); 921 zfcp_get_busid_by_adapter(adapter));
1004 } 922 }
1005 break; 923 break;
1006 924
1007 default: 925 default:
1008 debug_text_event(adapter->erp_dbf, 0, "unsol_unknown:"); 926 ZFCP_LOG_NORMAL("warning: An unsolicited status packet of unknown "
1009 debug_exception(adapter->erp_dbf, 0,
1010 &status_buffer->status_type, sizeof (u32));
1011 ZFCP_LOG_NORMAL("bug: An unsolicited status packet of unknown "
1012 "type was received (debug info 0x%x)\n", 927 "type was received (debug info 0x%x)\n",
1013 status_buffer->status_type); 928 status_buffer->status_type);
1014 ZFCP_LOG_DEBUG("Dump of status_read_buffer %p:\n", 929 ZFCP_LOG_DEBUG("Dump of status_read_buffer %p:\n",
@@ -1418,6 +1333,8 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1418 fsf_req->qtcb->bottom.support.timeout = ct->timeout; 1333 fsf_req->qtcb->bottom.support.timeout = ct->timeout;
1419 fsf_req->data = (unsigned long) ct; 1334 fsf_req->data = (unsigned long) ct;
1420 1335
1336 zfcp_san_dbf_event_ct_request(fsf_req);
1337
1421 /* start QDIO request for this FSF request */ 1338 /* start QDIO request for this FSF request */
1422 ret = zfcp_fsf_req_send(fsf_req, ct->timer); 1339 ret = zfcp_fsf_req_send(fsf_req, ct->timer);
1423 if (ret) { 1340 if (ret) {
@@ -1476,6 +1393,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1476 switch (header->fsf_status) { 1393 switch (header->fsf_status) {
1477 1394
1478 case FSF_GOOD: 1395 case FSF_GOOD:
1396 zfcp_san_dbf_event_ct_response(fsf_req);
1479 retval = 0; 1397 retval = 0;
1480 break; 1398 break;
1481 1399
@@ -1720,6 +1638,8 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1720 1638
1721 sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0); 1639 sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0);
1722 1640
1641 zfcp_san_dbf_event_els_request(fsf_req);
1642
1723 /* start QDIO request for this FSF request */ 1643 /* start QDIO request for this FSF request */
1724 ret = zfcp_fsf_req_send(fsf_req, els->timer); 1644 ret = zfcp_fsf_req_send(fsf_req, els->timer);
1725 if (ret) { 1645 if (ret) {
@@ -1777,6 +1697,7 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
1777 switch (header->fsf_status) { 1697 switch (header->fsf_status) {
1778 1698
1779 case FSF_GOOD: 1699 case FSF_GOOD:
1700 zfcp_san_dbf_event_els_response(fsf_req);
1780 retval = 0; 1701 retval = 0;
1781 break; 1702 break;
1782 1703
@@ -3309,9 +3230,6 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req)
3309 debug_text_event(fsf_req->adapter->erp_dbf, 1, 3230 debug_text_event(fsf_req->adapter->erp_dbf, 1,
3310 "fsf_s_phand_nv"); 3231 "fsf_s_phand_nv");
3311 zfcp_erp_adapter_reopen(unit->port->adapter, 0); 3232 zfcp_erp_adapter_reopen(unit->port->adapter, 0);
3312 zfcp_cmd_dbf_event_fsf("porthinv", fsf_req,
3313 &fsf_req->qtcb->header.fsf_status_qual,
3314 sizeof (union fsf_status_qual));
3315 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3233 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3316 break; 3234 break;
3317 3235
@@ -3330,9 +3248,6 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req)
3330 debug_text_event(fsf_req->adapter->erp_dbf, 1, 3248 debug_text_event(fsf_req->adapter->erp_dbf, 1,
3331 "fsf_s_lhand_nv"); 3249 "fsf_s_lhand_nv");
3332 zfcp_erp_port_reopen(unit->port, 0); 3250 zfcp_erp_port_reopen(unit->port, 0);
3333 zfcp_cmd_dbf_event_fsf("lunhinv", fsf_req,
3334 &fsf_req->qtcb->header.fsf_status_qual,
3335 sizeof (union fsf_status_qual));
3336 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3251 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3337 break; 3252 break;
3338 3253
@@ -3763,10 +3678,6 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3763 debug_text_event(fsf_req->adapter->erp_dbf, 1, 3678 debug_text_event(fsf_req->adapter->erp_dbf, 1,
3764 "fsf_s_hand_mis"); 3679 "fsf_s_hand_mis");
3765 zfcp_erp_adapter_reopen(unit->port->adapter, 0); 3680 zfcp_erp_adapter_reopen(unit->port->adapter, 0);
3766 zfcp_cmd_dbf_event_fsf("handmism",
3767 fsf_req,
3768 &header->fsf_status_qual,
3769 sizeof (union fsf_status_qual));
3770 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3681 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3771 break; 3682 break;
3772 3683
@@ -3787,10 +3698,6 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3787 debug_text_exception(fsf_req->adapter->erp_dbf, 0, 3698 debug_text_exception(fsf_req->adapter->erp_dbf, 0,
3788 "fsf_s_class_nsup"); 3699 "fsf_s_class_nsup");
3789 zfcp_erp_adapter_shutdown(unit->port->adapter, 0); 3700 zfcp_erp_adapter_shutdown(unit->port->adapter, 0);
3790 zfcp_cmd_dbf_event_fsf("unsclass",
3791 fsf_req,
3792 &header->fsf_status_qual,
3793 sizeof (union fsf_status_qual));
3794 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3701 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3795 break; 3702 break;
3796 3703
@@ -3809,10 +3716,6 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3809 debug_text_event(fsf_req->adapter->erp_dbf, 1, 3716 debug_text_event(fsf_req->adapter->erp_dbf, 1,
3810 "fsf_s_fcp_lun_nv"); 3717 "fsf_s_fcp_lun_nv");
3811 zfcp_erp_port_reopen(unit->port, 0); 3718 zfcp_erp_port_reopen(unit->port, 0);
3812 zfcp_cmd_dbf_event_fsf("fluninv",
3813 fsf_req,
3814 &header->fsf_status_qual,
3815 sizeof (union fsf_status_qual));
3816 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3719 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3817 break; 3720 break;
3818 3721
@@ -3851,10 +3754,6 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3851 debug_text_event(fsf_req->adapter->erp_dbf, 0, 3754 debug_text_event(fsf_req->adapter->erp_dbf, 0,
3852 "fsf_s_dir_ind_nv"); 3755 "fsf_s_dir_ind_nv");
3853 zfcp_erp_adapter_shutdown(unit->port->adapter, 0); 3756 zfcp_erp_adapter_shutdown(unit->port->adapter, 0);
3854 zfcp_cmd_dbf_event_fsf("dirinv",
3855 fsf_req,
3856 &header->fsf_status_qual,
3857 sizeof (union fsf_status_qual));
3858 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3757 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3859 break; 3758 break;
3860 3759
@@ -3870,10 +3769,6 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3870 debug_text_event(fsf_req->adapter->erp_dbf, 0, 3769 debug_text_event(fsf_req->adapter->erp_dbf, 0,
3871 "fsf_s_cmd_len_nv"); 3770 "fsf_s_cmd_len_nv");
3872 zfcp_erp_adapter_shutdown(unit->port->adapter, 0); 3771 zfcp_erp_adapter_shutdown(unit->port->adapter, 0);
3873 zfcp_cmd_dbf_event_fsf("cleninv",
3874 fsf_req,
3875 &header->fsf_status_qual,
3876 sizeof (union fsf_status_qual));
3877 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3772 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3878 break; 3773 break;
3879 3774
@@ -4043,7 +3938,6 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
4043 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, 3938 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
4044 (char *) &fsf_req->qtcb-> 3939 (char *) &fsf_req->qtcb->
4045 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE); 3940 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
4046 zfcp_cmd_dbf_event_fsf("clenmis", fsf_req, NULL, 0);
4047 set_host_byte(&scpnt->result, DID_ERROR); 3941 set_host_byte(&scpnt->result, DID_ERROR);
4048 goto skip_fsfstatus; 3942 goto skip_fsfstatus;
4049 case RSP_CODE_FIELD_INVALID: 3943 case RSP_CODE_FIELD_INVALID:
@@ -4062,7 +3956,6 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
4062 (char *) &fsf_req->qtcb-> 3956 (char *) &fsf_req->qtcb->
4063 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE); 3957 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
4064 set_host_byte(&scpnt->result, DID_ERROR); 3958 set_host_byte(&scpnt->result, DID_ERROR);
4065 zfcp_cmd_dbf_event_fsf("codeinv", fsf_req, NULL, 0);
4066 goto skip_fsfstatus; 3959 goto skip_fsfstatus;
4067 case RSP_CODE_RO_MISMATCH: 3960 case RSP_CODE_RO_MISMATCH:
4068 /* hardware bug */ 3961 /* hardware bug */
@@ -4079,7 +3972,6 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
4079 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, 3972 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
4080 (char *) &fsf_req->qtcb-> 3973 (char *) &fsf_req->qtcb->
4081 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE); 3974 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
4082 zfcp_cmd_dbf_event_fsf("codemism", fsf_req, NULL, 0);
4083 set_host_byte(&scpnt->result, DID_ERROR); 3975 set_host_byte(&scpnt->result, DID_ERROR);
4084 goto skip_fsfstatus; 3976 goto skip_fsfstatus;
4085 default: 3977 default:
@@ -4096,7 +3988,6 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
4096 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, 3988 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
4097 (char *) &fsf_req->qtcb-> 3989 (char *) &fsf_req->qtcb->
4098 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE); 3990 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
4099 zfcp_cmd_dbf_event_fsf("undeffcp", fsf_req, NULL, 0);
4100 set_host_byte(&scpnt->result, DID_ERROR); 3991 set_host_byte(&scpnt->result, DID_ERROR);
4101 goto skip_fsfstatus; 3992 goto skip_fsfstatus;
4102 } 3993 }
@@ -4158,19 +4049,17 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
4158 skip_fsfstatus: 4049 skip_fsfstatus:
4159 ZFCP_LOG_DEBUG("scpnt->result =0x%x\n", scpnt->result); 4050 ZFCP_LOG_DEBUG("scpnt->result =0x%x\n", scpnt->result);
4160 4051
4161 zfcp_cmd_dbf_event_scsi("response", scpnt); 4052 if (scpnt->result != 0)
4053 zfcp_scsi_dbf_event_result("erro", 3, fsf_req->adapter, scpnt);
4054 else if (scpnt->retries > 0)
4055 zfcp_scsi_dbf_event_result("retr", 4, fsf_req->adapter, scpnt);
4056 else
4057 zfcp_scsi_dbf_event_result("norm", 6, fsf_req->adapter, scpnt);
4162 4058
4163 /* cleanup pointer (need this especially for abort) */ 4059 /* cleanup pointer (need this especially for abort) */
4164 scpnt->host_scribble = NULL; 4060 scpnt->host_scribble = NULL;
4165 4061
4166 /*
4167 * NOTE:
4168 * according to the outcome of a discussion on linux-scsi we
4169 * don't need to grab the io_request_lock here since we use
4170 * the new eh
4171 */
4172 /* always call back */ 4062 /* always call back */
4173
4174 (scpnt->scsi_done) (scpnt); 4063 (scpnt->scsi_done) (scpnt);
4175 4064
4176 /* 4065 /*
@@ -4563,15 +4452,16 @@ zfcp_fsf_req_sbal_check(unsigned long *flags,
4563 * set qtcb pointer in fsf_req and initialize QTCB 4452 * set qtcb pointer in fsf_req and initialize QTCB
4564 */ 4453 */
4565static inline void 4454static inline void
4566zfcp_fsf_req_qtcb_init(struct zfcp_fsf_req *fsf_req, u32 fsf_cmd) 4455zfcp_fsf_req_qtcb_init(struct zfcp_fsf_req *fsf_req)
4567{ 4456{
4568 if (likely(fsf_req->qtcb != NULL)) { 4457 if (likely(fsf_req->qtcb != NULL)) {
4458 fsf_req->qtcb->prefix.req_seq_no = fsf_req->adapter->fsf_req_seq_no;
4569 fsf_req->qtcb->prefix.req_id = (unsigned long)fsf_req; 4459 fsf_req->qtcb->prefix.req_id = (unsigned long)fsf_req;
4570 fsf_req->qtcb->prefix.ulp_info = ZFCP_ULP_INFO_VERSION; 4460 fsf_req->qtcb->prefix.ulp_info = ZFCP_ULP_INFO_VERSION;
4571 fsf_req->qtcb->prefix.qtcb_type = fsf_qtcb_type[fsf_cmd]; 4461 fsf_req->qtcb->prefix.qtcb_type = fsf_qtcb_type[fsf_req->fsf_command];
4572 fsf_req->qtcb->prefix.qtcb_version = ZFCP_QTCB_VERSION; 4462 fsf_req->qtcb->prefix.qtcb_version = ZFCP_QTCB_VERSION;
4573 fsf_req->qtcb->header.req_handle = (unsigned long)fsf_req; 4463 fsf_req->qtcb->header.req_handle = (unsigned long)fsf_req;
4574 fsf_req->qtcb->header.fsf_command = fsf_cmd; 4464 fsf_req->qtcb->header.fsf_command = fsf_req->fsf_command;
4575 } 4465 }
4576} 4466}
4577 4467
@@ -4639,7 +4529,10 @@ zfcp_fsf_req_create(struct zfcp_adapter *adapter, u32 fsf_cmd, int req_flags,
4639 goto failed_fsf_req; 4529 goto failed_fsf_req;
4640 } 4530 }
4641 4531
4642 zfcp_fsf_req_qtcb_init(fsf_req, fsf_cmd); 4532 fsf_req->adapter = adapter;
4533 fsf_req->fsf_command = fsf_cmd;
4534
4535 zfcp_fsf_req_qtcb_init(fsf_req);
4643 4536
4644 /* initialize waitqueue which may be used to wait on 4537 /* initialize waitqueue which may be used to wait on
4645 this request completion */ 4538 this request completion */
@@ -4661,8 +4554,10 @@ zfcp_fsf_req_create(struct zfcp_adapter *adapter, u32 fsf_cmd, int req_flags,
4661 goto failed_sbals; 4554 goto failed_sbals;
4662 } 4555 }
4663 4556
4664 fsf_req->adapter = adapter; /* pointer to "parent" adapter */ 4557 if (fsf_req->qtcb) {
4665 fsf_req->fsf_command = fsf_cmd; 4558 fsf_req->seq_no = adapter->fsf_req_seq_no;
4559 fsf_req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no;
4560 }
4666 fsf_req->sbal_number = 1; 4561 fsf_req->sbal_number = 1;
4667 fsf_req->sbal_first = req_queue->free_index; 4562 fsf_req->sbal_first = req_queue->free_index;
4668 fsf_req->sbal_curr = req_queue->free_index; 4563 fsf_req->sbal_curr = req_queue->free_index;
@@ -4713,9 +4608,9 @@ zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req, struct timer_list *timer)
4713 struct zfcp_adapter *adapter; 4608 struct zfcp_adapter *adapter;
4714 struct zfcp_qdio_queue *req_queue; 4609 struct zfcp_qdio_queue *req_queue;
4715 volatile struct qdio_buffer_element *sbale; 4610 volatile struct qdio_buffer_element *sbale;
4611 int inc_seq_no;
4716 int new_distance_from_int; 4612 int new_distance_from_int;
4717 unsigned long flags; 4613 unsigned long flags;
4718 int inc_seq_no = 1;
4719 int retval = 0; 4614 int retval = 0;
4720 4615
4721 adapter = fsf_req->adapter; 4616 adapter = fsf_req->adapter;
@@ -4729,23 +4624,13 @@ zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req, struct timer_list *timer)
4729 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE, (char *) sbale[1].addr, 4624 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE, (char *) sbale[1].addr,
4730 sbale[1].length); 4625 sbale[1].length);
4731 4626
4732 /* set sequence counter in QTCB */
4733 if (likely(fsf_req->qtcb)) {
4734 fsf_req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no;
4735 fsf_req->seq_no = adapter->fsf_req_seq_no;
4736 ZFCP_LOG_TRACE("FSF request %p of adapter %s gets "
4737 "FSF sequence counter value of %i\n",
4738 fsf_req,
4739 zfcp_get_busid_by_adapter(adapter),
4740 fsf_req->qtcb->prefix.req_seq_no);
4741 } else
4742 inc_seq_no = 0;
4743
4744 /* put allocated FSF request at list tail */ 4627 /* put allocated FSF request at list tail */
4745 spin_lock_irqsave(&adapter->fsf_req_list_lock, flags); 4628 spin_lock_irqsave(&adapter->fsf_req_list_lock, flags);
4746 list_add_tail(&fsf_req->list, &adapter->fsf_req_list_head); 4629 list_add_tail(&fsf_req->list, &adapter->fsf_req_list_head);
4747 spin_unlock_irqrestore(&adapter->fsf_req_list_lock, flags); 4630 spin_unlock_irqrestore(&adapter->fsf_req_list_lock, flags);
4748 4631
4632 inc_seq_no = (fsf_req->qtcb != NULL);
4633
4749 /* figure out expiration time of timeout and start timeout */ 4634 /* figure out expiration time of timeout and start timeout */
4750 if (unlikely(timer)) { 4635 if (unlikely(timer)) {
4751 timer->expires += jiffies; 4636 timer->expires += jiffies;
@@ -4775,6 +4660,8 @@ zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req, struct timer_list *timer)
4775 req_queue->free_index %= QDIO_MAX_BUFFERS_PER_Q; /* wrap if needed */ 4660 req_queue->free_index %= QDIO_MAX_BUFFERS_PER_Q; /* wrap if needed */
4776 new_distance_from_int = zfcp_qdio_determine_pci(req_queue, fsf_req); 4661 new_distance_from_int = zfcp_qdio_determine_pci(req_queue, fsf_req);
4777 4662
4663 fsf_req->issued = get_clock();
4664
4778 retval = do_QDIO(adapter->ccw_device, 4665 retval = do_QDIO(adapter->ccw_device,
4779 QDIO_FLAG_SYNC_OUTPUT, 4666 QDIO_FLAG_SYNC_OUTPUT,
4780 0, fsf_req->sbal_first, fsf_req->sbal_number, NULL); 4667 0, fsf_req->sbal_first, fsf_req->sbal_number, NULL);
@@ -4813,15 +4700,11 @@ zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req, struct timer_list *timer)
4813 * routines resulting in missing sequence counter values 4700 * routines resulting in missing sequence counter values
4814 * otherwise, 4701 * otherwise,
4815 */ 4702 */
4703
4816 /* Don't increase for unsolicited status */ 4704 /* Don't increase for unsolicited status */
4817 if (likely(inc_seq_no)) { 4705 if (inc_seq_no)
4818 adapter->fsf_req_seq_no++; 4706 adapter->fsf_req_seq_no++;
4819 ZFCP_LOG_TRACE 4707
4820 ("FSF sequence counter value of adapter %s "
4821 "increased to %i\n",
4822 zfcp_get_busid_by_adapter(adapter),
4823 adapter->fsf_req_seq_no);
4824 }
4825 /* count FSF requests pending */ 4708 /* count FSF requests pending */
4826 atomic_inc(&adapter->fsf_reqs_active); 4709 atomic_inc(&adapter->fsf_reqs_active);
4827 } 4710 }