Subject: Re: [RFC PATCH v2 net-next 2/7] net: ethtool: attach an IDR of custom RSS contexts to a netdevice

From: Jakub Kicinski <[email-masked]>
Date: Wed, 12 Apr 2023 18:39:22 -0700

On Tue, 11 Apr 2023 19:26:10 +0100 [email-masked] wrote:
> +static void netdev_rss_contexts_free(struct net_device *dev)
> +{
> +	struct ethtool_rxfh_context *ctx;
> +	u32 context;
> +
> +	if (!dev->ethtool_ops->set_rxfh_context)
> +		return;
> +	idr_for_each_entry(&dev->ethtool->rss_ctx, ctx, context) {
> +		u32 *indir = ethtool_rxfh_context_indir(ctx);
> +		u8 *key = ethtool_rxfh_context_key(ctx);
> +
> +		idr_remove(&dev->ethtool->rss_ctx, context);
> +		dev->ethtool_ops->set_rxfh_context(dev, indir, key, ctx->hfunc,
> +						   &context, true);
> +		kfree(ctx);
> +	}
> +}

nit: maybe move the ethtool related code out to a new
net/ethtool/netdev.c ? We can probably put forward declarations 
in net/core/dev.h or a new header among sources?