Skip to contentSkip to conversation

Update lpfc to revision 14.4.0.8

PATCH Applied Justin Tee 2 participants 9 messages Jan 30, 2025 – Feb 10, 2025

Subsystems (2)
lore
Share & tools
lore

Justin Tee

author
#0 lore raw

cover Update lpfc to revision 14.4.0.8

Update lpfc to revision 14.4.0.8

This patch set contains fixes related to diagnostic logging, smatch, and ndlp ptr referencing issues.

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

Justin Tee (6):
lpfc: Reduce log message generation during ELS ring clean up
lpfc: Free phba irq in lpfc_sli4_enable_msi when pci_irq_vector fails
lpfc: Ignore ndlp rport mismatch in dev_loss_tmo callbk
lpfc: Handle duplicate D_IDs in ndlp search-by D_ID routine
lpfc: Update lpfc version to 14.4.0.8
lpfc: Copyright updates for 14.4.0.8 patches

 drivers/scsi/lpfc/lpfc_els.c     | 12 +++++-------
 drivers/scsi/lpfc/lpfc_hbadisc.c | 31 ++++++++++++++++++++++---------
 drivers/scsi/lpfc/lpfc_init.c    |  4 +++-
 drivers/scsi/lpfc/lpfc_version.h |  6 +++---
 4 files changed, 33 insertions(+), 20 deletions(-)
Signature · 1 line
2.38.0
author
#1 lore raw

PATCH 1/6 lpfc: Reduce log message generation during ELS ring clean up

A clean up log message is output from lpfc_els_flush_cmd for each outstanding ELS I/O and repeated for every NPIV instance. The log message should only be generated for active I/Os matching the NPIV vport. Thus, move the vport check to before logging the message.

---
 drivers/scsi/lpfc/lpfc_els.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +4 -6
index 1d7db49a8fe4..318dc83e9a2a 100644
@@ -9569,18 +9569,16 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport)
 	mbx_tmo_err = test_bit(MBX_TMO_ERR, &phba->bit_flags);
 	/* First we need to issue aborts to outstanding cmds on txcmpl */
 	list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) {
+		if (piocb->vport != vport)
+			continue;
+
 		lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
 				 "2243 iotag = 0x%x cmd_flag = 0x%x "
-				 "ulp_command = 0x%x this_vport %x "
-				 "sli_flag = 0x%x\n",
+				 "ulp_command = 0x%x sli_flag = 0x%x\n",
 				 piocb->iotag, piocb->cmd_flag,
 				 get_job_cmnd(phba, piocb),
-				 (piocb->vport == vport),
 				 phba->sli.sli_flag);
 
-		if (piocb->vport != vport)
-			continue;
-
 		if ((phba->sli.sli_flag & LPFC_SLI_ACTIVE) && !mbx_tmo_err) {
 			if (piocb->cmd_flag & LPFC_IO_LIBDFC)
 				continue;
Signature · 1 line
2.38.0
author
#2 lore raw

PATCH 2/6 lpfc: Free phba irq in lpfc_sli4_enable_msi when pci_irq_vector fails

In reply to Justin Tee

Fix smatch warning regarding missed calls to free_irq. Free the phba irq in the failed pci_irq_vector cases.

lpfc_init.c: lpfc_sli4_enable_msi() warn: 'phba->pcidev->irq' from
request_irq() not released.

---
 drivers/scsi/lpfc/lpfc_init.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/lpfc/lpfc_init.c +2 -0
index b94624789771..07b614bc9a6b 100644
@@ -13170,6 +13170,7 @@ lpfc_sli4_enable_msi(struct lpfc_hba *phba)
 	eqhdl = lpfc_get_eq_hdl(0);
 	rc = pci_irq_vector(phba->pcidev, 0);
 	if (rc < 0) {
+		free_irq(phba->pcidev->irq, phba);
 		pci_free_irq_vectors(phba->pcidev);
 		lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
 				"0496 MSI pci_irq_vec failed (%d)\n", rc);
@@ -13250,6 +13251,7 @@ lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode)
 			eqhdl = lpfc_get_eq_hdl(0);
 			retval = pci_irq_vector(phba->pcidev, 0);
 			if (retval < 0) {
+				free_irq(phba->pcidev->irq, phba);
 				lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
 					"0502 INTR pci_irq_vec failed (%d)\n",
 					 retval);
Signature · 1 line
2.38.0
author
#3 lore raw

PATCH 3/6 lpfc: Ignore ndlp rport mismatch in dev_loss_tmo callbk

In reply to Justin Tee

With repeated port swaps between separate fabrics, there can be multiple registrations for fabric well known address 0xfffffe. This can cause ndlp reference confusion due to the usage of a single ndlp ptr that stores the rport object in fc_rport struct private storage during transport registration. Subsequent registrations update the ndlp->rport field with the newer rport, so when transport layer triggers dev_loss_tmo for the earlier registered rport the ndlp->rport private storage is referencing the newer rport instead of the older rport in dev_loss_tmo callbk.

Because the older ndlp->rport object is already cleaned up elsewhere in driver code during the time of fabric swap, check that the rport provided in dev_loss_tmo callbk actually matches the rport stored in the LLDD's ndlp->rport field. Otherwise, skip dev_loss_tmo work on a stale rport.

---
 drivers/scsi/lpfc/lpfc_hbadisc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +9 -3
index 36e66df36a18..2dfcf1db5395 100644
@@ -228,10 +228,16 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
 	if (ndlp->nlp_state == NLP_STE_MAPPED_NODE)
 		return;
 
-	/* check for recovered fabric node */
-	if (ndlp->nlp_state == NLP_STE_UNMAPPED_NODE &&
-	    ndlp->nlp_DID == Fabric_DID)
+	/* Ignore callback for a mismatched (stale) rport */
+	if (ndlp->rport != rport) {
+		lpfc_vlog_msg(vport, KERN_WARNING, LOG_NODE,
+			      "6788 fc rport mismatch: d_id x%06x ndlp x%px "
+			      "fc rport x%px node rport x%px state x%x "
+			      "refcnt %u\n",
+			      ndlp->nlp_DID, ndlp, rport, ndlp->rport,
+			      ndlp->nlp_state, kref_read(&ndlp->kref));
 		return;
+	}
 
 	if (rport->port_name != wwn_to_u64(ndlp->nlp_portname.u.wwn))
 		lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
Signature · 1 line
2.38.0
author
#4 lore raw

PATCH 4/6 lpfc: Handle duplicate D_IDs in ndlp search-by D_ID routine

In reply to Justin Tee

After a port swap between separate fabrics, there may be multiple nodes in the vport's fc_nodes list with the same fabric well known address. Duplication is temporary and eventually resolves itself after dev_loss_tmo expires, but nameserver queries may still occur before dev_loss_tmo. This possibly results in returning stale fabric ndlp objects. Fix by adding an nlp_state check to ensure the ndlp search routine returns the correct newer allocated ndlp fabric object.

---
 drivers/scsi/lpfc/lpfc_hbadisc.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +12 -5
index 2dfcf1db5395..07cd611f34bd 100644
@@ -5570,6 +5570,7 @@ static struct lpfc_nodelist *
 __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
 {
 	struct lpfc_nodelist *ndlp;
+	struct lpfc_nodelist *np = NULL;
 	uint32_t data1;
 
 	list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
@@ -5584,14 +5585,20 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
 					 ndlp, ndlp->nlp_DID,
 					 ndlp->nlp_flag, data1, ndlp->nlp_rpi,
 					 ndlp->active_rrqs_xri_bitmap);
-			return ndlp;
+
+			/* Check for new or potentially stale node */
+			if (ndlp->nlp_state != NLP_STE_UNUSED_NODE)
+				return ndlp;
+			np = ndlp;
 		}
 	}
 
-	/* FIND node did <did> NOT FOUND */
-	lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
-			 "0932 FIND node did x%x NOT FOUND.\n", did);
-	return NULL;
+	if (!np)
+		/* FIND node did <did> NOT FOUND */
+		lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
+				 "0932 FIND node did x%x NOT FOUND.\n", did);
+
+	return np;
 }
 
 struct lpfc_nodelist *
Signature · 1 line
2.38.0
author
#5 lore raw

PATCH 5/6 lpfc: Update lpfc version to 14.4.0.8

In reply to Justin Tee

Update lpfc version to 14.4.0.8

---
 drivers/scsi/lpfc/lpfc_version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_version.h +1 -1
index c35f7225058e..8925b51910b6 100644
@@ -20,7 +20,7 @@
  * included with this package.                                     *
  *******************************************************************/
 
-#define LPFC_DRIVER_VERSION "14.4.0.7"
+#define LPFC_DRIVER_VERSION "14.4.0.8"
 #define LPFC_DRIVER_NAME		"lpfc"
 
 /* Used for SLI 2/3 */
Signature · 1 line
2.38.0
author
#6 lore raw

PATCH 6/6 lpfc: Copyright updates for 14.4.0.8 patches

In reply to Justin Tee

Update copyrights to 2025 for files modified in the 14.4.0.8 patch set.

---
 drivers/scsi/lpfc/lpfc_els.c     | 2 +-
 drivers/scsi/lpfc/lpfc_hbadisc.c | 2 +-
 drivers/scsi/lpfc/lpfc_init.c    | 2 +-
 drivers/scsi/lpfc/lpfc_version.h | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +1 -1
index 318dc83e9a2a..9ab2e98cf693 100644
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term *
+ * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
drivers/scsi/lpfc/lpfc_hbadisc.c +1 -1
index 07cd611f34bd..a2fd74cf8603 100644
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term *
+ * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
drivers/scsi/lpfc/lpfc_init.c +1 -1
index 07b614bc9a6b..8bcc47ac7026 100644
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term *
+ * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.  *
  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
drivers/scsi/lpfc/lpfc_version.h +2 -2
index 8925b51910b6..638b50f35287 100644
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term *
+ * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
@@ -32,6 +32,6 @@
 
 #define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \
 		LPFC_DRIVER_VERSION
-#define LPFC_COPYRIGHT "Copyright (C) 2017-2024 Broadcom. All Rights " \
+#define LPFC_COPYRIGHT "Copyright (C) 2017-2025 Broadcom. All Rights " \
 		"Reserved. The term \"Broadcom\" refers to Broadcom Inc. " \
 		"and/or its subsidiaries."
Signature · 1 line
2.38.0
#8 lore raw
In reply to Justin Tee
Quoted 8 lines · Justin Tee

Update lpfc to revision 14.4.0.8

This patch set contains fixes related to diagnostic logging, smatch, and ndlp ptr referencing issues.

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

[...]

Applied to 6.15/scsi-queue, thanks!

[1/6] lpfc: Reduce log message generation during ELS ring clean up

      https://git.kernel.org/mkp/scsi/c/8eccc58d71ea
[2/6] lpfc: Free phba irq in lpfc_sli4_enable_msi when pci_irq_vector fails
      https://git.kernel.org/mkp/scsi/c/f0842902b383
[3/6] lpfc: Ignore ndlp rport mismatch in dev_loss_tmo callbk
      https://git.kernel.org/mkp/scsi/c/23ed62897746
[4/6] lpfc: Handle duplicate D_IDs in ndlp search-by D_ID routine
      https://git.kernel.org/mkp/scsi/c/56c3d809b7b4
[5/6] lpfc: Update lpfc version to 14.4.0.8
      https://git.kernel.org/mkp/scsi/c/8be7202ad3af
[6/6] lpfc: Copyright updates for 14.4.0.8 patches
      https://git.kernel.org/mkp/scsi/c/ef12deb6ce74
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering