mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: "Théo Lebrun" <theo.lebrun@bootlin.com>
Cc: "Conor Dooley" <conor.dooley@microchip.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Paolo Valerio" <pvalerio@redhat.com>,
	"Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
	"Gregory CLEMENT" <gregory.clement@bootlin.com>,
	"Benoît Monin" <benoit.monin@bootlin.com>,
	"Tawfik Bayouk" <tawfik.bayouk@mobileye.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH net-next v5 2/3] net: macb: implement ethtool_ops.get|set_channels()
Date: Mon, 19 Oct 2026 14:52:28 +0200	[thread overview]
Message-ID: <45fae7a00024b7d07cd3250d4f2b5b48@tipi-net.de> (raw)
In-Reply-To: <20261016-macb-set-channels-v5-2-90ce0c0b8e75@bootlin.com>

Hi Théo

On 16.10.2026 18:58, Théo Lebrun wrote:
> bp->num_queues is the total number of queues and is constant from 
> probe.
> Introduce bp->max_num_queues which takes the current role of
> bp->num_queues and allow `0 < bp->num_queues <= bp->max_num_queues`.
> MACB/GEM does not know about Rx/Tx specific queues; it only has
> combined queues.
> 
> set_channels is reserved to devices with MACB_CAPS_QUEUE_DISABLE.
> The tieoff workaround would not work as packets would still be routed
> into queues with a tieoff descriptor.
> 
> Implement .set_channels() operation by refusing if netif_running(). We
> need context-swapping support upstream for proper on-the-fly channel
> count change.
> 
> Note we refuse the operation if any TAPRIO rules are in place on queues
> that would get disabled. If we allow the operation to take place, then
> a transmission window would be reserved but unusable.
> 
> Nit: fix an alignment issue inside gem_ethtool_ops which does not
> deserve its own patch.
> 
> Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
> ---

> [...]

> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c

> [...]

> +static int macb_set_channels(struct net_device *netdev,
> +			     struct ethtool_channels *ch)
> +{
> +	struct macb *bp = netdev_priv(netdev);
> +	unsigned int count = ch->combined_count;
> +	int ret;
> +
> +	/* MACB_CAPS_QUEUE_DISABLE means that the field QUEUE_DISABLE/BIT0 in
> +	 * the per-queue RBQP/TBQP registers disable Tx/Rx queues. If we 
> don't
> +	 * have that capability we can have multiple queues but we must 
> always
> +	 * run with all enabled.
> +	 */
> +	if (!(bp->caps & MACB_CAPS_QUEUE_DISABLE))
> +		return -EOPNOTSUPP;
> +
> +	/* TODO: reuse context swapping once it is merged. */

Once context swapping is merged, this needs to be addressed in v6 ;-)

> +	if (netif_running(bp->netdev))
> +		return -EBUSY;
> +
> +	/* If we allow disable a queue which has TAPRIO active, we'll keep a
> +	 * transmission window which will be unusable.
> +	 */
> +	if (bp->taprio_gated_queues >> count) {
> +		netdev_err(bp->netdev, "TAPRIO schedule gates queues >= %u; destroy 
> the qdisc before reducing channels\n",
> +			   count);
> +		return -EBUSY;
> +	}

I think this can get stuck:

- delete the  taprio qdisc after the link has been down for a while
- device is is runtime suspend
- taprio setup bails out before _destroy() is called
- ethtool -L keeps failing with -EBUSY, even though there is no qdisc 
anymore

Something like:

   ip link set eth0 up
   tc qdisc replace dev eth0 root taprio ... flags 0x2
   ip link set eth0 down
   sleep 1
   tc qdisc del dev eth0 root
   ethtool -L eth0 combined 1

> [...]

Thanks,
Nicolai

  reply	other threads:[~2026-10-19 12:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 16:58 [PATCH net-next v5 0/3] net: macb: implement ethtool set channels count operation Théo Lebrun
2026-10-16 16:58 ` [PATCH net-next v5 1/3] net: macb: add QUEUE_DISABLE capability to 3 compatibles Théo Lebrun
2026-10-19 11:32   ` Nicolai Buchwitz
2026-10-16 16:58 ` [PATCH net-next v5 2/3] net: macb: implement ethtool_ops.get|set_channels() Théo Lebrun
2026-10-19 12:52   ` Nicolai Buchwitz [this message]
2026-10-16 16:58 ` [PATCH net-next v5 3/3] net: macb: distribute evenly Tx SRAM segments Théo Lebrun
2026-10-19 12:58   ` Nicolai Buchwitz

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=45fae7a00024b7d07cd3250d4f2b5b48@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=benoit.monin@bootlin.com \
    --cc=conor.dooley@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pvalerio@redhat.com \
    --cc=tawfik.bayouk@mobileye.com \
    --cc=theo.lebrun@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.kondratiev@mobileye.com \
    /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®