IEEE80211_OUTPUT(9)
π ieee80211_output β the software 802.11 stack output functions (kernel developer's manual, section 9, bestie)
Okay so picture this: you're a network driver dev, it's a Thursday, and the net80211 layer is out here doing literally all the work for you. This is a section 9 manpage, so it's kernel-dev territory π§ β but don't stress, we're gonna walk through it together.
β¨ NAME β¨
ieee80211_output β the software 802.11 stack output functions. Yes that's the whole vibe. It's the output side, the transmit side, the "get these frames out the door" side π
πΈ SYNOPSIS πΈ
#include <net80211/ieee80211_var.h>
int
M_WME_GETAC(struct mbuf *);
int
M_SEQNO_GET(struct mbuf *);
struct ieee80211_key *
ieee80211_crypto_encap(struct ieee80211_node *, struct mbuf *);
void
ieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int);
Like, copy-paste this exactly, don't come for me about formatting π
π¦ DESCRIPTION π¦
So the net80211 layer β the one that supports your 802.11 device drivers β handles most of the work required to transmit frames. And when I say most, I mean MOST. Drivers usually just receive fully-encapsulated 802.11 frames that have already been classified and assigned a transmit priority. At that point all that's left is:
- do the crypto encapsulation
- prepare any hardware-specific state
- push the packet out to the device
That's it. That's the whole job. Iconic delegation honestly π
Outbound frames are either generated by the net80211 layer itself (management frames, hi bestie) or passed down from upper layers through the ifnet(9) transmit queue. Data frames passed down for transmit flow through net80211, which handles aggregation, 802.11 encapsulation, and then dispatches the frames to the driver through its transmit queue.
π the two control paths
There are two control paths by which frames reach a driver for transmit, and you need to know both:
- Data packets are queued to the device's
if_sndqueue and the driver'sif_startmethod is called. - Other frames are passed down using the
ic_raw_xmitmethod without queueing (unless the driver decides to queue them itself, that's on you).
The raw transmit path may include data frames from user applications that inject them through bpf(4), plus NullData frames generated by net80211 to probe for idle stations β that's the access point situation, for the record π‘
π the state bookkeeping (net80211's problem, not yours)
net80211 handles all state-related bookkeeping and management for the handling of data frames. Data frames are only transmitted for a vap in the IEEE80211_S_RUN state. So like, there's no need to check for frames sent down when CAC or CSA is active β that's genuinely not your job, bestie. Similarly, net80211 handles activities such as background scanning and power save mode: frames will not be sent to a driver unless it is operating on the BSS channel with "full power" β‘
π«Ά the node reference rule (do NOT forget this one)
All frames passed to a driver for transmit hold a reference to a node table entry in the m_pkthdr.rcvif field. The node is associated with the frame destination. Typically it's the receiver's entry, but in some situations it may be a placeholder entry or the "next hop station" (like in a mesh network, iykyk).
In all cases the reference must be reclaimed with ieee80211_free_node() when the transmit work is completed.
The rule to remember, tattoo it on your brain fr fr: net80211 passes responsibility for the mbuf and the "node reference" to the driver with each frame it hands off for transmit. ππ
π PACKET CLASSIFICATION π
All frames passed by net80211 for transmit are assigned a priority based on:
- any vlan tag assigned to the receiving station, and/or
- any Diffserv setting in an IP or IPv6 header
If both vlan and Diffserv priority are present, the higher of the two is used. If WME/WMM is being used, then any ACM policy (in station mode) is also enforced. The resulting AC is attached to the mbuf and may be read back using the M_WME_GETAC() macro. Cute, right? π
Now here's the flag tea β:
- PAE/EAPOL frames are tagged with an
M_EAPOLmbuf flag. Drivers should transmit them with care β usually by using the transmit rate for management frames. Handle with love, not violence. - Multicast/broadcast frames are marked with the
M_MCASTmbuf flag. - Frames coming out of a station's power save queue that have more frames immediately following are marked with the
M_MORE_DATAmbuf flag. Such frames will be queued consecutively in the driver'sif_sndqueue, and drivers should preserve the ordering when passing them to the device. Order matters, periodt β¨
π§ FRAGMENTED FRAMES π§
The net80211 layer will fragment data frames according to the setting of iv_fragthreshold β but only if a driver marks the IEEE80211_C_TXFRAG capability. Opt-in frag, we love a consent-based feature π
Fragmented frames are placed in the device's transmit queue with the fragments chained together with m_nextpkt. Each frame is marked with the M_FRAG mbuf flag, and the first and last are marked with M_FIRSTFRAG and M_LASTFRAG, respectively.
Drivers are expected to process all fragments or none. No half-sending, no picking favorites, that's giving undefined chaos π
β TRANSMIT CALLBACKS β
Frames sent by net80211 may be tagged with the M_TXCB mbuf flag to indicate a callback should be done when their transmission completes. The callback is done using ieee80211_process_callback(), with the last parameter set to a non-zero value if an error occurred and zero otherwise.
Ngl, net80211 understands that drivers may be incapable of determining status β a device may not report if an ACK frame is received, and/or a device may queue transmit requests in its hardware and only report status on whether the frame was successfully queued. So like, do your best, we're not mad at you π«Ά
π SEE ALSO π
and that's the whole page bestie, go forth and transmit responsibly πΈπβ¨
This icon of a manpage came from the Debian crew and is dated March 29, 2010 β shoutout to the IEEE80211_OUTPUT(9) footer that's holding it all together. π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2004 Bruce M. Simpson <bms@spc.org>
- Copyright (c) 2004 Darron Broad <darron@kewl.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms