From 3f48b319156869e030489e129f5d9648b9f4f410 Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Fri, 20 Nov 2015 11:15:08 +0000 Subject: i made a mistake. rename ifq_enq and ifq_deq to ifq_enqueue and ifq_dequeue fixing it now before i regret it more. --- share/man/man9/ifq_enqueue.9 | 140 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 share/man/man9/ifq_enqueue.9 (limited to 'share/man/man9/ifq_enqueue.9') diff --git a/share/man/man9/ifq_enqueue.9 b/share/man/man9/ifq_enqueue.9 new file mode 100644 index 00000000000..a53bde5e1f0 --- /dev/null +++ b/share/man/man9/ifq_enqueue.9 @@ -0,0 +1,140 @@ +.\" $OpenBSD: ifq_enqueue.9,v 1.1 2015/11/20 11:15:07 dlg Exp $ +.\" +.\" Copyright (c) 2015 David Gwynne +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: November 20 2015 $ +.Dt IFQ_ENQUEUE 9 +.Os +.Sh NAME +.Nm ifq_enqueue , +.Nm ifq_dequeue , +.Nm ifq_deq_begin , +.Nm ifq_deq_commit , +.Nm ifq_deq_rollback , +.Nm ifq_purge , +.Nm ifq_len , +.Nm ifq_empty +.Nd interface send queue API +.Sh SYNOPSIS +.In net/if_var.h +.Ft int +.Fn ifq_enqueue "struct ifqueue *ifq" "struct mbuf *m" +.Ft struft mbuf * +.Fn ifq_dequeue "struct ifqueue *ifq" +.Ft struft mbuf * +.Fn ifq_deq_begin "struct ifqueue *ifq" +.Ft void +.Fn ifq_deq_commit "struct ifqueue *ifq" "struct mbuf *m" +.Ft void +.Fn ifq_deq_rollback "struct ifqueue *ifq" "struct mbuf *m" +.Ft unsigned int +.Fn ifq_purge "struct ifqueue *ifq" +.Ft unsigned int +.Fn ifq_len "struct ifqueue *ifq" +.Ft unsigned int +.Fn ifq_empty "struct ifqueue *ifq" +.Sh DESCRIPTION +The ifqueue API provides implementions of data structures and +operations for the network stack to queue mbufs for a network driver +to dequeue from its start routine for transmission. +.Bl -tag -width Ds +.It Fn ifq_enqueue "struct ifqueue *ifq" "struct mbuf *m" +Enqueue mbuf +.Fa m +on the +.Fa ifq +interface send queue. +If the queue rejects the packet it will be freed with +.Xr m_freem 9 +and counted as a drop. +.It Fn ifq_dequeue "struct ifqueue *ifq" +Dequeue the next mbuf to be transmitted from the +.Fa ifq +interface send queue. +.It Fn ifq_deq_begin "struct ifqueue *ifq" +Get a reference to the next mbuf to be transmitted from the +.Fa ifq +interface send queue. +If an mbuf is to be transmitted, also acquire a lock on the send queue +to exclude modification or freeing of the referenced mbuf. +The mbuf must not be freed, or have its length (m_pkthdr.len) or +cookie (m_pkthdr.ph_cookie) modified until it has been dequeued +completely with +.Fn ifq_deq_commit . +.It Fn ifq_deq_commit "struct ifqueue *ifq" "struct mbuf *m" +Dequeue the mbuf +.Fa m +that was referenced by a previous call to +.Fn ifq_deq_begin +and release the lock on +.Fa ifq . +.It Fn ifq_deq_rollback "struct ifqueue *ifq" "struct mbuf *m" +Release the lock on the interface send queue +.Fa ifq +that was acquired while a reference to +.Fa m +was being held. +.It Fn ifq_purge "struct ifqueue *ifq" +Free all the mbufs on the interface send queue +.Fa ifq . +Freed mbufs will be accounted as drops. +.It Fn ifq_len "struct ifqueue *ifq" +Return the number of mbufs on the interface send queue +.Fa ifq . +Note that while +.Fn ifq_len +may report that mbufs are on the queue, the current queue +discipline may not make them available for dequeueing with +.Fn ifq_dequeue +or +.Fn ifq_deq_begin . +.It Fn ifq_empty "struct ifqueue *ifq" +Return if the interface send queue +.Fa ifq +is empty. +.El +.Sh CONTEXT +.Fn ifq_enqueue , +.Fn ifq_dequeue , +.Fn ifq_deq_begin , +.Fn ifq_deq_commit , +.Fn ifq_deq_rollback , +.Fn ifq_purge , +.Fn ifq_len , +and +.Fn ifq_empty +can be called during autoconf, from process context, or from interrupt context. +.Sh RETURN VALUES +.Fn ifq_enqueue +returns 0 if the mbuf was successfully queued, or non-zero if mbuf was freed. +.Pp +.Fn ifq_dequeue +and +.Fn ifq_deq_begin +return the next mbuf to be transmitted by the interface. +If no packet is available for transmission, +.Dv NULL +is returned. +.Pp +.Fn ifq_purge +returns the number of mbufs that were removed from the queue and freed. +.Pp +.Fn ifq_len +returns the number of mbufs on the queue. +.Pp +.Fn ifq_empty +returns a non-zero value if the queue is empty, otherwise 0. +.Sh SEE ALSO +.Xr m_freem 9 -- cgit v1.2.3