<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><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.75.2" /><link rel="home" href="index.html" title="The mac80211 subsystem for kernel developers" /><link rel="up" href="ch01.html" title="Chapter 1. Basic hardware handling" /><link rel="prev" href="re04.html" title="SET_IEEE80211_PERM_ADDR" /><link rel="next" href="re06.html" title="ieee80211_alloc_hw" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span>struct ieee80211_ops</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re04.html">Prev</a> </td><th width="60%" align="center">Chapter 1. Basic hardware handling</th><td width="20%" align="right"> <a accesskey="n" href="re06.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="struct ieee80211_ops"><a id="API-struct-ieee80211-ops"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct ieee80211_ops — callbacks from mac80211 to the driver </p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><pre class="programlisting"> struct ieee80211_ops { int (* tx) (struct ieee80211_hw *hw, struct sk_buff *skb); int (* start) (struct ieee80211_hw *hw); void (* stop) (struct ieee80211_hw *hw); int (* add_interface) (struct ieee80211_hw *hw,struct ieee80211_if_init_conf *conf); void (* remove_interface) (struct ieee80211_hw *hw,struct ieee80211_if_init_conf *conf); int (* config) (struct ieee80211_hw *hw, u32 changed); void (* bss_info_changed) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_bss_conf *info,u32 changed); u64 (* prepare_multicast) (struct ieee80211_hw *hw,int mc_count, struct dev_addr_list *mc_list); void (* configure_filter) (struct ieee80211_hw *hw,unsigned int changed_flags,unsigned int *total_flags,u64 multicast); int (* set_tim) (struct ieee80211_hw *hw, struct ieee80211_sta *sta,bool set); 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); void (* update_tkip_key) (struct ieee80211_hw *hw,struct ieee80211_key_conf *conf, const u8 *address,u32 iv32, u16 *phase1key); int (* hw_scan) (struct ieee80211_hw *hw,struct cfg80211_scan_request *req); void (* sw_scan_start) (struct ieee80211_hw *hw); void (* sw_scan_complete) (struct ieee80211_hw *hw); int (* get_stats) (struct ieee80211_hw *hw,struct ieee80211_low_level_stats *stats); void (* get_tkip_seq) (struct ieee80211_hw *hw, u8 hw_key_idx,u32 *iv32, u16 *iv16); int (* set_rts_threshold) (struct ieee80211_hw *hw, u32 value); void (* sta_notify) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,enum sta_notify_cmd, struct ieee80211_sta *sta); int (* conf_tx) (struct ieee80211_hw *hw, u16 queue,const struct ieee80211_tx_queue_params *params); int (* get_tx_stats) (struct ieee80211_hw *hw,struct ieee80211_tx_queue_stats *stats); u64 (* get_tsf) (struct ieee80211_hw *hw); void (* set_tsf) (struct ieee80211_hw *hw, u64 tsf); void (* reset_tsf) (struct ieee80211_hw *hw); int (* tx_last_beacon) (struct ieee80211_hw *hw); int (* ampdu_action) (struct ieee80211_hw *hw,enum ieee80211_ampdu_mlme_action action,struct ieee80211_sta *sta, u16 tid, u16 *ssn); void (* rfkill_poll) (struct ieee80211_hw *hw); #ifdef CONFIG_NL80211_TESTMODE int (* testmode_cmd) (struct ieee80211_hw *hw, void *data, int len); #endif }; </pre></div><div class="refsect1" title="Members"><a id="id2705399"></a><h2>Members</h2><div class="variablelist"><dl><dt><span class="term">tx</span></dt><dd><p> Handler that 802.11 module calls for each transmitted frame. skb contains the buffer starting from the IEEE 802.11 header. The low-level driver should send the frame out based on configuration in the TX control data. This handler should, preferably, never fail and stop queues appropriately, more importantly, however, it must never fail for A-MPDU-queues. This function should return NETDEV_TX_OK except in very limited cases. Must be implemented and atomic. </p></dd><dt><span class="term">start</span></dt><dd><p> Called before the first netdevice attached to the hardware is enabled. This should turn on the hardware and must turn on frame reception (for possibly enabled monitor interfaces.) Returns negative error codes, these may be seen in userspace, or zero. When the device is started it should not have a MAC address to avoid acknowledging frames before a non-monitor device is added. Must be implemented. </p></dd><dt><span class="term">stop</span></dt><dd><p> Called after last netdevice attached to the hardware is disabled. This should turn off the hardware (at least it must turn off frame reception.) May be called right after add_interface if that rejects an interface. If you added any work onto the mac80211 workqueue you should ensure to cancel it on this callback. Must be implemented. </p></dd><dt><span class="term">add_interface</span></dt><dd><p> Called when a netdevice attached to the hardware is enabled. Because it is not called for monitor mode devices, <em class="parameter"><code>start</code></em> and <em class="parameter"><code>stop</code></em> must be implemented. The driver should perform any initialization it needs before the device can be enabled. The initial configuration for the interface is given in the conf parameter. The callback may refuse to add an interface by returning a negative error code (which will be seen in userspace.) Must be implemented. </p></dd><dt><span class="term">remove_interface</span></dt><dd><p> Notifies a driver that an interface is going down. The <em class="parameter"><code>stop</code></em> callback is called after this if it is the last interface and no monitor interfaces are present. When all interfaces are removed, the MAC address in the hardware must be cleared so the device no longer acknowledges packets, the mac_addr member of the conf structure is, however, set to the MAC address of the device going away. Hence, this callback must be implemented. </p></dd><dt><span class="term">config</span></dt><dd><p> Handler for configuration requests. IEEE 802.11 code calls this function to change hardware configuration, e.g., channel. This function should never fail but returns a negative error code if it does. </p></dd><dt><span class="term">bss_info_changed</span></dt><dd><p> Handler for configuration requests related to BSS parameters that may vary during BSS's lifespan, and may affect low level driver (e.g. assoc/disassoc status, erp parameters). This function should not be used if no BSS has been set, unless for association indication. The <em class="parameter"><code>changed</code></em> parameter indicates which of the bss parameters has changed when a call is made. </p></dd><dt><span class="term">prepare_multicast</span></dt><dd><p> Prepare for multicast filter configuration. This callback is optional, and its return value is passed to <code class="function">configure_filter</code>. This callback must be atomic. </p></dd><dt><span class="term">configure_filter</span></dt><dd><p> Configure the device's RX filter. See the section <span class="quote">“<span class="quote">Frame filtering</span>”</span> for more information. This callback must be implemented. </p></dd><dt><span class="term">set_tim</span></dt><dd><p> Set TIM bit. mac80211 calls this function when a TIM bit must be set or cleared for a given STA. Must be atomic. </p></dd><dt><span class="term">set_key</span></dt><dd><p> See the section <span class="quote">“<span class="quote">Hardware crypto acceleration</span>”</span> This callback can sleep, and is only called between add_interface and remove_interface calls, i.e. while the given virtual interface is enabled. Returns a negative error code if the key can't be added. </p></dd><dt><span class="term">update_tkip_key</span></dt><dd><p> See the section <span class="quote">“<span class="quote">Hardware crypto acceleration</span>”</span> This callback will be called in the context of Rx. Called for drivers which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. </p></dd><dt><span class="term">hw_scan</span></dt><dd><p> Ask the hardware to service the scan request, no need to start the scan state machine in stack. The scan must honour the channel configuration done by the regulatory agent in the wiphy's registered bands. The hardware (or the driver) needs to make sure that power save is disabled. The <em class="parameter"><code>req</code></em> ie/ie_len members are rewritten by mac80211 to contain the entire IEs after the SSID, so that drivers need not look at these at all but just send them after the SSID -- mac80211 includes the (extended) supported rates and HT information (where applicable). When the scan finishes, <code class="function">ieee80211_scan_completed</code> must be called; note that it also must be called when the scan cannot finish due to any error unless this callback returned a negative error code. </p></dd><dt><span class="term">sw_scan_start</span></dt><dd><p> Notifier function that is called just before a software scan is started. Can be NULL, if the driver doesn't need this notification. </p></dd><dt><span class="term">sw_scan_complete</span></dt><dd><p> Notifier function that is called just after a software scan finished. Can be NULL, if the driver doesn't need this notification. </p></dd><dt><span class="term">get_stats</span></dt><dd><p> Return low-level statistics. Returns zero if statistics are available. </p></dd><dt><span class="term">get_tkip_seq</span></dt><dd><p> If your device implements TKIP encryption in hardware this callback should be provided to read the TKIP transmit IVs (both IV32 and IV16) for the given key from hardware. </p></dd><dt><span class="term">set_rts_threshold</span></dt><dd><p> Configuration of RTS threshold (if device needs it) </p></dd><dt><span class="term">sta_notify</span></dt><dd><p> Notifies low level driver about addition, removal or power state transition of an associated station, AP, IBSS/WDS/mesh peer etc. Must be atomic. </p></dd><dt><span class="term">conf_tx</span></dt><dd><p> Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), bursting) for a hardware TX queue. Returns a negative error code on failure. </p></dd><dt><span class="term">get_tx_stats</span></dt><dd><p> Get statistics of the current TX queue status. This is used to get number of currently queued packets (queue length), maximum queue size (limit), and total number of packets sent using each TX queue (count). The 'stats' pointer points to an array that has hw->queues items. </p></dd><dt><span class="term">get_tsf</span></dt><dd><p> Get the current TSF timer value from firmware/hardware. Currently, this is only used for IBSS mode BSSID merging and debugging. Is not a required function. </p></dd><dt><span class="term">set_tsf</span></dt><dd><p> Set the TSF timer to the specified value in the firmware/hardware. Currently, this is only used for IBSS mode debugging. Is not a required function. </p></dd><dt><span class="term">reset_tsf</span></dt><dd><p> Reset the TSF timer and allow firmware/hardware to synchronize with other STAs in the IBSS. This is only used in IBSS mode. This function is optional if the firmware/hardware takes full care of TSF synchronization. </p></dd><dt><span class="term">tx_last_beacon</span></dt><dd><p> Determine whether the last IBSS beacon was sent by us. This is needed only for IBSS mode and the result of this function is used to determine whether to reply to Probe Requests. Returns non-zero if this device sent the last beacon. </p></dd><dt><span class="term">ampdu_action</span></dt><dd><p> Perform a certain A-MPDU action The RA/TID combination determines the destination and TID we want the ampdu action to be performed for. The action is defined through ieee80211_ampdu_mlme_action. Starting sequence number (<em class="parameter"><code>ssn</code></em>) is the first frame we expect to perform the action on. Notice that TX/RX_STOP can pass NULL for this parameter. Returns a negative error code on failure. </p></dd><dt><span class="term">rfkill_poll</span></dt><dd><p> Poll rfkill hardware state. If you need this, you also need to set wiphy->rfkill_poll to <code class="constant">true</code> before registration, and need to call <code class="function">wiphy_rfkill_set_hw_state</code> in the callback. </p></dd><dt><span class="term">testmode_cmd</span></dt><dd><p> Implement a cfg80211 test mode command. </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2705894"></a><h2>Description</h2><p> </p><p> This structure contains various callbacks that the driver may handle or, in some cases, must handle, for example to configure the hardware to a new channel or to transmit a frame. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch01.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>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>ieee80211_alloc_hw</span></td></tr></table></div></body></html>