From patchwork Fri May 27 11:11:23 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: 9138173 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4DE6160467 for ; Fri, 27 May 2016 11:12:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E6AD274F3 for ; Fri, 27 May 2016 11:12:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31FA828137; Fri, 27 May 2016 11:12:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC58D274F3 for ; Fri, 27 May 2016 11:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753590AbcE0LMM (ORCPT ); Fri, 27 May 2016 07:12:12 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:36253 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753601AbcE0LMK (ORCPT ); Fri, 27 May 2016 07:12:10 -0400 Received: by mail-pa0-f43.google.com with SMTP id eu11so30235927pad.3 for ; Fri, 27 May 2016 04:12:09 -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=Ob/mdwnstNZS6NdQ3S9e3xD++e1A/JXtmMxO4shHjx/4XBwNzcTZfLoyKjI5yRhgfx Dj91kCACjX953UkjNVXNInzFPPkZOYnYcLWzVRrl8+F2krO8vGKK/Ct1kWirEWaic2Yv czx9HfP5Eu6UoFGEptnzvR6Ehy4RtPXHsE8Sg= 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=YypWo8K4kvWa4JF4DxSbfkY/nYEnXigSwJEx9CZHJwHmB1HzS0zLSh8ki4WozYlGrd VDOYAdJdrzJh7y1ehjq9pXMeYhM4DxZaVFbHpB8Zkfm9A4MJZXSjHXGyXvusQANaaFr/ l5RG5p/oKlj/cxG43fv5sFumy/zqYVSV5+IA/xj8fYzAEgnMe5QSIna5CgIf7pB3kgLO rOaws38E391Dc69zKVphF3CY4/IOZFyHhQ2cSC0K/TDd3/HXslZ9sHM5jeY5apNXJesI PiJy+HYRpywSGBabQfkWspWrHoIPC0dtwNV5PYpZhkY4cj/TVfpQNQxKjoaJyWci3mPe 8ovQ== X-Gm-Message-State: ALyK8tLwNaNhliaJzFR9Ub2pm+gmBHFY05KQ8ODmE8S6LFnyRJz+7DNFXgPbtCInuuH2fxVD X-Received: by 10.66.6.35 with SMTP id x3mr21552289pax.135.1464347528989; Fri, 27 May 2016 04:12:08 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id vi6sm27430788pab.21.2016.05.27.04.12.02 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 May 2016 04:12:08 -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 v2 2/3] crypto: Introduce CRYPTO_ALG_BULK flag Date: Fri, 27 May 2016 19:11:23 +0800 Message-Id: <47e9ddd8c9ea9ad9e29c8cb027d19d8459ea1479.1464346333.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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;