lkml.org 
[lkml]   [2012]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH net-next? V2] pktgen: Use simpler test for non-zero ipv6 address
From
Date
Reduces object size and should be slightly faster.

allyesconfig:
$ size net/core/pktgen.o*
text data bss dec hex filename
52284 4321 11840 68445 10b5d net/core/pktgen.o.new
52310 4293 11848 68451 10b63 net/core/pktgen.o.old

Signed-off-by: Joe Perches <joe@perches.com>
---
> What about ipv6_addr_any() ?

That's better I guess.
I forgot about it and didn't see it.
I saw the IPV6_ADDR_ANY type tests and
didn't look further.

Anyway, it's odd that it generates slightly larger code
than the original patch's direct tests in 32bit with
gcc 4.7.2. Perhaps an interesting lack of optimization?

cheers, Joe

net/core/pktgen.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 148e73d..a811a7d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2422,11 +2422,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
}
} else { /* IPV6 * */

- if (pkt_dev->min_in6_daddr.s6_addr32[0] == 0 &&
- pkt_dev->min_in6_daddr.s6_addr32[1] == 0 &&
- pkt_dev->min_in6_daddr.s6_addr32[2] == 0 &&
- pkt_dev->min_in6_daddr.s6_addr32[3] == 0) ;
- else {
+ if (!ipv6_addr_any(&pkt_dev->min_in6_daddr)) {
int i;

/* Only random destinations yet */



\
 
 \ /
  Last update: 2012-10-10 22:01    [W:0.096 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site