diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-12-14 09:28:14 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-01-10 16:16:55 -0500 |
commit | e7cd2514ea506f06bd4f7b13a9b62afd60f9c73b (patch) | |
tree | 66c46a54a2841091165a0b8083329c41f3504847 /include/crypto/internal | |
parent | 4726204200327c04a77b819e2c653c063f1bc6ab (diff) |
[CRYPTO] chainiv: Avoid lock spinning where possible
This patch makes chainiv avoid spinning by postponing requests on lock
contention if the user allows the use of asynchronous algorithms. If
a synchronous algorithm is requested then we behave as before.
This should improve IPsec performance on SMP when two CPUs attempt to
transmit over the same SA. Currently one of them will spin doing nothing
waiting for the other CPU to finish its encryption. This patch makes it
postpone the request and get on with other work.
If only one CPU is transmitting for a given SA, then we will process
the request synchronously as before.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/internal')
-rw-r--r-- | include/crypto/internal/skcipher.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h index 0053f34764ff..2ba42cd7d6aa 100644 --- a/include/crypto/internal/skcipher.h +++ b/include/crypto/internal/skcipher.h | |||
@@ -70,6 +70,19 @@ static inline struct crypto_ablkcipher *skcipher_geniv_cipher( | |||
70 | return crypto_ablkcipher_crt(geniv)->base; | 70 | return crypto_ablkcipher_crt(geniv)->base; |
71 | } | 71 | } |
72 | 72 | ||
73 | static inline int skcipher_enqueue_givcrypt( | ||
74 | struct crypto_queue *queue, struct skcipher_givcrypt_request *request) | ||
75 | { | ||
76 | return ablkcipher_enqueue_request(queue, &request->creq); | ||
77 | } | ||
78 | |||
79 | static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt( | ||
80 | struct crypto_queue *queue) | ||
81 | { | ||
82 | return container_of(ablkcipher_dequeue_request(queue), | ||
83 | struct skcipher_givcrypt_request, creq); | ||
84 | } | ||
85 | |||
73 | static inline void *skcipher_givcrypt_reqctx( | 86 | static inline void *skcipher_givcrypt_reqctx( |
74 | struct skcipher_givcrypt_request *req) | 87 | struct skcipher_givcrypt_request *req) |
75 | { | 88 | { |