Blame view

net/mac80211/driver-ops.h 14.7 KB
244879813   Johannes Berg   mac80211: add dri...
1
2
3
4
5
  #ifndef __MAC80211_DRIVER_OPS
  #define __MAC80211_DRIVER_OPS
  
  #include <net/mac80211.h>
  #include "ieee80211_i.h"
0a2b8bb24   Johannes Berg   mac80211: driver ...
6
  #include "driver-trace.h"
244879813   Johannes Berg   mac80211: add dri...
7

7bb456837   Johannes Berg   mac80211: make tx...
8
  static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb)
244879813   Johannes Berg   mac80211: add dri...
9
  {
7bb456837   Johannes Berg   mac80211: make tx...
10
  	local->ops->tx(&local->hw, skb);
244879813   Johannes Berg   mac80211: add dri...
11
12
13
14
  }
  
  static inline int drv_start(struct ieee80211_local *local)
  {
ea77f12f2   Johannes Berg   mac80211: remove ...
15
  	int ret;
e1781ed33   Kalle Valo   mac80211: annotat...
16
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
17
  	trace_drv_start(local);
ea77f12f2   Johannes Berg   mac80211: remove ...
18
19
20
  	local->started = true;
  	smp_mb();
  	ret = local->ops->start(&local->hw);
4efc76bdb   Johannes Berg   mac80211: bracket...
21
  	trace_drv_return_int(local, ret);
0a2b8bb24   Johannes Berg   mac80211: driver ...
22
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
23
24
25
26
  }
  
  static inline void drv_stop(struct ieee80211_local *local)
  {
e1781ed33   Kalle Valo   mac80211: annotat...
27
  	might_sleep();
0a2b8bb24   Johannes Berg   mac80211: driver ...
28
  	trace_drv_stop(local);
4efc76bdb   Johannes Berg   mac80211: bracket...
29
30
  	local->ops->stop(&local->hw);
  	trace_drv_return_void(local);
ea77f12f2   Johannes Berg   mac80211: remove ...
31
32
33
34
35
36
37
38
  
  	/* sync away all work on the tasklet before clearing started */
  	tasklet_disable(&local->tasklet);
  	tasklet_enable(&local->tasklet);
  
  	barrier();
  
  	local->started = false;
244879813   Johannes Berg   mac80211: add dri...
39
  }
eecc48000   Johannes Berg   mac80211: add bas...
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  #ifdef CONFIG_PM
  static inline int drv_suspend(struct ieee80211_local *local,
  			      struct cfg80211_wowlan *wowlan)
  {
  	int ret;
  
  	might_sleep();
  
  	trace_drv_suspend(local);
  	ret = local->ops->suspend(&local->hw, wowlan);
  	trace_drv_return_int(local, ret);
  	return ret;
  }
  
  static inline int drv_resume(struct ieee80211_local *local)
  {
  	int ret;
  
  	might_sleep();
  
  	trace_drv_resume(local);
  	ret = local->ops->resume(&local->hw);
  	trace_drv_return_int(local, ret);
  	return ret;
  }
  #endif
244879813   Johannes Berg   mac80211: add dri...
66
  static inline int drv_add_interface(struct ieee80211_local *local,
1ed32e4fc   Johannes Berg   mac80211: remove ...
67
  				    struct ieee80211_vif *vif)
244879813   Johannes Berg   mac80211: add dri...
68
  {
e1781ed33   Kalle Valo   mac80211: annotat...
69
70
71
  	int ret;
  
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
72
  	trace_drv_add_interface(local, vif_to_sdata(vif));
e1781ed33   Kalle Valo   mac80211: annotat...
73
  	ret = local->ops->add_interface(&local->hw, vif);
4efc76bdb   Johannes Berg   mac80211: bracket...
74
  	trace_drv_return_int(local, ret);
0a2b8bb24   Johannes Berg   mac80211: driver ...
75
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
76
  }
34d4bc4d4   Johannes Berg   mac80211: support...
77
78
  static inline int drv_change_interface(struct ieee80211_local *local,
  				       struct ieee80211_sub_if_data *sdata,
2ca27bcff   Johannes Berg   mac80211: add p2p...
79
  				       enum nl80211_iftype type, bool p2p)
34d4bc4d4   Johannes Berg   mac80211: support...
80
81
82
83
  {
  	int ret;
  
  	might_sleep();
2ca27bcff   Johannes Berg   mac80211: add p2p...
84
85
  	trace_drv_change_interface(local, sdata, type, p2p);
  	ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
34d4bc4d4   Johannes Berg   mac80211: support...
86
87
88
  	trace_drv_return_int(local, ret);
  	return ret;
  }
244879813   Johannes Berg   mac80211: add dri...
89
  static inline void drv_remove_interface(struct ieee80211_local *local,
1ed32e4fc   Johannes Berg   mac80211: remove ...
90
  					struct ieee80211_vif *vif)
244879813   Johannes Berg   mac80211: add dri...
91
  {
e1781ed33   Kalle Valo   mac80211: annotat...
92
  	might_sleep();
1ed32e4fc   Johannes Berg   mac80211: remove ...
93
  	trace_drv_remove_interface(local, vif_to_sdata(vif));
4efc76bdb   Johannes Berg   mac80211: bracket...
94
95
  	local->ops->remove_interface(&local->hw, vif);
  	trace_drv_return_void(local);
244879813   Johannes Berg   mac80211: add dri...
96
97
98
99
  }
  
  static inline int drv_config(struct ieee80211_local *local, u32 changed)
  {
e1781ed33   Kalle Valo   mac80211: annotat...
100
101
102
  	int ret;
  
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
103
  	trace_drv_config(local, changed);
e1781ed33   Kalle Valo   mac80211: annotat...
104
  	ret = local->ops->config(&local->hw, changed);
4efc76bdb   Johannes Berg   mac80211: bracket...
105
  	trace_drv_return_int(local, ret);
0a2b8bb24   Johannes Berg   mac80211: driver ...
106
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
107
108
109
  }
  
  static inline void drv_bss_info_changed(struct ieee80211_local *local,
12375ef93   Johannes Berg   mac80211: trace i...
110
  					struct ieee80211_sub_if_data *sdata,
244879813   Johannes Berg   mac80211: add dri...
111
112
113
  					struct ieee80211_bss_conf *info,
  					u32 changed)
  {
e1781ed33   Kalle Valo   mac80211: annotat...
114
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
115
  	trace_drv_bss_info_changed(local, sdata, info, changed);
244879813   Johannes Berg   mac80211: add dri...
116
  	if (local->ops->bss_info_changed)
12375ef93   Johannes Berg   mac80211: trace i...
117
  		local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
4efc76bdb   Johannes Berg   mac80211: bracket...
118
  	trace_drv_return_void(local);
244879813   Johannes Berg   mac80211: add dri...
119
  }
3ac64beec   Johannes Berg   mac80211: allow c...
120
  static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
22bedad3c   Jiri Pirko   net: convert mult...
121
  					struct netdev_hw_addr_list *mc_list)
3ac64beec   Johannes Berg   mac80211: allow c...
122
123
  {
  	u64 ret = 0;
4efc76bdb   Johannes Berg   mac80211: bracket...
124
  	trace_drv_prepare_multicast(local, mc_list->count);
3ac64beec   Johannes Berg   mac80211: allow c...
125
  	if (local->ops->prepare_multicast)
22bedad3c   Jiri Pirko   net: convert mult...
126
  		ret = local->ops->prepare_multicast(&local->hw, mc_list);
3ac64beec   Johannes Berg   mac80211: allow c...
127

4efc76bdb   Johannes Berg   mac80211: bracket...
128
  	trace_drv_return_u64(local, ret);
3ac64beec   Johannes Berg   mac80211: allow c...
129
130
131
  
  	return ret;
  }
244879813   Johannes Berg   mac80211: add dri...
132
133
134
  static inline void drv_configure_filter(struct ieee80211_local *local,
  					unsigned int changed_flags,
  					unsigned int *total_flags,
3ac64beec   Johannes Berg   mac80211: allow c...
135
  					u64 multicast)
244879813   Johannes Berg   mac80211: add dri...
136
  {
3ac64beec   Johannes Berg   mac80211: allow c...
137
  	might_sleep();
0a2b8bb24   Johannes Berg   mac80211: driver ...
138
  	trace_drv_configure_filter(local, changed_flags, total_flags,
3ac64beec   Johannes Berg   mac80211: allow c...
139
  				   multicast);
4efc76bdb   Johannes Berg   mac80211: bracket...
140
141
142
  	local->ops->configure_filter(&local->hw, changed_flags, total_flags,
  				     multicast);
  	trace_drv_return_void(local);
244879813   Johannes Berg   mac80211: add dri...
143
144
145
146
147
  }
  
  static inline int drv_set_tim(struct ieee80211_local *local,
  			      struct ieee80211_sta *sta, bool set)
  {
0a2b8bb24   Johannes Berg   mac80211: driver ...
148
  	int ret = 0;
4efc76bdb   Johannes Berg   mac80211: bracket...
149
  	trace_drv_set_tim(local, sta, set);
244879813   Johannes Berg   mac80211: add dri...
150
  	if (local->ops->set_tim)
0a2b8bb24   Johannes Berg   mac80211: driver ...
151
  		ret = local->ops->set_tim(&local->hw, sta, set);
4efc76bdb   Johannes Berg   mac80211: bracket...
152
  	trace_drv_return_int(local, ret);
0a2b8bb24   Johannes Berg   mac80211: driver ...
153
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
154
155
156
  }
  
  static inline int drv_set_key(struct ieee80211_local *local,
12375ef93   Johannes Berg   mac80211: trace i...
157
158
  			      enum set_key_cmd cmd,
  			      struct ieee80211_sub_if_data *sdata,
244879813   Johannes Berg   mac80211: add dri...
159
160
161
  			      struct ieee80211_sta *sta,
  			      struct ieee80211_key_conf *key)
  {
e1781ed33   Kalle Valo   mac80211: annotat...
162
163
164
  	int ret;
  
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
165
  	trace_drv_set_key(local, cmd, sdata, sta, key);
e1781ed33   Kalle Valo   mac80211: annotat...
166
  	ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
4efc76bdb   Johannes Berg   mac80211: bracket...
167
  	trace_drv_return_int(local, ret);
0a2b8bb24   Johannes Berg   mac80211: driver ...
168
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
169
170
171
  }
  
  static inline void drv_update_tkip_key(struct ieee80211_local *local,
b3fbdcf49   Johannes Berg   mac80211: pass vi...
172
  				       struct ieee80211_sub_if_data *sdata,
244879813   Johannes Berg   mac80211: add dri...
173
  				       struct ieee80211_key_conf *conf,
b3fbdcf49   Johannes Berg   mac80211: pass vi...
174
  				       struct sta_info *sta, u32 iv32,
244879813   Johannes Berg   mac80211: add dri...
175
176
  				       u16 *phase1key)
  {
b3fbdcf49   Johannes Berg   mac80211: pass vi...
177
  	struct ieee80211_sta *ista = NULL;
b3fbdcf49   Johannes Berg   mac80211: pass vi...
178
179
  	if (sta)
  		ista = &sta->sta;
4efc76bdb   Johannes Berg   mac80211: bracket...
180
  	trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
244879813   Johannes Berg   mac80211: add dri...
181
  	if (local->ops->update_tkip_key)
b3fbdcf49   Johannes Berg   mac80211: pass vi...
182
183
  		local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
  					    ista, iv32, phase1key);
4efc76bdb   Johannes Berg   mac80211: bracket...
184
  	trace_drv_return_void(local);
244879813   Johannes Berg   mac80211: add dri...
185
186
187
  }
  
  static inline int drv_hw_scan(struct ieee80211_local *local,
a060bbfe4   Johannes Berg   mac80211: give vi...
188
  			      struct ieee80211_sub_if_data *sdata,
244879813   Johannes Berg   mac80211: add dri...
189
190
  			      struct cfg80211_scan_request *req)
  {
e1781ed33   Kalle Valo   mac80211: annotat...
191
192
193
  	int ret;
  
  	might_sleep();
79f460ca4   Luciano Coelho   mac80211: add sup...
194
  	trace_drv_hw_scan(local, sdata);
a060bbfe4   Johannes Berg   mac80211: give vi...
195
  	ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
4efc76bdb   Johannes Berg   mac80211: bracket...
196
  	trace_drv_return_int(local, ret);
0a2b8bb24   Johannes Berg   mac80211: driver ...
197
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
198
  }
79f460ca4   Luciano Coelho   mac80211: add sup...
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
  static inline int
  drv_sched_scan_start(struct ieee80211_local *local,
  		     struct ieee80211_sub_if_data *sdata,
  		     struct cfg80211_sched_scan_request *req,
  		     struct ieee80211_sched_scan_ies *ies)
  {
  	int ret;
  
  	might_sleep();
  
  	trace_drv_sched_scan_start(local, sdata);
  	ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
  					      req, ies);
  	trace_drv_return_int(local, ret);
  	return ret;
  }
  
  static inline void drv_sched_scan_stop(struct ieee80211_local *local,
  				       struct ieee80211_sub_if_data *sdata)
  {
  	might_sleep();
  
  	trace_drv_sched_scan_stop(local, sdata);
  	local->ops->sched_scan_stop(&local->hw, &sdata->vif);
  	trace_drv_return_void(local);
  }
244879813   Johannes Berg   mac80211: add dri...
225
226
  static inline void drv_sw_scan_start(struct ieee80211_local *local)
  {
e1781ed33   Kalle Valo   mac80211: annotat...
227
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
228
  	trace_drv_sw_scan_start(local);
244879813   Johannes Berg   mac80211: add dri...
229
230
  	if (local->ops->sw_scan_start)
  		local->ops->sw_scan_start(&local->hw);
4efc76bdb   Johannes Berg   mac80211: bracket...
231
  	trace_drv_return_void(local);
244879813   Johannes Berg   mac80211: add dri...
232
233
234
235
  }
  
  static inline void drv_sw_scan_complete(struct ieee80211_local *local)
  {
e1781ed33   Kalle Valo   mac80211: annotat...
236
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
237
  	trace_drv_sw_scan_complete(local);
244879813   Johannes Berg   mac80211: add dri...
238
239
  	if (local->ops->sw_scan_complete)
  		local->ops->sw_scan_complete(&local->hw);
4efc76bdb   Johannes Berg   mac80211: bracket...
240
  	trace_drv_return_void(local);
244879813   Johannes Berg   mac80211: add dri...
241
242
243
244
245
  }
  
  static inline int drv_get_stats(struct ieee80211_local *local,
  				struct ieee80211_low_level_stats *stats)
  {
0a2b8bb24   Johannes Berg   mac80211: driver ...
246
  	int ret = -EOPNOTSUPP;
e1781ed33   Kalle Valo   mac80211: annotat...
247
  	might_sleep();
0a2b8bb24   Johannes Berg   mac80211: driver ...
248
249
250
251
252
  	if (local->ops->get_stats)
  		ret = local->ops->get_stats(&local->hw, stats);
  	trace_drv_get_stats(local, stats, ret);
  
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
253
254
255
256
257
258
259
  }
  
  static inline void drv_get_tkip_seq(struct ieee80211_local *local,
  				    u8 hw_key_idx, u32 *iv32, u16 *iv16)
  {
  	if (local->ops->get_tkip_seq)
  		local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
0a2b8bb24   Johannes Berg   mac80211: driver ...
260
  	trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16);
244879813   Johannes Berg   mac80211: add dri...
261
  }
f23a47807   Arik Nemtsov   mac80211: support...
262
263
264
265
266
267
268
269
270
271
272
273
274
  static inline int drv_set_frag_threshold(struct ieee80211_local *local,
  					u32 value)
  {
  	int ret = 0;
  
  	might_sleep();
  
  	trace_drv_set_frag_threshold(local, value);
  	if (local->ops->set_frag_threshold)
  		ret = local->ops->set_frag_threshold(&local->hw, value);
  	trace_drv_return_int(local, ret);
  	return ret;
  }
244879813   Johannes Berg   mac80211: add dri...
275
276
277
  static inline int drv_set_rts_threshold(struct ieee80211_local *local,
  					u32 value)
  {
0a2b8bb24   Johannes Berg   mac80211: driver ...
278
  	int ret = 0;
e1781ed33   Kalle Valo   mac80211: annotat...
279
280
  
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
281
  	trace_drv_set_rts_threshold(local, value);
244879813   Johannes Berg   mac80211: add dri...
282
  	if (local->ops->set_rts_threshold)
0a2b8bb24   Johannes Berg   mac80211: driver ...
283
  		ret = local->ops->set_rts_threshold(&local->hw, value);
4efc76bdb   Johannes Berg   mac80211: bracket...
284
  	trace_drv_return_int(local, ret);
0a2b8bb24   Johannes Berg   mac80211: driver ...
285
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
286
  }
310bc676e   Lukáš Turek   mac80211: Add new...
287
288
289
290
291
  static inline int drv_set_coverage_class(struct ieee80211_local *local,
  					 u8 value)
  {
  	int ret = 0;
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
292
  	trace_drv_set_coverage_class(local, value);
310bc676e   Lukáš Turek   mac80211: Add new...
293
294
295
296
  	if (local->ops->set_coverage_class)
  		local->ops->set_coverage_class(&local->hw, value);
  	else
  		ret = -EOPNOTSUPP;
4efc76bdb   Johannes Berg   mac80211: bracket...
297
  	trace_drv_return_int(local, ret);
310bc676e   Lukáš Turek   mac80211: Add new...
298
299
  	return ret;
  }
244879813   Johannes Berg   mac80211: add dri...
300
  static inline void drv_sta_notify(struct ieee80211_local *local,
12375ef93   Johannes Berg   mac80211: trace i...
301
  				  struct ieee80211_sub_if_data *sdata,
244879813   Johannes Berg   mac80211: add dri...
302
303
304
  				  enum sta_notify_cmd cmd,
  				  struct ieee80211_sta *sta)
  {
4efc76bdb   Johannes Berg   mac80211: bracket...
305
  	trace_drv_sta_notify(local, sdata, cmd, sta);
244879813   Johannes Berg   mac80211: add dri...
306
  	if (local->ops->sta_notify)
12375ef93   Johannes Berg   mac80211: trace i...
307
  		local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
4efc76bdb   Johannes Berg   mac80211: bracket...
308
  	trace_drv_return_void(local);
244879813   Johannes Berg   mac80211: add dri...
309
  }
34e895075   Johannes Berg   mac80211: allow s...
310
311
312
313
314
315
316
  static inline int drv_sta_add(struct ieee80211_local *local,
  			      struct ieee80211_sub_if_data *sdata,
  			      struct ieee80211_sta *sta)
  {
  	int ret = 0;
  
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
317
  	trace_drv_sta_add(local, sdata, sta);
34e895075   Johannes Berg   mac80211: allow s...
318
319
  	if (local->ops->sta_add)
  		ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
34e895075   Johannes Berg   mac80211: allow s...
320

4efc76bdb   Johannes Berg   mac80211: bracket...
321
  	trace_drv_return_int(local, ret);
34e895075   Johannes Berg   mac80211: allow s...
322
323
324
325
326
327
328
329
330
  
  	return ret;
  }
  
  static inline void drv_sta_remove(struct ieee80211_local *local,
  				  struct ieee80211_sub_if_data *sdata,
  				  struct ieee80211_sta *sta)
  {
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
331
  	trace_drv_sta_remove(local, sdata, sta);
34e895075   Johannes Berg   mac80211: allow s...
332
333
  	if (local->ops->sta_remove)
  		local->ops->sta_remove(&local->hw, &sdata->vif, sta);
34e895075   Johannes Berg   mac80211: allow s...
334

4efc76bdb   Johannes Berg   mac80211: bracket...
335
  	trace_drv_return_void(local);
34e895075   Johannes Berg   mac80211: allow s...
336
  }
244879813   Johannes Berg   mac80211: add dri...
337
338
339
  static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue,
  			      const struct ieee80211_tx_queue_params *params)
  {
0a2b8bb24   Johannes Berg   mac80211: driver ...
340
  	int ret = -EOPNOTSUPP;
e1781ed33   Kalle Valo   mac80211: annotat...
341
342
  
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
343
  	trace_drv_conf_tx(local, queue, params);
244879813   Johannes Berg   mac80211: add dri...
344
  	if (local->ops->conf_tx)
0a2b8bb24   Johannes Berg   mac80211: driver ...
345
  		ret = local->ops->conf_tx(&local->hw, queue, params);
4efc76bdb   Johannes Berg   mac80211: bracket...
346
  	trace_drv_return_int(local, ret);
0a2b8bb24   Johannes Berg   mac80211: driver ...
347
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
348
  }
244879813   Johannes Berg   mac80211: add dri...
349
350
  static inline u64 drv_get_tsf(struct ieee80211_local *local)
  {
0a2b8bb24   Johannes Berg   mac80211: driver ...
351
  	u64 ret = -1ULL;
e1781ed33   Kalle Valo   mac80211: annotat...
352
353
  
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
354
  	trace_drv_get_tsf(local);
244879813   Johannes Berg   mac80211: add dri...
355
  	if (local->ops->get_tsf)
0a2b8bb24   Johannes Berg   mac80211: driver ...
356
  		ret = local->ops->get_tsf(&local->hw);
4efc76bdb   Johannes Berg   mac80211: bracket...
357
  	trace_drv_return_u64(local, ret);
0a2b8bb24   Johannes Berg   mac80211: driver ...
358
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
359
360
361
362
  }
  
  static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf)
  {
e1781ed33   Kalle Valo   mac80211: annotat...
363
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
364
  	trace_drv_set_tsf(local, tsf);
244879813   Johannes Berg   mac80211: add dri...
365
366
  	if (local->ops->set_tsf)
  		local->ops->set_tsf(&local->hw, tsf);
4efc76bdb   Johannes Berg   mac80211: bracket...
367
  	trace_drv_return_void(local);
244879813   Johannes Berg   mac80211: add dri...
368
369
370
371
  }
  
  static inline void drv_reset_tsf(struct ieee80211_local *local)
  {
e1781ed33   Kalle Valo   mac80211: annotat...
372
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
373
  	trace_drv_reset_tsf(local);
244879813   Johannes Berg   mac80211: add dri...
374
375
  	if (local->ops->reset_tsf)
  		local->ops->reset_tsf(&local->hw);
4efc76bdb   Johannes Berg   mac80211: bracket...
376
  	trace_drv_return_void(local);
244879813   Johannes Berg   mac80211: add dri...
377
378
379
380
  }
  
  static inline int drv_tx_last_beacon(struct ieee80211_local *local)
  {
91f44b029   Tim Harvey   mac80211 default ...
381
  	int ret = 0; /* default unsuported op for less congestion */
e1781ed33   Kalle Valo   mac80211: annotat...
382
383
  
  	might_sleep();
4efc76bdb   Johannes Berg   mac80211: bracket...
384
  	trace_drv_tx_last_beacon(local);
244879813   Johannes Berg   mac80211: add dri...
385
  	if (local->ops->tx_last_beacon)
0a2b8bb24   Johannes Berg   mac80211: driver ...
386
  		ret = local->ops->tx_last_beacon(&local->hw);
4efc76bdb   Johannes Berg   mac80211: bracket...
387
  	trace_drv_return_int(local, ret);
0a2b8bb24   Johannes Berg   mac80211: driver ...
388
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
389
390
391
  }
  
  static inline int drv_ampdu_action(struct ieee80211_local *local,
12375ef93   Johannes Berg   mac80211: trace i...
392
  				   struct ieee80211_sub_if_data *sdata,
244879813   Johannes Berg   mac80211: add dri...
393
394
  				   enum ieee80211_ampdu_mlme_action action,
  				   struct ieee80211_sta *sta, u16 tid,
0b01f030d   Johannes Berg   mac80211: track r...
395
  				   u16 *ssn, u8 buf_size)
244879813   Johannes Berg   mac80211: add dri...
396
  {
0a2b8bb24   Johannes Berg   mac80211: driver ...
397
  	int ret = -EOPNOTSUPP;
cfcdbde35   Johannes Berg   mac80211: change ...
398
399
  
  	might_sleep();
0b01f030d   Johannes Berg   mac80211: track r...
400
  	trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
4efc76bdb   Johannes Berg   mac80211: bracket...
401

244879813   Johannes Berg   mac80211: add dri...
402
  	if (local->ops->ampdu_action)
12375ef93   Johannes Berg   mac80211: trace i...
403
  		ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action,
0b01f030d   Johannes Berg   mac80211: track r...
404
  					       sta, tid, ssn, buf_size);
85ad181ea   Johannes Berg   mac80211: allow d...
405

4efc76bdb   Johannes Berg   mac80211: bracket...
406
  	trace_drv_return_int(local, ret);
0a2b8bb24   Johannes Berg   mac80211: driver ...
407
  	return ret;
244879813   Johannes Berg   mac80211: add dri...
408
  }
1f87f7d3a   Johannes Berg   cfg80211: add rfk...
409

1289723ef   Holger Schurig   mac80211: sample ...
410
411
412
413
  static inline int drv_get_survey(struct ieee80211_local *local, int idx,
  				struct survey_info *survey)
  {
  	int ret = -EOPNOTSUPP;
c466d4efb   John W. Linville   mac80211: add bas...
414
415
  
  	trace_drv_get_survey(local, idx, survey);
35dd0509b   Holger Schurig   mac80211: fix fun...
416
  	if (local->ops->get_survey)
1289723ef   Holger Schurig   mac80211: sample ...
417
  		ret = local->ops->get_survey(&local->hw, idx, survey);
c466d4efb   John W. Linville   mac80211: add bas...
418
419
  
  	trace_drv_return_int(local, ret);
1289723ef   Holger Schurig   mac80211: sample ...
420
421
  	return ret;
  }
1f87f7d3a   Johannes Berg   cfg80211: add rfk...
422
423
424
  
  static inline void drv_rfkill_poll(struct ieee80211_local *local)
  {
e1781ed33   Kalle Valo   mac80211: annotat...
425
  	might_sleep();
1f87f7d3a   Johannes Berg   cfg80211: add rfk...
426
427
428
  	if (local->ops->rfkill_poll)
  		local->ops->rfkill_poll(&local->hw);
  }
a80f7c0b0   Johannes Berg   mac80211: introdu...
429
430
431
  
  static inline void drv_flush(struct ieee80211_local *local, bool drop)
  {
e1781ed33   Kalle Valo   mac80211: annotat...
432
  	might_sleep();
a80f7c0b0   Johannes Berg   mac80211: introdu...
433
434
435
  	trace_drv_flush(local, drop);
  	if (local->ops->flush)
  		local->ops->flush(&local->hw, drop);
4efc76bdb   Johannes Berg   mac80211: bracket...
436
  	trace_drv_return_void(local);
a80f7c0b0   Johannes Berg   mac80211: introdu...
437
  }
5ce6e438d   Johannes Berg   mac80211: add off...
438
439
440
441
442
  
  static inline void drv_channel_switch(struct ieee80211_local *local,
  				     struct ieee80211_channel_switch *ch_switch)
  {
  	might_sleep();
5ce6e438d   Johannes Berg   mac80211: add off...
443
  	trace_drv_channel_switch(local, ch_switch);
4efc76bdb   Johannes Berg   mac80211: bracket...
444
445
  	local->ops->channel_switch(&local->hw, ch_switch);
  	trace_drv_return_void(local);
5ce6e438d   Johannes Berg   mac80211: add off...
446
  }
15d967532   Bruno Randolf   mac80211: Add ant...
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
  
  static inline int drv_set_antenna(struct ieee80211_local *local,
  				  u32 tx_ant, u32 rx_ant)
  {
  	int ret = -EOPNOTSUPP;
  	might_sleep();
  	if (local->ops->set_antenna)
  		ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
  	trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
  	return ret;
  }
  
  static inline int drv_get_antenna(struct ieee80211_local *local,
  				  u32 *tx_ant, u32 *rx_ant)
  {
  	int ret = -EOPNOTSUPP;
  	might_sleep();
  	if (local->ops->get_antenna)
  		ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
  	trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
  	return ret;
  }
21f835896   Johannes Berg   mac80211: impleme...
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
  static inline int drv_remain_on_channel(struct ieee80211_local *local,
  					struct ieee80211_channel *chan,
  					enum nl80211_channel_type chantype,
  					unsigned int duration)
  {
  	int ret;
  
  	might_sleep();
  
  	trace_drv_remain_on_channel(local, chan, chantype, duration);
  	ret = local->ops->remain_on_channel(&local->hw, chan, chantype,
  					    duration);
  	trace_drv_return_int(local, ret);
  
  	return ret;
  }
  
  static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
  {
  	int ret;
  
  	might_sleep();
  
  	trace_drv_cancel_remain_on_channel(local);
  	ret = local->ops->cancel_remain_on_channel(&local->hw);
  	trace_drv_return_int(local, ret);
  
  	return ret;
  }
5f16a4361   Johannes Berg   mac80211: support...
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
  static inline int drv_offchannel_tx(struct ieee80211_local *local,
  				    struct sk_buff *skb,
  				    struct ieee80211_channel *chan,
  				    enum nl80211_channel_type channel_type,
  				    unsigned int wait)
  {
  	int ret;
  
  	might_sleep();
  
  	trace_drv_offchannel_tx(local, skb, chan, channel_type, wait);
  	ret = local->ops->offchannel_tx(&local->hw, skb, chan,
  					channel_type, wait);
  	trace_drv_return_int(local, ret);
  
  	return ret;
  }
  
  static inline int drv_offchannel_tx_cancel_wait(struct ieee80211_local *local)
  {
  	int ret;
  
  	might_sleep();
  
  	trace_drv_offchannel_tx_cancel_wait(local);
  	ret = local->ops->offchannel_tx_cancel_wait(&local->hw);
  	trace_drv_return_int(local, ret);
  
  	return ret;
  }
38c091590   John W. Linville   mac80211: impleme...
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
  static inline int drv_set_ringparam(struct ieee80211_local *local,
  				    u32 tx, u32 rx)
  {
  	int ret = -ENOTSUPP;
  
  	might_sleep();
  
  	trace_drv_set_ringparam(local, tx, rx);
  	if (local->ops->set_ringparam)
  		ret = local->ops->set_ringparam(&local->hw, tx, rx);
  	trace_drv_return_int(local, ret);
  
  	return ret;
  }
  
  static inline void drv_get_ringparam(struct ieee80211_local *local,
  				     u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
  {
  	might_sleep();
  
  	trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
  	if (local->ops->get_ringparam)
  		local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
  	trace_drv_return_void(local);
  }
e8306f989   Vivek Natarajan   mac80211: Check f...
553
554
555
556
557
558
559
560
561
562
563
564
565
  static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
  {
  	bool ret = false;
  
  	might_sleep();
  
  	trace_drv_tx_frames_pending(local);
  	if (local->ops->tx_frames_pending)
  		ret = local->ops->tx_frames_pending(&local->hw);
  	trace_drv_return_bool(local, ret);
  
  	return ret;
  }
bdbfd6b58   Sujith Manoharan   mac80211: Add new...
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
  
  static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
  				       struct ieee80211_sub_if_data *sdata,
  				       const struct cfg80211_bitrate_mask *mask)
  {
  	int ret = -EOPNOTSUPP;
  
  	might_sleep();
  
  	trace_drv_set_bitrate_mask(local, sdata, mask);
  	if (local->ops->set_bitrate_mask)
  		ret = local->ops->set_bitrate_mask(&local->hw,
  						   &sdata->vif, mask);
  	trace_drv_return_int(local, ret);
  
  	return ret;
  }
244879813   Johannes Berg   mac80211: add dri...
583
  #endif /* __MAC80211_DRIVER_OPS */