Skip to content

Commit

Permalink
net/ncsi: wait for the last response to Deselect Package before confi…
Browse files Browse the repository at this point in the history
…guring channel

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: 8e13f70 ("net/ncsi: Probe single packages to avoid conflict")
Cc: stable@vger.kernel.org
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Link: https://patch.msgid.link/20250116152900.8656-1-fercerpav@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Paul Fertser authored and Jakub Kicinski committed Jan 23, 2025
1 parent d31a49d commit 6bb194d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions net/ncsi/ncsi-manage.c
Original file line number Diff line number Diff line change
@@ -1385,6 +1385,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;
@@ -1501,13 +1507,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;

0 comments on commit 6bb194d

Please sign in to comment.