summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/xprintf_int.c
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2012-04-06 06:55:21 +0000
committermelifaro <melifaro@FreeBSD.org>2012-04-06 06:55:21 +0000
commit85ccef88d3440944ee1c97a3fba3e8718d05fb8e (patch)
tree9ef2a8c79325381d2620c436f7de019ef62c053f /lib/libc/stdio/xprintf_int.c
parent8b1d10268c8ffd28f6c4b0da1e3906b139fc94cf (diff)
downloadFreeBSD-src-85ccef88d3440944ee1c97a3fba3e8718d05fb8e.zip
FreeBSD-src-85ccef88d3440944ee1c97a3fba3e8718d05fb8e.tar.gz
- 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
Diffstat (limited to 'lib/libc/stdio/xprintf_int.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud