From patchwork Wed Jan 25 00:33:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1731488 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=ECW3G1dq; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P1lGK1JlPz23h0 for ; Wed, 25 Jan 2023 11:34:33 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6B0DF41833; Wed, 25 Jan 2023 00:34:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 6B0DF41833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1674606871; bh=BWkhUVqkbodLL9houEAevjwPt/7dSy6s8+yGgpb1WkM=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=ECW3G1dqh4WUj9lvHo8PwSryWJUxm07GhC4kM4dqfAnTv2ulyLMjJi7lzBGFVMC2v PkGh8HU2jRRl+9E8K//h698/6BRVUuhBMO9RCewttV8C3aGASP5MWv3z1lvwLdikS2 74c/pC6zTMwhsQbbTdsYhfQ32bEIqSvMslkfVin9+E1cxEMyAuDr2mDdb7WoZxCyaZ S/beS2pPnNsHNXN3wtAo7Et2QXTIQP7aCTqfcWATT7b5SvdD2SY+V10dQgZOdltSWj UJbAITrLXnIKaNA7lr29hXtX4rfBROSUGUSYj6tJNL7bFD5oAvEnBiG/IrZsXd3MH7 nSP+SM42zNplg== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PPqwHIrnY9R0; Wed, 25 Jan 2023 00:34:30 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 473304168A; Wed, 25 Jan 2023 00:34:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 473304168A X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id B55361BF3F0 for ; Wed, 25 Jan 2023 00:34:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8E57F4168A for ; Wed, 25 Jan 2023 00:34:28 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 8E57F4168A X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NyW0-b38DjSv for ; Wed, 25 Jan 2023 00:34:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9686E417C2 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by smtp4.osuosl.org (Postfix) with ESMTPS id 9686E417C2 for ; Wed, 25 Jan 2023 00:34:27 +0000 (UTC) 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 CD791B81733; Wed, 25 Jan 2023 00:34:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04C9BC433D2; Wed, 25 Jan 2023 00:34:24 +0000 (UTC) From: Lorenzo Bianconi To: bpf@vger.kernel.org Date: Wed, 25 Jan 2023 01:33:23 +0100 Message-Id: <20c7b0767c2e3be8c33bfcfe1e0de9e6eb3a5e9a.1674606197.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674606864; bh=EUEjHYCFZLBlSjnOAZ24J2T1iHJ/3Lz1NQeBwSmXZYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GMwX62gt4ITzzk3rY5tg2EFzZ9G+Udi8BUSmZjK4rc8WDvHoHR0pbX5iu8VLOcAnE U43FA1NZejxjhU3cUa6uilIravyKEREZJRs1JsFMT/an3pP4yU2tO0OtKmRlpXPOdj 04Wtq+HkthUXhulWEzC2FwIUtwMlAcmaJ38dY13gQA6e/uVQDXEtkPq+d8rIxYAQNy hid7k8TeT+0qh/aHSSamapypsyQqqLbg1TmrftVmpF9ifw9weW3Q57rqucPRm/DmSc S37nwXek2KQ85RudakRAfLPWQeeQWKk3zg2N+9qqSWZQUFbEjVwfQyZ9EfikcjETC/ YxAxOyYMA9YbQ== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=GMwX62gt Subject: [Intel-wired-lan] [PATCH v2 bpf-next 3/8] xsk: add usage of XDP features flags X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mst@redhat.com, vladimir.oltean@nxp.com, ast@kernel.org, edumazet@google.com, anthony.l.nguyen@intel.com, daniel@iogearbox.net, andrii@kernel.org, intel-wired-lan@lists.osuosl.org, simon.horman@corigine.com, kuba@kernel.org, pabeni@redhat.com, aelior@marvell.com, hawk@kernel.org, christophe.jaillet@wanadoo.fr, memxor@gmail.com, john@phrozen.org, bjorn@kernel.org, magnus.karlsson@intel.com, leon@kernel.org, netdev@vger.kernel.org, toke@redhat.com, martin.lau@linux.dev, ecree.xilinx@gmail.com, alardam@gmail.com, gospo@broadcom.com, saeedm@nvidia.com, davem@davemloft.net, nbd@nbd.name Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Marek Majtyka Change necessary condition check for XSK from ndo functions to xdp features flags. Signed-off-by: Marek Majtyka Signed-off-by: Lorenzo Bianconi --- net/xdp/xsk_buff_pool.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c index ed6c71826d31..b2df1e0f8153 100644 --- a/net/xdp/xsk_buff_pool.c +++ b/net/xdp/xsk_buff_pool.c @@ -140,6 +140,10 @@ static void xp_disable_drv_zc(struct xsk_buff_pool *pool) } } +#define NETDEV_XDP_ACT_ZC (NETDEV_XDP_ACT_BASIC | \ + NETDEV_XDP_ACT_REDIRECT | \ + NETDEV_XDP_ACT_XSK_ZEROCOPY) + int xp_assign_dev(struct xsk_buff_pool *pool, struct net_device *netdev, u16 queue_id, u16 flags) { @@ -178,8 +182,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool, /* For copy-mode, we are done. */ return 0; - if (!netdev->netdev_ops->ndo_bpf || - !netdev->netdev_ops->ndo_xsk_wakeup) { + if ((netdev->xdp_features & NETDEV_XDP_ACT_ZC) != NETDEV_XDP_ACT_ZC) { err = -EOPNOTSUPP; goto err_unreg_pool; }