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" 36baa951a1SJohannes Berg #include "drop.h" 37f0706e82SJiri Benc 383beea351SJohannes Berg extern const struct cfg80211_ops mac80211_config_ops; 393beea351SJohannes Berg 409cfb0009SJohannes Berg struct ieee80211_local; 41d5edb9aeSFelix Fietkau struct ieee80211_mesh_fast_tx; 42f0706e82SJiri Benc 43f0706e82SJiri Benc /* Maximum number of broadcast/multicast frames to buffer when some of the 44f0706e82SJiri Benc * associated stations are using power saving. */ 45f0706e82SJiri Benc #define AP_MAX_BC_BUFFER 128 46f0706e82SJiri Benc 47f0706e82SJiri Benc /* Maximum number of frames buffered to all STAs, including multicast frames. 48f0706e82SJiri Benc * Note: increasing this limit increases the potential memory requirement. Each 49f0706e82SJiri Benc * frame can be up to about 2 kB long. */ 50f0706e82SJiri Benc #define TOTAL_MAX_TX_BUFFER 512 51f0706e82SJiri Benc 52f0706e82SJiri Benc /* Required encryption head and tailroom */ 53f0706e82SJiri Benc #define IEEE80211_ENCRYPT_HEADROOM 8 54765cb46aSJouni Malinen #define IEEE80211_ENCRYPT_TAILROOM 18 55f0706e82SJiri Benc 561ea6f9c0SJohannes Berg /* power level hasn't been configured (or set to automatic) */ 571ea6f9c0SJohannes Berg #define IEEE80211_UNSET_POWER_LEVEL INT_MIN 581ea6f9c0SJohannes Berg 59d6a4ed6fSArik Nemtsov /* 60aa75ebc2SMichal Kazior * Some APs experience problems when working with U-APSD. Decreasing the 61aa75ebc2SMichal Kazior * probability of that happening by using legacy mode for all ACs but VO isn't 62aa75ebc2SMichal Kazior * enough. 63aa75ebc2SMichal Kazior * 64aa75ebc2SMichal Kazior * Cisco 4410N originally forced us to enable VO by default only because it 65aa75ebc2SMichal Kazior * treated non-VO ACs as legacy. 66aa75ebc2SMichal Kazior * 67aa75ebc2SMichal Kazior * However some APs (notably Netgear R7000) silently reclassify packets to 68aa75ebc2SMichal Kazior * different ACs. Since u-APSD ACs require trigger frames for frame retrieval 69aa75ebc2SMichal Kazior * clients would never see some frames (e.g. ARP responses) or would fetch them 70aa75ebc2SMichal Kazior * accidentally after a long time. 71aa75ebc2SMichal Kazior * 72aa75ebc2SMichal Kazior * It makes little sense to enable u-APSD queues by default because it needs 73aa75ebc2SMichal Kazior * userspace applications to be aware of it to actually take advantage of the 74aa75ebc2SMichal Kazior * possible additional powersavings. Implicitly depending on driver autotrigger 75aa75ebc2SMichal Kazior * frame support doesn't make much sense. 76d6a4ed6fSArik Nemtsov */ 77aa75ebc2SMichal Kazior #define IEEE80211_DEFAULT_UAPSD_QUEUES 0 78ab13315aSKalle Valo 79ab13315aSKalle Valo #define IEEE80211_DEFAULT_MAX_SP_LEN \ 80ab13315aSKalle Valo IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 81ab13315aSKalle Valo 82f438ceb8SEmmanuel Grumbach extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS]; 83f438ceb8SEmmanuel Grumbach 846ae16775SAntonio Quartulli #define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */) 856ae16775SAntonio Quartulli 86167e33f4SAyala Beker #define IEEE80211_MAX_NAN_INSTANCE_ID 255 87167e33f4SAyala Beker 888ccc0702SFelix Fietkau 898ccc0702SFelix Fietkau /* 908ccc0702SFelix Fietkau * Keep a station's queues on the active list for deficit accounting purposes 918ccc0702SFelix Fietkau * if it was active or queued during the last 100ms 928ccc0702SFelix Fietkau */ 938ccc0702SFelix Fietkau #define AIRTIME_ACTIVE_DURATION (HZ / 10) 948ccc0702SFelix Fietkau 95c2b13452SJohannes Berg struct ieee80211_bss { 96ef429dadSJohannes Berg u32 device_ts_beacon, device_ts_presp; 978c358bcdSJohannes Berg 9843ac2ca3SJouni Malinen bool wmm_used; 99ab13315aSKalle Valo bool uapsd_supported; 10000d3f14cSJohannes Berg 101f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32 102f0706e82SJiri Benc u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 103f0706e82SJiri Benc size_t supp_rates_len; 104817cee76SAlexander Bondar struct ieee80211_rate *beacon_rate; 105f0706e82SJiri Benc 1062a333a0dSJohannes Berg u32 vht_cap_info; 1072a333a0dSJohannes Berg 10800d3f14cSJohannes Berg /* 10925985edcSLucas De Marchi * During association, we save an ERP value from a probe response so 1105628221cSDaniel Drake * that we can feed ERP info to the driver when handling the 1115628221cSDaniel Drake * association completes. these fields probably won't be up-to-date 11200d3f14cSJohannes Berg * otherwise, you probably don't want to use them. 11300d3f14cSJohannes Berg */ 11400d3f14cSJohannes Berg bool has_erp_value; 1155628221cSDaniel Drake u8 erp_value; 116fcff4f10SPaul Stewart 117fcff4f10SPaul Stewart /* Keep track of the corruption of the last beacon/probe response. */ 118fcff4f10SPaul Stewart u8 corrupt_data; 119fcff4f10SPaul Stewart 120fcff4f10SPaul Stewart /* Keep track of what bits of information we have valid info for. */ 121fcff4f10SPaul Stewart u8 valid_data; 122fcff4f10SPaul Stewart }; 123fcff4f10SPaul Stewart 124fcff4f10SPaul Stewart /** 125fcff4f10SPaul Stewart * enum ieee80211_corrupt_data_flags - BSS data corruption flags 126fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted 127fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted 128fcff4f10SPaul Stewart * 129fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the 130fcff4f10SPaul Stewart * @corrupt_data field of &struct ieee80211_bss. 131fcff4f10SPaul Stewart */ 132fcff4f10SPaul Stewart enum ieee80211_bss_corrupt_data_flags { 133fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_BEACON = BIT(0), 134fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_PROBE_RESP = BIT(1) 135fcff4f10SPaul Stewart }; 136fcff4f10SPaul Stewart 137fcff4f10SPaul Stewart /** 138fcff4f10SPaul Stewart * enum ieee80211_valid_data_flags - BSS valid data flags 139fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE 140fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE 141fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE 142fcff4f10SPaul Stewart * 143fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the 144fcff4f10SPaul Stewart * @valid_data field of &struct ieee80211_bss. They show which parts 145d070f913SStephen Hemminger * of the data structure were received as a result of an un-corrupted 146fcff4f10SPaul Stewart * beacon/probe response. 147fcff4f10SPaul Stewart */ 148fcff4f10SPaul Stewart enum ieee80211_bss_valid_data_flags { 149fcff4f10SPaul Stewart IEEE80211_BSS_VALID_WMM = BIT(1), 150fcff4f10SPaul Stewart IEEE80211_BSS_VALID_RATES = BIT(2), 151fcff4f10SPaul Stewart IEEE80211_BSS_VALID_ERP = BIT(3) 152f0706e82SJiri Benc }; 153f0706e82SJiri Benc 1549efeccacSMichael S. Tsirkin typedef unsigned __bitwise ieee80211_tx_result; 1559ae54c84SJohannes Berg #define TX_CONTINUE ((__force ieee80211_tx_result) 0u) 1569ae54c84SJohannes Berg #define TX_DROP ((__force ieee80211_tx_result) 1u) 1579ae54c84SJohannes Berg #define TX_QUEUED ((__force ieee80211_tx_result) 2u) 1589ae54c84SJohannes Berg 1595cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST BIT(1) 1605cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED BIT(2) 1619ae54c84SJohannes Berg 1625cf121c3SJohannes Berg struct ieee80211_tx_data { 163f0706e82SJiri Benc struct sk_buff *skb; 164252b86c4SJohannes Berg struct sk_buff_head skbs; 165f0706e82SJiri Benc struct ieee80211_local *local; 166f0706e82SJiri Benc struct ieee80211_sub_if_data *sdata; 167f0706e82SJiri Benc struct sta_info *sta; 168f0706e82SJiri Benc struct ieee80211_key *key; 1690d528d85SFelix Fietkau struct ieee80211_tx_rate rate; 1705cf121c3SJohannes Berg 171056cdd59SJohannes Berg unsigned int flags; 1725cf121c3SJohannes Berg }; 1735cf121c3SJohannes Berg 174554891e6SJohannes Berg /** 175554891e6SJohannes Berg * enum ieee80211_packet_rx_flags - packet RX flags 176554891e6SJohannes Berg * @IEEE80211_RX_AMSDU: a-MSDU packet 177554891e6SJohannes Berg * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed 1784cfda47bSChristian Lamparter * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering 179554891e6SJohannes Berg * 180554891e6SJohannes Berg * These are per-frame flags that are attached to a frame in the 181554891e6SJohannes Berg * @rx_flags field of &struct ieee80211_rx_status. 182554891e6SJohannes Berg */ 183554891e6SJohannes Berg enum ieee80211_packet_rx_flags { 184554891e6SJohannes Berg IEEE80211_RX_AMSDU = BIT(3), 185554891e6SJohannes Berg IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4), 1864cfda47bSChristian Lamparter IEEE80211_RX_DEFERRED_RELEASE = BIT(5), 187554891e6SJohannes Berg }; 188554891e6SJohannes Berg 189554891e6SJohannes Berg /** 190554891e6SJohannes Berg * enum ieee80211_rx_flags - RX data flags 191554891e6SJohannes Berg * 192554891e6SJohannes Berg * @IEEE80211_RX_CMNTR: received on cooked monitor already 193ee971924SJohannes Berg * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported 194ee971924SJohannes Berg * to cfg80211_report_obss_beacon(). 195554891e6SJohannes Berg * 196554891e6SJohannes Berg * These flags are used across handling multiple interfaces 197554891e6SJohannes Berg * for a single frame. 198554891e6SJohannes Berg */ 199554891e6SJohannes Berg enum ieee80211_rx_flags { 200554891e6SJohannes Berg IEEE80211_RX_CMNTR = BIT(0), 201ee971924SJohannes Berg IEEE80211_RX_BEACON_REPORTED = BIT(1), 202554891e6SJohannes Berg }; 2035cf121c3SJohannes Berg 2045cf121c3SJohannes Berg struct ieee80211_rx_data { 205c5d1686bSFelix Fietkau struct list_head *list; 2065cf121c3SJohannes Berg struct sk_buff *skb; 2075cf121c3SJohannes Berg struct ieee80211_local *local; 2085cf121c3SJohannes Berg struct ieee80211_sub_if_data *sdata; 20956057da4SJohannes Berg struct ieee80211_link_data *link; 2105cf121c3SJohannes Berg struct sta_info *sta; 211ccdde7c7SJohannes Berg struct link_sta_info *link_sta; 2125cf121c3SJohannes Berg struct ieee80211_key *key; 213056cdd59SJohannes Berg 214056cdd59SJohannes Berg unsigned int flags; 2159e26297aSJohannes Berg 2169e26297aSJohannes Berg /* 2179e26297aSJohannes Berg * Index into sequence numbers array, 0..16 2189e26297aSJohannes Berg * since the last (16) is used for non-QoS, 2199e26297aSJohannes Berg * will be 16 on non-QoS frames. 2209e26297aSJohannes Berg */ 2219e26297aSJohannes Berg int seqno_idx; 2229e26297aSJohannes Berg 2239e26297aSJohannes Berg /* 2249e26297aSJohannes Berg * Index into the security IV/PN arrays, 0..16 2259e26297aSJohannes Berg * since the last (16) is used for CCMP-encrypted 2269e26297aSJohannes Berg * management frames, will be set to 16 on mgmt 2279e26297aSJohannes Berg * frames and 0 on non-QoS frames. 2289e26297aSJohannes Berg */ 2299e26297aSJohannes Berg int security_idx; 2309e26297aSJohannes Berg 231892b3bceSJohannes Berg int link_id; 232892b3bceSJohannes Berg 233bf30ca92SJohannes Berg union { 234bf30ca92SJohannes Berg struct { 235bf30ca92SJohannes Berg u32 iv32; 236bf30ca92SJohannes Berg u16 iv16; 237bf30ca92SJohannes Berg } tkip; 238bf30ca92SJohannes Berg struct { 239bf30ca92SJohannes Berg u8 pn[IEEE80211_CCMP_PN_LEN]; 240bf30ca92SJohannes Berg } ccm_gcm; 241bf30ca92SJohannes Berg }; 242f0706e82SJiri Benc }; 243f0706e82SJiri Benc 244af296bdbSMichal Kazior struct ieee80211_csa_settings { 245af296bdbSMichal Kazior const u16 *counter_offsets_beacon; 246af296bdbSMichal Kazior const u16 *counter_offsets_presp; 247af296bdbSMichal Kazior 248af296bdbSMichal Kazior int n_counter_offsets_beacon; 249af296bdbSMichal Kazior int n_counter_offsets_presp; 250af296bdbSMichal Kazior 251af296bdbSMichal Kazior u8 count; 252af296bdbSMichal Kazior }; 253af296bdbSMichal Kazior 2545f9404abSJohn Crispin struct ieee80211_color_change_settings { 2555f9404abSJohn Crispin u16 counter_offset_beacon; 2565f9404abSJohn Crispin u16 counter_offset_presp; 2575f9404abSJohn Crispin u8 count; 2585f9404abSJohn Crispin }; 2595f9404abSJohn Crispin 2605dfdaf58SJohannes Berg struct beacon_data { 2615dfdaf58SJohannes Berg u8 *head, *tail; 2625dfdaf58SJohannes Berg int head_len, tail_len; 26343552be1SThomas Pedersen struct ieee80211_meshconf_ie *meshconf; 2648552a434SJohn Crispin u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM]; 2658552a434SJohn Crispin u8 cntdwn_current_counter; 2662b3171c6SLorenzo Bianconi struct cfg80211_mbssid_elems *mbssid_ies; 26768b9bea2SAloka Dixit struct cfg80211_rnr_elems *rnr_ies; 2688860020eSJohannes Berg struct rcu_head rcu_head; 2695dfdaf58SJohannes Berg }; 2705dfdaf58SJohannes Berg 271aa7a0080SEyal Shapira struct probe_resp { 272aa7a0080SEyal Shapira struct rcu_head rcu_head; 273aa7a0080SEyal Shapira int len; 2748552a434SJohn Crispin u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM]; 2753c23215bSGustavo A. R. Silva u8 data[]; 276aa7a0080SEyal Shapira }; 277aa7a0080SEyal Shapira 278295b02c4SAloka Dixit struct fils_discovery_data { 279295b02c4SAloka Dixit struct rcu_head rcu_head; 280295b02c4SAloka Dixit int len; 281295b02c4SAloka Dixit u8 data[]; 282295b02c4SAloka Dixit }; 283295b02c4SAloka Dixit 284632189a0SAloka Dixit struct unsol_bcast_probe_resp_data { 285632189a0SAloka Dixit struct rcu_head rcu_head; 286632189a0SAloka Dixit int len; 287632189a0SAloka Dixit u8 data[]; 288632189a0SAloka Dixit }; 289632189a0SAloka Dixit 290d012a605SMarco Porsch struct ps_data { 291d012a605SMarco Porsch /* yes, this looks ugly, but guarantees that we can later use 292d012a605SMarco Porsch * bitmap_empty :) 293d012a605SMarco Porsch * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ 2945fe2bb86SJoe Perches u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)] 2955fe2bb86SJoe Perches __aligned(__alignof__(unsigned long)); 296d012a605SMarco Porsch struct sk_buff_head bc_buf; 297d012a605SMarco Porsch atomic_t num_sta_ps; /* number of stations in PS mode */ 298d012a605SMarco Porsch int dtim_count; 299d012a605SMarco Porsch bool dtim_bc_mc; 300d012a605SMarco Porsch }; 301d012a605SMarco Porsch 302f0706e82SJiri Benc struct ieee80211_if_ap { 3034e141dadSMichal Kazior struct list_head vlans; /* write-protected with RTNL and local->mtx */ 3040ec3ca44SJohannes Berg 305d012a605SMarco Porsch struct ps_data ps; 306030ef8f8SFelix Fietkau atomic_t num_mcast_sta; /* number of stations receiving multicast */ 307687da132SEmmanuel Grumbach 308ebceec86SMichael Braun bool multicast_to_unicast; 309bfd8403aSJohannes Berg bool active; 310f0706e82SJiri Benc }; 311f0706e82SJiri Benc 312f0706e82SJiri Benc struct ieee80211_if_vlan { 3134e141dadSMichal Kazior struct list_head list; /* write-protected with RTNL and local->mtx */ 314f14543eeSFelix Fietkau 315f14543eeSFelix Fietkau /* used for all tx if the VLAN is configured to 4-addr mode */ 31640b275b6SJohannes Berg struct sta_info __rcu *sta; 31772f15d53SMichael Braun atomic_t num_mcast_sta; /* number of stations receiving multicast */ 318f0706e82SJiri Benc }; 319f0706e82SJiri Benc 320ee385855SLuis Carlos Cobo struct mesh_stats { 321c8a61a7dSDaniel Walker __u32 fwded_mcast; /* Mesh forwarded multicast frames */ 322c8a61a7dSDaniel Walker __u32 fwded_unicast; /* Mesh forwarded unicast frames */ 323c8a61a7dSDaniel Walker __u32 fwded_frames; /* Mesh total forwarded frames */ 324ee385855SLuis Carlos Cobo __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ 325ee385855SLuis Carlos Cobo __u32 dropped_frames_no_route; /* Not transmitted, no route found */ 326ee385855SLuis Carlos Cobo }; 327ee385855SLuis Carlos Cobo 328ee385855SLuis Carlos Cobo #define PREQ_Q_F_START 0x1 329ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH 0x2 330ee385855SLuis Carlos Cobo struct mesh_preq_queue { 331ee385855SLuis Carlos Cobo struct list_head list; 332ee385855SLuis Carlos Cobo u8 dst[ETH_ALEN]; 333ee385855SLuis Carlos Cobo u8 flags; 334ee385855SLuis Carlos Cobo }; 335ee385855SLuis Carlos Cobo 3362eb278e0SJohannes Berg struct ieee80211_roc_work { 33777fdaa12SJohannes Berg struct list_head list; 338af6b6374SJohannes Berg 339af6b6374SJohannes Berg struct ieee80211_sub_if_data *sdata; 340af6b6374SJohannes Berg 341f679f65dSJohannes Berg struct ieee80211_channel *chan; 342af6b6374SJohannes Berg 3432eb278e0SJohannes Berg bool started, abort, hw_begun, notified; 344b4b177a5SJohannes Berg bool on_channel; 345f679f65dSJohannes Berg 346aaa016ccSJohannes Berg unsigned long start_time; 347e4da8c37SJohannes Berg 3482eb278e0SJohannes Berg u32 duration, req_duration; 349f30221e4SJohannes Berg struct sk_buff *frame; 35050febf6aSJohannes Berg u64 cookie, mgmt_tx_cookie; 351d339d5caSIlan Peer enum ieee80211_roc_type type; 35277fdaa12SJohannes Berg }; 35377fdaa12SJohannes Berg 35446900298SJohannes Berg /* flags used in struct ieee80211_if_managed.flags */ 355ab1faeadSJohannes Berg enum ieee80211_sta_flags { 356b291ba11SJohannes Berg IEEE80211_STA_CONNECTION_POLL = BIT(1), 357b291ba11SJohannes Berg IEEE80211_STA_CONTROL_PORT = BIT(2), 358b291ba11SJohannes Berg IEEE80211_STA_MFP_ENABLED = BIT(6), 359ab13315aSKalle Valo IEEE80211_STA_UAPSD_ENABLED = BIT(7), 360375177bfSVivek Natarajan IEEE80211_STA_NULLFUNC_ACKED = BIT(8), 361cd2f5dd7SAssaf Krauss IEEE80211_STA_ENABLE_RRM = BIT(15), 362ba323e29SJohannes Berg }; 363ba323e29SJohannes Berg 364ba323e29SJohannes Berg typedef u32 __bitwise ieee80211_conn_flags_t; 365ba323e29SJohannes Berg 366ba323e29SJohannes Berg enum ieee80211_conn_flags { 367ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_HT = (__force ieee80211_conn_flags_t)BIT(0), 368ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_40MHZ = (__force ieee80211_conn_flags_t)BIT(1), 369ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_VHT = (__force ieee80211_conn_flags_t)BIT(2), 370ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_80P80MHZ = (__force ieee80211_conn_flags_t)BIT(3), 371ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_160MHZ = (__force ieee80211_conn_flags_t)BIT(4), 372ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_HE = (__force ieee80211_conn_flags_t)BIT(5), 373ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_EHT = (__force ieee80211_conn_flags_t)BIT(6), 374ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_320MHZ = (__force ieee80211_conn_flags_t)BIT(7), 375ab1faeadSJohannes Berg }; 376ab1faeadSJohannes Berg 37766e67e41SJohannes Berg struct ieee80211_mgd_auth_data { 37866e67e41SJohannes Berg struct cfg80211_bss *bss; 37966e67e41SJohannes Berg unsigned long timeout; 38066e67e41SJohannes Berg int tries; 38166e67e41SJohannes Berg u16 algorithm, expected_transaction; 38266e67e41SJohannes Berg 38366e67e41SJohannes Berg u8 key[WLAN_KEY_LEN_WEP104]; 38466e67e41SJohannes Berg u8 key_len, key_idx; 38594d9864cSJohannes Berg bool done, waiting; 386efb543e6SJouni Malinen bool peer_confirmed; 38789afe614SJohannes Berg bool timeout_started; 38885176a3fSJohannes Berg int link_id; 38966e67e41SJohannes Berg 39081151ce4SJohannes Berg u8 ap_addr[ETH_ALEN] __aligned(2); 39181151ce4SJohannes 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 { 39881151ce4SJohannes Berg struct { 39966e67e41SJohannes Berg struct cfg80211_bss *bss; 40066e67e41SJohannes Berg 40181151ce4SJohannes Berg u8 addr[ETH_ALEN] __aligned(2); 40266e67e41SJohannes Berg 4039dde6423SJohannes Berg u8 ap_ht_param; 4049dde6423SJohannes Berg 405b08fbbd8SJohannes Berg struct ieee80211_vht_cap ap_vht_cap; 406b08fbbd8SJohannes Berg 40781151ce4SJohannes Berg size_t elems_len; 40881151ce4SJohannes Berg u8 *elems; /* pointing to inside ie[] below */ 40981151ce4SJohannes Berg 41081151ce4SJohannes Berg ieee80211_conn_flags_t conn_flags; 411c2d052a3SIlan Peer 412c2d052a3SIlan Peer u16 status; 41381151ce4SJohannes Berg } link[IEEE80211_MLD_MAX_NUM_LINKS]; 41481151ce4SJohannes Berg 41581151ce4SJohannes Berg u8 ap_addr[ETH_ALEN] __aligned(2); 41681151ce4SJohannes Berg 41781151ce4SJohannes Berg /* this is for a workaround, so we use it only for non-MLO */ 41881151ce4SJohannes Berg const u8 *supp_rates; 41981151ce4SJohannes Berg u8 supp_rates_len; 42081151ce4SJohannes Berg 42181151ce4SJohannes Berg unsigned long timeout; 42281151ce4SJohannes Berg int tries; 42381151ce4SJohannes Berg 42481151ce4SJohannes Berg u8 prev_ap_addr[ETH_ALEN]; 42581151ce4SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 42681151ce4SJohannes Berg u8 ssid_len; 42781151ce4SJohannes Berg bool wmm, uapsd; 42881151ce4SJohannes Berg bool need_beacon; 42981151ce4SJohannes Berg bool synced; 43081151ce4SJohannes Berg bool timeout_started; 43181151ce4SJohannes Berg bool s1g; 43281151ce4SJohannes Berg 43381151ce4SJohannes Berg unsigned int assoc_link_id; 43481151ce4SJohannes Berg 43539404feeSJouni Malinen u8 fils_nonces[2 * FILS_NONCE_LEN]; 43639404feeSJouni Malinen u8 fils_kek[FILS_MAX_KEK_LEN]; 43739404feeSJouni Malinen size_t fils_kek_len; 43839404feeSJouni Malinen 43966e67e41SJohannes Berg size_t ie_len; 44081151ce4SJohannes Berg u8 *ie_pos; /* used to fill ie[] with link[].elems */ 44166e67e41SJohannes Berg u8 ie[]; 44266e67e41SJohannes Berg }; 44366e67e41SJohannes Berg 44402219b3aSJohannes Berg struct ieee80211_sta_tx_tspec { 44502219b3aSJohannes Berg /* timestamp of the first packet in the time slice */ 44602219b3aSJohannes Berg unsigned long time_slice_start; 44702219b3aSJohannes Berg 44802219b3aSJohannes Berg u32 admitted_time; /* in usecs, unlike over the air */ 44902219b3aSJohannes Berg u8 tsid; 45002219b3aSJohannes Berg s8 up; /* signed to be able to invalidate with -1 during teardown */ 45102219b3aSJohannes Berg 45202219b3aSJohannes Berg /* consumed TX time in microseconds in the time slice */ 45302219b3aSJohannes Berg u32 consumed_tx_time; 45402219b3aSJohannes Berg enum { 45502219b3aSJohannes Berg TX_TSPEC_ACTION_NONE = 0, 45602219b3aSJohannes Berg TX_TSPEC_ACTION_DOWNGRADE, 45702219b3aSJohannes Berg TX_TSPEC_ACTION_STOP_DOWNGRADE, 45802219b3aSJohannes Berg } action; 45902219b3aSJohannes Berg bool downgraded; 46002219b3aSJohannes Berg }; 46102219b3aSJohannes Berg 462eb1e011aSJohannes Berg DECLARE_EWMA(beacon_signal, 4, 4) 463338c17aeSJohannes Berg 46446900298SJohannes Berg struct ieee80211_if_managed { 465056cdd59SJohannes Berg struct timer_list timer; 466b291ba11SJohannes Berg struct timer_list conn_mon_timer; 467b291ba11SJohannes Berg struct timer_list bcn_mon_timer; 468b291ba11SJohannes Berg struct work_struct monitor_work; 4691e4dcd01SJuuso Oikarinen struct work_struct beacon_connection_loss_work; 470882a7c69SJohannes Berg struct work_struct csa_connection_drop_work; 47146900298SJohannes Berg 4727ccc8bd7SFelix Fietkau unsigned long beacon_timeout; 473b291ba11SJohannes Berg unsigned long probe_timeout; 474a43abf29SMaxim Levitsky int probe_send_count; 47504ac3c0eSFelix Fietkau bool nullfunc_failed; 4763f8a39ffSJohannes Berg u8 connection_loss:1, 4773f8a39ffSJohannes Berg driver_disconnect:1, 4785dfad108SJohannes Berg reconnect:1, 4795dfad108SJohannes Berg associated:1; 480b291ba11SJohannes Berg 48166e67e41SJohannes Berg struct ieee80211_mgd_auth_data *auth_data; 48266e67e41SJohannes Berg struct ieee80211_mgd_assoc_data *assoc_data; 48346900298SJohannes Berg 484965bedadSJohannes Berg bool powersave; /* powersave requested for this iface */ 48505cb9108SJohannes Berg bool broken_ap; /* AP is broken -- turn off powersave */ 486965bedadSJohannes Berg 487d6f2da5bSJiri Slaby unsigned int flags; 488f0706e82SJiri Benc 4891672c0e3SJohannes Berg bool status_acked; 4901672c0e3SJohannes Berg bool status_received; 4911672c0e3SJohannes Berg __le16 status_fc; 4921672c0e3SJohannes Berg 493fdfacf0aSJouni Malinen enum { 494fdfacf0aSJouni Malinen IEEE80211_MFP_DISABLED, 495fdfacf0aSJouni Malinen IEEE80211_MFP_OPTIONAL, 496fdfacf0aSJouni Malinen IEEE80211_MFP_REQUIRED 497fdfacf0aSJouni Malinen } mfp; /* management frame protection */ 498fdfacf0aSJouni Malinen 499dc41e4d4SEliad Peller /* 500dc41e4d4SEliad Peller * Bitmask of enabled u-apsd queues, 501dc41e4d4SEliad Peller * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association 502dc41e4d4SEliad Peller * to take effect. 503dc41e4d4SEliad Peller */ 504dc41e4d4SEliad Peller unsigned int uapsd_queues; 505dc41e4d4SEliad Peller 506dc41e4d4SEliad Peller /* 507dc41e4d4SEliad Peller * Maximum number of buffered frames AP can deliver during a 508dc41e4d4SEliad Peller * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar. 509dc41e4d4SEliad Peller * Needs a new association to take effect. 510dc41e4d4SEliad Peller */ 511dc41e4d4SEliad Peller unsigned int uapsd_max_sp_len; 512dc41e4d4SEliad Peller 5139bc383deSJohannes Berg u8 use_4addr; 51417e4ec14SJouni Malinen 515615f7b9bSMeenakshi Venkataraman /* 516615f7b9bSMeenakshi Venkataraman * State variables for keeping track of RSSI of the AP currently 517615f7b9bSMeenakshi Venkataraman * connected to and informing driver when RSSI has gone 518615f7b9bSMeenakshi Venkataraman * below/above a certain threshold. 519615f7b9bSMeenakshi Venkataraman */ 520615f7b9bSMeenakshi Venkataraman int rssi_min_thold, rssi_max_thold; 521ef96a842SBen Greear 522ef96a842SBen Greear struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ 523ef96a842SBen Greear struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ 524dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */ 525dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */ 5267957c6c8SThomas Pedersen struct ieee80211_s1g_cap s1g_capa; /* configured S1G overrides */ 5277957c6c8SThomas Pedersen struct ieee80211_s1g_cap s1g_capa_mask; /* valid s1g_capa bits */ 52881dd2b88SArik Nemtsov 5291277b4a9SLiad Kaufman /* TDLS support */ 53081dd2b88SArik Nemtsov u8 tdls_peer[ETH_ALEN] __aligned(2); 53181dd2b88SArik Nemtsov struct delayed_work tdls_peer_del_work; 5321277b4a9SLiad Kaufman struct sk_buff *orig_teardown_skb; /* The original teardown skb */ 5331277b4a9SLiad Kaufman struct sk_buff *teardown_skb; /* A copy to send through the AP */ 5341277b4a9SLiad Kaufman spinlock_t teardown_lock; /* To lock changing teardown_skb */ 53582c0cc90SArik Nemtsov bool tdls_wider_bw_prohibited; 53602219b3aSJohannes Berg 53702219b3aSJohannes Berg /* WMM-AC TSPEC support */ 53802219b3aSJohannes Berg struct ieee80211_sta_tx_tspec tx_tspec[IEEE80211_NUM_ACS]; 53902219b3aSJohannes Berg /* Use a separate work struct so that we can do something here 54002219b3aSJohannes Berg * while the sdata->work is flushing the queues, for example. 54102219b3aSJohannes Berg * otherwise, in scenarios where we hardly get any traffic out 54202219b3aSJohannes Berg * on the BE queue, but there's a lot of VO traffic, we might 54302219b3aSJohannes Berg * get stuck in a downgraded situation and flush takes forever. 54402219b3aSJohannes Berg */ 54502219b3aSJohannes Berg struct delayed_work tx_tspec_wk; 5464d9ec73dSJouni Malinen 5474d9ec73dSJouni Malinen /* Information elements from the last transmitted (Re)Association 5484d9ec73dSJouni Malinen * Request frame. 5494d9ec73dSJouni Malinen */ 5504d9ec73dSJouni Malinen u8 *assoc_req_ies; 5514d9ec73dSJouni Malinen size_t assoc_req_ies_len; 552f0706e82SJiri Benc }; 553f0706e82SJiri Benc 55446900298SJohannes Berg struct ieee80211_if_ibss { 55546900298SJohannes Berg struct timer_list timer; 556cd7760e6SSimon Wunderlich struct work_struct csa_connection_drop_work; 55746900298SJohannes Berg 558af8cdcd8SJohannes Berg unsigned long last_scan_completed; 5595bb644a0SJohannes Berg 560fbd2c8dcSTeemu Paasikivi u32 basic_rates; 561fbd2c8dcSTeemu Paasikivi 562af8cdcd8SJohannes Berg bool fixed_bssid; 563af8cdcd8SJohannes Berg bool fixed_channel; 564fffd0934SJohannes Berg bool privacy; 56546900298SJohannes Berg 566267335d6SAntonio Quartulli bool control_port; 5678e8d347dSSimon Wunderlich bool userspace_handles_dfs; 568267335d6SAntonio Quartulli 5694d196e4bSFelix Fietkau u8 bssid[ETH_ALEN] __aligned(2); 570af8cdcd8SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 571af8cdcd8SJohannes Berg u8 ssid_len, ie_len; 572af8cdcd8SJohannes Berg u8 *ie; 5733aede78aSSimon Wunderlich struct cfg80211_chan_def chandef; 57446900298SJohannes Berg 57546900298SJohannes Berg unsigned long ibss_join_req; 576af8cdcd8SJohannes Berg /* probe response/beacon for IBSS */ 577c3ffeab4SJohannes Berg struct beacon_data __rcu *presp; 57846900298SJohannes Berg 579822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ 580822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ 581822854b0SSimon Wunderlich 5828bf11d8dSJohannes Berg spinlock_t incomplete_lock; 5838bf11d8dSJohannes Berg struct list_head incomplete_stations; 5848bf11d8dSJohannes Berg 58546900298SJohannes Berg enum { 58646900298SJohannes Berg IEEE80211_IBSS_MLME_SEARCH, 58746900298SJohannes Berg IEEE80211_IBSS_MLME_JOINED, 58846900298SJohannes Berg } state; 58946900298SJohannes Berg }; 59046900298SJohannes Berg 591dbf498fbSJavier Cardona /** 592239281f8SRostislav Lisovy * struct ieee80211_if_ocb - OCB mode state 593239281f8SRostislav Lisovy * 594239281f8SRostislav Lisovy * @housekeeping_timer: timer for periodic invocation of a housekeeping task 595239281f8SRostislav Lisovy * @wrkq_flags: OCB deferred task action 596239281f8SRostislav Lisovy * @incomplete_lock: delayed STA insertion lock 597239281f8SRostislav Lisovy * @incomplete_stations: list of STAs waiting for delayed insertion 598239281f8SRostislav Lisovy * @joined: indication if the interface is connected to an OCB network 599239281f8SRostislav Lisovy */ 600239281f8SRostislav Lisovy struct ieee80211_if_ocb { 601239281f8SRostislav Lisovy struct timer_list housekeeping_timer; 602239281f8SRostislav Lisovy unsigned long wrkq_flags; 603239281f8SRostislav Lisovy 604239281f8SRostislav Lisovy spinlock_t incomplete_lock; 605239281f8SRostislav Lisovy struct list_head incomplete_stations; 606239281f8SRostislav Lisovy 607239281f8SRostislav Lisovy bool joined; 608239281f8SRostislav Lisovy }; 609239281f8SRostislav Lisovy 610239281f8SRostislav Lisovy /** 611dbf498fbSJavier Cardona * struct ieee80211_mesh_sync_ops - Extensible synchronization framework interface 612dbf498fbSJavier Cardona * 613dbf498fbSJavier Cardona * these declarations define the interface, which enables 614dbf498fbSJavier Cardona * vendor-specific mesh synchronization 615dbf498fbSJavier Cardona * 616dbf498fbSJavier Cardona */ 617dbf498fbSJavier Cardona struct ieee802_11_elems; 618dbf498fbSJavier Cardona struct ieee80211_mesh_sync_ops { 619a5b983c6SJohannes Berg void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata, u16 stype, 620a5b983c6SJohannes Berg struct ieee80211_mgmt *mgmt, unsigned int len, 621a5b983c6SJohannes Berg const struct ieee80211_meshconf_ie *mesh_cfg, 622dbf498fbSJavier Cardona struct ieee80211_rx_status *rx_status); 62343552be1SThomas Pedersen 62443552be1SThomas Pedersen /* should be called with beacon_data under RCU read lock */ 625445cd452SMasashi Honma void (*adjust_tsf)(struct ieee80211_sub_if_data *sdata, 62643552be1SThomas Pedersen struct beacon_data *beacon); 627dbf498fbSJavier Cardona /* add other framework functions here */ 628dbf498fbSJavier Cardona }; 629dbf498fbSJavier Cardona 630b8456a14SChun-Yeow Yeoh struct mesh_csa_settings { 631b8456a14SChun-Yeow Yeoh struct rcu_head rcu_head; 632b8456a14SChun-Yeow Yeoh struct cfg80211_csa_settings settings; 633b8456a14SChun-Yeow Yeoh }; 634b8456a14SChun-Yeow Yeoh 6358b5cb7e4SPavel Skripkin /** 6368b5cb7e4SPavel Skripkin * struct mesh_table 6378b5cb7e4SPavel Skripkin * 6388b5cb7e4SPavel Skripkin * @known_gates: list of known mesh gates and their mpaths by the station. The 6398b5cb7e4SPavel Skripkin * gate's mpath may or may not be resolved and active. 6408b5cb7e4SPavel Skripkin * @gates_lock: protects updates to known_gates 6418b5cb7e4SPavel Skripkin * @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr 6428b5cb7e4SPavel Skripkin * @walk_head: linked list containing all mesh_path objects 6438b5cb7e4SPavel Skripkin * @walk_lock: lock protecting walk_head 6448b5cb7e4SPavel Skripkin * @entries: number of entries in the table 6458b5cb7e4SPavel Skripkin */ 6468b5cb7e4SPavel Skripkin struct mesh_table { 6478b5cb7e4SPavel Skripkin struct hlist_head known_gates; 6488b5cb7e4SPavel Skripkin spinlock_t gates_lock; 6498b5cb7e4SPavel Skripkin struct rhashtable rhead; 6508b5cb7e4SPavel Skripkin struct hlist_head walk_head; 6518b5cb7e4SPavel Skripkin spinlock_t walk_lock; 6528b5cb7e4SPavel Skripkin atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */ 6538b5cb7e4SPavel Skripkin }; 6548b5cb7e4SPavel Skripkin 655d5edb9aeSFelix Fietkau /** 656d5edb9aeSFelix Fietkau * struct mesh_tx_cache - mesh fast xmit header cache 657d5edb9aeSFelix Fietkau * 658d5edb9aeSFelix Fietkau * @rht: hash table containing struct ieee80211_mesh_fast_tx, using skb DA as key 659d5edb9aeSFelix Fietkau * @walk_head: linked list containing all ieee80211_mesh_fast_tx objects 660d5edb9aeSFelix Fietkau * @walk_lock: lock protecting walk_head and rht 661d5edb9aeSFelix Fietkau */ 662d5edb9aeSFelix Fietkau struct mesh_tx_cache { 663d5edb9aeSFelix Fietkau struct rhashtable rht; 664d5edb9aeSFelix Fietkau struct hlist_head walk_head; 665d5edb9aeSFelix Fietkau spinlock_t walk_lock; 666d5edb9aeSFelix Fietkau }; 667d5edb9aeSFelix Fietkau 668472dbc45SJohannes Berg struct ieee80211_if_mesh { 669472dbc45SJohannes Berg struct timer_list housekeeping_timer; 670472dbc45SJohannes Berg struct timer_list mesh_path_timer; 671e304bfd3SRui Paulo struct timer_list mesh_path_root_timer; 672472dbc45SJohannes Berg 67318889231SJavier Cardona unsigned long wrkq_flags; 674f81a9dedSThomas Pedersen unsigned long mbss_changed; 675472dbc45SJohannes Berg 6760ab2e55dSBenjamin Berg bool userspace_handles_dfs; 6770ab2e55dSBenjamin Berg 678472dbc45SJohannes Berg u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; 679472dbc45SJohannes Berg size_t mesh_id_len; 680472dbc45SJohannes Berg /* Active Path Selection Protocol Identifier */ 6813491707aSRui Paulo u8 mesh_pp_id; 682472dbc45SJohannes Berg /* Active Path Selection Metric Identifier */ 6833491707aSRui Paulo u8 mesh_pm_id; 684472dbc45SJohannes Berg /* Congestion Control Mode Identifier */ 6853491707aSRui Paulo u8 mesh_cc_id; 6869e03fdfdSJavier Cardona /* Synchronization Protocol Identifier */ 6873491707aSRui Paulo u8 mesh_sp_id; 6889e03fdfdSJavier Cardona /* Authentication Protocol Identifier */ 6893491707aSRui Paulo u8 mesh_auth_id; 690d19b3bf6SRui Paulo /* Local mesh Sequence Number */ 691d19b3bf6SRui Paulo u32 sn; 692472dbc45SJohannes Berg /* Last used PREQ ID */ 693472dbc45SJohannes Berg u32 preq_id; 694472dbc45SJohannes Berg atomic_t mpaths; 695d19b3bf6SRui Paulo /* Timestamp of last SN update */ 696d19b3bf6SRui Paulo unsigned long last_sn_update; 697dca7e943SThomas Pedersen /* Time when it's ok to send next PERR */ 698dca7e943SThomas Pedersen unsigned long next_perr; 699dca7e943SThomas Pedersen /* Timestamp of last PREQ sent */ 700472dbc45SJohannes Berg unsigned long last_preq; 701472dbc45SJohannes Berg struct mesh_rmc *rmc; 702472dbc45SJohannes Berg spinlock_t mesh_preq_queue_lock; 703472dbc45SJohannes Berg struct mesh_preq_queue preq_queue; 704472dbc45SJohannes Berg int preq_queue_len; 705472dbc45SJohannes Berg struct mesh_stats mshstats; 706472dbc45SJohannes Berg struct mesh_config mshcfg; 7071258d976SAshok Nagarajan atomic_t estab_plinks; 708e626dad9SFelix Fietkau atomic_t mesh_seqnum; 709472dbc45SJohannes Berg bool accepting_plinks; 7105ee68e5bSJavier Cardona int num_gates; 7112b5e1967SThomas Pedersen struct beacon_data __rcu *beacon; 712581a8b0fSJavier Cardona const u8 *ie; 713581a8b0fSJavier Cardona u8 ie_len; 714b130e5ceSJavier Cardona enum { 715b130e5ceSJavier Cardona IEEE80211_MESH_SEC_NONE = 0x0, 716b130e5ceSJavier Cardona IEEE80211_MESH_SEC_AUTHED = 0x1, 717b130e5ceSJavier Cardona IEEE80211_MESH_SEC_SECURED = 0x2, 718b130e5ceSJavier Cardona } security; 719a6dad6a2SThomas Pedersen bool user_mpm; 720dbf498fbSJavier Cardona /* Extensible Synchronization Framework */ 7218ba7acf3SJohannes Berg const struct ieee80211_mesh_sync_ops *sync_ops; 722dbf498fbSJavier Cardona s64 sync_offset_clockdrift_max; 723dbf498fbSJavier Cardona spinlock_t sync_offset_lock; 7243f52b7e3SMarco Porsch /* mesh power save */ 7253f52b7e3SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 7263f52b7e3SMarco Porsch int ps_peers_light_sleep; 7273f52b7e3SMarco Porsch int ps_peers_deep_sleep; 7283f52b7e3SMarco Porsch struct ps_data ps; 7298f2535b9SChun-Yeow Yeoh /* Channel Switching Support */ 730b8456a14SChun-Yeow Yeoh struct mesh_csa_settings __rcu *csa; 7310cb4d4dcSLuciano Coelho enum { 7320cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_NONE, 7330cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_INIT, 7340cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_REPEATER, 7350cb4d4dcSLuciano Coelho } csa_role; 736b8456a14SChun-Yeow Yeoh u8 chsw_ttl; 7378f2535b9SChun-Yeow Yeoh u16 pre_value; 73843552be1SThomas Pedersen 73943552be1SThomas Pedersen /* offset from skb->data while building IE */ 74043552be1SThomas Pedersen int meshconf_offset; 7412bdaf386SBob Copeland 7428b5cb7e4SPavel Skripkin struct mesh_table mesh_paths; 7438b5cb7e4SPavel Skripkin struct mesh_table mpp_paths; /* Store paths for MPP&MAP */ 7442bdaf386SBob Copeland int mesh_paths_generation; 7452bdaf386SBob Copeland int mpp_paths_generation; 746d5edb9aeSFelix Fietkau struct mesh_tx_cache tx_cache; 747472dbc45SJohannes Berg }; 748902acc78SJohannes Berg 749902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 750472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 751472dbc45SJohannes Berg do { (msh)->mshstats.name++; } while (0) 752902acc78SJohannes Berg #else 753472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 754902acc78SJohannes Berg do { } while (0) 755902acc78SJohannes Berg #endif 756f0706e82SJiri Benc 757213cd118SJohannes Berg /** 758213cd118SJohannes Berg * enum ieee80211_sub_if_data_flags - virtual interface flags 759213cd118SJohannes Berg * 760213cd118SJohannes Berg * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets 761213cd118SJohannes Berg * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between 762213cd118SJohannes Berg * associated stations and deliver multicast frames both 763213cd118SJohannes Berg * back to wireless media and to the local net stack. 76495acac61SJohannes Berg * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume. 7657b7eab6fSJohannes Berg * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver 7667d352ccfSYoughandhar Chintala * @IEEE80211_SDATA_DISCONNECT_HW_RESTART: Disconnect after hardware restart 7677d352ccfSYoughandhar Chintala * recovery 768213cd118SJohannes Berg */ 769213cd118SJohannes Berg enum ieee80211_sub_if_data_flags { 770213cd118SJohannes Berg IEEE80211_SDATA_ALLMULTI = BIT(0), 7717986cf95SJohannes Berg IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3), 77295acac61SJohannes Berg IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4), 7737b7eab6fSJohannes Berg IEEE80211_SDATA_IN_DRIVER = BIT(5), 7747d352ccfSYoughandhar Chintala IEEE80211_SDATA_DISCONNECT_HW_RESTART = BIT(6), 775213cd118SJohannes Berg }; 776213cd118SJohannes Berg 77734d4bc4dSJohannes Berg /** 77834d4bc4dSJohannes Berg * enum ieee80211_sdata_state_bits - virtual interface state bits 77934d4bc4dSJohannes Berg * @SDATA_STATE_RUNNING: virtual interface is up & running; this 78034d4bc4dSJohannes Berg * mirrors netif_running() but is separate for interface type 78134d4bc4dSJohannes Berg * change handling while the interface is up 7825b714c6aSJohannes Berg * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel 7835b714c6aSJohannes Berg * mode, so queues are stopped 784d6a83228SJohannes Berg * @SDATA_STATE_OFFCHANNEL_BEACON_STOPPED: Beaconing was stopped due 785d6a83228SJohannes Berg * to offchannel, reset when offchannel returns 78634d4bc4dSJohannes Berg */ 78734d4bc4dSJohannes Berg enum ieee80211_sdata_state_bits { 78834d4bc4dSJohannes Berg SDATA_STATE_RUNNING, 7895b714c6aSJohannes Berg SDATA_STATE_OFFCHANNEL, 790d6a83228SJohannes Berg SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, 79134d4bc4dSJohannes Berg }; 79234d4bc4dSJohannes Berg 793d01a1e65SMichal Kazior /** 794d01a1e65SMichal Kazior * enum ieee80211_chanctx_mode - channel context configuration mode 795d01a1e65SMichal Kazior * 796d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_SHARED: channel context may be used by 797d01a1e65SMichal Kazior * multiple interfaces 798d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_EXCLUSIVE: channel context can be used 799d01a1e65SMichal Kazior * only by a single interface. This can be used for example for 800d01a1e65SMichal Kazior * non-fixed channel IBSS. 801d01a1e65SMichal Kazior */ 802d01a1e65SMichal Kazior enum ieee80211_chanctx_mode { 803d01a1e65SMichal Kazior IEEE80211_CHANCTX_SHARED, 804d01a1e65SMichal Kazior IEEE80211_CHANCTX_EXCLUSIVE 805d01a1e65SMichal Kazior }; 806d01a1e65SMichal Kazior 8075bcae31dSMichal Kazior /** 8085bcae31dSMichal Kazior * enum ieee80211_chanctx_replace_state - channel context replacement state 8095bcae31dSMichal Kazior * 8105bcae31dSMichal Kazior * This is used for channel context in-place reservations that require channel 8115bcae31dSMichal Kazior * context switch/swap. 8125bcae31dSMichal Kazior * 8135bcae31dSMichal Kazior * @IEEE80211_CHANCTX_REPLACE_NONE: no replacement is taking place 8145bcae31dSMichal Kazior * @IEEE80211_CHANCTX_WILL_BE_REPLACED: this channel context will be replaced 8155bcae31dSMichal Kazior * by a (not yet registered) channel context pointed by %replace_ctx. 8165bcae31dSMichal Kazior * @IEEE80211_CHANCTX_REPLACES_OTHER: this (not yet registered) channel context 8175bcae31dSMichal Kazior * replaces an existing channel context pointed to by %replace_ctx. 8185bcae31dSMichal Kazior */ 8195bcae31dSMichal Kazior enum ieee80211_chanctx_replace_state { 8205bcae31dSMichal Kazior IEEE80211_CHANCTX_REPLACE_NONE, 8215bcae31dSMichal Kazior IEEE80211_CHANCTX_WILL_BE_REPLACED, 8225bcae31dSMichal Kazior IEEE80211_CHANCTX_REPLACES_OTHER, 8235bcae31dSMichal Kazior }; 8245bcae31dSMichal Kazior 825d01a1e65SMichal Kazior struct ieee80211_chanctx { 826d01a1e65SMichal Kazior struct list_head list; 827d01a1e65SMichal Kazior struct rcu_head rcu_head; 828d01a1e65SMichal Kazior 829b4f85443SJohannes Berg struct list_head assigned_links; 830b4f85443SJohannes Berg struct list_head reserved_links; 831484298adSMichal Kazior 8325bcae31dSMichal Kazior enum ieee80211_chanctx_replace_state replace_state; 8335bcae31dSMichal Kazior struct ieee80211_chanctx *replace_ctx; 8345bcae31dSMichal Kazior 835d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode; 8368a61af65SJohannes Berg bool driver_present; 837d01a1e65SMichal Kazior 838d01a1e65SMichal Kazior struct ieee80211_chanctx_conf conf; 839d01a1e65SMichal Kazior }; 840d01a1e65SMichal Kazior 84132db6b54SKyeyoon Park struct mac80211_qos_map { 84232db6b54SKyeyoon Park struct cfg80211_qos_map qos_map; 84332db6b54SKyeyoon Park struct rcu_head rcu_head; 84432db6b54SKyeyoon Park }; 84532db6b54SKyeyoon Park 846ba8c3d6fSFelix Fietkau enum txq_info_flags { 847ba8c3d6fSFelix Fietkau IEEE80211_TXQ_STOP, 848ba8c3d6fSFelix Fietkau IEEE80211_TXQ_AMPDU, 8496e0456b5SFelix Fietkau IEEE80211_TXQ_NO_AMSDU, 8504444bc21SAlexander Wetzel IEEE80211_TXQ_DIRTY, 851ba8c3d6fSFelix Fietkau }; 852ba8c3d6fSFelix Fietkau 853fa962b92SMichal Kazior /** 854fa962b92SMichal Kazior * struct txq_info - per tid queue 855fa962b92SMichal Kazior * 856fa962b92SMichal Kazior * @tin: contains packets split into multiple flows 857fa962b92SMichal Kazior * @def_flow: used as a fallback flow when a packet destined to @tin hashes to 858fa962b92SMichal Kazior * a fq_flow which is already owned by a different tin 8595caa328eSMichal Kazior * @def_cvars: codel vars for @def_flow 8602433647bSToke Høiland-Jørgensen * @frags: used to keep fragments created after dequeue 861942741daSFelix Fietkau * @schedule_order: used with ieee80211_local->active_txqs 862942741daSFelix Fietkau * @schedule_round: counter to prevent infinite loops on TXQ scheduling 863fa962b92SMichal Kazior */ 864ba8c3d6fSFelix Fietkau struct txq_info { 865fa962b92SMichal Kazior struct fq_tin tin; 8665caa328eSMichal Kazior struct codel_vars def_cvars; 8678d51dbb8SToke Høiland-Jørgensen struct codel_stats cstats; 868942741daSFelix Fietkau 869942741daSFelix Fietkau u16 schedule_round; 870942741daSFelix Fietkau struct list_head schedule_order; 871c74025f4SJohannes Berg 872c74025f4SJohannes Berg struct sk_buff_head frags; 873942741daSFelix Fietkau 874ba8c3d6fSFelix Fietkau unsigned long flags; 875ba8c3d6fSFelix Fietkau 876ba8c3d6fSFelix Fietkau /* keep last! */ 877ba8c3d6fSFelix Fietkau struct ieee80211_txq txq; 878ba8c3d6fSFelix Fietkau }; 879ba8c3d6fSFelix Fietkau 880d8212184SAviya Erenfeld struct ieee80211_if_mntr { 881d8212184SAviya Erenfeld u32 flags; 88242bd20d9SAviya Erenfeld u8 mu_follow_addr[ETH_ALEN] __aligned(2); 883f64331d5SJohannes Berg 884f64331d5SJohannes Berg struct list_head list; 885d8212184SAviya Erenfeld }; 886d8212184SAviya Erenfeld 8875953ff6dSAyala Beker /** 8885953ff6dSAyala Beker * struct ieee80211_if_nan - NAN state 8895953ff6dSAyala Beker * 8905953ff6dSAyala Beker * @conf: current NAN configuration 891167e33f4SAyala Beker * @func_ids: a bitmap of available instance_id's 8925953ff6dSAyala Beker */ 8935953ff6dSAyala Beker struct ieee80211_if_nan { 8945953ff6dSAyala Beker struct cfg80211_nan_conf conf; 895167e33f4SAyala Beker 896167e33f4SAyala Beker /* protects function_inst_ids */ 897167e33f4SAyala Beker spinlock_t func_lock; 898167e33f4SAyala Beker struct idr function_inst_ids; 8995953ff6dSAyala Beker }; 9005953ff6dSAyala Beker 901bfd8403aSJohannes Berg struct ieee80211_link_data_managed { 902bfd8403aSJohannes Berg u8 bssid[ETH_ALEN] __aligned(2); 903bfd8403aSJohannes Berg 904bfd8403aSJohannes Berg u8 dtim_period; 905bfd8403aSJohannes Berg enum ieee80211_smps_mode req_smps, /* requested smps mode */ 906bfd8403aSJohannes Berg driver_smps_mode; /* smps mode request */ 907bfd8403aSJohannes Berg 908ba323e29SJohannes Berg ieee80211_conn_flags_t conn_flags; 909ba323e29SJohannes Berg 910bfd8403aSJohannes Berg s16 p2p_noa_index; 911bfd8403aSJohannes Berg 912ab3a830dSJohannes Berg bool tdls_chan_switch_prohibited; 913ab3a830dSJohannes Berg 914bfd8403aSJohannes Berg bool have_beacon; 91542ed6748SJohannes Berg bool tracking_signal_avg; 9166359598dSJohannes Berg bool disable_wmm_tracking; 91739eac2deSJohannes Berg bool operating_11g_mode; 918bfd8403aSJohannes Berg 919bfd8403aSJohannes Berg bool csa_waiting_bcn; 920bfd8403aSJohannes Berg bool csa_ignored_same_chan; 9215bd5666dSJohannes Berg struct timer_list chswitch_timer; 9225bd5666dSJohannes Berg struct work_struct chswitch_work; 923bfd8403aSJohannes Berg 924bfd8403aSJohannes Berg struct work_struct request_smps_work; 925bfd8403aSJohannes Berg bool beacon_crc_valid; 926bfd8403aSJohannes Berg u32 beacon_crc; 927bfd8403aSJohannes Berg struct ewma_beacon_signal ave_beacon_signal; 928bfd8403aSJohannes Berg int last_ave_beacon_signal; 929bfd8403aSJohannes Berg 930bfd8403aSJohannes Berg /* 931bfd8403aSJohannes Berg * Number of Beacon frames used in ave_beacon_signal. This can be used 932bfd8403aSJohannes Berg * to avoid generating less reliable cqm events that would be based 933bfd8403aSJohannes Berg * only on couple of received frames. 934bfd8403aSJohannes Berg */ 935bfd8403aSJohannes Berg unsigned int count_beacon_signal; 936bfd8403aSJohannes Berg 937bfd8403aSJohannes Berg /* Number of times beacon loss was invoked. */ 938bfd8403aSJohannes Berg unsigned int beacon_loss_count; 939bfd8403aSJohannes Berg 940bfd8403aSJohannes Berg /* 941bfd8403aSJohannes Berg * Last Beacon frame signal strength average (ave_beacon_signal / 16) 942bfd8403aSJohannes Berg * that triggered a cqm event. 0 indicates that no event has been 943bfd8403aSJohannes Berg * generated for the current association. 944bfd8403aSJohannes Berg */ 945bfd8403aSJohannes Berg int last_cqm_event_signal; 946bfd8403aSJohannes Berg 947bfd8403aSJohannes Berg int wmm_last_param_set; 948bfd8403aSJohannes Berg int mu_edca_last_param_set; 949bfd8403aSJohannes Berg 950bfd8403aSJohannes Berg struct cfg80211_bss *bss; 951bfd8403aSJohannes Berg }; 952bfd8403aSJohannes Berg 953bfd8403aSJohannes Berg struct ieee80211_link_data_ap { 954bfd8403aSJohannes Berg struct beacon_data __rcu *beacon; 955bfd8403aSJohannes Berg struct probe_resp __rcu *probe_resp; 956bfd8403aSJohannes Berg struct fils_discovery_data __rcu *fils_discovery; 957bfd8403aSJohannes Berg struct unsol_bcast_probe_resp_data __rcu *unsol_bcast_probe_resp; 958bfd8403aSJohannes Berg 959bfd8403aSJohannes Berg /* to be used after channel switch. */ 960bfd8403aSJohannes Berg struct cfg80211_beacon_data *next_beacon; 961bfd8403aSJohannes Berg }; 962bfd8403aSJohannes Berg 963bfd8403aSJohannes Berg struct ieee80211_link_data { 964b4f85443SJohannes Berg struct ieee80211_sub_if_data *sdata; 965b4f85443SJohannes Berg unsigned int link_id; 966b4f85443SJohannes Berg 967b4f85443SJohannes Berg struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ 968b4f85443SJohannes Berg struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ 969b4f85443SJohannes Berg 970bfd8403aSJohannes Berg /* multicast keys only */ 971bfd8403aSJohannes Berg struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS + 972bfd8403aSJohannes Berg NUM_DEFAULT_MGMT_KEYS + 973bfd8403aSJohannes Berg NUM_DEFAULT_BEACON_KEYS]; 974bfd8403aSJohannes Berg struct ieee80211_key __rcu *default_multicast_key; 975bfd8403aSJohannes Berg struct ieee80211_key __rcu *default_mgmt_key; 976bfd8403aSJohannes Berg struct ieee80211_key __rcu *default_beacon_key; 977bfd8403aSJohannes Berg 978bfd8403aSJohannes Berg struct work_struct csa_finalize_work; 979bfd8403aSJohannes Berg bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ 98039eac2deSJohannes Berg 98139eac2deSJohannes Berg bool operating_11g_mode; 98239eac2deSJohannes Berg 983bfd8403aSJohannes Berg struct cfg80211_chan_def csa_chandef; 984bfd8403aSJohannes Berg 985bfd8403aSJohannes Berg struct work_struct color_change_finalize_work; 98692881884SLorenzo Bianconi struct delayed_work color_collision_detect_work; 98792881884SLorenzo Bianconi u64 color_bitmap; 988bfd8403aSJohannes Berg 989bfd8403aSJohannes Berg /* context reservation -- protected with chanctx_mtx */ 990bfd8403aSJohannes Berg struct ieee80211_chanctx *reserved_chanctx; 991bfd8403aSJohannes Berg struct cfg80211_chan_def reserved_chandef; 992bfd8403aSJohannes Berg bool reserved_radar_required; 993bfd8403aSJohannes Berg bool reserved_ready; 994bfd8403aSJohannes Berg 995bfd8403aSJohannes Berg u8 needed_rx_chains; 996bfd8403aSJohannes Berg enum ieee80211_smps_mode smps_mode; 997bfd8403aSJohannes Berg 998bfd8403aSJohannes Berg int user_power_level; /* in dBm */ 999bfd8403aSJohannes Berg int ap_power_level; /* in dBm */ 1000bfd8403aSJohannes Berg 1001bfd8403aSJohannes Berg bool radar_required; 1002bfd8403aSJohannes Berg struct delayed_work dfs_cac_timer_work; 1003bfd8403aSJohannes Berg 1004bfd8403aSJohannes Berg union { 1005bfd8403aSJohannes Berg struct ieee80211_link_data_managed mgd; 1006bfd8403aSJohannes Berg struct ieee80211_link_data_ap ap; 1007bfd8403aSJohannes Berg } u; 1008d8675a63SJohannes Berg 1009b3e2130bSJohannes Berg struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS]; 1010b3e2130bSJohannes Berg 1011d8675a63SJohannes Berg struct ieee80211_bss_conf *conf; 1012170cd6a6SBenjamin Berg 1013170cd6a6SBenjamin Berg #ifdef CONFIG_MAC80211_DEBUGFS 1014170cd6a6SBenjamin Berg struct dentry *debugfs_dir; 1015170cd6a6SBenjamin Berg #endif 1016bfd8403aSJohannes Berg }; 1017bfd8403aSJohannes Berg 1018f0706e82SJiri Benc struct ieee80211_sub_if_data { 1019f0706e82SJiri Benc struct list_head list; 1020f0706e82SJiri Benc 1021f0706e82SJiri Benc struct wireless_dev wdev; 1022f0706e82SJiri Benc 102311a843b7SJohannes Berg /* keys */ 102411a843b7SJohannes Berg struct list_head key_list; 102511a843b7SJohannes Berg 10263bff1865SYogesh Ashok Powar /* count for keys needing tailroom space allocation */ 10273bff1865SYogesh Ashok Powar int crypto_tx_tailroom_needed_cnt; 10288d1f7ecdSJohannes Berg int crypto_tx_tailroom_pending_dec; 10298d1f7ecdSJohannes Berg struct delayed_work dec_tailroom_needed_wk; 10303bff1865SYogesh Ashok Powar 1031f0706e82SJiri Benc struct net_device *dev; 1032f0706e82SJiri Benc struct ieee80211_local *local; 1033f0706e82SJiri Benc 103413262ffdSJiri Slaby unsigned int flags; 10357e9ed188SDaniel Drake 103634d4bc4dSJohannes Berg unsigned long state; 103734d4bc4dSJohannes Berg 103847846c9bSJohannes Berg char name[IFNAMSIZ]; 103947846c9bSJohannes Berg 10403a11ce08SJohannes Berg struct ieee80211_fragment_cache frags; 1041f0706e82SJiri Benc 1042b53be792SSimon Wunderlich /* TID bitmap for NoAck policy */ 1043b53be792SSimon Wunderlich u16 noack_map; 1044b53be792SSimon Wunderlich 104500e96decSYoni Divinsky /* bit field of ACM bits (BIT(802.1D tag)) */ 104600e96decSYoni Divinsky u8 wmm_acm; 104700e96decSYoni Divinsky 1048bfd8403aSJohannes Berg struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS]; 104940b275b6SJohannes Berg struct ieee80211_key __rcu *default_unicast_key; 1050f0706e82SJiri Benc 105194778280SJohannes Berg u16 sequence_number; 1052963d0e8dSJohannes Berg u16 mld_mcast_seq; 1053a621fa4dSJohannes Berg __be16 control_port_protocol; 1054a621fa4dSJohannes Berg bool control_port_no_encrypt; 10557f3f96ceSMarkus Theil bool control_port_no_preauth; 1056018f6fbfSDenis Kenzior bool control_port_over_nl80211; 105794778280SJohannes Berg 105880a83cfcSMichal Kazior atomic_t num_tx_queued; 105932db6b54SKyeyoon Park struct mac80211_qos_map __rcu *qos_map; 1060f6f3def3SEliad Peller 106104ecd257SJohannes Berg /* used to reconfigure hardware SM PS */ 106204ecd257SJohannes Berg struct work_struct recalc_smps; 106304ecd257SJohannes Berg 106464592c8fSJohannes Berg struct work_struct work; 106535f20c14SJohannes Berg struct sk_buff_head skb_queue; 1066f5a4c24eSLorenzo Bianconi struct sk_buff_head status_queue; 106735f20c14SJohannes Berg 10683e122be0SJohannes Berg /* 10693e122be0SJohannes Berg * AP this belongs to: self in AP mode and 10703e122be0SJohannes Berg * corresponding AP in VLAN mode, NULL for 10713e122be0SJohannes Berg * all others (might be needed later in IBSS) 10723e122be0SJohannes Berg */ 10733e122be0SJohannes Berg struct ieee80211_if_ap *bss; 10743e122be0SJohannes Berg 107537eb0b16SJouni Malinen /* bitmap of allowed (non-MCS) rate indexes for rate control */ 107657fbcce3SJohannes Berg u32 rc_rateidx_mask[NUM_NL80211_BANDS]; 10772ffbe6d3SFelix Fietkau 107857fbcce3SJohannes Berg bool rc_has_mcs_mask[NUM_NL80211_BANDS]; 107957fbcce3SJohannes Berg u8 rc_rateidx_mcs_mask[NUM_NL80211_BANDS][IEEE80211_HT_MCS_MASK_LEN]; 1080f0706e82SJiri Benc 108157fbcce3SJohannes Berg bool rc_has_vht_mcs_mask[NUM_NL80211_BANDS]; 108257fbcce3SJohannes Berg u16 rc_rateidx_vht_mcs_mask[NUM_NL80211_BANDS][NL80211_VHT_NSS_MAX]; 1083b119ad6eSLorenzo Bianconi 108408fad438SJouni Malinen /* Beacon frame (non-MCS) rate (as a bitmap) */ 108508fad438SJouni Malinen u32 beacon_rateidx_mask[NUM_NL80211_BANDS]; 108608fad438SJouni Malinen bool beacon_rate_set; 108708fad438SJouni Malinen 1088f0706e82SJiri Benc union { 1089f0706e82SJiri Benc struct ieee80211_if_ap ap; 1090f0706e82SJiri Benc struct ieee80211_if_vlan vlan; 109146900298SJohannes Berg struct ieee80211_if_managed mgd; 109246900298SJohannes Berg struct ieee80211_if_ibss ibss; 1093472dbc45SJohannes Berg struct ieee80211_if_mesh mesh; 1094239281f8SRostislav Lisovy struct ieee80211_if_ocb ocb; 1095d8212184SAviya Erenfeld struct ieee80211_if_mntr mntr; 10965953ff6dSAyala Beker struct ieee80211_if_nan nan; 1097f0706e82SJiri Benc } u; 1098e9f207f0SJiri Benc 1099bfd8403aSJohannes Berg struct ieee80211_link_data deflink; 1100d8675a63SJohannes Berg struct ieee80211_link_data __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; 1101bfd8403aSJohannes Berg 11023d901102SJohannes Berg /* for ieee80211_set_active_links_async() */ 11033d901102SJohannes Berg struct work_struct activate_links_work; 11043d901102SJohannes Berg u16 desired_active_links; 11053d901102SJohannes Berg 1106e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 1107e9f207f0SJiri Benc struct { 1108295bafb4SBen Greear struct dentry *subdir_stations; 1109f7e0104cSJohannes Berg struct dentry *default_unicast_key; 1110f7e0104cSJohannes Berg struct dentry *default_multicast_key; 11113cfcf6acSJouni Malinen struct dentry *default_mgmt_key; 1112e5473e80SJouni Malinen struct dentry *default_beacon_key; 11137bcfaf2fSJohannes Berg } debugfs; 1114e9f207f0SJiri Benc #endif 1115529ba6e9SJohannes Berg 111632bfd35dSJohannes Berg /* must be last, dynamically sized area in this! */ 111732bfd35dSJohannes Berg struct ieee80211_vif vif; 1118f0706e82SJiri Benc }; 1119f0706e82SJiri Benc 112032bfd35dSJohannes Berg static inline 112132bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) 112232bfd35dSJohannes Berg { 112332bfd35dSJohannes Berg return container_of(p, struct ieee80211_sub_if_data, vif); 112432bfd35dSJohannes Berg } 112532bfd35dSJohannes Berg 11268d61ffa5SJohannes Berg static inline void sdata_lock(struct ieee80211_sub_if_data *sdata) 11278d61ffa5SJohannes Berg __acquires(&sdata->wdev.mtx) 11288d61ffa5SJohannes Berg { 11298d61ffa5SJohannes Berg mutex_lock(&sdata->wdev.mtx); 11308d61ffa5SJohannes Berg __acquire(&sdata->wdev.mtx); 11318d61ffa5SJohannes Berg } 11328d61ffa5SJohannes Berg 11338d61ffa5SJohannes Berg static inline void sdata_unlock(struct ieee80211_sub_if_data *sdata) 11348d61ffa5SJohannes Berg __releases(&sdata->wdev.mtx) 11358d61ffa5SJohannes Berg { 11368d61ffa5SJohannes Berg mutex_unlock(&sdata->wdev.mtx); 11378d61ffa5SJohannes Berg __release(&sdata->wdev.mtx); 11388d61ffa5SJohannes Berg } 11398d61ffa5SJohannes Berg 11407ca133bcSSimon Wunderlich #define sdata_dereference(p, sdata) \ 11417ca133bcSSimon Wunderlich rcu_dereference_protected(p, lockdep_is_held(&sdata->wdev.mtx)) 11427ca133bcSSimon Wunderlich 11438d61ffa5SJohannes Berg static inline void 11448d61ffa5SJohannes Berg sdata_assert_lock(struct ieee80211_sub_if_data *sdata) 11458d61ffa5SJohannes Berg { 11468d61ffa5SJohannes Berg lockdep_assert_held(&sdata->wdev.mtx); 11478d61ffa5SJohannes Berg } 11488d61ffa5SJohannes Berg 1149438b61b7SSimon Wunderlich static inline int 11503dc05935SJohannes Berg ieee80211_chanwidth_get_shift(enum nl80211_chan_width width) 1151438b61b7SSimon Wunderlich { 11523dc05935SJohannes Berg switch (width) { 1153438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 1154438b61b7SSimon Wunderlich return 2; 1155438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 1156438b61b7SSimon Wunderlich return 1; 1157438b61b7SSimon Wunderlich default: 1158438b61b7SSimon Wunderlich return 0; 1159438b61b7SSimon Wunderlich } 1160438b61b7SSimon Wunderlich } 1161438b61b7SSimon Wunderlich 1162438b61b7SSimon Wunderlich static inline int 11633dc05935SJohannes Berg ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef) 11643dc05935SJohannes Berg { 11653dc05935SJohannes Berg return ieee80211_chanwidth_get_shift(chandef->width); 11663dc05935SJohannes Berg } 11673dc05935SJohannes Berg 11683dc05935SJohannes Berg static inline int 1169438b61b7SSimon Wunderlich ieee80211_vif_get_shift(struct ieee80211_vif *vif) 1170438b61b7SSimon Wunderlich { 1171438b61b7SSimon Wunderlich struct ieee80211_chanctx_conf *chanctx_conf; 1172438b61b7SSimon Wunderlich int shift = 0; 1173438b61b7SSimon Wunderlich 1174438b61b7SSimon Wunderlich rcu_read_lock(); 1175d0a9123eSJohannes Berg chanctx_conf = rcu_dereference(vif->bss_conf.chanctx_conf); 1176438b61b7SSimon Wunderlich if (chanctx_conf) 1177438b61b7SSimon Wunderlich shift = ieee80211_chandef_get_shift(&chanctx_conf->def); 1178438b61b7SSimon Wunderlich rcu_read_unlock(); 1179438b61b7SSimon Wunderlich 1180438b61b7SSimon Wunderlich return shift; 1181438b61b7SSimon Wunderlich } 1182438b61b7SSimon Wunderlich 11832b3171c6SLorenzo Bianconi static inline int 118468b9bea2SAloka Dixit ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems, 118568b9bea2SAloka Dixit struct cfg80211_rnr_elems *rnr_elems, 118668b9bea2SAloka Dixit u8 i) 11872b3171c6SLorenzo Bianconi { 1188bd54f3c2SAloka Dixit int len = 0; 11892b3171c6SLorenzo Bianconi 1190bd54f3c2SAloka Dixit if (!elems || !elems->cnt || i > elems->cnt) 11912b3171c6SLorenzo Bianconi return 0; 11922b3171c6SLorenzo Bianconi 119368b9bea2SAloka Dixit if (i < elems->cnt) { 119468b9bea2SAloka Dixit len = elems->elem[i].len; 119568b9bea2SAloka Dixit if (rnr_elems) { 119668b9bea2SAloka Dixit len += rnr_elems->elem[i].len; 119768b9bea2SAloka Dixit for (i = elems->cnt; i < rnr_elems->cnt; i++) 119868b9bea2SAloka Dixit len += rnr_elems->elem[i].len; 119968b9bea2SAloka Dixit } 120068b9bea2SAloka Dixit return len; 120168b9bea2SAloka Dixit } 1202bd54f3c2SAloka Dixit 1203bd54f3c2SAloka Dixit /* i == elems->cnt, calculate total length of all MBSSID elements */ 12042b3171c6SLorenzo Bianconi for (i = 0; i < elems->cnt; i++) 12052b3171c6SLorenzo Bianconi len += elems->elem[i].len; 12062b3171c6SLorenzo Bianconi 120768b9bea2SAloka Dixit if (rnr_elems) { 120868b9bea2SAloka Dixit for (i = 0; i < rnr_elems->cnt; i++) 120968b9bea2SAloka Dixit len += rnr_elems->elem[i].len; 121068b9bea2SAloka Dixit } 121168b9bea2SAloka Dixit 12122b3171c6SLorenzo Bianconi return len; 12132b3171c6SLorenzo Bianconi } 12142b3171c6SLorenzo Bianconi 1215f0706e82SJiri Benc enum { 1216f0706e82SJiri Benc IEEE80211_RX_MSG = 1, 1217f0706e82SJiri Benc IEEE80211_TX_STATUS_MSG = 2, 1218f0706e82SJiri Benc }; 1219f0706e82SJiri Benc 1220ce7c9111SKalle Valo enum queue_stop_reason { 1221ce7c9111SKalle Valo IEEE80211_QUEUE_STOP_REASON_DRIVER, 1222520eb820SKalle Valo IEEE80211_QUEUE_STOP_REASON_PS, 122396f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_CSA, 122496f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_AGGREGATION, 122525420604SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SUSPEND, 12268f77f384SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SKB_ADD, 12276c17b77bSSeth Forshee IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL, 1228445ea4e8SJohannes Berg IEEE80211_QUEUE_STOP_REASON_FLUSH, 1229db67d661SArik Nemtsov IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN, 1230b6da911bSLiad Kaufman IEEE80211_QUEUE_STOP_REASON_RESERVE_TID, 1231054c9939SJohannes Berg IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE, 1232cca07b00SLuciano Coelho 1233cca07b00SLuciano Coelho IEEE80211_QUEUE_STOP_REASONS, 1234ce7c9111SKalle Valo }; 1235ce7c9111SKalle Valo 123665a6538aSLuciano Coelho #ifdef CONFIG_MAC80211_LEDS 1237e1e54068SJohannes Berg struct tpt_led_trigger { 1238e1e54068SJohannes Berg char name[32]; 1239e1e54068SJohannes Berg const struct ieee80211_tpt_blink *blink_table; 1240e1e54068SJohannes Berg unsigned int blink_table_len; 1241e1e54068SJohannes Berg struct timer_list timer; 124234f11cd3SKees Cook struct ieee80211_local *local; 1243e1e54068SJohannes Berg unsigned long prev_traffic; 1244e1e54068SJohannes Berg unsigned long tx_bytes, rx_bytes; 124567408c8cSJohannes Berg unsigned int active, want; 124667408c8cSJohannes Berg bool running; 1247e1e54068SJohannes Berg }; 124865a6538aSLuciano Coelho #endif 1249e1e54068SJohannes Berg 1250142b9f50SHelmut Schaa /** 1251142b9f50SHelmut Schaa * mac80211 scan flags - currently active scan mode 1252142b9f50SHelmut Schaa * 1253142b9f50SHelmut Schaa * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as 1254142b9f50SHelmut Schaa * well be on the operating channel 1255142b9f50SHelmut Schaa * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to 1256142b9f50SHelmut Schaa * determine if we are on the operating channel or not 12578a690674SBen Greear * @SCAN_ONCHANNEL_SCANNING: Do a software scan on only the current operating 12588a690674SBen Greear * channel. This should not interrupt normal traffic. 12598789d459SJohannes Berg * @SCAN_COMPLETED: Set for our scan work function when the driver reported 12608789d459SJohannes Berg * that the scan completed. 12618789d459SJohannes Berg * @SCAN_ABORTED: Set for our scan work function when the driver reported 12628789d459SJohannes Berg * a scan complete for an aborted scan. 1263a754055aSEmmanuel Grumbach * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being 1264a754055aSEmmanuel Grumbach * cancelled. 1265b041b7b9SFelix Fietkau * @SCAN_BEACON_WAIT: Set whenever we're passive scanning because of radar/no-IR 1266b041b7b9SFelix Fietkau * and could send a probe request after receiving a beacon. 1267b041b7b9SFelix Fietkau * @SCAN_BEACON_DONE: Beacon received, we can now send a probe request 1268142b9f50SHelmut Schaa */ 1269fbe9c429SHelmut Schaa enum { 1270fbe9c429SHelmut Schaa SCAN_SW_SCANNING, 1271142b9f50SHelmut Schaa SCAN_HW_SCANNING, 12728a690674SBen Greear SCAN_ONCHANNEL_SCANNING, 12738789d459SJohannes Berg SCAN_COMPLETED, 12748789d459SJohannes Berg SCAN_ABORTED, 1275a754055aSEmmanuel Grumbach SCAN_HW_CANCELLED, 1276b041b7b9SFelix Fietkau SCAN_BEACON_WAIT, 1277b041b7b9SFelix Fietkau SCAN_BEACON_DONE, 1278142b9f50SHelmut Schaa }; 1279142b9f50SHelmut Schaa 1280142b9f50SHelmut Schaa /** 1281142b9f50SHelmut Schaa * enum mac80211_scan_state - scan state machine states 1282142b9f50SHelmut Schaa * 1283142b9f50SHelmut Schaa * @SCAN_DECISION: Main entry point to the scan state machine, this state 1284142b9f50SHelmut Schaa * determines if we should keep on scanning or switch back to the 1285142b9f50SHelmut Schaa * operating channel 1286142b9f50SHelmut Schaa * @SCAN_SET_CHANNEL: Set the next channel to be scanned 1287142b9f50SHelmut Schaa * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses 128807ef03eeSJohannes Berg * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to 128907ef03eeSJohannes Berg * send out data 129007ef03eeSJohannes Berg * @SCAN_RESUME: Resume the scan and scan the next channel 1291cd2bb512SSam Leffler * @SCAN_ABORT: Abort the scan and go back to operating channel 1292142b9f50SHelmut Schaa */ 1293142b9f50SHelmut Schaa enum mac80211_scan_state { 1294142b9f50SHelmut Schaa SCAN_DECISION, 1295142b9f50SHelmut Schaa SCAN_SET_CHANNEL, 1296142b9f50SHelmut Schaa SCAN_SEND_PROBE, 129707ef03eeSJohannes Berg SCAN_SUSPEND, 129807ef03eeSJohannes Berg SCAN_RESUME, 1299cd2bb512SSam Leffler SCAN_ABORT, 1300fbe9c429SHelmut Schaa }; 1301fbe9c429SHelmut Schaa 1302e908435eSLorenzo Bianconi DECLARE_STATIC_KEY_FALSE(aql_disable); 1303e908435eSLorenzo Bianconi 1304f0706e82SJiri Benc struct ieee80211_local { 1305f0706e82SJiri Benc /* embed the driver visible part. 1306f0706e82SJiri Benc * don't cast (use the static inlines below), but we keep 1307f0706e82SJiri Benc * it first anyway so they become a no-op */ 1308f0706e82SJiri Benc struct ieee80211_hw hw; 1309f0706e82SJiri Benc 1310fa962b92SMichal Kazior struct fq fq; 13115caa328eSMichal Kazior struct codel_vars *cvars; 13125caa328eSMichal Kazior struct codel_params cparams; 1313fa962b92SMichal Kazior 131418667600SToke Høiland-Jørgensen /* protects active_txqs and txqi->schedule_order */ 1315942741daSFelix Fietkau spinlock_t active_txq_lock[IEEE80211_NUM_ACS]; 1316942741daSFelix Fietkau struct list_head active_txqs[IEEE80211_NUM_ACS]; 1317942741daSFelix Fietkau u16 schedule_round[IEEE80211_NUM_ACS]; 1318942741daSFelix Fietkau 1319007ae9b2SAlexander Wetzel /* serializes ieee80211_handle_wake_tx_queue */ 1320007ae9b2SAlexander Wetzel spinlock_t handle_wake_tx_queue_lock; 1321007ae9b2SAlexander Wetzel 1322b4809e94SToke Høiland-Jørgensen u16 airtime_flags; 1323942741daSFelix Fietkau u32 aql_txq_limit_low[IEEE80211_NUM_ACS]; 1324942741daSFelix Fietkau u32 aql_txq_limit_high[IEEE80211_NUM_ACS]; 13253ace10f5SKan Yan u32 aql_threshold; 13263ace10f5SKan Yan atomic_t aql_total_pending_airtime; 13278e4bac06SFelix Fietkau atomic_t aql_ac_pending_airtime[IEEE80211_NUM_ACS]; 1328b4809e94SToke Høiland-Jørgensen 1329f0706e82SJiri Benc const struct ieee80211_ops *ops; 1330f0706e82SJiri Benc 133142935ecaSLuis R. Rodriguez /* 133242935ecaSLuis R. Rodriguez * private workqueue to mac80211. mac80211 makes this accessible 133342935ecaSLuis R. Rodriguez * via ieee80211_queue_work() 133442935ecaSLuis R. Rodriguez */ 133542935ecaSLuis R. Rodriguez struct workqueue_struct *workqueue; 133642935ecaSLuis R. Rodriguez 1337e4e72fb4SJohannes Berg unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES]; 1338cca07b00SLuciano Coelho int q_stop_reasons[IEEE80211_MAX_QUEUES][IEEE80211_QUEUE_STOP_REASONS]; 133996f5e66eSJohannes Berg /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */ 1340ce7c9111SKalle Valo spinlock_t queue_stop_reason_lock; 134196f5e66eSJohannes Berg 1342f0706e82SJiri Benc int open_count; 13433d30d949SMichael Wu int monitors, cooked_mntrs; 13448cc9a739SMichael Wu /* number of interfaces with corresponding FIF_ flags */ 13457be5086dSJohannes Berg int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll, 13467be5086dSJohannes Berg fif_probe_req; 13476cd536feSJohannes Berg bool probe_req_reg; 1348873b1cf6SJouni Malinen bool rx_mcast_action_reg; 13494150c572SJohannes Berg unsigned int filter_flags; /* FIF_* */ 13503b8d81e0SJohannes Berg 13513ffc2a90SJohannes Berg bool wiphy_ciphers_allocated; 13523ffc2a90SJohannes Berg 1353fe57d9f5SJohannes Berg bool use_chanctx; 1354fe57d9f5SJohannes Berg 13553b8d81e0SJohannes Berg /* protects the aggregated multicast list and filter calls */ 13563b8d81e0SJohannes Berg spinlock_t filter_lock; 13573b8d81e0SJohannes Berg 13583ac64beeSJohannes Berg /* used for uploading changed mc list */ 13593ac64beeSJohannes Berg struct work_struct reconfig_filter; 13603ac64beeSJohannes Berg 13613b8d81e0SJohannes Berg /* aggregated multicast list */ 136222bedad3SJiri Pirko struct netdev_hw_addr_list mc_list; 13633b8d81e0SJohannes Berg 1364d0709a65SJohannes Berg bool tim_in_locked_section; /* see ieee80211_beacon_get() */ 13655bb644a0SJohannes Berg 13665bb644a0SJohannes Berg /* 13675bb644a0SJohannes Berg * suspended is true if we finished all the suspend _and_ we have 13685bb644a0SJohannes Berg * not yet come up from resume. This is to be used by mac80211 13695bb644a0SJohannes Berg * to ensure driver sanity during suspend and mac80211's own 13705bb644a0SJohannes Berg * sanity. It can eventually be used for WoW as well. 13715bb644a0SJohannes Berg */ 13725bb644a0SJohannes Berg bool suspended; 13735bb644a0SJohannes Berg 1374b33fb28cSLoic Poulain /* suspending is true during the whole suspend process */ 1375b33fb28cSLoic Poulain bool suspending; 1376b33fb28cSLoic Poulain 13775bb644a0SJohannes Berg /* 1378ceb99fe0SJohannes Berg * Resuming is true while suspended, but when we're reprogramming the 1379ceb99fe0SJohannes Berg * hardware -- at that time it's allowed to use ieee80211_queue_work() 1380ceb99fe0SJohannes Berg * again even though some other parts of the stack are still suspended 1381ceb99fe0SJohannes Berg * and we still drop received frames to avoid waking the stack. 1382ceb99fe0SJohannes Berg */ 1383ceb99fe0SJohannes Berg bool resuming; 1384ceb99fe0SJohannes Berg 1385ceb99fe0SJohannes Berg /* 13865bb644a0SJohannes Berg * quiescing is true during the suspend process _only_ to 13875bb644a0SJohannes Berg * ease timer cancelling etc. 13885bb644a0SJohannes Berg */ 13895bb644a0SJohannes Berg bool quiescing; 13905bb644a0SJohannes Berg 1391ea77f12fSJohannes Berg /* device is started */ 1392ea77f12fSJohannes Berg bool started; 1393ea77f12fSJohannes Berg 139404800adaSArik Nemtsov /* device is during a HW reconfig */ 139504800adaSArik Nemtsov bool in_reconfig; 139604800adaSArik Nemtsov 1397eecc4800SJohannes Berg /* wowlan is enabled -- don't reconfig on resume */ 1398eecc4800SJohannes Berg bool wowlan; 1399eecc4800SJohannes Berg 1400164eb02dSSimon Wunderlich struct work_struct radar_detected_work; 1401164eb02dSSimon Wunderlich 140204ecd257SJohannes Berg /* number of RX chains the hardware has */ 140304ecd257SJohannes Berg u8 rx_chains; 140404ecd257SJohannes Berg 140509b4a4faSJohannes Berg /* bitmap of which sbands were copied */ 140609b4a4faSJohannes Berg u8 sband_allocated; 140709b4a4faSJohannes Berg 1408b306f453SJohannes Berg int tx_headroom; /* required headroom for hardware/radiotap */ 1409f0706e82SJiri Benc 1410f0706e82SJiri Benc /* Tasklet and skb queue to process calls from IRQ mode. All frames 1411f0706e82SJiri Benc * added to skb_queue will be processed, but frames in 1412f0706e82SJiri Benc * skb_queue_unreliable may be dropped if the total length of these 1413f0706e82SJiri Benc * queues increases over the limit. */ 1414f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128 1415f0706e82SJiri Benc struct tasklet_struct tasklet; 1416f0706e82SJiri Benc struct sk_buff_head skb_queue; 1417f0706e82SJiri Benc struct sk_buff_head skb_queue_unreliable; 1418f0706e82SJiri Benc 1419f9e124fbSChristian Lamparter spinlock_t rx_path_lock; 142024a8fdadSChristian Lamparter 1421d0709a65SJohannes Berg /* Station data */ 1422d0709a65SJohannes Berg /* 14234d33960bSJohannes Berg * The mutex only protects the list, hash table and 14244d33960bSJohannes Berg * counter, reads are done with RCU. 1425d0709a65SJohannes Berg */ 142634e89507SJohannes Berg struct mutex sta_mtx; 14274d33960bSJohannes Berg spinlock_t tim_lock; 1428d0709a65SJohannes Berg unsigned long num_sta; 14294d33960bSJohannes Berg struct list_head sta_list; 143083e7e4ceSHerbert Xu struct rhltable sta_hash; 1431ba6ddab9SJohannes Berg struct rhltable link_sta_hash; 1432f0706e82SJiri Benc struct timer_list sta_cleanup; 1433f5ea9120SJohannes Berg int sta_generation; 1434f0706e82SJiri Benc 14352a577d98SJohannes Berg struct sk_buff_head pending[IEEE80211_MAX_QUEUES]; 1436f0706e82SJiri Benc struct tasklet_struct tx_pending_tasklet; 143721a5d4c3SManikanta Pubbisetty struct tasklet_struct wake_txqs_tasklet; 1438f0706e82SJiri Benc 1439a6a67db2SJohannes Berg atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES]; 1440cd8ffc80SJohannes Berg 1441df140465SJohannes Berg /* number of interfaces with allmulti RX */ 1442df140465SJohannes Berg atomic_t iff_allmultis; 1443f0706e82SJiri Benc 1444f0706e82SJiri Benc struct rate_control_ref *rate_ctrl; 1445f0706e82SJiri Benc 14465fdb3735SArd Biesheuvel struct arc4_ctx wep_tx_ctx; 14475fdb3735SArd Biesheuvel struct arc4_ctx wep_rx_ctx; 1448f0706e82SJiri Benc u32 wep_iv; 1449f0706e82SJiri Benc 1450c771c9d8SJohannes Berg /* see iface.c */ 145179010420SJohannes Berg struct list_head interfaces; 1452f64331d5SJohannes Berg struct list_head mon_list; /* only that are IFF_UP && !cooked */ 1453c771c9d8SJohannes Berg struct mutex iflist_mtx; 145479010420SJohannes Berg 1455b16bd15cSJohannes Berg /* 1456ad0e2b5aSJohannes Berg * Key mutex, protects sdata's key_list and sta_info's 145796fc6efbSAlexander Wetzel * key pointers and ptk_idx (write access, they're RCU.) 1458b16bd15cSJohannes Berg */ 1459ad0e2b5aSJohannes Berg struct mutex key_mtx; 1460b16bd15cSJohannes Berg 1461a1699b75SJohannes Berg /* mutex for scan and work locking */ 1462a1699b75SJohannes Berg struct mutex mtx; 1463b16bd15cSJohannes Berg 1464c2b13452SJohannes Berg /* Scanning and BSS list */ 1465fbe9c429SHelmut Schaa unsigned long scanning; 14662a519311SJohannes Berg struct cfg80211_ssid scan_ssid; 14675ba63533SJohannes Berg struct cfg80211_scan_request *int_scan_req; 14686ea0a69cSJohannes Berg struct cfg80211_scan_request __rcu *scan_req; 1469c56ef672SDavid Spinadel struct ieee80211_scan_request *hw_scan_req; 14707ca15a0aSSimon Wunderlich struct cfg80211_chan_def scan_chandef; 147157fbcce3SJohannes Berg enum nl80211_band hw_scan_band; 1472f0706e82SJiri Benc int scan_channel_idx; 1473de95a54bSJohannes Berg int scan_ies_len; 1474c604b9f2SJohannes Berg int hw_scan_ies_bufsize; 14757947d3e0SAvraham Stern struct cfg80211_scan_info scan_info; 14768318d78aSJohannes Berg 147785a9994aSLuciano Coelho struct work_struct sched_scan_stopped_work; 14785260a5b2SJohannes Berg struct ieee80211_sub_if_data __rcu *sched_scan_sdata; 14796ea0a69cSJohannes Berg struct cfg80211_sched_scan_request __rcu *sched_scan_req; 1480a344d677SJohannes Berg u8 scan_addr[ETH_ALEN]; 148179f460caSLuciano Coelho 1482df13cce5SHelmut Schaa unsigned long leave_oper_channel_time; 1483977923b0SHelmut Schaa enum mac80211_scan_state next_scan_state; 1484f0706e82SJiri Benc struct delayed_work scan_work; 1485e2fd5dbcSJohannes Berg struct ieee80211_sub_if_data __rcu *scan_sdata; 148655de908aSJohannes Berg /* For backward compatibility only -- do not use */ 1487675a0b04SKarl Beldan struct cfg80211_chan_def _oper_chandef; 1488f0706e82SJiri Benc 1489b8bc4b0aSJohannes Berg /* Temporary remain-on-channel for off-channel operations */ 1490b8bc4b0aSJohannes Berg struct ieee80211_channel *tmp_channel; 1491b8bc4b0aSJohannes Berg 1492d01a1e65SMichal Kazior /* channel contexts */ 1493d01a1e65SMichal Kazior struct list_head chanctx_list; 1494d01a1e65SMichal Kazior struct mutex chanctx_mtx; 1495d01a1e65SMichal Kazior 1496c206ca67SJohannes Berg #ifdef CONFIG_MAC80211_LEDS 14978d5c2585SJohannes Berg struct led_trigger tx_led, rx_led, assoc_led, radio_led; 14988d5c2585SJohannes Berg struct led_trigger tpt_led; 14998d5c2585SJohannes Berg atomic_t tx_led_active, rx_led_active, assoc_led_active; 15008d5c2585SJohannes Berg atomic_t radio_led_active, tpt_led_active; 1501c206ca67SJohannes Berg struct tpt_led_trigger *tpt_led_trigger; 1502c206ca67SJohannes Berg #endif 1503c206ca67SJohannes Berg 1504c206ca67SJohannes Berg #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 1505f0706e82SJiri Benc /* SNMP counters */ 1506f0706e82SJiri Benc /* dot11CountersTable */ 1507f0706e82SJiri Benc u32 dot11TransmittedFragmentCount; 1508f0706e82SJiri Benc u32 dot11MulticastTransmittedFrameCount; 1509f0706e82SJiri Benc u32 dot11FailedCount; 1510f0706e82SJiri Benc u32 dot11RetryCount; 1511f0706e82SJiri Benc u32 dot11MultipleRetryCount; 1512f0706e82SJiri Benc u32 dot11FrameDuplicateCount; 1513f0706e82SJiri Benc u32 dot11ReceivedFragmentCount; 1514f0706e82SJiri Benc u32 dot11MulticastReceivedFrameCount; 1515f0706e82SJiri Benc u32 dot11TransmittedFrameCount; 1516f0706e82SJiri Benc 1517f0706e82SJiri Benc /* TX/RX handler statistics */ 1518f0706e82SJiri Benc unsigned int tx_handlers_drop; 1519f0706e82SJiri Benc unsigned int tx_handlers_queued; 1520f0706e82SJiri Benc unsigned int tx_handlers_drop_wep; 1521f0706e82SJiri Benc unsigned int tx_handlers_drop_not_assoc; 1522f0706e82SJiri Benc unsigned int tx_handlers_drop_unauth_port; 1523f0706e82SJiri Benc unsigned int rx_handlers_drop; 1524f0706e82SJiri Benc unsigned int rx_handlers_queued; 1525f0706e82SJiri Benc unsigned int rx_handlers_drop_nullfunc; 1526f0706e82SJiri Benc unsigned int rx_handlers_drop_defrag; 1527f0706e82SJiri Benc unsigned int tx_expand_skb_head; 1528f0706e82SJiri Benc unsigned int tx_expand_skb_head_cloned; 1529f1160434SJohannes Berg unsigned int rx_expand_skb_head_defrag; 1530f0706e82SJiri Benc unsigned int rx_handlers_fragments; 1531f0706e82SJiri Benc unsigned int tx_status_drop; 1532f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++ 1533f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */ 1534f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0) 1535f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ 1536f0706e82SJiri Benc 1537f0706e82SJiri Benc 1538f0706e82SJiri Benc int total_ps_buffered; /* total number of all buffered unicast and 1539f0706e82SJiri Benc * multicast packets for power saving stations 1540f0706e82SJiri Benc */ 1541520eb820SKalle Valo 1542572e0012SKalle Valo bool pspolling; 1543965bedadSJohannes Berg /* 1544965bedadSJohannes Berg * PS can only be enabled when we have exactly one managed 1545965bedadSJohannes Berg * interface (and monitors) in PS, this then points there. 1546965bedadSJohannes Berg */ 1547965bedadSJohannes Berg struct ieee80211_sub_if_data *ps_sdata; 1548520eb820SKalle Valo struct work_struct dynamic_ps_enable_work; 1549520eb820SKalle Valo struct work_struct dynamic_ps_disable_work; 1550520eb820SKalle Valo struct timer_list dynamic_ps_timer; 15512b2c009eSJuuso Oikarinen struct notifier_block ifa_notifier; 1552a65240c1SJohannes Berg struct notifier_block ifa6_notifier; 1553f0706e82SJiri Benc 1554ff616381SJuuso Oikarinen /* 1555ff616381SJuuso Oikarinen * The dynamic ps timeout configured from user space via WEXT - 1556ff616381SJuuso Oikarinen * this will override whatever chosen by mac80211 internally. 1557ff616381SJuuso Oikarinen */ 1558ff616381SJuuso Oikarinen int dynamic_ps_forced_timeout; 1559ff616381SJuuso Oikarinen 15601ea6f9c0SJohannes Berg int user_power_level; /* in dBm, for all interfaces */ 15612bf30fabSJohannes Berg 15620f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode; 15630f78231bSJohannes Berg 1564f2753ddbSJohannes Berg struct work_struct restart_work; 1565f2753ddbSJohannes Berg 1566e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 1567e9f207f0SJiri Benc struct local_debugfsdentries { 15684b7679a5SJohannes Berg struct dentry *rcdir; 1569e9f207f0SJiri Benc struct dentry *keys; 1570e9f207f0SJiri Benc } debugfs; 1571276d9e82SJulius Niedworok bool force_tx_status; 1572e9f207f0SJiri Benc #endif 15734e6cbfd0SJohn W. Linville 15742eb278e0SJohannes Berg /* 15752eb278e0SJohannes Berg * Remain-on-channel support 15762eb278e0SJohannes Berg */ 1577aaa016ccSJohannes Berg struct delayed_work roc_work; 15782eb278e0SJohannes Berg struct list_head roc_list; 157921f83589SJohannes Berg struct work_struct hw_roc_start, hw_roc_done; 15802eb278e0SJohannes Berg unsigned long hw_roc_start_time; 158150febf6aSJohannes Berg u64 roc_cookie_counter; 158221f83589SJohannes Berg 1583a729cff8SJohannes Berg struct idr ack_status_frames; 1584a729cff8SJohannes Berg spinlock_t ack_status_lock; 1585a729cff8SJohannes Berg 1586f142c6b9SJohannes Berg struct ieee80211_sub_if_data __rcu *p2p_sdata; 1587f142c6b9SJohannes Berg 15884b6f1dd6SJohannes Berg /* virtual monitor interface */ 15894b6f1dd6SJohannes Berg struct ieee80211_sub_if_data __rcu *monitor_sdata; 15904bf88530SJohannes Berg struct cfg80211_chan_def monitor_chandef; 1591e9a21949SLuciano Coelho 1592e9a21949SLuciano Coelho /* extended capabilities provided by mac80211 */ 1593e9a21949SLuciano Coelho u8 ext_capa[8]; 1594f0706e82SJiri Benc }; 1595f0706e82SJiri Benc 15963e122be0SJohannes Berg static inline struct ieee80211_sub_if_data * 1597d787a3e3SFelix Fietkau IEEE80211_DEV_TO_SUB_IF(const struct net_device *dev) 15983e122be0SJohannes Berg { 15993e122be0SJohannes Berg return netdev_priv(dev); 16003e122be0SJohannes Berg } 16013e122be0SJohannes Berg 160271bbc994SJohannes Berg static inline struct ieee80211_sub_if_data * 160371bbc994SJohannes Berg IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev) 160471bbc994SJohannes Berg { 160571bbc994SJohannes Berg return container_of(wdev, struct ieee80211_sub_if_data, wdev); 160671bbc994SJohannes Berg } 160771bbc994SJohannes Berg 160821a8e9ddSMohammed Shafi Shajakhan static inline struct ieee80211_supported_band * 160921a8e9ddSMohammed Shafi Shajakhan ieee80211_get_sband(struct ieee80211_sub_if_data *sdata) 161021a8e9ddSMohammed Shafi Shajakhan { 161121a8e9ddSMohammed Shafi Shajakhan struct ieee80211_local *local = sdata->local; 161221a8e9ddSMohammed Shafi Shajakhan struct ieee80211_chanctx_conf *chanctx_conf; 161321a8e9ddSMohammed Shafi Shajakhan enum nl80211_band band; 161421a8e9ddSMohammed Shafi Shajakhan 16151dd0f31cSJohannes Berg WARN_ON(sdata->vif.valid_links); 16161dd0f31cSJohannes Berg 161721a8e9ddSMohammed Shafi Shajakhan rcu_read_lock(); 1618d0a9123eSJohannes Berg chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf); 161921a8e9ddSMohammed Shafi Shajakhan 16200ee4d555SJohannes Berg if (!chanctx_conf) { 162121a8e9ddSMohammed Shafi Shajakhan rcu_read_unlock(); 162221a8e9ddSMohammed Shafi Shajakhan return NULL; 162321a8e9ddSMohammed Shafi Shajakhan } 162421a8e9ddSMohammed Shafi Shajakhan 162521a8e9ddSMohammed Shafi Shajakhan band = chanctx_conf->def.chan->band; 162621a8e9ddSMohammed Shafi Shajakhan rcu_read_unlock(); 162721a8e9ddSMohammed Shafi Shajakhan 162821a8e9ddSMohammed Shafi Shajakhan return local->hw.wiphy->bands[band]; 162921a8e9ddSMohammed Shafi Shajakhan } 163021a8e9ddSMohammed Shafi Shajakhan 1631f91cb507SShaul Triebitz static inline struct ieee80211_supported_band * 1632d8675a63SJohannes Berg ieee80211_get_link_sband(struct ieee80211_link_data *link) 1633f91cb507SShaul Triebitz { 1634d8675a63SJohannes Berg struct ieee80211_local *local = link->sdata->local; 1635f91cb507SShaul Triebitz struct ieee80211_chanctx_conf *chanctx_conf; 1636f91cb507SShaul Triebitz enum nl80211_band band; 1637f91cb507SShaul Triebitz 1638f91cb507SShaul Triebitz rcu_read_lock(); 1639d8675a63SJohannes Berg chanctx_conf = rcu_dereference(link->conf->chanctx_conf); 1640f91cb507SShaul Triebitz if (!chanctx_conf) { 1641f91cb507SShaul Triebitz rcu_read_unlock(); 1642f91cb507SShaul Triebitz return NULL; 1643f91cb507SShaul Triebitz } 1644f91cb507SShaul Triebitz 1645f91cb507SShaul Triebitz band = chanctx_conf->def.chan->band; 1646f91cb507SShaul Triebitz rcu_read_unlock(); 1647f91cb507SShaul Triebitz 1648f91cb507SShaul Triebitz return local->hw.wiphy->bands[band]; 1649f91cb507SShaul Triebitz } 1650f91cb507SShaul Triebitz 1651c0f17eb9SChun-Yeow Yeoh /* this struct holds the value parsing from channel switch IE */ 1652c0f17eb9SChun-Yeow Yeoh struct ieee80211_csa_ie { 1653c0f17eb9SChun-Yeow Yeoh struct cfg80211_chan_def chandef; 1654c0f17eb9SChun-Yeow Yeoh u8 mode; 1655c0f17eb9SChun-Yeow Yeoh u8 count; 1656c0f17eb9SChun-Yeow Yeoh u8 ttl; 16573f718fd8SChun-Yeow Yeoh u16 pre_value; 16585d55371bSBenjamin Berg u16 reason_code; 1659ee145775SSara Sharon u32 max_switch_time; 1660c0f17eb9SChun-Yeow Yeoh }; 1661c0f17eb9SChun-Yeow Yeoh 1662dd76986bSJohannes Berg /* Parsed Information Elements */ 1663dd76986bSJohannes Berg struct ieee802_11_elems { 16644a3cb702SJohannes Berg const u8 *ie_start; 1665dd76986bSJohannes Berg size_t total_len; 1666c6e37ed4SJohannes Berg u32 crc; 1667dd76986bSJohannes Berg 1668dd76986bSJohannes Berg /* pointers to IEs */ 166953837584SArik Nemtsov const struct ieee80211_tdls_lnkie *lnk_id; 167053837584SArik Nemtsov const struct ieee80211_ch_switch_timing *ch_sw_timing; 16719041c1faSArik Nemtsov const u8 *ext_capab; 16724a3cb702SJohannes Berg const u8 *ssid; 16734a3cb702SJohannes Berg const u8 *supp_rates; 16744a3cb702SJohannes Berg const u8 *ds_params; 16754a3cb702SJohannes Berg const struct ieee80211_tim_ie *tim; 16764a3cb702SJohannes Berg const u8 *rsn; 1677c0058df7SShaul Triebitz const u8 *rsnx; 16784a3cb702SJohannes Berg const u8 *erp_info; 16794a3cb702SJohannes Berg const u8 *ext_supp_rates; 16804a3cb702SJohannes Berg const u8 *wmm_info; 16814a3cb702SJohannes Berg const u8 *wmm_param; 16824a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_elem; 16834a3cb702SJohannes Berg const struct ieee80211_ht_operation *ht_operation; 16844a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_elem; 16854a3cb702SJohannes Berg const struct ieee80211_vht_operation *vht_operation; 16864a3cb702SJohannes Berg const struct ieee80211_meshconf_ie *mesh_config; 168741cbb0f5SLuca Coelho const u8 *he_cap; 168841cbb0f5SLuca Coelho const struct ieee80211_he_operation *he_operation; 1689ef11a931SJohn Crispin const struct ieee80211_he_spr *he_spr; 169041cbb0f5SLuca Coelho const struct ieee80211_mu_edca_param_set *mu_edca_param_set; 1691a6cf28e0SRajkumar Manoharan const struct ieee80211_he_6ghz_capa *he_6ghz_capa; 1692b0345850SWen Gong const struct ieee80211_tx_pwr_env *tx_pwr_env[IEEE80211_TPE_MAX_IE_COUNT]; 169341cbb0f5SLuca Coelho const u8 *uora_element; 16944a3cb702SJohannes Berg const u8 *mesh_id; 16954a3cb702SJohannes Berg const u8 *peering; 16964a3cb702SJohannes Berg const __le16 *awake_window; 16974a3cb702SJohannes Berg const u8 *preq; 16984a3cb702SJohannes Berg const u8 *prep; 16994a3cb702SJohannes Berg const u8 *perr; 17004a3cb702SJohannes Berg const struct ieee80211_rann_ie *rann; 17014a3cb702SJohannes Berg const struct ieee80211_channel_sw_ie *ch_switch_ie; 1702b4f286a1SJohannes Berg const struct ieee80211_ext_chansw_ie *ext_chansw_ie; 1703b2e506bfSJohannes Berg const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie; 1704ee145775SSara Sharon const u8 *max_channel_switch_time; 17054a3cb702SJohannes Berg const u8 *country_elem; 17064a3cb702SJohannes Berg const u8 *pwr_constr_elem; 1707c8d65917SSteinar H. Gunderson const u8 *cisco_dtpc_elem; 170879ba1d89SJohannes Berg const struct ieee80211_timeout_interval_ie *timeout_int; 17094a3cb702SJohannes Berg const u8 *opmode_notif; 171085220d71SJohannes Berg const struct ieee80211_sec_chan_offs_ie *sec_chan_offs; 1711c4de37eeSPeter Oh struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie; 1712e38a017bSAvraham Stern const struct ieee80211_bss_max_idle_period_ie *max_idle_period_ie; 171378ac51f8SSara Sharon const struct ieee80211_multiple_bssid_configuration *mbssid_config_ie; 171478ac51f8SSara Sharon const struct ieee80211_bssid_index *bssid_index; 171578ac51f8SSara Sharon u8 max_bssid_indicator; 171678ac51f8SSara Sharon u8 dtim_count; 171778ac51f8SSara Sharon u8 dtim_period; 17182aa485e1SJohn Crispin const struct ieee80211_addba_ext_ie *addba_ext_ie; 1719cd418ba6SThomas Pedersen const struct ieee80211_s1g_cap *s1g_capab; 1720cd418ba6SThomas Pedersen const struct ieee80211_s1g_oper_ie *s1g_oper; 1721cd418ba6SThomas Pedersen const struct ieee80211_s1g_bcn_compat_ie *s1g_bcn_compat; 17221d00ce80SThomas Pedersen const struct ieee80211_aid_response_ie *aid_resp; 1723f0e6bea8SIlan Peer const struct ieee80211_eht_cap_elem *eht_cap; 1724f0e6bea8SIlan Peer const struct ieee80211_eht_operation *eht_operation; 1725425f4b5fSJohannes Berg const struct ieee80211_multi_link_elem *multi_link; 1726dd76986bSJohannes Berg 1727dd76986bSJohannes Berg /* length of them, respectively */ 17289041c1faSArik Nemtsov u8 ext_capab_len; 1729dd76986bSJohannes Berg u8 ssid_len; 1730dd76986bSJohannes Berg u8 supp_rates_len; 1731dd76986bSJohannes Berg u8 tim_len; 1732dd76986bSJohannes Berg u8 rsn_len; 1733c0058df7SShaul Triebitz u8 rsnx_len; 1734dd76986bSJohannes Berg u8 ext_supp_rates_len; 1735dd76986bSJohannes Berg u8 wmm_info_len; 1736dd76986bSJohannes Berg u8 wmm_param_len; 173741cbb0f5SLuca Coelho u8 he_cap_len; 1738dd76986bSJohannes Berg u8 mesh_id_len; 1739dd76986bSJohannes Berg u8 peering_len; 1740dd76986bSJohannes Berg u8 preq_len; 1741dd76986bSJohannes Berg u8 prep_len; 1742dd76986bSJohannes Berg u8 perr_len; 1743dd76986bSJohannes Berg u8 country_elem_len; 174478ac51f8SSara Sharon u8 bssid_index_len; 1745b0345850SWen Gong u8 tx_pwr_env_len[IEEE80211_TPE_MAX_IE_COUNT]; 1746b0345850SWen Gong u8 tx_pwr_env_num; 1747f0e6bea8SIlan Peer u8 eht_cap_len; 1748fcff4f10SPaul Stewart 174945ebac4fSIlan Peer /* mult-link element can be de-fragmented and thus u8 is not sufficient */ 175045ebac4fSIlan Peer size_t multi_link_len; 175145ebac4fSIlan Peer 175245ebac4fSIlan Peer /* 175345ebac4fSIlan Peer * store the per station profile pointer and length in case that the 175445ebac4fSIlan Peer * parsing also handled Multi-Link element parsing for a specific link 175545ebac4fSIlan Peer * ID. 175645ebac4fSIlan Peer */ 175745ebac4fSIlan Peer struct ieee80211_mle_per_sta_profile *prof; 175845ebac4fSIlan Peer size_t sta_prof_len; 175945ebac4fSIlan Peer 1760fcff4f10SPaul Stewart /* whether a parse error occurred while retrieving these elements */ 1761fcff4f10SPaul Stewart bool parse_error; 176245ebac4fSIlan Peer 176345ebac4fSIlan Peer /* 176445ebac4fSIlan Peer * scratch buffer that can be used for various element parsing related 176545ebac4fSIlan Peer * tasks, e.g., element de-fragmentation etc. 176645ebac4fSIlan Peer */ 176745ebac4fSIlan Peer size_t scratch_len; 176845ebac4fSIlan Peer u8 *scratch_pos; 176945ebac4fSIlan Peer u8 scratch[]; 1770dd76986bSJohannes Berg }; 1771dd76986bSJohannes Berg 1772f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local( 1773f0706e82SJiri Benc struct ieee80211_hw *hw) 1774f0706e82SJiri Benc { 1775f0706e82SJiri Benc return container_of(hw, struct ieee80211_local, hw); 1776f0706e82SJiri Benc } 1777f0706e82SJiri Benc 1778ba8c3d6fSFelix Fietkau static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq) 1779ba8c3d6fSFelix Fietkau { 1780ba8c3d6fSFelix Fietkau return container_of(txq, struct txq_info, txq); 1781ba8c3d6fSFelix Fietkau } 1782f0706e82SJiri Benc 1783bb42f2d1SToke Høiland-Jørgensen static inline bool txq_has_queue(struct ieee80211_txq *txq) 1784bb42f2d1SToke Høiland-Jørgensen { 1785bb42f2d1SToke Høiland-Jørgensen struct txq_info *txqi = to_txq_info(txq); 1786bb42f2d1SToke Høiland-Jørgensen 1787bb42f2d1SToke Høiland-Jørgensen return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets); 1788bb42f2d1SToke Høiland-Jørgensen } 1789bb42f2d1SToke Høiland-Jørgensen 1790f4bda337SThomas Pedersen static inline bool 1791f4bda337SThomas Pedersen ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) 1792f4bda337SThomas Pedersen { 1793f4bda337SThomas Pedersen WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START && 1794f4bda337SThomas Pedersen status->flag & RX_FLAG_MACTIME_END); 1795da388233SAvraham Stern return !!(status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END | 1796da388233SAvraham Stern RX_FLAG_MACTIME_PLCP_START)); 1797f4bda337SThomas Pedersen } 1798571ecf67SJohannes Berg 179972f15d53SMichael Braun void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata); 180072f15d53SMichael Braun void ieee80211_vif_dec_num_mcast(struct ieee80211_sub_if_data *sdata); 180172f15d53SMichael Braun 180272f15d53SMichael Braun /* This function returns the number of multicast stations connected to this 180372f15d53SMichael Braun * interface. It returns -1 if that number is not tracked, that is for netdevs 180472f15d53SMichael Braun * not in AP or AP_VLAN mode or when using 4addr. 180572f15d53SMichael Braun */ 180672f15d53SMichael Braun static inline int 180772f15d53SMichael Braun ieee80211_vif_get_num_mcast_if(struct ieee80211_sub_if_data *sdata) 180872f15d53SMichael Braun { 180972f15d53SMichael Braun if (sdata->vif.type == NL80211_IFTYPE_AP) 181072f15d53SMichael Braun return atomic_read(&sdata->u.ap.num_mcast_sta); 181172f15d53SMichael Braun if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta) 181272f15d53SMichael Braun return atomic_read(&sdata->u.vlan.num_mcast_sta); 181372f15d53SMichael Braun return -1; 181472f15d53SMichael Braun } 181572f15d53SMichael Braun 1816f4bda337SThomas Pedersen u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, 1817f4bda337SThomas Pedersen struct ieee80211_rx_status *status, 1818f4bda337SThomas Pedersen unsigned int mpdu_len, 1819f4bda337SThomas Pedersen unsigned int mpdu_offset); 1820e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); 18215cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); 18229c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 18237b7090b4SJohannes Berg u64 changed); 18247b7090b4SJohannes Berg void ieee80211_vif_cfg_change_notify(struct ieee80211_sub_if_data *sdata, 18257b7090b4SJohannes Berg u64 changed); 18267b7090b4SJohannes Berg void ieee80211_link_info_change_notify(struct ieee80211_sub_if_data *sdata, 1827d8675a63SJohannes Berg struct ieee80211_link_data *link, 1828d8675a63SJohannes Berg u64 changed); 18290d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local); 183046900298SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 1831f0706e82SJiri Benc 1832a2fcfccbSJohannes Berg u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local); 18335ee00dbdSJohannes Berg int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb, 18345ee00dbdSJohannes Berg u64 *cookie, gfp_t gfp); 1835a2fcfccbSJohannes Berg 183649ddf8e6SJohannes Berg void ieee80211_check_fast_rx(struct sta_info *sta); 183749ddf8e6SJohannes Berg void __ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata); 183849ddf8e6SJohannes Berg void ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata); 183949ddf8e6SJohannes Berg void ieee80211_clear_fast_rx(struct sta_info *sta); 184049ddf8e6SJohannes Berg 18410d5891e3SAndrei Otcheretianski bool ieee80211_is_our_addr(struct ieee80211_sub_if_data *sdata, 18420d5891e3SAndrei Otcheretianski const u8 *addr, int *out_link_id); 18430d5891e3SAndrei Otcheretianski 184446900298SJohannes Berg /* STA code */ 18459c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); 184677fdaa12SJohannes Berg int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, 184777fdaa12SJohannes Berg struct cfg80211_auth_request *req); 184877fdaa12SJohannes Berg int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, 184977fdaa12SJohannes Berg struct cfg80211_assoc_request *req); 185077fdaa12SJohannes Berg int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, 185163c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 185277fdaa12SJohannes Berg int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, 185363c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 1854572e0012SKalle Valo void ieee80211_send_pspoll(struct ieee80211_local *local, 1855572e0012SKalle Valo struct ieee80211_sub_if_data *sdata); 18564a733ef1SJohannes Berg void ieee80211_recalc_ps(struct ieee80211_local *local); 1857ab095877SEliad Peller void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata); 18582b2c009eSJuuso Oikarinen int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); 18591fa57d01SJohannes Berg void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); 18601fa57d01SJohannes Berg void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 18611fa57d01SJohannes Berg struct sk_buff *skb); 186209a740ceSThomas Pedersen void ieee80211_sta_rx_queued_ext(struct ieee80211_sub_if_data *sdata, 186309a740ceSThomas Pedersen struct sk_buff *skb); 1864d3a910a8SLuis R. Rodriguez void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); 1865be099e82SLuis R. Rodriguez void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); 1866afa762f6SEliad Peller void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata); 18671672c0e3SJohannes Berg void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata, 18681672c0e3SJohannes Berg __le16 fc, bool acked); 18691a1cb744SJohannes Berg void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata); 1870b8360ab8SJohannes Berg void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata); 187102219b3aSJohannes Berg void ieee80211_sta_handle_tspec_ac_params(struct ieee80211_sub_if_data *sdata); 18727dd231ebSNaftali Goldstein void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata, 187353da4c45SJohannes Berg u8 reason, bool tx); 1874b2e8434fSJohannes Berg void ieee80211_mgd_setup_link(struct ieee80211_link_data *link); 1875b2e8434fSJohannes Berg void ieee80211_mgd_stop_link(struct ieee80211_link_data *link); 18767e415d0cSJohannes Berg void ieee80211_mgd_set_link_qos_params(struct ieee80211_link_data *link); 18779c6bd790SJohannes Berg 187846900298SJohannes Berg /* IBSS code */ 187946900298SJohannes Berg void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); 188046900298SJohannes Berg void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata); 18818bf11d8dSJohannes Berg void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, 18828bf11d8dSJohannes Berg const u8 *bssid, const u8 *addr, u32 supp_rates); 1883af8cdcd8SJohannes Berg int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, 1884af8cdcd8SJohannes Berg struct cfg80211_ibss_params *params); 1885af8cdcd8SJohannes Berg int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata); 18861fa57d01SJohannes Berg void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata); 18871fa57d01SJohannes Berg void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 18881fa57d01SJohannes Berg struct sk_buff *skb); 1889cd7760e6SSimon Wunderlich int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata, 1890cd7760e6SSimon Wunderlich struct cfg80211_csa_settings *csa_settings); 1891cd7760e6SSimon Wunderlich int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata); 1892cd7760e6SSimon Wunderlich void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata); 18931fa57d01SJohannes Berg 1894239281f8SRostislav Lisovy /* OCB code */ 1895239281f8SRostislav Lisovy void ieee80211_ocb_work(struct ieee80211_sub_if_data *sdata); 1896239281f8SRostislav Lisovy void ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data *sdata, 1897239281f8SRostislav Lisovy const u8 *bssid, const u8 *addr, u32 supp_rates); 1898239281f8SRostislav Lisovy void ieee80211_ocb_setup_sdata(struct ieee80211_sub_if_data *sdata); 1899239281f8SRostislav Lisovy int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata, 1900239281f8SRostislav Lisovy struct ocb_setup *setup); 1901239281f8SRostislav Lisovy int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata); 1902239281f8SRostislav Lisovy 19031fa57d01SJohannes Berg /* mesh code */ 19041fa57d01SJohannes Berg void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata); 19051fa57d01SJohannes Berg void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 19061fa57d01SJohannes Berg struct sk_buff *skb); 1907b8456a14SChun-Yeow Yeoh int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata, 190866e01cf9SLuciano Coelho struct cfg80211_csa_settings *csa_settings); 1909b8456a14SChun-Yeow Yeoh int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata); 191046900298SJohannes Berg 19119c6bd790SJohannes Berg /* scan/BSS handling */ 191246900298SJohannes Berg void ieee80211_scan_work(struct work_struct *work); 191334bcf715SStanislaw Gruszka int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, 1914be4a4b6aSJohannes Berg const u8 *ssid, u8 ssid_len, 191576bed0f4SJanusz.Dziedzic@tieto.com struct ieee80211_channel **channels, 191676bed0f4SJanusz.Dziedzic@tieto.com unsigned int n_channels, 19177ca15a0aSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 1918c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, 19192a519311SJohannes Berg struct cfg80211_scan_request *req); 19205bb644a0SJohannes Berg void ieee80211_scan_cancel(struct ieee80211_local *local); 1921133d40f9SStanislaw Gruszka void ieee80211_run_deferred_scan(struct ieee80211_local *local); 1922d48b2968SJohannes Berg void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb); 19239c6bd790SJohannes Berg 19240a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); 1925c2b13452SJohannes Berg struct ieee80211_bss * 192698c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local, 192798c8fccfSJohannes Berg struct ieee80211_rx_status *rx_status, 192898c8fccfSJohannes Berg struct ieee80211_mgmt *mgmt, 192998c8fccfSJohannes Berg size_t len, 1930d45c4172SEmmanuel Grumbach struct ieee80211_channel *channel); 193198c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local, 1932c2b13452SJohannes Berg struct ieee80211_bss *bss); 1933ee385855SLuis Carlos Cobo 193479f460caSLuciano Coelho /* scheduled scan handling */ 1935d43c6b6eSDavid Spinadel int 1936d43c6b6eSDavid Spinadel __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, 1937d43c6b6eSDavid Spinadel struct cfg80211_sched_scan_request *req); 193879f460caSLuciano Coelho int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, 193979f460caSLuciano Coelho struct cfg80211_sched_scan_request *req); 19400d440ea2SEliad Peller int ieee80211_request_sched_scan_stop(struct ieee80211_local *local); 1941f6837ba8SJohannes Berg void ieee80211_sched_scan_end(struct ieee80211_local *local); 194285a9994aSLuciano Coelho void ieee80211_sched_scan_stopped_work(struct work_struct *work); 194379f460caSLuciano Coelho 1944a2fcfccbSJohannes Berg /* off-channel/mgmt-tx */ 1945aacde9eeSStanislaw Gruszka void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local); 1946aacde9eeSStanislaw Gruszka void ieee80211_offchannel_return(struct ieee80211_local *local); 19472eb278e0SJohannes Berg void ieee80211_roc_setup(struct ieee80211_local *local); 19482eb278e0SJohannes Berg void ieee80211_start_next_roc(struct ieee80211_local *local); 1949c8f994eeSJohannes Berg void ieee80211_roc_purge(struct ieee80211_local *local, 1950c8f994eeSJohannes Berg struct ieee80211_sub_if_data *sdata); 1951a2fcfccbSJohannes Berg int ieee80211_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, 1952a2fcfccbSJohannes Berg struct ieee80211_channel *chan, 1953a2fcfccbSJohannes Berg unsigned int duration, u64 *cookie); 1954a2fcfccbSJohannes Berg int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy, 1955a2fcfccbSJohannes Berg struct wireless_dev *wdev, u64 cookie); 1956a2fcfccbSJohannes Berg int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, 1957a2fcfccbSJohannes Berg struct cfg80211_mgmt_tx_params *params, u64 *cookie); 1958a2fcfccbSJohannes Berg int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, 1959a2fcfccbSJohannes Berg struct wireless_dev *wdev, u64 cookie); 1960b203ffc3SJouni Malinen 196173da7d5bSSimon Wunderlich /* channel switch handling */ 196273da7d5bSSimon Wunderlich void ieee80211_csa_finalize_work(struct work_struct *work); 196382a8e17dSLuciano Coelho int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, 196482a8e17dSLuciano Coelho struct cfg80211_csa_settings *params); 196573da7d5bSSimon Wunderlich 19665f9404abSJohn Crispin /* color change handling */ 19675f9404abSJohn Crispin void ieee80211_color_change_finalize_work(struct work_struct *work); 196892881884SLorenzo Bianconi void ieee80211_color_collision_detection_work(struct work_struct *work); 19695f9404abSJohn Crispin 19703e122be0SJohannes Berg /* interface handling */ 197107b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \ 197207b83d2eSJohannes Berg NETIF_F_HW_CSUM | NETIF_F_SG | \ 197361587f15SFelix Fietkau NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE | \ 197461587f15SFelix Fietkau NETIF_F_HW_TC) 197507b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES_RX (NETIF_F_RXCSUM) 197607b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES (MAC80211_SUPPORTED_FEATURES_TX | \ 197707b83d2eSJohannes Berg MAC80211_SUPPORTED_FEATURES_RX) 197807b83d2eSJohannes Berg 197947846c9bSJohannes Berg int ieee80211_iface_init(void); 198047846c9bSJohannes Berg void ieee80211_iface_exit(void); 19813e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name, 19826bab2e19STom Gundersen unsigned char name_assign_type, 198384efbb84SJohannes Berg struct wireless_dev **new_wdev, enum nl80211_iftype type, 1984ee385855SLuis Carlos Cobo struct vif_params *params); 1985f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, 198605c914feSJohannes Berg enum nl80211_iftype type); 1987f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); 198875636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local); 1989382a103bSJohannes Berg u32 ieee80211_idle_off(struct ieee80211_local *local); 19905cff20e6SJohannes Berg void ieee80211_recalc_idle(struct ieee80211_local *local); 199185416a4fSChristian Lamparter void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, 199285416a4fSChristian Lamparter const int offset); 1993f142c6b9SJohannes Berg int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up); 1994f142c6b9SJohannes Berg void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata); 19953c3e21e7SJohannes Berg int ieee80211_add_virtual_monitor(struct ieee80211_local *local); 19963c3e21e7SJohannes Berg void ieee80211_del_virtual_monitor(struct ieee80211_local *local); 1997f0706e82SJiri Benc 19981ea6f9c0SJohannes Berg bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata); 1999db82d8a9SLorenzo Bianconi void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata, 2000db82d8a9SLorenzo Bianconi bool update_bss); 20016aea26ceSFelix Fietkau void ieee80211_recalc_offload(struct ieee80211_local *local); 20021ea6f9c0SJohannes Berg 20039607e6b6SJohannes Berg static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) 20049607e6b6SJohannes Berg { 200534d4bc4dSJohannes Berg return test_bit(SDATA_STATE_RUNNING, &sdata->state); 20069607e6b6SJohannes Berg } 20079607e6b6SJohannes Berg 2008e73b5e51SJohannes Berg /* link handling */ 2009e73b5e51SJohannes Berg void ieee80211_link_setup(struct ieee80211_link_data *link); 2010e73b5e51SJohannes Berg void ieee80211_link_init(struct ieee80211_sub_if_data *sdata, 2011e73b5e51SJohannes Berg int link_id, 2012e73b5e51SJohannes Berg struct ieee80211_link_data *link, 2013e73b5e51SJohannes Berg struct ieee80211_bss_conf *link_conf); 2014e73b5e51SJohannes Berg void ieee80211_link_stop(struct ieee80211_link_data *link); 2015e73b5e51SJohannes Berg int ieee80211_vif_set_links(struct ieee80211_sub_if_data *sdata, 2016e73b5e51SJohannes Berg u16 new_links); 2017e73b5e51SJohannes Berg void ieee80211_vif_clear_links(struct ieee80211_sub_if_data *sdata); 2018e73b5e51SJohannes Berg 2019e2ebc74dSJohannes Berg /* tx handling */ 2020e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local); 2021da1cad73SAllen Pais void ieee80211_tx_pending(struct tasklet_struct *t); 2022d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, 2023d0cf9c0dSStephen Hemminger struct net_device *dev); 2024d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, 2025d0cf9c0dSStephen Hemminger struct net_device *dev); 202650ff477aSJohn Crispin netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb, 202750ff477aSJohn Crispin struct net_device *dev); 202824d342c5SLiad Kaufman void __ieee80211_subif_start_xmit(struct sk_buff *skb, 202924d342c5SLiad Kaufman struct net_device *dev, 203006016772SRajkumar Manoharan u32 info_flags, 2031a7528198SMarkus Theil u32 ctrl_flags, 2032a7528198SMarkus Theil u64 *cookie); 20331f98ab7fSFelix Fietkau void ieee80211_purge_tx_queue(struct ieee80211_hw *hw, 20341f98ab7fSFelix Fietkau struct sk_buff_head *skbs); 20357528ec57SJohannes Berg struct sk_buff * 20367528ec57SJohannes Berg ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata, 20377528ec57SJohannes Berg struct sk_buff *skb, u32 info_flags); 20384dc792b8SHelmut Schaa void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb, 2039b7b2e8caSJohn Crispin int retry_count, int shift, bool send_to_cooked, 2040b7b2e8caSJohn Crispin struct ieee80211_tx_status *status); 2041e2ebc74dSJohannes Berg 204217c18bf8SJohannes Berg void ieee80211_check_fast_xmit(struct sta_info *sta); 204317c18bf8SJohannes Berg void ieee80211_check_fast_xmit_all(struct ieee80211_local *local); 204417c18bf8SJohannes Berg void ieee80211_check_fast_xmit_iface(struct ieee80211_sub_if_data *sdata); 204517c18bf8SJohannes Berg void ieee80211_clear_fast_xmit(struct sta_info *sta); 204691180649SDenis Kenzior int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, 204791180649SDenis Kenzior const u8 *buf, size_t len, 2048dca9ca2dSMarkus Theil const u8 *dest, __be16 proto, bool unencrypted, 204967207babSAndrei Otcheretianski int link_id, u64 *cookie); 20508828f81aSRajkumar Manoharan int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, 20518828f81aSRajkumar Manoharan const u8 *buf, size_t len); 2052d5edb9aeSFelix Fietkau void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, 2053d5edb9aeSFelix Fietkau struct sta_info *sta, 2054d5edb9aeSFelix Fietkau struct ieee80211_fast_tx *fast_tx, 2055d5edb9aeSFelix Fietkau struct sk_buff *skb, bool ampdu, 2056d5edb9aeSFelix Fietkau const u8 *da, const u8 *sa); 20578b0f5cb6SFelix Fietkau void ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, 20588b0f5cb6SFelix Fietkau struct sta_info *sta, struct sk_buff *skb); 205917c18bf8SJohannes Berg 2060de1ede7aSJohannes Berg /* HT */ 2061ef96a842SBen Greear void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, 2062ef96a842SBen Greear struct ieee80211_sta_ht_cap *ht_cap); 2063e1a0c6b3SJohannes Berg bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata, 2064ef96a842SBen Greear struct ieee80211_supported_band *sband, 20654a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_ie, 2066c71420dbSJohannes Berg struct link_sta_info *link_sta); 2067b8695a8fSJohannes Berg void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, 2068b8695a8fSJohannes Berg const u8 *da, u16 tid, 2069b8695a8fSJohannes Berg u16 initiator, u16 reason_code); 20700f78231bSJohannes Berg int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, 20710f78231bSJohannes Berg enum ieee80211_smps_mode smps, const u8 *da, 20720f78231bSJohannes Berg const u8 *bssid); 2073687da132SEmmanuel Grumbach bool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old, 2074687da132SEmmanuel Grumbach enum ieee80211_smps_mode smps_mode_new); 2075de1ede7aSJohannes Berg 20767c3b1dd8SJohannes Berg void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 207753f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 2078849b7967SJohannes Berg void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 207953f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 2080bde59c47SJohannes Berg void ___ieee80211_start_rx_ba_session(struct sta_info *sta, 2081bde59c47SJohannes Berg u8 dialog_token, u16 timeout, 2082bde59c47SJohannes Berg u16 start_seq_num, u16 ba_policy, u16 tid, 20832ab45876SJohn Crispin u16 buf_size, bool tx, bool auto_seq, 20842ab45876SJohn Crispin const struct ieee80211_addba_ext_ie *addbaext); 2085c82c4a80SJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, 2086c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 2087de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, 2088de1ede7aSJohannes Berg struct sta_info *sta, 2089de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, size_t len); 2090de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local, 2091de1ede7aSJohannes Berg struct sta_info *sta, 2092de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 2093de1ede7aSJohannes Berg size_t len); 2094de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local, 2095de1ede7aSJohannes Berg struct sta_info *sta, 2096de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 2097de1ede7aSJohannes Berg size_t len); 2098de1ede7aSJohannes Berg 2099849b7967SJohannes Berg int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 2100c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 210167c282c0SJohannes Berg int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 2102c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 21037a7c0a64SJohannes Berg void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid, 21047a7c0a64SJohannes Berg struct tid_ampdu_tx *tid_tx); 21057a7c0a64SJohannes Berg void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid, 21067a7c0a64SJohannes Berg struct tid_ampdu_tx *tid_tx); 210767c282c0SJohannes Berg void ieee80211_ba_session_work(struct work_struct *work); 210867c282c0SJohannes Berg void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid); 21092bff8ebfSChristian Lamparter void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid); 2110849b7967SJohannes Berg 211104ecd257SJohannes Berg u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs); 211257566b20Stamizhr@codeaurora.org enum nl80211_smps_mode 211357566b20Stamizhr@codeaurora.org ieee80211_smps_mode_to_smps_mode(enum ieee80211_smps_mode smps); 211404ecd257SJohannes Berg 2115818255eaSMahesh Palivela /* VHT */ 21164a3cb702SJohannes Berg void 21174a3cb702SJohannes Berg ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, 2118818255eaSMahesh Palivela struct ieee80211_supported_band *sband, 21194a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_ie, 2120c71420dbSJohannes Berg struct link_sta_info *link_sta); 2121c71420dbSJohannes Berg enum ieee80211_sta_rx_bandwidth 2122c71420dbSJohannes Berg ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta); 2123c71420dbSJohannes Berg enum ieee80211_sta_rx_bandwidth 2124c71420dbSJohannes Berg ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta); 2125c71420dbSJohannes Berg void ieee80211_sta_set_rx_nss(struct link_sta_info *link_sta); 212659021c67SArik Nemtsov enum ieee80211_sta_rx_bandwidth 212759021c67SArik Nemtsov ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width); 2128c71420dbSJohannes Berg enum nl80211_chan_width 2129c71420dbSJohannes Berg ieee80211_sta_cap_chan_bw(struct link_sta_info *link_sta); 213023a1f8d4SSara Sharon void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata, 2131d8675a63SJohannes Berg struct ieee80211_link_data *link, 213223a1f8d4SSara Sharon struct ieee80211_mgmt *mgmt); 2133b1bce14aSMarek Kwaczynski u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, 2134c71420dbSJohannes Berg struct link_sta_info *sta, 2135afe0d181SJohannes Berg u8 opmode, enum nl80211_band band); 21360af83d3dSJohannes Berg void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, 2137c71420dbSJohannes Berg struct link_sta_info *sta, 2138afe0d181SJohannes Berg u8 opmode, enum nl80211_band band); 2139dd5ecfeaSJohannes Berg void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, 2140dd5ecfeaSJohannes Berg struct ieee80211_sta_vht_cap *vht_cap); 2141b119ad6eSLorenzo Bianconi void ieee80211_get_vht_mask_from_cap(__le16 vht_cap, 2142b119ad6eSLorenzo Bianconi u16 vht_mask[NL80211_VHT_NSS_MAX]); 214397f5f425Stamizhr@codeaurora.org enum nl80211_chan_width 2144c71420dbSJohannes Berg ieee80211_sta_rx_bw_to_chan_width(struct link_sta_info *sta); 21454a34215eSJohannes Berg 214641cbb0f5SLuca Coelho /* HE */ 214741cbb0f5SLuca Coelho void 214841cbb0f5SLuca Coelho ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata, 214941cbb0f5SLuca Coelho struct ieee80211_supported_band *sband, 215041cbb0f5SLuca Coelho const u8 *he_cap_ie, u8 he_cap_len, 21511bb9a8a4SJohannes Berg const struct ieee80211_he_6ghz_capa *he_6ghz_capa, 2152c71420dbSJohannes Berg struct link_sta_info *link_sta); 21531ced169cSJohn Crispin void 21541ced169cSJohn Crispin ieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif, 21551ced169cSJohn Crispin const struct ieee80211_he_spr *he_spr_ie_elem); 215641cbb0f5SLuca Coelho 2157697f6c50SJohn Crispin void 2158697f6c50SJohn Crispin ieee80211_he_op_ie_to_bss_conf(struct ieee80211_vif *vif, 2159697f6c50SJohn Crispin const struct ieee80211_he_operation *he_op_ie_elem); 2160697f6c50SJohn Crispin 216112bf8fadSThomas Pedersen /* S1G */ 216212bf8fadSThomas Pedersen void ieee80211_s1g_sta_rate_init(struct sta_info *sta); 2163f5a4c24eSLorenzo Bianconi bool ieee80211_s1g_is_twt_setup(struct sk_buff *skb); 2164f5a4c24eSLorenzo Bianconi void ieee80211_s1g_rx_twt_action(struct ieee80211_sub_if_data *sdata, 2165f5a4c24eSLorenzo Bianconi struct sk_buff *skb); 2166f5a4c24eSLorenzo Bianconi void ieee80211_s1g_status_twt_action(struct ieee80211_sub_if_data *sdata, 2167f5a4c24eSLorenzo Bianconi struct sk_buff *skb); 216812bf8fadSThomas Pedersen 216939192c0bSJohannes Berg /* Spectrum management */ 217039192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, 217139192c0bSJohannes Berg struct ieee80211_mgmt *mgmt, 217239192c0bSJohannes Berg size_t len); 2173e6b7cde4SSimon Wunderlich /** 2174e6b7cde4SSimon Wunderlich * ieee80211_parse_ch_switch_ie - parses channel switch IEs 2175e6b7cde4SSimon Wunderlich * @sdata: the sdata of the interface which has received the frame 2176e6b7cde4SSimon Wunderlich * @elems: parsed 802.11 elements received with the frame 2177e6b7cde4SSimon Wunderlich * @current_band: indicates the current band 21782a333a0dSJohannes Berg * @vht_cap_info: VHT capabilities of the transmitter 2179ba323e29SJohannes Berg * @conn_flags: contains information about own capabilities and restrictions 2180ba323e29SJohannes Berg * to decide which channel switch announcements can be accepted, using 2181ba323e29SJohannes Berg * flags from &enum ieee80211_conn_flags. 2182e6b7cde4SSimon Wunderlich * @bssid: the currently connected bssid (for reporting) 2183c0f17eb9SChun-Yeow Yeoh * @csa_ie: parsed 802.11 csa elements on count, mode, chandef and mesh ttl. 2184c0f17eb9SChun-Yeow Yeoh All of them will be filled with if success only. 2185e6b7cde4SSimon Wunderlich * Return: 0 on success, <0 on error and >0 if there is nothing to parse. 2186e6b7cde4SSimon Wunderlich */ 2187e6b7cde4SSimon Wunderlich int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, 218884469a45SLuciano Coelho struct ieee802_11_elems *elems, 218957fbcce3SJohannes Berg enum nl80211_band current_band, 21902a333a0dSJohannes Berg u32 vht_cap_info, 2191ba323e29SJohannes Berg ieee80211_conn_flags_t conn_flags, u8 *bssid, 2192c0f17eb9SChun-Yeow Yeoh struct ieee80211_csa_ie *csa_ie); 219339192c0bSJohannes Berg 2194f2753ddbSJohannes Berg /* Suspend/resume and hw reconfiguration */ 2195f2753ddbSJohannes Berg int ieee80211_reconfig(struct ieee80211_local *local); 219684f6a01cSJohannes Berg void ieee80211_stop_device(struct ieee80211_local *local); 2197f2753ddbSJohannes Berg 2198eecc4800SJohannes Berg int __ieee80211_suspend(struct ieee80211_hw *hw, 2199eecc4800SJohannes Berg struct cfg80211_wowlan *wowlan); 2200f2753ddbSJohannes Berg 2201f2753ddbSJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw) 2202f2753ddbSJohannes Berg { 220385f72bc8SJohn W. Linville struct ieee80211_local *local = hw_to_local(hw); 220485f72bc8SJohn W. Linville 22059120d94eSLuciano Coelho WARN(test_bit(SCAN_HW_SCANNING, &local->scanning) && 22069120d94eSLuciano Coelho !test_bit(SCAN_COMPLETED, &local->scanning), 220785f72bc8SJohn W. Linville "%s: resume with hardware scan still in progress\n", 220885f72bc8SJohn W. Linville wiphy_name(hw->wiphy)); 220985f72bc8SJohn W. Linville 2210f2753ddbSJohannes Berg return ieee80211_reconfig(hw_to_local(hw)); 2211f2753ddbSJohannes Berg } 2212665af4fcSBob Copeland 2213c2d1560aSJohannes Berg /* utility functions/constants */ 22148a47cea7SJohannes Berg extern const void *const mac80211_wiphy_privid; /* for wiphy privid */ 221557fbcce3SJohannes Berg int ieee80211_frame_duration(enum nl80211_band band, size_t len, 2216438b61b7SSimon Wunderlich int rate, int erp, int short_preamble, 2217438b61b7SSimon Wunderlich int shift); 2218e552af05SHaim Dreyfuss void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata, 2219e552af05SHaim Dreyfuss struct ieee80211_tx_queue_params *qparam, 2220e552af05SHaim Dreyfuss int ac); 2221b3e2130bSJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_link_data *link, 2222cec66283SJohannes Berg bool bss_notify, bool enable_qos); 22237c10770fSJohannes Berg void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, 222408aca29aSMathy Vanhoef struct sta_info *sta, struct sk_buff *skb); 2225cf6bb79aSHelmut Schaa 222655de908aSJohannes Berg void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, 2227e1e68b14SJohannes Berg struct sk_buff *skb, int tid, int link_id, 222808aca29aSMathy Vanhoef enum nl80211_band band); 222955de908aSJohannes Berg 223050ff477aSJohn Crispin /* sta_out needs to be checked for ERR_PTR() before using */ 223150ff477aSJohn Crispin int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, 223250ff477aSJohn Crispin struct sk_buff *skb, 223350ff477aSJohn Crispin struct sta_info **sta_out); 223450ff477aSJohn Crispin 223555de908aSJohannes Berg static inline void 223655de908aSJohannes Berg ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, 223755de908aSJohannes Berg struct sk_buff *skb, int tid, 223808aca29aSMathy Vanhoef enum nl80211_band band) 223955de908aSJohannes Berg { 224055de908aSJohannes Berg rcu_read_lock(); 2241e1e68b14SJohannes Berg __ieee80211_tx_skb_tid_band(sdata, skb, tid, -1, band); 224255de908aSJohannes Berg rcu_read_unlock(); 224355de908aSJohannes Berg } 224455de908aSJohannes Berg 2245eef25a66SJohannes Berg void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata, 2246e1e68b14SJohannes Berg struct sk_buff *skb, int tid, int link_id); 224755de908aSJohannes Berg 224855de908aSJohannes Berg static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, 2249cf6bb79aSHelmut Schaa struct sk_buff *skb) 2250cf6bb79aSHelmut Schaa { 2251cf6bb79aSHelmut Schaa /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */ 2252e1e68b14SJohannes Berg ieee80211_tx_skb_tid(sdata, skb, 7, -1); 2253cf6bb79aSHelmut Schaa } 2254cf6bb79aSHelmut Schaa 2255fd17bf04SJohannes Berg /** 2256fd17bf04SJohannes Berg * struct ieee80211_elems_parse_params - element parsing parameters 2257fd17bf04SJohannes Berg * @start: pointer to the elements 2258fd17bf04SJohannes Berg * @len: length of the elements 2259fd17bf04SJohannes Berg * @action: %true if the elements came from an action frame 2260fd17bf04SJohannes Berg * @filter: bitmap of element IDs to filter out while calculating 2261fd17bf04SJohannes Berg * the element CRC 2262fd17bf04SJohannes Berg * @crc: CRC starting value 226338c6aa29SJohannes Berg * @bss: the BSS to parse this as, for multi-BSSID cases this can 226438c6aa29SJohannes Berg * represent a non-transmitting BSS in which case the data 226538c6aa29SJohannes Berg * for that non-transmitting BSS is returned 2266425f4b5fSJohannes Berg * @link_id: the link ID to parse elements for, if a STA profile 226745ebac4fSIlan Peer * is present in the multi-link element, or -1 to ignore; 226845ebac4fSIlan Peer * note that the code currently assumes parsing an association 226945ebac4fSIlan Peer * (or re-association) response frame if this is given 2270ea5cba26SJohannes Berg * @from_ap: frame is received from an AP (currently used only 2271ea5cba26SJohannes Berg * for EHT capabilities parsing) 227245ebac4fSIlan Peer * @scratch_len: if non zero, specifies the requested length of the scratch 227345ebac4fSIlan Peer * buffer; otherwise, 'len' is used. 2274fd17bf04SJohannes Berg */ 2275fd17bf04SJohannes Berg struct ieee80211_elems_parse_params { 2276fd17bf04SJohannes Berg const u8 *start; 2277fd17bf04SJohannes Berg size_t len; 2278fd17bf04SJohannes Berg bool action; 2279fd17bf04SJohannes Berg u64 filter; 2280fd17bf04SJohannes Berg u32 crc; 228138c6aa29SJohannes Berg struct cfg80211_bss *bss; 2282425f4b5fSJohannes Berg int link_id; 2283ea5cba26SJohannes Berg bool from_ap; 228445ebac4fSIlan Peer size_t scratch_len; 2285fd17bf04SJohannes Berg }; 2286fd17bf04SJohannes Berg 2287fd17bf04SJohannes Berg struct ieee802_11_elems * 2288fd17bf04SJohannes Berg ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params); 2289fd17bf04SJohannes Berg 2290fd17bf04SJohannes Berg static inline struct ieee802_11_elems * 2291fd17bf04SJohannes Berg ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, 22925d24828dSJohannes Berg u64 filter, u32 crc, 229338c6aa29SJohannes Berg struct cfg80211_bss *bss) 2294fd17bf04SJohannes Berg { 2295fd17bf04SJohannes Berg struct ieee80211_elems_parse_params params = { 2296fd17bf04SJohannes Berg .start = start, 2297fd17bf04SJohannes Berg .len = len, 2298fd17bf04SJohannes Berg .action = action, 2299fd17bf04SJohannes Berg .filter = filter, 2300fd17bf04SJohannes Berg .crc = crc, 230138c6aa29SJohannes Berg .bss = bss, 2302425f4b5fSJohannes Berg .link_id = -1, 2303fd17bf04SJohannes Berg }; 2304fd17bf04SJohannes Berg 2305fd17bf04SJohannes Berg return ieee802_11_parse_elems_full(¶ms); 2306fd17bf04SJohannes Berg } 2307fd17bf04SJohannes Berg 23085d24828dSJohannes Berg static inline struct ieee802_11_elems * 23095d24828dSJohannes Berg ieee802_11_parse_elems(const u8 *start, size_t len, bool action, 231038c6aa29SJohannes Berg struct cfg80211_bss *bss) 2311ddc4db2eSJohannes Berg { 231238c6aa29SJohannes Berg return ieee802_11_parse_elems_crc(start, len, action, 0, 0, bss); 2313ddc4db2eSJohannes Berg } 2314ddc4db2eSJohannes Berg 2315*d094482cSBenjamin Berg void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id); 231683eb935eSMichal Kazior 231702219b3aSJohannes Berg extern const int ieee802_1d_to_ac[8]; 231802219b3aSJohannes Berg 231902219b3aSJohannes Berg static inline int ieee80211_ac_from_tid(int tid) 232002219b3aSJohannes Berg { 232102219b3aSJohannes Berg return ieee802_1d_to_ac[tid & 7]; 232202219b3aSJohannes Berg } 232302219b3aSJohannes Berg 2324520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work); 2325520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work); 232634f11cd3SKees Cook void ieee80211_dynamic_ps_timer(struct timer_list *t); 2327a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local, 2328a97b77b9SVivek Natarajan struct ieee80211_sub_if_data *sdata, 2329076cdcb1SJohannes Berg bool powersave); 2330a5d3cbdbSFelix Fietkau void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local, 2331a5d3cbdbSFelix Fietkau struct ieee80211_sub_if_data *sdata); 23324e5ff376SFelix Fietkau void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, 233302219b3aSJohannes Berg struct ieee80211_hdr *hdr, bool ack, u16 tx_time); 2334520eb820SKalle Valo 2335ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, 2336445ea4e8SJohannes Berg unsigned long queues, 2337cca07b00SLuciano Coelho enum queue_stop_reason reason, 2338cca07b00SLuciano Coelho bool refcounted); 233926da23b6SLuciano Coelho void ieee80211_stop_vif_queues(struct ieee80211_local *local, 234026da23b6SLuciano Coelho struct ieee80211_sub_if_data *sdata, 234126da23b6SLuciano Coelho enum queue_stop_reason reason); 234226da23b6SLuciano Coelho void ieee80211_wake_vif_queues(struct ieee80211_local *local, 234326da23b6SLuciano Coelho struct ieee80211_sub_if_data *sdata, 234426da23b6SLuciano Coelho enum queue_stop_reason reason); 2345ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, 2346445ea4e8SJohannes Berg unsigned long queues, 2347cca07b00SLuciano Coelho enum queue_stop_reason reason, 2348cca07b00SLuciano Coelho bool refcounted); 234996f5e66eSJohannes Berg void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, 2350cca07b00SLuciano Coelho enum queue_stop_reason reason, 2351cca07b00SLuciano Coelho bool refcounted); 235296f5e66eSJohannes Berg void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, 2353cca07b00SLuciano Coelho enum queue_stop_reason reason, 2354cca07b00SLuciano Coelho bool refcounted); 23558f77f384SJohannes Berg void ieee80211_add_pending_skb(struct ieee80211_local *local, 23568f77f384SJohannes Berg struct sk_buff *skb); 2357e3685e03SJohannes Berg void ieee80211_add_pending_skbs(struct ieee80211_local *local, 2358e3685e03SJohannes Berg struct sk_buff_head *skbs); 235939ecc01dSJohannes Berg void ieee80211_flush_queues(struct ieee80211_local *local, 23603b24f4c6SEmmanuel Grumbach struct ieee80211_sub_if_data *sdata, bool drop); 23614f9610d5SLiad Kaufman void __ieee80211_flush_queues(struct ieee80211_local *local, 23624f9610d5SLiad Kaufman struct ieee80211_sub_if_data *sdata, 23633b24f4c6SEmmanuel Grumbach unsigned int queues, bool drop); 2364ce7c9111SKalle Valo 23654afaff17SEmmanuel Grumbach static inline bool ieee80211_can_run_worker(struct ieee80211_local *local) 23664afaff17SEmmanuel Grumbach { 23674afaff17SEmmanuel Grumbach /* 2368f8891461SNaftali Goldstein * It's unsafe to try to do any work during reconfigure flow. 2369f8891461SNaftali Goldstein * When the flow ends the work will be requeued. 2370f8891461SNaftali Goldstein */ 2371f8891461SNaftali Goldstein if (local->in_reconfig) 2372f8891461SNaftali Goldstein return false; 2373f8891461SNaftali Goldstein 2374f8891461SNaftali Goldstein /* 23754afaff17SEmmanuel Grumbach * If quiescing is set, we are racing with __ieee80211_suspend. 23764afaff17SEmmanuel Grumbach * __ieee80211_suspend flushes the workers after setting quiescing, 23774afaff17SEmmanuel Grumbach * and we check quiescing / suspended before enqueing new workers. 23784afaff17SEmmanuel Grumbach * We should abort the worker to avoid the races below. 23794afaff17SEmmanuel Grumbach */ 23804afaff17SEmmanuel Grumbach if (local->quiescing) 23814afaff17SEmmanuel Grumbach return false; 23824afaff17SEmmanuel Grumbach 23834afaff17SEmmanuel Grumbach /* 23844afaff17SEmmanuel Grumbach * We might already be suspended if the following scenario occurs: 23854afaff17SEmmanuel Grumbach * __ieee80211_suspend Control path 23864afaff17SEmmanuel Grumbach * 23874afaff17SEmmanuel Grumbach * if (local->quiescing) 23884afaff17SEmmanuel Grumbach * return; 23894afaff17SEmmanuel Grumbach * local->quiescing = true; 23904afaff17SEmmanuel Grumbach * flush_workqueue(); 23914afaff17SEmmanuel Grumbach * queue_work(...); 23924afaff17SEmmanuel Grumbach * local->suspended = true; 23934afaff17SEmmanuel Grumbach * local->quiescing = false; 23944afaff17SEmmanuel Grumbach * worker starts running... 23954afaff17SEmmanuel Grumbach */ 23964afaff17SEmmanuel Grumbach if (local->suspended) 23974afaff17SEmmanuel Grumbach return false; 23984afaff17SEmmanuel Grumbach 23994afaff17SEmmanuel Grumbach return true; 24004afaff17SEmmanuel Grumbach } 24014afaff17SEmmanuel Grumbach 2402fa962b92SMichal Kazior int ieee80211_txq_setup_flows(struct ieee80211_local *local); 24032fe4a29aSToke Høiland-Jørgensen void ieee80211_txq_set_params(struct ieee80211_local *local); 2404fa962b92SMichal Kazior void ieee80211_txq_teardown_flows(struct ieee80211_local *local); 2405fa962b92SMichal Kazior void ieee80211_txq_init(struct ieee80211_sub_if_data *sdata, 2406ba8c3d6fSFelix Fietkau struct sta_info *sta, 2407ba8c3d6fSFelix Fietkau struct txq_info *txq, int tid); 2408fa962b92SMichal Kazior void ieee80211_txq_purge(struct ieee80211_local *local, 2409fa962b92SMichal Kazior struct txq_info *txqi); 24102a9e2579SJohannes Berg void ieee80211_txq_remove_vlan(struct ieee80211_local *local, 24112a9e2579SJohannes Berg struct ieee80211_sub_if_data *sdata); 24122fe4a29aSToke Høiland-Jørgensen void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats, 24132fe4a29aSToke Høiland-Jørgensen struct txq_info *txqi); 2414da1cad73SAllen Pais void ieee80211_wake_txqs(struct tasklet_struct *t); 241546900298SJohannes Berg void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, 2416700e8ea6SJouni Malinen u16 transaction, u16 auth_alg, u16 status, 24174a3cb702SJohannes Berg const u8 *extra, size_t extra_len, const u8 *bssid, 24181672c0e3SJohannes Berg const u8 *da, const u8 *key, u8 key_len, u8 key_idx, 24191672c0e3SJohannes Berg u32 tx_flags); 24206ae16775SAntonio Quartulli void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, 24214b08d1b6SJohannes Berg const u8 *da, const u8 *bssid, 24224b08d1b6SJohannes Berg u16 stype, u16 reason, 24236ae16775SAntonio Quartulli bool send_frame, u8 *frame_buf); 242400387f32SJohannes Berg 242500387f32SJohannes Berg enum { 242600387f32SJohannes Berg IEEE80211_PROBE_FLAG_DIRECTED = BIT(0), 2427b9771d41SJohannes Berg IEEE80211_PROBE_FLAG_MIN_CONTENT = BIT(1), 2428b9771d41SJohannes Berg IEEE80211_PROBE_FLAG_RANDOM_SN = BIT(2), 242900387f32SJohannes Berg }; 243000387f32SJohannes Berg 24312ad2274cSIlan Peer int ieee80211_build_preq_ies(struct ieee80211_sub_if_data *sdata, u8 *buffer, 2432c56ef672SDavid Spinadel size_t buffer_len, 2433c56ef672SDavid Spinadel struct ieee80211_scan_ies *ie_desc, 2434c56ef672SDavid Spinadel const u8 *ie, size_t ie_len, 2435c56ef672SDavid Spinadel u8 bands_used, u32 *rate_masks, 243600387f32SJohannes Berg struct cfg80211_chan_def *chandef, 243700387f32SJohannes Berg u32 flags); 2438a619a4c0SJuuso Oikarinen struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, 2439a344d677SJohannes Berg const u8 *src, const u8 *dst, 2440a344d677SJohannes Berg u32 ratemask, 24416b77863bSJohannes Berg struct ieee80211_channel *chan, 2442a619a4c0SJuuso Oikarinen const u8 *ssid, size_t ssid_len, 2443a806c558SPaul Stewart const u8 *ie, size_t ie_len, 244400387f32SJohannes Berg u32 flags); 24452103dec1SSimon Wunderlich u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata, 244646900298SJohannes Berg struct ieee802_11_elems *elems, 244757fbcce3SJohannes Berg enum nl80211_band band, u32 *basic_rates); 2448687da132SEmmanuel Grumbach int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata, 2449d8675a63SJohannes Berg struct ieee80211_link_data *link, 2450687da132SEmmanuel Grumbach enum ieee80211_smps_mode smps_mode); 2451e9aac179SJohannes Berg void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata, 2452d8675a63SJohannes Berg struct ieee80211_link_data *link); 24530cbf348aSAndrei Otcheretianski void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata, 24540cbf348aSAndrei Otcheretianski int link_id); 245546900298SJohannes Berg 24568e664fb3SJohannes Berg size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset); 2457ef96a842SBen Greear u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, 245842e7aa77SAlexander Simon u16 cap); 2459074d46d1SJohannes Berg u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, 24604bf88530SJohannes Berg const struct cfg80211_chan_def *chandef, 246157f255f5SArik Nemtsov u16 prot_mode, bool rifs_mode); 246275d627d5SSimon Wunderlich void ieee80211_ie_build_wide_bw_cs(u8 *pos, 246375d627d5SSimon Wunderlich const struct cfg80211_chan_def *chandef); 2464ba0afa2fSMahesh Palivela u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, 2465ba0afa2fSMahesh Palivela u32 cap); 2466fb28ec0cSArik Nemtsov u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, 2467fb28ec0cSArik Nemtsov const struct cfg80211_chan_def *chandef); 246860ad72daSSven Eckelmann u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype); 2469ba323e29SJohannes Berg u8 *ieee80211_ie_build_he_cap(ieee80211_conn_flags_t disable_flags, u8 *pos, 247041cbb0f5SLuca Coelho const struct ieee80211_sta_he_cap *he_cap, 247141cbb0f5SLuca Coelho u8 *end); 247224a2042cSRajkumar Manoharan void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata, 2473abd27d06SJohannes Berg enum ieee80211_smps_mode smps_mode, 247424a2042cSRajkumar Manoharan struct sk_buff *skb); 2475d1b7524bSRajkumar Manoharan u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef); 2476df1875c4SRyder Lee u8 *ieee80211_ie_build_eht_oper(u8 *pos, struct cfg80211_chan_def *chandef, 2477df1875c4SRyder Lee const struct ieee80211_sta_eht_cap *eht_cap); 24783dc05935SJohannes Berg int ieee80211_parse_bitrates(enum nl80211_chan_width width, 24792103dec1SSimon Wunderlich const struct ieee80211_supported_band *sband, 24802103dec1SSimon Wunderlich const u8 *srates, int srates_len, u32 *rates); 2481fc8a7321SJohannes Berg int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, 24826b77863bSJohannes Berg struct sk_buff *skb, bool need_basic, 248357fbcce3SJohannes Berg enum nl80211_band band); 2484fc8a7321SJohannes Berg int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, 24856b77863bSJohannes Berg struct sk_buff *skb, bool need_basic, 248657fbcce3SJohannes Berg enum nl80211_band band); 248740b861a0SArik Nemtsov u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo); 24887957c6c8SThomas Pedersen void ieee80211_add_s1g_capab_ie(struct ieee80211_sub_if_data *sdata, 24897957c6c8SThomas Pedersen struct ieee80211_sta_s1g_cap *caps, 24907957c6c8SThomas Pedersen struct sk_buff *skb); 24911d00ce80SThomas Pedersen void ieee80211_add_aid_request_ie(struct ieee80211_sub_if_data *sdata, 24921d00ce80SThomas Pedersen struct sk_buff *skb); 24930333a81bSKieran Frewen u8 *ieee80211_ie_build_s1g_cap(u8 *pos, struct ieee80211_sta_s1g_cap *s1g_cap); 24948e664fb3SJohannes Berg 2495f444de05SJohannes Berg /* channel management */ 24968ac3c704SJohannes Berg bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper, 24974bf88530SJohannes Berg struct cfg80211_chan_def *chandef); 24982a333a0dSJohannes Berg bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw, u32 vht_cap_info, 24997eb26df2SJohannes Berg const struct ieee80211_vht_operation *oper, 25007eb26df2SJohannes Berg const struct ieee80211_ht_operation *htop, 2501abcff6efSJanusz.Dziedzic@tieto.com struct cfg80211_chan_def *chandef); 2502774e00c2SJohannes Berg void ieee80211_chandef_eht_oper(const struct ieee80211_eht_operation *eht_oper, 25031e0b3b0bSIlan Peer bool support_160, bool support_320, 25041e0b3b0bSIlan Peer struct cfg80211_chan_def *chandef); 250557fa5e85SJohannes Berg bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata, 250657fa5e85SJohannes Berg const struct ieee80211_he_operation *he_oper, 25075dca295dSIlan Peer const struct ieee80211_eht_operation *eht_oper, 250857fa5e85SJohannes Berg struct cfg80211_chan_def *chandef); 25091d00ce80SThomas Pedersen bool ieee80211_chandef_s1g_oper(const struct ieee80211_s1g_oper_ie *oper, 25101d00ce80SThomas Pedersen struct cfg80211_chan_def *chandef); 2511ba323e29SJohannes Berg ieee80211_conn_flags_t ieee80211_chandef_downgrade(struct cfg80211_chan_def *c); 2512f444de05SJohannes Berg 2513d01a1e65SMichal Kazior int __must_check 2514b4f85443SJohannes Berg ieee80211_link_use_channel(struct ieee80211_link_data *link, 25154bf88530SJohannes Berg const struct cfg80211_chan_def *chandef, 2516d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode); 25172c9b7359SJohannes Berg int __must_check 2518b4f85443SJohannes Berg ieee80211_link_reserve_chanctx(struct ieee80211_link_data *link, 251911335a55SLuciano Coelho const struct cfg80211_chan_def *chandef, 252009332481SMichal Kazior enum ieee80211_chanctx_mode mode, 252109332481SMichal Kazior bool radar_required); 252211335a55SLuciano Coelho int __must_check 2523b4f85443SJohannes Berg ieee80211_link_use_reserved_context(struct ieee80211_link_data *link); 2524b4f85443SJohannes Berg int ieee80211_link_unreserve_chanctx(struct ieee80211_link_data *link); 252511335a55SLuciano Coelho 252611335a55SLuciano Coelho int __must_check 2527b4f85443SJohannes Berg ieee80211_link_change_bandwidth(struct ieee80211_link_data *link, 25282c9b7359SJohannes Berg const struct cfg80211_chan_def *chandef, 2529aa87cd8bSJohannes Berg u64 *changed); 2530b4f85443SJohannes Berg void ieee80211_link_release_channel(struct ieee80211_link_data *link); 2531b4f85443SJohannes Berg void ieee80211_link_vlan_copy_chanctx(struct ieee80211_link_data *link); 2532b4f85443SJohannes Berg void ieee80211_link_copy_chanctx_to_vlans(struct ieee80211_link_data *link, 25331f4ac5a6SJohannes Berg bool clear); 2534c0166da9SMichal Kazior int ieee80211_chanctx_refcount(struct ieee80211_local *local, 2535c0166da9SMichal Kazior struct ieee80211_chanctx *ctx); 2536d01a1e65SMichal Kazior 253704ecd257SJohannes Berg void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, 253804ecd257SJohannes Berg struct ieee80211_chanctx *chanctx); 253921f659bfSEliad Peller void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, 2540b72a455aSJohannes Berg struct ieee80211_chanctx *ctx, 2541b72a455aSJohannes Berg struct ieee80211_link_data *rsvd_for); 25425cbc95a7SEliad Peller bool ieee80211_is_radar_required(struct ieee80211_local *local); 2543164eb02dSSimon Wunderlich 2544164eb02dSSimon Wunderlich void ieee80211_dfs_cac_timer(unsigned long data); 2545164eb02dSSimon Wunderlich void ieee80211_dfs_cac_timer_work(struct work_struct *work); 2546164eb02dSSimon Wunderlich void ieee80211_dfs_cac_cancel(struct ieee80211_local *local); 2547164eb02dSSimon Wunderlich void ieee80211_dfs_radar_detected_work(struct work_struct *work); 2548c6da674aSChun-Yeow Yeoh int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata, 2549c6da674aSChun-Yeow Yeoh struct cfg80211_csa_settings *csa_settings); 255004ecd257SJohannes Berg 2551057d5f4bSThomas Pedersen void ieee80211_recalc_dtim(struct ieee80211_local *local, 2552057d5f4bSThomas Pedersen struct ieee80211_sub_if_data *sdata); 255373de86a3SLuciano Coelho int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, 255473de86a3SLuciano Coelho const struct cfg80211_chan_def *chandef, 255573de86a3SLuciano Coelho enum ieee80211_chanctx_mode chanmode, 255673de86a3SLuciano Coelho u8 radar_detect); 25576fa001bcSMichal Kazior int ieee80211_max_num_channels(struct ieee80211_local *local); 25580fabfaafSArik Nemtsov void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, 25590fabfaafSArik Nemtsov struct ieee80211_chanctx *ctx); 25602475b1ccSMax Stepanov 256195224fe8SArik Nemtsov /* TDLS */ 256295224fe8SArik Nemtsov int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, 25633b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 256495224fe8SArik Nemtsov u16 status_code, u32 peer_capability, 256531fa97c5SArik Nemtsov bool initiator, const u8 *extra_ies, 256631fa97c5SArik Nemtsov size_t extra_ies_len); 256795224fe8SArik Nemtsov int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, 25683b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 2569c10a1993SJohannes Berg void ieee80211_tdls_peer_del_work(struct work_struct *wk); 2570a7a6bdd0SArik Nemtsov int ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev, 2571a7a6bdd0SArik Nemtsov const u8 *addr, u8 oper_class, 2572a7a6bdd0SArik Nemtsov struct cfg80211_chan_def *chandef); 2573a7a6bdd0SArik Nemtsov void ieee80211_tdls_cancel_channel_switch(struct wiphy *wiphy, 2574a7a6bdd0SArik Nemtsov struct net_device *dev, 2575a7a6bdd0SArik Nemtsov const u8 *addr); 2576d51c2ea3SArik Nemtsov void ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata); 257779c92ca4SYu Wang void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata, 257879c92ca4SYu Wang const u8 *peer, u16 reason); 2579f057d140SJohannes Berg void 2580f057d140SJohannes Berg ieee80211_process_tdls_channel_switch(struct ieee80211_sub_if_data *sdata, 2581f057d140SJohannes Berg struct sk_buff *skb); 2582f057d140SJohannes Berg 2583f057d140SJohannes Berg 258479c92ca4SYu Wang const char *ieee80211_get_reason_code_string(u16 reason_code); 258505d10957SThomas Pedersen u16 ieee80211_encode_usf(int val); 258609a740ceSThomas Pedersen u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, 258709a740ceSThomas Pedersen enum nl80211_iftype type); 258895224fe8SArik Nemtsov 2589b7ffbd7eSJohannes Berg extern const struct ethtool_ops ieee80211_ethtool_ops; 2590b7ffbd7eSJohannes Berg 2591db3e1c40SToke Høiland-Jørgensen u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, 2592db3e1c40SToke Høiland-Jørgensen struct ieee80211_vif *vif, 2593db3e1c40SToke Høiland-Jørgensen struct ieee80211_sta *pubsta, 25943ff901cbSFelix Fietkau int len, bool ampdu); 2595f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE 2596d9e8a70fSJohannes Berg #define debug_noinline noinline 2597d9e8a70fSJohannes Berg #else 2598d9e8a70fSJohannes Berg #define debug_noinline 2599d9e8a70fSJohannes Berg #endif 2600d9e8a70fSJohannes Berg 26013a11ce08SJohannes Berg void ieee80211_init_frag_cache(struct ieee80211_fragment_cache *cache); 26023a11ce08SJohannes Berg void ieee80211_destroy_frag_cache(struct ieee80211_fragment_cache *cache); 26033a11ce08SJohannes Berg 2604820acc81SIlan Peer u8 ieee80211_ie_len_eht_cap(struct ieee80211_sub_if_data *sdata, u8 iftype); 2605820acc81SIlan Peer u8 *ieee80211_ie_build_eht_cap(u8 *pos, 2606820acc81SIlan Peer const struct ieee80211_sta_he_cap *he_cap, 2607820acc81SIlan Peer const struct ieee80211_sta_eht_cap *eht_cap, 2608ea5cba26SJohannes Berg u8 *end, 2609ea5cba26SJohannes Berg bool for_ap); 2610a1de6407SIlan Peer 2611a1de6407SIlan Peer void 2612a1de6407SIlan Peer ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata, 2613a1de6407SIlan Peer struct ieee80211_supported_band *sband, 2614a1de6407SIlan Peer const u8 *he_cap_ie, u8 he_cap_len, 2615a1de6407SIlan Peer const struct ieee80211_eht_cap_elem *eht_cap_ie_elem, 2616c71420dbSJohannes Berg u8 eht_cap_len, 2617c71420dbSJohannes Berg struct link_sta_info *link_sta); 2618f0706e82SJiri Benc #endif /* IEEE80211_I_H */ 2619