xref: /freebsd/sys/net/bpf_zerocopy.h (revision fe267a559009cbf34f9341666fe4d88a92c02d5e)
14d621040SChristian S.J. Peron /*-
2*fe267a55SPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*fe267a55SPedro F. Giffuni  *
44d621040SChristian S.J. Peron  * Copyright (c) 2007 Seccuris Inc.
54d621040SChristian S.J. Peron  * All rights reserved.
64d621040SChristian S.J. Peron  *
7dde153daSEitan Adler  * This software was developed by Robert N. M. Watson under contract to
84d621040SChristian S.J. Peron  * Seccuris Inc.
94d621040SChristian S.J. Peron  *
104d621040SChristian S.J. Peron  * Redistribution and use in source and binary forms, with or without
114d621040SChristian S.J. Peron  * modification, are permitted provided that the following conditions
124d621040SChristian S.J. Peron  * are met:
134d621040SChristian S.J. Peron  * 1. Redistributions of source code must retain the above copyright
144d621040SChristian S.J. Peron  *    notice, this list of conditions and the following disclaimer.
154d621040SChristian S.J. Peron  * 2. Redistributions in binary form must reproduce the above copyright
164d621040SChristian S.J. Peron  *    notice, this list of conditions and the following disclaimer in the
174d621040SChristian S.J. Peron  *    documentation and/or other materials provided with the distribution.
184d621040SChristian S.J. Peron  *
194d621040SChristian S.J. Peron  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
204d621040SChristian S.J. Peron  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
214d621040SChristian S.J. Peron  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
224d621040SChristian S.J. Peron  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
234d621040SChristian S.J. Peron  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
244d621040SChristian S.J. Peron  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
254d621040SChristian S.J. Peron  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
264d621040SChristian S.J. Peron  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
274d621040SChristian S.J. Peron  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
284d621040SChristian S.J. Peron  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
294d621040SChristian S.J. Peron  * SUCH DAMAGE.
304d621040SChristian S.J. Peron  *
314d621040SChristian S.J. Peron  * $FreeBSD$
324d621040SChristian S.J. Peron  */
334d621040SChristian S.J. Peron 
344d621040SChristian S.J. Peron #ifndef _NET_BPF_ZEROCOPY_H_
354d621040SChristian S.J. Peron #define	_NET_BPF_ZEROCOPY_H_
364d621040SChristian S.J. Peron 
374d621040SChristian S.J. Peron #ifndef _KERNEL
384d621040SChristian S.J. Peron #error "no user-serviceable parts inside"
394d621040SChristian S.J. Peron #endif
404d621040SChristian S.J. Peron 
414d621040SChristian S.J. Peron void	bpf_zerocopy_append_bytes(struct bpf_d *d, caddr_t buf, u_int offset,
424d621040SChristian S.J. Peron 	    void *src, u_int len);
434d621040SChristian S.J. Peron void	bpf_zerocopy_append_mbuf(struct bpf_d *d, caddr_t buf, u_int offset,
444d621040SChristian S.J. Peron 	    void *src, u_int len);
45a7a91e65SRobert Watson void	bpf_zerocopy_buffull(struct bpf_d *);
464d621040SChristian S.J. Peron void	bpf_zerocopy_bufheld(struct bpf_d *);
4729f612ecSChristian S.J. Peron void	bpf_zerocopy_buf_reclaimed(struct bpf_d *);
484d621040SChristian S.J. Peron int	bpf_zerocopy_canfreebuf(struct bpf_d *);
49a7a91e65SRobert Watson int	bpf_zerocopy_canwritebuf(struct bpf_d *);
504d621040SChristian S.J. Peron void	bpf_zerocopy_free(struct bpf_d *d);
514d621040SChristian S.J. Peron int	bpf_zerocopy_ioctl_getzmax(struct thread *td, struct bpf_d *d,
524d621040SChristian S.J. Peron 	    size_t *i);
534d621040SChristian S.J. Peron int	bpf_zerocopy_ioctl_rotzbuf(struct thread *td, struct bpf_d *d,
544d621040SChristian S.J. Peron 	    struct bpf_zbuf *bz);
554d621040SChristian S.J. Peron int	bpf_zerocopy_ioctl_setzbuf(struct thread *td, struct bpf_d *d,
564d621040SChristian S.J. Peron 	    struct bpf_zbuf *bz);
574d621040SChristian S.J. Peron 
584d621040SChristian S.J. Peron #endif /* !_NET_BPF_ZEROCOPY_H_ */
59