All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linaro.org>
To: axboe@kernel.dk, agk@redhat.com, snitzer@redhat.com,
	dm-devel@redhat.com, herbert@gondor.apana.org.au,
	davem@davemloft.net
Cc: ebiggers3@gmail.com, js1304@gmail.com, tadeusz.struk@intel.com,
	smueller@chronox.de, standby24x7@gmail.com, shli@kernel.org,
	dan.j.williams@intel.com, martin.petersen@oracle.com,
	sagig@mellanox.com, kent.overstreet@gmail.com,
	keith.busch@intel.com, tj@kernel.org, ming.lei@canonical.com,
	broonie@kernel.org, arnd@arndb.de, linux-crypto@vger.kernel.org,
	linux-block@vger.kernel.org, linux-raid@vger.kernel.org,
	linux-kernel@vger.kernel.org, baolin.wang@linaro.org
Subject: [RFC v4 2/4] crypto: Introduce CRYPTO_ALG_BULK flag
Date: Tue,  7 Jun 2016 20:17:05 +0800	[thread overview]
Message-ID: <238ce3d506051c863300b90720c3e103175747cc.1465301616.git.baolin.wang@linaro.org> (raw)
In-Reply-To: <cover.1465301616.git.baolin.wang@linaro.org>
In-Reply-To: <cover.1465301616.git.baolin.wang@linaro.org>

Now some cipher hardware engines prefer to handle bulk block rather than one
sector (512 bytes) created by dm-crypt, cause these cipher engines can handle
the intermediate values (IV) by themselves in one bulk block. This means we
can increase the size of the request by merging request rather than always 512
bytes and thus increase the hardware engine processing speed.

So introduce 'CRYPTO_ALG_BULK' flag to indicate this cipher can support bulk
mode.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 include/crypto/skcipher.h |    7 +++++++
 include/linux/crypto.h    |    6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
index 0f987f5..d89d29a 100644
--- a/include/crypto/skcipher.h
+++ b/include/crypto/skcipher.h
@@ -519,5 +519,12 @@ static inline void skcipher_request_set_crypt(
 	req->iv = iv;
 }
 
+static inline unsigned int skcipher_is_bulk_mode(struct crypto_skcipher *sk_tfm)
+{
+	struct crypto_tfm *tfm = crypto_skcipher_tfm(sk_tfm);
+
+	return crypto_tfm_alg_bulk(tfm);
+}
+
 #endif	/* _CRYPTO_SKCIPHER_H */
 
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 6e28c89..a315487 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -63,6 +63,7 @@
 #define CRYPTO_ALG_DEAD			0x00000020
 #define CRYPTO_ALG_DYING		0x00000040
 #define CRYPTO_ALG_ASYNC		0x00000080
+#define CRYPTO_ALG_BULK			0x00000100
 
 /*
  * Set this bit if and only if the algorithm requires another algorithm of
@@ -623,6 +624,11 @@ static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm)
 	return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK;
 }
 
+static inline unsigned int crypto_tfm_alg_bulk(struct crypto_tfm *tfm)
+{
+	return tfm->__crt_alg->cra_flags & CRYPTO_ALG_BULK;
+}
+
 static inline unsigned int crypto_tfm_alg_blocksize(struct crypto_tfm *tfm)
 {
 	return tfm->__crt_alg->cra_blocksize;
-- 
1.7.9.5


  parent reply	other threads:[~2016-06-07 12:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 12:17 [RFC v4 0/4] Introduce the bulk mode method when sending request to crypto layer Baolin Wang
2016-06-07 12:17 ` [RFC v4 1/4] block: Introduce blk_bio_map_sg() to map one bio Baolin Wang
2016-06-07 12:17 ` Baolin Wang [this message]
2016-06-07 14:16   ` [RFC v4 2/4] crypto: Introduce CRYPTO_ALG_BULK flag Herbert Xu
2016-06-08  2:00     ` Baolin Wang
2016-06-08  2:00       ` Baolin Wang
2016-06-08  2:00       ` Baolin Wang
2016-06-08  2:00       ` Baolin Wang
2016-06-15  6:27       ` Baolin Wang
2016-06-15  6:27         ` Baolin Wang
2016-06-15  6:27         ` Baolin Wang
2016-06-15  6:27         ` Baolin Wang
2016-06-15  6:49         ` Herbert Xu
2016-06-15  6:49           ` Herbert Xu
2016-06-15  6:49           ` Herbert Xu
2016-06-15  6:49           ` Herbert Xu
2016-06-15  7:38           ` Baolin Wang
2016-06-15  7:38             ` Baolin Wang
2016-06-15  7:38             ` Baolin Wang
2016-06-15  7:38             ` Baolin Wang
2016-06-15  7:39             ` Herbert Xu
2016-06-15  7:39               ` Herbert Xu
2016-06-15  7:39               ` Herbert Xu
2016-06-15  7:39               ` Herbert Xu
2016-06-15  8:48               ` Baolin Wang
2016-06-15  8:48                 ` Baolin Wang
2016-06-15  8:48                 ` Baolin Wang
2016-06-15  8:48                 ` Baolin Wang
2016-06-07 12:17 ` [RFC v4 3/4] md: dm-crypt: Introduce the bulk mode method when sending request Baolin Wang
2016-06-07 12:17 ` [RFC v4 4/4] crypto: Add the CRYPTO_ALG_BULK flag for ecb(aes) cipher Baolin Wang

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=238ce3d506051c863300b90720c3e103175747cc.1465301616.git.baolin.wang@linaro.org \
    --to=baolin.wang@linaro.org \
    --cc=agk@redhat.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=broonie@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=davem@davemloft.net \
    --cc=dm-devel@redhat.com \
    --cc=ebiggers3@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=js1304@gmail.com \
    --cc=keith.busch@intel.com \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@canonical.com \
    --cc=sagig@mellanox.com \
    --cc=shli@kernel.org \
    --cc=smueller@chronox.de \
    --cc=snitzer@redhat.com \
    --cc=standby24x7@gmail.com \
    --cc=tadeusz.struk@intel.com \
    --cc=tj@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 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.