Re: [PATCH net-next v4 6/6] net: mvneta: serve the TX queues in weighted round robin
From: netdev-bot+sashiko
Date: Sat Nov 21 2026 - 18:03:14 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] Nothing in the driver confirms that the fix works on Armada
370/XP.
--
net: mvneta: serve the TX queues in weighted round robin
This patch gives every TX queue the same WRR weight and clears the fixed
TX queue priority. It writes both the newer register set and the separate
version 1 arbiter registers listed for Armada 370/XP. While an mqprio
offload is active, fixed priority stays in place.
Link: https://github.com/openwrt/openwrt/issues/5411
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index 89ade2ed7ce49..35409695d3d78 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -118,6 +118,7 @@
> #define MVNETA_HSGMII_SERDES_PROTO 0x1107
> #define MVNETA_TYPE_PRIO 0x24bc
> #define MVNETA_FORCE_UNI BIT(21)
> +#define MVETH_TXQ_FIXED_PRIO_REG 0x24dc
> #define MVNETA_TXQ_CMD_1 0x24e4
> #define MVNETA_TXQ_CMD 0x2448
[ ... ]
> @@ -1632,6 +1640,39 @@ static void mvneta_txq_max_tx_size_set(struct mvneta_port *pp, int max_tx_size)
> }
> }
>
> +static void mvneta_txq_wrr_weight(struct mvneta_port *pp, u32 reg, u32 weight)
> +{
> + u32 val = mvreg_read(pp, reg);
> +
> + val &= ~MVNETA_TXQ_WRR_WEIGHT_MASK;
> + mvreg_write(pp, reg, val | weight);
> +}
> +
> +/* With the default fixed priority, a busy queue starves the others.
> + * The Armada 370 and XP manuals list separate registers for the
> + * version 1 arbiter, which runs without a shaper, so set both.
> + */
> +static void mvneta_txq_wrr_set(struct mvneta_port *pp, int max_tx_size)
> +{
> + /* In units of 256 bytes, must exceed the largest packet */
> + u32 weight = max_tx_size / 256 + 1;
> + int queue;
> +
> + for (queue = 0; queue < txq_number; queue++) {
> + mvneta_txq_wrr_weight(pp, MVNETA_TXQ_WRR_ARB_REG(queue), weight);
> + mvneta_txq_wrr_weight(pp, MVETH_TXQ_WRR_ARB_REG(queue), weight);
> + }
> +}
> +
> +/* Only the traffic classes of an mqprio offload keep the fixed priority */
> +static void mvneta_txq_fixed_prio_set(struct mvneta_port *pp)
> +{
> + u32 val = pp->txq_fixed_prio ? MVNETA_TXQ_FIXED_PRIO_ALL : 0;
> +
> + mvreg_write(pp, MVNETA_TXQ_FIXED_PRIO_REG, val);
> + mvreg_write(pp, MVETH_TXQ_FIXED_PRIO_REG, val);
> +}
[Severity: Medium]
Is the version 1 arbiter on Armada 370/XP actually running WRR when these
registers are written?
In the same legacy 0x24xx block, mvneta_defaults_set() writes 0 to the v1
TXQ command register:
drivers/net/ethernet/marvell/mvneta.c:mvneta_defaults_set() {
...
/* Disable Legacy WRR, Disable EJP, Release from reset */
mvreg_write(pp, MVNETA_TXQ_CMD_1, 0);
...
}
That runs from mvneta_init() and mvneta_resume(), and nothing in this
patch sets MVNETA_TXQ_CMD_1 again. When an mqprio setup has no shaper, or
when the offload is removed, mvneta_disable_per_queue_rate_limit() sets
MVNETA_TXQ_CMD1_BW_LIM_SEL_V1, which selects the v1 algorithm.
Suppose the "Legacy WRR" bit in MVNETA_TXQ_CMD_1 is what turns on WRR in
the v1 arbiter. On 370/XP, would the weights written to
MVETH_TXQ_WRR_ARB_REG() then be ignored? Clearing MVETH_TXQ_FIXED_PRIO_REG
would also leave the arbiter in a mode the driver never programs, and the
multi-flow TX starvation could still happen on those boards.
The 256-byte unit used for the v1 weight field seems to depend on the same
assumption.
The commit message says only the Armada 385 was tested, and on that SoC
the two register sets are the same registers. That test doesn't exercise
the separate v1 path. Could this be checked against the Armada 370/XP
functional spec, or tested on 370/XP hardware?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118093012.90121-1-pepe.schlehofer%40gmail.com