blob: 68c27aaf5c9322e36885255c138da306ab8e9b97 [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 Berg011ad0e2012-06-22 12:55:52 +02006#include "trace.h"
Johannes Berg24487982009-04-23 18:52:52 +02007
Johannes Berg7b7eab62011-11-03 14:41:13 +01008static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
9{
Ben Greeard17087e2012-03-15 16:22:05 -070010 WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER),
11 "%s: Failed check-sdata-in-driver check, flags: 0x%x\n",
Johannes Bergf142c6b2012-06-18 20:07:15 +020012 sdata->dev ? sdata->dev->name : sdata->name, sdata->flags);
Johannes Berg7b7eab62011-11-03 14:41:13 +010013}
14
Felix Fietkaubc192f82011-11-23 21:09:49 +070015static inline struct ieee80211_sub_if_data *
16get_bss_sdata(struct ieee80211_sub_if_data *sdata)
17{
18 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
19 sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
20 u.ap);
21
22 return sdata;
23}
24
Thomas Huehn36323f82012-07-23 21:33:42 +020025static inline void drv_tx(struct ieee80211_local *local,
26 struct ieee80211_tx_control *control,
27 struct sk_buff *skb)
Johannes Berg24487982009-04-23 18:52:52 +020028{
Thomas Huehn36323f82012-07-23 21:33:42 +020029 local->ops->tx(&local->hw, control, skb);
Johannes Berg24487982009-04-23 18:52:52 +020030}
31
Ben Greeare3521142012-04-23 12:50:31 -070032static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata,
33 u32 sset, u8 *data)
34{
35 struct ieee80211_local *local = sdata->local;
36 if (local->ops->get_et_strings) {
37 trace_drv_get_et_strings(local, sset);
38 local->ops->get_et_strings(&local->hw, &sdata->vif, sset, data);
39 trace_drv_return_void(local);
40 }
41}
42
43static inline void drv_get_et_stats(struct ieee80211_sub_if_data *sdata,
44 struct ethtool_stats *stats,
45 u64 *data)
46{
47 struct ieee80211_local *local = sdata->local;
48 if (local->ops->get_et_stats) {
49 trace_drv_get_et_stats(local);
50 local->ops->get_et_stats(&local->hw, &sdata->vif, stats, data);
51 trace_drv_return_void(local);
52 }
53}
54
55static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data *sdata,
56 int sset)
57{
58 struct ieee80211_local *local = sdata->local;
59 int rv = 0;
60 if (local->ops->get_et_sset_count) {
61 trace_drv_get_et_sset_count(local, sset);
62 rv = local->ops->get_et_sset_count(&local->hw, &sdata->vif,
63 sset);
64 trace_drv_return_int(local, rv);
65 }
66 return rv;
67}
68
Johannes Berg24487982009-04-23 18:52:52 +020069static inline int drv_start(struct ieee80211_local *local)
70{
Johannes Bergea77f122009-08-21 14:44:45 +020071 int ret;
72
Kalle Valoe1781ed2009-12-23 13:15:47 +010073 might_sleep();
74
Johannes Berg4efc76b2010-06-10 10:56:20 +020075 trace_drv_start(local);
Johannes Bergea77f122009-08-21 14:44:45 +020076 local->started = true;
77 smp_mb();
78 ret = local->ops->start(&local->hw);
Johannes Berg4efc76b2010-06-10 10:56:20 +020079 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +020080 return ret;
Johannes Berg24487982009-04-23 18:52:52 +020081}
82
83static inline void drv_stop(struct ieee80211_local *local)
84{
Kalle Valoe1781ed2009-12-23 13:15:47 +010085 might_sleep();
86
Johannes Berg0a2b8bb2009-07-07 13:46:22 +020087 trace_drv_stop(local);
Johannes Berg4efc76b2010-06-10 10:56:20 +020088 local->ops->stop(&local->hw);
89 trace_drv_return_void(local);
Johannes Bergea77f122009-08-21 14:44:45 +020090
91 /* sync away all work on the tasklet before clearing started */
92 tasklet_disable(&local->tasklet);
93 tasklet_enable(&local->tasklet);
94
95 barrier();
96
97 local->started = false;
Johannes Berg24487982009-04-23 18:52:52 +020098}
99
Johannes Bergeecc4802011-05-04 15:37:29 +0200100#ifdef CONFIG_PM
101static inline int drv_suspend(struct ieee80211_local *local,
102 struct cfg80211_wowlan *wowlan)
103{
104 int ret;
105
106 might_sleep();
107
108 trace_drv_suspend(local);
109 ret = local->ops->suspend(&local->hw, wowlan);
110 trace_drv_return_int(local, ret);
111 return ret;
112}
113
114static inline int drv_resume(struct ieee80211_local *local)
115{
116 int ret;
117
118 might_sleep();
119
120 trace_drv_resume(local);
121 ret = local->ops->resume(&local->hw);
122 trace_drv_return_int(local, ret);
123 return ret;
124}
Johannes Berg6d525632012-04-04 15:05:25 +0200125
126static inline void drv_set_wakeup(struct ieee80211_local *local,
127 bool enabled)
128{
129 might_sleep();
130
131 if (!local->ops->set_wakeup)
132 return;
133
134 trace_drv_set_wakeup(local, enabled);
135 local->ops->set_wakeup(&local->hw, enabled);
136 trace_drv_return_void(local);
137}
Johannes Bergeecc4802011-05-04 15:37:29 +0200138#endif
139
Johannes Berg24487982009-04-23 18:52:52 +0200140static inline int drv_add_interface(struct ieee80211_local *local,
Johannes Berg7b7eab62011-11-03 14:41:13 +0100141 struct ieee80211_sub_if_data *sdata)
Johannes Berg24487982009-04-23 18:52:52 +0200142{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100143 int ret;
144
145 might_sleep();
146
Johannes Berg7b7eab62011-11-03 14:41:13 +0100147 if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
Johannes Berg4b6f1dd2012-04-03 14:35:57 +0200148 (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
149 !(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF))))
Johannes Berg7b7eab62011-11-03 14:41:13 +0100150 return -EINVAL;
151
152 trace_drv_add_interface(local, sdata);
153 ret = local->ops->add_interface(&local->hw, &sdata->vif);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200154 trace_drv_return_int(local, ret);
Johannes Berg7b7eab62011-11-03 14:41:13 +0100155
156 if (ret == 0)
157 sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
158
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200159 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200160}
161
Johannes Berg34d4bc42010-08-27 12:35:58 +0200162static inline int drv_change_interface(struct ieee80211_local *local,
163 struct ieee80211_sub_if_data *sdata,
Johannes Berg2ca27bc2010-09-16 14:58:23 +0200164 enum nl80211_iftype type, bool p2p)
Johannes Berg34d4bc42010-08-27 12:35:58 +0200165{
166 int ret;
167
168 might_sleep();
169
Johannes Berg7b7eab62011-11-03 14:41:13 +0100170 check_sdata_in_driver(sdata);
171
Johannes Berg2ca27bc2010-09-16 14:58:23 +0200172 trace_drv_change_interface(local, sdata, type, p2p);
173 ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
Johannes Berg34d4bc42010-08-27 12:35:58 +0200174 trace_drv_return_int(local, ret);
175 return ret;
176}
177
Johannes Berg24487982009-04-23 18:52:52 +0200178static inline void drv_remove_interface(struct ieee80211_local *local,
Johannes Berg7b7eab62011-11-03 14:41:13 +0100179 struct ieee80211_sub_if_data *sdata)
Johannes Berg24487982009-04-23 18:52:52 +0200180{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100181 might_sleep();
182
Johannes Berg7b7eab62011-11-03 14:41:13 +0100183 check_sdata_in_driver(sdata);
184
185 trace_drv_remove_interface(local, sdata);
186 local->ops->remove_interface(&local->hw, &sdata->vif);
187 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
Johannes Berg4efc76b2010-06-10 10:56:20 +0200188 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200189}
190
191static inline int drv_config(struct ieee80211_local *local, u32 changed)
192{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100193 int ret;
194
195 might_sleep();
196
Johannes Berg4efc76b2010-06-10 10:56:20 +0200197 trace_drv_config(local, changed);
Kalle Valoe1781ed2009-12-23 13:15:47 +0100198 ret = local->ops->config(&local->hw, changed);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200199 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200200 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200201}
202
203static inline void drv_bss_info_changed(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +0100204 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200205 struct ieee80211_bss_conf *info,
206 u32 changed)
207{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100208 might_sleep();
209
Johannes Berg7b7eab62011-11-03 14:41:13 +0100210 check_sdata_in_driver(sdata);
211
Johannes Berg4efc76b2010-06-10 10:56:20 +0200212 trace_drv_bss_info_changed(local, sdata, info, changed);
Johannes Berg24487982009-04-23 18:52:52 +0200213 if (local->ops->bss_info_changed)
Johannes Berg12375ef2009-11-25 20:30:31 +0100214 local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200215 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200216}
217
Johannes Berg3ac64be2009-08-17 16:16:53 +0200218static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
Jiri Pirko22bedad32010-04-01 21:22:57 +0000219 struct netdev_hw_addr_list *mc_list)
Johannes Berg24487982009-04-23 18:52:52 +0200220{
Johannes Berg3ac64be2009-08-17 16:16:53 +0200221 u64 ret = 0;
222
Johannes Berg4efc76b2010-06-10 10:56:20 +0200223 trace_drv_prepare_multicast(local, mc_list->count);
224
Johannes Berg3ac64be2009-08-17 16:16:53 +0200225 if (local->ops->prepare_multicast)
Jiri Pirko22bedad32010-04-01 21:22:57 +0000226 ret = local->ops->prepare_multicast(&local->hw, mc_list);
Johannes Berg3ac64be2009-08-17 16:16:53 +0200227
Johannes Berg4efc76b2010-06-10 10:56:20 +0200228 trace_drv_return_u64(local, ret);
Johannes Berg3ac64be2009-08-17 16:16:53 +0200229
230 return ret;
231}
232
233static inline void drv_configure_filter(struct ieee80211_local *local,
234 unsigned int changed_flags,
235 unsigned int *total_flags,
236 u64 multicast)
237{
238 might_sleep();
239
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200240 trace_drv_configure_filter(local, changed_flags, total_flags,
Johannes Berg3ac64be2009-08-17 16:16:53 +0200241 multicast);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200242 local->ops->configure_filter(&local->hw, changed_flags, total_flags,
243 multicast);
244 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200245}
246
247static inline int drv_set_tim(struct ieee80211_local *local,
248 struct ieee80211_sta *sta, bool set)
249{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200250 int ret = 0;
Johannes Berg4efc76b2010-06-10 10:56:20 +0200251 trace_drv_set_tim(local, sta, set);
Johannes Berg24487982009-04-23 18:52:52 +0200252 if (local->ops->set_tim)
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200253 ret = local->ops->set_tim(&local->hw, sta, set);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200254 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200255 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200256}
257
258static inline int drv_set_key(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +0100259 enum set_key_cmd cmd,
260 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200261 struct ieee80211_sta *sta,
262 struct ieee80211_key_conf *key)
263{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100264 int ret;
265
266 might_sleep();
267
Johannes Berg077f4932012-01-20 13:55:18 +0100268 sdata = get_bss_sdata(sdata);
Johannes Berg7b7eab62011-11-03 14:41:13 +0100269 check_sdata_in_driver(sdata);
270
Johannes Berg4efc76b2010-06-10 10:56:20 +0200271 trace_drv_set_key(local, cmd, sdata, sta, key);
Kalle Valoe1781ed2009-12-23 13:15:47 +0100272 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200273 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200274 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200275}
276
277static inline void drv_update_tkip_key(struct ieee80211_local *local,
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100278 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200279 struct ieee80211_key_conf *conf,
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100280 struct sta_info *sta, u32 iv32,
Johannes Berg24487982009-04-23 18:52:52 +0200281 u16 *phase1key)
282{
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100283 struct ieee80211_sta *ista = NULL;
284
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100285 if (sta)
286 ista = &sta->sta;
287
Johannes Berg077f4932012-01-20 13:55:18 +0100288 sdata = get_bss_sdata(sdata);
Johannes Berg7b7eab62011-11-03 14:41:13 +0100289 check_sdata_in_driver(sdata);
290
Johannes Berg4efc76b2010-06-10 10:56:20 +0200291 trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
Johannes Berg24487982009-04-23 18:52:52 +0200292 if (local->ops->update_tkip_key)
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100293 local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
294 ista, iv32, phase1key);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200295 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200296}
297
298static inline int drv_hw_scan(struct ieee80211_local *local,
Johannes Berga060bbf2010-04-27 11:59:34 +0200299 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200300 struct cfg80211_scan_request *req)
301{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100302 int ret;
303
304 might_sleep();
305
Johannes Berg7b7eab62011-11-03 14:41:13 +0100306 check_sdata_in_driver(sdata);
307
Luciano Coelho79f460c2011-05-11 17:09:36 +0300308 trace_drv_hw_scan(local, sdata);
Johannes Berga060bbf2010-04-27 11:59:34 +0200309 ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200310 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200311 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200312}
313
Eliad Pellerb8564392011-06-13 12:47:30 +0300314static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
315 struct ieee80211_sub_if_data *sdata)
316{
317 might_sleep();
318
Johannes Berg7b7eab62011-11-03 14:41:13 +0100319 check_sdata_in_driver(sdata);
320
Eliad Pellerb8564392011-06-13 12:47:30 +0300321 trace_drv_cancel_hw_scan(local, sdata);
322 local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
323 trace_drv_return_void(local);
324}
325
Luciano Coelho79f460c2011-05-11 17:09:36 +0300326static inline int
327drv_sched_scan_start(struct ieee80211_local *local,
328 struct ieee80211_sub_if_data *sdata,
329 struct cfg80211_sched_scan_request *req,
330 struct ieee80211_sched_scan_ies *ies)
331{
332 int ret;
333
334 might_sleep();
335
Johannes Berg7b7eab62011-11-03 14:41:13 +0100336 check_sdata_in_driver(sdata);
337
Luciano Coelho79f460c2011-05-11 17:09:36 +0300338 trace_drv_sched_scan_start(local, sdata);
339 ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
340 req, ies);
341 trace_drv_return_int(local, ret);
342 return ret;
343}
344
345static inline void drv_sched_scan_stop(struct ieee80211_local *local,
346 struct ieee80211_sub_if_data *sdata)
347{
348 might_sleep();
349
Johannes Berg7b7eab62011-11-03 14:41:13 +0100350 check_sdata_in_driver(sdata);
351
Luciano Coelho79f460c2011-05-11 17:09:36 +0300352 trace_drv_sched_scan_stop(local, sdata);
353 local->ops->sched_scan_stop(&local->hw, &sdata->vif);
354 trace_drv_return_void(local);
355}
356
Johannes Berg24487982009-04-23 18:52:52 +0200357static inline void drv_sw_scan_start(struct ieee80211_local *local)
358{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100359 might_sleep();
360
Johannes Berg4efc76b2010-06-10 10:56:20 +0200361 trace_drv_sw_scan_start(local);
Johannes Berg24487982009-04-23 18:52:52 +0200362 if (local->ops->sw_scan_start)
363 local->ops->sw_scan_start(&local->hw);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200364 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200365}
366
367static inline void drv_sw_scan_complete(struct ieee80211_local *local)
368{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100369 might_sleep();
370
Johannes Berg4efc76b2010-06-10 10:56:20 +0200371 trace_drv_sw_scan_complete(local);
Johannes Berg24487982009-04-23 18:52:52 +0200372 if (local->ops->sw_scan_complete)
373 local->ops->sw_scan_complete(&local->hw);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200374 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200375}
376
377static inline int drv_get_stats(struct ieee80211_local *local,
378 struct ieee80211_low_level_stats *stats)
379{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200380 int ret = -EOPNOTSUPP;
381
Kalle Valoe1781ed2009-12-23 13:15:47 +0100382 might_sleep();
383
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200384 if (local->ops->get_stats)
385 ret = local->ops->get_stats(&local->hw, stats);
386 trace_drv_get_stats(local, stats, ret);
387
388 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200389}
390
391static inline void drv_get_tkip_seq(struct ieee80211_local *local,
392 u8 hw_key_idx, u32 *iv32, u16 *iv16)
393{
394 if (local->ops->get_tkip_seq)
395 local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200396 trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16);
Johannes Berg24487982009-04-23 18:52:52 +0200397}
398
Arik Nemtsovf23a4782010-11-08 11:51:06 +0200399static inline int drv_set_frag_threshold(struct ieee80211_local *local,
400 u32 value)
401{
402 int ret = 0;
403
404 might_sleep();
405
406 trace_drv_set_frag_threshold(local, value);
407 if (local->ops->set_frag_threshold)
408 ret = local->ops->set_frag_threshold(&local->hw, value);
409 trace_drv_return_int(local, ret);
410 return ret;
411}
412
Johannes Berg24487982009-04-23 18:52:52 +0200413static inline int drv_set_rts_threshold(struct ieee80211_local *local,
414 u32 value)
415{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200416 int ret = 0;
Kalle Valoe1781ed2009-12-23 13:15:47 +0100417
418 might_sleep();
419
Johannes Berg4efc76b2010-06-10 10:56:20 +0200420 trace_drv_set_rts_threshold(local, value);
Johannes Berg24487982009-04-23 18:52:52 +0200421 if (local->ops->set_rts_threshold)
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200422 ret = local->ops->set_rts_threshold(&local->hw, value);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200423 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200424 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200425}
426
Lukáš Turek310bc672009-12-21 22:50:48 +0100427static inline int drv_set_coverage_class(struct ieee80211_local *local,
428 u8 value)
429{
430 int ret = 0;
431 might_sleep();
432
Johannes Berg4efc76b2010-06-10 10:56:20 +0200433 trace_drv_set_coverage_class(local, value);
Lukáš Turek310bc672009-12-21 22:50:48 +0100434 if (local->ops->set_coverage_class)
435 local->ops->set_coverage_class(&local->hw, value);
436 else
437 ret = -EOPNOTSUPP;
438
Johannes Berg4efc76b2010-06-10 10:56:20 +0200439 trace_drv_return_int(local, ret);
Lukáš Turek310bc672009-12-21 22:50:48 +0100440 return ret;
441}
442
Johannes Berg24487982009-04-23 18:52:52 +0200443static inline void drv_sta_notify(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +0100444 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200445 enum sta_notify_cmd cmd,
446 struct ieee80211_sta *sta)
447{
Felix Fietkaubc192f82011-11-23 21:09:49 +0700448 sdata = get_bss_sdata(sdata);
Johannes Berg7b7eab62011-11-03 14:41:13 +0100449 check_sdata_in_driver(sdata);
450
Johannes Berg4efc76b2010-06-10 10:56:20 +0200451 trace_drv_sta_notify(local, sdata, cmd, sta);
Johannes Berg24487982009-04-23 18:52:52 +0200452 if (local->ops->sta_notify)
Johannes Berg12375ef2009-11-25 20:30:31 +0100453 local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200454 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200455}
456
Johannes Berg34e89502010-02-03 13:59:58 +0100457static inline int drv_sta_add(struct ieee80211_local *local,
458 struct ieee80211_sub_if_data *sdata,
459 struct ieee80211_sta *sta)
460{
461 int ret = 0;
462
463 might_sleep();
464
Felix Fietkaubc192f82011-11-23 21:09:49 +0700465 sdata = get_bss_sdata(sdata);
Johannes Berg7b7eab62011-11-03 14:41:13 +0100466 check_sdata_in_driver(sdata);
467
Johannes Berg4efc76b2010-06-10 10:56:20 +0200468 trace_drv_sta_add(local, sdata, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100469 if (local->ops->sta_add)
470 ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100471
Johannes Berg4efc76b2010-06-10 10:56:20 +0200472 trace_drv_return_int(local, ret);
Johannes Berg34e89502010-02-03 13:59:58 +0100473
474 return ret;
475}
476
477static inline void drv_sta_remove(struct ieee80211_local *local,
478 struct ieee80211_sub_if_data *sdata,
479 struct ieee80211_sta *sta)
480{
481 might_sleep();
482
Felix Fietkaubc192f82011-11-23 21:09:49 +0700483 sdata = get_bss_sdata(sdata);
Johannes Berg7b7eab62011-11-03 14:41:13 +0100484 check_sdata_in_driver(sdata);
485
Johannes Berg4efc76b2010-06-10 10:56:20 +0200486 trace_drv_sta_remove(local, sdata, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100487 if (local->ops->sta_remove)
488 local->ops->sta_remove(&local->hw, &sdata->vif, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100489
Johannes Berg4efc76b2010-06-10 10:56:20 +0200490 trace_drv_return_void(local);
Johannes Berg34e89502010-02-03 13:59:58 +0100491}
492
Sujith Manoharan77d2ece2012-11-20 08:46:02 +0530493#ifdef CONFIG_MAC80211_DEBUGFS
494static inline void drv_sta_add_debugfs(struct ieee80211_local *local,
495 struct ieee80211_sub_if_data *sdata,
496 struct ieee80211_sta *sta,
497 struct dentry *dir)
498{
499 might_sleep();
500
501 sdata = get_bss_sdata(sdata);
502 check_sdata_in_driver(sdata);
503
504 if (local->ops->sta_add_debugfs)
505 local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
506 sta, dir);
507}
508
509static inline void drv_sta_remove_debugfs(struct ieee80211_local *local,
510 struct ieee80211_sub_if_data *sdata,
511 struct ieee80211_sta *sta,
512 struct dentry *dir)
513{
514 might_sleep();
515
516 sdata = get_bss_sdata(sdata);
517 check_sdata_in_driver(sdata);
518
519 if (local->ops->sta_remove_debugfs)
520 local->ops->sta_remove_debugfs(&local->hw, &sdata->vif,
521 sta, dir);
522}
523#endif
524
Johannes Bergf09603a2012-01-20 13:55:21 +0100525static inline __must_check
526int drv_sta_state(struct ieee80211_local *local,
527 struct ieee80211_sub_if_data *sdata,
528 struct sta_info *sta,
529 enum ieee80211_sta_state old_state,
530 enum ieee80211_sta_state new_state)
531{
532 int ret = 0;
533
534 might_sleep();
535
536 sdata = get_bss_sdata(sdata);
537 check_sdata_in_driver(sdata);
538
539 trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
Johannes Berga4ec45a2012-01-20 13:55:22 +0100540 if (local->ops->sta_state) {
Johannes Bergf09603a2012-01-20 13:55:21 +0100541 ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
542 old_state, new_state);
Johannes Berga4ec45a2012-01-20 13:55:22 +0100543 } else if (old_state == IEEE80211_STA_AUTH &&
544 new_state == IEEE80211_STA_ASSOC) {
545 ret = drv_sta_add(local, sdata, &sta->sta);
546 if (ret == 0)
547 sta->uploaded = true;
548 } else if (old_state == IEEE80211_STA_ASSOC &&
549 new_state == IEEE80211_STA_AUTH) {
550 drv_sta_remove(local, sdata, &sta->sta);
551 }
Johannes Bergf09603a2012-01-20 13:55:21 +0100552 trace_drv_return_int(local, ret);
553 return ret;
554}
555
Johannes Berg8f727ef2012-03-30 08:43:32 +0200556static inline void drv_sta_rc_update(struct ieee80211_local *local,
557 struct ieee80211_sub_if_data *sdata,
558 struct ieee80211_sta *sta, u32 changed)
559{
560 sdata = get_bss_sdata(sdata);
561 check_sdata_in_driver(sdata);
562
Antonio Quartullie687f612012-08-12 18:24:55 +0200563 WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED &&
564 sdata->vif.type != NL80211_IFTYPE_ADHOC);
565
Johannes Berg8f727ef2012-03-30 08:43:32 +0200566 trace_drv_sta_rc_update(local, sdata, sta, changed);
567 if (local->ops->sta_rc_update)
568 local->ops->sta_rc_update(&local->hw, &sdata->vif,
569 sta, changed);
570
571 trace_drv_return_void(local);
572}
573
Eliad Pellerf6f3def2011-09-25 20:06:54 +0300574static inline int drv_conf_tx(struct ieee80211_local *local,
Johannes Berga3304b02012-03-28 11:04:24 +0200575 struct ieee80211_sub_if_data *sdata, u16 ac,
Johannes Berg24487982009-04-23 18:52:52 +0200576 const struct ieee80211_tx_queue_params *params)
577{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200578 int ret = -EOPNOTSUPP;
Kalle Valoe1781ed2009-12-23 13:15:47 +0100579
580 might_sleep();
581
Johannes Berg7b7eab62011-11-03 14:41:13 +0100582 check_sdata_in_driver(sdata);
583
Johannes Berga3304b02012-03-28 11:04:24 +0200584 trace_drv_conf_tx(local, sdata, ac, params);
Johannes Berg24487982009-04-23 18:52:52 +0200585 if (local->ops->conf_tx)
Eliad Peller8a3a3c82011-10-02 10:15:52 +0200586 ret = local->ops->conf_tx(&local->hw, &sdata->vif,
Johannes Berga3304b02012-03-28 11:04:24 +0200587 ac, params);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200588 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200589 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200590}
591
Eliad Peller37a41b42011-09-21 14:06:11 +0300592static inline u64 drv_get_tsf(struct ieee80211_local *local,
593 struct ieee80211_sub_if_data *sdata)
Johannes Berg24487982009-04-23 18:52:52 +0200594{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200595 u64 ret = -1ULL;
Kalle Valoe1781ed2009-12-23 13:15:47 +0100596
597 might_sleep();
598
Johannes Berg7b7eab62011-11-03 14:41:13 +0100599 check_sdata_in_driver(sdata);
600
Eliad Peller37a41b42011-09-21 14:06:11 +0300601 trace_drv_get_tsf(local, sdata);
Johannes Berg24487982009-04-23 18:52:52 +0200602 if (local->ops->get_tsf)
Eliad Peller37a41b42011-09-21 14:06:11 +0300603 ret = local->ops->get_tsf(&local->hw, &sdata->vif);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200604 trace_drv_return_u64(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200605 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200606}
607
Eliad Peller37a41b42011-09-21 14:06:11 +0300608static inline void drv_set_tsf(struct ieee80211_local *local,
609 struct ieee80211_sub_if_data *sdata,
610 u64 tsf)
Johannes Berg24487982009-04-23 18:52:52 +0200611{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100612 might_sleep();
613
Johannes Berg7b7eab62011-11-03 14:41:13 +0100614 check_sdata_in_driver(sdata);
615
Eliad Peller37a41b42011-09-21 14:06:11 +0300616 trace_drv_set_tsf(local, sdata, tsf);
Johannes Berg24487982009-04-23 18:52:52 +0200617 if (local->ops->set_tsf)
Eliad Peller37a41b42011-09-21 14:06:11 +0300618 local->ops->set_tsf(&local->hw, &sdata->vif, tsf);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200619 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200620}
621
Eliad Peller37a41b42011-09-21 14:06:11 +0300622static inline void drv_reset_tsf(struct ieee80211_local *local,
623 struct ieee80211_sub_if_data *sdata)
Johannes Berg24487982009-04-23 18:52:52 +0200624{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100625 might_sleep();
626
Johannes Berg7b7eab62011-11-03 14:41:13 +0100627 check_sdata_in_driver(sdata);
628
Eliad Peller37a41b42011-09-21 14:06:11 +0300629 trace_drv_reset_tsf(local, sdata);
Johannes Berg24487982009-04-23 18:52:52 +0200630 if (local->ops->reset_tsf)
Eliad Peller37a41b42011-09-21 14:06:11 +0300631 local->ops->reset_tsf(&local->hw, &sdata->vif);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200632 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200633}
634
635static inline int drv_tx_last_beacon(struct ieee80211_local *local)
636{
Tim Harvey91f44b02010-12-09 13:15:45 -0800637 int ret = 0; /* default unsuported op for less congestion */
Kalle Valoe1781ed2009-12-23 13:15:47 +0100638
639 might_sleep();
640
Johannes Berg4efc76b2010-06-10 10:56:20 +0200641 trace_drv_tx_last_beacon(local);
Johannes Berg24487982009-04-23 18:52:52 +0200642 if (local->ops->tx_last_beacon)
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200643 ret = local->ops->tx_last_beacon(&local->hw);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200644 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200645 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200646}
647
648static inline int drv_ampdu_action(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +0100649 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200650 enum ieee80211_ampdu_mlme_action action,
651 struct ieee80211_sta *sta, u16 tid,
Johannes Berg0b01f032011-01-18 13:51:05 +0100652 u16 *ssn, u8 buf_size)
Johannes Berg24487982009-04-23 18:52:52 +0200653{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200654 int ret = -EOPNOTSUPP;
Johannes Bergcfcdbde2010-06-10 10:21:48 +0200655
656 might_sleep();
657
Felix Fietkaubc192f82011-11-23 21:09:49 +0700658 sdata = get_bss_sdata(sdata);
Johannes Berg7b7eab62011-11-03 14:41:13 +0100659 check_sdata_in_driver(sdata);
660
Johannes Berg0b01f032011-01-18 13:51:05 +0100661 trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200662
Johannes Berg24487982009-04-23 18:52:52 +0200663 if (local->ops->ampdu_action)
Johannes Berg12375ef2009-11-25 20:30:31 +0100664 ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action,
Johannes Berg0b01f032011-01-18 13:51:05 +0100665 sta, tid, ssn, buf_size);
Johannes Berg85ad1812010-06-10 10:21:49 +0200666
Johannes Berg4efc76b2010-06-10 10:56:20 +0200667 trace_drv_return_int(local, ret);
668
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200669 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200670}
Johannes Berg1f87f7d2009-06-02 13:01:41 +0200671
Holger Schurig12897232010-04-19 10:23:57 +0200672static inline int drv_get_survey(struct ieee80211_local *local, int idx,
673 struct survey_info *survey)
674{
675 int ret = -EOPNOTSUPP;
John W. Linvillec466d4e2010-06-29 14:51:23 -0400676
677 trace_drv_get_survey(local, idx, survey);
678
Holger Schurig35dd0502010-06-07 16:33:49 +0200679 if (local->ops->get_survey)
Holger Schurig12897232010-04-19 10:23:57 +0200680 ret = local->ops->get_survey(&local->hw, idx, survey);
John W. Linvillec466d4e2010-06-29 14:51:23 -0400681
682 trace_drv_return_int(local, ret);
683
Holger Schurig12897232010-04-19 10:23:57 +0200684 return ret;
685}
Johannes Berg1f87f7d2009-06-02 13:01:41 +0200686
687static inline void drv_rfkill_poll(struct ieee80211_local *local)
688{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100689 might_sleep();
690
Johannes Berg1f87f7d2009-06-02 13:01:41 +0200691 if (local->ops->rfkill_poll)
692 local->ops->rfkill_poll(&local->hw);
693}
Johannes Berga80f7c02009-12-23 13:15:32 +0100694
695static inline void drv_flush(struct ieee80211_local *local, bool drop)
696{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100697 might_sleep();
698
Johannes Berga80f7c02009-12-23 13:15:32 +0100699 trace_drv_flush(local, drop);
700 if (local->ops->flush)
701 local->ops->flush(&local->hw, drop);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200702 trace_drv_return_void(local);
Johannes Berga80f7c02009-12-23 13:15:32 +0100703}
Johannes Berg5ce6e432010-05-11 16:20:57 +0200704
705static inline void drv_channel_switch(struct ieee80211_local *local,
706 struct ieee80211_channel_switch *ch_switch)
707{
708 might_sleep();
709
Johannes Berg5ce6e432010-05-11 16:20:57 +0200710 trace_drv_channel_switch(local, ch_switch);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200711 local->ops->channel_switch(&local->hw, ch_switch);
712 trace_drv_return_void(local);
Johannes Berg5ce6e432010-05-11 16:20:57 +0200713}
714
Bruno Randolf15d96752010-11-10 12:50:56 +0900715
716static inline int drv_set_antenna(struct ieee80211_local *local,
717 u32 tx_ant, u32 rx_ant)
718{
719 int ret = -EOPNOTSUPP;
720 might_sleep();
721 if (local->ops->set_antenna)
722 ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
723 trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
724 return ret;
725}
726
727static inline int drv_get_antenna(struct ieee80211_local *local,
728 u32 *tx_ant, u32 *rx_ant)
729{
730 int ret = -EOPNOTSUPP;
731 might_sleep();
732 if (local->ops->get_antenna)
733 ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
734 trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
735 return ret;
736}
737
Johannes Berg21f83582010-12-18 17:20:47 +0100738static inline int drv_remain_on_channel(struct ieee80211_local *local,
Eliad Peller49884562012-11-19 17:05:09 +0200739 struct ieee80211_sub_if_data *sdata,
Johannes Berg21f83582010-12-18 17:20:47 +0100740 struct ieee80211_channel *chan,
741 enum nl80211_channel_type chantype,
742 unsigned int duration)
743{
744 int ret;
745
746 might_sleep();
747
Eliad Peller49884562012-11-19 17:05:09 +0200748 trace_drv_remain_on_channel(local, sdata, chan, chantype, duration);
749 ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
750 chan, chantype, duration);
Johannes Berg21f83582010-12-18 17:20:47 +0100751 trace_drv_return_int(local, ret);
752
753 return ret;
754}
755
756static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
757{
758 int ret;
759
760 might_sleep();
761
762 trace_drv_cancel_remain_on_channel(local);
763 ret = local->ops->cancel_remain_on_channel(&local->hw);
764 trace_drv_return_int(local, ret);
765
766 return ret;
767}
768
John W. Linville38c09152011-03-07 16:19:18 -0500769static inline int drv_set_ringparam(struct ieee80211_local *local,
770 u32 tx, u32 rx)
771{
772 int ret = -ENOTSUPP;
773
774 might_sleep();
775
776 trace_drv_set_ringparam(local, tx, rx);
777 if (local->ops->set_ringparam)
778 ret = local->ops->set_ringparam(&local->hw, tx, rx);
779 trace_drv_return_int(local, ret);
780
781 return ret;
782}
783
784static inline void drv_get_ringparam(struct ieee80211_local *local,
785 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
786{
787 might_sleep();
788
789 trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
790 if (local->ops->get_ringparam)
791 local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
792 trace_drv_return_void(local);
793}
794
Vivek Natarajane8306f92011-04-06 11:41:10 +0530795static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
796{
797 bool ret = false;
798
799 might_sleep();
800
801 trace_drv_tx_frames_pending(local);
802 if (local->ops->tx_frames_pending)
803 ret = local->ops->tx_frames_pending(&local->hw);
804 trace_drv_return_bool(local, ret);
805
806 return ret;
807}
Sujith Manoharanbdbfd6b2011-04-27 16:56:51 +0530808
809static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
810 struct ieee80211_sub_if_data *sdata,
811 const struct cfg80211_bitrate_mask *mask)
812{
813 int ret = -EOPNOTSUPP;
814
815 might_sleep();
816
Johannes Berg7b7eab62011-11-03 14:41:13 +0100817 check_sdata_in_driver(sdata);
818
Sujith Manoharanbdbfd6b2011-04-27 16:56:51 +0530819 trace_drv_set_bitrate_mask(local, sdata, mask);
820 if (local->ops->set_bitrate_mask)
821 ret = local->ops->set_bitrate_mask(&local->hw,
822 &sdata->vif, mask);
823 trace_drv_return_int(local, ret);
824
825 return ret;
826}
827
Johannes Bergc68f4b82011-07-05 16:35:41 +0200828static inline void drv_set_rekey_data(struct ieee80211_local *local,
829 struct ieee80211_sub_if_data *sdata,
830 struct cfg80211_gtk_rekey_data *data)
831{
Johannes Berg7b7eab62011-11-03 14:41:13 +0100832 check_sdata_in_driver(sdata);
833
Johannes Bergc68f4b82011-07-05 16:35:41 +0200834 trace_drv_set_rekey_data(local, sdata, data);
835 if (local->ops->set_rekey_data)
836 local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
837 trace_drv_return_void(local);
838}
839
Meenakshi Venkataraman615f7b92011-07-08 08:46:22 -0700840static inline void drv_rssi_callback(struct ieee80211_local *local,
841 const enum ieee80211_rssi_event event)
842{
843 trace_drv_rssi_callback(local, event);
844 if (local->ops->rssi_callback)
845 local->ops->rssi_callback(&local->hw, event);
846 trace_drv_return_void(local);
847}
Johannes Berg4049e092011-09-29 16:04:32 +0200848
849static inline void
850drv_release_buffered_frames(struct ieee80211_local *local,
851 struct sta_info *sta, u16 tids, int num_frames,
852 enum ieee80211_frame_release_type reason,
853 bool more_data)
854{
855 trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
856 reason, more_data);
857 if (local->ops->release_buffered_frames)
858 local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
859 num_frames, reason,
860 more_data);
861 trace_drv_return_void(local);
862}
Johannes Berg40b96402011-09-29 16:04:38 +0200863
864static inline void
865drv_allow_buffered_frames(struct ieee80211_local *local,
866 struct sta_info *sta, u16 tids, int num_frames,
867 enum ieee80211_frame_release_type reason,
868 bool more_data)
869{
870 trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
871 reason, more_data);
872 if (local->ops->allow_buffered_frames)
873 local->ops->allow_buffered_frames(&local->hw, &sta->sta,
874 tids, num_frames, reason,
875 more_data);
876 trace_drv_return_void(local);
877}
Victor Goldenshtein66572cf2012-06-21 10:56:46 +0300878
879static inline int drv_get_rssi(struct ieee80211_local *local,
880 struct ieee80211_sub_if_data *sdata,
881 struct ieee80211_sta *sta,
882 s8 *rssi_dbm)
883{
884 int ret;
885
886 might_sleep();
887
888 ret = local->ops->get_rssi(&local->hw, &sdata->vif, sta, rssi_dbm);
889 trace_drv_get_rssi(local, sta, *rssi_dbm, ret);
890
891 return ret;
892}
Johannes Berga1845fc2012-06-27 13:18:36 +0200893
894static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
895 struct ieee80211_sub_if_data *sdata)
896{
897 might_sleep();
898
899 check_sdata_in_driver(sdata);
900 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
901
902 trace_drv_mgd_prepare_tx(local, sdata);
903 if (local->ops->mgd_prepare_tx)
904 local->ops->mgd_prepare_tx(&local->hw, &sdata->vif);
905 trace_drv_return_void(local);
906}
Michal Kaziorc3645ea2012-06-26 14:37:17 +0200907
908static inline int drv_add_chanctx(struct ieee80211_local *local,
909 struct ieee80211_chanctx *ctx)
910{
911 int ret = -EOPNOTSUPP;
912
913 trace_drv_add_chanctx(local, ctx);
914 if (local->ops->add_chanctx)
915 ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
916 trace_drv_return_int(local, ret);
917
918 return ret;
919}
920
921static inline void drv_remove_chanctx(struct ieee80211_local *local,
922 struct ieee80211_chanctx *ctx)
923{
924 trace_drv_remove_chanctx(local, ctx);
925 if (local->ops->remove_chanctx)
926 local->ops->remove_chanctx(&local->hw, &ctx->conf);
927 trace_drv_return_void(local);
928}
929
930static inline void drv_change_chanctx(struct ieee80211_local *local,
931 struct ieee80211_chanctx *ctx,
932 u32 changed)
933{
934 trace_drv_change_chanctx(local, ctx, changed);
935 if (local->ops->change_chanctx)
936 local->ops->change_chanctx(&local->hw, &ctx->conf, changed);
937 trace_drv_return_void(local);
938}
939
940static inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
941 struct ieee80211_sub_if_data *sdata,
942 struct ieee80211_chanctx *ctx)
943{
944 int ret = 0;
945
946 check_sdata_in_driver(sdata);
947
948 trace_drv_assign_vif_chanctx(local, sdata, ctx);
949 if (local->ops->assign_vif_chanctx)
950 ret = local->ops->assign_vif_chanctx(&local->hw,
951 &sdata->vif,
952 &ctx->conf);
953 trace_drv_return_int(local, ret);
954
955 return ret;
956}
957
958static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
959 struct ieee80211_sub_if_data *sdata,
960 struct ieee80211_chanctx *ctx)
961{
962 check_sdata_in_driver(sdata);
963
964 trace_drv_unassign_vif_chanctx(local, sdata, ctx);
965 if (local->ops->unassign_vif_chanctx)
966 local->ops->unassign_vif_chanctx(&local->hw,
967 &sdata->vif,
968 &ctx->conf);
969 trace_drv_return_void(local);
970}
971
Johannes Berg10416382012-10-19 15:44:42 +0200972static inline int drv_start_ap(struct ieee80211_local *local,
973 struct ieee80211_sub_if_data *sdata)
974{
975 int ret = 0;
976
977 check_sdata_in_driver(sdata);
978
979 trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf);
980 if (local->ops->start_ap)
981 ret = local->ops->start_ap(&local->hw, &sdata->vif);
982 trace_drv_return_int(local, ret);
983 return ret;
984}
985
986static inline void drv_stop_ap(struct ieee80211_local *local,
987 struct ieee80211_sub_if_data *sdata)
988{
989 check_sdata_in_driver(sdata);
990
991 trace_drv_stop_ap(local, sdata);
992 if (local->ops->stop_ap)
993 local->ops->stop_ap(&local->hw, &sdata->vif);
994 trace_drv_return_void(local);
995}
996
Johannes Berg9214ad72012-11-06 19:18:13 +0100997static inline void drv_restart_complete(struct ieee80211_local *local)
998{
999 might_sleep();
1000
1001 trace_drv_restart_complete(local);
1002 if (local->ops->restart_complete)
1003 local->ops->restart_complete(&local->hw);
1004 trace_drv_return_void(local);
1005}
1006
Johannes Berg24487982009-04-23 18:52:52 +02001007#endif /* __MAC80211_DRIVER_OPS */