Discussion:
bpfjit
Alexander Nasonov
2012-11-06 08:03:35 UTC
Permalink
Hi,

I enabled bpfjit on sparc but I don't have any hardware to test it.

Can someone from this list help me please?

First, you need to load bpfjit module or add SLJIT and BPFJIT options to
kernel config file.
Second, you need to set net.bpf.jit to 1.

# modload bpfjit
# sysctl -w net.bpf.jit=1

Once it's done, all new filter programs will be compiled into binary
code by the kernel and that code will be passed as a hook to watch for
matching packets.

You can see all jit'ed programs using fstat(1):

$ fstat | grep jit
_tcpdump tcpdump 18471 5* bpf rec=97, dr=0, cap=4, pid=18471, promisc, seesent, jit, idle

Thanks,
Alex
Manuel Bouyer
2012-11-06 08:57:43 UTC
Permalink
Post by Alexander Nasonov
Hi,
I enabled bpfjit on sparc but I don't have any hardware to test it.
You can test with qemu. pkgsrc/misc/py-anita can even set up the VM for you :)
--
Manuel Bouyer <***@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
Alexander Nasonov
2012-11-06 19:56:03 UTC
Permalink
Post by Manuel Bouyer
You can test with qemu. pkgsrc/misc/py-anita can even set up the VM for you :)
I already do some tests (sljit) in qemu through
http://releng.netbsd.org/test-results.html but I'd like to test
flushing of instruction cache on real hardware.

Alex
Martin Husemann
2012-11-10 12:36:52 UTC
Permalink
Post by Alexander Nasonov
# modload bpfjit
# sysctl -w net.bpf.jit=1
Note that you need to do this early with GENERIC{,.MP} kernels on sparc,
as we do not hape options INSECURE, so module loading later will not
work.
Post by Alexander Nasonov
Once it's done, all new filter programs will be compiled into binary
code by the kernel and that code will be passed as a hook to watch for
matching packets.
$ fstat | grep jit
_tcpdump tcpdump 18471 5* bpf rec=97, dr=0, cap=4, pid=18471, promisc, seesent, jit, idle
I only tried a few (trivial) filters, but they seem to work:

_tcpdump tcpdump 401 5* bpf rec=275, dr=0, cap=195, pid=401, promisc, seesent, jit, idle
_tcpdump tcpdump 388 5* bpf rec=748, dr=0, cap=5, pid=388, promisc, seesent, jit, idle


Martin

Loading...