1.\" $OpenBSD: ifq_deq_begin.9,v 1.2 2015/11/23 11:07:58 jmc Exp $ 2.\" 3.\" Copyright (c) 2015 David Gwynne <dlg@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: November 23 2015 $ 18.Dt IFQ_DEQ_BEGIN 9 19.Os 20.Sh NAME 21.Nm ifq_deq_begin , 22.Nm ifq_deq_commit , 23.Nm ifq_deq_rollback 24.Nd dequeue an mbuf from an interface sending queue 25.Sh SYNOPSIS 26.In net/if_var.h 27.Ft struft mbuf * 28.Fn ifq_deq_begin "struct ifqueue *ifq" 29.Ft void 30.Fn ifq_deq_commit "struct ifqueue *ifq" "struct mbuf *m" 31.Ft void 32.Fn ifq_deq_rollback "struct ifqueue *ifq" "struct mbuf *m" 33.Sh DESCRIPTION 34The ifq_deq_* 35set of functions provides a non-atomic alternative to 36.Fn ifq_dequeue . 37.Bl -tag -width Ds 38.It Fn ifq_deq_begin "struct ifqueue *ifq" 39Get a reference to the next mbuf to be transmitted from the 40.Fa ifq 41interface send queue. 42If an mbuf is to be transmitted, also acquire a lock on the send queue 43to exclude modification or freeing of the referenced mbuf. 44Its packet header must not be modified until the mbuf has been dequeued with 45.Fn ifq_deq_commit . 46.It Fn ifq_deq_commit "struct ifqueue *ifq" "struct mbuf *m" 47Dequeue the mbuf 48.Fa m 49that was referenced by a previous call to 50.Fn ifq_deq_begin 51and release the lock on 52.Fa ifq . 53.It Fn ifq_deq_rollback "struct ifqueue *ifq" "struct mbuf *m" 54Release the lock on the interface send queue 55.Fa ifq 56that was acquired while a reference to 57.Fa m 58was being held. 59.El 60.Sh CONTEXT 61.Fn ifq_deq_begin , 62.Fn ifq_deq_commit , 63and 64.Fn ifq_deq_rollback 65can be called during autoconf, from process context, or from interrupt context. 66.Sh RETURN VALUES 67.Fn ifq_deq_begin 68returns the next mbuf to be transmitted by the interface. 69If no packet is available for transmission, 70.Dv NULL 71is returned. 72.Sh SEE ALSO 73.Xr ifq_dequeue 9 74