1 #ifndef __MAC80211_DRIVER_OPS
2 #define __MAC80211_DRIVER_OPS
4 #include <net/mac80211.h>
5 #include "ieee80211_i.h"
6 #include "driver-trace.h"
8 static inline int drv_tx(struct ieee80211_local
*local
, struct sk_buff
*skb
)
10 return local
->ops
->tx(&local
->hw
, skb
);
13 static inline int drv_start(struct ieee80211_local
*local
)
19 trace_drv_start(local
);
20 local
->started
= true;
22 ret
= local
->ops
->start(&local
->hw
);
23 trace_drv_return_int(local
, ret
);
27 static inline void drv_stop(struct ieee80211_local
*local
)
31 trace_drv_stop(local
);
32 local
->ops
->stop(&local
->hw
);
33 trace_drv_return_void(local
);
35 /* sync away all work on the tasklet before clearing started */
36 tasklet_disable(&local
->tasklet
);
37 tasklet_enable(&local
->tasklet
);
41 local
->started
= false;
44 static inline int drv_add_interface(struct ieee80211_local
*local
,
45 struct ieee80211_vif
*vif
)
51 trace_drv_add_interface(local
, vif_to_sdata(vif
));
52 ret
= local
->ops
->add_interface(&local
->hw
, vif
);
53 trace_drv_return_int(local
, ret
);
57 static inline int drv_change_interface(struct ieee80211_local
*local
,
58 struct ieee80211_sub_if_data
*sdata
,
59 enum nl80211_iftype type
, bool p2p
)
65 trace_drv_change_interface(local
, sdata
, type
, p2p
);
66 ret
= local
->ops
->change_interface(&local
->hw
, &sdata
->vif
, type
, p2p
);
67 trace_drv_return_int(local
, ret
);
71 static inline void drv_remove_interface(struct ieee80211_local
*local
,
72 struct ieee80211_vif
*vif
)
76 trace_drv_remove_interface(local
, vif_to_sdata(vif
));
77 local
->ops
->remove_interface(&local
->hw
, vif
);
78 trace_drv_return_void(local
);
81 static inline int drv_config(struct ieee80211_local
*local
, u32 changed
)
87 trace_drv_config(local
, changed
);
88 ret
= local
->ops
->config(&local
->hw
, changed
);
89 trace_drv_return_int(local
, ret
);
93 static inline void drv_bss_info_changed(struct ieee80211_local
*local
,
94 struct ieee80211_sub_if_data
*sdata
,
95 struct ieee80211_bss_conf
*info
,
100 trace_drv_bss_info_changed(local
, sdata
, info
, changed
);
101 if (local
->ops
->bss_info_changed
)
102 local
->ops
->bss_info_changed(&local
->hw
, &sdata
->vif
, info
, changed
);
103 trace_drv_return_void(local
);
106 static inline u64
drv_prepare_multicast(struct ieee80211_local
*local
,
107 struct netdev_hw_addr_list
*mc_list
)
111 trace_drv_prepare_multicast(local
, mc_list
->count
);
113 if (local
->ops
->prepare_multicast
)
114 ret
= local
->ops
->prepare_multicast(&local
->hw
, mc_list
);
116 trace_drv_return_u64(local
, ret
);
121 static inline void drv_configure_filter(struct ieee80211_local
*local
,
122 unsigned int changed_flags
,
123 unsigned int *total_flags
,
128 trace_drv_configure_filter(local
, changed_flags
, total_flags
,
130 local
->ops
->configure_filter(&local
->hw
, changed_flags
, total_flags
,
132 trace_drv_return_void(local
);
135 static inline int drv_set_tim(struct ieee80211_local
*local
,
136 struct ieee80211_sta
*sta
, bool set
)
139 trace_drv_set_tim(local
, sta
, set
);
140 if (local
->ops
->set_tim
)
141 ret
= local
->ops
->set_tim(&local
->hw
, sta
, set
);
142 trace_drv_return_int(local
, ret
);
146 static inline int drv_set_key(struct ieee80211_local
*local
,
147 enum set_key_cmd cmd
,
148 struct ieee80211_sub_if_data
*sdata
,
149 struct ieee80211_sta
*sta
,
150 struct ieee80211_key_conf
*key
)
156 trace_drv_set_key(local
, cmd
, sdata
, sta
, key
);
157 ret
= local
->ops
->set_key(&local
->hw
, cmd
, &sdata
->vif
, sta
, key
);
158 trace_drv_return_int(local
, ret
);
162 static inline void drv_update_tkip_key(struct ieee80211_local
*local
,
163 struct ieee80211_sub_if_data
*sdata
,
164 struct ieee80211_key_conf
*conf
,
165 struct sta_info
*sta
, u32 iv32
,
168 struct ieee80211_sta
*ista
= NULL
;
173 trace_drv_update_tkip_key(local
, sdata
, conf
, ista
, iv32
);
174 if (local
->ops
->update_tkip_key
)
175 local
->ops
->update_tkip_key(&local
->hw
, &sdata
->vif
, conf
,
176 ista
, iv32
, phase1key
);
177 trace_drv_return_void(local
);
180 static inline int drv_hw_scan(struct ieee80211_local
*local
,
181 struct ieee80211_sub_if_data
*sdata
,
182 struct cfg80211_scan_request
*req
)
188 trace_drv_hw_scan(local
, sdata
, req
);
189 ret
= local
->ops
->hw_scan(&local
->hw
, &sdata
->vif
, req
);
190 trace_drv_return_int(local
, ret
);
194 static inline void drv_sw_scan_start(struct ieee80211_local
*local
)
198 trace_drv_sw_scan_start(local
);
199 if (local
->ops
->sw_scan_start
)
200 local
->ops
->sw_scan_start(&local
->hw
);
201 trace_drv_return_void(local
);
204 static inline void drv_sw_scan_complete(struct ieee80211_local
*local
)
208 trace_drv_sw_scan_complete(local
);
209 if (local
->ops
->sw_scan_complete
)
210 local
->ops
->sw_scan_complete(&local
->hw
);
211 trace_drv_return_void(local
);
214 static inline int drv_get_stats(struct ieee80211_local
*local
,
215 struct ieee80211_low_level_stats
*stats
)
217 int ret
= -EOPNOTSUPP
;
221 if (local
->ops
->get_stats
)
222 ret
= local
->ops
->get_stats(&local
->hw
, stats
);
223 trace_drv_get_stats(local
, stats
, ret
);
228 static inline void drv_get_tkip_seq(struct ieee80211_local
*local
,
229 u8 hw_key_idx
, u32
*iv32
, u16
*iv16
)
231 if (local
->ops
->get_tkip_seq
)
232 local
->ops
->get_tkip_seq(&local
->hw
, hw_key_idx
, iv32
, iv16
);
233 trace_drv_get_tkip_seq(local
, hw_key_idx
, iv32
, iv16
);
236 static inline int drv_set_frag_threshold(struct ieee80211_local
*local
,
243 trace_drv_set_frag_threshold(local
, value
);
244 if (local
->ops
->set_frag_threshold
)
245 ret
= local
->ops
->set_frag_threshold(&local
->hw
, value
);
246 trace_drv_return_int(local
, ret
);
250 static inline int drv_set_rts_threshold(struct ieee80211_local
*local
,
257 trace_drv_set_rts_threshold(local
, value
);
258 if (local
->ops
->set_rts_threshold
)
259 ret
= local
->ops
->set_rts_threshold(&local
->hw
, value
);
260 trace_drv_return_int(local
, ret
);
264 static inline int drv_set_coverage_class(struct ieee80211_local
*local
,
270 trace_drv_set_coverage_class(local
, value
);
271 if (local
->ops
->set_coverage_class
)
272 local
->ops
->set_coverage_class(&local
->hw
, value
);
276 trace_drv_return_int(local
, ret
);
280 static inline void drv_sta_notify(struct ieee80211_local
*local
,
281 struct ieee80211_sub_if_data
*sdata
,
282 enum sta_notify_cmd cmd
,
283 struct ieee80211_sta
*sta
)
285 trace_drv_sta_notify(local
, sdata
, cmd
, sta
);
286 if (local
->ops
->sta_notify
)
287 local
->ops
->sta_notify(&local
->hw
, &sdata
->vif
, cmd
, sta
);
288 trace_drv_return_void(local
);
291 static inline int drv_sta_add(struct ieee80211_local
*local
,
292 struct ieee80211_sub_if_data
*sdata
,
293 struct ieee80211_sta
*sta
)
299 trace_drv_sta_add(local
, sdata
, sta
);
300 if (local
->ops
->sta_add
)
301 ret
= local
->ops
->sta_add(&local
->hw
, &sdata
->vif
, sta
);
303 trace_drv_return_int(local
, ret
);
308 static inline void drv_sta_remove(struct ieee80211_local
*local
,
309 struct ieee80211_sub_if_data
*sdata
,
310 struct ieee80211_sta
*sta
)
314 trace_drv_sta_remove(local
, sdata
, sta
);
315 if (local
->ops
->sta_remove
)
316 local
->ops
->sta_remove(&local
->hw
, &sdata
->vif
, sta
);
318 trace_drv_return_void(local
);
321 static inline int drv_conf_tx(struct ieee80211_local
*local
, u16 queue
,
322 const struct ieee80211_tx_queue_params
*params
)
324 int ret
= -EOPNOTSUPP
;
328 trace_drv_conf_tx(local
, queue
, params
);
329 if (local
->ops
->conf_tx
)
330 ret
= local
->ops
->conf_tx(&local
->hw
, queue
, params
);
331 trace_drv_return_int(local
, ret
);
335 static inline u64
drv_get_tsf(struct ieee80211_local
*local
)
341 trace_drv_get_tsf(local
);
342 if (local
->ops
->get_tsf
)
343 ret
= local
->ops
->get_tsf(&local
->hw
);
344 trace_drv_return_u64(local
, ret
);
348 static inline void drv_set_tsf(struct ieee80211_local
*local
, u64 tsf
)
352 trace_drv_set_tsf(local
, tsf
);
353 if (local
->ops
->set_tsf
)
354 local
->ops
->set_tsf(&local
->hw
, tsf
);
355 trace_drv_return_void(local
);
358 static inline void drv_reset_tsf(struct ieee80211_local
*local
)
362 trace_drv_reset_tsf(local
);
363 if (local
->ops
->reset_tsf
)
364 local
->ops
->reset_tsf(&local
->hw
);
365 trace_drv_return_void(local
);
368 static inline int drv_tx_last_beacon(struct ieee80211_local
*local
)
370 int ret
= 0; /* default unsuported op for less congestion */
374 trace_drv_tx_last_beacon(local
);
375 if (local
->ops
->tx_last_beacon
)
376 ret
= local
->ops
->tx_last_beacon(&local
->hw
);
377 trace_drv_return_int(local
, ret
);
381 static inline int drv_ampdu_action(struct ieee80211_local
*local
,
382 struct ieee80211_sub_if_data
*sdata
,
383 enum ieee80211_ampdu_mlme_action action
,
384 struct ieee80211_sta
*sta
, u16 tid
,
387 int ret
= -EOPNOTSUPP
;
391 trace_drv_ampdu_action(local
, sdata
, action
, sta
, tid
, ssn
);
393 if (local
->ops
->ampdu_action
)
394 ret
= local
->ops
->ampdu_action(&local
->hw
, &sdata
->vif
, action
,
397 trace_drv_return_int(local
, ret
);
402 static inline int drv_get_survey(struct ieee80211_local
*local
, int idx
,
403 struct survey_info
*survey
)
405 int ret
= -EOPNOTSUPP
;
407 trace_drv_get_survey(local
, idx
, survey
);
409 if (local
->ops
->get_survey
)
410 ret
= local
->ops
->get_survey(&local
->hw
, idx
, survey
);
412 trace_drv_return_int(local
, ret
);
417 static inline void drv_rfkill_poll(struct ieee80211_local
*local
)
421 if (local
->ops
->rfkill_poll
)
422 local
->ops
->rfkill_poll(&local
->hw
);
425 static inline void drv_flush(struct ieee80211_local
*local
, bool drop
)
429 trace_drv_flush(local
, drop
);
430 if (local
->ops
->flush
)
431 local
->ops
->flush(&local
->hw
, drop
);
432 trace_drv_return_void(local
);
435 static inline void drv_channel_switch(struct ieee80211_local
*local
,
436 struct ieee80211_channel_switch
*ch_switch
)
440 trace_drv_channel_switch(local
, ch_switch
);
441 local
->ops
->channel_switch(&local
->hw
, ch_switch
);
442 trace_drv_return_void(local
);
446 static inline int drv_set_antenna(struct ieee80211_local
*local
,
447 u32 tx_ant
, u32 rx_ant
)
449 int ret
= -EOPNOTSUPP
;
451 if (local
->ops
->set_antenna
)
452 ret
= local
->ops
->set_antenna(&local
->hw
, tx_ant
, rx_ant
);
453 trace_drv_set_antenna(local
, tx_ant
, rx_ant
, ret
);
457 static inline int drv_get_antenna(struct ieee80211_local
*local
,
458 u32
*tx_ant
, u32
*rx_ant
)
460 int ret
= -EOPNOTSUPP
;
462 if (local
->ops
->get_antenna
)
463 ret
= local
->ops
->get_antenna(&local
->hw
, tx_ant
, rx_ant
);
464 trace_drv_get_antenna(local
, *tx_ant
, *rx_ant
, ret
);
468 static inline int drv_remain_on_channel(struct ieee80211_local
*local
,
469 struct ieee80211_channel
*chan
,
470 enum nl80211_channel_type chantype
,
471 unsigned int duration
)
477 trace_drv_remain_on_channel(local
, chan
, chantype
, duration
);
478 ret
= local
->ops
->remain_on_channel(&local
->hw
, chan
, chantype
,
480 trace_drv_return_int(local
, ret
);
485 static inline int drv_cancel_remain_on_channel(struct ieee80211_local
*local
)
491 trace_drv_cancel_remain_on_channel(local
);
492 ret
= local
->ops
->cancel_remain_on_channel(&local
->hw
);
493 trace_drv_return_int(local
, ret
);
498 #endif /* __MAC80211_DRIVER_OPS */