2008-01-08 06:09:14

by Herbert Xu

[permalink] [raw]
Subject: [CRYPTO] api: Set default CRYPTO_MINALIGN to unsigned long long

Hi:

I've just added this patch to cryptodev-2.6.

[CRYPTO] api: Set default CRYPTO_MINALIGN to unsigned long long

Thanks to David Miller for pointing out that the SLAB (or SLOB/SLUB)
cache uses the alignment of unsigned long long if the architecture
kmalloc/slab alignment macros are not defined.

This patch changes the CRYPTO_MINALIGN so that it uses the same default
value.

Signed-off-by: Herbert Xu <[email protected]>

diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 0aba104..6a20fc9 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -90,6 +90,8 @@
#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
#elif defined(ARCH_SLAB_MINALIGN)
#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
+#else
+#define CRYPTO_MINALIGN __alignof__(unsigned long long)
#endif

#ifdef CRYPTO_MINALIGN

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


2008-01-08 06:14:25

by David Miller

[permalink] [raw]
Subject: Re: [CRYPTO] api: Set default CRYPTO_MINALIGN to unsigned long long

From: Herbert Xu <[email protected]>
Date: Tue, 8 Jan 2008 17:09:11 +1100

> diff --git a/include/linux/crypto.h b/include/linux/crypto.h
> index 0aba104..6a20fc9 100644
> --- a/include/linux/crypto.h
> +++ b/include/linux/crypto.h
> @@ -90,6 +90,8 @@
> #define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
> #elif defined(ARCH_SLAB_MINALIGN)
> #define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
> +#else
> +#define CRYPTO_MINALIGN __alignof__(unsigned long long)
> #endif
>
> #ifdef CRYPTO_MINALIGN

Not to nit-pick but the CRYPTO_MINALIGN ifdef there at the
end is superfluous. It will always be defined.

2008-01-08 06:15:50

by Herbert Xu

[permalink] [raw]
Subject: Re: [CRYPTO] api: Set default CRYPTO_MINALIGN to unsigned long long

On Mon, Jan 07, 2008 at 10:14:25PM -0800, David Miller wrote:
>
> Not to nit-pick but the CRYPTO_MINALIGN ifdef there at the
> end is superfluous. It will always be defined.

Good point. I'll get rid of that too.

Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2008-01-08 06:18:00

by Herbert Xu

[permalink] [raw]
Subject: Re: [CRYPTO] api: Set default CRYPTO_MINALIGN to unsigned long long

On Tue, Jan 08, 2008 at 05:15:48PM +1100, Herbert Xu wrote:
>
> Good point. I'll get rid of that too.

I've replaced that patch with this:

[CRYPTO] api: Set default CRYPTO_MINALIGN to unsigned long long

Thanks to David Miller for pointing out that the SLAB (or SLOB/SLUB)
cache uses the alignment of unsigned long long if the architecture
kmalloc/slab alignment macros are not defined.

This patch changes the CRYPTO_MINALIGN so that it uses the same default
value.

Signed-off-by: Herbert Xu <[email protected]>

diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 0aba104..5e02d1b 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -90,13 +90,11 @@
#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
#elif defined(ARCH_SLAB_MINALIGN)
#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
+#else
+#define CRYPTO_MINALIGN __alignof__(unsigned long long)
#endif

-#ifdef CRYPTO_MINALIGN
#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
-#else
-#define CRYPTO_MINALIGN_ATTR
-#endif

struct scatterlist;
struct crypto_ablkcipher;

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2008-01-08 06:32:07

by David Miller

[permalink] [raw]
Subject: Re: [CRYPTO] api: Set default CRYPTO_MINALIGN to unsigned long long

From: Herbert Xu <[email protected]>
Date: Tue, 8 Jan 2008 17:17:57 +1100

> On Tue, Jan 08, 2008 at 05:15:48PM +1100, Herbert Xu wrote:
> >
> > Good point. I'll get rid of that too.
>
> I've replaced that patch with this:
>
> [CRYPTO] api: Set default CRYPTO_MINALIGN to unsigned long long

Looks great.