From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 056FB227EA0; Mon, 10 Mar 2025 17:58:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741629525; cv=none; b=AYTUQln4/8r4NrhXfzrVJmEJa3UMnN6OaalWZOdtERikZhIQGXPTbl8kVtccJQdltJ8wcLh1QxdBMIHwLF4ji7SxxUO4aVwU75gPP6nv0bOAxo34emj+LYn/u3x5r7AdI1Tou9+MkgvITKCZsM72McHsVogCxwubS5nsBAauYZs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741629525; c=relaxed/simple; bh=AP5az0qgiQytymeP04DCIiwsresSZBByl8lknPeYjI8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uaINko+d8ZqV/OqVUTKVe8fwPDwt/qqoENYxL0cLpIUSyMbxOJKBWNVXSvoNs8LyywH+c+/yy0vM+5QO5kzXHZ+p6r8d+mA4YZNDWmte+CPGrhENvkP0jpggcl9GQqAikbilkJI92/xQBpx+tZ1ewGcW6Kjb33mXDX/OiakUZvY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mqgk2CqK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mqgk2CqK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 800ECC4CEE5; Mon, 10 Mar 2025 17:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1741629524; bh=AP5az0qgiQytymeP04DCIiwsresSZBByl8lknPeYjI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mqgk2CqK9lbgXRA76lsV/bAC72e2Ir3JcSCD90iEWgtHWPF6PhOP/Hhsgvm+YaO/4 kOuzCOClXGKEUMyMYHFVtFEv0I1PPVnvKOHgqqdXxateXegmTGtQ0f4qHeQJwt/5x7 GDYtB27fPhONIXCoWAR2GDc2UpNO7xJvuNcu2YFU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Paul Fertser , Jakub Kicinski Subject: [PATCH 5.15 325/620] net/ncsi: wait for the last response to Deselect Package before configuring channel Date: Mon, 10 Mar 2025 18:02:51 +0100 Message-ID: <20250310170558.435370665@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310170545.553361750@linuxfoundation.org> References: <20250310170545.553361750@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paul Fertser commit 6bb194d036c6e1b329dcdff459338cdd9a54802a upstream. 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 Link: https://patch.msgid.link/20250116152900.8656-1-fercerpav@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ncsi/ncsi-manage.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/net/ncsi/ncsi-manage.c +++ b/net/ncsi/ncsi-manage.c @@ -1385,6 +1385,12 @@ static void ncsi_probe_channel(struct nc 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 nc 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;