mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-23 11:04:44 +08:00
c3f812cea0
The page pool keeps track of the number of pages in flight, and
it isn't safe to remove the pool until all pages are returned.
Disallow removing the pool until all pages are back, so the pool
is always available for page producers.
Make the page pool responsible for its own delayed destruction
instead of relying on XDP, so the page pool can be used without
the xdp memory model.
When all pages are returned, free the pool and notify xdp if the
pool is registered with the xdp memory system. Have the callback
perform a table walk since some drivers (cpsw) may share the pool
among multiple xdp_rxq_info.
Note that the increment of pages_state_release_cnt may result in
inflight == 0, resulting in the pool being released.
Fixes: d956a048cd
("xdp: force mem allocator removal and periodic warning")
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
20 lines
446 B
C
20 lines
446 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __LINUX_NET_XDP_PRIV_H__
|
|
#define __LINUX_NET_XDP_PRIV_H__
|
|
|
|
#include <linux/rhashtable.h>
|
|
|
|
/* Private to net/core/xdp.c, but used by trace/events/xdp.h */
|
|
struct xdp_mem_allocator {
|
|
struct xdp_mem_info mem;
|
|
union {
|
|
void *allocator;
|
|
struct page_pool *page_pool;
|
|
struct zero_copy_allocator *zc_alloc;
|
|
};
|
|
struct rhash_head node;
|
|
struct rcu_head rcu;
|
|
};
|
|
|
|
#endif /* __LINUX_NET_XDP_PRIV_H__ */
|