freebsd-nq/share
Alexander V. Chernikov 51ec1eb70d - Improve performace for writer-only BPF users.
Linux and Solaris (at least OpenSolaris) has PF_PACKET socket families to send
raw ethernet frames. The only FreeBSD interface that can be used to send raw frames
is BPF. As a result, many programs like cdpd, lldpd, various dhcp stuff uses
BPF only to send data. This leads us to the situation when software like cdpd,
being run on high-traffic-volume interface significantly reduces overall performance
since we have to acquire additional locks for every packet.

Here we add sysctl that changes BPF behavior in the following way:
If program came and opens BPF socket without explicitly specifyin read filter we
assume it to be write-only and add it to special writer-only per-interface list.
This makes bpf_peers_present() return 0, so no additional overhead is introduced.
After filter is supplied, descriptor is added to original per-interface list permitting
packets to be captured.

Unfortunately, pcap_open_live() sets catch-all filter itself for the purpose of
setting snap length.

Fortunately, most programs explicitly sets (event catch-all) filter after that.
tcpdump(1) is a good example.

So a bit hackis approach is taken: we upgrade description only after second
BIOCSETF is received.

Sysctl is named net.bpf.optimize_writers and is turned off by default.

- While here, document all sysctl variables in bpf.4

Sponsored by Yandex LLC

Reviewed by:    glebius (previous version)
Reviewed by:    silence on -net@
Approved by:    (mentor)

MFC after:      4 weeks
2012-04-06 06:55:21 +00:00
..
colldef Add lv_LV, move lt_LT to common part 2009-09-03 16:53:11 +00:00
dict Various changes from various sources: 2010-09-23 11:19:03 +00:00
doc Add Bv9ARM.pdf to the list of docs to install. 2012-04-04 23:58:41 +00:00
examples Add a few more examples 2012-03-24 23:10:18 +00:00
i18n Add the BSD-licensed Citrus iconv to the base system with default off 2011-02-25 00:04:39 +00:00
info
man - Improve performace for writer-only BPF users. 2012-04-06 06:55:21 +00:00
me
misc Add myself 2012-03-01 20:03:44 +00:00
mk Assume a big-endian default on MIPS and drop the "eb" suffix from MACHINE_ARCH. 2012-03-29 02:54:35 +00:00
mklocale Add lv_LV, move lt_LT to common part 2009-09-03 17:12:45 +00:00
monetdef Fix the number of decimal digits used for Swiss Francs (0 -> 2). Found by the libc++ test suite. If there is some locale test suite somewhere, it might be worth running it... 2011-11-12 14:39:20 +00:00
msgdef Add lv_LV 2009-09-04 06:19:37 +00:00
numericdef Add lv_LV 2009-09-03 17:37:23 +00:00
security Remove stale references to utmp(5) and its corresponding filenames. 2010-01-21 17:25:12 +00:00
sendmail
skel skel/.shrc: Improve commented CDPATH example for POSIX requirements. 2011-06-10 13:47:11 +00:00
snmp
syscons Include descriptions for keymaps missing from INDEX.keymaps. This fixes 2011-09-13 21:15:23 +00:00
tabset
termcap Remove superfluous paragraph macro. 2012-03-25 09:23:10 +00:00
timedef Partial fix for PR 91106. Correct the short weekday names. Done according to this poll https://bugzilla.redhat.com/show_bug.cgi?id=242296. This will not close the bug fully yet, as the month names are still not correctly in Genitive. More research on this topic will be done, as I'm suspecting a bug in the libc locale functions picking the month name from the wrong group. 2011-02-27 21:32:25 +00:00
zoneinfo Officially speaking, the zoneinfo data files are contributed data. 2010-02-25 06:44:16 +00:00
Makefile Add the BSD-licensed Citrus iconv to the base system with default off 2011-02-25 00:04:39 +00:00
Makefile.inc