public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Rui <wirelesser@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: multi bpf filter will impact performance?
Date: Tue, 30 Nov 2010 12:17:16 +0100	[thread overview]
Message-ID: <1291115836.2904.49.camel@edumazet-laptop> (raw)
In-Reply-To: <AANLkTikx68M43+vv+Rav_HCJMJnuc15TtuBgmbv2xP=U@mail.gmail.com>

Le mardi 30 novembre 2010 à 17:22 +0800, Rui a écrit :

> PCAP_FRAMES=32000 ./tcpdump_MMAP -i eth4 'udp dst port 2152 and (
> (((ether[48:1]&0x07)>0) and
> (((ether[66:1]+ether[67:1]+ether[68:1]+ether[69:1]+ether[70:1]+ether[71:1]+ether[72:1]+ether[73:1])&0x03)==0))
> or (((ether[48:1]&0x07)==0) and
> (((ether[62:1]+ether[63:1]+ether[64:1]+ether[65:1]+ether[66:1]+ether[67:1]+ether[68:1]+ether[69:1])&0x03)==0))
> ) ' -w /dev/null -s 4096 2>f1.log &

(000) ldh      [12]
(001) jeq      #0x86dd          jt 2	jf 6
(002) ldb      [20]
(003) jeq      #0x11            jt 4	jf 95
(004) ldh      [56]
(005) jeq      #0x868           jt 14	jf 95
(006) jeq      #0x800           jt 7	jf 95
(007) ldb      [23]
(008) jeq      #0x11            jt 9	jf 95
(009) ldh      [20]
(010) jset     #0x1fff          jt 95	jf 11
(011) ldxb     4*([14]&0xf)
(012) ldh      [x + 16]
(013) jeq      #0x868           jt 14	jf 95
(014) ldb      [48]
(015) and      #0x7
(016) ldx      #0x0
(017) jgt      x                jt 18	jf 55
(018) ldb      [66]
(019) st       M[4]
(020) ldb      [67]
(021) tax      
(022) ld       M[4]
(023) add      x
(024) st       M[6]
(025) ldb      [68]
(026) tax      
(027) ld       M[6]
(028) add      x
(029) st       M[8]
(030) ldb      [69]
(031) tax      
(032) ld       M[8]
(033) add      x
(034) st       M[10]
(035) ldb      [70]
(036) tax      
(037) ld       M[10]
(038) add      x
(039) st       M[12]
(040) ldb      [71]
(041) tax      
(042) ld       M[12]
(043) add      x
(044) st       M[14]
(045) ldb      [72]
(046) tax      
(047) ld       M[14]
(048) add      x
(049) st       M[0]
(050) ldb      [73]
(051) tax      
(052) ld       M[0]
(053) add      x

[deleted part]

Ouch... we miss a "add{bh } [byteoff]" instruction, or "ldx{bh } [byteoff]"

ldb	[66]
ldxb	[67]
add	x
ldxb	[68]
add	x
ldxb	[69]
add	x
ldxb	[70]
add	x
ldxb	[71]
add	x
ldxb	[72]
add	x
ldxb	[73]
add	x
...

With current instruction set, pcap optimizer could at least do something like :

ldb	[66]
tax
ldb	[67]
add	x
tax
ldb	[68]
add	x
tax
ldb	[69]
add	x
tax
ldb	[70]
add	x
tax
ldb	[71]
add	x
tax
ldb	[72]
add	x
tax
ldb	[73]
add	x
...




      parent reply	other threads:[~2010-11-30 11:17 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-30  9:22 multi bpf filter will impact performance? Rui
2010-11-30  9:34 ` Eric Dumazet
     [not found]   ` <AANLkTi=VpmnrXTBNV7McQm6mq9ULT7KTKbM8_hLPoL=2@mail.gmail.com>
     [not found]     ` <1291127670.2904.96.camel@edumazet-laptop>
2010-12-01  3:48       ` Rui
2010-12-01  4:03         ` Eric Dumazet
2010-12-01  7:45           ` [PATCH net-next-2.6] filter: add SKF_AD_RXHASH and SKF_AD_CPU Eric Dumazet
2010-12-01  8:03             ` Changli Gao
2010-12-06 21:02             ` David Miller
2010-12-03  9:40           ` multi bpf filter will impact performance? Junchang Wang
2010-12-01  7:36         ` Changli Gao
2010-12-01  7:47           ` Eric Dumazet
2010-12-01  7:59             ` Changli Gao
2010-12-01  8:09               ` Eric Dumazet
2010-12-01  8:15                 ` Changli Gao
2010-12-01  8:42                   ` Eric Dumazet
2010-12-01 17:22                     ` Hagen Paul Pfeifer
2010-12-01 18:18                       ` David Miller
2010-12-01 18:24                         ` David Miller
2010-12-01 18:24                         ` Eric Dumazet
2010-12-01 18:44                           ` David Miller
2010-12-01 19:48                             ` Eric Dumazet
2010-12-01 20:23                               ` David Miller
2010-12-01 20:45                                 ` [PATCH net-next-2.6] filter: add a security check at install time Eric Dumazet
2010-12-02  2:30                                   ` Changli Gao
2010-12-02  6:46                                     ` Eric Dumazet
2010-12-02  8:11                                       ` Changli Gao
2010-12-02  8:53                                         ` Eric Dumazet
2010-12-02  9:00                                           ` Eric Dumazet
2010-12-02  9:10                                             ` Changli Gao
2010-12-02  9:54                                               ` Eric Dumazet
2010-12-02 10:10                                                 ` Changli Gao
2010-12-02 11:15                                                   ` Eric Dumazet
2010-12-02 11:29                                                     ` Changli Gao
2010-12-02 13:14                                                       ` Eric Dumazet
2010-12-02 10:59                                             ` Changli Gao
2010-12-06 21:07                                       ` David Miller
2010-12-03  6:32                         ` multi bpf filter will impact performance? Eric Dumazet
2010-12-05 20:53                           ` PATCH] filter: fix sk_filter rcu handling Eric Dumazet
2010-12-05 21:08                             ` Andi Kleen
2010-12-05 21:28                               ` Eric Dumazet
2010-12-06 17:29                             ` David Miller
2010-11-30 10:01 ` multi bpf filter will impact performance? Eric Dumazet
2010-11-30 11:17 ` Eric Dumazet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291115836.2904.49.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=wirelesser@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox