Deleted Added
full compact
ieee80211_output.9 (147647) ieee80211_output.9 (196155)
1.\"
2.\" Copyright (c) 2004 Bruce M. Simpson <bms@spc.org>
3.\" Copyright (c) 2004 Darron Broad <darron@kewl.org>
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:

--- 10 unchanged lines hidden (view full) ---

19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
1.\"
2.\" Copyright (c) 2004 Bruce M. Simpson <bms@spc.org>
3.\" Copyright (c) 2004 Darron Broad <darron@kewl.org>
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:

--- 10 unchanged lines hidden (view full) ---

19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" $FreeBSD: head/share/man/man9/ieee80211_output.9 147647 2005-06-28 20:15:19Z hmp $
27.\" $FreeBSD: head/share/man/man9/ieee80211_output.9 196155 2009-08-12 21:03:16Z sam $
28.\" $Id: ieee80211_output.9,v 1.5 2004/03/04 12:31:18 bruce Exp $
29.\"
28.\" $Id: ieee80211_output.9,v 1.5 2004/03/04 12:31:18 bruce Exp $
29.\"
30.Dd March 2, 2004
30.Dd August 4, 2009
31.Dt IEEE80211_OUTPUT 9
32.Os
33.Sh NAME
31.Dt IEEE80211_OUTPUT 9
32.Os
33.Sh NAME
34.Nm ieee80211_encap , ieee80211_add_rates ,
35.Nm ieee80211_add_xrates , ieee80211_send_mgmt
34.Nm ieee80211_output
36.Nd software 802.11 stack output functions
37.Sh SYNOPSIS
38.In net80211/ieee80211_var.h
35.Nd software 802.11 stack output functions
36.Sh SYNOPSIS
37.In net80211/ieee80211_var.h
39.In net80211/ieee80211_proto.h
40.Ft struct mbuf *
41.Fo ieee80211_encap
42.Fa "struct ifnet *ifp" "struct mbuf *m" "struct ieee80211_node **pni"
43.Fc
44.Ft u_int8_t *
45.Fn ieee80211_add_rates "u_int8_t *frm" "const struct ieee80211_rateset *rs"
46.Ft u_int8_t *
47.Fn ieee80211_add_xrates "u_int8_t *frm" "const struct ieee80211_rateset *rs"
38.\"
48.Ft int
39.Ft int
49.Fo ieee80211_send_mgmt
50.Fa "struct ieee80211com *ic" "struct ieee80211_node *ni" "int type" "int arg"
40.Fn M_WME_GETAC "struct mbuf *"
41.\"
42.Ft int
43.Fn M_SEQNO_GET "struct mbuf *"
44.\"
45.Ft struct ieee80211_key *
46.Fn ieee80211_crypto_encap "struct ieee80211_node *" "struct mbuf *"
47.\"
48.Ft void
49.Fo ieee80211_process_callback
50.Fa struct ieee80211_node *
51.Fa struct mbuf *
52.Fa int
51.Fc
52.Sh DESCRIPTION
53.Fc
54.Sh DESCRIPTION
53These functions handle the encapsulation and transmission of 802.11 frames
54within the software 802.11 stack.
55.Pp
56The
55The
57.Fn ieee80211_encap
58function encapsulates an outbound data frame contained within the
59mbuf chain
60.Fa m
61from the interface
62.Fa ifp .
63The argument
64.Fa *pni
65is a reference to the destination node.
56.Nm net80211
57layer that supports 802.11 device drivers handles most of the
58work required to transmit frames.
59Drivers usually receive fully-encapsulated 802.11 frames that
60have been classified and assigned a transmit priority;
61all that is left is to do
62crypto encapsulation,
63prepare any hardware-specific state,
64and
65push the packet out to the device.
66Outbound frames are either generated by the
67.Nm net80211
68layer (e.g. management frames) or are passed down
69from upper layers through the
70.Xr ifnet 9
71transmit queue.
72Data frames passed down for transmit flow through
73.Nm net80211
74which handles aggregation, 802.11 encapsulation, and then
75dispatches the frames to the driver through it's transmit queue.
66.Pp
76.Pp
67If the function is successful, the mbuf chain is updated with the
68802.11 frame header prepended, and a pointer to the head of the chain
69is returned.
70If an error occurs,
71.Dv NULL
72will be returned, and
73.Fa *pni
74is also set to
75.Dv NULL .
76The caller is responsible for freeing the node reference if
77.Fa *pni
78is
79.Pf non- Dv NULL
80on return.
81The convention is that
82.Va ic_bss
83is not reference counted; the caller is responsible for maintaining this
84reference count.
77There are two control paths by which frames reach a driver for transmit.
78Data packets are queued to the device's
79.Vt if_snd
80queue and the driver's
81.Vt if_start
82method is called.
83Other frames are passed down using the
84.Vt ic_raw_xmit
85method without queueing (unless done by the driver).
86The raw transmit path may include data frames from user applications
87that inject them through
88.Xr bpf 4
89and NullData frames generated by
90.Nm net80211
91to probe for idle stations (when operating as an access point).
85.Pp
92.Pp
86.\"
87The
88.Fn ieee80211_add_rates
89utility function is used to add the rate set element
90.Fa *rs
91to the frame
92.Fa frm .
93A pointer to the location in the buffer after the addition of the rate set
94is returned.
95It is typically used when constructing management frames from within the
96software 802.11 stack.
93.Nm net80211
94handles all state-related bookkeeping and management for the handling
95of data frames.
96Data frames are only transmit for a vap in the
97.Dv IEEE80211_S_RUN
98state; there is no need, for example, to check for frames sent down
99when CAC or CSA is active.
100Similarly,
101.Nm net80211
102handles activities such as background scanning and power save mode,
103frames will not be sent to a driver unless it is operating on the
104BSS channel will
105.Dq full power .
97.Pp
106.Pp
98.\"
99The
100.Fn ieee80211_add_xrates
101utility function is used to add the extended rate set element
102.Fa *rs
103to the frame
104.Fa frm .
105A pointer to the location in the buffer after the addition of the rate set
106is returned.
107It is typically used when constructing management frames from within the
108software 802.11 stack in 802.11g mode.
107All frames passed to a driver for transmit hold a reference to a
108node table entry in the
109.Vt m_pkthdr.rcvif
110field.
111The node is associated with the frame destination.
112Typically it is the receiver's entry but in some situations it may be
113a placeholder entry or the
114.Dq next hop station
115(such as in a mesh network).
116In all cases the reference must be reclaimed with
117.Fn ieee80211_free_node
118when the transmit work is completed.
119The rule to remember is:
120.Nm net80211
121passes responsibility for the
122.Vt mbuf
123and
124.Dq node reference
125to the driver with each frame it hands off for transmit.
126.Sh PACKET CLASSIFICATION
127All frames passed by
128.Nm net80211
129for transmit are assigned a priority based on any vlan tag
130assigned to the receiving station and/or any Diffserv setting
131in an IP or IPv6 header.
132If both vlan and Diffserv priority are present the higher of the
133two is used.
134If WME/WMM is being used then any ACM policy (in station mode) is
135also enforced.
136The resulting AC is attached to the mbuf and may be read back using the
137.Fn M_WME_GETAC
138macro.
109.Pp
139.Pp
110.\"
140PAE/EAPOL frames are tagged with an
141.Dv M_EAPOL
142mbuf flag; drivers should transmit them with care, usually by
143using the transmit rate for management frames.
144Multicast/broadcast frames are marked with the
145.Dv M_MCAST
146mbuf flag.
147Frames coming out of a station's power save queue and that have
148more frames immediately following are marked with the
149.Dv M_MORE_DATA
150mbuf flag.
151Such frames will be queued consecutively in the driver's
152.Vt if_snd
153queue and drivers should preserve the ordering when passing
154them to the device.
155.Sh FRAGMENTED FRAMES
111The
156The
112.Fn ieee80211_send_mgmt
113function transmits a management frame on the interface
114.Fa ic
115to the destination node
116.Fa ni
117of type
118.Fa type .
119.Pp
120The argument
121.Fa arg
122specifies either a sequence number for authentication operations,
123a status code for [re]association operations,
124or a reason for deauthentication and deassociation operations.
125.Pp
126Nodes other than
127.Va ic_bss
128have their reference count incremented to reflect their use for an
129indeterminate amount of time.
130This reference is freed when the function returns.
131.Pp
132The function returns 0 if successful; if temporary buffer space is not
133available, the function returns
134.Er ENOMEM .
135.\"
157.Nm net80211
158layer will fragment data frames according to the setting of
159.Vt iv_fragthreshold
160if a driver marks the
161.Dv IEEE80211_C_TXFRAG
162capability.
163Fragmented frames are placed
164in the devices transmit queue with the fragments chained together with
165.Vt m_nextpkt .
166Each frame is marked with the
167.Dv M_FRAG
168mbuf flag, and the first and last are marked with
169.Dv M_FIRSTFRAG
170and
171.Dv M_LASTFRAG ,
172respectively.
173Drivers are expected to process all fragments or none.
174.Sh TRANSMIT CALLBACKS
175Frames sent by
176.Nm net80211
177may be tagged with the
178.Dv M_TXCB
179mbuf flag to indicate a callback should be done
180when their transmission completes.
181The callback is done using
182.Fn ieee80211_process_callback
183with the last parameter set to a non-zero value if an error occurred
184and zero otherwise.
185Note
186.Nm net80211
187understands that drivers may be incapable of determining status;
188a device may not report if an ACK frame is received and/or a device may queue
189transmit requests in its hardware and only report status on whether
190the frame was successfully queued.
136.Sh SEE ALSO
191.Sh SEE ALSO
192.Xr bpf 4
137.Xr ieee80211 9 ,
138.Xr ifnet 9
193.Xr ieee80211 9 ,
194.Xr ifnet 9
139.Sh HISTORY
140The
141.Nm ieee80211
142series of functions first appeared in
143.Nx 1.5 ,
144and were later ported to
145.Fx 4.6 .
146.Sh AUTHORS
147.An -nosplit
148This manual page was written by
149.An Bruce M. Simpson Aq bms@FreeBSD.org
150and
151.An Darron Broad Aq darron@kewl.org .