Skip to content

Commit 6bb194d

Browse files
paulfertserkuba-moo
authored andcommitted
net/ncsi: wait for the last response to Deselect Package before configuring 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: [email protected] Signed-off-by: Paul Fertser <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d31a49d commit 6bb194d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

net/ncsi/ncsi-manage.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,12 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
13851385
nd->state = ncsi_dev_state_probe_package;
13861386
break;
13871387
case ncsi_dev_state_probe_package:
1388+
if (ndp->package_probe_id >= 8) {
1389+
/* Last package probed, finishing */
1390+
ndp->flags |= NCSI_DEV_PROBED;
1391+
break;
1392+
}
1393+
13881394
ndp->pending_req_num = 1;
13891395

13901396
nca.type = NCSI_PKT_CMD_SP;
@@ -1501,13 +1507,8 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
15011507
if (ret)
15021508
goto error;
15031509

1504-
/* Probe next package */
1510+
/* Probe next package after receiving response */
15051511
ndp->package_probe_id++;
1506-
if (ndp->package_probe_id >= 8) {
1507-
/* Probe finished */
1508-
ndp->flags |= NCSI_DEV_PROBED;
1509-
break;
1510-
}
15111512
nd->state = ncsi_dev_state_probe_package;
15121513
ndp->active_package = NULL;
15131514
break;

0 commit comments

Comments
 (0)