diff options
author | Denis Kirjanov <kda@linux-powerpc.org> | 2020-03-25 23:35:28 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-29 21:49:20 -0700 |
commit | 798dda818ad1fdad6240959241194b490d6660ee (patch) | |
tree | 143229522200156744ffef94c621a3b9b733d2b3 /net/core/page_pool.c | |
parent | 5ef5c90e3cb3ae1ce7bebddaeb8e8f44309950f7 (diff) | |
download | linux-798dda818ad1fdad6240959241194b490d6660ee.tar.bz2 |
net: page pool: allow to pass zero flags to page_pool_init()
page pool API can be useful for non-DMA cases like
xen-netfront driver so let's allow to pass zero flags to
page pool flags.
v2: check DMA direction only if PP_FLAG_DMA_MAP is set
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/page_pool.c')
-rw-r--r-- | net/core/page_pool.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 626db912fce4..ef98372facf6 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -43,9 +43,11 @@ static int page_pool_init(struct page_pool *pool, * DMA_BIDIRECTIONAL is for allowing page used for DMA sending, * which is the XDP_TX use-case. */ - if ((pool->p.dma_dir != DMA_FROM_DEVICE) && - (pool->p.dma_dir != DMA_BIDIRECTIONAL)) - return -EINVAL; + if (pool->p.flags & PP_FLAG_DMA_MAP) { + if ((pool->p.dma_dir != DMA_FROM_DEVICE) && + (pool->p.dma_dir != DMA_BIDIRECTIONAL)) + return -EINVAL; + } if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV) { /* In order to request DMA-sync-for-device the page |