Thread (2 messages) 2 messages, 2 authors, 2014-12-03

Re: [PATCH v2] crypto: algif - Mark sgl end at the end of data

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2014-12-03 14:27:06

On Tue, Dec 02, 2014 at 07:07:50AM -0800, Tadeusz Struk wrote:
quoted hunk ↗ jump to hunk
Hi,
algif_skcipher sends 127 sgl buffers for encryption regardless of how
many buffers acctually have data to process, where the few first with
valid len and the rest with zero len. This is not very eficient and may cause
problems when algs do something like this without checking the buff
lenght:
for_each_sg(sgl, sg, sg_nents, i)
	sg_virt(sg)
This patch marks the last one with data as the last one to process.

Changes:
v2 - use data len to find the last buffer instead of nents in RX list.

Signed-off-by: Tadeusz Struk <redacted>
---
 crypto/algif_skcipher.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index f2a88a7..cde507f 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -414,6 +414,23 @@ unlock:
 	return err ?: size;
 }
 
+static int skcipher_get_nents_with_data(struct scatterlist *sg, int len)
+{
This is way too complicated.  Why not just do it every time we add
data and modify sgl->cur?

Cheers,
-- 
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help