13f3f4cdbSBruce M Simpson.\" 23f3f4cdbSBruce M Simpson.\" Copyright (c) 2004 Bruce M. Simpson <bms@spc.org> 33f3f4cdbSBruce M Simpson.\" Copyright (c) 2004 Darron Broad <darron@kewl.org> 43f3f4cdbSBruce M Simpson.\" All rights reserved. 53f3f4cdbSBruce M Simpson.\" 63f3f4cdbSBruce M Simpson.\" Redistribution and use in source and binary forms, with or without 73f3f4cdbSBruce M Simpson.\" modification, are permitted provided that the following conditions 83f3f4cdbSBruce M Simpson.\" are met: 93f3f4cdbSBruce M Simpson.\" 1. Redistributions of source code must retain the above copyright 103f3f4cdbSBruce M Simpson.\" notice, this list of conditions and the following disclaimer. 113f3f4cdbSBruce M Simpson.\" 2. Redistributions in binary form must reproduce the above copyright 123f3f4cdbSBruce M Simpson.\" notice, this list of conditions and the following disclaimer in the 133f3f4cdbSBruce M Simpson.\" documentation and/or other materials provided with the distribution. 143f3f4cdbSBruce M Simpson.\" 153f3f4cdbSBruce M Simpson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 163f3f4cdbSBruce M Simpson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 173f3f4cdbSBruce M Simpson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 183f3f4cdbSBruce M Simpson.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 193f3f4cdbSBruce M Simpson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 203f3f4cdbSBruce M Simpson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 213f3f4cdbSBruce M Simpson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 223f3f4cdbSBruce M Simpson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 233f3f4cdbSBruce M Simpson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 243f3f4cdbSBruce M Simpson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 253f3f4cdbSBruce M Simpson.\" SUCH DAMAGE. 263f3f4cdbSBruce M Simpson.\" $Id: ieee80211_output.9,v 1.5 2004/03/04 12:31:18 bruce Exp $ 273f3f4cdbSBruce M Simpson.\" 2811b168b8SEdward Tomasz Napierala.Dd March 29, 2010 292e777780SRuslan Ermilov.Dt IEEE80211_OUTPUT 9 303f3f4cdbSBruce M Simpson.Os 313f3f4cdbSBruce M Simpson.Sh NAME 32692eebe0SSam Leffler.Nm ieee80211_output 333f3f4cdbSBruce M Simpson.Nd software 802.11 stack output functions 343f3f4cdbSBruce M Simpson.Sh SYNOPSIS 353f3f4cdbSBruce M Simpson.In net80211/ieee80211_var.h 36692eebe0SSam Leffler.\" 373f3f4cdbSBruce M Simpson.Ft int 38692eebe0SSam Leffler.Fn M_WME_GETAC "struct mbuf *" 39692eebe0SSam Leffler.\" 40692eebe0SSam Leffler.Ft int 41692eebe0SSam Leffler.Fn M_SEQNO_GET "struct mbuf *" 42692eebe0SSam Leffler.\" 43692eebe0SSam Leffler.Ft struct ieee80211_key * 44692eebe0SSam Leffler.Fn ieee80211_crypto_encap "struct ieee80211_node *" "struct mbuf *" 45692eebe0SSam Leffler.\" 46692eebe0SSam Leffler.Ft void 47692eebe0SSam Leffler.Fo ieee80211_process_callback 48ace02a6dSChristian Brueffer.Fa "struct ieee80211_node *" 49ace02a6dSChristian Brueffer.Fa "struct mbuf *" 50ace02a6dSChristian Brueffer.Fa "int" 512e777780SRuslan Ermilov.Fc 523f3f4cdbSBruce M Simpson.Sh DESCRIPTION 533f3f4cdbSBruce M SimpsonThe 54692eebe0SSam Leffler.Nm net80211 55692eebe0SSam Lefflerlayer that supports 802.11 device drivers handles most of the 56692eebe0SSam Lefflerwork required to transmit frames. 57692eebe0SSam LefflerDrivers usually receive fully-encapsulated 802.11 frames that 58692eebe0SSam Lefflerhave been classified and assigned a transmit priority; 59692eebe0SSam Lefflerall that is left is to do 60692eebe0SSam Lefflercrypto encapsulation, 61692eebe0SSam Lefflerprepare any hardware-specific state, 62692eebe0SSam Lefflerand 63692eebe0SSam Lefflerpush the packet out to the device. 64692eebe0SSam LefflerOutbound frames are either generated by the 65692eebe0SSam Leffler.Nm net80211 66692eebe0SSam Lefflerlayer (e.g. management frames) or are passed down 67692eebe0SSam Lefflerfrom upper layers through the 68692eebe0SSam Leffler.Xr ifnet 9 69692eebe0SSam Lefflertransmit queue. 70692eebe0SSam LefflerData frames passed down for transmit flow through 71692eebe0SSam Leffler.Nm net80211 72692eebe0SSam Lefflerwhich handles aggregation, 802.11 encapsulation, and then 73692eebe0SSam Lefflerdispatches the frames to the driver through it's transmit queue. 743f3f4cdbSBruce M Simpson.Pp 75692eebe0SSam LefflerThere are two control paths by which frames reach a driver for transmit. 76692eebe0SSam LefflerData packets are queued to the device's 77692eebe0SSam Leffler.Vt if_snd 78692eebe0SSam Lefflerqueue and the driver's 79692eebe0SSam Leffler.Vt if_start 80692eebe0SSam Lefflermethod is called. 81692eebe0SSam LefflerOther frames are passed down using the 82692eebe0SSam Leffler.Vt ic_raw_xmit 83692eebe0SSam Lefflermethod without queueing (unless done by the driver). 84692eebe0SSam LefflerThe raw transmit path may include data frames from user applications 85692eebe0SSam Lefflerthat inject them through 86692eebe0SSam Leffler.Xr bpf 4 87692eebe0SSam Lefflerand NullData frames generated by 88692eebe0SSam Leffler.Nm net80211 89692eebe0SSam Lefflerto probe for idle stations (when operating as an access point). 903f3f4cdbSBruce M Simpson.Pp 91692eebe0SSam Leffler.Nm net80211 92692eebe0SSam Lefflerhandles all state-related bookkeeping and management for the handling 93692eebe0SSam Lefflerof data frames. 94692eebe0SSam LefflerData frames are only transmit for a vap in the 95692eebe0SSam Leffler.Dv IEEE80211_S_RUN 96692eebe0SSam Lefflerstate; there is no need, for example, to check for frames sent down 97692eebe0SSam Lefflerwhen CAC or CSA is active. 98692eebe0SSam LefflerSimilarly, 99692eebe0SSam Leffler.Nm net80211 100692eebe0SSam Lefflerhandles activities such as background scanning and power save mode, 101692eebe0SSam Lefflerframes will not be sent to a driver unless it is operating on the 102ace02a6dSChristian BruefferBSS channel with 103692eebe0SSam Leffler.Dq full power . 104692eebe0SSam Leffler.Pp 105692eebe0SSam LefflerAll frames passed to a driver for transmit hold a reference to a 106692eebe0SSam Lefflernode table entry in the 107692eebe0SSam Leffler.Vt m_pkthdr.rcvif 108692eebe0SSam Lefflerfield. 109692eebe0SSam LefflerThe node is associated with the frame destination. 110692eebe0SSam LefflerTypically it is the receiver's entry but in some situations it may be 111692eebe0SSam Lefflera placeholder entry or the 112692eebe0SSam Leffler.Dq next hop station 113692eebe0SSam Leffler(such as in a mesh network). 114692eebe0SSam LefflerIn all cases the reference must be reclaimed with 115692eebe0SSam Leffler.Fn ieee80211_free_node 116692eebe0SSam Lefflerwhen the transmit work is completed. 117692eebe0SSam LefflerThe rule to remember is: 118692eebe0SSam Leffler.Nm net80211 119692eebe0SSam Lefflerpasses responsibility for the 120692eebe0SSam Leffler.Vt mbuf 121692eebe0SSam Lefflerand 122692eebe0SSam Leffler.Dq node reference 123692eebe0SSam Lefflerto the driver with each frame it hands off for transmit. 124692eebe0SSam Leffler.Sh PACKET CLASSIFICATION 125692eebe0SSam LefflerAll frames passed by 126692eebe0SSam Leffler.Nm net80211 127692eebe0SSam Lefflerfor transmit are assigned a priority based on any vlan tag 128692eebe0SSam Lefflerassigned to the receiving station and/or any Diffserv setting 129692eebe0SSam Lefflerin an IP or IPv6 header. 130692eebe0SSam LefflerIf both vlan and Diffserv priority are present the higher of the 131692eebe0SSam Lefflertwo is used. 132692eebe0SSam LefflerIf WME/WMM is being used then any ACM policy (in station mode) is 133692eebe0SSam Leffleralso enforced. 134692eebe0SSam LefflerThe resulting AC is attached to the mbuf and may be read back using the 135692eebe0SSam Leffler.Fn M_WME_GETAC 136692eebe0SSam Lefflermacro. 137692eebe0SSam Leffler.Pp 138692eebe0SSam LefflerPAE/EAPOL frames are tagged with an 139692eebe0SSam Leffler.Dv M_EAPOL 140692eebe0SSam Lefflermbuf flag; drivers should transmit them with care, usually by 141692eebe0SSam Lefflerusing the transmit rate for management frames. 142692eebe0SSam LefflerMulticast/broadcast frames are marked with the 143692eebe0SSam Leffler.Dv M_MCAST 144692eebe0SSam Lefflermbuf flag. 145692eebe0SSam LefflerFrames coming out of a station's power save queue and that have 146692eebe0SSam Lefflermore frames immediately following are marked with the 147692eebe0SSam Leffler.Dv M_MORE_DATA 148692eebe0SSam Lefflermbuf flag. 149692eebe0SSam LefflerSuch frames will be queued consecutively in the driver's 150692eebe0SSam Leffler.Vt if_snd 151692eebe0SSam Lefflerqueue and drivers should preserve the ordering when passing 152692eebe0SSam Lefflerthem to the device. 153692eebe0SSam Leffler.Sh FRAGMENTED FRAMES 1543f3f4cdbSBruce M SimpsonThe 155692eebe0SSam Leffler.Nm net80211 156692eebe0SSam Lefflerlayer will fragment data frames according to the setting of 157692eebe0SSam Leffler.Vt iv_fragthreshold 158692eebe0SSam Lefflerif a driver marks the 159692eebe0SSam Leffler.Dv IEEE80211_C_TXFRAG 160692eebe0SSam Lefflercapability. 161692eebe0SSam LefflerFragmented frames are placed 162692eebe0SSam Lefflerin the devices transmit queue with the fragments chained together with 163692eebe0SSam Leffler.Vt m_nextpkt . 164692eebe0SSam LefflerEach frame is marked with the 165692eebe0SSam Leffler.Dv M_FRAG 166692eebe0SSam Lefflermbuf flag, and the first and last are marked with 167692eebe0SSam Leffler.Dv M_FIRSTFRAG 168692eebe0SSam Lefflerand 169692eebe0SSam Leffler.Dv M_LASTFRAG , 170692eebe0SSam Lefflerrespectively. 171692eebe0SSam LefflerDrivers are expected to process all fragments or none. 172692eebe0SSam Leffler.Sh TRANSMIT CALLBACKS 173692eebe0SSam LefflerFrames sent by 174692eebe0SSam Leffler.Nm net80211 175692eebe0SSam Lefflermay be tagged with the 176692eebe0SSam Leffler.Dv M_TXCB 177692eebe0SSam Lefflermbuf flag to indicate a callback should be done 178692eebe0SSam Lefflerwhen their transmission completes. 179692eebe0SSam LefflerThe callback is done using 180692eebe0SSam Leffler.Fn ieee80211_process_callback 181692eebe0SSam Lefflerwith the last parameter set to a non-zero value if an error occurred 182692eebe0SSam Lefflerand zero otherwise. 183692eebe0SSam LefflerNote 184692eebe0SSam Leffler.Nm net80211 185692eebe0SSam Lefflerunderstands that drivers may be incapable of determining status; 186692eebe0SSam Lefflera device may not report if an ACK frame is received and/or a device may queue 187692eebe0SSam Lefflertransmit requests in its hardware and only report status on whether 188692eebe0SSam Lefflerthe frame was successfully queued. 1893f3f4cdbSBruce M Simpson.Sh SEE ALSO 19011b168b8SEdward Tomasz Napierala.Xr bpf 4 , 1913f3f4cdbSBruce M Simpson.Xr ieee80211 9 , 1923f3f4cdbSBruce M Simpson.Xr ifnet 9 193