[pisa-src] Re: r1546 - trunk/libpisa/arp.c

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Fri, 6 Nov 2009 08:13:25 +0100

On Fri, Nov 06, 2009 at 02:10:55AM +0100, Mircea Gherzan wrote:
> Log:
> libpisa: uninline pisa_arp_cache_find
> 
> Get rid of the following warning:
> libpisa/arp.c:61: warning: inlining failed in call to 'pisa_arp_cache_find'
> 
> HASH_FIND is actually a little monster, so routines that use it are NOT
> supposed to be declared inline.

I have to admit that this macro produces more code than the one line suggests.
Funny thing is that no other platform complains. The new inline warning about
pisa_ipv6_copy (which is just a memcpy wrapper IIRC) suggests that the
compiler has a general problem with inlining rather than this being a serious
warning.

The reason why I inlined this function in the first place is that ARP lookup
is performed for every packet and thus may have an impact on throughput. There
are two calls to pisa_arp_cache_find and considering that pisa_arp_cache_find
is just a wrapper around HASH_FIND it was an elegant solution to have no
duplicate code. If we really cannot have inline in that place, we should move
the HASH_FIND line to the two calling functions IMO. It's not worth building
up a stack frame for a hash lookup alone.

-- 
Thomas Jansen, "Mithi" --- mithi@xxxxxxxxx
GPG 9D5C682B, feel free to sign or encrypt your mail

Other related posts: