Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge patch series "Update lpfc to revision 14.4.0.12"

Justin Tee <justin.tee@broadcom.com> says:

Update lpfc to revision 14.4.0.12

This patch set contains updates to log messaging, revision of outdated
comment descriptions, fixes to kref accounting, support for BB credit
recovery in point-to-point mode, and introduction of registering unique
platform name identifiers with fabrics.

The patches were cut against Martin's 6.19/scsi-queue tree.

Link: https://patch.msgid.link/20251106224639.139176-1-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

+327 -110
+3 -1
drivers/scsi/lpfc/lpfc.h
··· 311 311 u16 rx_id; 312 312 u16 ox_id; 313 313 struct lpfc_nodelist *ndlp; 314 - 315 314 }; 316 315 317 316 #define LPFC_VMID_TIMER 300 /* timer interval in seconds */ ··· 633 634 #define FC_CT_RSPN_ID 0x8 /* RSPN_ID accepted by switch */ 634 635 #define FC_CT_RFT_ID 0x10 /* RFT_ID accepted by switch */ 635 636 #define FC_CT_RPRT_DEFER 0x20 /* Defer issuing FDMI RPRT */ 637 + #define FC_CT_RSPNI_PNI 0x40 /* RSPNI_PNI accepted by switch */ 636 638 637 639 struct list_head fc_nodes; 638 640 spinlock_t fc_nodes_list_lock; /* spinlock for fc_nodes list */ ··· 1077 1077 struct lpfc_stats fc_stat; 1078 1078 1079 1079 uint32_t nport_event_cnt; /* timestamp for nlplist entry */ 1080 + 1081 + unsigned long pni; /* 64-bit Platform Name Identifier */ 1080 1082 1081 1083 uint8_t wwnn[8]; 1082 1084 uint8_t wwpn[8];
+36
drivers/scsi/lpfc/lpfc_ct.c
··· 1743 1743 } 1744 1744 1745 1745 static void 1746 + lpfc_cmpl_ct_cmd_rspni_pni(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, 1747 + struct lpfc_iocbq *rspiocb) 1748 + { 1749 + struct lpfc_vport *vport; 1750 + struct lpfc_dmabuf *outp; 1751 + struct lpfc_sli_ct_request *ctrsp; 1752 + u32 ulp_status; 1753 + 1754 + vport = cmdiocb->vport; 1755 + ulp_status = get_job_ulpstatus(phba, rspiocb); 1756 + 1757 + if (ulp_status == IOSTAT_SUCCESS) { 1758 + outp = cmdiocb->rsp_dmabuf; 1759 + ctrsp = (struct lpfc_sli_ct_request *)outp->virt; 1760 + if (be16_to_cpu(ctrsp->CommandResponse.bits.CmdRsp) == 1761 + SLI_CT_RESPONSE_FS_ACC) 1762 + vport->ct_flags |= FC_CT_RSPNI_PNI; 1763 + } 1764 + lpfc_cmpl_ct(phba, cmdiocb, rspiocb); 1765 + } 1766 + 1767 + static void 1746 1768 lpfc_cmpl_ct_cmd_da_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, 1747 1769 struct lpfc_iocbq *rspiocb) 1748 1770 { ··· 1978 1956 bpl->tus.f.bdeSize = RSPN_REQUEST_SZ; 1979 1957 else if (cmdcode == SLI_CTNS_RSNN_NN) 1980 1958 bpl->tus.f.bdeSize = RSNN_REQUEST_SZ; 1959 + else if (cmdcode == SLI_CTNS_RSPNI_PNI) 1960 + bpl->tus.f.bdeSize = RSPNI_REQUEST_SZ; 1981 1961 else if (cmdcode == SLI_CTNS_DA_ID) 1982 1962 bpl->tus.f.bdeSize = DA_ID_REQUEST_SZ; 1983 1963 else if (cmdcode == SLI_CTNS_RFF_ID) ··· 2100 2076 lpfc_vport_symbolic_node_name(vport, 2101 2077 CtReq->un.rsnn.symbname, size); 2102 2078 cmpl = lpfc_cmpl_ct_cmd_rsnn_nn; 2079 + break; 2080 + case SLI_CTNS_RSPNI_PNI: 2081 + vport->ct_flags &= ~FC_CT_RSPNI_PNI; 2082 + CtReq->CommandResponse.bits.CmdRsp = 2083 + cpu_to_be16(SLI_CTNS_RSPNI_PNI); 2084 + CtReq->un.rspni.pni = cpu_to_be64(phba->pni); 2085 + scnprintf(CtReq->un.rspni.symbname, 2086 + sizeof(CtReq->un.rspni.symbname), "OS Host Name::%s", 2087 + phba->os_host_name); 2088 + CtReq->un.rspni.len = strnlen(CtReq->un.rspni.symbname, 2089 + sizeof(CtReq->un.rspni.symbname)); 2090 + cmpl = lpfc_cmpl_ct_cmd_rspni_pni; 2103 2091 break; 2104 2092 case SLI_CTNS_DA_ID: 2105 2093 /* Implement DA_ID Nameserver request */
+2 -1
drivers/scsi/lpfc/lpfc_disc.h
··· 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-2024 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2004-2013 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 208 208 NPR list */ 209 209 NLP_RM_DFLT_RPI = 26, /* need to remove leftover dflt RPI */ 210 210 NLP_NODEV_REMOVE = 27, /* Defer removal till discovery ends */ 211 + NLP_FLOGI_DFR_ACC = 28, /* FLOGI LS_ACC was Deferred */ 211 212 NLP_SC_REQ = 29, /* Target requires authentication */ 212 213 NLP_FIRSTBURST = 30, /* Target supports FirstBurst */ 213 214 NLP_RPI_REGISTERED = 31 /* nlp_rpi is valid */
+174 -75
drivers/scsi/lpfc/lpfc_els.c
··· 650 650 ndlp->nlp_class_sup |= FC_COS_CLASS2; 651 651 if (sp->cls3.classValid) 652 652 ndlp->nlp_class_sup |= FC_COS_CLASS3; 653 - if (sp->cls4.classValid) 654 - ndlp->nlp_class_sup |= FC_COS_CLASS4; 655 653 ndlp->nlp_maxframe = ((sp->cmn.bbRcvSizeMsb & 0x0F) << 8) | 656 654 sp->cmn.bbRcvSizeLsb; 657 655 ··· 932 934 /* Check to see if link went down during discovery */ 933 935 if (lpfc_els_chk_latt(vport)) { 934 936 /* One additional decrement on node reference count to 935 - * trigger the release of the node 937 + * trigger the release of the node. Make sure the ndlp 938 + * is marked NLP_DROPPED. 936 939 */ 937 - if (!(ndlp->fc4_xpt_flags & SCSI_XPT_REGD)) 940 + if (!test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag) && 941 + !test_bit(NLP_DROPPED, &ndlp->nlp_flag) && 942 + !(ndlp->fc4_xpt_flags & SCSI_XPT_REGD)) { 943 + set_bit(NLP_DROPPED, &ndlp->nlp_flag); 938 944 lpfc_nlp_put(ndlp); 945 + } 939 946 goto out; 940 947 } 941 948 ··· 998 995 IOERR_LOOP_OPEN_FAILURE))) 999 996 lpfc_vlog_msg(vport, KERN_WARNING, LOG_ELS, 1000 997 "2858 FLOGI Status:x%x/x%x TMO" 1001 - ":x%x Data x%lx x%x\n", 998 + ":x%x Data x%lx x%x x%lx x%x\n", 1002 999 ulp_status, ulp_word4, tmo, 1003 - phba->hba_flag, phba->fcf.fcf_flag); 1000 + phba->hba_flag, phba->fcf.fcf_flag, 1001 + ndlp->nlp_flag, ndlp->fc4_xpt_flags); 1004 1002 1005 1003 /* Check for retry */ 1006 1004 if (lpfc_els_retry(phba, cmdiocb, rspiocb)) { ··· 1019 1015 * reference to trigger node release. 1020 1016 */ 1021 1017 if (!test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag) && 1022 - !(ndlp->fc4_xpt_flags & SCSI_XPT_REGD)) 1018 + !test_bit(NLP_DROPPED, &ndlp->nlp_flag) && 1019 + !(ndlp->fc4_xpt_flags & SCSI_XPT_REGD)) { 1020 + set_bit(NLP_DROPPED, &ndlp->nlp_flag); 1023 1021 lpfc_nlp_put(ndlp); 1022 + } 1024 1023 1025 1024 lpfc_printf_vlog(vport, KERN_WARNING, LOG_ELS, 1026 1025 "0150 FLOGI Status:x%x/x%x " 1027 - "xri x%x TMO:x%x refcnt %d\n", 1026 + "xri x%x iotag x%x TMO:x%x refcnt %d\n", 1028 1027 ulp_status, ulp_word4, cmdiocb->sli4_xritag, 1029 - tmo, kref_read(&ndlp->kref)); 1028 + cmdiocb->iotag, tmo, kref_read(&ndlp->kref)); 1030 1029 1031 1030 /* If this is not a loop open failure, bail out */ 1032 1031 if (!(ulp_status == IOSTAT_LOCAL_REJECT && ··· 1286 1279 uint32_t tmo, did; 1287 1280 int rc; 1288 1281 1282 + /* It's possible for lpfc to reissue a FLOGI on an ndlp that is marked 1283 + * NLP_DROPPED. This happens when the FLOGI completed with the XB bit 1284 + * set causing lpfc to reference the ndlp until the XRI_ABORTED CQE is 1285 + * issued. The time window for the XRI_ABORTED CQE can be as much as 1286 + * 2*2*RA_TOV allowing for ndlp reuse of this type when the link is 1287 + * cycling quickly. When true, restore the initial reference and remove 1288 + * the NLP_DROPPED flag as lpfc is retrying. 1289 + */ 1290 + if (test_and_clear_bit(NLP_DROPPED, &ndlp->nlp_flag)) { 1291 + if (!lpfc_nlp_get(ndlp)) 1292 + return 1; 1293 + } 1294 + 1289 1295 cmdsize = (sizeof(uint32_t) + sizeof(struct serv_parm)); 1290 1296 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, 1291 1297 ndlp->nlp_DID, ELS_CMD_FLOGI); ··· 1354 1334 /* Can't do SLI4 class2 without support sequence coalescing */ 1355 1335 sp->cls2.classValid = 0; 1356 1336 sp->cls2.seqDelivery = 0; 1337 + 1338 + /* Fill out Auxiliary Parameter Data */ 1339 + if (phba->pni) { 1340 + sp->aux.flags = 1341 + AUX_PARM_DATA_VALID | AUX_PARM_PNI_VALID; 1342 + sp->aux.pni = cpu_to_be64(phba->pni); 1343 + sp->aux.npiv_cnt = cpu_to_be16(phba->max_vpi - 1); 1344 + } 1357 1345 } else { 1358 1346 /* Historical, setting sequential-delivery bit for SLI3 */ 1359 1347 sp->cls2.seqDelivery = (sp->cls2.classValid) ? 1 : 0; ··· 1441 1413 phba->defer_flogi_acc.ox_id; 1442 1414 } 1443 1415 1444 - lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 1445 - "3354 Xmit deferred FLOGI ACC: rx_id: x%x," 1446 - " ox_id: x%x, hba_flag x%lx\n", 1447 - phba->defer_flogi_acc.rx_id, 1448 - phba->defer_flogi_acc.ox_id, phba->hba_flag); 1416 + /* The LS_ACC completion needs to drop the initial reference. 1417 + * This is a special case for Pt2Pt because both FLOGIs need 1418 + * to complete and lpfc defers the LS_ACC when the remote 1419 + * FLOGI arrives before the driver's FLOGI. 1420 + */ 1421 + set_bit(NLP_FLOGI_DFR_ACC, &ndlp->nlp_flag); 1449 1422 1450 1423 /* Send deferred FLOGI ACC */ 1451 1424 lpfc_els_rsp_acc(vport, ELS_CMD_FLOGI, &defer_flogi_acc, ··· 1461 1432 lpfc_nlp_put(phba->defer_flogi_acc.ndlp); 1462 1433 phba->defer_flogi_acc.ndlp = NULL; 1463 1434 } 1435 + 1436 + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 1437 + "3354 Xmit deferred FLOGI ACC: rx_id: x%x," 1438 + " ox_id: x%x, ndlp x%px hba_flag x%lx\n", 1439 + phba->defer_flogi_acc.rx_id, 1440 + phba->defer_flogi_acc.ox_id, 1441 + phba->defer_flogi_acc.ndlp, 1442 + phba->hba_flag); 1464 1443 1465 1444 vport->fc_myDID = did; 1466 1445 } ··· 2285 2248 2286 2249 sp->cmn.valid_vendor_ver_level = 0; 2287 2250 memset(sp->un.vendorVersion, 0, sizeof(sp->un.vendorVersion)); 2288 - sp->cmn.bbRcvSizeMsb &= 0xF; 2251 + if (!test_bit(FC_PT2PT, &vport->fc_flag)) 2252 + sp->cmn.bbRcvSizeMsb &= 0xF; 2289 2253 2290 2254 /* Check if the destination port supports VMID */ 2291 2255 ndlp->vmid_support = 0; ··· 2405 2367 mode = KERN_INFO; 2406 2368 2407 2369 /* Warn PRLI status */ 2408 - lpfc_printf_vlog(vport, mode, LOG_ELS, 2370 + lpfc_vlog_msg(vport, mode, LOG_ELS, 2409 2371 "2754 PRLI DID:%06X Status:x%x/x%x, " 2410 2372 "data: x%x x%x x%lx\n", 2411 2373 ndlp->nlp_DID, ulp_status, ··· 3062 3024 ndlp->nlp_DID, ulp_status, 3063 3025 ulp_word4); 3064 3026 3027 + /* Call NLP_EVT_DEVICE_RM if link is down or LOGO is aborted */ 3065 3028 if (lpfc_error_lost_link(vport, ulp_status, ulp_word4)) 3066 3029 skip_recovery = 1; 3067 3030 } ··· 3301 3262 return -ENOMEM; 3302 3263 } 3303 3264 rc = lpfc_reg_rpi(phba, vport->vpi, fc_ndlp->nlp_DID, 3304 - (u8 *)&vport->fc_sparam, mbox, fc_ndlp->nlp_rpi); 3265 + (u8 *)&ns_ndlp->fc_sparam, mbox, fc_ndlp->nlp_rpi); 3305 3266 if (rc) { 3306 3267 rc = -EACCES; 3307 3268 goto out; ··· 3345 3306 * 3346 3307 * This routine is a generic completion callback function for Discovery ELS cmd. 3347 3308 * Currently used by the ELS command issuing routines for the ELS State Change 3348 - * Request (SCR), lpfc_issue_els_scr() and the ELS RDF, lpfc_issue_els_rdf(). 3309 + * Request (SCR), lpfc_issue_els_scr(), Exchange Diagnostic Capabilities (EDC), 3310 + * lpfc_issue_els_edc() and the ELS RDF, lpfc_issue_els_rdf(). 3349 3311 * These commands will be retried once only for ELS timeout errors. 3350 3312 **/ 3351 3313 static void ··· 3419 3379 lpfc_cmpl_els_edc(phba, cmdiocb, rspiocb); 3420 3380 return; 3421 3381 } 3382 + 3422 3383 if (ulp_status) { 3423 3384 /* ELS discovery cmd completes with error */ 3424 3385 lpfc_printf_vlog(vport, KERN_WARNING, LOG_ELS | LOG_CGN_MGMT, 3425 3386 "4203 ELS cmd x%x error: x%x x%X\n", cmd, 3426 3387 ulp_status, ulp_word4); 3388 + 3389 + /* In the case where the ELS cmd completes with an error and 3390 + * the node does not have RPI registered, the node is 3391 + * outstanding and should put its initial reference. 3392 + */ 3393 + if ((cmd == ELS_CMD_SCR || cmd == ELS_CMD_RDF) && 3394 + !(ndlp->fc4_xpt_flags & SCSI_XPT_REGD) && 3395 + !test_and_set_bit(NLP_DROPPED, &ndlp->nlp_flag)) 3396 + lpfc_nlp_put(ndlp); 3427 3397 goto out; 3428 3398 } 3429 3399 ··· 3502 3452 uint8_t *pcmd; 3503 3453 uint16_t cmdsize; 3504 3454 struct lpfc_nodelist *ndlp; 3455 + bool node_created = false; 3505 3456 3506 3457 cmdsize = (sizeof(uint32_t) + sizeof(SCR)); 3507 3458 ··· 3512 3461 if (!ndlp) 3513 3462 return 1; 3514 3463 lpfc_enqueue_node(vport, ndlp); 3464 + node_created = true; 3515 3465 } 3516 3466 3517 3467 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, 3518 3468 ndlp->nlp_DID, ELS_CMD_SCR); 3519 3469 if (!elsiocb) 3520 - return 1; 3470 + goto out_node_created; 3521 3471 3522 3472 if (phba->sli_rev == LPFC_SLI_REV4) { 3523 3473 rc = lpfc_reg_fab_ctrl_node(vport, ndlp); 3524 3474 if (rc) { 3525 - lpfc_els_free_iocb(phba, elsiocb); 3526 3475 lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE, 3527 3476 "0937 %s: Failed to reg fc node, rc %d\n", 3528 3477 __func__, rc); 3529 - return 1; 3478 + goto out_free_iocb; 3530 3479 } 3531 3480 } 3532 3481 pcmd = (uint8_t *)elsiocb->cmd_dmabuf->virt; ··· 3545 3494 phba->fc_stat.elsXmitSCR++; 3546 3495 elsiocb->cmd_cmpl = lpfc_cmpl_els_disc_cmd; 3547 3496 elsiocb->ndlp = lpfc_nlp_get(ndlp); 3548 - if (!elsiocb->ndlp) { 3549 - lpfc_els_free_iocb(phba, elsiocb); 3550 - return 1; 3551 - } 3497 + if (!elsiocb->ndlp) 3498 + goto out_free_iocb; 3552 3499 3553 3500 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, 3554 3501 "Issue SCR: did:x%x refcnt %d", 3555 3502 ndlp->nlp_DID, kref_read(&ndlp->kref), 0); 3556 3503 3557 3504 rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0); 3558 - if (rc == IOCB_ERROR) { 3559 - lpfc_els_free_iocb(phba, elsiocb); 3560 - lpfc_nlp_put(ndlp); 3561 - return 1; 3562 - } 3505 + if (rc == IOCB_ERROR) 3506 + goto out_iocb_error; 3563 3507 3564 3508 return 0; 3509 + 3510 + out_iocb_error: 3511 + lpfc_nlp_put(ndlp); 3512 + out_free_iocb: 3513 + lpfc_els_free_iocb(phba, elsiocb); 3514 + out_node_created: 3515 + if (node_created) 3516 + lpfc_nlp_put(ndlp); 3517 + return 1; 3565 3518 } 3566 3519 3567 3520 /** ··· 3652 3597 } 3653 3598 3654 3599 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, 3655 - "Issue RSCN: did:x%x", 3656 - ndlp->nlp_DID, 0, 0); 3600 + "Issue RSCN: did:x%x refcnt %d", 3601 + ndlp->nlp_DID, kref_read(&ndlp->kref), 0); 3657 3602 3658 3603 rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0); 3659 3604 if (rc == IOCB_ERROR) { ··· 3760 3705 lpfc_nlp_put(ndlp); 3761 3706 return 1; 3762 3707 } 3763 - /* This will cause the callback-function lpfc_cmpl_els_cmd to 3764 - * trigger the release of the node. 3765 - */ 3766 - /* Don't release reference count as RDF is likely outstanding */ 3708 + 3767 3709 return 0; 3768 3710 } 3769 3711 ··· 3778 3726 * 3779 3727 * Return code 3780 3728 * 0 - Successfully issued rdf command 3781 - * 1 - Failed to issue rdf command 3729 + * < 0 - Failed to issue rdf command 3730 + * -EACCES - RDF not required for NPIV_PORT 3731 + * -ENODEV - No fabric controller device available 3732 + * -ENOMEM - No available memory 3733 + * -EIO - The mailbox failed to complete successfully. 3734 + * 3782 3735 **/ 3783 3736 int 3784 3737 lpfc_issue_els_rdf(struct lpfc_vport *vport, uint8_t retry) ··· 3794 3737 struct lpfc_nodelist *ndlp; 3795 3738 uint16_t cmdsize; 3796 3739 int rc; 3740 + bool node_created = false; 3741 + int err; 3797 3742 3798 3743 cmdsize = sizeof(*prdf); 3744 + 3745 + /* RDF ELS is not required on an NPIV VN_Port. */ 3746 + if (vport->port_type == LPFC_NPIV_PORT) 3747 + return -EACCES; 3799 3748 3800 3749 ndlp = lpfc_findnode_did(vport, Fabric_Cntl_DID); 3801 3750 if (!ndlp) { ··· 3809 3746 if (!ndlp) 3810 3747 return -ENODEV; 3811 3748 lpfc_enqueue_node(vport, ndlp); 3749 + node_created = true; 3812 3750 } 3813 - 3814 - /* RDF ELS is not required on an NPIV VN_Port. */ 3815 - if (vport->port_type == LPFC_NPIV_PORT) 3816 - return -EACCES; 3817 3751 3818 3752 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, 3819 3753 ndlp->nlp_DID, ELS_CMD_RDF); 3820 - if (!elsiocb) 3821 - return -ENOMEM; 3754 + if (!elsiocb) { 3755 + err = -ENOMEM; 3756 + goto out_node_created; 3757 + } 3822 3758 3823 3759 /* Configure the payload for the supported FPIN events. */ 3824 3760 prdf = (struct lpfc_els_rdf_req *)elsiocb->cmd_dmabuf->virt; ··· 3843 3781 elsiocb->cmd_cmpl = lpfc_cmpl_els_disc_cmd; 3844 3782 elsiocb->ndlp = lpfc_nlp_get(ndlp); 3845 3783 if (!elsiocb->ndlp) { 3846 - lpfc_els_free_iocb(phba, elsiocb); 3847 - return -EIO; 3784 + err = -EIO; 3785 + goto out_free_iocb; 3848 3786 } 3849 3787 3850 3788 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, ··· 3853 3791 3854 3792 rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0); 3855 3793 if (rc == IOCB_ERROR) { 3856 - lpfc_els_free_iocb(phba, elsiocb); 3857 - lpfc_nlp_put(ndlp); 3858 - return -EIO; 3794 + err = -EIO; 3795 + goto out_iocb_error; 3859 3796 } 3860 3797 return 0; 3798 + 3799 + out_iocb_error: 3800 + lpfc_nlp_put(ndlp); 3801 + out_free_iocb: 3802 + lpfc_els_free_iocb(phba, elsiocb); 3803 + out_node_created: 3804 + if (node_created) 3805 + lpfc_nlp_put(ndlp); 3806 + return err; 3861 3807 } 3862 3808 3863 3809 /** ··· 3886 3816 lpfc_els_rcv_rdf(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, 3887 3817 struct lpfc_nodelist *ndlp) 3888 3818 { 3819 + int rc; 3820 + 3821 + rc = lpfc_els_rsp_acc(vport, ELS_CMD_RDF, cmdiocb, ndlp, NULL); 3889 3822 /* Send LS_ACC */ 3890 - if (lpfc_els_rsp_acc(vport, ELS_CMD_RDF, cmdiocb, ndlp, NULL)) { 3823 + if (rc) { 3891 3824 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_CGN_MGMT, 3892 - "1623 Failed to RDF_ACC from x%x for x%x\n", 3893 - ndlp->nlp_DID, vport->fc_myDID); 3825 + "1623 Failed to RDF_ACC from x%x for x%x Data: %d\n", 3826 + ndlp->nlp_DID, vport->fc_myDID, rc); 3894 3827 return -EIO; 3895 3828 } 3896 3829 3830 + rc = lpfc_issue_els_rdf(vport, 0); 3897 3831 /* Issue new RDF for reregistering */ 3898 - if (lpfc_issue_els_rdf(vport, 0)) { 3832 + if (rc) { 3899 3833 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_CGN_MGMT, 3900 - "2623 Failed to re register RDF for x%x\n", 3901 - vport->fc_myDID); 3834 + "2623 Failed to re register RDF for x%x Data: %d\n", 3835 + vport->fc_myDID, rc); 3902 3836 return -EIO; 3903 3837 } 3904 3838 ··· 4373 4299 rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0); 4374 4300 if (rc == IOCB_ERROR) { 4375 4301 /* The additional lpfc_nlp_put will cause the following 4376 - * lpfc_els_free_iocb routine to trigger the rlease of 4302 + * lpfc_els_free_iocb routine to trigger the release of 4377 4303 * the node. 4378 4304 */ 4379 4305 lpfc_els_free_iocb(phba, elsiocb); ··· 5201 5127 { 5202 5128 struct lpfc_dmabuf *buf_ptr, *buf_ptr1; 5203 5129 5204 - /* The I/O iocb is complete. Clear the node and first dmbuf */ 5130 + /* The I/O iocb is complete. Clear the node and first dmabuf */ 5205 5131 elsiocb->ndlp = NULL; 5206 5132 5207 5133 /* cmd_dmabuf = cmd, cmd_dmabuf->next = rsp, bpl_dmabuf = bpl */ ··· 5234 5160 } else { 5235 5161 buf_ptr1 = elsiocb->cmd_dmabuf; 5236 5162 lpfc_els_free_data(phba, buf_ptr1); 5237 - elsiocb->cmd_dmabuf = NULL; 5238 5163 } 5239 5164 } 5240 5165 5241 5166 if (elsiocb->bpl_dmabuf) { 5242 5167 buf_ptr = elsiocb->bpl_dmabuf; 5243 5168 lpfc_els_free_bpl(phba, buf_ptr); 5244 - elsiocb->bpl_dmabuf = NULL; 5245 5169 } 5246 5170 lpfc_sli_release_iocbq(phba, elsiocb); 5247 5171 return 0; ··· 5377 5305 IOCB_t *irsp; 5378 5306 LPFC_MBOXQ_t *mbox = NULL; 5379 5307 u32 ulp_status, ulp_word4, tmo, did, iotag; 5308 + u32 cmd; 5380 5309 5381 5310 if (!vport) { 5382 5311 lpfc_printf_log(phba, KERN_WARNING, LOG_ELS, 5383 5312 "3177 null vport in ELS rsp\n"); 5384 - goto out; 5313 + goto release; 5385 5314 } 5386 5315 if (cmdiocb->context_un.mbox) 5387 5316 mbox = cmdiocb->context_un.mbox; ··· 5492 5419 * these conditions because it doesn't need the login. 5493 5420 */ 5494 5421 if (phba->sli_rev == LPFC_SLI_REV4 && 5495 - vport && vport->port_type == LPFC_NPIV_PORT && 5422 + vport->port_type == LPFC_NPIV_PORT && 5496 5423 !(ndlp->fc4_xpt_flags & SCSI_XPT_REGD)) { 5497 5424 if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE && 5498 5425 ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE && ··· 5508 5435 } 5509 5436 } 5510 5437 5438 + /* The driver's unsolicited deferred FLOGI ACC in Pt2Pt needs to 5439 + * release the initial reference because the put after the free_iocb 5440 + * call removes only the reference from the defer logic. This FLOGI 5441 + * is never registered with the SCSI transport. 5442 + */ 5443 + if (test_bit(FC_PT2PT, &vport->fc_flag) && 5444 + test_and_clear_bit(NLP_FLOGI_DFR_ACC, &ndlp->nlp_flag)) { 5445 + lpfc_printf_vlog(vport, KERN_INFO, 5446 + LOG_ELS | LOG_NODE | LOG_DISCOVERY, 5447 + "3357 Pt2Pt Defer FLOGI ACC ndlp x%px, " 5448 + "nflags x%lx, fc_flag x%lx\n", 5449 + ndlp, ndlp->nlp_flag, 5450 + vport->fc_flag); 5451 + cmd = *((u32 *)cmdiocb->cmd_dmabuf->virt); 5452 + if (cmd == ELS_CMD_ACC) { 5453 + if (!test_and_set_bit(NLP_DROPPED, &ndlp->nlp_flag)) 5454 + lpfc_nlp_put(ndlp); 5455 + } 5456 + } 5457 + 5458 + release: 5511 5459 /* Release the originating I/O reference. */ 5512 5460 lpfc_els_free_iocb(phba, cmdiocb); 5513 5461 lpfc_nlp_put(ndlp); ··· 5663 5569 sp->cls1.classValid = 0; 5664 5570 sp->cls2.classValid = 0; 5665 5571 sp->cls3.classValid = 0; 5666 - sp->cls4.classValid = 0; 5667 5572 5668 5573 /* Copy our worldwide names */ 5669 5574 memcpy(&sp->portName, &vport->fc_sparam.portName, ··· 5676 5583 sp->cmn.valid_vendor_ver_level = 0; 5677 5584 memset(sp->un.vendorVersion, 0, 5678 5585 sizeof(sp->un.vendorVersion)); 5679 - sp->cmn.bbRcvSizeMsb &= 0xF; 5586 + if (!test_bit(FC_PT2PT, &vport->fc_flag)) 5587 + sp->cmn.bbRcvSizeMsb &= 0xF; 5680 5588 5681 5589 /* If our firmware supports this feature, convey that 5682 5590 * info to the target using the vendor specific field. ··· 8496 8402 &wqe->xmit_els_rsp.wqe_com); 8497 8403 8498 8404 vport->fc_myDID = did; 8499 - 8500 - lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 8501 - "3344 Deferring FLOGI ACC: rx_id: x%x," 8502 - " ox_id: x%x, hba_flag x%lx\n", 8503 - phba->defer_flogi_acc.rx_id, 8504 - phba->defer_flogi_acc.ox_id, phba->hba_flag); 8505 - 8506 8405 phba->defer_flogi_acc.flag = true; 8507 8406 8508 8407 /* This nlp_get is paired with nlp_puts that reset the ··· 8504 8417 * processed or cancelled. 8505 8418 */ 8506 8419 phba->defer_flogi_acc.ndlp = lpfc_nlp_get(ndlp); 8420 + 8421 + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 8422 + "3344 Deferring FLOGI ACC: rx_id: x%x," 8423 + " ox_id: x%x, ndlp x%px, hba_flag x%lx\n", 8424 + phba->defer_flogi_acc.rx_id, 8425 + phba->defer_flogi_acc.ox_id, 8426 + phba->defer_flogi_acc.ndlp, 8427 + phba->hba_flag); 8507 8428 return 0; 8508 8429 } 8509 8430 ··· 8829 8734 * @cmdiocb: pointer to lpfc command iocb data structure. 8830 8735 * @ndlp: pointer to a node-list data structure. 8831 8736 * 8832 - * This routine processes Read Timout Value (RTV) IOCB received as an 8737 + * This routine processes Read Timeout Value (RTV) IOCB received as an 8833 8738 * ELS unsolicited event. It first checks the remote port state. If the 8834 8739 * remote port is not in NLP_STE_UNMAPPED_NODE state or NLP_STE_MAPPED_NODE 8835 8740 * state, it invokes the lpfc_els_rsl_reject() routine to send the reject ··· 10452 10357 * Do not process any unsolicited ELS commands 10453 10358 * if the ndlp is in DEV_LOSS 10454 10359 */ 10455 - if (test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag)) { 10456 - if (newnode) 10457 - lpfc_nlp_put(ndlp); 10360 + if (test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag)) 10458 10361 goto dropit; 10459 - } 10460 10362 10461 10363 elsiocb->ndlp = lpfc_nlp_get(ndlp); 10462 10364 if (!elsiocb->ndlp) ··· 10935 10843 lpfc_els_unsol_buffer(phba, pring, vport, elsiocb); 10936 10844 /* 10937 10845 * The different unsolicited event handlers would tell us 10938 - * if they are done with "mp" by setting cmd_dmabuf to NULL. 10846 + * if they are done with "mp" by setting cmd_dmabuf/bpl_dmabuf to NULL. 10939 10847 */ 10940 10848 if (elsiocb->cmd_dmabuf) { 10941 10849 lpfc_in_buf_free(phba, elsiocb->cmd_dmabuf); ··· 11514 11422 sp->cls1.classValid = 0; 11515 11423 sp->cls2.seqDelivery = 1; 11516 11424 sp->cls3.seqDelivery = 1; 11425 + 11426 + /* Fill out Auxiliary Parameter Data */ 11427 + if (phba->pni) { 11428 + sp->aux.flags = 11429 + AUX_PARM_DATA_VALID | AUX_PARM_PNI_VALID; 11430 + sp->aux.pni = cpu_to_be64(phba->pni); 11431 + } 11517 11432 11518 11433 pcmd += sizeof(uint32_t); /* CSP Word 2 */ 11519 11434 pcmd += sizeof(uint32_t); /* CSP Word 3 */
+5 -1
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 424 424 struct lpfc_nodelist *ndlp) 425 425 { 426 426 if (test_and_clear_bit(NLP_IN_RECOV_POST_DEV_LOSS, &ndlp->save_flags)) { 427 + clear_bit(NLP_DROPPED, &ndlp->nlp_flag); 427 428 lpfc_nlp_get(ndlp); 428 429 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY | LOG_NODE, 429 430 "8438 Devloss timeout reversed on DID x%x " ··· 567 566 return fcf_inuse; 568 567 } 569 568 570 - lpfc_nlp_put(ndlp); 569 + if (!test_and_set_bit(NLP_DROPPED, &ndlp->nlp_flag)) 570 + lpfc_nlp_put(ndlp); 571 571 return fcf_inuse; 572 572 } 573 573 ··· 4373 4371 lpfc_ns_cmd(vport, SLI_CTNS_RNN_ID, 0, 0); 4374 4372 lpfc_ns_cmd(vport, SLI_CTNS_RSNN_NN, 0, 0); 4375 4373 lpfc_ns_cmd(vport, SLI_CTNS_RSPN_ID, 0, 0); 4374 + if (phba->pni) 4375 + lpfc_ns_cmd(vport, SLI_CTNS_RSPNI_PNI, 0, 0); 4376 4376 lpfc_ns_cmd(vport, SLI_CTNS_RFT_ID, 0, 0); 4377 4377 4378 4378 if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
+24 -1
drivers/scsi/lpfc/lpfc_hw.h
··· 168 168 uint8_t len; 169 169 uint8_t symbname[255]; 170 170 } rspn; 171 + struct rspni { /* For RSPNI_PNI requests */ 172 + __be64 pni; 173 + u8 len; 174 + u8 symbname[255]; 175 + } rspni; 171 176 struct gff { 172 177 uint32_t PortId; 173 178 } gff; ··· 218 213 sizeof(struct da_id)) 219 214 #define RSPN_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \ 220 215 sizeof(struct rspn)) 216 + #define RSPNI_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \ 217 + sizeof(struct rspni)) 221 218 222 219 /* 223 220 * FsType Definitions ··· 316 309 #define SLI_CTNS_RIP_NN 0x0235 317 310 #define SLI_CTNS_RIPA_NN 0x0236 318 311 #define SLI_CTNS_RSNN_NN 0x0239 312 + #define SLI_CTNS_RSPNI_PNI 0x0240 319 313 #define SLI_CTNS_DA_ID 0x0300 320 314 321 315 /* ··· 520 512 uint8_t word3Reserved2; /* Fc Word 3, bit 0: 7 */ 521 513 }; 522 514 515 + enum aux_parm_flags { 516 + AUX_PARM_PNI_VALID = 0x20, /* FC Word 0, bit 29 */ 517 + AUX_PARM_DATA_VALID = 0x40, /* FC Word 0, bit 30 */ 518 + }; 519 + 520 + struct aux_parm { 521 + u8 flags; /* FC Word 0, bit 31:24 */ 522 + u8 ext_feat[3]; /* FC Word 0, bit 23:0 */ 523 + 524 + __be64 pni; /* FC Word 1 and 2, platform name identifier */ 525 + 526 + __be16 rsvd; /* FC Word 3, bit 31:16 */ 527 + __be16 npiv_cnt; /* FC Word 3, bit 15:0 */ 528 + } __packed; 529 + 523 530 struct serv_parm { /* Structure is in Big Endian format */ 524 531 struct csp cmn; 525 532 struct lpfc_name portName; ··· 542 519 struct class_parms cls1; 543 520 struct class_parms cls2; 544 521 struct class_parms cls3; 545 - struct class_parms cls4; 522 + struct aux_parm aux; 546 523 union { 547 524 uint8_t vendorVersion[16]; 548 525 struct {
+3 -9
drivers/scsi/lpfc/lpfc_init.c
··· 3057 3057 lpfc_vmid_vport_cleanup(vport); 3058 3058 3059 3059 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { 3060 - if (ndlp->nlp_DID == Fabric_Cntl_DID && 3061 - ndlp->nlp_state == NLP_STE_UNUSED_NODE) { 3062 - lpfc_nlp_put(ndlp); 3063 - continue; 3064 - } 3065 - 3066 3060 /* Fabric Ports not in UNMAPPED state are cleaned up in the 3067 3061 * DEVICE_RM event. 3068 3062 */ ··· 9076 9082 vport->fdmi_port_mask = LPFC_FDMI2_PORT_ATTR; 9077 9083 } 9078 9084 9079 - lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, 9080 - "6077 Setup FDMI mask: hba x%x port x%x\n", 9081 - vport->fdmi_hba_mask, vport->fdmi_port_mask); 9085 + lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 9086 + "6077 Setup FDMI mask: hba x%x port x%x\n", 9087 + vport->fdmi_hba_mask, vport->fdmi_port_mask); 9082 9088 } 9083 9089 9084 9090 /**
+4 -17
drivers/scsi/lpfc/lpfc_nportdisc.c
··· 432 432 ndlp->nlp_class_sup |= FC_COS_CLASS2; 433 433 if (sp->cls3.classValid) 434 434 ndlp->nlp_class_sup |= FC_COS_CLASS3; 435 - if (sp->cls4.classValid) 436 - ndlp->nlp_class_sup |= FC_COS_CLASS4; 437 435 ndlp->nlp_maxframe = 438 436 ((sp->cmn.bbRcvSizeMsb & 0x0F) << 8) | sp->cmn.bbRcvSizeLsb; 439 437 /* if already logged in, do implicit logout */ ··· 450 452 */ 451 453 if (!(ndlp->nlp_type & NLP_FABRIC) && 452 454 !(phba->nvmet_support)) { 453 - /* Clear ndlp info, since follow up PRLI may have 454 - * updated ndlp information 455 - */ 456 - ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); 457 - ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR); 458 - ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; 459 - ndlp->nlp_nvme_info &= ~NLP_NVME_NSLER; 460 - clear_bit(NLP_FIRSTBURST, &ndlp->nlp_flag); 461 - 462 - lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, 463 - ndlp, NULL); 464 - return 1; 455 + break; 465 456 } 466 457 if (nlp_portwwn != 0 && 467 458 nlp_portwwn != wwn_to_u64(sp->portName.u.wwn)) ··· 472 485 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 473 486 break; 474 487 } 475 - 488 + /* Clear ndlp info, since follow up processes may have 489 + * updated ndlp information 490 + */ 476 491 ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); 477 492 ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR); 478 493 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; ··· 1415 1426 ndlp->nlp_class_sup |= FC_COS_CLASS2; 1416 1427 if (sp->cls3.classValid) 1417 1428 ndlp->nlp_class_sup |= FC_COS_CLASS3; 1418 - if (sp->cls4.classValid) 1419 - ndlp->nlp_class_sup |= FC_COS_CLASS4; 1420 1429 ndlp->nlp_maxframe = 1421 1430 ((sp->cmn.bbRcvSizeMsb & 0x0F) << 8) | sp->cmn.bbRcvSizeLsb; 1422 1431
+75 -4
drivers/scsi/lpfc/lpfc_sli.c
··· 27 27 #include <linux/delay.h> 28 28 #include <linux/slab.h> 29 29 #include <linux/lockdep.h> 30 + #include <linux/dmi.h> 31 + #include <linux/of.h> 30 32 31 33 #include <scsi/scsi.h> 32 34 #include <scsi/scsi_cmnd.h> ··· 8449 8447 } 8450 8448 8451 8449 /** 8450 + * lpfc_get_platform_uuid - Attempts to extract a platform uuid 8451 + * @phba: pointer to lpfc hba data structure. 8452 + * 8453 + * This routine attempts to first read SMBIOS DMI data for the System 8454 + * Information structure offset 08h called System UUID. Else, no platform 8455 + * UUID will be advertised. 8456 + **/ 8457 + static void 8458 + lpfc_get_platform_uuid(struct lpfc_hba *phba) 8459 + { 8460 + int rc; 8461 + const char *uuid; 8462 + char pni[17] = {0}; /* 16 characters + '\0' */ 8463 + bool is_ff = true, is_00 = true; 8464 + u8 i; 8465 + 8466 + /* First attempt SMBIOS DMI */ 8467 + uuid = dmi_get_system_info(DMI_PRODUCT_UUID); 8468 + if (uuid) { 8469 + lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 8470 + "2088 SMBIOS UUID %s\n", 8471 + uuid); 8472 + } else { 8473 + lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 8474 + "2099 Could not extract UUID\n"); 8475 + } 8476 + 8477 + if (uuid && uuid_is_valid(uuid)) { 8478 + /* Generate PNI from UUID format. 8479 + * 8480 + * 1.) Extract lower 64 bits from UUID format. 8481 + * 2.) Set 3h for NAA Locally Assigned Name Identifier format. 8482 + * 8483 + * e.g. xxxxxxxx-xxxx-xxxx-yyyy-yyyyyyyyyyyy 8484 + * 8485 + * extract the yyyy-yyyyyyyyyyyy portion 8486 + * final PNI 3yyyyyyyyyyyyyyy 8487 + */ 8488 + scnprintf(pni, sizeof(pni), "3%c%c%c%s", 8489 + uuid[20], uuid[21], uuid[22], &uuid[24]); 8490 + 8491 + /* Sanitize the converted PNI */ 8492 + for (i = 1; i < 16 && (is_ff || is_00); i++) { 8493 + if (pni[i] != '0') 8494 + is_00 = false; 8495 + if (pni[i] != 'f' && pni[i] != 'F') 8496 + is_ff = false; 8497 + } 8498 + 8499 + /* Convert from char* to unsigned long */ 8500 + rc = kstrtoul(pni, 16, &phba->pni); 8501 + if (!rc && !is_ff && !is_00) { 8502 + lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 8503 + "2100 PNI 0x%016lx\n", phba->pni); 8504 + } else { 8505 + lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 8506 + "2101 PNI %s generation status %d\n", 8507 + pni, rc); 8508 + phba->pni = 0; 8509 + } 8510 + } 8511 + } 8512 + 8513 + /** 8452 8514 * lpfc_sli4_hba_setup - SLI4 device initialization PCI function 8453 8515 * @phba: Pointer to HBA context object. 8454 8516 * ··· 8594 8528 } else { 8595 8529 clear_bit(HBA_FCOE_MODE, &phba->hba_flag); 8596 8530 } 8531 + 8532 + /* Obtain platform UUID, only for SLI4 FC adapters */ 8533 + if (!test_bit(HBA_FCOE_MODE, &phba->hba_flag)) 8534 + lpfc_get_platform_uuid(phba); 8597 8535 8598 8536 if (bf_get(lpfc_mbx_rd_rev_cee_ver, &mqe->un.read_rev) == 8599 8537 LPFC_DCBX_CEE_MODE) ··· 19928 19858 } 19929 19859 19930 19860 /** 19931 - * lpfc_sli4_resume_rpi - Remove the rpi bitmask region 19861 + * lpfc_sli4_resume_rpi - Resume traffic relative to an RPI 19932 19862 * @ndlp: pointer to lpfc nodelist data structure. 19933 19863 * @cmpl: completion call-back. 19934 19864 * @iocbq: data to load as mbox ctx_u information 19935 19865 * 19936 - * This routine is invoked to remove the memory region that 19937 - * provided rpi via a bitmask. 19866 + * Return codes 19867 + * 0 - successful 19868 + * -ENOMEM - No available memory 19869 + * -EIO - The mailbox failed to complete successfully. 19938 19870 **/ 19939 19871 int 19940 19872 lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp, ··· 19966 19894 return -EIO; 19967 19895 } 19968 19896 19969 - /* Post all rpi memory regions to the port. */ 19970 19897 lpfc_resume_rpi(mboxq, ndlp); 19971 19898 if (cmpl) { 19972 19899 mboxq->mbox_cmpl = cmpl;
+1 -1
drivers/scsi/lpfc/lpfc_version.h
··· 20 20 * included with this package. * 21 21 *******************************************************************/ 22 22 23 - #define LPFC_DRIVER_VERSION "14.4.0.11" 23 + #define LPFC_DRIVER_VERSION "14.4.0.12" 24 24 #define LPFC_DRIVER_NAME "lpfc" 25 25 26 26 /* Used for SLI 2/3 */