🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #4907

Re: [PATCH net-next v5 2/3] net: macb: implement ethtool_ops.get|set_channels()

#4907
From: Nicolai Buchwitz
Date: Mon, 19 Oct 2026 12:52
91 lines
9049 bytes
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
Technical Details
Message-ID: <45fae7a00024b7d07cd3250d4f2b5b48@tipi-net.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348513-linux-kernel-netdev=dewy.ru
References: <20261016-macb-set-channels-v5-0-90ce0c0b8e75@bootlin.com> <20261016-macb-set-channels-v5-2-90ce0c0b8e75@bootlin.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348513-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <45fae7a00024b7d07cd3250d4f2b5b48@tipi-net.de>
References: <20261016-macb-set-channels-v5-0-90ce0c0b8e75@bootlin.com>
 <20261016-macb-set-channels-v5-2-90ce0c0b8e75@bootlin.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3605376"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:h+ee5PFpDrEXc1wwuKBnzv+97S4= sha256:e1zIyyBrlC9ZgJVghIKkob5tWqeLNgN7XWSDfEl4W8Q=
	sha1:eK5XB6Uxo/Kjyhg2Y+/fW2GpE3Y= sha256:KkHaECpAitPDDHQQEekeKVudPkz89kASEKytFVMbF4w=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id E369C1109E6; Mon, 19 Oct 2026 15:53:01 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=tipi-net.de
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id E32XKa38OP-2;
	Mon, 19 Oct 2026 15:52:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-348513-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 624B31109A8; Mon, 19 Oct 2026 15:52:40 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sin.lore.kernel.org (Postfix) with ESMTP id 4DD1426589; Mon, 19 Oct 2026 12:52:37 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B08963AF66F;
	Mon, 19 Oct 2026 12:52:35 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b="ujuL6CZX"
X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C15633DDDD2;
	Mon, 19 Oct 2026 12:52:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.13.80.246
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792414355; cv=none; b=PIbOpbTpmolv4qdbaVUYMjzOdyU3o3XMekJr21qT+ER48FICMTq3lvCVkgtq31GgQrPVMHRdx6aJ/DQBZERggxyD4ivYa5fOjrRSrE3UYNX7mWWPfOuzyTwoB2ZT47OUWM1E3JJkchDxxTz13nzVXC3C0HIKDlKjtJhgPznoTQ0=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792414355; c=relaxed/simple;
	bh=w2VeGlZBbxG5ZCWetKbFg1zbEFOtnl5wOp6izwN0bcE=;
	h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References:
	 Message-ID:Content-Type; b=Jff9jMaQ8L0VC0hcLmdL3VU/E4sbeaoWOs8FgCew6ZK6lbIkwtjBevofD0ROO/GVpzY3AozFkwlSg0alK2/EgY3fgHp5/wWjh8O8lIStl5FxleIBIXbGBBM2pP1tyIcVTO8/0aK9pkiZBw8L5W1bBk5wNjoMY8UfkQb1/w4ocIY=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b=ujuL6CZX; arc=none smtp.client-ip=194.13.80.246
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de
X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D4296A156C;
	Mon, 19 Oct 2026 14:52:28 +0200 (CEST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim;
	t=1792414350; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:in-reply-to:references;
	bh=sTQ3s+VlvanVN3XiSVNNqOr6UbCLcC2uXpq+HoxI8yc=;
	b=ujuL6CZXalo6dl7tL/6ltG4pKz8ikd8pFuS2aTt5Un/30uziovbwzuhPVV5gBA9zmEx+Y4
	S79/WcnjeZ32BqiOkIgl2EdHBMIzwHHyLzmhpF6+5tDZxmojkHi78f1PuGnFdSXPq55HSq
	V+KTKQaomc4+BDpUMeo2Fbr2UjcnMozEkKeLZykw6VcPJrpFK5vEI4qWDhLqBK4o1fIXEp
	oaX8QCKqF/1z4HUwxSIJ3Ju9ZTcO+rMVSVtbTGivtE1Y/hvnVN93r+tQI8/CHgo17Rcl+E
	GKWSakVoVVQsb8DxzWEIvcN16uT/t7+leyeB34XbkSf7JiwpuzxjUZWzfWAeFw==
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-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>
X-In-Reply-To: <20261016-macb-set-channels-v5-2-90ce0c0b8e75@bootlin.com>
X-Sender: nb@tipi-net.de
X-Last-TLS-Session-Version: TLSv1.3