Remove two unnecessary sleeps from the hot path in bpf(4).
authorloos <loos@FreeBSD.org>
Fri, 31 Jul 2015 21:43:27 +0000 (21:43 +0000)
committerloos <loos@FreeBSD.org>
Fri, 31 Jul 2015 21:43:27 +0000 (21:43 +0000)
commitbf2e4c78057eef31cf6b3f9fb821c49b900a87db
tree9061d7b2530d1551af11b9133664d91aa8ee7be6
parent89fd02fd8c0a24cebacf3d3426a7b7c94363b5e1
Remove two unnecessary sleeps from the hot path in bpf(4).

The first one never triggers because bpf_canfreebuf() can only be true for
zero-copy buffers and zero-copy buffers are not read with read(2).

The second also never triggers, because we check the free buffer before
calling ROTATE_BUFFERS().  If the hold buffer is in use the free buffer
will be NULL and there is nothing else to do besides drop the packet.  If
the free buffer isn't NULL the hold buffer _is_ free and it is safe to
rotate the buffers.

Update the comment in ROTATE_BUFFERS macro to match the logic described
here.

While here fix a few typos in comments.

MFC after: 2 weeks
Sponsored by: Rubicon Communications (Netgate)
sys/net/bpf.c
sys/net/bpf.h