All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next] net: page pool: allow to pass zero flags to page_pool_init()
@ 2020-03-25 20:35 Denis Kirjanov
  2020-03-25 21:32 ` Jesper Dangaard Brouer
  2020-03-30  4:50 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Denis Kirjanov @ 2020-03-25 20:35 UTC (permalink / raw)
  To: netdev; +Cc: hawk, ilias.apalodimas, Denis Kirjanov

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>
---
 net/core/page_pool.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index a6aefe9..af70331 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
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 net-next] net: page pool: allow to pass zero flags to page_pool_init()
  2020-03-25 20:35 [PATCH v2 net-next] net: page pool: allow to pass zero flags to page_pool_init() Denis Kirjanov
@ 2020-03-25 21:32 ` Jesper Dangaard Brouer
  2020-03-30  4:50 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Jesper Dangaard Brouer @ 2020-03-25 21:32 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: brouer, netdev, ilias.apalodimas

On Wed, 25 Mar 2020 23:35:28 +0300
Denis Kirjanov <kda@linux-powerpc.org> 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
> 
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 net-next] net: page pool: allow to pass zero flags to page_pool_init()
  2020-03-25 20:35 [PATCH v2 net-next] net: page pool: allow to pass zero flags to page_pool_init() Denis Kirjanov
  2020-03-25 21:32 ` Jesper Dangaard Brouer
@ 2020-03-30  4:50 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-03-30  4:50 UTC (permalink / raw)
  To: kda; +Cc: netdev, hawk, ilias.apalodimas

From: Denis Kirjanov <kda@linux-powerpc.org>
Date: Wed, 25 Mar 2020 23:35:28 +0300

> 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>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-30  4:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 20:35 [PATCH v2 net-next] net: page pool: allow to pass zero flags to page_pool_init() Denis Kirjanov
2020-03-25 21:32 ` Jesper Dangaard Brouer
2020-03-30  4:50 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.