IEEE80211_OUTPUT(9)
π ieee80211_output β software 802.11 stack output functions π
okay bestie, welcome to the kernel dev manual for ieee80211_output, aka the <pink>software 802.11 stack output functions</pink> β¨ (yes we're in section 9, kernel developer territory, get comfy π«Ά)
β¨ SYNOPSIS β¨
like literally just include this first, no cap:
#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);
πΈ DESCRIPTION πΈ
so the net80211 layer β the one that supports 802.11 device drivers β is out here doing most of the work required to transmit frames. iconic behavior honestly. π
drivers usually receive fully-encapsulated 802.11 frames that have already been classified and assigned a transmit priority. so all that's left for the driver is:
- do the crypto encapsulation π
- prepare any hardware-specific state
- push the packet out to the device
that's it. that's the whole to-do list. main character energy fr.
outbound frames are either:
- generated by the net80211 layer itself (like management frames, she makes them herself π)
- passed down from upper layers through the
ifnet(9)transmit queue
data frames passed down for transmit flow through net80211, which handles aggregation, then 802.11 encapsulation, and then dispatches the frames to the driver through it's transmit queue. (yes that apostrophe is in the original, we don't fix, we preserve π)
the two control paths π¦
there are literally two control paths by which frames reach a driver for transmit:
- 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 does the queueing itself)
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 (when operating as an access point). π
net80211 handles all the state-related bookkeeping and management for the handling of data frames. data frames are only transmit for a vap in the IEEE80211_S_RUN state β so no need, for example, to check for frames sent down when CAC or CSA is active. similarly, net80211 handles activities like 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β. periodt.
the node reference rule (remember 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β (such as in a mesh network). in all cases the reference must be reclaimed with ieee80211_free_node() when the transmit work is completed.
the rule to remember is: net80211 passes responsibility for the mbuf and βnode referenceβ to the driver with each frame it hands off for transmit. π do not forget this. do not lose the reference. we will know.
π 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. slay, sensible.
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. π«
the mbuf flags u need to know π§
- 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. β - 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.
those M_MORE_DATA ones will be queued consecutively in the driver's if_snd queue, and drivers should preserve the ordering when passing them to the device. do not shuffle. do not reorder. keep the vibe in order. π
π₯ FRAGMENTED FRAMES π₯
the net80211 layer will fragment data frames according to the setting of iv_fragthreshold if a driver marks the IEEE80211_C_TXFRAG capability.
fragmented frames are placed in the devices 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 picking and choosing, bestie, that's not the assignment. π
π 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, note that 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 yeah, sometimes "status" is just vibes and hardware queues. it's giving best-effort. π
π SEE ALSO π
and that's the whole page bestie!! this one came from the Debian crew, dated March 29, 2010 β a whole classic, still serving. go forth and transmit responsibly, ily π«Άπβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- 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 on : a language model's rewrite of the original, under its terms