Subject: Re: [PATCH net-next v5 7/8] net: wangxun: add ethtool_ops for channel number

From: Jakub Kicinski <[email-masked]>
Date: Fri, 15 Dec 2023 18:41:07 -0800

On Thu, 14 Dec 2023 10:54:55 +0800 Jiawen Wu wrote:
> +	if (!(wx->msix_q_entries)) {

pointless brackets

> +void wx_get_channels(struct net_device *dev,
> +		     struct ethtool_channels *ch)
> +{
> +	struct wx *wx = netdev_priv(dev);
> +
> +	/* report maximum channels */
> +	ch->max_combined = wx_max_channels(wx);
> +
> +	/* report info for other vector */
> +	if (wx->msix_q_entries) {
> +		ch->max_other = 1;
> +		ch->other_count = 1;
> +	}
> +
> +	/* record RSS queues */
> +	ch->combined_count = wx->ring_feature[RING_F_RSS].indices;
> +
> +	/* nothing else to report if RSS is disabled */
> +	if (ch->combined_count == 1)
> +		return;

pointless return

> +}
> +EXPORT_SYMBOL(wx_get_channels);
> +
> +int wx_set_channels(struct net_device *dev,
> +		    struct ethtool_channels *ch)
> +{
> +	unsigned int count = ch->combined_count;
> +	struct wx *wx = netdev_priv(dev);
> +
> +	/* verify they are not requesting separate vectors */
> +	if (!count || ch->rx_count || ch->tx_count)
> +		return -EOPNOTSUPP;

core shouldn't allow this to reach you