From: Denis Kirjanov <kda@linux-powerpc.org>
To: netdev@vger.kernel.org
Cc: hawk@kernel.org, ilias.apalodimas@linaro.org,
Denis Kirjanov <kda@linux-powerpc.org>
Subject: [PATCH v2 net-next] net: page pool: allow to pass zero flags to page_pool_init()
Date: Wed, 25 Mar 2020 23:35:28 +0300 [thread overview]
Message-ID: <1585168528-2445-1-git-send-email-kda@linux-powerpc.org> (raw)
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
next reply other threads:[~2020-03-25 20:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-25 20:35 Denis Kirjanov [this message]
2020-03-25 21:32 ` [PATCH v2 net-next] net: page pool: allow to pass zero flags to page_pool_init() Jesper Dangaard Brouer
2020-03-30 4:50 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1585168528-2445-1-git-send-email-kda@linux-powerpc.org \
--to=kda@linux-powerpc.org \
--cc=hawk@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).