* [PATCH] IPV6 : get rid of __HAVE_ARCH_ADDR_SET
@ 2007-05-01 4:00 Eric Dumazet
2007-05-03 10:09 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2007-05-01 4:00 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / 吉藤英明,
David S. Miller
Cc: Linux Netdev List
[-- Attachment #1: Type: text/plain, Size: 117 bytes --]
__HAVE_ARCH_ADDR_SET seems unused these days, just get rid of it.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
[-- Attachment #2: get_rid_of_HAVE_ARCH_ADDR_SET.patch --]
[-- Type: text/plain, Size: 615 bytes --]
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index f70afef..2ce3941 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -328,7 +328,6 @@ static inline void ipv6_addr_prefix(stru
memset(pfx->s6_addr + o, 0, 16 - o);
}
-#ifndef __HAVE_ARCH_ADDR_SET
static inline void ipv6_addr_set(struct in6_addr *addr,
__be32 w1, __be32 w2,
__be32 w3, __be32 w4)
@@ -338,7 +337,6 @@ static inline void ipv6_addr_set(struct
addr->s6_addr32[2] = w3;
addr->s6_addr32[3] = w4;
}
-#endif
static inline int ipv6_addr_equal(const struct in6_addr *a1,
const struct in6_addr *a2)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] IPV6 : get rid of __HAVE_ARCH_ADDR_SET
2007-05-01 4:00 [PATCH] IPV6 : get rid of __HAVE_ARCH_ADDR_SET Eric Dumazet
@ 2007-05-03 10:09 ` David Miller
2007-05-03 16:32 ` [PATCH] IPV6 : Some cleanups in include/net/ipv6.h Eric Dumazet
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2007-05-03 10:09 UTC (permalink / raw)
To: dada1; +Cc: yoshfuji, netdev
From: Eric Dumazet <dada1@cosmosbay.com>
Date: Tue, 01 May 2007 06:00:09 +0200
> __HAVE_ARCH_ADDR_SET seems unused these days, just get rid of it.
>
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] IPV6 : Some cleanups in include/net/ipv6.h
2007-05-03 10:09 ` David Miller
@ 2007-05-03 16:32 ` Eric Dumazet
2007-05-04 0:39 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2007-05-03 16:32 UTC (permalink / raw)
To: David Miller; +Cc: yoshfuji, netdev
1) struct ip6_flowlabel : moves 'users' field to avoid two 32bits holes for 64bit arches. Shrinks by 8 bytes sizeof(struct ip6_flowlabel)
2) ipv6_addr_cmp() and ipv6_addr_copy() dont need (void *) casts :
Compiler might take into account natural alignement of in6_addr structs to emit better code for memcpy()/memcmp()
Casts to (void *) force byte accesses.
3) ipv6_addr_prefix() optimization :
Better to clear whole struct, as compiler can emit better code for memset(addr, 0, 16) (2 stores on x86_64), and avoid some conditional branches.
# size vmlinux.after vmlinux.before
text data bss dec hex filename
5262262 647612 557432 6467306 62aeea vmlinux.after
5262550 647612 557432 6467594 62b00a vmlinux.before
thats 288 bytes saved.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 2ce3941..e4b16b7 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -204,9 +204,9 @@ struct ip6_flowlabel
{
struct ip6_flowlabel *next;
__be32 label;
+ atomic_t users;
struct in6_addr dst;
struct ipv6_txoptions *opt;
- atomic_t users;
unsigned long linger;
u8 share;
u32 owner;
@@ -291,7 +291,7 @@ static inline int ipv6_addr_src_scope(co
static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2)
{
- return memcmp((const void *) a1, (const void *) a2, sizeof(struct in6_addr));
+ return memcmp(a1, a2, sizeof(struct in6_addr));
}
static inline int
@@ -308,7 +308,7 @@ ipv6_masked_addr_cmp(const struct in6_ad
static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2)
{
- memcpy((void *) a1, (const void *) a2, sizeof(struct in6_addr));
+ memcpy(a1, a2, sizeof(struct in6_addr));
}
static inline void ipv6_addr_prefix(struct in6_addr *pfx,
@@ -319,13 +319,10 @@ static inline void ipv6_addr_prefix(stru
int o = plen >> 3,
b = plen & 0x7;
+ memset(pfx->s6_addr, 0, sizeof(pfx->s6_addr));
memcpy(pfx->s6_addr, addr, o);
- if (b != 0) {
+ if (b != 0)
pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b);
- o++;
- }
- if (o < 16)
- memset(pfx->s6_addr + o, 0, 16 - o);
}
static inline void ipv6_addr_set(struct in6_addr *addr,
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] IPV6 : Some cleanups in include/net/ipv6.h
2007-05-03 16:32 ` [PATCH] IPV6 : Some cleanups in include/net/ipv6.h Eric Dumazet
@ 2007-05-04 0:39 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2007-05-04 0:39 UTC (permalink / raw)
To: dada1; +Cc: yoshfuji, netdev
From: Eric Dumazet <dada1@cosmosbay.com>
Date: Thu, 3 May 2007 18:32:08 +0200
> 1) struct ip6_flowlabel : moves 'users' field to avoid two 32bits holes for 64bit arches. Shrinks by 8 bytes sizeof(struct ip6_flowlabel)
>
> 2) ipv6_addr_cmp() and ipv6_addr_copy() dont need (void *) casts :
> Compiler might take into account natural alignement of in6_addr structs to emit better code for memcpy()/memcmp()
> Casts to (void *) force byte accesses.
>
> 3) ipv6_addr_prefix() optimization :
> Better to clear whole struct, as compiler can emit better code for memset(addr, 0, 16) (2 stores on x86_64), and avoid some conditional branches.
>
> # size vmlinux.after vmlinux.before
> text data bss dec hex filename
> 5262262 647612 557432 6467306 62aeea vmlinux.after
> 5262550 647612 557432 6467594 62b00a vmlinux.before
>
> thats 288 bytes saved.
>
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-05-04 0:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-01 4:00 [PATCH] IPV6 : get rid of __HAVE_ARCH_ADDR_SET Eric Dumazet
2007-05-03 10:09 ` David Miller
2007-05-03 16:32 ` [PATCH] IPV6 : Some cleanups in include/net/ipv6.h Eric Dumazet
2007-05-04 0:39 ` 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).