filter: optimize accesses to ancillary data
authorEric Dumazet <eric.dumazet@gmail.com>
Wed, 15 Dec 2010 19:45:28 +0000 (19:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Dec 2010 20:30:12 +0000 (12:30 -0800)
We can translate pseudo load instructions at filter check time to
dedicated instructions to speed up filtering and avoid one switch().
libpcap currently uses SKF_AD_PROTOCOL, but custom filters probably use
other ancillary accesses.

Note : I made the assertion that ancillary data was always accessed with
BPF_LD|BPF_?|BPF_ABS instructions, not with BPF_LD|BPF_?|BPF_IND ones
(offset given by K constant, not by K + X register)

On x86_64, this saves a few bytes of text :

# size net/core/filter.o.*
   text    data     bss     dec     hex filename
   4864       0       0    4864    1300 net/core/filter.o.new
   4944       0       0    4944    1350 net/core/filter.o.old

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

No differences found