diff options
author | Marek Majtyka <alardam@gmail.com> | 2023-02-01 11:24:19 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-02-02 20:48:23 -0800 |
commit | 0ae0cb2bb22eb8cf943fa07137068347e1b918c4 (patch) | |
tree | b71cb77a337130f28e87b55adbb0d0ab7cc02a9a /net/xdp | |
parent | 66c0e13ad236c74ea88c7c1518f3cef7f372e3da (diff) |
xsk: add usage of XDP features flags
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>
Link: https://lore.kernel.org/r/45a98ec67b4556a6a22dfd85df3eb8276beeeb74.1675245258.git.lorenzo@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net/xdp')
-rw-r--r-- | net/xdp/xsk_buff_pool.c | 7 |
1 files 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; } |