summaryrefslogtreecommitdiffstats
path: root/net/core/mp_dmabuf_devmem.h
blob: 67cd0dd7319c347489d34d1004716b37ad8731c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Dmabuf device memory provider.
 *
 * Authors:	Mina Almasry <almasrymina@google.com>
 *
 */
#ifndef _NET_MP_DMABUF_DEVMEM_H
#define _NET_MP_DMABUF_DEVMEM_H

#include <net/netmem.h>

#if defined(CONFIG_NET_DEVMEM)
int mp_dmabuf_devmem_init(struct page_pool *pool);

netmem_ref mp_dmabuf_devmem_alloc_netmems(struct page_pool *pool, gfp_t gfp);

void mp_dmabuf_devmem_destroy(struct page_pool *pool);

bool mp_dmabuf_devmem_release_page(struct page_pool *pool, netmem_ref netmem);
#else
static inline int mp_dmabuf_devmem_init(struct page_pool *pool)
{
	return -EOPNOTSUPP;
}

static inline netmem_ref
mp_dmabuf_devmem_alloc_netmems(struct page_pool *pool, gfp_t gfp)
{
	return 0;
}

static inline void mp_dmabuf_devmem_destroy(struct page_pool *pool)
{
}

static inline bool
mp_dmabuf_devmem_release_page(struct page_pool *pool, netmem_ref netmem)
{
	return false;
}
#endif

#endif /* _NET_MP_DMABUF_DEVMEM_H */