From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by mail.toke.dk (Postfix) with ESMTPS id E720C9C2CCD for ; Wed, 16 Nov 2022 21:43:01 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Yy5A5AFW Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4C028B81E8B; Wed, 16 Nov 2022 20:42:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B00CC433C1; Wed, 16 Nov 2022 20:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668631378; bh=2PSaNIlC/i6/awrIB1H4PHloF4KJB1K+tUqNH2kcX+A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Yy5A5AFWR6yHlYe6iMP14PABCTzTHsnNYQMiYiDWM+vkG02/S9KzqdLnR75rI32B+ CXtvj97rBDdQjs7Y4naiwFkPpJxSFFboIRdSBsewFFidvJN9U9GugT0eSgsX7qrw4e NcgSnwGdDxICrGMrEGs5dnEXmQI2wCLUKyQv+15rOgEEUHOuQXxTTUkAdmyAiLv/op B9lVofNeS2v/pBtaDxvlci766xO/x/zDo2f2umLCLHJCU2IQaC6pcBechR/T3sjt9w +o+wJEmHO/chrwZ54k6NH76eU9AYFrgJ5s3waAWVeWtxk0AFucIdAzWvWbZj7/3Yzr a0SlNku7Tte9w== Date: Wed, 16 Nov 2022 12:42:56 -0800 From: Jakub Kicinski To: Stanislav Fomichev Message-ID: <20221116124256.04a75fba@kernel.org> In-Reply-To: <20221115030210.3159213-4-sdf@google.com> References: <20221115030210.3159213-1-sdf@google.com> <20221115030210.3159213-4-sdf@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: A72CXIK7WXX5MC3ABJTIX4LKPJZ4IM2U X-Message-ID-Hash: A72CXIK7WXX5MC3ABJTIX4LKPJZ4IM2U X-MailFrom: kuba@kernel.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, David Ahern , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.6 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next 03/11] bpf: Support inlined/unrolled kfuncs for xdp metadata List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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?