Skip to contentSkip to conversation

Update lpfc to revision 15.0.0.0

PATCH Applied Justin Tee 2 participants 13 messages Mar 31 – Apr 9

Subsystems (2)
lore
Share & tools
lore

Justin Tee

author
#0 lore raw

cover Update lpfc to revision 15.0.0.0

Update lpfc to revision 15.0.0.0

This patch set adds support for the G8 ASIC found on the LPe42100 series adapter models.

Updates are made to irq affinity assignment, mailbox command handling related to initialization, SGL construction, firmware download diagnostics, and the removal of an outdated performance feature. We also add 128G link speed selection and support.

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

Justin Tee (10):
lpfc: Break out of IRQ affinity assignment when mask reaches
nr_cpu_ids
lpfc: Select mailbox rq_create cmd version based on sli4 if_type
lpfc: Log mcqe contents for mbox commands with no context
lpfc: Add REG_VFI mailbox cmd error handling
lpfc: Remove deprecated PBDE feature
lpfc: Update construction of SGL when XPSGL is enabled
lpfc: Check ASIC_ID register to aid diagnostics during failed fw
updates
lpfc: Introduce 128G link speed selection and support
lpfc: Add PCI ID support for LPe42100 series adapters
lpfc: Update lpfc version to 15.0.0.0

 drivers/scsi/lpfc/lpfc.h           |   9 +-
 drivers/scsi/lpfc/lpfc_attr.c      |  27 +++---
 drivers/scsi/lpfc/lpfc_els.c       |  18 +++-
 drivers/scsi/lpfc/lpfc_hbadisc.c   |   4 +-
 drivers/scsi/lpfc/lpfc_hw.h        |   3 +-
 drivers/scsi/lpfc/lpfc_hw4.h       |  37 ++++----
 drivers/scsi/lpfc/lpfc_ids.h       |   4 +-
 drivers/scsi/lpfc/lpfc_init.c      |  53 ++++++++---
 drivers/scsi/lpfc/lpfc_mbox.c      |   7 +-
 drivers/scsi/lpfc/lpfc_nportdisc.c |  38 ++++----
 drivers/scsi/lpfc/lpfc_nvme.c      |  56 ++++--------
 drivers/scsi/lpfc/lpfc_nvmet.c     |  37 ++------
 drivers/scsi/lpfc/lpfc_scsi.c      | 137 ++++++++++++++---------------
 drivers/scsi/lpfc/lpfc_sli.c       |  27 ++----
 drivers/scsi/lpfc/lpfc_sli4.h      |   1 +
 drivers/scsi/lpfc/lpfc_version.h   |   2 +-
 16 files changed, 225 insertions(+), 235 deletions(-)
Signature · 1 line
2.38.0
author
#1 lore raw

PATCH 1/10 lpfc: Break out of IRQ affinity assignment when mask reaches nr_cpu_ids

The purpose of the lpfc_next_online_cpu() call is to save the cpu index for the next iteration of the for (index = 0; index < vectors; index++) loop. Because we’ve reached the last iteration of the loop, cpumask_next(cpu, aff_mask) returns nr_cpu_ids. Thus, if we already know we've reached the last iteration of the IRQ affinity assignment loop, then we can just break and exit.

---
 drivers/scsi/lpfc/lpfc_init.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_init.c +5 -1
index 3bf522c7f099..cc2ecfe1c907 100644
@@ -2,7 +2,7 @@
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
  * Copyright (C) 2017-2026 Broadcom. All Rights Reserved. The term *
- * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.  *
+ * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.broadcom.com                                                *
@@ -13039,6 +13039,10 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
 			/* Iterate to next offline or online cpu in aff_mask */
 			cpu = cpumask_next(cpu, aff_mask);
 
+			/* Reached the end of the aff_mask */
+			if (cpu >= nr_cpu_ids)
+				break;
+
 			/* Find next online cpu in aff_mask to set affinity */
 			cpu_select = lpfc_next_online_cpu(aff_mask, cpu);
 		} else if (vectors == 1) {
Signature · 1 line
2.38.0
author
#2 lore raw

PATCH 2/10 lpfc: Select mailbox rq_create cmd version based on sli4 if_type

In reply to Justin Tee

When specifying rq version, it is preferred to refer to sli4 interface type instead of the get_sli4_parameters mailbox command response. If sli4 if_type is 2 or above, then the newer version 1 is used for rq_create mailbox commands. Otherwise, version 0 is used and is meant for older adapters.

---
 drivers/scsi/lpfc/lpfc_init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_init.c +3 -1
index cc2ecfe1c907..aa3917f4756a 100644
@@ -13716,7 +13716,9 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
 	sli4_params->cqv = bf_get(cfg_cqv, mbx_sli4_parameters);
 	sli4_params->mqv = bf_get(cfg_mqv, mbx_sli4_parameters);
 	sli4_params->wqv = bf_get(cfg_wqv, mbx_sli4_parameters);
-	sli4_params->rqv = bf_get(cfg_rqv, mbx_sli4_parameters);
+	sli4_params->rqv =
+		(sli4_params->if_type < LPFC_SLI_INTF_IF_TYPE_2) ?
+			LPFC_Q_CREATE_VERSION_0 : LPFC_Q_CREATE_VERSION_1;
 	sli4_params->eqav = bf_get(cfg_eqav, mbx_sli4_parameters);
 	sli4_params->cqav = bf_get(cfg_cqav, mbx_sli4_parameters);
 	sli4_params->wqsize = bf_get(cfg_wqsize, mbx_sli4_parameters);
Signature · 1 line
2.38.0
author
#3 lore raw

PATCH 3/10 lpfc: Log mcqe contents for mbox commands with no context

In reply to Justin Tee

Update log message to display the entirety of an MCQE for which there is no submission context. This log message is not expected to occur and hence is tagged as a LOG_TRACE_EVENT. As such, move the hbalock release to before this log message so that the trace event process does not hold the hbalock for too long.

---
 drivers/scsi/lpfc/lpfc_sli.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +5 -3
index bd71292e7480..b32a1870eec2 100644
@@ -14337,13 +14337,15 @@ lpfc_sli4_sp_handle_mbox_event(struct lpfc_hba *phba, struct lpfc_mcqe *mcqe)
 	/* Get the reference to the active mbox command */
 	spin_lock_irqsave(&phba->hbalock, iflags);
 	pmb = phba->sli.mbox_active;
+	spin_unlock_irqrestore(&phba->hbalock, iflags);
 	if (unlikely(!pmb)) {
 		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
-				"1832 No pending MBOX command to handle\n");
-		spin_unlock_irqrestore(&phba->hbalock, iflags);
+				"1832 No pending MBOX command to handle, "
+				"mcqe: x%08x x%08x x%08x x%08x\n",
+				mcqe->word0, mcqe->mcqe_tag0,
+				mcqe->mcqe_tag1, mcqe->trailer);
 		goto out_no_mqe_complete;
 	}
-	spin_unlock_irqrestore(&phba->hbalock, iflags);
 	mqe = &pmb->u.mqe;
 	pmbox = (MAILBOX_t *)&pmb->u.mqe;
 	mbox = phba->mbox;
Signature · 1 line
2.38.0
author
#4 lore raw

PATCH 4/10 lpfc: Add REG_VFI mailbox cmd error handling

In reply to Justin Tee

If lpfc_issue_reg_vfi() returns an error in lpfc_rcv_plogi(), then execution of lpfc_rcv_plogi() continues and lpfc_reg_rpi() is called, which allocates an mbuf. When this REG_RPI mailbox is issued, it inevitably fails because the VFI is not registered. However, the REG_RPI failure does not free the mbuf that was allocated in lpfc_reg_rpi() because there is no check for mbox error status in lpfc_defer_plogi_acc().

Fix by adding a check in lpfc_rcv_plogi() if lpfc_reg_vfi() fails, then exit early. Also, add mailbox status check in lpfc_defer_plogi_acc to enter the REG_RPI mbox_cmpl functions and free the allocated mbuf.

---
 drivers/scsi/lpfc/lpfc_nportdisc.c | 38 ++++++++++++++++--------------
 1 file changed, 20 insertions(+), 18 deletions(-)
drivers/scsi/lpfc/lpfc_nportdisc.c +20 -18
index 5e431928de0b..9c449055a55e 100644
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
+ * Copyright (C) 2017-2026 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.                        *
@@ -316,8 +316,7 @@ lpfc_defer_plogi_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *login_mbox)
 	struct lpfc_iocbq *save_iocb;
 	struct lpfc_nodelist *ndlp;
 	MAILBOX_t *mb = &login_mbox->u.mb;
-
-	int rc;
+	int rc = 0;
 
 	ndlp = login_mbox->ctx_ndlp;
 	save_iocb = login_mbox->ctx_u.save_iocb;
@@ -346,7 +345,7 @@ lpfc_defer_plogi_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *login_mbox)
 	 * completes.  This ensures, in Pt2Pt, that the PLOGI LS_ACC is sent
 	 * before the PRLI.
 	 */
-	if (!test_bit(FC_PT2PT, &ndlp->vport->fc_flag)) {
+	if (!test_bit(FC_PT2PT, &ndlp->vport->fc_flag) || mb->mbxStatus || rc) {
 		/* Now process the REG_RPI cmpl */
 		lpfc_mbx_cmpl_reg_login(phba, login_mbox);
 		clear_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag);
@@ -525,13 +524,13 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 		/* Issue CONFIG_LINK for SLI3 or REG_VFI for SLI4,
 		 * to account for updated TOV's / parameters
 		 */
-		if (phba->sli_rev == LPFC_SLI_REV4)
-			lpfc_issue_reg_vfi(vport);
-		else {
+		if (phba->sli_rev == LPFC_SLI_REV4) {
+			rc = lpfc_issue_reg_vfi(vport);
+		} else {
 			link_mbox = mempool_alloc(phba->mbox_mem_pool,
 						  GFP_KERNEL);
 			if (!link_mbox)
-				goto out;
+				goto rsp_rjt;
 			lpfc_config_link(phba, link_mbox);
 			link_mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
 			link_mbox->vport = vport;
@@ -544,11 +543,13 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 			rc = lpfc_sli_issue_mbox(phba, link_mbox, MBX_NOWAIT);
 			if (rc == MBX_NOT_FINISHED) {
 				mempool_free(link_mbox, phba->mbox_mem_pool);
-				goto out;
+				goto rsp_rjt;
 			}
 		}
 
 		lpfc_can_disctmo(vport);
+		if (rc)
+			goto rsp_rjt;
 	}
 
 	clear_bit(NLP_SUPPRESS_RSP, &ndlp->nlp_flag);
@@ -562,11 +563,11 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 
 	login_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
 	if (!login_mbox)
-		goto out;
+		goto rsp_rjt;
 
 	save_iocb = kzalloc_obj(*save_iocb);
 	if (!save_iocb)
-		goto out;
+		goto free_login_mbox;
 
 	/* Save info from cmd IOCB to be used in rsp after all mbox completes */
 	memcpy((uint8_t *)save_iocb, (uint8_t *)cmdiocb,
@@ -586,7 +587,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 	rc = lpfc_reg_rpi(phba, vport->vpi, remote_did,
 			    (uint8_t *)sp, login_mbox, ndlp->nlp_rpi);
 	if (rc)
-		goto out;
+		goto free_save_iocb;
 
 	login_mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login;
 	login_mbox->vport = vport;
@@ -659,7 +660,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 	login_mbox->mbox_cmpl = lpfc_defer_plogi_acc;
 	login_mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
 	if (!login_mbox->ctx_ndlp)
-		goto out;
+		goto free_save_iocb;
 
 	login_mbox->ctx_u.save_iocb = save_iocb; /* For PLOGI ACC */
 
@@ -670,16 +671,17 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 	rc = lpfc_sli_issue_mbox(phba, login_mbox, MBX_NOWAIT);
 	if (rc == MBX_NOT_FINISHED) {
 		lpfc_nlp_put(ndlp);
-		goto out;
+		goto free_save_iocb;
 	}
 	lpfc_nlp_set_state(vport, ndlp, NLP_STE_REG_LOGIN_ISSUE);
 
 	return 1;
-out:
-	kfree(save_iocb);
-	if (login_mbox)
-		mempool_free(login_mbox, phba->mbox_mem_pool);
 
+free_save_iocb:
+	kfree(save_iocb);
+free_login_mbox:
+	mempool_free(login_mbox, phba->mbox_mem_pool);
+rsp_rjt:
 	stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
 	stat.un.b.lsRjtRsnCodeExp = LSEXP_OUT_OF_RESOURCE;
 	lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
Signature · 1 line
2.38.0
author
#5 lore raw

PATCH 5/10 lpfc: Remove deprecated PBDE feature

In reply to Justin Tee

The PBDE feature is no longer supported and its related fields are removed in this patch. There are no expected side effects with regards to existing functionality.

---
 drivers/scsi/lpfc/lpfc.h       |  4 +---
 drivers/scsi/lpfc/lpfc_attr.c  |  6 ++----
 drivers/scsi/lpfc/lpfc_hw4.h   | 17 ++--------------
 drivers/scsi/lpfc/lpfc_init.c  |  9 +--------
 drivers/scsi/lpfc/lpfc_mbox.c  |  3 +--
 drivers/scsi/lpfc/lpfc_nvme.c  | 26 ------------------------
 drivers/scsi/lpfc/lpfc_nvmet.c | 37 +++++-----------------------------
 drivers/scsi/lpfc/lpfc_scsi.c  | 34 -------------------------------
 drivers/scsi/lpfc/lpfc_sli.c   | 19 ++---------------
 9 files changed, 14 insertions(+), 141 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -3
index 49ed55db1e47..022c8b1bcc24 100644
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
+ * Copyright (C) 2017-2026 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.                        *
@@ -1015,7 +1015,6 @@ struct lpfc_hba {
 #define LPFC_SLI3_CRP_ENABLED		0x08
 #define LPFC_SLI3_BG_ENABLED		0x20
 #define LPFC_SLI3_DSS_ENABLED		0x40
-#define LPFC_SLI4_PERFH_ENABLED		0x80
 #define LPFC_SLI4_PHWQ_ENABLED		0x100
 	uint32_t iocb_cmd_size;
 	uint32_t iocb_rsp_size;
@@ -1188,7 +1187,6 @@ struct lpfc_hba {
 	uint32_t cfg_ras_fwlog_func;
 	uint32_t cfg_enable_bbcr;	/* Enable BB Credit Recovery */
 	uint32_t cfg_enable_dpp;	/* Enable Direct Packet Push */
-	uint32_t cfg_enable_pbde;
 	uint32_t cfg_enable_mi;
 	struct nvmet_fc_target_port *targetport;
 	lpfc_vpd_t vpd;		/* vital product data */
drivers/scsi/lpfc/lpfc_attr.c +2 -4
index 53f41d68e0d8..9f7df51f893d 100644
@@ -1,8 +1,8 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
- * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.  *
+ * Copyright (C) 2017-2026 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.                        *
  * www.broadcom.com                                                *
@@ -7467,8 +7467,6 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
 
 	phba->cfg_auto_imax = (phba->cfg_fcp_imax) ? 0 : 1;
 
-	phba->cfg_enable_pbde = 0;
-
 	/* A value of 0 means use the number of CPUs found in the system */
 	if (phba->cfg_hdw_queue == 0)
 		phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu;
drivers/scsi/lpfc/lpfc_hw4.h +2 -15
index c000474c3066..0e11701b0881 100644
@@ -1,8 +1,8 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
- * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.  *
+ * Copyright (C) 2017-2026 Broadcom. All Rights Reserved. The term *
+ * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
  * Copyright (C) 2009-2016 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.broadcom.com                                                *
@@ -3062,9 +3062,6 @@ struct lpfc_mbx_request_features {
 #define lpfc_mbx_rq_ftr_rq_iaar_SHIFT		9
 #define lpfc_mbx_rq_ftr_rq_iaar_MASK		0x00000001
 #define lpfc_mbx_rq_ftr_rq_iaar_WORD		word2
-#define lpfc_mbx_rq_ftr_rq_perfh_SHIFT		11
-#define lpfc_mbx_rq_ftr_rq_perfh_MASK		0x00000001
-#define lpfc_mbx_rq_ftr_rq_perfh_WORD		word2
 #define lpfc_mbx_rq_ftr_rq_mrqp_SHIFT		16
 #define lpfc_mbx_rq_ftr_rq_mrqp_MASK		0x00000001
 #define lpfc_mbx_rq_ftr_rq_mrqp_WORD		word2
@@ -3096,9 +3093,6 @@ struct lpfc_mbx_request_features {
 #define lpfc_mbx_rq_ftr_rsp_ifip_SHIFT		7
 #define lpfc_mbx_rq_ftr_rsp_ifip_MASK		0x00000001
 #define lpfc_mbx_rq_ftr_rsp_ifip_WORD		word3
-#define lpfc_mbx_rq_ftr_rsp_perfh_SHIFT		11
-#define lpfc_mbx_rq_ftr_rsp_perfh_MASK		0x00000001
-#define lpfc_mbx_rq_ftr_rsp_perfh_WORD		word3
 #define lpfc_mbx_rq_ftr_rsp_mrqp_SHIFT		16
 #define lpfc_mbx_rq_ftr_rsp_mrqp_MASK		0x00000001
 #define lpfc_mbx_rq_ftr_rsp_mrqp_WORD		word3
@@ -3461,10 +3455,6 @@ struct lpfc_sli4_parameters {
 #define cfg_pvl_MASK				0x00000001
 #define cfg_pvl_WORD				word19
 
-#define cfg_pbde_SHIFT				20
-#define cfg_pbde_MASK				0x00000001
-#define cfg_pbde_WORD				word19
-
 	uint32_t word20;
 #define cfg_max_tow_xri_SHIFT			0
 #define cfg_max_tow_xri_MASK			0x0000ffff
@@ -4484,9 +4474,6 @@ struct wqe_common {
 #define wqe_irsp_SHIFT        4
 #define wqe_irsp_MASK         0x00000001
 #define wqe_irsp_WORD         word11
-#define wqe_pbde_SHIFT        5
-#define wqe_pbde_MASK         0x00000001
-#define wqe_pbde_WORD         word11
 #define wqe_sup_SHIFT         6
 #define wqe_sup_MASK          0x00000001
 #define wqe_sup_WORD          word11
drivers/scsi/lpfc/lpfc_init.c +1 -8
index aa3917f4756a..8e5f00e6abe0 100644
@@ -13780,12 +13780,6 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
 	if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME)
 		phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT;
 
-	/* Enable embedded Payload BDE if support is indicated */
-	if (bf_get(cfg_pbde, mbx_sli4_parameters))
-		phba->cfg_enable_pbde = 1;
-	else
-		phba->cfg_enable_pbde = 0;
-
 	/*
 	 * To support Suppress Response feature we must satisfy 3 conditions.
 	 * lpfc_suppress_rsp module parameter must be set (default).
@@ -13820,9 +13814,8 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
 		phba->fcp_embed_io = 0;
 
 	lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME,
-			"6422 XIB %d PBDE %d: FCP %d NVME %d %d %d\n",
+			"6422 XIB %d: FCP %d NVME %d %d %d\n",
 			bf_get(cfg_xib, mbx_sli4_parameters),
-			phba->cfg_enable_pbde,
 			phba->fcp_embed_io, sli4_params->nvme,
 			phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp);
 
drivers/scsi/lpfc/lpfc_mbox.c +1 -2
index d07c2786cb12..572db7348806 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-2026 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.                        *
@@ -2139,7 +2139,6 @@ lpfc_request_features(struct lpfc_hba *phba, struct lpfcMboxq *mboxq)
 
 	/* Set up host requested features. */
 	bf_set(lpfc_mbx_rq_ftr_rq_fcpi, &mboxq->u.mqe.un.req_ftrs, 1);
-	bf_set(lpfc_mbx_rq_ftr_rq_perfh, &mboxq->u.mqe.un.req_ftrs, 1);
 
 	/* Enable DIF (block guard) only if configured to do so. */
 	if (phba->cfg_enable_bg)
drivers/scsi/lpfc/lpfc_nvme.c +0 -26
index 74c2820c64f3..81b8fe69f2bc 100644
@@ -1296,8 +1296,6 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport,
 	/* Word 10 */
 	bf_set(wqe_xchg, &wqe->fcp_iwrite.wqe_com, LPFC_NVME_XCHG);
 
-	/* Words 13 14 15 are for PBDE support */
-
 	/* add the VMID tags as per switch response */
 	if (unlikely(lpfc_ncmd->cur_iocbq.cmd_flag & LPFC_IO_VMID)) {
 		if (phba->pport->vmid_priority_tagging) {
@@ -1335,12 +1333,9 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,
 {
 	struct lpfc_hba *phba = vport->phba;
 	struct nvmefc_fcp_req *nCmd = lpfc_ncmd->nvmeCmd;
-	union lpfc_wqe128 *wqe = &lpfc_ncmd->cur_iocbq.wqe;
 	struct sli4_sge *sgl = lpfc_ncmd->dma_sgl;
 	struct sli4_hybrid_sgl *sgl_xtra = NULL;
 	struct scatterlist *data_sg;
-	struct sli4_sge *first_data_sgl;
-	struct ulp_bde64 *bde;
 	dma_addr_t physaddr = 0;
 	uint32_t dma_len = 0;
 	uint32_t dma_offset = 0;
@@ -1361,7 +1356,6 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,
 		 */
 		sgl += 2;
 
-		first_data_sgl = sgl;
 		lpfc_ncmd->seg_cnt = nCmd->sg_cnt;
 		if (lpfc_ncmd->seg_cnt > lpfc_nvme_template.max_sgl_segments) {
 			lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
@@ -1464,26 +1458,6 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,
 
 			j++;
 		}
-
-		/* PBDE support for first data SGE only */
-		if (nseg == 1 && phba->cfg_enable_pbde) {
-			/* Words 13-15 */
-			bde = (struct ulp_bde64 *)
-				&wqe->words[13];
-			bde->addrLow = first_data_sgl->addr_lo;
-			bde->addrHigh = first_data_sgl->addr_hi;
-			bde->tus.f.bdeSize =
-				le32_to_cpu(first_data_sgl->sge_len);
-			bde->tus.f.bdeFlags = BUFF_TYPE_BDE_64;
-			bde->tus.w = cpu_to_le32(bde->tus.w);
-
-			/* Word 11 - set PBDE bit */
-			bf_set(wqe_pbde, &wqe->generic.wqe_com, 1);
-		} else {
-			memset(&wqe->words[13], 0, (sizeof(uint32_t) * 3));
-			/* Word 11 - PBDE bit disabled by default template */
-		}
-
 	} else {
 		lpfc_ncmd->seg_cnt = 0;
 
drivers/scsi/lpfc/lpfc_nvmet.c +5 -32
index debd9317103a..72f3f6f9444d 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-2026 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.                        *
@@ -118,12 +118,9 @@ lpfc_nvmet_cmd_template(void)
 	bf_set(wqe_sup, &wqe->fcp_tsend.wqe_com, 0);
 	bf_set(wqe_irsp, &wqe->fcp_tsend.wqe_com, 0);
 	bf_set(wqe_irsplen, &wqe->fcp_tsend.wqe_com, 0);
-	bf_set(wqe_pbde, &wqe->fcp_tsend.wqe_com, 0);
 
 	/* Word 12 - fcp_data_len is variable */
 
-	/* Word 13, 14, 15 - PBDE is zero */
-
 	/* TRECEIVE template */
 	wqe = &lpfc_treceive_cmd_template;
 	memset(wqe, 0, sizeof(union lpfc_wqe128));
@@ -158,18 +155,15 @@ lpfc_nvmet_cmd_template(void)
 	bf_set(wqe_lenloc, &wqe->fcp_treceive.wqe_com, LPFC_WQE_LENLOC_WORD12);
 	bf_set(wqe_xc, &wqe->fcp_tsend.wqe_com, 1);
 
-	/* Word 11 - pbde is variable */
+	/* Word 11 */
 	bf_set(wqe_cmd_type, &wqe->fcp_treceive.wqe_com, FCP_COMMAND_TRECEIVE);
 	bf_set(wqe_cqid, &wqe->fcp_treceive.wqe_com, LPFC_WQE_CQ_ID_DEFAULT);
 	bf_set(wqe_sup, &wqe->fcp_treceive.wqe_com, 0);
 	bf_set(wqe_irsp, &wqe->fcp_treceive.wqe_com, 0);
 	bf_set(wqe_irsplen, &wqe->fcp_treceive.wqe_com, 0);
-	bf_set(wqe_pbde, &wqe->fcp_treceive.wqe_com, 1);
 
 	/* Word 12 - fcp_data_len is variable */
 
-	/* Word 13, 14, 15 - PBDE is variable */
-
 	/* TRSP template */
 	wqe = &lpfc_trsp_cmd_template;
 	memset(wqe, 0, sizeof(union lpfc_wqe128));
@@ -207,7 +201,6 @@ lpfc_nvmet_cmd_template(void)
 	bf_set(wqe_sup, &wqe->fcp_trsp.wqe_com, 0);
 	bf_set(wqe_irsp, &wqe->fcp_trsp.wqe_com, 0);
 	bf_set(wqe_irsplen, &wqe->fcp_trsp.wqe_com, 0);
-	bf_set(wqe_pbde, &wqe->fcp_trsp.wqe_com, 0);
 
 	/* Word 12, 13, 14, 15 - is zero */
 }
@@ -2722,7 +2715,6 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,
 	struct ulp_bde64 *bde;
 	dma_addr_t physaddr;
 	int i, cnt, nsegs;
-	bool use_pbde = false;
 	int xc = 1;
 
 	if (!lpfc_is_link_up(phba)) {
@@ -2907,15 +2899,6 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,
 		if (!xc)
 			bf_set(wqe_xc, &wqe->fcp_treceive.wqe_com, 0);
 
-		/* Word 11 - check for pbde */
-		if (nsegs == 1 && phba->cfg_enable_pbde) {
-			use_pbde = true;
-			/* Word 11 - PBDE bit already preset by template */
-		} else {
-			/* Overwrite default template setting */
-			bf_set(wqe_pbde, &wqe->fcp_treceive.wqe_com, 0);
-		}
-
 		/* Word 12 */
 		wqe->fcp_tsend.fcp_data_len = rsp->transfer_length;
 
@@ -3023,19 +3006,9 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,
 	}
 
 	bde = (struct ulp_bde64 *)&wqe->words[13];
-	if (use_pbde) {
-		/* decrement sgl ptr backwards once to first data sge */
-		sgl--;
-
-		/* Words 13-15 (PBDE) */
-		bde->addrLow = sgl->addr_lo;
-		bde->addrHigh = sgl->addr_hi;
-		bde->tus.f.bdeSize = le32_to_cpu(sgl->sge_len);
-		bde->tus.f.bdeFlags = BUFF_TYPE_BDE_64;
-		bde->tus.w = cpu_to_le32(bde->tus.w);
-	} else {
-		memset(bde, 0, sizeof(struct ulp_bde64));
-	}
+
+	memset(bde, 0, sizeof(struct ulp_bde64));
+
 	ctxp->state = LPFC_NVME_STE_DATA;
 	ctxp->entry_cnt++;
 	return nvmewqe;
drivers/scsi/lpfc/lpfc_scsi.c +0 -34
index e9d27703bc44..f11f2c29db89 100644
@@ -3050,7 +3050,6 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
 	struct scatterlist *sgel = NULL;
 	struct fcp_cmnd *fcp_cmnd = lpfc_cmd->fcp_cmnd;
 	struct sli4_sge *sgl = (struct sli4_sge *)lpfc_cmd->dma_sgl;
-	struct sli4_sge *first_data_sgl;
 	struct lpfc_iocbq *pwqeq = &lpfc_cmd->cur_iocbq;
 	struct lpfc_vport *vport = phba->pport;
 	union lpfc_wqe128 *wqe = &pwqeq->wqe;
@@ -3058,7 +3057,6 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
 	uint32_t dma_len;
 	uint32_t dma_offset = 0;
 	int nseg, i, j;
-	struct ulp_bde64 *bde;
 	bool lsp_just_set = false;
 	struct sli4_hybrid_sgl *sgl_xtra = NULL;
 
@@ -3085,7 +3083,6 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
 		bf_set(lpfc_sli4_sge_last, sgl, 0);
 		sgl->word2 = cpu_to_le32(sgl->word2);
 		sgl += 1;
-		first_data_sgl = sgl;
 		lpfc_cmd->seg_cnt = nseg;
 		if (!phba->cfg_xpsgl &&
 		    lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) {
@@ -3185,43 +3182,12 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
 
 			j++;
 		}
-
-		/* PBDE support for first data SGE only.
-		 * For FCoE, we key off Performance Hints.
-		 * For FC, we key off lpfc_enable_pbde.
-		 */
-		if (nseg == 1 &&
-		    ((phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) ||
-		     phba->cfg_enable_pbde)) {
-			/* Words 13-15 */
-			bde = (struct ulp_bde64 *)
-				&wqe->words[13];
-			bde->addrLow = first_data_sgl->addr_lo;
-			bde->addrHigh = first_data_sgl->addr_hi;
-			bde->tus.f.bdeSize =
-					le32_to_cpu(first_data_sgl->sge_len);
-			bde->tus.f.bdeFlags = BUFF_TYPE_BDE_64;
-			bde->tus.w = cpu_to_le32(bde->tus.w);
-
-			/* Word 11 - set PBDE bit */
-			bf_set(wqe_pbde, &wqe->generic.wqe_com, 1);
-		} else {
-			memset(&wqe->words[13], 0, (sizeof(uint32_t) * 3));
-			/* Word 11 - PBDE bit disabled by default template */
-		}
 	} else {
 		sgl += 1;
 		/* set the last flag in the fcp_rsp map entry */
 		sgl->word2 = le32_to_cpu(sgl->word2);
 		bf_set(lpfc_sli4_sge_last, sgl, 1);
 		sgl->word2 = cpu_to_le32(sgl->word2);
-
-		if ((phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) ||
-		    phba->cfg_enable_pbde) {
-			bde = (struct ulp_bde64 *)
-				&wqe->words[13];
-			memset(bde, 0, (sizeof(uint32_t) * 3));
-		}
 	}
 
 	/*
drivers/scsi/lpfc/lpfc_sli.c +2 -17
index b32a1870eec2..41a73ffd34e1 100644
@@ -136,15 +136,12 @@ void lpfc_wqe_cmd_template(void)
 	bf_set(wqe_dbde, &wqe->fcp_iread.wqe_com, 0);
 	bf_set(wqe_wqes, &wqe->fcp_iread.wqe_com, 1);
 
-	/* Word 11 - pbde is variable */
+	/* Word 11 */
 	bf_set(wqe_cmd_type, &wqe->fcp_iread.wqe_com, COMMAND_DATA_IN);
 	bf_set(wqe_cqid, &wqe->fcp_iread.wqe_com, LPFC_WQE_CQ_ID_DEFAULT);
-	bf_set(wqe_pbde, &wqe->fcp_iread.wqe_com, 0);
 
 	/* Word 12 - is zero */
 
-	/* Word 13, 14, 15 - PBDE is variable */
-
 	/* IWRITE template */
 	wqe = &lpfc_iwrite_cmd_template;
 	memset(wqe, 0, sizeof(union lpfc_wqe128));
@@ -176,15 +173,12 @@ void lpfc_wqe_cmd_template(void)
 	bf_set(wqe_dbde, &wqe->fcp_iwrite.wqe_com, 0);
 	bf_set(wqe_wqes, &wqe->fcp_iwrite.wqe_com, 1);
 
-	/* Word 11 - pbde is variable */
+	/* Word 11 */
 	bf_set(wqe_cmd_type, &wqe->fcp_iwrite.wqe_com, COMMAND_DATA_OUT);
 	bf_set(wqe_cqid, &wqe->fcp_iwrite.wqe_com, LPFC_WQE_CQ_ID_DEFAULT);
-	bf_set(wqe_pbde, &wqe->fcp_iwrite.wqe_com, 0);
 
 	/* Word 12 - is zero */
 
-	/* Word 13, 14, 15 - PBDE is variable */
-
 	/* ICMND template */
 	wqe = &lpfc_icmnd_cmd_template;
 	memset(wqe, 0, sizeof(union lpfc_wqe128));
@@ -217,7 +211,6 @@ void lpfc_wqe_cmd_template(void)
 	/* Word 11 */
 	bf_set(wqe_cmd_type, &wqe->fcp_icmd.wqe_com, COMMAND_DATA_IN);
 	bf_set(wqe_cqid, &wqe->fcp_icmd.wqe_com, LPFC_WQE_CQ_ID_DEFAULT);
-	bf_set(wqe_pbde, &wqe->fcp_icmd.wqe_com, 0);
 
 	/* Word 12, 13, 14, 15 - is zero */
 }
@@ -8732,14 +8725,6 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
 		ftr_rsp++;
 	}
 
-	/* Performance Hints are ONLY for FCoE */
-	if (test_bit(HBA_FCOE_MODE, &phba->hba_flag)) {
-		if (bf_get(lpfc_mbx_rq_ftr_rsp_perfh, &mqe->un.req_ftrs))
-			phba->sli3_options |= LPFC_SLI4_PERFH_ENABLED;
-		else
-			phba->sli3_options &= ~LPFC_SLI4_PERFH_ENABLED;
-	}
-
 	/*
 	 * If the port cannot support the host's requested features
 	 * then turn off the global config parameters to disable the
Signature · 1 line
2.38.0
author
#6 lore raw

PATCH 6/10 lpfc: Update construction of SGL when XPSGL is enabled

In reply to Justin Tee

The construction of SGLs is updated to safeguard ASIC boundary requirements when using XPSGL.

The LSP type SGE is used to notify where a continuing SGL resides. Typically, this means that the LSP is the last SGE in an SGL because the current SGL has reached its maximum size and the LSP is used to refer to the next follow up SGL. Due to ASIC boundary requirements, there is a need to ensure a 4 KB boundary is not crossed. Thus, for a maximum size of 256 byte SGLs or 16 SGEs, this means restricting the LSP to being the 12th SGE for the very first SGL that is used for pre-registration. If additional SGEs are needed, the LSP will be the last SGE position within that follow up SGL as was previously implemented.

---
 drivers/scsi/lpfc/lpfc_nvme.c |  30 ++++++----
 drivers/scsi/lpfc/lpfc_scsi.c | 103 ++++++++++++++++++++++------------
 2 files changed, 87 insertions(+), 46 deletions(-)
drivers/scsi/lpfc/lpfc_nvme.c +19 -11
index 81b8fe69f2bc..71714ea390d9 100644
@@ -1339,7 +1339,7 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,
 	dma_addr_t physaddr = 0;
 	uint32_t dma_len = 0;
 	uint32_t dma_offset = 0;
-	int nseg, i, j;
+	int nseg, i, j, k;
 	bool lsp_just_set = false;
 
 	/* Fix up the command and response DMA stuff. */
@@ -1379,6 +1379,9 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,
 
 		/* for tracking the segment boundaries */
 		j = 2;
+		k = 5;
+		if (unlikely(!phba->cfg_xpsgl))
+			k = 1;
 		for (i = 0; i < nseg; i++) {
 			if (data_sg == NULL) {
 				lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
@@ -1397,9 +1400,8 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,
 				bf_set(lpfc_sli4_sge_last, sgl, 0);
 
 				/* expand the segment */
-				if (!lsp_just_set &&
-				    !((j + 1) % phba->border_sge_num) &&
-				    ((nseg - 1) != i)) {
+				if (!lsp_just_set && (nseg != (i + k)) &&
+				    !((j + k) % phba->border_sge_num)) {
 					/* set LSP type */
 					bf_set(lpfc_sli4_sge_type, sgl,
 					       LPFC_SGE_TYPE_LSP);
@@ -1422,8 +1424,8 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,
 				}
 			}
 
-			if (!(bf_get(lpfc_sli4_sge_type, sgl) &
-				     LPFC_SGE_TYPE_LSP)) {
+			if (bf_get(lpfc_sli4_sge_type, sgl) !=
+			    LPFC_SGE_TYPE_LSP) {
 				if ((nseg - 1) == i)
 					bf_set(lpfc_sli4_sge_last, sgl, 1);
 
@@ -1444,19 +1446,25 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,
 				sgl++;
 
 				lsp_just_set = false;
+				j++;
 			} else {
 				sgl->word2 = cpu_to_le32(sgl->word2);
-
-				sgl->sge_len = cpu_to_le32(
-						     phba->cfg_sg_dma_buf_size);
+				/* will remaining SGEs fill the next SGL? */
+				if ((nseg - i) < phba->border_sge_num)
+					sgl->sge_len =
+						cpu_to_le32((nseg - i) *
+								sizeof(*sgl));
+				else
+					sgl->sge_len =
+						cpu_to_le32(phba->cfg_sg_dma_buf_size);
 
 				sgl = (struct sli4_sge *)sgl_xtra->dma_sgl;
 				i = i - 1;
 
 				lsp_just_set = true;
+				j += k;
+				k = 1;
 			}
-
-			j++;
 		}
 	} else {
 		lpfc_ncmd->seg_cnt = 0;
drivers/scsi/lpfc/lpfc_scsi.c +68 -35

242 lines not on this page · raw message

Signature · 1 line
2.38.0
author
#7 lore raw

PATCH 7/10 lpfc: Check ASIC_ID register to aid diagnostics during failed fw updates

In reply to Justin Tee

When WRITE_OBJECT mailbox command fails during firmware update, the lpfc_log_write_firmware_error routine is used to log and parse commonly found error codes. Update this routine to also include ASIC_ID register checks for notifying users of incompatible images.

---
 drivers/scsi/lpfc/lpfc_hw4.h  | 20 ++++++++++++++++++--
 drivers/scsi/lpfc/lpfc_init.c | 19 ++++++++++++++++++-
 drivers/scsi/lpfc/lpfc_sli4.h |  1 +
 3 files changed, 37 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_hw4.h +18 -2
index 0e11701b0881..f91bde4a6c38 100644
@@ -100,7 +100,8 @@ struct lpfc_sli_intf {
 #define lpfc_sli_intf_sli_family_MASK		0x0000000F
 #define lpfc_sli_intf_sli_family_WORD		word0
 #define LPFC_SLI_INTF_FAMILY_BE2	0x0
-#define LPFC_SLI_INTF_FAMILY_BE3	0x1
+#define LPFC_SLI_INTF_ASIC_ID		0x1	/* Refer to ASIC_ID register */
+#define LPFC_SLI_INTF_FAMILY_BE3	0x3
 #define LPFC_SLI_INTF_FAMILY_LNCR_A0	0xa
 #define LPFC_SLI_INTF_FAMILY_LNCR_B0	0xb
 #define LPFC_SLI_INTF_FAMILY_G6		0xc
@@ -118,6 +119,17 @@ struct lpfc_sli_intf {
 #define LPFC_SLI_INTF_IF_TYPE_VIRT	1
 };
 
+struct lpfc_asic_id {
+	u32 word0;
+#define lpfc_asic_id_gen_num_SHIFT	8
+#define lpfc_asic_id_gen_num_MASK	0x000000FF
+#define lpfc_asic_id_gen_num_WORD	word0
+#define LPFC_SLI_INTF_FAMILY_G8		0x10
+#define lpfc_asic_id_rev_num_SHIFT	0
+#define lpfc_asic_id_rev_num_MASK	0x000000FF
+#define lpfc_asic_id_rev_num_WORD	word0
+};
+
 #define LPFC_SLI4_MBX_EMBED	true
 #define LPFC_SLI4_MBX_NEMBED	false
 
@@ -624,6 +636,10 @@ struct lpfc_register {
 
 #define LPFC_PORT_SEM_UE_RECOVERABLE    0xE000
 #define LPFC_PORT_SEM_MASK		0xF000
+
+/* The following are config space register offsets */
+#define LPFC_ASIC_ID_OFFSET		0x0308
+
 /* The following BAR0 Registers apply to SLI4 if_type 0 UCNAs. */
 #define LPFC_UERR_STATUS_HI		0x00A4
 #define LPFC_UERR_STATUS_LO		0x00A0
@@ -632,7 +648,6 @@ struct lpfc_register {
 
 /* The following BAR0 register sets are defined for if_type 0 and 2 UCNAs. */
 #define LPFC_SLI_INTF			0x0058
-#define LPFC_SLI_ASIC_VER		0x009C
 
 #define LPFC_CTL_PORT_SEM_OFFSET	0x400
 #define lpfc_port_smphr_perr_SHIFT	31
@@ -4965,6 +4980,7 @@ union lpfc_wqe128 {
 #define MAGIC_NUMBER_G6 0xFEAA0003
 #define MAGIC_NUMBER_G7 0xFEAA0005
 #define MAGIC_NUMBER_G7P 0xFEAA0020
+#define MAGIC_NUMBER_G8 0xFEAA0070
 
 struct lpfc_grp_hdr {
 	uint32_t size;
drivers/scsi/lpfc/lpfc_init.c +18 -1
index 8e5f00e6abe0..fd6b48e46a69 100644
@@ -11793,6 +11793,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
 	unsigned long bar0map_len, bar1map_len, bar2map_len;
 	int error;
 	uint32_t if_type;
+	u8 sli_family;
 
 	if (!pdev)
 		return -ENODEV;
@@ -11823,6 +11824,14 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
 		return -ENODEV;
 	}
 
+	/* Check if ASIC_ID register should be read */
+	sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf);
+	if (sli_family == LPFC_SLI_INTF_ASIC_ID) {
+		if (pci_read_config_dword(pdev, LPFC_ASIC_ID_OFFSET,
+					  &phba->sli4_hba.asic_id.word0))
+			return -ENODEV;
+	}
+
 	if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf);
 	/*
 	 * Get the bus address of SLI4 device Bar regions and the
@@ -14480,6 +14489,12 @@ lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset,
 	u8 sli_family;
 
 	sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf);
+
+	/* Refer to ASIC_ID register case */
+	if (sli_family == LPFC_SLI_INTF_ASIC_ID)
+		sli_family = bf_get(lpfc_asic_id_gen_num,
+				    &phba->sli4_hba.asic_id);
+
 	/* Three cases:  (1) FW was not supported on the detected adapter.
 	 * (2) FW update has been locked out administratively.
 	 * (3) Some other error during FW update.
@@ -14492,7 +14507,9 @@ lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset,
 	    (sli_family == LPFC_SLI_INTF_FAMILY_G7 &&
 	     magic_number != MAGIC_NUMBER_G7) ||
 	    (sli_family == LPFC_SLI_INTF_FAMILY_G7P &&
-	     magic_number != MAGIC_NUMBER_G7P)) {
+	     magic_number != MAGIC_NUMBER_G7P) ||
+	    (sli_family == LPFC_SLI_INTF_FAMILY_G8 &&
+	     magic_number != MAGIC_NUMBER_G8)) {
 		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
 				"3030 This firmware version is not supported on"
 				" this HBA model. Device:%x Magic:%x Type:%x "
drivers/scsi/lpfc/lpfc_sli4.h +1 -0
index 0aa105cab125..036760702ecc 100644
@@ -838,6 +838,7 @@ struct lpfc_sli4_hba {
 	uint32_t ue_to_sr;
 	uint32_t ue_to_rp;
 	struct lpfc_register sli_intf;
+	struct lpfc_register asic_id;
 	struct lpfc_pc_sli4_params pc_sli4_params;
 	struct lpfc_bbscn_params bbscn_params;
 	struct lpfc_hba_eq_hdl *hba_eq_hdl; /* HBA per-WQ handle */
Signature · 1 line
2.38.0
author
#8 lore raw

PATCH 8/10 lpfc: Introduce 128G link speed selection and support

In reply to Justin Tee

128G link speed selection and support is added for various mailbox commands, defines, and ACQE handling. The default behavior to autonegotiate supported link speed remains the same.

---
 drivers/scsi/lpfc/lpfc.h         |  5 +++--
 drivers/scsi/lpfc/lpfc_attr.c    | 21 ++++++++++++---------
 drivers/scsi/lpfc/lpfc_els.c     | 18 ++++++++++++++----
 drivers/scsi/lpfc/lpfc_hbadisc.c |  4 ++--
 drivers/scsi/lpfc/lpfc_init.c    | 12 ++++++++++--
 drivers/scsi/lpfc/lpfc_mbox.c    |  4 ++++
 6 files changed, 45 insertions(+), 19 deletions(-)
drivers/scsi/lpfc/lpfc.h +3 -2
index 022c8b1bcc24..b67ea1730dcf 100644
@@ -810,9 +810,10 @@ struct unsol_rcv_ct_ctx {
 #define LPFC_USER_LINK_SPEED_16G	16	/* 16 Gigabaud */
 #define LPFC_USER_LINK_SPEED_32G	32	/* 32 Gigabaud */
 #define LPFC_USER_LINK_SPEED_64G	64	/* 64 Gigabaud */
-#define LPFC_USER_LINK_SPEED_MAX	LPFC_USER_LINK_SPEED_64G
+#define LPFC_USER_LINK_SPEED_128G	128	/* 128 Gigabaud */
+#define LPFC_USER_LINK_SPEED_MAX	LPFC_USER_LINK_SPEED_128G
 
-#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8, 10, 16, 32, 64"
+#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8, 10, 16, 32, 64, 128"
 
 enum nemb_type {
 	nemb_mse = 1,
drivers/scsi/lpfc/lpfc_attr.c +12 -9
index 9f7df51f893d..c91fa44b12d4 100644
@@ -4415,7 +4415,7 @@ static DEVICE_ATTR_RO(lpfc_static_vport);
 /*
 # lpfc_link_speed: Link speed selection for initializing the Fibre Channel
 # connection.
-# Value range is [0,16]. Default value is 0.
+# Value range is [0,128]. Default value is 0.
 */
 /**
  * lpfc_link_speed_store - Set the adapters link speed
@@ -4468,14 +4468,15 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
 		"3055 lpfc_link_speed changed from %d to %d %s\n",
 		phba->cfg_link_speed, val, nolip ? "(nolip)" : "(lip)");
 
-	if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) ||
-	    ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) ||
-	    ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) ||
-	    ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) ||
-	    ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) ||
-	    ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) ||
-	    ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb)) ||
-	    ((val == LPFC_USER_LINK_SPEED_64G) && !(phba->lmt & LMT_64Gb))) {
+	if ((val == LPFC_USER_LINK_SPEED_1G && !(phba->lmt & LMT_1Gb)) ||
+	    (val == LPFC_USER_LINK_SPEED_2G && !(phba->lmt & LMT_2Gb)) ||
+	    (val == LPFC_USER_LINK_SPEED_4G && !(phba->lmt & LMT_4Gb)) ||
+	    (val == LPFC_USER_LINK_SPEED_8G && !(phba->lmt & LMT_8Gb)) ||
+	    (val == LPFC_USER_LINK_SPEED_10G && !(phba->lmt & LMT_10Gb)) ||
+	    (val == LPFC_USER_LINK_SPEED_16G && !(phba->lmt & LMT_16Gb)) ||
+	    (val == LPFC_USER_LINK_SPEED_32G && !(phba->lmt & LMT_32Gb)) ||
+	    (val == LPFC_USER_LINK_SPEED_64G && !(phba->lmt & LMT_64Gb)) ||
+	    (val == LPFC_USER_LINK_SPEED_128G && !(phba->lmt & LMT_128Gb))) {
 		lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
 				"2879 lpfc_link_speed attribute cannot be set "
 				"to %d. Speed is not supported by this port.\n",
@@ -4500,6 +4501,7 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
 	case LPFC_USER_LINK_SPEED_16G:
 	case LPFC_USER_LINK_SPEED_32G:
 	case LPFC_USER_LINK_SPEED_64G:
+	case LPFC_USER_LINK_SPEED_128G:
 		prev_val = phba->cfg_link_speed;
 		phba->cfg_link_speed = val;
 		if (nolip)
@@ -4564,6 +4566,7 @@ lpfc_link_speed_init(struct lpfc_hba *phba, int val)
 	case LPFC_USER_LINK_SPEED_16G:
 	case LPFC_USER_LINK_SPEED_32G:
 	case LPFC_USER_LINK_SPEED_64G:
+	case LPFC_USER_LINK_SPEED_128G:
 		phba->cfg_link_speed = val;
 		return 0;
 	default:
drivers/scsi/lpfc/lpfc_els.c +14 -4
index d70a4039a345..4e3fe89283e4 100644
@@ -4329,18 +4329,28 @@ lpfc_format_edc_cgn_desc(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)
 static bool
 lpfc_link_is_lds_capable(struct lpfc_hba *phba)
 {
-	if (!(phba->lmt & LMT_64Gb))
+	if (!(phba->lmt & (LMT_64Gb | LMT_128Gb)))
 		return false;
 	if (phba->sli_rev != LPFC_SLI_REV4)
 		return false;
 
 	if (phba->sli4_hba.conf_trunk) {
-		if (phba->trunk_link.phy_lnk_speed == LPFC_USER_LINK_SPEED_64G)
+		switch (phba->trunk_link.phy_lnk_speed) {
+		case LPFC_USER_LINK_SPEED_128G:
+		case LPFC_USER_LINK_SPEED_64G:
 			return true;
-	} else if (phba->fc_linkspeed == LPFC_LINK_SPEED_64GHZ) {
+		default:
+			return false;
+		}
+	}
+
+	switch (phba->fc_linkspeed) {
+	case LPFC_LINK_SPEED_128GHZ:
+	case LPFC_LINK_SPEED_64GHZ:
 		return true;
+	default:
+		return false;
 	}
-	return false;
 }
 
  /**
drivers/scsi/lpfc/lpfc_hbadisc.c +2 -2
index 73e78e633d41..34f8d58192ce 100644
@@ -3817,7 +3817,7 @@ lpfc_mbx_cmpl_read_topology(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 		if (phba->cmf_active_mode != LPFC_CFG_OFF)
 			lpfc_cmf_signal_init(phba);
 
-		if (phba->lmt & LMT_64Gb)
+		if (phba->lmt & (LMT_64Gb | LMT_128Gb))
 			lpfc_read_lds_params(phba);
 
 	} else if (attn_type == LPFC_ATT_LINK_DOWN ||
@@ -4410,7 +4410,7 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 					LOG_INIT | LOG_ELS | LOG_DISCOVERY,
 					"4220 Issue EDC status x%x Data x%x\n",
 					rc, phba->cgn_init_reg_signal);
-		} else if (phba->lmt & LMT_64Gb) {
+		} else if (phba->lmt & (LMT_64Gb | LMT_128Gb)) {
 			/* may send link fault capability descriptor */
 			lpfc_issue_els_edc(vport, 0);
 		} else {
drivers/scsi/lpfc/lpfc_init.c +10 -2
index fd6b48e46a69..70cdb039ef4e 100644
@@ -789,7 +789,9 @@ lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology,
 	    ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) &&
 	     !(phba->lmt & LMT_32Gb)) ||
 	    ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_64G) &&
-	     !(phba->lmt & LMT_64Gb))) {
+	     !(phba->lmt & LMT_64Gb)) ||
+	    ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_128G) &&
+	     !(phba->lmt & LMT_128Gb))) {
 		/* Reset link speed to auto */
 		lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
 				"1302 Invalid speed for this board:%d "
@@ -2535,7 +2537,9 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
 		return;
 	}
 
-	if (phba->lmt & LMT_64Gb)
+	if (phba->lmt & LMT_128Gb)
+		max_speed = 128;
+	else if (phba->lmt & LMT_64Gb)
 		max_speed = 64;
 	else if (phba->lmt & LMT_32Gb)
 		max_speed = 32;
@@ -10144,6 +10148,10 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
 				phba->cfg_link_speed =
 					LPFC_USER_LINK_SPEED_64G;
 				break;
+			case LINK_SPEED_128G:
+				phba->cfg_link_speed =
+					LPFC_USER_LINK_SPEED_128G;
+				break;
 			case 0xffff:
 				phba->cfg_link_speed =
 					LPFC_USER_LINK_SPEED_AUTO;
drivers/scsi/lpfc/lpfc_mbox.c +4 -0
index 572db7348806..4c058904758d 100644
@@ -625,6 +625,10 @@ lpfc_init_link(struct lpfc_hba * phba,
 			mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
 			mb->un.varInitLnk.link_speed = LINK_SPEED_64G;
 			break;
+		case LPFC_USER_LINK_SPEED_128G:
+			mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
+			mb->un.varInitLnk.link_speed = LINK_SPEED_128G;
+			break;
 		case LPFC_USER_LINK_SPEED_AUTO:
 		default:
 			mb->un.varInitLnk.link_speed = LINK_SPEED_AUTO;
Signature · 1 line
2.38.0
author
#9 lore raw

PATCH 9/10 lpfc: Add PCI ID support for LPe42100 series adapters

In reply to Justin Tee

Update supported pci_device_id table to include the values for the G8 ASIC Device ID utilized by LPe42100 series of adapters. The default reporting string will be "LPe42100".

---
 drivers/scsi/lpfc/lpfc_hw.h   | 3 ++-
 drivers/scsi/lpfc/lpfc_ids.h  | 4 +++-
 drivers/scsi/lpfc/lpfc_init.c | 3 +++
 3 files changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_hw.h +2 -1
index b2e353590ebb..6326f7353dd6 100644
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
+ * Copyright (C) 2017-2026 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.                        *
@@ -1771,6 +1771,7 @@ struct lpfc_fdmi_reg_portattr {
 #define PCI_DEVICE_ID_LANCER_G6_FC  0xe300
 #define PCI_DEVICE_ID_LANCER_G7_FC  0xf400
 #define PCI_DEVICE_ID_LANCER_G7P_FC 0xf500
+#define PCI_DEVICE_ID_LANCER_G8_FC  0xd300
 #define PCI_DEVICE_ID_SAT_SMB       0xf011
 #define PCI_DEVICE_ID_SAT_MID       0xf015
 #define PCI_DEVICE_ID_RFLY          0xf095
drivers/scsi/lpfc/lpfc_ids.h +3 -1
index 0b1616e93cf4..a0a6e2d379b8 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-2026 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.                        *
@@ -118,6 +118,8 @@ const struct pci_device_id lpfc_id_table[] = {
 		PCI_ANY_ID, PCI_ANY_ID, },
 	{PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_G7P_FC,
 		PCI_ANY_ID, PCI_ANY_ID, },
+	{PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_G8_FC,
+		PCI_ANY_ID, PCI_ANY_ID, },
 	{PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SKYHAWK,
 		PCI_ANY_ID, PCI_ANY_ID, },
 	{PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SKYHAWK_VF,
drivers/scsi/lpfc/lpfc_init.c +3 -0
index 70cdb039ef4e..7fb6b8e9cdf2 100644
@@ -2757,6 +2757,9 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
 	case PCI_DEVICE_ID_LANCER_G7P_FC:
 		m = (typeof(m)){"LPe38000", "PCIe", "Fibre Channel Adapter"};
 		break;
+	case PCI_DEVICE_ID_LANCER_G8_FC:
+		m = (typeof(m)){"LPe42100", "PCIe", "Fibre Channel Adapter"};
+		break;
 	case PCI_DEVICE_ID_SKYHAWK:
 	case PCI_DEVICE_ID_SKYHAWK_VF:
 		oneConnect = 1;
Signature · 1 line
2.38.0
author
#10 lore raw

PATCH 10/10 lpfc: Update lpfc version to 15.0.0.0

In reply to Justin Tee

Update lpfc version to 15.0.0.0

---
 drivers/scsi/lpfc/lpfc_version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_version.h +1 -1
index 31a0cd9db1c2..d6e6e436fbfc 100644
@@ -20,7 +20,7 @@
  * included with this package.                                     *
  *******************************************************************/
 
-#define LPFC_DRIVER_VERSION "14.4.0.14"
+#define LPFC_DRIVER_VERSION "15.0.0.0"
 #define LPFC_DRIVER_NAME		"lpfc"
 
 /* Used for SLI 2/3 */
Signature · 1 line
2.38.0
#12 lore raw
In reply to Justin Tee
Quoted 11 lines · Justin Tee

Update lpfc to revision 15.0.0.0

This patch set adds support for the G8 ASIC found on the LPe42100 series adapter models.

Updates are made to irq affinity assignment, mailbox command handling related to initialization, SGL construction, firmware download diagnostics, and the removal of an outdated performance feature. We also add 128G link speed selection and support.

[...]

Applied to 7.1/scsi-queue, thanks!

[01/10] lpfc: Break out of IRQ affinity assignment when mask reaches nr_cpu_ids

        https://git.kernel.org/mkp/scsi/c/e32b5e8f0950
[02/10] lpfc: Select mailbox rq_create cmd version based on sli4 if_type
        https://git.kernel.org/mkp/scsi/c/35f22f84bed1
[03/10] lpfc: Log mcqe contents for mbox commands with no context
        https://git.kernel.org/mkp/scsi/c/f75754f2feaa
[04/10] lpfc: Add REG_VFI mailbox cmd error handling
        https://git.kernel.org/mkp/scsi/c/5b402a8aceb1
[05/10] lpfc: Remove deprecated PBDE feature
        https://git.kernel.org/mkp/scsi/c/384075eb19b2
[06/10] lpfc: Update construction of SGL when XPSGL is enabled
        https://git.kernel.org/mkp/scsi/c/ba6dec7e703e
[07/10] lpfc: Check ASIC_ID register to aid diagnostics during failed fw updates
        https://git.kernel.org/mkp/scsi/c/a1421afa0ddb
[08/10] lpfc: Introduce 128G link speed selection and support
        https://git.kernel.org/mkp/scsi/c/39d1d94166da
[09/10] lpfc: Add PCI ID support for LPe42100 series adapters
        https://git.kernel.org/mkp/scsi/c/49b9f31e52b2
[10/10] lpfc: Update lpfc version to 15.0.0.0
        https://git.kernel.org/mkp/scsi/c/7f1e2c1cce1c
Signature · 1 line
Martin K. Petersen