1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct ieee80211_ops</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The 802.11 subsystems &#8211; for kernel developers"><link rel="up" href="basics.html" title="Chapter&#160;1.&#160;Basic hardware handling"><link rel="prev" href="API-SET-IEEE80211-PERM-ADDR.html" title="SET_IEEE80211_PERM_ADDR"><link rel="next" href="API-ieee80211-alloc-hw.html" title="ieee80211_alloc_hw"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct ieee80211_ops</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-SET-IEEE80211-PERM-ADDR.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;1.&#160;Basic hardware handling</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-ieee80211-alloc-hw.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-ieee80211-ops"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct ieee80211_ops &#8212; 
2  callbacks from mac80211 to the driver
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
4struct ieee80211_ops {
5  void (* tx) (struct ieee80211_hw *hw,struct ieee80211_tx_control *control,struct sk_buff *skb);
6  int (* start) (struct ieee80211_hw *hw);
7  void (* stop) (struct ieee80211_hw *hw);
8#ifdef CONFIG_PM
9  int (* suspend) (struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
10  int (* resume) (struct ieee80211_hw *hw);
11  void (* set_wakeup) (struct ieee80211_hw *hw, bool enabled);
12#endif
13  int (* add_interface) (struct ieee80211_hw *hw,struct ieee80211_vif *vif);
14  int (* change_interface) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,enum nl80211_iftype new_type, bool p2p);
15  void (* remove_interface) (struct ieee80211_hw *hw,struct ieee80211_vif *vif);
16  int (* config) (struct ieee80211_hw *hw, u32 changed);
17  void (* bss_info_changed) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_bss_conf *info,u32 changed);
18  int (* start_ap) (struct ieee80211_hw *hw, struct ieee80211_vif *vif);
19  void (* stop_ap) (struct ieee80211_hw *hw, struct ieee80211_vif *vif);
20  u64 (* prepare_multicast) (struct ieee80211_hw *hw,struct netdev_hw_addr_list *mc_list);
21  void (* configure_filter) (struct ieee80211_hw *hw,unsigned int changed_flags,unsigned int *total_flags,u64 multicast);
22  int (* set_tim) (struct ieee80211_hw *hw, struct ieee80211_sta *sta,bool set);
23  int (* set_key) (struct ieee80211_hw *hw, enum set_key_cmd cmd,struct ieee80211_vif *vif, struct ieee80211_sta *sta,struct ieee80211_key_conf *key);
24  void (* update_tkip_key) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_key_conf *conf,struct ieee80211_sta *sta,u32 iv32, u16 *phase1key);
25  void (* set_rekey_data) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct cfg80211_gtk_rekey_data *data);
26  void (* set_default_unicast_key) (struct ieee80211_hw *hw,struct ieee80211_vif *vif, int idx);
27  int (* hw_scan) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_scan_request *req);
28  void (* cancel_hw_scan) (struct ieee80211_hw *hw,struct ieee80211_vif *vif);
29  int (* sched_scan_start) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct cfg80211_sched_scan_request *req,struct ieee80211_scan_ies *ies);
30  int (* sched_scan_stop) (struct ieee80211_hw *hw,struct ieee80211_vif *vif);
31  void (* sw_scan_start) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,const u8 *mac_addr);
32  void (* sw_scan_complete) (struct ieee80211_hw *hw,struct ieee80211_vif *vif);
33  int (* get_stats) (struct ieee80211_hw *hw,struct ieee80211_low_level_stats *stats);
34  void (* get_tkip_seq) (struct ieee80211_hw *hw, u8 hw_key_idx,u32 *iv32, u16 *iv16);
35  int (* set_frag_threshold) (struct ieee80211_hw *hw, u32 value);
36  int (* set_rts_threshold) (struct ieee80211_hw *hw, u32 value);
37  int (* sta_add) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_sta *sta);
38  int (* sta_remove) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_sta *sta);
39#ifdef CONFIG_MAC80211_DEBUGFS
40  void (* sta_add_debugfs) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta,struct dentry *dir);
41  void (* sta_remove_debugfs) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta,struct dentry *dir);
42#endif
43  void (* sta_notify) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,enum sta_notify_cmd, struct ieee80211_sta *sta);
44  int (* sta_state) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_sta *sta,enum ieee80211_sta_state old_state,enum ieee80211_sta_state new_state);
45  void (* sta_pre_rcu_remove) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta);
46  void (* sta_rc_update) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta,u32 changed);
47  void (* sta_rate_tbl_update) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta);
48  void (* sta_statistics) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta,struct station_info *sinfo);
49  int (* conf_tx) (struct ieee80211_hw *hw,struct ieee80211_vif *vif, u16 ac,const struct ieee80211_tx_queue_params *params);
50  u64 (* get_tsf) (struct ieee80211_hw *hw, struct ieee80211_vif *vif);
51  void (* set_tsf) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,u64 tsf);
52  void (* reset_tsf) (struct ieee80211_hw *hw, struct ieee80211_vif *vif);
53  int (* tx_last_beacon) (struct ieee80211_hw *hw);
54  int (* ampdu_action) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,enum ieee80211_ampdu_mlme_action action,struct ieee80211_sta *sta, u16 tid, u16 *ssn,u8 buf_size);
55  int (* get_survey) (struct ieee80211_hw *hw, int idx,struct survey_info *survey);
56  void (* rfkill_poll) (struct ieee80211_hw *hw);
57  void (* set_coverage_class) (struct ieee80211_hw *hw, s16 coverage_class);
58#ifdef CONFIG_NL80211_TESTMODE
59  int (* testmode_cmd) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,void *data, int len);
60  int (* testmode_dump) (struct ieee80211_hw *hw, struct sk_buff *skb,struct netlink_callback *cb,void *data, int len);
61#endif
62  void (* flush) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,u32 queues, bool drop);
63  void (* channel_switch) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_channel_switch *ch_switch);
64  int (* set_antenna) (struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
65  int (* get_antenna) (struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
66  int (* remain_on_channel) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_channel *chan,int duration,enum ieee80211_roc_type type);
67  int (* cancel_remain_on_channel) (struct ieee80211_hw *hw);
68  int (* set_ringparam) (struct ieee80211_hw *hw, u32 tx, u32 rx);
69  void (* get_ringparam) (struct ieee80211_hw *hw,u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
70  bool (* tx_frames_pending) (struct ieee80211_hw *hw);
71  int (* set_bitrate_mask) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,const struct cfg80211_bitrate_mask *mask);
72  void (* event_callback) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,const struct ieee80211_event *event);
73  void (* allow_buffered_frames) (struct ieee80211_hw *hw,struct ieee80211_sta *sta,u16 tids, int num_frames,enum ieee80211_frame_release_type reason,bool more_data);
74  void (* release_buffered_frames) (struct ieee80211_hw *hw,struct ieee80211_sta *sta,u16 tids, int num_frames,enum ieee80211_frame_release_type reason,bool more_data);
75  int (* get_et_sset_count) (struct ieee80211_hw *hw,struct ieee80211_vif *vif, int sset);
76  void (* get_et_stats) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ethtool_stats *stats, u64 *data);
77  void (* get_et_strings) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,u32 sset, u8 *data);
78  void (* mgd_prepare_tx) (struct ieee80211_hw *hw,struct ieee80211_vif *vif);
79  void (* mgd_protect_tdls_discover) (struct ieee80211_hw *hw,struct ieee80211_vif *vif);
80  int (* add_chanctx) (struct ieee80211_hw *hw,struct ieee80211_chanctx_conf *ctx);
81  void (* remove_chanctx) (struct ieee80211_hw *hw,struct ieee80211_chanctx_conf *ctx);
82  void (* change_chanctx) (struct ieee80211_hw *hw,struct ieee80211_chanctx_conf *ctx,u32 changed);
83  int (* assign_vif_chanctx) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_chanctx_conf *ctx);
84  void (* unassign_vif_chanctx) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_chanctx_conf *ctx);
85  int (* switch_vif_chanctx) (struct ieee80211_hw *hw,struct ieee80211_vif_chanctx_switch *vifs,int n_vifs,enum ieee80211_chanctx_switch_mode mode);
86  void (* reconfig_complete) (struct ieee80211_hw *hw,enum ieee80211_reconfig_type reconfig_type);
87#if IS_ENABLED(CONFIG_IPV6)
88  void (* ipv6_addr_change) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct inet6_dev *idev);
89#endif
90  void (* channel_switch_beacon) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct cfg80211_chan_def *chandef);
91  int (* pre_channel_switch) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_channel_switch *ch_switch);
92  int (* post_channel_switch) (struct ieee80211_hw *hw,struct ieee80211_vif *vif);
93  int (* join_ibss) (struct ieee80211_hw *hw, struct ieee80211_vif *vif);
94  void (* leave_ibss) (struct ieee80211_hw *hw, struct ieee80211_vif *vif);
95  u32 (* get_expected_throughput) (struct ieee80211_sta *sta);
96  int (* get_txpower) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,int *dbm);
97  int (* tdls_channel_switch) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta, u8 oper_class,struct cfg80211_chan_def *chandef,struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie);
98  void (* tdls_cancel_channel_switch) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta);
99  void (* tdls_recv_channel_switch) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_tdls_ch_sw_params *params);
100  void (* wake_tx_queue) (struct ieee80211_hw *hw,struct ieee80211_txq *txq);
101};  </pre></div><div class="refsect1"><a name="idp1113389988"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">tx</span></dt><dd><p>
102Handler that 802.11 module calls for each transmitted frame.
103skb contains the buffer starting from the IEEE 802.11 header.
104The low-level driver should send the frame out based on
105configuration in the TX control data. This handler should,
106preferably, never fail and stop queues appropriately.
107Must be atomic.
108      </p></dd><dt><span class="term">start</span></dt><dd><p>
109Called before the first netdevice attached to the hardware
110is enabled. This should turn on the hardware and must turn on
111frame reception (for possibly enabled monitor interfaces.)
112Returns negative error codes, these may be seen in userspace,
113or zero.
114When the device is started it should not have a MAC address
115to avoid acknowledging frames before a non-monitor device
116is added.
117Must be implemented and can sleep.
118      </p></dd><dt><span class="term">stop</span></dt><dd><p>
119Called after last netdevice attached to the hardware
120is disabled. This should turn off the hardware (at least
121it must turn off frame reception.)
122May be called right after add_interface if that rejects
123an interface. If you added any work onto the mac80211 workqueue
124you should ensure to cancel it on this callback.
125Must be implemented and can sleep.
126      </p></dd><dt><span class="term">suspend</span></dt><dd><p>
127Suspend the device; mac80211 itself will quiesce before and
128stop transmitting and doing any other configuration, and then
129ask the device to suspend. This is only invoked when WoWLAN is
130configured, otherwise the device is deconfigured completely and
131reconfigured at resume time.
132The driver may also impose special conditions under which it
133wants to use the <span class="quote">&#8220;<span class="quote">normal</span>&#8221;</span> suspend (deconfigure), say if it only
134supports WoWLAN when the device is associated. In this case, it
135must return 1 from this function.
136      </p></dd><dt><span class="term">resume</span></dt><dd><p>
137If WoWLAN was configured, this indicates that mac80211 is
138now resuming its operation, after this the device must be fully
139functional again. If this returns an error, the only way out is
140to also unregister the device. If it returns 1, then mac80211
141will also go through the regular complete restart on resume.
142      </p></dd><dt><span class="term">set_wakeup</span></dt><dd><p>
143Enable or disable wakeup when WoWLAN configuration is
144modified. The reason is that <code class="function">device_set_wakeup_enable</code> is
145supposed to be called when the configuration changes, not only
146in <code class="function">suspend</code>.
147      </p></dd><dt><span class="term">add_interface</span></dt><dd><p>
148Called when a netdevice attached to the hardware is
149enabled. Because it is not called for monitor mode devices, <em class="parameter"><code>start</code></em>
150and <em class="parameter"><code>stop</code></em> must be implemented.
151The driver should perform any initialization it needs before
152the device can be enabled. The initial configuration for the
153interface is given in the conf parameter.
154The callback may refuse to add an interface by returning a
155negative error code (which will be seen in userspace.)
156Must be implemented and can sleep.
157      </p></dd><dt><span class="term">change_interface</span></dt><dd><p>
158Called when a netdevice changes type. This callback
159is optional, but only if it is supported can interface types be
160switched while the interface is UP. The callback may sleep.
161Note that while an interface is being switched, it will not be
162found by the interface iteration callbacks.
163      </p></dd><dt><span class="term">remove_interface</span></dt><dd><p>
164Notifies a driver that an interface is going down.
165The <em class="parameter"><code>stop</code></em> callback is called after this if it is the last interface
166and no monitor interfaces are present.
167When all interfaces are removed, the MAC address in the hardware
168must be cleared so the device no longer acknowledges packets,
169the mac_addr member of the conf structure is, however, set to the
170MAC address of the device going away.
171Hence, this callback must be implemented. It can sleep.
172      </p></dd><dt><span class="term">config</span></dt><dd><p>
173Handler for configuration requests. IEEE 802.11 code calls this
174function to change hardware configuration, e.g., channel.
175This function should never fail but returns a negative error code
176if it does. The callback can sleep.
177      </p></dd><dt><span class="term">bss_info_changed</span></dt><dd><p>
178Handler for configuration requests related to BSS
179parameters that may vary during BSS's lifespan, and may affect low
180level driver (e.g. assoc/disassoc status, erp parameters).
181This function should not be used if no BSS has been set, unless
182for association indication. The <em class="parameter"><code>changed</code></em> parameter indicates which
183of the bss parameters has changed when a call is made. The callback
184can sleep.
185      </p></dd><dt><span class="term">start_ap</span></dt><dd><p>
186Start operation on the AP interface, this is called after all the
187information in bss_conf is set and beacon can be retrieved. A channel
188context is bound before this is called. Note that if the driver uses
189software scan or ROC, this (and <em class="parameter"><code>stop_ap</code></em>) isn't called when the AP is
190just <span class="quote">&#8220;<span class="quote">paused</span>&#8221;</span> for scanning/ROC, which is indicated by the beacon being
191disabled/enabled via <em class="parameter"><code>bss_info_changed</code></em>.
192      </p></dd><dt><span class="term">stop_ap</span></dt><dd><p>
193Stop operation on the AP interface.
194      </p></dd><dt><span class="term">prepare_multicast</span></dt><dd><p>
195Prepare for multicast filter configuration.
196This callback is optional, and its return value is passed
197to <code class="function">configure_filter</code>. This callback must be atomic.
198      </p></dd><dt><span class="term">configure_filter</span></dt><dd><p>
199Configure the device's RX filter.
200See the section <span class="quote">&#8220;<span class="quote">Frame filtering</span>&#8221;</span> for more information.
201This callback must be implemented and can sleep.
202      </p></dd><dt><span class="term">set_tim</span></dt><dd><p>
203Set TIM bit. mac80211 calls this function when a TIM bit
204must be set or cleared for a given STA. Must be atomic.
205      </p></dd><dt><span class="term">set_key</span></dt><dd><p>
206See the section <span class="quote">&#8220;<span class="quote">Hardware crypto acceleration</span>&#8221;</span>
207This callback is only called between add_interface and
208remove_interface calls, i.e. while the given virtual interface
209is enabled.
210Returns a negative error code if the key can't be added.
211The callback can sleep.
212      </p></dd><dt><span class="term">update_tkip_key</span></dt><dd><p>
213See the section <span class="quote">&#8220;<span class="quote">Hardware crypto acceleration</span>&#8221;</span>
214This callback will be called in the context of Rx. Called for drivers
215which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
216The callback must be atomic.
217      </p></dd><dt><span class="term">set_rekey_data</span></dt><dd><p>
218If the device supports GTK rekeying, for example while the
219host is suspended, it can assign this callback to retrieve the data
220necessary to do GTK rekeying, this is the KEK, KCK and replay counter.
221After rekeying was done it should (for example during resume) notify
222userspace of the new replay counter using <code class="function">ieee80211_gtk_rekey_notify</code>.
223      </p></dd><dt><span class="term">set_default_unicast_key</span></dt><dd><p>
224Set the default (unicast) key index, useful for
225WEP when the device sends data packets autonomously, e.g. for ARP
226offloading. The index can be 0-3, or -1 for unsetting it.
227      </p></dd><dt><span class="term">hw_scan</span></dt><dd><p>
228Ask the hardware to service the scan request, no need to start
229the scan state machine in stack. The scan must honour the channel
230configuration done by the regulatory agent in the wiphy's
231registered bands. The hardware (or the driver) needs to make sure
232that power save is disabled.
233The <em class="parameter"><code>req</code></em> ie/ie_len members are rewritten by mac80211 to contain the
234entire IEs after the SSID, so that drivers need not look at these
235at all but just send them after the SSID -- mac80211 includes the
236(extended) supported rates and HT information (where applicable).
237When the scan finishes, <code class="function">ieee80211_scan_completed</code> must be called;
238note that it also must be called when the scan cannot finish due to
239any error unless this callback returned a negative error code.
240The callback can sleep.
241      </p></dd><dt><span class="term">cancel_hw_scan</span></dt><dd><p>
242Ask the low-level tp cancel the active hw scan.
243The driver should ask the hardware to cancel the scan (if possible),
244but the scan will be completed only after the driver will call
245<code class="function">ieee80211_scan_completed</code>.
246This callback is needed for wowlan, to prevent enqueueing a new
247scan_work after the low-level driver was already suspended.
248The callback can sleep.
249      </p></dd><dt><span class="term">sched_scan_start</span></dt><dd><p>
250Ask the hardware to start scanning repeatedly at
251specific intervals.  The driver must call the
252<code class="function">ieee80211_sched_scan_results</code> function whenever it finds results.
253This process will continue until sched_scan_stop is called.
254      </p></dd><dt><span class="term">sched_scan_stop</span></dt><dd><p>
255Tell the hardware to stop an ongoing scheduled scan.
256In this case, <code class="function">ieee80211_sched_scan_stopped</code> must not be called.
257      </p></dd><dt><span class="term">sw_scan_start</span></dt><dd><p>
258Notifier function that is called just before a software scan
259is started. Can be NULL, if the driver doesn't need this notification.
260The mac_addr parameter allows supporting NL80211_SCAN_FLAG_RANDOM_ADDR,
261the driver may set the NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR flag if it
262can use this parameter. The callback can sleep.
263      </p></dd><dt><span class="term">sw_scan_complete</span></dt><dd><p>
264Notifier function that is called just after a
265software scan finished. Can be NULL, if the driver doesn't need
266this notification.
267The callback can sleep.
268      </p></dd><dt><span class="term">get_stats</span></dt><dd><p>
269Return low-level statistics.
270Returns zero if statistics are available.
271The callback can sleep.
272      </p></dd><dt><span class="term">get_tkip_seq</span></dt><dd><p>
273If your device implements TKIP encryption in hardware this
274callback should be provided to read the TKIP transmit IVs (both IV32
275and IV16) for the given key from hardware.
276The callback must be atomic.
277      </p></dd><dt><span class="term">set_frag_threshold</span></dt><dd><p>
278Configuration of fragmentation threshold. Assign this
279if the device does fragmentation by itself; if this callback is
280implemented then the stack will not do fragmentation.
281The callback can sleep.
282      </p></dd><dt><span class="term">set_rts_threshold</span></dt><dd><p>
283Configuration of RTS threshold (if device needs it)
284The callback can sleep.
285      </p></dd><dt><span class="term">sta_add</span></dt><dd><p>
286Notifies low level driver about addition of an associated station,
287AP, IBSS/WDS/mesh peer etc. This callback can sleep.
288      </p></dd><dt><span class="term">sta_remove</span></dt><dd><p>
289Notifies low level driver about removal of an associated
290station, AP, IBSS/WDS/mesh peer etc. Note that after the callback
291returns it isn't safe to use the pointer, not even RCU protected;
292no RCU grace period is guaranteed between returning here and freeing
293the station. See <em class="parameter"><code>sta_pre_rcu_remove</code></em> if needed.
294This callback can sleep.
295      </p></dd><dt><span class="term">sta_add_debugfs</span></dt><dd><p>
296Drivers can use this callback to add debugfs files
297when a station is added to mac80211's station list. This callback
298and <em class="parameter"><code>sta_remove_debugfs</code></em> should be within a CONFIG_MAC80211_DEBUGFS
299conditional. This callback can sleep.
300      </p></dd><dt><span class="term">sta_remove_debugfs</span></dt><dd><p>
301Remove the debugfs files which were added using
302<em class="parameter"><code>sta_add_debugfs</code></em>. This callback can sleep.
303      </p></dd><dt><span class="term">sta_notify</span></dt><dd><p>
304Notifies low level driver about power state transition of an
305associated station, AP,  IBSS/WDS/mesh peer etc. For a VIF operating
306in AP mode, this callback will not be called when the flag
307<code class="constant">IEEE80211_HW_AP_LINK_PS</code> is set. Must be atomic.
308      </p></dd><dt><span class="term">sta_state</span></dt><dd><p>
309Notifies low level driver about state transition of a
310station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
311This callback is mutually exclusive with <em class="parameter"><code>sta_add</code></em>/<em class="parameter"><code>sta_remove</code></em>.
312It must not fail for down transitions but may fail for transitions
313up the list of states. Also note that after the callback returns it
314isn't safe to use the pointer, not even RCU protected - no RCU grace
315period is guaranteed between returning here and freeing the station.
316See <em class="parameter"><code>sta_pre_rcu_remove</code></em> if needed.
317The callback can sleep.
318      </p></dd><dt><span class="term">sta_pre_rcu_remove</span></dt><dd><p>
319Notify driver about station removal before RCU
320synchronisation. This is useful if a driver needs to have station
321pointers protected using RCU, it can then use this call to clear
322the pointers instead of waiting for an RCU grace period to elapse
323in <em class="parameter"><code>sta_state</code></em>.
324The callback can sleep.
325      </p></dd><dt><span class="term">sta_rc_update</span></dt><dd><p>
326Notifies the driver of changes to the bitrates that can be
327used to transmit to the station. The changes are advertised with bits
328from <span class="structname">enum</span> ieee80211_rate_control_changed and the values are reflected
329in the station data. This callback should only be used when the driver
330uses hardware rate control (<code class="constant">IEEE80211_HW_HAS_RATE_CONTROL</code>) since
331otherwise the rate control algorithm is notified directly.
332Must be atomic.
333      </p></dd><dt><span class="term">sta_rate_tbl_update</span></dt><dd><p>
334Notifies the driver that the rate table changed. This
335is only used if the configured rate control algorithm actually uses
336the new rate table API, and is therefore optional. Must be atomic.
337      </p></dd><dt><span class="term">sta_statistics</span></dt><dd><p>
338Get statistics for this station. For example with beacon
339filtering, the statistics kept by mac80211 might not be accurate, so
340let the driver pre-fill the statistics. The driver can fill most of
341the values (indicating which by setting the filled bitmap), but not
342all of them make sense - see the source for which ones are possible.
343Statistics that the driver doesn't fill will be filled by mac80211.
344The callback can sleep.
345      </p></dd><dt><span class="term">conf_tx</span></dt><dd><p>
346Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
347bursting) for a hardware TX queue.
348Returns a negative error code on failure.
349The callback can sleep.
350      </p></dd><dt><span class="term">get_tsf</span></dt><dd><p>
351Get the current TSF timer value from firmware/hardware. Currently,
352this is only used for IBSS mode BSSID merging and debugging. Is not a
353required function.
354The callback can sleep.
355      </p></dd><dt><span class="term">set_tsf</span></dt><dd><p>
356Set the TSF timer to the specified value in the firmware/hardware.
357Currently, this is only used for IBSS mode debugging. Is not a
358required function.
359The callback can sleep.
360      </p></dd><dt><span class="term">reset_tsf</span></dt><dd><p>
361Reset the TSF timer and allow firmware/hardware to synchronize
362with other STAs in the IBSS. This is only used in IBSS mode. This
363function is optional if the firmware/hardware takes full care of
364TSF synchronization.
365The callback can sleep.
366      </p></dd><dt><span class="term">tx_last_beacon</span></dt><dd><p>
367Determine whether the last IBSS beacon was sent by us.
368This is needed only for IBSS mode and the result of this function is
369used to determine whether to reply to Probe Requests.
370Returns non-zero if this device sent the last beacon.
371The callback can sleep.
372      </p></dd><dt><span class="term">ampdu_action</span></dt><dd><p>
373Perform a certain A-MPDU action
374The RA/TID combination determines the destination and TID we want
375the ampdu action to be performed for. The action is defined through
376ieee80211_ampdu_mlme_action. Starting sequence number (<em class="parameter"><code>ssn</code></em>)
377is the first frame we expect to perform the action on. Notice
378that TX/RX_STOP can pass NULL for this parameter.
379The <em class="parameter"><code>buf_size</code></em> parameter is only valid when the action is set to
380<code class="constant">IEEE80211_AMPDU_TX_OPERATIONAL</code> and indicates the peer's reorder
381buffer size (number of subframes) for this session -- the driver
382may neither send aggregates containing more subframes than this
383nor send aggregates in a way that lost frames would exceed the
384buffer size. If just limiting the aggregate size, this would be
385      </p></dd><dt><span class="term">get_survey</span></dt><dd><p>
386Return per-channel survey information
387      </p></dd><dt><span class="term">rfkill_poll</span></dt><dd><p>
388Poll rfkill hardware state. If you need this, you also
389need to set wiphy-&gt;rfkill_poll to <code class="constant">true</code> before registration,
390and need to call <code class="function">wiphy_rfkill_set_hw_state</code> in the callback.
391The callback can sleep.
392      </p></dd><dt><span class="term">set_coverage_class</span></dt><dd><p>
393Set slot time for given coverage class as specified
394in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout
395accordingly; coverage class equals to -1 to enable ACK timeout
396estimation algorithm (dynack). To disable dynack set valid value for
397coverage class. This callback is not required and may sleep.
398      </p></dd><dt><span class="term">testmode_cmd</span></dt><dd><p>
399Implement a cfg80211 test mode command. The passed <em class="parameter"><code>vif</code></em> may
400be <code class="constant">NULL</code>. The callback can sleep.
401      </p></dd><dt><span class="term">testmode_dump</span></dt><dd><p>
402Implement a cfg80211 test mode dump. The callback can sleep.
403      </p></dd><dt><span class="term">flush</span></dt><dd><p>
404Flush all pending frames from the hardware queue, making sure
405that the hardware queues are empty. The <em class="parameter"><code>queues</code></em> parameter is a bitmap
406of queues to flush, which is useful if different virtual interfaces
407use different hardware queues; it may also indicate all queues.
408If the parameter <em class="parameter"><code>drop</code></em> is set to <code class="constant">true</code>, pending frames may be dropped.
409Note that vif can be NULL.
410The callback can sleep.
411      </p></dd><dt><span class="term">channel_switch</span></dt><dd><p>
412Drivers that need (or want) to offload the channel
413switch operation for CSAs received from the AP may implement this
414callback. They must then call <code class="function">ieee80211_chswitch_done</code> to indicate
415completion of the channel switch.
416      </p></dd><dt><span class="term">set_antenna</span></dt><dd><p>
417Set antenna configuration (tx_ant, rx_ant) on the device.
418Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
419reject TX/RX mask combinations they cannot support by returning -EINVAL
420(also see nl80211.h <em class="parameter"><code>NL80211_ATTR_WIPHY_ANTENNA_TX</code></em>).
421      </p></dd><dt><span class="term">get_antenna</span></dt><dd><p>
422Get current antenna configuration from device (tx_ant, rx_ant).
423      </p></dd><dt><span class="term">remain_on_channel</span></dt><dd><p>
424Starts an off-channel period on the given channel, must
425call back to <code class="function">ieee80211_ready_on_channel</code> when on that channel. Note
426that normal channel traffic is not stopped as this is intended for hw
427offload. Frames to transmit on the off-channel channel are transmitted
428normally except for the <code class="constant">IEEE80211_TX_CTL_TX_OFFCHAN</code> flag. When the
429duration (which will always be non-zero) expires, the driver must call
430<code class="function">ieee80211_remain_on_channel_expired</code>.
431Note that this callback may be called while the device is in IDLE and
432must be accepted in this case.
433This callback may sleep.
434      </p></dd><dt><span class="term">cancel_remain_on_channel</span></dt><dd><p>
435Requests that an ongoing off-channel period is
436aborted before it expires. This callback may sleep.
437      </p></dd><dt><span class="term">set_ringparam</span></dt><dd><p>
438Set tx and rx ring sizes.
439      </p></dd><dt><span class="term">get_ringparam</span></dt><dd><p>
440Get tx and rx ring current and maximum sizes.
441      </p></dd><dt><span class="term">tx_frames_pending</span></dt><dd><p>
442Check if there is any pending frame in the hardware
443queues before entering power save.
444      </p></dd><dt><span class="term">set_bitrate_mask</span></dt><dd><p>
445Set a mask of rates to be used for rate control selection
446when transmitting a frame. Currently only legacy rates are handled.
447The callback can sleep.
448      </p></dd><dt><span class="term">event_callback</span></dt><dd><p>
449Notify driver about any event in mac80211. See
450<span class="structname">enum</span> ieee80211_event_type for the different types.
451The callback can sleep.
452      </p></dd><dt><span class="term">allow_buffered_frames</span></dt><dd><p>
453Prepare device to allow the given number of frames
454to go out to the given station. The frames will be sent by mac80211
455via the usual TX path after this call. The TX information for frames
456released will also have the <code class="constant">IEEE80211_TX_CTL_NO_PS_BUFFER</code> flag set
457and the last one will also have <code class="constant">IEEE80211_TX_STATUS_EOSP</code> set. In case
458frames from multiple TIDs are released and the driver might reorder
459them between the TIDs, it must set the <code class="constant">IEEE80211_TX_STATUS_EOSP</code> flag
460on the last frame and clear it on all others and also handle the EOSP
461bit in the QoS header correctly. Alternatively, it can also call the
462<code class="function">ieee80211_sta_eosp</code> function.
463The <em class="parameter"><code>tids</code></em> parameter is a bitmap and tells the driver which TIDs the
464frames will be on; it will at most have two bits set.
465This callback must be atomic.
466      </p></dd><dt><span class="term">release_buffered_frames</span></dt><dd><p>
467Release buffered frames according to the given
468parameters. In the case where the driver buffers some frames for
469sleeping stations mac80211 will use this callback to tell the driver
470to release some frames, either for PS-poll or uAPSD.
471Note that if the <em class="parameter"><code>more_data</code></em> parameter is <code class="constant">false</code> the driver must check
472if there are more frames on the given TIDs, and if there are more than
473the frames being released then it must still set the more-data bit in
474the frame. If the <em class="parameter"><code>more_data</code></em> parameter is <code class="constant">true</code>, then of course the
475more-data bit must always be set.
476The <em class="parameter"><code>tids</code></em> parameter tells the driver which TIDs to release frames
477from, for PS-poll it will always have only a single bit set.
478In the case this is used for a PS-poll initiated release, the
479<em class="parameter"><code>num_frames</code></em> parameter will always be 1 so code can be shared. In
480this case the driver must also set <code class="constant">IEEE80211_TX_STATUS_EOSP</code> flag
481on the TX status (and must report TX status) so that the PS-poll
482period is properly ended. This is used to avoid sending multiple
483responses for a retried PS-poll frame.
484In the case this is used for uAPSD, the <em class="parameter"><code>num_frames</code></em> parameter may be
485bigger than one, but the driver may send fewer frames (it must send
486at least one, however). In this case it is also responsible for
487setting the EOSP flag in the QoS header of the frames. Also, when the
488service period ends, the driver must set <code class="constant">IEEE80211_TX_STATUS_EOSP</code>
489on the last frame in the SP. Alternatively, it may call the function
490<code class="function">ieee80211_sta_eosp</code> to inform mac80211 of the end of the SP.
491This callback must be atomic.
492      </p></dd><dt><span class="term">get_et_sset_count</span></dt><dd><p>
493Ethtool API to get string-set count.
494      </p></dd><dt><span class="term">get_et_stats</span></dt><dd><p>
495Ethtool API to get a set of u64 stats.
496      </p></dd><dt><span class="term">get_et_strings</span></dt><dd><p>
497Ethtool API to get a set of strings to describe stats
498and perhaps other supported types of ethtool data-sets.
499      </p></dd><dt><span class="term">mgd_prepare_tx</span></dt><dd><p>
500Prepare for transmitting a management frame for association
501before associated. In multi-channel scenarios, a virtual interface is
502bound to a channel before it is associated, but as it isn't associated
503yet it need not necessarily be given airtime, in particular since any
504transmission to a P2P GO needs to be synchronized against the GO's
505powersave state. mac80211 will call this function before transmitting a
506management frame prior to having successfully associated to allow the
507driver to give it channel time for the transmission, to get a response
508and to be able to synchronize with the GO.
509The callback will be called before each transmission and upon return
510mac80211 will transmit the frame right away.
511The callback is optional and can (should!) sleep.
512      </p></dd><dt><span class="term">mgd_protect_tdls_discover</span></dt><dd><p>
513Protect a TDLS discovery session. After sending
514a TDLS discovery-request, we expect a reply to arrive on the AP's
515channel. We must stay on the channel (no PSM, scan, etc.), since a TDLS
516setup-response is a direct packet not buffered by the AP.
517mac80211 will call this function just before the transmission of a TDLS
518discovery-request. The recommended period of protection is at least
5192 * (DTIM period).
520The callback is optional and can sleep.
521      </p></dd><dt><span class="term">add_chanctx</span></dt><dd><p>
522Notifies device driver about new channel context creation.
523      </p></dd><dt><span class="term">remove_chanctx</span></dt><dd><p>
524Notifies device driver about channel context destruction.
525      </p></dd><dt><span class="term">change_chanctx</span></dt><dd><p>
526Notifies device driver about channel context changes that
527may happen when combining different virtual interfaces on the same
528channel context with different settings
529      </p></dd><dt><span class="term">assign_vif_chanctx</span></dt><dd><p>
530Notifies device driver about channel context being bound
531to vif. Possible use is for hw queue remapping.
532      </p></dd><dt><span class="term">unassign_vif_chanctx</span></dt><dd><p>
533Notifies device driver about channel context being
534unbound from vif.
535      </p></dd><dt><span class="term">switch_vif_chanctx</span></dt><dd><p>
536switch a number of vifs from one chanctx to
537another, as specified in the list of
538<em class="parameter"><code>ieee80211_vif_chanctx_switch</code></em> passed to the driver, according
539to the mode defined in <span class="structname">ieee80211_chanctx_switch_mode</span>.
540      </p></dd><dt><span class="term">reconfig_complete</span></dt><dd><p>
541Called after a call to <code class="function">ieee80211_restart_hw</code> and
542during resume, when the reconfiguration has completed.
543This can help the driver implement the reconfiguration step (and
544indicate mac80211 is ready to receive frames).
545This callback may sleep.
546      </p></dd><dt><span class="term">ipv6_addr_change</span></dt><dd><p>
547IPv6 address assignment on the given interface changed.
548Currently, this is only called for managed or P2P client interfaces.
549This callback is optional; it must not sleep.
550      </p></dd><dt><span class="term">channel_switch_beacon</span></dt><dd><p>
551Starts a channel switch to a new channel.
552Beacons are modified to include CSA or ECSA IEs before calling this
553function. The corresponding count fields in these IEs must be
554decremented, and when they reach 1 the driver must call
555<code class="function">ieee80211_csa_finish</code>. Drivers which use <code class="function">ieee80211_beacon_get</code>
556get the csa counter decremented by mac80211, but must check if it is
5571 using <code class="function">ieee80211_csa_is_complete</code> after the beacon has been
558transmitted and then call <code class="function">ieee80211_csa_finish</code>.
559If the CSA count starts as zero or 1, this function will not be called,
560since there won't be any time to beacon before the switch anyway.
561      </p></dd><dt><span class="term">pre_channel_switch</span></dt><dd><p>
562This is an optional callback that is called
563before a channel switch procedure is started (ie. when a STA
564gets a CSA or an userspace initiated channel-switch), allowing
565the driver to prepare for the channel switch.
566      </p></dd><dt><span class="term">post_channel_switch</span></dt><dd><p>
567This is an optional callback that is called
568after a channel switch procedure is completed, allowing the
569driver to go back to a normal configuration.
570      </p></dd><dt><span class="term">join_ibss</span></dt><dd><p>
571Join an IBSS (on an IBSS interface); this is called after all
572information in bss_conf is set up and the beacon can be retrieved. A
573channel context is bound before this is called.
574      </p></dd><dt><span class="term">leave_ibss</span></dt><dd><p>
575Leave the IBSS again.
576      </p></dd><dt><span class="term">get_expected_throughput</span></dt><dd><p>
577extract the expected throughput towards the
578specified station. The returned value is expressed in Kbps. It returns 0
579if the RC algorithm does not have proper data to provide.
580      </p></dd><dt><span class="term">get_txpower</span></dt><dd><p>
581get current maximum tx power (in dBm) based on configuration
582and hardware limits.
583      </p></dd><dt><span class="term">tdls_channel_switch</span></dt><dd><p>
584Start channel-switching with a TDLS peer. The driver
585is responsible for continually initiating channel-switching operations
586and returning to the base channel for communication with the AP. The
587driver receives a channel-switch request template and the location of
588the switch-timing IE within the template as part of the invocation.
589The template is valid only within the call, and the driver can
590optionally copy the skb for further re-use.
591      </p></dd><dt><span class="term">tdls_cancel_channel_switch</span></dt><dd><p>
592Stop channel-switching with a TDLS peer. Both
593peers must be on the base channel when the call completes.
594      </p></dd><dt><span class="term">tdls_recv_channel_switch</span></dt><dd><p>
595a TDLS channel-switch related frame (request or
596response) has been received from a remote peer. The driver gets
597parameters parsed from the incoming frame and may use them to continue
598an ongoing channel-switch operation. In addition, a channel-switch
599response template is provided, together with the location of the
600switch-timing IE within the template. The skb can only be used within
601the function call.
602      </p></dd><dt><span class="term">wake_tx_queue</span></dt><dd><p>
603Called when new packets have been added to the queue.
604      </p></dd></dl></div></div><div class="refsect1"><a name="idp1113493772"></a><h2>Description</h2><p>
605   </p><p>
606
607   This structure contains various callbacks that the driver may
608   handle or, in some cases, must handle, for example to configure
609   the hardware to a new channel or to transmit a frame.
610</p></div><div class="refsect1"><a name="idp1113494692"></a><h2>possible with a buf_size of 8</h2><p>
611   - TX: 1.....7
612   - RX:  2....7 (lost frame #1)
613   - TX:        8..1...
614   which is invalid since #1 was now re-transmitted well past the
615   buffer size of 8. Correct ways to retransmit #1 would be:
616   - TX:       1 or 18 or 81
617   Even <span class="quote">&#8220;<span class="quote">189</span>&#8221;</span> would be wrong since 1 could be lost again.
618   </p><p>
619
620   Returns a negative error code on failure.
621   The callback can sleep.
622</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-SET-IEEE80211-PERM-ADDR.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="basics.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-ieee80211-alloc-hw.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">SET_IEEE80211_PERM_ADDR</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">ieee80211_alloc_hw</span></td></tr></table></div></body></html>
623