1.\" $OpenBSD: ifq_deq_begin.9,v 1.5 2021/03/20 21:02:56 sthen 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: March 20 2021 $ 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 struct 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.Xr ifq_dequeue 9 . 37Their use is discouraged, code should use 38.Xr ifq_dequeue 9 39whenever possible. 40.Bl -tag -width Ds 41.It Fn ifq_deq_begin "struct ifqueue *ifq" 42Get a reference to the next mbuf to be transmitted from the 43.Fa ifq 44interface send queue. 45If an mbuf is to be transmitted, also acquire a lock on the send queue 46to exclude modification or freeing of the referenced mbuf. 47Its packet header must not be modified until the mbuf has been dequeued with 48.Fn ifq_deq_commit . 49.It Fn ifq_deq_commit "struct ifqueue *ifq" "struct mbuf *m" 50Dequeue the mbuf 51.Fa m 52that was referenced by a previous call to 53.Fn ifq_deq_begin 54and release the lock on 55.Fa ifq . 56.It Fn ifq_deq_rollback "struct ifqueue *ifq" "struct mbuf *m" 57Release the lock on the interface send queue 58.Fa ifq 59that was acquired while a reference to 60.Fa m 61was being held. 62.El 63.Sh CONTEXT 64.Fn ifq_deq_begin , 65.Fn ifq_deq_commit , 66and 67.Fn ifq_deq_rollback 68can be called during autoconf, from process context, or from interrupt context. 69.Sh RETURN VALUES 70.Fn ifq_deq_begin 71returns the next mbuf to be transmitted by the interface. 72If no packet is available for transmission, 73.Dv NULL 74is returned. 75.Sh SEE ALSO 76.Xr ifq_dequeue 9 77