Skip to content

Commit 4d45f35

Browse files
committed
Merge: lpfc 14_4_0_9 updates for rhel-10.1
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/845 lpfc 14_4_0_9 updates for rhel-10.1 JIRA: https://issues.redhat.com/browse/RHEL-89473 Signed-off-by: Dick Kennedy <dkennedy@redhat.com> Approved-by: Ewan D. Milne <emilne@redhat.com> Approved-by: Chris Leech <cleech@redhat.com> Approved-by: Ming Lei <ming.lei@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Jan Stancek <jstancek@redhat.com>
2 parents 0632c52 + e74c79c commit 4d45f35

File tree

6 files changed

+170
-27
lines changed

6 files changed

+170
-27
lines changed

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 135 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************
22
* This file is part of the Emulex Linux Device Driver for *
33
* Fibre Channel Host Bus Adapters. *
4-
* Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term *
4+
* Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
55
* “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
66
* Copyright (C) 2004-2016 Emulex. All rights reserved. *
77
* EMULEX and SLI are trademarks of Emulex. *
@@ -291,6 +291,138 @@ lpfc_cmf_info_show(struct device *dev, struct device_attribute *attr,
291291
return len;
292292
}
293293

294+
static ssize_t
295+
lpfc_vmid_info_show(struct device *dev, struct device_attribute *attr,
296+
char *buf)
297+
{
298+
struct Scsi_Host *shost = class_to_shost(dev);
299+
struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
300+
struct lpfc_hba *phba = vport->phba;
301+
struct lpfc_vmid *vmp;
302+
int len = 0, i, j, k, cpu;
303+
char hxstr[LPFC_MAX_VMID_SIZE * 3] = {0};
304+
struct timespec64 curr_tm;
305+
struct lpfc_vmid_priority_range *vr;
306+
u64 *lta, rct_acc = 0, max_lta = 0;
307+
struct tm tm_val;
308+
309+
ktime_get_ts64(&curr_tm);
310+
311+
len += scnprintf(buf + len, PAGE_SIZE - len, "Key 'vmid':\n");
312+
313+
/* if enabled continue, else return */
314+
if (lpfc_is_vmid_enabled(phba)) {
315+
len += scnprintf(buf + len, PAGE_SIZE - len,
316+
"lpfc VMID Page: ON\n\n");
317+
} else {
318+
len += scnprintf(buf + len, PAGE_SIZE - len,
319+
"lpfc VMID Page: OFF\n\n");
320+
return len;
321+
}
322+
323+
/* if using priority tagging */
324+
if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO) {
325+
len += scnprintf(buf + len, PAGE_SIZE - len,
326+
"VMID priority ranges:\n");
327+
vr = vport->vmid_priority.vmid_range;
328+
for (i = 0; i < vport->vmid_priority.num_descriptors; ++i) {
329+
len += scnprintf(buf + len, PAGE_SIZE - len,
330+
"\t[x%x - x%x], qos: x%x\n",
331+
vr->low, vr->high, vr->qos);
332+
vr++;
333+
}
334+
}
335+
336+
for (i = 0; i < phba->cfg_max_vmid; i++) {
337+
vmp = &vport->vmid[i];
338+
max_lta = 0;
339+
340+
/* only if the slot is used */
341+
if (!(vmp->flag & LPFC_VMID_SLOT_USED) ||
342+
!(vmp->flag & LPFC_VMID_REGISTERED))
343+
continue;
344+
345+
/* if using priority tagging */
346+
if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO) {
347+
len += scnprintf(buf + len, PAGE_SIZE - len,
348+
"VEM ID: %02x:%02x:%02x:%02x:"
349+
"%02x:%02x:%02x:%02x:%02x:%02x:"
350+
"%02x:%02x:%02x:%02x:%02x:%02x\n",
351+
vport->lpfc_vmid_host_uuid[0],
352+
vport->lpfc_vmid_host_uuid[1],
353+
vport->lpfc_vmid_host_uuid[2],
354+
vport->lpfc_vmid_host_uuid[3],
355+
vport->lpfc_vmid_host_uuid[4],
356+
vport->lpfc_vmid_host_uuid[5],
357+
vport->lpfc_vmid_host_uuid[6],
358+
vport->lpfc_vmid_host_uuid[7],
359+
vport->lpfc_vmid_host_uuid[8],
360+
vport->lpfc_vmid_host_uuid[9],
361+
vport->lpfc_vmid_host_uuid[10],
362+
vport->lpfc_vmid_host_uuid[11],
363+
vport->lpfc_vmid_host_uuid[12],
364+
vport->lpfc_vmid_host_uuid[13],
365+
vport->lpfc_vmid_host_uuid[14],
366+
vport->lpfc_vmid_host_uuid[15]);
367+
}
368+
369+
/* IO stats */
370+
len += scnprintf(buf + len, PAGE_SIZE - len,
371+
"ID00 READs:%llx WRITEs:%llx\n",
372+
vmp->io_rd_cnt,
373+
vmp->io_wr_cnt);
374+
for (j = 0, k = 0; j < strlen(vmp->host_vmid); j++, k += 3)
375+
sprintf((char *)(hxstr + k), "%2x ", vmp->host_vmid[j]);
376+
/* UUIDs */
377+
len += scnprintf(buf + len, PAGE_SIZE - len, "UUID:\n");
378+
len += scnprintf(buf + len, PAGE_SIZE - len, "%s\n", hxstr);
379+
380+
len += scnprintf(buf + len, PAGE_SIZE - len, "String (%s)\n",
381+
vmp->host_vmid);
382+
383+
if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO)
384+
len += scnprintf(buf + len, PAGE_SIZE - len,
385+
"CS_CTL VMID: 0x%x\n",
386+
vmp->un.cs_ctl_vmid);
387+
else
388+
len += scnprintf(buf + len, PAGE_SIZE - len,
389+
"Application id: 0x%x\n",
390+
vmp->un.app_id);
391+
392+
/* calculate the last access time */
393+
for_each_possible_cpu(cpu) {
394+
lta = per_cpu_ptr(vmp->last_io_time, cpu);
395+
if (!lta)
396+
continue;
397+
398+
/* if last access time is less than timeout */
399+
if (time_after((unsigned long)*lta, jiffies))
400+
continue;
401+
402+
if (*lta > max_lta)
403+
max_lta = *lta;
404+
}
405+
406+
rct_acc = jiffies_to_msecs(jiffies - max_lta) / 1000;
407+
/* current time */
408+
time64_to_tm(ktime_get_real_seconds(),
409+
-(sys_tz.tz_minuteswest * 60) - rct_acc, &tm_val);
410+
411+
len += scnprintf(buf + len, PAGE_SIZE - len,
412+
"Last Access Time :"
413+
"%ld-%d-%dT%02d:%02d:%02d\n\n",
414+
1900 + tm_val.tm_year, tm_val.tm_mon + 1,
415+
tm_val.tm_mday, tm_val.tm_hour,
416+
tm_val.tm_min, tm_val.tm_sec);
417+
418+
if (len >= PAGE_SIZE)
419+
return len;
420+
421+
memset(hxstr, 0, LPFC_MAX_VMID_SIZE * 3);
422+
}
423+
return len;
424+
}
425+
294426
/**
295427
* lpfc_drvr_version_show - Return the Emulex driver string with version number
296428
* @dev: class unused variable.
@@ -3011,6 +3143,7 @@ static DEVICE_ATTR(protocol, S_IRUGO, lpfc_sli4_protocol_show, NULL);
30113143
static DEVICE_ATTR(lpfc_xlane_supported, S_IRUGO, lpfc_oas_supported_show,
30123144
NULL);
30133145
static DEVICE_ATTR(cmf_info, 0444, lpfc_cmf_info_show, NULL);
3146+
static DEVICE_ATTR_RO(lpfc_vmid_info);
30143147

30153148
#define WWN_SZ 8
30163149
/**
@@ -6117,6 +6250,7 @@ static struct attribute *lpfc_hba_attrs[] = {
61176250
&dev_attr_lpfc_vmid_inactivity_timeout.attr,
61186251
&dev_attr_lpfc_vmid_app_header.attr,
61196252
&dev_attr_lpfc_vmid_priority_tagging.attr,
6253+
&dev_attr_lpfc_vmid_info.attr,
61206254
NULL,
61216255
};
61226256

drivers/scsi/lpfc/lpfc_hbadisc.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
161161
struct lpfc_hba *phba;
162162
struct lpfc_work_evt *evtp;
163163
unsigned long iflags;
164-
bool nvme_reg = false;
164+
bool drop_initial_node_ref = false;
165165

166166
ndlp = ((struct lpfc_rport_data *)rport->dd_data)->pnode;
167167
if (!ndlp)
@@ -188,8 +188,13 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
188188
spin_lock_irqsave(&ndlp->lock, iflags);
189189
ndlp->rport = NULL;
190190

191-
if (ndlp->fc4_xpt_flags & NVME_XPT_REGD)
192-
nvme_reg = true;
191+
/* Only 1 thread can drop the initial node reference.
192+
* If not registered for NVME and NLP_DROPPED flag is
193+
* clear, remove the initial reference.
194+
*/
195+
if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD))
196+
if (!test_and_set_bit(NLP_DROPPED, &ndlp->nlp_flag))
197+
drop_initial_node_ref = true;
193198

194199
/* The scsi_transport is done with the rport so lpfc cannot
195200
* call to unregister.
@@ -200,28 +205,25 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
200205
/* If NLP_XPT_REGD was cleared in lpfc_nlp_unreg_node,
201206
* unregister calls were made to the scsi and nvme
202207
* transports and refcnt was already decremented. Clear
203-
* the NLP_XPT_REGD flag only if the NVME Rport is
208+
* the NLP_XPT_REGD flag only if the NVME nrport is
204209
* confirmed unregistered.
205210
*/
206-
if (!nvme_reg && ndlp->fc4_xpt_flags & NLP_XPT_REGD) {
207-
ndlp->fc4_xpt_flags &= ~NLP_XPT_REGD;
211+
if (ndlp->fc4_xpt_flags & NLP_XPT_REGD) {
212+
if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD))
213+
ndlp->fc4_xpt_flags &= ~NLP_XPT_REGD;
208214
spin_unlock_irqrestore(&ndlp->lock, iflags);
209-
lpfc_nlp_put(ndlp); /* may free ndlp */
215+
216+
/* Release scsi transport reference */
217+
lpfc_nlp_put(ndlp);
210218
} else {
211219
spin_unlock_irqrestore(&ndlp->lock, iflags);
212220
}
213221
} else {
214222
spin_unlock_irqrestore(&ndlp->lock, iflags);
215223
}
216224

217-
/* Only 1 thread can drop the initial node reference. If
218-
* another thread has set NLP_DROPPED, this thread is done.
219-
*/
220-
if (nvme_reg || test_bit(NLP_DROPPED, &ndlp->nlp_flag))
221-
return;
222-
223-
set_bit(NLP_DROPPED, &ndlp->nlp_flag);
224-
lpfc_nlp_put(ndlp);
225+
if (drop_initial_node_ref)
226+
lpfc_nlp_put(ndlp);
225227
return;
226228
}
227229

@@ -4695,9 +4697,7 @@ lpfc_nlp_unreg_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
46954697
if (ndlp->fc4_xpt_flags & NVME_XPT_REGD) {
46964698
vport->phba->nport_event_cnt++;
46974699
if (vport->phba->nvmet_support == 0) {
4698-
/* Start devloss if target. */
4699-
if (ndlp->nlp_type & NLP_NVME_TARGET)
4700-
lpfc_nvme_unregister_port(vport, ndlp);
4700+
lpfc_nvme_unregister_port(vport, ndlp);
47014701
} else {
47024702
/* NVMET has no upcall. */
47034703
lpfc_nlp_put(ndlp);
@@ -5053,7 +5053,7 @@ lpfc_check_sli_ndlp(struct lpfc_hba *phba,
50535053
case CMD_GEN_REQUEST64_CR:
50545054
if (iocb->ndlp == ndlp)
50555055
return 1;
5056-
fallthrough;
5056+
break;
50575057
case CMD_ELS_REQUEST64_CR:
50585058
if (remote_id == ndlp->nlp_DID)
50595059
return 1;

drivers/scsi/lpfc/lpfc_init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,6 +1907,9 @@ lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action,
19071907
uint32_t intr_mode;
19081908
LPFC_MBOXQ_t *mboxq;
19091909

1910+
/* Notifying the transport that the targets are going offline. */
1911+
lpfc_scsi_dev_block(phba);
1912+
19101913
if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >=
19111914
LPFC_SLI_INTF_IF_TYPE_2) {
19121915
/*

drivers/scsi/lpfc/lpfc_nvme.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************
22
* This file is part of the Emulex Linux Device Driver for *
33
* Fibre Channel Host Bus Adapters. *
4-
* Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term *
4+
* Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
55
* “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
66
* Copyright (C) 2004-2016 Emulex. All rights reserved. *
77
* EMULEX and SLI are trademarks of Emulex. *
@@ -2508,7 +2508,10 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
25082508
"6031 RemotePort Registration failed "
25092509
"err: %d, DID x%06x ref %u\n",
25102510
ret, ndlp->nlp_DID, kref_read(&ndlp->kref));
2511-
lpfc_nlp_put(ndlp);
2511+
2512+
/* Only release reference if one was taken for this request */
2513+
if (!oldrport)
2514+
lpfc_nlp_put(ndlp);
25122515
}
25132516

25142517
return ret;
@@ -2614,7 +2617,8 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
26142617
* clear any rport state until the transport calls back.
26152618
*/
26162619

2617-
if (ndlp->nlp_type & NLP_NVME_TARGET) {
2620+
if ((ndlp->nlp_type & NLP_NVME_TARGET) ||
2621+
(remoteport->port_role & FC_PORT_ROLE_NVME_TARGET)) {
26182622
/* No concern about the role change on the nvme remoteport.
26192623
* The transport will update it.
26202624
*/

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************
22
* This file is part of the Emulex Linux Device Driver for *
33
* Fibre Channel Host Bus Adapters. *
4-
* Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term *
4+
* Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
55
* “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
66
* Copyright (C) 2004-2016 Emulex. All rights reserved. *
77
* EMULEX and SLI are trademarks of Emulex. *
@@ -2923,6 +2923,8 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
29232923
clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
29242924
ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING;
29252925
lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
2926+
} else {
2927+
clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
29262928
}
29272929

29282930
/* The unreg_login mailbox is complete and had a
@@ -6004,9 +6006,9 @@ lpfc_sli4_get_ctl_attr(struct lpfc_hba *phba)
60046006
phba->sli4_hba.flash_id = bf_get(lpfc_cntl_attr_flash_id, cntl_attr);
60056007
phba->sli4_hba.asic_rev = bf_get(lpfc_cntl_attr_asic_rev, cntl_attr);
60066008

6007-
memset(phba->BIOSVersion, 0, sizeof(phba->BIOSVersion));
6008-
strlcat(phba->BIOSVersion, (char *)cntl_attr->bios_ver_str,
6009+
memcpy(phba->BIOSVersion, cntl_attr->bios_ver_str,
60096010
sizeof(phba->BIOSVersion));
6011+
phba->BIOSVersion[sizeof(phba->BIOSVersion) - 1] = '\0';
60106012

60116013
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
60126014
"3086 lnk_type:%d, lnk_numb:%d, bios_ver:%s, "

drivers/scsi/lpfc/lpfc_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* included with this package. *
2121
*******************************************************************/
2222

23-
#define LPFC_DRIVER_VERSION "14.4.0.8"
23+
#define LPFC_DRIVER_VERSION "14.4.0.9"
2424
#define LPFC_DRIVER_NAME "lpfc"
2525

2626
/* Used for SLI 2/3 */

0 commit comments

Comments
 (0)