Re: [PATCH net-next v2 1/2] net: macb: implement ethtool_ops.get|set_channels()
From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-03-13 01:26:26
Also in:
lkml
From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-03-13 01:26:26
Also in:
lkml
On Wed, 11 Mar 2026 17:41:53 +0100 Théo Lebrun wrote:
+ struct macb *bp = netdev_priv(netdev); + unsigned int old_count = bp->num_queues; + unsigned int count = ch->combined_count; + int ret = 0;
unnecessary init
+ /* + * MACB_CAPS_QUEUE_DISABLE means that the field QUEUE_DISABLE/BIT0 in + * the per-queue RBQP register disables queue Rx. 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; + + /* + * An ideal .set_channels() implementation uses upfront allocated + * resources and swaps them in, bringing reliability under memory + * pressure. However, here we implement it for memory savings in + * setups with less than max number of queues active. + * + * Signal it by refusing .set_channels() once interface is opened. + */ + if (netif_running(bp->dev)) + return -EBUSY; + + if (count == old_count) + return 0;
should we reorder this with the running() check?