Zero-Copy for packet capture and mbuf question

Jon Schipp jonschipp at
Thu Sep 15 02:03:26 UTC 2011

Has anyone used the zero-copy mechanism for an increased performance in
packet capturing?
I'm on FreeBSD 8.2-RELEASE, I was thinking about trying it. It's for a
network monitoring system, it just grabs and dumps all data
from all my network segments. I've noticed improvements by increasing the
bpf buf size and maxbufsize which in turned increased the
initial buffer size for libpcap. I'm dropping less now.

In 8.2, is turning on zero-copy as simple as changing the value of
I can't seem to find much information that shows that it's this simple.
Right now it seems that if I want to use zero-copy for sends
I would have to recompile the kernel with: options ZERO_COPY_SOCKETS
But for receives, which is only what I'm concerned about, it seems that I
just turn it on via sysctl.

*I see that in 9.0 it will be on by default*

Another question: I'm assuming all packets get copied to an mbuf from the
NIC and then copied again to the bpf device/bpf buffer. Can anyone verify
I don't think raising my mbufs will help, since a few hundred are free
during peak hours. Will increasing the amount of mbuf clusters (nmbclusters)
only help when you are pushing the threshold i.e. running out? Also, out of
curiousity, is it possible to increase the amount of mbufs as opposed to the
amount of mbuf clusters?

Any help is appreciated.
- Jon

VMB: 812-682-0231

Dubois County Linux User Group -
Southern Indiana Computer Klub -
Bloomington FOOLS -
BloomingLabs -
ISSA-Kentuckiana  -

GPG Key ID: 810903CB
Key fingerprint = 0069 ED69 EABB DF84 5983  AD3C 6C20 BEFD 8109 03CB

More information about the freebsd-performance mailing list