blob: 98d589960a4913c96f3b717f9b6a997215c9484d [file] [log] [blame]
Johannes Berg24487982009-04-23 18:52:52 +02001#ifndef __MAC80211_DRIVER_OPS
2#define __MAC80211_DRIVER_OPS
3
4#include <net/mac80211.h>
5#include "ieee80211_i.h"
Johannes Berg0a2b8bb2009-07-07 13:46:22 +02006#include "driver-trace.h"
Johannes Berg24487982009-04-23 18:52:52 +02007
8static inline int drv_tx(struct ieee80211_local *local, struct sk_buff *skb)
9{
10 return local->ops->tx(&local->hw, skb);
11}
12
13static inline int drv_start(struct ieee80211_local *local)
14{
Johannes Bergea77f122009-08-21 14:44:45 +020015 int ret;
16
Kalle Valoe1781ed2009-12-23 13:15:47 +010017 might_sleep();
18
Johannes Berg4efc76b2010-06-10 10:56:20 +020019 trace_drv_start(local);
Johannes Bergea77f122009-08-21 14:44:45 +020020 local->started = true;
21 smp_mb();
22 ret = local->ops->start(&local->hw);
Johannes Berg4efc76b2010-06-10 10:56:20 +020023 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +020024 return ret;
Johannes Berg24487982009-04-23 18:52:52 +020025}
26
27static inline void drv_stop(struct ieee80211_local *local)
28{
Kalle Valoe1781ed2009-12-23 13:15:47 +010029 might_sleep();
30
Johannes Berg0a2b8bb2009-07-07 13:46:22 +020031 trace_drv_stop(local);
Johannes Berg4efc76b2010-06-10 10:56:20 +020032 local->ops->stop(&local->hw);
33 trace_drv_return_void(local);
Johannes Bergea77f122009-08-21 14:44:45 +020034
35 /* sync away all work on the tasklet before clearing started */
36 tasklet_disable(&local->tasklet);
37 tasklet_enable(&local->tasklet);
38
39 barrier();
40
41 local->started = false;
Johannes Berg24487982009-04-23 18:52:52 +020042}
43
44static inline int drv_add_interface(struct ieee80211_local *local,
Johannes Berg1ed32e42009-12-23 13:15:45 +010045 struct ieee80211_vif *vif)
Johannes Berg24487982009-04-23 18:52:52 +020046{
Kalle Valoe1781ed2009-12-23 13:15:47 +010047 int ret;
48
49 might_sleep();
50
Johannes Berg4efc76b2010-06-10 10:56:20 +020051 trace_drv_add_interface(local, vif_to_sdata(vif));
Kalle Valoe1781ed2009-12-23 13:15:47 +010052 ret = local->ops->add_interface(&local->hw, vif);
Johannes Berg4efc76b2010-06-10 10:56:20 +020053 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +020054 return ret;
Johannes Berg24487982009-04-23 18:52:52 +020055}
56
Johannes Berg34d4bc42010-08-27 12:35:58 +020057static inline int drv_change_interface(struct ieee80211_local *local,
58 struct ieee80211_sub_if_data *sdata,
Johannes Berg2ca27bc2010-09-16 14:58:23 +020059 enum nl80211_iftype type, bool p2p)
Johannes Berg34d4bc42010-08-27 12:35:58 +020060{
61 int ret;
62
63 might_sleep();
64
Johannes Berg2ca27bc2010-09-16 14:58:23 +020065 trace_drv_change_interface(local, sdata, type, p2p);
66 ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
Johannes Berg34d4bc42010-08-27 12:35:58 +020067 trace_drv_return_int(local, ret);
68 return ret;
69}
70
Johannes Berg24487982009-04-23 18:52:52 +020071static inline void drv_remove_interface(struct ieee80211_local *local,
Johannes Berg1ed32e42009-12-23 13:15:45 +010072 struct ieee80211_vif *vif)
Johannes Berg24487982009-04-23 18:52:52 +020073{
Kalle Valoe1781ed2009-12-23 13:15:47 +010074 might_sleep();
75
Johannes Berg1ed32e42009-12-23 13:15:45 +010076 trace_drv_remove_interface(local, vif_to_sdata(vif));
Johannes Berg4efc76b2010-06-10 10:56:20 +020077 local->ops->remove_interface(&local->hw, vif);
78 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +020079}
80
81static inline int drv_config(struct ieee80211_local *local, u32 changed)
82{
Kalle Valoe1781ed2009-12-23 13:15:47 +010083 int ret;
84
85 might_sleep();
86
Johannes Berg4efc76b2010-06-10 10:56:20 +020087 trace_drv_config(local, changed);
Kalle Valoe1781ed2009-12-23 13:15:47 +010088 ret = local->ops->config(&local->hw, changed);
Johannes Berg4efc76b2010-06-10 10:56:20 +020089 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +020090 return ret;
Johannes Berg24487982009-04-23 18:52:52 +020091}
92
93static inline void drv_bss_info_changed(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +010094 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +020095 struct ieee80211_bss_conf *info,
96 u32 changed)
97{
Kalle Valoe1781ed2009-12-23 13:15:47 +010098 might_sleep();
99
Johannes Berg4efc76b2010-06-10 10:56:20 +0200100 trace_drv_bss_info_changed(local, sdata, info, changed);
Johannes Berg24487982009-04-23 18:52:52 +0200101 if (local->ops->bss_info_changed)
Johannes Berg12375ef2009-11-25 20:30:31 +0100102 local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200103 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200104}
105
Johannes Berg3ac64be2009-08-17 16:16:53 +0200106static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
Jiri Pirko22bedad32010-04-01 21:22:57 +0000107 struct netdev_hw_addr_list *mc_list)
Johannes Berg24487982009-04-23 18:52:52 +0200108{
Johannes Berg3ac64be2009-08-17 16:16:53 +0200109 u64 ret = 0;
110
Johannes Berg4efc76b2010-06-10 10:56:20 +0200111 trace_drv_prepare_multicast(local, mc_list->count);
112
Johannes Berg3ac64be2009-08-17 16:16:53 +0200113 if (local->ops->prepare_multicast)
Jiri Pirko22bedad32010-04-01 21:22:57 +0000114 ret = local->ops->prepare_multicast(&local->hw, mc_list);
Johannes Berg3ac64be2009-08-17 16:16:53 +0200115
Johannes Berg4efc76b2010-06-10 10:56:20 +0200116 trace_drv_return_u64(local, ret);
Johannes Berg3ac64be2009-08-17 16:16:53 +0200117
118 return ret;
119}
120
121static inline void drv_configure_filter(struct ieee80211_local *local,
122 unsigned int changed_flags,
123 unsigned int *total_flags,
124 u64 multicast)
125{
126 might_sleep();
127
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200128 trace_drv_configure_filter(local, changed_flags, total_flags,
Johannes Berg3ac64be2009-08-17 16:16:53 +0200129 multicast);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200130 local->ops->configure_filter(&local->hw, changed_flags, total_flags,
131 multicast);
132 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200133}
134
135static inline int drv_set_tim(struct ieee80211_local *local,
136 struct ieee80211_sta *sta, bool set)
137{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200138 int ret = 0;
Johannes Berg4efc76b2010-06-10 10:56:20 +0200139 trace_drv_set_tim(local, sta, set);
Johannes Berg24487982009-04-23 18:52:52 +0200140 if (local->ops->set_tim)
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200141 ret = local->ops->set_tim(&local->hw, sta, set);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200142 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200143 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200144}
145
146static inline int drv_set_key(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +0100147 enum set_key_cmd cmd,
148 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200149 struct ieee80211_sta *sta,
150 struct ieee80211_key_conf *key)
151{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100152 int ret;
153
154 might_sleep();
155
Johannes Berg4efc76b2010-06-10 10:56:20 +0200156 trace_drv_set_key(local, cmd, sdata, sta, key);
Kalle Valoe1781ed2009-12-23 13:15:47 +0100157 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200158 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200159 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200160}
161
162static inline void drv_update_tkip_key(struct ieee80211_local *local,
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100163 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200164 struct ieee80211_key_conf *conf,
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100165 struct sta_info *sta, u32 iv32,
Johannes Berg24487982009-04-23 18:52:52 +0200166 u16 *phase1key)
167{
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100168 struct ieee80211_sta *ista = NULL;
169
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100170 if (sta)
171 ista = &sta->sta;
172
Johannes Berg4efc76b2010-06-10 10:56:20 +0200173 trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
Johannes Berg24487982009-04-23 18:52:52 +0200174 if (local->ops->update_tkip_key)
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100175 local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
176 ista, iv32, phase1key);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200177 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200178}
179
180static inline int drv_hw_scan(struct ieee80211_local *local,
Johannes Berga060bbf2010-04-27 11:59:34 +0200181 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200182 struct cfg80211_scan_request *req)
183{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100184 int ret;
185
186 might_sleep();
187
Johannes Berg4efc76b2010-06-10 10:56:20 +0200188 trace_drv_hw_scan(local, sdata, req);
Johannes Berga060bbf2010-04-27 11:59:34 +0200189 ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200190 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200191 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200192}
193
194static inline void drv_sw_scan_start(struct ieee80211_local *local)
195{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100196 might_sleep();
197
Johannes Berg4efc76b2010-06-10 10:56:20 +0200198 trace_drv_sw_scan_start(local);
Johannes Berg24487982009-04-23 18:52:52 +0200199 if (local->ops->sw_scan_start)
200 local->ops->sw_scan_start(&local->hw);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200201 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200202}
203
204static inline void drv_sw_scan_complete(struct ieee80211_local *local)
205{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100206 might_sleep();
207
Johannes Berg4efc76b2010-06-10 10:56:20 +0200208 trace_drv_sw_scan_complete(local);
Johannes Berg24487982009-04-23 18:52:52 +0200209 if (local->ops->sw_scan_complete)
210 local->ops->sw_scan_complete(&local->hw);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200211 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200212}
213
214static inline int drv_get_stats(struct ieee80211_local *local,
215 struct ieee80211_low_level_stats *stats)
216{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200217 int ret = -EOPNOTSUPP;
218
Kalle Valoe1781ed2009-12-23 13:15:47 +0100219 might_sleep();
220
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200221 if (local->ops->get_stats)
222 ret = local->ops->get_stats(&local->hw, stats);
223 trace_drv_get_stats(local, stats, ret);
224
225 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200226}
227
228static inline void drv_get_tkip_seq(struct ieee80211_local *local,
229 u8 hw_key_idx, u32 *iv32, u16 *iv16)
230{
231 if (local->ops->get_tkip_seq)
232 local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200233 trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16);
Johannes Berg24487982009-04-23 18:52:52 +0200234}
235
Arik Nemtsovf23a4782010-11-08 11:51:06 +0200236static inline int drv_set_frag_threshold(struct ieee80211_local *local,
237 u32 value)
238{
239 int ret = 0;
240
241 might_sleep();
242
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);
247 return ret;
248}
249
Johannes Berg24487982009-04-23 18:52:52 +0200250static inline int drv_set_rts_threshold(struct ieee80211_local *local,
251 u32 value)
252{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200253 int ret = 0;
Kalle Valoe1781ed2009-12-23 13:15:47 +0100254
255 might_sleep();
256
Johannes Berg4efc76b2010-06-10 10:56:20 +0200257 trace_drv_set_rts_threshold(local, value);
Johannes Berg24487982009-04-23 18:52:52 +0200258 if (local->ops->set_rts_threshold)
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200259 ret = local->ops->set_rts_threshold(&local->hw, value);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200260 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200261 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200262}
263
Lukáš Turek310bc672009-12-21 22:50:48 +0100264static inline int drv_set_coverage_class(struct ieee80211_local *local,
265 u8 value)
266{
267 int ret = 0;
268 might_sleep();
269
Johannes Berg4efc76b2010-06-10 10:56:20 +0200270 trace_drv_set_coverage_class(local, value);
Lukáš Turek310bc672009-12-21 22:50:48 +0100271 if (local->ops->set_coverage_class)
272 local->ops->set_coverage_class(&local->hw, value);
273 else
274 ret = -EOPNOTSUPP;
275
Johannes Berg4efc76b2010-06-10 10:56:20 +0200276 trace_drv_return_int(local, ret);
Lukáš Turek310bc672009-12-21 22:50:48 +0100277 return ret;
278}
279
Johannes Berg24487982009-04-23 18:52:52 +0200280static inline void drv_sta_notify(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +0100281 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200282 enum sta_notify_cmd cmd,
283 struct ieee80211_sta *sta)
284{
Johannes Berg4efc76b2010-06-10 10:56:20 +0200285 trace_drv_sta_notify(local, sdata, cmd, sta);
Johannes Berg24487982009-04-23 18:52:52 +0200286 if (local->ops->sta_notify)
Johannes Berg12375ef2009-11-25 20:30:31 +0100287 local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200288 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200289}
290
Johannes Berg34e89502010-02-03 13:59:58 +0100291static inline int drv_sta_add(struct ieee80211_local *local,
292 struct ieee80211_sub_if_data *sdata,
293 struct ieee80211_sta *sta)
294{
295 int ret = 0;
296
297 might_sleep();
298
Johannes Berg4efc76b2010-06-10 10:56:20 +0200299 trace_drv_sta_add(local, sdata, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100300 if (local->ops->sta_add)
301 ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100302
Johannes Berg4efc76b2010-06-10 10:56:20 +0200303 trace_drv_return_int(local, ret);
Johannes Berg34e89502010-02-03 13:59:58 +0100304
305 return ret;
306}
307
308static inline void drv_sta_remove(struct ieee80211_local *local,
309 struct ieee80211_sub_if_data *sdata,
310 struct ieee80211_sta *sta)
311{
312 might_sleep();
313
Johannes Berg4efc76b2010-06-10 10:56:20 +0200314 trace_drv_sta_remove(local, sdata, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100315 if (local->ops->sta_remove)
316 local->ops->sta_remove(&local->hw, &sdata->vif, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100317
Johannes Berg4efc76b2010-06-10 10:56:20 +0200318 trace_drv_return_void(local);
Johannes Berg34e89502010-02-03 13:59:58 +0100319}
320
Johannes Berg24487982009-04-23 18:52:52 +0200321static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue,
322 const struct ieee80211_tx_queue_params *params)
323{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200324 int ret = -EOPNOTSUPP;
Kalle Valoe1781ed2009-12-23 13:15:47 +0100325
326 might_sleep();
327
Johannes Berg4efc76b2010-06-10 10:56:20 +0200328 trace_drv_conf_tx(local, queue, params);
Johannes Berg24487982009-04-23 18:52:52 +0200329 if (local->ops->conf_tx)
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200330 ret = local->ops->conf_tx(&local->hw, queue, params);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200331 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200332 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200333}
334
Johannes Berg24487982009-04-23 18:52:52 +0200335static inline u64 drv_get_tsf(struct ieee80211_local *local)
336{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200337 u64 ret = -1ULL;
Kalle Valoe1781ed2009-12-23 13:15:47 +0100338
339 might_sleep();
340
Johannes Berg4efc76b2010-06-10 10:56:20 +0200341 trace_drv_get_tsf(local);
Johannes Berg24487982009-04-23 18:52:52 +0200342 if (local->ops->get_tsf)
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200343 ret = local->ops->get_tsf(&local->hw);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200344 trace_drv_return_u64(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200345 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200346}
347
348static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf)
349{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100350 might_sleep();
351
Johannes Berg4efc76b2010-06-10 10:56:20 +0200352 trace_drv_set_tsf(local, tsf);
Johannes Berg24487982009-04-23 18:52:52 +0200353 if (local->ops->set_tsf)
354 local->ops->set_tsf(&local->hw, tsf);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200355 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200356}
357
358static inline void drv_reset_tsf(struct ieee80211_local *local)
359{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100360 might_sleep();
361
Johannes Berg4efc76b2010-06-10 10:56:20 +0200362 trace_drv_reset_tsf(local);
Johannes Berg24487982009-04-23 18:52:52 +0200363 if (local->ops->reset_tsf)
364 local->ops->reset_tsf(&local->hw);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200365 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200366}
367
368static inline int drv_tx_last_beacon(struct ieee80211_local *local)
369{
Tim Harvey91f44b02010-12-09 13:15:45 -0800370 int ret = 0; /* default unsuported op for less congestion */
Kalle Valoe1781ed2009-12-23 13:15:47 +0100371
372 might_sleep();
373
Johannes Berg4efc76b2010-06-10 10:56:20 +0200374 trace_drv_tx_last_beacon(local);
Johannes Berg24487982009-04-23 18:52:52 +0200375 if (local->ops->tx_last_beacon)
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200376 ret = local->ops->tx_last_beacon(&local->hw);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200377 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200378 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200379}
380
381static inline int drv_ampdu_action(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +0100382 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200383 enum ieee80211_ampdu_mlme_action action,
384 struct ieee80211_sta *sta, u16 tid,
385 u16 *ssn)
386{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200387 int ret = -EOPNOTSUPP;
Johannes Bergcfcdbde2010-06-10 10:21:48 +0200388
389 might_sleep();
390
Johannes Berg4efc76b2010-06-10 10:56:20 +0200391 trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn);
392
Johannes Berg24487982009-04-23 18:52:52 +0200393 if (local->ops->ampdu_action)
Johannes Berg12375ef2009-11-25 20:30:31 +0100394 ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action,
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200395 sta, tid, ssn);
Johannes Berg85ad1812010-06-10 10:21:49 +0200396
Johannes Berg4efc76b2010-06-10 10:56:20 +0200397 trace_drv_return_int(local, ret);
398
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200399 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200400}
Johannes Berg1f87f7d2009-06-02 13:01:41 +0200401
Holger Schurig12897232010-04-19 10:23:57 +0200402static inline int drv_get_survey(struct ieee80211_local *local, int idx,
403 struct survey_info *survey)
404{
405 int ret = -EOPNOTSUPP;
John W. Linvillec466d4e2010-06-29 14:51:23 -0400406
407 trace_drv_get_survey(local, idx, survey);
408
Holger Schurig35dd0502010-06-07 16:33:49 +0200409 if (local->ops->get_survey)
Holger Schurig12897232010-04-19 10:23:57 +0200410 ret = local->ops->get_survey(&local->hw, idx, survey);
John W. Linvillec466d4e2010-06-29 14:51:23 -0400411
412 trace_drv_return_int(local, ret);
413
Holger Schurig12897232010-04-19 10:23:57 +0200414 return ret;
415}
Johannes Berg1f87f7d2009-06-02 13:01:41 +0200416
417static inline void drv_rfkill_poll(struct ieee80211_local *local)
418{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100419 might_sleep();
420
Johannes Berg1f87f7d2009-06-02 13:01:41 +0200421 if (local->ops->rfkill_poll)
422 local->ops->rfkill_poll(&local->hw);
423}
Johannes Berga80f7c02009-12-23 13:15:32 +0100424
425static inline void drv_flush(struct ieee80211_local *local, bool drop)
426{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100427 might_sleep();
428
Johannes Berga80f7c02009-12-23 13:15:32 +0100429 trace_drv_flush(local, drop);
430 if (local->ops->flush)
431 local->ops->flush(&local->hw, drop);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200432 trace_drv_return_void(local);
Johannes Berga80f7c02009-12-23 13:15:32 +0100433}
Johannes Berg5ce6e432010-05-11 16:20:57 +0200434
435static inline void drv_channel_switch(struct ieee80211_local *local,
436 struct ieee80211_channel_switch *ch_switch)
437{
438 might_sleep();
439
Johannes Berg5ce6e432010-05-11 16:20:57 +0200440 trace_drv_channel_switch(local, ch_switch);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200441 local->ops->channel_switch(&local->hw, ch_switch);
442 trace_drv_return_void(local);
Johannes Berg5ce6e432010-05-11 16:20:57 +0200443}
444
Bruno Randolf15d96752010-11-10 12:50:56 +0900445
446static inline int drv_set_antenna(struct ieee80211_local *local,
447 u32 tx_ant, u32 rx_ant)
448{
449 int ret = -EOPNOTSUPP;
450 might_sleep();
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);
454 return ret;
455}
456
457static inline int drv_get_antenna(struct ieee80211_local *local,
458 u32 *tx_ant, u32 *rx_ant)
459{
460 int ret = -EOPNOTSUPP;
461 might_sleep();
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);
465 return ret;
466}
467
Johannes Berg21f83582010-12-18 17:20:47 +0100468static 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)
472{
473 int ret;
474
475 might_sleep();
476
477 trace_drv_remain_on_channel(local, chan, chantype, duration);
478 ret = local->ops->remain_on_channel(&local->hw, chan, chantype,
479 duration);
480 trace_drv_return_int(local, ret);
481
482 return ret;
483}
484
485static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
486{
487 int ret;
488
489 might_sleep();
490
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);
494
495 return ret;
496}
497
Johannes Berg24487982009-04-23 18:52:52 +0200498#endif /* __MAC80211_DRIVER_OPS */