mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Josef Schlehofer <pepe.schlehofer@gmail.com>, netdev@vger.kernel.org
Cc: marcin.s.wojtas@gmail.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, w@1wt.eu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 4/5] net: mvneta: unwind a failed mqprio setup
Date: Tue, 3 Nov 2026 20:01:15 +0100	[thread overview]
Message-ID: <5d71380c-9549-4563-9caf-df0784c77516@bootlin.com> (raw)
In-Reply-To: <20261103125021.70845-5-pepe.schlehofer@gmail.com>

Hi,

On 11/3/26 13:50, Josef Schlehofer wrote:
> A failed mqprio offload setup leaves part of its configuration in the
> hardware. For example, when one max_rate is not a multiple of
> 10 kbit/s, the command fails but the TX queues set up before it stay
> rate limited.
> 
> mvneta_setup_mqprio() returns on an invalid queue range or rate after
> it has already mapped RX queues, switched the rate limit mode and set
> the rates of some TX queues. The qdisc then fails to attach and the
> driver is not called again, so nothing removes them.
> 
> Undo the RX queue mapping, the rate limits and the traffic classes
> when the setup fails.
> 
> Tested on a Turris Omnia (Armada 385). After mqprio failed on a
> max_rate of 10001kbit, TX queues 0-3 stayed limited to 10 Mbit/s and
> the VLAN priority map stayed set. With this patch neither is left
> behind.
> 
> Fixes: e9f7099d0730 ("net: mvneta: Allow having more than one queue per TC")
> Fixes: 2551dc9e398c ("net: mvneta: Add TC traffic shaping offload")
> Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime

> ---
>  drivers/net/ethernet/marvell/mvneta.c | 28 +++++++++++++++++++--------
>  1 file changed, 20 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index 75d46349df37..d3a6bf8f383e 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -5299,8 +5299,10 @@ static int mvneta_setup_mqprio(struct net_device *dev,
>  		for (rxq = mqprio->qopt.offset[tc];
>  		     rxq < mqprio->qopt.count[tc] + mqprio->qopt.offset[tc];
>  		     rxq++) {
> -			if (rxq >= rxq_number)
> -				return -EINVAL;
> +			if (rxq >= rxq_number) {
> +				ret = -EINVAL;
> +				goto err;
> +			}
>  
>  			mvneta_map_vlan_prio_to_rxq(pp, tc, rxq);
>  		}
> @@ -5311,29 +5313,39 @@ static int mvneta_setup_mqprio(struct net_device *dev,
>  		return 0;
>  	}
>  
> -	if (mqprio->qopt.num_tc > txq_number)
> -		return -EINVAL;
> +	if (mqprio->qopt.num_tc > txq_number) {
> +		ret = -EINVAL;
> +		goto err;
> +	}
>  
>  	ret = mvneta_enable_per_queue_rate_limit(pp);
>  	if (ret)
> -		return ret;
> +		goto err;
>  
>  	for (tc = 0; tc < mqprio->qopt.num_tc; tc++) {
>  		for (txq = mqprio->qopt.offset[tc];
>  		     txq < mqprio->qopt.count[tc] + mqprio->qopt.offset[tc];
>  		     txq++) {
> -			if (txq >= txq_number)
> -				return -EINVAL;
> +			if (txq >= txq_number) {
> +				ret = -EINVAL;
> +				goto err;
> +			}
>  
>  			ret = mvneta_setup_queue_rates(pp, txq,
>  						       mqprio->min_rate[tc],
>  						       mqprio->max_rate[tc]);
>  			if (ret)
> -				return ret;
> +				goto err;
>  		}
>  	}
>  
>  	return 0;
> +
> +err:
> +	mvneta_clear_rx_prio_map(pp);
> +	mvneta_disable_per_queue_rate_limit(pp);
> +	netdev_reset_tc(dev);
> +	return ret;
>  }
>  
>  static int mvneta_setup_tc(struct net_device *dev, enum tc_setup_type type,


  reply	other threads:[~2026-11-03 19:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 12:50 [PATCH net v2 0/5] net: mvneta: fix the TX queue arbitration and the mqprio offload Josef Schlehofer
2026-11-03 12:50 ` [PATCH net v2 1/5] net: mvneta: lift the per-queue TX rate limits Josef Schlehofer
2026-11-03 18:56   ` Maxime Chevallier
2026-11-03 12:50 ` [PATCH net v2 2/5] net: mvneta: fix the removal of the mqprio offload Josef Schlehofer
2026-11-03 19:00   ` Maxime Chevallier
2026-11-03 12:50 ` [PATCH net v2 3/5] net: mvneta: serve the TX queues in weighted round robin Josef Schlehofer
2026-11-03 12:50 ` [PATCH net v2 4/5] net: mvneta: unwind a failed mqprio setup Josef Schlehofer
2026-11-03 19:01   ` Maxime Chevallier [this message]
2026-11-03 12:50 ` [PATCH net v2 5/5] net: mvneta: keep the TX rate limits across open and MTU change Josef Schlehofer
2026-11-03 18:56 ` [PATCH net v2 0/5] net: mvneta: fix the TX queue arbitration and the mqprio offload Maxime Chevallier

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=5d71380c-9549-4563-9caf-df0784c77516@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --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=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®