aboutsummaryrefslogtreecommitdiff
path: root/sys/net/bpf_zerocopy.h
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2008-04-07 02:51:00 +0000
committerRobert Watson <rwatson@FreeBSD.org>2008-04-07 02:51:00 +0000
commita7a91e6592c9ea0d730b460af5753ea82f572843 (patch)
tree22f480af437b5929bf51d1bf686a1ec51d4fd260 /sys/net/bpf_zerocopy.h
parent08304c161774f35956d47dbb3725e2ccb166ed6f (diff)
downloadsrc-a7a91e6592c9ea0d730b460af5753ea82f572843.tar.gz
src-a7a91e6592c9ea0d730b460af5753ea82f572843.zip
Maintain and observe a ZBUF_FLAG_IMMUTABLE flag on zero-copy BPF
buffer kernel descriptors, which is used to allow the buffer currently in the BPF "store" position to be assigned to userspace when it fills, even if userspace hasn't acknowledged the buffer in the "hold" position yet. To implement this, notify the buffer model when a buffer becomes full, and check that the store buffer is writable, not just for it being full, before trying to append new packet data. Shared memory buffers will be assigned to userspace at most once per fill, be it in the store or in the hold position. This removes the restriction that at most one shared memory can by owned by userspace, reducing the chances that userspace will need to call select() after acknowledging one buffer in order to wait for the next buffer when under high load. This more fully realizes the goal of zero system calls in order to process a high-speed packet stream from BPF. Update bpf.4 to reflect that both buffers may be owned by userspace at once; caution against assuming this.
Notes
Notes: svn path=/head/; revision=177966
Diffstat (limited to 'sys/net/bpf_zerocopy.h')
-rw-r--r--sys/net/bpf_zerocopy.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/net/bpf_zerocopy.h b/sys/net/bpf_zerocopy.h
index 33d1f25041d8..92186a84553c 100644
--- a/sys/net/bpf_zerocopy.h
+++ b/sys/net/bpf_zerocopy.h
@@ -40,8 +40,10 @@ void bpf_zerocopy_append_bytes(struct bpf_d *d, caddr_t buf, u_int offset,
void *src, u_int len);
void bpf_zerocopy_append_mbuf(struct bpf_d *d, caddr_t buf, u_int offset,
void *src, u_int len);
+void bpf_zerocopy_buffull(struct bpf_d *);
void bpf_zerocopy_bufheld(struct bpf_d *);
int bpf_zerocopy_canfreebuf(struct bpf_d *);
+int bpf_zerocopy_canwritebuf(struct bpf_d *);
void bpf_zerocopy_free(struct bpf_d *d);
int bpf_zerocopy_ioctl_getzmax(struct thread *td, struct bpf_d *d,
size_t *i);