linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Horia Geanta <horia.geanta@freescale.com>
To: <linux-crypto@vger.kernel.org>, Herbert Xu <herbert@gondor.apana.org.au>
Cc: Kim Phillips <kim.phillips@freescale.com>
Subject: [PATCH 1/4] crypto: add CRYPTO_TFM_REQ_DMA flag
Date: Fri, 13 Mar 2015 19:14:42 +0200	[thread overview]
Message-ID: <1426266882-31626-1-git-send-email-horia.geanta@freescale.com> (raw)

The CRYPTO_TFM_REQ_DMA flag can be used by backend implementations to
indicate to crypto API the need to allocate GFP_DMA memory
for private contexts of the crypto requests.

Signed-off-by: Horia Geanta <horia.geanta@freescale.com>
---
 include/linux/crypto.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index fb5ef16d6a12..64258c9198d5 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -103,6 +103,7 @@
 #define CRYPTO_TFM_REQ_WEAK_KEY		0x00000100
 #define CRYPTO_TFM_REQ_MAY_SLEEP	0x00000200
 #define CRYPTO_TFM_REQ_MAY_BACKLOG	0x00000400
+#define CRYPTO_TFM_REQ_DMA		0x00000800
 #define CRYPTO_TFM_RES_WEAK_KEY		0x00100000
 #define CRYPTO_TFM_RES_BAD_KEY_LEN   	0x00200000
 #define CRYPTO_TFM_RES_BAD_KEY_SCHED 	0x00400000
@@ -1108,6 +1109,10 @@ static inline struct ablkcipher_request *ablkcipher_request_alloc(
 {
 	struct ablkcipher_request *req;
 
+	if (crypto_ablkcipher_reqsize(tfm) &&
+	    (crypto_ablkcipher_get_flags(tfm) & CRYPTO_TFM_REQ_DMA))
+		gfp |= GFP_DMA;
+
 	req = kmalloc(sizeof(struct ablkcipher_request) +
 		      crypto_ablkcipher_reqsize(tfm), gfp);
 
@@ -1471,6 +1476,10 @@ static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
 {
 	struct aead_request *req;
 
+	if (crypto_aead_reqsize(tfm) &&
+	    (crypto_aead_get_flags(tfm) & CRYPTO_TFM_REQ_DMA))
+		gfp |= GFP_DMA;
+
 	req = kmalloc(sizeof(*req) + crypto_aead_reqsize(tfm), gfp);
 
 	if (likely(req))
-- 
1.8.3.1

             reply	other threads:[~2015-03-13 17:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13 17:14 Horia Geanta [this message]
2015-03-13 17:15 ` [PATCH 2/4] net: esp: check CRYPTO_TFM_REQ_DMA flag when allocating crypto request Horia Geanta
2015-03-13 19:46   ` David Miller
2015-03-14 12:16     ` Horia Geantă
2015-03-14 18:27       ` David Miller
2015-03-13 17:16 ` [PATCH 3/4] crypto: talitos - move talitos_{edesc,request} to request private ctx Horia Geanta
2015-03-13 17:16 ` [PATCH 4/4] crypto: talitos - add software backlog queue handling Horia Geanta
2015-03-13 18:37   ` Tom Lendacky
2015-03-14 17:16     ` Horia Geantă
2015-03-16 12:58       ` Martin Hicks
2015-03-13 17:27 ` [PATCH 1/4] crypto: add CRYPTO_TFM_REQ_DMA flag Horia Geantă

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=1426266882-31626-1-git-send-email-horia.geanta@freescale.com \
    --to=horia.geanta@freescale.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kim.phillips@freescale.com \
    --cc=linux-crypto@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).