Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
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, shacharr@microsoft.com
Subject: Re: [PATCH net-next v12 5/5] net: mana: use the reported HWC queue depth
Date: Sat, 28 Nov 2026 16:39:53 +0000	[thread overview]
Message-ID: <179588399336.3135.15832712725709611248@kernel.org> (raw)
In-Reply-To: <hwc-v12.91ec3eff9cb647d5bc5cc932b3c6f60c.5@linux.microsoft.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

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] The patch may apply each firmware-reported HWC message limit
  to the wrong direction.

--

net: mana: use the reported HWC queue depth

This commit rebuilds the HWC at the PF-reported queue depth when all four
descriptor rings fit in 4 KiB and the reported message sizes match the
bootstrap allocations. Otherwise it keeps the bootstrap queues and
enforces the reported transmit and receive limits. It also tests the
rebuilt channel and restores a depth-one channel if that test fails.

> diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c b/drivers/net/ethernet/microsoft/mana/hw_channel.c
> index cf1b9c75b10e2..c78c2baf7048d 100644
> --- a/drivers/net/ethernet/microsoft/mana/hw_channel.c
> +++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c

[ ... ]

> @@ -1097,32 +1138,177 @@ void mana_hwc_free_retained_channel(struct gdma_context *gc)

[ ... ]

> +static int mana_hwc_finish_channel(struct hw_channel_context *hwc,
> +				   const struct mana_hwc_init_report *report)
>  {
> -	u32 max_req_msg_size, max_resp_msg_size;
> -	u16 q_depth_max;
>  	int err;
>  
> -	err = mana_hwc_init_queues(hwc, HW_CHANNEL_VF_BOOTSTRAP_QUEUE_DEPTH,
> +	/* MAX_REQUEST sizes the RQ; MAX_RESPONSE sizes the SQ. */
> +	hwc->rx_msg_size_limit = report->max_req_msg_size;
> +	hwc->tx_msg_size_limit = report->max_resp_msg_size;

[Severity: Medium]
Are these two limits applied to the right directions?

HWC_INIT_DATA_MAX_REQUEST is stored as rx_msg_size_limit, and
HWC_INIT_DATA_MAX_RESPONSE as tx_msg_size_limit. The tx limit then bounds
every host-to-PF request, first in mana_hwc_get_max_req_size():

    return min(hwc->tx_msg_size_limit, hwc->max_resp_msg_size);

and then in mana_hwc_stage():

    if (sub->len > min(hwc->tx_msg_size_limit, tx->buf_len) ||
        sub->resp_len > min(hwc->rx_msg_size_limit, hwc->max_req_msg_size))
        return -EMSGSIZE;

Before this patch, mana_gd_create_dma_region() and
mana_ib_gd_create_dma_region() bounded outgoing requests by
hwc->max_req_msg_size. So the request maximum was treated as the bound
for requests.

The comment "MAX_REQUEST sizes the RQ; MAX_RESPONSE sizes the SQ" follows
the driver's own buffer naming in mana_hwc_init_queues(). Nothing in the
tree says what the PF means by these two values.

Suppose MAX_REQUEST is the largest request the PF accepts. Then on the
keep-bootstrap path in mana_hwc_prepare_channel(), wouldn't each
direction get the other direction's limit? For example:

  If the PF reports MAX_REQUEST=2048 and MAX_RESPONSE=4096, the driver
  sends CREATE_DMA_REGION and ADD_PAGES messages of up to 4 KiB to a PF
  that accepts only 2 KiB.

  If the PF reports MAX_REQUEST=4096 and MAX_RESPONSE=1024, requests are
  capped at 1 KiB. mana_gd_create_dma_region() then returns -EINVAL for
  queue buffers that need more than about 120 page entries. The RDMA
  max_pgs_create_cmd and max_pgs_add_cmd batches also shrink.

The rebuild path requires both values to be 4096. So this only matters
when the bootstrap queues are kept and the PF reports other sizes.

The commit message says "enforce the reported transmit and receive
limits", but it does not say which report maps to which direction.

Could the mapping be checked against the firmware definition and
documented?

> +
> +	err = mana_hwc_test_channel(hwc);
> +	if (err)
> +		dev_err(hwc->dev, "Failed to test HWC: %d\n", err);
> +
> +	return err;
> +}

[ ... ]

> diff --git a/include/net/mana/hw_channel.h b/include/net/mana/hw_channel.h
> index c154264f0f7c3..23df7222e8339 100644
> --- a/include/net/mana/hw_channel.h
> +++ b/include/net/mana/hw_channel.h

[ ... ]

> @@ -233,6 +240,13 @@ struct hw_channel_context {
>  	struct hwc_caller_ctx *caller_ctx;
>  };
>  
> +/* Host-to-PF requests are bounded by the negotiated TX limit and SQ stride. */
> +static inline u32
> +mana_hwc_get_max_req_size(const struct hw_channel_context *hwc)
> +{
> +	return min(hwc->tx_msg_size_limit, hwc->max_resp_msg_size);
> +}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/hwc-v12.91ec3eff9cb647d5bc5cc932b3c6f60c.0%40linux.microsoft.com

  reply	other threads:[~2026-11-28 16:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 15:40 [PATCH net-next v12 0/5] net: mana: concurrent HWC requests Wei Hu
2026-11-24 15:40 ` [PATCH net-next v12 1/5] net: mana: validate the HWC doorbell before ringing it Wei Hu
2026-11-24 15:40 ` [PATCH net-next v12 2/5] net: mana: keep HWC queues until the PF acknowledges teardown Wei Hu
2026-11-28 16:39   ` netdev-bot+sashiko
2026-11-24 15:40 ` [PATCH net-next v12 3/5] net: mana: protect the HWC response buffer until the sender returns Wei Hu
2026-11-24 15:40 ` [PATCH net-next v12 4/5] net: mana: support concurrent HWC requests Wei Hu
2026-11-28 16:39   ` netdev-bot+sashiko
2026-11-24 15:40 ` [PATCH net-next v12 5/5] net: mana: use the reported HWC queue depth Wei Hu
2026-11-28 16:39   ` netdev-bot+sashiko [this message]
2026-11-24 15:44 ` [PATCH net-next v12 0/5] net: mana: concurrent HWC requests netdev-bot+sinfo
2026-11-25  3:13   ` [EXTERNAL] " Wei Hu
2026-11-24 16:00 ` sashiko-bot

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=179588399336.3135.15832712725709611248@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=edumazet@google.com \
    --cc=edumazet@kernel.org \
    --cc=ernis@linux.microsoft.com \
    --cc=gargaditya@linux.microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=horms@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=kees+treewide@kernel.org \
    --cc=kees@kernel.org \
    --cc=kotaranov@microsoft.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=longli@kernel.org \
    --cc=mawasthi@linux.microsoft.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shacharr@microsoft.com \
    --cc=shradhagupta@linux.microsoft.com \
    --cc=stephen@networkplumber.org \
    --cc=weh@linux.microsoft.com \
    --cc=weh@microsoft.com \
    --cc=wei.liu@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