Re: [PATCH net-next v4 4/6] net: mvneta: keep the TX rate limits across open and MTU change
From: netdev-bot+sashiko
Date: Sat Nov 21 2026 - 18:03:06 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] In this patch, a rejected mqprio shaper config leaves the new
`bucket_refill` copy set, and `mvneta_restore_per_queue_rate_limit()`…
--
net: mvneta: keep the TX rate limits across open and MTU change
This commit saves the refill value of each rate limited TX queue in a new
bucket_refill field of struct mvneta_tx_queue. A new helper,
mvneta_restore_per_queue_rate_limit(), writes the limits back from
mvneta_start_dev(). Before this, mvneta_txq_hw_init() reset every limit to
10.23 Mbit/s after ifup, an MTU change or resume.
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index 76dfbc484269e..58453c69be361 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
[ ... ]
> @@ -5239,11 +5247,32 @@ static int mvneta_setup_queue_rates(struct mvneta_port *pp, int queue,
> val |= (MVNETA_TXQ_BUCKET_REFILL_PERIOD <<
> MVNETA_TXQ_BUCKET_REFILL_PERIOD_SHIFT);
>
> + pp->txqs[queue].bucket_refill = val;
> mvreg_write(pp, MVNETA_TXQ_BUCKET_REFILL_REG(queue), val);
>
> return 0;
> }
[Severity: Medium]
Can a rejected mqprio shaper config leave bucket_refill set for some
queues?
mvneta_setup_mqprio() calls mvneta_setup_queue_rates() one traffic class
at a time. If a later class fails (nonzero min_rate, a rate that is not a
multiple of 10 kbit/s, zero, or above the maximum), it returns in the
middle of the loop:
mvneta_setup_mqprio() {
...
ret = mvneta_setup_queue_rates(pp, txq,
mqprio->min_rate[tc],
mqprio->max_rate[tc]);
if (ret)
return ret;
...
}
The queues of the earlier classes keep a nonzero bucket_refill.
In net/sched/sch_mqprio.c, mqprio_enable_offload() sets priv->hw_offload
only when the offload succeeds. So mqprio_destroy() takes the
netdev_set_num_tc(dev, 0) branch and does not call the driver with
num_tc == 0.
That means mvneta_disable_per_queue_rate_limit() never runs, and it is
the only place that clears bucket_refill. This also breaks the "0 when
not limited" comment on the new field.
For example:
tc qdisc add ... mqprio ... hw 1 mode channel shaper bw_rlimit \
max_rate 10Mbit 10001kbit
mvneta_setup_mqprio()
class 0 sets bucket_refill for its queues
class 1 returns -EINVAL
hw_offload stays 0, mqprio_destroy() does not call the driver
ip link set dev ... down; ip link set dev ... up (or an MTU change)
mvneta_start_dev()
mvneta_restore_per_queue_rate_limit()
> +/* The TX queue setup overwrites the rate limits, program them again */
> +static void mvneta_restore_per_queue_rate_limit(struct mvneta_port *pp)
> +{
> + int queue;
> +
> + for (queue = 0; queue < txq_number; queue++) {
> + if (pp->txqs[queue].bucket_refill)
> + break;
> + }
> +
> + if (queue == txq_number || mvneta_enable_per_queue_rate_limit(pp))
> + return;
> +
> + for (; queue < txq_number; queue++) {
> + if (pp->txqs[queue].bucket_refill)
> + mvreg_write(pp, MVNETA_TXQ_BUCKET_REFILL_REG(queue),
> + pp->txqs[queue].bucket_refill);
> + }
> +}
At every later mvneta_start_dev(), would this find the leftover entries,
turn the v3 limiter back on, and write back the limits of the rejected
config?
No mqprio qdisc is installed at that point, so tc cannot show or delete
these limits. Installing and then deleting a valid shaper is the only way
to clear them.
Before this patch, a rejected config already left the hardware partly
configured, but that state did not survive a port restart.
The next patch in the series, "net: mvneta: validate an mqprio setup
before applying it", appears to fix this. With it, mvneta_setup_mqprio()
validates every class with mvneta_txq_refill_val() before touching the
hardware, and bucket_refill is written only after that.
Both patches carry the same Fixes: tag. Should they go to stable together,
or should this patch only store bucket_refill once the whole config has
been accepted?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118093012.90121-1-pepe.schlehofer%40gmail.com