Subject: Re: [PATCH] netfilter: unfold two critical loops in ip_packet_match()

From: Patrick McHardy <[email-masked]>
Date: Wed, 18 Feb 2009 17:52:22 +0100

Eric Dumazet wrote:
> Patrick McHardy a écrit :
>> In case of IPv4 and IPv6 they are already suitable aligned, it
>> simply performing the comparison in unsigned long quantities.
>> struct arpt_arp unfortunately doesn't properly align the interface
>> names, so we need to continue to do byte-wise comparisons.
>>
> I see, but #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS can help here ;)

get_unaligned() would work as well I guess. But we don't seem to
have a get_unaligned_long().

> ifname_compare() should be static in three files (ipv4_ip_tables, ipv6_ip_tables and arp_tables),
> since only arp_tables variant has the alignement problem.
> 
> [PATCH] netfilter: unfold two critical loops in arp_packet_match()
> 
> x86 and powerpc can perform long word accesses in an efficient maner.
> We can use this to unroll two loops in arp_packet_match(), to
> perform arithmetic on long words instead of bytes. This is a win
> on x86_64 for example.

This looks good to me. Applied, thanks.