Commit 0ae0cb2b authored by Marek Majtyka's avatar Marek Majtyka Committed by Alexei Starovoitov

xsk: add usage of XDP features flags

Change necessary condition check for XSK from ndo functions to
xdp features flags.
Signed-off-by: default avatarMarek Majtyka <alardam@gmail.com>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/45a98ec67b4556a6a22dfd85df3eb8276beeeb74.1675245258.git.lorenzo@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 66c0e13a
...@@ -140,6 +140,10 @@ static void xp_disable_drv_zc(struct xsk_buff_pool *pool) ...@@ -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, int xp_assign_dev(struct xsk_buff_pool *pool,
struct net_device *netdev, u16 queue_id, u16 flags) struct net_device *netdev, u16 queue_id, u16 flags)
{ {
...@@ -178,8 +182,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool, ...@@ -178,8 +182,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
/* For copy-mode, we are done. */ /* For copy-mode, we are done. */
return 0; return 0;
if (!netdev->netdev_ops->ndo_bpf || if ((netdev->xdp_features & NETDEV_XDP_ACT_ZC) != NETDEV_XDP_ACT_ZC) {
!netdev->netdev_ops->ndo_xsk_wakeup) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto err_unreg_pool; goto err_unreg_pool;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment