mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: pepe.schlehofer@gmail.com
Cc: netdev@vger.kernel.org, marcin.s.wojtas@gmail.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com,
	maxime.chevallier@bootlin.com, w@1wt.eu,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 2/6] net: mvneta: fix the removal of the mqprio offload
Date: Sat, 21 Nov 2026 23:02:53 +0000	[thread overview]
Message-ID: <179530217303.3135.1162900771508007234@kernel.org> (raw)
In-Reply-To: <20261118093012.90121-3-pepe.schlehofer@gmail.com>

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

  reply	other threads:[~2026-11-21 23:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  9:30 [PATCH net-next v4 0/6] net: mvneta: fix the TX queue arbitration and " Josef Schlehofer
2026-11-18  9:30 ` [PATCH net-next v4 1/6] net: mvneta: lift the per-queue TX rate limits Josef Schlehofer
2026-11-18  9:30 ` [PATCH net-next v4 2/6] net: mvneta: fix the removal of the mqprio offload Josef Schlehofer
2026-11-21 23:02   ` netdev-bot+sashiko [this message]
2026-11-18  9:30 ` [PATCH net-next v4 3/6] net: mvneta: check the TX queue range of an " Josef Schlehofer
2026-11-18  9:30 ` [PATCH net-next v4 4/6] net: mvneta: keep the TX rate limits across open and MTU change Josef Schlehofer
2026-11-21 23:02   ` netdev-bot+sashiko
2026-11-18  9:30 ` [PATCH net-next v4 5/6] net: mvneta: validate an mqprio setup before applying it Josef Schlehofer
2026-11-18  9:30 ` [PATCH net-next v4 6/6] net: mvneta: serve the TX queues in weighted round robin Josef Schlehofer
2026-11-21 23:02   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179530217303.3135.1162900771508007234@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin.s.wojtas@gmail.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pepe.schlehofer@gmail.com \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®