1
2
3
4
5
6
7
8
9
10
11#ifndef IEEE80211_I_H
12#define IEEE80211_I_H
13
14#include <linux/kernel.h>
15#include <linux/device.h>
16#include <linux/if_ether.h>
17#include <linux/interrupt.h>
18#include <linux/list.h>
19#include <linux/netdevice.h>
20#include <linux/skbuff.h>
21#include <linux/workqueue.h>
22#include <linux/types.h>
23#include <linux/spinlock.h>
24#include <linux/etherdevice.h>
25#include <linux/leds.h>
26#include <linux/idr.h>
27#include <linux/rhashtable.h>
28#include <net/ieee80211_radiotap.h>
29#include <net/cfg80211.h>
30#include <net/mac80211.h>
31#include <net/fq.h>
32#include "key.h"
33#include "sta_info.h"
34#include "debug.h"
35
36extern const struct cfg80211_ops mac80211_config_ops;
37
38struct ieee80211_local;
39
40
41
42#define AP_MAX_BC_BUFFER 128
43
44
45
46
47#define TOTAL_MAX_TX_BUFFER 512
48
49
50#define IEEE80211_ENCRYPT_HEADROOM 8
51#define IEEE80211_ENCRYPT_TAILROOM 18
52
53
54
55
56
57#define IEEE80211_FRAGMENT_MAX 4
58
59
60#define IEEE80211_UNSET_POWER_LEVEL INT_MIN
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80#define IEEE80211_DEFAULT_UAPSD_QUEUES 0
81
82#define IEEE80211_DEFAULT_MAX_SP_LEN \
83 IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
84
85extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS];
86
87#define IEEE80211_DEAUTH_FRAME_LEN (24 + 2 )
88
89#define IEEE80211_MAX_NAN_INSTANCE_ID 255
90
91struct ieee80211_fragment_entry {
92 struct sk_buff_head skb_list;
93 unsigned long first_frag_time;
94 u16 seq;
95 u16 extra_len;
96 u16 last_frag;
97 u8 rx_queue;
98 bool check_sequential_pn;
99 u8 last_pn[6];
100};
101
102
103struct ieee80211_bss {
104 u32 device_ts_beacon, device_ts_presp;
105
106 bool wmm_used;
107 bool uapsd_supported;
108
109#define IEEE80211_MAX_SUPP_RATES 32
110 u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
111 size_t supp_rates_len;
112 struct ieee80211_rate *beacon_rate;
113
114 u32 vht_cap_info;
115
116
117
118
119
120
121
122 bool has_erp_value;
123 u8 erp_value;
124
125
126 u8 corrupt_data;
127
128
129 u8 valid_data;
130};
131
132
133
134
135
136
137
138
139
140enum ieee80211_bss_corrupt_data_flags {
141 IEEE80211_BSS_CORRUPT_BEACON = BIT(0),
142 IEEE80211_BSS_CORRUPT_PROBE_RESP = BIT(1)
143};
144
145
146
147
148
149
150
151
152
153
154
155
156enum ieee80211_bss_valid_data_flags {
157 IEEE80211_BSS_VALID_WMM = BIT(1),
158 IEEE80211_BSS_VALID_RATES = BIT(2),
159 IEEE80211_BSS_VALID_ERP = BIT(3)
160};
161
162typedef unsigned __bitwise ieee80211_tx_result;
163#define TX_CONTINUE ((__force ieee80211_tx_result) 0u)
164#define TX_DROP ((__force ieee80211_tx_result) 1u)
165#define TX_QUEUED ((__force ieee80211_tx_result) 2u)
166
167#define IEEE80211_TX_UNICAST BIT(1)
168#define IEEE80211_TX_PS_BUFFERED BIT(2)
169
170struct ieee80211_tx_data {
171 struct sk_buff *skb;
172 struct sk_buff_head skbs;
173 struct ieee80211_local *local;
174 struct ieee80211_sub_if_data *sdata;
175 struct sta_info *sta;
176 struct ieee80211_key *key;
177 struct ieee80211_tx_rate rate;
178
179 unsigned int flags;
180};
181
182
183typedef unsigned __bitwise ieee80211_rx_result;
184#define RX_CONTINUE ((__force ieee80211_rx_result) 0u)
185#define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u)
186#define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u)
187#define RX_QUEUED ((__force ieee80211_rx_result) 3u)
188
189
190
191
192
193
194
195
196
197
198enum ieee80211_packet_rx_flags {
199 IEEE80211_RX_AMSDU = BIT(3),
200 IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4),
201 IEEE80211_RX_DEFERRED_RELEASE = BIT(5),
202};
203
204
205
206
207
208
209
210
211
212
213
214enum ieee80211_rx_flags {
215 IEEE80211_RX_CMNTR = BIT(0),
216 IEEE80211_RX_BEACON_REPORTED = BIT(1),
217};
218
219struct ieee80211_rx_data {
220 struct list_head *list;
221 struct sk_buff *skb;
222 struct ieee80211_local *local;
223 struct ieee80211_sub_if_data *sdata;
224 struct sta_info *sta;
225 struct ieee80211_key *key;
226
227 unsigned int flags;
228
229
230
231
232
233
234 int seqno_idx;
235
236
237
238
239
240
241
242 int security_idx;
243
244 u32 tkip_iv32;
245 u16 tkip_iv16;
246};
247
248struct ieee80211_csa_settings {
249 const u16 *counter_offsets_beacon;
250 const u16 *counter_offsets_presp;
251
252 int n_counter_offsets_beacon;
253 int n_counter_offsets_presp;
254
255 u8 count;
256};
257
258struct beacon_data {
259 u8 *head, *tail;
260 int head_len, tail_len;
261 struct ieee80211_meshconf_ie *meshconf;
262 u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
263 u8 cntdwn_current_counter;
264 struct rcu_head rcu_head;
265};
266
267struct probe_resp {
268 struct rcu_head rcu_head;
269 int len;
270 u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
271 u8 data[];
272};
273
274struct fils_discovery_data {
275 struct rcu_head rcu_head;
276 int len;
277 u8 data[];
278};
279
280struct unsol_bcast_probe_resp_data {
281 struct rcu_head rcu_head;
282 int len;
283 u8 data[];
284};
285
286struct ps_data {
287
288
289
290 u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]
291 __aligned(__alignof__(unsigned long));
292 struct sk_buff_head bc_buf;
293 atomic_t num_sta_ps;
294 int dtim_count;
295 bool dtim_bc_mc;
296};
297
298struct ieee80211_if_ap {
299 struct beacon_data __rcu *beacon;
300 struct probe_resp __rcu *probe_resp;
301 struct fils_discovery_data __rcu *fils_discovery;
302 struct unsol_bcast_probe_resp_data __rcu *unsol_bcast_probe_resp;
303
304
305 struct cfg80211_beacon_data *next_beacon;
306 struct list_head vlans;
307
308 struct ps_data ps;
309 atomic_t num_mcast_sta;
310
311 bool multicast_to_unicast;
312};
313
314struct ieee80211_if_wds {
315 struct sta_info *sta;
316 u8 remote_addr[ETH_ALEN];
317};
318
319struct ieee80211_if_vlan {
320 struct list_head list;
321
322
323 struct sta_info __rcu *sta;
324 atomic_t num_mcast_sta;
325};
326
327struct mesh_stats {
328 __u32 fwded_mcast;
329 __u32 fwded_unicast;
330 __u32 fwded_frames;
331 __u32 dropped_frames_ttl;
332 __u32 dropped_frames_no_route;
333 __u32 dropped_frames_congestion;
334};
335
336#define PREQ_Q_F_START 0x1
337#define PREQ_Q_F_REFRESH 0x2
338struct mesh_preq_queue {
339 struct list_head list;
340 u8 dst[ETH_ALEN];
341 u8 flags;
342};
343
344struct ieee80211_roc_work {
345 struct list_head list;
346
347 struct ieee80211_sub_if_data *sdata;
348
349 struct ieee80211_channel *chan;
350
351 bool started, abort, hw_begun, notified;
352 bool on_channel;
353
354 unsigned long start_time;
355
356 u32 duration, req_duration;
357 struct sk_buff *frame;
358 u64 cookie, mgmt_tx_cookie;
359 enum ieee80211_roc_type type;
360};
361
362
363enum ieee80211_sta_flags {
364 IEEE80211_STA_CONNECTION_POLL = BIT(1),
365 IEEE80211_STA_CONTROL_PORT = BIT(2),
366 IEEE80211_STA_DISABLE_HT = BIT(4),
367 IEEE80211_STA_MFP_ENABLED = BIT(6),
368 IEEE80211_STA_UAPSD_ENABLED = BIT(7),
369 IEEE80211_STA_NULLFUNC_ACKED = BIT(8),
370 IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9),
371 IEEE80211_STA_DISABLE_40MHZ = BIT(10),
372 IEEE80211_STA_DISABLE_VHT = BIT(11),
373 IEEE80211_STA_DISABLE_80P80MHZ = BIT(12),
374 IEEE80211_STA_DISABLE_160MHZ = BIT(13),
375 IEEE80211_STA_DISABLE_WMM = BIT(14),
376 IEEE80211_STA_ENABLE_RRM = BIT(15),
377 IEEE80211_STA_DISABLE_HE = BIT(16),
378};
379
380struct ieee80211_mgd_auth_data {
381 struct cfg80211_bss *bss;
382 unsigned long timeout;
383 int tries;
384 u16 algorithm, expected_transaction;
385
386 u8 key[WLAN_KEY_LEN_WEP104];
387 u8 key_len, key_idx;
388 bool done;
389 bool peer_confirmed;
390 bool timeout_started;
391
392 u16 sae_trans, sae_status;
393 size_t data_len;
394 u8 data[];
395};
396
397struct ieee80211_mgd_assoc_data {
398 struct cfg80211_bss *bss;
399 const u8 *supp_rates;
400
401 unsigned long timeout;
402 int tries;
403
404 u16 capability;
405 u8 prev_bssid[ETH_ALEN];
406 u8 ssid[IEEE80211_MAX_SSID_LEN];
407 u8 ssid_len;
408 u8 supp_rates_len;
409 bool wmm, uapsd;
410 bool need_beacon;
411 bool synced;
412 bool timeout_started;
413
414 u8 ap_ht_param;
415
416 struct ieee80211_vht_cap ap_vht_cap;
417
418 u8 fils_nonces[2 * FILS_NONCE_LEN];
419 u8 fils_kek[FILS_MAX_KEK_LEN];
420 size_t fils_kek_len;
421
422 size_t ie_len;
423 u8 ie[];
424};
425
426struct ieee80211_sta_tx_tspec {
427
428 unsigned long time_slice_start;
429
430 u32 admitted_time;
431 u8 tsid;
432 s8 up;
433
434
435 u32 consumed_tx_time;
436 enum {
437 TX_TSPEC_ACTION_NONE = 0,
438 TX_TSPEC_ACTION_DOWNGRADE,
439 TX_TSPEC_ACTION_STOP_DOWNGRADE,
440 } action;
441 bool downgraded;
442};
443
444DECLARE_EWMA(beacon_signal, 4, 4)
445
446struct ieee80211_if_managed {
447 struct timer_list timer;
448 struct timer_list conn_mon_timer;
449 struct timer_list bcn_mon_timer;
450 struct timer_list chswitch_timer;
451 struct work_struct monitor_work;
452 struct work_struct chswitch_work;
453 struct work_struct beacon_connection_loss_work;
454 struct work_struct csa_connection_drop_work;
455
456 unsigned long beacon_timeout;
457 unsigned long probe_timeout;
458 int probe_send_count;
459 bool nullfunc_failed;
460 bool connection_loss;
461
462 struct cfg80211_bss *associated;
463 struct ieee80211_mgd_auth_data *auth_data;
464 struct ieee80211_mgd_assoc_data *assoc_data;
465
466 u8 bssid[ETH_ALEN] __aligned(2);
467
468 bool powersave;
469 bool broken_ap;
470 bool have_beacon;
471 u8 dtim_period;
472 enum ieee80211_smps_mode req_smps,
473 driver_smps_mode;
474
475 struct work_struct request_smps_work;
476
477 unsigned int flags;
478
479 bool csa_waiting_bcn;
480 bool csa_ignored_same_chan;
481
482 bool beacon_crc_valid;
483 u32 beacon_crc;
484
485 bool status_acked;
486 bool status_received;
487 __le16 status_fc;
488
489 enum {
490 IEEE80211_MFP_DISABLED,
491 IEEE80211_MFP_OPTIONAL,
492 IEEE80211_MFP_REQUIRED
493 } mfp;
494
495
496
497
498
499
500 unsigned int uapsd_queues;
501
502
503
504
505
506
507 unsigned int uapsd_max_sp_len;
508
509 int wmm_last_param_set;
510 int mu_edca_last_param_set;
511
512 u8 use_4addr;
513
514 s16 p2p_noa_index;
515
516 struct ewma_beacon_signal ave_beacon_signal;
517
518
519
520
521
522
523 unsigned int count_beacon_signal;
524
525
526 unsigned int beacon_loss_count;
527
528
529
530
531
532
533 int last_cqm_event_signal;
534
535
536
537
538
539
540 int rssi_min_thold, rssi_max_thold;
541 int last_ave_beacon_signal;
542
543 struct ieee80211_ht_cap ht_capa;
544 struct ieee80211_ht_cap ht_capa_mask;
545 struct ieee80211_vht_cap vht_capa;
546 struct ieee80211_vht_cap vht_capa_mask;
547 struct ieee80211_s1g_cap s1g_capa;
548 struct ieee80211_s1g_cap s1g_capa_mask;
549
550
551 u8 tdls_peer[ETH_ALEN] __aligned(2);
552 struct delayed_work tdls_peer_del_work;
553 struct sk_buff *orig_teardown_skb;
554 struct sk_buff *teardown_skb;
555 spinlock_t teardown_lock;
556 bool tdls_chan_switch_prohibited;
557 bool tdls_wider_bw_prohibited;
558
559
560 struct ieee80211_sta_tx_tspec tx_tspec[IEEE80211_NUM_ACS];
561
562
563
564
565
566
567 struct delayed_work tx_tspec_wk;
568
569
570
571
572 u8 *assoc_req_ies;
573 size_t assoc_req_ies_len;
574};
575
576struct ieee80211_if_ibss {
577 struct timer_list timer;
578 struct work_struct csa_connection_drop_work;
579
580 unsigned long last_scan_completed;
581
582 u32 basic_rates;
583
584 bool fixed_bssid;
585 bool fixed_channel;
586 bool privacy;
587
588 bool control_port;
589 bool userspace_handles_dfs;
590
591 u8 bssid[ETH_ALEN] __aligned(2);
592 u8 ssid[IEEE80211_MAX_SSID_LEN];
593 u8 ssid_len, ie_len;
594 u8 *ie;
595 struct cfg80211_chan_def chandef;
596
597 unsigned long ibss_join_req;
598
599 struct beacon_data __rcu *presp;
600
601 struct ieee80211_ht_cap ht_capa;
602 struct ieee80211_ht_cap ht_capa_mask;
603
604 spinlock_t incomplete_lock;
605 struct list_head incomplete_stations;
606
607 enum {
608 IEEE80211_IBSS_MLME_SEARCH,
609 IEEE80211_IBSS_MLME_JOINED,
610 } state;
611};
612
613
614
615
616
617
618
619
620
621
622struct ieee80211_if_ocb {
623 struct timer_list housekeeping_timer;
624 unsigned long wrkq_flags;
625
626 spinlock_t incomplete_lock;
627 struct list_head incomplete_stations;
628
629 bool joined;
630};
631
632
633
634
635
636
637
638
639struct ieee802_11_elems;
640struct ieee80211_mesh_sync_ops {
641 void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata,
642 u16 stype,
643 struct ieee80211_mgmt *mgmt,
644 struct ieee802_11_elems *elems,
645 struct ieee80211_rx_status *rx_status);
646
647
648 void (*adjust_tsf)(struct ieee80211_sub_if_data *sdata,
649 struct beacon_data *beacon);
650
651};
652
653struct mesh_csa_settings {
654 struct rcu_head rcu_head;
655 struct cfg80211_csa_settings settings;
656};
657
658struct ieee80211_if_mesh {
659 struct timer_list housekeeping_timer;
660 struct timer_list mesh_path_timer;
661 struct timer_list mesh_path_root_timer;
662
663 unsigned long wrkq_flags;
664 unsigned long mbss_changed;
665
666 bool userspace_handles_dfs;
667
668 u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
669 size_t mesh_id_len;
670
671 u8 mesh_pp_id;
672
673 u8 mesh_pm_id;
674
675 u8 mesh_cc_id;
676
677 u8 mesh_sp_id;
678
679 u8 mesh_auth_id;
680
681 u32 sn;
682
683 u32 preq_id;
684 atomic_t mpaths;
685
686 unsigned long last_sn_update;
687
688 unsigned long next_perr;
689
690 unsigned long last_preq;
691 struct mesh_rmc *rmc;
692 spinlock_t mesh_preq_queue_lock;
693 struct mesh_preq_queue preq_queue;
694 int preq_queue_len;
695 struct mesh_stats mshstats;
696 struct mesh_config mshcfg;
697 atomic_t estab_plinks;
698 u32 mesh_seqnum;
699 bool accepting_plinks;
700 int num_gates;
701 struct beacon_data __rcu *beacon;
702 const u8 *ie;
703 u8 ie_len;
704 enum {
705 IEEE80211_MESH_SEC_NONE = 0x0,
706 IEEE80211_MESH_SEC_AUTHED = 0x1,
707 IEEE80211_MESH_SEC_SECURED = 0x2,
708 } security;
709 bool user_mpm;
710
711 const struct ieee80211_mesh_sync_ops *sync_ops;
712 s64 sync_offset_clockdrift_max;
713 spinlock_t sync_offset_lock;
714
715 enum nl80211_mesh_power_mode nonpeer_pm;
716 int ps_peers_light_sleep;
717 int ps_peers_deep_sleep;
718 struct ps_data ps;
719
720 struct mesh_csa_settings __rcu *csa;
721 enum {
722 IEEE80211_MESH_CSA_ROLE_NONE,
723 IEEE80211_MESH_CSA_ROLE_INIT,
724 IEEE80211_MESH_CSA_ROLE_REPEATER,
725 } csa_role;
726 u8 chsw_ttl;
727 u16 pre_value;
728
729
730 int meshconf_offset;
731
732 struct mesh_table *mesh_paths;
733 struct mesh_table *mpp_paths;
734 int mesh_paths_generation;
735 int mpp_paths_generation;
736};
737
738#ifdef CONFIG_MAC80211_MESH
739#define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
740 do { (msh)->mshstats.name++; } while (0)
741#else
742#define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
743 do { } while (0)
744#endif
745
746
747
748
749
750
751
752
753
754
755
756
757enum ieee80211_sub_if_data_flags {
758 IEEE80211_SDATA_ALLMULTI = BIT(0),
759 IEEE80211_SDATA_OPERATING_GMODE = BIT(2),
760 IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3),
761 IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4),
762 IEEE80211_SDATA_IN_DRIVER = BIT(5),
763};
764
765
766
767
768
769
770
771
772
773
774
775enum ieee80211_sdata_state_bits {
776 SDATA_STATE_RUNNING,
777 SDATA_STATE_OFFCHANNEL,
778 SDATA_STATE_OFFCHANNEL_BEACON_STOPPED,
779};
780
781
782
783
784
785
786
787
788
789
790enum ieee80211_chanctx_mode {
791 IEEE80211_CHANCTX_SHARED,
792 IEEE80211_CHANCTX_EXCLUSIVE
793};
794
795
796
797
798
799
800
801
802
803
804
805
806
807enum ieee80211_chanctx_replace_state {
808 IEEE80211_CHANCTX_REPLACE_NONE,
809 IEEE80211_CHANCTX_WILL_BE_REPLACED,
810 IEEE80211_CHANCTX_REPLACES_OTHER,
811};
812
813struct ieee80211_chanctx {
814 struct list_head list;
815 struct rcu_head rcu_head;
816
817 struct list_head assigned_vifs;
818 struct list_head reserved_vifs;
819
820 enum ieee80211_chanctx_replace_state replace_state;
821 struct ieee80211_chanctx *replace_ctx;
822
823 enum ieee80211_chanctx_mode mode;
824 bool driver_present;
825
826 struct ieee80211_chanctx_conf conf;
827};
828
829struct mac80211_qos_map {
830 struct cfg80211_qos_map qos_map;
831 struct rcu_head rcu_head;
832};
833
834enum txq_info_flags {
835 IEEE80211_TXQ_STOP,
836 IEEE80211_TXQ_AMPDU,
837 IEEE80211_TXQ_NO_AMSDU,
838 IEEE80211_TXQ_STOP_NETIF_TX,
839};
840
841
842
843
844
845
846
847
848
849
850
851
852struct txq_info {
853 struct fq_tin tin;
854 struct fq_flow def_flow;
855 struct codel_vars def_cvars;
856 struct codel_stats cstats;
857 struct sk_buff_head frags;
858 struct list_head schedule_order;
859 u16 schedule_round;
860 unsigned long flags;
861
862
863 struct ieee80211_txq txq;
864};
865
866struct ieee80211_if_mntr {
867 u32 flags;
868 u8 mu_follow_addr[ETH_ALEN] __aligned(2);
869
870 struct list_head list;
871};
872
873
874
875
876
877
878
879struct ieee80211_if_nan {
880 struct cfg80211_nan_conf conf;
881
882
883 spinlock_t func_lock;
884 struct idr function_inst_ids;
885};
886
887struct ieee80211_sub_if_data {
888 struct list_head list;
889
890 struct wireless_dev wdev;
891
892
893 struct list_head key_list;
894
895
896 int crypto_tx_tailroom_needed_cnt;
897 int crypto_tx_tailroom_pending_dec;
898 struct delayed_work dec_tailroom_needed_wk;
899
900 struct net_device *dev;
901 struct ieee80211_local *local;
902
903 unsigned int flags;
904
905 unsigned long state;
906
907 char name[IFNAMSIZ];
908
909
910 struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
911 unsigned int fragment_next;
912
913
914 u16 noack_map;
915
916
917 u8 wmm_acm;
918
919 struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS +
920 NUM_DEFAULT_MGMT_KEYS +
921 NUM_DEFAULT_BEACON_KEYS];
922 struct ieee80211_key __rcu *default_unicast_key;
923 struct ieee80211_key __rcu *default_multicast_key;
924 struct ieee80211_key __rcu *default_mgmt_key;
925 struct ieee80211_key __rcu *default_beacon_key;
926
927 u16 sequence_number;
928 __be16 control_port_protocol;
929 bool control_port_no_encrypt;
930 bool control_port_no_preauth;
931 bool control_port_over_nl80211;
932 int encrypt_headroom;
933
934 atomic_t num_tx_queued;
935 struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
936 struct mac80211_qos_map __rcu *qos_map;
937
938 struct work_struct csa_finalize_work;
939 bool csa_block_tx;
940 struct cfg80211_chan_def csa_chandef;
941
942 struct list_head assigned_chanctx_list;
943 struct list_head reserved_chanctx_list;
944
945
946 struct ieee80211_chanctx *reserved_chanctx;
947 struct cfg80211_chan_def reserved_chandef;
948 bool reserved_radar_required;
949 bool reserved_ready;
950
951
952 struct work_struct recalc_smps;
953
954 struct work_struct work;
955 struct sk_buff_head skb_queue;
956
957 u8 needed_rx_chains;
958 enum ieee80211_smps_mode smps_mode;
959
960 int user_power_level;
961 int ap_power_level;
962
963 bool radar_required;
964 struct delayed_work dfs_cac_timer_work;
965
966
967
968
969
970
971 struct ieee80211_if_ap *bss;
972
973
974 u32 rc_rateidx_mask[NUM_NL80211_BANDS];
975
976 bool rc_has_mcs_mask[NUM_NL80211_BANDS];
977 u8 rc_rateidx_mcs_mask[NUM_NL80211_BANDS][IEEE80211_HT_MCS_MASK_LEN];
978
979 bool rc_has_vht_mcs_mask[NUM_NL80211_BANDS];
980 u16 rc_rateidx_vht_mcs_mask[NUM_NL80211_BANDS][NL80211_VHT_NSS_MAX];
981
982
983 u32 beacon_rateidx_mask[NUM_NL80211_BANDS];
984 bool beacon_rate_set;
985
986 union {
987 struct ieee80211_if_ap ap;
988 struct ieee80211_if_wds wds;
989 struct ieee80211_if_vlan vlan;
990 struct ieee80211_if_managed mgd;
991 struct ieee80211_if_ibss ibss;
992 struct ieee80211_if_mesh mesh;
993 struct ieee80211_if_ocb ocb;
994 struct ieee80211_if_mntr mntr;
995 struct ieee80211_if_nan nan;
996 } u;
997
998#ifdef CONFIG_MAC80211_DEBUGFS
999 struct {
1000 struct dentry *subdir_stations;
1001 struct dentry *default_unicast_key;
1002 struct dentry *default_multicast_key;
1003 struct dentry *default_mgmt_key;
1004 struct dentry *default_beacon_key;
1005 } debugfs;
1006#endif
1007
1008
1009 struct ieee80211_vif vif;
1010};
1011
1012static inline
1013struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
1014{
1015 return container_of(p, struct ieee80211_sub_if_data, vif);
1016}
1017
1018static inline void sdata_lock(struct ieee80211_sub_if_data *sdata)
1019 __acquires(&sdata->wdev.mtx)
1020{
1021 mutex_lock(&sdata->wdev.mtx);
1022 __acquire(&sdata->wdev.mtx);
1023}
1024
1025static inline void sdata_unlock(struct ieee80211_sub_if_data *sdata)
1026 __releases(&sdata->wdev.mtx)
1027{
1028 mutex_unlock(&sdata->wdev.mtx);
1029 __release(&sdata->wdev.mtx);
1030}
1031
1032#define sdata_dereference(p, sdata) \
1033 rcu_dereference_protected(p, lockdep_is_held(&sdata->wdev.mtx))
1034
1035static inline void
1036sdata_assert_lock(struct ieee80211_sub_if_data *sdata)
1037{
1038 lockdep_assert_held(&sdata->wdev.mtx);
1039}
1040
1041static inline int
1042ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef)
1043{
1044 switch (chandef->width) {
1045 case NL80211_CHAN_WIDTH_5:
1046 return 2;
1047 case NL80211_CHAN_WIDTH_10:
1048 return 1;
1049 default:
1050 return 0;
1051 }
1052}
1053
1054static inline int
1055ieee80211_vif_get_shift(struct ieee80211_vif *vif)
1056{
1057 struct ieee80211_chanctx_conf *chanctx_conf;
1058 int shift = 0;
1059
1060 rcu_read_lock();
1061 chanctx_conf = rcu_dereference(vif->chanctx_conf);
1062 if (chanctx_conf)
1063 shift = ieee80211_chandef_get_shift(&chanctx_conf->def);
1064 rcu_read_unlock();
1065
1066 return shift;
1067}
1068
1069enum {
1070 IEEE80211_RX_MSG = 1,
1071 IEEE80211_TX_STATUS_MSG = 2,
1072};
1073
1074enum queue_stop_reason {
1075 IEEE80211_QUEUE_STOP_REASON_DRIVER,
1076 IEEE80211_QUEUE_STOP_REASON_PS,
1077 IEEE80211_QUEUE_STOP_REASON_CSA,
1078 IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
1079 IEEE80211_QUEUE_STOP_REASON_SUSPEND,
1080 IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
1081 IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL,
1082 IEEE80211_QUEUE_STOP_REASON_FLUSH,
1083 IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN,
1084 IEEE80211_QUEUE_STOP_REASON_RESERVE_TID,
1085
1086 IEEE80211_QUEUE_STOP_REASONS,
1087};
1088
1089#ifdef CONFIG_MAC80211_LEDS
1090struct tpt_led_trigger {
1091 char name[32];
1092 const struct ieee80211_tpt_blink *blink_table;
1093 unsigned int blink_table_len;
1094 struct timer_list timer;
1095 struct ieee80211_local *local;
1096 unsigned long prev_traffic;
1097 unsigned long tx_bytes, rx_bytes;
1098 unsigned int active, want;
1099 bool running;
1100};
1101#endif
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119enum {
1120 SCAN_SW_SCANNING,
1121 SCAN_HW_SCANNING,
1122 SCAN_ONCHANNEL_SCANNING,
1123 SCAN_COMPLETED,
1124 SCAN_ABORTED,
1125 SCAN_HW_CANCELLED,
1126};
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141enum mac80211_scan_state {
1142 SCAN_DECISION,
1143 SCAN_SET_CHANNEL,
1144 SCAN_SEND_PROBE,
1145 SCAN_SUSPEND,
1146 SCAN_RESUME,
1147 SCAN_ABORT,
1148};
1149
1150struct ieee80211_local {
1151
1152
1153
1154 struct ieee80211_hw hw;
1155
1156 struct fq fq;
1157 struct codel_vars *cvars;
1158 struct codel_params cparams;
1159
1160
1161 spinlock_t active_txq_lock[IEEE80211_NUM_ACS];
1162 struct list_head active_txqs[IEEE80211_NUM_ACS];
1163 u16 schedule_round[IEEE80211_NUM_ACS];
1164
1165 u16 airtime_flags;
1166 u32 aql_txq_limit_low[IEEE80211_NUM_ACS];
1167 u32 aql_txq_limit_high[IEEE80211_NUM_ACS];
1168 u32 aql_threshold;
1169 atomic_t aql_total_pending_airtime;
1170
1171 const struct ieee80211_ops *ops;
1172
1173
1174
1175
1176
1177 struct workqueue_struct *workqueue;
1178
1179 unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
1180 int q_stop_reasons[IEEE80211_MAX_QUEUES][IEEE80211_QUEUE_STOP_REASONS];
1181
1182 spinlock_t queue_stop_reason_lock;
1183
1184 int open_count;
1185 int monitors, cooked_mntrs;
1186
1187 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
1188 fif_probe_req;
1189 bool probe_req_reg;
1190 bool rx_mcast_action_reg;
1191 unsigned int filter_flags;
1192
1193 bool wiphy_ciphers_allocated;
1194
1195 bool use_chanctx;
1196
1197
1198 spinlock_t filter_lock;
1199
1200
1201 struct work_struct reconfig_filter;
1202
1203
1204 struct netdev_hw_addr_list mc_list;
1205
1206 bool tim_in_locked_section;
1207
1208
1209
1210
1211
1212
1213
1214 bool suspended;
1215
1216
1217
1218
1219
1220
1221
1222 bool resuming;
1223
1224
1225
1226
1227
1228 bool quiescing;
1229
1230
1231 bool started;
1232
1233
1234 bool in_reconfig;
1235
1236
1237 bool wowlan;
1238
1239 struct work_struct radar_detected_work;
1240
1241
1242 u8 rx_chains;
1243
1244
1245 u8 sband_allocated;
1246
1247 int tx_headroom;
1248
1249
1250
1251
1252
1253#define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
1254 struct tasklet_struct tasklet;
1255 struct sk_buff_head skb_queue;
1256 struct sk_buff_head skb_queue_unreliable;
1257
1258 spinlock_t rx_path_lock;
1259
1260
1261
1262
1263
1264
1265 struct mutex sta_mtx;
1266 spinlock_t tim_lock;
1267 unsigned long num_sta;
1268 struct list_head sta_list;
1269 struct rhltable sta_hash;
1270 struct timer_list sta_cleanup;
1271 int sta_generation;
1272
1273 struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
1274 struct tasklet_struct tx_pending_tasklet;
1275 struct tasklet_struct wake_txqs_tasklet;
1276
1277 atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES];
1278
1279
1280 atomic_t iff_allmultis;
1281
1282 struct rate_control_ref *rate_ctrl;
1283
1284 struct arc4_ctx wep_tx_ctx;
1285 struct arc4_ctx wep_rx_ctx;
1286 u32 wep_iv;
1287
1288
1289 struct list_head interfaces;
1290 struct list_head mon_list;
1291 struct mutex iflist_mtx;
1292
1293
1294
1295
1296
1297 struct mutex key_mtx;
1298
1299
1300 struct mutex mtx;
1301
1302
1303 unsigned long scanning;
1304 struct cfg80211_ssid scan_ssid;
1305 struct cfg80211_scan_request *int_scan_req;
1306 struct cfg80211_scan_request __rcu *scan_req;
1307 struct ieee80211_scan_request *hw_scan_req;
1308 struct cfg80211_chan_def scan_chandef;
1309 enum nl80211_band hw_scan_band;
1310 int scan_channel_idx;
1311 int scan_ies_len;
1312 int hw_scan_ies_bufsize;
1313 struct cfg80211_scan_info scan_info;
1314
1315 struct work_struct sched_scan_stopped_work;
1316 struct ieee80211_sub_if_data __rcu *sched_scan_sdata;
1317 struct cfg80211_sched_scan_request __rcu *sched_scan_req;
1318 u8 scan_addr[ETH_ALEN];
1319
1320 unsigned long leave_oper_channel_time;
1321 enum mac80211_scan_state next_scan_state;
1322 struct delayed_work scan_work;
1323 struct ieee80211_sub_if_data __rcu *scan_sdata;
1324
1325 struct cfg80211_chan_def _oper_chandef;
1326
1327
1328 struct ieee80211_channel *tmp_channel;
1329
1330
1331 struct list_head chanctx_list;
1332 struct mutex chanctx_mtx;
1333
1334#ifdef CONFIG_MAC80211_LEDS
1335 struct led_trigger tx_led, rx_led, assoc_led, radio_led;
1336 struct led_trigger tpt_led;
1337 atomic_t tx_led_active, rx_led_active, assoc_led_active;
1338 atomic_t radio_led_active, tpt_led_active;
1339 struct tpt_led_trigger *tpt_led_trigger;
1340#endif
1341
1342#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
1343
1344
1345 u32 dot11TransmittedFragmentCount;
1346 u32 dot11MulticastTransmittedFrameCount;
1347 u32 dot11FailedCount;
1348 u32 dot11RetryCount;
1349 u32 dot11MultipleRetryCount;
1350 u32 dot11FrameDuplicateCount;
1351 u32 dot11ReceivedFragmentCount;
1352 u32 dot11MulticastReceivedFrameCount;
1353 u32 dot11TransmittedFrameCount;
1354
1355
1356 unsigned int tx_handlers_drop;
1357 unsigned int tx_handlers_queued;
1358 unsigned int tx_handlers_drop_wep;
1359 unsigned int tx_handlers_drop_not_assoc;
1360 unsigned int tx_handlers_drop_unauth_port;
1361 unsigned int rx_handlers_drop;
1362 unsigned int rx_handlers_queued;
1363 unsigned int rx_handlers_drop_nullfunc;
1364 unsigned int rx_handlers_drop_defrag;
1365 unsigned int tx_expand_skb_head;
1366 unsigned int tx_expand_skb_head_cloned;
1367 unsigned int rx_expand_skb_head_defrag;
1368 unsigned int rx_handlers_fragments;
1369 unsigned int tx_status_drop;
1370#define I802_DEBUG_INC(c) (c)++
1371#else
1372#define I802_DEBUG_INC(c) do { } while (0)
1373#endif
1374
1375
1376 int total_ps_buffered;
1377
1378
1379
1380 bool pspolling;
1381
1382
1383
1384
1385 struct ieee80211_sub_if_data *ps_sdata;
1386 struct work_struct dynamic_ps_enable_work;
1387 struct work_struct dynamic_ps_disable_work;
1388 struct timer_list dynamic_ps_timer;
1389 struct notifier_block ifa_notifier;
1390 struct notifier_block ifa6_notifier;
1391
1392
1393
1394
1395
1396 int dynamic_ps_forced_timeout;
1397
1398 int user_power_level;
1399
1400 enum ieee80211_smps_mode smps_mode;
1401
1402 struct work_struct restart_work;
1403
1404#ifdef CONFIG_MAC80211_DEBUGFS
1405 struct local_debugfsdentries {
1406 struct dentry *rcdir;
1407 struct dentry *keys;
1408 } debugfs;
1409 bool force_tx_status;
1410#endif
1411
1412
1413
1414
1415 struct delayed_work roc_work;
1416 struct list_head roc_list;
1417 struct work_struct hw_roc_start, hw_roc_done;
1418 unsigned long hw_roc_start_time;
1419 u64 roc_cookie_counter;
1420
1421 struct idr ack_status_frames;
1422 spinlock_t ack_status_lock;
1423
1424 struct ieee80211_sub_if_data __rcu *p2p_sdata;
1425
1426
1427 struct ieee80211_sub_if_data __rcu *monitor_sdata;
1428 struct cfg80211_chan_def monitor_chandef;
1429
1430
1431 u8 ext_capa[8];
1432
1433
1434 struct work_struct tdls_chsw_work;
1435 struct sk_buff_head skb_queue_tdls_chsw;
1436};
1437
1438static inline struct ieee80211_sub_if_data *
1439IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
1440{
1441 return netdev_priv(dev);
1442}
1443
1444static inline struct ieee80211_sub_if_data *
1445IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev)
1446{
1447 return container_of(wdev, struct ieee80211_sub_if_data, wdev);
1448}
1449
1450static inline struct ieee80211_supported_band *
1451ieee80211_get_sband(struct ieee80211_sub_if_data *sdata)
1452{
1453 struct ieee80211_local *local = sdata->local;
1454 struct ieee80211_chanctx_conf *chanctx_conf;
1455 enum nl80211_band band;
1456
1457 rcu_read_lock();
1458 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
1459
1460 if (WARN_ON_ONCE(!chanctx_conf)) {
1461 rcu_read_unlock();
1462 return NULL;
1463 }
1464
1465 band = chanctx_conf->def.chan->band;
1466 rcu_read_unlock();
1467
1468 return local->hw.wiphy->bands[band];
1469}
1470
1471
1472struct ieee80211_csa_ie {
1473 struct cfg80211_chan_def chandef;
1474 u8 mode;
1475 u8 count;
1476 u8 ttl;
1477 u16 pre_value;
1478 u16 reason_code;
1479 u32 max_switch_time;
1480};
1481
1482
1483struct ieee802_11_elems {
1484 const u8 *ie_start;
1485 size_t total_len;
1486
1487
1488 const struct ieee80211_tdls_lnkie *lnk_id;
1489 const struct ieee80211_ch_switch_timing *ch_sw_timing;
1490 const u8 *ext_capab;
1491 const u8 *ssid;
1492 const u8 *supp_rates;
1493 const u8 *ds_params;
1494 const struct ieee80211_tim_ie *tim;
1495 const u8 *challenge;
1496 const u8 *rsn;
1497 const u8 *rsnx;
1498 const u8 *erp_info;
1499 const u8 *ext_supp_rates;
1500 const u8 *wmm_info;
1501 const u8 *wmm_param;
1502 const struct ieee80211_ht_cap *ht_cap_elem;
1503 const struct ieee80211_ht_operation *ht_operation;
1504 const struct ieee80211_vht_cap *vht_cap_elem;
1505 const struct ieee80211_vht_operation *vht_operation;
1506 const struct ieee80211_meshconf_ie *mesh_config;
1507 const u8 *he_cap;
1508 const struct ieee80211_he_operation *he_operation;
1509 const struct ieee80211_he_spr *he_spr;
1510 const struct ieee80211_mu_edca_param_set *mu_edca_param_set;
1511 const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1512 const u8 *uora_element;
1513 const u8 *mesh_id;
1514 const u8 *peering;
1515 const __le16 *awake_window;
1516 const u8 *preq;
1517 const u8 *prep;
1518 const u8 *perr;
1519 const struct ieee80211_rann_ie *rann;
1520 const struct ieee80211_channel_sw_ie *ch_switch_ie;
1521 const struct ieee80211_ext_chansw_ie *ext_chansw_ie;
1522 const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie;
1523 const u8 *max_channel_switch_time;
1524 const u8 *country_elem;
1525 const u8 *pwr_constr_elem;
1526 const u8 *cisco_dtpc_elem;
1527 const struct ieee80211_timeout_interval_ie *timeout_int;
1528 const u8 *opmode_notif;
1529 const struct ieee80211_sec_chan_offs_ie *sec_chan_offs;
1530 struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie;
1531 const struct ieee80211_bss_max_idle_period_ie *max_idle_period_ie;
1532 const struct ieee80211_multiple_bssid_configuration *mbssid_config_ie;
1533 const struct ieee80211_bssid_index *bssid_index;
1534 u8 max_bssid_indicator;
1535 u8 dtim_count;
1536 u8 dtim_period;
1537 const struct ieee80211_addba_ext_ie *addba_ext_ie;
1538 const struct ieee80211_s1g_cap *s1g_capab;
1539 const struct ieee80211_s1g_oper_ie *s1g_oper;
1540 const struct ieee80211_s1g_bcn_compat_ie *s1g_bcn_compat;
1541 const struct ieee80211_aid_response_ie *aid_resp;
1542
1543
1544 u8 ext_capab_len;
1545 u8 ssid_len;
1546 u8 supp_rates_len;
1547 u8 tim_len;
1548 u8 challenge_len;
1549 u8 rsn_len;
1550 u8 rsnx_len;
1551 u8 ext_supp_rates_len;
1552 u8 wmm_info_len;
1553 u8 wmm_param_len;
1554 u8 he_cap_len;
1555 u8 mesh_id_len;
1556 u8 peering_len;
1557 u8 preq_len;
1558 u8 prep_len;
1559 u8 perr_len;
1560 u8 country_elem_len;
1561 u8 bssid_index_len;
1562
1563
1564 bool parse_error;
1565};
1566
1567static inline struct ieee80211_local *hw_to_local(
1568 struct ieee80211_hw *hw)
1569{
1570 return container_of(hw, struct ieee80211_local, hw);
1571}
1572
1573static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
1574{
1575 return container_of(txq, struct txq_info, txq);
1576}
1577
1578static inline bool txq_has_queue(struct ieee80211_txq *txq)
1579{
1580 struct txq_info *txqi = to_txq_info(txq);
1581
1582 return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets);
1583}
1584
1585static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
1586{
1587 return ether_addr_equal(raddr, addr) ||
1588 is_broadcast_ether_addr(raddr);
1589}
1590
1591static inline bool
1592ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status)
1593{
1594 WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START &&
1595 status->flag & RX_FLAG_MACTIME_END);
1596 if (status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END))
1597 return true;
1598
1599 if (status->flag & RX_FLAG_MACTIME_PLCP_START &&
1600 status->encoding == RX_ENC_LEGACY)
1601 return true;
1602 return false;
1603}
1604
1605void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata);
1606void ieee80211_vif_dec_num_mcast(struct ieee80211_sub_if_data *sdata);
1607
1608
1609
1610
1611
1612static inline int
1613ieee80211_vif_get_num_mcast_if(struct ieee80211_sub_if_data *sdata)
1614{
1615 if (sdata->vif.type == NL80211_IFTYPE_AP)
1616 return atomic_read(&sdata->u.ap.num_mcast_sta);
1617 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta)
1618 return atomic_read(&sdata->u.vlan.num_mcast_sta);
1619 return -1;
1620}
1621
1622u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
1623 struct ieee80211_rx_status *status,
1624 unsigned int mpdu_len,
1625 unsigned int mpdu_offset);
1626int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
1627void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
1628void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
1629 u32 changed);
1630void ieee80211_configure_filter(struct ieee80211_local *local);
1631u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
1632
1633u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local);
1634int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb,
1635 u64 *cookie, gfp_t gfp);
1636
1637void ieee80211_check_fast_rx(struct sta_info *sta);
1638void __ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata);
1639void ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata);
1640void ieee80211_clear_fast_rx(struct sta_info *sta);
1641
1642
1643void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
1644int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
1645 struct cfg80211_auth_request *req);
1646int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
1647 struct cfg80211_assoc_request *req);
1648int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
1649 struct cfg80211_deauth_request *req);
1650int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
1651 struct cfg80211_disassoc_request *req);
1652void ieee80211_send_pspoll(struct ieee80211_local *local,
1653 struct ieee80211_sub_if_data *sdata);
1654void ieee80211_recalc_ps(struct ieee80211_local *local);
1655void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata);
1656int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);
1657void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
1658void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1659 struct sk_buff *skb);
1660void ieee80211_sta_rx_queued_ext(struct ieee80211_sub_if_data *sdata,
1661 struct sk_buff *skb);
1662void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
1663void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
1664void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata);
1665void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata,
1666 __le16 fc, bool acked);
1667void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata);
1668void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
1669void ieee80211_sta_handle_tspec_ac_params(struct ieee80211_sub_if_data *sdata);
1670
1671
1672void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
1673void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
1674void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
1675 const u8 *bssid, const u8 *addr, u32 supp_rates);
1676int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
1677 struct cfg80211_ibss_params *params);
1678int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
1679void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata);
1680void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1681 struct sk_buff *skb);
1682int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
1683 struct cfg80211_csa_settings *csa_settings);
1684int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata);
1685void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata);
1686
1687
1688void ieee80211_ocb_work(struct ieee80211_sub_if_data *sdata);
1689void ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data *sdata,
1690 const u8 *bssid, const u8 *addr, u32 supp_rates);
1691void ieee80211_ocb_setup_sdata(struct ieee80211_sub_if_data *sdata);
1692int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata,
1693 struct ocb_setup *setup);
1694int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata);
1695
1696
1697void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata);
1698void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1699 struct sk_buff *skb);
1700int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata,
1701 struct cfg80211_csa_settings *csa_settings);
1702int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata);
1703
1704
1705void ieee80211_scan_work(struct work_struct *work);
1706int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
1707 const u8 *ssid, u8 ssid_len,
1708 struct ieee80211_channel **channels,
1709 unsigned int n_channels,
1710 enum nl80211_bss_scan_width scan_width);
1711int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
1712 struct cfg80211_scan_request *req);
1713void ieee80211_scan_cancel(struct ieee80211_local *local);
1714void ieee80211_run_deferred_scan(struct ieee80211_local *local);
1715void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb);
1716
1717void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
1718struct ieee80211_bss *
1719ieee80211_bss_info_update(struct ieee80211_local *local,
1720 struct ieee80211_rx_status *rx_status,
1721 struct ieee80211_mgmt *mgmt,
1722 size_t len,
1723 struct ieee80211_channel *channel);
1724void ieee80211_rx_bss_put(struct ieee80211_local *local,
1725 struct ieee80211_bss *bss);
1726
1727
1728int
1729__ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
1730 struct cfg80211_sched_scan_request *req);
1731int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
1732 struct cfg80211_sched_scan_request *req);
1733int ieee80211_request_sched_scan_stop(struct ieee80211_local *local);
1734void ieee80211_sched_scan_end(struct ieee80211_local *local);
1735void ieee80211_sched_scan_stopped_work(struct work_struct *work);
1736
1737
1738void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local);
1739void ieee80211_offchannel_return(struct ieee80211_local *local);
1740void ieee80211_roc_setup(struct ieee80211_local *local);
1741void ieee80211_start_next_roc(struct ieee80211_local *local);
1742void ieee80211_roc_purge(struct ieee80211_local *local,
1743 struct ieee80211_sub_if_data *sdata);
1744int ieee80211_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
1745 struct ieee80211_channel *chan,
1746 unsigned int duration, u64 *cookie);
1747int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
1748 struct wireless_dev *wdev, u64 cookie);
1749int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
1750 struct cfg80211_mgmt_tx_params *params, u64 *cookie);
1751int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
1752 struct wireless_dev *wdev, u64 cookie);
1753
1754
1755void ieee80211_csa_finalize_work(struct work_struct *work);
1756int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
1757 struct cfg80211_csa_settings *params);
1758
1759
1760#define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \
1761 NETIF_F_HW_CSUM | NETIF_F_SG | \
1762 NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE)
1763#define MAC80211_SUPPORTED_FEATURES_RX (NETIF_F_RXCSUM)
1764#define MAC80211_SUPPORTED_FEATURES (MAC80211_SUPPORTED_FEATURES_TX | \
1765 MAC80211_SUPPORTED_FEATURES_RX)
1766
1767int ieee80211_iface_init(void);
1768void ieee80211_iface_exit(void);
1769int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1770 unsigned char name_assign_type,
1771 struct wireless_dev **new_wdev, enum nl80211_iftype type,
1772 struct vif_params *params);
1773int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
1774 enum nl80211_iftype type);
1775void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
1776void ieee80211_remove_interfaces(struct ieee80211_local *local);
1777u32 ieee80211_idle_off(struct ieee80211_local *local);
1778void ieee80211_recalc_idle(struct ieee80211_local *local);
1779void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
1780 const int offset);
1781int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up);
1782void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata);
1783int ieee80211_add_virtual_monitor(struct ieee80211_local *local);
1784void ieee80211_del_virtual_monitor(struct ieee80211_local *local);
1785
1786bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata);
1787void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata,
1788 bool update_bss);
1789void ieee80211_recalc_offload(struct ieee80211_local *local);
1790
1791static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
1792{
1793 return test_bit(SDATA_STATE_RUNNING, &sdata->state);
1794}
1795
1796
1797void ieee80211_clear_tx_pending(struct ieee80211_local *local);
1798void ieee80211_tx_pending(unsigned long data);
1799netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
1800 struct net_device *dev);
1801netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1802 struct net_device *dev);
1803netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb,
1804 struct net_device *dev);
1805void __ieee80211_subif_start_xmit(struct sk_buff *skb,
1806 struct net_device *dev,
1807 u32 info_flags,
1808 u32 ctrl_flags,
1809 u64 *cookie);
1810void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
1811 struct sk_buff_head *skbs);
1812struct sk_buff *
1813ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
1814 struct sk_buff *skb, u32 info_flags);
1815void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
1816 struct ieee80211_supported_band *sband,
1817 int retry_count, int shift, bool send_to_cooked,
1818 struct ieee80211_tx_status *status);
1819
1820void ieee80211_check_fast_xmit(struct sta_info *sta);
1821void ieee80211_check_fast_xmit_all(struct ieee80211_local *local);
1822void ieee80211_check_fast_xmit_iface(struct ieee80211_sub_if_data *sdata);
1823void ieee80211_clear_fast_xmit(struct sta_info *sta);
1824int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
1825 const u8 *buf, size_t len,
1826 const u8 *dest, __be16 proto, bool unencrypted,
1827 u64 *cookie);
1828int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,
1829 const u8 *buf, size_t len);
1830
1831
1832void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
1833 struct ieee80211_sta_ht_cap *ht_cap);
1834bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
1835 struct ieee80211_supported_band *sband,
1836 const struct ieee80211_ht_cap *ht_cap_ie,
1837 struct sta_info *sta);
1838void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
1839 const u8 *da, u16 tid,
1840 u16 initiator, u16 reason_code);
1841int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
1842 enum ieee80211_smps_mode smps, const u8 *da,
1843 const u8 *bssid);
1844void ieee80211_request_smps_ap_work(struct work_struct *work);
1845void ieee80211_request_smps_mgd_work(struct work_struct *work);
1846bool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old,
1847 enum ieee80211_smps_mode smps_mode_new);
1848
1849void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
1850 u16 initiator, u16 reason, bool stop);
1851void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
1852 u16 initiator, u16 reason, bool stop);
1853void ___ieee80211_start_rx_ba_session(struct sta_info *sta,
1854 u8 dialog_token, u16 timeout,
1855 u16 start_seq_num, u16 ba_policy, u16 tid,
1856 u16 buf_size, bool tx, bool auto_seq,
1857 const struct ieee80211_addba_ext_ie *addbaext);
1858void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
1859 enum ieee80211_agg_stop_reason reason);
1860void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
1861 struct sta_info *sta,
1862 struct ieee80211_mgmt *mgmt, size_t len);
1863void ieee80211_process_addba_resp(struct ieee80211_local *local,
1864 struct sta_info *sta,
1865 struct ieee80211_mgmt *mgmt,
1866 size_t len);
1867void ieee80211_process_addba_request(struct ieee80211_local *local,
1868 struct sta_info *sta,
1869 struct ieee80211_mgmt *mgmt,
1870 size_t len);
1871
1872int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
1873 enum ieee80211_agg_stop_reason reason);
1874int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
1875 enum ieee80211_agg_stop_reason reason);
1876void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid,
1877 struct tid_ampdu_tx *tid_tx);
1878void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid,
1879 struct tid_ampdu_tx *tid_tx);
1880void ieee80211_ba_session_work(struct work_struct *work);
1881void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
1882void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
1883
1884u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs);
1885enum nl80211_smps_mode
1886ieee80211_smps_mode_to_smps_mode(enum ieee80211_smps_mode smps);
1887
1888
1889void
1890ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
1891 struct ieee80211_supported_band *sband,
1892 const struct ieee80211_vht_cap *vht_cap_ie,
1893 struct sta_info *sta);
1894enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta);
1895enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta);
1896void ieee80211_sta_set_rx_nss(struct sta_info *sta);
1897enum ieee80211_sta_rx_bandwidth
1898ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width);
1899enum nl80211_chan_width ieee80211_sta_cap_chan_bw(struct sta_info *sta);
1900void ieee80211_sta_set_rx_nss(struct sta_info *sta);
1901void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata,
1902 struct ieee80211_mgmt *mgmt);
1903u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
1904 struct sta_info *sta, u8 opmode,
1905 enum nl80211_band band);
1906void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
1907 struct sta_info *sta, u8 opmode,
1908 enum nl80211_band band);
1909void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata,
1910 struct ieee80211_sta_vht_cap *vht_cap);
1911void ieee80211_get_vht_mask_from_cap(__le16 vht_cap,
1912 u16 vht_mask[NL80211_VHT_NSS_MAX]);
1913enum nl80211_chan_width
1914ieee80211_sta_rx_bw_to_chan_width(struct sta_info *sta);
1915
1916
1917void
1918ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
1919 struct ieee80211_supported_band *sband,
1920 const u8 *he_cap_ie, u8 he_cap_len,
1921 const struct ieee80211_he_6ghz_capa *he_6ghz_capa,
1922 struct sta_info *sta);
1923void
1924ieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif,
1925 const struct ieee80211_he_spr *he_spr_ie_elem);
1926
1927void
1928ieee80211_he_op_ie_to_bss_conf(struct ieee80211_vif *vif,
1929 const struct ieee80211_he_operation *he_op_ie_elem);
1930
1931
1932void ieee80211_s1g_sta_rate_init(struct sta_info *sta);
1933
1934
1935void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
1936 struct ieee80211_mgmt *mgmt,
1937 size_t len);
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
1956 struct ieee802_11_elems *elems,
1957 enum nl80211_band current_band,
1958 u32 vht_cap_info,
1959 u32 sta_flags, u8 *bssid,
1960 struct ieee80211_csa_ie *csa_ie);
1961
1962
1963int ieee80211_reconfig(struct ieee80211_local *local);
1964void ieee80211_stop_device(struct ieee80211_local *local);
1965
1966int __ieee80211_suspend(struct ieee80211_hw *hw,
1967 struct cfg80211_wowlan *wowlan);
1968
1969static inline int __ieee80211_resume(struct ieee80211_hw *hw)
1970{
1971 struct ieee80211_local *local = hw_to_local(hw);
1972
1973 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning) &&
1974 !test_bit(SCAN_COMPLETED, &local->scanning),
1975 "%s: resume with hardware scan still in progress\n",
1976 wiphy_name(hw->wiphy));
1977
1978 return ieee80211_reconfig(hw_to_local(hw));
1979}
1980
1981
1982extern const void *const mac80211_wiphy_privid;
1983int ieee80211_frame_duration(enum nl80211_band band, size_t len,
1984 int rate, int erp, int short_preamble,
1985 int shift);
1986void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata,
1987 struct ieee80211_tx_queue_params *qparam,
1988 int ac);
1989void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
1990 bool bss_notify, bool enable_qos);
1991void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1992 struct sta_info *sta, struct sk_buff *skb);
1993
1994void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
1995 struct sk_buff *skb, int tid,
1996 enum nl80211_band band);
1997
1998
1999int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
2000 struct sk_buff *skb,
2001 struct sta_info **sta_out);
2002
2003static inline void
2004ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
2005 struct sk_buff *skb, int tid,
2006 enum nl80211_band band)
2007{
2008 rcu_read_lock();
2009 __ieee80211_tx_skb_tid_band(sdata, skb, tid, band);
2010 rcu_read_unlock();
2011}
2012
2013static inline void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
2014 struct sk_buff *skb, int tid)
2015{
2016 struct ieee80211_chanctx_conf *chanctx_conf;
2017
2018 rcu_read_lock();
2019 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2020 if (WARN_ON(!chanctx_conf)) {
2021 rcu_read_unlock();
2022 kfree_skb(skb);
2023 return;
2024 }
2025
2026 __ieee80211_tx_skb_tid_band(sdata, skb, tid,
2027 chanctx_conf->def.chan->band);
2028 rcu_read_unlock();
2029}
2030
2031static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,
2032 struct sk_buff *skb)
2033{
2034
2035 ieee80211_tx_skb_tid(sdata, skb, 7);
2036}
2037
2038u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
2039 struct ieee802_11_elems *elems,
2040 u64 filter, u32 crc, u8 *transmitter_bssid,
2041 u8 *bss_bssid);
2042static inline void ieee802_11_parse_elems(const u8 *start, size_t len,
2043 bool action,
2044 struct ieee802_11_elems *elems,
2045 u8 *transmitter_bssid,
2046 u8 *bss_bssid)
2047{
2048 ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0,
2049 transmitter_bssid, bss_bssid);
2050}
2051
2052
2053extern const int ieee802_1d_to_ac[8];
2054
2055static inline int ieee80211_ac_from_tid(int tid)
2056{
2057 return ieee802_1d_to_ac[tid & 7];
2058}
2059
2060void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
2061void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
2062void ieee80211_dynamic_ps_timer(struct timer_list *t);
2063void ieee80211_send_nullfunc(struct ieee80211_local *local,
2064 struct ieee80211_sub_if_data *sdata,
2065 bool powersave);
2066void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
2067 struct ieee80211_hdr *hdr, bool ack, u16 tx_time);
2068
2069void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
2070 unsigned long queues,
2071 enum queue_stop_reason reason,
2072 bool refcounted);
2073void ieee80211_stop_vif_queues(struct ieee80211_local *local,
2074 struct ieee80211_sub_if_data *sdata,
2075 enum queue_stop_reason reason);
2076void ieee80211_wake_vif_queues(struct ieee80211_local *local,
2077 struct ieee80211_sub_if_data *sdata,
2078 enum queue_stop_reason reason);
2079void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
2080 unsigned long queues,
2081 enum queue_stop_reason reason,
2082 bool refcounted);
2083void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
2084 enum queue_stop_reason reason,
2085 bool refcounted);
2086void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
2087 enum queue_stop_reason reason,
2088 bool refcounted);
2089void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue);
2090void ieee80211_add_pending_skb(struct ieee80211_local *local,
2091 struct sk_buff *skb);
2092void ieee80211_add_pending_skbs(struct ieee80211_local *local,
2093 struct sk_buff_head *skbs);
2094void ieee80211_flush_queues(struct ieee80211_local *local,
2095 struct ieee80211_sub_if_data *sdata, bool drop);
2096void __ieee80211_flush_queues(struct ieee80211_local *local,
2097 struct ieee80211_sub_if_data *sdata,
2098 unsigned int queues, bool drop);
2099
2100static inline bool ieee80211_can_run_worker(struct ieee80211_local *local)
2101{
2102
2103
2104
2105
2106 if (local->in_reconfig)
2107 return false;
2108
2109
2110
2111
2112
2113
2114
2115 if (local->quiescing)
2116 return false;
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131 if (local->suspended)
2132 return false;
2133
2134 return true;
2135}
2136
2137int ieee80211_txq_setup_flows(struct ieee80211_local *local);
2138void ieee80211_txq_set_params(struct ieee80211_local *local);
2139void ieee80211_txq_teardown_flows(struct ieee80211_local *local);
2140void ieee80211_txq_init(struct ieee80211_sub_if_data *sdata,
2141 struct sta_info *sta,
2142 struct txq_info *txq, int tid);
2143void ieee80211_txq_purge(struct ieee80211_local *local,
2144 struct txq_info *txqi);
2145void ieee80211_txq_remove_vlan(struct ieee80211_local *local,
2146 struct ieee80211_sub_if_data *sdata);
2147void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats,
2148 struct txq_info *txqi);
2149void ieee80211_wake_txqs(unsigned long data);
2150void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
2151 u16 transaction, u16 auth_alg, u16 status,
2152 const u8 *extra, size_t extra_len, const u8 *bssid,
2153 const u8 *da, const u8 *key, u8 key_len, u8 key_idx,
2154 u32 tx_flags);
2155void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
2156 const u8 *da, const u8 *bssid,
2157 u16 stype, u16 reason,
2158 bool send_frame, u8 *frame_buf);
2159
2160enum {
2161 IEEE80211_PROBE_FLAG_DIRECTED = BIT(0),
2162 IEEE80211_PROBE_FLAG_MIN_CONTENT = BIT(1),
2163 IEEE80211_PROBE_FLAG_RANDOM_SN = BIT(2),
2164};
2165
2166int ieee80211_build_preq_ies(struct ieee80211_sub_if_data *sdata, u8 *buffer,
2167 size_t buffer_len,
2168 struct ieee80211_scan_ies *ie_desc,
2169 const u8 *ie, size_t ie_len,
2170 u8 bands_used, u32 *rate_masks,
2171 struct cfg80211_chan_def *chandef,
2172 u32 flags);
2173struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
2174 const u8 *src, const u8 *dst,
2175 u32 ratemask,
2176 struct ieee80211_channel *chan,
2177 const u8 *ssid, size_t ssid_len,
2178 const u8 *ie, size_t ie_len,
2179 u32 flags);
2180u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
2181 struct ieee802_11_elems *elems,
2182 enum nl80211_band band, u32 *basic_rates);
2183int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,
2184 enum ieee80211_smps_mode smps_mode);
2185void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata);
2186void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata);
2187
2188size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
2189u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
2190 u16 cap);
2191u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
2192 const struct cfg80211_chan_def *chandef,
2193 u16 prot_mode, bool rifs_mode);
2194void ieee80211_ie_build_wide_bw_cs(u8 *pos,
2195 const struct cfg80211_chan_def *chandef);
2196u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
2197 u32 cap);
2198u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
2199 const struct cfg80211_chan_def *chandef);
2200u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype);
2201u8 *ieee80211_ie_build_he_cap(u8 *pos,
2202 const struct ieee80211_sta_he_cap *he_cap,
2203 u8 *end);
2204void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata,
2205 struct sk_buff *skb);
2206u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef);
2207int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef,
2208 const struct ieee80211_supported_band *sband,
2209 const u8 *srates, int srates_len, u32 *rates);
2210int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
2211 struct sk_buff *skb, bool need_basic,
2212 enum nl80211_band band);
2213int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,
2214 struct sk_buff *skb, bool need_basic,
2215 enum nl80211_band band);
2216u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo);
2217void ieee80211_add_s1g_capab_ie(struct ieee80211_sub_if_data *sdata,
2218 struct ieee80211_sta_s1g_cap *caps,
2219 struct sk_buff *skb);
2220void ieee80211_add_aid_request_ie(struct ieee80211_sub_if_data *sdata,
2221 struct sk_buff *skb);
2222
2223
2224bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper,
2225 struct cfg80211_chan_def *chandef);
2226bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw, u32 vht_cap_info,
2227 const struct ieee80211_vht_operation *oper,
2228 const struct ieee80211_ht_operation *htop,
2229 struct cfg80211_chan_def *chandef);
2230bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata,
2231 const struct ieee80211_he_operation *he_oper,
2232 struct cfg80211_chan_def *chandef);
2233bool ieee80211_chandef_s1g_oper(const struct ieee80211_s1g_oper_ie *oper,
2234 struct cfg80211_chan_def *chandef);
2235u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c);
2236
2237int __must_check
2238ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
2239 const struct cfg80211_chan_def *chandef,
2240 enum ieee80211_chanctx_mode mode);
2241int __must_check
2242ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata,
2243 const struct cfg80211_chan_def *chandef,
2244 enum ieee80211_chanctx_mode mode,
2245 bool radar_required);
2246int __must_check
2247ieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data *sdata);
2248int ieee80211_vif_unreserve_chanctx(struct ieee80211_sub_if_data *sdata);
2249
2250int __must_check
2251ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata,
2252 const struct cfg80211_chan_def *chandef,
2253 u32 *changed);
2254void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata);
2255void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata);
2256void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata,
2257 bool clear);
2258int ieee80211_chanctx_refcount(struct ieee80211_local *local,
2259 struct ieee80211_chanctx *ctx);
2260
2261void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
2262 struct ieee80211_chanctx *chanctx);
2263void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local,
2264 struct ieee80211_chanctx *ctx);
2265bool ieee80211_is_radar_required(struct ieee80211_local *local);
2266
2267void ieee80211_dfs_cac_timer(unsigned long data);
2268void ieee80211_dfs_cac_timer_work(struct work_struct *work);
2269void ieee80211_dfs_cac_cancel(struct ieee80211_local *local);
2270void ieee80211_dfs_radar_detected_work(struct work_struct *work);
2271int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
2272 struct cfg80211_csa_settings *csa_settings);
2273
2274bool ieee80211_cs_valid(const struct ieee80211_cipher_scheme *cs);
2275bool ieee80211_cs_list_valid(const struct ieee80211_cipher_scheme *cs, int n);
2276const struct ieee80211_cipher_scheme *
2277ieee80211_cs_get(struct ieee80211_local *local, u32 cipher,
2278 enum nl80211_iftype iftype);
2279int ieee80211_cs_headroom(struct ieee80211_local *local,
2280 struct cfg80211_crypto_settings *crypto,
2281 enum nl80211_iftype iftype);
2282void ieee80211_recalc_dtim(struct ieee80211_local *local,
2283 struct ieee80211_sub_if_data *sdata);
2284int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
2285 const struct cfg80211_chan_def *chandef,
2286 enum ieee80211_chanctx_mode chanmode,
2287 u8 radar_detect);
2288int ieee80211_max_num_channels(struct ieee80211_local *local);
2289enum nl80211_chan_width ieee80211_get_sta_bw(struct ieee80211_sta *sta);
2290void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,
2291 struct ieee80211_chanctx *ctx);
2292
2293
2294int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
2295 const u8 *peer, u8 action_code, u8 dialog_token,
2296 u16 status_code, u32 peer_capability,
2297 bool initiator, const u8 *extra_ies,
2298 size_t extra_ies_len);
2299int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
2300 const u8 *peer, enum nl80211_tdls_operation oper);
2301void ieee80211_tdls_peer_del_work(struct work_struct *wk);
2302int ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev,
2303 const u8 *addr, u8 oper_class,
2304 struct cfg80211_chan_def *chandef);
2305void ieee80211_tdls_cancel_channel_switch(struct wiphy *wiphy,
2306 struct net_device *dev,
2307 const u8 *addr);
2308void ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata);
2309void ieee80211_tdls_chsw_work(struct work_struct *wk);
2310void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata,
2311 const u8 *peer, u16 reason);
2312const char *ieee80211_get_reason_code_string(u16 reason_code);
2313u16 ieee80211_encode_usf(int val);
2314u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
2315 enum nl80211_iftype type);
2316
2317extern const struct ethtool_ops ieee80211_ethtool_ops;
2318
2319u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
2320 struct ieee80211_vif *vif,
2321 struct ieee80211_sta *pubsta,
2322 int len, bool ampdu);
2323#ifdef CONFIG_MAC80211_NOINLINE
2324#define debug_noinline noinline
2325#else
2326#define debug_noinline
2327#endif
2328
2329#endif
2330