1  /* SPDX-License-Identifier: GPL-2.0 */
2  /*
3  * Portions of this file
4  * Copyright(c) 2016 Intel Deutschland GmbH
5  * Copyright (C) 2018-2019, 2021-2024 Intel Corporation
6  */
7  
8  #ifndef __MAC80211_DRIVER_OPS
9  #define __MAC80211_DRIVER_OPS
10  
11  #include <net/mac80211.h>
12  #include "ieee80211_i.h"
13  #include "trace.h"
14  
15  #define check_sdata_in_driver(sdata)	({					\
16  	WARN_ONCE(!sdata->local->reconfig_failure &&				\
17  		  !(sdata->flags & IEEE80211_SDATA_IN_DRIVER),			\
18  		  "%s: Failed check-sdata-in-driver check, flags: 0x%x\n",	\
19  		  sdata->dev ? sdata->dev->name : sdata->name, sdata->flags);	\
20  	!!(sdata->flags & IEEE80211_SDATA_IN_DRIVER);				\
21  })
22  
23  static inline struct ieee80211_sub_if_data *
get_bss_sdata(struct ieee80211_sub_if_data * sdata)24  get_bss_sdata(struct ieee80211_sub_if_data *sdata)
25  {
26  	if (sdata && sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
27  		sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
28  				     u.ap);
29  
30  	return sdata;
31  }
32  
drv_tx(struct ieee80211_local * local,struct ieee80211_tx_control * control,struct sk_buff * skb)33  static inline void drv_tx(struct ieee80211_local *local,
34  			  struct ieee80211_tx_control *control,
35  			  struct sk_buff *skb)
36  {
37  	local->ops->tx(&local->hw, control, skb);
38  }
39  
drv_sync_rx_queues(struct ieee80211_local * local,struct sta_info * sta)40  static inline void drv_sync_rx_queues(struct ieee80211_local *local,
41  				      struct sta_info *sta)
42  {
43  	might_sleep();
44  	lockdep_assert_wiphy(local->hw.wiphy);
45  
46  	if (local->ops->sync_rx_queues) {
47  		trace_drv_sync_rx_queues(local, sta->sdata, &sta->sta);
48  		local->ops->sync_rx_queues(&local->hw);
49  		trace_drv_return_void(local);
50  	}
51  }
52  
drv_get_et_strings(struct ieee80211_sub_if_data * sdata,u32 sset,u8 * data)53  static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata,
54  				      u32 sset, u8 *data)
55  {
56  	struct ieee80211_local *local = sdata->local;
57  	if (local->ops->get_et_strings) {
58  		trace_drv_get_et_strings(local, sset);
59  		local->ops->get_et_strings(&local->hw, &sdata->vif, sset, data);
60  		trace_drv_return_void(local);
61  	}
62  }
63  
drv_get_et_stats(struct ieee80211_sub_if_data * sdata,struct ethtool_stats * stats,u64 * data)64  static inline void drv_get_et_stats(struct ieee80211_sub_if_data *sdata,
65  				    struct ethtool_stats *stats,
66  				    u64 *data)
67  {
68  	struct ieee80211_local *local = sdata->local;
69  	if (local->ops->get_et_stats) {
70  		trace_drv_get_et_stats(local);
71  		local->ops->get_et_stats(&local->hw, &sdata->vif, stats, data);
72  		trace_drv_return_void(local);
73  	}
74  }
75  
drv_get_et_sset_count(struct ieee80211_sub_if_data * sdata,int sset)76  static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data *sdata,
77  					int sset)
78  {
79  	struct ieee80211_local *local = sdata->local;
80  	int rv = 0;
81  	if (local->ops->get_et_sset_count) {
82  		trace_drv_get_et_sset_count(local, sset);
83  		rv = local->ops->get_et_sset_count(&local->hw, &sdata->vif,
84  						   sset);
85  		trace_drv_return_int(local, rv);
86  	}
87  	return rv;
88  }
89  
90  int drv_start(struct ieee80211_local *local);
91  void drv_stop(struct ieee80211_local *local, bool suspend);
92  
93  #ifdef CONFIG_PM
drv_suspend(struct ieee80211_local * local,struct cfg80211_wowlan * wowlan)94  static inline int drv_suspend(struct ieee80211_local *local,
95  			      struct cfg80211_wowlan *wowlan)
96  {
97  	int ret;
98  
99  	might_sleep();
100  	lockdep_assert_wiphy(local->hw.wiphy);
101  
102  	trace_drv_suspend(local);
103  	ret = local->ops->suspend(&local->hw, wowlan);
104  	trace_drv_return_int(local, ret);
105  	return ret;
106  }
107  
drv_resume(struct ieee80211_local * local)108  static inline int drv_resume(struct ieee80211_local *local)
109  {
110  	int ret;
111  
112  	might_sleep();
113  	lockdep_assert_wiphy(local->hw.wiphy);
114  
115  	trace_drv_resume(local);
116  	ret = local->ops->resume(&local->hw);
117  	trace_drv_return_int(local, ret);
118  	return ret;
119  }
120  
drv_set_wakeup(struct ieee80211_local * local,bool enabled)121  static inline void drv_set_wakeup(struct ieee80211_local *local,
122  				  bool enabled)
123  {
124  	might_sleep();
125  	lockdep_assert_wiphy(local->hw.wiphy);
126  
127  	if (!local->ops->set_wakeup)
128  		return;
129  
130  	trace_drv_set_wakeup(local, enabled);
131  	local->ops->set_wakeup(&local->hw, enabled);
132  	trace_drv_return_void(local);
133  }
134  #endif
135  
136  int drv_add_interface(struct ieee80211_local *local,
137  		      struct ieee80211_sub_if_data *sdata);
138  
139  int drv_change_interface(struct ieee80211_local *local,
140  			 struct ieee80211_sub_if_data *sdata,
141  			 enum nl80211_iftype type, bool p2p);
142  
143  void drv_remove_interface(struct ieee80211_local *local,
144  			  struct ieee80211_sub_if_data *sdata);
145  
drv_config(struct ieee80211_local * local,u32 changed)146  static inline int drv_config(struct ieee80211_local *local, u32 changed)
147  {
148  	int ret;
149  
150  	might_sleep();
151  	lockdep_assert_wiphy(local->hw.wiphy);
152  
153  	trace_drv_config(local, changed);
154  	ret = local->ops->config(&local->hw, changed);
155  	trace_drv_return_int(local, ret);
156  	return ret;
157  }
158  
drv_vif_cfg_changed(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,u64 changed)159  static inline void drv_vif_cfg_changed(struct ieee80211_local *local,
160  				       struct ieee80211_sub_if_data *sdata,
161  				       u64 changed)
162  {
163  	might_sleep();
164  	lockdep_assert_wiphy(local->hw.wiphy);
165  
166  	if (!check_sdata_in_driver(sdata))
167  		return;
168  
169  	trace_drv_vif_cfg_changed(local, sdata, changed);
170  	if (local->ops->vif_cfg_changed)
171  		local->ops->vif_cfg_changed(&local->hw, &sdata->vif, changed);
172  	else if (local->ops->bss_info_changed)
173  		local->ops->bss_info_changed(&local->hw, &sdata->vif,
174  					     &sdata->vif.bss_conf, changed);
175  	trace_drv_return_void(local);
176  }
177  
178  void drv_link_info_changed(struct ieee80211_local *local,
179  			   struct ieee80211_sub_if_data *sdata,
180  			   struct ieee80211_bss_conf *info,
181  			   int link_id, u64 changed);
182  
drv_prepare_multicast(struct ieee80211_local * local,struct netdev_hw_addr_list * mc_list)183  static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
184  					struct netdev_hw_addr_list *mc_list)
185  {
186  	u64 ret = 0;
187  
188  	trace_drv_prepare_multicast(local, mc_list->count);
189  
190  	if (local->ops->prepare_multicast)
191  		ret = local->ops->prepare_multicast(&local->hw, mc_list);
192  
193  	trace_drv_return_u64(local, ret);
194  
195  	return ret;
196  }
197  
drv_configure_filter(struct ieee80211_local * local,unsigned int changed_flags,unsigned int * total_flags,u64 multicast)198  static inline void drv_configure_filter(struct ieee80211_local *local,
199  					unsigned int changed_flags,
200  					unsigned int *total_flags,
201  					u64 multicast)
202  {
203  	might_sleep();
204  	lockdep_assert_wiphy(local->hw.wiphy);
205  
206  	trace_drv_configure_filter(local, changed_flags, total_flags,
207  				   multicast);
208  	local->ops->configure_filter(&local->hw, changed_flags, total_flags,
209  				     multicast);
210  	trace_drv_return_void(local);
211  }
212  
drv_config_iface_filter(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,unsigned int filter_flags,unsigned int changed_flags)213  static inline void drv_config_iface_filter(struct ieee80211_local *local,
214  					   struct ieee80211_sub_if_data *sdata,
215  					   unsigned int filter_flags,
216  					   unsigned int changed_flags)
217  {
218  	might_sleep();
219  	lockdep_assert_wiphy(local->hw.wiphy);
220  
221  	trace_drv_config_iface_filter(local, sdata, filter_flags,
222  				      changed_flags);
223  	if (local->ops->config_iface_filter)
224  		local->ops->config_iface_filter(&local->hw, &sdata->vif,
225  						filter_flags,
226  						changed_flags);
227  	trace_drv_return_void(local);
228  }
229  
drv_set_tim(struct ieee80211_local * local,struct ieee80211_sta * sta,bool set)230  static inline int drv_set_tim(struct ieee80211_local *local,
231  			      struct ieee80211_sta *sta, bool set)
232  {
233  	int ret = 0;
234  	trace_drv_set_tim(local, sta, set);
235  	if (local->ops->set_tim)
236  		ret = local->ops->set_tim(&local->hw, sta, set);
237  	trace_drv_return_int(local, ret);
238  	return ret;
239  }
240  
241  int drv_set_key(struct ieee80211_local *local,
242  		enum set_key_cmd cmd,
243  		struct ieee80211_sub_if_data *sdata,
244  		struct ieee80211_sta *sta,
245  		struct ieee80211_key_conf *key);
246  
drv_update_tkip_key(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_key_conf * conf,struct sta_info * sta,u32 iv32,u16 * phase1key)247  static inline void drv_update_tkip_key(struct ieee80211_local *local,
248  				       struct ieee80211_sub_if_data *sdata,
249  				       struct ieee80211_key_conf *conf,
250  				       struct sta_info *sta, u32 iv32,
251  				       u16 *phase1key)
252  {
253  	struct ieee80211_sta *ista = NULL;
254  
255  	if (sta)
256  		ista = &sta->sta;
257  
258  	sdata = get_bss_sdata(sdata);
259  	if (!check_sdata_in_driver(sdata))
260  		return;
261  
262  	trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
263  	if (local->ops->update_tkip_key)
264  		local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
265  					    ista, iv32, phase1key);
266  	trace_drv_return_void(local);
267  }
268  
drv_hw_scan(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_scan_request * req)269  static inline int drv_hw_scan(struct ieee80211_local *local,
270  			      struct ieee80211_sub_if_data *sdata,
271  			      struct ieee80211_scan_request *req)
272  {
273  	int ret;
274  
275  	might_sleep();
276  	lockdep_assert_wiphy(local->hw.wiphy);
277  
278  	if (!check_sdata_in_driver(sdata))
279  		return -EIO;
280  
281  	trace_drv_hw_scan(local, sdata);
282  	ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
283  	trace_drv_return_int(local, ret);
284  	return ret;
285  }
286  
drv_cancel_hw_scan(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)287  static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
288  				      struct ieee80211_sub_if_data *sdata)
289  {
290  	might_sleep();
291  	lockdep_assert_wiphy(local->hw.wiphy);
292  
293  	if (!check_sdata_in_driver(sdata))
294  		return;
295  
296  	trace_drv_cancel_hw_scan(local, sdata);
297  	local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
298  	trace_drv_return_void(local);
299  }
300  
301  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_scan_ies * ies)302  drv_sched_scan_start(struct ieee80211_local *local,
303  		     struct ieee80211_sub_if_data *sdata,
304  		     struct cfg80211_sched_scan_request *req,
305  		     struct ieee80211_scan_ies *ies)
306  {
307  	int ret;
308  
309  	might_sleep();
310  	lockdep_assert_wiphy(local->hw.wiphy);
311  
312  	if (!check_sdata_in_driver(sdata))
313  		return -EIO;
314  
315  	trace_drv_sched_scan_start(local, sdata);
316  	ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
317  					      req, ies);
318  	trace_drv_return_int(local, ret);
319  	return ret;
320  }
321  
drv_sched_scan_stop(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)322  static inline int drv_sched_scan_stop(struct ieee80211_local *local,
323  				      struct ieee80211_sub_if_data *sdata)
324  {
325  	int ret;
326  
327  	might_sleep();
328  	lockdep_assert_wiphy(local->hw.wiphy);
329  
330  	if (!check_sdata_in_driver(sdata))
331  		return -EIO;
332  
333  	trace_drv_sched_scan_stop(local, sdata);
334  	ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif);
335  	trace_drv_return_int(local, ret);
336  
337  	return ret;
338  }
339  
drv_sw_scan_start(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,const u8 * mac_addr)340  static inline void drv_sw_scan_start(struct ieee80211_local *local,
341  				     struct ieee80211_sub_if_data *sdata,
342  				     const u8 *mac_addr)
343  {
344  	might_sleep();
345  	lockdep_assert_wiphy(local->hw.wiphy);
346  
347  	trace_drv_sw_scan_start(local, sdata, mac_addr);
348  	if (local->ops->sw_scan_start)
349  		local->ops->sw_scan_start(&local->hw, &sdata->vif, mac_addr);
350  	trace_drv_return_void(local);
351  }
352  
drv_sw_scan_complete(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)353  static inline void drv_sw_scan_complete(struct ieee80211_local *local,
354  					struct ieee80211_sub_if_data *sdata)
355  {
356  	might_sleep();
357  	lockdep_assert_wiphy(local->hw.wiphy);
358  
359  	trace_drv_sw_scan_complete(local, sdata);
360  	if (local->ops->sw_scan_complete)
361  		local->ops->sw_scan_complete(&local->hw, &sdata->vif);
362  	trace_drv_return_void(local);
363  }
364  
drv_get_stats(struct ieee80211_local * local,struct ieee80211_low_level_stats * stats)365  static inline int drv_get_stats(struct ieee80211_local *local,
366  				struct ieee80211_low_level_stats *stats)
367  {
368  	int ret = -EOPNOTSUPP;
369  
370  	might_sleep();
371  	lockdep_assert_wiphy(local->hw.wiphy);
372  
373  	if (local->ops->get_stats)
374  		ret = local->ops->get_stats(&local->hw, stats);
375  	trace_drv_get_stats(local, stats, ret);
376  
377  	return ret;
378  }
379  
drv_get_key_seq(struct ieee80211_local * local,struct ieee80211_key * key,struct ieee80211_key_seq * seq)380  static inline void drv_get_key_seq(struct ieee80211_local *local,
381  				   struct ieee80211_key *key,
382  				   struct ieee80211_key_seq *seq)
383  {
384  	if (local->ops->get_key_seq)
385  		local->ops->get_key_seq(&local->hw, &key->conf, seq);
386  	trace_drv_get_key_seq(local, &key->conf);
387  }
388  
drv_set_frag_threshold(struct ieee80211_local * local,u32 value)389  static inline int drv_set_frag_threshold(struct ieee80211_local *local,
390  					u32 value)
391  {
392  	int ret = 0;
393  
394  	might_sleep();
395  	lockdep_assert_wiphy(local->hw.wiphy);
396  
397  	trace_drv_set_frag_threshold(local, value);
398  	if (local->ops->set_frag_threshold)
399  		ret = local->ops->set_frag_threshold(&local->hw, value);
400  	trace_drv_return_int(local, ret);
401  	return ret;
402  }
403  
drv_set_rts_threshold(struct ieee80211_local * local,u32 value)404  static inline int drv_set_rts_threshold(struct ieee80211_local *local,
405  					u32 value)
406  {
407  	int ret = 0;
408  
409  	might_sleep();
410  	lockdep_assert_wiphy(local->hw.wiphy);
411  
412  	trace_drv_set_rts_threshold(local, value);
413  	if (local->ops->set_rts_threshold)
414  		ret = local->ops->set_rts_threshold(&local->hw, value);
415  	trace_drv_return_int(local, ret);
416  	return ret;
417  }
418  
drv_set_coverage_class(struct ieee80211_local * local,s16 value)419  static inline int drv_set_coverage_class(struct ieee80211_local *local,
420  					 s16 value)
421  {
422  	int ret = 0;
423  	might_sleep();
424  	lockdep_assert_wiphy(local->hw.wiphy);
425  
426  	trace_drv_set_coverage_class(local, value);
427  	if (local->ops->set_coverage_class)
428  		local->ops->set_coverage_class(&local->hw, value);
429  	else
430  		ret = -EOPNOTSUPP;
431  
432  	trace_drv_return_int(local, ret);
433  	return ret;
434  }
435  
drv_sta_notify(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,enum sta_notify_cmd cmd,struct ieee80211_sta * sta)436  static inline void drv_sta_notify(struct ieee80211_local *local,
437  				  struct ieee80211_sub_if_data *sdata,
438  				  enum sta_notify_cmd cmd,
439  				  struct ieee80211_sta *sta)
440  {
441  	sdata = get_bss_sdata(sdata);
442  	if (!check_sdata_in_driver(sdata))
443  		return;
444  
445  	trace_drv_sta_notify(local, sdata, cmd, sta);
446  	if (local->ops->sta_notify)
447  		local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
448  	trace_drv_return_void(local);
449  }
450  
drv_sta_add(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta)451  static inline int drv_sta_add(struct ieee80211_local *local,
452  			      struct ieee80211_sub_if_data *sdata,
453  			      struct ieee80211_sta *sta)
454  {
455  	int ret = 0;
456  
457  	might_sleep();
458  	lockdep_assert_wiphy(local->hw.wiphy);
459  
460  	sdata = get_bss_sdata(sdata);
461  	if (!check_sdata_in_driver(sdata))
462  		return -EIO;
463  
464  	trace_drv_sta_add(local, sdata, sta);
465  	if (local->ops->sta_add)
466  		ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
467  
468  	trace_drv_return_int(local, ret);
469  
470  	return ret;
471  }
472  
drv_sta_remove(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta)473  static inline void drv_sta_remove(struct ieee80211_local *local,
474  				  struct ieee80211_sub_if_data *sdata,
475  				  struct ieee80211_sta *sta)
476  {
477  	might_sleep();
478  	lockdep_assert_wiphy(local->hw.wiphy);
479  
480  	sdata = get_bss_sdata(sdata);
481  	if (!check_sdata_in_driver(sdata))
482  		return;
483  
484  	trace_drv_sta_remove(local, sdata, sta);
485  	if (local->ops->sta_remove)
486  		local->ops->sta_remove(&local->hw, &sdata->vif, sta);
487  
488  	trace_drv_return_void(local);
489  }
490  
491  #ifdef CONFIG_MAC80211_DEBUGFS
drv_vif_add_debugfs(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)492  static inline void drv_vif_add_debugfs(struct ieee80211_local *local,
493  				       struct ieee80211_sub_if_data *sdata)
494  {
495  	might_sleep();
496  
497  	if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
498  	    WARN_ON(!sdata->vif.debugfs_dir))
499  		return;
500  
501  	sdata = get_bss_sdata(sdata);
502  	if (!check_sdata_in_driver(sdata))
503  		return;
504  
505  	if (local->ops->vif_add_debugfs)
506  		local->ops->vif_add_debugfs(&local->hw, &sdata->vif);
507  }
508  
drv_link_add_debugfs(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_bss_conf * link_conf,struct dentry * dir)509  static inline void drv_link_add_debugfs(struct ieee80211_local *local,
510  					struct ieee80211_sub_if_data *sdata,
511  					struct ieee80211_bss_conf *link_conf,
512  					struct dentry *dir)
513  {
514  	might_sleep();
515  	lockdep_assert_wiphy(local->hw.wiphy);
516  
517  	sdata = get_bss_sdata(sdata);
518  	if (!check_sdata_in_driver(sdata))
519  		return;
520  
521  	if (local->ops->link_add_debugfs)
522  		local->ops->link_add_debugfs(&local->hw, &sdata->vif,
523  					     link_conf, dir);
524  }
525  
drv_sta_add_debugfs(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,struct dentry * dir)526  static inline void drv_sta_add_debugfs(struct ieee80211_local *local,
527  				       struct ieee80211_sub_if_data *sdata,
528  				       struct ieee80211_sta *sta,
529  				       struct dentry *dir)
530  {
531  	might_sleep();
532  	lockdep_assert_wiphy(local->hw.wiphy);
533  
534  	sdata = get_bss_sdata(sdata);
535  	if (!check_sdata_in_driver(sdata))
536  		return;
537  
538  	if (local->ops->sta_add_debugfs)
539  		local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
540  					    sta, dir);
541  }
542  
drv_link_sta_add_debugfs(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_link_sta * link_sta,struct dentry * dir)543  static inline void drv_link_sta_add_debugfs(struct ieee80211_local *local,
544  					    struct ieee80211_sub_if_data *sdata,
545  					    struct ieee80211_link_sta *link_sta,
546  					    struct dentry *dir)
547  {
548  	might_sleep();
549  	lockdep_assert_wiphy(local->hw.wiphy);
550  
551  	sdata = get_bss_sdata(sdata);
552  	if (!check_sdata_in_driver(sdata))
553  		return;
554  
555  	if (local->ops->link_sta_add_debugfs)
556  		local->ops->link_sta_add_debugfs(&local->hw, &sdata->vif,
557  						 link_sta, dir);
558  }
559  #else
drv_vif_add_debugfs(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)560  static inline void drv_vif_add_debugfs(struct ieee80211_local *local,
561  				       struct ieee80211_sub_if_data *sdata)
562  {
563  	might_sleep();
564  }
565  #endif
566  
drv_sta_pre_rcu_remove(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct sta_info * sta)567  static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local,
568  					  struct ieee80211_sub_if_data *sdata,
569  					  struct sta_info *sta)
570  {
571  	might_sleep();
572  	lockdep_assert_wiphy(local->hw.wiphy);
573  
574  	sdata = get_bss_sdata(sdata);
575  	if (!check_sdata_in_driver(sdata))
576  		return;
577  
578  	trace_drv_sta_pre_rcu_remove(local, sdata, &sta->sta);
579  	if (local->ops->sta_pre_rcu_remove)
580  		local->ops->sta_pre_rcu_remove(&local->hw, &sdata->vif,
581  					       &sta->sta);
582  	trace_drv_return_void(local);
583  }
584  
585  __must_check
586  int drv_sta_state(struct ieee80211_local *local,
587  		  struct ieee80211_sub_if_data *sdata,
588  		  struct sta_info *sta,
589  		  enum ieee80211_sta_state old_state,
590  		  enum ieee80211_sta_state new_state);
591  
592  __must_check
593  int drv_sta_set_txpwr(struct ieee80211_local *local,
594  		      struct ieee80211_sub_if_data *sdata,
595  		      struct sta_info *sta);
596  
597  void drv_sta_rc_update(struct ieee80211_local *local,
598  		       struct ieee80211_sub_if_data *sdata,
599  		       struct ieee80211_sta *sta, u32 changed);
600  
drv_sta_rate_tbl_update(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta)601  static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local,
602  					   struct ieee80211_sub_if_data *sdata,
603  					   struct ieee80211_sta *sta)
604  {
605  	sdata = get_bss_sdata(sdata);
606  	if (!check_sdata_in_driver(sdata))
607  		return;
608  
609  	trace_drv_sta_rate_tbl_update(local, sdata, sta);
610  	if (local->ops->sta_rate_tbl_update)
611  		local->ops->sta_rate_tbl_update(&local->hw, &sdata->vif, sta);
612  
613  	trace_drv_return_void(local);
614  }
615  
drv_sta_statistics(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,struct station_info * sinfo)616  static inline void drv_sta_statistics(struct ieee80211_local *local,
617  				      struct ieee80211_sub_if_data *sdata,
618  				      struct ieee80211_sta *sta,
619  				      struct station_info *sinfo)
620  {
621  	might_sleep();
622  	lockdep_assert_wiphy(local->hw.wiphy);
623  
624  	sdata = get_bss_sdata(sdata);
625  	if (!check_sdata_in_driver(sdata))
626  		return;
627  
628  	trace_drv_sta_statistics(local, sdata, sta);
629  	if (local->ops->sta_statistics)
630  		local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo);
631  	trace_drv_return_void(local);
632  }
633  
634  int drv_conf_tx(struct ieee80211_local *local,
635  		struct ieee80211_link_data *link, u16 ac,
636  		const struct ieee80211_tx_queue_params *params);
637  
638  u64 drv_get_tsf(struct ieee80211_local *local,
639  		struct ieee80211_sub_if_data *sdata);
640  void drv_set_tsf(struct ieee80211_local *local,
641  		 struct ieee80211_sub_if_data *sdata,
642  		 u64 tsf);
643  void drv_offset_tsf(struct ieee80211_local *local,
644  		    struct ieee80211_sub_if_data *sdata,
645  		    s64 offset);
646  void drv_reset_tsf(struct ieee80211_local *local,
647  		   struct ieee80211_sub_if_data *sdata);
648  
drv_tx_last_beacon(struct ieee80211_local * local)649  static inline int drv_tx_last_beacon(struct ieee80211_local *local)
650  {
651  	int ret = 0; /* default unsupported op for less congestion */
652  
653  	might_sleep();
654  	lockdep_assert_wiphy(local->hw.wiphy);
655  
656  	trace_drv_tx_last_beacon(local);
657  	if (local->ops->tx_last_beacon)
658  		ret = local->ops->tx_last_beacon(&local->hw);
659  	trace_drv_return_int(local, ret);
660  	return ret;
661  }
662  
663  int drv_ampdu_action(struct ieee80211_local *local,
664  		     struct ieee80211_sub_if_data *sdata,
665  		     struct ieee80211_ampdu_params *params);
666  
drv_get_survey(struct ieee80211_local * local,int idx,struct survey_info * survey)667  static inline int drv_get_survey(struct ieee80211_local *local, int idx,
668  				struct survey_info *survey)
669  {
670  	int ret = -EOPNOTSUPP;
671  
672  	might_sleep();
673  	lockdep_assert_wiphy(local->hw.wiphy);
674  
675  	trace_drv_get_survey(local, idx, survey);
676  
677  	if (local->ops->get_survey)
678  		ret = local->ops->get_survey(&local->hw, idx, survey);
679  
680  	trace_drv_return_int(local, ret);
681  
682  	return ret;
683  }
684  
drv_rfkill_poll(struct ieee80211_local * local)685  static inline void drv_rfkill_poll(struct ieee80211_local *local)
686  {
687  	might_sleep();
688  	lockdep_assert_wiphy(local->hw.wiphy);
689  
690  	if (local->ops->rfkill_poll)
691  		local->ops->rfkill_poll(&local->hw);
692  }
693  
drv_flush(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,u32 queues,bool drop)694  static inline void drv_flush(struct ieee80211_local *local,
695  			     struct ieee80211_sub_if_data *sdata,
696  			     u32 queues, bool drop)
697  {
698  	struct ieee80211_vif *vif;
699  
700  	might_sleep();
701  	lockdep_assert_wiphy(local->hw.wiphy);
702  
703  	sdata = get_bss_sdata(sdata);
704  	vif = sdata ? &sdata->vif : NULL;
705  
706  	if (sdata && !check_sdata_in_driver(sdata))
707  		return;
708  
709  	trace_drv_flush(local, queues, drop);
710  	if (local->ops->flush)
711  		local->ops->flush(&local->hw, vif, queues, drop);
712  	trace_drv_return_void(local);
713  }
714  
drv_flush_sta(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct sta_info * sta)715  static inline void drv_flush_sta(struct ieee80211_local *local,
716  				 struct ieee80211_sub_if_data *sdata,
717  				 struct sta_info *sta)
718  {
719  	might_sleep();
720  	lockdep_assert_wiphy(local->hw.wiphy);
721  
722  	sdata = get_bss_sdata(sdata);
723  
724  	if (sdata && !check_sdata_in_driver(sdata))
725  		return;
726  
727  	trace_drv_flush_sta(local, sdata, &sta->sta);
728  	if (local->ops->flush_sta)
729  		local->ops->flush_sta(&local->hw, &sdata->vif, &sta->sta);
730  	trace_drv_return_void(local);
731  }
732  
drv_channel_switch(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_channel_switch * ch_switch)733  static inline void drv_channel_switch(struct ieee80211_local *local,
734  				      struct ieee80211_sub_if_data *sdata,
735  				      struct ieee80211_channel_switch *ch_switch)
736  {
737  	might_sleep();
738  	lockdep_assert_wiphy(local->hw.wiphy);
739  
740  	trace_drv_channel_switch(local, sdata, ch_switch);
741  	local->ops->channel_switch(&local->hw, &sdata->vif, ch_switch);
742  	trace_drv_return_void(local);
743  }
744  
745  
drv_set_antenna(struct ieee80211_local * local,u32 tx_ant,u32 rx_ant)746  static inline int drv_set_antenna(struct ieee80211_local *local,
747  				  u32 tx_ant, u32 rx_ant)
748  {
749  	int ret = -EOPNOTSUPP;
750  	might_sleep();
751  	lockdep_assert_wiphy(local->hw.wiphy);
752  	if (local->ops->set_antenna)
753  		ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
754  	trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
755  	return ret;
756  }
757  
drv_get_antenna(struct ieee80211_local * local,u32 * tx_ant,u32 * rx_ant)758  static inline int drv_get_antenna(struct ieee80211_local *local,
759  				  u32 *tx_ant, u32 *rx_ant)
760  {
761  	int ret = -EOPNOTSUPP;
762  	might_sleep();
763  	lockdep_assert_wiphy(local->hw.wiphy);
764  	if (local->ops->get_antenna)
765  		ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
766  	trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
767  	return ret;
768  }
769  
drv_remain_on_channel(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_channel * chan,unsigned int duration,enum ieee80211_roc_type type)770  static inline int drv_remain_on_channel(struct ieee80211_local *local,
771  					struct ieee80211_sub_if_data *sdata,
772  					struct ieee80211_channel *chan,
773  					unsigned int duration,
774  					enum ieee80211_roc_type type)
775  {
776  	int ret;
777  
778  	might_sleep();
779  	lockdep_assert_wiphy(local->hw.wiphy);
780  
781  	trace_drv_remain_on_channel(local, sdata, chan, duration, type);
782  	ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
783  					    chan, duration, type);
784  	trace_drv_return_int(local, ret);
785  
786  	return ret;
787  }
788  
789  static inline int
drv_cancel_remain_on_channel(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)790  drv_cancel_remain_on_channel(struct ieee80211_local *local,
791  			     struct ieee80211_sub_if_data *sdata)
792  {
793  	int ret;
794  
795  	might_sleep();
796  	lockdep_assert_wiphy(local->hw.wiphy);
797  
798  	trace_drv_cancel_remain_on_channel(local, sdata);
799  	ret = local->ops->cancel_remain_on_channel(&local->hw, &sdata->vif);
800  	trace_drv_return_int(local, ret);
801  
802  	return ret;
803  }
804  
drv_set_ringparam(struct ieee80211_local * local,u32 tx,u32 rx)805  static inline int drv_set_ringparam(struct ieee80211_local *local,
806  				    u32 tx, u32 rx)
807  {
808  	int ret = -EOPNOTSUPP;
809  
810  	might_sleep();
811  	lockdep_assert_wiphy(local->hw.wiphy);
812  
813  	trace_drv_set_ringparam(local, tx, rx);
814  	if (local->ops->set_ringparam)
815  		ret = local->ops->set_ringparam(&local->hw, tx, rx);
816  	trace_drv_return_int(local, ret);
817  
818  	return ret;
819  }
820  
drv_get_ringparam(struct ieee80211_local * local,u32 * tx,u32 * tx_max,u32 * rx,u32 * rx_max)821  static inline void drv_get_ringparam(struct ieee80211_local *local,
822  				     u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
823  {
824  	might_sleep();
825  	lockdep_assert_wiphy(local->hw.wiphy);
826  
827  	trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
828  	if (local->ops->get_ringparam)
829  		local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
830  	trace_drv_return_void(local);
831  }
832  
drv_tx_frames_pending(struct ieee80211_local * local)833  static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
834  {
835  	bool ret = false;
836  
837  	might_sleep();
838  	lockdep_assert_wiphy(local->hw.wiphy);
839  
840  	trace_drv_tx_frames_pending(local);
841  	if (local->ops->tx_frames_pending)
842  		ret = local->ops->tx_frames_pending(&local->hw);
843  	trace_drv_return_bool(local, ret);
844  
845  	return ret;
846  }
847  
drv_set_bitrate_mask(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,const struct cfg80211_bitrate_mask * mask)848  static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
849  				       struct ieee80211_sub_if_data *sdata,
850  				       const struct cfg80211_bitrate_mask *mask)
851  {
852  	int ret = -EOPNOTSUPP;
853  
854  	might_sleep();
855  	lockdep_assert_wiphy(local->hw.wiphy);
856  
857  	if (!check_sdata_in_driver(sdata))
858  		return -EIO;
859  
860  	trace_drv_set_bitrate_mask(local, sdata, mask);
861  	if (local->ops->set_bitrate_mask)
862  		ret = local->ops->set_bitrate_mask(&local->hw,
863  						   &sdata->vif, mask);
864  	trace_drv_return_int(local, ret);
865  
866  	return ret;
867  }
868  
drv_set_rekey_data(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct cfg80211_gtk_rekey_data * data)869  static inline void drv_set_rekey_data(struct ieee80211_local *local,
870  				      struct ieee80211_sub_if_data *sdata,
871  				      struct cfg80211_gtk_rekey_data *data)
872  {
873  	might_sleep();
874  	lockdep_assert_wiphy(local->hw.wiphy);
875  
876  	if (!check_sdata_in_driver(sdata))
877  		return;
878  
879  	trace_drv_set_rekey_data(local, sdata, data);
880  	if (local->ops->set_rekey_data)
881  		local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
882  	trace_drv_return_void(local);
883  }
884  
drv_event_callback(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,const struct ieee80211_event * event)885  static inline void drv_event_callback(struct ieee80211_local *local,
886  				      struct ieee80211_sub_if_data *sdata,
887  				      const struct ieee80211_event *event)
888  {
889  	trace_drv_event_callback(local, sdata, event);
890  	if (local->ops->event_callback)
891  		local->ops->event_callback(&local->hw, &sdata->vif, event);
892  	trace_drv_return_void(local);
893  }
894  
895  static inline void
drv_release_buffered_frames(struct ieee80211_local * local,struct sta_info * sta,u16 tids,int num_frames,enum ieee80211_frame_release_type reason,bool more_data)896  drv_release_buffered_frames(struct ieee80211_local *local,
897  			    struct sta_info *sta, u16 tids, int num_frames,
898  			    enum ieee80211_frame_release_type reason,
899  			    bool more_data)
900  {
901  	trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
902  					  reason, more_data);
903  	if (local->ops->release_buffered_frames)
904  		local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
905  						    num_frames, reason,
906  						    more_data);
907  	trace_drv_return_void(local);
908  }
909  
910  static inline void
drv_allow_buffered_frames(struct ieee80211_local * local,struct sta_info * sta,u16 tids,int num_frames,enum ieee80211_frame_release_type reason,bool more_data)911  drv_allow_buffered_frames(struct ieee80211_local *local,
912  			  struct sta_info *sta, u16 tids, int num_frames,
913  			  enum ieee80211_frame_release_type reason,
914  			  bool more_data)
915  {
916  	trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
917  					reason, more_data);
918  	if (local->ops->allow_buffered_frames)
919  		local->ops->allow_buffered_frames(&local->hw, &sta->sta,
920  						  tids, num_frames, reason,
921  						  more_data);
922  	trace_drv_return_void(local);
923  }
924  
drv_mgd_prepare_tx(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_prep_tx_info * info)925  static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
926  				      struct ieee80211_sub_if_data *sdata,
927  				      struct ieee80211_prep_tx_info *info)
928  {
929  	might_sleep();
930  	lockdep_assert_wiphy(local->hw.wiphy);
931  
932  	if (!check_sdata_in_driver(sdata))
933  		return;
934  	WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
935  
936  	info->link_id = info->link_id < 0 ? 0 : info->link_id;
937  	trace_drv_mgd_prepare_tx(local, sdata, info->duration,
938  				 info->subtype, info->success);
939  	if (local->ops->mgd_prepare_tx)
940  		local->ops->mgd_prepare_tx(&local->hw, &sdata->vif, info);
941  	trace_drv_return_void(local);
942  }
943  
drv_mgd_complete_tx(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_prep_tx_info * info)944  static inline void drv_mgd_complete_tx(struct ieee80211_local *local,
945  				       struct ieee80211_sub_if_data *sdata,
946  				       struct ieee80211_prep_tx_info *info)
947  {
948  	might_sleep();
949  	lockdep_assert_wiphy(local->hw.wiphy);
950  
951  	if (!check_sdata_in_driver(sdata))
952  		return;
953  	WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
954  
955  	trace_drv_mgd_complete_tx(local, sdata, info->duration,
956  				  info->subtype, info->success);
957  	if (local->ops->mgd_complete_tx)
958  		local->ops->mgd_complete_tx(&local->hw, &sdata->vif, info);
959  	trace_drv_return_void(local);
960  }
961  
962  static inline void
drv_mgd_protect_tdls_discover(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,int link_id)963  drv_mgd_protect_tdls_discover(struct ieee80211_local *local,
964  			      struct ieee80211_sub_if_data *sdata,
965  			      int link_id)
966  {
967  	might_sleep();
968  	lockdep_assert_wiphy(local->hw.wiphy);
969  
970  	if (!check_sdata_in_driver(sdata))
971  		return;
972  	WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
973  
974  	link_id = link_id > 0 ? link_id : 0;
975  
976  	trace_drv_mgd_protect_tdls_discover(local, sdata);
977  	if (local->ops->mgd_protect_tdls_discover)
978  		local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif,
979  						      link_id);
980  	trace_drv_return_void(local);
981  }
982  
drv_add_chanctx(struct ieee80211_local * local,struct ieee80211_chanctx * ctx)983  static inline int drv_add_chanctx(struct ieee80211_local *local,
984  				  struct ieee80211_chanctx *ctx)
985  {
986  	int ret = -EOPNOTSUPP;
987  
988  	might_sleep();
989  	lockdep_assert_wiphy(local->hw.wiphy);
990  
991  	trace_drv_add_chanctx(local, ctx);
992  	if (local->ops->add_chanctx)
993  		ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
994  	trace_drv_return_int(local, ret);
995  	if (!ret)
996  		ctx->driver_present = true;
997  
998  	return ret;
999  }
1000  
drv_remove_chanctx(struct ieee80211_local * local,struct ieee80211_chanctx * ctx)1001  static inline void drv_remove_chanctx(struct ieee80211_local *local,
1002  				      struct ieee80211_chanctx *ctx)
1003  {
1004  	might_sleep();
1005  	lockdep_assert_wiphy(local->hw.wiphy);
1006  
1007  	if (WARN_ON(!ctx->driver_present))
1008  		return;
1009  
1010  	trace_drv_remove_chanctx(local, ctx);
1011  	if (local->ops->remove_chanctx)
1012  		local->ops->remove_chanctx(&local->hw, &ctx->conf);
1013  	trace_drv_return_void(local);
1014  	ctx->driver_present = false;
1015  }
1016  
drv_change_chanctx(struct ieee80211_local * local,struct ieee80211_chanctx * ctx,u32 changed)1017  static inline void drv_change_chanctx(struct ieee80211_local *local,
1018  				      struct ieee80211_chanctx *ctx,
1019  				      u32 changed)
1020  {
1021  	might_sleep();
1022  	lockdep_assert_wiphy(local->hw.wiphy);
1023  
1024  	trace_drv_change_chanctx(local, ctx, changed);
1025  	if (local->ops->change_chanctx) {
1026  		WARN_ON_ONCE(!ctx->driver_present);
1027  		local->ops->change_chanctx(&local->hw, &ctx->conf, changed);
1028  	}
1029  	trace_drv_return_void(local);
1030  }
1031  
1032  int drv_assign_vif_chanctx(struct ieee80211_local *local,
1033  			   struct ieee80211_sub_if_data *sdata,
1034  			   struct ieee80211_bss_conf *link_conf,
1035  			   struct ieee80211_chanctx *ctx);
1036  void drv_unassign_vif_chanctx(struct ieee80211_local *local,
1037  			      struct ieee80211_sub_if_data *sdata,
1038  			      struct ieee80211_bss_conf *link_conf,
1039  			      struct ieee80211_chanctx *ctx);
1040  int drv_switch_vif_chanctx(struct ieee80211_local *local,
1041  			   struct ieee80211_vif_chanctx_switch *vifs,
1042  			   int n_vifs, enum ieee80211_chanctx_switch_mode mode);
1043  
drv_start_ap(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_bss_conf * link_conf)1044  static inline int drv_start_ap(struct ieee80211_local *local,
1045  			       struct ieee80211_sub_if_data *sdata,
1046  			       struct ieee80211_bss_conf *link_conf)
1047  {
1048  	int ret = 0;
1049  
1050  	might_sleep();
1051  	lockdep_assert_wiphy(local->hw.wiphy);
1052  
1053  	if (!check_sdata_in_driver(sdata))
1054  		return -EIO;
1055  
1056  	trace_drv_start_ap(local, sdata, link_conf);
1057  	if (local->ops->start_ap)
1058  		ret = local->ops->start_ap(&local->hw, &sdata->vif, link_conf);
1059  	trace_drv_return_int(local, ret);
1060  	return ret;
1061  }
1062  
drv_stop_ap(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_bss_conf * link_conf)1063  static inline void drv_stop_ap(struct ieee80211_local *local,
1064  			       struct ieee80211_sub_if_data *sdata,
1065  			       struct ieee80211_bss_conf *link_conf)
1066  {
1067  	might_sleep();
1068  	lockdep_assert_wiphy(local->hw.wiphy);
1069  
1070  	if (!check_sdata_in_driver(sdata))
1071  		return;
1072  
1073  	trace_drv_stop_ap(local, sdata, link_conf);
1074  	if (local->ops->stop_ap)
1075  		local->ops->stop_ap(&local->hw, &sdata->vif, link_conf);
1076  	trace_drv_return_void(local);
1077  }
1078  
1079  static inline void
drv_reconfig_complete(struct ieee80211_local * local,enum ieee80211_reconfig_type reconfig_type)1080  drv_reconfig_complete(struct ieee80211_local *local,
1081  		      enum ieee80211_reconfig_type reconfig_type)
1082  {
1083  	might_sleep();
1084  	lockdep_assert_wiphy(local->hw.wiphy);
1085  
1086  	trace_drv_reconfig_complete(local, reconfig_type);
1087  	if (local->ops->reconfig_complete)
1088  		local->ops->reconfig_complete(&local->hw, reconfig_type);
1089  	trace_drv_return_void(local);
1090  }
1091  
1092  static inline void
drv_set_default_unicast_key(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,int key_idx)1093  drv_set_default_unicast_key(struct ieee80211_local *local,
1094  			    struct ieee80211_sub_if_data *sdata,
1095  			    int key_idx)
1096  {
1097  	might_sleep();
1098  	lockdep_assert_wiphy(local->hw.wiphy);
1099  
1100  	if (!check_sdata_in_driver(sdata))
1101  		return;
1102  
1103  	WARN_ON_ONCE(key_idx < -1 || key_idx > 3);
1104  
1105  	trace_drv_set_default_unicast_key(local, sdata, key_idx);
1106  	if (local->ops->set_default_unicast_key)
1107  		local->ops->set_default_unicast_key(&local->hw, &sdata->vif,
1108  						    key_idx);
1109  	trace_drv_return_void(local);
1110  }
1111  
1112  #if IS_ENABLED(CONFIG_IPV6)
drv_ipv6_addr_change(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct inet6_dev * idev)1113  static inline void drv_ipv6_addr_change(struct ieee80211_local *local,
1114  					struct ieee80211_sub_if_data *sdata,
1115  					struct inet6_dev *idev)
1116  {
1117  	trace_drv_ipv6_addr_change(local, sdata);
1118  	if (local->ops->ipv6_addr_change)
1119  		local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev);
1120  	trace_drv_return_void(local);
1121  }
1122  #endif
1123  
1124  static inline void
drv_channel_switch_beacon(struct ieee80211_sub_if_data * sdata,struct cfg80211_chan_def * chandef)1125  drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata,
1126  			  struct cfg80211_chan_def *chandef)
1127  {
1128  	struct ieee80211_local *local = sdata->local;
1129  
1130  	might_sleep();
1131  	lockdep_assert_wiphy(local->hw.wiphy);
1132  
1133  	if (local->ops->channel_switch_beacon) {
1134  		trace_drv_channel_switch_beacon(local, sdata, chandef);
1135  		local->ops->channel_switch_beacon(&local->hw, &sdata->vif,
1136  						  chandef);
1137  	}
1138  }
1139  
1140  static inline int
drv_pre_channel_switch(struct ieee80211_sub_if_data * sdata,struct ieee80211_channel_switch * ch_switch)1141  drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata,
1142  		       struct ieee80211_channel_switch *ch_switch)
1143  {
1144  	struct ieee80211_local *local = sdata->local;
1145  	int ret = 0;
1146  
1147  	might_sleep();
1148  	lockdep_assert_wiphy(local->hw.wiphy);
1149  
1150  	if (!check_sdata_in_driver(sdata))
1151  		return -EIO;
1152  
1153  	if (!ieee80211_vif_link_active(&sdata->vif, ch_switch->link_id))
1154  		return 0;
1155  
1156  	trace_drv_pre_channel_switch(local, sdata, ch_switch);
1157  	if (local->ops->pre_channel_switch)
1158  		ret = local->ops->pre_channel_switch(&local->hw, &sdata->vif,
1159  						     ch_switch);
1160  	trace_drv_return_int(local, ret);
1161  	return ret;
1162  }
1163  
1164  static inline int
drv_post_channel_switch(struct ieee80211_link_data * link)1165  drv_post_channel_switch(struct ieee80211_link_data *link)
1166  {
1167  	struct ieee80211_sub_if_data *sdata = link->sdata;
1168  	struct ieee80211_local *local = sdata->local;
1169  	int ret = 0;
1170  
1171  	might_sleep();
1172  	lockdep_assert_wiphy(local->hw.wiphy);
1173  
1174  	if (!check_sdata_in_driver(sdata))
1175  		return -EIO;
1176  
1177  	if (!ieee80211_vif_link_active(&sdata->vif, link->link_id))
1178  		return 0;
1179  
1180  	trace_drv_post_channel_switch(local, sdata);
1181  	if (local->ops->post_channel_switch)
1182  		ret = local->ops->post_channel_switch(&local->hw, &sdata->vif,
1183  						      link->conf);
1184  	trace_drv_return_int(local, ret);
1185  	return ret;
1186  }
1187  
1188  static inline void
drv_abort_channel_switch(struct ieee80211_link_data * link)1189  drv_abort_channel_switch(struct ieee80211_link_data *link)
1190  {
1191  	struct ieee80211_sub_if_data *sdata = link->sdata;
1192  	struct ieee80211_local *local = sdata->local;
1193  
1194  	might_sleep();
1195  	lockdep_assert_wiphy(local->hw.wiphy);
1196  
1197  	if (!check_sdata_in_driver(sdata))
1198  		return;
1199  
1200  	if (!ieee80211_vif_link_active(&sdata->vif, link->link_id))
1201  		return;
1202  
1203  	trace_drv_abort_channel_switch(local, sdata);
1204  
1205  	if (local->ops->abort_channel_switch)
1206  		local->ops->abort_channel_switch(&local->hw, &sdata->vif,
1207  						 link->conf);
1208  }
1209  
1210  static inline void
drv_channel_switch_rx_beacon(struct ieee80211_sub_if_data * sdata,struct ieee80211_channel_switch * ch_switch)1211  drv_channel_switch_rx_beacon(struct ieee80211_sub_if_data *sdata,
1212  			     struct ieee80211_channel_switch *ch_switch)
1213  {
1214  	struct ieee80211_local *local = sdata->local;
1215  
1216  	might_sleep();
1217  	lockdep_assert_wiphy(local->hw.wiphy);
1218  
1219  	if (!check_sdata_in_driver(sdata))
1220  		return;
1221  
1222  	if (!ieee80211_vif_link_active(&sdata->vif, ch_switch->link_id))
1223  		return;
1224  
1225  	trace_drv_channel_switch_rx_beacon(local, sdata, ch_switch);
1226  	if (local->ops->channel_switch_rx_beacon)
1227  		local->ops->channel_switch_rx_beacon(&local->hw, &sdata->vif,
1228  						     ch_switch);
1229  }
1230  
drv_join_ibss(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)1231  static inline int drv_join_ibss(struct ieee80211_local *local,
1232  				struct ieee80211_sub_if_data *sdata)
1233  {
1234  	int ret = 0;
1235  
1236  	might_sleep();
1237  	lockdep_assert_wiphy(local->hw.wiphy);
1238  	if (!check_sdata_in_driver(sdata))
1239  		return -EIO;
1240  
1241  	trace_drv_join_ibss(local, sdata, &sdata->vif.bss_conf);
1242  	if (local->ops->join_ibss)
1243  		ret = local->ops->join_ibss(&local->hw, &sdata->vif);
1244  	trace_drv_return_int(local, ret);
1245  	return ret;
1246  }
1247  
drv_leave_ibss(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)1248  static inline void drv_leave_ibss(struct ieee80211_local *local,
1249  				  struct ieee80211_sub_if_data *sdata)
1250  {
1251  	might_sleep();
1252  	lockdep_assert_wiphy(local->hw.wiphy);
1253  	if (!check_sdata_in_driver(sdata))
1254  		return;
1255  
1256  	trace_drv_leave_ibss(local, sdata);
1257  	if (local->ops->leave_ibss)
1258  		local->ops->leave_ibss(&local->hw, &sdata->vif);
1259  	trace_drv_return_void(local);
1260  }
1261  
drv_get_expected_throughput(struct ieee80211_local * local,struct sta_info * sta)1262  static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
1263  					      struct sta_info *sta)
1264  {
1265  	u32 ret = 0;
1266  
1267  	trace_drv_get_expected_throughput(&sta->sta);
1268  	if (local->ops->get_expected_throughput && sta->uploaded)
1269  		ret = local->ops->get_expected_throughput(&local->hw, &sta->sta);
1270  	trace_drv_return_u32(local, ret);
1271  
1272  	return ret;
1273  }
1274  
drv_get_txpower(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,int * dbm)1275  static inline int drv_get_txpower(struct ieee80211_local *local,
1276  				  struct ieee80211_sub_if_data *sdata, int *dbm)
1277  {
1278  	int ret;
1279  
1280  	might_sleep();
1281  	lockdep_assert_wiphy(local->hw.wiphy);
1282  
1283  	if (!local->ops->get_txpower)
1284  		return -EOPNOTSUPP;
1285  
1286  	ret = local->ops->get_txpower(&local->hw, &sdata->vif, dbm);
1287  	trace_drv_get_txpower(local, sdata, *dbm, ret);
1288  
1289  	return ret;
1290  }
1291  
1292  static inline int
drv_tdls_channel_switch(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,u8 oper_class,struct cfg80211_chan_def * chandef,struct sk_buff * tmpl_skb,u32 ch_sw_tm_ie)1293  drv_tdls_channel_switch(struct ieee80211_local *local,
1294  			struct ieee80211_sub_if_data *sdata,
1295  			struct ieee80211_sta *sta, u8 oper_class,
1296  			struct cfg80211_chan_def *chandef,
1297  			struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie)
1298  {
1299  	int ret;
1300  
1301  	might_sleep();
1302  	lockdep_assert_wiphy(local->hw.wiphy);
1303  	if (!check_sdata_in_driver(sdata))
1304  		return -EIO;
1305  
1306  	if (!local->ops->tdls_channel_switch)
1307  		return -EOPNOTSUPP;
1308  
1309  	trace_drv_tdls_channel_switch(local, sdata, sta, oper_class, chandef);
1310  	ret = local->ops->tdls_channel_switch(&local->hw, &sdata->vif, sta,
1311  					      oper_class, chandef, tmpl_skb,
1312  					      ch_sw_tm_ie);
1313  	trace_drv_return_int(local, ret);
1314  	return ret;
1315  }
1316  
1317  static inline void
drv_tdls_cancel_channel_switch(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta)1318  drv_tdls_cancel_channel_switch(struct ieee80211_local *local,
1319  			       struct ieee80211_sub_if_data *sdata,
1320  			       struct ieee80211_sta *sta)
1321  {
1322  	might_sleep();
1323  	lockdep_assert_wiphy(local->hw.wiphy);
1324  	if (!check_sdata_in_driver(sdata))
1325  		return;
1326  
1327  	if (!local->ops->tdls_cancel_channel_switch)
1328  		return;
1329  
1330  	trace_drv_tdls_cancel_channel_switch(local, sdata, sta);
1331  	local->ops->tdls_cancel_channel_switch(&local->hw, &sdata->vif, sta);
1332  	trace_drv_return_void(local);
1333  }
1334  
1335  static inline void
drv_tdls_recv_channel_switch(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_tdls_ch_sw_params * params)1336  drv_tdls_recv_channel_switch(struct ieee80211_local *local,
1337  			     struct ieee80211_sub_if_data *sdata,
1338  			     struct ieee80211_tdls_ch_sw_params *params)
1339  {
1340  	trace_drv_tdls_recv_channel_switch(local, sdata, params);
1341  	if (local->ops->tdls_recv_channel_switch)
1342  		local->ops->tdls_recv_channel_switch(&local->hw, &sdata->vif,
1343  						     params);
1344  	trace_drv_return_void(local);
1345  }
1346  
drv_wake_tx_queue(struct ieee80211_local * local,struct txq_info * txq)1347  static inline void drv_wake_tx_queue(struct ieee80211_local *local,
1348  				     struct txq_info *txq)
1349  {
1350  	struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
1351  
1352  	/* In reconfig don't transmit now, but mark for waking later */
1353  	if (local->in_reconfig) {
1354  		set_bit(IEEE80211_TXQ_DIRTY, &txq->flags);
1355  		return;
1356  	}
1357  
1358  	if (!check_sdata_in_driver(sdata))
1359  		return;
1360  
1361  	trace_drv_wake_tx_queue(local, sdata, txq);
1362  	local->ops->wake_tx_queue(&local->hw, &txq->txq);
1363  }
1364  
schedule_and_wake_txq(struct ieee80211_local * local,struct txq_info * txqi)1365  static inline void schedule_and_wake_txq(struct ieee80211_local *local,
1366  					 struct txq_info *txqi)
1367  {
1368  	ieee80211_schedule_txq(&local->hw, &txqi->txq);
1369  	drv_wake_tx_queue(local, txqi);
1370  }
1371  
drv_can_aggregate_in_amsdu(struct ieee80211_local * local,struct sk_buff * head,struct sk_buff * skb)1372  static inline int drv_can_aggregate_in_amsdu(struct ieee80211_local *local,
1373  					     struct sk_buff *head,
1374  					     struct sk_buff *skb)
1375  {
1376  	if (!local->ops->can_aggregate_in_amsdu)
1377  		return true;
1378  
1379  	return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb);
1380  }
1381  
1382  static inline int
drv_get_ftm_responder_stats(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct cfg80211_ftm_responder_stats * ftm_stats)1383  drv_get_ftm_responder_stats(struct ieee80211_local *local,
1384  			    struct ieee80211_sub_if_data *sdata,
1385  			    struct cfg80211_ftm_responder_stats *ftm_stats)
1386  {
1387  	u32 ret = -EOPNOTSUPP;
1388  
1389  	might_sleep();
1390  	lockdep_assert_wiphy(local->hw.wiphy);
1391  	if (!check_sdata_in_driver(sdata))
1392  		return -EIO;
1393  
1394  	if (local->ops->get_ftm_responder_stats)
1395  		ret = local->ops->get_ftm_responder_stats(&local->hw,
1396  							 &sdata->vif,
1397  							 ftm_stats);
1398  	trace_drv_get_ftm_responder_stats(local, sdata, ftm_stats);
1399  
1400  	return ret;
1401  }
1402  
drv_start_pmsr(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct cfg80211_pmsr_request * request)1403  static inline int drv_start_pmsr(struct ieee80211_local *local,
1404  				 struct ieee80211_sub_if_data *sdata,
1405  				 struct cfg80211_pmsr_request *request)
1406  {
1407  	int ret = -EOPNOTSUPP;
1408  
1409  	might_sleep();
1410  	lockdep_assert_wiphy(local->hw.wiphy);
1411  	if (!check_sdata_in_driver(sdata))
1412  		return -EIO;
1413  
1414  	trace_drv_start_pmsr(local, sdata);
1415  
1416  	if (local->ops->start_pmsr)
1417  		ret = local->ops->start_pmsr(&local->hw, &sdata->vif, request);
1418  	trace_drv_return_int(local, ret);
1419  
1420  	return ret;
1421  }
1422  
drv_abort_pmsr(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct cfg80211_pmsr_request * request)1423  static inline void drv_abort_pmsr(struct ieee80211_local *local,
1424  				  struct ieee80211_sub_if_data *sdata,
1425  				  struct cfg80211_pmsr_request *request)
1426  {
1427  	trace_drv_abort_pmsr(local, sdata);
1428  
1429  	might_sleep();
1430  	lockdep_assert_wiphy(local->hw.wiphy);
1431  	if (!check_sdata_in_driver(sdata))
1432  		return;
1433  
1434  	if (local->ops->abort_pmsr)
1435  		local->ops->abort_pmsr(&local->hw, &sdata->vif, request);
1436  	trace_drv_return_void(local);
1437  }
1438  
drv_start_nan(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct cfg80211_nan_conf * conf)1439  static inline int drv_start_nan(struct ieee80211_local *local,
1440  				struct ieee80211_sub_if_data *sdata,
1441  				struct cfg80211_nan_conf *conf)
1442  {
1443  	int ret;
1444  
1445  	might_sleep();
1446  	lockdep_assert_wiphy(local->hw.wiphy);
1447  	check_sdata_in_driver(sdata);
1448  
1449  	trace_drv_start_nan(local, sdata, conf);
1450  	ret = local->ops->start_nan(&local->hw, &sdata->vif, conf);
1451  	trace_drv_return_int(local, ret);
1452  	return ret;
1453  }
1454  
drv_stop_nan(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)1455  static inline void drv_stop_nan(struct ieee80211_local *local,
1456  				struct ieee80211_sub_if_data *sdata)
1457  {
1458  	might_sleep();
1459  	lockdep_assert_wiphy(local->hw.wiphy);
1460  	check_sdata_in_driver(sdata);
1461  
1462  	trace_drv_stop_nan(local, sdata);
1463  	local->ops->stop_nan(&local->hw, &sdata->vif);
1464  	trace_drv_return_void(local);
1465  }
1466  
drv_nan_change_conf(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct cfg80211_nan_conf * conf,u32 changes)1467  static inline int drv_nan_change_conf(struct ieee80211_local *local,
1468  				       struct ieee80211_sub_if_data *sdata,
1469  				       struct cfg80211_nan_conf *conf,
1470  				       u32 changes)
1471  {
1472  	int ret;
1473  
1474  	might_sleep();
1475  	lockdep_assert_wiphy(local->hw.wiphy);
1476  	check_sdata_in_driver(sdata);
1477  
1478  	if (!local->ops->nan_change_conf)
1479  		return -EOPNOTSUPP;
1480  
1481  	trace_drv_nan_change_conf(local, sdata, conf, changes);
1482  	ret = local->ops->nan_change_conf(&local->hw, &sdata->vif, conf,
1483  					  changes);
1484  	trace_drv_return_int(local, ret);
1485  
1486  	return ret;
1487  }
1488  
drv_add_nan_func(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,const struct cfg80211_nan_func * nan_func)1489  static inline int drv_add_nan_func(struct ieee80211_local *local,
1490  				   struct ieee80211_sub_if_data *sdata,
1491  				   const struct cfg80211_nan_func *nan_func)
1492  {
1493  	int ret;
1494  
1495  	might_sleep();
1496  	lockdep_assert_wiphy(local->hw.wiphy);
1497  	check_sdata_in_driver(sdata);
1498  
1499  	if (!local->ops->add_nan_func)
1500  		return -EOPNOTSUPP;
1501  
1502  	trace_drv_add_nan_func(local, sdata, nan_func);
1503  	ret = local->ops->add_nan_func(&local->hw, &sdata->vif, nan_func);
1504  	trace_drv_return_int(local, ret);
1505  
1506  	return ret;
1507  }
1508  
drv_del_nan_func(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,u8 instance_id)1509  static inline void drv_del_nan_func(struct ieee80211_local *local,
1510  				   struct ieee80211_sub_if_data *sdata,
1511  				   u8 instance_id)
1512  {
1513  	might_sleep();
1514  	lockdep_assert_wiphy(local->hw.wiphy);
1515  	check_sdata_in_driver(sdata);
1516  
1517  	trace_drv_del_nan_func(local, sdata, instance_id);
1518  	if (local->ops->del_nan_func)
1519  		local->ops->del_nan_func(&local->hw, &sdata->vif, instance_id);
1520  	trace_drv_return_void(local);
1521  }
1522  
drv_set_tid_config(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,struct cfg80211_tid_config * tid_conf)1523  static inline int drv_set_tid_config(struct ieee80211_local *local,
1524  				     struct ieee80211_sub_if_data *sdata,
1525  				     struct ieee80211_sta *sta,
1526  				     struct cfg80211_tid_config *tid_conf)
1527  {
1528  	int ret;
1529  
1530  	might_sleep();
1531  	lockdep_assert_wiphy(local->hw.wiphy);
1532  	ret = local->ops->set_tid_config(&local->hw, &sdata->vif, sta,
1533  					 tid_conf);
1534  	trace_drv_return_int(local, ret);
1535  
1536  	return ret;
1537  }
1538  
drv_reset_tid_config(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,u8 tids)1539  static inline int drv_reset_tid_config(struct ieee80211_local *local,
1540  				       struct ieee80211_sub_if_data *sdata,
1541  				       struct ieee80211_sta *sta, u8 tids)
1542  {
1543  	int ret;
1544  
1545  	might_sleep();
1546  	lockdep_assert_wiphy(local->hw.wiphy);
1547  	ret = local->ops->reset_tid_config(&local->hw, &sdata->vif, sta, tids);
1548  	trace_drv_return_int(local, ret);
1549  
1550  	return ret;
1551  }
1552  
drv_update_vif_offload(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)1553  static inline void drv_update_vif_offload(struct ieee80211_local *local,
1554  					  struct ieee80211_sub_if_data *sdata)
1555  {
1556  	might_sleep();
1557  	lockdep_assert_wiphy(local->hw.wiphy);
1558  	check_sdata_in_driver(sdata);
1559  
1560  	if (!local->ops->update_vif_offload)
1561  		return;
1562  
1563  	trace_drv_update_vif_offload(local, sdata);
1564  	local->ops->update_vif_offload(&local->hw, &sdata->vif);
1565  	trace_drv_return_void(local);
1566  }
1567  
drv_sta_set_4addr(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,bool enabled)1568  static inline void drv_sta_set_4addr(struct ieee80211_local *local,
1569  				     struct ieee80211_sub_if_data *sdata,
1570  				     struct ieee80211_sta *sta, bool enabled)
1571  {
1572  	sdata = get_bss_sdata(sdata);
1573  
1574  	might_sleep();
1575  	lockdep_assert_wiphy(local->hw.wiphy);
1576  	if (!check_sdata_in_driver(sdata))
1577  		return;
1578  
1579  	trace_drv_sta_set_4addr(local, sdata, sta, enabled);
1580  	if (local->ops->sta_set_4addr)
1581  		local->ops->sta_set_4addr(&local->hw, &sdata->vif, sta, enabled);
1582  	trace_drv_return_void(local);
1583  }
1584  
drv_sta_set_decap_offload(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,bool enabled)1585  static inline void drv_sta_set_decap_offload(struct ieee80211_local *local,
1586  					     struct ieee80211_sub_if_data *sdata,
1587  					     struct ieee80211_sta *sta,
1588  					     bool enabled)
1589  {
1590  	sdata = get_bss_sdata(sdata);
1591  
1592  	might_sleep();
1593  	lockdep_assert_wiphy(local->hw.wiphy);
1594  	if (!check_sdata_in_driver(sdata))
1595  		return;
1596  
1597  	trace_drv_sta_set_decap_offload(local, sdata, sta, enabled);
1598  	if (local->ops->sta_set_decap_offload)
1599  		local->ops->sta_set_decap_offload(&local->hw, &sdata->vif, sta,
1600  						  enabled);
1601  	trace_drv_return_void(local);
1602  }
1603  
drv_add_twt_setup(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,struct ieee80211_twt_setup * twt)1604  static inline void drv_add_twt_setup(struct ieee80211_local *local,
1605  				     struct ieee80211_sub_if_data *sdata,
1606  				     struct ieee80211_sta *sta,
1607  				     struct ieee80211_twt_setup *twt)
1608  {
1609  	struct ieee80211_twt_params *twt_agrt;
1610  
1611  	might_sleep();
1612  	lockdep_assert_wiphy(local->hw.wiphy);
1613  
1614  	if (!check_sdata_in_driver(sdata))
1615  		return;
1616  
1617  	twt_agrt = (void *)twt->params;
1618  
1619  	trace_drv_add_twt_setup(local, sta, twt, twt_agrt);
1620  	local->ops->add_twt_setup(&local->hw, sta, twt);
1621  	trace_drv_return_void(local);
1622  }
1623  
drv_twt_teardown_request(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,u8 flowid)1624  static inline void drv_twt_teardown_request(struct ieee80211_local *local,
1625  					    struct ieee80211_sub_if_data *sdata,
1626  					    struct ieee80211_sta *sta,
1627  					    u8 flowid)
1628  {
1629  	might_sleep();
1630  	lockdep_assert_wiphy(local->hw.wiphy);
1631  	if (!check_sdata_in_driver(sdata))
1632  		return;
1633  
1634  	if (!local->ops->twt_teardown_request)
1635  		return;
1636  
1637  	trace_drv_twt_teardown_request(local, sta, flowid);
1638  	local->ops->twt_teardown_request(&local->hw, sta, flowid);
1639  	trace_drv_return_void(local);
1640  }
1641  
drv_net_fill_forward_path(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,struct net_device_path_ctx * ctx,struct net_device_path * path)1642  static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
1643  					    struct ieee80211_sub_if_data *sdata,
1644  					    struct ieee80211_sta *sta,
1645  					    struct net_device_path_ctx *ctx,
1646  					    struct net_device_path *path)
1647  {
1648  	int ret = -EOPNOTSUPP;
1649  
1650  	sdata = get_bss_sdata(sdata);
1651  	if (!check_sdata_in_driver(sdata))
1652  		return -EIO;
1653  
1654  	trace_drv_net_fill_forward_path(local, sdata, sta);
1655  	if (local->ops->net_fill_forward_path)
1656  		ret = local->ops->net_fill_forward_path(&local->hw,
1657  							&sdata->vif, sta,
1658  							ctx, path);
1659  	trace_drv_return_int(local, ret);
1660  
1661  	return ret;
1662  }
1663  
drv_net_setup_tc(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct net_device * dev,enum tc_setup_type type,void * type_data)1664  static inline int drv_net_setup_tc(struct ieee80211_local *local,
1665  				   struct ieee80211_sub_if_data *sdata,
1666  				   struct net_device *dev,
1667  				   enum tc_setup_type type, void *type_data)
1668  {
1669  	int ret = -EOPNOTSUPP;
1670  
1671  	might_sleep();
1672  
1673  	sdata = get_bss_sdata(sdata);
1674  	trace_drv_net_setup_tc(local, sdata, type);
1675  	if (local->ops->net_setup_tc)
1676  		ret = local->ops->net_setup_tc(&local->hw, &sdata->vif, dev,
1677  					       type, type_data);
1678  	trace_drv_return_int(local, ret);
1679  
1680  	return ret;
1681  }
1682  
drv_can_activate_links(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,u16 active_links)1683  static inline bool drv_can_activate_links(struct ieee80211_local *local,
1684  					  struct ieee80211_sub_if_data *sdata,
1685  					  u16 active_links)
1686  {
1687  	bool ret = true;
1688  
1689  	lockdep_assert_wiphy(local->hw.wiphy);
1690  
1691  	if (!check_sdata_in_driver(sdata))
1692  		return false;
1693  
1694  	trace_drv_can_activate_links(local, sdata, active_links);
1695  	if (local->ops->can_activate_links)
1696  		ret = local->ops->can_activate_links(&local->hw, &sdata->vif,
1697  						     active_links);
1698  	trace_drv_return_bool(local, ret);
1699  
1700  	return ret;
1701  }
1702  
1703  int drv_change_vif_links(struct ieee80211_local *local,
1704  			 struct ieee80211_sub_if_data *sdata,
1705  			 u16 old_links, u16 new_links,
1706  			 struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]);
1707  int drv_change_sta_links(struct ieee80211_local *local,
1708  			 struct ieee80211_sub_if_data *sdata,
1709  			 struct ieee80211_sta *sta,
1710  			 u16 old_links, u16 new_links);
1711  
1712  static inline enum ieee80211_neg_ttlm_res
drv_can_neg_ttlm(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_neg_ttlm * neg_ttlm)1713  drv_can_neg_ttlm(struct ieee80211_local *local,
1714  		 struct ieee80211_sub_if_data *sdata,
1715  		 struct ieee80211_neg_ttlm *neg_ttlm)
1716  {
1717  	enum ieee80211_neg_ttlm_res res = NEG_TTLM_RES_REJECT;
1718  
1719  	might_sleep();
1720  	if (!check_sdata_in_driver(sdata))
1721  		return -EIO;
1722  
1723  	trace_drv_can_neg_ttlm(local, sdata, neg_ttlm);
1724  	if (local->ops->can_neg_ttlm)
1725  		res = local->ops->can_neg_ttlm(&local->hw, &sdata->vif,
1726  					       neg_ttlm);
1727  	trace_drv_neg_ttlm_res(local, sdata, res, neg_ttlm);
1728  
1729  	return res;
1730  }
1731  #endif /* __MAC80211_DRIVER_OPS */
1732