Re: [PATCH net-next v4 2/6] net: mvneta: fix the removal of the mqprio offload
From: netdev-bot+sashiko
Date: Sat Nov 21 2026 - 18:03:02 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] After this patch, every all-zero mqprio teardown runs the full
device-wide reset in mvneta_setup_mqprio()…
--
net: mvneta: fix the removal of the mqprio offload
This patch changes mvneta_setup_mqprio() so that qopt.hw is checked only
when num_tc is non-zero. The all-zero teardown from
mqprio_disable_offload() can then reach the code that clears the RX prio
map, the per-queue rate limits and the netdev TC state.
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index c0abc843b1c1a..06b5453543a19 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -5251,11 +5251,12 @@ static int mvneta_setup_mqprio(struct net_device *dev,
> int rxq, txq, tc, ret;
> u8 num_tc;
>
> - if (mqprio->qopt.hw != TC_MQPRIO_HW_OFFLOAD_TCS)
> - return 0;
> -
> num_tc = mqprio->qopt.num_tc;
>
> + /* On removal the qdisc passes an all-zero qopt, with hw 0 */
> + if (num_tc && mqprio->qopt.hw != TC_MQPRIO_HW_OFFLOAD_TCS)
> + return 0;
> +
[Severity: Medium]
Can this wipe the configuration of a replacement qdisc? Since the hw
check is now skipped when num_tc == 0, every all-zero teardown goes on
to the device-wide reset further down in mvneta_setup_mqprio():
mvneta_clear_rx_prio_map(pp);
if (!num_tc) {
mvneta_disable_per_queue_rate_limit(pp);
netdev_reset_tc(dev);
return 0;
}
The teardown from mqprio_disable_offload() in net/sched/sch_mqprio.c is
an all-zero struct tc_mqprio_qopt_offload. It does not say which qdisc
instance it belongs to.
Take a replace under a new handle, for example:
tc qdisc replace dev eth2 root handle 200: mqprio ... hw 1
The calls then happen in this order:
qdisc_create()
mqprio_init()
mqprio_enable_offload()
mvneta_setup_mqprio(num_tc=N, hw=1) <- new config programmed
qdisc_graft()
rcu_assign_pointer(dev->qdisc, new ? : &noop_qdisc);
notify_and_destroy(old)
mqprio_destroy(old)
mqprio_disable_offload(old)
mvneta_setup_mqprio(num_tc=0) <- new config cleared
new->ops->attach(new) <- offload not reprogrammed
A software taprio replacement sets its TCs with netdev_set_num_tc() in
taprio_change() before the old offloaded mqprio is destroyed. The
netdev_reset_tc() above then undoes them.
In that case, would a new offloaded mqprio end up without its traffic
classes, its MVNETA_VLAN_PRIO_TO_RXQ mapping and its TX rate limits,
while its priv->hw_offload still reads 1? And would a taprio left
without TCs stop sending?
Before this patch, the early return on hw != TC_MQPRIO_HW_OFFLOAD_TCS
made this teardown a no-op, so the replacement kept its configuration.
The commit message describes this behaviour. The root cause looks like
it is in the qdisc core: it destroys the old qdisc after the new one is
set up, and its teardown does not name the qdisc.
Several other drivers reset the same way on num_tc == 0:
enetc_setup_tc_mqprio(), ocelot_port_mqprio(), am65_cpsw_setup_mqprio(),
dpaa_setup_tc(), dpaa2_eth_setup_mqprio() and bnx2x_setup_tc().
At the end of the series, mvneta_setup_mqprio() still does the full
reset for every num_tc == 0 call.
Would a proper fix need the core to identify the qdisc in the teardown
call, so the removal fix does not cause a regression on replace?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118093012.90121-1-pepe.schlehofer%40gmail.com