Skip to content

Commit 52448d5

Browse files
Merge patch series "Update lpfc to revision 14.4.0.4"
Justin Tee <[email protected]> says: Update lpfc to revision 14.4.0.4 This patch set contains diagnostic logging improvements, a minor clean up when submitting abort requests, a bug fix related to reset and errata paths, and modifications to FLOGI and PRLO ELS command handling. The patches were cut against Martin's 6.11/scsi-queue tree. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 88e6804 + 5b247f0 commit 52448d5

File tree

8 files changed

+112
-46
lines changed

8 files changed

+112
-46
lines changed

drivers/scsi/lpfc/lpfc.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,14 @@ struct lpfc_stats {
306306

307307
struct lpfc_hba;
308308

309+
/* Data structure to keep withheld FLOGI_ACC information */
310+
struct lpfc_defer_flogi_acc {
311+
bool flag;
312+
u16 rx_id;
313+
u16 ox_id;
314+
struct lpfc_nodelist *ndlp;
315+
316+
};
309317

310318
#define LPFC_VMID_TIMER 300 /* timer interval in seconds */
311319

@@ -1430,9 +1438,7 @@ struct lpfc_hba {
14301438
uint16_t vlan_id;
14311439
struct list_head fcf_conn_rec_list;
14321440

1433-
bool defer_flogi_acc_flag;
1434-
uint16_t defer_flogi_acc_rx_id;
1435-
uint16_t defer_flogi_acc_ox_id;
1441+
struct lpfc_defer_flogi_acc defer_flogi_acc;
14361442

14371443
spinlock_t ct_ev_lock; /* synchronize access to ct_ev_waiters */
14381444
struct list_head ct_ev_waiters;

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,8 +1099,10 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
10991099
sp->cmn.priority_tagging, kref_read(&ndlp->kref));
11001100

11011101
/* reinitialize the VMID datastructure before returning */
1102-
if (lpfc_is_vmid_enabled(phba))
1102+
if (lpfc_is_vmid_enabled(phba)) {
11031103
lpfc_reinit_vmid(vport);
1104+
vport->vmid_flag = 0;
1105+
}
11041106
if (sp->cmn.priority_tagging)
11051107
vport->phba->pport->vmid_flag |= (LPFC_VMID_ISSUE_QFPA |
11061108
LPFC_VMID_TYPE_PRIO);
@@ -1390,7 +1392,7 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
13901392
phba->link_flag &= ~LS_EXTERNAL_LOOPBACK;
13911393

13921394
/* Check for a deferred FLOGI ACC condition */
1393-
if (phba->defer_flogi_acc_flag) {
1395+
if (phba->defer_flogi_acc.flag) {
13941396
/* lookup ndlp for received FLOGI */
13951397
ndlp = lpfc_findnode_did(vport, 0);
13961398
if (!ndlp)
@@ -1404,34 +1406,38 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
14041406
if (phba->sli_rev == LPFC_SLI_REV4) {
14051407
bf_set(wqe_ctxt_tag,
14061408
&defer_flogi_acc.wqe.xmit_els_rsp.wqe_com,
1407-
phba->defer_flogi_acc_rx_id);
1409+
phba->defer_flogi_acc.rx_id);
14081410
bf_set(wqe_rcvoxid,
14091411
&defer_flogi_acc.wqe.xmit_els_rsp.wqe_com,
1410-
phba->defer_flogi_acc_ox_id);
1412+
phba->defer_flogi_acc.ox_id);
14111413
} else {
14121414
icmd = &defer_flogi_acc.iocb;
1413-
icmd->ulpContext = phba->defer_flogi_acc_rx_id;
1415+
icmd->ulpContext = phba->defer_flogi_acc.rx_id;
14141416
icmd->unsli3.rcvsli3.ox_id =
1415-
phba->defer_flogi_acc_ox_id;
1417+
phba->defer_flogi_acc.ox_id;
14161418
}
14171419

14181420
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
14191421
"3354 Xmit deferred FLOGI ACC: rx_id: x%x,"
14201422
" ox_id: x%x, hba_flag x%lx\n",
1421-
phba->defer_flogi_acc_rx_id,
1422-
phba->defer_flogi_acc_ox_id, phba->hba_flag);
1423+
phba->defer_flogi_acc.rx_id,
1424+
phba->defer_flogi_acc.ox_id, phba->hba_flag);
14231425

14241426
/* Send deferred FLOGI ACC */
14251427
lpfc_els_rsp_acc(vport, ELS_CMD_FLOGI, &defer_flogi_acc,
14261428
ndlp, NULL);
14271429

1428-
phba->defer_flogi_acc_flag = false;
1429-
vport->fc_myDID = did;
1430+
phba->defer_flogi_acc.flag = false;
14301431

1431-
/* Decrement ndlp reference count to indicate the node can be
1432-
* released when other references are removed.
1432+
/* Decrement the held ndlp that was incremented when the
1433+
* deferred flogi acc flag was set.
14331434
*/
1434-
lpfc_nlp_put(ndlp);
1435+
if (phba->defer_flogi_acc.ndlp) {
1436+
lpfc_nlp_put(phba->defer_flogi_acc.ndlp);
1437+
phba->defer_flogi_acc.ndlp = NULL;
1438+
}
1439+
1440+
vport->fc_myDID = did;
14351441
}
14361442

14371443
return 0;
@@ -5240,9 +5246,10 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
52405246
/* ACC to LOGO completes to NPort <nlp_DID> */
52415247
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
52425248
"0109 ACC to LOGO completes to NPort x%x refcnt %d "
5243-
"Data: x%x x%x x%x\n",
5244-
ndlp->nlp_DID, kref_read(&ndlp->kref), ndlp->nlp_flag,
5245-
ndlp->nlp_state, ndlp->nlp_rpi);
5249+
"last els x%x Data: x%x x%x x%x\n",
5250+
ndlp->nlp_DID, kref_read(&ndlp->kref),
5251+
ndlp->nlp_last_elscmd, ndlp->nlp_flag, ndlp->nlp_state,
5252+
ndlp->nlp_rpi);
52465253

52475254
/* This clause allows the LOGO ACC to complete and free resources
52485255
* for the Fabric Domain Controller. It does deliberately skip
@@ -5254,18 +5261,22 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
52545261
goto out;
52555262

52565263
if (ndlp->nlp_state == NLP_STE_NPR_NODE) {
5257-
/* If PLOGI is being retried, PLOGI completion will cleanup the
5258-
* node. The NLP_NPR_2B_DISC flag needs to be retained to make
5259-
* progress on nodes discovered from last RSCN.
5260-
*/
5261-
if ((ndlp->nlp_flag & NLP_DELAY_TMO) &&
5262-
(ndlp->nlp_last_elscmd == ELS_CMD_PLOGI))
5263-
goto out;
5264-
52655264
if (ndlp->nlp_flag & NLP_RPI_REGISTERED)
52665265
lpfc_unreg_rpi(vport, ndlp);
52675266

5267+
/* If came from PRLO, then PRLO_ACC is done.
5268+
* Start rediscovery now.
5269+
*/
5270+
if (ndlp->nlp_last_elscmd == ELS_CMD_PRLO) {
5271+
spin_lock_irq(&ndlp->lock);
5272+
ndlp->nlp_flag |= NLP_NPR_2B_DISC;
5273+
spin_unlock_irq(&ndlp->lock);
5274+
ndlp->nlp_prev_state = ndlp->nlp_state;
5275+
lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
5276+
lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
5277+
}
52685278
}
5279+
52695280
out:
52705281
/*
52715282
* The driver received a LOGO from the rport and has ACK'd it.
@@ -8454,21 +8465,27 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
84548465

84558466
/* Defer ACC response until AFTER we issue a FLOGI */
84568467
if (!test_bit(HBA_FLOGI_ISSUED, &phba->hba_flag)) {
8457-
phba->defer_flogi_acc_rx_id = bf_get(wqe_ctxt_tag,
8468+
phba->defer_flogi_acc.rx_id = bf_get(wqe_ctxt_tag,
84588469
&wqe->xmit_els_rsp.wqe_com);
8459-
phba->defer_flogi_acc_ox_id = bf_get(wqe_rcvoxid,
8470+
phba->defer_flogi_acc.ox_id = bf_get(wqe_rcvoxid,
84608471
&wqe->xmit_els_rsp.wqe_com);
84618472

84628473
vport->fc_myDID = did;
84638474

84648475
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
84658476
"3344 Deferring FLOGI ACC: rx_id: x%x,"
84668477
" ox_id: x%x, hba_flag x%lx\n",
8467-
phba->defer_flogi_acc_rx_id,
8468-
phba->defer_flogi_acc_ox_id, phba->hba_flag);
8478+
phba->defer_flogi_acc.rx_id,
8479+
phba->defer_flogi_acc.ox_id, phba->hba_flag);
84698480

8470-
phba->defer_flogi_acc_flag = true;
8481+
phba->defer_flogi_acc.flag = true;
84718482

8483+
/* This nlp_get is paired with nlp_puts that reset the
8484+
* defer_flogi_acc.flag back to false. We need to retain
8485+
* a kref on the ndlp until the deferred FLOGI ACC is
8486+
* processed or cancelled.
8487+
*/
8488+
phba->defer_flogi_acc.ndlp = lpfc_nlp_get(ndlp);
84728489
return 0;
84738490
}
84748491

@@ -10504,7 +10521,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1050410521

1050510522
lpfc_els_rcv_flogi(vport, elsiocb, ndlp);
1050610523
/* retain node if our response is deferred */
10507-
if (phba->defer_flogi_acc_flag)
10524+
if (phba->defer_flogi_acc.flag)
1050810525
break;
1050910526
if (newnode)
1051010527
lpfc_disc_state_machine(vport, ndlp, NULL,
@@ -10742,7 +10759,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1074210759
rjt_exp = LSEXP_NOTHING_MORE;
1074310760

1074410761
/* Unknown ELS command <elsCmd> received from NPORT <did> */
10745-
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
10762+
lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
1074610763
"0115 Unknown ELS command x%x "
1074710764
"received from NPORT x%x\n", cmd, did);
1074810765
if (newnode)

drivers/scsi/lpfc/lpfc_hbadisc.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
175175
ndlp->nlp_state, ndlp->fc4_xpt_flags);
176176

177177
/* Don't schedule a worker thread event if the vport is going down. */
178-
if (test_bit(FC_UNLOADING, &vport->load_flag)) {
178+
if (test_bit(FC_UNLOADING, &vport->load_flag) ||
179+
!test_bit(HBA_SETUP, &phba->hba_flag)) {
179180
spin_lock_irqsave(&ndlp->lock, iflags);
180181
ndlp->rport = NULL;
181182

@@ -1254,7 +1255,14 @@ lpfc_linkdown(struct lpfc_hba *phba)
12541255
lpfc_scsi_dev_block(phba);
12551256
offline = pci_channel_offline(phba->pcidev);
12561257

1257-
phba->defer_flogi_acc_flag = false;
1258+
/* Decrement the held ndlp if there is a deferred flogi acc */
1259+
if (phba->defer_flogi_acc.flag) {
1260+
if (phba->defer_flogi_acc.ndlp) {
1261+
lpfc_nlp_put(phba->defer_flogi_acc.ndlp);
1262+
phba->defer_flogi_acc.ndlp = NULL;
1263+
}
1264+
}
1265+
phba->defer_flogi_acc.flag = false;
12581266

12591267
/* Clear external loopback plug detected flag */
12601268
phba->link_flag &= ~LS_EXTERNAL_LOOPBACK;
@@ -1376,7 +1384,7 @@ lpfc_linkup_port(struct lpfc_vport *vport)
13761384
(vport != phba->pport))
13771385
return;
13781386

1379-
if (phba->defer_flogi_acc_flag) {
1387+
if (phba->defer_flogi_acc.flag) {
13801388
clear_bit(FC_ABORT_DISCOVERY, &vport->fc_flag);
13811389
clear_bit(FC_RSCN_MODE, &vport->fc_flag);
13821390
clear_bit(FC_NLP_MORE, &vport->fc_flag);

drivers/scsi/lpfc/lpfc_nportdisc.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,8 +2652,26 @@ lpfc_rcv_prlo_mapped_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
26522652
/* flush the target */
26532653
lpfc_sli_abort_iocb(vport, ndlp->nlp_sid, 0, LPFC_CTX_TGT);
26542654

2655-
/* Treat like rcv logo */
2656-
lpfc_rcv_logo(vport, ndlp, cmdiocb, ELS_CMD_PRLO);
2655+
/* Send PRLO_ACC */
2656+
spin_lock_irq(&ndlp->lock);
2657+
ndlp->nlp_flag |= NLP_LOGO_ACC;
2658+
spin_unlock_irq(&ndlp->lock);
2659+
lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL);
2660+
2661+
/* Save ELS_CMD_PRLO as the last elscmd and then set to NPR.
2662+
* lpfc_cmpl_els_logo_acc is expected to restart discovery.
2663+
*/
2664+
ndlp->nlp_last_elscmd = ELS_CMD_PRLO;
2665+
ndlp->nlp_prev_state = ndlp->nlp_state;
2666+
2667+
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_ELS | LOG_DISCOVERY,
2668+
"3422 DID x%06x nflag x%x lastels x%x ref cnt %u\n",
2669+
ndlp->nlp_DID, ndlp->nlp_flag,
2670+
ndlp->nlp_last_elscmd,
2671+
kref_read(&ndlp->kref));
2672+
2673+
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
2674+
26572675
return ndlp->nlp_state;
26582676
}
26592677

drivers/scsi/lpfc/lpfc_scsi.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5555,11 +5555,20 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
55555555

55565556
iocb = &lpfc_cmd->cur_iocbq;
55575557
if (phba->sli_rev == LPFC_SLI_REV4) {
5558-
pring_s4 = phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq->pring;
5559-
if (!pring_s4) {
5558+
/* if the io_wq & pring are gone, the port was reset. */
5559+
if (!phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq ||
5560+
!phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq->pring) {
5561+
lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
5562+
"2877 SCSI Layer I/O Abort Request "
5563+
"IO CMPL Status x%x ID %d LUN %llu "
5564+
"HBA_SETUP %d\n", FAILED,
5565+
cmnd->device->id,
5566+
(u64)cmnd->device->lun,
5567+
test_bit(HBA_SETUP, &phba->hba_flag));
55605568
ret = FAILED;
55615569
goto out_unlock_hba;
55625570
}
5571+
pring_s4 = phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq->pring;
55635572
spin_lock(&pring_s4->ring_lock);
55645573
}
55655574
/* the command is in process of being cancelled */

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4687,6 +4687,17 @@ lpfc_sli_flush_io_rings(struct lpfc_hba *phba)
46874687
/* Look on all the FCP Rings for the iotag */
46884688
if (phba->sli_rev >= LPFC_SLI_REV4) {
46894689
for (i = 0; i < phba->cfg_hdw_queue; i++) {
4690+
if (!phba->sli4_hba.hdwq ||
4691+
!phba->sli4_hba.hdwq[i].io_wq) {
4692+
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
4693+
"7777 hdwq's deleted %lx "
4694+
"%lx %x %x\n",
4695+
phba->pport->load_flag,
4696+
phba->hba_flag,
4697+
phba->link_state,
4698+
phba->sli.sli_flag);
4699+
return;
4700+
}
46904701
pring = phba->sli4_hba.hdwq[i].io_wq->pring;
46914702

46924703
spin_lock_irq(&pring->ring_lock);
@@ -12473,8 +12484,6 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1247312484
cmdiocb->iocb.ulpClass,
1247412485
LPFC_WQE_CQ_ID_DEFAULT, ia, false);
1247512486

12476-
abtsiocbp->vport = vport;
12477-
1247812487
/* ABTS WQE must go to the same WQ as the WQE to be aborted */
1247912488
abtsiocbp->hba_wqidx = cmdiocb->hba_wqidx;
1248012489
if (cmdiocb->cmd_flag & LPFC_IO_FCP)

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.3"
23+
#define LPFC_DRIVER_VERSION "14.4.0.4"
2424
#define LPFC_DRIVER_NAME "lpfc"
2525

2626
/* Used for SLI 2/3 */

drivers/scsi/lpfc/lpfc_vmid.c

Lines changed: 1 addition & 2 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-2023 Broadcom. All Rights Reserved. The term *
4+
* Copyright (C) 2017-2024 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. *
@@ -321,6 +321,5 @@ lpfc_reinit_vmid(struct lpfc_vport *vport)
321321
if (!hash_empty(vport->hash_table))
322322
hash_for_each_safe(vport->hash_table, bucket, tmp, cur, hnode)
323323
hash_del(&cur->hnode);
324-
vport->vmid_flag = 0;
325324
write_unlock(&vport->vmid_lock);
326325
}

0 commit comments

Comments
 (0)