Add another small helper called xp_pool_bindable and move the current dev_get_min_mp_channel_count test into this helper. Pass in the pool object, such that we derive the netdev from the prior registered pool. Signed-off-by: Daniel Borkmann Co-developed-by: David Wei Signed-off-by: David Wei --- net/xdp/xsk_buff_pool.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c index 375696f895d4..d2109d683fe5 100644 --- a/net/xdp/xsk_buff_pool.c +++ b/net/xdp/xsk_buff_pool.c @@ -54,6 +54,11 @@ int xp_alloc_tx_descs(struct xsk_buff_pool *pool, struct xdp_sock *xs) return 0; } +static bool xp_pool_bindable(struct xsk_buff_pool *pool) +{ + return dev_get_min_mp_channel_count(pool->netdev) == 0; +} + struct xsk_buff_pool *xp_create_and_assign_umem(struct xdp_sock *xs, struct xdp_umem *umem) { @@ -199,7 +204,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool, err = -EOPNOTSUPP; goto err_unreg_pool; } - if (dev_get_min_mp_channel_count(netdev)) { + if (!xp_pool_bindable(pool)) { err = -EBUSY; goto err_unreg_pool; } -- 2.43.0