Skip to contentSkip to conversation

lpfc: Update lpfc to revision 14.2.0.13

PATCH Applied Justin Tee 3 participants 14 messages May 23, 2023 – Jun 8, 2023

Subsystems (2)
lore
Share & tools
lore

Justin Tee

author
#0 lore raw

cover lpfc: Update lpfc to revision 14.2.0.13

Update lpfc to revision 14.2.0.13

This patch set contains discovery bug fixes, firmware logging improvements, clean up of CQ handling, and statistics collection enhancements.

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

Justin Tee (9):
lpfc: Fix use-after-free rport memory access in
lpfc_register_remote_port
lpfc: Clear NLP_IN_DEV_LOSS flag if already in rediscovery
lpfc: Account for fabric domain ctlr device loss recovery
lpfc: Revise NPIV ELS unsol rcv cmpl logic to drop ndlp based on
nlp_state
lpfc: Change firmware upgrade logging to KERN_NOTICE instead of
TRACE_EVENT
lpfc: Clean up SLI-4 CQE status handling
lpfc: Enhance congestion statistics collection
lpfc: Update lpfc version to 14.2.0.13
lpfc: Copyright updates for 14.2.0.13 patches

 drivers/scsi/lpfc/lpfc.h         |  65 +++-----
 drivers/scsi/lpfc/lpfc_els.c     |  14 +-
 drivers/scsi/lpfc/lpfc_hbadisc.c |  33 ++--
 drivers/scsi/lpfc/lpfc_hw4.h     |   3 -
 drivers/scsi/lpfc/lpfc_init.c    | 250 +++++++++----------------------
 drivers/scsi/lpfc/lpfc_logmsg.h  |   6 +-
 drivers/scsi/lpfc/lpfc_nvme.c    |  17 ++-
 drivers/scsi/lpfc/lpfc_nvmet.c   |   6 +-
 drivers/scsi/lpfc/lpfc_scsi.c    |  65 ++++----
 drivers/scsi/lpfc/lpfc_sli.c     |  54 +++----
 drivers/scsi/lpfc/lpfc_version.h |   2 +-
 11 files changed, 195 insertions(+), 320 deletions(-)
Signature · 1 line
2.38.0
author
#1 lore raw

PATCH 1/9 lpfc: Fix use-after-free rport memory access in lpfc_register_remote_port

Due to a target port D_ID swap, it is possible for the lpfc_register_remote_port routine to touch post mortem fc_rport memory when trying to access fc_rport->dd_data.

The D_ID swap causes a simultaneous call to lpfc_unregister_remote_port, where fc_remote_port_delete reclaims fc_rport memory.

Remove the fc_rport->dd_data->pnode NULL assignment because the following line reassigns ndlp->rport with an fc_rport object from fc_remote_port_add anyways. The pnode nullification is superfluous.

---
 drivers/scsi/lpfc/lpfc_hbadisc.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +0 -8
index 67bfdddb897c..63e42e3f2165 100644
@@ -4498,14 +4498,6 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
 	if (vport->load_flag & FC_UNLOADING)
 		return;
 
-	/*
-	 * Disassociate any older association between this ndlp and rport
-	 */
-	if (ndlp->rport) {
-		rdata = ndlp->rport->dd_data;
-		rdata->pnode = NULL;
-	}
-
 	ndlp->rport = rport = fc_remote_port_add(shost, 0, &rport_ids);
 	if (!rport) {
 		dev_printk(KERN_WARNING, &phba->pcidev->dev,
Signature · 1 line
2.38.0
Acked-by on v1 1/9
#2 lore raw

Re: [PATCH 1/9] lpfc: Fix use-after-free rport memory access in lpfc_register_remote_port

Quoted 9 lines · Justin Tee

Due to a target port D_ID swap, it is possible for the lpfc_register_remote_port routine to touch post mortem fc_rport memory when
trying to access fc_rport->dd_data.

The D_ID swap causes a simultaneous call to lpfc_unregister_remote_port,
where fc_remote_port_delete reclaims fc_rport memory.

Quoted 7 lines

Remove the fc_rport->dd_data->pnode NULL assignment because the following
line reassigns ndlp->rport with an fc_rport object from fc_remote_port_add
anyways.  The pnode nullification is superfluous.

This patch fixed a customer issue for us.

Quoted 27 lines

---
 drivers/scsi/lpfc/lpfc_hbadisc.c | 8 --------

 1 file changed, 8 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +0 -0
index 67bfdddb897c..63e42e3f2165 100644
@@ -4498,14 +4498,6 @@ lpfc_register_remote_port(struct lpfc_vport
 *vport, struct lpfc_nodelist *ndlp)
         if (vport->load_flag & FC_UNLOADING)
                 return;


-       /*
-        * Disassociate any older association between this ndlp and rport
-        */
-       if (ndlp->rport) {
-               rdata = ndlp->rport->dd_data;
-               rdata->pnode = NULL;
-       }
-
        ndlp->rport = rport = fc_remote_port_add(shost, 0, &rport_ids);
        if (!rport) {
                dev_printk(KERN_WARNING, &phba->pcidev->dev,

author
#3 lore raw

PATCH 2/9 lpfc: Clear NLP_IN_DEV_LOSS flag if already in rediscovery

In reply to Justin Tee

In dev_loss_tmo callback routine, we early return if the ndlp is in a state of rediscovery. This occurs when a target proactively PLOGIs or PRLIs after an RSCN before the dev_loss_tmo callback routine is scheduled to run. Move clear of the NLP_IN_DEV_LOSS flag before the ndlp state check in such cases.

---
 drivers/scsi/lpfc/lpfc_hbadisc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +3 -3
index 63e42e3f2165..f99b5c206cdb 100644
@@ -556,6 +556,9 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
 				 ndlp->nlp_DID, ndlp->nlp_flag,
 				 ndlp->nlp_state, ndlp->nlp_rpi);
 	}
+	spin_lock_irqsave(&ndlp->lock, iflags);
+	ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS;
+	spin_unlock_irqrestore(&ndlp->lock, iflags);
 
 	/* If we are devloss, but we are in the process of rediscovering the
 	 * ndlp, don't issue a NLP_EVT_DEVICE_RM event.
@@ -565,9 +568,6 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
 		return fcf_inuse;
 	}
 
-	spin_lock_irqsave(&ndlp->lock, iflags);
-	ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS;
-	spin_unlock_irqrestore(&ndlp->lock, iflags);
 	if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD))
 		lpfc_disc_state_machine(vport, ndlp, NULL, NLP_EVT_DEVICE_RM);
 
Signature · 1 line
2.38.0
author
#4 lore raw

PATCH 3/9 lpfc: Account for fabric domain ctlr device loss recovery

In reply to Justin Tee

Pre-existing device loss recovery logic via the NLP_IN_RECOV_POST_DEV_LOSS flag only handled Fabric Port Login, Fabric Controller, Management, and Name Server addresses.

Fabric domain controllers fall under the same category for usage of the NLP_IN_RECOV_POST_DEV_LOSS flag. Add a default case statement to mark an ndlp for device loss recovery.

---
 drivers/scsi/lpfc/lpfc_hbadisc.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +14 -5
index f99b5c206cdb..a5c69d4bf2e0 100644
@@ -458,11 +458,9 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
 	if (ndlp->nlp_type & NLP_FABRIC) {
 		spin_lock_irqsave(&ndlp->lock, iflags);
 
-		/* In massive vport configuration settings or when the FLOGI
-		 * completes with a sequence timeout, it's possible
-		 * dev_loss_tmo fired during node recovery.  The driver has to
-		 * account for this race to allow for recovery and keep
-		 * the reference counting correct.
+		/* The driver has to account for a race between any fabric
+		 * node that's in recovery when dev_loss_tmo expires. When this
+		 * happens, the driver has to allow node recovery.
 		 */
 		switch (ndlp->nlp_DID) {
 		case Fabric_DID:
@@ -489,6 +487,17 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
 			    ndlp->nlp_state <= NLP_STE_REG_LOGIN_ISSUE)
 				recovering = true;
 			break;
+		default:
+			/* Ensure the nlp_DID at least has the correct prefix.
+			 * The fabric domain controller's last three nibbles
+			 * vary so we handle it in the default case.
+			 */
+			if (ndlp->nlp_DID & Fabric_DID_MASK) {
+				if (ndlp->nlp_state >= NLP_STE_PLOGI_ISSUE &&
+				    ndlp->nlp_state <= NLP_STE_REG_LOGIN_ISSUE)
+					recovering = true;
+			}
+			break;
 		}
 		spin_unlock_irqrestore(&ndlp->lock, iflags);
 
Signature · 1 line
2.38.0
Acked-by Acked-by on v1 3/9
#5 lore raw

Re: [PATCH 3/9] lpfc: Account for fabric domain ctlr device loss recovery

Quoted 6 lines · Justin Tee

Pre-existing device loss recovery logic via the NLP_IN_RECOV_POST_DEV_LOSS
flag only handled Fabric Port Login, Fabric Controller, Management, and
Name Server addresses.

Quoted 7 lines

Fabric domain controllers fall under the same category for usage of the
NLP_IN_RECOV_POST_DEV_LOSS flag.  Add a default case statement to mark
an ndlp for device loss recovery.

This patch fixed a customer issue for us.

Quoted 13 lines

---
 drivers/scsi/lpfc/lpfc_hbadisc.c | 19 ++++++++++++++-----

 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +0 -0
index f99b5c206cdb..a5c69d4bf2e0 100644
@@ -458,11 +458,9 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist
 *ndlp)
         if (ndlp->nlp_type & NLP_FABRIC) {
                 spin_lock_irqsave(&ndlp->lock, iflags);
Quoted 8 lines


-               /* In massive vport configuration settings or when the FLOGI
-                * completes with a sequence timeout, it's possible -                * dev_loss_tmo fired during node recovery.  The driver has to
-                * account for this race to allow for recovery and keepThis patch fixed a customer issue for us.

Quoted 33 lines

-                * the reference counting correct.
+               /* The driver has to account for a race between any fabric
+                * node that's in recovery when dev_loss_tmo expires. When this
+                * happens, the driver has to allow node recovery. */
                switch (ndlp->nlp_DID) {
                case Fabric_DID:

drivers/scsi/lpfc/lpfc_hbadisc.c +0 -0
@@ -489,6 +487,17 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist
 *ndlp)

                            ndlp->nlp_state <= NLP_STE_REG_LOGIN_ISSUE)
                                recovering = true;
                        break;
+               default:
+                       /* Ensure the nlp_DID at least has the correct prefix.
+                        * The fabric domain controller's last three nibbles
+                        * vary so we handle it in the default case. +                        */
+                       if (ndlp->nlp_DID & Fabric_DID_MASK) { +                               if (ndlp->nlp_state >= NLP_STE_PLOGI_ISSUE &&
+                                   ndlp->nlp_state <= NLP_STE_REG_LOGIN_ISSUE)
+                                       recovering = true; +                       }
+                       break;
                }
                spin_unlock_irqrestore(&ndlp->lock, iflags);

author
#6 lore raw

PATCH 4/9 lpfc: Revise NPIV ELS unsol rcv cmpl logic to drop ndlp based on nlp_state

In reply to Justin Tee

When NPIV ports are zoned to devices that support both initiator and target mode, a remote device's initiated PRLI results in unintended final kref clean up of the device's ndlp structure. This disrupts NPIV ports' discovery for target devices that support both initiator and target mode.

Modify the NPIV lpfc_drop_node clause such that we allow the ndlp to live so long as it was in NLP_STE_PLOGI_ISSUE, NLP_STE_REG_LOGIN_ISSUE, or NLP_STE_PRLI_ISSUE nlp_state. This allows lpfc's issued PRLI completion routine to determine if the final kref clean up should execute rather than a remote device's issued PRLI.

Fixes db651ec22524 ("scsi: lpfc: Correct used_rpi count when devloss tmo fires with no recovery")
---
 drivers/scsi/lpfc/lpfc_els.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +12 -2
index a3c8550e9985..2bad9954c355 100644
@@ -5452,9 +5452,19 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 				ndlp->nlp_flag &= ~NLP_RELEASE_RPI;
 				spin_unlock_irq(&ndlp->lock);
 			}
+			lpfc_drop_node(vport, ndlp);
+		} else if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE &&
+			   ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE &&
+			   ndlp->nlp_state != NLP_STE_PRLI_ISSUE) {
+			/* Drop ndlp if there is no planned or outstanding
+			 * issued PRLI.
+			 *
+			 * In cases when the ndlp is acting as both an initiator
+			 * and target function, let our issued PRLI determine
+			 * the final ndlp kref drop.
+			 */
+			lpfc_drop_node(vport, ndlp);
 		}
-
-		lpfc_drop_node(vport, ndlp);
 	}
 
 	/* Release the originating I/O reference. */
Signature · 1 line
2.38.0
author
#7 lore raw

PATCH 5/9 lpfc: Change firmware upgrade logging to KERN_NOTICE instead of TRACE_EVENT

In reply to Justin Tee

A firmware upgrade does not necessitate dumping of phba->dbg_log[] to kmsg via LOG_TRACE_EVENT. A simple KERN_NOTICE log message should suffice to notify the user of successful or unsuccessful firmware upgrade. As such, firmware upgrade log messages are updated to use KERN_NOTICE instead of LOG_TRACE_EVENT. Additionally, in order to notify the user of reset type for instantiating newly downloaded firmware, lpfc_log_msg's default KERN_LEVEL is updated to 5 or KERN_NOTICE.

---
 drivers/scsi/lpfc/lpfc_init.c   | 24 +++++++--------
 drivers/scsi/lpfc/lpfc_logmsg.h |  4 +--
 drivers/scsi/lpfc/lpfc_sli.c    | 54 ++++++++++++++++-----------------
 3 files changed, 41 insertions(+), 41 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +12 -12
index 088bd75fb5d7..2d9879bf298b 100644
@@ -14747,10 +14747,10 @@ lpfc_write_firmware(const struct firmware *fw, void *context)
 	INIT_LIST_HEAD(&dma_buffer_list);
 	lpfc_decode_firmware_rev(phba, fwrev, 1);
 	if (strncmp(fwrev, image->revision, strnlen(image->revision, 16))) {
-		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
-				"3023 Updating Firmware, Current Version:%s "
-				"New Version:%s\n",
-				fwrev, image->revision);
+		lpfc_log_msg(phba, KERN_NOTICE, LOG_INIT | LOG_SLI,
+			     "3023 Updating Firmware, Current Version:%s "
+			     "New Version:%s\n",
+			     fwrev, image->revision);
 		for (i = 0; i < LPFC_MBX_WR_CONFIG_MAX_BDE; i++) {
 			dmabuf = kzalloc(sizeof(struct lpfc_dmabuf),
 					 GFP_KERNEL);
@@ -14797,10 +14797,10 @@ lpfc_write_firmware(const struct firmware *fw, void *context)
 		}
 		rc = offset;
 	} else
-		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
-				"3029 Skipped Firmware update, Current "
-				"Version:%s New Version:%s\n",
-				fwrev, image->revision);
+		lpfc_log_msg(phba, KERN_NOTICE, LOG_INIT | LOG_SLI,
+			     "3029 Skipped Firmware update, Current "
+			     "Version:%s New Version:%s\n",
+			     fwrev, image->revision);
 
 release_out:
 	list_for_each_entry_safe(dmabuf, next, &dma_buffer_list, list) {
@@ -14812,11 +14812,11 @@ lpfc_write_firmware(const struct firmware *fw, void *context)
 	release_firmware(fw);
 out:
 	if (rc < 0)
-		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
-				"3062 Firmware update error, status %d.\n", rc);
+		lpfc_log_msg(phba, KERN_ERR, LOG_INIT | LOG_SLI,
+			     "3062 Firmware update error, status %d.\n", rc);
 	else
-		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
-				"3024 Firmware update success: size %d.\n", rc);
+		lpfc_log_msg(phba, KERN_NOTICE, LOG_INIT | LOG_SLI,
+			     "3024 Firmware update success: size %d.\n", rc);
 }
 
 /**
drivers/scsi/lpfc/lpfc_logmsg.h +2 -2
index b39cefcd8703..324b865db0e1 100644
@@ -55,7 +55,7 @@ void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...);
 
 /* generate message by verbose log setting or severity */
 #define lpfc_vlog_msg(vport, level, mask, fmt, arg...) \
-{ if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '4')) \
+{ if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '5')) \
 	dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
 		   fmt, (vport)->phba->brd_no, vport->vpi, ##arg); }
 
@@ -64,7 +64,7 @@ do { \
 	{ uint32_t log_verbose = (phba)->pport ? \
 				 (phba)->pport->cfg_log_verbose : \
 				 (phba)->cfg_log_verbose; \
-	if (((mask) & log_verbose) || (level[1] <= '4')) \
+	if (((mask) & log_verbose) || (level[1] <= '5')) \
 		dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
 			   fmt, phba->brd_no, ##arg); \
 	} \
drivers/scsi/lpfc/lpfc_sli.c +27 -27

76 lines not on this page · raw message

Signature · 1 line
2.38.0
author
#8 lore raw

PATCH 6/9 lpfc: Clean up SLI-4 CQE status handling

In reply to Justin Tee

There is mishandling of SLI-4 CQE status values larger than what is allowed by the LPFC_IOCB_STATUS_MASK of 4 bits. The LPFC_IOCB_STATUS_MASK is a leftover SLI-3 construct and serves no purpose in SLI-4 path.

Remove the LPFC_IOCB_STATUS_MASK and clean up general CQE status handling in SLI-4 completion paths.

---
 drivers/scsi/lpfc/lpfc.h       |  2 --
 drivers/scsi/lpfc/lpfc_hw4.h   |  3 --
 drivers/scsi/lpfc/lpfc_nvme.c  | 17 +++++----
 drivers/scsi/lpfc/lpfc_nvmet.c |  4 +--
 drivers/scsi/lpfc/lpfc_scsi.c  | 65 +++++++++++++++-------------------
 5 files changed, 41 insertions(+), 50 deletions(-)
drivers/scsi/lpfc/lpfc.h +0 -2
index 5e3a93d13a91..dcb87bb5f88b 100644
@@ -932,8 +932,6 @@ struct lpfc_hba {
 	void (*__lpfc_sli_release_iocbq)(struct lpfc_hba *,
 			 struct lpfc_iocbq *);
 	int (*lpfc_hba_down_post)(struct lpfc_hba *phba);
-	void (*lpfc_scsi_cmd_iocb_cmpl)
-		(struct lpfc_hba *, struct lpfc_iocbq *, struct lpfc_iocbq *);
 
 	/* MBOX interface function jump table entries */
 	int (*lpfc_sli_issue_mbox)
drivers/scsi/lpfc/lpfc_hw4.h +0 -3
index 082f8a109e55..5d4f9f27084d 100644
@@ -395,9 +395,6 @@ struct lpfc_cqe {
 #define CQE_STATUS_NEED_BUFF_ENTRY	0xf
 #define CQE_STATUS_DI_ERROR		0x16
 
-/* Used when mapping CQE status to IOCB */
-#define LPFC_IOCB_STATUS_MASK		0xf
-
 /* Status returned by hardware (valid only if status = CQE_STATUS_SUCCESS). */
 #define CQE_HW_STATUS_NO_ERR		0x0
 #define CQE_HW_STATUS_UNDERRUN		0x1
drivers/scsi/lpfc/lpfc_nvme.c +10 -7
index 82730a89ecb5..8db7cb99903d 100644
@@ -310,20 +310,20 @@ lpfc_nvme_handle_lsreq(struct lpfc_hba *phba,
  * for the LS request.
  **/
 void
-__lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba,  struct lpfc_vport *vport,
+__lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba, struct lpfc_vport *vport,
 			struct lpfc_iocbq *cmdwqe,
 			struct lpfc_wcqe_complete *wcqe)
 {
 	struct nvmefc_ls_req *pnvme_lsreq;
 	struct lpfc_dmabuf *buf_ptr;
 	struct lpfc_nodelist *ndlp;
-	uint32_t status;
+	int status;
 
 	pnvme_lsreq = cmdwqe->context_un.nvme_lsreq;
 	ndlp = cmdwqe->ndlp;
 	buf_ptr = cmdwqe->bpl_dmabuf;
 
-	status = bf_get(lpfc_wcqe_c_status, wcqe) & LPFC_IOCB_STATUS_MASK;
+	status = bf_get(lpfc_wcqe_c_status, wcqe);
 
 	lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC,
 			 "6047 NVMEx LS REQ x%px cmpl DID %x Xri: %x "
@@ -343,14 +343,17 @@ __lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba,  struct lpfc_vport *vport,
 		kfree(buf_ptr);
 		cmdwqe->bpl_dmabuf = NULL;
 	}
-	if (pnvme_lsreq->done)
+	if (pnvme_lsreq->done) {
+		if (status != CQE_STATUS_SUCCESS)
+			status = -ENXIO;
 		pnvme_lsreq->done(pnvme_lsreq, status);
-	else
+	} else {
 		lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
 				 "6046 NVMEx cmpl without done call back? "
 				 "Data x%px DID %x Xri: %x status %x\n",
 				pnvme_lsreq, ndlp ? ndlp->nlp_DID : 0,
 				cmdwqe->sli4_xritag, status);
+	}
 	if (ndlp) {
 		lpfc_nlp_put(ndlp);
 		cmdwqe->ndlp = NULL;
@@ -367,7 +370,7 @@ lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe,
 	uint32_t status;
 	struct lpfc_wcqe_complete *wcqe = &rspwqe->wcqe_cmpl;
 
-	status = bf_get(lpfc_wcqe_c_status, wcqe) & LPFC_IOCB_STATUS_MASK;
+	status = bf_get(lpfc_wcqe_c_status, wcqe);
 
 	if (vport->localport) {
 		lport = (struct lpfc_nvme_lport *)vport->localport->private;
@@ -1040,7 +1043,7 @@ lpfc_nvme_io_cmd_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn,
 		nCmd->rcv_rsplen = LPFC_NVME_ERSP_LEN;
 		nCmd->transferred_length = nCmd->payload_length;
 	} else {
-		lpfc_ncmd->status = (status & LPFC_IOCB_STATUS_MASK);
+		lpfc_ncmd->status = status;
 		lpfc_ncmd->result = (wcqe->parameter & IOERR_PARAM_MASK);
 
 		/* For NVME, the only failure path that results in an
drivers/scsi/lpfc/lpfc_nvmet.c +2 -2
index 7517dd55fe91..ce201465dc6f 100644
@@ -300,7 +300,7 @@ __lpfc_nvme_xmt_ls_rsp_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe,
 	struct nvmefc_ls_rsp *ls_rsp = &axchg->ls_rsp;
 	uint32_t status, result;
 
-	status = bf_get(lpfc_wcqe_c_status, wcqe) & LPFC_IOCB_STATUS_MASK;
+	status = bf_get(lpfc_wcqe_c_status, wcqe);
 	result = wcqe->parameter;
 
 	if (axchg->state != LPFC_NVME_STE_LS_RSP || axchg->entry_cnt != 2) {
@@ -350,7 +350,7 @@ lpfc_nvmet_xmt_ls_rsp_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe,
 	if (!phba->targetport)
 		goto finish;
 
-	status = bf_get(lpfc_wcqe_c_status, wcqe) & LPFC_IOCB_STATUS_MASK;
+	status = bf_get(lpfc_wcqe_c_status, wcqe);
 	result = wcqe->parameter;
 
 	tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
drivers/scsi/lpfc/lpfc_scsi.c +29 -36

126 lines not on this page · raw message

Signature · 1 line
2.38.0
author
#9 lore raw

PATCH 7/9 lpfc: Enhance congestion statistics collection

In reply to Justin Tee

Various improvements are made for collecting congestion statistics:

- Pre-existing logic is replaced with use of an hrtimer for increased reporting accuracy.
- Congestion timestamp information is reorganized into a single struct.
- Common statistic collection logic is refactored into a helper routine.

---
 drivers/scsi/lpfc/lpfc.h      |  63 +++-------
 drivers/scsi/lpfc/lpfc_init.c | 226 ++++++++++------------------------
 2 files changed, 81 insertions(+), 208 deletions(-)
drivers/scsi/lpfc/lpfc.h +19 -44
index dcb87bb5f88b..9a8963684369 100644
@@ -429,6 +429,15 @@ struct lpfc_cgn_param {
 /* Max number of days of congestion data */
 #define LPFC_MAX_CGN_DAYS 10
 
+struct lpfc_cgn_ts {
+	uint8_t month;
+	uint8_t day;
+	uint8_t year;
+	uint8_t hour;
+	uint8_t minute;
+	uint8_t second;
+};
+
 /* Format of congestion buffer info
  * This structure defines memory thats allocated and registered with
  * the HBA firmware. When adding or removing fields from this structure
@@ -442,6 +451,7 @@ struct lpfc_cgn_info {
 #define LPFC_CGN_INFO_V1	1
 #define LPFC_CGN_INFO_V2	2
 #define LPFC_CGN_INFO_V3	3
+#define LPFC_CGN_INFO_V4	4
 	uint8_t  cgn_info_mode;		/* 0=off 1=managed 2=monitor only */
 	uint8_t  cgn_info_detect;
 	uint8_t  cgn_info_action;
@@ -450,12 +460,7 @@ struct lpfc_cgn_info {
 	uint8_t  cgn_info_level2;
 
 	/* Start Time */
-	uint8_t  cgn_info_month;
-	uint8_t  cgn_info_day;
-	uint8_t  cgn_info_year;
-	uint8_t  cgn_info_hour;
-	uint8_t  cgn_info_minute;
-	uint8_t  cgn_info_second;
+	struct lpfc_cgn_ts base_time;
 
 	/* minute / hours / daily indices */
 	uint8_t  cgn_index_minute;
@@ -496,45 +501,17 @@ struct lpfc_cgn_info {
 		uint8_t  cgn_stat_npm;		/* Notifications per minute */
 
 		/* Start Time */
-		uint8_t  cgn_stat_month;
-		uint8_t  cgn_stat_day;
-		uint8_t  cgn_stat_year;
-		uint8_t  cgn_stat_hour;
-		uint8_t  cgn_stat_minute;
-		uint8_t  cgn_pad2[2];
+		struct lpfc_cgn_ts stat_start;	/* Base time */
+		uint8_t cgn_pad2;
 
 		__le32   cgn_notification;
 		__le32   cgn_peer_notification;
 		__le32   link_integ_notification;
 		__le32   delivery_notification;
-
-		uint8_t  cgn_stat_cgn_month; /* Last congestion notification FPIN */
-		uint8_t  cgn_stat_cgn_day;
-		uint8_t  cgn_stat_cgn_year;
-		uint8_t  cgn_stat_cgn_hour;
-		uint8_t  cgn_stat_cgn_min;
-		uint8_t  cgn_stat_cgn_sec;
-
-		uint8_t  cgn_stat_peer_month; /* Last peer congestion FPIN */
-		uint8_t  cgn_stat_peer_day;
-		uint8_t  cgn_stat_peer_year;
-		uint8_t  cgn_stat_peer_hour;
-		uint8_t  cgn_stat_peer_min;
-		uint8_t  cgn_stat_peer_sec;
-
-		uint8_t  cgn_stat_lnk_month; /* Last link integrity FPIN */
-		uint8_t  cgn_stat_lnk_day;
-		uint8_t  cgn_stat_lnk_year;
-		uint8_t  cgn_stat_lnk_hour;
-		uint8_t  cgn_stat_lnk_min;
-		uint8_t  cgn_stat_lnk_sec;
-
-		uint8_t  cgn_stat_del_month; /* Last delivery notification FPIN */
-		uint8_t  cgn_stat_del_day;
-		uint8_t  cgn_stat_del_year;
-		uint8_t  cgn_stat_del_hour;
-		uint8_t  cgn_stat_del_min;
-		uint8_t  cgn_stat_del_sec;
+		struct lpfc_cgn_ts stat_fpin;	/* Last congestion notification FPIN */
+		struct lpfc_cgn_ts stat_peer;	/* Last peer congestion FPIN */
+		struct lpfc_cgn_ts stat_lnk;	/* Last link integrity FPIN */
+		struct lpfc_cgn_ts stat_delivery;	/* Last delivery notification FPIN */
 	);
 
 	__le32   cgn_info_crc;
@@ -1043,8 +1020,6 @@ struct lpfc_hba {
 					 * capability
 					 */
 #define HBA_FLOGI_ISSUED	0x100000 /* FLOGI was issued */
-#define HBA_SHORT_CMF		0x200000 /* shorter CMF timer routine */
-#define HBA_CGN_DAY_WRAP	0x400000 /* HBA Congestion info day wraps */
 #define HBA_DEFER_FLOGI		0x800000 /* Defer FLOGI till read_sparm cmpl */
 #define HBA_SETUP		0x1000000 /* Signifies HBA setup is completed */
 #define HBA_NEEDS_CFG_PORT	0x2000000 /* SLI3 - needs a CONFIG_PORT mbox */
@@ -1527,6 +1502,7 @@ struct lpfc_hba {
 	uint64_t cmf_last_sync_bw;
 #define  LPFC_CMF_BLK_SIZE 512
 	struct hrtimer cmf_timer;
+	struct hrtimer cmf_stats_timer;	/* 1 minute stats timer  */
 	atomic_t cmf_bw_wait;
 	atomic_t cmf_busy;
 	atomic_t cmf_stop_io;      /* To block request and stop IO's */
@@ -1574,12 +1550,11 @@ struct lpfc_hba {
 	atomic_t cgn_sync_alarm_cnt;    /* Total alarm events for SYNC wqe */
 	atomic_t cgn_driver_evt_cnt;    /* Total driver cgn events for fmw */
 	atomic_t cgn_latency_evt_cnt;
-	struct timespec64 cgn_daily_ts;
 	atomic64_t cgn_latency_evt;     /* Avg latency per minute */
 	unsigned long cgn_evt_timestamp;
 #define LPFC_CGN_TIMER_TO_MIN   60000 /* ms in a minute */
 	uint32_t cgn_evt_minute;
-#define LPFC_SEC_MIN		60
+#define LPFC_SEC_MIN		60UL
 #define LPFC_MIN_HOUR		60
 #define LPFC_HOUR_DAY		24
 #define LPFC_MIN_DAY		(LPFC_MIN_HOUR * LPFC_HOUR_DAY)
drivers/scsi/lpfc/lpfc_init.c +62 -164

377 lines not on this page · raw message

Signature · 1 line
2.38.0
author
#10 lore raw

PATCH 8/9 lpfc: Update lpfc version to 14.2.0.13

In reply to Justin Tee

Update lpfc version to 14.2.0.13

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

PATCH 9/9 lpfc: Copyright updates for 14.2.0.13 patches

In reply to Justin Tee

Update copyrights to 2023 for files modified in the 14.2.0.13 patch set.

---
 drivers/scsi/lpfc/lpfc_logmsg.h | 2 +-
 drivers/scsi/lpfc/lpfc_nvmet.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_logmsg.h +1 -1
index 324b865db0e1..f896ec610433 100644
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2022 Broadcom. All Rights Reserved. The term *
+ * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term *
  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
  * Copyright (C) 2004-2009 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
drivers/scsi/lpfc/lpfc_nvmet.c +1 -1
index ce201465dc6f..dff4584d338b 100644
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2022 Broadcom. All Rights Reserved. The term *
+ * Copyright (C) 2017-2023 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.                        *
Signature · 1 line
2.38.0
#12 lore raw
In reply to Justin Tee

Justin,

Quoted 7 lines

Update lpfc to revision 14.2.0.13

This patch set contains discovery bug fixes, firmware logging improvements, clean up of CQ handling, and statistics collection enhancements.

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

Applied to 6.5/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#13 lore raw
In reply to Justin Tee
Quoted 8 lines · Justin Tee

Update lpfc to revision 14.2.0.13

This patch set contains discovery bug fixes, firmware logging improvements, clean up of CQ handling, and statistics collection enhancements.

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

[...]

Applied to 6.5/scsi-queue, thanks!

[1/9] lpfc: Fix use-after-free rport memory access in lpfc_register_remote_port

      https://git.kernel.org/mkp/scsi/c/a4157aaf0fb4
[2/9] lpfc: Clear NLP_IN_DEV_LOSS flag if already in rediscovery
      https://git.kernel.org/mkp/scsi/c/fd57a687d441
[3/9] lpfc: Account for fabric domain ctlr device loss recovery
      https://git.kernel.org/mkp/scsi/c/73ded37869f8
[4/9] lpfc: Revise NPIV ELS unsol rcv cmpl logic to drop ndlp based on nlp_state
      https://git.kernel.org/mkp/scsi/c/9914a3d033d3
[5/9] lpfc: Change firmware upgrade logging to KERN_NOTICE instead of TRACE_EVENT
      https://git.kernel.org/mkp/scsi/c/b9951e1cffae
[6/9] lpfc: Clean up SLI-4 CQE status handling
      https://git.kernel.org/mkp/scsi/c/6a84d015082e
[7/9] lpfc: Enhance congestion statistics collection
      https://git.kernel.org/mkp/scsi/c/93190ac1d4e7
[8/9] lpfc: Update lpfc version to 14.2.0.13
      https://git.kernel.org/mkp/scsi/c/48abf8b4b563
[9/9] lpfc: Copyright updates for 14.2.0.13 patches
      https://git.kernel.org/mkp/scsi/c/b93f9eb8f4cd
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering