From: Paul Fertser <fercerpav@gmail.com>
To: Potin Lai <potin.lai.pt@gmail.com>,
Cosmo Chou <chou.cosmo@gmail.com>,
Eddie James <eajames@linux.ibm.com>,
Samuel Mendoza-Jonas <sam@mendozajonas.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Ivan Mikhaylov <fr0st61te@gmail.com>,
Paul Fertser <fercerpav@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH] net/ncsi: wait for the last response to Deselect Package before configuring channel
Date: Thu, 16 Jan 2025 18:29:00 +0300 [thread overview]
Message-ID: <20250116152900.8656-1-fercerpav@gmail.com> (raw)
In-Reply-To: <CAGfYmwVH1A+imBF5TLenLaSM0Zf0C5wgfgocYix9Ye_7siR_xQ@mail.gmail.com>
The NCSI state machine as it's currently implemented assumes that
transition to the next logical state is performed either explicitly by
calling `schedule_work(&ndp->work)` to re-queue itself or implicitly
after processing the predefined (ndp->pending_req_num) number of
replies. Thus to avoid the configuration FSM from advancing prematurely
and getting out of sync with the process it's essential to not skip
waiting for a reply.
This patch makes the code wait for reception of the Deselect Package
response for the last package probed before proceeding to channel
configuration.
Thanks go to Potin Lai and Cosmo Chou for the initial investigation and
testing.
Fixes: 8e13f70be05e ("net/ncsi: Probe single packages to avoid conflict")
Cc: stable@vger.kernel.org
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
net/ncsi/ncsi-manage.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index 5cf55bde366d..bf8e27b84a66 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -1373,6 +1373,12 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
nd->state = ncsi_dev_state_probe_package;
break;
case ncsi_dev_state_probe_package:
+ if (ndp->package_probe_id >= 8) {
+ /* Last package probed, finishing */
+ ndp->flags |= NCSI_DEV_PROBED;
+ break;
+ }
+
ndp->pending_req_num = 1;
nca.type = NCSI_PKT_CMD_SP;
@@ -1489,13 +1495,8 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
if (ret)
goto error;
- /* Probe next package */
+ /* Probe next package after receiving response */
ndp->package_probe_id++;
- if (ndp->package_probe_id >= 8) {
- /* Probe finished */
- ndp->flags |= NCSI_DEV_PROBED;
- break;
- }
nd->state = ncsi_dev_state_probe_package;
ndp->active_package = NULL;
break;
--
2.34.1
next prev parent reply other threads:[~2025-01-16 15:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 2:34 [PATCH v3 0/2] net/ncsi: fix oem gma command handling and state race issue Potin Lai
2025-01-13 2:34 ` [PATCH v3 1/2] net/ncsi: fix locking in Get MAC Address handling Potin Lai
2025-01-13 2:34 ` [PATCH v3 2/2] net/ncsi: fix state race during channel probe completion Potin Lai
2025-01-14 12:55 ` Paul Fertser
2025-01-16 0:38 ` Potin Lai
2025-01-16 15:29 ` Paul Fertser [this message]
2025-01-23 4:10 ` [PATCH] net/ncsi: wait for the last response to Deselect Package before configuring channel patchwork-bot+netdevbpf
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=20250116152900.8656-1-fercerpav@gmail.com \
--to=fercerpav@gmail.com \
--cc=chou.cosmo@gmail.com \
--cc=davem@davemloft.net \
--cc=eajames@linux.ibm.com \
--cc=edumazet@google.com \
--cc=fr0st61te@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=potin.lai.pt@gmail.com \
--cc=sam@mendozajonas.com \
--cc=stable@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