.. | .. |
---|
1 | 1 | /******************************************************************* |
---|
2 | 2 | * This file is part of the Emulex Linux Device Driver for * |
---|
3 | 3 | * Fibre Channel Host Bus Adapters. * |
---|
4 | | - * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term * |
---|
| 4 | + * Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term * |
---|
5 | 5 | * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * |
---|
6 | 6 | * Copyright (C) 2004-2016 Emulex. All rights reserved. * |
---|
7 | 7 | * EMULEX and SLI are trademarks of Emulex. * |
---|
.. | .. |
---|
44 | 44 | #include "lpfc_disc.h" |
---|
45 | 45 | #include "lpfc.h" |
---|
46 | 46 | #include "lpfc_scsi.h" |
---|
47 | | -#include "lpfc_nvme.h" |
---|
48 | 47 | #include "lpfc_logmsg.h" |
---|
49 | 48 | #include "lpfc_crtn.h" |
---|
50 | 49 | #include "lpfc_version.h" |
---|
.. | .. |
---|
301 | 300 | return 0; |
---|
302 | 301 | } |
---|
303 | 302 | |
---|
304 | | -/** |
---|
| 303 | +/* |
---|
305 | 304 | * lpfc_gen_req - Build and issue a GEN_REQUEST command to the SLI Layer |
---|
306 | 305 | * @vport: pointer to a host virtual N_Port data structure. |
---|
307 | 306 | * @bmp: Pointer to BPL for SLI command |
---|
.. | .. |
---|
388 | 387 | rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, geniocb, 0); |
---|
389 | 388 | |
---|
390 | 389 | if (rc == IOCB_ERROR) { |
---|
| 390 | + geniocb->context_un.ndlp = NULL; |
---|
| 391 | + lpfc_nlp_put(ndlp); |
---|
391 | 392 | lpfc_sli_release_iocbq(phba, geniocb); |
---|
392 | 393 | return 1; |
---|
393 | 394 | } |
---|
.. | .. |
---|
395 | 396 | return 0; |
---|
396 | 397 | } |
---|
397 | 398 | |
---|
398 | | -/** |
---|
| 399 | +/* |
---|
399 | 400 | * lpfc_ct_cmd - Build and issue a CT command |
---|
400 | 401 | * @vport: pointer to a host virtual N_Port data structure. |
---|
401 | 402 | * @inmp: Pointer to data buffer for response data. |
---|
.. | .. |
---|
445 | 446 | struct lpfc_vport *vport_curr; |
---|
446 | 447 | unsigned long flags; |
---|
447 | 448 | |
---|
448 | | - spin_lock_irqsave(&phba->hbalock, flags); |
---|
| 449 | + spin_lock_irqsave(&phba->port_list_lock, flags); |
---|
449 | 450 | list_for_each_entry(vport_curr, &phba->port_list, listentry) { |
---|
450 | 451 | if ((vport_curr->fc_myDID) && (vport_curr->fc_myDID == did)) { |
---|
451 | | - spin_unlock_irqrestore(&phba->hbalock, flags); |
---|
| 452 | + spin_unlock_irqrestore(&phba->port_list_lock, flags); |
---|
452 | 453 | return vport_curr; |
---|
453 | 454 | } |
---|
454 | 455 | } |
---|
455 | | - spin_unlock_irqrestore(&phba->hbalock, flags); |
---|
| 456 | + spin_unlock_irqrestore(&phba->port_list_lock, flags); |
---|
456 | 457 | return NULL; |
---|
457 | 458 | } |
---|
458 | 459 | |
---|
.. | .. |
---|
480 | 481 | |
---|
481 | 482 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
482 | 483 | "0238 Process x%06x NameServer Rsp " |
---|
483 | | - "Data: x%x x%x x%x x%x\n", Did, |
---|
| 484 | + "Data: x%x x%x x%x x%x x%x\n", Did, |
---|
484 | 485 | ndlp->nlp_flag, ndlp->nlp_fc4_type, |
---|
485 | | - vport->fc_flag, |
---|
| 486 | + ndlp->nlp_state, vport->fc_flag, |
---|
486 | 487 | vport->fc_rscn_id_cnt); |
---|
| 488 | + |
---|
| 489 | + /* if ndlp needs to be discovered and prior |
---|
| 490 | + * state of ndlp hit devloss, change state to |
---|
| 491 | + * allow rediscovery. |
---|
| 492 | + */ |
---|
| 493 | + if (ndlp->nlp_flag & NLP_NPR_2B_DISC && |
---|
| 494 | + ndlp->nlp_state == NLP_STE_UNUSED_NODE) { |
---|
| 495 | + lpfc_nlp_set_state(vport, ndlp, |
---|
| 496 | + NLP_STE_NPR_NODE); |
---|
| 497 | + } |
---|
487 | 498 | } else { |
---|
488 | 499 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, |
---|
489 | 500 | "Skip1 GID_FTrsp: did:x%x flg:x%x cnt:%d", |
---|
.. | .. |
---|
491 | 502 | |
---|
492 | 503 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
493 | 504 | "0239 Skip x%06x NameServer Rsp " |
---|
494 | | - "Data: x%x x%x\n", Did, |
---|
495 | | - vport->fc_flag, |
---|
496 | | - vport->fc_rscn_id_cnt); |
---|
| 505 | + "Data: x%x x%x %p\n", |
---|
| 506 | + Did, vport->fc_flag, |
---|
| 507 | + vport->fc_rscn_id_cnt, ndlp); |
---|
497 | 508 | } |
---|
498 | 509 | } else { |
---|
499 | 510 | if (!(vport->fc_flag & FC_RSCN_MODE) || |
---|
.. | .. |
---|
540 | 551 | struct lpfc_hba *phba = vport->phba; |
---|
541 | 552 | struct lpfc_nodelist *ndlp = NULL; |
---|
542 | 553 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
---|
| 554 | + char *str; |
---|
543 | 555 | |
---|
| 556 | + if (phba->cfg_ns_query == LPFC_NS_QUERY_GID_FT) |
---|
| 557 | + str = "GID_FT"; |
---|
| 558 | + else |
---|
| 559 | + str = "GID_PT"; |
---|
| 560 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 561 | + "6430 Process %s rsp for %08x type %x %s %s\n", |
---|
| 562 | + str, Did, fc4_type, |
---|
| 563 | + (fc4_type == FC_TYPE_FCP) ? "FCP" : " ", |
---|
| 564 | + (fc4_type == FC_TYPE_NVME) ? "NVME" : " "); |
---|
544 | 565 | /* |
---|
545 | 566 | * To conserve rpi's, filter out addresses for other |
---|
546 | 567 | * vports on the same physical HBAs. |
---|
.. | .. |
---|
694 | 715 | /* This is a GID_FT completing so the gidft_inp counter was |
---|
695 | 716 | * incremented before the GID_FT was issued to the wire. |
---|
696 | 717 | */ |
---|
697 | | - vport->gidft_inp--; |
---|
| 718 | + if (vport->gidft_inp) |
---|
| 719 | + vport->gidft_inp--; |
---|
698 | 720 | |
---|
699 | 721 | /* |
---|
700 | 722 | * Skip processing the NS response |
---|
.. | .. |
---|
722 | 744 | goto out; |
---|
723 | 745 | |
---|
724 | 746 | /* CT command is being retried */ |
---|
725 | | - vport->gidft_inp--; |
---|
726 | 747 | rc = lpfc_ns_cmd(vport, SLI_CTNS_GID_FT, |
---|
727 | 748 | vport->fc_ns_retry, type); |
---|
728 | 749 | if (rc == 0) |
---|
729 | 750 | goto out; |
---|
| 751 | + else { /* Unable to send NS cmd */ |
---|
| 752 | + if (vport->gidft_inp) |
---|
| 753 | + vport->gidft_inp--; |
---|
| 754 | + } |
---|
730 | 755 | } |
---|
731 | 756 | if (vport->fc_flag & FC_RSCN_MODE) |
---|
732 | 757 | lpfc_els_flush_rscn(vport); |
---|
733 | 758 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
---|
734 | | - lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
---|
| 759 | + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |
---|
735 | 760 | "0257 GID_FT Query error: 0x%x 0x%x\n", |
---|
736 | 761 | irsp->ulpStatus, vport->fc_ns_retry); |
---|
737 | 762 | } else { |
---|
.. | .. |
---|
741 | 766 | if (CTrsp->CommandResponse.bits.CmdRsp == |
---|
742 | 767 | cpu_to_be16(SLI_CT_RESPONSE_FS_ACC)) { |
---|
743 | 768 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
744 | | - "0208 NameServer Rsp Data: x%x x%x\n", |
---|
| 769 | + "0208 NameServer Rsp Data: x%x x%x " |
---|
| 770 | + "x%x x%x sz x%x\n", |
---|
745 | 771 | vport->fc_flag, |
---|
746 | | - CTreq->un.gid.Fc4Type); |
---|
| 772 | + CTreq->un.gid.Fc4Type, |
---|
| 773 | + vport->num_disc_nodes, |
---|
| 774 | + vport->gidft_inp, |
---|
| 775 | + irsp->un.genreq64.bdl.bdeSize); |
---|
747 | 776 | |
---|
748 | 777 | lpfc_ns_rsp(vport, |
---|
749 | 778 | outp, |
---|
.. | .. |
---|
788 | 817 | |
---|
789 | 818 | } else { |
---|
790 | 819 | /* NameServer Rsp Error */ |
---|
791 | | - lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
---|
| 820 | + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |
---|
792 | 821 | "0241 NameServer Rsp Error " |
---|
793 | 822 | "Data: x%x x%x x%x x%x\n", |
---|
794 | 823 | CTrsp->CommandResponse.bits.CmdRsp, |
---|
.. | .. |
---|
802 | 831 | (uint32_t) CTrsp->ReasonCode, |
---|
803 | 832 | (uint32_t) CTrsp->Explanation); |
---|
804 | 833 | } |
---|
805 | | - vport->gidft_inp--; |
---|
| 834 | + if (vport->gidft_inp) |
---|
| 835 | + vport->gidft_inp--; |
---|
806 | 836 | } |
---|
| 837 | + |
---|
| 838 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 839 | + "4216 GID_FT cmpl inp %d disc %d\n", |
---|
| 840 | + vport->gidft_inp, vport->num_disc_nodes); |
---|
| 841 | + |
---|
807 | 842 | /* Link up / RSCN discovery */ |
---|
808 | 843 | if ((vport->num_disc_nodes == 0) && |
---|
809 | 844 | (vport->gidft_inp == 0)) { |
---|
.. | .. |
---|
832 | 867 | } |
---|
833 | 868 | |
---|
834 | 869 | static void |
---|
| 870 | +lpfc_cmpl_ct_cmd_gid_pt(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
---|
| 871 | + struct lpfc_iocbq *rspiocb) |
---|
| 872 | +{ |
---|
| 873 | + struct lpfc_vport *vport = cmdiocb->vport; |
---|
| 874 | + struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
---|
| 875 | + IOCB_t *irsp; |
---|
| 876 | + struct lpfc_dmabuf *outp; |
---|
| 877 | + struct lpfc_dmabuf *inp; |
---|
| 878 | + struct lpfc_sli_ct_request *CTrsp; |
---|
| 879 | + struct lpfc_sli_ct_request *CTreq; |
---|
| 880 | + struct lpfc_nodelist *ndlp; |
---|
| 881 | + int rc; |
---|
| 882 | + |
---|
| 883 | + /* First save ndlp, before we overwrite it */ |
---|
| 884 | + ndlp = cmdiocb->context_un.ndlp; |
---|
| 885 | + |
---|
| 886 | + /* we pass cmdiocb to state machine which needs rspiocb as well */ |
---|
| 887 | + cmdiocb->context_un.rsp_iocb = rspiocb; |
---|
| 888 | + inp = (struct lpfc_dmabuf *)cmdiocb->context1; |
---|
| 889 | + outp = (struct lpfc_dmabuf *)cmdiocb->context2; |
---|
| 890 | + irsp = &rspiocb->iocb; |
---|
| 891 | + |
---|
| 892 | + lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, |
---|
| 893 | + "GID_PT cmpl: status:x%x/x%x rtry:%d", |
---|
| 894 | + irsp->ulpStatus, irsp->un.ulpWord[4], |
---|
| 895 | + vport->fc_ns_retry); |
---|
| 896 | + |
---|
| 897 | + /* Don't bother processing response if vport is being torn down. */ |
---|
| 898 | + if (vport->load_flag & FC_UNLOADING) { |
---|
| 899 | + if (vport->fc_flag & FC_RSCN_MODE) |
---|
| 900 | + lpfc_els_flush_rscn(vport); |
---|
| 901 | + goto out; |
---|
| 902 | + } |
---|
| 903 | + |
---|
| 904 | + if (lpfc_els_chk_latt(vport)) { |
---|
| 905 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 906 | + "4108 Link event during NS query\n"); |
---|
| 907 | + if (vport->fc_flag & FC_RSCN_MODE) |
---|
| 908 | + lpfc_els_flush_rscn(vport); |
---|
| 909 | + lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
---|
| 910 | + goto out; |
---|
| 911 | + } |
---|
| 912 | + if (lpfc_error_lost_link(irsp)) { |
---|
| 913 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 914 | + "4166 NS query failed due to link event\n"); |
---|
| 915 | + if (vport->fc_flag & FC_RSCN_MODE) |
---|
| 916 | + lpfc_els_flush_rscn(vport); |
---|
| 917 | + goto out; |
---|
| 918 | + } |
---|
| 919 | + |
---|
| 920 | + spin_lock_irq(shost->host_lock); |
---|
| 921 | + if (vport->fc_flag & FC_RSCN_DEFERRED) { |
---|
| 922 | + vport->fc_flag &= ~FC_RSCN_DEFERRED; |
---|
| 923 | + spin_unlock_irq(shost->host_lock); |
---|
| 924 | + |
---|
| 925 | + /* This is a GID_PT completing so the gidft_inp counter was |
---|
| 926 | + * incremented before the GID_PT was issued to the wire. |
---|
| 927 | + */ |
---|
| 928 | + if (vport->gidft_inp) |
---|
| 929 | + vport->gidft_inp--; |
---|
| 930 | + |
---|
| 931 | + /* |
---|
| 932 | + * Skip processing the NS response |
---|
| 933 | + * Re-issue the NS cmd |
---|
| 934 | + */ |
---|
| 935 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
---|
| 936 | + "4167 Process Deferred RSCN Data: x%x x%x\n", |
---|
| 937 | + vport->fc_flag, vport->fc_rscn_id_cnt); |
---|
| 938 | + lpfc_els_handle_rscn(vport); |
---|
| 939 | + |
---|
| 940 | + goto out; |
---|
| 941 | + } |
---|
| 942 | + spin_unlock_irq(shost->host_lock); |
---|
| 943 | + |
---|
| 944 | + if (irsp->ulpStatus) { |
---|
| 945 | + /* Check for retry */ |
---|
| 946 | + if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { |
---|
| 947 | + if (irsp->ulpStatus != IOSTAT_LOCAL_REJECT || |
---|
| 948 | + (irsp->un.ulpWord[4] & IOERR_PARAM_MASK) != |
---|
| 949 | + IOERR_NO_RESOURCES) |
---|
| 950 | + vport->fc_ns_retry++; |
---|
| 951 | + |
---|
| 952 | + /* CT command is being retried */ |
---|
| 953 | + rc = lpfc_ns_cmd(vport, SLI_CTNS_GID_PT, |
---|
| 954 | + vport->fc_ns_retry, GID_PT_N_PORT); |
---|
| 955 | + if (rc == 0) |
---|
| 956 | + goto out; |
---|
| 957 | + else { /* Unable to send NS cmd */ |
---|
| 958 | + if (vport->gidft_inp) |
---|
| 959 | + vport->gidft_inp--; |
---|
| 960 | + } |
---|
| 961 | + } |
---|
| 962 | + if (vport->fc_flag & FC_RSCN_MODE) |
---|
| 963 | + lpfc_els_flush_rscn(vport); |
---|
| 964 | + lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
---|
| 965 | + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |
---|
| 966 | + "4103 GID_FT Query error: 0x%x 0x%x\n", |
---|
| 967 | + irsp->ulpStatus, vport->fc_ns_retry); |
---|
| 968 | + } else { |
---|
| 969 | + /* Good status, continue checking */ |
---|
| 970 | + CTreq = (struct lpfc_sli_ct_request *)inp->virt; |
---|
| 971 | + CTrsp = (struct lpfc_sli_ct_request *)outp->virt; |
---|
| 972 | + if (CTrsp->CommandResponse.bits.CmdRsp == |
---|
| 973 | + cpu_to_be16(SLI_CT_RESPONSE_FS_ACC)) { |
---|
| 974 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 975 | + "4105 NameServer Rsp Data: x%x x%x " |
---|
| 976 | + "x%x x%x sz x%x\n", |
---|
| 977 | + vport->fc_flag, |
---|
| 978 | + CTreq->un.gid.Fc4Type, |
---|
| 979 | + vport->num_disc_nodes, |
---|
| 980 | + vport->gidft_inp, |
---|
| 981 | + irsp->un.genreq64.bdl.bdeSize); |
---|
| 982 | + |
---|
| 983 | + lpfc_ns_rsp(vport, |
---|
| 984 | + outp, |
---|
| 985 | + CTreq->un.gid.Fc4Type, |
---|
| 986 | + (uint32_t)(irsp->un.genreq64.bdl.bdeSize)); |
---|
| 987 | + } else if (CTrsp->CommandResponse.bits.CmdRsp == |
---|
| 988 | + be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { |
---|
| 989 | + /* NameServer Rsp Error */ |
---|
| 990 | + if ((CTrsp->ReasonCode == SLI_CT_UNABLE_TO_PERFORM_REQ) |
---|
| 991 | + && (CTrsp->Explanation == SLI_CT_NO_FC4_TYPES)) { |
---|
| 992 | + lpfc_printf_vlog( |
---|
| 993 | + vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 994 | + "4106 No NameServer Entries " |
---|
| 995 | + "Data: x%x x%x x%x x%x\n", |
---|
| 996 | + CTrsp->CommandResponse.bits.CmdRsp, |
---|
| 997 | + (uint32_t)CTrsp->ReasonCode, |
---|
| 998 | + (uint32_t)CTrsp->Explanation, |
---|
| 999 | + vport->fc_flag); |
---|
| 1000 | + |
---|
| 1001 | + lpfc_debugfs_disc_trc( |
---|
| 1002 | + vport, LPFC_DISC_TRC_CT, |
---|
| 1003 | + "GID_PT no entry cmd:x%x rsn:x%x exp:x%x", |
---|
| 1004 | + (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, |
---|
| 1005 | + (uint32_t)CTrsp->ReasonCode, |
---|
| 1006 | + (uint32_t)CTrsp->Explanation); |
---|
| 1007 | + } else { |
---|
| 1008 | + lpfc_printf_vlog( |
---|
| 1009 | + vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 1010 | + "4107 NameServer Rsp Error " |
---|
| 1011 | + "Data: x%x x%x x%x x%x\n", |
---|
| 1012 | + CTrsp->CommandResponse.bits.CmdRsp, |
---|
| 1013 | + (uint32_t)CTrsp->ReasonCode, |
---|
| 1014 | + (uint32_t)CTrsp->Explanation, |
---|
| 1015 | + vport->fc_flag); |
---|
| 1016 | + |
---|
| 1017 | + lpfc_debugfs_disc_trc( |
---|
| 1018 | + vport, LPFC_DISC_TRC_CT, |
---|
| 1019 | + "GID_PT rsp err1 cmd:x%x rsn:x%x exp:x%x", |
---|
| 1020 | + (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, |
---|
| 1021 | + (uint32_t)CTrsp->ReasonCode, |
---|
| 1022 | + (uint32_t)CTrsp->Explanation); |
---|
| 1023 | + } |
---|
| 1024 | + } else { |
---|
| 1025 | + /* NameServer Rsp Error */ |
---|
| 1026 | + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |
---|
| 1027 | + "4109 NameServer Rsp Error " |
---|
| 1028 | + "Data: x%x x%x x%x x%x\n", |
---|
| 1029 | + CTrsp->CommandResponse.bits.CmdRsp, |
---|
| 1030 | + (uint32_t)CTrsp->ReasonCode, |
---|
| 1031 | + (uint32_t)CTrsp->Explanation, |
---|
| 1032 | + vport->fc_flag); |
---|
| 1033 | + |
---|
| 1034 | + lpfc_debugfs_disc_trc( |
---|
| 1035 | + vport, LPFC_DISC_TRC_CT, |
---|
| 1036 | + "GID_PT rsp err2 cmd:x%x rsn:x%x exp:x%x", |
---|
| 1037 | + (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, |
---|
| 1038 | + (uint32_t)CTrsp->ReasonCode, |
---|
| 1039 | + (uint32_t)CTrsp->Explanation); |
---|
| 1040 | + } |
---|
| 1041 | + if (vport->gidft_inp) |
---|
| 1042 | + vport->gidft_inp--; |
---|
| 1043 | + } |
---|
| 1044 | + |
---|
| 1045 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 1046 | + "6450 GID_PT cmpl inp %d disc %d\n", |
---|
| 1047 | + vport->gidft_inp, vport->num_disc_nodes); |
---|
| 1048 | + |
---|
| 1049 | + /* Link up / RSCN discovery */ |
---|
| 1050 | + if ((vport->num_disc_nodes == 0) && |
---|
| 1051 | + (vport->gidft_inp == 0)) { |
---|
| 1052 | + /* |
---|
| 1053 | + * The driver has cycled through all Nports in the RSCN payload. |
---|
| 1054 | + * Complete the handling by cleaning up and marking the |
---|
| 1055 | + * current driver state. |
---|
| 1056 | + */ |
---|
| 1057 | + if (vport->port_state >= LPFC_DISC_AUTH) { |
---|
| 1058 | + if (vport->fc_flag & FC_RSCN_MODE) { |
---|
| 1059 | + lpfc_els_flush_rscn(vport); |
---|
| 1060 | + spin_lock_irq(shost->host_lock); |
---|
| 1061 | + vport->fc_flag |= FC_RSCN_MODE; /* RSCN still */ |
---|
| 1062 | + spin_unlock_irq(shost->host_lock); |
---|
| 1063 | + } else { |
---|
| 1064 | + lpfc_els_flush_rscn(vport); |
---|
| 1065 | + } |
---|
| 1066 | + } |
---|
| 1067 | + |
---|
| 1068 | + lpfc_disc_start(vport); |
---|
| 1069 | + } |
---|
| 1070 | +out: |
---|
| 1071 | + cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */ |
---|
| 1072 | + lpfc_ct_free_iocb(phba, cmdiocb); |
---|
| 1073 | +} |
---|
| 1074 | + |
---|
| 1075 | +static void |
---|
835 | 1076 | lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
---|
836 | 1077 | struct lpfc_iocbq *rspiocb) |
---|
837 | 1078 | { |
---|
.. | .. |
---|
856 | 1097 | /* Good status, continue checking */ |
---|
857 | 1098 | CTrsp = (struct lpfc_sli_ct_request *) outp->virt; |
---|
858 | 1099 | fbits = CTrsp->un.gff_acc.fbits[FCP_TYPE_FEATURE_OFFSET]; |
---|
| 1100 | + |
---|
| 1101 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 1102 | + "6431 Process GFF_ID rsp for %08x " |
---|
| 1103 | + "fbits %02x %s %s\n", |
---|
| 1104 | + did, fbits, |
---|
| 1105 | + (fbits & FC4_FEATURE_INIT) ? "Initiator" : " ", |
---|
| 1106 | + (fbits & FC4_FEATURE_TARGET) ? "Target" : " "); |
---|
859 | 1107 | |
---|
860 | 1108 | if (CTrsp->CommandResponse.bits.CmdRsp == |
---|
861 | 1109 | be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { |
---|
.. | .. |
---|
907 | 1155 | } |
---|
908 | 1156 | } |
---|
909 | 1157 | } |
---|
910 | | - lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
---|
| 1158 | + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |
---|
911 | 1159 | "0267 NameServer GFF Rsp " |
---|
912 | 1160 | "x%x Error (%d %d) Data: x%x x%x\n", |
---|
913 | 1161 | did, irsp->ulpStatus, irsp->un.ulpWord[4], |
---|
.. | .. |
---|
932 | 1180 | /* Link up / RSCN discovery */ |
---|
933 | 1181 | if (vport->num_disc_nodes) |
---|
934 | 1182 | vport->num_disc_nodes--; |
---|
| 1183 | + |
---|
| 1184 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 1185 | + "6451 GFF_ID cmpl inp %d disc %d\n", |
---|
| 1186 | + vport->gidft_inp, vport->num_disc_nodes); |
---|
| 1187 | + |
---|
935 | 1188 | if (vport->num_disc_nodes == 0) { |
---|
936 | 1189 | /* |
---|
937 | 1190 | * The driver has cycled through all Nports in the RSCN payload. |
---|
.. | .. |
---|
979 | 1232 | CTrsp = (struct lpfc_sli_ct_request *)outp->virt; |
---|
980 | 1233 | fc4_data_0 = be32_to_cpu(CTrsp->un.gft_acc.fc4_types[0]); |
---|
981 | 1234 | fc4_data_1 = be32_to_cpu(CTrsp->un.gft_acc.fc4_types[1]); |
---|
| 1235 | + |
---|
982 | 1236 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
983 | | - "3062 DID x%06x GFT Wd0 x%08x Wd1 x%08x\n", |
---|
984 | | - did, fc4_data_0, fc4_data_1); |
---|
| 1237 | + "6432 Process GFT_ID rsp for %08x " |
---|
| 1238 | + "Data %08x %08x %s %s\n", |
---|
| 1239 | + did, fc4_data_0, fc4_data_1, |
---|
| 1240 | + (fc4_data_0 & LPFC_FC4_TYPE_BITMASK) ? |
---|
| 1241 | + "FCP" : " ", |
---|
| 1242 | + (fc4_data_1 & LPFC_FC4_TYPE_BITMASK) ? |
---|
| 1243 | + "NVME" : " "); |
---|
985 | 1244 | |
---|
986 | 1245 | ndlp = lpfc_findnode_did(vport, did); |
---|
987 | 1246 | if (ndlp) { |
---|
.. | .. |
---|
994 | 1253 | if (fc4_data_1 & LPFC_FC4_TYPE_BITMASK) |
---|
995 | 1254 | ndlp->nlp_fc4_type |= NLP_FC4_NVME; |
---|
996 | 1255 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
997 | | - "3064 Setting ndlp %p, DID x%06x with " |
---|
998 | | - "FC4 x%08x, Data: x%08x x%08x\n", |
---|
| 1256 | + "3064 Setting ndlp x%px, DID x%06x " |
---|
| 1257 | + "with FC4 x%08x, Data: x%08x x%08x " |
---|
| 1258 | + "%d\n", |
---|
999 | 1259 | ndlp, did, ndlp->nlp_fc4_type, |
---|
1000 | | - FC_TYPE_FCP, FC_TYPE_NVME); |
---|
1001 | | - ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; |
---|
| 1260 | + FC_TYPE_FCP, FC_TYPE_NVME, |
---|
| 1261 | + ndlp->nlp_state); |
---|
1002 | 1262 | |
---|
1003 | | - lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE); |
---|
1004 | | - lpfc_issue_els_prli(vport, ndlp, 0); |
---|
| 1263 | + if (ndlp->nlp_state == NLP_STE_REG_LOGIN_ISSUE && |
---|
| 1264 | + ndlp->nlp_fc4_type) { |
---|
| 1265 | + ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; |
---|
| 1266 | + |
---|
| 1267 | + lpfc_nlp_set_state(vport, ndlp, |
---|
| 1268 | + NLP_STE_PRLI_ISSUE); |
---|
| 1269 | + lpfc_issue_els_prli(vport, ndlp, 0); |
---|
| 1270 | + } else if (!ndlp->nlp_fc4_type) { |
---|
| 1271 | + /* If fc4 type is still unknown, then LOGO */ |
---|
| 1272 | + lpfc_printf_vlog(vport, KERN_INFO, |
---|
| 1273 | + LOG_DISCOVERY, |
---|
| 1274 | + "6443 Sending LOGO ndlp x%px," |
---|
| 1275 | + "DID x%06x with fc4_type: " |
---|
| 1276 | + "x%08x, state: %d\n", |
---|
| 1277 | + ndlp, did, ndlp->nlp_fc4_type, |
---|
| 1278 | + ndlp->nlp_state); |
---|
| 1279 | + lpfc_issue_els_logo(vport, ndlp, 0); |
---|
| 1280 | + ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; |
---|
| 1281 | + lpfc_nlp_set_state(vport, ndlp, |
---|
| 1282 | + NLP_STE_NPR_NODE); |
---|
| 1283 | + } |
---|
1005 | 1284 | } |
---|
1006 | 1285 | } else |
---|
1007 | | - lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
---|
| 1286 | + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |
---|
1008 | 1287 | "3065 GFT_ID failed x%08x\n", irsp->ulpStatus); |
---|
1009 | 1288 | |
---|
1010 | 1289 | lpfc_ct_free_iocb(phba, cmdiocb); |
---|
.. | .. |
---|
1053 | 1332 | irsp->ulpStatus, irsp->un.ulpWord[4], cmdcode); |
---|
1054 | 1333 | |
---|
1055 | 1334 | if (irsp->ulpStatus) { |
---|
1056 | | - lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
---|
| 1335 | + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |
---|
1057 | 1336 | "0268 NS cmd x%x Error (x%x x%x)\n", |
---|
1058 | 1337 | cmdcode, irsp->ulpStatus, irsp->un.ulpWord[4]); |
---|
1059 | 1338 | |
---|
.. | .. |
---|
1224 | 1503 | lpfc_vport_symbolic_node_name(struct lpfc_vport *vport, char *symbol, |
---|
1225 | 1504 | size_t size) |
---|
1226 | 1505 | { |
---|
1227 | | - char fwrev[FW_REV_STR_SIZE]; |
---|
1228 | | - int n; |
---|
| 1506 | + char fwrev[FW_REV_STR_SIZE] = {0}; |
---|
| 1507 | + char tmp[MAXHOSTNAMELEN] = {0}; |
---|
| 1508 | + |
---|
| 1509 | + memset(symbol, 0, size); |
---|
| 1510 | + |
---|
| 1511 | + scnprintf(tmp, sizeof(tmp), "Emulex %s", vport->phba->ModelName); |
---|
| 1512 | + if (strlcat(symbol, tmp, size) >= size) |
---|
| 1513 | + goto buffer_done; |
---|
1229 | 1514 | |
---|
1230 | 1515 | lpfc_decode_firmware_rev(vport->phba, fwrev, 0); |
---|
| 1516 | + scnprintf(tmp, sizeof(tmp), " FV%s", fwrev); |
---|
| 1517 | + if (strlcat(symbol, tmp, size) >= size) |
---|
| 1518 | + goto buffer_done; |
---|
1231 | 1519 | |
---|
1232 | | - n = scnprintf(symbol, size, "Emulex %s", vport->phba->ModelName); |
---|
1233 | | - if (size < n) |
---|
1234 | | - return n; |
---|
| 1520 | + scnprintf(tmp, sizeof(tmp), " DV%s", lpfc_release_version); |
---|
| 1521 | + if (strlcat(symbol, tmp, size) >= size) |
---|
| 1522 | + goto buffer_done; |
---|
1235 | 1523 | |
---|
1236 | | - n += scnprintf(symbol + n, size - n, " FV%s", fwrev); |
---|
1237 | | - if (size < n) |
---|
1238 | | - return n; |
---|
1239 | | - |
---|
1240 | | - n += scnprintf(symbol + n, size - n, " DV%s.", |
---|
1241 | | - lpfc_release_version); |
---|
1242 | | - if (size < n) |
---|
1243 | | - return n; |
---|
1244 | | - |
---|
1245 | | - n += scnprintf(symbol + n, size - n, " HN:%s.", |
---|
1246 | | - init_utsname()->nodename); |
---|
1247 | | - if (size < n) |
---|
1248 | | - return n; |
---|
| 1524 | + scnprintf(tmp, sizeof(tmp), " HN:%s", vport->phba->os_host_name); |
---|
| 1525 | + if (strlcat(symbol, tmp, size) >= size) |
---|
| 1526 | + goto buffer_done; |
---|
1249 | 1527 | |
---|
1250 | 1528 | /* Note :- OS name is "Linux" */ |
---|
1251 | | - n += scnprintf(symbol + n, size - n, " OS:%s\n", |
---|
1252 | | - init_utsname()->sysname); |
---|
1253 | | - return n; |
---|
| 1529 | + scnprintf(tmp, sizeof(tmp), " OS:%s", init_utsname()->sysname); |
---|
| 1530 | + strlcat(symbol, tmp, size); |
---|
| 1531 | + |
---|
| 1532 | +buffer_done: |
---|
| 1533 | + return strnlen(symbol, size); |
---|
| 1534 | + |
---|
1254 | 1535 | } |
---|
1255 | 1536 | |
---|
1256 | 1537 | static uint32_t |
---|
.. | .. |
---|
1312 | 1593 | struct ulp_bde64 *bpl; |
---|
1313 | 1594 | void (*cmpl) (struct lpfc_hba *, struct lpfc_iocbq *, |
---|
1314 | 1595 | struct lpfc_iocbq *) = NULL; |
---|
| 1596 | + uint32_t *ptr; |
---|
1315 | 1597 | uint32_t rsp_size = 1024; |
---|
1316 | 1598 | size_t size; |
---|
1317 | 1599 | int rc = 0; |
---|
.. | .. |
---|
1365 | 1647 | bpl->tus.f.bdeFlags = 0; |
---|
1366 | 1648 | if (cmdcode == SLI_CTNS_GID_FT) |
---|
1367 | 1649 | bpl->tus.f.bdeSize = GID_REQUEST_SZ; |
---|
| 1650 | + else if (cmdcode == SLI_CTNS_GID_PT) |
---|
| 1651 | + bpl->tus.f.bdeSize = GID_REQUEST_SZ; |
---|
1368 | 1652 | else if (cmdcode == SLI_CTNS_GFF_ID) |
---|
1369 | 1653 | bpl->tus.f.bdeSize = GFF_REQUEST_SZ; |
---|
1370 | 1654 | else if (cmdcode == SLI_CTNS_GFT_ID) |
---|
.. | .. |
---|
1405 | 1689 | rsp_size = FC_MAX_NS_RSP; |
---|
1406 | 1690 | break; |
---|
1407 | 1691 | |
---|
| 1692 | + case SLI_CTNS_GID_PT: |
---|
| 1693 | + CtReq->CommandResponse.bits.CmdRsp = |
---|
| 1694 | + cpu_to_be16(SLI_CTNS_GID_PT); |
---|
| 1695 | + CtReq->un.gid.PortType = context; |
---|
| 1696 | + |
---|
| 1697 | + if (vport->port_state < LPFC_NS_QRY) |
---|
| 1698 | + vport->port_state = LPFC_NS_QRY; |
---|
| 1699 | + lpfc_set_disctmo(vport); |
---|
| 1700 | + cmpl = lpfc_cmpl_ct_cmd_gid_pt; |
---|
| 1701 | + rsp_size = FC_MAX_NS_RSP; |
---|
| 1702 | + break; |
---|
| 1703 | + |
---|
1408 | 1704 | case SLI_CTNS_GFF_ID: |
---|
1409 | 1705 | CtReq->CommandResponse.bits.CmdRsp = |
---|
1410 | 1706 | cpu_to_be16(SLI_CTNS_GFF_ID); |
---|
.. | .. |
---|
1426 | 1722 | CtReq->un.rft.PortId = cpu_to_be32(vport->fc_myDID); |
---|
1427 | 1723 | |
---|
1428 | 1724 | /* Register FC4 FCP type if enabled. */ |
---|
1429 | | - if ((phba->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || |
---|
1430 | | - (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP)) |
---|
| 1725 | + if (vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH || |
---|
| 1726 | + vport->cfg_enable_fc4_type == LPFC_ENABLE_FCP) |
---|
1431 | 1727 | CtReq->un.rft.fcpReg = 1; |
---|
1432 | 1728 | |
---|
1433 | 1729 | /* Register NVME type if enabled. Defined LE and swapped. |
---|
1434 | 1730 | * rsvd[0] is used as word1 because of the hard-coded |
---|
1435 | 1731 | * word0 usage in the ct_request data structure. |
---|
1436 | 1732 | */ |
---|
1437 | | - if ((phba->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || |
---|
1438 | | - (phba->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) |
---|
1439 | | - CtReq->un.rft.rsvd[0] = cpu_to_be32(0x00000100); |
---|
| 1733 | + if (vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH || |
---|
| 1734 | + vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME) |
---|
| 1735 | + CtReq->un.rft.rsvd[0] = |
---|
| 1736 | + cpu_to_be32(LPFC_FC4_TYPE_BITMASK); |
---|
1440 | 1737 | |
---|
| 1738 | + ptr = (uint32_t *)CtReq; |
---|
| 1739 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 1740 | + "6433 Issue RFT (%s %s): %08x %08x %08x %08x " |
---|
| 1741 | + "%08x %08x %08x %08x\n", |
---|
| 1742 | + CtReq->un.rft.fcpReg ? "FCP" : " ", |
---|
| 1743 | + CtReq->un.rft.rsvd[0] ? "NVME" : " ", |
---|
| 1744 | + *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), |
---|
| 1745 | + *(ptr + 4), *(ptr + 5), |
---|
| 1746 | + *(ptr + 6), *(ptr + 7)); |
---|
1441 | 1747 | cmpl = lpfc_cmpl_ct_cmd_rft_id; |
---|
1442 | 1748 | break; |
---|
1443 | 1749 | |
---|
.. | .. |
---|
1492 | 1798 | * caller can specify NVME (type x28) as well. But only |
---|
1493 | 1799 | * these that FC4 type is supported. |
---|
1494 | 1800 | */ |
---|
1495 | | - if (((phba->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || |
---|
1496 | | - (phba->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) && |
---|
| 1801 | + if (((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || |
---|
| 1802 | + (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) && |
---|
1497 | 1803 | (context == FC_TYPE_NVME)) { |
---|
1498 | 1804 | if ((vport == phba->pport) && phba->nvmet_support) { |
---|
1499 | 1805 | CtReq->un.rff.fbits = (FC4_FEATURE_TARGET | |
---|
.. | .. |
---|
1504 | 1810 | } |
---|
1505 | 1811 | CtReq->un.rff.type_code = context; |
---|
1506 | 1812 | |
---|
1507 | | - } else if (((phba->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || |
---|
1508 | | - (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP)) && |
---|
| 1813 | + } else if (((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || |
---|
| 1814 | + (vport->cfg_enable_fc4_type == LPFC_ENABLE_FCP)) && |
---|
1509 | 1815 | (context == FC_TYPE_FCP)) |
---|
1510 | 1816 | CtReq->un.rff.type_code = context; |
---|
1511 | 1817 | |
---|
1512 | 1818 | else |
---|
1513 | 1819 | goto ns_cmd_free_bmpvirt; |
---|
1514 | 1820 | |
---|
| 1821 | + ptr = (uint32_t *)CtReq; |
---|
| 1822 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
---|
| 1823 | + "6434 Issue RFF (%s): %08x %08x %08x %08x " |
---|
| 1824 | + "%08x %08x %08x %08x\n", |
---|
| 1825 | + (context == FC_TYPE_NVME) ? "NVME" : "FCP", |
---|
| 1826 | + *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), |
---|
| 1827 | + *(ptr + 4), *(ptr + 5), |
---|
| 1828 | + *(ptr + 6), *(ptr + 7)); |
---|
1515 | 1829 | cmpl = lpfc_cmpl_ct_cmd_rff_id; |
---|
1516 | 1830 | break; |
---|
1517 | 1831 | } |
---|
.. | .. |
---|
1541 | 1855 | ns_cmd_free_mp: |
---|
1542 | 1856 | kfree(mp); |
---|
1543 | 1857 | ns_cmd_exit: |
---|
1544 | | - lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
---|
| 1858 | + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |
---|
1545 | 1859 | "0266 Issue NameServer Req x%x err %d Data: x%x x%x\n", |
---|
1546 | 1860 | cmdcode, rc, vport->fc_flag, vport->fc_rscn_id_cnt); |
---|
1547 | 1861 | return 1; |
---|
.. | .. |
---|
1582 | 1896 | if (irsp->ulpStatus == IOSTAT_LOCAL_REJECT) { |
---|
1583 | 1897 | switch ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK)) { |
---|
1584 | 1898 | case IOERR_SLI_ABORTED: |
---|
| 1899 | + case IOERR_SLI_DOWN: |
---|
| 1900 | + /* Driver aborted this IO. No retry as error |
---|
| 1901 | + * is likely Offline->Online or some adapter |
---|
| 1902 | + * error. Recovery will try again. |
---|
| 1903 | + */ |
---|
| 1904 | + break; |
---|
1585 | 1905 | case IOERR_ABORT_IN_PROGRESS: |
---|
1586 | 1906 | case IOERR_SEQUENCE_TIMEOUT: |
---|
1587 | 1907 | case IOERR_ILLEGAL_FRAME: |
---|
.. | .. |
---|
1690 | 2010 | |
---|
1691 | 2011 | |
---|
1692 | 2012 | /** |
---|
1693 | | - * lpfc_fdmi_num_disc_check - Check how many mapped NPorts we are connected to |
---|
| 2013 | + * lpfc_fdmi_change_check - Check for changed FDMI parameters |
---|
1694 | 2014 | * @vport: pointer to a host virtual N_Port data structure. |
---|
1695 | 2015 | * |
---|
1696 | | - * Called from hbeat timeout routine to check if the number of discovered |
---|
1697 | | - * ports has changed. If so, re-register thar port Attribute. |
---|
| 2016 | + * Check how many mapped NPorts we are connected to |
---|
| 2017 | + * Check if our hostname changed |
---|
| 2018 | + * Called from hbeat timeout routine to check if any FDMI parameters |
---|
| 2019 | + * changed. If so, re-register those Attributes. |
---|
1698 | 2020 | */ |
---|
1699 | 2021 | void |
---|
1700 | | -lpfc_fdmi_num_disc_check(struct lpfc_vport *vport) |
---|
| 2022 | +lpfc_fdmi_change_check(struct lpfc_vport *vport) |
---|
1701 | 2023 | { |
---|
1702 | 2024 | struct lpfc_hba *phba = vport->phba; |
---|
1703 | 2025 | struct lpfc_nodelist *ndlp; |
---|
.. | .. |
---|
1710 | 2032 | if (!(vport->fc_flag & FC_FABRIC)) |
---|
1711 | 2033 | return; |
---|
1712 | 2034 | |
---|
| 2035 | + ndlp = lpfc_findnode_did(vport, FDMI_DID); |
---|
| 2036 | + if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) |
---|
| 2037 | + return; |
---|
| 2038 | + |
---|
| 2039 | + /* Check if system hostname changed */ |
---|
| 2040 | + if (strcmp(phba->os_host_name, init_utsname()->nodename)) { |
---|
| 2041 | + memset(phba->os_host_name, 0, sizeof(phba->os_host_name)); |
---|
| 2042 | + scnprintf(phba->os_host_name, sizeof(phba->os_host_name), "%s", |
---|
| 2043 | + init_utsname()->nodename); |
---|
| 2044 | + lpfc_ns_cmd(vport, SLI_CTNS_RSNN_NN, 0, 0); |
---|
| 2045 | + |
---|
| 2046 | + /* Since this effects multiple HBA and PORT attributes, we need |
---|
| 2047 | + * de-register and go thru the whole FDMI registration cycle. |
---|
| 2048 | + * DHBA -> DPRT -> RHBA -> RPA (physical port) |
---|
| 2049 | + * DPRT -> RPRT (vports) |
---|
| 2050 | + */ |
---|
| 2051 | + if (vport->port_type == LPFC_PHYSICAL_PORT) |
---|
| 2052 | + lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA, 0); |
---|
| 2053 | + else |
---|
| 2054 | + lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DPRT, 0); |
---|
| 2055 | + |
---|
| 2056 | + /* Since this code path registers all the port attributes |
---|
| 2057 | + * we can just return without further checking. |
---|
| 2058 | + */ |
---|
| 2059 | + return; |
---|
| 2060 | + } |
---|
| 2061 | + |
---|
1713 | 2062 | if (!(vport->fdmi_port_mask & LPFC_FDMI_PORT_ATTR_num_disc)) |
---|
1714 | 2063 | return; |
---|
1715 | 2064 | |
---|
| 2065 | + /* Check if the number of mapped NPorts changed */ |
---|
1716 | 2066 | cnt = lpfc_find_map_node(vport); |
---|
1717 | 2067 | if (cnt == vport->fdmi_num_disc) |
---|
1718 | | - return; |
---|
1719 | | - |
---|
1720 | | - ndlp = lpfc_findnode_did(vport, FDMI_DID); |
---|
1721 | | - if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) |
---|
1722 | 2068 | return; |
---|
1723 | 2069 | |
---|
1724 | 2070 | if (vport->port_type == LPFC_PHYSICAL_PORT) { |
---|
.. | .. |
---|
2056 | 2402 | ae = &ad->AttrValue; |
---|
2057 | 2403 | memset(ae, 0, sizeof(*ae)); |
---|
2058 | 2404 | |
---|
2059 | | - lpfc_decode_firmware_rev(phba, ae->un.AttrString, 1); |
---|
| 2405 | + strlcat(ae->un.AttrString, phba->BIOSVersion, |
---|
| 2406 | + sizeof(ae->un.AttrString)); |
---|
2060 | 2407 | len = strnlen(ae->un.AttrString, |
---|
2061 | 2408 | sizeof(ae->un.AttrString)); |
---|
2062 | 2409 | len += (len & 3) ? (4 - (len & 3)) : 4; |
---|
.. | .. |
---|
2109 | 2456 | lpfc_fdmi_port_attr_fc4type(struct lpfc_vport *vport, |
---|
2110 | 2457 | struct lpfc_fdmi_attr_def *ad) |
---|
2111 | 2458 | { |
---|
| 2459 | + struct lpfc_hba *phba = vport->phba; |
---|
2112 | 2460 | struct lpfc_fdmi_attr_entry *ae; |
---|
2113 | 2461 | uint32_t size; |
---|
2114 | 2462 | |
---|
2115 | 2463 | ae = &ad->AttrValue; |
---|
2116 | 2464 | memset(ae, 0, sizeof(*ae)); |
---|
2117 | 2465 | |
---|
2118 | | - ae->un.AttrTypes[3] = 0x02; /* Type 0x1 - ELS */ |
---|
2119 | 2466 | ae->un.AttrTypes[2] = 0x01; /* Type 0x8 - FCP */ |
---|
2120 | | - if (vport->nvmei_support || vport->phba->nvmet_support) |
---|
2121 | | - ae->un.AttrTypes[6] = 0x01; /* Type 0x28 - NVME */ |
---|
2122 | 2467 | ae->un.AttrTypes[7] = 0x01; /* Type 0x20 - CT */ |
---|
| 2468 | + |
---|
| 2469 | + /* Check to see if Firmware supports NVME and on physical port */ |
---|
| 2470 | + if ((phba->sli_rev == LPFC_SLI_REV4) && (vport == phba->pport) && |
---|
| 2471 | + phba->sli4_hba.pc_sli4_params.nvme) |
---|
| 2472 | + ae->un.AttrTypes[6] = 0x01; /* Type 0x28 - NVME */ |
---|
| 2473 | + |
---|
2123 | 2474 | size = FOURBYTES + 32; |
---|
2124 | 2475 | ad->AttrLen = cpu_to_be16(size); |
---|
2125 | 2476 | ad->AttrType = cpu_to_be16(RPRT_SUPPORTED_FC4_TYPES); |
---|
.. | .. |
---|
2138 | 2489 | |
---|
2139 | 2490 | ae->un.AttrInt = 0; |
---|
2140 | 2491 | if (!(phba->hba_flag & HBA_FCOE_MODE)) { |
---|
| 2492 | + if (phba->lmt & LMT_128Gb) |
---|
| 2493 | + ae->un.AttrInt |= HBA_PORTSPEED_128GFC; |
---|
2141 | 2494 | if (phba->lmt & LMT_64Gb) |
---|
2142 | 2495 | ae->un.AttrInt |= HBA_PORTSPEED_64GFC; |
---|
2143 | 2496 | if (phba->lmt & LMT_32Gb) |
---|
.. | .. |
---|
2214 | 2567 | case LPFC_LINK_SPEED_64GHZ: |
---|
2215 | 2568 | ae->un.AttrInt = HBA_PORTSPEED_64GFC; |
---|
2216 | 2569 | break; |
---|
| 2570 | + case LPFC_LINK_SPEED_128GHZ: |
---|
| 2571 | + ae->un.AttrInt = HBA_PORTSPEED_128GFC; |
---|
| 2572 | + break; |
---|
2217 | 2573 | default: |
---|
2218 | 2574 | ae->un.AttrInt = HBA_PORTSPEED_UNKNOWN; |
---|
2219 | 2575 | break; |
---|
.. | .. |
---|
2256 | 2612 | ae = &ad->AttrValue; |
---|
2257 | 2613 | |
---|
2258 | 2614 | hsp = (struct serv_parm *)&vport->fc_sparam; |
---|
2259 | | - ae->un.AttrInt = (((uint32_t) hsp->cmn.bbRcvSizeMsb) << 8) | |
---|
| 2615 | + ae->un.AttrInt = (((uint32_t) hsp->cmn.bbRcvSizeMsb & 0x0F) << 8) | |
---|
2260 | 2616 | (uint32_t) hsp->cmn.bbRcvSizeLsb; |
---|
2261 | 2617 | ae->un.AttrInt = cpu_to_be32(ae->un.AttrInt); |
---|
2262 | 2618 | size = FOURBYTES + sizeof(uint32_t); |
---|
.. | .. |
---|
2297 | 2653 | ae = &ad->AttrValue; |
---|
2298 | 2654 | memset(ae, 0, sizeof(*ae)); |
---|
2299 | 2655 | |
---|
2300 | | - snprintf(ae->un.AttrString, sizeof(ae->un.AttrString), "%s", |
---|
2301 | | - init_utsname()->nodename); |
---|
| 2656 | + scnprintf(ae->un.AttrString, sizeof(ae->un.AttrString), "%s", |
---|
| 2657 | + vport->phba->os_host_name); |
---|
2302 | 2658 | |
---|
2303 | 2659 | len = strnlen(ae->un.AttrString, sizeof(ae->un.AttrString)); |
---|
2304 | 2660 | len += (len & 3) ? (4 - (len & 3)) : 4; |
---|
.. | .. |
---|
2424 | 2780 | ae = &ad->AttrValue; |
---|
2425 | 2781 | memset(ae, 0, sizeof(*ae)); |
---|
2426 | 2782 | |
---|
2427 | | - ae->un.AttrTypes[3] = 0x02; /* Type 0x1 - ELS */ |
---|
2428 | 2783 | ae->un.AttrTypes[2] = 0x01; /* Type 0x8 - FCP */ |
---|
| 2784 | + ae->un.AttrTypes[7] = 0x01; /* Type 0x20 - CT */ |
---|
| 2785 | + |
---|
| 2786 | + /* Check to see if NVME is configured or not */ |
---|
2429 | 2787 | if (vport->phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) |
---|
2430 | 2788 | ae->un.AttrTypes[6] = 0x1; /* Type 0x28 - NVME */ |
---|
2431 | | - ae->un.AttrTypes[7] = 0x01; /* Type 0x20 - CT */ |
---|
| 2789 | + |
---|
2432 | 2790 | size = FOURBYTES + 32; |
---|
2433 | 2791 | ad->AttrLen = cpu_to_be16(size); |
---|
2434 | 2792 | ad->AttrType = cpu_to_be16(RPRT_ACTIVE_FC4_TYPES); |
---|
.. | .. |
---|
2673 | 3031 | * lpfc_fdmi_cmd - Build and send a FDMI cmd to the specified NPort |
---|
2674 | 3032 | * @vport: pointer to a host virtual N_Port data structure. |
---|
2675 | 3033 | * @ndlp: ndlp to send FDMI cmd to (if NULL use FDMI_DID) |
---|
2676 | | - * cmdcode: FDMI command to send |
---|
2677 | | - * mask: Mask of HBA or PORT Attributes to send |
---|
| 3034 | + * @cmdcode: FDMI command to send |
---|
| 3035 | + * @new_mask: Mask of HBA or PORT Attributes to send |
---|
2678 | 3036 | * |
---|
2679 | 3037 | * Builds and sends a FDMI command using the CT subsystem. |
---|
2680 | 3038 | */ |
---|
.. | .. |
---|
2846 | 3204 | case SLI_MGMT_GHAT: |
---|
2847 | 3205 | case SLI_MGMT_GRPL: |
---|
2848 | 3206 | rsp_size = FC_MAX_NS_RSP; |
---|
| 3207 | + fallthrough; |
---|
2849 | 3208 | case SLI_MGMT_DHBA: |
---|
2850 | 3209 | case SLI_MGMT_DHAT: |
---|
2851 | 3210 | pe = (struct lpfc_fdmi_port_entry *)&CtReq->un.PortID; |
---|
.. | .. |
---|
2858 | 3217 | case SLI_MGMT_GPAT: |
---|
2859 | 3218 | case SLI_MGMT_GPAS: |
---|
2860 | 3219 | rsp_size = FC_MAX_NS_RSP; |
---|
| 3220 | + fallthrough; |
---|
2861 | 3221 | case SLI_MGMT_DPRT: |
---|
2862 | 3222 | case SLI_MGMT_DPA: |
---|
2863 | 3223 | pe = (struct lpfc_fdmi_port_entry *)&CtReq->un.PortID; |
---|
.. | .. |
---|
2914 | 3274 | |
---|
2915 | 3275 | /** |
---|
2916 | 3276 | * lpfc_delayed_disc_tmo - Timeout handler for delayed discovery timer. |
---|
2917 | | - * @ptr - Context object of the timer. |
---|
| 3277 | + * @t: Context object of the timer. |
---|
2918 | 3278 | * |
---|
2919 | 3279 | * This function set the WORKER_DELAYED_DISC_TMO flag and wake up |
---|
2920 | 3280 | * the worker thread. |
---|