diff options
author | James Smart <James.Smart@Emulex.Com> | 2007-06-17 20:56:39 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-06-17 23:38:11 -0400 |
commit | 858c9f6c19c6f9bf86cbbc64ce0d17c61d6131b8 (patch) | |
tree | 9591b15b4424066023e375ad0aa33fdd37e1c452 /drivers/scsi/lpfc/lpfc_ct.c | |
parent | 92d7f7b0cde3ad2260e7462b40867b57efd49851 (diff) |
[SCSI] lpfc: bug fixes
Following the NPIV support, the following changes have been accumulated
in the testing and qualification of the driver:
- Fix affinity of ELS ring to slow/deferred event processing
- Fix Ring attention masks
- Defer dev_loss_tmo timeout handling to worker thread
- Consolidate link down error classification for better error checking
- Remove unused/deprecated nlp_initiator_tmr timer
- Fix for async scan - move adapter init code back into pci_probe_one
context. Fix async scan interfaces.
- Expand validation of ability to create vports
- Extract VPI resource cnt from firmware
- Tuning of Login/Reject policies to better deal with overwhelmned targets
- Misc ELS and discovery fixes
- Export the npiv_enable attribute to sysfs
- Mailbox handling fix
- Add debugfs support
- A few other small misc fixes:
- wrong return values, double-frees, bad locking
- Added adapter failure heartbeat
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_ct.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_ct.c | 217 |
1 files changed, 164 insertions, 53 deletions
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 5584f395314c..ae9d6f385a6c 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include "lpfc_crtn.h" | 41 | #include "lpfc_crtn.h" |
42 | #include "lpfc_version.h" | 42 | #include "lpfc_version.h" |
43 | #include "lpfc_vport.h" | 43 | #include "lpfc_vport.h" |
44 | #include "lpfc_debugfs.h" | ||
44 | 45 | ||
45 | #define HBA_PORTSPEED_UNKNOWN 0 /* Unknown - transceiver | 46 | #define HBA_PORTSPEED_UNKNOWN 0 /* Unknown - transceiver |
46 | * incapable of reporting */ | 47 | * incapable of reporting */ |
@@ -251,6 +252,32 @@ lpfc_alloc_ct_rsp(struct lpfc_hba *phba, int cmdcode, struct ulp_bde64 *bpl, | |||
251 | return mlist; | 252 | return mlist; |
252 | } | 253 | } |
253 | 254 | ||
255 | int | ||
256 | lpfc_ct_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *ctiocb) | ||
257 | { | ||
258 | struct lpfc_dmabuf *buf_ptr; | ||
259 | |||
260 | if (ctiocb->context1) { | ||
261 | buf_ptr = (struct lpfc_dmabuf *) ctiocb->context1; | ||
262 | lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); | ||
263 | kfree(buf_ptr); | ||
264 | ctiocb->context1 = NULL; | ||
265 | } | ||
266 | if (ctiocb->context2) { | ||
267 | lpfc_free_ct_rsp(phba, (struct lpfc_dmabuf *) ctiocb->context2); | ||
268 | ctiocb->context2 = NULL; | ||
269 | } | ||
270 | |||
271 | if (ctiocb->context3) { | ||
272 | buf_ptr = (struct lpfc_dmabuf *) ctiocb->context3; | ||
273 | lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); | ||
274 | kfree(buf_ptr); | ||
275 | ctiocb->context1 = NULL; | ||
276 | } | ||
277 | lpfc_sli_release_iocbq(phba, ctiocb); | ||
278 | return 0; | ||
279 | } | ||
280 | |||
254 | static int | 281 | static int |
255 | lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, | 282 | lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, |
256 | struct lpfc_dmabuf *inp, struct lpfc_dmabuf *outp, | 283 | struct lpfc_dmabuf *inp, struct lpfc_dmabuf *outp, |
@@ -428,6 +455,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
428 | (!phba->cfg_vport_restrict_login)) { | 455 | (!phba->cfg_vport_restrict_login)) { |
429 | ndlp = lpfc_setup_disc_node(vport, Did); | 456 | ndlp = lpfc_setup_disc_node(vport, Did); |
430 | if (ndlp) { | 457 | if (ndlp) { |
458 | lpfc_debugfs_disc_trc(vport, | ||
459 | LPFC_DISC_TRC_CT, | ||
460 | "Parse GID_FTrsp: " | ||
461 | "did:x%x flg:x%x x%x", | ||
462 | Did, ndlp->nlp_flag, | ||
463 | vport->fc_flag); | ||
464 | |||
431 | lpfc_printf_log(phba, KERN_INFO, | 465 | lpfc_printf_log(phba, KERN_INFO, |
432 | LOG_DISCOVERY, | 466 | LOG_DISCOVERY, |
433 | "%d (%d):0238 Process " | 467 | "%d (%d):0238 Process " |
@@ -439,6 +473,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
439 | vport->fc_flag, | 473 | vport->fc_flag, |
440 | vport->fc_rscn_id_cnt); | 474 | vport->fc_rscn_id_cnt); |
441 | } else { | 475 | } else { |
476 | lpfc_debugfs_disc_trc(vport, | ||
477 | LPFC_DISC_TRC_CT, | ||
478 | "Skip1 GID_FTrsp: " | ||
479 | "did:x%x flg:x%x cnt:%d", | ||
480 | Did, vport->fc_flag, | ||
481 | vport->fc_rscn_id_cnt); | ||
482 | |||
442 | lpfc_printf_log(phba, KERN_INFO, | 483 | lpfc_printf_log(phba, KERN_INFO, |
443 | LOG_DISCOVERY, | 484 | LOG_DISCOVERY, |
444 | "%d (%d):0239 Skip x%x " | 485 | "%d (%d):0239 Skip x%x " |
@@ -453,12 +494,26 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
453 | } else { | 494 | } else { |
454 | if (!(vport->fc_flag & FC_RSCN_MODE) || | 495 | if (!(vport->fc_flag & FC_RSCN_MODE) || |
455 | (lpfc_rscn_payload_check(vport, Did))) { | 496 | (lpfc_rscn_payload_check(vport, Did))) { |
497 | lpfc_debugfs_disc_trc(vport, | ||
498 | LPFC_DISC_TRC_CT, | ||
499 | "Query GID_FTrsp: " | ||
500 | "did:x%x flg:x%x cnt:%d", | ||
501 | Did, vport->fc_flag, | ||
502 | vport->fc_rscn_id_cnt); | ||
503 | |||
456 | if (lpfc_ns_cmd(vport, | 504 | if (lpfc_ns_cmd(vport, |
457 | SLI_CTNS_GFF_ID, | 505 | SLI_CTNS_GFF_ID, |
458 | 0, Did) == 0) | 506 | 0, Did) == 0) |
459 | vport->num_disc_nodes++; | 507 | vport->num_disc_nodes++; |
460 | } | 508 | } |
461 | else { | 509 | else { |
510 | lpfc_debugfs_disc_trc(vport, | ||
511 | LPFC_DISC_TRC_CT, | ||
512 | "Skip2 GID_FTrsp: " | ||
513 | "did:x%x flg:x%x cnt:%d", | ||
514 | Did, vport->fc_flag, | ||
515 | vport->fc_rscn_id_cnt); | ||
516 | |||
462 | lpfc_printf_log(phba, KERN_INFO, | 517 | lpfc_printf_log(phba, KERN_INFO, |
463 | LOG_DISCOVERY, | 518 | LOG_DISCOVERY, |
464 | "%d (%d):0245 Skip x%x " | 519 | "%d (%d):0245 Skip x%x " |
@@ -492,7 +547,6 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
492 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 547 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
493 | IOCB_t *irsp; | 548 | IOCB_t *irsp; |
494 | struct lpfc_dmabuf *bmp; | 549 | struct lpfc_dmabuf *bmp; |
495 | struct lpfc_dmabuf *inp; | ||
496 | struct lpfc_dmabuf *outp; | 550 | struct lpfc_dmabuf *outp; |
497 | struct lpfc_sli_ct_request *CTrsp; | 551 | struct lpfc_sli_ct_request *CTrsp; |
498 | int rc; | 552 | int rc; |
@@ -500,31 +554,39 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
500 | /* we pass cmdiocb to state machine which needs rspiocb as well */ | 554 | /* we pass cmdiocb to state machine which needs rspiocb as well */ |
501 | cmdiocb->context_un.rsp_iocb = rspiocb; | 555 | cmdiocb->context_un.rsp_iocb = rspiocb; |
502 | 556 | ||
503 | inp = (struct lpfc_dmabuf *) cmdiocb->context1; | ||
504 | outp = (struct lpfc_dmabuf *) cmdiocb->context2; | 557 | outp = (struct lpfc_dmabuf *) cmdiocb->context2; |
505 | bmp = (struct lpfc_dmabuf *) cmdiocb->context3; | 558 | bmp = (struct lpfc_dmabuf *) cmdiocb->context3; |
559 | irsp = &rspiocb->iocb; | ||
560 | |||
561 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | ||
562 | "GID_FT cmpl: status:x%x/x%x rtry:%d", | ||
563 | irsp->ulpStatus, irsp->un.ulpWord[4], vport->fc_ns_retry); | ||
506 | 564 | ||
507 | /* Don't bother processing response if vport is being torn down. */ | 565 | /* Don't bother processing response if vport is being torn down. */ |
508 | if (vport->load_flag & FC_UNLOADING) | 566 | if (vport->load_flag & FC_UNLOADING) |
509 | goto out; | 567 | goto out; |
510 | 568 | ||
511 | irsp = &rspiocb->iocb; | ||
512 | if (irsp->ulpStatus) { | ||
513 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && | ||
514 | ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) || | ||
515 | (irsp->un.ulpWord[4] == IOERR_SLI_ABORTED))) | ||
516 | goto err1; | ||
517 | 569 | ||
570 | if (lpfc_els_chk_latt(vport) || lpfc_error_lost_link(irsp)) { | ||
571 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | ||
572 | "%d (%d):0216 Link event during NS query\n", | ||
573 | phba->brd_no, vport->vpi); | ||
574 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | ||
575 | goto out; | ||
576 | } | ||
577 | |||
578 | if (irsp->ulpStatus) { | ||
518 | /* Check for retry */ | 579 | /* Check for retry */ |
519 | if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { | 580 | if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { |
520 | vport->fc_ns_retry++; | 581 | if ((irsp->ulpStatus != IOSTAT_LOCAL_REJECT) || |
582 | (irsp->un.ulpWord[4] != IOERR_NO_RESOURCES)) | ||
583 | vport->fc_ns_retry++; | ||
521 | /* CT command is being retried */ | 584 | /* CT command is being retried */ |
522 | rc = lpfc_ns_cmd(vport, SLI_CTNS_GID_FT, | 585 | rc = lpfc_ns_cmd(vport, SLI_CTNS_GID_FT, |
523 | vport->fc_ns_retry, 0); | 586 | vport->fc_ns_retry, 0); |
524 | if (rc == 0) | 587 | if (rc == 0) |
525 | goto out; | 588 | goto out; |
526 | } | 589 | } |
527 | err1: | ||
528 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 590 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
529 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 591 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, |
530 | "%d (%d):0257 GID_FT Query error: 0x%x 0x%x\n", | 592 | "%d (%d):0257 GID_FT Query error: 0x%x 0x%x\n", |
@@ -553,6 +615,13 @@ err1: | |||
553 | (uint32_t) CTrsp->ReasonCode, | 615 | (uint32_t) CTrsp->ReasonCode, |
554 | (uint32_t) CTrsp->Explanation, | 616 | (uint32_t) CTrsp->Explanation, |
555 | vport->fc_flag); | 617 | vport->fc_flag); |
618 | |||
619 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | ||
620 | "GID_FT rsp err1 cmd:x%x rsn:x%x exp:x%x", | ||
621 | (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, | ||
622 | (uint32_t) CTrsp->ReasonCode, | ||
623 | (uint32_t) CTrsp->Explanation); | ||
624 | |||
556 | } else { | 625 | } else { |
557 | /* NameServer Rsp Error */ | 626 | /* NameServer Rsp Error */ |
558 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 627 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, |
@@ -563,6 +632,12 @@ err1: | |||
563 | (uint32_t) CTrsp->ReasonCode, | 632 | (uint32_t) CTrsp->ReasonCode, |
564 | (uint32_t) CTrsp->Explanation, | 633 | (uint32_t) CTrsp->Explanation, |
565 | vport->fc_flag); | 634 | vport->fc_flag); |
635 | |||
636 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | ||
637 | "GID_FT rsp err2 cmd:x%x rsn:x%x exp:x%x", | ||
638 | (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, | ||
639 | (uint32_t) CTrsp->ReasonCode, | ||
640 | (uint32_t) CTrsp->Explanation); | ||
566 | } | 641 | } |
567 | } | 642 | } |
568 | /* Link up / RSCN discovery */ | 643 | /* Link up / RSCN discovery */ |
@@ -586,12 +661,7 @@ err1: | |||
586 | lpfc_disc_start(vport); | 661 | lpfc_disc_start(vport); |
587 | } | 662 | } |
588 | out: | 663 | out: |
589 | lpfc_free_ct_rsp(phba, outp); | 664 | lpfc_ct_free_iocb(phba, cmdiocb); |
590 | lpfc_mbuf_free(phba, inp->virt, inp->phys); | ||
591 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | ||
592 | kfree(inp); | ||
593 | kfree(bmp); | ||
594 | lpfc_sli_release_iocbq(phba, cmdiocb); | ||
595 | return; | 665 | return; |
596 | } | 666 | } |
597 | 667 | ||
@@ -602,7 +672,6 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
602 | struct lpfc_vport *vport = cmdiocb->vport; | 672 | struct lpfc_vport *vport = cmdiocb->vport; |
603 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 673 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
604 | IOCB_t *irsp = &rspiocb->iocb; | 674 | IOCB_t *irsp = &rspiocb->iocb; |
605 | struct lpfc_dmabuf *bmp = (struct lpfc_dmabuf *) cmdiocb->context3; | ||
606 | struct lpfc_dmabuf *inp = (struct lpfc_dmabuf *) cmdiocb->context1; | 675 | struct lpfc_dmabuf *inp = (struct lpfc_dmabuf *) cmdiocb->context1; |
607 | struct lpfc_dmabuf *outp = (struct lpfc_dmabuf *) cmdiocb->context2; | 676 | struct lpfc_dmabuf *outp = (struct lpfc_dmabuf *) cmdiocb->context2; |
608 | struct lpfc_sli_ct_request *CTrsp; | 677 | struct lpfc_sli_ct_request *CTrsp; |
@@ -613,6 +682,10 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
613 | did = ((struct lpfc_sli_ct_request *) inp->virt)->un.gff.PortId; | 682 | did = ((struct lpfc_sli_ct_request *) inp->virt)->un.gff.PortId; |
614 | did = be32_to_cpu(did); | 683 | did = be32_to_cpu(did); |
615 | 684 | ||
685 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | ||
686 | "GFF_ID cmpl: status:x%x/x%x did:x%x", | ||
687 | irsp->ulpStatus, irsp->un.ulpWord[4], did); | ||
688 | |||
616 | if (irsp->ulpStatus == IOSTAT_SUCCESS) { | 689 | if (irsp->ulpStatus == IOSTAT_SUCCESS) { |
617 | /* Good status, continue checking */ | 690 | /* Good status, continue checking */ |
618 | CTrsp = (struct lpfc_sli_ct_request *) outp->virt; | 691 | CTrsp = (struct lpfc_sli_ct_request *) outp->virt; |
@@ -632,6 +705,15 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
632 | } | 705 | } |
633 | } | 706 | } |
634 | } | 707 | } |
708 | else { | ||
709 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | ||
710 | "%d (%d):0267 NameServer GFF Rsp" | ||
711 | " x%x Error (%d %d) Data: x%x x%x\n", | ||
712 | phba->brd_no, vport->vpi, did, | ||
713 | irsp->ulpStatus, irsp->un.ulpWord[4], | ||
714 | vport->fc_flag, vport->fc_rscn_id_cnt) | ||
715 | } | ||
716 | |||
635 | /* This is a target port, unregistered port, or the GFF_ID failed */ | 717 | /* This is a target port, unregistered port, or the GFF_ID failed */ |
636 | ndlp = lpfc_setup_disc_node(vport, did); | 718 | ndlp = lpfc_setup_disc_node(vport, did); |
637 | if (ndlp) { | 719 | if (ndlp) { |
@@ -670,13 +752,7 @@ out: | |||
670 | } | 752 | } |
671 | lpfc_disc_start(vport); | 753 | lpfc_disc_start(vport); |
672 | } | 754 | } |
673 | 755 | lpfc_ct_free_iocb(phba, cmdiocb); | |
674 | lpfc_free_ct_rsp(phba, outp); | ||
675 | lpfc_mbuf_free(phba, inp->virt, inp->phys); | ||
676 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | ||
677 | kfree(inp); | ||
678 | kfree(bmp); | ||
679 | lpfc_sli_release_iocbq(phba, cmdiocb); | ||
680 | return; | 756 | return; |
681 | } | 757 | } |
682 | 758 | ||
@@ -686,37 +762,45 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
686 | struct lpfc_iocbq *rspiocb) | 762 | struct lpfc_iocbq *rspiocb) |
687 | { | 763 | { |
688 | struct lpfc_vport *vport = cmdiocb->vport; | 764 | struct lpfc_vport *vport = cmdiocb->vport; |
689 | struct lpfc_dmabuf *bmp; | ||
690 | struct lpfc_dmabuf *inp; | 765 | struct lpfc_dmabuf *inp; |
691 | struct lpfc_dmabuf *outp; | 766 | struct lpfc_dmabuf *outp; |
692 | IOCB_t *irsp; | 767 | IOCB_t *irsp; |
693 | struct lpfc_sli_ct_request *CTrsp; | 768 | struct lpfc_sli_ct_request *CTrsp; |
694 | int cmdcode, rc; | 769 | int cmdcode, rc; |
695 | uint8_t retry; | 770 | uint8_t retry; |
771 | uint32_t latt; | ||
696 | 772 | ||
697 | /* we pass cmdiocb to state machine which needs rspiocb as well */ | 773 | /* we pass cmdiocb to state machine which needs rspiocb as well */ |
698 | cmdiocb->context_un.rsp_iocb = rspiocb; | 774 | cmdiocb->context_un.rsp_iocb = rspiocb; |
699 | 775 | ||
700 | inp = (struct lpfc_dmabuf *) cmdiocb->context1; | 776 | inp = (struct lpfc_dmabuf *) cmdiocb->context1; |
701 | outp = (struct lpfc_dmabuf *) cmdiocb->context2; | 777 | outp = (struct lpfc_dmabuf *) cmdiocb->context2; |
702 | bmp = (struct lpfc_dmabuf *) cmdiocb->context3; | ||
703 | irsp = &rspiocb->iocb; | 778 | irsp = &rspiocb->iocb; |
704 | 779 | ||
705 | cmdcode = be16_to_cpu(((struct lpfc_sli_ct_request *) inp->virt)-> | 780 | cmdcode = be16_to_cpu(((struct lpfc_sli_ct_request *) inp->virt)-> |
706 | CommandResponse.bits.CmdRsp); | 781 | CommandResponse.bits.CmdRsp); |
707 | CTrsp = (struct lpfc_sli_ct_request *) outp->virt; | 782 | CTrsp = (struct lpfc_sli_ct_request *) outp->virt; |
708 | 783 | ||
709 | /* NS request completes status <ulpStatus> CmdRsp <CmdRsp> */ | 784 | latt = lpfc_els_chk_latt(vport); |
785 | |||
786 | /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */ | ||
710 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 787 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
711 | "%d (%d):0209 NS request %x completes " | 788 | "%d (%d):0209 RFT request completes, latt %d, " |
712 | "ulpStatus x%x / x%x " | 789 | "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n", |
713 | "CmdRsp x%x, Context x%x, Tag x%x\n", | 790 | phba->brd_no, vport->vpi, latt, irsp->ulpStatus, |
714 | phba->brd_no, vport->vpi, | ||
715 | cmdcode, irsp->ulpStatus, irsp->un.ulpWord[4], | ||
716 | CTrsp->CommandResponse.bits.CmdRsp, | 791 | CTrsp->CommandResponse.bits.CmdRsp, |
717 | cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag); | 792 | cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag); |
718 | 793 | ||
794 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | ||
795 | "CT cmd cmpl: status:x%x/x%x cmd:x%x", | ||
796 | irsp->ulpStatus, irsp->un.ulpWord[4], cmdcode); | ||
797 | |||
719 | if (irsp->ulpStatus) { | 798 | if (irsp->ulpStatus) { |
799 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | ||
800 | "%d (%d):0268 NS cmd %x Error (%d %d)\n", | ||
801 | phba->brd_no, vport->vpi, cmdcode, | ||
802 | irsp->ulpStatus, irsp->un.ulpWord[4]); | ||
803 | |||
720 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && | 804 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && |
721 | ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) || | 805 | ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) || |
722 | (irsp->un.ulpWord[4] == IOERR_SLI_ABORTED))) | 806 | (irsp->un.ulpWord[4] == IOERR_SLI_ABORTED))) |
@@ -736,12 +820,7 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
736 | } | 820 | } |
737 | 821 | ||
738 | out: | 822 | out: |
739 | lpfc_free_ct_rsp(phba, outp); | 823 | lpfc_ct_free_iocb(phba, cmdiocb); |
740 | lpfc_mbuf_free(phba, inp->virt, inp->phys); | ||
741 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | ||
742 | kfree(inp); | ||
743 | kfree(bmp); | ||
744 | lpfc_sli_release_iocbq(phba, cmdiocb); | ||
745 | return; | 824 | return; |
746 | } | 825 | } |
747 | 826 | ||
@@ -840,31 +919,42 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, | |||
840 | struct lpfc_iocbq *) = NULL; | 919 | struct lpfc_iocbq *) = NULL; |
841 | uint32_t rsp_size = 1024; | 920 | uint32_t rsp_size = 1024; |
842 | size_t size; | 921 | size_t size; |
922 | int rc = 0; | ||
843 | 923 | ||
844 | ndlp = lpfc_findnode_did(vport, NameServer_DID); | 924 | ndlp = lpfc_findnode_did(vport, NameServer_DID); |
845 | if (ndlp == NULL || ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) | 925 | if (ndlp == NULL || ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) { |
846 | return 1; | 926 | rc=1; |
927 | goto ns_cmd_exit; | ||
928 | } | ||
847 | 929 | ||
848 | /* fill in BDEs for command */ | 930 | /* fill in BDEs for command */ |
849 | /* Allocate buffer for command payload */ | 931 | /* Allocate buffer for command payload */ |
850 | mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL); | 932 | mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL); |
851 | if (!mp) | 933 | if (!mp) { |
934 | rc=2; | ||
852 | goto ns_cmd_exit; | 935 | goto ns_cmd_exit; |
936 | } | ||
853 | 937 | ||
854 | INIT_LIST_HEAD(&mp->list); | 938 | INIT_LIST_HEAD(&mp->list); |
855 | mp->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &(mp->phys)); | 939 | mp->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &(mp->phys)); |
856 | if (!mp->virt) | 940 | if (!mp->virt) { |
941 | rc=3; | ||
857 | goto ns_cmd_free_mp; | 942 | goto ns_cmd_free_mp; |
943 | } | ||
858 | 944 | ||
859 | /* Allocate buffer for Buffer ptr list */ | 945 | /* Allocate buffer for Buffer ptr list */ |
860 | bmp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL); | 946 | bmp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL); |
861 | if (!bmp) | 947 | if (!bmp) { |
948 | rc=4; | ||
862 | goto ns_cmd_free_mpvirt; | 949 | goto ns_cmd_free_mpvirt; |
950 | } | ||
863 | 951 | ||
864 | INIT_LIST_HEAD(&bmp->list); | 952 | INIT_LIST_HEAD(&bmp->list); |
865 | bmp->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &(bmp->phys)); | 953 | bmp->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &(bmp->phys)); |
866 | if (!bmp->virt) | 954 | if (!bmp->virt) { |
955 | rc=5; | ||
867 | goto ns_cmd_free_bmp; | 956 | goto ns_cmd_free_bmp; |
957 | } | ||
868 | 958 | ||
869 | /* NameServer Req */ | 959 | /* NameServer Req */ |
870 | lpfc_printf_log(phba, KERN_INFO ,LOG_DISCOVERY, | 960 | lpfc_printf_log(phba, KERN_INFO ,LOG_DISCOVERY, |
@@ -970,10 +1060,15 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, | |||
970 | break; | 1060 | break; |
971 | } | 1061 | } |
972 | 1062 | ||
973 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) | 1063 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) { |
974 | /* On success, The cmpl function will free the buffers */ | 1064 | /* On success, The cmpl function will free the buffers */ |
1065 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | ||
1066 | "Issue CT cmd: cmd:x%x did:x%x", | ||
1067 | cmdcode, ndlp->nlp_DID, 0); | ||
975 | return 0; | 1068 | return 0; |
1069 | } | ||
976 | 1070 | ||
1071 | rc=6; | ||
977 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | 1072 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); |
978 | ns_cmd_free_bmp: | 1073 | ns_cmd_free_bmp: |
979 | kfree(bmp); | 1074 | kfree(bmp); |
@@ -982,6 +1077,10 @@ ns_cmd_free_mpvirt: | |||
982 | ns_cmd_free_mp: | 1077 | ns_cmd_free_mp: |
983 | kfree(mp); | 1078 | kfree(mp); |
984 | ns_cmd_exit: | 1079 | ns_cmd_exit: |
1080 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | ||
1081 | "%d (%d):0266 Issue NameServer Req x%x err %d Data: x%x x%x\n", | ||
1082 | phba->brd_no, vport->vpi, cmdcode, rc, vport->fc_flag, | ||
1083 | vport->fc_rscn_id_cnt); | ||
985 | return 1; | 1084 | return 1; |
986 | } | 1085 | } |
987 | 1086 | ||
@@ -989,7 +1088,6 @@ static void | |||
989 | lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | 1088 | lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
990 | struct lpfc_iocbq * rspiocb) | 1089 | struct lpfc_iocbq * rspiocb) |
991 | { | 1090 | { |
992 | struct lpfc_dmabuf *bmp = cmdiocb->context3; | ||
993 | struct lpfc_dmabuf *inp = cmdiocb->context1; | 1091 | struct lpfc_dmabuf *inp = cmdiocb->context1; |
994 | struct lpfc_dmabuf *outp = cmdiocb->context2; | 1092 | struct lpfc_dmabuf *outp = cmdiocb->context2; |
995 | struct lpfc_sli_ct_request *CTrsp = outp->virt; | 1093 | struct lpfc_sli_ct_request *CTrsp = outp->virt; |
@@ -998,6 +1096,25 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
998 | uint16_t fdmi_cmd = CTcmd->CommandResponse.bits.CmdRsp; | 1096 | uint16_t fdmi_cmd = CTcmd->CommandResponse.bits.CmdRsp; |
999 | uint16_t fdmi_rsp = CTrsp->CommandResponse.bits.CmdRsp; | 1097 | uint16_t fdmi_rsp = CTrsp->CommandResponse.bits.CmdRsp; |
1000 | struct lpfc_vport *vport = cmdiocb->vport; | 1098 | struct lpfc_vport *vport = cmdiocb->vport; |
1099 | IOCB_t *irsp = &rspiocb->iocb; | ||
1100 | uint32_t latt; | ||
1101 | |||
1102 | latt = lpfc_els_chk_latt(vport); | ||
1103 | |||
1104 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | ||
1105 | "FDMI cmpl: status:x%x/x%x latt:%d", | ||
1106 | irsp->ulpStatus, irsp->un.ulpWord[4], latt); | ||
1107 | |||
1108 | if (latt || irsp->ulpStatus) { | ||
1109 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | ||
1110 | "%d (%d):0229 FDMI cmd %04x failed, latt = %d " | ||
1111 | "ulpStatus: x%x, rid x%x\n", | ||
1112 | phba->brd_no, vport->vpi, | ||
1113 | be16_to_cpu(fdmi_cmd), latt, irsp->ulpStatus, | ||
1114 | irsp->un.ulpWord[4]); | ||
1115 | lpfc_ct_free_iocb(phba, cmdiocb); | ||
1116 | return; | ||
1117 | } | ||
1001 | 1118 | ||
1002 | ndlp = lpfc_findnode_did(vport, FDMI_DID); | 1119 | ndlp = lpfc_findnode_did(vport, FDMI_DID); |
1003 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { | 1120 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { |
@@ -1024,13 +1141,7 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1024 | lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_RHBA); | 1141 | lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_RHBA); |
1025 | break; | 1142 | break; |
1026 | } | 1143 | } |
1027 | 1144 | lpfc_ct_free_iocb(phba, cmdiocb); | |
1028 | lpfc_free_ct_rsp(phba, outp); | ||
1029 | lpfc_mbuf_free(phba, inp->virt, inp->phys); | ||
1030 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | ||
1031 | kfree(inp); | ||
1032 | kfree(bmp); | ||
1033 | lpfc_sli_release_iocbq(phba, cmdiocb); | ||
1034 | return; | 1145 | return; |
1035 | } | 1146 | } |
1036 | 1147 | ||