Re: [PATCH net-next v12 5/5] net: mana: use the reported HWC queue depth
From: netdev-bot+sashiko
Date: Sat Nov 28 2026 - 11:40:04 EST
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