From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796445407; b=jsFcPeQhOAfZBIQ8MqWlyeOCJ0iRBW+iyHGNTseRS/8X+zDlF11h21jnsA95qewRw2Ds nT1ZdqpF+VGs1AyK3RuHW/ot1Ns4rWV4m4NZjhYUSWHZOgoVFpvZ6Kfq7o7z7GLFCBp/f xiv0yMoEEXdrT+3J2up/kh8KWwSEgbft1WRu83pmP9Sj8IBT2c/YXMNAXRrNmzgxFtx5Y /lpYOP3vY9uYdXtCmP5Th0fpkG2UQLx6MAouFeDr+GGkCkFwDDI0ND/dt/XHvGcXzANHZ 3goeVZTQY02+YRVPYfy7zO8EQ1G4bmO8XJY7owEQhO4jqj9y6jhLkcUEgRohUQH8qhA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796445407; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=pWpwmUt+sdpL0cxZDRxlWUyZ3FwaAKKYPq+Dhhegm0Y=; b=ptDHxhmj/a7bZea/JIDtBf8S51DQ1qTa3k+1cRSudkILdOqbly7+cqJRoBrVzKfMTySC NrADoQUry/O2lf2DRD3qKfPe5LoqBL07EM7MnHErISPcsSrn2uuw8EefSRpLBRT9769pS 3DPlZ+nGkjOmhjfmLusPtvr5c10a5ittdhntZ0uRr/ySCCnYi91LkwVysbZfHktDBw+ig fFAK7n8LMHeB9bYMa7Gr4xVkk5nS8cZyAehlmAyfVCGmd99US4zeK/MvxH3wp/4PYWosJ YnMhZMRg33HMayIv3Xh2icpomiyprLL5X/DZ7Rdy4tBvyPpEK4TB5CraFgcB1Ni9H9A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=f8W6oLpp; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 211A2606A33A; Sat, 5 Dec 2026 04:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=f8W6oLpp Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29EEE1F00A12; Sat, 5 Dec 2026 04:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796445406; bh=pWpwmUt+sdpL0cxZDRxlWUyZ3FwaAKKYPq+Dhhegm0Y=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=f8W6oLpp2hGetkcRqR9JIHQFcWoYIMsFehkcLALTenfl8hzy4ds2wD6Suo+rdSJMd dogbKh9y4i8hx0K7uYRdcpC0b/x73yrLA5cI+HCtUqa0lxjMFJZViv1lVcFk7luweF OJOPo4qXeyVa/1KJI6fYteyYs+zOUzJdbUMwWkTMGjLAaqdcm2rfyHZ8zQMGFE8dL1 DsQMwsfvzuYS+EWhTBbRTfNUofyyey0sC8LEWxbWkAoz3LXoaSVneki8L+DU1683CZ H3LUfLbBZpU9n3CPiyXh2aOHFIl+HzHyG4vxhnNB8NizBFwxrBxjI/fldPUtWZZCVx Le9ZTVRaDvV3g== Subject: Re: [PATCH net-next v13 5/5] net: mana: use the reported HWC queue depth From: netdev-bot+sashiko@kernel.org To: weh@linux.microsoft.com Cc: longli@kernel.org, kotaranov@microsoft.com, kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, jgg@ziepe.ca, leon@kernel.org, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, shradhagupta@linux.microsoft.com, horms@kernel.org, ernis@linux.microsoft.com, stephen@networkplumber.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, gargaditya@linux.microsoft.com, kees+treewide@kernel.org, kees@kernel.org, mawasthi@linux.microsoft.com, weh@microsoft.com, edumazet@kernel.org Date: Sat, 05 Dec 2026 04:36:44 +0000 Message-ID: <179644540466.3146.14682429380154028120@kernel.org> In-Reply-To: References: X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 1 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] HWC bring-up now fails with -EPROTO if the PF does not report non-zero values for HWC_INIT_DATA_QUEUE_DEPTH,… - [Low] Beyond rebuilding the queues, the patch makes the PF-reported MAX_REQUEST/MAX_RESPONSE values enforced limits on every channel,… -- net: mana: use the reported HWC queue depth This patch rebuilds the hardware channel at the PF-reported queue depth when the descriptors fit in the fixed 4 KiB rings and the reported message sizes match the bootstrap allocations. Otherwise it keeps the depth-one bootstrap queues. It also uses the reported MAX_REQUEST and MAX_RESPONSE values as per-request admission limits, and falls back to a depth-one channel if the rebuilt channel fails its test. > diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c b/drivers/net/ethernet/microsoft/mana/hw_channel.c > index 5c2385c4e1620..34987ee19a31e 100644 > --- a/drivers/net/ethernet/microsoft/mana/hw_channel.c > +++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c [ ... ] > @@ -1115,32 +1166,176 @@ void mana_hwc_free_retained_channel(struct gdma_context *gc) > gc->hwc.gdma_context = NULL; > } > > -static int mana_hwc_create_bootstrap_channel(struct hw_channel_context *hwc) > +static int > +mana_hwc_validate_report(struct hw_channel_context *hwc, > + const struct mana_hwc_init_report *report, > + u32 expected_depth, bool check_depth, > + bool require_exact_msg_sizes) > +{ > + if (!report->queue_depth || !report->max_req_msg_size || > + !report->max_resp_msg_size) { > + dev_err(hwc->dev, > + "HWC: invalid maxima depth=%u req=%u resp=%u\n", > + report->queue_depth, report->max_req_msg_size, > + report->max_resp_msg_size); > + return -EPROTO; > + } [ ... ] > +static int mana_hwc_finish_channel(struct hw_channel_context *hwc, > + const struct mana_hwc_init_report *report) > +{ > + int err; > + > + /* The VF receives up to MAX_REQUEST and sends up to MAX_RESPONSE. */ > + hwc->rx_msg_size_limit = report->max_req_msg_size; > + hwc->tx_msg_size_limit = report->max_resp_msg_size; > + > + err = mana_hwc_test_channel(hwc); > + if (err) > + dev_err(hwc->dev, "Failed to test HWC: %d\n", err); > + > + return err; > +} [ ... ] > +static int mana_hwc_prepare_channel(struct hw_channel_context *hwc) > +{ > + struct mana_hwc_init_report report; > + u16 rebuild_depth; > + int err; > + > + err = mana_hwc_build_channel(hwc, > + HW_CHANNEL_VF_BOOTSTRAP_QUEUE_DEPTH, > + &report); > + if (err) > + return err; > + > + err = mana_hwc_validate_report(hwc, &report, 0, false, false); > + if (err) > + return err; [Severity: Medium] Suppose the PF never sends HWC_INIT_DATA_QUEUE_DEPTH, HWC_INIT_DATA_MAX_REQUEST or HWC_INIT_DATA_MAX_RESPONSE, or sends zero for one of them. Does this now fail the whole probe on the depth-one bootstrap channel? These fields start at zero from kzalloc_obj(), and mana_hwc_establish_channel() also clears them before ESTABLISH_HWC: hwc->hwc_init_q_depth_max = 0; hwc->hwc_init_max_req_msg_size = 0; hwc->hwc_init_max_resp_msg_size = 0; So a missing event leaves a zero in the report. The -EPROTO from mana_hwc_validate_report() then propagates up: mana_gd_setup() mana_hwc_create_channel() mana_hwc_prepare_channel() mana_hwc_validate_report() -> -EPROTO mana_gd_setup() then does: err = mana_hwc_create_channel(gc); if (err) goto remove_irq; and the device fails to probe. Before this patch, mana_hwc_create_bootstrap_channel() received q_depth_max, max_req_msg_size and max_resp_msg_size and threw them away. The depth-one channel worked whatever the PF reported. The commit message says "Otherwise keep the bootstrap queues". With a missing or zero report, the result is a probe failure instead. The zero check seems to be needed only because mana_hwc_finish_channel() now uses the reported sizes as admission limits. Would falling back to HW_CHANNEL_MAX_REQUEST_SIZE and HW_CHANNEL_MAX_RESPONSE_SIZE on the bootstrap path keep the old behaviour? > + > + if (!mana_hwc_depth_fits(report.queue_depth)) { > + dev_warn(hwc->dev, > + "HWC depth %u exceeds ring capacity, keeping bootstrap\n", > + report.queue_depth); > + } else if (report.queue_depth > > + HW_CHANNEL_VF_BOOTSTRAP_QUEUE_DEPTH && > + (report.max_req_msg_size != HW_CHANNEL_MAX_REQUEST_SIZE || > + report.max_resp_msg_size != HW_CHANNEL_MAX_RESPONSE_SIZE)) { > + dev_warn(hwc->dev, > + "HWC maxima req=%u resp=%u differ from rebuild policy %u/%u, keeping bootstrap\n", > + report.max_req_msg_size, report.max_resp_msg_size, > + HW_CHANNEL_MAX_REQUEST_SIZE, > + HW_CHANNEL_MAX_RESPONSE_SIZE); > + } else if (report.queue_depth > > + HW_CHANNEL_VF_BOOTSTRAP_QUEUE_DEPTH) { > + rebuild_depth = report.queue_depth; > + return mana_hwc_rebuild_channel(hwc, rebuild_depth, &report); > + } > + > + return mana_hwc_finish_channel(hwc, &report); [Severity: Low] The "keeping bootstrap" branches fall through to here. That means mana_hwc_finish_channel() applies the PF-reported maxima even when the bootstrap queues are kept: hwc->rx_msg_size_limit = report->max_req_msg_size; hwc->tx_msg_size_limit = report->max_resp_msg_size; mana_hwc_try_get_msg_index() now rejects every request above those limits: req_limit = mana_hwc_get_max_req_size(hwc); resp_limit = min(hwc->rx_msg_size_limit, hwc->max_req_msg_size); if (req_len > req_limit || resp_len > resp_limit) { ... return -EMSGSIZE; } Suppose a PF reports maxima below 4 KiB and smaller than an existing request, such as the gdma_verify_ver_req sent during probe. Could requests that used to succeed on the bootstrap channel now fail with -EMSGSIZE? mana_gd_create_dma_region() and mana_ib_gd_create_dma_region() also change. They now limit and batch CREATE_DMA_REGION and ADD_PAGES messages with mana_hwc_get_max_req_size() instead of hwc->max_req_msg_size, the RQ stride. When both reported values equal the HW_CHANNEL_* constants, the result matches the old code. The commit message only says "MAX_RESPONSE limits what the VF can send; MAX_REQUEST limits what it can receive." Could it mention that these limits also apply when the bootstrap queues are kept? Could it also mention that drivers/infiniband/hw/mana/main.c changes under this net: mana: subject? > } > > int mana_hwc_create_channel(struct gdma_context *gc) [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/hwc-v13.ab4ca86c3bf24a51ad8a84cc8a0220d1.0%40linux.microsoft.com