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

Configure Feed

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

Merge patch series "Update lpfc to revision 14.4.0.13"

Justin Tee <justintee8345@gmail.com> says:

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.

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

+197 -3
+8
drivers/base/transport_class.c
··· 169 169 goto err_del; 170 170 } 171 171 172 + if (tcont->encryption) { 173 + error = sysfs_create_group(&classdev->kobj, tcont->encryption); 174 + if (error) 175 + goto err_del; 176 + } 177 + 172 178 return 0; 173 179 174 180 err_del: ··· 250 244 if (tclass->remove != anon_transport_dummy_function) { 251 245 if (tcont->statistics) 252 246 sysfs_remove_group(&classdev->kobj, tcont->statistics); 247 + if (tcont->encryption) 248 + sysfs_remove_group(&classdev->kobj, tcont->encryption); 253 249 attribute_container_class_device_del(classdev); 254 250 } 255 251
+40
drivers/scsi/lpfc/lpfc_attr.c
··· 6979 6979 return; 6980 6980 } 6981 6981 6982 + /** 6983 + * lpfc_get_enc_info - Return encryption information about the session for 6984 + * a given remote port. 6985 + * @rport: ptr to fc_rport from scsi transport fc 6986 + * 6987 + * Given an rport object, iterate through the fc_nodes list to find node 6988 + * corresponding with rport. Pass the encryption information from the node to 6989 + * rport's encryption attribute for reporting to upper layers. Information is 6990 + * passed through nlp_enc_info struct which contains encryption status. 6991 + * 6992 + * Returns: 6993 + * - Address of rport's fc_encryption_info struct 6994 + * - NULL when not found 6995 + **/ 6996 + static struct fc_encryption_info * 6997 + lpfc_get_enc_info(struct fc_rport *rport) 6998 + { 6999 + struct Scsi_Host *shost = rport_to_shost(rport); 7000 + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 7001 + struct fc_encryption_info *ef = NULL; 7002 + struct lpfc_nodelist *ndlp, *next_ndlp; 7003 + unsigned long iflags; 7004 + 7005 + spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags); 7006 + list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { 7007 + if (ndlp->rport && ndlp->rport == rport) { 7008 + ef = &rport->enc_info; 7009 + ef->status = ndlp->nlp_enc_info.status; 7010 + break; 7011 + } 7012 + } 7013 + spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); 7014 + return ef; 7015 + } 7016 + 7017 + 6982 7018 /* 6983 7019 * The LPFC driver treats linkdown handling as target loss events so there 6984 7020 * are no sysfs handlers for link_down_tmo. ··· 7232 7196 .get_fc_host_stats = lpfc_get_stats, 7233 7197 .reset_fc_host_stats = lpfc_reset_stats, 7234 7198 7199 + .get_fc_rport_enc_info = lpfc_get_enc_info, 7200 + 7235 7201 .dd_fcrport_size = sizeof(struct lpfc_rport_data), 7236 7202 .show_rport_maxframe_size = 1, 7237 7203 .show_rport_supported_classes = 1, ··· 7302 7264 7303 7265 .get_fc_host_stats = lpfc_get_stats, 7304 7266 .reset_fc_host_stats = lpfc_reset_stats, 7267 + 7268 + .get_fc_rport_enc_info = lpfc_get_enc_info, 7305 7269 7306 7270 .dd_fcrport_size = sizeof(struct lpfc_rport_data), 7307 7271 .show_rport_maxframe_size = 1,
+7
drivers/scsi/lpfc/lpfc_debugfs.c
··· 872 872 ndlp->nlp_rpi); 873 873 len += scnprintf(buf+len, size-len, "flag:x%08lx ", 874 874 ndlp->nlp_flag); 875 + if (ndlp->nlp_enc_info.status) { 876 + len += scnprintf(buf + len, 877 + size - len, "ENCRYPTED"); 878 + len += scnprintf(buf + len, size - len, 879 + ndlp->nlp_enc_info.level 880 + ? "(CNSA2.0) " : "(CNSA1.0) "); 881 + } 875 882 if (!ndlp->nlp_type) 876 883 len += scnprintf(buf+len, size-len, "UNKNOWN_TYPE "); 877 884 if (ndlp->nlp_type & NLP_FC_NODE)
+7
drivers/scsi/lpfc/lpfc_disc.h
··· 77 77 unsigned long xri_bitmap[XRI_BITMAP_ULONGS]; 78 78 }; 79 79 80 + struct lpfc_enc_info { 81 + u8 status; /* encryption status for session */ 82 + u8 level; /* CNSA encryption level */ 83 + }; 84 + 80 85 enum lpfc_fc4_xpt_flags { 81 86 NLP_XPT_REGD = 0x1, 82 87 SCSI_XPT_REGD = 0x2, ··· 142 137 u8 nlp_nvme_info; /* NVME NSLER Support */ 143 138 uint8_t vmid_support; /* destination VMID support */ 144 139 #define NLP_NVME_NSLER 0x1 /* NVME NSLER device */ 140 + 141 + struct lpfc_enc_info nlp_enc_info; /* Encryption information struct */ 145 142 146 143 struct timer_list nlp_delayfunc; /* Used for delayed ELS cmds */ 147 144 struct lpfc_hba *phba;
+57
drivers/scsi/lpfc/lpfc_els.c
··· 2014 2014 lpfc_nlp_put(ndlp); 2015 2015 return; 2016 2016 } 2017 + 2018 + /** 2019 + * lpfc_check_encryption - Reports an ndlp's encryption information 2020 + * @phba: pointer to lpfc hba data structure. 2021 + * @ndlp: pointer to a node-list data structure. 2022 + * @cmdiocb: pointer to lpfc command iocbq data structure. 2023 + * @rspiocb: pointer to lpfc response iocbq data structure. 2024 + * 2025 + * This routine is called in the completion callback function for issuing 2026 + * or receiving a Port Login (PLOGI) command. In a PLOGI completion, if FEDIF 2027 + * is supported, encryption information will be provided in completion status 2028 + * data. If @phba supports FEDIF, a log message containing encryption 2029 + * information will be logged. Encryption status is also saved for encryption 2030 + * reporting with upper layer through the rport encryption attribute. 2031 + **/ 2032 + static void 2033 + lpfc_check_encryption(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, 2034 + struct lpfc_iocbq *cmdiocb, struct lpfc_iocbq *rspiocb) 2035 + { 2036 + struct lpfc_vport *vport = cmdiocb->vport; 2037 + u32 did = ndlp->nlp_DID; 2038 + struct lpfc_enc_info *nlp_enc_info = &ndlp->nlp_enc_info; 2039 + char enc_status[FC_RPORT_ENCRYPTION_STATUS_MAX_LEN] = {0}; 2040 + char enc_level[8] = "N/A"; 2041 + u8 encryption; 2042 + 2043 + if (phba->sli4_hba.encryption_support && 2044 + ((did & Fabric_DID_MASK) != Fabric_DID_MASK)) { 2045 + encryption = bf_get(lpfc_wcqe_c_enc, 2046 + &rspiocb->wcqe_cmpl); 2047 + nlp_enc_info->status = encryption; 2048 + 2049 + strscpy(enc_status, encryption ? "Encrypted" : "Unencrypted", 2050 + sizeof(enc_status)); 2051 + 2052 + if (encryption) { 2053 + nlp_enc_info->level = bf_get(lpfc_wcqe_c_enc_lvl, 2054 + &rspiocb->wcqe_cmpl); 2055 + strscpy(enc_level, nlp_enc_info->level ? "CNSA2.0" : 2056 + "CNSA1.0", 2057 + sizeof(enc_level)); 2058 + } 2059 + 2060 + lpfc_printf_vlog(vport, KERN_INFO, LOG_ENCRYPTION, 2061 + "0924 DID:x%06x %s Session " 2062 + "Established, Encryption Level:%s " 2063 + "rpi:x%x\n", 2064 + ndlp->nlp_DID, enc_status, enc_level, 2065 + ndlp->nlp_rpi); 2066 + } 2067 + } 2068 + 2017 2069 /** 2018 2070 * lpfc_cmpl_els_plogi - Completion callback function for plogi 2019 2071 * @phba: pointer to lpfc hba data structure. ··· 2204 2152 if (!lpfc_is_els_acc_rsp(prsp)) 2205 2153 goto out; 2206 2154 ndlp = lpfc_plogi_confirm_nport(phba, prsp->virt, ndlp); 2155 + 2156 + lpfc_check_encryption(phba, ndlp, cmdiocb, rspiocb); 2207 2157 2208 2158 sp = (struct serv_parm *)((u8 *)prsp->virt + 2209 2159 sizeof(u32)); ··· 5460 5406 lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED); 5461 5407 goto out; 5462 5408 } 5409 + 5410 + if (!ulp_status && test_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag)) 5411 + lpfc_check_encryption(phba, ndlp, cmdiocb, rspiocb); 5463 5412 5464 5413 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 5465 5414 "ELS rsp cmpl: status:x%x/x%x did:x%x",
+1
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 5340 5340 clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 5341 5341 if (acc_plogi) 5342 5342 clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag); 5343 + memset(&ndlp->nlp_enc_info, 0, sizeof(ndlp->nlp_enc_info)); 5343 5344 return 1; 5344 5345 } 5345 5346 clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag);
+10 -1
drivers/scsi/lpfc/lpfc_hw4.h
··· 437 437 #define lpfc_wcqe_c_cmf_bw_MASK 0x0FFFFFFF 438 438 #define lpfc_wcqe_c_cmf_bw_WORD total_data_placed 439 439 uint32_t parameter; 440 + #define lpfc_wcqe_c_enc_SHIFT 31 441 + #define lpfc_wcqe_c_enc_MASK 0x00000001 442 + #define lpfc_wcqe_c_enc_WORD parameter 443 + #define lpfc_wcqe_c_enc_lvl_SHIFT 30 444 + #define lpfc_wcqe_c_enc_lvl_MASK 0x00000001 445 + #define lpfc_wcqe_c_enc_lvl_WORD parameter 440 446 #define lpfc_wcqe_c_bg_edir_SHIFT 5 441 447 #define lpfc_wcqe_c_bg_edir_MASK 0x00000001 442 448 #define lpfc_wcqe_c_bg_edir_WORD parameter ··· 2948 2942 #define lpfc_mbx_rd_conf_topology_SHIFT 24 2949 2943 #define lpfc_mbx_rd_conf_topology_MASK 0x000000FF 2950 2944 #define lpfc_mbx_rd_conf_topology_WORD word2 2951 - uint32_t rsvd_3; 2945 + uint32_t word3; 2946 + #define lpfc_mbx_rd_conf_fedif_SHIFT 6 2947 + #define lpfc_mbx_rd_conf_fedif_MASK 0x00000001 2948 + #define lpfc_mbx_rd_conf_fedif_WORD word3 2952 2949 uint32_t word4; 2953 2950 #define lpfc_mbx_rd_conf_e_d_tov_SHIFT 0 2954 2951 #define lpfc_mbx_rd_conf_e_d_tov_MASK 0x0000FFFF
+5
drivers/scsi/lpfc/lpfc_init.c
··· 9999 9999 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; 10000 10000 phba->max_vports = phba->max_vpi; 10001 10001 10002 + if (bf_get(lpfc_mbx_rd_conf_fedif, rd_config)) 10003 + phba->sli4_hba.encryption_support = true; 10004 + else 10005 + phba->sli4_hba.encryption_support = false; 10006 + 10002 10007 /* Next decide on FPIN or Signal E2E CGN support 10003 10008 * For congestion alarms and warnings valid combination are: 10004 10009 * 1. FPIN alarms / FPIN warnings
+2 -1
drivers/scsi/lpfc/lpfc_logmsg.h
··· 1 1 /******************************************************************* 2 2 * This file is part of the Emulex Linux Device Driver for * 3 3 * Fibre Channel Host Bus Adapters. * 4 - * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2004-2009 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 47 47 #define LOG_RSVD1 0x01000000 /* Reserved */ 48 48 #define LOG_RSVD2 0x02000000 /* Reserved */ 49 49 #define LOG_CGN_MGMT 0x04000000 /* Congestion Mgmt events */ 50 + #define LOG_ENCRYPTION 0x40000000 /* EDIF Encryption events. */ 50 51 #define LOG_TRACE_EVENT 0x80000000 /* Dmp the DBG log on this err */ 51 52 #define LOG_ALL_MSG 0x7fffffff /* LOG all messages */ 52 53
+4
drivers/scsi/lpfc/lpfc_sli4.h
··· 888 888 #define LPFC_FP_EQ_MAX_INTR_SEC 10000 889 889 890 890 uint32_t intr_enable; 891 + 892 + /* Indicates whether SLI Port supports FEDIF */ 893 + bool encryption_support; 894 + 891 895 struct lpfc_bmbx bmbx; 892 896 struct lpfc_max_cfg_param max_cfg_param; 893 897 uint16_t extents_in_use; /* must allocate resource extents. */
+1 -1
drivers/scsi/lpfc/lpfc_version.h
··· 20 20 * included with this package. * 21 21 *******************************************************************/ 22 22 23 - #define LPFC_DRIVER_VERSION "14.4.0.12" 23 + #define LPFC_DRIVER_VERSION "14.4.0.13" 24 24 #define LPFC_DRIVER_NAME "lpfc" 25 25 26 26 /* Used for SLI 2/3 */
+42
drivers/scsi/scsi_transport_fc.c
··· 1328 1328 static FC_DEVICE_ATTR(rport, fast_io_fail_tmo, S_IRUGO | S_IWUSR, 1329 1329 show_fc_rport_fast_io_fail_tmo, store_fc_rport_fast_io_fail_tmo); 1330 1330 1331 + #define fc_rport_encryption(name) \ 1332 + static ssize_t fc_rport_encinfo_##name(struct device *cd, \ 1333 + struct device_attribute *attr, \ 1334 + char *buf) \ 1335 + { \ 1336 + struct fc_rport *rport = transport_class_to_rport(cd); \ 1337 + struct Scsi_Host *shost = rport_to_shost(rport); \ 1338 + struct fc_internal *i = to_fc_internal(shost->transportt); \ 1339 + struct fc_encryption_info *info; \ 1340 + ssize_t ret = -ENOENT; \ 1341 + u32 data; \ 1342 + \ 1343 + if (i->f->get_fc_rport_enc_info) { \ 1344 + info = (i->f->get_fc_rport_enc_info)(rport); \ 1345 + if (info) { \ 1346 + data = info->name; \ 1347 + if (!strcmp(#name, "status")) { \ 1348 + ret = scnprintf(buf, \ 1349 + FC_RPORT_ENCRYPTION_STATUS_MAX_LEN, \ 1350 + "%s\n", \ 1351 + data ? "Encrypted" : "Unencrypted"); \ 1352 + } \ 1353 + } \ 1354 + } \ 1355 + return ret; \ 1356 + } \ 1357 + static FC_DEVICE_ATTR(rport, encryption_##name, 0444, fc_rport_encinfo_##name, NULL) \ 1358 + 1359 + fc_rport_encryption(status); 1360 + 1361 + static struct attribute *fc_rport_encryption_attrs[] = { 1362 + &device_attr_rport_encryption_status.attr, 1363 + NULL 1364 + }; 1365 + 1366 + static struct attribute_group fc_rport_encryption_group = { 1367 + .name = "encryption", 1368 + .attrs = fc_rport_encryption_attrs, 1369 + }; 1370 + 1331 1371 #define fc_rport_fpin_statistic(name) \ 1332 1372 static ssize_t fc_rport_fpinstat_##name(struct device *cd, \ 1333 1373 struct device_attribute *attr, \ ··· 2673 2633 i->rport_attr_cont.ac.attrs = &i->rport_attrs[0]; 2674 2634 i->rport_attr_cont.ac.class = &fc_rport_class.class; 2675 2635 i->rport_attr_cont.ac.match = fc_rport_match; 2636 + if (ft->get_fc_rport_enc_info) 2637 + i->rport_attr_cont.encryption = &fc_rport_encryption_group; 2676 2638 i->rport_attr_cont.statistics = &fc_rport_statistics_group; 2677 2639 transport_container_register(&i->rport_attr_cont); 2678 2640
+1
include/linux/transport_class.h
··· 56 56 struct transport_container { 57 57 struct attribute_container ac; 58 58 const struct attribute_group *statistics; 59 + const struct attribute_group *encryption; 59 60 }; 60 61 61 62 #define attribute_container_to_transport_container(x) \
+12
include/scsi/scsi_transport_fc.h
··· 317 317 u64 cn_device_specific; 318 318 }; 319 319 320 + #define FC_RPORT_ENCRYPTION_STATUS_MAX_LEN 14 321 + /* 322 + * Encryption Information 323 + */ 324 + struct fc_encryption_info { 325 + /* Encryption Status */ 326 + u8 status; 327 + }; 328 + 320 329 /* Macro for use in defining Remote Port attributes */ 321 330 #define FC_RPORT_ATTR(_name,_mode,_show,_store) \ 322 331 struct device_attribute dev_attr_rport_##_name = \ ··· 373 364 u64 port_name; 374 365 u32 port_id; 375 366 u32 roles; 367 + struct fc_encryption_info enc_info; 376 368 enum fc_port_state port_state; /* Will only be ONLINE or UNKNOWN */ 377 369 u32 scsi_target_id; 378 370 u32 fast_io_fail_tmo; ··· 700 690 701 691 struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *); 702 692 void (*reset_fc_host_stats)(struct Scsi_Host *); 693 + 694 + struct fc_encryption_info * (*get_fc_rport_enc_info)(struct fc_rport *); 703 695 704 696 int (*issue_fc_host_lip)(struct Scsi_Host *); 705 697