From: Joe Perches <joe@perches.com> Date: 2012-10-10 18:42:44
Reduces object size and should be slightly faster.
allyesconfig:
$ size net/core/pktgen.o*
text data bss dec hex filename
52251 4293 11824 68368 10b10 net/core/pktgen.o.new
52310 4293 11848 68451 10b63 net/core/pktgen.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
Found by looking for if (foo) ; tests with a perl regex
Yes Eric, it could be 2 compares instead of 4 on 64-bit
systems with HAS_EFFICIENT_UNALIGNED_ACCESS. Maybe later
or if there are other tests that could become something
like ipv6_is_zeronet.
cheers, Joe
net/core/pktgen.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
From: Brian Haley <hidden> Date: 2012-10-10 18:59:34
On 10/10/2012 02:42 PM, Joe Perches wrote:
quoted hunk
Found by looking for if (foo) ; tests with a perl regex
Yes Eric, it could be 2 compares instead of 4 on 64-bit
systems with HAS_EFFICIENT_UNALIGNED_ACCESS. Maybe later
or if there are other tests that could become something
like ipv6_is_zeronet.
cheers, Joe
net/core/pktgen.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
From: Eric Dumazet <hidden> Date: 2012-10-10 19:01:57
On Wed, 2012-10-10 at 11:42 -0700, Joe Perches wrote:
quoted hunk
Reduces object size and should be slightly faster.
allyesconfig:
$ size net/core/pktgen.o*
text data bss dec hex filename
52251 4293 11824 68368 10b10 net/core/pktgen.o.new
52310 4293 11848 68451 10b63 net/core/pktgen.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
Found by looking for if (foo) ; tests with a perl regex
Yes Eric, it could be 2 compares instead of 4 on 64-bit
systems with HAS_EFFICIENT_UNALIGNED_ACCESS. Maybe later
or if there are other tests that could become something
like ipv6_is_zeronet.
cheers, Joe
net/core/pktgen.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
From: Joe Perches <joe@perches.com> Date: 2012-10-10 19:23:29
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(-)
From: Joe Perches <joe@perches.com> Date: 2012-10-10 19:38:48
ipv4 and ipv6 use different styles for these tests.
ipv4_is_<foo>(__be32)
ipv6_addr_<foo>(struct in6_addr *)
Perhaps it'd be good to convert the ipv4 tests to the ipv6 style.
There are ~100 instances of ipv4_is_<foo> tests treewide.
From: Joe Perches <joe@perches.com> Date: 2012-10-11 00:56:22
Maybe all the is_<foo>_ether_addr functions should be renamed
to eth_addr_<foo> for more api/style symmetry.
$ git grep --name-only -E "\bis_\w+_ether_addr" | \
xargs sed -r -i -e 's/\bis_(\w+)_ether_addr\b/eth_addr_\1/g'
$ git diff --shortstat
304 files changed, 690 insertions(+), 690 deletions(-)
Maybe add #defines of the old names for a few releases.
From: Cong Wang <hidden> Date: 2012-10-11 02:18:58
On Thu, Oct 11, 2012 at 3:23 AM, Joe Perches [off-list ref] wrote:
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>
Looks good.
This should go to -net, net-next is not open currently.
Thanks.
Given the likely values, it might be worth using:
if (pkt_dev->min_in6_daddr.s6_addr32[0] == 0 &&
pkt_dev->min_in6_daddr.s6_addr32[1] |
pkt_dev->min_in6_daddr.s6_addr32[2] |
pkt_dev->min_in6_daddr.s6_addr32[3]) {
David
From: David Laight <hidden> Date: 2012-10-11 08:21:50
ipv4 and ipv6 use different styles for these tests.
ipv4_is_<foo>(__be32)
ipv6_addr_<foo>(struct in6_addr *)
I presume there is a 'const' in there ...
Perhaps it'd be good to convert the ipv4 tests to the ipv6 style.
You don't want to force an IPv4 address (which might be in a register)
be written out to stack.
Taking the address also has implications for the optimiser.
David
From: Joe Perches <joe@perches.com> Date: 2012-10-11 08:28:39
On Thu, 2012-10-11 at 09:11 +0100, David Laight wrote:
quoted
ipv4 and ipv6 use different styles for these tests.
ipv4_is_<foo>(__be32)
ipv6_addr_<foo>(struct in6_addr *)
I presume there is a 'const' in there ...
quoted
Perhaps it'd be good to convert the ipv4 tests to the ipv6 style.
You don't want to force an IPv4 address (which might be in a register)
be written out to stack.
Taking the address also has implications for the optimiser.
From: David Miller <davem@davemloft.net> Date: 2012-10-11 19:21:03
From: Joe Perches <joe@perches.com>
Date: Wed, 10 Oct 2012 12:23:25 -0700
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>