1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2f0706e82SJiri Benc /* 3f0706e82SJiri Benc * Copyright 2002-2005, Instant802 Networks, Inc. 4f0706e82SJiri Benc * Copyright 2005, Devicescape Software, Inc. 5f0706e82SJiri Benc * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 6026331c4SJouni Malinen * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> 742bd20d9SAviya Erenfeld * Copyright 2013-2015 Intel Mobile Communications GmbH 823a5f0afSJohannes Berg * Copyright (C) 2018-2022 Intel Corporation 9f0706e82SJiri Benc */ 10f0706e82SJiri Benc 11f0706e82SJiri Benc #ifndef IEEE80211_I_H 12f0706e82SJiri Benc #define IEEE80211_I_H 13f0706e82SJiri Benc 14f0706e82SJiri Benc #include <linux/kernel.h> 15f0706e82SJiri Benc #include <linux/device.h> 16f0706e82SJiri Benc #include <linux/if_ether.h> 17f0706e82SJiri Benc #include <linux/interrupt.h> 18f0706e82SJiri Benc #include <linux/list.h> 19f0706e82SJiri Benc #include <linux/netdevice.h> 20f0706e82SJiri Benc #include <linux/skbuff.h> 21f0706e82SJiri Benc #include <linux/workqueue.h> 22f0706e82SJiri Benc #include <linux/types.h> 23f0706e82SJiri Benc #include <linux/spinlock.h> 24571ecf67SJohannes Berg #include <linux/etherdevice.h> 25e1e54068SJohannes Berg #include <linux/leds.h> 26a729cff8SJohannes Berg #include <linux/idr.h> 277bedd0cfSJohannes Berg #include <linux/rhashtable.h> 28779969e3SJohannes Berg #include <linux/rbtree.h> 29fe7a5d5cSJohannes Berg #include <net/ieee80211_radiotap.h> 3093da9cc1Scolin@cozybit.com #include <net/cfg80211.h> 3151cb6db0SDavid S. Miller #include <net/mac80211.h> 32fa962b92SMichal Kazior #include <net/fq.h> 332c8dccc7SJohannes Berg #include "key.h" 34f0706e82SJiri Benc #include "sta_info.h" 35bdcbd8e0SJohannes Berg #include "debug.h" 36f0706e82SJiri Benc 373beea351SJohannes Berg extern const struct cfg80211_ops mac80211_config_ops; 383beea351SJohannes Berg 399cfb0009SJohannes Berg struct ieee80211_local; 40f0706e82SJiri Benc 41f0706e82SJiri Benc /* Maximum number of broadcast/multicast frames to buffer when some of the 42f0706e82SJiri Benc * associated stations are using power saving. */ 43f0706e82SJiri Benc #define AP_MAX_BC_BUFFER 128 44f0706e82SJiri Benc 45f0706e82SJiri Benc /* Maximum number of frames buffered to all STAs, including multicast frames. 46f0706e82SJiri Benc * Note: increasing this limit increases the potential memory requirement. Each 47f0706e82SJiri Benc * frame can be up to about 2 kB long. */ 48f0706e82SJiri Benc #define TOTAL_MAX_TX_BUFFER 512 49f0706e82SJiri Benc 50f0706e82SJiri Benc /* Required encryption head and tailroom */ 51f0706e82SJiri Benc #define IEEE80211_ENCRYPT_HEADROOM 8 52765cb46aSJouni Malinen #define IEEE80211_ENCRYPT_TAILROOM 18 53f0706e82SJiri Benc 541ea6f9c0SJohannes Berg /* power level hasn't been configured (or set to automatic) */ 551ea6f9c0SJohannes Berg #define IEEE80211_UNSET_POWER_LEVEL INT_MIN 561ea6f9c0SJohannes Berg 57d6a4ed6fSArik Nemtsov /* 58aa75ebc2SMichal Kazior * Some APs experience problems when working with U-APSD. Decreasing the 59aa75ebc2SMichal Kazior * probability of that happening by using legacy mode for all ACs but VO isn't 60aa75ebc2SMichal Kazior * enough. 61aa75ebc2SMichal Kazior * 62aa75ebc2SMichal Kazior * Cisco 4410N originally forced us to enable VO by default only because it 63aa75ebc2SMichal Kazior * treated non-VO ACs as legacy. 64aa75ebc2SMichal Kazior * 65aa75ebc2SMichal Kazior * However some APs (notably Netgear R7000) silently reclassify packets to 66aa75ebc2SMichal Kazior * different ACs. Since u-APSD ACs require trigger frames for frame retrieval 67aa75ebc2SMichal Kazior * clients would never see some frames (e.g. ARP responses) or would fetch them 68aa75ebc2SMichal Kazior * accidentally after a long time. 69aa75ebc2SMichal Kazior * 70aa75ebc2SMichal Kazior * It makes little sense to enable u-APSD queues by default because it needs 71aa75ebc2SMichal Kazior * userspace applications to be aware of it to actually take advantage of the 72aa75ebc2SMichal Kazior * possible additional powersavings. Implicitly depending on driver autotrigger 73aa75ebc2SMichal Kazior * frame support doesn't make much sense. 74d6a4ed6fSArik Nemtsov */ 75aa75ebc2SMichal Kazior #define IEEE80211_DEFAULT_UAPSD_QUEUES 0 76ab13315aSKalle Valo 77ab13315aSKalle Valo #define IEEE80211_DEFAULT_MAX_SP_LEN \ 78ab13315aSKalle Valo IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 79ab13315aSKalle Valo 80f438ceb8SEmmanuel Grumbach extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS]; 81f438ceb8SEmmanuel Grumbach 826ae16775SAntonio Quartulli #define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */) 836ae16775SAntonio Quartulli 84167e33f4SAyala Beker #define IEEE80211_MAX_NAN_INSTANCE_ID 255 85167e33f4SAyala Beker 868ccc0702SFelix Fietkau 878ccc0702SFelix Fietkau /* 888ccc0702SFelix Fietkau * Keep a station's queues on the active list for deficit accounting purposes 898ccc0702SFelix Fietkau * if it was active or queued during the last 100ms 908ccc0702SFelix Fietkau */ 918ccc0702SFelix Fietkau #define AIRTIME_ACTIVE_DURATION (HZ / 10) 928ccc0702SFelix Fietkau 93c2b13452SJohannes Berg struct ieee80211_bss { 94ef429dadSJohannes Berg u32 device_ts_beacon, device_ts_presp; 958c358bcdSJohannes Berg 9643ac2ca3SJouni Malinen bool wmm_used; 97ab13315aSKalle Valo bool uapsd_supported; 9800d3f14cSJohannes Berg 99f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32 100f0706e82SJiri Benc u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 101f0706e82SJiri Benc size_t supp_rates_len; 102817cee76SAlexander Bondar struct ieee80211_rate *beacon_rate; 103f0706e82SJiri Benc 1042a333a0dSJohannes Berg u32 vht_cap_info; 1052a333a0dSJohannes Berg 10600d3f14cSJohannes Berg /* 10725985edcSLucas De Marchi * During association, we save an ERP value from a probe response so 1085628221cSDaniel Drake * that we can feed ERP info to the driver when handling the 1095628221cSDaniel Drake * association completes. these fields probably won't be up-to-date 11000d3f14cSJohannes Berg * otherwise, you probably don't want to use them. 11100d3f14cSJohannes Berg */ 11200d3f14cSJohannes Berg bool has_erp_value; 1135628221cSDaniel Drake u8 erp_value; 114fcff4f10SPaul Stewart 115fcff4f10SPaul Stewart /* Keep track of the corruption of the last beacon/probe response. */ 116fcff4f10SPaul Stewart u8 corrupt_data; 117fcff4f10SPaul Stewart 118fcff4f10SPaul Stewart /* Keep track of what bits of information we have valid info for. */ 119fcff4f10SPaul Stewart u8 valid_data; 120fcff4f10SPaul Stewart }; 121fcff4f10SPaul Stewart 122fcff4f10SPaul Stewart /** 123fcff4f10SPaul Stewart * enum ieee80211_corrupt_data_flags - BSS data corruption flags 124fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted 125fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted 126fcff4f10SPaul Stewart * 127fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the 128fcff4f10SPaul Stewart * @corrupt_data field of &struct ieee80211_bss. 129fcff4f10SPaul Stewart */ 130fcff4f10SPaul Stewart enum ieee80211_bss_corrupt_data_flags { 131fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_BEACON = BIT(0), 132fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_PROBE_RESP = BIT(1) 133fcff4f10SPaul Stewart }; 134fcff4f10SPaul Stewart 135fcff4f10SPaul Stewart /** 136fcff4f10SPaul Stewart * enum ieee80211_valid_data_flags - BSS valid data flags 137fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE 138fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE 139fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE 140fcff4f10SPaul Stewart * 141fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the 142fcff4f10SPaul Stewart * @valid_data field of &struct ieee80211_bss. They show which parts 143d070f913SStephen Hemminger * of the data structure were received as a result of an un-corrupted 144fcff4f10SPaul Stewart * beacon/probe response. 145fcff4f10SPaul Stewart */ 146fcff4f10SPaul Stewart enum ieee80211_bss_valid_data_flags { 147fcff4f10SPaul Stewart IEEE80211_BSS_VALID_WMM = BIT(1), 148fcff4f10SPaul Stewart IEEE80211_BSS_VALID_RATES = BIT(2), 149fcff4f10SPaul Stewart IEEE80211_BSS_VALID_ERP = BIT(3) 150f0706e82SJiri Benc }; 151f0706e82SJiri Benc 1529efeccacSMichael S. Tsirkin typedef unsigned __bitwise ieee80211_tx_result; 1539ae54c84SJohannes Berg #define TX_CONTINUE ((__force ieee80211_tx_result) 0u) 1549ae54c84SJohannes Berg #define TX_DROP ((__force ieee80211_tx_result) 1u) 1559ae54c84SJohannes Berg #define TX_QUEUED ((__force ieee80211_tx_result) 2u) 1569ae54c84SJohannes Berg 1575cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST BIT(1) 1585cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED BIT(2) 1599ae54c84SJohannes Berg 1605cf121c3SJohannes Berg struct ieee80211_tx_data { 161f0706e82SJiri Benc struct sk_buff *skb; 162252b86c4SJohannes Berg struct sk_buff_head skbs; 163f0706e82SJiri Benc struct ieee80211_local *local; 164f0706e82SJiri Benc struct ieee80211_sub_if_data *sdata; 165f0706e82SJiri Benc struct sta_info *sta; 166f0706e82SJiri Benc struct ieee80211_key *key; 1670d528d85SFelix Fietkau struct ieee80211_tx_rate rate; 1685cf121c3SJohannes Berg 169056cdd59SJohannes Berg unsigned int flags; 1705cf121c3SJohannes Berg }; 1715cf121c3SJohannes Berg 1725cf121c3SJohannes Berg 1739efeccacSMichael S. Tsirkin typedef unsigned __bitwise ieee80211_rx_result; 1745cf121c3SJohannes Berg #define RX_CONTINUE ((__force ieee80211_rx_result) 0u) 1755cf121c3SJohannes Berg #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) 1765cf121c3SJohannes Berg #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) 1775cf121c3SJohannes Berg #define RX_QUEUED ((__force ieee80211_rx_result) 3u) 1785cf121c3SJohannes Berg 179554891e6SJohannes Berg /** 180554891e6SJohannes Berg * enum ieee80211_packet_rx_flags - packet RX flags 181554891e6SJohannes Berg * @IEEE80211_RX_AMSDU: a-MSDU packet 182554891e6SJohannes Berg * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed 1834cfda47bSChristian Lamparter * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering 184554891e6SJohannes Berg * 185554891e6SJohannes Berg * These are per-frame flags that are attached to a frame in the 186554891e6SJohannes Berg * @rx_flags field of &struct ieee80211_rx_status. 187554891e6SJohannes Berg */ 188554891e6SJohannes Berg enum ieee80211_packet_rx_flags { 189554891e6SJohannes Berg IEEE80211_RX_AMSDU = BIT(3), 190554891e6SJohannes Berg IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4), 1914cfda47bSChristian Lamparter IEEE80211_RX_DEFERRED_RELEASE = BIT(5), 192554891e6SJohannes Berg }; 193554891e6SJohannes Berg 194554891e6SJohannes Berg /** 195554891e6SJohannes Berg * enum ieee80211_rx_flags - RX data flags 196554891e6SJohannes Berg * 197554891e6SJohannes Berg * @IEEE80211_RX_CMNTR: received on cooked monitor already 198ee971924SJohannes Berg * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported 199ee971924SJohannes Berg * to cfg80211_report_obss_beacon(). 200554891e6SJohannes Berg * 201554891e6SJohannes Berg * These flags are used across handling multiple interfaces 202554891e6SJohannes Berg * for a single frame. 203554891e6SJohannes Berg */ 204554891e6SJohannes Berg enum ieee80211_rx_flags { 205554891e6SJohannes Berg IEEE80211_RX_CMNTR = BIT(0), 206ee971924SJohannes Berg IEEE80211_RX_BEACON_REPORTED = BIT(1), 207554891e6SJohannes Berg }; 2085cf121c3SJohannes Berg 2095cf121c3SJohannes Berg struct ieee80211_rx_data { 210c5d1686bSFelix Fietkau struct list_head *list; 2115cf121c3SJohannes Berg struct sk_buff *skb; 2125cf121c3SJohannes Berg struct ieee80211_local *local; 2135cf121c3SJohannes Berg struct ieee80211_sub_if_data *sdata; 2145cf121c3SJohannes Berg struct sta_info *sta; 2155cf121c3SJohannes Berg struct ieee80211_key *key; 216056cdd59SJohannes Berg 217056cdd59SJohannes Berg unsigned int flags; 2189e26297aSJohannes Berg 2199e26297aSJohannes Berg /* 2209e26297aSJohannes Berg * Index into sequence numbers array, 0..16 2219e26297aSJohannes Berg * since the last (16) is used for non-QoS, 2229e26297aSJohannes Berg * will be 16 on non-QoS frames. 2239e26297aSJohannes Berg */ 2249e26297aSJohannes Berg int seqno_idx; 2259e26297aSJohannes Berg 2269e26297aSJohannes Berg /* 2279e26297aSJohannes Berg * Index into the security IV/PN arrays, 0..16 2289e26297aSJohannes Berg * since the last (16) is used for CCMP-encrypted 2299e26297aSJohannes Berg * management frames, will be set to 16 on mgmt 2309e26297aSJohannes Berg * frames and 0 on non-QoS frames. 2319e26297aSJohannes Berg */ 2329e26297aSJohannes Berg int security_idx; 2339e26297aSJohannes Berg 234892b3bceSJohannes Berg int link_id; 235892b3bceSJohannes Berg 236bf30ca92SJohannes Berg union { 237bf30ca92SJohannes Berg struct { 238bf30ca92SJohannes Berg u32 iv32; 239bf30ca92SJohannes Berg u16 iv16; 240bf30ca92SJohannes Berg } tkip; 241bf30ca92SJohannes Berg struct { 242bf30ca92SJohannes Berg u8 pn[IEEE80211_CCMP_PN_LEN]; 243bf30ca92SJohannes Berg } ccm_gcm; 244bf30ca92SJohannes Berg }; 245f0706e82SJiri Benc }; 246f0706e82SJiri Benc 247af296bdbSMichal Kazior struct ieee80211_csa_settings { 248af296bdbSMichal Kazior const u16 *counter_offsets_beacon; 249af296bdbSMichal Kazior const u16 *counter_offsets_presp; 250af296bdbSMichal Kazior 251af296bdbSMichal Kazior int n_counter_offsets_beacon; 252af296bdbSMichal Kazior int n_counter_offsets_presp; 253af296bdbSMichal Kazior 254af296bdbSMichal Kazior u8 count; 255af296bdbSMichal Kazior }; 256af296bdbSMichal Kazior 2575f9404abSJohn Crispin struct ieee80211_color_change_settings { 2585f9404abSJohn Crispin u16 counter_offset_beacon; 2595f9404abSJohn Crispin u16 counter_offset_presp; 2605f9404abSJohn Crispin u8 count; 2615f9404abSJohn Crispin }; 2625f9404abSJohn Crispin 2635dfdaf58SJohannes Berg struct beacon_data { 2645dfdaf58SJohannes Berg u8 *head, *tail; 2655dfdaf58SJohannes Berg int head_len, tail_len; 26643552be1SThomas Pedersen struct ieee80211_meshconf_ie *meshconf; 2678552a434SJohn Crispin u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM]; 2688552a434SJohn Crispin u8 cntdwn_current_counter; 2692b3171c6SLorenzo Bianconi struct cfg80211_mbssid_elems *mbssid_ies; 2708860020eSJohannes Berg struct rcu_head rcu_head; 2715dfdaf58SJohannes Berg }; 2725dfdaf58SJohannes Berg 273aa7a0080SEyal Shapira struct probe_resp { 274aa7a0080SEyal Shapira struct rcu_head rcu_head; 275aa7a0080SEyal Shapira int len; 2768552a434SJohn Crispin u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM]; 2773c23215bSGustavo A. R. Silva u8 data[]; 278aa7a0080SEyal Shapira }; 279aa7a0080SEyal Shapira 280295b02c4SAloka Dixit struct fils_discovery_data { 281295b02c4SAloka Dixit struct rcu_head rcu_head; 282295b02c4SAloka Dixit int len; 283295b02c4SAloka Dixit u8 data[]; 284295b02c4SAloka Dixit }; 285295b02c4SAloka Dixit 286632189a0SAloka Dixit struct unsol_bcast_probe_resp_data { 287632189a0SAloka Dixit struct rcu_head rcu_head; 288632189a0SAloka Dixit int len; 289632189a0SAloka Dixit u8 data[]; 290632189a0SAloka Dixit }; 291632189a0SAloka Dixit 292d012a605SMarco Porsch struct ps_data { 293d012a605SMarco Porsch /* yes, this looks ugly, but guarantees that we can later use 294d012a605SMarco Porsch * bitmap_empty :) 295d012a605SMarco Porsch * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ 2965fe2bb86SJoe Perches u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)] 2975fe2bb86SJoe Perches __aligned(__alignof__(unsigned long)); 298d012a605SMarco Porsch struct sk_buff_head bc_buf; 299d012a605SMarco Porsch atomic_t num_sta_ps; /* number of stations in PS mode */ 300d012a605SMarco Porsch int dtim_count; 301d012a605SMarco Porsch bool dtim_bc_mc; 302d012a605SMarco Porsch }; 303d012a605SMarco Porsch 304f0706e82SJiri Benc struct ieee80211_if_ap { 3054e141dadSMichal Kazior struct list_head vlans; /* write-protected with RTNL and local->mtx */ 3060ec3ca44SJohannes Berg 307d012a605SMarco Porsch struct ps_data ps; 308030ef8f8SFelix Fietkau atomic_t num_mcast_sta; /* number of stations receiving multicast */ 309687da132SEmmanuel Grumbach 310ebceec86SMichael Braun bool multicast_to_unicast; 311bfd8403aSJohannes Berg bool active; 312f0706e82SJiri Benc }; 313f0706e82SJiri Benc 314f0706e82SJiri Benc struct ieee80211_if_vlan { 3154e141dadSMichal Kazior struct list_head list; /* write-protected with RTNL and local->mtx */ 316f14543eeSFelix Fietkau 317f14543eeSFelix Fietkau /* used for all tx if the VLAN is configured to 4-addr mode */ 31840b275b6SJohannes Berg struct sta_info __rcu *sta; 31972f15d53SMichael Braun atomic_t num_mcast_sta; /* number of stations receiving multicast */ 320f0706e82SJiri Benc }; 321f0706e82SJiri Benc 322ee385855SLuis Carlos Cobo struct mesh_stats { 323c8a61a7dSDaniel Walker __u32 fwded_mcast; /* Mesh forwarded multicast frames */ 324c8a61a7dSDaniel Walker __u32 fwded_unicast; /* Mesh forwarded unicast frames */ 325c8a61a7dSDaniel Walker __u32 fwded_frames; /* Mesh total forwarded frames */ 326ee385855SLuis Carlos Cobo __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ 327ee385855SLuis Carlos Cobo __u32 dropped_frames_no_route; /* Not transmitted, no route found */ 328cfee66b0SJavier Cardona __u32 dropped_frames_congestion;/* Not forwarded due to congestion */ 329ee385855SLuis Carlos Cobo }; 330ee385855SLuis Carlos Cobo 331ee385855SLuis Carlos Cobo #define PREQ_Q_F_START 0x1 332ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH 0x2 333ee385855SLuis Carlos Cobo struct mesh_preq_queue { 334ee385855SLuis Carlos Cobo struct list_head list; 335ee385855SLuis Carlos Cobo u8 dst[ETH_ALEN]; 336ee385855SLuis Carlos Cobo u8 flags; 337ee385855SLuis Carlos Cobo }; 338ee385855SLuis Carlos Cobo 3392eb278e0SJohannes Berg struct ieee80211_roc_work { 34077fdaa12SJohannes Berg struct list_head list; 341af6b6374SJohannes Berg 342af6b6374SJohannes Berg struct ieee80211_sub_if_data *sdata; 343af6b6374SJohannes Berg 344f679f65dSJohannes Berg struct ieee80211_channel *chan; 345af6b6374SJohannes Berg 3462eb278e0SJohannes Berg bool started, abort, hw_begun, notified; 347b4b177a5SJohannes Berg bool on_channel; 348f679f65dSJohannes Berg 349aaa016ccSJohannes Berg unsigned long start_time; 350e4da8c37SJohannes Berg 3512eb278e0SJohannes Berg u32 duration, req_duration; 352f30221e4SJohannes Berg struct sk_buff *frame; 35350febf6aSJohannes Berg u64 cookie, mgmt_tx_cookie; 354d339d5caSIlan Peer enum ieee80211_roc_type type; 35577fdaa12SJohannes Berg }; 35677fdaa12SJohannes Berg 35746900298SJohannes Berg /* flags used in struct ieee80211_if_managed.flags */ 358ab1faeadSJohannes Berg enum ieee80211_sta_flags { 359b291ba11SJohannes Berg IEEE80211_STA_CONNECTION_POLL = BIT(1), 360b291ba11SJohannes Berg IEEE80211_STA_CONTROL_PORT = BIT(2), 361b291ba11SJohannes Berg IEEE80211_STA_MFP_ENABLED = BIT(6), 362ab13315aSKalle Valo IEEE80211_STA_UAPSD_ENABLED = BIT(7), 363375177bfSVivek Natarajan IEEE80211_STA_NULLFUNC_ACKED = BIT(8), 364cd2f5dd7SAssaf Krauss IEEE80211_STA_ENABLE_RRM = BIT(15), 365ba323e29SJohannes Berg }; 366ba323e29SJohannes Berg 367ba323e29SJohannes Berg typedef u32 __bitwise ieee80211_conn_flags_t; 368ba323e29SJohannes Berg 369ba323e29SJohannes Berg enum ieee80211_conn_flags { 370ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_HT = (__force ieee80211_conn_flags_t)BIT(0), 371ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_40MHZ = (__force ieee80211_conn_flags_t)BIT(1), 372ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_VHT = (__force ieee80211_conn_flags_t)BIT(2), 373ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_80P80MHZ = (__force ieee80211_conn_flags_t)BIT(3), 374ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_160MHZ = (__force ieee80211_conn_flags_t)BIT(4), 375ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_HE = (__force ieee80211_conn_flags_t)BIT(5), 376ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_EHT = (__force ieee80211_conn_flags_t)BIT(6), 377ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_320MHZ = (__force ieee80211_conn_flags_t)BIT(7), 378ab1faeadSJohannes Berg }; 379ab1faeadSJohannes Berg 38066e67e41SJohannes Berg struct ieee80211_mgd_auth_data { 38166e67e41SJohannes Berg struct cfg80211_bss *bss; 38266e67e41SJohannes Berg unsigned long timeout; 38366e67e41SJohannes Berg int tries; 38466e67e41SJohannes Berg u16 algorithm, expected_transaction; 38566e67e41SJohannes Berg 38666e67e41SJohannes Berg u8 key[WLAN_KEY_LEN_WEP104]; 38766e67e41SJohannes Berg u8 key_len, key_idx; 38894d9864cSJohannes Berg bool done, waiting; 389efb543e6SJouni Malinen bool peer_confirmed; 39089afe614SJohannes Berg bool timeout_started; 39166e67e41SJohannes Berg 3926b8ece3aSJouni Malinen u16 sae_trans, sae_status; 3936b8ece3aSJouni Malinen size_t data_len; 3946b8ece3aSJouni Malinen u8 data[]; 39566e67e41SJohannes Berg }; 39666e67e41SJohannes Berg 39766e67e41SJohannes Berg struct ieee80211_mgd_assoc_data { 39866e67e41SJohannes Berg struct cfg80211_bss *bss; 39966e67e41SJohannes Berg const u8 *supp_rates; 40066e67e41SJohannes Berg 40166e67e41SJohannes Berg unsigned long timeout; 40266e67e41SJohannes Berg int tries; 40366e67e41SJohannes Berg 40466e67e41SJohannes Berg u16 capability; 40566e67e41SJohannes Berg u8 prev_bssid[ETH_ALEN]; 40666e67e41SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 40766e67e41SJohannes Berg u8 ssid_len; 40866e67e41SJohannes Berg u8 supp_rates_len; 40976f0303dSJohannes Berg bool wmm, uapsd; 410989c6505SAlexander Bondar bool need_beacon; 41166e67e41SJohannes Berg bool synced; 41289afe614SJohannes Berg bool timeout_started; 41366e67e41SJohannes Berg 4149dde6423SJohannes Berg u8 ap_ht_param; 4159dde6423SJohannes Berg 416b08fbbd8SJohannes Berg struct ieee80211_vht_cap ap_vht_cap; 417b08fbbd8SJohannes Berg 41839404feeSJouni Malinen u8 fils_nonces[2 * FILS_NONCE_LEN]; 41939404feeSJouni Malinen u8 fils_kek[FILS_MAX_KEK_LEN]; 42039404feeSJouni Malinen size_t fils_kek_len; 42139404feeSJouni Malinen 42266e67e41SJohannes Berg size_t ie_len; 42366e67e41SJohannes Berg u8 ie[]; 42466e67e41SJohannes Berg }; 42566e67e41SJohannes Berg 42602219b3aSJohannes Berg struct ieee80211_sta_tx_tspec { 42702219b3aSJohannes Berg /* timestamp of the first packet in the time slice */ 42802219b3aSJohannes Berg unsigned long time_slice_start; 42902219b3aSJohannes Berg 43002219b3aSJohannes Berg u32 admitted_time; /* in usecs, unlike over the air */ 43102219b3aSJohannes Berg u8 tsid; 43202219b3aSJohannes Berg s8 up; /* signed to be able to invalidate with -1 during teardown */ 43302219b3aSJohannes Berg 43402219b3aSJohannes Berg /* consumed TX time in microseconds in the time slice */ 43502219b3aSJohannes Berg u32 consumed_tx_time; 43602219b3aSJohannes Berg enum { 43702219b3aSJohannes Berg TX_TSPEC_ACTION_NONE = 0, 43802219b3aSJohannes Berg TX_TSPEC_ACTION_DOWNGRADE, 43902219b3aSJohannes Berg TX_TSPEC_ACTION_STOP_DOWNGRADE, 44002219b3aSJohannes Berg } action; 44102219b3aSJohannes Berg bool downgraded; 44202219b3aSJohannes Berg }; 44302219b3aSJohannes Berg 444eb1e011aSJohannes Berg DECLARE_EWMA(beacon_signal, 4, 4) 445338c17aeSJohannes Berg 44646900298SJohannes Berg struct ieee80211_if_managed { 447056cdd59SJohannes Berg struct timer_list timer; 448b291ba11SJohannes Berg struct timer_list conn_mon_timer; 449b291ba11SJohannes Berg struct timer_list bcn_mon_timer; 450b291ba11SJohannes Berg struct work_struct monitor_work; 4511e4dcd01SJuuso Oikarinen struct work_struct beacon_connection_loss_work; 452882a7c69SJohannes Berg struct work_struct csa_connection_drop_work; 45346900298SJohannes Berg 4547ccc8bd7SFelix Fietkau unsigned long beacon_timeout; 455b291ba11SJohannes Berg unsigned long probe_timeout; 456a43abf29SMaxim Levitsky int probe_send_count; 45704ac3c0eSFelix Fietkau bool nullfunc_failed; 4583f8a39ffSJohannes Berg u8 connection_loss:1, 4593f8a39ffSJohannes Berg driver_disconnect:1, 4605dfad108SJohannes Berg reconnect:1, 4615dfad108SJohannes Berg associated:1; 462b291ba11SJohannes Berg 46366e67e41SJohannes Berg struct ieee80211_mgd_auth_data *auth_data; 46466e67e41SJohannes Berg struct ieee80211_mgd_assoc_data *assoc_data; 46546900298SJohannes Berg 466965bedadSJohannes Berg bool powersave; /* powersave requested for this iface */ 46705cb9108SJohannes Berg bool broken_ap; /* AP is broken -- turn off powersave */ 468965bedadSJohannes Berg 469d6f2da5bSJiri Slaby unsigned int flags; 470f0706e82SJiri Benc 4711672c0e3SJohannes Berg bool status_acked; 4721672c0e3SJohannes Berg bool status_received; 4731672c0e3SJohannes Berg __le16 status_fc; 4741672c0e3SJohannes Berg 475fdfacf0aSJouni Malinen enum { 476fdfacf0aSJouni Malinen IEEE80211_MFP_DISABLED, 477fdfacf0aSJouni Malinen IEEE80211_MFP_OPTIONAL, 478fdfacf0aSJouni Malinen IEEE80211_MFP_REQUIRED 479fdfacf0aSJouni Malinen } mfp; /* management frame protection */ 480fdfacf0aSJouni Malinen 481dc41e4d4SEliad Peller /* 482dc41e4d4SEliad Peller * Bitmask of enabled u-apsd queues, 483dc41e4d4SEliad Peller * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association 484dc41e4d4SEliad Peller * to take effect. 485dc41e4d4SEliad Peller */ 486dc41e4d4SEliad Peller unsigned int uapsd_queues; 487dc41e4d4SEliad Peller 488dc41e4d4SEliad Peller /* 489dc41e4d4SEliad Peller * Maximum number of buffered frames AP can deliver during a 490dc41e4d4SEliad Peller * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar. 491dc41e4d4SEliad Peller * Needs a new association to take effect. 492dc41e4d4SEliad Peller */ 493dc41e4d4SEliad Peller unsigned int uapsd_max_sp_len; 494dc41e4d4SEliad Peller 4959bc383deSJohannes Berg u8 use_4addr; 49617e4ec14SJouni Malinen 497615f7b9bSMeenakshi Venkataraman /* 498615f7b9bSMeenakshi Venkataraman * State variables for keeping track of RSSI of the AP currently 499615f7b9bSMeenakshi Venkataraman * connected to and informing driver when RSSI has gone 500615f7b9bSMeenakshi Venkataraman * below/above a certain threshold. 501615f7b9bSMeenakshi Venkataraman */ 502615f7b9bSMeenakshi Venkataraman int rssi_min_thold, rssi_max_thold; 503ef96a842SBen Greear 504ef96a842SBen Greear struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ 505ef96a842SBen Greear struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ 506dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */ 507dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */ 5087957c6c8SThomas Pedersen struct ieee80211_s1g_cap s1g_capa; /* configured S1G overrides */ 5097957c6c8SThomas Pedersen struct ieee80211_s1g_cap s1g_capa_mask; /* valid s1g_capa bits */ 51081dd2b88SArik Nemtsov 5111277b4a9SLiad Kaufman /* TDLS support */ 51281dd2b88SArik Nemtsov u8 tdls_peer[ETH_ALEN] __aligned(2); 51381dd2b88SArik Nemtsov struct delayed_work tdls_peer_del_work; 5141277b4a9SLiad Kaufman struct sk_buff *orig_teardown_skb; /* The original teardown skb */ 5151277b4a9SLiad Kaufman struct sk_buff *teardown_skb; /* A copy to send through the AP */ 5161277b4a9SLiad Kaufman spinlock_t teardown_lock; /* To lock changing teardown_skb */ 51782c0cc90SArik Nemtsov bool tdls_wider_bw_prohibited; 51802219b3aSJohannes Berg 51902219b3aSJohannes Berg /* WMM-AC TSPEC support */ 52002219b3aSJohannes Berg struct ieee80211_sta_tx_tspec tx_tspec[IEEE80211_NUM_ACS]; 52102219b3aSJohannes Berg /* Use a separate work struct so that we can do something here 52202219b3aSJohannes Berg * while the sdata->work is flushing the queues, for example. 52302219b3aSJohannes Berg * otherwise, in scenarios where we hardly get any traffic out 52402219b3aSJohannes Berg * on the BE queue, but there's a lot of VO traffic, we might 52502219b3aSJohannes Berg * get stuck in a downgraded situation and flush takes forever. 52602219b3aSJohannes Berg */ 52702219b3aSJohannes Berg struct delayed_work tx_tspec_wk; 5284d9ec73dSJouni Malinen 5294d9ec73dSJouni Malinen /* Information elements from the last transmitted (Re)Association 5304d9ec73dSJouni Malinen * Request frame. 5314d9ec73dSJouni Malinen */ 5324d9ec73dSJouni Malinen u8 *assoc_req_ies; 5334d9ec73dSJouni Malinen size_t assoc_req_ies_len; 534f0706e82SJiri Benc }; 535f0706e82SJiri Benc 53646900298SJohannes Berg struct ieee80211_if_ibss { 53746900298SJohannes Berg struct timer_list timer; 538cd7760e6SSimon Wunderlich struct work_struct csa_connection_drop_work; 53946900298SJohannes Berg 540af8cdcd8SJohannes Berg unsigned long last_scan_completed; 5415bb644a0SJohannes Berg 542fbd2c8dcSTeemu Paasikivi u32 basic_rates; 543fbd2c8dcSTeemu Paasikivi 544af8cdcd8SJohannes Berg bool fixed_bssid; 545af8cdcd8SJohannes Berg bool fixed_channel; 546fffd0934SJohannes Berg bool privacy; 54746900298SJohannes Berg 548267335d6SAntonio Quartulli bool control_port; 5498e8d347dSSimon Wunderlich bool userspace_handles_dfs; 550267335d6SAntonio Quartulli 5514d196e4bSFelix Fietkau u8 bssid[ETH_ALEN] __aligned(2); 552af8cdcd8SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 553af8cdcd8SJohannes Berg u8 ssid_len, ie_len; 554af8cdcd8SJohannes Berg u8 *ie; 5553aede78aSSimon Wunderlich struct cfg80211_chan_def chandef; 55646900298SJohannes Berg 55746900298SJohannes Berg unsigned long ibss_join_req; 558af8cdcd8SJohannes Berg /* probe response/beacon for IBSS */ 559c3ffeab4SJohannes Berg struct beacon_data __rcu *presp; 56046900298SJohannes Berg 561822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ 562822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ 563822854b0SSimon Wunderlich 5648bf11d8dSJohannes Berg spinlock_t incomplete_lock; 5658bf11d8dSJohannes Berg struct list_head incomplete_stations; 5668bf11d8dSJohannes Berg 56746900298SJohannes Berg enum { 56846900298SJohannes Berg IEEE80211_IBSS_MLME_SEARCH, 56946900298SJohannes Berg IEEE80211_IBSS_MLME_JOINED, 57046900298SJohannes Berg } state; 57146900298SJohannes Berg }; 57246900298SJohannes Berg 573dbf498fbSJavier Cardona /** 574239281f8SRostislav Lisovy * struct ieee80211_if_ocb - OCB mode state 575239281f8SRostislav Lisovy * 576239281f8SRostislav Lisovy * @housekeeping_timer: timer for periodic invocation of a housekeeping task 577239281f8SRostislav Lisovy * @wrkq_flags: OCB deferred task action 578239281f8SRostislav Lisovy * @incomplete_lock: delayed STA insertion lock 579239281f8SRostislav Lisovy * @incomplete_stations: list of STAs waiting for delayed insertion 580239281f8SRostislav Lisovy * @joined: indication if the interface is connected to an OCB network 581239281f8SRostislav Lisovy */ 582239281f8SRostislav Lisovy struct ieee80211_if_ocb { 583239281f8SRostislav Lisovy struct timer_list housekeeping_timer; 584239281f8SRostislav Lisovy unsigned long wrkq_flags; 585239281f8SRostislav Lisovy 586239281f8SRostislav Lisovy spinlock_t incomplete_lock; 587239281f8SRostislav Lisovy struct list_head incomplete_stations; 588239281f8SRostislav Lisovy 589239281f8SRostislav Lisovy bool joined; 590239281f8SRostislav Lisovy }; 591239281f8SRostislav Lisovy 592239281f8SRostislav Lisovy /** 593dbf498fbSJavier Cardona * struct ieee80211_mesh_sync_ops - Extensible synchronization framework interface 594dbf498fbSJavier Cardona * 595dbf498fbSJavier Cardona * these declarations define the interface, which enables 596dbf498fbSJavier Cardona * vendor-specific mesh synchronization 597dbf498fbSJavier Cardona * 598dbf498fbSJavier Cardona */ 599dbf498fbSJavier Cardona struct ieee802_11_elems; 600dbf498fbSJavier Cardona struct ieee80211_mesh_sync_ops { 601a5b983c6SJohannes Berg void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata, u16 stype, 602a5b983c6SJohannes Berg struct ieee80211_mgmt *mgmt, unsigned int len, 603a5b983c6SJohannes Berg const struct ieee80211_meshconf_ie *mesh_cfg, 604dbf498fbSJavier Cardona struct ieee80211_rx_status *rx_status); 60543552be1SThomas Pedersen 60643552be1SThomas Pedersen /* should be called with beacon_data under RCU read lock */ 607445cd452SMasashi Honma void (*adjust_tsf)(struct ieee80211_sub_if_data *sdata, 60843552be1SThomas Pedersen struct beacon_data *beacon); 609dbf498fbSJavier Cardona /* add other framework functions here */ 610dbf498fbSJavier Cardona }; 611dbf498fbSJavier Cardona 612b8456a14SChun-Yeow Yeoh struct mesh_csa_settings { 613b8456a14SChun-Yeow Yeoh struct rcu_head rcu_head; 614b8456a14SChun-Yeow Yeoh struct cfg80211_csa_settings settings; 615b8456a14SChun-Yeow Yeoh }; 616b8456a14SChun-Yeow Yeoh 6178b5cb7e4SPavel Skripkin /** 6188b5cb7e4SPavel Skripkin * struct mesh_table 6198b5cb7e4SPavel Skripkin * 6208b5cb7e4SPavel Skripkin * @known_gates: list of known mesh gates and their mpaths by the station. The 6218b5cb7e4SPavel Skripkin * gate's mpath may or may not be resolved and active. 6228b5cb7e4SPavel Skripkin * @gates_lock: protects updates to known_gates 6238b5cb7e4SPavel Skripkin * @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr 6248b5cb7e4SPavel Skripkin * @walk_head: linked list containing all mesh_path objects 6258b5cb7e4SPavel Skripkin * @walk_lock: lock protecting walk_head 6268b5cb7e4SPavel Skripkin * @entries: number of entries in the table 6278b5cb7e4SPavel Skripkin */ 6288b5cb7e4SPavel Skripkin struct mesh_table { 6298b5cb7e4SPavel Skripkin struct hlist_head known_gates; 6308b5cb7e4SPavel Skripkin spinlock_t gates_lock; 6318b5cb7e4SPavel Skripkin struct rhashtable rhead; 6328b5cb7e4SPavel Skripkin struct hlist_head walk_head; 6338b5cb7e4SPavel Skripkin spinlock_t walk_lock; 6348b5cb7e4SPavel Skripkin atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */ 6358b5cb7e4SPavel Skripkin }; 6368b5cb7e4SPavel Skripkin 637472dbc45SJohannes Berg struct ieee80211_if_mesh { 638472dbc45SJohannes Berg struct timer_list housekeeping_timer; 639472dbc45SJohannes Berg struct timer_list mesh_path_timer; 640e304bfd3SRui Paulo struct timer_list mesh_path_root_timer; 641472dbc45SJohannes Berg 64218889231SJavier Cardona unsigned long wrkq_flags; 643f81a9dedSThomas Pedersen unsigned long mbss_changed; 644472dbc45SJohannes Berg 6450ab2e55dSBenjamin Berg bool userspace_handles_dfs; 6460ab2e55dSBenjamin Berg 647472dbc45SJohannes Berg u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; 648472dbc45SJohannes Berg size_t mesh_id_len; 649472dbc45SJohannes Berg /* Active Path Selection Protocol Identifier */ 6503491707aSRui Paulo u8 mesh_pp_id; 651472dbc45SJohannes Berg /* Active Path Selection Metric Identifier */ 6523491707aSRui Paulo u8 mesh_pm_id; 653472dbc45SJohannes Berg /* Congestion Control Mode Identifier */ 6543491707aSRui Paulo u8 mesh_cc_id; 6559e03fdfdSJavier Cardona /* Synchronization Protocol Identifier */ 6563491707aSRui Paulo u8 mesh_sp_id; 6579e03fdfdSJavier Cardona /* Authentication Protocol Identifier */ 6583491707aSRui Paulo u8 mesh_auth_id; 659d19b3bf6SRui Paulo /* Local mesh Sequence Number */ 660d19b3bf6SRui Paulo u32 sn; 661472dbc45SJohannes Berg /* Last used PREQ ID */ 662472dbc45SJohannes Berg u32 preq_id; 663472dbc45SJohannes Berg atomic_t mpaths; 664d19b3bf6SRui Paulo /* Timestamp of last SN update */ 665d19b3bf6SRui Paulo unsigned long last_sn_update; 666dca7e943SThomas Pedersen /* Time when it's ok to send next PERR */ 667dca7e943SThomas Pedersen unsigned long next_perr; 668dca7e943SThomas Pedersen /* Timestamp of last PREQ sent */ 669472dbc45SJohannes Berg unsigned long last_preq; 670472dbc45SJohannes Berg struct mesh_rmc *rmc; 671472dbc45SJohannes Berg spinlock_t mesh_preq_queue_lock; 672472dbc45SJohannes Berg struct mesh_preq_queue preq_queue; 673472dbc45SJohannes Berg int preq_queue_len; 674472dbc45SJohannes Berg struct mesh_stats mshstats; 675472dbc45SJohannes Berg struct mesh_config mshcfg; 6761258d976SAshok Nagarajan atomic_t estab_plinks; 677472dbc45SJohannes Berg u32 mesh_seqnum; 678472dbc45SJohannes Berg bool accepting_plinks; 6795ee68e5bSJavier Cardona int num_gates; 6802b5e1967SThomas Pedersen struct beacon_data __rcu *beacon; 681581a8b0fSJavier Cardona const u8 *ie; 682581a8b0fSJavier Cardona u8 ie_len; 683b130e5ceSJavier Cardona enum { 684b130e5ceSJavier Cardona IEEE80211_MESH_SEC_NONE = 0x0, 685b130e5ceSJavier Cardona IEEE80211_MESH_SEC_AUTHED = 0x1, 686b130e5ceSJavier Cardona IEEE80211_MESH_SEC_SECURED = 0x2, 687b130e5ceSJavier Cardona } security; 688a6dad6a2SThomas Pedersen bool user_mpm; 689dbf498fbSJavier Cardona /* Extensible Synchronization Framework */ 6908ba7acf3SJohannes Berg const struct ieee80211_mesh_sync_ops *sync_ops; 691dbf498fbSJavier Cardona s64 sync_offset_clockdrift_max; 692dbf498fbSJavier Cardona spinlock_t sync_offset_lock; 6933f52b7e3SMarco Porsch /* mesh power save */ 6943f52b7e3SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 6953f52b7e3SMarco Porsch int ps_peers_light_sleep; 6963f52b7e3SMarco Porsch int ps_peers_deep_sleep; 6973f52b7e3SMarco Porsch struct ps_data ps; 6988f2535b9SChun-Yeow Yeoh /* Channel Switching Support */ 699b8456a14SChun-Yeow Yeoh struct mesh_csa_settings __rcu *csa; 7000cb4d4dcSLuciano Coelho enum { 7010cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_NONE, 7020cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_INIT, 7030cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_REPEATER, 7040cb4d4dcSLuciano Coelho } csa_role; 705b8456a14SChun-Yeow Yeoh u8 chsw_ttl; 7068f2535b9SChun-Yeow Yeoh u16 pre_value; 70743552be1SThomas Pedersen 70843552be1SThomas Pedersen /* offset from skb->data while building IE */ 70943552be1SThomas Pedersen int meshconf_offset; 7102bdaf386SBob Copeland 7118b5cb7e4SPavel Skripkin struct mesh_table mesh_paths; 7128b5cb7e4SPavel Skripkin struct mesh_table mpp_paths; /* Store paths for MPP&MAP */ 7132bdaf386SBob Copeland int mesh_paths_generation; 7142bdaf386SBob Copeland int mpp_paths_generation; 715472dbc45SJohannes Berg }; 716902acc78SJohannes Berg 717902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 718472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 719472dbc45SJohannes Berg do { (msh)->mshstats.name++; } while (0) 720902acc78SJohannes Berg #else 721472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 722902acc78SJohannes Berg do { } while (0) 723902acc78SJohannes Berg #endif 724f0706e82SJiri Benc 725213cd118SJohannes Berg /** 726213cd118SJohannes Berg * enum ieee80211_sub_if_data_flags - virtual interface flags 727213cd118SJohannes Berg * 728213cd118SJohannes Berg * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets 729213cd118SJohannes Berg * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode 730213cd118SJohannes Berg * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between 731213cd118SJohannes Berg * associated stations and deliver multicast frames both 732213cd118SJohannes Berg * back to wireless media and to the local net stack. 73395acac61SJohannes Berg * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume. 7347b7eab6fSJohannes Berg * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver 7357d352ccfSYoughandhar Chintala * @IEEE80211_SDATA_DISCONNECT_HW_RESTART: Disconnect after hardware restart 7367d352ccfSYoughandhar Chintala * recovery 737213cd118SJohannes Berg */ 738213cd118SJohannes Berg enum ieee80211_sub_if_data_flags { 739213cd118SJohannes Berg IEEE80211_SDATA_ALLMULTI = BIT(0), 7407986cf95SJohannes Berg IEEE80211_SDATA_OPERATING_GMODE = BIT(2), 7417986cf95SJohannes Berg IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3), 74295acac61SJohannes Berg IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4), 7437b7eab6fSJohannes Berg IEEE80211_SDATA_IN_DRIVER = BIT(5), 7447d352ccfSYoughandhar Chintala IEEE80211_SDATA_DISCONNECT_HW_RESTART = BIT(6), 745213cd118SJohannes Berg }; 746213cd118SJohannes Berg 74734d4bc4dSJohannes Berg /** 74834d4bc4dSJohannes Berg * enum ieee80211_sdata_state_bits - virtual interface state bits 74934d4bc4dSJohannes Berg * @SDATA_STATE_RUNNING: virtual interface is up & running; this 75034d4bc4dSJohannes Berg * mirrors netif_running() but is separate for interface type 75134d4bc4dSJohannes Berg * change handling while the interface is up 7525b714c6aSJohannes Berg * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel 7535b714c6aSJohannes Berg * mode, so queues are stopped 754d6a83228SJohannes Berg * @SDATA_STATE_OFFCHANNEL_BEACON_STOPPED: Beaconing was stopped due 755d6a83228SJohannes Berg * to offchannel, reset when offchannel returns 75634d4bc4dSJohannes Berg */ 75734d4bc4dSJohannes Berg enum ieee80211_sdata_state_bits { 75834d4bc4dSJohannes Berg SDATA_STATE_RUNNING, 7595b714c6aSJohannes Berg SDATA_STATE_OFFCHANNEL, 760d6a83228SJohannes Berg SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, 76134d4bc4dSJohannes Berg }; 76234d4bc4dSJohannes Berg 763d01a1e65SMichal Kazior /** 764d01a1e65SMichal Kazior * enum ieee80211_chanctx_mode - channel context configuration mode 765d01a1e65SMichal Kazior * 766d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_SHARED: channel context may be used by 767d01a1e65SMichal Kazior * multiple interfaces 768d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_EXCLUSIVE: channel context can be used 769d01a1e65SMichal Kazior * only by a single interface. This can be used for example for 770d01a1e65SMichal Kazior * non-fixed channel IBSS. 771d01a1e65SMichal Kazior */ 772d01a1e65SMichal Kazior enum ieee80211_chanctx_mode { 773d01a1e65SMichal Kazior IEEE80211_CHANCTX_SHARED, 774d01a1e65SMichal Kazior IEEE80211_CHANCTX_EXCLUSIVE 775d01a1e65SMichal Kazior }; 776d01a1e65SMichal Kazior 7775bcae31dSMichal Kazior /** 7785bcae31dSMichal Kazior * enum ieee80211_chanctx_replace_state - channel context replacement state 7795bcae31dSMichal Kazior * 7805bcae31dSMichal Kazior * This is used for channel context in-place reservations that require channel 7815bcae31dSMichal Kazior * context switch/swap. 7825bcae31dSMichal Kazior * 7835bcae31dSMichal Kazior * @IEEE80211_CHANCTX_REPLACE_NONE: no replacement is taking place 7845bcae31dSMichal Kazior * @IEEE80211_CHANCTX_WILL_BE_REPLACED: this channel context will be replaced 7855bcae31dSMichal Kazior * by a (not yet registered) channel context pointed by %replace_ctx. 7865bcae31dSMichal Kazior * @IEEE80211_CHANCTX_REPLACES_OTHER: this (not yet registered) channel context 7875bcae31dSMichal Kazior * replaces an existing channel context pointed to by %replace_ctx. 7885bcae31dSMichal Kazior */ 7895bcae31dSMichal Kazior enum ieee80211_chanctx_replace_state { 7905bcae31dSMichal Kazior IEEE80211_CHANCTX_REPLACE_NONE, 7915bcae31dSMichal Kazior IEEE80211_CHANCTX_WILL_BE_REPLACED, 7925bcae31dSMichal Kazior IEEE80211_CHANCTX_REPLACES_OTHER, 7935bcae31dSMichal Kazior }; 7945bcae31dSMichal Kazior 795d01a1e65SMichal Kazior struct ieee80211_chanctx { 796d01a1e65SMichal Kazior struct list_head list; 797d01a1e65SMichal Kazior struct rcu_head rcu_head; 798d01a1e65SMichal Kazior 799b4f85443SJohannes Berg struct list_head assigned_links; 800b4f85443SJohannes Berg struct list_head reserved_links; 801484298adSMichal Kazior 8025bcae31dSMichal Kazior enum ieee80211_chanctx_replace_state replace_state; 8035bcae31dSMichal Kazior struct ieee80211_chanctx *replace_ctx; 8045bcae31dSMichal Kazior 805d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode; 8068a61af65SJohannes Berg bool driver_present; 807d01a1e65SMichal Kazior 808d01a1e65SMichal Kazior struct ieee80211_chanctx_conf conf; 809d01a1e65SMichal Kazior }; 810d01a1e65SMichal Kazior 81132db6b54SKyeyoon Park struct mac80211_qos_map { 81232db6b54SKyeyoon Park struct cfg80211_qos_map qos_map; 81332db6b54SKyeyoon Park struct rcu_head rcu_head; 81432db6b54SKyeyoon Park }; 81532db6b54SKyeyoon Park 816ba8c3d6fSFelix Fietkau enum txq_info_flags { 817ba8c3d6fSFelix Fietkau IEEE80211_TXQ_STOP, 818ba8c3d6fSFelix Fietkau IEEE80211_TXQ_AMPDU, 8196e0456b5SFelix Fietkau IEEE80211_TXQ_NO_AMSDU, 82021a5d4c3SManikanta Pubbisetty IEEE80211_TXQ_STOP_NETIF_TX, 821ba8c3d6fSFelix Fietkau }; 822ba8c3d6fSFelix Fietkau 823fa962b92SMichal Kazior /** 824fa962b92SMichal Kazior * struct txq_info - per tid queue 825fa962b92SMichal Kazior * 826fa962b92SMichal Kazior * @tin: contains packets split into multiple flows 827fa962b92SMichal Kazior * @def_flow: used as a fallback flow when a packet destined to @tin hashes to 828fa962b92SMichal Kazior * a fq_flow which is already owned by a different tin 8295caa328eSMichal Kazior * @def_cvars: codel vars for @def_flow 8302433647bSToke Høiland-Jørgensen * @frags: used to keep fragments created after dequeue 831942741daSFelix Fietkau * @schedule_order: used with ieee80211_local->active_txqs 832942741daSFelix Fietkau * @schedule_round: counter to prevent infinite loops on TXQ scheduling 833fa962b92SMichal Kazior */ 834ba8c3d6fSFelix Fietkau struct txq_info { 835fa962b92SMichal Kazior struct fq_tin tin; 8365caa328eSMichal Kazior struct codel_vars def_cvars; 8378d51dbb8SToke Høiland-Jørgensen struct codel_stats cstats; 838942741daSFelix Fietkau 839942741daSFelix Fietkau u16 schedule_round; 840942741daSFelix Fietkau struct list_head schedule_order; 841c74025f4SJohannes Berg 842c74025f4SJohannes Berg struct sk_buff_head frags; 843942741daSFelix Fietkau 844ba8c3d6fSFelix Fietkau unsigned long flags; 845ba8c3d6fSFelix Fietkau 846ba8c3d6fSFelix Fietkau /* keep last! */ 847ba8c3d6fSFelix Fietkau struct ieee80211_txq txq; 848ba8c3d6fSFelix Fietkau }; 849ba8c3d6fSFelix Fietkau 850d8212184SAviya Erenfeld struct ieee80211_if_mntr { 851d8212184SAviya Erenfeld u32 flags; 85242bd20d9SAviya Erenfeld u8 mu_follow_addr[ETH_ALEN] __aligned(2); 853f64331d5SJohannes Berg 854f64331d5SJohannes Berg struct list_head list; 855d8212184SAviya Erenfeld }; 856d8212184SAviya Erenfeld 8575953ff6dSAyala Beker /** 8585953ff6dSAyala Beker * struct ieee80211_if_nan - NAN state 8595953ff6dSAyala Beker * 8605953ff6dSAyala Beker * @conf: current NAN configuration 861167e33f4SAyala Beker * @func_ids: a bitmap of available instance_id's 8625953ff6dSAyala Beker */ 8635953ff6dSAyala Beker struct ieee80211_if_nan { 8645953ff6dSAyala Beker struct cfg80211_nan_conf conf; 865167e33f4SAyala Beker 866167e33f4SAyala Beker /* protects function_inst_ids */ 867167e33f4SAyala Beker spinlock_t func_lock; 868167e33f4SAyala Beker struct idr function_inst_ids; 8695953ff6dSAyala Beker }; 8705953ff6dSAyala Beker 871bfd8403aSJohannes Berg struct ieee80211_link_data_managed { 872bfd8403aSJohannes Berg u8 bssid[ETH_ALEN] __aligned(2); 873bfd8403aSJohannes Berg 874bfd8403aSJohannes Berg u8 dtim_period; 875bfd8403aSJohannes Berg enum ieee80211_smps_mode req_smps, /* requested smps mode */ 876bfd8403aSJohannes Berg driver_smps_mode; /* smps mode request */ 877bfd8403aSJohannes Berg 878ba323e29SJohannes Berg ieee80211_conn_flags_t conn_flags; 879ba323e29SJohannes Berg 880bfd8403aSJohannes Berg s16 p2p_noa_index; 881bfd8403aSJohannes Berg 882*ab3a830dSJohannes Berg bool tdls_chan_switch_prohibited; 883*ab3a830dSJohannes Berg 884bfd8403aSJohannes Berg bool have_beacon; 88542ed6748SJohannes Berg bool tracking_signal_avg; 8866359598dSJohannes Berg bool disable_wmm_tracking; 887bfd8403aSJohannes Berg 888bfd8403aSJohannes Berg bool csa_waiting_bcn; 889bfd8403aSJohannes Berg bool csa_ignored_same_chan; 8905bd5666dSJohannes Berg struct timer_list chswitch_timer; 8915bd5666dSJohannes Berg struct work_struct chswitch_work; 892bfd8403aSJohannes Berg 893bfd8403aSJohannes Berg struct work_struct request_smps_work; 894bfd8403aSJohannes Berg bool beacon_crc_valid; 895bfd8403aSJohannes Berg u32 beacon_crc; 896bfd8403aSJohannes Berg struct ewma_beacon_signal ave_beacon_signal; 897bfd8403aSJohannes Berg int last_ave_beacon_signal; 898bfd8403aSJohannes Berg 899bfd8403aSJohannes Berg /* 900bfd8403aSJohannes Berg * Number of Beacon frames used in ave_beacon_signal. This can be used 901bfd8403aSJohannes Berg * to avoid generating less reliable cqm events that would be based 902bfd8403aSJohannes Berg * only on couple of received frames. 903bfd8403aSJohannes Berg */ 904bfd8403aSJohannes Berg unsigned int count_beacon_signal; 905bfd8403aSJohannes Berg 906bfd8403aSJohannes Berg /* Number of times beacon loss was invoked. */ 907bfd8403aSJohannes Berg unsigned int beacon_loss_count; 908bfd8403aSJohannes Berg 909bfd8403aSJohannes Berg /* 910bfd8403aSJohannes Berg * Last Beacon frame signal strength average (ave_beacon_signal / 16) 911bfd8403aSJohannes Berg * that triggered a cqm event. 0 indicates that no event has been 912bfd8403aSJohannes Berg * generated for the current association. 913bfd8403aSJohannes Berg */ 914bfd8403aSJohannes Berg int last_cqm_event_signal; 915bfd8403aSJohannes Berg 916bfd8403aSJohannes Berg int wmm_last_param_set; 917bfd8403aSJohannes Berg int mu_edca_last_param_set; 918bfd8403aSJohannes Berg 919bfd8403aSJohannes Berg struct cfg80211_bss *bss; 920bfd8403aSJohannes Berg }; 921bfd8403aSJohannes Berg 922bfd8403aSJohannes Berg struct ieee80211_link_data_ap { 923bfd8403aSJohannes Berg struct beacon_data __rcu *beacon; 924bfd8403aSJohannes Berg struct probe_resp __rcu *probe_resp; 925bfd8403aSJohannes Berg struct fils_discovery_data __rcu *fils_discovery; 926bfd8403aSJohannes Berg struct unsol_bcast_probe_resp_data __rcu *unsol_bcast_probe_resp; 927bfd8403aSJohannes Berg 928bfd8403aSJohannes Berg /* to be used after channel switch. */ 929bfd8403aSJohannes Berg struct cfg80211_beacon_data *next_beacon; 930bfd8403aSJohannes Berg }; 931bfd8403aSJohannes Berg 932bfd8403aSJohannes Berg struct ieee80211_link_data { 933b4f85443SJohannes Berg struct ieee80211_sub_if_data *sdata; 934b4f85443SJohannes Berg unsigned int link_id; 935b4f85443SJohannes Berg 936b4f85443SJohannes Berg struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ 937b4f85443SJohannes Berg struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ 938b4f85443SJohannes Berg 939bfd8403aSJohannes Berg /* multicast keys only */ 940bfd8403aSJohannes Berg struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS + 941bfd8403aSJohannes Berg NUM_DEFAULT_MGMT_KEYS + 942bfd8403aSJohannes Berg NUM_DEFAULT_BEACON_KEYS]; 943bfd8403aSJohannes Berg struct ieee80211_key __rcu *default_multicast_key; 944bfd8403aSJohannes Berg struct ieee80211_key __rcu *default_mgmt_key; 945bfd8403aSJohannes Berg struct ieee80211_key __rcu *default_beacon_key; 946bfd8403aSJohannes Berg 947bfd8403aSJohannes Berg struct work_struct csa_finalize_work; 948bfd8403aSJohannes Berg bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ 949bfd8403aSJohannes Berg struct cfg80211_chan_def csa_chandef; 950bfd8403aSJohannes Berg 951bfd8403aSJohannes Berg struct work_struct color_change_finalize_work; 952bfd8403aSJohannes Berg 953bfd8403aSJohannes Berg /* context reservation -- protected with chanctx_mtx */ 954bfd8403aSJohannes Berg struct ieee80211_chanctx *reserved_chanctx; 955bfd8403aSJohannes Berg struct cfg80211_chan_def reserved_chandef; 956bfd8403aSJohannes Berg bool reserved_radar_required; 957bfd8403aSJohannes Berg bool reserved_ready; 958bfd8403aSJohannes Berg 959bfd8403aSJohannes Berg u8 needed_rx_chains; 960bfd8403aSJohannes Berg enum ieee80211_smps_mode smps_mode; 961bfd8403aSJohannes Berg 962bfd8403aSJohannes Berg int user_power_level; /* in dBm */ 963bfd8403aSJohannes Berg int ap_power_level; /* in dBm */ 964bfd8403aSJohannes Berg 965bfd8403aSJohannes Berg bool radar_required; 966bfd8403aSJohannes Berg struct delayed_work dfs_cac_timer_work; 967bfd8403aSJohannes Berg 968bfd8403aSJohannes Berg union { 969bfd8403aSJohannes Berg struct ieee80211_link_data_managed mgd; 970bfd8403aSJohannes Berg struct ieee80211_link_data_ap ap; 971bfd8403aSJohannes Berg } u; 972d8675a63SJohannes Berg 973b3e2130bSJohannes Berg struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS]; 974b3e2130bSJohannes Berg 975d8675a63SJohannes Berg struct ieee80211_bss_conf *conf; 976bfd8403aSJohannes Berg }; 977bfd8403aSJohannes Berg 978f0706e82SJiri Benc struct ieee80211_sub_if_data { 979f0706e82SJiri Benc struct list_head list; 980f0706e82SJiri Benc 981f0706e82SJiri Benc struct wireless_dev wdev; 982f0706e82SJiri Benc 98311a843b7SJohannes Berg /* keys */ 98411a843b7SJohannes Berg struct list_head key_list; 98511a843b7SJohannes Berg 9863bff1865SYogesh Ashok Powar /* count for keys needing tailroom space allocation */ 9873bff1865SYogesh Ashok Powar int crypto_tx_tailroom_needed_cnt; 9888d1f7ecdSJohannes Berg int crypto_tx_tailroom_pending_dec; 9898d1f7ecdSJohannes Berg struct delayed_work dec_tailroom_needed_wk; 9903bff1865SYogesh Ashok Powar 991f0706e82SJiri Benc struct net_device *dev; 992f0706e82SJiri Benc struct ieee80211_local *local; 993f0706e82SJiri Benc 99413262ffdSJiri Slaby unsigned int flags; 9957e9ed188SDaniel Drake 99634d4bc4dSJohannes Berg unsigned long state; 99734d4bc4dSJohannes Berg 99847846c9bSJohannes Berg char name[IFNAMSIZ]; 99947846c9bSJohannes Berg 10003a11ce08SJohannes Berg struct ieee80211_fragment_cache frags; 1001f0706e82SJiri Benc 1002b53be792SSimon Wunderlich /* TID bitmap for NoAck policy */ 1003b53be792SSimon Wunderlich u16 noack_map; 1004b53be792SSimon Wunderlich 100500e96decSYoni Divinsky /* bit field of ACM bits (BIT(802.1D tag)) */ 100600e96decSYoni Divinsky u8 wmm_acm; 100700e96decSYoni Divinsky 1008bfd8403aSJohannes Berg struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS]; 100940b275b6SJohannes Berg struct ieee80211_key __rcu *default_unicast_key; 1010f0706e82SJiri Benc 101194778280SJohannes Berg u16 sequence_number; 1012a621fa4dSJohannes Berg __be16 control_port_protocol; 1013a621fa4dSJohannes Berg bool control_port_no_encrypt; 10147f3f96ceSMarkus Theil bool control_port_no_preauth; 1015018f6fbfSDenis Kenzior bool control_port_over_nl80211; 101694778280SJohannes Berg 101780a83cfcSMichal Kazior atomic_t num_tx_queued; 101832db6b54SKyeyoon Park struct mac80211_qos_map __rcu *qos_map; 1019f6f3def3SEliad Peller 102004ecd257SJohannes Berg /* used to reconfigure hardware SM PS */ 102104ecd257SJohannes Berg struct work_struct recalc_smps; 102204ecd257SJohannes Berg 102364592c8fSJohannes Berg struct work_struct work; 102435f20c14SJohannes Berg struct sk_buff_head skb_queue; 1025f5a4c24eSLorenzo Bianconi struct sk_buff_head status_queue; 102635f20c14SJohannes Berg 10273e122be0SJohannes Berg /* 10283e122be0SJohannes Berg * AP this belongs to: self in AP mode and 10293e122be0SJohannes Berg * corresponding AP in VLAN mode, NULL for 10303e122be0SJohannes Berg * all others (might be needed later in IBSS) 10313e122be0SJohannes Berg */ 10323e122be0SJohannes Berg struct ieee80211_if_ap *bss; 10333e122be0SJohannes Berg 103437eb0b16SJouni Malinen /* bitmap of allowed (non-MCS) rate indexes for rate control */ 103557fbcce3SJohannes Berg u32 rc_rateidx_mask[NUM_NL80211_BANDS]; 10362ffbe6d3SFelix Fietkau 103757fbcce3SJohannes Berg bool rc_has_mcs_mask[NUM_NL80211_BANDS]; 103857fbcce3SJohannes Berg u8 rc_rateidx_mcs_mask[NUM_NL80211_BANDS][IEEE80211_HT_MCS_MASK_LEN]; 1039f0706e82SJiri Benc 104057fbcce3SJohannes Berg bool rc_has_vht_mcs_mask[NUM_NL80211_BANDS]; 104157fbcce3SJohannes Berg u16 rc_rateidx_vht_mcs_mask[NUM_NL80211_BANDS][NL80211_VHT_NSS_MAX]; 1042b119ad6eSLorenzo Bianconi 104308fad438SJouni Malinen /* Beacon frame (non-MCS) rate (as a bitmap) */ 104408fad438SJouni Malinen u32 beacon_rateidx_mask[NUM_NL80211_BANDS]; 104508fad438SJouni Malinen bool beacon_rate_set; 104608fad438SJouni Malinen 1047f0706e82SJiri Benc union { 1048f0706e82SJiri Benc struct ieee80211_if_ap ap; 1049f0706e82SJiri Benc struct ieee80211_if_vlan vlan; 105046900298SJohannes Berg struct ieee80211_if_managed mgd; 105146900298SJohannes Berg struct ieee80211_if_ibss ibss; 1052472dbc45SJohannes Berg struct ieee80211_if_mesh mesh; 1053239281f8SRostislav Lisovy struct ieee80211_if_ocb ocb; 1054d8212184SAviya Erenfeld struct ieee80211_if_mntr mntr; 10555953ff6dSAyala Beker struct ieee80211_if_nan nan; 1056f0706e82SJiri Benc } u; 1057e9f207f0SJiri Benc 1058bfd8403aSJohannes Berg struct ieee80211_link_data deflink; 1059d8675a63SJohannes Berg struct ieee80211_link_data __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; 1060bfd8403aSJohannes Berg 1061e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 1062e9f207f0SJiri Benc struct { 1063295bafb4SBen Greear struct dentry *subdir_stations; 1064f7e0104cSJohannes Berg struct dentry *default_unicast_key; 1065f7e0104cSJohannes Berg struct dentry *default_multicast_key; 10663cfcf6acSJouni Malinen struct dentry *default_mgmt_key; 1067e5473e80SJouni Malinen struct dentry *default_beacon_key; 10687bcfaf2fSJohannes Berg } debugfs; 1069e9f207f0SJiri Benc #endif 1070529ba6e9SJohannes Berg 107132bfd35dSJohannes Berg /* must be last, dynamically sized area in this! */ 107232bfd35dSJohannes Berg struct ieee80211_vif vif; 1073f0706e82SJiri Benc }; 1074f0706e82SJiri Benc 107532bfd35dSJohannes Berg static inline 107632bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) 107732bfd35dSJohannes Berg { 107832bfd35dSJohannes Berg return container_of(p, struct ieee80211_sub_if_data, vif); 107932bfd35dSJohannes Berg } 108032bfd35dSJohannes Berg 10818d61ffa5SJohannes Berg static inline void sdata_lock(struct ieee80211_sub_if_data *sdata) 10828d61ffa5SJohannes Berg __acquires(&sdata->wdev.mtx) 10838d61ffa5SJohannes Berg { 10848d61ffa5SJohannes Berg mutex_lock(&sdata->wdev.mtx); 10858d61ffa5SJohannes Berg __acquire(&sdata->wdev.mtx); 10868d61ffa5SJohannes Berg } 10878d61ffa5SJohannes Berg 10888d61ffa5SJohannes Berg static inline void sdata_unlock(struct ieee80211_sub_if_data *sdata) 10898d61ffa5SJohannes Berg __releases(&sdata->wdev.mtx) 10908d61ffa5SJohannes Berg { 10918d61ffa5SJohannes Berg mutex_unlock(&sdata->wdev.mtx); 10928d61ffa5SJohannes Berg __release(&sdata->wdev.mtx); 10938d61ffa5SJohannes Berg } 10948d61ffa5SJohannes Berg 10957ca133bcSSimon Wunderlich #define sdata_dereference(p, sdata) \ 10967ca133bcSSimon Wunderlich rcu_dereference_protected(p, lockdep_is_held(&sdata->wdev.mtx)) 10977ca133bcSSimon Wunderlich 10988d61ffa5SJohannes Berg static inline void 10998d61ffa5SJohannes Berg sdata_assert_lock(struct ieee80211_sub_if_data *sdata) 11008d61ffa5SJohannes Berg { 11018d61ffa5SJohannes Berg lockdep_assert_held(&sdata->wdev.mtx); 11028d61ffa5SJohannes Berg } 11038d61ffa5SJohannes Berg 1104438b61b7SSimon Wunderlich static inline int 1105438b61b7SSimon Wunderlich ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef) 1106438b61b7SSimon Wunderlich { 1107438b61b7SSimon Wunderlich switch (chandef->width) { 1108438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 1109438b61b7SSimon Wunderlich return 2; 1110438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 1111438b61b7SSimon Wunderlich return 1; 1112438b61b7SSimon Wunderlich default: 1113438b61b7SSimon Wunderlich return 0; 1114438b61b7SSimon Wunderlich } 1115438b61b7SSimon Wunderlich } 1116438b61b7SSimon Wunderlich 1117438b61b7SSimon Wunderlich static inline int 1118438b61b7SSimon Wunderlich ieee80211_vif_get_shift(struct ieee80211_vif *vif) 1119438b61b7SSimon Wunderlich { 1120438b61b7SSimon Wunderlich struct ieee80211_chanctx_conf *chanctx_conf; 1121438b61b7SSimon Wunderlich int shift = 0; 1122438b61b7SSimon Wunderlich 1123438b61b7SSimon Wunderlich rcu_read_lock(); 1124d0a9123eSJohannes Berg chanctx_conf = rcu_dereference(vif->bss_conf.chanctx_conf); 1125438b61b7SSimon Wunderlich if (chanctx_conf) 1126438b61b7SSimon Wunderlich shift = ieee80211_chandef_get_shift(&chanctx_conf->def); 1127438b61b7SSimon Wunderlich rcu_read_unlock(); 1128438b61b7SSimon Wunderlich 1129438b61b7SSimon Wunderlich return shift; 1130438b61b7SSimon Wunderlich } 1131438b61b7SSimon Wunderlich 11322b3171c6SLorenzo Bianconi static inline int 11332b3171c6SLorenzo Bianconi ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems) 11342b3171c6SLorenzo Bianconi { 11352b3171c6SLorenzo Bianconi int i, len = 0; 11362b3171c6SLorenzo Bianconi 11372b3171c6SLorenzo Bianconi if (!elems) 11382b3171c6SLorenzo Bianconi return 0; 11392b3171c6SLorenzo Bianconi 11402b3171c6SLorenzo Bianconi for (i = 0; i < elems->cnt; i++) 11412b3171c6SLorenzo Bianconi len += elems->elem[i].len; 11422b3171c6SLorenzo Bianconi 11432b3171c6SLorenzo Bianconi return len; 11442b3171c6SLorenzo Bianconi } 11452b3171c6SLorenzo Bianconi 1146f0706e82SJiri Benc enum { 1147f0706e82SJiri Benc IEEE80211_RX_MSG = 1, 1148f0706e82SJiri Benc IEEE80211_TX_STATUS_MSG = 2, 1149f0706e82SJiri Benc }; 1150f0706e82SJiri Benc 1151ce7c9111SKalle Valo enum queue_stop_reason { 1152ce7c9111SKalle Valo IEEE80211_QUEUE_STOP_REASON_DRIVER, 1153520eb820SKalle Valo IEEE80211_QUEUE_STOP_REASON_PS, 115496f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_CSA, 115596f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_AGGREGATION, 115625420604SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SUSPEND, 11578f77f384SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SKB_ADD, 11586c17b77bSSeth Forshee IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL, 1159445ea4e8SJohannes Berg IEEE80211_QUEUE_STOP_REASON_FLUSH, 1160db67d661SArik Nemtsov IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN, 1161b6da911bSLiad Kaufman IEEE80211_QUEUE_STOP_REASON_RESERVE_TID, 1162054c9939SJohannes Berg IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE, 1163cca07b00SLuciano Coelho 1164cca07b00SLuciano Coelho IEEE80211_QUEUE_STOP_REASONS, 1165ce7c9111SKalle Valo }; 1166ce7c9111SKalle Valo 116765a6538aSLuciano Coelho #ifdef CONFIG_MAC80211_LEDS 1168e1e54068SJohannes Berg struct tpt_led_trigger { 1169e1e54068SJohannes Berg char name[32]; 1170e1e54068SJohannes Berg const struct ieee80211_tpt_blink *blink_table; 1171e1e54068SJohannes Berg unsigned int blink_table_len; 1172e1e54068SJohannes Berg struct timer_list timer; 117334f11cd3SKees Cook struct ieee80211_local *local; 1174e1e54068SJohannes Berg unsigned long prev_traffic; 1175e1e54068SJohannes Berg unsigned long tx_bytes, rx_bytes; 117667408c8cSJohannes Berg unsigned int active, want; 117767408c8cSJohannes Berg bool running; 1178e1e54068SJohannes Berg }; 117965a6538aSLuciano Coelho #endif 1180e1e54068SJohannes Berg 1181142b9f50SHelmut Schaa /** 1182142b9f50SHelmut Schaa * mac80211 scan flags - currently active scan mode 1183142b9f50SHelmut Schaa * 1184142b9f50SHelmut Schaa * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as 1185142b9f50SHelmut Schaa * well be on the operating channel 1186142b9f50SHelmut Schaa * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to 1187142b9f50SHelmut Schaa * determine if we are on the operating channel or not 11888a690674SBen Greear * @SCAN_ONCHANNEL_SCANNING: Do a software scan on only the current operating 11898a690674SBen Greear * channel. This should not interrupt normal traffic. 11908789d459SJohannes Berg * @SCAN_COMPLETED: Set for our scan work function when the driver reported 11918789d459SJohannes Berg * that the scan completed. 11928789d459SJohannes Berg * @SCAN_ABORTED: Set for our scan work function when the driver reported 11938789d459SJohannes Berg * a scan complete for an aborted scan. 1194a754055aSEmmanuel Grumbach * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being 1195a754055aSEmmanuel Grumbach * cancelled. 1196b041b7b9SFelix Fietkau * @SCAN_BEACON_WAIT: Set whenever we're passive scanning because of radar/no-IR 1197b041b7b9SFelix Fietkau * and could send a probe request after receiving a beacon. 1198b041b7b9SFelix Fietkau * @SCAN_BEACON_DONE: Beacon received, we can now send a probe request 1199142b9f50SHelmut Schaa */ 1200fbe9c429SHelmut Schaa enum { 1201fbe9c429SHelmut Schaa SCAN_SW_SCANNING, 1202142b9f50SHelmut Schaa SCAN_HW_SCANNING, 12038a690674SBen Greear SCAN_ONCHANNEL_SCANNING, 12048789d459SJohannes Berg SCAN_COMPLETED, 12058789d459SJohannes Berg SCAN_ABORTED, 1206a754055aSEmmanuel Grumbach SCAN_HW_CANCELLED, 1207b041b7b9SFelix Fietkau SCAN_BEACON_WAIT, 1208b041b7b9SFelix Fietkau SCAN_BEACON_DONE, 1209142b9f50SHelmut Schaa }; 1210142b9f50SHelmut Schaa 1211142b9f50SHelmut Schaa /** 1212142b9f50SHelmut Schaa * enum mac80211_scan_state - scan state machine states 1213142b9f50SHelmut Schaa * 1214142b9f50SHelmut Schaa * @SCAN_DECISION: Main entry point to the scan state machine, this state 1215142b9f50SHelmut Schaa * determines if we should keep on scanning or switch back to the 1216142b9f50SHelmut Schaa * operating channel 1217142b9f50SHelmut Schaa * @SCAN_SET_CHANNEL: Set the next channel to be scanned 1218142b9f50SHelmut Schaa * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses 121907ef03eeSJohannes Berg * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to 122007ef03eeSJohannes Berg * send out data 122107ef03eeSJohannes Berg * @SCAN_RESUME: Resume the scan and scan the next channel 1222cd2bb512SSam Leffler * @SCAN_ABORT: Abort the scan and go back to operating channel 1223142b9f50SHelmut Schaa */ 1224142b9f50SHelmut Schaa enum mac80211_scan_state { 1225142b9f50SHelmut Schaa SCAN_DECISION, 1226142b9f50SHelmut Schaa SCAN_SET_CHANNEL, 1227142b9f50SHelmut Schaa SCAN_SEND_PROBE, 122807ef03eeSJohannes Berg SCAN_SUSPEND, 122907ef03eeSJohannes Berg SCAN_RESUME, 1230cd2bb512SSam Leffler SCAN_ABORT, 1231fbe9c429SHelmut Schaa }; 1232fbe9c429SHelmut Schaa 1233e908435eSLorenzo Bianconi DECLARE_STATIC_KEY_FALSE(aql_disable); 1234e908435eSLorenzo Bianconi 1235f0706e82SJiri Benc struct ieee80211_local { 1236f0706e82SJiri Benc /* embed the driver visible part. 1237f0706e82SJiri Benc * don't cast (use the static inlines below), but we keep 1238f0706e82SJiri Benc * it first anyway so they become a no-op */ 1239f0706e82SJiri Benc struct ieee80211_hw hw; 1240f0706e82SJiri Benc 1241fa962b92SMichal Kazior struct fq fq; 12425caa328eSMichal Kazior struct codel_vars *cvars; 12435caa328eSMichal Kazior struct codel_params cparams; 1244fa962b92SMichal Kazior 124518667600SToke Høiland-Jørgensen /* protects active_txqs and txqi->schedule_order */ 1246942741daSFelix Fietkau spinlock_t active_txq_lock[IEEE80211_NUM_ACS]; 1247942741daSFelix Fietkau struct list_head active_txqs[IEEE80211_NUM_ACS]; 1248942741daSFelix Fietkau u16 schedule_round[IEEE80211_NUM_ACS]; 1249942741daSFelix Fietkau 1250b4809e94SToke Høiland-Jørgensen u16 airtime_flags; 1251942741daSFelix Fietkau u32 aql_txq_limit_low[IEEE80211_NUM_ACS]; 1252942741daSFelix Fietkau u32 aql_txq_limit_high[IEEE80211_NUM_ACS]; 12533ace10f5SKan Yan u32 aql_threshold; 12543ace10f5SKan Yan atomic_t aql_total_pending_airtime; 12558e4bac06SFelix Fietkau atomic_t aql_ac_pending_airtime[IEEE80211_NUM_ACS]; 1256b4809e94SToke Høiland-Jørgensen 1257f0706e82SJiri Benc const struct ieee80211_ops *ops; 1258f0706e82SJiri Benc 125942935ecaSLuis R. Rodriguez /* 126042935ecaSLuis R. Rodriguez * private workqueue to mac80211. mac80211 makes this accessible 126142935ecaSLuis R. Rodriguez * via ieee80211_queue_work() 126242935ecaSLuis R. Rodriguez */ 126342935ecaSLuis R. Rodriguez struct workqueue_struct *workqueue; 126442935ecaSLuis R. Rodriguez 1265e4e72fb4SJohannes Berg unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES]; 1266cca07b00SLuciano Coelho int q_stop_reasons[IEEE80211_MAX_QUEUES][IEEE80211_QUEUE_STOP_REASONS]; 126796f5e66eSJohannes Berg /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */ 1268ce7c9111SKalle Valo spinlock_t queue_stop_reason_lock; 126996f5e66eSJohannes Berg 1270f0706e82SJiri Benc int open_count; 12713d30d949SMichael Wu int monitors, cooked_mntrs; 12728cc9a739SMichael Wu /* number of interfaces with corresponding FIF_ flags */ 12737be5086dSJohannes Berg int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll, 12747be5086dSJohannes Berg fif_probe_req; 12756cd536feSJohannes Berg bool probe_req_reg; 1276873b1cf6SJouni Malinen bool rx_mcast_action_reg; 12774150c572SJohannes Berg unsigned int filter_flags; /* FIF_* */ 12783b8d81e0SJohannes Berg 12793ffc2a90SJohannes Berg bool wiphy_ciphers_allocated; 12803ffc2a90SJohannes Berg 1281fe57d9f5SJohannes Berg bool use_chanctx; 1282fe57d9f5SJohannes Berg 12833b8d81e0SJohannes Berg /* protects the aggregated multicast list and filter calls */ 12843b8d81e0SJohannes Berg spinlock_t filter_lock; 12853b8d81e0SJohannes Berg 12863ac64beeSJohannes Berg /* used for uploading changed mc list */ 12873ac64beeSJohannes Berg struct work_struct reconfig_filter; 12883ac64beeSJohannes Berg 12893b8d81e0SJohannes Berg /* aggregated multicast list */ 129022bedad3SJiri Pirko struct netdev_hw_addr_list mc_list; 12913b8d81e0SJohannes Berg 1292d0709a65SJohannes Berg bool tim_in_locked_section; /* see ieee80211_beacon_get() */ 12935bb644a0SJohannes Berg 12945bb644a0SJohannes Berg /* 12955bb644a0SJohannes Berg * suspended is true if we finished all the suspend _and_ we have 12965bb644a0SJohannes Berg * not yet come up from resume. This is to be used by mac80211 12975bb644a0SJohannes Berg * to ensure driver sanity during suspend and mac80211's own 12985bb644a0SJohannes Berg * sanity. It can eventually be used for WoW as well. 12995bb644a0SJohannes Berg */ 13005bb644a0SJohannes Berg bool suspended; 13015bb644a0SJohannes Berg 1302b33fb28cSLoic Poulain /* suspending is true during the whole suspend process */ 1303b33fb28cSLoic Poulain bool suspending; 1304b33fb28cSLoic Poulain 13055bb644a0SJohannes Berg /* 1306ceb99fe0SJohannes Berg * Resuming is true while suspended, but when we're reprogramming the 1307ceb99fe0SJohannes Berg * hardware -- at that time it's allowed to use ieee80211_queue_work() 1308ceb99fe0SJohannes Berg * again even though some other parts of the stack are still suspended 1309ceb99fe0SJohannes Berg * and we still drop received frames to avoid waking the stack. 1310ceb99fe0SJohannes Berg */ 1311ceb99fe0SJohannes Berg bool resuming; 1312ceb99fe0SJohannes Berg 1313ceb99fe0SJohannes Berg /* 13145bb644a0SJohannes Berg * quiescing is true during the suspend process _only_ to 13155bb644a0SJohannes Berg * ease timer cancelling etc. 13165bb644a0SJohannes Berg */ 13175bb644a0SJohannes Berg bool quiescing; 13185bb644a0SJohannes Berg 1319ea77f12fSJohannes Berg /* device is started */ 1320ea77f12fSJohannes Berg bool started; 1321ea77f12fSJohannes Berg 132204800adaSArik Nemtsov /* device is during a HW reconfig */ 132304800adaSArik Nemtsov bool in_reconfig; 132404800adaSArik Nemtsov 1325eecc4800SJohannes Berg /* wowlan is enabled -- don't reconfig on resume */ 1326eecc4800SJohannes Berg bool wowlan; 1327eecc4800SJohannes Berg 1328164eb02dSSimon Wunderlich struct work_struct radar_detected_work; 1329164eb02dSSimon Wunderlich 133004ecd257SJohannes Berg /* number of RX chains the hardware has */ 133104ecd257SJohannes Berg u8 rx_chains; 133204ecd257SJohannes Berg 133309b4a4faSJohannes Berg /* bitmap of which sbands were copied */ 133409b4a4faSJohannes Berg u8 sband_allocated; 133509b4a4faSJohannes Berg 1336b306f453SJohannes Berg int tx_headroom; /* required headroom for hardware/radiotap */ 1337f0706e82SJiri Benc 1338f0706e82SJiri Benc /* Tasklet and skb queue to process calls from IRQ mode. All frames 1339f0706e82SJiri Benc * added to skb_queue will be processed, but frames in 1340f0706e82SJiri Benc * skb_queue_unreliable may be dropped if the total length of these 1341f0706e82SJiri Benc * queues increases over the limit. */ 1342f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128 1343f0706e82SJiri Benc struct tasklet_struct tasklet; 1344f0706e82SJiri Benc struct sk_buff_head skb_queue; 1345f0706e82SJiri Benc struct sk_buff_head skb_queue_unreliable; 1346f0706e82SJiri Benc 1347f9e124fbSChristian Lamparter spinlock_t rx_path_lock; 134824a8fdadSChristian Lamparter 1349d0709a65SJohannes Berg /* Station data */ 1350d0709a65SJohannes Berg /* 13514d33960bSJohannes Berg * The mutex only protects the list, hash table and 13524d33960bSJohannes Berg * counter, reads are done with RCU. 1353d0709a65SJohannes Berg */ 135434e89507SJohannes Berg struct mutex sta_mtx; 13554d33960bSJohannes Berg spinlock_t tim_lock; 1356d0709a65SJohannes Berg unsigned long num_sta; 13574d33960bSJohannes Berg struct list_head sta_list; 135883e7e4ceSHerbert Xu struct rhltable sta_hash; 1359ba6ddab9SJohannes Berg struct rhltable link_sta_hash; 1360f0706e82SJiri Benc struct timer_list sta_cleanup; 1361f5ea9120SJohannes Berg int sta_generation; 1362f0706e82SJiri Benc 13632a577d98SJohannes Berg struct sk_buff_head pending[IEEE80211_MAX_QUEUES]; 1364f0706e82SJiri Benc struct tasklet_struct tx_pending_tasklet; 136521a5d4c3SManikanta Pubbisetty struct tasklet_struct wake_txqs_tasklet; 1366f0706e82SJiri Benc 1367a6a67db2SJohannes Berg atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES]; 1368cd8ffc80SJohannes Berg 1369df140465SJohannes Berg /* number of interfaces with allmulti RX */ 1370df140465SJohannes Berg atomic_t iff_allmultis; 1371f0706e82SJiri Benc 1372f0706e82SJiri Benc struct rate_control_ref *rate_ctrl; 1373f0706e82SJiri Benc 13745fdb3735SArd Biesheuvel struct arc4_ctx wep_tx_ctx; 13755fdb3735SArd Biesheuvel struct arc4_ctx wep_rx_ctx; 1376f0706e82SJiri Benc u32 wep_iv; 1377f0706e82SJiri Benc 1378c771c9d8SJohannes Berg /* see iface.c */ 137979010420SJohannes Berg struct list_head interfaces; 1380f64331d5SJohannes Berg struct list_head mon_list; /* only that are IFF_UP && !cooked */ 1381c771c9d8SJohannes Berg struct mutex iflist_mtx; 138279010420SJohannes Berg 1383b16bd15cSJohannes Berg /* 1384ad0e2b5aSJohannes Berg * Key mutex, protects sdata's key_list and sta_info's 138596fc6efbSAlexander Wetzel * key pointers and ptk_idx (write access, they're RCU.) 1386b16bd15cSJohannes Berg */ 1387ad0e2b5aSJohannes Berg struct mutex key_mtx; 1388b16bd15cSJohannes Berg 1389a1699b75SJohannes Berg /* mutex for scan and work locking */ 1390a1699b75SJohannes Berg struct mutex mtx; 1391b16bd15cSJohannes Berg 1392c2b13452SJohannes Berg /* Scanning and BSS list */ 1393fbe9c429SHelmut Schaa unsigned long scanning; 13942a519311SJohannes Berg struct cfg80211_ssid scan_ssid; 13955ba63533SJohannes Berg struct cfg80211_scan_request *int_scan_req; 13966ea0a69cSJohannes Berg struct cfg80211_scan_request __rcu *scan_req; 1397c56ef672SDavid Spinadel struct ieee80211_scan_request *hw_scan_req; 13987ca15a0aSSimon Wunderlich struct cfg80211_chan_def scan_chandef; 139957fbcce3SJohannes Berg enum nl80211_band hw_scan_band; 1400f0706e82SJiri Benc int scan_channel_idx; 1401de95a54bSJohannes Berg int scan_ies_len; 1402c604b9f2SJohannes Berg int hw_scan_ies_bufsize; 14037947d3e0SAvraham Stern struct cfg80211_scan_info scan_info; 14048318d78aSJohannes Berg 140585a9994aSLuciano Coelho struct work_struct sched_scan_stopped_work; 14065260a5b2SJohannes Berg struct ieee80211_sub_if_data __rcu *sched_scan_sdata; 14076ea0a69cSJohannes Berg struct cfg80211_sched_scan_request __rcu *sched_scan_req; 1408a344d677SJohannes Berg u8 scan_addr[ETH_ALEN]; 140979f460caSLuciano Coelho 1410df13cce5SHelmut Schaa unsigned long leave_oper_channel_time; 1411977923b0SHelmut Schaa enum mac80211_scan_state next_scan_state; 1412f0706e82SJiri Benc struct delayed_work scan_work; 1413e2fd5dbcSJohannes Berg struct ieee80211_sub_if_data __rcu *scan_sdata; 141455de908aSJohannes Berg /* For backward compatibility only -- do not use */ 1415675a0b04SKarl Beldan struct cfg80211_chan_def _oper_chandef; 1416f0706e82SJiri Benc 1417b8bc4b0aSJohannes Berg /* Temporary remain-on-channel for off-channel operations */ 1418b8bc4b0aSJohannes Berg struct ieee80211_channel *tmp_channel; 1419b8bc4b0aSJohannes Berg 1420d01a1e65SMichal Kazior /* channel contexts */ 1421d01a1e65SMichal Kazior struct list_head chanctx_list; 1422d01a1e65SMichal Kazior struct mutex chanctx_mtx; 1423d01a1e65SMichal Kazior 1424c206ca67SJohannes Berg #ifdef CONFIG_MAC80211_LEDS 14258d5c2585SJohannes Berg struct led_trigger tx_led, rx_led, assoc_led, radio_led; 14268d5c2585SJohannes Berg struct led_trigger tpt_led; 14278d5c2585SJohannes Berg atomic_t tx_led_active, rx_led_active, assoc_led_active; 14288d5c2585SJohannes Berg atomic_t radio_led_active, tpt_led_active; 1429c206ca67SJohannes Berg struct tpt_led_trigger *tpt_led_trigger; 1430c206ca67SJohannes Berg #endif 1431c206ca67SJohannes Berg 1432c206ca67SJohannes Berg #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 1433f0706e82SJiri Benc /* SNMP counters */ 1434f0706e82SJiri Benc /* dot11CountersTable */ 1435f0706e82SJiri Benc u32 dot11TransmittedFragmentCount; 1436f0706e82SJiri Benc u32 dot11MulticastTransmittedFrameCount; 1437f0706e82SJiri Benc u32 dot11FailedCount; 1438f0706e82SJiri Benc u32 dot11RetryCount; 1439f0706e82SJiri Benc u32 dot11MultipleRetryCount; 1440f0706e82SJiri Benc u32 dot11FrameDuplicateCount; 1441f0706e82SJiri Benc u32 dot11ReceivedFragmentCount; 1442f0706e82SJiri Benc u32 dot11MulticastReceivedFrameCount; 1443f0706e82SJiri Benc u32 dot11TransmittedFrameCount; 1444f0706e82SJiri Benc 1445f0706e82SJiri Benc /* TX/RX handler statistics */ 1446f0706e82SJiri Benc unsigned int tx_handlers_drop; 1447f0706e82SJiri Benc unsigned int tx_handlers_queued; 1448f0706e82SJiri Benc unsigned int tx_handlers_drop_wep; 1449f0706e82SJiri Benc unsigned int tx_handlers_drop_not_assoc; 1450f0706e82SJiri Benc unsigned int tx_handlers_drop_unauth_port; 1451f0706e82SJiri Benc unsigned int rx_handlers_drop; 1452f0706e82SJiri Benc unsigned int rx_handlers_queued; 1453f0706e82SJiri Benc unsigned int rx_handlers_drop_nullfunc; 1454f0706e82SJiri Benc unsigned int rx_handlers_drop_defrag; 1455f0706e82SJiri Benc unsigned int tx_expand_skb_head; 1456f0706e82SJiri Benc unsigned int tx_expand_skb_head_cloned; 1457f1160434SJohannes Berg unsigned int rx_expand_skb_head_defrag; 1458f0706e82SJiri Benc unsigned int rx_handlers_fragments; 1459f0706e82SJiri Benc unsigned int tx_status_drop; 1460f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++ 1461f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */ 1462f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0) 1463f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ 1464f0706e82SJiri Benc 1465f0706e82SJiri Benc 1466f0706e82SJiri Benc int total_ps_buffered; /* total number of all buffered unicast and 1467f0706e82SJiri Benc * multicast packets for power saving stations 1468f0706e82SJiri Benc */ 1469520eb820SKalle Valo 1470572e0012SKalle Valo bool pspolling; 1471965bedadSJohannes Berg /* 1472965bedadSJohannes Berg * PS can only be enabled when we have exactly one managed 1473965bedadSJohannes Berg * interface (and monitors) in PS, this then points there. 1474965bedadSJohannes Berg */ 1475965bedadSJohannes Berg struct ieee80211_sub_if_data *ps_sdata; 1476520eb820SKalle Valo struct work_struct dynamic_ps_enable_work; 1477520eb820SKalle Valo struct work_struct dynamic_ps_disable_work; 1478520eb820SKalle Valo struct timer_list dynamic_ps_timer; 14792b2c009eSJuuso Oikarinen struct notifier_block ifa_notifier; 1480a65240c1SJohannes Berg struct notifier_block ifa6_notifier; 1481f0706e82SJiri Benc 1482ff616381SJuuso Oikarinen /* 1483ff616381SJuuso Oikarinen * The dynamic ps timeout configured from user space via WEXT - 1484ff616381SJuuso Oikarinen * this will override whatever chosen by mac80211 internally. 1485ff616381SJuuso Oikarinen */ 1486ff616381SJuuso Oikarinen int dynamic_ps_forced_timeout; 1487ff616381SJuuso Oikarinen 14881ea6f9c0SJohannes Berg int user_power_level; /* in dBm, for all interfaces */ 14892bf30fabSJohannes Berg 14900f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode; 14910f78231bSJohannes Berg 1492f2753ddbSJohannes Berg struct work_struct restart_work; 1493f2753ddbSJohannes Berg 1494e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 1495e9f207f0SJiri Benc struct local_debugfsdentries { 14964b7679a5SJohannes Berg struct dentry *rcdir; 1497e9f207f0SJiri Benc struct dentry *keys; 1498e9f207f0SJiri Benc } debugfs; 1499276d9e82SJulius Niedworok bool force_tx_status; 1500e9f207f0SJiri Benc #endif 15014e6cbfd0SJohn W. Linville 15022eb278e0SJohannes Berg /* 15032eb278e0SJohannes Berg * Remain-on-channel support 15042eb278e0SJohannes Berg */ 1505aaa016ccSJohannes Berg struct delayed_work roc_work; 15062eb278e0SJohannes Berg struct list_head roc_list; 150721f83589SJohannes Berg struct work_struct hw_roc_start, hw_roc_done; 15082eb278e0SJohannes Berg unsigned long hw_roc_start_time; 150950febf6aSJohannes Berg u64 roc_cookie_counter; 151021f83589SJohannes Berg 1511a729cff8SJohannes Berg struct idr ack_status_frames; 1512a729cff8SJohannes Berg spinlock_t ack_status_lock; 1513a729cff8SJohannes Berg 1514f142c6b9SJohannes Berg struct ieee80211_sub_if_data __rcu *p2p_sdata; 1515f142c6b9SJohannes Berg 15164b6f1dd6SJohannes Berg /* virtual monitor interface */ 15174b6f1dd6SJohannes Berg struct ieee80211_sub_if_data __rcu *monitor_sdata; 15184bf88530SJohannes Berg struct cfg80211_chan_def monitor_chandef; 1519e9a21949SLuciano Coelho 1520e9a21949SLuciano Coelho /* extended capabilities provided by mac80211 */ 1521e9a21949SLuciano Coelho u8 ext_capa[8]; 1522f0706e82SJiri Benc }; 1523f0706e82SJiri Benc 15243e122be0SJohannes Berg static inline struct ieee80211_sub_if_data * 1525d787a3e3SFelix Fietkau IEEE80211_DEV_TO_SUB_IF(const struct net_device *dev) 15263e122be0SJohannes Berg { 15273e122be0SJohannes Berg return netdev_priv(dev); 15283e122be0SJohannes Berg } 15293e122be0SJohannes Berg 153071bbc994SJohannes Berg static inline struct ieee80211_sub_if_data * 153171bbc994SJohannes Berg IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev) 153271bbc994SJohannes Berg { 153371bbc994SJohannes Berg return container_of(wdev, struct ieee80211_sub_if_data, wdev); 153471bbc994SJohannes Berg } 153571bbc994SJohannes Berg 153621a8e9ddSMohammed Shafi Shajakhan static inline struct ieee80211_supported_band * 153721a8e9ddSMohammed Shafi Shajakhan ieee80211_get_sband(struct ieee80211_sub_if_data *sdata) 153821a8e9ddSMohammed Shafi Shajakhan { 153921a8e9ddSMohammed Shafi Shajakhan struct ieee80211_local *local = sdata->local; 154021a8e9ddSMohammed Shafi Shajakhan struct ieee80211_chanctx_conf *chanctx_conf; 154121a8e9ddSMohammed Shafi Shajakhan enum nl80211_band band; 154221a8e9ddSMohammed Shafi Shajakhan 15431dd0f31cSJohannes Berg WARN_ON(sdata->vif.valid_links); 15441dd0f31cSJohannes Berg 154521a8e9ddSMohammed Shafi Shajakhan rcu_read_lock(); 1546d0a9123eSJohannes Berg chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf); 154721a8e9ddSMohammed Shafi Shajakhan 15480ee4d555SJohannes Berg if (!chanctx_conf) { 154921a8e9ddSMohammed Shafi Shajakhan rcu_read_unlock(); 155021a8e9ddSMohammed Shafi Shajakhan return NULL; 155121a8e9ddSMohammed Shafi Shajakhan } 155221a8e9ddSMohammed Shafi Shajakhan 155321a8e9ddSMohammed Shafi Shajakhan band = chanctx_conf->def.chan->band; 155421a8e9ddSMohammed Shafi Shajakhan rcu_read_unlock(); 155521a8e9ddSMohammed Shafi Shajakhan 155621a8e9ddSMohammed Shafi Shajakhan return local->hw.wiphy->bands[band]; 155721a8e9ddSMohammed Shafi Shajakhan } 155821a8e9ddSMohammed Shafi Shajakhan 1559f91cb507SShaul Triebitz static inline struct ieee80211_supported_band * 1560d8675a63SJohannes Berg ieee80211_get_link_sband(struct ieee80211_link_data *link) 1561f91cb507SShaul Triebitz { 1562d8675a63SJohannes Berg struct ieee80211_local *local = link->sdata->local; 1563f91cb507SShaul Triebitz struct ieee80211_chanctx_conf *chanctx_conf; 1564f91cb507SShaul Triebitz enum nl80211_band band; 1565f91cb507SShaul Triebitz 1566f91cb507SShaul Triebitz rcu_read_lock(); 1567d8675a63SJohannes Berg chanctx_conf = rcu_dereference(link->conf->chanctx_conf); 1568f91cb507SShaul Triebitz if (!chanctx_conf) { 1569f91cb507SShaul Triebitz rcu_read_unlock(); 1570f91cb507SShaul Triebitz return NULL; 1571f91cb507SShaul Triebitz } 1572f91cb507SShaul Triebitz 1573f91cb507SShaul Triebitz band = chanctx_conf->def.chan->band; 1574f91cb507SShaul Triebitz rcu_read_unlock(); 1575f91cb507SShaul Triebitz 1576f91cb507SShaul Triebitz return local->hw.wiphy->bands[band]; 1577f91cb507SShaul Triebitz } 1578f91cb507SShaul Triebitz 1579c0f17eb9SChun-Yeow Yeoh /* this struct holds the value parsing from channel switch IE */ 1580c0f17eb9SChun-Yeow Yeoh struct ieee80211_csa_ie { 1581c0f17eb9SChun-Yeow Yeoh struct cfg80211_chan_def chandef; 1582c0f17eb9SChun-Yeow Yeoh u8 mode; 1583c0f17eb9SChun-Yeow Yeoh u8 count; 1584c0f17eb9SChun-Yeow Yeoh u8 ttl; 15853f718fd8SChun-Yeow Yeoh u16 pre_value; 15865d55371bSBenjamin Berg u16 reason_code; 1587ee145775SSara Sharon u32 max_switch_time; 1588c0f17eb9SChun-Yeow Yeoh }; 1589c0f17eb9SChun-Yeow Yeoh 1590dd76986bSJohannes Berg /* Parsed Information Elements */ 1591dd76986bSJohannes Berg struct ieee802_11_elems { 15924a3cb702SJohannes Berg const u8 *ie_start; 1593dd76986bSJohannes Berg size_t total_len; 1594c6e37ed4SJohannes Berg u32 crc; 1595dd76986bSJohannes Berg 1596dd76986bSJohannes Berg /* pointers to IEs */ 159753837584SArik Nemtsov const struct ieee80211_tdls_lnkie *lnk_id; 159853837584SArik Nemtsov const struct ieee80211_ch_switch_timing *ch_sw_timing; 15999041c1faSArik Nemtsov const u8 *ext_capab; 16004a3cb702SJohannes Berg const u8 *ssid; 16014a3cb702SJohannes Berg const u8 *supp_rates; 16024a3cb702SJohannes Berg const u8 *ds_params; 16034a3cb702SJohannes Berg const struct ieee80211_tim_ie *tim; 16044a3cb702SJohannes Berg const u8 *rsn; 1605c0058df7SShaul Triebitz const u8 *rsnx; 16064a3cb702SJohannes Berg const u8 *erp_info; 16074a3cb702SJohannes Berg const u8 *ext_supp_rates; 16084a3cb702SJohannes Berg const u8 *wmm_info; 16094a3cb702SJohannes Berg const u8 *wmm_param; 16104a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_elem; 16114a3cb702SJohannes Berg const struct ieee80211_ht_operation *ht_operation; 16124a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_elem; 16134a3cb702SJohannes Berg const struct ieee80211_vht_operation *vht_operation; 16144a3cb702SJohannes Berg const struct ieee80211_meshconf_ie *mesh_config; 161541cbb0f5SLuca Coelho const u8 *he_cap; 161641cbb0f5SLuca Coelho const struct ieee80211_he_operation *he_operation; 1617ef11a931SJohn Crispin const struct ieee80211_he_spr *he_spr; 161841cbb0f5SLuca Coelho const struct ieee80211_mu_edca_param_set *mu_edca_param_set; 1619a6cf28e0SRajkumar Manoharan const struct ieee80211_he_6ghz_capa *he_6ghz_capa; 1620b0345850SWen Gong const struct ieee80211_tx_pwr_env *tx_pwr_env[IEEE80211_TPE_MAX_IE_COUNT]; 162141cbb0f5SLuca Coelho const u8 *uora_element; 16224a3cb702SJohannes Berg const u8 *mesh_id; 16234a3cb702SJohannes Berg const u8 *peering; 16244a3cb702SJohannes Berg const __le16 *awake_window; 16254a3cb702SJohannes Berg const u8 *preq; 16264a3cb702SJohannes Berg const u8 *prep; 16274a3cb702SJohannes Berg const u8 *perr; 16284a3cb702SJohannes Berg const struct ieee80211_rann_ie *rann; 16294a3cb702SJohannes Berg const struct ieee80211_channel_sw_ie *ch_switch_ie; 1630b4f286a1SJohannes Berg const struct ieee80211_ext_chansw_ie *ext_chansw_ie; 1631b2e506bfSJohannes Berg const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie; 1632ee145775SSara Sharon const u8 *max_channel_switch_time; 16334a3cb702SJohannes Berg const u8 *country_elem; 16344a3cb702SJohannes Berg const u8 *pwr_constr_elem; 1635c8d65917SSteinar H. Gunderson const u8 *cisco_dtpc_elem; 163679ba1d89SJohannes Berg const struct ieee80211_timeout_interval_ie *timeout_int; 16374a3cb702SJohannes Berg const u8 *opmode_notif; 163885220d71SJohannes Berg const struct ieee80211_sec_chan_offs_ie *sec_chan_offs; 1639c4de37eeSPeter Oh struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie; 1640e38a017bSAvraham Stern const struct ieee80211_bss_max_idle_period_ie *max_idle_period_ie; 164178ac51f8SSara Sharon const struct ieee80211_multiple_bssid_configuration *mbssid_config_ie; 164278ac51f8SSara Sharon const struct ieee80211_bssid_index *bssid_index; 164378ac51f8SSara Sharon u8 max_bssid_indicator; 164478ac51f8SSara Sharon u8 dtim_count; 164578ac51f8SSara Sharon u8 dtim_period; 16462aa485e1SJohn Crispin const struct ieee80211_addba_ext_ie *addba_ext_ie; 1647cd418ba6SThomas Pedersen const struct ieee80211_s1g_cap *s1g_capab; 1648cd418ba6SThomas Pedersen const struct ieee80211_s1g_oper_ie *s1g_oper; 1649cd418ba6SThomas Pedersen const struct ieee80211_s1g_bcn_compat_ie *s1g_bcn_compat; 16501d00ce80SThomas Pedersen const struct ieee80211_aid_response_ie *aid_resp; 1651f0e6bea8SIlan Peer const struct ieee80211_eht_cap_elem *eht_cap; 1652f0e6bea8SIlan Peer const struct ieee80211_eht_operation *eht_operation; 1653dd76986bSJohannes Berg 1654dd76986bSJohannes Berg /* length of them, respectively */ 16559041c1faSArik Nemtsov u8 ext_capab_len; 1656dd76986bSJohannes Berg u8 ssid_len; 1657dd76986bSJohannes Berg u8 supp_rates_len; 1658dd76986bSJohannes Berg u8 tim_len; 1659dd76986bSJohannes Berg u8 rsn_len; 1660c0058df7SShaul Triebitz u8 rsnx_len; 1661dd76986bSJohannes Berg u8 ext_supp_rates_len; 1662dd76986bSJohannes Berg u8 wmm_info_len; 1663dd76986bSJohannes Berg u8 wmm_param_len; 166441cbb0f5SLuca Coelho u8 he_cap_len; 1665dd76986bSJohannes Berg u8 mesh_id_len; 1666dd76986bSJohannes Berg u8 peering_len; 1667dd76986bSJohannes Berg u8 preq_len; 1668dd76986bSJohannes Berg u8 prep_len; 1669dd76986bSJohannes Berg u8 perr_len; 1670dd76986bSJohannes Berg u8 country_elem_len; 167178ac51f8SSara Sharon u8 bssid_index_len; 1672b0345850SWen Gong u8 tx_pwr_env_len[IEEE80211_TPE_MAX_IE_COUNT]; 1673b0345850SWen Gong u8 tx_pwr_env_num; 1674f0e6bea8SIlan Peer u8 eht_cap_len; 1675fcff4f10SPaul Stewart 1676fcff4f10SPaul Stewart /* whether a parse error occurred while retrieving these elements */ 1677fcff4f10SPaul Stewart bool parse_error; 1678dd76986bSJohannes Berg }; 1679dd76986bSJohannes Berg 1680f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local( 1681f0706e82SJiri Benc struct ieee80211_hw *hw) 1682f0706e82SJiri Benc { 1683f0706e82SJiri Benc return container_of(hw, struct ieee80211_local, hw); 1684f0706e82SJiri Benc } 1685f0706e82SJiri Benc 1686ba8c3d6fSFelix Fietkau static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq) 1687ba8c3d6fSFelix Fietkau { 1688ba8c3d6fSFelix Fietkau return container_of(txq, struct txq_info, txq); 1689ba8c3d6fSFelix Fietkau } 1690f0706e82SJiri Benc 1691bb42f2d1SToke Høiland-Jørgensen static inline bool txq_has_queue(struct ieee80211_txq *txq) 1692bb42f2d1SToke Høiland-Jørgensen { 1693bb42f2d1SToke Høiland-Jørgensen struct txq_info *txqi = to_txq_info(txq); 1694bb42f2d1SToke Høiland-Jørgensen 1695bb42f2d1SToke Høiland-Jørgensen return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets); 1696bb42f2d1SToke Høiland-Jørgensen } 1697bb42f2d1SToke Høiland-Jørgensen 1698f4bda337SThomas Pedersen static inline bool 1699f4bda337SThomas Pedersen ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) 1700f4bda337SThomas Pedersen { 1701f4bda337SThomas Pedersen WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START && 1702f4bda337SThomas Pedersen status->flag & RX_FLAG_MACTIME_END); 1703da388233SAvraham Stern return !!(status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END | 1704da388233SAvraham Stern RX_FLAG_MACTIME_PLCP_START)); 1705f4bda337SThomas Pedersen } 1706571ecf67SJohannes Berg 170772f15d53SMichael Braun void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata); 170872f15d53SMichael Braun void ieee80211_vif_dec_num_mcast(struct ieee80211_sub_if_data *sdata); 170972f15d53SMichael Braun 171072f15d53SMichael Braun /* This function returns the number of multicast stations connected to this 171172f15d53SMichael Braun * interface. It returns -1 if that number is not tracked, that is for netdevs 171272f15d53SMichael Braun * not in AP or AP_VLAN mode or when using 4addr. 171372f15d53SMichael Braun */ 171472f15d53SMichael Braun static inline int 171572f15d53SMichael Braun ieee80211_vif_get_num_mcast_if(struct ieee80211_sub_if_data *sdata) 171672f15d53SMichael Braun { 171772f15d53SMichael Braun if (sdata->vif.type == NL80211_IFTYPE_AP) 171872f15d53SMichael Braun return atomic_read(&sdata->u.ap.num_mcast_sta); 171972f15d53SMichael Braun if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta) 172072f15d53SMichael Braun return atomic_read(&sdata->u.vlan.num_mcast_sta); 172172f15d53SMichael Braun return -1; 172272f15d53SMichael Braun } 172372f15d53SMichael Braun 1724f4bda337SThomas Pedersen u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, 1725f4bda337SThomas Pedersen struct ieee80211_rx_status *status, 1726f4bda337SThomas Pedersen unsigned int mpdu_len, 1727f4bda337SThomas Pedersen unsigned int mpdu_offset); 1728e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); 17295cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); 17309c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 17317b7090b4SJohannes Berg u64 changed); 17327b7090b4SJohannes Berg void ieee80211_vif_cfg_change_notify(struct ieee80211_sub_if_data *sdata, 17337b7090b4SJohannes Berg u64 changed); 17347b7090b4SJohannes Berg void ieee80211_link_info_change_notify(struct ieee80211_sub_if_data *sdata, 1735d8675a63SJohannes Berg struct ieee80211_link_data *link, 1736d8675a63SJohannes Berg u64 changed); 17370d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local); 173846900298SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 1739f0706e82SJiri Benc 1740a2fcfccbSJohannes Berg u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local); 17415ee00dbdSJohannes Berg int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb, 17425ee00dbdSJohannes Berg u64 *cookie, gfp_t gfp); 1743a2fcfccbSJohannes Berg 174449ddf8e6SJohannes Berg void ieee80211_check_fast_rx(struct sta_info *sta); 174549ddf8e6SJohannes Berg void __ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata); 174649ddf8e6SJohannes Berg void ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata); 174749ddf8e6SJohannes Berg void ieee80211_clear_fast_rx(struct sta_info *sta); 174849ddf8e6SJohannes Berg 174946900298SJohannes Berg /* STA code */ 17509c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); 175177fdaa12SJohannes Berg int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, 175277fdaa12SJohannes Berg struct cfg80211_auth_request *req); 175377fdaa12SJohannes Berg int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, 175477fdaa12SJohannes Berg struct cfg80211_assoc_request *req); 175577fdaa12SJohannes Berg int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, 175663c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 175777fdaa12SJohannes Berg int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, 175863c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 1759572e0012SKalle Valo void ieee80211_send_pspoll(struct ieee80211_local *local, 1760572e0012SKalle Valo struct ieee80211_sub_if_data *sdata); 17614a733ef1SJohannes Berg void ieee80211_recalc_ps(struct ieee80211_local *local); 1762ab095877SEliad Peller void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata); 17632b2c009eSJuuso Oikarinen int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); 17641fa57d01SJohannes Berg void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); 17651fa57d01SJohannes Berg void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 17661fa57d01SJohannes Berg struct sk_buff *skb); 176709a740ceSThomas Pedersen void ieee80211_sta_rx_queued_ext(struct ieee80211_sub_if_data *sdata, 176809a740ceSThomas Pedersen struct sk_buff *skb); 1769d3a910a8SLuis R. Rodriguez void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); 1770be099e82SLuis R. Rodriguez void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); 1771afa762f6SEliad Peller void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata); 17721672c0e3SJohannes Berg void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata, 17731672c0e3SJohannes Berg __le16 fc, bool acked); 17741a1cb744SJohannes Berg void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata); 1775b8360ab8SJohannes Berg void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata); 177602219b3aSJohannes Berg void ieee80211_sta_handle_tspec_ac_params(struct ieee80211_sub_if_data *sdata); 17777dd231ebSNaftali Goldstein void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata, 177853da4c45SJohannes Berg u8 reason, bool tx); 1779b2e8434fSJohannes Berg void ieee80211_mgd_setup_link(struct ieee80211_link_data *link); 1780b2e8434fSJohannes Berg void ieee80211_mgd_stop_link(struct ieee80211_link_data *link); 17819c6bd790SJohannes Berg 178246900298SJohannes Berg /* IBSS code */ 178346900298SJohannes Berg void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); 178446900298SJohannes Berg void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata); 17858bf11d8dSJohannes Berg void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, 17868bf11d8dSJohannes Berg const u8 *bssid, const u8 *addr, u32 supp_rates); 1787af8cdcd8SJohannes Berg int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, 1788af8cdcd8SJohannes Berg struct cfg80211_ibss_params *params); 1789af8cdcd8SJohannes Berg int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata); 17901fa57d01SJohannes Berg void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata); 17911fa57d01SJohannes Berg void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 17921fa57d01SJohannes Berg struct sk_buff *skb); 1793cd7760e6SSimon Wunderlich int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata, 1794cd7760e6SSimon Wunderlich struct cfg80211_csa_settings *csa_settings); 1795cd7760e6SSimon Wunderlich int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata); 1796cd7760e6SSimon Wunderlich void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata); 17971fa57d01SJohannes Berg 1798239281f8SRostislav Lisovy /* OCB code */ 1799239281f8SRostislav Lisovy void ieee80211_ocb_work(struct ieee80211_sub_if_data *sdata); 1800239281f8SRostislav Lisovy void ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data *sdata, 1801239281f8SRostislav Lisovy const u8 *bssid, const u8 *addr, u32 supp_rates); 1802239281f8SRostislav Lisovy void ieee80211_ocb_setup_sdata(struct ieee80211_sub_if_data *sdata); 1803239281f8SRostislav Lisovy int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata, 1804239281f8SRostislav Lisovy struct ocb_setup *setup); 1805239281f8SRostislav Lisovy int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata); 1806239281f8SRostislav Lisovy 18071fa57d01SJohannes Berg /* mesh code */ 18081fa57d01SJohannes Berg void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata); 18091fa57d01SJohannes Berg void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 18101fa57d01SJohannes Berg struct sk_buff *skb); 1811b8456a14SChun-Yeow Yeoh int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata, 181266e01cf9SLuciano Coelho struct cfg80211_csa_settings *csa_settings); 1813b8456a14SChun-Yeow Yeoh int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata); 181446900298SJohannes Berg 18159c6bd790SJohannes Berg /* scan/BSS handling */ 181646900298SJohannes Berg void ieee80211_scan_work(struct work_struct *work); 181734bcf715SStanislaw Gruszka int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, 1818be4a4b6aSJohannes Berg const u8 *ssid, u8 ssid_len, 181976bed0f4SJanusz.Dziedzic@tieto.com struct ieee80211_channel **channels, 182076bed0f4SJanusz.Dziedzic@tieto.com unsigned int n_channels, 18217ca15a0aSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 1822c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, 18232a519311SJohannes Berg struct cfg80211_scan_request *req); 18245bb644a0SJohannes Berg void ieee80211_scan_cancel(struct ieee80211_local *local); 1825133d40f9SStanislaw Gruszka void ieee80211_run_deferred_scan(struct ieee80211_local *local); 1826d48b2968SJohannes Berg void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb); 18279c6bd790SJohannes Berg 18280a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); 1829c2b13452SJohannes Berg struct ieee80211_bss * 183098c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local, 183198c8fccfSJohannes Berg struct ieee80211_rx_status *rx_status, 183298c8fccfSJohannes Berg struct ieee80211_mgmt *mgmt, 183398c8fccfSJohannes Berg size_t len, 1834d45c4172SEmmanuel Grumbach struct ieee80211_channel *channel); 183598c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local, 1836c2b13452SJohannes Berg struct ieee80211_bss *bss); 1837ee385855SLuis Carlos Cobo 183879f460caSLuciano Coelho /* scheduled scan handling */ 1839d43c6b6eSDavid Spinadel int 1840d43c6b6eSDavid Spinadel __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, 1841d43c6b6eSDavid Spinadel struct cfg80211_sched_scan_request *req); 184279f460caSLuciano Coelho int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, 184379f460caSLuciano Coelho struct cfg80211_sched_scan_request *req); 18440d440ea2SEliad Peller int ieee80211_request_sched_scan_stop(struct ieee80211_local *local); 1845f6837ba8SJohannes Berg void ieee80211_sched_scan_end(struct ieee80211_local *local); 184685a9994aSLuciano Coelho void ieee80211_sched_scan_stopped_work(struct work_struct *work); 184779f460caSLuciano Coelho 1848a2fcfccbSJohannes Berg /* off-channel/mgmt-tx */ 1849aacde9eeSStanislaw Gruszka void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local); 1850aacde9eeSStanislaw Gruszka void ieee80211_offchannel_return(struct ieee80211_local *local); 18512eb278e0SJohannes Berg void ieee80211_roc_setup(struct ieee80211_local *local); 18522eb278e0SJohannes Berg void ieee80211_start_next_roc(struct ieee80211_local *local); 1853c8f994eeSJohannes Berg void ieee80211_roc_purge(struct ieee80211_local *local, 1854c8f994eeSJohannes Berg struct ieee80211_sub_if_data *sdata); 1855a2fcfccbSJohannes Berg int ieee80211_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, 1856a2fcfccbSJohannes Berg struct ieee80211_channel *chan, 1857a2fcfccbSJohannes Berg unsigned int duration, u64 *cookie); 1858a2fcfccbSJohannes Berg int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy, 1859a2fcfccbSJohannes Berg struct wireless_dev *wdev, u64 cookie); 1860a2fcfccbSJohannes Berg int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, 1861a2fcfccbSJohannes Berg struct cfg80211_mgmt_tx_params *params, u64 *cookie); 1862a2fcfccbSJohannes Berg int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, 1863a2fcfccbSJohannes Berg struct wireless_dev *wdev, u64 cookie); 1864b203ffc3SJouni Malinen 186573da7d5bSSimon Wunderlich /* channel switch handling */ 186673da7d5bSSimon Wunderlich void ieee80211_csa_finalize_work(struct work_struct *work); 186782a8e17dSLuciano Coelho int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, 186882a8e17dSLuciano Coelho struct cfg80211_csa_settings *params); 186973da7d5bSSimon Wunderlich 18705f9404abSJohn Crispin /* color change handling */ 18715f9404abSJohn Crispin void ieee80211_color_change_finalize_work(struct work_struct *work); 18725f9404abSJohn Crispin 18733e122be0SJohannes Berg /* interface handling */ 187407b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \ 187507b83d2eSJohannes Berg NETIF_F_HW_CSUM | NETIF_F_SG | \ 187607b83d2eSJohannes Berg NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE) 187707b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES_RX (NETIF_F_RXCSUM) 187807b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES (MAC80211_SUPPORTED_FEATURES_TX | \ 187907b83d2eSJohannes Berg MAC80211_SUPPORTED_FEATURES_RX) 188007b83d2eSJohannes Berg 188147846c9bSJohannes Berg int ieee80211_iface_init(void); 188247846c9bSJohannes Berg void ieee80211_iface_exit(void); 18833e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name, 18846bab2e19STom Gundersen unsigned char name_assign_type, 188584efbb84SJohannes Berg struct wireless_dev **new_wdev, enum nl80211_iftype type, 1886ee385855SLuis Carlos Cobo struct vif_params *params); 1887f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, 188805c914feSJohannes Berg enum nl80211_iftype type); 1889f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); 189075636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local); 1891382a103bSJohannes Berg u32 ieee80211_idle_off(struct ieee80211_local *local); 18925cff20e6SJohannes Berg void ieee80211_recalc_idle(struct ieee80211_local *local); 189385416a4fSChristian Lamparter void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, 189485416a4fSChristian Lamparter const int offset); 1895f142c6b9SJohannes Berg int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up); 1896f142c6b9SJohannes Berg void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata); 18973c3e21e7SJohannes Berg int ieee80211_add_virtual_monitor(struct ieee80211_local *local); 18983c3e21e7SJohannes Berg void ieee80211_del_virtual_monitor(struct ieee80211_local *local); 1899f0706e82SJiri Benc 1900d8787ec6SJohannes Berg int ieee80211_vif_set_links(struct ieee80211_sub_if_data *sdata, 1901d8787ec6SJohannes Berg u16 new_links); 1902d8787ec6SJohannes Berg 19031ea6f9c0SJohannes Berg bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata); 1904db82d8a9SLorenzo Bianconi void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata, 1905db82d8a9SLorenzo Bianconi bool update_bss); 19066aea26ceSFelix Fietkau void ieee80211_recalc_offload(struct ieee80211_local *local); 19071ea6f9c0SJohannes Berg 19089607e6b6SJohannes Berg static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) 19099607e6b6SJohannes Berg { 191034d4bc4dSJohannes Berg return test_bit(SDATA_STATE_RUNNING, &sdata->state); 19119607e6b6SJohannes Berg } 19129607e6b6SJohannes Berg 1913e2ebc74dSJohannes Berg /* tx handling */ 1914e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local); 1915da1cad73SAllen Pais void ieee80211_tx_pending(struct tasklet_struct *t); 1916d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, 1917d0cf9c0dSStephen Hemminger struct net_device *dev); 1918d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, 1919d0cf9c0dSStephen Hemminger struct net_device *dev); 192050ff477aSJohn Crispin netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb, 192150ff477aSJohn Crispin struct net_device *dev); 192224d342c5SLiad Kaufman void __ieee80211_subif_start_xmit(struct sk_buff *skb, 192324d342c5SLiad Kaufman struct net_device *dev, 192406016772SRajkumar Manoharan u32 info_flags, 1925a7528198SMarkus Theil u32 ctrl_flags, 1926a7528198SMarkus Theil u64 *cookie); 19271f98ab7fSFelix Fietkau void ieee80211_purge_tx_queue(struct ieee80211_hw *hw, 19281f98ab7fSFelix Fietkau struct sk_buff_head *skbs); 19297528ec57SJohannes Berg struct sk_buff * 19307528ec57SJohannes Berg ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata, 19317528ec57SJohannes Berg struct sk_buff *skb, u32 info_flags); 19324dc792b8SHelmut Schaa void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb, 1933b7b2e8caSJohn Crispin int retry_count, int shift, bool send_to_cooked, 1934b7b2e8caSJohn Crispin struct ieee80211_tx_status *status); 1935e2ebc74dSJohannes Berg 193617c18bf8SJohannes Berg void ieee80211_check_fast_xmit(struct sta_info *sta); 193717c18bf8SJohannes Berg void ieee80211_check_fast_xmit_all(struct ieee80211_local *local); 193817c18bf8SJohannes Berg void ieee80211_check_fast_xmit_iface(struct ieee80211_sub_if_data *sdata); 193917c18bf8SJohannes Berg void ieee80211_clear_fast_xmit(struct sta_info *sta); 194091180649SDenis Kenzior int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, 194191180649SDenis Kenzior const u8 *buf, size_t len, 1942dca9ca2dSMarkus Theil const u8 *dest, __be16 proto, bool unencrypted, 1943dca9ca2dSMarkus Theil u64 *cookie); 19448828f81aSRajkumar Manoharan int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, 19458828f81aSRajkumar Manoharan const u8 *buf, size_t len); 194617c18bf8SJohannes Berg 1947de1ede7aSJohannes Berg /* HT */ 1948ef96a842SBen Greear void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, 1949ef96a842SBen Greear struct ieee80211_sta_ht_cap *ht_cap); 1950e1a0c6b3SJohannes Berg bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata, 1951ef96a842SBen Greear struct ieee80211_supported_band *sband, 19524a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_ie, 1953c71420dbSJohannes Berg struct link_sta_info *link_sta); 1954b8695a8fSJohannes Berg void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, 1955b8695a8fSJohannes Berg const u8 *da, u16 tid, 1956b8695a8fSJohannes Berg u16 initiator, u16 reason_code); 19570f78231bSJohannes Berg int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, 19580f78231bSJohannes Berg enum ieee80211_smps_mode smps, const u8 *da, 19590f78231bSJohannes Berg const u8 *bssid); 1960687da132SEmmanuel Grumbach bool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old, 1961687da132SEmmanuel Grumbach enum ieee80211_smps_mode smps_mode_new); 1962de1ede7aSJohannes Berg 19637c3b1dd8SJohannes Berg void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 196453f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 1965849b7967SJohannes Berg void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 196653f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 1967bde59c47SJohannes Berg void ___ieee80211_start_rx_ba_session(struct sta_info *sta, 1968bde59c47SJohannes Berg u8 dialog_token, u16 timeout, 1969bde59c47SJohannes Berg u16 start_seq_num, u16 ba_policy, u16 tid, 19702ab45876SJohn Crispin u16 buf_size, bool tx, bool auto_seq, 19712ab45876SJohn Crispin const struct ieee80211_addba_ext_ie *addbaext); 1972c82c4a80SJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, 1973c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 1974de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, 1975de1ede7aSJohannes Berg struct sta_info *sta, 1976de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, size_t len); 1977de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local, 1978de1ede7aSJohannes Berg struct sta_info *sta, 1979de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1980de1ede7aSJohannes Berg size_t len); 1981de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local, 1982de1ede7aSJohannes Berg struct sta_info *sta, 1983de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1984de1ede7aSJohannes Berg size_t len); 1985de1ede7aSJohannes Berg 1986849b7967SJohannes Berg int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1987c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 198867c282c0SJohannes Berg int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1989c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 19907a7c0a64SJohannes Berg void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid, 19917a7c0a64SJohannes Berg struct tid_ampdu_tx *tid_tx); 19927a7c0a64SJohannes Berg void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid, 19937a7c0a64SJohannes Berg struct tid_ampdu_tx *tid_tx); 199467c282c0SJohannes Berg void ieee80211_ba_session_work(struct work_struct *work); 199567c282c0SJohannes Berg void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid); 19962bff8ebfSChristian Lamparter void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid); 1997849b7967SJohannes Berg 199804ecd257SJohannes Berg u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs); 199957566b20Stamizhr@codeaurora.org enum nl80211_smps_mode 200057566b20Stamizhr@codeaurora.org ieee80211_smps_mode_to_smps_mode(enum ieee80211_smps_mode smps); 200104ecd257SJohannes Berg 2002818255eaSMahesh Palivela /* VHT */ 20034a3cb702SJohannes Berg void 20044a3cb702SJohannes Berg ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, 2005818255eaSMahesh Palivela struct ieee80211_supported_band *sband, 20064a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_ie, 2007c71420dbSJohannes Berg struct link_sta_info *link_sta); 2008c71420dbSJohannes Berg enum ieee80211_sta_rx_bandwidth 2009c71420dbSJohannes Berg ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta); 2010c71420dbSJohannes Berg enum ieee80211_sta_rx_bandwidth 2011c71420dbSJohannes Berg ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta); 2012c71420dbSJohannes Berg void ieee80211_sta_set_rx_nss(struct link_sta_info *link_sta); 201359021c67SArik Nemtsov enum ieee80211_sta_rx_bandwidth 201459021c67SArik Nemtsov ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width); 2015c71420dbSJohannes Berg enum nl80211_chan_width 2016c71420dbSJohannes Berg ieee80211_sta_cap_chan_bw(struct link_sta_info *link_sta); 201723a1f8d4SSara Sharon void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata, 2018d8675a63SJohannes Berg struct ieee80211_link_data *link, 201923a1f8d4SSara Sharon struct ieee80211_mgmt *mgmt); 2020b1bce14aSMarek Kwaczynski u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, 2021c71420dbSJohannes Berg struct link_sta_info *sta, 2022afe0d181SJohannes Berg u8 opmode, enum nl80211_band band); 20230af83d3dSJohannes Berg void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, 2024c71420dbSJohannes Berg struct link_sta_info *sta, 2025afe0d181SJohannes Berg u8 opmode, enum nl80211_band band); 2026dd5ecfeaSJohannes Berg void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, 2027dd5ecfeaSJohannes Berg struct ieee80211_sta_vht_cap *vht_cap); 2028b119ad6eSLorenzo Bianconi void ieee80211_get_vht_mask_from_cap(__le16 vht_cap, 2029b119ad6eSLorenzo Bianconi u16 vht_mask[NL80211_VHT_NSS_MAX]); 203097f5f425Stamizhr@codeaurora.org enum nl80211_chan_width 2031c71420dbSJohannes Berg ieee80211_sta_rx_bw_to_chan_width(struct link_sta_info *sta); 20324a34215eSJohannes Berg 203341cbb0f5SLuca Coelho /* HE */ 203441cbb0f5SLuca Coelho void 203541cbb0f5SLuca Coelho ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata, 203641cbb0f5SLuca Coelho struct ieee80211_supported_band *sband, 203741cbb0f5SLuca Coelho const u8 *he_cap_ie, u8 he_cap_len, 20381bb9a8a4SJohannes Berg const struct ieee80211_he_6ghz_capa *he_6ghz_capa, 2039c71420dbSJohannes Berg struct link_sta_info *link_sta); 20401ced169cSJohn Crispin void 20411ced169cSJohn Crispin ieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif, 20421ced169cSJohn Crispin const struct ieee80211_he_spr *he_spr_ie_elem); 204341cbb0f5SLuca Coelho 2044697f6c50SJohn Crispin void 2045697f6c50SJohn Crispin ieee80211_he_op_ie_to_bss_conf(struct ieee80211_vif *vif, 2046697f6c50SJohn Crispin const struct ieee80211_he_operation *he_op_ie_elem); 2047697f6c50SJohn Crispin 204812bf8fadSThomas Pedersen /* S1G */ 204912bf8fadSThomas Pedersen void ieee80211_s1g_sta_rate_init(struct sta_info *sta); 2050f5a4c24eSLorenzo Bianconi bool ieee80211_s1g_is_twt_setup(struct sk_buff *skb); 2051f5a4c24eSLorenzo Bianconi void ieee80211_s1g_rx_twt_action(struct ieee80211_sub_if_data *sdata, 2052f5a4c24eSLorenzo Bianconi struct sk_buff *skb); 2053f5a4c24eSLorenzo Bianconi void ieee80211_s1g_status_twt_action(struct ieee80211_sub_if_data *sdata, 2054f5a4c24eSLorenzo Bianconi struct sk_buff *skb); 205512bf8fadSThomas Pedersen 205639192c0bSJohannes Berg /* Spectrum management */ 205739192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, 205839192c0bSJohannes Berg struct ieee80211_mgmt *mgmt, 205939192c0bSJohannes Berg size_t len); 2060e6b7cde4SSimon Wunderlich /** 2061e6b7cde4SSimon Wunderlich * ieee80211_parse_ch_switch_ie - parses channel switch IEs 2062e6b7cde4SSimon Wunderlich * @sdata: the sdata of the interface which has received the frame 2063e6b7cde4SSimon Wunderlich * @elems: parsed 802.11 elements received with the frame 2064e6b7cde4SSimon Wunderlich * @current_band: indicates the current band 20652a333a0dSJohannes Berg * @vht_cap_info: VHT capabilities of the transmitter 2066ba323e29SJohannes Berg * @conn_flags: contains information about own capabilities and restrictions 2067ba323e29SJohannes Berg * to decide which channel switch announcements can be accepted, using 2068ba323e29SJohannes Berg * flags from &enum ieee80211_conn_flags. 2069e6b7cde4SSimon Wunderlich * @bssid: the currently connected bssid (for reporting) 2070c0f17eb9SChun-Yeow Yeoh * @csa_ie: parsed 802.11 csa elements on count, mode, chandef and mesh ttl. 2071c0f17eb9SChun-Yeow Yeoh All of them will be filled with if success only. 2072e6b7cde4SSimon Wunderlich * Return: 0 on success, <0 on error and >0 if there is nothing to parse. 2073e6b7cde4SSimon Wunderlich */ 2074e6b7cde4SSimon Wunderlich int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, 207584469a45SLuciano Coelho struct ieee802_11_elems *elems, 207657fbcce3SJohannes Berg enum nl80211_band current_band, 20772a333a0dSJohannes Berg u32 vht_cap_info, 2078ba323e29SJohannes Berg ieee80211_conn_flags_t conn_flags, u8 *bssid, 2079c0f17eb9SChun-Yeow Yeoh struct ieee80211_csa_ie *csa_ie); 208039192c0bSJohannes Berg 2081f2753ddbSJohannes Berg /* Suspend/resume and hw reconfiguration */ 2082f2753ddbSJohannes Berg int ieee80211_reconfig(struct ieee80211_local *local); 208384f6a01cSJohannes Berg void ieee80211_stop_device(struct ieee80211_local *local); 2084f2753ddbSJohannes Berg 2085eecc4800SJohannes Berg int __ieee80211_suspend(struct ieee80211_hw *hw, 2086eecc4800SJohannes Berg struct cfg80211_wowlan *wowlan); 2087f2753ddbSJohannes Berg 2088f2753ddbSJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw) 2089f2753ddbSJohannes Berg { 209085f72bc8SJohn W. Linville struct ieee80211_local *local = hw_to_local(hw); 209185f72bc8SJohn W. Linville 20929120d94eSLuciano Coelho WARN(test_bit(SCAN_HW_SCANNING, &local->scanning) && 20939120d94eSLuciano Coelho !test_bit(SCAN_COMPLETED, &local->scanning), 209485f72bc8SJohn W. Linville "%s: resume with hardware scan still in progress\n", 209585f72bc8SJohn W. Linville wiphy_name(hw->wiphy)); 209685f72bc8SJohn W. Linville 2097f2753ddbSJohannes Berg return ieee80211_reconfig(hw_to_local(hw)); 2098f2753ddbSJohannes Berg } 2099665af4fcSBob Copeland 2100c2d1560aSJohannes Berg /* utility functions/constants */ 21018a47cea7SJohannes Berg extern const void *const mac80211_wiphy_privid; /* for wiphy privid */ 210257fbcce3SJohannes Berg int ieee80211_frame_duration(enum nl80211_band band, size_t len, 2103438b61b7SSimon Wunderlich int rate, int erp, int short_preamble, 2104438b61b7SSimon Wunderlich int shift); 2105e552af05SHaim Dreyfuss void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata, 2106e552af05SHaim Dreyfuss struct ieee80211_tx_queue_params *qparam, 2107e552af05SHaim Dreyfuss int ac); 2108b3e2130bSJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_link_data *link, 2109cec66283SJohannes Berg bool bss_notify, bool enable_qos); 21107c10770fSJohannes Berg void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, 211108aca29aSMathy Vanhoef struct sta_info *sta, struct sk_buff *skb); 2112cf6bb79aSHelmut Schaa 211355de908aSJohannes Berg void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, 211455de908aSJohannes Berg struct sk_buff *skb, int tid, 211508aca29aSMathy Vanhoef enum nl80211_band band); 211655de908aSJohannes Berg 211750ff477aSJohn Crispin /* sta_out needs to be checked for ERR_PTR() before using */ 211850ff477aSJohn Crispin int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, 211950ff477aSJohn Crispin struct sk_buff *skb, 212050ff477aSJohn Crispin struct sta_info **sta_out); 212150ff477aSJohn Crispin 212255de908aSJohannes Berg static inline void 212355de908aSJohannes Berg ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, 212455de908aSJohannes Berg struct sk_buff *skb, int tid, 212508aca29aSMathy Vanhoef enum nl80211_band band) 212655de908aSJohannes Berg { 212755de908aSJohannes Berg rcu_read_lock(); 212808aca29aSMathy Vanhoef __ieee80211_tx_skb_tid_band(sdata, skb, tid, band); 212955de908aSJohannes Berg rcu_read_unlock(); 213055de908aSJohannes Berg } 213155de908aSJohannes Berg 2132eef25a66SJohannes Berg void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata, 2133eef25a66SJohannes Berg struct sk_buff *skb, int tid); 213455de908aSJohannes Berg 213555de908aSJohannes Berg static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, 2136cf6bb79aSHelmut Schaa struct sk_buff *skb) 2137cf6bb79aSHelmut Schaa { 2138cf6bb79aSHelmut Schaa /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */ 2139cf6bb79aSHelmut Schaa ieee80211_tx_skb_tid(sdata, skb, 7); 2140cf6bb79aSHelmut Schaa } 2141cf6bb79aSHelmut Schaa 2142fd17bf04SJohannes Berg /** 2143fd17bf04SJohannes Berg * struct ieee80211_elems_parse_params - element parsing parameters 2144fd17bf04SJohannes Berg * @start: pointer to the elements 2145fd17bf04SJohannes Berg * @len: length of the elements 2146fd17bf04SJohannes Berg * @action: %true if the elements came from an action frame 2147fd17bf04SJohannes Berg * @filter: bitmap of element IDs to filter out while calculating 2148fd17bf04SJohannes Berg * the element CRC 2149fd17bf04SJohannes Berg * @crc: CRC starting value 2150fd17bf04SJohannes Berg * @transmitter_bssid: transmitter BSSID to parse the multi-BSSID 2151fd17bf04SJohannes Berg * element 2152fd17bf04SJohannes Berg * @bss_bssid: BSSID of the BSS we want to obtain elements for 2153fd17bf04SJohannes Berg * when parsing the multi-BSSID element 2154fd17bf04SJohannes Berg */ 2155fd17bf04SJohannes Berg struct ieee80211_elems_parse_params { 2156fd17bf04SJohannes Berg const u8 *start; 2157fd17bf04SJohannes Berg size_t len; 2158fd17bf04SJohannes Berg bool action; 2159fd17bf04SJohannes Berg u64 filter; 2160fd17bf04SJohannes Berg u32 crc; 2161fd17bf04SJohannes Berg const u8 *transmitter_bssid; 2162fd17bf04SJohannes Berg const u8 *bss_bssid; 2163fd17bf04SJohannes Berg }; 2164fd17bf04SJohannes Berg 2165fd17bf04SJohannes Berg struct ieee802_11_elems * 2166fd17bf04SJohannes Berg ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params); 2167fd17bf04SJohannes Berg 2168fd17bf04SJohannes Berg static inline struct ieee802_11_elems * 2169fd17bf04SJohannes Berg ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, 21705d24828dSJohannes Berg u64 filter, u32 crc, 21715d24828dSJohannes Berg const u8 *transmitter_bssid, 2172fd17bf04SJohannes Berg const u8 *bss_bssid) 2173fd17bf04SJohannes Berg { 2174fd17bf04SJohannes Berg struct ieee80211_elems_parse_params params = { 2175fd17bf04SJohannes Berg .start = start, 2176fd17bf04SJohannes Berg .len = len, 2177fd17bf04SJohannes Berg .action = action, 2178fd17bf04SJohannes Berg .filter = filter, 2179fd17bf04SJohannes Berg .crc = crc, 2180fd17bf04SJohannes Berg .transmitter_bssid = transmitter_bssid, 2181fd17bf04SJohannes Berg .bss_bssid = bss_bssid, 2182fd17bf04SJohannes Berg }; 2183fd17bf04SJohannes Berg 2184fd17bf04SJohannes Berg return ieee802_11_parse_elems_full(¶ms); 2185fd17bf04SJohannes Berg } 2186fd17bf04SJohannes Berg 21875d24828dSJohannes Berg static inline struct ieee802_11_elems * 21885d24828dSJohannes Berg ieee802_11_parse_elems(const u8 *start, size_t len, bool action, 21895d24828dSJohannes Berg const u8 *transmitter_bssid, 21905d24828dSJohannes Berg const u8 *bss_bssid) 2191ddc4db2eSJohannes Berg { 21925d24828dSJohannes Berg return ieee802_11_parse_elems_crc(start, len, action, 0, 0, 21934abb52a4SSara Sharon transmitter_bssid, bss_bssid); 2194ddc4db2eSJohannes Berg } 2195ddc4db2eSJohannes Berg 219683eb935eSMichal Kazior 219702219b3aSJohannes Berg extern const int ieee802_1d_to_ac[8]; 219802219b3aSJohannes Berg 219902219b3aSJohannes Berg static inline int ieee80211_ac_from_tid(int tid) 220002219b3aSJohannes Berg { 220102219b3aSJohannes Berg return ieee802_1d_to_ac[tid & 7]; 220202219b3aSJohannes Berg } 220302219b3aSJohannes Berg 2204520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work); 2205520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work); 220634f11cd3SKees Cook void ieee80211_dynamic_ps_timer(struct timer_list *t); 2207a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local, 2208a97b77b9SVivek Natarajan struct ieee80211_sub_if_data *sdata, 2209076cdcb1SJohannes Berg bool powersave); 2210a5d3cbdbSFelix Fietkau void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local, 2211a5d3cbdbSFelix Fietkau struct ieee80211_sub_if_data *sdata); 22124e5ff376SFelix Fietkau void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, 221302219b3aSJohannes Berg struct ieee80211_hdr *hdr, bool ack, u16 tx_time); 2214520eb820SKalle Valo 2215ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, 2216445ea4e8SJohannes Berg unsigned long queues, 2217cca07b00SLuciano Coelho enum queue_stop_reason reason, 2218cca07b00SLuciano Coelho bool refcounted); 221926da23b6SLuciano Coelho void ieee80211_stop_vif_queues(struct ieee80211_local *local, 222026da23b6SLuciano Coelho struct ieee80211_sub_if_data *sdata, 222126da23b6SLuciano Coelho enum queue_stop_reason reason); 222226da23b6SLuciano Coelho void ieee80211_wake_vif_queues(struct ieee80211_local *local, 222326da23b6SLuciano Coelho struct ieee80211_sub_if_data *sdata, 222426da23b6SLuciano Coelho enum queue_stop_reason reason); 2225ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, 2226445ea4e8SJohannes Berg unsigned long queues, 2227cca07b00SLuciano Coelho enum queue_stop_reason reason, 2228cca07b00SLuciano Coelho bool refcounted); 222996f5e66eSJohannes Berg void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, 2230cca07b00SLuciano Coelho enum queue_stop_reason reason, 2231cca07b00SLuciano Coelho bool refcounted); 223296f5e66eSJohannes Berg void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, 2233cca07b00SLuciano Coelho enum queue_stop_reason reason, 2234cca07b00SLuciano Coelho bool refcounted); 22353a25a8c8SJohannes Berg void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue); 22368f77f384SJohannes Berg void ieee80211_add_pending_skb(struct ieee80211_local *local, 22378f77f384SJohannes Berg struct sk_buff *skb); 2238e3685e03SJohannes Berg void ieee80211_add_pending_skbs(struct ieee80211_local *local, 2239e3685e03SJohannes Berg struct sk_buff_head *skbs); 224039ecc01dSJohannes Berg void ieee80211_flush_queues(struct ieee80211_local *local, 22413b24f4c6SEmmanuel Grumbach struct ieee80211_sub_if_data *sdata, bool drop); 22424f9610d5SLiad Kaufman void __ieee80211_flush_queues(struct ieee80211_local *local, 22434f9610d5SLiad Kaufman struct ieee80211_sub_if_data *sdata, 22443b24f4c6SEmmanuel Grumbach unsigned int queues, bool drop); 2245ce7c9111SKalle Valo 22464afaff17SEmmanuel Grumbach static inline bool ieee80211_can_run_worker(struct ieee80211_local *local) 22474afaff17SEmmanuel Grumbach { 22484afaff17SEmmanuel Grumbach /* 2249f8891461SNaftali Goldstein * It's unsafe to try to do any work during reconfigure flow. 2250f8891461SNaftali Goldstein * When the flow ends the work will be requeued. 2251f8891461SNaftali Goldstein */ 2252f8891461SNaftali Goldstein if (local->in_reconfig) 2253f8891461SNaftali Goldstein return false; 2254f8891461SNaftali Goldstein 2255f8891461SNaftali Goldstein /* 22564afaff17SEmmanuel Grumbach * If quiescing is set, we are racing with __ieee80211_suspend. 22574afaff17SEmmanuel Grumbach * __ieee80211_suspend flushes the workers after setting quiescing, 22584afaff17SEmmanuel Grumbach * and we check quiescing / suspended before enqueing new workers. 22594afaff17SEmmanuel Grumbach * We should abort the worker to avoid the races below. 22604afaff17SEmmanuel Grumbach */ 22614afaff17SEmmanuel Grumbach if (local->quiescing) 22624afaff17SEmmanuel Grumbach return false; 22634afaff17SEmmanuel Grumbach 22644afaff17SEmmanuel Grumbach /* 22654afaff17SEmmanuel Grumbach * We might already be suspended if the following scenario occurs: 22664afaff17SEmmanuel Grumbach * __ieee80211_suspend Control path 22674afaff17SEmmanuel Grumbach * 22684afaff17SEmmanuel Grumbach * if (local->quiescing) 22694afaff17SEmmanuel Grumbach * return; 22704afaff17SEmmanuel Grumbach * local->quiescing = true; 22714afaff17SEmmanuel Grumbach * flush_workqueue(); 22724afaff17SEmmanuel Grumbach * queue_work(...); 22734afaff17SEmmanuel Grumbach * local->suspended = true; 22744afaff17SEmmanuel Grumbach * local->quiescing = false; 22754afaff17SEmmanuel Grumbach * worker starts running... 22764afaff17SEmmanuel Grumbach */ 22774afaff17SEmmanuel Grumbach if (local->suspended) 22784afaff17SEmmanuel Grumbach return false; 22794afaff17SEmmanuel Grumbach 22804afaff17SEmmanuel Grumbach return true; 22814afaff17SEmmanuel Grumbach } 22824afaff17SEmmanuel Grumbach 2283fa962b92SMichal Kazior int ieee80211_txq_setup_flows(struct ieee80211_local *local); 22842fe4a29aSToke Høiland-Jørgensen void ieee80211_txq_set_params(struct ieee80211_local *local); 2285fa962b92SMichal Kazior void ieee80211_txq_teardown_flows(struct ieee80211_local *local); 2286fa962b92SMichal Kazior void ieee80211_txq_init(struct ieee80211_sub_if_data *sdata, 2287ba8c3d6fSFelix Fietkau struct sta_info *sta, 2288ba8c3d6fSFelix Fietkau struct txq_info *txq, int tid); 2289fa962b92SMichal Kazior void ieee80211_txq_purge(struct ieee80211_local *local, 2290fa962b92SMichal Kazior struct txq_info *txqi); 22912a9e2579SJohannes Berg void ieee80211_txq_remove_vlan(struct ieee80211_local *local, 22922a9e2579SJohannes Berg struct ieee80211_sub_if_data *sdata); 22932fe4a29aSToke Høiland-Jørgensen void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats, 22942fe4a29aSToke Høiland-Jørgensen struct txq_info *txqi); 2295da1cad73SAllen Pais void ieee80211_wake_txqs(struct tasklet_struct *t); 229646900298SJohannes Berg void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, 2297700e8ea6SJouni Malinen u16 transaction, u16 auth_alg, u16 status, 22984a3cb702SJohannes Berg const u8 *extra, size_t extra_len, const u8 *bssid, 22991672c0e3SJohannes Berg const u8 *da, const u8 *key, u8 key_len, u8 key_idx, 23001672c0e3SJohannes Berg u32 tx_flags); 23016ae16775SAntonio Quartulli void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, 23024b08d1b6SJohannes Berg const u8 *da, const u8 *bssid, 23034b08d1b6SJohannes Berg u16 stype, u16 reason, 23046ae16775SAntonio Quartulli bool send_frame, u8 *frame_buf); 230500387f32SJohannes Berg 230600387f32SJohannes Berg enum { 230700387f32SJohannes Berg IEEE80211_PROBE_FLAG_DIRECTED = BIT(0), 2308b9771d41SJohannes Berg IEEE80211_PROBE_FLAG_MIN_CONTENT = BIT(1), 2309b9771d41SJohannes Berg IEEE80211_PROBE_FLAG_RANDOM_SN = BIT(2), 231000387f32SJohannes Berg }; 231100387f32SJohannes Berg 23122ad2274cSIlan Peer int ieee80211_build_preq_ies(struct ieee80211_sub_if_data *sdata, u8 *buffer, 2313c56ef672SDavid Spinadel size_t buffer_len, 2314c56ef672SDavid Spinadel struct ieee80211_scan_ies *ie_desc, 2315c56ef672SDavid Spinadel const u8 *ie, size_t ie_len, 2316c56ef672SDavid Spinadel u8 bands_used, u32 *rate_masks, 231700387f32SJohannes Berg struct cfg80211_chan_def *chandef, 231800387f32SJohannes Berg u32 flags); 2319a619a4c0SJuuso Oikarinen struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, 2320a344d677SJohannes Berg const u8 *src, const u8 *dst, 2321a344d677SJohannes Berg u32 ratemask, 23226b77863bSJohannes Berg struct ieee80211_channel *chan, 2323a619a4c0SJuuso Oikarinen const u8 *ssid, size_t ssid_len, 2324a806c558SPaul Stewart const u8 *ie, size_t ie_len, 232500387f32SJohannes Berg u32 flags); 23262103dec1SSimon Wunderlich u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata, 232746900298SJohannes Berg struct ieee802_11_elems *elems, 232857fbcce3SJohannes Berg enum nl80211_band band, u32 *basic_rates); 2329687da132SEmmanuel Grumbach int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata, 2330d8675a63SJohannes Berg struct ieee80211_link_data *link, 2331687da132SEmmanuel Grumbach enum ieee80211_smps_mode smps_mode); 2332e9aac179SJohannes Berg void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata, 2333d8675a63SJohannes Berg struct ieee80211_link_data *link); 233421f659bfSEliad Peller void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata); 233546900298SJohannes Berg 23368e664fb3SJohannes Berg size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset); 2337ef96a842SBen Greear u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, 233842e7aa77SAlexander Simon u16 cap); 2339074d46d1SJohannes Berg u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, 23404bf88530SJohannes Berg const struct cfg80211_chan_def *chandef, 234157f255f5SArik Nemtsov u16 prot_mode, bool rifs_mode); 234275d627d5SSimon Wunderlich void ieee80211_ie_build_wide_bw_cs(u8 *pos, 234375d627d5SSimon Wunderlich const struct cfg80211_chan_def *chandef); 2344ba0afa2fSMahesh Palivela u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, 2345ba0afa2fSMahesh Palivela u32 cap); 2346fb28ec0cSArik Nemtsov u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, 2347fb28ec0cSArik Nemtsov const struct cfg80211_chan_def *chandef); 234860ad72daSSven Eckelmann u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype); 2349ba323e29SJohannes Berg u8 *ieee80211_ie_build_he_cap(ieee80211_conn_flags_t disable_flags, u8 *pos, 235041cbb0f5SLuca Coelho const struct ieee80211_sta_he_cap *he_cap, 235141cbb0f5SLuca Coelho u8 *end); 235224a2042cSRajkumar Manoharan void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata, 235324a2042cSRajkumar Manoharan struct sk_buff *skb); 2354d1b7524bSRajkumar Manoharan u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef); 23552103dec1SSimon Wunderlich int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef, 23562103dec1SSimon Wunderlich const struct ieee80211_supported_band *sband, 23572103dec1SSimon Wunderlich const u8 *srates, int srates_len, u32 *rates); 2358fc8a7321SJohannes Berg int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, 23596b77863bSJohannes Berg struct sk_buff *skb, bool need_basic, 236057fbcce3SJohannes Berg enum nl80211_band band); 2361fc8a7321SJohannes Berg int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, 23626b77863bSJohannes Berg struct sk_buff *skb, bool need_basic, 236357fbcce3SJohannes Berg enum nl80211_band band); 236440b861a0SArik Nemtsov u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo); 23657957c6c8SThomas Pedersen void ieee80211_add_s1g_capab_ie(struct ieee80211_sub_if_data *sdata, 23667957c6c8SThomas Pedersen struct ieee80211_sta_s1g_cap *caps, 23677957c6c8SThomas Pedersen struct sk_buff *skb); 23681d00ce80SThomas Pedersen void ieee80211_add_aid_request_ie(struct ieee80211_sub_if_data *sdata, 23691d00ce80SThomas Pedersen struct sk_buff *skb); 23708e664fb3SJohannes Berg 2371f444de05SJohannes Berg /* channel management */ 23728ac3c704SJohannes Berg bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper, 23734bf88530SJohannes Berg struct cfg80211_chan_def *chandef); 23742a333a0dSJohannes Berg bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw, u32 vht_cap_info, 23757eb26df2SJohannes Berg const struct ieee80211_vht_operation *oper, 23767eb26df2SJohannes Berg const struct ieee80211_ht_operation *htop, 2377abcff6efSJanusz.Dziedzic@tieto.com struct cfg80211_chan_def *chandef); 23781e0b3b0bSIlan Peer void ieee80211_chandef_eht_oper(struct ieee80211_sub_if_data *sdata, 23791e0b3b0bSIlan Peer const struct ieee80211_eht_operation *eht_oper, 23801e0b3b0bSIlan Peer bool support_160, bool support_320, 23811e0b3b0bSIlan Peer struct cfg80211_chan_def *chandef); 238257fa5e85SJohannes Berg bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata, 238357fa5e85SJohannes Berg const struct ieee80211_he_operation *he_oper, 23845dca295dSIlan Peer const struct ieee80211_eht_operation *eht_oper, 238557fa5e85SJohannes Berg struct cfg80211_chan_def *chandef); 23861d00ce80SThomas Pedersen bool ieee80211_chandef_s1g_oper(const struct ieee80211_s1g_oper_ie *oper, 23871d00ce80SThomas Pedersen struct cfg80211_chan_def *chandef); 2388ba323e29SJohannes Berg ieee80211_conn_flags_t ieee80211_chandef_downgrade(struct cfg80211_chan_def *c); 2389f444de05SJohannes Berg 2390d01a1e65SMichal Kazior int __must_check 2391b4f85443SJohannes Berg ieee80211_link_use_channel(struct ieee80211_link_data *link, 23924bf88530SJohannes Berg const struct cfg80211_chan_def *chandef, 2393d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode); 23942c9b7359SJohannes Berg int __must_check 2395b4f85443SJohannes Berg ieee80211_link_reserve_chanctx(struct ieee80211_link_data *link, 239611335a55SLuciano Coelho const struct cfg80211_chan_def *chandef, 239709332481SMichal Kazior enum ieee80211_chanctx_mode mode, 239809332481SMichal Kazior bool radar_required); 239911335a55SLuciano Coelho int __must_check 2400b4f85443SJohannes Berg ieee80211_link_use_reserved_context(struct ieee80211_link_data *link); 2401b4f85443SJohannes Berg int ieee80211_link_unreserve_chanctx(struct ieee80211_link_data *link); 240211335a55SLuciano Coelho 240311335a55SLuciano Coelho int __must_check 2404b4f85443SJohannes Berg ieee80211_link_change_bandwidth(struct ieee80211_link_data *link, 24052c9b7359SJohannes Berg const struct cfg80211_chan_def *chandef, 24062c9b7359SJohannes Berg u32 *changed); 2407b4f85443SJohannes Berg void ieee80211_link_release_channel(struct ieee80211_link_data *link); 2408b4f85443SJohannes Berg void ieee80211_link_vlan_copy_chanctx(struct ieee80211_link_data *link); 2409b4f85443SJohannes Berg void ieee80211_link_copy_chanctx_to_vlans(struct ieee80211_link_data *link, 24101f4ac5a6SJohannes Berg bool clear); 2411c0166da9SMichal Kazior int ieee80211_chanctx_refcount(struct ieee80211_local *local, 2412c0166da9SMichal Kazior struct ieee80211_chanctx *ctx); 2413d01a1e65SMichal Kazior 241404ecd257SJohannes Berg void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, 241504ecd257SJohannes Berg struct ieee80211_chanctx *chanctx); 241621f659bfSEliad Peller void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, 241721f659bfSEliad Peller struct ieee80211_chanctx *ctx); 24185cbc95a7SEliad Peller bool ieee80211_is_radar_required(struct ieee80211_local *local); 2419164eb02dSSimon Wunderlich 2420164eb02dSSimon Wunderlich void ieee80211_dfs_cac_timer(unsigned long data); 2421164eb02dSSimon Wunderlich void ieee80211_dfs_cac_timer_work(struct work_struct *work); 2422164eb02dSSimon Wunderlich void ieee80211_dfs_cac_cancel(struct ieee80211_local *local); 2423164eb02dSSimon Wunderlich void ieee80211_dfs_radar_detected_work(struct work_struct *work); 2424c6da674aSChun-Yeow Yeoh int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata, 2425c6da674aSChun-Yeow Yeoh struct cfg80211_csa_settings *csa_settings); 242604ecd257SJohannes Berg 2427057d5f4bSThomas Pedersen void ieee80211_recalc_dtim(struct ieee80211_local *local, 2428057d5f4bSThomas Pedersen struct ieee80211_sub_if_data *sdata); 242973de86a3SLuciano Coelho int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, 243073de86a3SLuciano Coelho const struct cfg80211_chan_def *chandef, 243173de86a3SLuciano Coelho enum ieee80211_chanctx_mode chanmode, 243273de86a3SLuciano Coelho u8 radar_detect); 24336fa001bcSMichal Kazior int ieee80211_max_num_channels(struct ieee80211_local *local); 24340fabfaafSArik Nemtsov void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, 24350fabfaafSArik Nemtsov struct ieee80211_chanctx *ctx); 24362475b1ccSMax Stepanov 243795224fe8SArik Nemtsov /* TDLS */ 243895224fe8SArik Nemtsov int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, 24393b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 244095224fe8SArik Nemtsov u16 status_code, u32 peer_capability, 244131fa97c5SArik Nemtsov bool initiator, const u8 *extra_ies, 244231fa97c5SArik Nemtsov size_t extra_ies_len); 244395224fe8SArik Nemtsov int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, 24443b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 2445c10a1993SJohannes Berg void ieee80211_tdls_peer_del_work(struct work_struct *wk); 2446a7a6bdd0SArik Nemtsov int ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev, 2447a7a6bdd0SArik Nemtsov const u8 *addr, u8 oper_class, 2448a7a6bdd0SArik Nemtsov struct cfg80211_chan_def *chandef); 2449a7a6bdd0SArik Nemtsov void ieee80211_tdls_cancel_channel_switch(struct wiphy *wiphy, 2450a7a6bdd0SArik Nemtsov struct net_device *dev, 2451a7a6bdd0SArik Nemtsov const u8 *addr); 2452d51c2ea3SArik Nemtsov void ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata); 245379c92ca4SYu Wang void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata, 245479c92ca4SYu Wang const u8 *peer, u16 reason); 2455f057d140SJohannes Berg void 2456f057d140SJohannes Berg ieee80211_process_tdls_channel_switch(struct ieee80211_sub_if_data *sdata, 2457f057d140SJohannes Berg struct sk_buff *skb); 2458f057d140SJohannes Berg 2459f057d140SJohannes Berg 246079c92ca4SYu Wang const char *ieee80211_get_reason_code_string(u16 reason_code); 246105d10957SThomas Pedersen u16 ieee80211_encode_usf(int val); 246209a740ceSThomas Pedersen u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, 246309a740ceSThomas Pedersen enum nl80211_iftype type); 246495224fe8SArik Nemtsov 2465b7ffbd7eSJohannes Berg extern const struct ethtool_ops ieee80211_ethtool_ops; 2466b7ffbd7eSJohannes Berg 2467db3e1c40SToke Høiland-Jørgensen u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, 2468db3e1c40SToke Høiland-Jørgensen struct ieee80211_vif *vif, 2469db3e1c40SToke Høiland-Jørgensen struct ieee80211_sta *pubsta, 24703ff901cbSFelix Fietkau int len, bool ampdu); 2471f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE 2472d9e8a70fSJohannes Berg #define debug_noinline noinline 2473d9e8a70fSJohannes Berg #else 2474d9e8a70fSJohannes Berg #define debug_noinline 2475d9e8a70fSJohannes Berg #endif 2476d9e8a70fSJohannes Berg 24773a11ce08SJohannes Berg void ieee80211_init_frag_cache(struct ieee80211_fragment_cache *cache); 24783a11ce08SJohannes Berg void ieee80211_destroy_frag_cache(struct ieee80211_fragment_cache *cache); 24793a11ce08SJohannes Berg 2480820acc81SIlan Peer u8 ieee80211_ie_len_eht_cap(struct ieee80211_sub_if_data *sdata, u8 iftype); 2481820acc81SIlan Peer u8 *ieee80211_ie_build_eht_cap(u8 *pos, 2482820acc81SIlan Peer const struct ieee80211_sta_he_cap *he_cap, 2483820acc81SIlan Peer const struct ieee80211_sta_eht_cap *eht_cap, 2484820acc81SIlan Peer u8 *end); 2485a1de6407SIlan Peer 2486a1de6407SIlan Peer void 2487a1de6407SIlan Peer ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata, 2488a1de6407SIlan Peer struct ieee80211_supported_band *sband, 2489a1de6407SIlan Peer const u8 *he_cap_ie, u8 he_cap_len, 2490a1de6407SIlan Peer const struct ieee80211_eht_cap_elem *eht_cap_ie_elem, 2491c71420dbSJohannes Berg u8 eht_cap_len, 2492c71420dbSJohannes Berg struct link_sta_info *link_sta); 2493f0706e82SJiri Benc #endif /* IEEE80211_I_H */ 2494