Subject: Re: [RFC net-next 18/22] net: wipe the setting of deactived queues

From: Stanislav Fomichev <[email-masked]>
Date: Tue, 22 Apr 2025 09:21:54 -0700

On 04/21, Jakub Kicinski wrote:
> Clear out all settings of deactived queues when user changes
> the number of channels. We already perform similar cleanup
> for shapers.
> 
> Signed-off-by: Jakub Kicinski <[email-masked]>
> ---
>  net/core/dev.h           |  2 ++
>  net/core/dev.c           |  5 +++++
>  net/core/netdev_config.c | 13 +++++++++++++
>  3 files changed, 20 insertions(+)
> 
> diff --git a/net/core/dev.h b/net/core/dev.h
> index e0d433fb6325..4cdd8ac7df4f 100644
> --- a/net/core/dev.h
> +++ b/net/core/dev.h
> @@ -101,6 +101,8 @@ void __netdev_queue_config(struct net_device *dev, int rxq,
>  			   struct netdev_queue_config *qcfg, bool pending);
>  int netdev_queue_config_revalidate(struct net_device *dev,
>  				   struct netlink_ext_ack *extack);
> +void netdev_queue_config_update_cnt(struct net_device *dev, unsigned int txq,
> +				    unsigned int rxq);
>  
>  /* netdev management, shared between various uAPI entry points */
>  struct netdev_name_node {
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 7930b57d1767..c1f9b6ce6500 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3188,6 +3188,8 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)
>  		if (dev->num_tc)
>  			netif_setup_tc(dev, txq);
>  
> +		netdev_queue_config_update_cnt(dev, txq,
> +					       dev->real_num_rx_queues);
>  		net_shaper_set_real_num_tx_queues(dev, txq);
>  
>  		dev_qdisc_change_real_num_tx(dev, txq);
> @@ -3234,6 +3236,9 @@ int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq)
>  						  rxq);
>  		if (rc)
>  			return rc;
> +
> +		netdev_queue_config_update_cnt(dev, dev->real_num_tx_queues,
> +					       rxq);
>  	}
>  
>  	dev->real_num_rx_queues = rxq;
> diff --git a/net/core/netdev_config.c b/net/core/netdev_config.c
> index ede02b77470e..c5ae39e76f40 100644
> --- a/net/core/netdev_config.c
> +++ b/net/core/netdev_config.c
> @@ -64,6 +64,19 @@ int netdev_reconfig_start(struct net_device *dev)
>  	return -ENOMEM;
>  }
>  
> +void netdev_queue_config_update_cnt(struct net_device *dev, unsigned int txq,
> +				    unsigned int rxq)
> +{

Presumably txq argument is here for some potential future use cases?