[OpenBSD]

Manual Page Search Parameters
IFQ_ENQUEUE(9) Kernel Developer's Manual IFQ_ENQUEUE(9)

ifq_enqueue, ifq_dequeue, ifq_purge, ifq_len, ifq_empty, ifq_hdatalen, ifq_set_oactive, ifq_clr_oactive, ifq_is_oactive, ifq_restart, ifq_barrier
interface send queue API

#include <net/if_var.h>

int
ifq_enqueue(struct ifqueue *ifq, struct mbuf *m);

struft mbuf *
ifq_dequeue(struct ifqueue *ifq);

unsigned int
ifq_purge(struct ifqueue *ifq);

unsigned int
ifq_len(struct ifqueue *ifq);

unsigned int
ifq_empty(struct ifqueue *ifq);

int
ifq_hdatalen(struct ifqueue *ifq);

void
ifq_set_oactive(struct ifqueue *ifq);

void
ifq_clr_oactive(struct ifqueue *ifq);

unsigned int
ifq_is_oactive(struct ifqueue *ifq);

void
ifq_restart(struct ifqueue *ifq);

void
ifq_barrier(struct ifqueue *ifq);

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.
ifq_enqueue(struct ifqueue *ifq, struct mbuf *m)
Enqueue mbuf m on the ifq interface send queue. If the queue rejects the packet it will be freed with m_freem(9) and counted as a drop.
ifq_dequeue(struct ifqueue *ifq)
Dequeue the next mbuf to be transmitted from the ifq interface send queue.
ifq_purge(struct ifqueue *ifq)
Free all the mbufs on the interface send queue ifq. Freed mbufs will be accounted as drops.
ifq_len(struct ifqueue *ifq)
Return the number of mbufs on the interface send queue ifq. Note that while ifq_len() may report that mbufs are on the queue, the current queue discipline may not make them available for dequeueing with ifq_dequeue() or ifq_deq_begin().
ifq_empty(struct ifqueue *ifq)
Return if the interface send queue ifq is empty.
ifq_hdatalen(struct ifqueue *ifq)
Return the number of bytes in the mbuf at the head of the interface send queue ifq.
ifq_set_oactive(struct ifqueue *ifq)
ifq_set_oactive() is called by the relevant driver to mark the hardware associated with the interface send queue ifq as unable to transmit more packets.
ifq_clr_oactive(struct ifqueue *ifq)
ifq_clr_oactive() is called by the relevant driver to clear the "active" mark on the hardware associated with the interface send queue ifq, meaning it is now able to transmit packets.
ifq_is_oactive(struct ifqueue *ifq)
Return if the hardware associated with the interface send queue ifq is unable to transmit more packets.
ifq_restart(struct ifqueue *ifq)
Dispatch a call to ifq_clr_oactive() and the interface's start routine. This call is serialised with other calls to the start routine via if_start() and therefore provides race free modification of the "active" mark.
ifq_barrier(struct ifqueue *ifq)
ifq_barrier() guarantees that any work currently running in the interface queue serialiser (e.g. work dispatched by ifq_restart() or the interface's start routine) has finished before ifq_barrier() returns.

ifq_enqueue(), ifq_dequeue(), ifq_purge(), ifq_len(), ifq_empty(), ifq_hdatalen(), ifq_set_oactive(), ifq_clr_oactive(), ifq_is_oactive(), and ifq_restart() can be called during autoconf, from process context, or from interrupt context.

ifq_barrier() can be called from process context.

ifq_enqueue() returns 0 if the mbuf was successfully queued, or non-zero if mbuf was freed.

ifq_dequeue() returns the next mbuf to be transmitted by the interface. If no packet is available for transmission, NULL is returned.

ifq_purge() returns the number of mbufs that were removed from the queue and freed.

ifq_len() returns the number of mbufs on the queue.

ifq_empty() returns a non-zero value if the queue is empty, otherwise 0.

ifq_hdatalen() returns the size of a packet on the queue, or 0 if the queue is empty;

ifq_is_oactive() returns a non-zero value if the hardware associated with the interface send queue is unable to transmit more packets, otherwise 0.

ifq_deq_begin(9), m_freem(9)
December 11, 2018 OpenBSD-current