1STRUCT IEEE80211_OPS(9) The basic mac80211 driver inte STRUCT IEEE80211_OPS(9)
2
3
4
6 struct_ieee80211_ops - callbacks from mac80211 to the driver
7
9 struct ieee80211_ops {
10 int (* tx) (struct ieee80211_hw *hw, struct sk_buff *skb);
11 int (* start) (struct ieee80211_hw *hw);
12 void (* stop) (struct ieee80211_hw *hw);
13 int (* add_interface) (struct ieee80211_hw *hw,struct ieee80211_vif *vif);
14 void (* remove_interface) (struct ieee80211_hw *hw,struct ieee80211_vif *vif);
15 int (* config) (struct ieee80211_hw *hw, u32 changed);
16 void (* bss_info_changed) (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_bss_conf *info,u32 changed);
17 u64 (* prepare_multicast) (struct ieee80211_hw *hw,struct netdev_hw_addr_list *mc_list);
18 void (* configure_filter) (struct ieee80211_hw *hw,unsigned int changed_flags,unsigned int *total_flags,u64 multicast);
19 int (* set_tim) (struct ieee80211_hw *hw, struct ieee80211_sta *sta,bool set);
20 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);
21 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);
22 int (* hw_scan) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct cfg80211_scan_request *req);
23 void (* sw_scan_start) (struct ieee80211_hw *hw);
24 void (* sw_scan_complete) (struct ieee80211_hw *hw);
25 int (* get_stats) (struct ieee80211_hw *hw,struct ieee80211_low_level_stats *stats);
26 void (* get_tkip_seq) (struct ieee80211_hw *hw, u8 hw_key_idx,u32 *iv32, u16 *iv16);
27 int (* set_rts_threshold) (struct ieee80211_hw *hw, u32 value);
28 int (* sta_add) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_sta *sta);
29 int (* sta_remove) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_sta *sta);
30 void (* sta_notify) (struct ieee80211_hw *hw, struct ieee80211_vif *vif,enum sta_notify_cmd, struct ieee80211_sta *sta);
31 int (* conf_tx) (struct ieee80211_hw *hw, u16 queue,const struct ieee80211_tx_queue_params *params);
32 u64 (* get_tsf) (struct ieee80211_hw *hw);
33 void (* set_tsf) (struct ieee80211_hw *hw, u64 tsf);
34 void (* reset_tsf) (struct ieee80211_hw *hw);
35 int (* tx_last_beacon) (struct ieee80211_hw *hw);
36 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);
37 int (* get_survey) (struct ieee80211_hw *hw, int idx,struct survey_info *survey);
38 void (* rfkill_poll) (struct ieee80211_hw *hw);
39 void (* set_coverage_class) (struct ieee80211_hw *hw, u8 coverage_class);
40 #ifdef CONFIG_NL80211_TESTMODE
41 int (* testmode_cmd) (struct ieee80211_hw *hw, void *data, int len);
42 #endif
43 void (* flush) (struct ieee80211_hw *hw, bool drop);
44 void (* channel_switch) (struct ieee80211_hw *hw,struct ieee80211_channel_switch *ch_switch);
45 };
46
48 tx
49 Handler that 802.11 module calls for each transmitted frame. skb
50 contains the buffer starting from the IEEE 802.11 header. The
51 low-level driver should send the frame out based on configuration
52 in the TX control data. This handler should, preferably, never fail
53 and stop queues appropriately, more importantly, however, it must
54 never fail for A-MPDU-queues. This function should return
55 NETDEV_TX_OK except in very limited cases. Must be implemented and
56 atomic.
57
58 start
59 Called before the first netdevice attached to the hardware is
60 enabled. This should turn on the hardware and must turn on frame
61 reception (for possibly enabled monitor interfaces.) Returns
62 negative error codes, these may be seen in userspace, or zero. When
63 the device is started it should not have a MAC address to avoid
64 acknowledging frames before a non-monitor device is added. Must be
65 implemented and can sleep.
66
67 stop
68 Called after last netdevice attached to the hardware is disabled.
69 This should turn off the hardware (at least it must turn off frame
70 reception.) May be called right after add_interface if that rejects
71 an interface. If you added any work onto the mac80211 workqueue you
72 should ensure to cancel it on this callback. Must be implemented
73 and can sleep.
74
75 add_interface
76 Called when a netdevice attached to the hardware is enabled.
77 Because it is not called for monitor mode devices, start and stop
78 must be implemented. The driver should perform any initialization
79 it needs before the device can be enabled. The initial
80 configuration for the interface is given in the conf parameter. The
81 callback may refuse to add an interface by returning a negative
82 error code (which will be seen in userspace.) Must be implemented
83 and can sleep.
84
85 remove_interface
86 Notifies a driver that an interface is going down. The stop
87 callback is called after this if it is the last interface and no
88 monitor interfaces are present. When all interfaces are removed,
89 the MAC address in the hardware must be cleared so the device no
90 longer acknowledges packets, the mac_addr member of the conf
91 structure is, however, set to the MAC address of the device going
92 away. Hence, this callback must be implemented. It can sleep.
93
94 config
95 Handler for configuration requests. IEEE 802.11 code calls this
96 function to change hardware configuration, e.g., channel. This
97 function should never fail but returns a negative error code if it
98 does. The callback can sleep.
99
100 bss_info_changed
101 Handler for configuration requests related to BSS parameters that
102 may vary during BSS's lifespan, and may affect low level driver
103 (e.g. assoc/disassoc status, erp parameters). This function should
104 not be used if no BSS has been set, unless for association
105 indication. The changed parameter indicates which of the bss
106 parameters has changed when a call is made. The callback can sleep.
107
108 prepare_multicast
109 Prepare for multicast filter configuration. This callback is
110 optional, and its return value is passed to configure_filter. This
111 callback must be atomic.
112
113 configure_filter
114 Configure the device's RX filter. See the section “Frame filtering”
115 for more information. This callback must be implemented and can
116 sleep.
117
118 set_tim
119 Set TIM bit. mac80211 calls this function when a TIM bit must be
120 set or cleared for a given STA. Must be atomic.
121
122 set_key
123 See the section “Hardware crypto acceleration” This callback is
124 only called between add_interface and remove_interface calls, i.e.
125 while the given virtual interface is enabled. Returns a negative
126 error code if the key can't be added. The callback can sleep.
127
128 update_tkip_key
129 See the section “Hardware crypto acceleration” This callback will
130 be called in the context of Rx. Called for drivers which set
131 IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. The callback must be atomic.
132
133 hw_scan
134 Ask the hardware to service the scan request, no need to start the
135 scan state machine in stack. The scan must honour the channel
136 configuration done by the regulatory agent in the wiphy's
137 registered bands. The hardware (or the driver) needs to make sure
138 that power save is disabled. The req ie/ie_len members are
139 rewritten by mac80211 to contain the entire IEs after the SSID, so
140 that drivers need not look at these at all but just send them after
141 the SSID -- mac80211 includes the (extended) supported rates and HT
142 information (where applicable). When the scan finishes,
143 ieee80211_scan_completed must be called; note that it also must be
144 called when the scan cannot finish due to any error unless this
145 callback returned a negative error code. The callback can sleep.
146
147 sw_scan_start
148 Notifier function that is called just before a software scan is
149 started. Can be NULL, if the driver doesn't need this notification.
150 The callback can sleep.
151
152 sw_scan_complete
153 Notifier function that is called just after a software scan
154 finished. Can be NULL, if the driver doesn't need this
155 notification. The callback can sleep.
156
157 get_stats
158 Return low-level statistics. Returns zero if statistics are
159 available. The callback can sleep.
160
161 get_tkip_seq
162 If your device implements TKIP encryption in hardware this callback
163 should be provided to read the TKIP transmit IVs (both IV32 and
164 IV16) for the given key from hardware. The callback must be atomic.
165
166 set_rts_threshold
167 Configuration of RTS threshold (if device needs it) The callback
168 can sleep.
169
170 sta_add
171 Notifies low level driver about addition of an associated station,
172 AP, IBSS/WDS/mesh peer etc. This callback can sleep.
173
174 sta_remove
175 Notifies low level driver about removal of an associated station,
176 AP, IBSS/WDS/mesh peer etc. This callback can sleep.
177
178 sta_notify
179 Notifies low level driver about power state transition of an
180 associated station, AP, IBSS/WDS/mesh peer etc. Must be atomic.
181
182 conf_tx
183 Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
184 bursting) for a hardware TX queue. Returns a negative error code on
185 failure. The callback can sleep.
186
187 get_tsf
188 Get the current TSF timer value from firmware/hardware. Currently,
189 this is only used for IBSS mode BSSID merging and debugging. Is not
190 a required function. The callback can sleep.
191
192 set_tsf
193 Set the TSF timer to the specified value in the firmware/hardware.
194 Currently, this is only used for IBSS mode debugging. Is not a
195 required function. The callback can sleep.
196
197 reset_tsf
198 Reset the TSF timer and allow firmware/hardware to synchronize with
199 other STAs in the IBSS. This is only used in IBSS mode. This
200 function is optional if the firmware/hardware takes full care of
201 TSF synchronization. The callback can sleep.
202
203 tx_last_beacon
204 Determine whether the last IBSS beacon was sent by us. This is
205 needed only for IBSS mode and the result of this function is used
206 to determine whether to reply to Probe Requests. Returns non-zero
207 if this device sent the last beacon. The callback can sleep.
208
209 ampdu_action
210 Perform a certain A-MPDU action The RA/TID combination determines
211 the destination and TID we want the ampdu action to be performed
212 for. The action is defined through ieee80211_ampdu_mlme_action.
213 Starting sequence number (ssn) is the first frame we expect to
214 perform the action on. Notice that TX/RX_STOP can pass NULL for
215 this parameter. Returns a negative error code on failure. The
216 callback must be atomic.
217
218 get_survey
219 Return per-channel survey information
220
221 rfkill_poll
222 Poll rfkill hardware state. If you need this, you also need to set
223 wiphy->rfkill_poll to true before registration, and need to call
224 wiphy_rfkill_set_hw_state in the callback. The callback can sleep.
225
226 set_coverage_class
227 Set slot time for given coverage class as specified in IEEE
228 802.11-2007 section 17.3.8.6 and modify ACK timeout accordingly.
229 This callback is not required and may sleep.
230
231 testmode_cmd
232 Implement a cfg80211 test mode command. The callback can sleep.
233
234 flush
235 Flush all pending frames from the hardware queue, making sure that
236 the hardware queues are empty. If the parameter drop is set to
237 true, pending frames may be dropped. The callback can sleep.
238
239 channel_switch
240 Drivers that need (or want) to offload the channel switch operation
241 for CSAs received from the AP may implement this callback. They
242 must then call ieee80211_chswitch_done to indicate completion of
243 the channel switch.
244
246 This structure contains various callbacks that the driver may handle
247 or, in some cases, must handle, for example to configure the hardware
248 to a new channel or to transmit a frame.
249
251 Johannes Berg <johannes@sipsolutions.net>
252 Author.
253
255Kernel Hackers Manual 2.6. November 2011 STRUCT IEEE80211_OPS(9)