Subject: Re: [RFC PATCH net-next 2/6] net: ethtool: record custom RSS contexts in the IDR

From: Jakub Kicinski <[email-masked]>
Date: Mon, 3 Apr 2023 14:48:39 -0700

On Mon, 3 Apr 2023 17:32:59 +0100 [email-masked] wrote:
> @@ -880,6 +896,7 @@ struct ethtool_ops {
>  			    u8 *hfunc);
>  	int	(*set_rxfh)(struct net_device *, const u32 *indir,
>  			    const u8 *key, const u8 hfunc);
> +	u16	(*get_rxfh_priv_size)(struct net_device *);
>  	int	(*get_rxfh_context)(struct net_device *, u32 *indir, u8 *key,
>  				    u8 *hfunc, u32 rss_context);
>  	int	(*set_rxfh_context)(struct net_device *, const u32 *indir,

Would a static value not do for most drivers?
We already have a handful of data fields in the "ops" structure.

> @@ -1331,6 +1335,31 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
>  		}
>  	}
>  
> +	if (create) {
> +		if (delete) {
> +			ret = -EINVAL;
> +			goto out;
> +		}
> +		ctx = kzalloc(ethtool_rxfh_context_size(dev_indir_size,
> +							dev_key_size,
> +							dev_priv_size),
> +			      GFP_USER);

GFP_USER? Do you mean it for accounting? GFP_KERNEL_ACCOUNT?