IFQ_ENQUEUE(9)
πΈ NAME πΈ
okay bestie, welcome to IFQ_ENQUEUE(9) β the ifq_enqueue(9) page from the Kernel Developer's Manual, and it's literally the whole interface send queue API π
It covers these icons: ifq_enqueue, ifq_dequeue, ifq_purge, ifq_len, ifq_empty, ifq_hdatalen, ifq_set_oactive, ifq_clr_oactive, ifq_is_oactive, ifq_restart, and ifq_barrier β the interface send queue API, no cap β¨
β¨ SYNOPSIS β¨
#include <net/if_var.h>
int
ifq_enqueue(struct ifqueue *ifq, struct mbuf *m);
struct 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);
π DESCRIPTION π
The ifqueue API gives the network stack implementations of data structures and operations for queueing mbufs so a network driver can dequeue from its start routine for transmission. it's giving plumbing but make it iconic π«Ά
ifq_enqueue(struct ifqueue *ifq, struct mbuf *m)β enqueue mbufmon theifqinterface send queue. if the queue rejects the packet, it will be freed withm_freem(9)and counted as a drop. sad but documented πifq_dequeue(struct ifqueue *ifq)β dequeue the next mbuf to be transmitted from theifqinterface send queue. next up, bestie πifq_purge(struct ifqueue *ifq)β free all the mbufs on the interface send queueifq. freed mbufs will be accounted as drops. clean slate, but make it counted πifq_len(struct ifqueue *ifq)β return the number of mbufs on the interface send queueifq. note: whileifq_len()may report that mbufs are on the queue, the current queue discipline may not make them available for dequeueing withifq_dequeue()orifq_deq_begin(). iykyk πifq_empty(struct ifqueue *ifq)β return if the interface send queueifqis empty. vibe check: empty or not? π³οΈifq_hdatalen(struct ifqueue *ifq)β return the number of bytes in the mbuf at the head of the interface send queueifq. head-of-line size reveal β¨ifq_set_oactive(struct ifqueue *ifq)βifq_set_oactive()is called by the relevant driver to mark the hardware associated with the interface send queueifqas unable to transmit more packets. busy hardware era π₯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 queueifq, meaning it is now able to transmit packets. she's back online πifq_is_oactive(struct ifqueue *ifq)β return if the hardware associated with the interface send queueifqis unable to transmit more packets. yes/no, can she send? π¦ifq_restart(struct ifqueue *ifq)β dispatch a call toifq_clr_oactive()and the interface's start routine. this call is serialised with other calls to the start routine viaif_start()and therefore provides race free modification of the "active" mark. main character energy in the queue serialiser πifq_barrier(struct ifqueue *ifq)βifq_barrier()guarantees that any work currently running in the interface queue serialiser (e.g. work dispatched byifq_restart()or the interface's start routine) has finished beforeifq_barrier()returns. waiting for the group chat to stop typing before you speak, fr fr π«§
π°οΈ CONTEXT π°οΈ
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. flexible queens π
ifq_barrier() can be called from process context. just her, in process context, being patient π
π RETURN VALUES π
ifq_enqueue()returns0if 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,NULLis returned. πifq_purge()returns the number of mbufs that were removed from the queue and freed. the receipts π§Ύifq_len()returns the number of mbufs on the queue. πifq_empty()returns a non-zero value if the queue is empty, otherwise0. π³οΈifq_hdatalen()returns the size of a packet on the queue, or0if 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, otherwise0. β
π SEE ALSO π
ifq_deq_begin(9), m_freem(9) β go read these next, bestie, it's giving required reading π
okay that's the whole page β source/version Debian, dated March 31, 2022, and yes she ate π
β¨ periodt
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2015 David Gwynne <dlg@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms