netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [XFRM]: alg_key_len & alg_icv_len should be unsigned
@ 2008-04-25  7:09 Eric Dumazet
  2008-04-25  7:14 ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2008-04-25  7:09 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List, Herbert Xu

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

In commit ba749ae98d5aa9d2ce9a7facde0deed454f92230 ([XFRM]: alg_key_len 
should be unsigned to avoid integer divides 
<http://git2.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commitdiff;h=ba749ae98d5aa9d2ce9a7facde0deed454f92230>) 
alg_key_len field of struct xfrm_algo was converted to unsigned int to 
avoid integer divides.

Then Herbert in commit 1a6509d991225ad210de54c63314fd9542922095 
([IPSEC]: Add support for combined mode algorithms) added a new 
structure xfrm_algo_aead, that resurrected a signed int for alg_key_len 
and re-introduce integer divides.

This patch avoids these divides and saves 64 bytes of text on i386.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>



[-- Attachment #2: xfrm.patch --]
[-- Type: text/plain, Size: 470 bytes --]

diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 0c82c80..2ca6bae 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -97,10 +97,10 @@ struct xfrm_algo {
 };
 
 struct xfrm_algo_aead {
-	char	alg_name[64];
-	int	alg_key_len;	/* in bits */
-	int	alg_icv_len;	/* in bits */
-	char	alg_key[0];
+	char		alg_name[64];
+	unsigned int	alg_key_len;	/* in bits */
+	unsigned int	alg_icv_len;	/* in bits */
+	char		alg_key[0];
 };
 
 struct xfrm_stats {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [XFRM]: alg_key_len & alg_icv_len should be unsigned
  2008-04-25  7:09 [XFRM]: alg_key_len & alg_icv_len should be unsigned Eric Dumazet
@ 2008-04-25  7:14 ` Herbert Xu
  2008-04-25  7:17   ` Eric Dumazet
  2008-04-25  7:29   ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Herbert Xu @ 2008-04-25  7:14 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, Linux Netdev List

On Fri, Apr 25, 2008 at 09:09:05AM +0200, Eric Dumazet wrote:
> In commit ba749ae98d5aa9d2ce9a7facde0deed454f92230 ([XFRM]: alg_key_len 
> should be unsigned to avoid integer divides 
> <http://git2.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commitdiff;h=ba749ae98d5aa9d2ce9a7facde0deed454f92230>) 
> alg_key_len field of struct xfrm_algo was converted to unsigned int to 
> avoid integer divides.
> 
> Then Herbert in commit 1a6509d991225ad210de54c63314fd9542922095 
> ([IPSEC]: Add support for combined mode algorithms) added a new 
> structure xfrm_algo_aead, that resurrected a signed int for alg_key_len 
> and re-introduce integer divides.
> 
> This patch avoids these divides and saves 64 bytes of text on i386.
> 
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

I actually wrote my patch before yours was merged which was why
it was signed.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [XFRM]: alg_key_len & alg_icv_len should be unsigned
  2008-04-25  7:14 ` Herbert Xu
@ 2008-04-25  7:17   ` Eric Dumazet
  2008-04-25  7:29   ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2008-04-25  7:17 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, Linux Netdev List

Herbert Xu a écrit :
>
> Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> I actually wrote my patch before yours was merged which was why
> it was signed.
>
> Cheers,
>   

No problem Herbert, this is a minor cleanup after all :)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [XFRM]: alg_key_len & alg_icv_len should be unsigned
  2008-04-25  7:14 ` Herbert Xu
  2008-04-25  7:17   ` Eric Dumazet
@ 2008-04-25  7:29   ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2008-04-25  7:29 UTC (permalink / raw)
  To: herbert; +Cc: dada1, netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Fri, 25 Apr 2008 15:14:20 +0800

> On Fri, Apr 25, 2008 at 09:09:05AM +0200, Eric Dumazet wrote:
> > In commit ba749ae98d5aa9d2ce9a7facde0deed454f92230 ([XFRM]: alg_key_len 
> > should be unsigned to avoid integer divides 
> > <http://git2.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commitdiff;h=ba749ae98d5aa9d2ce9a7facde0deed454f92230>) 
> > alg_key_len field of struct xfrm_algo was converted to unsigned int to 
> > avoid integer divides.
> > 
> > Then Herbert in commit 1a6509d991225ad210de54c63314fd9542922095 
> > ([IPSEC]: Add support for combined mode algorithms) added a new 
> > structure xfrm_algo_aead, that resurrected a signed int for alg_key_len 
> > and re-introduce integer divides.
> > 
> > This patch avoids these divides and saves 64 bytes of text on i386.
> > 
> > Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
> 
> Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> I actually wrote my patch before yours was merged which was why
> it was signed.

Applied, thanks everyone.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-25  7:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-25  7:09 [XFRM]: alg_key_len & alg_icv_len should be unsigned Eric Dumazet
2008-04-25  7:14 ` Herbert Xu
2008-04-25  7:17   ` Eric Dumazet
2008-04-25  7:29   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).