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

From: Jakub Kicinski <[email-masked]>
Date: Fri, 6 Mar 2026 19:09:48 -0800

On Thu, 05 Mar 2026 18:20:14 +0100 Théo Lebrun wrote:
> +	if (!(bp->caps & MACB_CAPS_QUEUE_DISABLE))
> +		return -EOPNOTSUPP;

Why not set max to 1 in this case?

> +	if (!count || ch->rx_count || ch->tx_count)
> +		return -EINVAL;

Core should check this for you already

> +	if (count > bp->max_num_queues)
> +		return -EINVAL;

and this

> +	if (count == old_count)
> +		return 0;
> +
> +	if (running)
> +		macb_close(bp->dev);
> +
> +	bp->num_queues = count;
> +	netif_set_real_num_queues(bp->dev, count, count);
> +
> +	if (running) {
> +		ret = macb_open(bp->dev);
> +		if (ret) {
> +			bp->num_queues = old_count;
> +			netif_set_real_num_queues(bp->dev, old_count, old_count);
> +			macb_open(bp->dev);

both macb_open() calls may fail under memory pressure
For new functionality we ask drivers to allocate all necessary
resources upfront then just swap them in and reconfigure HW
-- 
pw-bot: cr