Skip to contentSkip to conversation

Update lpfc to revision 14.4.0.13

PATCH Applied Justin Tee 2 participants 6 messages Dec 10, 2025 – Jan 4

Subsystems (3)
lore
Share & tools
lore

Justin Tee

author
#0 lore raw

cover Update lpfc to revision 14.4.0.13

From: Justin Tee <[email protected]>

Update lpfc to revision 14.4.0.13

This patch set introduces reporting encryption information for fibre channel HBAs.

First, the scsi_transport_fc layer is updated to include a new fc_encryption_info attribute that is added to struct fc_rport. Supporting sysfs and LLDD templates are provided.

Then, the lpfc driver is updated to utilize the new templates for reporting encrypted fibre channel connections to upper layer.

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

Justin Tee (1):
lpfc: Update lpfc version to 14.4.0.13

Sarah Catania (2):
scsi_transport_fc: Introduce encryption group in fc_rport attribute
lpfc: Add support for reporting encryption events

 drivers/base/transport_class.c   |  8 +++++
 drivers/scsi/lpfc/lpfc_attr.c    | 40 ++++++++++++++++++++++
 drivers/scsi/lpfc/lpfc_debugfs.c |  7 ++++
 drivers/scsi/lpfc/lpfc_disc.h    |  7 ++++
 drivers/scsi/lpfc/lpfc_els.c     | 57 ++++++++++++++++++++++++++++++++
 drivers/scsi/lpfc/lpfc_hbadisc.c |  1 +
 drivers/scsi/lpfc/lpfc_hw4.h     | 11 +++++-
 drivers/scsi/lpfc/lpfc_init.c    |  5 +++
 drivers/scsi/lpfc/lpfc_logmsg.h  |  3 +-
 drivers/scsi/lpfc/lpfc_sli4.h    |  4 +++
 drivers/scsi/lpfc/lpfc_version.h |  2 +-
 drivers/scsi/scsi_transport_fc.c | 42 +++++++++++++++++++++++
 include/linux/transport_class.h  |  1 +
 include/scsi/scsi_transport_fc.h | 12 +++++++
 14 files changed, 197 insertions(+), 3 deletions(-)
Signature · 1 line
2.38.0
author
#1 lore raw

PATCH 1/3 scsi_transport_fc: Introduce encryption group in fc_rport attribute

From: Sarah Catania <[email protected]>

Introduce a new structure for reporting an encrypted session over an fc_rport. The encryption group is added as an attribute in struct fc_rport and reports information in fc_encryption_info. This structure contains a status member variable, which stores a bit value indicating an encrypted session.

---
 drivers/base/transport_class.c   |  8 ++++++
 drivers/scsi/scsi_transport_fc.c | 42 ++++++++++++++++++++++++++++++++
 include/linux/transport_class.h  |  1 +
 include/scsi/scsi_transport_fc.h | 12 +++++++++
 4 files changed, 63 insertions(+)
drivers/base/transport_class.c +8 -0
index 09ee2a1e35bb..69c6ac2e8263 100644
@@ -169,6 +169,12 @@ static int transport_add_class_device(struct attribute_container *cont,
 			goto err_del;
 	}
 
+	if (tcont->encryption) {
+		error = sysfs_create_group(&classdev->kobj, tcont->encryption);
+		if (error)
+			goto err_del;
+	}
+
 	return 0;
 
 err_del:
@@ -244,6 +250,8 @@ static int transport_remove_classdev(struct attribute_container *cont,
 	if (tclass->remove != anon_transport_dummy_function) {
 		if (tcont->statistics)
 			sysfs_remove_group(&classdev->kobj, tcont->statistics);
+		if (tcont->encryption)
+			sysfs_remove_group(&classdev->kobj, tcont->encryption);
 		attribute_container_class_device_del(classdev);
 	}
 
drivers/scsi/scsi_transport_fc.c +42 -0

54 lines not on this page · raw message

include/linux/transport_class.h +1 -0
index 2efc271a96fa..a009d66db15a 100644
@@ -56,6 +56,7 @@ struct anon_transport_class cls = {				\
 struct transport_container {
 	struct attribute_container ac;
 	const struct attribute_group *statistics;
+	const struct attribute_group *encryption;
 };
 
 #define attribute_container_to_transport_container(x) \
include/scsi/scsi_transport_fc.h +12 -0
index b908aacfef48..9f30625aa0d3 100644
@@ -317,6 +317,15 @@ struct fc_fpin_stats {
 	u64 cn_device_specific;
 };
 
+#define FC_RPORT_ENCRYPTION_STATUS_MAX_LEN      14
+/*
+ * Encryption Information
+ */
+struct fc_encryption_info {
+	/* Encryption Status */
+	u8 status;
+};
+
 /* Macro for use in defining Remote Port attributes */
 #define FC_RPORT_ATTR(_name,_mode,_show,_store)				\
 struct device_attribute dev_attr_rport_##_name = 	\
@@ -364,6 +373,7 @@ struct fc_rport {	/* aka fc_starget_attrs */
 	u64 port_name;
 	u32 port_id;
 	u32 roles;
+	struct fc_encryption_info enc_info;
 	enum fc_port_state port_state;	/* Will only be ONLINE or UNKNOWN */
 	u32 scsi_target_id;
 	u32 fast_io_fail_tmo;
@@ -691,6 +701,8 @@ struct fc_function_template {
 	struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *);
 	void	(*reset_fc_host_stats)(struct Scsi_Host *);
 
+	struct fc_encryption_info * (*get_fc_rport_enc_info)(struct fc_rport *);
+
 	int	(*issue_fc_host_lip)(struct Scsi_Host *);
 
 	void    (*dev_loss_tmo_callbk)(struct fc_rport *);
Signature · 1 line
2.38.0
author
#2 lore raw

PATCH 2/3 lpfc: Add support for reporting encryption events

In reply to Justin Tee

From: Sarah Catania <[email protected]>

Support logging encryption events in both point to point and fabric topologies. A new LOG_ENCRYPTION flag is defined for reporting encryption related events for HBAs that support the FEDIF feature. Encryption information is stored in each ndlp object, which is determined during the discovery stage after PLOGI completes.

For reporting encryption information to upper layers, the .get_fc_rport_enc_info routine is implemented in lpfc_get_enc_info. This allows encryption status to be reported through fc_remote_ports sysfs. Debugfs is also updated to report encryption information for all ndlp objects.

---
 drivers/scsi/lpfc/lpfc_attr.c    | 40 ++++++++++++++++++++++
 drivers/scsi/lpfc/lpfc_debugfs.c |  7 ++++
 drivers/scsi/lpfc/lpfc_disc.h    |  7 ++++
 drivers/scsi/lpfc/lpfc_els.c     | 57 ++++++++++++++++++++++++++++++++
 drivers/scsi/lpfc/lpfc_hbadisc.c |  1 +
 drivers/scsi/lpfc/lpfc_hw4.h     | 11 +++++-
 drivers/scsi/lpfc/lpfc_init.c    |  5 +++
 drivers/scsi/lpfc/lpfc_logmsg.h  |  3 +-
 drivers/scsi/lpfc/lpfc_sli4.h    |  4 +++
 9 files changed, 133 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +40 -0
index 33582d48ec09..4af5c069635a 100644
@@ -6979,6 +6979,42 @@ lpfc_reset_stats(struct Scsi_Host *shost)
 	return;
 }
 
+/**
+ * lpfc_get_enc_info - Return encryption information about the session for
+ *                     a given remote port.
+ * @rport: ptr to fc_rport from scsi transport fc
+ *
+ * Given an rport object, iterate through the fc_nodes list to find node
+ * corresponding with rport. Pass the encryption information from the node to
+ * rport's encryption attribute for reporting to upper layers. Information is
+ * passed through nlp_enc_info struct which contains encryption status.
+ *
+ * Returns:
+ * - Address of rport's fc_encryption_info struct
+ * - NULL when not found
+ **/
+static struct fc_encryption_info *
+lpfc_get_enc_info(struct fc_rport *rport)
+{
+	struct Scsi_Host *shost = rport_to_shost(rport);
+	struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
+	struct fc_encryption_info *ef = NULL;
+	struct lpfc_nodelist *ndlp, *next_ndlp;
+	unsigned long iflags;
+
+	spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags);
+	list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
+		if (ndlp->rport && ndlp->rport == rport) {
+			ef = &rport->enc_info;
+			ef->status = ndlp->nlp_enc_info.status;
+			break;
+		}
+	}
+	spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags);
+	return ef;
+}
+
+
 /*
  * The LPFC driver treats linkdown handling as target loss events so there
  * are no sysfs handlers for link_down_tmo.
@@ -7196,6 +7232,8 @@ struct fc_function_template lpfc_transport_functions = {
 	.get_fc_host_stats = lpfc_get_stats,
 	.reset_fc_host_stats = lpfc_reset_stats,
 
+	.get_fc_rport_enc_info = lpfc_get_enc_info,
+
 	.dd_fcrport_size = sizeof(struct lpfc_rport_data),
 	.show_rport_maxframe_size = 1,
 	.show_rport_supported_classes = 1,
@@ -7265,6 +7303,8 @@ struct fc_function_template lpfc_vport_transport_functions = {
 	.get_fc_host_stats = lpfc_get_stats,
 	.reset_fc_host_stats = lpfc_reset_stats,
 
+	.get_fc_rport_enc_info = lpfc_get_enc_info,
+
 	.dd_fcrport_size = sizeof(struct lpfc_rport_data),
 	.show_rport_maxframe_size = 1,
 	.show_rport_supported_classes = 1,
drivers/scsi/lpfc/lpfc_debugfs.c +7 -0
index 92b5b2dbe847..646f88c776f5 100644
@@ -872,6 +872,13 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
 				 ndlp->nlp_rpi);
 		len += scnprintf(buf+len, size-len, "flag:x%08lx ",
 				 ndlp->nlp_flag);
+		if (ndlp->nlp_enc_info.status) {
+			len += scnprintf(buf + len,
+					 size - len, "ENCRYPTED");
+			len += scnprintf(buf + len, size - len,
+					 ndlp->nlp_enc_info.level
+					 ? "(CNSA2.0) " : "(CNSA1.0) ");
+		}
 		if (!ndlp->nlp_type)
 			len += scnprintf(buf+len, size-len, "UNKNOWN_TYPE ");
 		if (ndlp->nlp_type & NLP_FC_NODE)
drivers/scsi/lpfc/lpfc_disc.h +7 -0
index 51cb8571c049..de0adeecf668 100644
@@ -77,6 +77,11 @@ struct lpfc_node_rrqs {
 	unsigned long xri_bitmap[XRI_BITMAP_ULONGS];
 };
 
+struct lpfc_enc_info {
+	u8 status; /* encryption status for session */
+	u8 level; /* CNSA encryption level */
+};
+
 enum lpfc_fc4_xpt_flags {
 	NLP_XPT_REGD		= 0x1,
 	SCSI_XPT_REGD		= 0x2,
@@ -138,6 +143,8 @@ struct lpfc_nodelist {
 	uint8_t		vmid_support;		/* destination VMID support */
 #define NLP_NVME_NSLER     0x1			/* NVME NSLER device */
 
+	struct lpfc_enc_info nlp_enc_info; /* Encryption information struct */
+
 	struct timer_list   nlp_delayfunc;	/* Used for delayed ELS cmds */
 	struct lpfc_hba *phba;
 	struct fc_rport *rport;		/* scsi_transport_fc port structure */
drivers/scsi/lpfc/lpfc_els.c +57 -0

75 lines not on this page · raw message

drivers/scsi/lpfc/lpfc_hbadisc.c +1 -0
index bb803f32bc1b..1aeebdc08073 100644
@@ -5340,6 +5340,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
 		clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag);
 		if (acc_plogi)
 			clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag);
+		memset(&ndlp->nlp_enc_info, 0, sizeof(ndlp->nlp_enc_info));
 		return 1;
 	}
 	clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag);
drivers/scsi/lpfc/lpfc_hw4.h +10 -1
index a7f7ed86d2b0..c000474c3066 100644
@@ -437,6 +437,12 @@ struct lpfc_wcqe_complete {
 #define lpfc_wcqe_c_cmf_bw_MASK		0x0FFFFFFF
 #define lpfc_wcqe_c_cmf_bw_WORD		total_data_placed
 	uint32_t parameter;
+#define lpfc_wcqe_c_enc_SHIFT		31
+#define lpfc_wcqe_c_enc_MASK		0x00000001
+#define lpfc_wcqe_c_enc_WORD		parameter
+#define lpfc_wcqe_c_enc_lvl_SHIFT	30
+#define lpfc_wcqe_c_enc_lvl_MASK	0x00000001
+#define lpfc_wcqe_c_enc_lvl_WORD	parameter
 #define lpfc_wcqe_c_bg_edir_SHIFT	5
 #define lpfc_wcqe_c_bg_edir_MASK	0x00000001
 #define lpfc_wcqe_c_bg_edir_WORD	parameter
@@ -2942,7 +2948,10 @@ struct lpfc_mbx_read_config {
 #define lpfc_mbx_rd_conf_topology_SHIFT		24
 #define lpfc_mbx_rd_conf_topology_MASK		0x000000FF
 #define lpfc_mbx_rd_conf_topology_WORD		word2
-	uint32_t rsvd_3;
+	uint32_t word3;
+#define lpfc_mbx_rd_conf_fedif_SHIFT		6
+#define lpfc_mbx_rd_conf_fedif_MASK		0x00000001
+#define lpfc_mbx_rd_conf_fedif_WORD		word3
 	uint32_t word4;
 #define lpfc_mbx_rd_conf_e_d_tov_SHIFT		0
 #define lpfc_mbx_rd_conf_e_d_tov_MASK		0x0000FFFF
drivers/scsi/lpfc/lpfc_init.c +5 -0
index 2bd445703146..0d00f5fd5395 100644
@@ -9999,6 +9999,11 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
 				(phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0;
 		phba->max_vports = phba->max_vpi;
 
+		if (bf_get(lpfc_mbx_rd_conf_fedif, rd_config))
+			phba->sli4_hba.encryption_support = true;
+		else
+			phba->sli4_hba.encryption_support = false;
+
 		/* Next decide on FPIN or Signal E2E CGN support
 		 * For congestion alarms and warnings valid combination are:
 		 * 1. FPIN alarms / FPIN warnings
drivers/scsi/lpfc/lpfc_logmsg.h +2 -1
index 59bd2bafc73f..e00d101d548c 100644
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2023 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-2009 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
@@ -47,6 +47,7 @@
 #define LOG_RSVD1	0x01000000	/* Reserved */
 #define LOG_RSVD2	0x02000000	/* Reserved */
 #define LOG_CGN_MGMT    0x04000000	/* Congestion Mgmt events */
+#define LOG_ENCRYPTION  0x40000000      /* EDIF Encryption events. */
 #define LOG_TRACE_EVENT 0x80000000	/* Dmp the DBG log on this err */
 #define LOG_ALL_MSG	0x7fffffff	/* LOG all messages */
 
drivers/scsi/lpfc/lpfc_sli4.h +4 -0
index fd6dab157887..ee58383492b2 100644
@@ -888,6 +888,10 @@ struct lpfc_sli4_hba {
 #define LPFC_FP_EQ_MAX_INTR_SEC         10000
 
 	uint32_t intr_enable;
+
+	 /* Indicates whether SLI Port supports FEDIF */
+	bool encryption_support;
+
 	struct lpfc_bmbx bmbx;
 	struct lpfc_max_cfg_param max_cfg_param;
 	uint16_t extents_in_use; /* must allocate resource extents. */
Signature · 1 line
2.38.0
author
#3 lore raw

PATCH 3/3 lpfc: Update lpfc version to 14.4.0.13

In reply to Justin Tee

Update lpfc version to 14.4.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 f3dada5bf7c1..c4ca8bf5843a 100644
@@ -20,7 +20,7 @@
  * included with this package.                                     *
  *******************************************************************/
 
-#define LPFC_DRIVER_VERSION "14.4.0.12"
+#define LPFC_DRIVER_VERSION "14.4.0.13"
 #define LPFC_DRIVER_NAME		"lpfc"
 
 /* Used for SLI 2/3 */
Signature · 1 line
2.38.0
#5 lore raw
In reply to Justin Tee
Quoted 10 lines · Justin Tee

Update lpfc to revision 14.4.0.13

This patch set introduces reporting encryption information for fibre channel HBAs.

First, the scsi_transport_fc layer is updated to include a new fc_encryption_info attribute that is added to struct fc_rport. Supporting sysfs and LLDD templates are provided.

[...]

Applied to 6.20/scsi-queue, thanks!

[1/3] scsi_transport_fc: Introduce encryption group in fc_rport attribute

      https://git.kernel.org/mkp/scsi/c/bd2bc528691e
[2/3] lpfc: Add support for reporting encryption events
      https://git.kernel.org/mkp/scsi/c/e2dacf8e5e33
[3/3] lpfc: Update lpfc version to 14.4.0.13
      https://git.kernel.org/mkp/scsi/c/621164425315
Signature · 1 line
Martin K. Petersen