Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Tadeusz Struk <tadeusz.struk@intel.com>
To: herbert@gondor.apana.org.au
Cc: davem@davemloft.net, linux-crypto@vger.kernel.org, qat-linux@intel.com
Subject: [PATCH RFC 1/4] crytpo: qat - Fix 64 bytes requests
Date: Thu, 06 Nov 2014 11:59:37 -0800	[thread overview]
Message-ID: <20141106195937.13328.38363.stgit@tstruk-mobl1> (raw)
In-Reply-To: <20141106195931.13328.90501.stgit@tstruk-mobl1>

Fix invalid inflights calculation for 64byte PKE requests that will be sent
from userspace.

Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
---
 .../qat/qat_common/adf_transport_access_macros.h   |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/qat/qat_common/adf_transport_access_macros.h b/drivers/crypto/qat/qat_common/adf_transport_access_macros.h
index 91d88d6..160c9a3 100644
--- a/drivers/crypto/qat/qat_common/adf_transport_access_macros.h
+++ b/drivers/crypto/qat/qat_common/adf_transport_access_macros.h
@@ -83,14 +83,14 @@
 #define ADF_MAX_RING_SIZE ADF_RING_SIZE_4M
 #define ADF_DEFAULT_RING_SIZE ADF_RING_SIZE_16K
 
-/* Valid internal msg size values internal */
+/* Valid internal msg size values */
 #define ADF_MSG_SIZE_32 0x01
 #define ADF_MSG_SIZE_64 0x02
 #define ADF_MSG_SIZE_128 0x04
 #define ADF_MIN_MSG_SIZE ADF_MSG_SIZE_32
 #define ADF_MAX_MSG_SIZE ADF_MSG_SIZE_128
 
-/* Size to bytes conversion macros for ring and msg values */
+/* Size to bytes conversion macros for ring and msg size values */
 #define ADF_MSG_SIZE_TO_BYTES(SIZE) (SIZE << 5)
 #define ADF_BYTES_TO_MSG_SIZE(SIZE) (SIZE >> 5)
 #define ADF_SIZE_TO_RING_SIZE_IN_BYTES(SIZE) ((1 << (SIZE - 1)) << 7)
@@ -100,8 +100,11 @@
 #define ADF_RING_SIZE_BYTES_MIN(SIZE) ((SIZE < ADF_RING_SIZE_4K) ? \
 				ADF_RING_SIZE_4K : SIZE)
 #define ADF_RING_SIZE_MODULO(SIZE) (SIZE + 0x6)
+#define ADF_SIZE_TO_POW(SIZE) ((((SIZE & 0x4) >> 1) | ((SIZE & 0x4) >> 2) | \
+				SIZE) & ~0x4)
+/* Max outstanding requests */
 #define ADF_MAX_INFLIGHTS(RING_SIZE, MSG_SIZE) \
-	((((1 << (RING_SIZE - 1)) << 4) >> MSG_SIZE) - 1)
+	((((1 << (RING_SIZE - 1)) << 3) >> ADF_SIZE_TO_POW(MSG_SIZE)) - 1)
 #define BUILD_RING_CONFIG(size)	\
 	((ADF_RING_NEAR_WATERMARK_0 << ADF_RING_CONFIG_NEAR_FULL_WM) \
 	| (ADF_RING_NEAR_WATERMARK_0 << ADF_RING_CONFIG_NEAR_EMPTY_WM) \

  reply	other threads:[~2014-11-06 20:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 19:59 [PATCH RFC 0/4] crypto: qat - Add userspace access to QAT services Tadeusz Struk
2014-11-06 19:59 ` Tadeusz Struk [this message]
2014-11-06 19:59 ` [PATCH RFC 2/4] crypto: qat - Add PKE firmware Tadeusz Struk
2014-11-06 19:59 ` [PATCH RFC 3/4] crypto: qat - Add userspace instances Tadeusz Struk
2014-11-06 19:59 ` [PATCH RFC 4/4] crypto: qat - Add new algif interface for userspace Tadeusz Struk
2014-11-07  2:56   ` Herbert Xu
2014-11-07  3:43     ` Tadeusz Struk
2014-11-07  4:05       ` Herbert Xu
2014-11-07  5:24         ` Tadeusz Struk
2014-11-07  5:31           ` Herbert Xu
2014-11-07 18:53             ` Tadeusz Struk
2014-11-07 19:48             ` Tadeusz Struk
2014-11-14  1:19               ` Herbert Xu
2014-11-14  1:25                 ` Tadeusz Struk
2014-11-14  1:29                   ` Herbert Xu

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=20141106195937.13328.38363.stgit@tstruk-mobl1 \
    --to=tadeusz.struk@intel.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qat-linux@intel.com \
    /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