Subject: Re: [PATCH net-next v4 1/2] net: macb: implement ethtool_ops.get|set_channels()

From: Jakub Kicinski <[email-masked]>
Date: Wed, 18 Mar 2026 19:38:26 -0700

On Tue, 17 Mar 2026 17:19:08 +0100 Théo Lebrun wrote:
> +static int macb_set_channels(struct net_device *netdev,
> +			     struct ethtool_channels *ch)
> +{
> +	struct macb *bp = netdev_priv(netdev);
> +	unsigned int old_count = bp->num_queues;
> +	unsigned int count = ch->combined_count;
> +	int ret;
> +
> +	/*
> +	 * 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;
> +
> +	ret = netif_set_real_num_queues(bp->dev, count, count);
> +	if (ret)
> +		return ret;
> +
> +	bp->num_queues = count;
> +	return 0;
> +}

Looks like some left over here:

drivers/net/ethernet/cadence/macb_main.c:4173:15: warning: unused variable 'old_count' [-Wunused-variable]
 4173 |         unsigned int old_count = bp->num_queues;
      |                      ^~~~~~~~~