DragonFly On-Line Manual Pages
ALTQ(9) DragonFly Kernel Developer's Manual ALTQ(9)
NAME
ALTQ -- kernel interfaces for manipulating output queues on network
interfaces
SYNOPSIS
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/ifq_var.h>
static int
ifq_enqueue(struct ifaltq *_ifq, struct mbuf *_m,
struct altq_pktattr *_pa);
static int
ifq_handoff(struct ifnet *_ifp, struct mbuf *_m,
struct altq_pktattr *_pa);
struct mbuf *
ifq_dequeue(struct ifaltq *_ifq, struct mbuf *_mpolled);
struct mbuf *
ifq_poll(struct ifaltq *_ifq);
void
ifq_purge(struct ifaltq *_ifq);
void
ifq_classify(struct ifaltq *_ifq, struct mbuf *_m, uint8_t _af,
struct altq_pktattr *_pa);
int
ifq_is_empty(struct ifaltq *_ifq);
void
ifq_set_maxlen(struct ifaltq *_ifq, int _len);
void
ifq_set_ready(struct ifaltq *_ifq);
int
ifq_is_enabled(struct ifaltq *_ifq);
DESCRIPTION
The ALTQ system is a framework to manage queueing disciplines on network
interfaces. ALTQ introduces new functions to manipulate output queues.
The output queue functions are used to abstract queue operations and not
to touch the internal fields of the output queue structure.
ifq_enqueue() and ifq_handoff() enqueue a packet _m to the queue _ifq.
The underlying queueing discipline may discard the packet. They return 0
on success, or ENOBUFS if the packet is discarded. The packet pointed to
by _m will be freed by the device driver on success or by the queueing
discipline on failure, so that the caller should not touch _m after
calling ifq_enqueue(). ifq_handoff() combines the enqueue operation with
statistic generation and calls if_start() upon successful enqueue to
initiate the actual send.
ifq_dequeue() dequeues a packet from the queue. It returns the dequeued
packet, or NULL if no packet is dequeued. The caller must always check
the return value since a non-empty queue could return NULL under rate-
limiting.
ifq_poll() returns the next packet without removing it from the queue.
It is guaranteed by the underlying queueing discipline that ifq_dequeue()
immediately after ifq_poll() returns the same packet.
ifq_purge() discards all the packets in the queue. The purge operation
is needed since a non-work conserving queue cannot be emptied by a
dequeue loop.
ifq_classify() classifies a packet to a scheduling class, and returns the
result in _pa.
ifq_is_empty() can be used to check if the queue is empty. Note that
ifq_dequeue() could still return NULL if the queueing discipline is non-
work conserving.
ifq_set_maxlen() sets the queue length limit to the default FIFO queue.
ifq_set_ready() sets a flag to indicate that this driver is converted to
use the new macros. ALTQ can be enabled only on interfaces with this
flag.
ifq_is_enabled() returns 1 if ALTQ is enabled for the queue, 0 if not.
QUEUEING DISCIPLINES
Queueing disciplines need to maintain ifq_len (used by ifq_is_empty()).
Queueing disciplines also need to guarantee that the same mbuf is
returned if ifq_dequeue() is called immediately after ifq_poll().
SEE ALSO
altq(4), pf(4), pf.conf(5), pfctl(8)
HISTORY
The ALTQ system first appeared in March 1997 and was imported into
DragonFly 1.1.
DragonFly 3.7 November 18, 2007 DragonFly 3.7