Deleted Added
full compact
drbr.9 (233648) drbr.9 (241037)
1.\" Copyright (c) 2009 Bitgravity Inc
2.\" Written by: Kip Macy <kmacy@@FreeBSD.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
1.\" Copyright (c) 2009 Bitgravity Inc
2.\" Written by: Kip Macy <kmacy@@FreeBSD.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD: head/share/man/man9/drbr.9 233648 2012-03-29 05:02:12Z eadler $
26.\" $FreeBSD: head/share/man/man9/drbr.9 241037 2012-09-28 18:28:27Z glebius $
27.\"
27.\"
28.Dd January 30, 2012
28.Dd September 27, 2012
29.Dt DRBR 9
30.Os
31.Sh NAME
32.Nm drbr ,
33.Nm drbr_free ,
34.Nm drbr_enqueue ,
35.Nm drbr_dequeue ,
36.Nm drbr_dequeue_cond ,
37.Nm drbr_flush ,
38.Nm drbr_empty ,
39.Nm drbr_inuse ,
29.Dt DRBR 9
30.Os
31.Sh NAME
32.Nm drbr ,
33.Nm drbr_free ,
34.Nm drbr_enqueue ,
35.Nm drbr_dequeue ,
36.Nm drbr_dequeue_cond ,
37.Nm drbr_flush ,
38.Nm drbr_empty ,
39.Nm drbr_inuse ,
40.Nm drbr_stats_update ,
41.Nd network driver interface to buf_ring
42.Sh SYNOPSIS
43.In sys/param.h
44.In net/if.h
45.In net/if_var.h
46.Ft void
47.Fn drbr_free "struct buf_ring *br" "struct malloc_type *type"
48.Ft int
49.Fn drbr_enqueue "struct ifnet *ifp" "struct buf_ring *br" "struct mbuf *m"
50.Ft struct mbuf *
51.Fn drbr_dequeue "struct ifnet *ifp" "struct buf_ring *br"
52.Ft struct mbuf *
53.Fn drbr_dequeue_cond "struct ifnet *ifp" "struct buf_ring *br" "int (*func) (struct mbuf *, void *)" "void *arg"
54.Ft void
55.Fn drbr_flush "struct ifnet *ifp" "struct buf_ring *br"
56.Ft int
57.Fn drbr_empty "struct ifnet *ifp" "struct buf_ring *br"
58.Ft int
59.Fn drbr_inuse "struct ifnet *ifp" "struct buf_ring *br"
40.Nd network driver interface to buf_ring
41.Sh SYNOPSIS
42.In sys/param.h
43.In net/if.h
44.In net/if_var.h
45.Ft void
46.Fn drbr_free "struct buf_ring *br" "struct malloc_type *type"
47.Ft int
48.Fn drbr_enqueue "struct ifnet *ifp" "struct buf_ring *br" "struct mbuf *m"
49.Ft struct mbuf *
50.Fn drbr_dequeue "struct ifnet *ifp" "struct buf_ring *br"
51.Ft struct mbuf *
52.Fn drbr_dequeue_cond "struct ifnet *ifp" "struct buf_ring *br" "int (*func) (struct mbuf *, void *)" "void *arg"
53.Ft void
54.Fn drbr_flush "struct ifnet *ifp" "struct buf_ring *br"
55.Ft int
56.Fn drbr_empty "struct ifnet *ifp" "struct buf_ring *br"
57.Ft int
58.Fn drbr_inuse "struct ifnet *ifp" "struct buf_ring *br"
60.Ft void
61.Fn drbr_stats_update "struct ifnet *ifp" "int len" "int mflags"
62.Sh DESCRIPTION
63The
64.Nm
65functions provide an API to network drivers for using
66.Xr buf_ring 9
67for enqueueing and dequeueing packets.
68This is meant as a replacement for the IFQ interface for packet queuing.
69It allows a packet to be enqueued with a single atomic and packet

--- 48 unchanged lines hidden (view full) ---

118.Fn drbr_inuse
119function returns the number of mbufs enqueued.
120Note to users that this is intrinsically racy as there is no guarantee that
121there will not be more mbufs when
122.Fn drbr_dequeue
123is actually called.
124Provided the tx queue lock is held there will not be less.
125.Pp
59.Sh DESCRIPTION
60The
61.Nm
62functions provide an API to network drivers for using
63.Xr buf_ring 9
64for enqueueing and dequeueing packets.
65This is meant as a replacement for the IFQ interface for packet queuing.
66It allows a packet to be enqueued with a single atomic and packet

--- 48 unchanged lines hidden (view full) ---

115.Fn drbr_inuse
116function returns the number of mbufs enqueued.
117Note to users that this is intrinsically racy as there is no guarantee that
118there will not be more mbufs when
119.Fn drbr_dequeue
120is actually called.
121Provided the tx queue lock is held there will not be less.
122.Pp
126The
127.Fn drbr_stats_update
128function updates the number of bytes and the number of multicast packets sent.
129.Sh RETURN VALUES
130The
131.Fn drbr_enqueue
132function returns
133.Er ENOBUFS
134if there are no slots available in the buf_ring and
135.Dv 0
136on success.
137.Pp
138The
139.Fn drbr_dequeue
140and
141.Fn drbr_dequeue_cond
142functions return an mbuf on success and
143.Dv NULL
144if the buf_ring is empty.
145.Sh HISTORY
146These functions were introduced in
147.Fx 8.0 .
123.Sh RETURN VALUES
124The
125.Fn drbr_enqueue
126function returns
127.Er ENOBUFS
128if there are no slots available in the buf_ring and
129.Dv 0
130on success.
131.Pp
132The
133.Fn drbr_dequeue
134and
135.Fn drbr_dequeue_cond
136functions return an mbuf on success and
137.Dv NULL
138if the buf_ring is empty.
139.Sh HISTORY
140These functions were introduced in
141.Fx 8.0 .