diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_ct.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_ct.c | 243 |
1 files changed, 132 insertions, 111 deletions
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index ae9d6f385a6c..c701e4d611a9 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -257,6 +257,10 @@ lpfc_ct_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *ctiocb) | |||
257 | { | 257 | { |
258 | struct lpfc_dmabuf *buf_ptr; | 258 | struct lpfc_dmabuf *buf_ptr; |
259 | 259 | ||
260 | if (ctiocb->context_un.ndlp) { | ||
261 | lpfc_nlp_put(ctiocb->context_un.ndlp); | ||
262 | ctiocb->context_un.ndlp = NULL; | ||
263 | } | ||
260 | if (ctiocb->context1) { | 264 | if (ctiocb->context1) { |
261 | buf_ptr = (struct lpfc_dmabuf *) ctiocb->context1; | 265 | buf_ptr = (struct lpfc_dmabuf *) ctiocb->context1; |
262 | lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); | 266 | lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); |
@@ -314,6 +318,7 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, | |||
314 | /* Save for completion so we can release these resources */ | 318 | /* Save for completion so we can release these resources */ |
315 | geniocb->context1 = (uint8_t *) inp; | 319 | geniocb->context1 = (uint8_t *) inp; |
316 | geniocb->context2 = (uint8_t *) outp; | 320 | geniocb->context2 = (uint8_t *) outp; |
321 | geniocb->context_un.ndlp = ndlp; | ||
317 | 322 | ||
318 | /* Fill in payload, bp points to frame payload */ | 323 | /* Fill in payload, bp points to frame payload */ |
319 | icmd->ulpCommand = CMD_GEN_REQUEST64_CR; | 324 | icmd->ulpCommand = CMD_GEN_REQUEST64_CR; |
@@ -341,11 +346,11 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, | |||
341 | } | 346 | } |
342 | 347 | ||
343 | /* Issue GEN REQ IOCB for NPORT <did> */ | 348 | /* Issue GEN REQ IOCB for NPORT <did> */ |
344 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 349 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
345 | "%d (%d):0119 Issue GEN REQ IOCB to NPORT x%x " | 350 | "0119 Issue GEN REQ IOCB to NPORT x%x " |
346 | "Data: x%x x%x\n", phba->brd_no, vport->vpi, | 351 | "Data: x%x x%x\n", |
347 | ndlp->nlp_DID, icmd->ulpIoTag, | 352 | ndlp->nlp_DID, icmd->ulpIoTag, |
348 | vport->port_state); | 353 | vport->port_state); |
349 | geniocb->iocb_cmpl = cmpl; | 354 | geniocb->iocb_cmpl = cmpl; |
350 | geniocb->drvrTimeout = icmd->ulpTimeout + LPFC_DRVR_TIMEOUT; | 355 | geniocb->drvrTimeout = icmd->ulpTimeout + LPFC_DRVR_TIMEOUT; |
351 | geniocb->vport = vport; | 356 | geniocb->vport = vport; |
@@ -390,17 +395,19 @@ lpfc_ct_cmd(struct lpfc_vport *vport, struct lpfc_dmabuf *inmp, | |||
390 | return 0; | 395 | return 0; |
391 | } | 396 | } |
392 | 397 | ||
393 | static struct lpfc_vport * | 398 | struct lpfc_vport * |
394 | lpfc_find_vport_by_did(struct lpfc_hba *phba, uint32_t did) { | 399 | lpfc_find_vport_by_did(struct lpfc_hba *phba, uint32_t did) { |
395 | |||
396 | struct lpfc_vport *vport_curr; | 400 | struct lpfc_vport *vport_curr; |
401 | unsigned long flags; | ||
397 | 402 | ||
403 | spin_lock_irqsave(&phba->hbalock, flags); | ||
398 | list_for_each_entry(vport_curr, &phba->port_list, listentry) { | 404 | list_for_each_entry(vport_curr, &phba->port_list, listentry) { |
399 | if ((vport_curr->fc_myDID) && | 405 | if ((vport_curr->fc_myDID) && (vport_curr->fc_myDID == did)) { |
400 | (vport_curr->fc_myDID == did)) | 406 | spin_unlock_irqrestore(&phba->hbalock, flags); |
401 | return vport_curr; | 407 | return vport_curr; |
408 | } | ||
402 | } | 409 | } |
403 | 410 | spin_unlock_irqrestore(&phba->hbalock, flags); | |
404 | return NULL; | 411 | return NULL; |
405 | } | 412 | } |
406 | 413 | ||
@@ -449,10 +456,10 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
449 | */ | 456 | */ |
450 | if ((Did != vport->fc_myDID) && | 457 | if ((Did != vport->fc_myDID) && |
451 | ((lpfc_find_vport_by_did(phba, Did) == NULL) || | 458 | ((lpfc_find_vport_by_did(phba, Did) == NULL) || |
452 | phba->cfg_peer_port_login)) { | 459 | vport->cfg_peer_port_login)) { |
453 | if ((vport->port_type != LPFC_NPIV_PORT) || | 460 | if ((vport->port_type != LPFC_NPIV_PORT) || |
454 | (vport->fc_flag & FC_RFF_NOT_SUPPORTED) || | 461 | (vport->fc_flag & FC_RFF_NOT_SUPPORTED) || |
455 | (!phba->cfg_vport_restrict_login)) { | 462 | (!vport->cfg_restrict_login)) { |
456 | ndlp = lpfc_setup_disc_node(vport, Did); | 463 | ndlp = lpfc_setup_disc_node(vport, Did); |
457 | if (ndlp) { | 464 | if (ndlp) { |
458 | lpfc_debugfs_disc_trc(vport, | 465 | lpfc_debugfs_disc_trc(vport, |
@@ -462,14 +469,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
462 | Did, ndlp->nlp_flag, | 469 | Did, ndlp->nlp_flag, |
463 | vport->fc_flag); | 470 | vport->fc_flag); |
464 | 471 | ||
465 | lpfc_printf_log(phba, KERN_INFO, | 472 | lpfc_printf_vlog(vport, |
473 | KERN_INFO, | ||
466 | LOG_DISCOVERY, | 474 | LOG_DISCOVERY, |
467 | "%d (%d):0238 Process " | 475 | "0238 Process " |
468 | "x%x NameServer Rsp" | 476 | "x%x NameServer Rsp" |
469 | "Data: x%x x%x x%x\n", | 477 | "Data: x%x x%x x%x\n", |
470 | phba->brd_no, | 478 | Did, ndlp->nlp_flag, |
471 | vport->vpi, Did, | ||
472 | ndlp->nlp_flag, | ||
473 | vport->fc_flag, | 479 | vport->fc_flag, |
474 | vport->fc_rscn_id_cnt); | 480 | vport->fc_rscn_id_cnt); |
475 | } else { | 481 | } else { |
@@ -480,14 +486,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
480 | Did, vport->fc_flag, | 486 | Did, vport->fc_flag, |
481 | vport->fc_rscn_id_cnt); | 487 | vport->fc_rscn_id_cnt); |
482 | 488 | ||
483 | lpfc_printf_log(phba, KERN_INFO, | 489 | lpfc_printf_vlog(vport, |
490 | KERN_INFO, | ||
484 | LOG_DISCOVERY, | 491 | LOG_DISCOVERY, |
485 | "%d (%d):0239 Skip x%x " | 492 | "0239 Skip x%x " |
486 | "NameServer Rsp Data: " | 493 | "NameServer Rsp Data: " |
487 | "x%x x%x\n", | 494 | "x%x x%x\n", |
488 | phba->brd_no, | 495 | Did, vport->fc_flag, |
489 | vport->vpi, Did, | ||
490 | vport->fc_flag, | ||
491 | vport->fc_rscn_id_cnt); | 496 | vport->fc_rscn_id_cnt); |
492 | } | 497 | } |
493 | 498 | ||
@@ -514,14 +519,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
514 | Did, vport->fc_flag, | 519 | Did, vport->fc_flag, |
515 | vport->fc_rscn_id_cnt); | 520 | vport->fc_rscn_id_cnt); |
516 | 521 | ||
517 | lpfc_printf_log(phba, KERN_INFO, | 522 | lpfc_printf_vlog(vport, |
523 | KERN_INFO, | ||
518 | LOG_DISCOVERY, | 524 | LOG_DISCOVERY, |
519 | "%d (%d):0245 Skip x%x " | 525 | "0245 Skip x%x " |
520 | "NameServer Rsp Data: " | 526 | "NameServer Rsp Data: " |
521 | "x%x x%x\n", | 527 | "x%x x%x\n", |
522 | phba->brd_no, | 528 | Did, vport->fc_flag, |
523 | vport->vpi, Did, | ||
524 | vport->fc_flag, | ||
525 | vport->fc_rscn_id_cnt); | 529 | vport->fc_rscn_id_cnt); |
526 | } | 530 | } |
527 | } | 531 | } |
@@ -549,8 +553,12 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
549 | struct lpfc_dmabuf *bmp; | 553 | struct lpfc_dmabuf *bmp; |
550 | struct lpfc_dmabuf *outp; | 554 | struct lpfc_dmabuf *outp; |
551 | struct lpfc_sli_ct_request *CTrsp; | 555 | struct lpfc_sli_ct_request *CTrsp; |
556 | struct lpfc_nodelist *ndlp; | ||
552 | int rc; | 557 | int rc; |
553 | 558 | ||
559 | /* First save ndlp, before we overwrite it */ | ||
560 | ndlp = cmdiocb->context_un.ndlp; | ||
561 | |||
554 | /* we pass cmdiocb to state machine which needs rspiocb as well */ | 562 | /* we pass cmdiocb to state machine which needs rspiocb as well */ |
555 | cmdiocb->context_un.rsp_iocb = rspiocb; | 563 | cmdiocb->context_un.rsp_iocb = rspiocb; |
556 | 564 | ||
@@ -568,9 +576,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
568 | 576 | ||
569 | 577 | ||
570 | if (lpfc_els_chk_latt(vport) || lpfc_error_lost_link(irsp)) { | 578 | if (lpfc_els_chk_latt(vport) || lpfc_error_lost_link(irsp)) { |
571 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 579 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
572 | "%d (%d):0216 Link event during NS query\n", | 580 | "0216 Link event during NS query\n"); |
573 | phba->brd_no, vport->vpi); | ||
574 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 581 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
575 | goto out; | 582 | goto out; |
576 | } | 583 | } |
@@ -588,46 +595,61 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
588 | goto out; | 595 | goto out; |
589 | } | 596 | } |
590 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 597 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
591 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 598 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
592 | "%d (%d):0257 GID_FT Query error: 0x%x 0x%x\n", | 599 | "0257 GID_FT Query error: 0x%x 0x%x\n", |
593 | phba->brd_no, vport->vpi, irsp->ulpStatus, | 600 | irsp->ulpStatus, vport->fc_ns_retry); |
594 | vport->fc_ns_retry); | ||
595 | } else { | 601 | } else { |
596 | /* Good status, continue checking */ | 602 | /* Good status, continue checking */ |
597 | CTrsp = (struct lpfc_sli_ct_request *) outp->virt; | 603 | CTrsp = (struct lpfc_sli_ct_request *) outp->virt; |
598 | if (CTrsp->CommandResponse.bits.CmdRsp == | 604 | if (CTrsp->CommandResponse.bits.CmdRsp == |
599 | be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { | 605 | be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { |
600 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 606 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
601 | "%d (%d):0208 NameServer Rsp " | 607 | "0208 NameServer Rsp Data: x%x\n", |
602 | "Data: x%x\n", | 608 | vport->fc_flag); |
603 | phba->brd_no, vport->vpi, | ||
604 | vport->fc_flag); | ||
605 | lpfc_ns_rsp(vport, outp, | 609 | lpfc_ns_rsp(vport, outp, |
606 | (uint32_t) (irsp->un.genreq64.bdl.bdeSize)); | 610 | (uint32_t) (irsp->un.genreq64.bdl.bdeSize)); |
607 | } else if (CTrsp->CommandResponse.bits.CmdRsp == | 611 | } else if (CTrsp->CommandResponse.bits.CmdRsp == |
608 | be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { | 612 | be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { |
609 | /* NameServer Rsp Error */ | 613 | /* NameServer Rsp Error */ |
610 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 614 | if ((CTrsp->ReasonCode == SLI_CT_UNABLE_TO_PERFORM_REQ) |
611 | "%d (%d):0240 NameServer Rsp Error " | 615 | && (CTrsp->Explanation == SLI_CT_NO_FC4_TYPES)) { |
616 | lpfc_printf_vlog(vport, KERN_INFO, | ||
617 | LOG_DISCOVERY, | ||
618 | "0269 No NameServer Entries " | ||
612 | "Data: x%x x%x x%x x%x\n", | 619 | "Data: x%x x%x x%x x%x\n", |
613 | phba->brd_no, vport->vpi, | ||
614 | CTrsp->CommandResponse.bits.CmdRsp, | 620 | CTrsp->CommandResponse.bits.CmdRsp, |
615 | (uint32_t) CTrsp->ReasonCode, | 621 | (uint32_t) CTrsp->ReasonCode, |
616 | (uint32_t) CTrsp->Explanation, | 622 | (uint32_t) CTrsp->Explanation, |
617 | vport->fc_flag); | 623 | vport->fc_flag); |
618 | 624 | ||
619 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | 625 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, |
626 | "GID_FT no entry cmd:x%x rsn:x%x exp:x%x", | ||
627 | (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, | ||
628 | (uint32_t) CTrsp->ReasonCode, | ||
629 | (uint32_t) CTrsp->Explanation); | ||
630 | } else { | ||
631 | lpfc_printf_vlog(vport, KERN_INFO, | ||
632 | LOG_DISCOVERY, | ||
633 | "0240 NameServer Rsp Error " | ||
634 | "Data: x%x x%x x%x x%x\n", | ||
635 | CTrsp->CommandResponse.bits.CmdRsp, | ||
636 | (uint32_t) CTrsp->ReasonCode, | ||
637 | (uint32_t) CTrsp->Explanation, | ||
638 | vport->fc_flag); | ||
639 | |||
640 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | ||
620 | "GID_FT rsp err1 cmd:x%x rsn:x%x exp:x%x", | 641 | "GID_FT rsp err1 cmd:x%x rsn:x%x exp:x%x", |
621 | (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, | 642 | (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, |
622 | (uint32_t) CTrsp->ReasonCode, | 643 | (uint32_t) CTrsp->ReasonCode, |
623 | (uint32_t) CTrsp->Explanation); | 644 | (uint32_t) CTrsp->Explanation); |
645 | } | ||
646 | |||
624 | 647 | ||
625 | } else { | 648 | } else { |
626 | /* NameServer Rsp Error */ | 649 | /* NameServer Rsp Error */ |
627 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 650 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
628 | "%d (%d):0241 NameServer Rsp Error " | 651 | "0241 NameServer Rsp Error " |
629 | "Data: x%x x%x x%x x%x\n", | 652 | "Data: x%x x%x x%x x%x\n", |
630 | phba->brd_no, vport->vpi, | ||
631 | CTrsp->CommandResponse.bits.CmdRsp, | 653 | CTrsp->CommandResponse.bits.CmdRsp, |
632 | (uint32_t) CTrsp->ReasonCode, | 654 | (uint32_t) CTrsp->ReasonCode, |
633 | (uint32_t) CTrsp->Explanation, | 655 | (uint32_t) CTrsp->Explanation, |
@@ -661,11 +683,12 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
661 | lpfc_disc_start(vport); | 683 | lpfc_disc_start(vport); |
662 | } | 684 | } |
663 | out: | 685 | out: |
686 | cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */ | ||
664 | lpfc_ct_free_iocb(phba, cmdiocb); | 687 | lpfc_ct_free_iocb(phba, cmdiocb); |
665 | return; | 688 | return; |
666 | } | 689 | } |
667 | 690 | ||
668 | void | 691 | static void |
669 | lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | 692 | lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
670 | struct lpfc_iocbq *rspiocb) | 693 | struct lpfc_iocbq *rspiocb) |
671 | { | 694 | { |
@@ -695,40 +718,37 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
695 | be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { | 718 | be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { |
696 | if ((fbits & FC4_FEATURE_INIT) && | 719 | if ((fbits & FC4_FEATURE_INIT) && |
697 | !(fbits & FC4_FEATURE_TARGET)) { | 720 | !(fbits & FC4_FEATURE_TARGET)) { |
698 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 721 | lpfc_printf_vlog(vport, KERN_INFO, |
699 | "%d (%d):0245 Skip x%x GFF " | 722 | LOG_DISCOVERY, |
700 | "NameServer Rsp Data: (init) " | 723 | "0270 Skip x%x GFF " |
701 | "x%x x%x\n", phba->brd_no, | 724 | "NameServer Rsp Data: (init) " |
702 | vport->vpi, did, fbits, | 725 | "x%x x%x\n", did, fbits, |
703 | vport->fc_rscn_id_cnt); | 726 | vport->fc_rscn_id_cnt); |
704 | goto out; | 727 | goto out; |
705 | } | 728 | } |
706 | } | 729 | } |
707 | } | 730 | } |
708 | else { | 731 | else { |
709 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 732 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
710 | "%d (%d):0267 NameServer GFF Rsp" | 733 | "0267 NameServer GFF Rsp " |
711 | " x%x Error (%d %d) Data: x%x x%x\n", | 734 | "x%x Error (%d %d) Data: x%x x%x\n", |
712 | phba->brd_no, vport->vpi, did, | 735 | did, irsp->ulpStatus, irsp->un.ulpWord[4], |
713 | irsp->ulpStatus, irsp->un.ulpWord[4], | 736 | vport->fc_flag, vport->fc_rscn_id_cnt) |
714 | vport->fc_flag, vport->fc_rscn_id_cnt) | ||
715 | } | 737 | } |
716 | 738 | ||
717 | /* This is a target port, unregistered port, or the GFF_ID failed */ | 739 | /* This is a target port, unregistered port, or the GFF_ID failed */ |
718 | ndlp = lpfc_setup_disc_node(vport, did); | 740 | ndlp = lpfc_setup_disc_node(vport, did); |
719 | if (ndlp) { | 741 | if (ndlp) { |
720 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 742 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
721 | "%d (%d):0242 Process x%x GFF " | 743 | "0242 Process x%x GFF " |
722 | "NameServer Rsp Data: x%x x%x x%x\n", | 744 | "NameServer Rsp Data: x%x x%x x%x\n", |
723 | phba->brd_no, vport->vpi, | 745 | did, ndlp->nlp_flag, vport->fc_flag, |
724 | did, ndlp->nlp_flag, vport->fc_flag, | 746 | vport->fc_rscn_id_cnt); |
725 | vport->fc_rscn_id_cnt); | ||
726 | } else { | 747 | } else { |
727 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 748 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
728 | "%d (%d):0243 Skip x%x GFF " | 749 | "0243 Skip x%x GFF " |
729 | "NameServer Rsp Data: x%x x%x\n", | 750 | "NameServer Rsp Data: x%x x%x\n", did, |
730 | phba->brd_no, vport->vpi, did, | 751 | vport->fc_flag, vport->fc_rscn_id_cnt); |
731 | vport->fc_flag, vport->fc_rscn_id_cnt); | ||
732 | } | 752 | } |
733 | out: | 753 | out: |
734 | /* Link up / RSCN discovery */ | 754 | /* Link up / RSCN discovery */ |
@@ -766,10 +786,14 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
766 | struct lpfc_dmabuf *outp; | 786 | struct lpfc_dmabuf *outp; |
767 | IOCB_t *irsp; | 787 | IOCB_t *irsp; |
768 | struct lpfc_sli_ct_request *CTrsp; | 788 | struct lpfc_sli_ct_request *CTrsp; |
789 | struct lpfc_nodelist *ndlp; | ||
769 | int cmdcode, rc; | 790 | int cmdcode, rc; |
770 | uint8_t retry; | 791 | uint8_t retry; |
771 | uint32_t latt; | 792 | uint32_t latt; |
772 | 793 | ||
794 | /* First save ndlp, before we overwrite it */ | ||
795 | ndlp = cmdiocb->context_un.ndlp; | ||
796 | |||
773 | /* we pass cmdiocb to state machine which needs rspiocb as well */ | 797 | /* we pass cmdiocb to state machine which needs rspiocb as well */ |
774 | cmdiocb->context_un.rsp_iocb = rspiocb; | 798 | cmdiocb->context_un.rsp_iocb = rspiocb; |
775 | 799 | ||
@@ -784,22 +808,21 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
784 | latt = lpfc_els_chk_latt(vport); | 808 | latt = lpfc_els_chk_latt(vport); |
785 | 809 | ||
786 | /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */ | 810 | /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */ |
787 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 811 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
788 | "%d (%d):0209 RFT request completes, latt %d, " | 812 | "0209 RFT request completes, latt %d, " |
789 | "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n", | 813 | "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n", |
790 | phba->brd_no, vport->vpi, latt, irsp->ulpStatus, | 814 | latt, irsp->ulpStatus, |
791 | CTrsp->CommandResponse.bits.CmdRsp, | 815 | CTrsp->CommandResponse.bits.CmdRsp, |
792 | cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag); | 816 | cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag); |
793 | 817 | ||
794 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | 818 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, |
795 | "CT cmd cmpl: status:x%x/x%x cmd:x%x", | 819 | "CT cmd cmpl: status:x%x/x%x cmd:x%x", |
796 | irsp->ulpStatus, irsp->un.ulpWord[4], cmdcode); | 820 | irsp->ulpStatus, irsp->un.ulpWord[4], cmdcode); |
797 | 821 | ||
798 | if (irsp->ulpStatus) { | 822 | if (irsp->ulpStatus) { |
799 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 823 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
800 | "%d (%d):0268 NS cmd %x Error (%d %d)\n", | 824 | "0268 NS cmd %x Error (%d %d)\n", |
801 | phba->brd_no, vport->vpi, cmdcode, | 825 | cmdcode, irsp->ulpStatus, irsp->un.ulpWord[4]); |
802 | irsp->ulpStatus, irsp->un.ulpWord[4]); | ||
803 | 826 | ||
804 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && | 827 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && |
805 | ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) || | 828 | ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) || |
@@ -811,15 +834,15 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
811 | goto out; | 834 | goto out; |
812 | 835 | ||
813 | retry++; | 836 | retry++; |
814 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 837 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
815 | "%d (%d):0216 Retrying NS cmd %x\n", | 838 | "0216 Retrying NS cmd %x\n", cmdcode); |
816 | phba->brd_no, vport->vpi, cmdcode); | ||
817 | rc = lpfc_ns_cmd(vport, cmdcode, retry, 0); | 839 | rc = lpfc_ns_cmd(vport, cmdcode, retry, 0); |
818 | if (rc == 0) | 840 | if (rc == 0) |
819 | goto out; | 841 | goto out; |
820 | } | 842 | } |
821 | 843 | ||
822 | out: | 844 | out: |
845 | cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */ | ||
823 | lpfc_ct_free_iocb(phba, cmdiocb); | 846 | lpfc_ct_free_iocb(phba, cmdiocb); |
824 | return; | 847 | return; |
825 | } | 848 | } |
@@ -862,7 +885,7 @@ lpfc_cmpl_ct_cmd_rff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
862 | return; | 885 | return; |
863 | } | 886 | } |
864 | 887 | ||
865 | int | 888 | static int |
866 | lpfc_vport_symbolic_port_name(struct lpfc_vport *vport, char *symbol, | 889 | lpfc_vport_symbolic_port_name(struct lpfc_vport *vport, char *symbol, |
867 | size_t size) | 890 | size_t size) |
868 | { | 891 | { |
@@ -957,10 +980,9 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, | |||
957 | } | 980 | } |
958 | 981 | ||
959 | /* NameServer Req */ | 982 | /* NameServer Req */ |
960 | lpfc_printf_log(phba, KERN_INFO ,LOG_DISCOVERY, | 983 | lpfc_printf_vlog(vport, KERN_INFO ,LOG_DISCOVERY, |
961 | "%d (%d):0236 NameServer Req Data: x%x x%x x%x\n", | 984 | "0236 NameServer Req Data: x%x x%x x%x\n", |
962 | phba->brd_no, vport->vpi, cmdcode, vport->fc_flag, | 985 | cmdcode, vport->fc_flag, vport->fc_rscn_id_cnt); |
963 | vport->fc_rscn_id_cnt); | ||
964 | 986 | ||
965 | bpl = (struct ulp_bde64 *) bmp->virt; | 987 | bpl = (struct ulp_bde64 *) bmp->virt; |
966 | memset(bpl, 0, sizeof(struct ulp_bde64)); | 988 | memset(bpl, 0, sizeof(struct ulp_bde64)); |
@@ -1059,6 +1081,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, | |||
1059 | cmpl = lpfc_cmpl_ct_cmd_rff_id; | 1081 | cmpl = lpfc_cmpl_ct_cmd_rff_id; |
1060 | break; | 1082 | break; |
1061 | } | 1083 | } |
1084 | lpfc_nlp_get(ndlp); | ||
1062 | 1085 | ||
1063 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) { | 1086 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) { |
1064 | /* On success, The cmpl function will free the buffers */ | 1087 | /* On success, The cmpl function will free the buffers */ |
@@ -1069,6 +1092,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, | |||
1069 | } | 1092 | } |
1070 | 1093 | ||
1071 | rc=6; | 1094 | rc=6; |
1095 | lpfc_nlp_put(ndlp); | ||
1072 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | 1096 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); |
1073 | ns_cmd_free_bmp: | 1097 | ns_cmd_free_bmp: |
1074 | kfree(bmp); | 1098 | kfree(bmp); |
@@ -1077,10 +1101,9 @@ ns_cmd_free_mpvirt: | |||
1077 | ns_cmd_free_mp: | 1101 | ns_cmd_free_mp: |
1078 | kfree(mp); | 1102 | kfree(mp); |
1079 | ns_cmd_exit: | 1103 | ns_cmd_exit: |
1080 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 1104 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
1081 | "%d (%d):0266 Issue NameServer Req x%x err %d Data: x%x x%x\n", | 1105 | "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, | 1106 | cmdcode, rc, vport->fc_flag, vport->fc_rscn_id_cnt); |
1083 | vport->fc_rscn_id_cnt); | ||
1084 | return 1; | 1107 | return 1; |
1085 | } | 1108 | } |
1086 | 1109 | ||
@@ -1106,12 +1129,11 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1106 | irsp->ulpStatus, irsp->un.ulpWord[4], latt); | 1129 | irsp->ulpStatus, irsp->un.ulpWord[4], latt); |
1107 | 1130 | ||
1108 | if (latt || irsp->ulpStatus) { | 1131 | if (latt || irsp->ulpStatus) { |
1109 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 1132 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
1110 | "%d (%d):0229 FDMI cmd %04x failed, latt = %d " | 1133 | "0229 FDMI cmd %04x failed, latt = %d " |
1111 | "ulpStatus: x%x, rid x%x\n", | 1134 | "ulpStatus: x%x, rid x%x\n", |
1112 | phba->brd_no, vport->vpi, | 1135 | be16_to_cpu(fdmi_cmd), latt, irsp->ulpStatus, |
1113 | be16_to_cpu(fdmi_cmd), latt, irsp->ulpStatus, | 1136 | irsp->un.ulpWord[4]); |
1114 | irsp->un.ulpWord[4]); | ||
1115 | lpfc_ct_free_iocb(phba, cmdiocb); | 1137 | lpfc_ct_free_iocb(phba, cmdiocb); |
1116 | return; | 1138 | return; |
1117 | } | 1139 | } |
@@ -1119,10 +1141,9 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1119 | ndlp = lpfc_findnode_did(vport, FDMI_DID); | 1141 | ndlp = lpfc_findnode_did(vport, FDMI_DID); |
1120 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { | 1142 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { |
1121 | /* FDMI rsp failed */ | 1143 | /* FDMI rsp failed */ |
1122 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 1144 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
1123 | "%d (%d):0220 FDMI rsp failed Data: x%x\n", | 1145 | "0220 FDMI rsp failed Data: x%x\n", |
1124 | phba->brd_no, vport->vpi, | 1146 | be16_to_cpu(fdmi_cmd)); |
1125 | be16_to_cpu(fdmi_cmd)); | ||
1126 | } | 1147 | } |
1127 | 1148 | ||
1128 | switch (be16_to_cpu(fdmi_cmd)) { | 1149 | switch (be16_to_cpu(fdmi_cmd)) { |
@@ -1185,11 +1206,9 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) | |||
1185 | INIT_LIST_HEAD(&bmp->list); | 1206 | INIT_LIST_HEAD(&bmp->list); |
1186 | 1207 | ||
1187 | /* FDMI request */ | 1208 | /* FDMI request */ |
1188 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 1209 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
1189 | "%d (%d):0218 FDMI Request Data: x%x x%x x%x\n", | 1210 | "0218 FDMI Request Data: x%x x%x x%x\n", |
1190 | phba->brd_no, vport->vpi, vport->fc_flag, | 1211 | vport->fc_flag, vport->port_state, cmdcode); |
1191 | vport->port_state, cmdcode); | ||
1192 | |||
1193 | CtReq = (struct lpfc_sli_ct_request *) mp->virt; | 1212 | CtReq = (struct lpfc_sli_ct_request *) mp->virt; |
1194 | 1213 | ||
1195 | memset(CtReq, 0, sizeof(struct lpfc_sli_ct_request)); | 1214 | memset(CtReq, 0, sizeof(struct lpfc_sli_ct_request)); |
@@ -1449,7 +1468,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) | |||
1449 | pab->ab.EntryCnt++; | 1468 | pab->ab.EntryCnt++; |
1450 | size += FOURBYTES + len; | 1469 | size += FOURBYTES + len; |
1451 | 1470 | ||
1452 | if (phba->cfg_fdmi_on == 2) { | 1471 | if (vport->cfg_fdmi_on == 2) { |
1453 | /* #6 Port attribute entry */ | 1472 | /* #6 Port attribute entry */ |
1454 | ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab + | 1473 | ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab + |
1455 | size); | 1474 | size); |
@@ -1499,10 +1518,12 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) | |||
1499 | bpl->tus.w = le32_to_cpu(bpl->tus.w); | 1518 | bpl->tus.w = le32_to_cpu(bpl->tus.w); |
1500 | 1519 | ||
1501 | cmpl = lpfc_cmpl_ct_cmd_fdmi; | 1520 | cmpl = lpfc_cmpl_ct_cmd_fdmi; |
1521 | lpfc_nlp_get(ndlp); | ||
1502 | 1522 | ||
1503 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0)) | 1523 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0)) |
1504 | return 0; | 1524 | return 0; |
1505 | 1525 | ||
1526 | lpfc_nlp_put(ndlp); | ||
1506 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | 1527 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); |
1507 | fdmi_cmd_free_bmp: | 1528 | fdmi_cmd_free_bmp: |
1508 | kfree(bmp); | 1529 | kfree(bmp); |
@@ -1512,9 +1533,9 @@ fdmi_cmd_free_mp: | |||
1512 | kfree(mp); | 1533 | kfree(mp); |
1513 | fdmi_cmd_exit: | 1534 | fdmi_cmd_exit: |
1514 | /* Issue FDMI request failed */ | 1535 | /* Issue FDMI request failed */ |
1515 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 1536 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
1516 | "%d (%d):0244 Issue FDMI request failed Data: x%x\n", | 1537 | "0244 Issue FDMI request failed Data: x%x\n", |
1517 | phba->brd_no, vport->vpi, cmdcode); | 1538 | cmdcode); |
1518 | return 1; | 1539 | return 1; |
1519 | } | 1540 | } |
1520 | 1541 | ||