[PATCH net-next v4 2/6] net: mvneta: fix the removal of the mqprio offload
From: Josef Schlehofer
Date: Wed Nov 18 2026 - 04:30:26 EST
Deleting an offloaded mqprio qdisc leaves its traffic classes and
per-queue rate limits in place:
tc qdisc add dev eth2 root handle 100: mqprio num_tc 2 \
map 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 queues 4@0 4@4 hw 1 \
mode channel shaper bw_rlimit max_rate 10Mbit 10Mbit
tc qdisc del dev eth2 root
mqprio_disable_offload() passes an all-zero configuration, so qopt.hw
is 0 and mvneta_setup_mqprio() returns before it reaches the teardown
code. Check qopt.hw only when traffic classes are set up.
With this fix, replacing an offloaded mqprio qdisc under a new handle
by another qdisc with traffic classes loses them. The replacement is
set up before the old qdisc is destroyed, and the teardown call does
not say which qdisc it belongs to. The old qdisc's teardown therefore
clears the traffic classes of the new one, and for a new offload also
its rate limits and RX queue mapping. tc then shows the new qdisc
without traffic classes. The core does the same when the old qdisc is
a software mqprio. A taprio qdisc left without traffic classes sends
nothing.
Triggered during code development. Reading mvneta_setup_mqprio()
showed the early return, and the commands above confirmed it on a
Turris Omnia (Armada 385) with a 100 Mbit/s link. Only TX queues 0-3
were used and the link carried 19 Mbit/s. With this patch and the
previous one the queues above 3 are used again and the link reaches
94 Mbit/s. No kernel selftest covers the mvneta mqprio offload.
Fixes: e7ca75fe6662 ("net: mvneta: Don't force-set the offloading flag")
Signed-off-by: Josef Schlehofer <pepe.schlehofer@xxxxxxxxx>
Reviewed-by: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
---
v4: Commit message only. Commands and discovery statement added, and
the replace paragraph also names the rate limits and the RX queue
mapping (Sashiko).
---
drivers/net/ethernet/marvell/mvneta.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index c0abc843b1c1..06b5453543a1 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;
+
if (num_tc > rxq_number)
return -EINVAL;
--
2.54.0 (Apple Git-157)