mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Francis Moreau" <francis.moro@gmail.com>
To: "Herbert Xu" <herbert@gondor.apana.org.au>
Cc: helge.hafting@aitel.hist.no, linux-kernel@vger.kernel.org,
	linux-crypto@vger.kernel.org
Subject: Re: [CRYPTO] is it really optimized ?
Date: Tue, 17 Apr 2007 14:36:09 +0200	[thread overview]
Message-ID: <38b2ab8a0704170536x15920b15xedfd518cad50cee@mail.gmail.com> (raw)
In-Reply-To: <20070417004117.GA16513@gondor.apana.org.au>

On 4/17/07, Herbert Xu <herbert@gondor.apana.org.au> wrote:
> On Mon, Apr 16, 2007 at 10:37:01AM +0200, Francis Moreau wrote:
> >
> > BTW, here are figures I got with 2 different versions of the driver
> > when using tcrypt module. The second being the result with the
> > optimized driver (no key reloading on each block):
> >
> > normal version:
> > test 4 (128 bit key, 8192 byte blocks): 1 operation in 67991 cycles (8192
> > bytes)
> >
> > optimized version:
> > test 4 (128 bit key, 8192 byte blocks): 1 operation in 51783 cycles (8192
> > bytes)
> >
> > So the gain is 16000 cycles which seems to worth the change, isn't it ?
>
> Sounds like it would.  It would help of course if you posted the patch :)
>

OK, I tried to cook up something very simple. Since I don't know this
code, please be indulgent when reading the following patch ;)

diff --git a/crypto/api.c b/crypto/api.c
index 55af8bb..f067de8 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -71,6 +71,10 @@ struct crypto_alg *__crypto_alg_lookup(const char
*name, u32 type, u32 mask)
 		    ((struct crypto_larval *)q)->mask != mask)
 			continue;

+		if (alg->cra_flags & CRYPTO_ALG_EXCLUSIVE &&
+		    atomic_read(&alg->cra_refcnt) > 0)
+			continue;
+
 		exact = !strcmp(q->cra_driver_name, name);
 		fuzzy = !strcmp(q->cra_name, name);
 		if (!exact && !(fuzzy && q->cra_priority > best))
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 779aa78..278d386 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -41,6 +41,7 @@
 #define CRYPTO_ALG_DEAD			0x00000020
 #define CRYPTO_ALG_DYING		0x00000040
 #define CRYPTO_ALG_ASYNC		0x00000080
+#define CRYPTO_ALG_EXCLUSIVE		0x00000100

 /*
  * Set this bit if and only if the algorithm requires another algorithm of

-- 
Francis

  reply	other threads:[~2007-04-17 12:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-12 19:39 Francis Moreau
2007-04-13 12:17 ` Helge Hafting
2007-04-13 13:30   ` Francis Moreau
2007-04-14  4:30     ` Herbert Xu
2007-04-14 13:15       ` Francis Moreau
2007-04-14 19:34         ` Herbert Xu
2007-04-14 21:10           ` Francis Moreau
2007-04-15  7:52             ` Herbert Xu
2007-04-16  8:37               ` Francis Moreau
2007-04-17  0:41                 ` Herbert Xu
2007-04-17 12:36                   ` Francis Moreau [this message]
2007-04-17 13:04                     ` Evgeniy Polyakov
2007-04-17 13:42                       ` Herbert Xu
2007-04-17 14:01                         ` Francis Moreau
2007-04-17 15:08                           ` Evgeniy Polyakov
2007-04-17 15:34                             ` Francis Moreau
2007-04-17 15:57                               ` Evgeniy Polyakov
2007-04-17 16:18                                 ` Francis Moreau
2007-04-17 17:07                                   ` Evgeniy Polyakov
2007-04-17 13:57                       ` Francis Moreau
2007-04-17 13:40                     ` Herbert Xu
2007-04-17 13:59                       ` Francis Moreau
2007-04-17 14:02                         ` Herbert Xu
2007-04-17 14:41                           ` Francis Moreau
2007-04-17 15:40                             ` Roland Dreier
2007-04-17 16:14                               ` Francis Moreau
2007-04-17 16:33                                 ` Roland Dreier
2007-04-17 17:24                                   ` Francis Moreau
2007-04-17 17:34                                     ` Roland Dreier
2007-04-19  8:07                                       ` Francis Moreau
2007-04-23 13:56                                         ` Francis Moreau

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=38b2ab8a0704170536x15920b15xedfd518cad50cee@mail.gmail.com \
    --to=francis.moro@gmail.com \
    --cc=helge.hafting@aitel.hist.no \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®