From patchwork Wed Jun 1 04:58:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 68960 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2330848qge; Tue, 31 May 2016 21:59:49 -0700 (PDT) X-Received: by 10.98.64.21 with SMTP id n21mr4286065pfa.161.1464757189344; Tue, 31 May 2016 21:59:49 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xb3si8015081pab.132.2016.05.31.21.59.49 for ; Tue, 31 May 2016 21:59:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757336AbcFAE7m (ORCPT ); Wed, 1 Jun 2016 00:59:42 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:36608 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756857AbcFAE6x (ORCPT ); Wed, 1 Jun 2016 00:58:53 -0400 Received: by mail-pf0-f176.google.com with SMTP id f144so7153763pfa.3 for ; Tue, 31 May 2016 21:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=JrnmqpJJckOrnPZH2ETGagU+nog3J7+1RSv1kF6Yn5o=; b=Bt1EP9jOGkrGQSQDJzoLrECPYWSbpTbnbZV4SBR5VMlL91fsNV/GYf1OAcYp8AB/BK FgC+LuVAWgwarqeV676Eu1qUBHEAeoXAVoKp0DzxX5j0CFuDrT/TEZeS0zdMOC5XkWS/ 2cM/XsOYq8HuaHX1HdasTgQPUkj1Se7C3quoM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=JrnmqpJJckOrnPZH2ETGagU+nog3J7+1RSv1kF6Yn5o=; b=PeJirMOM63QR1KM6OlXt7KaGCKI/nmiYWEeZYIShXYSaKaZmHmm3hyvQC4AntDjb1o yuoABMC7Ihka3tIOlosOoLWyIhrOYUsr9y+qnG7HTnTkRaLasPTI55/pKEPSFOJ/d2oH xG4FD8HmsV2vCGw3XqT72wqHBdS4VW9UpM8L3j8hUzWXdA9VEpuCuPHXifcmvagv1BP7 W0/hmp/myetPD/d/KsUQxNPcKoFfq/AvUZ3RJ2PHL1ggs2dCtA2xbrfdFEPvVamKW6I8 0T3LlxsUTFkR6WWofPzdCrz1vdHdHHtM8xZfvCgoALRJJUAOKyc0AnlAB6zVng/Nhay5 Yp2w== X-Gm-Message-State: ALyK8tLnnO0t3d/6tRUeq2uhyK0Xlhv980o5XVjrOjtuqDxeR11SXqPl92C1k+LG9ILFNrdI X-Received: by 10.98.82.77 with SMTP id g74mr4269701pfb.113.1464757132329; Tue, 31 May 2016 21:58:52 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id d71sm42764420pfd.80.2016.05.31.21.58.45 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 31 May 2016 21:58:51 -0700 (PDT) From: Baolin Wang 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 v3 2/4] crypto: Introduce CRYPTO_ALG_BULK flag Date: Wed, 1 Jun 2016 12:58:05 +0800 Message-Id: <47e9ddd8c9ea9ad9e29c8cb027d19d8459ea1479.1464756501.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.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 --- include/crypto/skcipher.h | 7 +++++++ include/linux/crypto.h | 6 ++++++ 2 files changed, 13 insertions(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;