blob: 32a2e707e2226355235907c956632d6f03aa5af5 [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 Bergf6837ba2014-04-30 14:19:04 +02008static inline bool check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
Johannes Berg7b7eab62011-11-03 14:41:13 +01009{
Johannes Bergf6837ba2014-04-30 14:19:04 +020010 return !WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER),
11 "%s: Failed check-sdata-in-driver check, flags: 0x%x\n",
12 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 &&
Johannes Berg30686bf2015-06-02 21:39:54 +0200149 !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF) &&
Felix Fietkau31eba5b2013-05-28 13:01:53 +0200150 !(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE))))
Johannes Berg7b7eab62011-11-03 14:41:13 +0100151 return -EINVAL;
152
153 trace_drv_add_interface(local, sdata);
154 ret = local->ops->add_interface(&local->hw, &sdata->vif);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200155 trace_drv_return_int(local, ret);
Johannes Berg7b7eab62011-11-03 14:41:13 +0100156
157 if (ret == 0)
158 sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
159
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200160 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200161}
162
Johannes Berg34d4bc42010-08-27 12:35:58 +0200163static inline int drv_change_interface(struct ieee80211_local *local,
164 struct ieee80211_sub_if_data *sdata,
Johannes Berg2ca27bc2010-09-16 14:58:23 +0200165 enum nl80211_iftype type, bool p2p)
Johannes Berg34d4bc42010-08-27 12:35:58 +0200166{
167 int ret;
168
169 might_sleep();
170
Johannes Bergf6837ba2014-04-30 14:19:04 +0200171 if (!check_sdata_in_driver(sdata))
172 return -EIO;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100173
Johannes Berg2ca27bc2010-09-16 14:58:23 +0200174 trace_drv_change_interface(local, sdata, type, p2p);
175 ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
Johannes Berg34d4bc42010-08-27 12:35:58 +0200176 trace_drv_return_int(local, ret);
177 return ret;
178}
179
Johannes Berg24487982009-04-23 18:52:52 +0200180static inline void drv_remove_interface(struct ieee80211_local *local,
Johannes Berg7b7eab62011-11-03 14:41:13 +0100181 struct ieee80211_sub_if_data *sdata)
Johannes Berg24487982009-04-23 18:52:52 +0200182{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100183 might_sleep();
184
Johannes Bergf6837ba2014-04-30 14:19:04 +0200185 if (!check_sdata_in_driver(sdata))
186 return;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100187
188 trace_drv_remove_interface(local, sdata);
189 local->ops->remove_interface(&local->hw, &sdata->vif);
190 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
Johannes Berg4efc76b2010-06-10 10:56:20 +0200191 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200192}
193
194static inline int drv_config(struct ieee80211_local *local, u32 changed)
195{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100196 int ret;
197
198 might_sleep();
199
Johannes Berg4efc76b2010-06-10 10:56:20 +0200200 trace_drv_config(local, changed);
Kalle Valoe1781ed2009-12-23 13:15:47 +0100201 ret = local->ops->config(&local->hw, changed);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200202 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200203 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200204}
205
206static inline void drv_bss_info_changed(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +0100207 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200208 struct ieee80211_bss_conf *info,
209 u32 changed)
210{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100211 might_sleep();
212
Johannes Berg5bbe754d2013-02-13 13:50:51 +0100213 if (WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON |
214 BSS_CHANGED_BEACON_ENABLED) &&
215 sdata->vif.type != NL80211_IFTYPE_AP &&
216 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
Rostislav Lisovy239281f2014-11-03 10:33:19 +0100217 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
218 sdata->vif.type != NL80211_IFTYPE_OCB))
Johannes Berg5bbe754d2013-02-13 13:50:51 +0100219 return;
220
221 if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE ||
222 sdata->vif.type == NL80211_IFTYPE_MONITOR))
223 return;
Johannes Bergb8dc1a32012-12-14 14:22:10 +0100224
Johannes Bergf6837ba2014-04-30 14:19:04 +0200225 if (!check_sdata_in_driver(sdata))
226 return;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100227
Johannes Berg4efc76b2010-06-10 10:56:20 +0200228 trace_drv_bss_info_changed(local, sdata, info, changed);
Johannes Berg24487982009-04-23 18:52:52 +0200229 if (local->ops->bss_info_changed)
Johannes Berg12375ef2009-11-25 20:30:31 +0100230 local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200231 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200232}
233
Johannes Berg3ac64be2009-08-17 16:16:53 +0200234static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
Jiri Pirko22bedad32010-04-01 21:22:57 +0000235 struct netdev_hw_addr_list *mc_list)
Johannes Berg24487982009-04-23 18:52:52 +0200236{
Johannes Berg3ac64be2009-08-17 16:16:53 +0200237 u64 ret = 0;
238
Johannes Berg4efc76b2010-06-10 10:56:20 +0200239 trace_drv_prepare_multicast(local, mc_list->count);
240
Johannes Berg3ac64be2009-08-17 16:16:53 +0200241 if (local->ops->prepare_multicast)
Jiri Pirko22bedad32010-04-01 21:22:57 +0000242 ret = local->ops->prepare_multicast(&local->hw, mc_list);
Johannes Berg3ac64be2009-08-17 16:16:53 +0200243
Johannes Berg4efc76b2010-06-10 10:56:20 +0200244 trace_drv_return_u64(local, ret);
Johannes Berg3ac64be2009-08-17 16:16:53 +0200245
246 return ret;
247}
248
249static inline void drv_configure_filter(struct ieee80211_local *local,
250 unsigned int changed_flags,
251 unsigned int *total_flags,
252 u64 multicast)
253{
254 might_sleep();
255
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200256 trace_drv_configure_filter(local, changed_flags, total_flags,
Johannes Berg3ac64be2009-08-17 16:16:53 +0200257 multicast);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200258 local->ops->configure_filter(&local->hw, changed_flags, total_flags,
259 multicast);
260 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200261}
262
263static inline int drv_set_tim(struct ieee80211_local *local,
264 struct ieee80211_sta *sta, bool set)
265{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200266 int ret = 0;
Johannes Berg4efc76b2010-06-10 10:56:20 +0200267 trace_drv_set_tim(local, sta, set);
Johannes Berg24487982009-04-23 18:52:52 +0200268 if (local->ops->set_tim)
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200269 ret = local->ops->set_tim(&local->hw, sta, set);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200270 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200271 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200272}
273
274static inline int drv_set_key(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +0100275 enum set_key_cmd cmd,
276 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200277 struct ieee80211_sta *sta,
278 struct ieee80211_key_conf *key)
279{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100280 int ret;
281
282 might_sleep();
283
Johannes Berg077f4932012-01-20 13:55:18 +0100284 sdata = get_bss_sdata(sdata);
Johannes Bergf6837ba2014-04-30 14:19:04 +0200285 if (!check_sdata_in_driver(sdata))
286 return -EIO;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100287
Johannes Berg4efc76b2010-06-10 10:56:20 +0200288 trace_drv_set_key(local, cmd, sdata, sta, key);
Kalle Valoe1781ed2009-12-23 13:15:47 +0100289 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200290 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200291 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200292}
293
294static inline void drv_update_tkip_key(struct ieee80211_local *local,
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100295 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200296 struct ieee80211_key_conf *conf,
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100297 struct sta_info *sta, u32 iv32,
Johannes Berg24487982009-04-23 18:52:52 +0200298 u16 *phase1key)
299{
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100300 struct ieee80211_sta *ista = NULL;
301
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100302 if (sta)
303 ista = &sta->sta;
304
Johannes Berg077f4932012-01-20 13:55:18 +0100305 sdata = get_bss_sdata(sdata);
Johannes Bergf6837ba2014-04-30 14:19:04 +0200306 if (!check_sdata_in_driver(sdata))
307 return;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100308
Johannes Berg4efc76b2010-06-10 10:56:20 +0200309 trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
Johannes Berg24487982009-04-23 18:52:52 +0200310 if (local->ops->update_tkip_key)
Johannes Bergb3fbdcf2010-01-21 11:40:47 +0100311 local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
312 ista, iv32, phase1key);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200313 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200314}
315
316static inline int drv_hw_scan(struct ieee80211_local *local,
Johannes Berga060bbf2010-04-27 11:59:34 +0200317 struct ieee80211_sub_if_data *sdata,
David Spinadelc56ef672014-02-05 15:21:13 +0200318 struct ieee80211_scan_request *req)
Johannes Berg24487982009-04-23 18:52:52 +0200319{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100320 int ret;
321
322 might_sleep();
323
Johannes Bergf6837ba2014-04-30 14:19:04 +0200324 if (!check_sdata_in_driver(sdata))
325 return -EIO;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100326
Luciano Coelho79f460c2011-05-11 17:09:36 +0300327 trace_drv_hw_scan(local, sdata);
Johannes Berga060bbf2010-04-27 11:59:34 +0200328 ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200329 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200330 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200331}
332
Eliad Pellerb8564392011-06-13 12:47:30 +0300333static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
334 struct ieee80211_sub_if_data *sdata)
335{
336 might_sleep();
337
Johannes Bergf6837ba2014-04-30 14:19:04 +0200338 if (!check_sdata_in_driver(sdata))
339 return;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100340
Eliad Pellerb8564392011-06-13 12:47:30 +0300341 trace_drv_cancel_hw_scan(local, sdata);
342 local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
343 trace_drv_return_void(local);
344}
345
Luciano Coelho79f460c2011-05-11 17:09:36 +0300346static inline int
347drv_sched_scan_start(struct ieee80211_local *local,
348 struct ieee80211_sub_if_data *sdata,
349 struct cfg80211_sched_scan_request *req,
David Spinadel633e2712014-02-06 16:15:23 +0200350 struct ieee80211_scan_ies *ies)
Luciano Coelho79f460c2011-05-11 17:09:36 +0300351{
352 int ret;
353
354 might_sleep();
355
Johannes Bergf6837ba2014-04-30 14:19:04 +0200356 if (!check_sdata_in_driver(sdata))
357 return -EIO;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100358
Luciano Coelho79f460c2011-05-11 17:09:36 +0300359 trace_drv_sched_scan_start(local, sdata);
360 ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
361 req, ies);
362 trace_drv_return_int(local, ret);
363 return ret;
364}
365
Johannes Berg37e33082014-02-17 10:48:17 +0100366static inline int drv_sched_scan_stop(struct ieee80211_local *local,
367 struct ieee80211_sub_if_data *sdata)
Luciano Coelho79f460c2011-05-11 17:09:36 +0300368{
Johannes Berg37e33082014-02-17 10:48:17 +0100369 int ret;
370
Luciano Coelho79f460c2011-05-11 17:09:36 +0300371 might_sleep();
372
Johannes Bergf6837ba2014-04-30 14:19:04 +0200373 if (!check_sdata_in_driver(sdata))
374 return -EIO;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100375
Luciano Coelho79f460c2011-05-11 17:09:36 +0300376 trace_drv_sched_scan_stop(local, sdata);
Johannes Berg37e33082014-02-17 10:48:17 +0100377 ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif);
378 trace_drv_return_int(local, ret);
379
380 return ret;
Luciano Coelho79f460c2011-05-11 17:09:36 +0300381}
382
Johannes Berga344d672014-06-12 22:24:31 +0200383static inline void drv_sw_scan_start(struct ieee80211_local *local,
384 struct ieee80211_sub_if_data *sdata,
385 const u8 *mac_addr)
Johannes Berg24487982009-04-23 18:52:52 +0200386{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100387 might_sleep();
388
Johannes Berga344d672014-06-12 22:24:31 +0200389 trace_drv_sw_scan_start(local, sdata, mac_addr);
Johannes Berg24487982009-04-23 18:52:52 +0200390 if (local->ops->sw_scan_start)
Johannes Berga344d672014-06-12 22:24:31 +0200391 local->ops->sw_scan_start(&local->hw, &sdata->vif, mac_addr);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200392 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200393}
394
Johannes Berga344d672014-06-12 22:24:31 +0200395static inline void drv_sw_scan_complete(struct ieee80211_local *local,
396 struct ieee80211_sub_if_data *sdata)
Johannes Berg24487982009-04-23 18:52:52 +0200397{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100398 might_sleep();
399
Johannes Berga344d672014-06-12 22:24:31 +0200400 trace_drv_sw_scan_complete(local, sdata);
Johannes Berg24487982009-04-23 18:52:52 +0200401 if (local->ops->sw_scan_complete)
Johannes Berga344d672014-06-12 22:24:31 +0200402 local->ops->sw_scan_complete(&local->hw, &sdata->vif);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200403 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200404}
405
406static inline int drv_get_stats(struct ieee80211_local *local,
407 struct ieee80211_low_level_stats *stats)
408{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200409 int ret = -EOPNOTSUPP;
410
Kalle Valoe1781ed2009-12-23 13:15:47 +0100411 might_sleep();
412
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200413 if (local->ops->get_stats)
414 ret = local->ops->get_stats(&local->hw, stats);
415 trace_drv_get_stats(local, stats, ret);
416
417 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200418}
419
Johannes Berg9352c192015-04-20 18:12:41 +0200420static inline void drv_get_key_seq(struct ieee80211_local *local,
421 struct ieee80211_key *key,
422 struct ieee80211_key_seq *seq)
Johannes Berg24487982009-04-23 18:52:52 +0200423{
Johannes Berg9352c192015-04-20 18:12:41 +0200424 if (local->ops->get_key_seq)
425 local->ops->get_key_seq(&local->hw, &key->conf, seq);
426 trace_drv_get_key_seq(local, &key->conf);
Johannes Berg24487982009-04-23 18:52:52 +0200427}
428
Arik Nemtsovf23a4782010-11-08 11:51:06 +0200429static inline int drv_set_frag_threshold(struct ieee80211_local *local,
430 u32 value)
431{
432 int ret = 0;
433
434 might_sleep();
435
436 trace_drv_set_frag_threshold(local, value);
437 if (local->ops->set_frag_threshold)
438 ret = local->ops->set_frag_threshold(&local->hw, value);
439 trace_drv_return_int(local, ret);
440 return ret;
441}
442
Johannes Berg24487982009-04-23 18:52:52 +0200443static inline int drv_set_rts_threshold(struct ieee80211_local *local,
444 u32 value)
445{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200446 int ret = 0;
Kalle Valoe1781ed2009-12-23 13:15:47 +0100447
448 might_sleep();
449
Johannes Berg4efc76b2010-06-10 10:56:20 +0200450 trace_drv_set_rts_threshold(local, value);
Johannes Berg24487982009-04-23 18:52:52 +0200451 if (local->ops->set_rts_threshold)
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200452 ret = local->ops->set_rts_threshold(&local->hw, value);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200453 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200454 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200455}
456
Lukáš Turek310bc672009-12-21 22:50:48 +0100457static inline int drv_set_coverage_class(struct ieee80211_local *local,
Lorenzo Bianconia4bcaf52014-09-04 23:57:41 +0200458 s16 value)
Lukáš Turek310bc672009-12-21 22:50:48 +0100459{
460 int ret = 0;
461 might_sleep();
462
Johannes Berg4efc76b2010-06-10 10:56:20 +0200463 trace_drv_set_coverage_class(local, value);
Lukáš Turek310bc672009-12-21 22:50:48 +0100464 if (local->ops->set_coverage_class)
465 local->ops->set_coverage_class(&local->hw, value);
466 else
467 ret = -EOPNOTSUPP;
468
Johannes Berg4efc76b2010-06-10 10:56:20 +0200469 trace_drv_return_int(local, ret);
Lukáš Turek310bc672009-12-21 22:50:48 +0100470 return ret;
471}
472
Johannes Berg24487982009-04-23 18:52:52 +0200473static inline void drv_sta_notify(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +0100474 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200475 enum sta_notify_cmd cmd,
476 struct ieee80211_sta *sta)
477{
Felix Fietkaubc192f82011-11-23 21:09:49 +0700478 sdata = get_bss_sdata(sdata);
Johannes Bergf6837ba2014-04-30 14:19:04 +0200479 if (!check_sdata_in_driver(sdata))
480 return;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100481
Johannes Berg4efc76b2010-06-10 10:56:20 +0200482 trace_drv_sta_notify(local, sdata, cmd, sta);
Johannes Berg24487982009-04-23 18:52:52 +0200483 if (local->ops->sta_notify)
Johannes Berg12375ef2009-11-25 20:30:31 +0100484 local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200485 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200486}
487
Johannes Berg34e89502010-02-03 13:59:58 +0100488static inline int drv_sta_add(struct ieee80211_local *local,
489 struct ieee80211_sub_if_data *sdata,
490 struct ieee80211_sta *sta)
491{
492 int ret = 0;
493
494 might_sleep();
495
Felix Fietkaubc192f82011-11-23 21:09:49 +0700496 sdata = get_bss_sdata(sdata);
Johannes Bergf6837ba2014-04-30 14:19:04 +0200497 if (!check_sdata_in_driver(sdata))
498 return -EIO;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100499
Johannes Berg4efc76b2010-06-10 10:56:20 +0200500 trace_drv_sta_add(local, sdata, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100501 if (local->ops->sta_add)
502 ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100503
Johannes Berg4efc76b2010-06-10 10:56:20 +0200504 trace_drv_return_int(local, ret);
Johannes Berg34e89502010-02-03 13:59:58 +0100505
506 return ret;
507}
508
509static inline void drv_sta_remove(struct ieee80211_local *local,
510 struct ieee80211_sub_if_data *sdata,
511 struct ieee80211_sta *sta)
512{
513 might_sleep();
514
Felix Fietkaubc192f82011-11-23 21:09:49 +0700515 sdata = get_bss_sdata(sdata);
Johannes Bergf6837ba2014-04-30 14:19:04 +0200516 if (!check_sdata_in_driver(sdata))
517 return;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100518
Johannes Berg4efc76b2010-06-10 10:56:20 +0200519 trace_drv_sta_remove(local, sdata, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100520 if (local->ops->sta_remove)
521 local->ops->sta_remove(&local->hw, &sdata->vif, sta);
Johannes Berg34e89502010-02-03 13:59:58 +0100522
Johannes Berg4efc76b2010-06-10 10:56:20 +0200523 trace_drv_return_void(local);
Johannes Berg34e89502010-02-03 13:59:58 +0100524}
525
Sujith Manoharan77d2ece2012-11-20 08:46:02 +0530526#ifdef CONFIG_MAC80211_DEBUGFS
527static inline void drv_sta_add_debugfs(struct ieee80211_local *local,
528 struct ieee80211_sub_if_data *sdata,
529 struct ieee80211_sta *sta,
530 struct dentry *dir)
531{
532 might_sleep();
533
534 sdata = get_bss_sdata(sdata);
Johannes Bergf6837ba2014-04-30 14:19:04 +0200535 if (!check_sdata_in_driver(sdata))
536 return;
Sujith Manoharan77d2ece2012-11-20 08:46:02 +0530537
538 if (local->ops->sta_add_debugfs)
539 local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
540 sta, dir);
541}
542
543static inline void drv_sta_remove_debugfs(struct ieee80211_local *local,
544 struct ieee80211_sub_if_data *sdata,
545 struct ieee80211_sta *sta,
546 struct dentry *dir)
547{
548 might_sleep();
549
550 sdata = get_bss_sdata(sdata);
551 check_sdata_in_driver(sdata);
552
553 if (local->ops->sta_remove_debugfs)
554 local->ops->sta_remove_debugfs(&local->hw, &sdata->vif,
555 sta, dir);
556}
557#endif
558
Johannes Berg6a9d1b92013-12-04 22:39:17 +0100559static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local,
560 struct ieee80211_sub_if_data *sdata,
561 struct sta_info *sta)
562{
563 might_sleep();
564
565 sdata = get_bss_sdata(sdata);
Johannes Bergf6837ba2014-04-30 14:19:04 +0200566 if (!check_sdata_in_driver(sdata))
567 return;
Johannes Berg6a9d1b92013-12-04 22:39:17 +0100568
569 trace_drv_sta_pre_rcu_remove(local, sdata, &sta->sta);
570 if (local->ops->sta_pre_rcu_remove)
571 local->ops->sta_pre_rcu_remove(&local->hw, &sdata->vif,
572 &sta->sta);
573 trace_drv_return_void(local);
574}
575
Johannes Bergf09603a2012-01-20 13:55:21 +0100576static inline __must_check
577int drv_sta_state(struct ieee80211_local *local,
578 struct ieee80211_sub_if_data *sdata,
579 struct sta_info *sta,
580 enum ieee80211_sta_state old_state,
581 enum ieee80211_sta_state new_state)
582{
583 int ret = 0;
584
585 might_sleep();
586
587 sdata = get_bss_sdata(sdata);
Johannes Bergf6837ba2014-04-30 14:19:04 +0200588 if (!check_sdata_in_driver(sdata))
589 return -EIO;
Johannes Bergf09603a2012-01-20 13:55:21 +0100590
591 trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
Johannes Berga4ec45a2012-01-20 13:55:22 +0100592 if (local->ops->sta_state) {
Johannes Bergf09603a2012-01-20 13:55:21 +0100593 ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
594 old_state, new_state);
Johannes Berga4ec45a2012-01-20 13:55:22 +0100595 } else if (old_state == IEEE80211_STA_AUTH &&
596 new_state == IEEE80211_STA_ASSOC) {
597 ret = drv_sta_add(local, sdata, &sta->sta);
598 if (ret == 0)
599 sta->uploaded = true;
600 } else if (old_state == IEEE80211_STA_ASSOC &&
601 new_state == IEEE80211_STA_AUTH) {
602 drv_sta_remove(local, sdata, &sta->sta);
603 }
Johannes Bergf09603a2012-01-20 13:55:21 +0100604 trace_drv_return_int(local, ret);
605 return ret;
606}
607
Johannes Berg8f727ef2012-03-30 08:43:32 +0200608static inline void drv_sta_rc_update(struct ieee80211_local *local,
609 struct ieee80211_sub_if_data *sdata,
610 struct ieee80211_sta *sta, u32 changed)
611{
612 sdata = get_bss_sdata(sdata);
Johannes Bergf6837ba2014-04-30 14:19:04 +0200613 if (!check_sdata_in_driver(sdata))
614 return;
Johannes Berg8f727ef2012-03-30 08:43:32 +0200615
Antonio Quartullie687f612012-08-12 18:24:55 +0200616 WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED &&
Thomas Pedersenf68d7762013-01-23 12:18:13 -0800617 (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
618 sdata->vif.type != NL80211_IFTYPE_MESH_POINT));
Antonio Quartullie687f612012-08-12 18:24:55 +0200619
Johannes Berg8f727ef2012-03-30 08:43:32 +0200620 trace_drv_sta_rc_update(local, sdata, sta, changed);
621 if (local->ops->sta_rc_update)
622 local->ops->sta_rc_update(&local->hw, &sdata->vif,
623 sta, changed);
624
625 trace_drv_return_void(local);
626}
627
Johannes Bergf815e2b2014-11-19 00:10:42 +0100628static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local,
629 struct ieee80211_sub_if_data *sdata,
630 struct ieee80211_sta *sta)
631{
632 sdata = get_bss_sdata(sdata);
633 if (!check_sdata_in_driver(sdata))
634 return;
635
636 trace_drv_sta_rate_tbl_update(local, sdata, sta);
637 if (local->ops->sta_rate_tbl_update)
638 local->ops->sta_rate_tbl_update(&local->hw, &sdata->vif, sta);
639
640 trace_drv_return_void(local);
641}
642
Johannes Berg2b9a7e12014-11-17 11:35:23 +0100643static inline void drv_sta_statistics(struct ieee80211_local *local,
644 struct ieee80211_sub_if_data *sdata,
645 struct ieee80211_sta *sta,
646 struct station_info *sinfo)
647{
648 sdata = get_bss_sdata(sdata);
649 if (!check_sdata_in_driver(sdata))
650 return;
651
652 trace_drv_sta_statistics(local, sdata, sta);
653 if (local->ops->sta_statistics)
654 local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo);
655 trace_drv_return_void(local);
656}
657
Eliad Pellerf6f3def2011-09-25 20:06:54 +0300658static inline int drv_conf_tx(struct ieee80211_local *local,
Johannes Berga3304b02012-03-28 11:04:24 +0200659 struct ieee80211_sub_if_data *sdata, u16 ac,
Johannes Berg24487982009-04-23 18:52:52 +0200660 const struct ieee80211_tx_queue_params *params)
661{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200662 int ret = -EOPNOTSUPP;
Kalle Valoe1781ed2009-12-23 13:15:47 +0100663
664 might_sleep();
665
Johannes Bergf6837ba2014-04-30 14:19:04 +0200666 if (!check_sdata_in_driver(sdata))
667 return -EIO;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100668
Johannes Bergf4090792014-10-08 14:37:47 +0200669 if (WARN_ONCE(params->cw_min == 0 ||
670 params->cw_min > params->cw_max,
671 "%s: invalid CW_min/CW_max: %d/%d\n",
672 sdata->name, params->cw_min, params->cw_max))
673 return -EINVAL;
674
Johannes Berga3304b02012-03-28 11:04:24 +0200675 trace_drv_conf_tx(local, sdata, ac, params);
Johannes Berg24487982009-04-23 18:52:52 +0200676 if (local->ops->conf_tx)
Eliad Peller8a3a3c82011-10-02 10:15:52 +0200677 ret = local->ops->conf_tx(&local->hw, &sdata->vif,
Johannes Berga3304b02012-03-28 11:04:24 +0200678 ac, params);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200679 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200680 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200681}
682
Eliad Peller37a41b42011-09-21 14:06:11 +0300683static inline u64 drv_get_tsf(struct ieee80211_local *local,
684 struct ieee80211_sub_if_data *sdata)
Johannes Berg24487982009-04-23 18:52:52 +0200685{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200686 u64 ret = -1ULL;
Kalle Valoe1781ed2009-12-23 13:15:47 +0100687
688 might_sleep();
689
Johannes Bergf6837ba2014-04-30 14:19:04 +0200690 if (!check_sdata_in_driver(sdata))
691 return ret;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100692
Eliad Peller37a41b42011-09-21 14:06:11 +0300693 trace_drv_get_tsf(local, sdata);
Johannes Berg24487982009-04-23 18:52:52 +0200694 if (local->ops->get_tsf)
Eliad Peller37a41b42011-09-21 14:06:11 +0300695 ret = local->ops->get_tsf(&local->hw, &sdata->vif);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200696 trace_drv_return_u64(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200697 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200698}
699
Eliad Peller37a41b42011-09-21 14:06:11 +0300700static inline void drv_set_tsf(struct ieee80211_local *local,
701 struct ieee80211_sub_if_data *sdata,
702 u64 tsf)
Johannes Berg24487982009-04-23 18:52:52 +0200703{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100704 might_sleep();
705
Johannes Bergf6837ba2014-04-30 14:19:04 +0200706 if (!check_sdata_in_driver(sdata))
707 return;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100708
Eliad Peller37a41b42011-09-21 14:06:11 +0300709 trace_drv_set_tsf(local, sdata, tsf);
Johannes Berg24487982009-04-23 18:52:52 +0200710 if (local->ops->set_tsf)
Eliad Peller37a41b42011-09-21 14:06:11 +0300711 local->ops->set_tsf(&local->hw, &sdata->vif, tsf);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200712 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200713}
714
Eliad Peller37a41b42011-09-21 14:06:11 +0300715static inline void drv_reset_tsf(struct ieee80211_local *local,
716 struct ieee80211_sub_if_data *sdata)
Johannes Berg24487982009-04-23 18:52:52 +0200717{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100718 might_sleep();
719
Johannes Bergf6837ba2014-04-30 14:19:04 +0200720 if (!check_sdata_in_driver(sdata))
721 return;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100722
Eliad Peller37a41b42011-09-21 14:06:11 +0300723 trace_drv_reset_tsf(local, sdata);
Johannes Berg24487982009-04-23 18:52:52 +0200724 if (local->ops->reset_tsf)
Eliad Peller37a41b42011-09-21 14:06:11 +0300725 local->ops->reset_tsf(&local->hw, &sdata->vif);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200726 trace_drv_return_void(local);
Johannes Berg24487982009-04-23 18:52:52 +0200727}
728
729static inline int drv_tx_last_beacon(struct ieee80211_local *local)
730{
Masanari Iida02582e92012-08-22 19:11:26 +0900731 int ret = 0; /* default unsupported op for less congestion */
Kalle Valoe1781ed2009-12-23 13:15:47 +0100732
733 might_sleep();
734
Johannes Berg4efc76b2010-06-10 10:56:20 +0200735 trace_drv_tx_last_beacon(local);
Johannes Berg24487982009-04-23 18:52:52 +0200736 if (local->ops->tx_last_beacon)
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200737 ret = local->ops->tx_last_beacon(&local->hw);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200738 trace_drv_return_int(local, ret);
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200739 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200740}
741
742static inline int drv_ampdu_action(struct ieee80211_local *local,
Johannes Berg12375ef2009-11-25 20:30:31 +0100743 struct ieee80211_sub_if_data *sdata,
Johannes Berg24487982009-04-23 18:52:52 +0200744 enum ieee80211_ampdu_mlme_action action,
745 struct ieee80211_sta *sta, u16 tid,
Johannes Berg0b01f032011-01-18 13:51:05 +0100746 u16 *ssn, u8 buf_size)
Johannes Berg24487982009-04-23 18:52:52 +0200747{
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200748 int ret = -EOPNOTSUPP;
Johannes Bergcfcdbde2010-06-10 10:21:48 +0200749
750 might_sleep();
751
Felix Fietkaubc192f82011-11-23 21:09:49 +0700752 sdata = get_bss_sdata(sdata);
Johannes Bergf6837ba2014-04-30 14:19:04 +0200753 if (!check_sdata_in_driver(sdata))
754 return -EIO;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100755
Johannes Berg0b01f032011-01-18 13:51:05 +0100756 trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200757
Johannes Berg24487982009-04-23 18:52:52 +0200758 if (local->ops->ampdu_action)
Johannes Berg12375ef2009-11-25 20:30:31 +0100759 ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action,
Johannes Berg0b01f032011-01-18 13:51:05 +0100760 sta, tid, ssn, buf_size);
Johannes Berg85ad1812010-06-10 10:21:49 +0200761
Johannes Berg4efc76b2010-06-10 10:56:20 +0200762 trace_drv_return_int(local, ret);
763
Johannes Berg0a2b8bb2009-07-07 13:46:22 +0200764 return ret;
Johannes Berg24487982009-04-23 18:52:52 +0200765}
Johannes Berg1f87f7d2009-06-02 13:01:41 +0200766
Holger Schurig12897232010-04-19 10:23:57 +0200767static inline int drv_get_survey(struct ieee80211_local *local, int idx,
768 struct survey_info *survey)
769{
770 int ret = -EOPNOTSUPP;
John W. Linvillec466d4e2010-06-29 14:51:23 -0400771
772 trace_drv_get_survey(local, idx, survey);
773
Holger Schurig35dd0502010-06-07 16:33:49 +0200774 if (local->ops->get_survey)
Holger Schurig12897232010-04-19 10:23:57 +0200775 ret = local->ops->get_survey(&local->hw, idx, survey);
John W. Linvillec466d4e2010-06-29 14:51:23 -0400776
777 trace_drv_return_int(local, ret);
778
Holger Schurig12897232010-04-19 10:23:57 +0200779 return ret;
780}
Johannes Berg1f87f7d2009-06-02 13:01:41 +0200781
782static inline void drv_rfkill_poll(struct ieee80211_local *local)
783{
Kalle Valoe1781ed2009-12-23 13:15:47 +0100784 might_sleep();
785
Johannes Berg1f87f7d2009-06-02 13:01:41 +0200786 if (local->ops->rfkill_poll)
787 local->ops->rfkill_poll(&local->hw);
788}
Johannes Berga80f7c02009-12-23 13:15:32 +0100789
Johannes Berg39ecc012013-02-13 12:11:00 +0100790static inline void drv_flush(struct ieee80211_local *local,
Emmanuel Grumbach77be2c52014-03-27 11:30:29 +0200791 struct ieee80211_sub_if_data *sdata,
Johannes Berg39ecc012013-02-13 12:11:00 +0100792 u32 queues, bool drop)
Johannes Berga80f7c02009-12-23 13:15:32 +0100793{
Emmanuel Grumbach77be2c52014-03-27 11:30:29 +0200794 struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL;
795
Kalle Valoe1781ed2009-12-23 13:15:47 +0100796 might_sleep();
797
Johannes Bergf6837ba2014-04-30 14:19:04 +0200798 if (sdata && !check_sdata_in_driver(sdata))
799 return;
Emmanuel Grumbach77be2c52014-03-27 11:30:29 +0200800
Johannes Berg39ecc012013-02-13 12:11:00 +0100801 trace_drv_flush(local, queues, drop);
Johannes Berga80f7c02009-12-23 13:15:32 +0100802 if (local->ops->flush)
Emmanuel Grumbach77be2c52014-03-27 11:30:29 +0200803 local->ops->flush(&local->hw, vif, queues, drop);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200804 trace_drv_return_void(local);
Johannes Berga80f7c02009-12-23 13:15:32 +0100805}
Johannes Berg5ce6e432010-05-11 16:20:57 +0200806
807static inline void drv_channel_switch(struct ieee80211_local *local,
Luciano Coelho0f791eb42014-10-08 09:48:40 +0300808 struct ieee80211_sub_if_data *sdata,
809 struct ieee80211_channel_switch *ch_switch)
Johannes Berg5ce6e432010-05-11 16:20:57 +0200810{
811 might_sleep();
812
Luciano Coelho0f791eb42014-10-08 09:48:40 +0300813 trace_drv_channel_switch(local, sdata, ch_switch);
814 local->ops->channel_switch(&local->hw, &sdata->vif, ch_switch);
Johannes Berg4efc76b2010-06-10 10:56:20 +0200815 trace_drv_return_void(local);
Johannes Berg5ce6e432010-05-11 16:20:57 +0200816}
817
Bruno Randolf15d96752010-11-10 12:50:56 +0900818
819static inline int drv_set_antenna(struct ieee80211_local *local,
820 u32 tx_ant, u32 rx_ant)
821{
822 int ret = -EOPNOTSUPP;
823 might_sleep();
824 if (local->ops->set_antenna)
825 ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
826 trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
827 return ret;
828}
829
830static inline int drv_get_antenna(struct ieee80211_local *local,
831 u32 *tx_ant, u32 *rx_ant)
832{
833 int ret = -EOPNOTSUPP;
834 might_sleep();
835 if (local->ops->get_antenna)
836 ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
837 trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
838 return ret;
839}
840
Johannes Berg21f83582010-12-18 17:20:47 +0100841static inline int drv_remain_on_channel(struct ieee80211_local *local,
Eliad Peller49884562012-11-19 17:05:09 +0200842 struct ieee80211_sub_if_data *sdata,
Johannes Berg21f83582010-12-18 17:20:47 +0100843 struct ieee80211_channel *chan,
Ilan Peerd339d5c2013-02-12 09:34:13 +0200844 unsigned int duration,
845 enum ieee80211_roc_type type)
Johannes Berg21f83582010-12-18 17:20:47 +0100846{
847 int ret;
848
849 might_sleep();
850
Ilan Peerd339d5c2013-02-12 09:34:13 +0200851 trace_drv_remain_on_channel(local, sdata, chan, duration, type);
Eliad Peller49884562012-11-19 17:05:09 +0200852 ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
Ilan Peerd339d5c2013-02-12 09:34:13 +0200853 chan, duration, type);
Johannes Berg21f83582010-12-18 17:20:47 +0100854 trace_drv_return_int(local, ret);
855
856 return ret;
857}
858
859static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
860{
861 int ret;
862
863 might_sleep();
864
865 trace_drv_cancel_remain_on_channel(local);
866 ret = local->ops->cancel_remain_on_channel(&local->hw);
867 trace_drv_return_int(local, ret);
868
869 return ret;
870}
871
John W. Linville38c09152011-03-07 16:19:18 -0500872static inline int drv_set_ringparam(struct ieee80211_local *local,
873 u32 tx, u32 rx)
874{
875 int ret = -ENOTSUPP;
876
877 might_sleep();
878
879 trace_drv_set_ringparam(local, tx, rx);
880 if (local->ops->set_ringparam)
881 ret = local->ops->set_ringparam(&local->hw, tx, rx);
882 trace_drv_return_int(local, ret);
883
884 return ret;
885}
886
887static inline void drv_get_ringparam(struct ieee80211_local *local,
888 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
889{
890 might_sleep();
891
892 trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
893 if (local->ops->get_ringparam)
894 local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
895 trace_drv_return_void(local);
896}
897
Vivek Natarajane8306f92011-04-06 11:41:10 +0530898static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
899{
900 bool ret = false;
901
902 might_sleep();
903
904 trace_drv_tx_frames_pending(local);
905 if (local->ops->tx_frames_pending)
906 ret = local->ops->tx_frames_pending(&local->hw);
907 trace_drv_return_bool(local, ret);
908
909 return ret;
910}
Sujith Manoharanbdbfd6b2011-04-27 16:56:51 +0530911
912static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
913 struct ieee80211_sub_if_data *sdata,
914 const struct cfg80211_bitrate_mask *mask)
915{
916 int ret = -EOPNOTSUPP;
917
918 might_sleep();
919
Johannes Bergf6837ba2014-04-30 14:19:04 +0200920 if (!check_sdata_in_driver(sdata))
921 return -EIO;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100922
Sujith Manoharanbdbfd6b2011-04-27 16:56:51 +0530923 trace_drv_set_bitrate_mask(local, sdata, mask);
924 if (local->ops->set_bitrate_mask)
925 ret = local->ops->set_bitrate_mask(&local->hw,
926 &sdata->vif, mask);
927 trace_drv_return_int(local, ret);
928
929 return ret;
930}
931
Johannes Bergc68f4b82011-07-05 16:35:41 +0200932static inline void drv_set_rekey_data(struct ieee80211_local *local,
933 struct ieee80211_sub_if_data *sdata,
934 struct cfg80211_gtk_rekey_data *data)
935{
Johannes Bergf6837ba2014-04-30 14:19:04 +0200936 if (!check_sdata_in_driver(sdata))
937 return;
Johannes Berg7b7eab62011-11-03 14:41:13 +0100938
Johannes Bergc68f4b82011-07-05 16:35:41 +0200939 trace_drv_set_rekey_data(local, sdata, data);
940 if (local->ops->set_rekey_data)
941 local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
942 trace_drv_return_void(local);
943}
944
Emmanuel Grumbacha8182922015-03-16 23:23:34 +0200945static inline void drv_event_callback(struct ieee80211_local *local,
946 struct ieee80211_sub_if_data *sdata,
947 const struct ieee80211_event *event)
Meenakshi Venkataraman615f7b92011-07-08 08:46:22 -0700948{
Emmanuel Grumbacha8182922015-03-16 23:23:34 +0200949 trace_drv_event_callback(local, sdata, event);
950 if (local->ops->event_callback)
951 local->ops->event_callback(&local->hw, &sdata->vif, event);
Meenakshi Venkataraman615f7b92011-07-08 08:46:22 -0700952 trace_drv_return_void(local);
953}
Johannes Berg4049e092011-09-29 16:04:32 +0200954
955static inline void
956drv_release_buffered_frames(struct ieee80211_local *local,
957 struct sta_info *sta, u16 tids, int num_frames,
958 enum ieee80211_frame_release_type reason,
959 bool more_data)
960{
961 trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
962 reason, more_data);
963 if (local->ops->release_buffered_frames)
964 local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
965 num_frames, reason,
966 more_data);
967 trace_drv_return_void(local);
968}
Johannes Berg40b96402011-09-29 16:04:38 +0200969
970static inline void
971drv_allow_buffered_frames(struct ieee80211_local *local,
972 struct sta_info *sta, u16 tids, int num_frames,
973 enum ieee80211_frame_release_type reason,
974 bool more_data)
975{
976 trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
977 reason, more_data);
978 if (local->ops->allow_buffered_frames)
979 local->ops->allow_buffered_frames(&local->hw, &sta->sta,
980 tids, num_frames, reason,
981 more_data);
982 trace_drv_return_void(local);
983}
Victor Goldenshtein66572cf2012-06-21 10:56:46 +0300984
Johannes Berga1845fc2012-06-27 13:18:36 +0200985static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
986 struct ieee80211_sub_if_data *sdata)
987{
988 might_sleep();
989
Johannes Bergf6837ba2014-04-30 14:19:04 +0200990 if (!check_sdata_in_driver(sdata))
991 return;
Johannes Berga1845fc2012-06-27 13:18:36 +0200992 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
993
994 trace_drv_mgd_prepare_tx(local, sdata);
995 if (local->ops->mgd_prepare_tx)
996 local->ops->mgd_prepare_tx(&local->hw, &sdata->vif);
997 trace_drv_return_void(local);
998}
Michal Kaziorc3645ea2012-06-26 14:37:17 +0200999
Arik Nemtsovee10f2c2014-06-11 17:18:27 +03001000static inline void
1001drv_mgd_protect_tdls_discover(struct ieee80211_local *local,
1002 struct ieee80211_sub_if_data *sdata)
1003{
1004 might_sleep();
1005
1006 if (!check_sdata_in_driver(sdata))
1007 return;
1008 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
1009
1010 trace_drv_mgd_protect_tdls_discover(local, sdata);
1011 if (local->ops->mgd_protect_tdls_discover)
1012 local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif);
1013 trace_drv_return_void(local);
1014}
1015
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001016static inline int drv_add_chanctx(struct ieee80211_local *local,
1017 struct ieee80211_chanctx *ctx)
1018{
1019 int ret = -EOPNOTSUPP;
1020
1021 trace_drv_add_chanctx(local, ctx);
1022 if (local->ops->add_chanctx)
1023 ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
1024 trace_drv_return_int(local, ret);
Johannes Berg8a61af62012-12-13 17:42:30 +01001025 if (!ret)
1026 ctx->driver_present = true;
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001027
1028 return ret;
1029}
1030
1031static inline void drv_remove_chanctx(struct ieee80211_local *local,
1032 struct ieee80211_chanctx *ctx)
1033{
Johannes Bergf6837ba2014-04-30 14:19:04 +02001034 if (WARN_ON(!ctx->driver_present))
1035 return;
1036
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001037 trace_drv_remove_chanctx(local, ctx);
1038 if (local->ops->remove_chanctx)
1039 local->ops->remove_chanctx(&local->hw, &ctx->conf);
1040 trace_drv_return_void(local);
Johannes Berg8a61af62012-12-13 17:42:30 +01001041 ctx->driver_present = false;
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001042}
1043
1044static inline void drv_change_chanctx(struct ieee80211_local *local,
1045 struct ieee80211_chanctx *ctx,
1046 u32 changed)
1047{
1048 trace_drv_change_chanctx(local, ctx, changed);
Johannes Berg8a61af62012-12-13 17:42:30 +01001049 if (local->ops->change_chanctx) {
1050 WARN_ON_ONCE(!ctx->driver_present);
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001051 local->ops->change_chanctx(&local->hw, &ctx->conf, changed);
Johannes Berg8a61af62012-12-13 17:42:30 +01001052 }
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001053 trace_drv_return_void(local);
1054}
1055
1056static inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
1057 struct ieee80211_sub_if_data *sdata,
1058 struct ieee80211_chanctx *ctx)
1059{
1060 int ret = 0;
1061
Johannes Bergf6837ba2014-04-30 14:19:04 +02001062 if (!check_sdata_in_driver(sdata))
1063 return -EIO;
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001064
1065 trace_drv_assign_vif_chanctx(local, sdata, ctx);
Johannes Berg8a61af62012-12-13 17:42:30 +01001066 if (local->ops->assign_vif_chanctx) {
1067 WARN_ON_ONCE(!ctx->driver_present);
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001068 ret = local->ops->assign_vif_chanctx(&local->hw,
1069 &sdata->vif,
1070 &ctx->conf);
Johannes Berg8a61af62012-12-13 17:42:30 +01001071 }
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001072 trace_drv_return_int(local, ret);
1073
1074 return ret;
1075}
1076
1077static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
1078 struct ieee80211_sub_if_data *sdata,
1079 struct ieee80211_chanctx *ctx)
1080{
Johannes Bergf6837ba2014-04-30 14:19:04 +02001081 if (!check_sdata_in_driver(sdata))
1082 return;
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001083
1084 trace_drv_unassign_vif_chanctx(local, sdata, ctx);
Johannes Berg8a61af62012-12-13 17:42:30 +01001085 if (local->ops->unassign_vif_chanctx) {
1086 WARN_ON_ONCE(!ctx->driver_present);
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001087 local->ops->unassign_vif_chanctx(&local->hw,
1088 &sdata->vif,
1089 &ctx->conf);
Johannes Berg8a61af62012-12-13 17:42:30 +01001090 }
Michal Kaziorc3645ea2012-06-26 14:37:17 +02001091 trace_drv_return_void(local);
1092}
1093
Luciano Coelho1a5f0c12014-05-23 14:33:12 +03001094static inline int
1095drv_switch_vif_chanctx(struct ieee80211_local *local,
1096 struct ieee80211_vif_chanctx_switch *vifs,
1097 int n_vifs,
1098 enum ieee80211_chanctx_switch_mode mode)
1099{
1100 int ret = 0;
1101 int i;
1102
1103 if (!local->ops->switch_vif_chanctx)
1104 return -EOPNOTSUPP;
1105
1106 for (i = 0; i < n_vifs; i++) {
1107 struct ieee80211_chanctx *new_ctx =
1108 container_of(vifs[i].new_ctx,
1109 struct ieee80211_chanctx,
1110 conf);
1111 struct ieee80211_chanctx *old_ctx =
1112 container_of(vifs[i].old_ctx,
1113 struct ieee80211_chanctx,
1114 conf);
1115
1116 WARN_ON_ONCE(!old_ctx->driver_present);
1117 WARN_ON_ONCE((mode == CHANCTX_SWMODE_SWAP_CONTEXTS &&
1118 new_ctx->driver_present) ||
1119 (mode == CHANCTX_SWMODE_REASSIGN_VIF &&
1120 !new_ctx->driver_present));
1121 }
1122
1123 trace_drv_switch_vif_chanctx(local, vifs, n_vifs, mode);
1124 ret = local->ops->switch_vif_chanctx(&local->hw,
1125 vifs, n_vifs, mode);
1126 trace_drv_return_int(local, ret);
1127
1128 if (!ret && mode == CHANCTX_SWMODE_SWAP_CONTEXTS) {
1129 for (i = 0; i < n_vifs; i++) {
1130 struct ieee80211_chanctx *new_ctx =
1131 container_of(vifs[i].new_ctx,
1132 struct ieee80211_chanctx,
1133 conf);
1134 struct ieee80211_chanctx *old_ctx =
1135 container_of(vifs[i].old_ctx,
1136 struct ieee80211_chanctx,
1137 conf);
1138
1139 new_ctx->driver_present = true;
1140 old_ctx->driver_present = false;
1141 }
1142 }
1143
1144 return ret;
1145}
1146
Johannes Berg10416382012-10-19 15:44:42 +02001147static inline int drv_start_ap(struct ieee80211_local *local,
1148 struct ieee80211_sub_if_data *sdata)
1149{
1150 int ret = 0;
1151
Johannes Bergf6837ba2014-04-30 14:19:04 +02001152 if (!check_sdata_in_driver(sdata))
1153 return -EIO;
Johannes Berg10416382012-10-19 15:44:42 +02001154
1155 trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf);
1156 if (local->ops->start_ap)
1157 ret = local->ops->start_ap(&local->hw, &sdata->vif);
1158 trace_drv_return_int(local, ret);
1159 return ret;
1160}
1161
1162static inline void drv_stop_ap(struct ieee80211_local *local,
1163 struct ieee80211_sub_if_data *sdata)
1164{
Johannes Bergf6837ba2014-04-30 14:19:04 +02001165 if (!check_sdata_in_driver(sdata))
1166 return;
Johannes Berg10416382012-10-19 15:44:42 +02001167
1168 trace_drv_stop_ap(local, sdata);
1169 if (local->ops->stop_ap)
1170 local->ops->stop_ap(&local->hw, &sdata->vif);
1171 trace_drv_return_void(local);
1172}
1173
Eliad Pellercf2c92d2014-11-04 11:43:54 +02001174static inline void
1175drv_reconfig_complete(struct ieee80211_local *local,
1176 enum ieee80211_reconfig_type reconfig_type)
Johannes Berg9214ad72012-11-06 19:18:13 +01001177{
1178 might_sleep();
1179
Eliad Pellercf2c92d2014-11-04 11:43:54 +02001180 trace_drv_reconfig_complete(local, reconfig_type);
1181 if (local->ops->reconfig_complete)
1182 local->ops->reconfig_complete(&local->hw, reconfig_type);
Johannes Berg9214ad72012-11-06 19:18:13 +01001183 trace_drv_return_void(local);
1184}
1185
Yoni Divinskyde5fad82012-05-30 11:36:39 +03001186static inline void
1187drv_set_default_unicast_key(struct ieee80211_local *local,
1188 struct ieee80211_sub_if_data *sdata,
1189 int key_idx)
1190{
Johannes Bergf6837ba2014-04-30 14:19:04 +02001191 if (!check_sdata_in_driver(sdata))
1192 return;
Yoni Divinskyde5fad82012-05-30 11:36:39 +03001193
1194 WARN_ON_ONCE(key_idx < -1 || key_idx > 3);
1195
1196 trace_drv_set_default_unicast_key(local, sdata, key_idx);
1197 if (local->ops->set_default_unicast_key)
1198 local->ops->set_default_unicast_key(&local->hw, &sdata->vif,
1199 key_idx);
1200 trace_drv_return_void(local);
1201}
1202
Johannes Berga65240c2013-01-14 15:14:34 +01001203#if IS_ENABLED(CONFIG_IPV6)
1204static inline void drv_ipv6_addr_change(struct ieee80211_local *local,
1205 struct ieee80211_sub_if_data *sdata,
1206 struct inet6_dev *idev)
1207{
1208 trace_drv_ipv6_addr_change(local, sdata);
1209 if (local->ops->ipv6_addr_change)
1210 local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev);
1211 trace_drv_return_void(local);
1212}
1213#endif
1214
Simon Wunderlich73da7d52013-07-11 16:09:06 +02001215static inline void
1216drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata,
1217 struct cfg80211_chan_def *chandef)
1218{
1219 struct ieee80211_local *local = sdata->local;
1220
1221 if (local->ops->channel_switch_beacon) {
1222 trace_drv_channel_switch_beacon(local, sdata, chandef);
1223 local->ops->channel_switch_beacon(&local->hw, &sdata->vif,
1224 chandef);
1225 }
1226}
1227
Luciano Coelho6d027bc2014-10-08 09:48:37 +03001228static inline int
1229drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata,
1230 struct ieee80211_channel_switch *ch_switch)
1231{
1232 struct ieee80211_local *local = sdata->local;
1233 int ret = 0;
1234
1235 if (!check_sdata_in_driver(sdata))
1236 return -EIO;
1237
1238 trace_drv_pre_channel_switch(local, sdata, ch_switch);
1239 if (local->ops->pre_channel_switch)
1240 ret = local->ops->pre_channel_switch(&local->hw, &sdata->vif,
1241 ch_switch);
1242 trace_drv_return_int(local, ret);
1243 return ret;
1244}
1245
Luciano Coelhof1d65582014-10-08 09:48:38 +03001246static inline int
1247drv_post_channel_switch(struct ieee80211_sub_if_data *sdata)
1248{
1249 struct ieee80211_local *local = sdata->local;
1250 int ret = 0;
1251
1252 if (!check_sdata_in_driver(sdata))
1253 return -EIO;
1254
1255 trace_drv_post_channel_switch(local, sdata);
1256 if (local->ops->post_channel_switch)
1257 ret = local->ops->post_channel_switch(&local->hw, &sdata->vif);
1258 trace_drv_return_int(local, ret);
1259 return ret;
1260}
1261
Johannes Berg55fff502013-08-19 18:48:41 +02001262static inline int drv_join_ibss(struct ieee80211_local *local,
1263 struct ieee80211_sub_if_data *sdata)
1264{
1265 int ret = 0;
1266
1267 might_sleep();
Johannes Bergf6837ba2014-04-30 14:19:04 +02001268 if (!check_sdata_in_driver(sdata))
1269 return -EIO;
Johannes Berg55fff502013-08-19 18:48:41 +02001270
1271 trace_drv_join_ibss(local, sdata, &sdata->vif.bss_conf);
1272 if (local->ops->join_ibss)
1273 ret = local->ops->join_ibss(&local->hw, &sdata->vif);
1274 trace_drv_return_int(local, ret);
1275 return ret;
1276}
1277
1278static inline void drv_leave_ibss(struct ieee80211_local *local,
1279 struct ieee80211_sub_if_data *sdata)
1280{
1281 might_sleep();
Johannes Bergf6837ba2014-04-30 14:19:04 +02001282 if (!check_sdata_in_driver(sdata))
1283 return;
Johannes Berg55fff502013-08-19 18:48:41 +02001284
1285 trace_drv_leave_ibss(local, sdata);
1286 if (local->ops->leave_ibss)
1287 local->ops->leave_ibss(&local->hw, &sdata->vif);
1288 trace_drv_return_void(local);
1289}
1290
Antonio Quartullicca674d2014-05-19 21:53:20 +02001291static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
1292 struct ieee80211_sta *sta)
1293{
1294 u32 ret = 0;
1295
1296 trace_drv_get_expected_throughput(sta);
1297 if (local->ops->get_expected_throughput)
1298 ret = local->ops->get_expected_throughput(sta);
1299 trace_drv_return_u32(local, ret);
1300
1301 return ret;
1302}
1303
Felix Fietkau5b3dc422014-10-26 00:32:53 +02001304static inline int drv_get_txpower(struct ieee80211_local *local,
1305 struct ieee80211_sub_if_data *sdata, int *dbm)
1306{
1307 int ret;
1308
1309 if (!local->ops->get_txpower)
1310 return -EOPNOTSUPP;
1311
1312 ret = local->ops->get_txpower(&local->hw, &sdata->vif, dbm);
1313 trace_drv_get_txpower(local, sdata, *dbm, ret);
1314
1315 return ret;
1316}
1317
Arik Nemtsova7a6bdd2014-11-09 18:50:19 +02001318static inline int
1319drv_tdls_channel_switch(struct ieee80211_local *local,
1320 struct ieee80211_sub_if_data *sdata,
1321 struct ieee80211_sta *sta, u8 oper_class,
1322 struct cfg80211_chan_def *chandef,
1323 struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie)
1324{
1325 int ret;
1326
1327 might_sleep();
1328 if (!check_sdata_in_driver(sdata))
1329 return -EIO;
1330
1331 if (!local->ops->tdls_channel_switch)
1332 return -EOPNOTSUPP;
1333
1334 trace_drv_tdls_channel_switch(local, sdata, sta, oper_class, chandef);
1335 ret = local->ops->tdls_channel_switch(&local->hw, &sdata->vif, sta,
1336 oper_class, chandef, tmpl_skb,
1337 ch_sw_tm_ie);
1338 trace_drv_return_int(local, ret);
1339 return ret;
1340}
1341
1342static inline void
1343drv_tdls_cancel_channel_switch(struct ieee80211_local *local,
1344 struct ieee80211_sub_if_data *sdata,
1345 struct ieee80211_sta *sta)
1346{
1347 might_sleep();
1348 if (!check_sdata_in_driver(sdata))
1349 return;
1350
1351 if (!local->ops->tdls_cancel_channel_switch)
1352 return;
1353
1354 trace_drv_tdls_cancel_channel_switch(local, sdata, sta);
1355 local->ops->tdls_cancel_channel_switch(&local->hw, &sdata->vif, sta);
1356 trace_drv_return_void(local);
1357}
1358
Arik Nemtsov8a4d32f2014-11-09 18:50:20 +02001359static inline void
1360drv_tdls_recv_channel_switch(struct ieee80211_local *local,
1361 struct ieee80211_sub_if_data *sdata,
1362 struct ieee80211_tdls_ch_sw_params *params)
1363{
1364 trace_drv_tdls_recv_channel_switch(local, sdata, params);
1365 if (local->ops->tdls_recv_channel_switch)
1366 local->ops->tdls_recv_channel_switch(&local->hw, &sdata->vif,
1367 params);
1368 trace_drv_return_void(local);
1369}
1370
Felix Fietkauba8c3d62015-03-27 21:30:37 +01001371static inline void drv_wake_tx_queue(struct ieee80211_local *local,
1372 struct txq_info *txq)
1373{
1374 struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
1375
1376 if (!check_sdata_in_driver(sdata))
1377 return;
1378
1379 trace_drv_wake_tx_queue(local, sdata, txq);
1380 local->ops->wake_tx_queue(&local->hw, &txq->txq);
1381}
1382
Johannes Berg24487982009-04-23 18:52:52 +02001383#endif /* __MAC80211_DRIVER_OPS */