Skip to contentSkip to conversation

net: page pool: allow to pass zero flags to page_pool_init()

PATCH Applied Denis Kirjanov 3 participants 3 messages Mar 25, 2020 – Mar 30, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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

---
 net/core/page_pool.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
net/core/page_pool.c +5 -3
index a6aefe9..af70331 100644
@@ -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
Signature · 1 line
1.8.3.1
Acked-by on v2 1/1
#1 lore raw
Quoted 7 lines · On Wed, 25 Mar 2020 23:35:28 +0300 Denis Kirjanov <[email protected]> wrote:

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

Signature · 4 lines
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer