mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
page_pool: Add callback to init pages when they are allocated
Add a new callback function to page_pool that, if set, will be called every time a new page is allocated. This will be used from bpf_test_run() to initialise the page data with the data provided by userspace when running XDP programs with redirect turned on. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: John Fastabend <john.fastabend@gmail.com> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com> Link: https://lore.kernel.org/bpf/20220103150812.87914-3-toke@redhat.com
This commit is contained in:
parent
4a48ef70b9
commit
35b2e54989
@ -80,6 +80,8 @@ struct page_pool_params {
|
||||
enum dma_data_direction dma_dir; /* DMA mapping direction */
|
||||
unsigned int max_len; /* max DMA sync memory size */
|
||||
unsigned int offset; /* DMA addr offset */
|
||||
void (*init_callback)(struct page *page, void *arg);
|
||||
void *init_arg;
|
||||
};
|
||||
|
||||
struct page_pool {
|
||||
|
@ -217,6 +217,8 @@ static void page_pool_set_pp_info(struct page_pool *pool,
|
||||
{
|
||||
page->pp = pool;
|
||||
page->pp_magic |= PP_SIGNATURE;
|
||||
if (pool->p.init_callback)
|
||||
pool->p.init_callback(page, pool->p.init_arg);
|
||||
}
|
||||
|
||||
static void page_pool_clear_pp_info(struct page *page)
|
||||
|
Loading…
Reference in New Issue
Block a user