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