Subject: Re: [PATCH bpf-next 03/11] bpf: Support inlined/unrolled kfuncs for xdp metadata

From: Jakub Kicinski <[email-masked]>
Date: Wed, 16 Nov 2022 12:42:56 -0800

On Mon, 14 Nov 2022 19:02:02 -0800 Stanislav Fomichev wrote:
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 117e830cabb0..a2227f4f4a0b 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -9258,6 +9258,13 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
>  			return -EOPNOTSUPP;
>  		}
>  
> +		if (new_prog &&
> +		    new_prog->aux->xdp_kfunc_ndo &&
> +		    new_prog->aux->xdp_kfunc_ndo != dev->netdev_ops) {
> +			NL_SET_ERR_MSG(extack, "Cannot attach to a different target device");
> +			return -EINVAL;
> +		}

This chunk can go up into the large

	if (new_prog) {
		...

list of checks?

nit: aux->xdp_kfunc_ndo sounds like you're storing the kfunc NDO,
     not all ndos. Throw in an 's' at the end, or some such?