]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Implement flexible BPF timestamping framework.
authorJung-uk Kim <jkim@FreeBSD.org>
Tue, 15 Jun 2010 19:28:44 +0000 (19:28 +0000)
committerJung-uk Kim <jkim@FreeBSD.org>
Tue, 15 Jun 2010 19:28:44 +0000 (19:28 +0000)
commit547d94bde34f99a8068431bc4cf680ee9dbb1816
tree7fbda1d0820b3e7d313b910158875757fdde63ff
parentbf9659591505fa132580ae8ffb7cabfae6875bda
Implement flexible BPF timestamping framework.

- Allow setting format, resolution and accuracy of BPF time stamps per
listener.  Previously, we were only able to use microtime(9).  Now we can
set various resolutions and accuracies with ioctl(2) BIOCSTSTAMP command.
Similarly, we can get the current resolution and accuracy with BIOCGTSTAMP
command.  Document all supported options in bpf(4) and their uses.

- Introduce new time stamp 'struct bpf_ts' and header 'struct bpf_xhdr'.
The new time stamp has both 64-bit second and fractional parts.  bpf_xhdr
has this time stamp instead of 'struct timeval' for bh_tstamp.  The new
structures let us use bh_tstamp of same size on both 32-bit and 64-bit
platforms without adding additional shims for 32-bit binaries.  On 64-bit
platforms, size of BPF header does not change compared to bpf_hdr as its
members are already all 64-bit long.  On 32-bit platforms, the size may
increase by 8 bytes.  For backward compatibility, struct bpf_hdr with
struct timeval is still the default header unless new time stamp format is
explicitly requested.  However, the behaviour may change in the future and
all relevant code is wrapped around "#ifdef BURN_BRIDGES" for now.

- Add experimental support for tagging mbufs with time stamps from a lower
layer, e.g., device driver.  Currently, mbuf_tags(9) is used to tag mbufs.
The time stamps must be uptime in 'struct bintime' format as binuptime(9)
and getbinuptime(9) do.

Reviewed by: net@
share/man/man4/bpf.4
sys/kern/kern_tc.c
sys/net/bpf.c
sys/net/bpf.h
sys/net/bpfdesc.h
sys/sys/time.h