netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: bpf@vger.kernel.org
Cc: netdev@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
	andrii@kernel.org, davem@davemloft.net, kuba@kernel.org,
	hawk@kernel.org, pabeni@redhat.com, edumazet@google.com,
	toke@redhat.com, memxor@gmail.com, alardam@gmail.com,
	saeedm@nvidia.com, anthony.l.nguyen@intel.com,
	gospo@broadcom.com, vladimir.oltean@nxp.com, nbd@nbd.name,
	john@phrozen.org, leon@kernel.org, simon.horman@corigine.com,
	aelior@marvell.com, christophe.jaillet@wanadoo.fr,
	ecree.xilinx@gmail.com, mst@redhat.com, bjorn@kernel.org,
	magnus.karlsson@intel.com, maciej.fijalkowski@intel.com,
	intel-wired-lan@lists.osuosl.org, lorenzo.bianconi@redhat.com,
	martin.lau@linux.dev
Subject: [PATCH v2 bpf-next 3/8] xsk: add usage of XDP features flags
Date: Wed, 25 Jan 2023 01:33:23 +0100	[thread overview]
Message-ID: <20c7b0767c2e3be8c33bfcfe1e0de9e6eb3a5e9a.1674606197.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1674606193.git.lorenzo@kernel.org>

From: Marek Majtyka <alardam@gmail.com>

Change necessary condition check for XSK from ndo functions to
xdp features flags.

Signed-off-by: Marek Majtyka <alardam@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 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;
 	}
-- 
2.39.1


  parent reply	other threads:[~2023-01-25  0:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25  0:33 [PATCH v2 bpf-next 0/8] xdp: introduce xdp-feature support Lorenzo Bianconi
2023-01-25  0:33 ` [PATCH v2 bpf-next 1/8] netdev-genl: create a simple family for netdev stuff Lorenzo Bianconi
2023-01-25 10:12   ` Jesper Dangaard Brouer
2023-01-25  0:33 ` [PATCH v2 bpf-next 2/8] drivers: net: turn on XDP features Lorenzo Bianconi
2023-01-25  3:04   ` Jakub Kicinski
2023-01-25  4:00   ` kernel test robot
2023-01-25  8:27   ` Simon Horman
2023-01-26 19:09   ` Gerhard Engleder
2023-01-26 22:00     ` Lorenzo Bianconi
2023-01-29 13:05     ` Lorenzo Bianconi
2023-01-30 14:09       ` Gerhard Engleder
2023-01-25  0:33 ` Lorenzo Bianconi [this message]
2023-01-25  0:33 ` [PATCH v2 bpf-next 4/8] libbpf: add the capability to specify netlink proto in libbpf_netlink_send_recv Lorenzo Bianconi
2023-01-25  0:33 ` [PATCH v2 bpf-next 5/8] libbpf: add API to get XDP/XSK supported features Lorenzo Bianconi
2023-01-25  0:33 ` [PATCH v2 bpf-next 6/8] bpf: devmap: check XDP features in __xdp_enqueue routine Lorenzo Bianconi
2023-01-25 10:35   ` Jesper Dangaard Brouer
2023-01-25  0:33 ` [PATCH v2 bpf-next 7/8] selftests/bpf: add test for bpf_xdp_query xdp-features support Lorenzo Bianconi
2023-01-25  0:33 ` [PATCH v2 bpf-next 8/8] selftests/bpf: introduce XDP compliance test tool Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20c7b0767c2e3be8c33bfcfe1e0de9e6eb3a5e9a.1674606197.git.lorenzo@kernel.org \
    --to=lorenzo@kernel.org \
    --cc=aelior@marvell.com \
    --cc=alardam@gmail.com \
    --cc=andrii@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=gospo@broadcom.com \
    --cc=hawk@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=mst@redhat.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=simon.horman@corigine.com \
    --cc=toke@redhat.com \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).