From: Justin Tee <justintee8345@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: jsmart2021@gmail.com, justin.tee@broadcom.com,
Justin Tee <justintee8345@gmail.com>
Subject: [PATCH 2/8] lpfc: Update phba link state conditional before sending CMF_SYNC_WQE
Date: Thu, 12 Sep 2024 16:24:41 -0700 [thread overview]
Message-ID: <20240912232447.45607-3-justintee8345@gmail.com> (raw)
In-Reply-To: <20240912232447.45607-1-justintee8345@gmail.com>
It's possible for the driver to send a CMF_SYNC_WQE to nonresponsive
firmware during reset of the adapter. The phba link_state conditional
check is currently a strict == LPFC_LINK_DOWN, which does not cover
initialization states before reaching the LPFC_LINK_UP state.
Update the phba->link_state conditional to < LPFC_LINK_UP so that all
initialization states are covered before allowing sending CMF_SYNC_WQE.
Update taking of the hbalock to be during this link_state check as well.
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
---
drivers/scsi/lpfc/lpfc_sli.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 332b8d2348e9..bb5fd3322273 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1940,12 +1940,15 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total)
atot = atomic_xchg(&phba->cgn_sync_alarm_cnt, 0);
wtot = atomic_xchg(&phba->cgn_sync_warn_cnt, 0);
+ spin_lock_irqsave(&phba->hbalock, iflags);
+
/* ONLY Managed mode will send the CMF_SYNC_WQE to the HBA */
if (phba->cmf_active_mode != LPFC_CFG_MANAGED ||
- phba->link_state == LPFC_LINK_DOWN)
- return 0;
+ phba->link_state < LPFC_LINK_UP) {
+ ret_val = 0;
+ goto out_unlock;
+ }
- spin_lock_irqsave(&phba->hbalock, iflags);
sync_buf = __lpfc_sli_get_iocbq(phba);
if (!sync_buf) {
lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT,
--
2.38.0
next prev parent reply other threads:[~2024-09-12 23:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 23:24 [PATCH 0/8] Update lpfc to revision 14.4.0.5 Justin Tee
2024-09-12 23:24 ` [PATCH 1/8] lpfc: Add ELS_RSP cmd to the list of WQEs to flush in lpfc_els_flush_cmd Justin Tee
2024-09-12 23:24 ` Justin Tee [this message]
2024-09-12 23:24 ` [PATCH 3/8] lpfc: Restrict support for 32 byte CDBs to specific HBAs Justin Tee
2024-09-12 23:24 ` [PATCH 4/8] lpfc: Fix kref imbalance on fabric ndlps from dev_loss_tmo handler Justin Tee
2024-09-12 23:24 ` [PATCH 5/8] lpfc: Ensure DA_ID handling completion before deleting an NPIV instance Justin Tee
2024-09-12 23:24 ` [PATCH 6/8] lpfc: Revise TRACE_EVENT log flag severities from KERN_ERR to KERN_WARNING Justin Tee
2024-09-12 23:24 ` [PATCH 7/8] lpfc: Support loopback tests with VMID enabled Justin Tee
2024-09-12 23:24 ` [PATCH 8/8] lpfc: Update lpfc version to 14.4.0.5 Justin Tee
2024-09-13 1:22 ` [PATCH 0/8] Update lpfc to revision 14.4.0.5 Martin K. Petersen
2024-09-19 15:52 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240912232447.45607-3-justintee8345@gmail.com \
--to=justintee8345@gmail.com \
--cc=jsmart2021@gmail.com \
--cc=justin.tee@broadcom.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox