1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 #ifndef __NET_CFG80211_H 3 #define __NET_CFG80211_H 4 /* 5 * 802.11 device and configuration interface 6 * 7 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 8 * Copyright 2013-2014 Intel Mobile Communications GmbH 9 * Copyright 2015-2017 Intel Deutschland GmbH 10 * Copyright (C) 2018-2026 Intel Corporation 11 */ 12 13 #include <linux/ethtool.h> 14 #include <uapi/linux/rfkill.h> 15 #include <linux/netdevice.h> 16 #include <linux/debugfs.h> 17 #include <linux/list.h> 18 #include <linux/bug.h> 19 #include <linux/netlink.h> 20 #include <linux/skbuff.h> 21 #include <linux/nl80211.h> 22 #include <linux/if_ether.h> 23 #include <linux/ieee80211.h> 24 #include <linux/net.h> 25 #include <linux/rfkill.h> 26 #include <net/regulatory.h> 27 28 /** 29 * DOC: Introduction 30 * 31 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges 32 * userspace and drivers, and offers some utility functionality associated 33 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used 34 * by all modern wireless drivers in Linux, so that they offer a consistent 35 * API through nl80211. For backward compatibility, cfg80211 also offers 36 * wireless extensions to userspace, but hides them from drivers completely. 37 * 38 * Additionally, cfg80211 contains code to help enforce regulatory spectrum 39 * use restrictions. 40 */ 41 42 43 /** 44 * DOC: Device registration 45 * 46 * In order for a driver to use cfg80211, it must register the hardware device 47 * with cfg80211. This happens through a number of hardware capability structs 48 * described below. 49 * 50 * The fundamental structure for each device is the 'wiphy', of which each 51 * instance describes a physical wireless device connected to the system. Each 52 * such wiphy can have zero, one, or many virtual interfaces associated with 53 * it, which need to be identified as such by pointing the network interface's 54 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes 55 * the wireless part of the interface. Normally this struct is embedded in the 56 * network interface's private data area. Drivers can optionally allow creating 57 * or destroying virtual interfaces on the fly, but without at least one or the 58 * ability to create some the wireless device isn't useful. 59 * 60 * Each wiphy structure contains device capability information, and also has 61 * a pointer to the various operations the driver offers. The definitions and 62 * structures here describe these capabilities in detail. 63 */ 64 65 struct wiphy; 66 67 /* 68 * wireless hardware capability structures 69 */ 70 71 /** 72 * enum ieee80211_channel_flags - channel flags 73 * 74 * Channel flags set by the regulatory control code. 75 * 76 * @IEEE80211_CHAN_DISABLED: This channel is disabled. 77 * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes 78 * sending probe requests or beaconing. 79 * @IEEE80211_CHAN_PSD: Power spectral density (in dBm) is set for this 80 * channel. 81 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 82 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 83 * is not permitted. 84 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 85 * is not permitted. 86 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel. 87 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band, 88 * this flag indicates that an 80 MHz channel cannot use this 89 * channel as the control or any of the secondary channels. 90 * This may be due to the driver or due to regulatory bandwidth 91 * restrictions. 92 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band, 93 * this flag indicates that an 160 MHz channel cannot use this 94 * channel as the control or any of the secondary channels. 95 * This may be due to the driver or due to regulatory bandwidth 96 * restrictions. 97 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY 98 * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT 99 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted 100 * on this channel. 101 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted 102 * on this channel. 103 * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel. 104 * @IEEE80211_CHAN_NO_320MHZ: If the driver supports 320 MHz on the band, 105 * this flag indicates that a 320 MHz channel cannot use this 106 * channel as the control or any of the secondary channels. 107 * This may be due to the driver or due to regulatory bandwidth 108 * restrictions. 109 * @IEEE80211_CHAN_NO_EHT: EHT operation is not permitted on this channel. 110 * @IEEE80211_CHAN_DFS_CONCURRENT: See %NL80211_RRF_DFS_CONCURRENT 111 * @IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT: Client connection with VLP AP 112 * not permitted using this channel 113 * @IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT: Client connection with AFC AP 114 * not permitted using this channel 115 * @IEEE80211_CHAN_CAN_MONITOR: This channel can be used for monitor 116 * mode even in the presence of other (regulatory) restrictions, 117 * even if it is otherwise disabled. 118 * @IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP: Allow using this channel for AP operation 119 * with very low power (VLP), even if otherwise set to NO_IR. 120 * @IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY: Allow activity on a 20 MHz channel, 121 * even if otherwise set to NO_IR. 122 * @IEEE80211_CHAN_S1G_NO_PRIMARY: Prevents the channel for use as an S1G 123 * primary channel. Does not prevent the wider operating channel 124 * described by the chandef from being used. In order for a 2MHz primary 125 * to be used, both 1MHz subchannels shall not contain this flag. 126 * @IEEE80211_CHAN_NO_4MHZ: 4 MHz bandwidth is not permitted on this channel. 127 * @IEEE80211_CHAN_NO_8MHZ: 8 MHz bandwidth is not permitted on this channel. 128 * @IEEE80211_CHAN_NO_16MHZ: 16 MHz bandwidth is not permitted on this channel. 129 * @IEEE80211_CHAN_NO_UHR: UHR operation is not permitted on this channel. 130 */ 131 enum ieee80211_channel_flags { 132 IEEE80211_CHAN_DISABLED = BIT(0), 133 IEEE80211_CHAN_NO_IR = BIT(1), 134 IEEE80211_CHAN_PSD = BIT(2), 135 IEEE80211_CHAN_RADAR = BIT(3), 136 IEEE80211_CHAN_NO_HT40PLUS = BIT(4), 137 IEEE80211_CHAN_NO_HT40MINUS = BIT(5), 138 IEEE80211_CHAN_NO_OFDM = BIT(6), 139 IEEE80211_CHAN_NO_80MHZ = BIT(7), 140 IEEE80211_CHAN_NO_160MHZ = BIT(8), 141 IEEE80211_CHAN_INDOOR_ONLY = BIT(9), 142 IEEE80211_CHAN_IR_CONCURRENT = BIT(10), 143 IEEE80211_CHAN_NO_20MHZ = BIT(11), 144 IEEE80211_CHAN_NO_10MHZ = BIT(12), 145 IEEE80211_CHAN_NO_HE = BIT(13), 146 /* can use free bits here */ 147 IEEE80211_CHAN_NO_UHR = BIT(18), 148 IEEE80211_CHAN_NO_320MHZ = BIT(19), 149 IEEE80211_CHAN_NO_EHT = BIT(20), 150 IEEE80211_CHAN_DFS_CONCURRENT = BIT(21), 151 IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT = BIT(22), 152 IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT = BIT(23), 153 IEEE80211_CHAN_CAN_MONITOR = BIT(24), 154 IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP = BIT(25), 155 IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY = BIT(26), 156 IEEE80211_CHAN_S1G_NO_PRIMARY = BIT(27), 157 IEEE80211_CHAN_NO_4MHZ = BIT(28), 158 IEEE80211_CHAN_NO_8MHZ = BIT(29), 159 IEEE80211_CHAN_NO_16MHZ = BIT(30), 160 }; 161 162 #define IEEE80211_CHAN_NO_HT40 \ 163 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 164 165 #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000 166 #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000) 167 168 /** 169 * struct ieee80211_channel - channel definition 170 * 171 * This structure describes a single channel for use 172 * with cfg80211. 173 * 174 * @center_freq: center frequency in MHz 175 * @freq_offset: offset from @center_freq, in KHz 176 * @hw_value: hardware-specific value for the channel 177 * @flags: channel flags from &enum ieee80211_channel_flags. 178 * @orig_flags: channel flags at registration time, used by regulatory 179 * code to support devices with additional restrictions 180 * @band: band this channel belongs to. 181 * @max_antenna_gain: maximum antenna gain in dBi 182 * @max_power: maximum transmission power (in dBm) 183 * @max_reg_power: maximum regulatory transmission power (in dBm) 184 * @beacon_found: helper to regulatory code to indicate when a beacon 185 * has been found on this channel. Use regulatory_hint_found_beacon() 186 * to enable this, this is useful only on 5 GHz band. 187 * @orig_mag: internal use 188 * @orig_mpwr: internal use 189 * @dfs_state: current state of this channel. Only relevant if radar is required 190 * on this channel. 191 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 192 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. 193 * @cac_start_time: timestamp (CLOCK_BOOTTIME, nanoseconds) when CAC was 194 * started on this channel. Zero when CAC is not in progress. 195 * @psd: power spectral density (in dBm) 196 */ 197 struct ieee80211_channel { 198 enum nl80211_band band; 199 u32 center_freq; 200 u16 freq_offset; 201 u16 hw_value; 202 u32 flags; 203 int max_antenna_gain; 204 int max_power; 205 int max_reg_power; 206 bool beacon_found; 207 u32 orig_flags; 208 int orig_mag, orig_mpwr; 209 enum nl80211_dfs_state dfs_state; 210 unsigned long dfs_state_entered; 211 unsigned int dfs_cac_ms; 212 u64 cac_start_time; 213 s8 psd; 214 }; 215 216 /** 217 * enum ieee80211_rate_flags - rate flags 218 * 219 * Hardware/specification flags for rates. These are structured 220 * in a way that allows using the same bitrate structure for 221 * different bands/PHY modes. 222 * 223 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 224 * preamble on this bitrate; only relevant in 2.4GHz band and 225 * with CCK rates. 226 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 227 * when used with 802.11a (on the 5 GHz band); filled by the 228 * core code when registering the wiphy. 229 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 230 * when used with 802.11b (on the 2.4 GHz band); filled by the 231 * core code when registering the wiphy. 232 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 233 * when used with 802.11g (on the 2.4 GHz band); filled by the 234 * core code when registering the wiphy. 235 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 236 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode 237 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode 238 */ 239 enum ieee80211_rate_flags { 240 IEEE80211_RATE_SHORT_PREAMBLE = BIT(0), 241 IEEE80211_RATE_MANDATORY_A = BIT(1), 242 IEEE80211_RATE_MANDATORY_B = BIT(2), 243 IEEE80211_RATE_MANDATORY_G = BIT(3), 244 IEEE80211_RATE_ERP_G = BIT(4), 245 IEEE80211_RATE_SUPPORTS_5MHZ = BIT(5), 246 IEEE80211_RATE_SUPPORTS_10MHZ = BIT(6), 247 }; 248 249 /** 250 * enum ieee80211_bss_type - BSS type filter 251 * 252 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS 253 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS 254 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS 255 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS 256 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type 257 */ 258 enum ieee80211_bss_type { 259 IEEE80211_BSS_TYPE_ESS, 260 IEEE80211_BSS_TYPE_PBSS, 261 IEEE80211_BSS_TYPE_IBSS, 262 IEEE80211_BSS_TYPE_MBSS, 263 IEEE80211_BSS_TYPE_ANY 264 }; 265 266 /** 267 * enum ieee80211_privacy - BSS privacy filter 268 * 269 * @IEEE80211_PRIVACY_ON: privacy bit set 270 * @IEEE80211_PRIVACY_OFF: privacy bit clear 271 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting 272 */ 273 enum ieee80211_privacy { 274 IEEE80211_PRIVACY_ON, 275 IEEE80211_PRIVACY_OFF, 276 IEEE80211_PRIVACY_ANY 277 }; 278 279 #define IEEE80211_PRIVACY(x) \ 280 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF) 281 282 /** 283 * struct ieee80211_rate - bitrate definition 284 * 285 * This structure describes a bitrate that an 802.11 PHY can 286 * operate with. The two values @hw_value and @hw_value_short 287 * are only for driver use when pointers to this structure are 288 * passed around. 289 * 290 * @flags: rate-specific flags from &enum ieee80211_rate_flags 291 * @bitrate: bitrate in units of 100 Kbps 292 * @hw_value: driver/hardware value for this rate 293 * @hw_value_short: driver/hardware value for this rate when 294 * short preamble is used 295 */ 296 struct ieee80211_rate { 297 u32 flags; 298 u16 bitrate; 299 u16 hw_value, hw_value_short; 300 }; 301 302 /** 303 * struct ieee80211_he_obss_pd - AP settings for spatial reuse 304 * 305 * @enable: is the feature enabled. 306 * @sr_ctrl: The SR Control field of SRP element. 307 * @non_srg_max_offset: non-SRG maximum tx power offset 308 * @min_offset: minimal tx power offset an associated station shall use 309 * @max_offset: maximum tx power offset an associated station shall use 310 * @bss_color_bitmap: bitmap that indicates the BSS color values used by 311 * members of the SRG 312 * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values 313 * used by members of the SRG 314 */ 315 struct ieee80211_he_obss_pd { 316 bool enable; 317 u8 sr_ctrl; 318 u8 non_srg_max_offset; 319 u8 min_offset; 320 u8 max_offset; 321 u8 bss_color_bitmap[8]; 322 u8 partial_bssid_bitmap[8]; 323 }; 324 325 /** 326 * struct cfg80211_he_bss_color - AP settings for BSS coloring 327 * 328 * @color: the current color. 329 * @enabled: HE BSS color is used 330 * @partial: define the AID equation. 331 */ 332 struct cfg80211_he_bss_color { 333 u8 color; 334 bool enabled; 335 bool partial; 336 }; 337 338 /** 339 * struct ieee80211_sta_ht_cap - STA's HT capabilities 340 * 341 * This structure describes most essential parameters needed 342 * to describe 802.11n HT capabilities for an STA. 343 * 344 * @ht_supported: is HT supported by the STA 345 * @cap: HT capabilities map as described in 802.11n spec 346 * @ampdu_factor: Maximum A-MPDU length factor 347 * @ampdu_density: Minimum A-MPDU spacing 348 * @mcs: Supported MCS rates 349 */ 350 struct ieee80211_sta_ht_cap { 351 u16 cap; /* use IEEE80211_HT_CAP_ */ 352 bool ht_supported; 353 u8 ampdu_factor; 354 u8 ampdu_density; 355 struct ieee80211_mcs_info mcs; 356 }; 357 358 /** 359 * struct ieee80211_sta_vht_cap - STA's VHT capabilities 360 * 361 * This structure describes most essential parameters needed 362 * to describe 802.11ac VHT capabilities for an STA. 363 * 364 * @vht_supported: is VHT supported by the STA 365 * @cap: VHT capabilities map as described in 802.11ac spec 366 * @vht_mcs: Supported VHT MCS rates 367 */ 368 struct ieee80211_sta_vht_cap { 369 bool vht_supported; 370 u32 cap; /* use IEEE80211_VHT_CAP_ */ 371 struct ieee80211_vht_mcs_info vht_mcs; 372 }; 373 374 #define IEEE80211_HE_PPE_THRES_MAX_LEN 25 375 376 /** 377 * struct ieee80211_sta_he_cap - STA's HE capabilities 378 * 379 * This structure describes most essential parameters needed 380 * to describe 802.11ax HE capabilities for a STA. 381 * 382 * @has_he: true iff HE data is valid. 383 * @he_cap_elem: Fixed portion of the HE capabilities element. 384 * @he_mcs_nss_supp: The supported NSS/MCS combinations. 385 * @ppe_thres: Holds the PPE Thresholds data. 386 */ 387 struct ieee80211_sta_he_cap { 388 bool has_he; 389 struct ieee80211_he_cap_elem he_cap_elem; 390 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp; 391 u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN]; 392 }; 393 394 /** 395 * struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS 396 * 397 * See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS 398 * and NSS Set field" 399 * 400 * @only_20mhz: MCS/NSS support for 20 MHz-only STA. 401 * @bw: MCS/NSS support for 80, 160 and 320 MHz 402 * @bw._80: MCS/NSS support for BW <= 80 MHz 403 * @bw._160: MCS/NSS support for BW = 160 MHz 404 * @bw._320: MCS/NSS support for BW = 320 MHz 405 */ 406 struct ieee80211_eht_mcs_nss_supp { 407 union { 408 struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz; 409 struct { 410 struct ieee80211_eht_mcs_nss_supp_bw _80; 411 struct ieee80211_eht_mcs_nss_supp_bw _160; 412 struct ieee80211_eht_mcs_nss_supp_bw _320; 413 } __packed bw; 414 } __packed; 415 } __packed; 416 417 #define IEEE80211_EHT_PPE_THRES_MAX_LEN 32 418 419 /** 420 * struct ieee80211_sta_eht_cap - STA's EHT capabilities 421 * 422 * This structure describes most essential parameters needed 423 * to describe 802.11be EHT capabilities for a STA. 424 * 425 * @has_eht: true iff EHT data is valid. 426 * @eht_cap_elem: Fixed portion of the eht capabilities element. 427 * @eht_mcs_nss_supp: The supported NSS/MCS combinations. 428 * @eht_ppe_thres: Holds the PPE Thresholds data. 429 */ 430 struct ieee80211_sta_eht_cap { 431 bool has_eht; 432 struct ieee80211_eht_cap_elem_fixed eht_cap_elem; 433 struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp; 434 u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN]; 435 }; 436 437 /** 438 * struct ieee80211_sta_uhr_cap - STA's UHR capabilities 439 * @has_uhr: true iff UHR is supported and data is valid 440 * @mac: fixed MAC capabilities 441 * @phy: fixed PHY capabilities 442 */ 443 struct ieee80211_sta_uhr_cap { 444 bool has_uhr; 445 struct ieee80211_uhr_cap_mac mac; 446 struct ieee80211_uhr_cap_phy phy; 447 }; 448 449 /* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */ 450 #ifdef __CHECKER__ 451 /* 452 * This is used to mark the sband->iftype_data pointer which is supposed 453 * to be an array with special access semantics (per iftype), but a lot 454 * of code got it wrong in the past, so with this marking sparse will be 455 * noisy when the pointer is used directly. 456 */ 457 # define __iftd __attribute__((noderef, address_space(__iftype_data))) 458 #else 459 # define __iftd 460 #endif /* __CHECKER__ */ 461 462 /** 463 * struct ieee80211_sband_iftype_data - sband data per interface type 464 * 465 * This structure encapsulates sband data that is relevant for the 466 * interface types defined in @types_mask. Each type in the 467 * @types_mask must be unique across all instances of iftype_data. 468 * 469 * @types_mask: interface types mask 470 * @he_cap: holds the HE capabilities 471 * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a 472 * 6 GHz band channel (and 0 may be valid value). 473 * @eht_cap: STA's EHT capabilities 474 * @uhr_cap: STA's UHR capabilities 475 * @vendor_elems: vendor element(s) to advertise 476 * @vendor_elems.data: vendor element(s) data 477 * @vendor_elems.len: vendor element(s) length 478 */ 479 struct ieee80211_sband_iftype_data { 480 u16 types_mask; 481 struct ieee80211_sta_he_cap he_cap; 482 struct ieee80211_he_6ghz_capa he_6ghz_capa; 483 struct ieee80211_sta_eht_cap eht_cap; 484 struct ieee80211_sta_uhr_cap uhr_cap; 485 struct { 486 const u8 *data; 487 unsigned int len; 488 } vendor_elems; 489 }; 490 491 /** 492 * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations 493 * 494 * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz 495 * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz 496 * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz 497 * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz 498 * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz 499 * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz 500 * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz 501 * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and 502 * 2.16GHz+2.16GHz 503 * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and 504 * 4.32GHz + 4.32GHz 505 * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and 506 * 4.32GHz + 4.32GHz 507 * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz 508 * and 4.32GHz + 4.32GHz 509 * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz, 510 * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz 511 */ 512 enum ieee80211_edmg_bw_config { 513 IEEE80211_EDMG_BW_CONFIG_4 = 4, 514 IEEE80211_EDMG_BW_CONFIG_5 = 5, 515 IEEE80211_EDMG_BW_CONFIG_6 = 6, 516 IEEE80211_EDMG_BW_CONFIG_7 = 7, 517 IEEE80211_EDMG_BW_CONFIG_8 = 8, 518 IEEE80211_EDMG_BW_CONFIG_9 = 9, 519 IEEE80211_EDMG_BW_CONFIG_10 = 10, 520 IEEE80211_EDMG_BW_CONFIG_11 = 11, 521 IEEE80211_EDMG_BW_CONFIG_12 = 12, 522 IEEE80211_EDMG_BW_CONFIG_13 = 13, 523 IEEE80211_EDMG_BW_CONFIG_14 = 14, 524 IEEE80211_EDMG_BW_CONFIG_15 = 15, 525 }; 526 527 /** 528 * struct ieee80211_edmg - EDMG configuration 529 * 530 * This structure describes most essential parameters needed 531 * to describe 802.11ay EDMG configuration 532 * 533 * @channels: bitmap that indicates the 2.16 GHz channel(s) 534 * that are allowed to be used for transmissions. 535 * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc. 536 * Set to 0 indicate EDMG not supported. 537 * @bw_config: Channel BW Configuration subfield encodes 538 * the allowed channel bandwidth configurations 539 */ 540 struct ieee80211_edmg { 541 u8 channels; 542 enum ieee80211_edmg_bw_config bw_config; 543 }; 544 545 /** 546 * struct ieee80211_sta_s1g_cap - STA's S1G capabilities 547 * 548 * This structure describes most essential parameters needed 549 * to describe 802.11ah S1G capabilities for a STA. 550 * 551 * @s1g: is STA an S1G STA 552 * @cap: S1G capabilities information 553 * @nss_mcs: Supported NSS MCS set 554 */ 555 struct ieee80211_sta_s1g_cap { 556 bool s1g; 557 u8 cap[10]; /* use S1G_CAPAB_ */ 558 u8 nss_mcs[5]; 559 }; 560 561 /** 562 * struct ieee80211_supported_band - frequency band definition 563 * 564 * This structure describes a frequency band a wiphy 565 * is able to operate in. 566 * 567 * @channels: Array of channels the hardware can operate with 568 * in this band. 569 * @band: the band this structure represents 570 * @n_channels: Number of channels in @channels 571 * @bitrates: Array of bitrates the hardware can operate with 572 * in this band. Must be sorted to give a valid "supported 573 * rates" IE, i.e. CCK rates first, then OFDM. 574 * @n_bitrates: Number of bitrates in @bitrates 575 * @ht_cap: HT capabilities in this band 576 * @vht_cap: VHT capabilities in this band 577 * @s1g_cap: S1G capabilities in this band 578 * @edmg_cap: EDMG capabilities in this band 579 * @s1g_cap: S1G capabilities in this band (S1G band only, of course) 580 * @n_iftype_data: number of iftype data entries 581 * @iftype_data: interface type data entries. Note that the bits in 582 * @types_mask inside this structure cannot overlap (i.e. only 583 * one occurrence of each type is allowed across all instances of 584 * iftype_data). 585 */ 586 struct ieee80211_supported_band { 587 struct ieee80211_channel *channels; 588 struct ieee80211_rate *bitrates; 589 enum nl80211_band band; 590 int n_channels; 591 int n_bitrates; 592 struct ieee80211_sta_ht_cap ht_cap; 593 struct ieee80211_sta_vht_cap vht_cap; 594 struct ieee80211_sta_s1g_cap s1g_cap; 595 struct ieee80211_edmg edmg_cap; 596 u16 n_iftype_data; 597 const struct ieee80211_sband_iftype_data __iftd *iftype_data; 598 }; 599 600 /** 601 * _ieee80211_set_sband_iftype_data - set sband iftype data array 602 * @sband: the sband to initialize 603 * @iftd: the iftype data array pointer 604 * @n_iftd: the length of the iftype data array 605 * 606 * Set the sband iftype data array; use this where the length cannot 607 * be derived from the ARRAY_SIZE() of the argument, but prefer 608 * ieee80211_set_sband_iftype_data() where it can be used. 609 */ 610 static inline void 611 _ieee80211_set_sband_iftype_data(struct ieee80211_supported_band *sband, 612 const struct ieee80211_sband_iftype_data *iftd, 613 u16 n_iftd) 614 { 615 sband->iftype_data = (const void __iftd __force *)iftd; 616 sband->n_iftype_data = n_iftd; 617 } 618 619 /** 620 * ieee80211_set_sband_iftype_data - set sband iftype data array 621 * @sband: the sband to initialize 622 * @iftd: the iftype data array 623 */ 624 #define ieee80211_set_sband_iftype_data(sband, iftd) \ 625 _ieee80211_set_sband_iftype_data(sband, iftd, ARRAY_SIZE(iftd)) 626 627 /** 628 * for_each_sband_iftype_data - iterate sband iftype data entries 629 * @sband: the sband whose iftype_data array to iterate 630 * @i: iterator counter 631 * @iftd: iftype data pointer to set 632 */ 633 #define for_each_sband_iftype_data(sband, i, iftd) \ 634 for (i = 0, iftd = (const void __force *)&(sband)->iftype_data[i]; \ 635 i < (sband)->n_iftype_data; \ 636 i++, iftd = (const void __force *)&(sband)->iftype_data[i]) 637 638 /** 639 * ieee80211_get_sband_iftype_data - return sband data for a given iftype 640 * @sband: the sband to search for the STA on 641 * @iftype: enum nl80211_iftype 642 * 643 * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found 644 */ 645 static inline const struct ieee80211_sband_iftype_data * 646 ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband, 647 u8 iftype) 648 { 649 const struct ieee80211_sband_iftype_data *data; 650 int i; 651 652 if (WARN_ON(iftype >= NUM_NL80211_IFTYPES)) 653 return NULL; 654 655 if (iftype == NL80211_IFTYPE_AP_VLAN) 656 iftype = NL80211_IFTYPE_AP; 657 658 for_each_sband_iftype_data(sband, i, data) { 659 if (data->types_mask & BIT(iftype)) 660 return data; 661 } 662 663 return NULL; 664 } 665 666 /** 667 * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype 668 * @sband: the sband to search for the iftype on 669 * @iftype: enum nl80211_iftype 670 * 671 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found 672 */ 673 static inline const struct ieee80211_sta_he_cap * 674 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband, 675 u8 iftype) 676 { 677 const struct ieee80211_sband_iftype_data *data = 678 ieee80211_get_sband_iftype_data(sband, iftype); 679 680 if (data && data->he_cap.has_he) 681 return &data->he_cap; 682 683 return NULL; 684 } 685 686 /** 687 * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities 688 * @sband: the sband to search for the STA on 689 * @iftype: the iftype to search for 690 * 691 * Return: the 6GHz capabilities 692 */ 693 static inline __le16 694 ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband, 695 enum nl80211_iftype iftype) 696 { 697 const struct ieee80211_sband_iftype_data *data = 698 ieee80211_get_sband_iftype_data(sband, iftype); 699 700 if (WARN_ON(!data || !data->he_cap.has_he)) 701 return 0; 702 703 return data->he_6ghz_capa.capa; 704 } 705 706 /** 707 * ieee80211_get_eht_iftype_cap - return EHT capabilities for an sband's iftype 708 * @sband: the sband to search for the iftype on 709 * @iftype: enum nl80211_iftype 710 * 711 * Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found 712 */ 713 static inline const struct ieee80211_sta_eht_cap * 714 ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband, 715 enum nl80211_iftype iftype) 716 { 717 const struct ieee80211_sband_iftype_data *data = 718 ieee80211_get_sband_iftype_data(sband, iftype); 719 720 if (data && data->eht_cap.has_eht) 721 return &data->eht_cap; 722 723 return NULL; 724 } 725 726 /** 727 * ieee80211_get_uhr_iftype_cap - return UHR capabilities for an sband's iftype 728 * @sband: the sband to search for the iftype on 729 * @iftype: enum nl80211_iftype 730 * 731 * Return: pointer to the struct ieee80211_sta_uhr_cap, or NULL is none found 732 */ 733 static inline const struct ieee80211_sta_uhr_cap * 734 ieee80211_get_uhr_iftype_cap(const struct ieee80211_supported_band *sband, 735 enum nl80211_iftype iftype) 736 { 737 const struct ieee80211_sband_iftype_data *data = 738 ieee80211_get_sband_iftype_data(sband, iftype); 739 740 if (data && data->uhr_cap.has_uhr) 741 return &data->uhr_cap; 742 743 return NULL; 744 } 745 746 /** 747 * wiphy_read_of_freq_limits - read frequency limits from device tree 748 * 749 * @wiphy: the wireless device to get extra limits for 750 * 751 * Some devices may have extra limitations specified in DT. This may be useful 752 * for chipsets that normally support more bands but are limited due to board 753 * design (e.g. by antennas or external power amplifier). 754 * 755 * This function reads info from DT and uses it to *modify* channels (disable 756 * unavailable ones). It's usually a *bad* idea to use it in drivers with 757 * shared channel data as DT limitations are device specific. You should make 758 * sure to call it only if channels in wiphy are copied and can be modified 759 * without affecting other devices. 760 * 761 * As this function access device node it has to be called after set_wiphy_dev. 762 * It also modifies channels so they have to be set first. 763 * If using this helper, call it before wiphy_register(). 764 */ 765 #ifdef CONFIG_OF 766 void wiphy_read_of_freq_limits(struct wiphy *wiphy); 767 #else /* CONFIG_OF */ 768 static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy) 769 { 770 } 771 #endif /* !CONFIG_OF */ 772 773 774 /* 775 * Wireless hardware/device configuration structures and methods 776 */ 777 778 /** 779 * DOC: Actions and configuration 780 * 781 * Each wireless device and each virtual interface offer a set of configuration 782 * operations and other actions that are invoked by userspace. Each of these 783 * actions is described in the operations structure, and the parameters these 784 * operations use are described separately. 785 * 786 * Additionally, some operations are asynchronous and expect to get status 787 * information via some functions that drivers need to call. 788 * 789 * Scanning and BSS list handling with its associated functionality is described 790 * in a separate chapter. 791 */ 792 793 #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\ 794 WLAN_USER_POSITION_LEN) 795 796 /** 797 * struct vif_params - describes virtual interface parameters 798 * @flags: monitor interface flags, unchanged if 0, otherwise 799 * %MONITOR_FLAG_CHANGED will be set 800 * @use_4addr: use 4-address frames 801 * @macaddr: address to use for this virtual interface. 802 * If this parameter is set to zero address the driver may 803 * determine the address as needed. 804 * This feature is only fully supported by drivers that enable the 805 * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating 806 ** only p2p devices with specified MAC. 807 * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets 808 * belonging to that MU-MIMO groupID; %NULL if not changed 809 * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring 810 * MU-MIMO packets going to the specified station; %NULL if not changed 811 */ 812 struct vif_params { 813 u32 flags; 814 int use_4addr; 815 u8 macaddr[ETH_ALEN]; 816 const u8 *vht_mumimo_groups; 817 const u8 *vht_mumimo_follow_addr; 818 }; 819 820 /** 821 * struct key_params - key information 822 * 823 * Information about a key 824 * 825 * @key: key material 826 * @key_len: length of key material 827 * @cipher: cipher suite selector 828 * @seq: sequence counter (IV/PN), must be in little endian, 829 * length given by @seq_len. 830 * @seq_len: length of @seq. 831 * @vlan_id: vlan_id for VLAN group key (if nonzero) 832 * @mode: key install mode (RX_TX, NO_TX or SET_TX) 833 */ 834 struct key_params { 835 const u8 *key; 836 const u8 *seq; 837 int key_len; 838 int seq_len; 839 u16 vlan_id; 840 u32 cipher; 841 enum nl80211_key_mode mode; 842 }; 843 844 /** 845 * struct cfg80211_chan_def - channel definition 846 * @chan: the (control) channel 847 * @width: channel width 848 * @center_freq1: center frequency of first segment 849 * @center_freq2: center frequency of second segment 850 * (only with 80+80 MHz) 851 * @edmg: define the EDMG channels configuration. 852 * If edmg is requested (i.e. the .channels member is non-zero), 853 * chan will define the primary channel and all other 854 * parameters are ignored. 855 * @freq1_offset: offset from @center_freq1, in KHz 856 * @punctured: mask of the punctured 20 MHz subchannels, with 857 * bits turned on being disabled (punctured); numbered 858 * from lower to higher frequency (like in the spec) 859 * @s1g_primary_2mhz: Indicates if the control channel pointed to 860 * by 'chan' exists as a 1MHz primary subchannel within an 861 * S1G 2MHz primary channel. 862 */ 863 struct cfg80211_chan_def { 864 struct ieee80211_channel *chan; 865 enum nl80211_chan_width width; 866 u32 center_freq1; 867 u32 center_freq2; 868 struct ieee80211_edmg edmg; 869 u16 freq1_offset; 870 u16 punctured; 871 bool s1g_primary_2mhz; 872 }; 873 874 /* 875 * cfg80211_bitrate_mask - masks for bitrate control 876 */ 877 struct cfg80211_bitrate_mask { 878 struct { 879 u32 legacy; 880 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 881 u16 vht_mcs[NL80211_VHT_NSS_MAX]; 882 u16 he_mcs[NL80211_HE_NSS_MAX]; 883 u16 eht_mcs[NL80211_EHT_NSS_MAX]; 884 enum nl80211_txrate_gi gi; 885 enum nl80211_he_gi he_gi; 886 enum nl80211_eht_gi eht_gi; 887 enum nl80211_he_ltf he_ltf; 888 enum nl80211_eht_ltf eht_ltf; 889 } control[NUM_NL80211_BANDS]; 890 }; 891 892 893 /** 894 * struct cfg80211_tid_cfg - TID specific configuration 895 * @config_override: Flag to notify driver to reset TID configuration 896 * of the peer. 897 * @tids: bitmap of TIDs to modify 898 * @mask: bitmap of attributes indicating which parameter changed, 899 * similar to &nl80211_tid_config_supp. 900 * @noack: noack configuration value for the TID 901 * @retry_long: retry count value 902 * @retry_short: retry count value 903 * @ampdu: Enable/Disable MPDU aggregation 904 * @rtscts: Enable/Disable RTS/CTS 905 * @amsdu: Enable/Disable MSDU aggregation 906 * @txrate_type: Tx bitrate mask type 907 * @txrate_mask: Tx bitrate to be applied for the TID 908 */ 909 struct cfg80211_tid_cfg { 910 bool config_override; 911 u8 tids; 912 u64 mask; 913 enum nl80211_tid_config noack; 914 u8 retry_long, retry_short; 915 enum nl80211_tid_config ampdu; 916 enum nl80211_tid_config rtscts; 917 enum nl80211_tid_config amsdu; 918 enum nl80211_tx_rate_setting txrate_type; 919 struct cfg80211_bitrate_mask txrate_mask; 920 }; 921 922 /** 923 * struct cfg80211_tid_config - TID configuration 924 * @peer: Station's MAC address 925 * @n_tid_conf: Number of TID specific configurations to be applied 926 * @tid_conf: Configuration change info 927 */ 928 struct cfg80211_tid_config { 929 const u8 *peer; 930 u32 n_tid_conf; 931 struct cfg80211_tid_cfg tid_conf[] __counted_by(n_tid_conf); 932 }; 933 934 /** 935 * struct cfg80211_fils_aad - FILS AAD data 936 * @macaddr: STA MAC address 937 * @kek: FILS KEK 938 * @kek_len: FILS KEK length 939 * @snonce: STA Nonce 940 * @anonce: AP Nonce 941 */ 942 struct cfg80211_fils_aad { 943 const u8 *macaddr; 944 const u8 *kek; 945 u8 kek_len; 946 const u8 *snonce; 947 const u8 *anonce; 948 }; 949 950 /** 951 * struct cfg80211_set_hw_timestamp - enable/disable HW timestamping 952 * @macaddr: peer MAC address. NULL to enable/disable HW timestamping for all 953 * addresses. 954 * @enable: if set, enable HW timestamping for the specified MAC address. 955 * Otherwise disable HW timestamping for the specified MAC address. 956 */ 957 struct cfg80211_set_hw_timestamp { 958 const u8 *macaddr; 959 bool enable; 960 }; 961 962 /** 963 * cfg80211_get_chandef_type - return old channel type from chandef 964 * @chandef: the channel definition 965 * 966 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given 967 * chandef, which must have a bandwidth allowing this conversion. 968 */ 969 static inline enum nl80211_channel_type 970 cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef) 971 { 972 switch (chandef->width) { 973 case NL80211_CHAN_WIDTH_20_NOHT: 974 return NL80211_CHAN_NO_HT; 975 case NL80211_CHAN_WIDTH_20: 976 return NL80211_CHAN_HT20; 977 case NL80211_CHAN_WIDTH_40: 978 if (chandef->center_freq1 > chandef->chan->center_freq) 979 return NL80211_CHAN_HT40PLUS; 980 return NL80211_CHAN_HT40MINUS; 981 default: 982 WARN_ON(1); 983 return NL80211_CHAN_NO_HT; 984 } 985 } 986 987 /** 988 * cfg80211_chandef_create - create channel definition using channel type 989 * @chandef: the channel definition struct to fill 990 * @channel: the control channel 991 * @chantype: the channel type 992 * 993 * Given a channel type, create a channel definition. 994 */ 995 void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 996 struct ieee80211_channel *channel, 997 enum nl80211_channel_type chantype); 998 999 /** 1000 * cfg80211_chandef_identical - check if two channel definitions are identical 1001 * @chandef1: first channel definition 1002 * @chandef2: second channel definition 1003 * 1004 * Return: %true if the channels defined by the channel definitions are 1005 * identical, %false otherwise. 1006 */ 1007 static inline bool 1008 cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1, 1009 const struct cfg80211_chan_def *chandef2) 1010 { 1011 return (chandef1->chan == chandef2->chan && 1012 chandef1->width == chandef2->width && 1013 chandef1->center_freq1 == chandef2->center_freq1 && 1014 chandef1->freq1_offset == chandef2->freq1_offset && 1015 chandef1->center_freq2 == chandef2->center_freq2 && 1016 chandef1->punctured == chandef2->punctured && 1017 chandef1->s1g_primary_2mhz == chandef2->s1g_primary_2mhz); 1018 } 1019 1020 /** 1021 * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel 1022 * 1023 * @chandef: the channel definition 1024 * 1025 * Return: %true if EDMG defined, %false otherwise. 1026 */ 1027 static inline bool 1028 cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef) 1029 { 1030 return chandef->edmg.channels || chandef->edmg.bw_config; 1031 } 1032 1033 /** 1034 * cfg80211_chandef_is_s1g - check if chandef represents an S1G channel 1035 * @chandef: the channel definition 1036 * 1037 * Return: %true if S1G. 1038 */ 1039 static inline bool 1040 cfg80211_chandef_is_s1g(const struct cfg80211_chan_def *chandef) 1041 { 1042 return chandef->chan->band == NL80211_BAND_S1GHZ; 1043 } 1044 1045 /** 1046 * cfg80211_chandef_compatible - check if two channel definitions are compatible 1047 * @chandef1: first channel definition 1048 * @chandef2: second channel definition 1049 * 1050 * Return: %NULL if the given channel definitions are incompatible, 1051 * chandef1 or chandef2 otherwise. 1052 */ 1053 const struct cfg80211_chan_def * 1054 cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, 1055 const struct cfg80211_chan_def *chandef2); 1056 1057 1058 /** 1059 * nl80211_chan_width_to_mhz - get the channel width in MHz 1060 * @chan_width: the channel width from &enum nl80211_chan_width 1061 * 1062 * Return: channel width in MHz if the chan_width from &enum nl80211_chan_width 1063 * is valid. -1 otherwise. 1064 */ 1065 int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width); 1066 1067 /** 1068 * cfg80211_chandef_get_width - return chandef width in MHz 1069 * @c: chandef to return bandwidth for 1070 * Return: channel width in MHz for the given chandef; note that it returns 1071 * 80 for 80+80 configurations 1072 */ 1073 static inline int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c) 1074 { 1075 return nl80211_chan_width_to_mhz(c->width); 1076 } 1077 1078 /** 1079 * cfg80211_chandef_valid - check if a channel definition is valid 1080 * @chandef: the channel definition to check 1081 * Return: %true if the channel definition is valid. %false otherwise. 1082 */ 1083 bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 1084 1085 /** 1086 * cfg80211_chandef_usable - check if secondary channels can be used 1087 * @wiphy: the wiphy to validate against 1088 * @chandef: the channel definition to check 1089 * @prohibited_flags: the regulatory channel flags that must not be set 1090 * Return: %true if secondary channels are usable. %false otherwise. 1091 */ 1092 bool cfg80211_chandef_usable(struct wiphy *wiphy, 1093 const struct cfg80211_chan_def *chandef, 1094 u32 prohibited_flags); 1095 1096 /** 1097 * cfg80211_chandef_dfs_required - checks if radar detection is required 1098 * @wiphy: the wiphy to validate against 1099 * @chandef: the channel definition to check 1100 * @iftype: the interface type as specified in &enum nl80211_iftype 1101 * Returns: 1102 * 1 if radar detection is required, 0 if it is not, < 0 on error 1103 */ 1104 int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 1105 const struct cfg80211_chan_def *chandef, 1106 enum nl80211_iftype iftype); 1107 1108 /** 1109 * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable and we 1110 * can/need start CAC on such channel 1111 * @wiphy: the wiphy to validate against 1112 * @chandef: the channel definition to check 1113 * 1114 * Return: true if all channels available and at least 1115 * one channel requires CAC (NL80211_DFS_USABLE) 1116 */ 1117 bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy, 1118 const struct cfg80211_chan_def *chandef); 1119 1120 /** 1121 * cfg80211_chandef_dfs_cac_time - get the DFS CAC time (in ms) for given 1122 * channel definition 1123 * @wiphy: the wiphy to validate against 1124 * @chandef: the channel definition to check 1125 * 1126 * Returns: DFS CAC time (in ms) which applies for this channel definition 1127 */ 1128 unsigned int 1129 cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, 1130 const struct cfg80211_chan_def *chandef); 1131 1132 /** 1133 * cfg80211_chandef_primary - calculate primary 40/80/160 MHz freq 1134 * @chandef: chandef to calculate for 1135 * @primary_chan_width: primary channel width to calculate center for 1136 * @punctured: punctured sub-channel bitmap, will be recalculated 1137 * according to the new bandwidth, can be %NULL 1138 * 1139 * Returns: the primary 40/80/160 MHz channel center frequency, or -1 1140 * for errors, updating the punctured bitmap 1141 */ 1142 int cfg80211_chandef_primary(const struct cfg80211_chan_def *chandef, 1143 enum nl80211_chan_width primary_chan_width, 1144 u16 *punctured); 1145 1146 /** 1147 * nl80211_send_chandef - sends the channel definition. 1148 * @msg: the msg to send channel definition 1149 * @chandef: the channel definition to check 1150 * 1151 * Returns: 0 if sent the channel definition to msg, < 0 on error 1152 **/ 1153 int nl80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *chandef); 1154 1155 /** 1156 * ieee80211_chandef_max_power - maximum transmission power for the chandef 1157 * 1158 * In some regulations, the transmit power may depend on the configured channel 1159 * bandwidth which may be defined as dBm/MHz. This function returns the actual 1160 * max_power for non-standard (20 MHz) channels. 1161 * 1162 * @chandef: channel definition for the channel 1163 * 1164 * Returns: maximum allowed transmission power in dBm for the chandef 1165 */ 1166 static inline int 1167 ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef) 1168 { 1169 switch (chandef->width) { 1170 case NL80211_CHAN_WIDTH_5: 1171 return min(chandef->chan->max_reg_power - 6, 1172 chandef->chan->max_power); 1173 case NL80211_CHAN_WIDTH_10: 1174 return min(chandef->chan->max_reg_power - 3, 1175 chandef->chan->max_power); 1176 default: 1177 break; 1178 } 1179 return chandef->chan->max_power; 1180 } 1181 1182 /** 1183 * cfg80211_any_usable_channels - check for usable channels 1184 * @wiphy: the wiphy to check for 1185 * @band_mask: which bands to check on 1186 * @prohibited_flags: which channels to not consider usable, 1187 * %IEEE80211_CHAN_DISABLED is always taken into account 1188 * 1189 * Return: %true if usable channels found, %false otherwise 1190 */ 1191 bool cfg80211_any_usable_channels(struct wiphy *wiphy, 1192 unsigned long band_mask, 1193 u32 prohibited_flags); 1194 1195 /** 1196 * enum survey_info_flags - survey information flags 1197 * 1198 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 1199 * @SURVEY_INFO_IN_USE: channel is currently being used 1200 * @SURVEY_INFO_TIME: active time (in ms) was filled in 1201 * @SURVEY_INFO_TIME_BUSY: busy time was filled in 1202 * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in 1203 * @SURVEY_INFO_TIME_RX: receive time was filled in 1204 * @SURVEY_INFO_TIME_TX: transmit time was filled in 1205 * @SURVEY_INFO_TIME_SCAN: scan time was filled in 1206 * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in 1207 * 1208 * Used by the driver to indicate which info in &struct survey_info 1209 * it has filled in during the get_survey(). 1210 */ 1211 enum survey_info_flags { 1212 SURVEY_INFO_NOISE_DBM = BIT(0), 1213 SURVEY_INFO_IN_USE = BIT(1), 1214 SURVEY_INFO_TIME = BIT(2), 1215 SURVEY_INFO_TIME_BUSY = BIT(3), 1216 SURVEY_INFO_TIME_EXT_BUSY = BIT(4), 1217 SURVEY_INFO_TIME_RX = BIT(5), 1218 SURVEY_INFO_TIME_TX = BIT(6), 1219 SURVEY_INFO_TIME_SCAN = BIT(7), 1220 SURVEY_INFO_TIME_BSS_RX = BIT(8), 1221 }; 1222 1223 /** 1224 * struct survey_info - channel survey response 1225 * 1226 * @channel: the channel this survey record reports, may be %NULL for a single 1227 * record to report global statistics 1228 * @filled: bitflag of flags from &enum survey_info_flags 1229 * @noise: channel noise in dBm. This and all following fields are 1230 * optional 1231 * @time: amount of time in ms the radio was turn on (on the channel) 1232 * @time_busy: amount of time the primary channel was sensed busy 1233 * @time_ext_busy: amount of time the extension channel was sensed busy 1234 * @time_rx: amount of time the radio spent receiving data 1235 * @time_tx: amount of time the radio spent transmitting data 1236 * @time_scan: amount of time the radio spent for scanning 1237 * @time_bss_rx: amount of time the radio spent receiving data on a local BSS 1238 * 1239 * Used by dump_survey() to report back per-channel survey information. 1240 * 1241 * This structure can later be expanded with things like 1242 * channel duty cycle etc. 1243 */ 1244 struct survey_info { 1245 struct ieee80211_channel *channel; 1246 u64 time; 1247 u64 time_busy; 1248 u64 time_ext_busy; 1249 u64 time_rx; 1250 u64 time_tx; 1251 u64 time_scan; 1252 u64 time_bss_rx; 1253 u32 filled; 1254 s8 noise; 1255 }; 1256 1257 #define CFG80211_MAX_NUM_AKM_SUITES 10 1258 1259 /** 1260 * struct cfg80211_crypto_settings - Crypto settings 1261 * @wpa_versions: indicates which, if any, WPA versions are enabled 1262 * (from enum nl80211_wpa_versions) 1263 * @cipher_group: group key cipher suite (or 0 if unset) 1264 * @n_ciphers_pairwise: number of AP supported unicast ciphers 1265 * @ciphers_pairwise: unicast key cipher suites 1266 * @n_akm_suites: number of AKM suites 1267 * @akm_suites: AKM suites 1268 * @control_port: Whether user space controls IEEE 802.1X port, i.e., 1269 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1270 * required to assume that the port is unauthorized until authorized by 1271 * user space. Otherwise, port is marked authorized by default. 1272 * @control_port_ethertype: the control port protocol that should be 1273 * allowed through even on unauthorized ports 1274 * @control_port_no_encrypt: TRUE to prevent encryption of control port 1275 * protocol frames. 1276 * @control_port_over_nl80211: TRUE if userspace expects to exchange control 1277 * port frames over NL80211 instead of the network interface. 1278 * @control_port_no_preauth: disables pre-auth rx over the nl80211 control 1279 * port for mac80211 1280 * @psk: PSK (for devices supporting 4-way-handshake offload) 1281 * @sae_pwd: password for SAE authentication (for devices supporting SAE 1282 * offload) 1283 * @sae_pwd_len: length of SAE password (for devices supporting SAE offload) 1284 * @sae_pwe: The mechanisms allowed for SAE PWE derivation: 1285 * 1286 * NL80211_SAE_PWE_UNSPECIFIED 1287 * Not-specified, used to indicate userspace did not specify any 1288 * preference. The driver should follow its internal policy in 1289 * such a scenario. 1290 * 1291 * NL80211_SAE_PWE_HUNT_AND_PECK 1292 * Allow hunting-and-pecking loop only 1293 * 1294 * NL80211_SAE_PWE_HASH_TO_ELEMENT 1295 * Allow hash-to-element only 1296 * 1297 * NL80211_SAE_PWE_BOTH 1298 * Allow either hunting-and-pecking loop or hash-to-element 1299 */ 1300 struct cfg80211_crypto_settings { 1301 u32 wpa_versions; 1302 u32 cipher_group; 1303 int n_ciphers_pairwise; 1304 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 1305 int n_akm_suites; 1306 u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES]; 1307 bool control_port; 1308 __be16 control_port_ethertype; 1309 bool control_port_no_encrypt; 1310 bool control_port_over_nl80211; 1311 bool control_port_no_preauth; 1312 const u8 *psk; 1313 const u8 *sae_pwd; 1314 u8 sae_pwd_len; 1315 enum nl80211_sae_pwe_mechanism sae_pwe; 1316 }; 1317 1318 /** 1319 * struct cfg80211_mbssid_config - AP settings for multi bssid 1320 * 1321 * @tx_wdev: pointer to the transmitted interface in the MBSSID set 1322 * @tx_link_id: link ID of the transmitted profile in an MLD. 1323 * @index: index of this AP in the multi bssid group. 1324 * @ema: set to true if the beacons should be sent out in EMA mode. 1325 */ 1326 struct cfg80211_mbssid_config { 1327 struct wireless_dev *tx_wdev; 1328 u8 tx_link_id; 1329 u8 index; 1330 bool ema; 1331 }; 1332 1333 /** 1334 * struct cfg80211_mbssid_elems - Multiple BSSID elements 1335 * 1336 * @cnt: Number of elements in array %elems. 1337 * 1338 * @elem: Array of multiple BSSID element(s) to be added into Beacon frames. 1339 * @elem.data: Data for multiple BSSID elements. 1340 * @elem.len: Length of data. 1341 */ 1342 struct cfg80211_mbssid_elems { 1343 u8 cnt; 1344 struct { 1345 const u8 *data; 1346 size_t len; 1347 } elem[] __counted_by(cnt); 1348 }; 1349 1350 /** 1351 * struct cfg80211_rnr_elems - Reduced neighbor report (RNR) elements 1352 * 1353 * @cnt: Number of elements in array %elems. 1354 * 1355 * @elem: Array of RNR element(s) to be added into Beacon frames. 1356 * @elem.data: Data for RNR elements. 1357 * @elem.len: Length of data. 1358 */ 1359 struct cfg80211_rnr_elems { 1360 u8 cnt; 1361 struct { 1362 const u8 *data; 1363 size_t len; 1364 } elem[] __counted_by(cnt); 1365 }; 1366 1367 /** 1368 * struct cfg80211_beacon_data - beacon data 1369 * @link_id: the link ID for the AP MLD link sending this beacon 1370 * @head: head portion of beacon (before TIM IE) 1371 * or %NULL if not changed 1372 * @tail: tail portion of beacon (after TIM IE) 1373 * or %NULL if not changed 1374 * @head_len: length of @head 1375 * @tail_len: length of @tail 1376 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 1377 * @beacon_ies_len: length of beacon_ies in octets 1378 * @proberesp_ies: extra information element(s) to add into Probe Response 1379 * frames or %NULL 1380 * @proberesp_ies_len: length of proberesp_ies in octets 1381 * @assocresp_ies: extra information element(s) to add into (Re)Association 1382 * Response frames or %NULL 1383 * @assocresp_ies_len: length of assocresp_ies in octets 1384 * @probe_resp_len: length of probe response template (@probe_resp) 1385 * @probe_resp: probe response template (AP mode only) 1386 * @mbssid_ies: multiple BSSID elements 1387 * @rnr_ies: reduced neighbor report elements 1388 * @ftm_responder: enable FTM responder functionality; -1 for no change 1389 * (which also implies no change in LCI/civic location data) 1390 * @lci: Measurement Report element content, starting with Measurement Token 1391 * (measurement type 8) 1392 * @civicloc: Measurement Report element content, starting with Measurement 1393 * Token (measurement type 11) 1394 * @lci_len: LCI data length 1395 * @civicloc_len: Civic location data length 1396 * @he_bss_color: BSS Color settings 1397 * @he_bss_color_valid: indicates whether bss color 1398 * attribute is present in beacon data or not. 1399 */ 1400 struct cfg80211_beacon_data { 1401 unsigned int link_id; 1402 1403 const u8 *head, *tail; 1404 const u8 *beacon_ies; 1405 const u8 *proberesp_ies; 1406 const u8 *assocresp_ies; 1407 const u8 *probe_resp; 1408 const u8 *lci; 1409 const u8 *civicloc; 1410 struct cfg80211_mbssid_elems *mbssid_ies; 1411 struct cfg80211_rnr_elems *rnr_ies; 1412 s8 ftm_responder; 1413 1414 size_t head_len, tail_len; 1415 size_t beacon_ies_len; 1416 size_t proberesp_ies_len; 1417 size_t assocresp_ies_len; 1418 size_t probe_resp_len; 1419 size_t lci_len; 1420 size_t civicloc_len; 1421 struct cfg80211_he_bss_color he_bss_color; 1422 bool he_bss_color_valid; 1423 }; 1424 1425 struct mac_address { 1426 u8 addr[ETH_ALEN]; 1427 }; 1428 1429 /** 1430 * struct cfg80211_acl_data - Access control list data 1431 * 1432 * @acl_policy: ACL policy to be applied on the station's 1433 * entry specified by mac_addr 1434 * @n_acl_entries: Number of MAC address entries passed 1435 * @mac_addrs: List of MAC addresses of stations to be used for ACL 1436 */ 1437 struct cfg80211_acl_data { 1438 enum nl80211_acl_policy acl_policy; 1439 int n_acl_entries; 1440 1441 /* Keep it last */ 1442 struct mac_address mac_addrs[] __counted_by(n_acl_entries); 1443 }; 1444 1445 /** 1446 * struct cfg80211_fils_discovery - FILS discovery parameters from 1447 * IEEE Std 802.11ai-2016, Annex C.3 MIB detail. 1448 * 1449 * @update: Set to true if the feature configuration should be updated. 1450 * @min_interval: Minimum packet interval in TUs (0 - 10000) 1451 * @max_interval: Maximum packet interval in TUs (0 - 10000) 1452 * @tmpl_len: Template length 1453 * @tmpl: Template data for FILS discovery frame including the action 1454 * frame headers. 1455 */ 1456 struct cfg80211_fils_discovery { 1457 bool update; 1458 u32 min_interval; 1459 u32 max_interval; 1460 size_t tmpl_len; 1461 const u8 *tmpl; 1462 }; 1463 1464 /** 1465 * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe 1466 * response parameters in 6GHz. 1467 * 1468 * @update: Set to true if the feature configuration should be updated. 1469 * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned 1470 * in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive 1471 * scanning 1472 * @tmpl_len: Template length 1473 * @tmpl: Template data for probe response 1474 */ 1475 struct cfg80211_unsol_bcast_probe_resp { 1476 bool update; 1477 u32 interval; 1478 size_t tmpl_len; 1479 const u8 *tmpl; 1480 }; 1481 1482 /** 1483 * struct cfg80211_s1g_short_beacon - S1G short beacon data. 1484 * 1485 * @update: Set to true if the feature configuration should be updated. 1486 * @short_head: Short beacon head. 1487 * @short_tail: Short beacon tail. 1488 * @short_head_len: Short beacon head len. 1489 * @short_tail_len: Short beacon tail len. 1490 */ 1491 struct cfg80211_s1g_short_beacon { 1492 bool update; 1493 const u8 *short_head; 1494 const u8 *short_tail; 1495 size_t short_head_len; 1496 size_t short_tail_len; 1497 }; 1498 1499 /** 1500 * struct cfg80211_ap_settings - AP configuration 1501 * 1502 * Used to configure an AP interface. 1503 * 1504 * @chandef: defines the channel to use 1505 * @beacon: beacon data 1506 * @beacon_interval: beacon interval 1507 * @dtim_period: DTIM period 1508 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 1509 * user space) 1510 * @ssid_len: length of @ssid 1511 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 1512 * @crypto: crypto settings 1513 * @privacy: the BSS uses privacy 1514 * @auth_type: Authentication type (algorithm) 1515 * @inactivity_timeout: time in seconds to determine station's inactivity. 1516 * @p2p_ctwindow: P2P CT Window 1517 * @p2p_opp_ps: P2P opportunistic PS 1518 * @acl: ACL configuration used by the drivers which has support for 1519 * MAC address based access control 1520 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG 1521 * networks. 1522 * @beacon_rate: bitrate to be used for beacons 1523 * @ht_cap: HT capabilities (or %NULL if HT isn't enabled) 1524 * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled) 1525 * @he_cap: HE capabilities (or %NULL if HE isn't enabled) 1526 * @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled) 1527 * @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled) 1528 * @uhr_oper: UHR operation (or %NULL if UHR isn't enabled) 1529 * @ht_required: stations must support HT 1530 * @vht_required: stations must support VHT 1531 * @twt_responder: Enable Target Wait Time 1532 * @he_required: stations must support HE 1533 * @sae_h2e_required: stations must support direct H2E technique in SAE 1534 * @flags: flags, as defined in &enum nl80211_ap_settings_flags 1535 * @he_obss_pd: OBSS Packet Detection settings 1536 * @he_oper: HE operation IE (or %NULL if HE isn't enabled) 1537 * @fils_discovery: FILS discovery transmission parameters 1538 * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters 1539 * @mbssid_config: AP settings for multiple bssid 1540 * @s1g_long_beacon_period: S1G long beacon period 1541 * @s1g_short_beacon: S1G short beacon data 1542 */ 1543 struct cfg80211_ap_settings { 1544 struct cfg80211_chan_def chandef; 1545 1546 struct cfg80211_beacon_data beacon; 1547 1548 int beacon_interval, dtim_period; 1549 const u8 *ssid; 1550 size_t ssid_len; 1551 enum nl80211_hidden_ssid hidden_ssid; 1552 struct cfg80211_crypto_settings crypto; 1553 bool privacy; 1554 enum nl80211_auth_type auth_type; 1555 int inactivity_timeout; 1556 u8 p2p_ctwindow; 1557 bool p2p_opp_ps; 1558 const struct cfg80211_acl_data *acl; 1559 bool pbss; 1560 struct cfg80211_bitrate_mask beacon_rate; 1561 1562 const struct ieee80211_ht_cap *ht_cap; 1563 const struct ieee80211_vht_cap *vht_cap; 1564 const struct ieee80211_he_cap_elem *he_cap; 1565 const struct ieee80211_he_operation *he_oper; 1566 const struct ieee80211_eht_cap_elem *eht_cap; 1567 const struct ieee80211_eht_operation *eht_oper; 1568 const struct ieee80211_uhr_operation *uhr_oper; 1569 bool ht_required, vht_required, he_required, sae_h2e_required; 1570 bool twt_responder; 1571 u32 flags; 1572 struct ieee80211_he_obss_pd he_obss_pd; 1573 struct cfg80211_fils_discovery fils_discovery; 1574 struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; 1575 struct cfg80211_mbssid_config mbssid_config; 1576 u8 s1g_long_beacon_period; 1577 struct cfg80211_s1g_short_beacon s1g_short_beacon; 1578 }; 1579 1580 1581 /** 1582 * struct cfg80211_ap_update - AP configuration update 1583 * 1584 * Subset of &struct cfg80211_ap_settings, for updating a running AP. 1585 * 1586 * @beacon: beacon data 1587 * @fils_discovery: FILS discovery transmission parameters 1588 * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters 1589 * @s1g_short_beacon: S1G short beacon data 1590 */ 1591 struct cfg80211_ap_update { 1592 struct cfg80211_beacon_data beacon; 1593 struct cfg80211_fils_discovery fils_discovery; 1594 struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; 1595 struct cfg80211_s1g_short_beacon s1g_short_beacon; 1596 }; 1597 1598 /** 1599 * struct cfg80211_csa_settings - channel switch settings 1600 * 1601 * Used for channel switch 1602 * 1603 * @chandef: defines the channel to use after the switch 1604 * @beacon_csa: beacon data while performing the switch 1605 * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 1606 * @counter_offsets_presp: offsets of the counters within the probe response 1607 * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 1608 * @n_counter_offsets_presp: number of csa counters in the probe response 1609 * @beacon_after: beacon data to be used on the new channel 1610 * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters 1611 * @radar_required: whether radar detection is required on the new channel 1612 * @block_tx: whether transmissions should be blocked while changing 1613 * @count: number of beacons until switch 1614 * @link_id: defines the link on which channel switch is expected during 1615 * MLO. 0 in case of non-MLO. 1616 */ 1617 struct cfg80211_csa_settings { 1618 struct cfg80211_chan_def chandef; 1619 struct cfg80211_beacon_data beacon_csa; 1620 const u16 *counter_offsets_beacon; 1621 const u16 *counter_offsets_presp; 1622 unsigned int n_counter_offsets_beacon; 1623 unsigned int n_counter_offsets_presp; 1624 struct cfg80211_beacon_data beacon_after; 1625 struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; 1626 bool radar_required; 1627 bool block_tx; 1628 u8 count; 1629 u8 link_id; 1630 }; 1631 1632 /** 1633 * struct cfg80211_color_change_settings - color change settings 1634 * 1635 * Used for bss color change 1636 * 1637 * @beacon_color_change: beacon data while performing the color countdown 1638 * @counter_offset_beacon: offsets of the counters within the beacon (tail) 1639 * @counter_offset_presp: offsets of the counters within the probe response 1640 * @beacon_next: beacon data to be used after the color change 1641 * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters 1642 * @count: number of beacons until the color change 1643 * @color: the color used after the change 1644 * @link_id: defines the link on which color change is expected during MLO. 1645 * 0 in case of non-MLO. 1646 */ 1647 struct cfg80211_color_change_settings { 1648 struct cfg80211_beacon_data beacon_color_change; 1649 u16 counter_offset_beacon; 1650 u16 counter_offset_presp; 1651 struct cfg80211_beacon_data beacon_next; 1652 struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; 1653 u8 count; 1654 u8 color; 1655 u8 link_id; 1656 }; 1657 1658 /** 1659 * struct iface_combination_params - input parameters for interface combinations 1660 * 1661 * Used to pass interface combination parameters 1662 * 1663 * @radio_idx: wiphy radio index or -1 for global 1664 * @num_different_channels: the number of different channels we want 1665 * to use for verification 1666 * @radar_detect: a bitmap where each bit corresponds to a channel 1667 * width where radar detection is needed, as in the definition of 1668 * &struct ieee80211_iface_combination.@radar_detect_widths 1669 * @iftype_num: array with the number of interfaces of each interface 1670 * type. The index is the interface type as specified in &enum 1671 * nl80211_iftype. 1672 * @new_beacon_int: set this to the beacon interval of a new interface 1673 * that's not operating yet, if such is to be checked as part of 1674 * the verification 1675 */ 1676 struct iface_combination_params { 1677 int radio_idx; 1678 int num_different_channels; 1679 u8 radar_detect; 1680 int iftype_num[NUM_NL80211_IFTYPES]; 1681 u32 new_beacon_int; 1682 }; 1683 1684 /** 1685 * enum station_parameters_apply_mask - station parameter values to apply 1686 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 1687 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 1688 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 1689 * 1690 * Not all station parameters have in-band "no change" signalling, 1691 * for those that don't these flags will are used. 1692 */ 1693 enum station_parameters_apply_mask { 1694 STATION_PARAM_APPLY_UAPSD = BIT(0), 1695 STATION_PARAM_APPLY_CAPABILITY = BIT(1), 1696 STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 1697 }; 1698 1699 /** 1700 * struct sta_txpwr - station txpower configuration 1701 * 1702 * Used to configure txpower for station. 1703 * 1704 * @power: tx power (in dBm) to be used for sending data traffic. If tx power 1705 * is not provided, the default per-interface tx power setting will be 1706 * overriding. Driver should be picking up the lowest tx power, either tx 1707 * power per-interface or per-station. 1708 * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power 1709 * will be less than or equal to specified from userspace, whereas if TPC 1710 * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power. 1711 * NL80211_TX_POWER_FIXED is not a valid configuration option for 1712 * per peer TPC. 1713 */ 1714 struct sta_txpwr { 1715 s16 power; 1716 enum nl80211_tx_power_setting type; 1717 }; 1718 1719 /** 1720 * struct link_station_parameters - link station parameters 1721 * 1722 * Used to change and create a new link station. 1723 * 1724 * @mld_mac: MAC address of the station 1725 * @link_id: the link id (-1 for non-MLD station) 1726 * @link_mac: MAC address of the link 1727 * @supported_rates: supported rates in IEEE 802.11 format 1728 * (or NULL for no change) 1729 * @supported_rates_len: number of supported rates 1730 * @ht_capa: HT capabilities of station 1731 * @vht_capa: VHT capabilities of station 1732 * @opmode_notif: operating mode field from Operating Mode Notification 1733 * @opmode_notif_used: information if operating mode field is used 1734 * @he_capa: HE capabilities of station 1735 * @he_capa_len: the length of the HE capabilities 1736 * @txpwr: transmit power for an associated station 1737 * @txpwr_set: txpwr field is set 1738 * @he_6ghz_capa: HE 6 GHz Band capabilities of station 1739 * @eht_capa: EHT capabilities of station 1740 * @eht_capa_len: the length of the EHT capabilities 1741 * @s1g_capa: S1G capabilities of station 1742 * @uhr_capa: UHR capabilities of the station 1743 * @uhr_capa_len: the length of the UHR capabilities 1744 */ 1745 struct link_station_parameters { 1746 const u8 *mld_mac; 1747 int link_id; 1748 const u8 *link_mac; 1749 const u8 *supported_rates; 1750 u8 supported_rates_len; 1751 const struct ieee80211_ht_cap *ht_capa; 1752 const struct ieee80211_vht_cap *vht_capa; 1753 u8 opmode_notif; 1754 bool opmode_notif_used; 1755 const struct ieee80211_he_cap_elem *he_capa; 1756 u8 he_capa_len; 1757 struct sta_txpwr txpwr; 1758 bool txpwr_set; 1759 const struct ieee80211_he_6ghz_capa *he_6ghz_capa; 1760 const struct ieee80211_eht_cap_elem *eht_capa; 1761 u8 eht_capa_len; 1762 const struct ieee80211_s1g_cap *s1g_capa; 1763 const struct ieee80211_uhr_cap *uhr_capa; 1764 u8 uhr_capa_len; 1765 }; 1766 1767 /** 1768 * struct link_station_del_parameters - link station deletion parameters 1769 * 1770 * Used to delete a link station entry (or all stations). 1771 * 1772 * @mld_mac: MAC address of the station 1773 * @link_id: the link id 1774 */ 1775 struct link_station_del_parameters { 1776 const u8 *mld_mac; 1777 u32 link_id; 1778 }; 1779 1780 /** 1781 * struct cfg80211_ttlm_params: TID to link mapping parameters 1782 * 1783 * Used for setting a TID to link mapping. 1784 * 1785 * @dlink: Downlink TID to link mapping, as defined in section 9.4.2.314 1786 * (TID-To-Link Mapping element) in Draft P802.11be_D4.0. 1787 * @ulink: Uplink TID to link mapping, as defined in section 9.4.2.314 1788 * (TID-To-Link Mapping element) in Draft P802.11be_D4.0. 1789 */ 1790 struct cfg80211_ttlm_params { 1791 u16 dlink[8]; 1792 u16 ulink[8]; 1793 }; 1794 1795 /** 1796 * struct station_parameters - station parameters 1797 * 1798 * Used to change and create a new station. 1799 * 1800 * @vlan: vlan interface station should belong to 1801 * @sta_flags_mask: station flags that changed 1802 * (bitmask of BIT(%NL80211_STA_FLAG_...)) 1803 * @sta_flags_set: station flags values 1804 * (bitmask of BIT(%NL80211_STA_FLAG_...)) 1805 * @listen_interval: listen interval or -1 for no change 1806 * @aid: AID or zero for no change 1807 * @vlan_id: VLAN ID for station (if nonzero) 1808 * @peer_aid: mesh peer AID or zero for no change 1809 * @plink_action: plink action to take 1810 * @plink_state: set the peer link state for a station 1811 * @uapsd_queues: bitmap of queues configured for uapsd. same format 1812 * as the AC bitmap in the QoS info field 1813 * @max_sp: max Service Period. same format as the MAX_SP in the 1814 * QoS info field (but already shifted down) 1815 * @sta_modify_mask: bitmap indicating which parameters changed 1816 * (for those that don't have a natural "no change" value), 1817 * see &enum station_parameters_apply_mask 1818 * @local_pm: local link-specific mesh power save mode (no change when set 1819 * to unknown) 1820 * @capability: station capability 1821 * @ext_capab: extended capabilities of the station 1822 * @ext_capab_len: number of extended capabilities 1823 * @supported_channels: supported channels in IEEE 802.11 format 1824 * @supported_channels_len: number of supported channels 1825 * @supported_oper_classes: supported oper classes in IEEE 802.11 format 1826 * @supported_oper_classes_len: number of supported operating classes 1827 * @support_p2p_ps: information if station supports P2P PS mechanism 1828 * @airtime_weight: airtime scheduler weight for this station 1829 * @eml_cap_present: Specifies if EML capabilities field (@eml_cap) is 1830 * present/updated 1831 * @eml_cap: EML capabilities of this station 1832 * @link_sta_params: link related params. 1833 * @epp_peer: EPP peer indication 1834 */ 1835 struct station_parameters { 1836 struct net_device *vlan; 1837 u32 sta_flags_mask, sta_flags_set; 1838 u32 sta_modify_mask; 1839 int listen_interval; 1840 u16 aid; 1841 u16 vlan_id; 1842 u16 peer_aid; 1843 u8 plink_action; 1844 u8 plink_state; 1845 u8 uapsd_queues; 1846 u8 max_sp; 1847 enum nl80211_mesh_power_mode local_pm; 1848 u16 capability; 1849 const u8 *ext_capab; 1850 u8 ext_capab_len; 1851 const u8 *supported_channels; 1852 u8 supported_channels_len; 1853 const u8 *supported_oper_classes; 1854 u8 supported_oper_classes_len; 1855 int support_p2p_ps; 1856 u16 airtime_weight; 1857 bool eml_cap_present; 1858 u16 eml_cap; 1859 struct link_station_parameters link_sta_params; 1860 bool epp_peer; 1861 }; 1862 1863 /** 1864 * struct station_del_parameters - station deletion parameters 1865 * 1866 * Used to delete a station entry (or all stations). 1867 * 1868 * @mac: MAC address of the station to remove or NULL to remove all stations 1869 * @subtype: Management frame subtype to use for indicating removal 1870 * (10 = Disassociation, 12 = Deauthentication) 1871 * @reason_code: Reason code for the Disassociation/Deauthentication frame 1872 * @link_id: Link ID indicating a link that stations to be flushed must be 1873 * using; valid only for MLO, but can also be -1 for MLO to really 1874 * remove all stations. 1875 */ 1876 struct station_del_parameters { 1877 const u8 *mac; 1878 u8 subtype; 1879 u16 reason_code; 1880 int link_id; 1881 }; 1882 1883 /** 1884 * enum cfg80211_station_type - the type of station being modified 1885 * @CFG80211_STA_AP_CLIENT: client of an AP interface 1886 * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still 1887 * unassociated (update properties for this type of client is permitted) 1888 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 1889 * the AP MLME in the device 1890 * @CFG80211_STA_AP_STA: AP station on managed interface 1891 * @CFG80211_STA_IBSS: IBSS station 1892 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 1893 * while TDLS setup is in progress, it moves out of this state when 1894 * being marked authorized; use this only if TDLS with external setup is 1895 * supported/used) 1896 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 1897 * entry that is operating, has been marked authorized by userspace) 1898 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 1899 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 1900 */ 1901 enum cfg80211_station_type { 1902 CFG80211_STA_AP_CLIENT, 1903 CFG80211_STA_AP_CLIENT_UNASSOC, 1904 CFG80211_STA_AP_MLME_CLIENT, 1905 CFG80211_STA_AP_STA, 1906 CFG80211_STA_IBSS, 1907 CFG80211_STA_TDLS_PEER_SETUP, 1908 CFG80211_STA_TDLS_PEER_ACTIVE, 1909 CFG80211_STA_MESH_PEER_KERNEL, 1910 CFG80211_STA_MESH_PEER_USER, 1911 }; 1912 1913 /** 1914 * cfg80211_check_station_change - validate parameter changes 1915 * @wiphy: the wiphy this operates on 1916 * @params: the new parameters for a station 1917 * @statype: the type of station being modified 1918 * 1919 * Utility function for the @change_station driver method. Call this function 1920 * with the appropriate station type looking up the station (and checking that 1921 * it exists). It will verify whether the station change is acceptable. 1922 * 1923 * Return: 0 if the change is acceptable, otherwise an error code. Note that 1924 * it may modify the parameters for backward compatibility reasons, so don't 1925 * use them before calling this. 1926 */ 1927 int cfg80211_check_station_change(struct wiphy *wiphy, 1928 struct station_parameters *params, 1929 enum cfg80211_station_type statype); 1930 1931 /** 1932 * enum rate_info_flags - bitrate info flags 1933 * 1934 * Used by the driver to indicate the specific rate transmission 1935 * type for 802.11n transmissions. 1936 * 1937 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 1938 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 1939 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 1940 * @RATE_INFO_FLAGS_DMG: 60GHz MCS 1941 * @RATE_INFO_FLAGS_HE_MCS: HE MCS information 1942 * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode 1943 * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS 1944 * @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information 1945 * @RATE_INFO_FLAGS_S1G_MCS: MCS field filled with S1G MCS 1946 * @RATE_INFO_FLAGS_UHR_MCS: UHR MCS information 1947 * @RATE_INFO_FLAGS_UHR_ELR_MCS: UHR ELR MCS was used 1948 * (set together with @RATE_INFO_FLAGS_UHR_MCS) 1949 * @RATE_INFO_FLAGS_UHR_IM: UHR Interference Mitigation 1950 * was used 1951 */ 1952 enum rate_info_flags { 1953 RATE_INFO_FLAGS_MCS = BIT(0), 1954 RATE_INFO_FLAGS_VHT_MCS = BIT(1), 1955 RATE_INFO_FLAGS_SHORT_GI = BIT(2), 1956 RATE_INFO_FLAGS_DMG = BIT(3), 1957 RATE_INFO_FLAGS_HE_MCS = BIT(4), 1958 RATE_INFO_FLAGS_EDMG = BIT(5), 1959 RATE_INFO_FLAGS_EXTENDED_SC_DMG = BIT(6), 1960 RATE_INFO_FLAGS_EHT_MCS = BIT(7), 1961 RATE_INFO_FLAGS_S1G_MCS = BIT(8), 1962 RATE_INFO_FLAGS_UHR_MCS = BIT(9), 1963 RATE_INFO_FLAGS_UHR_ELR_MCS = BIT(10), 1964 RATE_INFO_FLAGS_UHR_IM = BIT(11), 1965 }; 1966 1967 /** 1968 * enum rate_info_bw - rate bandwidth information 1969 * 1970 * Used by the driver to indicate the rate bandwidth. 1971 * 1972 * @RATE_INFO_BW_5: 5 MHz bandwidth 1973 * @RATE_INFO_BW_10: 10 MHz bandwidth 1974 * @RATE_INFO_BW_20: 20 MHz bandwidth 1975 * @RATE_INFO_BW_40: 40 MHz bandwidth 1976 * @RATE_INFO_BW_80: 80 MHz bandwidth 1977 * @RATE_INFO_BW_160: 160 MHz bandwidth 1978 * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation 1979 * @RATE_INFO_BW_320: 320 MHz bandwidth 1980 * @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT/UHR RU allocation 1981 * @RATE_INFO_BW_1: 1 MHz bandwidth 1982 * @RATE_INFO_BW_2: 2 MHz bandwidth 1983 * @RATE_INFO_BW_4: 4 MHz bandwidth 1984 * @RATE_INFO_BW_8: 8 MHz bandwidth 1985 * @RATE_INFO_BW_16: 16 MHz bandwidth 1986 */ 1987 enum rate_info_bw { 1988 RATE_INFO_BW_20 = 0, 1989 RATE_INFO_BW_5, 1990 RATE_INFO_BW_10, 1991 RATE_INFO_BW_40, 1992 RATE_INFO_BW_80, 1993 RATE_INFO_BW_160, 1994 RATE_INFO_BW_HE_RU, 1995 RATE_INFO_BW_320, 1996 RATE_INFO_BW_EHT_RU, 1997 RATE_INFO_BW_1, 1998 RATE_INFO_BW_2, 1999 RATE_INFO_BW_4, 2000 RATE_INFO_BW_8, 2001 RATE_INFO_BW_16, 2002 }; 2003 2004 /** 2005 * struct rate_info - bitrate information 2006 * 2007 * Information about a receiving or transmitting bitrate 2008 * 2009 * @flags: bitflag of flags from &enum rate_info_flags 2010 * @legacy: bitrate in 100kbit/s for 802.11abg 2011 * @mcs: mcs index if struct describes an HT/VHT/HE/EHT/S1G/UHR rate 2012 * @nss: number of streams (VHT & HE only) 2013 * @bw: bandwidth (from &enum rate_info_bw) 2014 * @he_gi: HE guard interval (from &enum nl80211_he_gi) 2015 * @he_dcm: HE DCM value 2016 * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc, 2017 * only valid if bw is %RATE_INFO_BW_HE_RU) 2018 * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4) 2019 * @eht_gi: EHT guard interval (from &enum nl80211_eht_gi) 2020 * @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc, 2021 * only valid if bw is %RATE_INFO_BW_EHT_RU) 2022 */ 2023 struct rate_info { 2024 u16 flags; 2025 u16 legacy; 2026 u8 mcs; 2027 u8 nss; 2028 u8 bw; 2029 u8 he_gi; 2030 u8 he_dcm; 2031 u8 he_ru_alloc; 2032 u8 n_bonded_ch; 2033 u8 eht_gi; 2034 u8 eht_ru_alloc; 2035 }; 2036 2037 /** 2038 * enum bss_param_flags - bitrate info flags 2039 * 2040 * Used by the driver to indicate the specific rate transmission 2041 * type for 802.11n transmissions. 2042 * 2043 * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 2044 * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 2045 * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 2046 */ 2047 enum bss_param_flags { 2048 BSS_PARAM_FLAGS_CTS_PROT = BIT(0), 2049 BSS_PARAM_FLAGS_SHORT_PREAMBLE = BIT(1), 2050 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = BIT(2), 2051 }; 2052 2053 /** 2054 * struct sta_bss_parameters - BSS parameters for the attached station 2055 * 2056 * Information about the currently associated BSS 2057 * 2058 * @flags: bitflag of flags from &enum bss_param_flags 2059 * @dtim_period: DTIM period for the BSS 2060 * @beacon_interval: beacon interval 2061 */ 2062 struct sta_bss_parameters { 2063 u8 flags; 2064 u8 dtim_period; 2065 u16 beacon_interval; 2066 }; 2067 2068 /** 2069 * struct cfg80211_txq_stats - TXQ statistics for this TID 2070 * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to 2071 * indicate the relevant values in this struct are filled 2072 * @backlog_bytes: total number of bytes currently backlogged 2073 * @backlog_packets: total number of packets currently backlogged 2074 * @flows: number of new flows seen 2075 * @drops: total number of packets dropped 2076 * @ecn_marks: total number of packets marked with ECN CE 2077 * @overlimit: number of drops due to queue space overflow 2078 * @overmemory: number of drops due to memory limit overflow 2079 * @collisions: number of hash collisions 2080 * @tx_bytes: total number of bytes dequeued 2081 * @tx_packets: total number of packets dequeued 2082 * @max_flows: maximum number of flows supported 2083 */ 2084 struct cfg80211_txq_stats { 2085 u32 filled; 2086 u32 backlog_bytes; 2087 u32 backlog_packets; 2088 u32 flows; 2089 u32 drops; 2090 u32 ecn_marks; 2091 u32 overlimit; 2092 u32 overmemory; 2093 u32 collisions; 2094 u32 tx_bytes; 2095 u32 tx_packets; 2096 u32 max_flows; 2097 }; 2098 2099 /** 2100 * struct cfg80211_tid_stats - per-TID statistics 2101 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 2102 * indicate the relevant values in this struct are filled 2103 * @rx_msdu: number of received MSDUs 2104 * @tx_msdu: number of (attempted) transmitted MSDUs 2105 * @tx_msdu_retries: number of retries (not counting the first) for 2106 * transmitted MSDUs 2107 * @tx_msdu_failed: number of failed transmitted MSDUs 2108 * @txq_stats: TXQ statistics 2109 */ 2110 struct cfg80211_tid_stats { 2111 u32 filled; 2112 u64 rx_msdu; 2113 u64 tx_msdu; 2114 u64 tx_msdu_retries; 2115 u64 tx_msdu_failed; 2116 struct cfg80211_txq_stats txq_stats; 2117 }; 2118 2119 #define IEEE80211_MAX_CHAINS 4 2120 2121 /** 2122 * struct link_station_info - link station information 2123 * 2124 * Link station information filled by driver for get_station() and 2125 * dump_station(). 2126 * @filled: bit flag of flags using the bits of &enum nl80211_sta_info to 2127 * indicate the relevant values in this struct for them 2128 * @connected_time: time(in secs) since a link of station is last connected 2129 * @inactive_time: time since last activity for link station(tx/rx) 2130 * in milliseconds 2131 * @assoc_at: bootime (ns) of the last association of link of station 2132 * @rx_bytes: bytes (size of MPDUs) received from this link of station 2133 * @tx_bytes: bytes (size of MPDUs) transmitted to this link of station 2134 * @signal: The signal strength, type depends on the wiphy's signal_type. 2135 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 2136 * @signal_avg: Average signal strength, type depends on the wiphy's 2137 * signal_type. For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_ 2138 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 2139 * @chain_signal: per-chain signal strength of last received packet in dBm 2140 * @chain_signal_avg: per-chain signal strength average in dBm 2141 * @txrate: current unicast bitrate from this link of station 2142 * @rxrate: current unicast bitrate to this link of station 2143 * @rx_packets: packets (MSDUs & MMPDUs) received from this link of station 2144 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this link of station 2145 * @tx_retries: cumulative retry counts (MPDUs) for this link of station 2146 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 2147 * @rx_dropped_misc: Dropped for un-specified reason. 2148 * @bss_param: current BSS parameters 2149 * @beacon_loss_count: Number of times beacon loss event has triggered. 2150 * @expected_throughput: expected throughput in kbps (including 802.11 headers) 2151 * towards this station. 2152 * @rx_beacon: number of beacons received from this peer 2153 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 2154 * from this peer 2155 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 2156 * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer 2157 * @airtime_weight: current airtime scheduling weight 2158 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 2159 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 2160 * Note that this doesn't use the @filled bit, but is used if non-NULL. 2161 * @ack_signal: signal strength (in dBm) of the last ACK frame. 2162 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has 2163 * been sent. 2164 * @rx_mpdu_count: number of MPDUs received from this station 2165 * @fcs_err_count: number of packets (MPDUs) received from this station with 2166 * an FCS error. This counter should be incremented only when TA of the 2167 * received packet with an FCS error matches the peer MAC address. 2168 * @addr: For MLO STA connection, filled with address of the link of station. 2169 */ 2170 struct link_station_info { 2171 u64 filled; 2172 u32 connected_time; 2173 u32 inactive_time; 2174 u64 assoc_at; 2175 u64 rx_bytes; 2176 u64 tx_bytes; 2177 s8 signal; 2178 s8 signal_avg; 2179 2180 u8 chains; 2181 s8 chain_signal[IEEE80211_MAX_CHAINS]; 2182 s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 2183 2184 struct rate_info txrate; 2185 struct rate_info rxrate; 2186 u32 rx_packets; 2187 u32 tx_packets; 2188 u32 tx_retries; 2189 u32 tx_failed; 2190 u32 rx_dropped_misc; 2191 struct sta_bss_parameters bss_param; 2192 2193 u32 beacon_loss_count; 2194 2195 u32 expected_throughput; 2196 2197 u64 tx_duration; 2198 u64 rx_duration; 2199 u64 rx_beacon; 2200 u8 rx_beacon_signal_avg; 2201 2202 u16 airtime_weight; 2203 2204 s8 ack_signal; 2205 s8 avg_ack_signal; 2206 struct cfg80211_tid_stats *pertid; 2207 2208 u32 rx_mpdu_count; 2209 u32 fcs_err_count; 2210 2211 u8 addr[ETH_ALEN] __aligned(2); 2212 }; 2213 2214 /** 2215 * struct station_info - station information 2216 * 2217 * Station information filled by driver for get_station() and dump_station. 2218 * 2219 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to 2220 * indicate the relevant values in this struct for them 2221 * @connected_time: time(in secs) since a station is last connected 2222 * @inactive_time: time since last station activity (tx/rx) in milliseconds 2223 * @assoc_at: bootime (ns) of the last association 2224 * @rx_bytes: bytes (size of MPDUs) received from this station 2225 * @tx_bytes: bytes (size of MPDUs) transmitted to this station 2226 * @signal: The signal strength, type depends on the wiphy's signal_type. 2227 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 2228 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 2229 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 2230 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 2231 * @chain_signal: per-chain signal strength of last received packet in dBm 2232 * @chain_signal_avg: per-chain signal strength average in dBm 2233 * @txrate: current unicast bitrate from this station 2234 * @rxrate: current unicast bitrate to this station 2235 * @rx_packets: packets (MSDUs & MMPDUs) received from this station 2236 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station 2237 * @tx_retries: cumulative retry counts (MPDUs) 2238 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 2239 * @rx_dropped_misc: Dropped for un-specified reason. 2240 * @bss_param: current BSS parameters 2241 * @generation: generation number for nl80211 dumps. 2242 * This number should increase every time the list of stations 2243 * changes, i.e. when a station is added or removed, so that 2244 * userspace can tell whether it got a consistent snapshot. 2245 * @beacon_loss_count: Number of times beacon loss event has triggered. 2246 * @assoc_req_ies: IEs from (Re)Association Request. 2247 * This is used only when in AP mode with drivers that do not use 2248 * user space MLME/SME implementation. The information is provided for 2249 * the cfg80211_new_sta() calls to notify user space of the IEs. 2250 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 2251 * @sta_flags: station flags mask & values 2252 * @t_offset: Time offset of the station relative to this host. 2253 * @llid: mesh local link id 2254 * @plid: mesh peer link id 2255 * @plink_state: mesh peer link state 2256 * @connected_to_gate: true if mesh STA has a path to mesh gate 2257 * @connected_to_as: true if mesh STA has a path to authentication server 2258 * @airtime_link_metric: mesh airtime link metric. 2259 * @local_pm: local mesh STA power save mode 2260 * @peer_pm: peer mesh STA power save mode 2261 * @nonpeer_pm: non-peer mesh STA power save mode 2262 * @expected_throughput: expected throughput in kbps (including 802.11 headers) 2263 * towards this station. 2264 * @rx_beacon: number of beacons received from this peer 2265 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 2266 * from this peer 2267 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 2268 * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer 2269 * @airtime_weight: current airtime scheduling weight 2270 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 2271 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 2272 * Note that this doesn't use the @filled bit, but is used if non-NULL. 2273 * @ack_signal: signal strength (in dBm) of the last ACK frame. 2274 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has 2275 * been sent. 2276 * @rx_mpdu_count: number of MPDUs received from this station 2277 * @fcs_err_count: number of packets (MPDUs) received from this station with 2278 * an FCS error. This counter should be incremented only when TA of the 2279 * received packet with an FCS error matches the peer MAC address. 2280 * @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled 2281 * by driver. Drivers use this only in cfg80211_new_sta() calls when AP 2282 * MLD's MLME/SME is offload to driver. Drivers won't fill this 2283 * information in cfg80211_del_sta_sinfo(), get_station() and 2284 * dump_station() callbacks. 2285 * @assoc_link_id: Indicates MLO link ID of the AP, with which the station 2286 * completed (re)association. This information filled for both MLO 2287 * and non-MLO STA connections when the AP affiliated with an MLD. 2288 * @mld_addr: For MLO STA connection, filled with MLD address of the station. 2289 * For non-MLO STA connection, filled with all zeros. 2290 * @assoc_resp_ies: IEs from (Re)Association Response. 2291 * This is used only when in AP mode with drivers that do not use user 2292 * space MLME/SME implementation. The information is provided only for the 2293 * cfg80211_new_sta() calls to notify user space of the IEs. Drivers won't 2294 * fill this information in cfg80211_del_sta_sinfo(), get_station() and 2295 * dump_station() callbacks. User space needs this information to determine 2296 * the accepted and rejected affiliated links of the connected station. 2297 * @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets. 2298 * @valid_links: bitmap of valid links, or 0 for non-MLO. Drivers fill this 2299 * information in cfg80211_new_sta(), cfg80211_del_sta_sinfo(), 2300 * get_station() and dump_station() callbacks. 2301 * @links: reference to Link sta entries for MLO STA, all link specific 2302 * information is accessed through links[link_id]. 2303 */ 2304 struct station_info { 2305 u64 filled; 2306 u32 connected_time; 2307 u32 inactive_time; 2308 u64 assoc_at; 2309 u64 rx_bytes; 2310 u64 tx_bytes; 2311 s8 signal; 2312 s8 signal_avg; 2313 2314 u8 chains; 2315 s8 chain_signal[IEEE80211_MAX_CHAINS]; 2316 s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 2317 2318 struct rate_info txrate; 2319 struct rate_info rxrate; 2320 u32 rx_packets; 2321 u32 tx_packets; 2322 u32 tx_retries; 2323 u32 tx_failed; 2324 u32 rx_dropped_misc; 2325 struct sta_bss_parameters bss_param; 2326 struct nl80211_sta_flag_update sta_flags; 2327 2328 int generation; 2329 2330 u32 beacon_loss_count; 2331 2332 const u8 *assoc_req_ies; 2333 size_t assoc_req_ies_len; 2334 2335 s64 t_offset; 2336 u16 llid; 2337 u16 plid; 2338 u8 plink_state; 2339 u8 connected_to_gate; 2340 u8 connected_to_as; 2341 u32 airtime_link_metric; 2342 enum nl80211_mesh_power_mode local_pm; 2343 enum nl80211_mesh_power_mode peer_pm; 2344 enum nl80211_mesh_power_mode nonpeer_pm; 2345 2346 u32 expected_throughput; 2347 2348 u16 airtime_weight; 2349 2350 s8 ack_signal; 2351 s8 avg_ack_signal; 2352 struct cfg80211_tid_stats *pertid; 2353 2354 u64 tx_duration; 2355 u64 rx_duration; 2356 u64 rx_beacon; 2357 u8 rx_beacon_signal_avg; 2358 2359 u32 rx_mpdu_count; 2360 u32 fcs_err_count; 2361 2362 bool mlo_params_valid; 2363 u8 assoc_link_id; 2364 u8 mld_addr[ETH_ALEN] __aligned(2); 2365 const u8 *assoc_resp_ies; 2366 size_t assoc_resp_ies_len; 2367 2368 u16 valid_links; 2369 struct link_station_info *links[IEEE80211_MLD_MAX_NUM_LINKS]; 2370 }; 2371 2372 /** 2373 * struct cfg80211_sar_sub_specs - sub specs limit 2374 * @power: power limitation in 0.25dbm 2375 * @freq_range_index: index the power limitation applies to 2376 */ 2377 struct cfg80211_sar_sub_specs { 2378 s32 power; 2379 u32 freq_range_index; 2380 }; 2381 2382 /** 2383 * struct cfg80211_sar_specs - sar limit specs 2384 * @type: it's set with power in 0.25dbm or other types 2385 * @num_sub_specs: number of sar sub specs 2386 * @sub_specs: memory to hold the sar sub specs 2387 */ 2388 struct cfg80211_sar_specs { 2389 enum nl80211_sar_type type; 2390 u32 num_sub_specs; 2391 struct cfg80211_sar_sub_specs sub_specs[] __counted_by(num_sub_specs); 2392 }; 2393 2394 2395 /** 2396 * struct cfg80211_sar_freq_ranges - sar frequency ranges 2397 * @start_freq: start range edge frequency 2398 * @end_freq: end range edge frequency 2399 */ 2400 struct cfg80211_sar_freq_ranges { 2401 u32 start_freq; 2402 u32 end_freq; 2403 }; 2404 2405 /** 2406 * struct cfg80211_sar_capa - sar limit capability 2407 * @type: it's set via power in 0.25dbm or other types 2408 * @num_freq_ranges: number of frequency ranges 2409 * @freq_ranges: memory to hold the freq ranges. 2410 * 2411 * Note: WLAN driver may append new ranges or split an existing 2412 * range to small ones and then append them. 2413 */ 2414 struct cfg80211_sar_capa { 2415 enum nl80211_sar_type type; 2416 u32 num_freq_ranges; 2417 const struct cfg80211_sar_freq_ranges *freq_ranges; 2418 }; 2419 2420 #if IS_ENABLED(CONFIG_CFG80211) 2421 /** 2422 * cfg80211_get_station - retrieve information about a given station 2423 * @dev: the device where the station is supposed to be connected to 2424 * @mac_addr: the mac address of the station of interest 2425 * @sinfo: pointer to the structure to fill with the information 2426 * 2427 * Return: 0 on success and sinfo is filled with the available information 2428 * otherwise returns a negative error code and the content of sinfo has to be 2429 * considered undefined. 2430 */ 2431 int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 2432 struct station_info *sinfo); 2433 #else 2434 static inline int cfg80211_get_station(struct net_device *dev, 2435 const u8 *mac_addr, 2436 struct station_info *sinfo) 2437 { 2438 return -ENOENT; 2439 } 2440 #endif 2441 2442 /** 2443 * enum monitor_flags - monitor flags 2444 * 2445 * Monitor interface configuration flags. Note that these must be the bits 2446 * according to the nl80211 flags. 2447 * 2448 * @MONITOR_FLAG_CHANGED: set if the flags were changed 2449 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 2450 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 2451 * @MONITOR_FLAG_CONTROL: pass control frames 2452 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 2453 * @MONITOR_FLAG_COOK_FRAMES: deprecated, will unconditionally be refused 2454 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 2455 * @MONITOR_FLAG_SKIP_TX: do not pass locally transmitted frames 2456 */ 2457 enum monitor_flags { 2458 MONITOR_FLAG_CHANGED = BIT(__NL80211_MNTR_FLAG_INVALID), 2459 MONITOR_FLAG_FCSFAIL = BIT(NL80211_MNTR_FLAG_FCSFAIL), 2460 MONITOR_FLAG_PLCPFAIL = BIT(NL80211_MNTR_FLAG_PLCPFAIL), 2461 MONITOR_FLAG_CONTROL = BIT(NL80211_MNTR_FLAG_CONTROL), 2462 MONITOR_FLAG_OTHER_BSS = BIT(NL80211_MNTR_FLAG_OTHER_BSS), 2463 MONITOR_FLAG_COOK_FRAMES = BIT(NL80211_MNTR_FLAG_COOK_FRAMES), 2464 MONITOR_FLAG_ACTIVE = BIT(NL80211_MNTR_FLAG_ACTIVE), 2465 MONITOR_FLAG_SKIP_TX = BIT(NL80211_MNTR_FLAG_SKIP_TX), 2466 }; 2467 2468 /** 2469 * enum mpath_info_flags - mesh path information flags 2470 * 2471 * Used by the driver to indicate which info in &struct mpath_info it has filled 2472 * in during get_station() or dump_station(). 2473 * 2474 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 2475 * @MPATH_INFO_SN: @sn filled 2476 * @MPATH_INFO_METRIC: @metric filled 2477 * @MPATH_INFO_EXPTIME: @exptime filled 2478 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 2479 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 2480 * @MPATH_INFO_FLAGS: @flags filled 2481 * @MPATH_INFO_HOP_COUNT: @hop_count filled 2482 * @MPATH_INFO_PATH_CHANGE: @path_change_count filled 2483 */ 2484 enum mpath_info_flags { 2485 MPATH_INFO_FRAME_QLEN = BIT(0), 2486 MPATH_INFO_SN = BIT(1), 2487 MPATH_INFO_METRIC = BIT(2), 2488 MPATH_INFO_EXPTIME = BIT(3), 2489 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 2490 MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 2491 MPATH_INFO_FLAGS = BIT(6), 2492 MPATH_INFO_HOP_COUNT = BIT(7), 2493 MPATH_INFO_PATH_CHANGE = BIT(8), 2494 }; 2495 2496 /** 2497 * struct mpath_info - mesh path information 2498 * 2499 * Mesh path information filled by driver for get_mpath() and dump_mpath(). 2500 * 2501 * @filled: bitfield of flags from &enum mpath_info_flags 2502 * @frame_qlen: number of queued frames for this destination 2503 * @sn: target sequence number 2504 * @metric: metric (cost) of this mesh path 2505 * @exptime: expiration time for the mesh path from now, in msecs 2506 * @flags: mesh path flags from &enum mesh_path_flags 2507 * @discovery_timeout: total mesh path discovery timeout, in msecs 2508 * @discovery_retries: mesh path discovery retries 2509 * @generation: generation number for nl80211 dumps. 2510 * This number should increase every time the list of mesh paths 2511 * changes, i.e. when a station is added or removed, so that 2512 * userspace can tell whether it got a consistent snapshot. 2513 * @hop_count: hops to destination 2514 * @path_change_count: total number of path changes to destination 2515 */ 2516 struct mpath_info { 2517 u32 filled; 2518 u32 frame_qlen; 2519 u32 sn; 2520 u32 metric; 2521 u32 exptime; 2522 u32 discovery_timeout; 2523 u8 discovery_retries; 2524 u8 flags; 2525 u8 hop_count; 2526 u32 path_change_count; 2527 2528 int generation; 2529 }; 2530 2531 /** 2532 * enum wiphy_bss_param_flags - bit positions for supported bss parameters. 2533 * 2534 * @WIPHY_BSS_PARAM_CTS_PROT: support changing CTS protection. 2535 * @WIPHY_BSS_PARAM_SHORT_PREAMBLE: support changing short preamble usage. 2536 * @WIPHY_BSS_PARAM_SHORT_SLOT_TIME: support changing short slot time usage. 2537 * @WIPHY_BSS_PARAM_BASIC_RATES: support reconfiguring basic rates. 2538 * @WIPHY_BSS_PARAM_AP_ISOLATE: support changing AP isolation. 2539 * @WIPHY_BSS_PARAM_HT_OPMODE: support changing HT operating mode. 2540 * @WIPHY_BSS_PARAM_P2P_CTWINDOW: support reconfiguring ctwindow. 2541 * @WIPHY_BSS_PARAM_P2P_OPPPS: support changing P2P opportunistic power-save. 2542 */ 2543 enum wiphy_bss_param_flags { 2544 WIPHY_BSS_PARAM_CTS_PROT = BIT(0), 2545 WIPHY_BSS_PARAM_SHORT_PREAMBLE = BIT(1), 2546 WIPHY_BSS_PARAM_SHORT_SLOT_TIME = BIT(2), 2547 WIPHY_BSS_PARAM_BASIC_RATES = BIT(3), 2548 WIPHY_BSS_PARAM_AP_ISOLATE = BIT(4), 2549 WIPHY_BSS_PARAM_HT_OPMODE = BIT(5), 2550 WIPHY_BSS_PARAM_P2P_CTWINDOW = BIT(6), 2551 WIPHY_BSS_PARAM_P2P_OPPPS = BIT(7), 2552 }; 2553 2554 /** 2555 * struct bss_parameters - BSS parameters 2556 * 2557 * Used to change BSS parameters (mainly for AP mode). 2558 * 2559 * @link_id: link_id or -1 for non-MLD 2560 * @use_cts_prot: Whether to use CTS protection 2561 * (0 = no, 1 = yes, -1 = do not change) 2562 * @use_short_preamble: Whether the use of short preambles is allowed 2563 * (0 = no, 1 = yes, -1 = do not change) 2564 * @use_short_slot_time: Whether the use of short slot time is allowed 2565 * (0 = no, 1 = yes, -1 = do not change) 2566 * @basic_rates: basic rates in IEEE 802.11 format 2567 * (or NULL for no change) 2568 * @basic_rates_len: number of basic rates 2569 * @ap_isolate: do not forward packets between connected stations 2570 * (0 = no, 1 = yes, -1 = do not change) 2571 * @ht_opmode: HT Operation mode 2572 * (u16 = opmode, -1 = do not change) 2573 * @p2p_ctwindow: P2P CT Window (-1 = no change) 2574 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 2575 */ 2576 struct bss_parameters { 2577 int link_id; 2578 int use_cts_prot; 2579 int use_short_preamble; 2580 int use_short_slot_time; 2581 const u8 *basic_rates; 2582 u8 basic_rates_len; 2583 int ap_isolate; 2584 int ht_opmode; 2585 s8 p2p_ctwindow, p2p_opp_ps; 2586 }; 2587 2588 /** 2589 * struct mesh_config - 802.11s mesh configuration 2590 * 2591 * These parameters can be changed while the mesh is active. 2592 * 2593 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 2594 * by the Mesh Peering Open message 2595 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 2596 * used by the Mesh Peering Open message 2597 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 2598 * the mesh peering management to close a mesh peering 2599 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 2600 * mesh interface 2601 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 2602 * be sent to establish a new peer link instance in a mesh 2603 * @dot11MeshTTL: the value of TTL field set at a source mesh STA 2604 * @element_ttl: the value of TTL field set at a mesh STA for path selection 2605 * elements 2606 * @auto_open_plinks: whether we should automatically open peer links when we 2607 * detect compatible mesh peers 2608 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 2609 * synchronize to for 11s default synchronization method 2610 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 2611 * that an originator mesh STA can send to a particular path target 2612 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 2613 * @min_discovery_timeout: the minimum length of time to wait until giving up on 2614 * a path discovery in milliseconds 2615 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 2616 * receiving a PREQ shall consider the forwarding information from the 2617 * root to be valid. (TU = time unit) 2618 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 2619 * which a mesh STA can send only one action frame containing a PREQ 2620 * element 2621 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 2622 * which a mesh STA can send only one Action frame containing a PERR 2623 * element 2624 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 2625 * it takes for an HWMP information element to propagate across the mesh 2626 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 2627 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 2628 * announcements are transmitted 2629 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 2630 * station has access to a broader network beyond the MBSS. (This is 2631 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 2632 * only means that the station will announce others it's a mesh gate, but 2633 * not necessarily using the gate announcement protocol. Still keeping the 2634 * same nomenclature to be in sync with the spec) 2635 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 2636 * entity (default is TRUE - forwarding entity) 2637 * @rssi_threshold: the threshold for average signal strength of candidate 2638 * station to establish a peer link 2639 * @ht_opmode: mesh HT protection mode 2640 * 2641 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 2642 * receiving a proactive PREQ shall consider the forwarding information to 2643 * the root mesh STA to be valid. 2644 * 2645 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 2646 * PREQs are transmitted. 2647 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 2648 * during which a mesh STA can send only one Action frame containing 2649 * a PREQ element for root path confirmation. 2650 * @power_mode: The default mesh power save mode which will be the initial 2651 * setting for new peer links. 2652 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 2653 * after transmitting its beacon. 2654 * @plink_timeout: If no tx activity is seen from a STA we've established 2655 * peering with for longer than this time (in seconds), then remove it 2656 * from the STA's list of peers. Default is 30 minutes. 2657 * @dot11MeshConnectedToAuthServer: if set to true then this mesh STA 2658 * will advertise that it is connected to a authentication server 2659 * in the mesh formation field. 2660 * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is 2661 * connected to a mesh gate in mesh formation info. If false, the 2662 * value in mesh formation is determined by the presence of root paths 2663 * in the mesh path table 2664 * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP 2665 * for HWMP) if the destination is a direct neighbor. Note that this might 2666 * not be the optimal decision as a multi-hop route might be better. So 2667 * if using this setting you will likely also want to disable 2668 * dot11MeshForwarding and use another mesh routing protocol on top. 2669 */ 2670 struct mesh_config { 2671 u16 dot11MeshRetryTimeout; 2672 u16 dot11MeshConfirmTimeout; 2673 u16 dot11MeshHoldingTimeout; 2674 u16 dot11MeshMaxPeerLinks; 2675 u8 dot11MeshMaxRetries; 2676 u8 dot11MeshTTL; 2677 u8 element_ttl; 2678 bool auto_open_plinks; 2679 u32 dot11MeshNbrOffsetMaxNeighbor; 2680 u8 dot11MeshHWMPmaxPREQretries; 2681 u32 path_refresh_time; 2682 u16 min_discovery_timeout; 2683 u32 dot11MeshHWMPactivePathTimeout; 2684 u16 dot11MeshHWMPpreqMinInterval; 2685 u16 dot11MeshHWMPperrMinInterval; 2686 u16 dot11MeshHWMPnetDiameterTraversalTime; 2687 u8 dot11MeshHWMPRootMode; 2688 bool dot11MeshConnectedToMeshGate; 2689 bool dot11MeshConnectedToAuthServer; 2690 u16 dot11MeshHWMPRannInterval; 2691 bool dot11MeshGateAnnouncementProtocol; 2692 bool dot11MeshForwarding; 2693 s32 rssi_threshold; 2694 u16 ht_opmode; 2695 u32 dot11MeshHWMPactivePathToRootTimeout; 2696 u16 dot11MeshHWMProotInterval; 2697 u16 dot11MeshHWMPconfirmationInterval; 2698 enum nl80211_mesh_power_mode power_mode; 2699 u16 dot11MeshAwakeWindowDuration; 2700 u32 plink_timeout; 2701 bool dot11MeshNolearn; 2702 }; 2703 2704 /** 2705 * struct mesh_setup - 802.11s mesh setup configuration 2706 * @chandef: defines the channel to use 2707 * @mesh_id: the mesh ID 2708 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 2709 * @sync_method: which synchronization method to use 2710 * @path_sel_proto: which path selection protocol to use 2711 * @path_metric: which metric to use 2712 * @auth_id: which authentication method this mesh is using 2713 * @ie: vendor information elements (optional) 2714 * @ie_len: length of vendor information elements 2715 * @is_authenticated: this mesh requires authentication 2716 * @is_secure: this mesh uses security 2717 * @user_mpm: userspace handles all MPM functions 2718 * @dtim_period: DTIM period to use 2719 * @beacon_interval: beacon interval to use 2720 * @mcast_rate: multicast rate for Mesh Node [6Mbps is the default for 802.11a] 2721 * @basic_rates: basic rates to use when creating the mesh 2722 * @beacon_rate: bitrate to be used for beacons 2723 * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 2724 * changes the channel when a radar is detected. This is required 2725 * to operate on DFS channels. 2726 * @control_port_over_nl80211: TRUE if userspace expects to exchange control 2727 * port frames over NL80211 instead of the network interface. 2728 * 2729 * These parameters are fixed when the mesh is created. 2730 */ 2731 struct mesh_setup { 2732 struct cfg80211_chan_def chandef; 2733 const u8 *mesh_id; 2734 u8 mesh_id_len; 2735 u8 sync_method; 2736 u8 path_sel_proto; 2737 u8 path_metric; 2738 u8 auth_id; 2739 const u8 *ie; 2740 u8 ie_len; 2741 bool is_authenticated; 2742 bool is_secure; 2743 bool user_mpm; 2744 u8 dtim_period; 2745 u16 beacon_interval; 2746 int mcast_rate[NUM_NL80211_BANDS]; 2747 u32 basic_rates; 2748 struct cfg80211_bitrate_mask beacon_rate; 2749 bool userspace_handles_dfs; 2750 bool control_port_over_nl80211; 2751 }; 2752 2753 /** 2754 * struct ocb_setup - 802.11p OCB mode setup configuration 2755 * @chandef: defines the channel to use 2756 * 2757 * These parameters are fixed when connecting to the network 2758 */ 2759 struct ocb_setup { 2760 struct cfg80211_chan_def chandef; 2761 }; 2762 2763 /** 2764 * struct ieee80211_txq_params - TX queue parameters 2765 * @ac: AC identifier 2766 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 2767 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 2768 * 1..32767] 2769 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 2770 * 1..32767] 2771 * @aifs: Arbitration interframe space [0..255] 2772 * @link_id: link_id or -1 for non-MLD 2773 */ 2774 struct ieee80211_txq_params { 2775 enum nl80211_ac ac; 2776 u16 txop; 2777 u16 cwmin; 2778 u16 cwmax; 2779 u8 aifs; 2780 int link_id; 2781 }; 2782 2783 /** 2784 * DOC: Scanning and BSS list handling 2785 * 2786 * The scanning process itself is fairly simple, but cfg80211 offers quite 2787 * a bit of helper functionality. To start a scan, the scan operation will 2788 * be invoked with a scan definition. This scan definition contains the 2789 * channels to scan, and the SSIDs to send probe requests for (including the 2790 * wildcard, if desired). A passive scan is indicated by having no SSIDs to 2791 * probe. Additionally, a scan request may contain extra information elements 2792 * that should be added to the probe request. The IEs are guaranteed to be 2793 * well-formed, and will not exceed the maximum length the driver advertised 2794 * in the wiphy structure. 2795 * 2796 * When scanning finds a BSS, cfg80211 needs to be notified of that, because 2797 * it is responsible for maintaining the BSS list; the driver should not 2798 * maintain a list itself. For this notification, various functions exist. 2799 * 2800 * Since drivers do not maintain a BSS list, there are also a number of 2801 * functions to search for a BSS and obtain information about it from the 2802 * BSS structure cfg80211 maintains. The BSS list is also made available 2803 * to userspace. 2804 */ 2805 2806 /** 2807 * struct cfg80211_ssid - SSID description 2808 * @ssid: the SSID 2809 * @ssid_len: length of the ssid 2810 */ 2811 struct cfg80211_ssid { 2812 u8 ssid[IEEE80211_MAX_SSID_LEN]; 2813 u8 ssid_len; 2814 }; 2815 2816 /** 2817 * struct cfg80211_scan_info - information about completed scan 2818 * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the 2819 * wireless device that requested the scan is connected to. If this 2820 * information is not available, this field is left zero. 2821 * @tsf_bssid: the BSSID according to which %scan_start_tsf is set. 2822 * @aborted: set to true if the scan was aborted for any reason, 2823 * userspace will be notified of that 2824 */ 2825 struct cfg80211_scan_info { 2826 u64 scan_start_tsf; 2827 u8 tsf_bssid[ETH_ALEN] __aligned(2); 2828 bool aborted; 2829 }; 2830 2831 /** 2832 * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only 2833 * 2834 * @short_ssid: short ssid to scan for 2835 * @bssid: bssid to scan for 2836 * @channel_idx: idx of the channel in the channel array in the scan request 2837 * which the above info is relevant to 2838 * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU 2839 * @short_ssid_valid: @short_ssid is valid and can be used 2840 * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait 2841 * 20 TUs before starting to send probe requests. 2842 * @psd_20: The AP's 20 MHz PSD value. 2843 */ 2844 struct cfg80211_scan_6ghz_params { 2845 u32 short_ssid; 2846 u32 channel_idx; 2847 u8 bssid[ETH_ALEN]; 2848 bool unsolicited_probe; 2849 bool short_ssid_valid; 2850 bool psc_no_listen; 2851 s8 psd_20; 2852 }; 2853 2854 /** 2855 * struct cfg80211_scan_request - scan request description 2856 * 2857 * @ssids: SSIDs to scan for (active scan only) 2858 * @n_ssids: number of SSIDs 2859 * @channels: channels to scan on. 2860 * @n_channels: total number of channels to scan 2861 * @ie: optional information element(s) to add into Probe Request or %NULL 2862 * @ie_len: length of ie in octets 2863 * @duration: how long to listen on each channel, in TUs. If 2864 * %duration_mandatory is not set, this is the maximum dwell time and 2865 * the actual dwell time may be shorter. 2866 * @duration_mandatory: if set, the scan duration must be as specified by the 2867 * %duration field. 2868 * @flags: control flags from &enum nl80211_scan_flags 2869 * @rates: bitmap of rates to advertise for each band 2870 * @wiphy: the wiphy this was for 2871 * @scan_start: time (in jiffies) when the scan started 2872 * @wdev: the wireless device to scan for 2873 * @no_cck: used to send probe requests at non CCK rate in 2GHz band 2874 * @mac_addr: MAC address used with randomisation 2875 * @mac_addr_mask: MAC address mask used with randomisation, bits that 2876 * are 0 in the mask should be randomised, bits that are 1 should 2877 * be taken from the @mac_addr 2878 * @scan_6ghz: relevant for split scan request only, 2879 * true if this is a 6 GHz scan request 2880 * @first_part: %true if this is the first part of a split scan request or a 2881 * scan that was not split. May be %true for a @scan_6ghz scan if no other 2882 * channels were requested 2883 * @n_6ghz_params: number of 6 GHz params 2884 * @scan_6ghz_params: 6 GHz params 2885 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID) 2886 * @tsf_report_link_id: for MLO, indicates the link ID of the BSS that should be 2887 * used for TSF reporting. Can be set to -1 to indicate no preference. 2888 */ 2889 struct cfg80211_scan_request { 2890 struct cfg80211_ssid *ssids; 2891 int n_ssids; 2892 u32 n_channels; 2893 const u8 *ie; 2894 size_t ie_len; 2895 u16 duration; 2896 bool duration_mandatory; 2897 u32 flags; 2898 2899 u32 rates[NUM_NL80211_BANDS]; 2900 2901 struct wireless_dev *wdev; 2902 2903 u8 mac_addr[ETH_ALEN] __aligned(2); 2904 u8 mac_addr_mask[ETH_ALEN] __aligned(2); 2905 u8 bssid[ETH_ALEN] __aligned(2); 2906 struct wiphy *wiphy; 2907 unsigned long scan_start; 2908 bool no_cck; 2909 bool scan_6ghz; 2910 bool first_part; 2911 u32 n_6ghz_params; 2912 struct cfg80211_scan_6ghz_params *scan_6ghz_params; 2913 s8 tsf_report_link_id; 2914 2915 /* keep last */ 2916 struct ieee80211_channel *channels[]; 2917 }; 2918 2919 static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 2920 { 2921 int i; 2922 2923 get_random_bytes(buf, ETH_ALEN); 2924 for (i = 0; i < ETH_ALEN; i++) { 2925 buf[i] &= ~mask[i]; 2926 buf[i] |= addr[i] & mask[i]; 2927 } 2928 } 2929 2930 /** 2931 * struct cfg80211_match_set - sets of attributes to match 2932 * 2933 * @ssid: SSID to be matched; may be zero-length in case of BSSID match 2934 * or no match (RSSI only) 2935 * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match 2936 * or no match (RSSI only) 2937 * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 2938 */ 2939 struct cfg80211_match_set { 2940 struct cfg80211_ssid ssid; 2941 u8 bssid[ETH_ALEN]; 2942 s32 rssi_thold; 2943 }; 2944 2945 /** 2946 * struct cfg80211_sched_scan_plan - scan plan for scheduled scan 2947 * 2948 * @interval: interval between scheduled scan iterations. In seconds. 2949 * @iterations: number of scan iterations in this scan plan. Zero means 2950 * infinite loop. 2951 * The last scan plan will always have this parameter set to zero, 2952 * all other scan plans will have a finite number of iterations. 2953 */ 2954 struct cfg80211_sched_scan_plan { 2955 u32 interval; 2956 u32 iterations; 2957 }; 2958 2959 /** 2960 * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment. 2961 * 2962 * @band: band of BSS which should match for RSSI level adjustment. 2963 * @delta: value of RSSI level adjustment. 2964 */ 2965 struct cfg80211_bss_select_adjust { 2966 enum nl80211_band band; 2967 s8 delta; 2968 }; 2969 2970 /** 2971 * struct cfg80211_sched_scan_request - scheduled scan request description 2972 * 2973 * @reqid: identifies this request. 2974 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 2975 * @n_ssids: number of SSIDs 2976 * @n_channels: total number of channels to scan 2977 * @ie: optional information element(s) to add into Probe Request or %NULL 2978 * @ie_len: length of ie in octets 2979 * @flags: control flags from &enum nl80211_scan_flags 2980 * @match_sets: sets of parameters to be matched for a scan result 2981 * entry to be considered valid and to be passed to the host 2982 * (others are filtered out). 2983 * If omitted, all results are passed. 2984 * @n_match_sets: number of match sets 2985 * @report_results: indicates that results were reported for this request 2986 * @wiphy: the wiphy this was for 2987 * @dev: the interface 2988 * @scan_start: start time of the scheduled scan 2989 * @channels: channels to scan 2990 * @min_rssi_thold: for drivers only supporting a single threshold, this 2991 * contains the minimum over all matchsets 2992 * @mac_addr: MAC address used with randomisation 2993 * @mac_addr_mask: MAC address mask used with randomisation, bits that 2994 * are 0 in the mask should be randomised, bits that are 1 should 2995 * be taken from the @mac_addr 2996 * @scan_plans: scan plans to be executed in this scheduled scan. Lowest 2997 * index must be executed first. 2998 * @n_scan_plans: number of scan plans, at least 1. 2999 * @rcu_head: RCU callback used to free the struct 3000 * @owner_nlportid: netlink portid of owner (if this should is a request 3001 * owned by a particular socket) 3002 * @nl_owner_dead: netlink owner socket was closed - this request be freed 3003 * @list: for keeping list of requests. 3004 * @delay: delay in seconds to use before starting the first scan 3005 * cycle. The driver may ignore this parameter and start 3006 * immediately (or at any other time), if this feature is not 3007 * supported. 3008 * @relative_rssi_set: Indicates whether @relative_rssi is set or not. 3009 * @relative_rssi: Relative RSSI threshold in dB to restrict scan result 3010 * reporting in connected state to cases where a matching BSS is determined 3011 * to have better or slightly worse RSSI than the current connected BSS. 3012 * The relative RSSI threshold values are ignored in disconnected state. 3013 * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong 3014 * to the specified band while deciding whether a better BSS is reported 3015 * using @relative_rssi. If delta is a negative number, the BSSs that 3016 * belong to the specified band will be penalized by delta dB in relative 3017 * comparisons. 3018 */ 3019 struct cfg80211_sched_scan_request { 3020 u64 reqid; 3021 struct cfg80211_ssid *ssids; 3022 int n_ssids; 3023 u32 n_channels; 3024 const u8 *ie; 3025 size_t ie_len; 3026 u32 flags; 3027 struct cfg80211_match_set *match_sets; 3028 int n_match_sets; 3029 s32 min_rssi_thold; 3030 u32 delay; 3031 struct cfg80211_sched_scan_plan *scan_plans; 3032 int n_scan_plans; 3033 3034 u8 mac_addr[ETH_ALEN] __aligned(2); 3035 u8 mac_addr_mask[ETH_ALEN] __aligned(2); 3036 3037 bool relative_rssi_set; 3038 s8 relative_rssi; 3039 struct cfg80211_bss_select_adjust rssi_adjust; 3040 3041 /* internal */ 3042 struct wiphy *wiphy; 3043 struct net_device *dev; 3044 unsigned long scan_start; 3045 bool report_results; 3046 struct rcu_head rcu_head; 3047 u32 owner_nlportid; 3048 bool nl_owner_dead; 3049 struct list_head list; 3050 3051 /* keep last */ 3052 struct ieee80211_channel *channels[] __counted_by(n_channels); 3053 }; 3054 3055 /** 3056 * enum cfg80211_signal_type - signal type 3057 * 3058 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 3059 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 3060 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 3061 */ 3062 enum cfg80211_signal_type { 3063 CFG80211_SIGNAL_TYPE_NONE, 3064 CFG80211_SIGNAL_TYPE_MBM, 3065 CFG80211_SIGNAL_TYPE_UNSPEC, 3066 }; 3067 3068 /** 3069 * struct cfg80211_inform_bss - BSS inform data 3070 * @chan: channel the frame was received on 3071 * @signal: signal strength value, according to the wiphy's 3072 * signal type 3073 * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was 3074 * received; should match the time when the frame was actually 3075 * received by the device (not just by the host, in case it was 3076 * buffered on the device) and be accurate to about 10ms. 3077 * If the frame isn't buffered, just passing the return value of 3078 * ktime_get_boottime_ns() is likely appropriate. 3079 * @parent_tsf: the time at the start of reception of the first octet of the 3080 * timestamp field of the frame. The time is the TSF of the BSS specified 3081 * by %parent_bssid. 3082 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to 3083 * the BSS that requested the scan in which the beacon/probe was received. 3084 * @chains: bitmask for filled values in @chain_signal. 3085 * @chain_signal: per-chain signal strength of last received BSS in dBm. 3086 * @restrict_use: restrict usage, if not set, assume @use_for is 3087 * %NL80211_BSS_USE_FOR_NORMAL. 3088 * @use_for: bitmap of possible usage for this BSS, see 3089 * &enum nl80211_bss_use_for 3090 * @cannot_use_reasons: the reasons (bitmap) for not being able to connect, 3091 * if @restrict_use is set and @use_for is zero (empty); may be 0 for 3092 * unspecified reasons; see &enum nl80211_bss_cannot_use_reasons 3093 * @drv_data: Data to be passed through to @inform_bss 3094 */ 3095 struct cfg80211_inform_bss { 3096 struct ieee80211_channel *chan; 3097 s32 signal; 3098 u64 boottime_ns; 3099 u64 parent_tsf; 3100 u8 parent_bssid[ETH_ALEN] __aligned(2); 3101 u8 chains; 3102 s8 chain_signal[IEEE80211_MAX_CHAINS]; 3103 3104 u8 restrict_use:1, use_for:7; 3105 u8 cannot_use_reasons; 3106 3107 void *drv_data; 3108 }; 3109 3110 /** 3111 * struct cfg80211_bss_ies - BSS entry IE data 3112 * @tsf: TSF contained in the frame that carried these IEs 3113 * @rcu_head: internal use, for freeing 3114 * @len: length of the IEs 3115 * @from_beacon: these IEs are known to come from a beacon 3116 * @data: IE data 3117 */ 3118 struct cfg80211_bss_ies { 3119 u64 tsf; 3120 struct rcu_head rcu_head; 3121 int len; 3122 bool from_beacon; 3123 u8 data[]; 3124 }; 3125 3126 /** 3127 * struct cfg80211_bss - BSS description 3128 * 3129 * This structure describes a BSS (which may also be a mesh network) 3130 * for use in scan results and similar. 3131 * 3132 * @channel: channel this BSS is on 3133 * @bssid: BSSID of the BSS 3134 * @beacon_interval: the beacon interval as from the frame 3135 * @capability: the capability field in host byte order 3136 * @ies: the information elements (Note that there is no guarantee that these 3137 * are well-formed!); this is a pointer to either the beacon_ies or 3138 * proberesp_ies depending on whether Probe Response frame has been 3139 * received. It is always non-%NULL. 3140 * @beacon_ies: the information elements from the last Beacon frame 3141 * (implementation note: if @hidden_beacon_bss is set this struct doesn't 3142 * own the beacon_ies, but they're just pointers to the ones from the 3143 * @hidden_beacon_bss struct) 3144 * @proberesp_ies: the information elements from the last Probe Response frame 3145 * @proberesp_ecsa_stuck: ECSA element is stuck in the Probe Response frame, 3146 * cannot rely on it having valid data 3147 * @hidden_beacon_bss: in case this BSS struct represents a probe response from 3148 * a BSS that hides the SSID in its beacon, this points to the BSS struct 3149 * that holds the beacon data. @beacon_ies is still valid, of course, and 3150 * points to the same data as hidden_beacon_bss->beacon_ies in that case. 3151 * @transmitted_bss: pointer to the transmitted BSS, if this is a 3152 * non-transmitted one (multi-BSSID support) 3153 * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one 3154 * (multi-BSSID support) 3155 * @signal: signal strength value (type depends on the wiphy's signal_type) 3156 * @ts_boottime: timestamp of the last BSS update in nanoseconds since boot 3157 * @chains: bitmask for filled values in @chain_signal. 3158 * @chain_signal: per-chain signal strength of last received BSS in dBm. 3159 * @bssid_index: index in the multiple BSS set 3160 * @max_bssid_indicator: max number of members in the BSS set 3161 * @use_for: bitmap of possible usage for this BSS, see 3162 * &enum nl80211_bss_use_for 3163 * @cannot_use_reasons: the reasons (bitmap) for not being able to connect, 3164 * if @restrict_use is set and @use_for is zero (empty); may be 0 for 3165 * unspecified reasons; see &enum nl80211_bss_cannot_use_reasons 3166 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 3167 */ 3168 struct cfg80211_bss { 3169 struct ieee80211_channel *channel; 3170 3171 const struct cfg80211_bss_ies __rcu *ies; 3172 const struct cfg80211_bss_ies __rcu *beacon_ies; 3173 const struct cfg80211_bss_ies __rcu *proberesp_ies; 3174 3175 struct cfg80211_bss *hidden_beacon_bss; 3176 struct cfg80211_bss *transmitted_bss; 3177 struct list_head nontrans_list; 3178 3179 s32 signal; 3180 3181 u64 ts_boottime; 3182 3183 u16 beacon_interval; 3184 u16 capability; 3185 3186 u8 bssid[ETH_ALEN]; 3187 u8 chains; 3188 s8 chain_signal[IEEE80211_MAX_CHAINS]; 3189 3190 u8 proberesp_ecsa_stuck:1; 3191 3192 u8 bssid_index; 3193 u8 max_bssid_indicator; 3194 3195 u8 use_for; 3196 u8 cannot_use_reasons; 3197 3198 u8 priv[] __aligned(sizeof(void *)); 3199 }; 3200 3201 /** 3202 * ieee80211_bss_get_elem - find element with given ID 3203 * @bss: the bss to search 3204 * @id: the element ID 3205 * 3206 * Note that the return value is an RCU-protected pointer, so 3207 * rcu_read_lock() must be held when calling this function. 3208 * Return: %NULL if not found. 3209 */ 3210 const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id); 3211 3212 /** 3213 * ieee80211_bss_get_ie - find IE with given ID 3214 * @bss: the bss to search 3215 * @id: the element ID 3216 * 3217 * Note that the return value is an RCU-protected pointer, so 3218 * rcu_read_lock() must be held when calling this function. 3219 * Return: %NULL if not found. 3220 */ 3221 static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id) 3222 { 3223 return (const void *)ieee80211_bss_get_elem(bss, id); 3224 } 3225 3226 3227 /** 3228 * struct cfg80211_auth_request - Authentication request data 3229 * 3230 * This structure provides information needed to complete IEEE 802.11 3231 * authentication. 3232 * 3233 * @bss: The BSS to authenticate with, the callee must obtain a reference 3234 * to it if it needs to keep it. 3235 * @supported_selectors: List of selectors that should be assumed to be 3236 * supported by the station. 3237 * SAE_H2E must be assumed supported if set to %NULL. 3238 * @supported_selectors_len: Length of supported_selectors in octets. 3239 * @auth_type: Authentication type (algorithm) 3240 * @ie: Extra IEs to add to Authentication frame or %NULL 3241 * @ie_len: Length of ie buffer in octets 3242 * @key_len: length of WEP key for shared key authentication 3243 * @key_idx: index of WEP key for shared key authentication 3244 * @key: WEP key for shared key authentication 3245 * @auth_data: Fields and elements in Authentication frames. This contains 3246 * the authentication frame body (non-IE and IE data), excluding the 3247 * Authentication algorithm number, i.e., starting at the Authentication 3248 * transaction sequence number field. 3249 * @auth_data_len: Length of auth_data buffer in octets 3250 * @link_id: if >= 0, indicates authentication should be done as an MLD, 3251 * the interface address is included as the MLD address and the 3252 * necessary link (with the given link_id) will be created (and 3253 * given an MLD address) by the driver 3254 * @ap_mld_addr: AP MLD address in case of authentication request with 3255 * an AP MLD, valid iff @link_id >= 0 3256 */ 3257 struct cfg80211_auth_request { 3258 struct cfg80211_bss *bss; 3259 const u8 *ie; 3260 size_t ie_len; 3261 const u8 *supported_selectors; 3262 u8 supported_selectors_len; 3263 enum nl80211_auth_type auth_type; 3264 const u8 *key; 3265 u8 key_len; 3266 s8 key_idx; 3267 const u8 *auth_data; 3268 size_t auth_data_len; 3269 s8 link_id; 3270 const u8 *ap_mld_addr; 3271 }; 3272 3273 /** 3274 * struct cfg80211_assoc_link - per-link information for MLO association 3275 * @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss; 3276 * if this is %NULL for a link, that link is not requested 3277 * @elems: extra elements for the per-STA profile for this link 3278 * @elems_len: length of the elements 3279 * @error: per-link error code, must be <= 0. If there is an error, then the 3280 * operation as a whole must fail. 3281 */ 3282 struct cfg80211_assoc_link { 3283 struct cfg80211_bss *bss; 3284 const u8 *elems; 3285 size_t elems_len; 3286 int error; 3287 }; 3288 3289 /** 3290 * struct cfg80211_ml_reconf_req - MLO link reconfiguration request 3291 * @add_links: data for links to add, see &struct cfg80211_assoc_link 3292 * @rem_links: bitmap of links to remove 3293 * @ext_mld_capa_ops: extended MLD capabilities and operations set by 3294 * userspace for the ML reconfiguration action frame 3295 */ 3296 struct cfg80211_ml_reconf_req { 3297 struct cfg80211_assoc_link add_links[IEEE80211_MLD_MAX_NUM_LINKS]; 3298 u16 rem_links; 3299 u16 ext_mld_capa_ops; 3300 }; 3301 3302 /** 3303 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 3304 * 3305 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 3306 * @ASSOC_REQ_DISABLE_VHT: Disable VHT 3307 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 3308 * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external 3309 * authentication capability. Drivers can offload authentication to 3310 * userspace if this flag is set. Only applicable for cfg80211_connect() 3311 * request (connect callback). 3312 * @ASSOC_REQ_DISABLE_HE: Disable HE 3313 * @ASSOC_REQ_DISABLE_EHT: Disable EHT 3314 * @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links. 3315 * Drivers shall disable MLO features for the current association if this 3316 * flag is not set. 3317 * @ASSOC_REQ_SPP_AMSDU: SPP A-MSDUs will be used on this connection (if any) 3318 * @ASSOC_REQ_DISABLE_UHR: Disable UHR 3319 */ 3320 enum cfg80211_assoc_req_flags { 3321 ASSOC_REQ_DISABLE_HT = BIT(0), 3322 ASSOC_REQ_DISABLE_VHT = BIT(1), 3323 ASSOC_REQ_USE_RRM = BIT(2), 3324 CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3), 3325 ASSOC_REQ_DISABLE_HE = BIT(4), 3326 ASSOC_REQ_DISABLE_EHT = BIT(5), 3327 CONNECT_REQ_MLO_SUPPORT = BIT(6), 3328 ASSOC_REQ_SPP_AMSDU = BIT(7), 3329 ASSOC_REQ_DISABLE_UHR = BIT(8), 3330 }; 3331 3332 /** 3333 * struct cfg80211_assoc_request - (Re)Association request data 3334 * 3335 * This structure provides information needed to complete IEEE 802.11 3336 * (re)association. 3337 * @bss: The BSS to associate with. If the call is successful the driver is 3338 * given a reference that it must give back to cfg80211_send_rx_assoc() 3339 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 3340 * association requests while already associating must be rejected. 3341 * This also applies to the @links.bss parameter, which is used instead 3342 * of this one (it is %NULL) for MLO associations. 3343 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 3344 * @ie_len: Length of ie buffer in octets 3345 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 3346 * @crypto: crypto settings 3347 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 3348 * to indicate a request to reassociate within the ESS instead of a request 3349 * do the initial association with the ESS. When included, this is set to 3350 * the BSSID of the current association, i.e., to the value that is 3351 * included in the Current AP address field of the Reassociation Request 3352 * frame. 3353 * @flags: See &enum cfg80211_assoc_req_flags 3354 * @supported_selectors: supported BSS selectors in IEEE 802.11 format 3355 * (or %NULL for no change). 3356 * If %NULL, then support for SAE_H2E should be assumed. 3357 * @supported_selectors_len: number of supported BSS selectors 3358 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 3359 * will be used in ht_capa. Un-supported values will be ignored. 3360 * @ht_capa_mask: The bits of ht_capa which are to be used. 3361 * @vht_capa: VHT capability override 3362 * @vht_capa_mask: VHT capability mask indicating which fields to use 3363 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or 3364 * %NULL if FILS is not used. 3365 * @fils_kek_len: Length of fils_kek in octets 3366 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association 3367 * Request/Response frame or %NULL if FILS is not used. This field starts 3368 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce. 3369 * @s1g_capa: S1G capability override 3370 * @s1g_capa_mask: S1G capability override mask 3371 * @links: per-link information for MLO connections 3372 * @link_id: >= 0 for MLO connections, where links are given, and indicates 3373 * the link on which the association request should be sent 3374 * @ap_mld_addr: AP MLD address in case of MLO association request, 3375 * valid iff @link_id >= 0 3376 * @ext_mld_capa_ops: extended MLD capabilities and operations set by 3377 * userspace for the association 3378 */ 3379 struct cfg80211_assoc_request { 3380 struct cfg80211_bss *bss; 3381 const u8 *ie, *prev_bssid; 3382 size_t ie_len; 3383 struct cfg80211_crypto_settings crypto; 3384 bool use_mfp; 3385 u32 flags; 3386 const u8 *supported_selectors; 3387 u8 supported_selectors_len; 3388 struct ieee80211_ht_cap ht_capa; 3389 struct ieee80211_ht_cap ht_capa_mask; 3390 struct ieee80211_vht_cap vht_capa, vht_capa_mask; 3391 const u8 *fils_kek; 3392 size_t fils_kek_len; 3393 const u8 *fils_nonces; 3394 struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask; 3395 struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS]; 3396 const u8 *ap_mld_addr; 3397 s8 link_id; 3398 u16 ext_mld_capa_ops; 3399 }; 3400 3401 /** 3402 * struct cfg80211_deauth_request - Deauthentication request data 3403 * 3404 * This structure provides information needed to complete IEEE 802.11 3405 * deauthentication. 3406 * 3407 * @bssid: the BSSID or AP MLD address to deauthenticate from 3408 * @ie: Extra IEs to add to Deauthentication frame or %NULL 3409 * @ie_len: Length of ie buffer in octets 3410 * @reason_code: The reason code for the deauthentication 3411 * @local_state_change: if set, change local state only and 3412 * do not set a deauth frame 3413 */ 3414 struct cfg80211_deauth_request { 3415 const u8 *bssid; 3416 const u8 *ie; 3417 size_t ie_len; 3418 u16 reason_code; 3419 bool local_state_change; 3420 }; 3421 3422 /** 3423 * struct cfg80211_disassoc_request - Disassociation request data 3424 * 3425 * This structure provides information needed to complete IEEE 802.11 3426 * disassociation. 3427 * 3428 * @ap_addr: the BSSID or AP MLD address to disassociate from 3429 * @ie: Extra IEs to add to Disassociation frame or %NULL 3430 * @ie_len: Length of ie buffer in octets 3431 * @reason_code: The reason code for the disassociation 3432 * @local_state_change: This is a request for a local state only, i.e., no 3433 * Disassociation frame is to be transmitted. 3434 */ 3435 struct cfg80211_disassoc_request { 3436 const u8 *ap_addr; 3437 const u8 *ie; 3438 size_t ie_len; 3439 u16 reason_code; 3440 bool local_state_change; 3441 }; 3442 3443 /** 3444 * struct cfg80211_ibss_params - IBSS parameters 3445 * 3446 * This structure defines the IBSS parameters for the join_ibss() 3447 * method. 3448 * 3449 * @ssid: The SSID, will always be non-null. 3450 * @ssid_len: The length of the SSID, will always be non-zero. 3451 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 3452 * search for IBSSs with a different BSSID. 3453 * @chandef: defines the channel to use if no other IBSS to join can be found 3454 * @channel_fixed: The channel should be fixed -- do not search for 3455 * IBSSs to join on other channels. 3456 * @ie: information element(s) to include in the beacon 3457 * @ie_len: length of that 3458 * @beacon_interval: beacon interval to use 3459 * @privacy: this is a protected network, keys will be configured 3460 * after joining 3461 * @control_port: whether user space controls IEEE 802.1X port, i.e., 3462 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 3463 * required to assume that the port is unauthorized until authorized by 3464 * user space. Otherwise, port is marked authorized by default. 3465 * @control_port_over_nl80211: TRUE if userspace expects to exchange control 3466 * port frames over NL80211 instead of the network interface. 3467 * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 3468 * changes the channel when a radar is detected. This is required 3469 * to operate on DFS channels. 3470 * @basic_rates: bitmap of basic rates to use when creating the IBSS 3471 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 3472 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 3473 * will be used in ht_capa. Un-supported values will be ignored. 3474 * @ht_capa_mask: The bits of ht_capa which are to be used. 3475 * @wep_keys: static WEP keys, if not NULL points to an array of 3476 * CFG80211_MAX_WEP_KEYS WEP keys 3477 * @wep_tx_key: key index (0..3) of the default TX static WEP key 3478 */ 3479 struct cfg80211_ibss_params { 3480 const u8 *ssid; 3481 const u8 *bssid; 3482 struct cfg80211_chan_def chandef; 3483 const u8 *ie; 3484 u8 ssid_len, ie_len; 3485 u16 beacon_interval; 3486 u32 basic_rates; 3487 bool channel_fixed; 3488 bool privacy; 3489 bool control_port; 3490 bool control_port_over_nl80211; 3491 bool userspace_handles_dfs; 3492 int mcast_rate[NUM_NL80211_BANDS]; 3493 struct ieee80211_ht_cap ht_capa; 3494 struct ieee80211_ht_cap ht_capa_mask; 3495 struct key_params *wep_keys; 3496 int wep_tx_key; 3497 }; 3498 3499 /** 3500 * struct cfg80211_bss_selection - connection parameters for BSS selection. 3501 * 3502 * @behaviour: requested BSS selection behaviour. 3503 * @param: parameters for requestion behaviour. 3504 * @param.band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF. 3505 * @param.adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST. 3506 */ 3507 struct cfg80211_bss_selection { 3508 enum nl80211_bss_select_attr behaviour; 3509 union { 3510 enum nl80211_band band_pref; 3511 struct cfg80211_bss_select_adjust adjust; 3512 } param; 3513 }; 3514 3515 /** 3516 * struct cfg80211_connect_params - Connection parameters 3517 * 3518 * This structure provides information needed to complete IEEE 802.11 3519 * authentication and association. 3520 * 3521 * @channel: The channel to use or %NULL if not specified (auto-select based 3522 * on scan results) 3523 * @channel_hint: The channel of the recommended BSS for initial connection or 3524 * %NULL if not specified 3525 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 3526 * results) 3527 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 3528 * %NULL if not specified. Unlike the @bssid parameter, the driver is 3529 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 3530 * to use. 3531 * @ssid: SSID 3532 * @ssid_len: Length of ssid in octets 3533 * @auth_type: Authentication type (algorithm) 3534 * @ie: IEs for association request 3535 * @ie_len: Length of assoc_ie in octets 3536 * @privacy: indicates whether privacy-enabled APs should be used 3537 * @mfp: indicate whether management frame protection is used 3538 * @crypto: crypto settings 3539 * @key_len: length of WEP key for shared key authentication 3540 * @key_idx: index of WEP key for shared key authentication 3541 * @key: WEP key for shared key authentication 3542 * @flags: See &enum cfg80211_assoc_req_flags 3543 * @bg_scan_period: Background scan period in seconds 3544 * or -1 to indicate that default value is to be used. 3545 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 3546 * will be used in ht_capa. Un-supported values will be ignored. 3547 * @ht_capa_mask: The bits of ht_capa which are to be used. 3548 * @vht_capa: VHT Capability overrides 3549 * @vht_capa_mask: The bits of vht_capa which are to be used. 3550 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG 3551 * networks. 3552 * @bss_select: criteria to be used for BSS selection. 3553 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 3554 * to indicate a request to reassociate within the ESS instead of a request 3555 * do the initial association with the ESS. When included, this is set to 3556 * the BSSID of the current association, i.e., to the value that is 3557 * included in the Current AP address field of the Reassociation Request 3558 * frame. 3559 * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the 3560 * NAI or %NULL if not specified. This is used to construct FILS wrapped 3561 * data IE. 3562 * @fils_erp_username_len: Length of @fils_erp_username in octets. 3563 * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or 3564 * %NULL if not specified. This specifies the domain name of ER server and 3565 * is used to construct FILS wrapped data IE. 3566 * @fils_erp_realm_len: Length of @fils_erp_realm in octets. 3567 * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP 3568 * messages. This is also used to construct FILS wrapped data IE. 3569 * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional 3570 * keys in FILS or %NULL if not specified. 3571 * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets. 3572 * @want_1x: indicates user-space supports and wants to use 802.1X driver 3573 * offload of 4-way handshake. 3574 * @edmg: define the EDMG channels. 3575 * This may specify multiple channels and bonding options for the driver 3576 * to choose from, based on BSS configuration. 3577 */ 3578 struct cfg80211_connect_params { 3579 struct ieee80211_channel *channel; 3580 struct ieee80211_channel *channel_hint; 3581 const u8 *bssid; 3582 const u8 *bssid_hint; 3583 const u8 *ssid; 3584 size_t ssid_len; 3585 enum nl80211_auth_type auth_type; 3586 const u8 *ie; 3587 size_t ie_len; 3588 bool privacy; 3589 enum nl80211_mfp mfp; 3590 struct cfg80211_crypto_settings crypto; 3591 const u8 *key; 3592 u8 key_len, key_idx; 3593 u32 flags; 3594 int bg_scan_period; 3595 struct ieee80211_ht_cap ht_capa; 3596 struct ieee80211_ht_cap ht_capa_mask; 3597 struct ieee80211_vht_cap vht_capa; 3598 struct ieee80211_vht_cap vht_capa_mask; 3599 bool pbss; 3600 struct cfg80211_bss_selection bss_select; 3601 const u8 *prev_bssid; 3602 const u8 *fils_erp_username; 3603 size_t fils_erp_username_len; 3604 const u8 *fils_erp_realm; 3605 size_t fils_erp_realm_len; 3606 u16 fils_erp_next_seq_num; 3607 const u8 *fils_erp_rrk; 3608 size_t fils_erp_rrk_len; 3609 bool want_1x; 3610 struct ieee80211_edmg edmg; 3611 }; 3612 3613 /** 3614 * enum cfg80211_connect_params_changed - Connection parameters being updated 3615 * 3616 * This enum provides information of all connect parameters that 3617 * have to be updated as part of update_connect_params() call. 3618 * 3619 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated 3620 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm, 3621 * username, erp sequence number and rrk) are updated 3622 * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated 3623 */ 3624 enum cfg80211_connect_params_changed { 3625 UPDATE_ASSOC_IES = BIT(0), 3626 UPDATE_FILS_ERP_INFO = BIT(1), 3627 UPDATE_AUTH_TYPE = BIT(2), 3628 }; 3629 3630 /** 3631 * enum wiphy_params_flags - set_wiphy_params bitfield values 3632 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 3633 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 3634 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 3635 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 3636 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 3637 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 3638 * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed 3639 * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed 3640 * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum 3641 */ 3642 enum wiphy_params_flags { 3643 WIPHY_PARAM_RETRY_SHORT = BIT(0), 3644 WIPHY_PARAM_RETRY_LONG = BIT(1), 3645 WIPHY_PARAM_FRAG_THRESHOLD = BIT(2), 3646 WIPHY_PARAM_RTS_THRESHOLD = BIT(3), 3647 WIPHY_PARAM_COVERAGE_CLASS = BIT(4), 3648 WIPHY_PARAM_DYN_ACK = BIT(5), 3649 WIPHY_PARAM_TXQ_LIMIT = BIT(6), 3650 WIPHY_PARAM_TXQ_MEMORY_LIMIT = BIT(7), 3651 WIPHY_PARAM_TXQ_QUANTUM = BIT(8), 3652 }; 3653 3654 #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256 3655 3656 /* The per TXQ device queue limit in airtime */ 3657 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000 3658 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000 3659 3660 /* The per interface airtime threshold to switch to lower queue limit */ 3661 #define IEEE80211_AQL_THRESHOLD 24000 3662 3663 /** 3664 * struct cfg80211_pmksa - PMK Security Association 3665 * 3666 * This structure is passed to the set/del_pmksa() method for PMKSA 3667 * caching. 3668 * 3669 * @bssid: The AP's BSSID (may be %NULL). 3670 * @pmkid: The identifier to refer a PMKSA. 3671 * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key 3672 * derivation by a FILS STA. Otherwise, %NULL. 3673 * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on 3674 * the hash algorithm used to generate this. 3675 * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS 3676 * cache identifier (may be %NULL). 3677 * @ssid_len: Length of the @ssid in octets. 3678 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the 3679 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be 3680 * %NULL). 3681 * @pmk_lifetime: Maximum lifetime for PMKSA in seconds 3682 * (dot11RSNAConfigPMKLifetime) or 0 if not specified. 3683 * The configured PMKSA must not be used for PMKSA caching after 3684 * expiration and any keys derived from this PMK become invalid on 3685 * expiration, i.e., the current association must be dropped if the PMK 3686 * used for it expires. 3687 * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of 3688 * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified. 3689 * Drivers are expected to trigger a full authentication instead of using 3690 * this PMKSA for caching when reassociating to a new BSS after this 3691 * threshold to generate a new PMK before the current one expires. 3692 */ 3693 struct cfg80211_pmksa { 3694 const u8 *bssid; 3695 const u8 *pmkid; 3696 const u8 *pmk; 3697 size_t pmk_len; 3698 const u8 *ssid; 3699 size_t ssid_len; 3700 const u8 *cache_id; 3701 u32 pmk_lifetime; 3702 u8 pmk_reauth_threshold; 3703 }; 3704 3705 /** 3706 * struct cfg80211_pkt_pattern - packet pattern 3707 * @mask: bitmask where to match pattern and where to ignore bytes, 3708 * one bit per byte, in same format as nl80211 3709 * @pattern: bytes to match where bitmask is 1 3710 * @pattern_len: length of pattern (in bytes) 3711 * @pkt_offset: packet offset (in bytes) 3712 * 3713 * Internal note: @mask and @pattern are allocated in one chunk of 3714 * memory, free @mask only! 3715 */ 3716 struct cfg80211_pkt_pattern { 3717 const u8 *mask, *pattern; 3718 int pattern_len; 3719 int pkt_offset; 3720 }; 3721 3722 /** 3723 * struct cfg80211_wowlan_tcp - TCP connection parameters 3724 * 3725 * @sock: (internal) socket for source port allocation 3726 * @src: source IP address 3727 * @dst: destination IP address 3728 * @dst_mac: destination MAC address 3729 * @src_port: source port 3730 * @dst_port: destination port 3731 * @payload_len: data payload length 3732 * @payload: data payload buffer 3733 * @payload_seq: payload sequence stamping configuration 3734 * @data_interval: interval at which to send data packets 3735 * @wake_len: wakeup payload match length 3736 * @wake_data: wakeup payload match data 3737 * @wake_mask: wakeup payload match mask 3738 * @tokens_size: length of the tokens buffer 3739 * @payload_tok: payload token usage configuration 3740 */ 3741 struct cfg80211_wowlan_tcp { 3742 struct socket *sock; 3743 __be32 src, dst; 3744 u16 src_port, dst_port; 3745 u8 dst_mac[ETH_ALEN]; 3746 int payload_len; 3747 const u8 *payload; 3748 struct nl80211_wowlan_tcp_data_seq payload_seq; 3749 u32 data_interval; 3750 u32 wake_len; 3751 const u8 *wake_data, *wake_mask; 3752 u32 tokens_size; 3753 /* must be last, variable member */ 3754 struct nl80211_wowlan_tcp_data_token payload_tok; 3755 }; 3756 3757 /** 3758 * struct cfg80211_wowlan - Wake on Wireless-LAN support info 3759 * 3760 * This structure defines the enabled WoWLAN triggers for the device. 3761 * @any: wake up on any activity -- special trigger if device continues 3762 * operating as normal during suspend 3763 * @disconnect: wake up if getting disconnected 3764 * @magic_pkt: wake up on receiving magic packet 3765 * @patterns: wake up on receiving packet matching a pattern 3766 * @n_patterns: number of patterns 3767 * @gtk_rekey_failure: wake up on GTK rekey failure 3768 * @eap_identity_req: wake up on EAP identity request packet 3769 * @four_way_handshake: wake up on 4-way handshake 3770 * @rfkill_release: wake up when rfkill is released 3771 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 3772 * NULL if not configured. 3773 * @nd_config: configuration for the scan to be used for net detect wake. 3774 */ 3775 struct cfg80211_wowlan { 3776 bool any, disconnect, magic_pkt, gtk_rekey_failure, 3777 eap_identity_req, four_way_handshake, 3778 rfkill_release; 3779 struct cfg80211_pkt_pattern *patterns; 3780 struct cfg80211_wowlan_tcp *tcp; 3781 int n_patterns; 3782 struct cfg80211_sched_scan_request *nd_config; 3783 }; 3784 3785 /** 3786 * struct cfg80211_coalesce_rules - Coalesce rule parameters 3787 * 3788 * This structure defines coalesce rule for the device. 3789 * @delay: maximum coalescing delay in msecs. 3790 * @condition: condition for packet coalescence. 3791 * see &enum nl80211_coalesce_condition. 3792 * @patterns: array of packet patterns 3793 * @n_patterns: number of patterns 3794 */ 3795 struct cfg80211_coalesce_rules { 3796 int delay; 3797 enum nl80211_coalesce_condition condition; 3798 struct cfg80211_pkt_pattern *patterns; 3799 int n_patterns; 3800 }; 3801 3802 /** 3803 * struct cfg80211_coalesce - Packet coalescing settings 3804 * 3805 * This structure defines coalescing settings. 3806 * @rules: array of coalesce rules 3807 * @n_rules: number of rules 3808 */ 3809 struct cfg80211_coalesce { 3810 int n_rules; 3811 struct cfg80211_coalesce_rules rules[] __counted_by(n_rules); 3812 }; 3813 3814 /** 3815 * struct cfg80211_wowlan_nd_match - information about the match 3816 * 3817 * @ssid: SSID of the match that triggered the wake up 3818 * @n_channels: Number of channels where the match occurred. This 3819 * value may be zero if the driver can't report the channels. 3820 * @channels: center frequencies of the channels where a match 3821 * occurred (in MHz) 3822 */ 3823 struct cfg80211_wowlan_nd_match { 3824 struct cfg80211_ssid ssid; 3825 int n_channels; 3826 u32 channels[] __counted_by(n_channels); 3827 }; 3828 3829 /** 3830 * struct cfg80211_wowlan_nd_info - net detect wake up information 3831 * 3832 * @n_matches: Number of match information instances provided in 3833 * @matches. This value may be zero if the driver can't provide 3834 * match information. 3835 * @matches: Array of pointers to matches containing information about 3836 * the matches that triggered the wake up. 3837 */ 3838 struct cfg80211_wowlan_nd_info { 3839 int n_matches; 3840 struct cfg80211_wowlan_nd_match *matches[] __counted_by(n_matches); 3841 }; 3842 3843 /** 3844 * struct cfg80211_wowlan_wakeup - wakeup report 3845 * @disconnect: woke up by getting disconnected 3846 * @magic_pkt: woke up by receiving magic packet 3847 * @gtk_rekey_failure: woke up by GTK rekey failure 3848 * @eap_identity_req: woke up by EAP identity request packet 3849 * @four_way_handshake: woke up by 4-way handshake 3850 * @rfkill_release: woke up by rfkill being released 3851 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 3852 * @packet_present_len: copied wakeup packet data 3853 * @packet_len: original wakeup packet length 3854 * @packet: The packet causing the wakeup, if any. 3855 * @packet_80211: For pattern match, magic packet and other data 3856 * frame triggers an 802.3 frame should be reported, for 3857 * disconnect due to deauth 802.11 frame. This indicates which 3858 * it is. 3859 * @tcp_match: TCP wakeup packet received 3860 * @tcp_connlost: TCP connection lost or failed to establish 3861 * @tcp_nomoretokens: TCP data ran out of tokens 3862 * @net_detect: if not %NULL, woke up because of net detect 3863 * @unprot_deauth_disassoc: woke up due to unprotected deauth or 3864 * disassoc frame (in MFP). 3865 */ 3866 struct cfg80211_wowlan_wakeup { 3867 bool disconnect, magic_pkt, gtk_rekey_failure, 3868 eap_identity_req, four_way_handshake, 3869 rfkill_release, packet_80211, 3870 tcp_match, tcp_connlost, tcp_nomoretokens, 3871 unprot_deauth_disassoc; 3872 s32 pattern_idx; 3873 u32 packet_present_len, packet_len; 3874 const void *packet; 3875 struct cfg80211_wowlan_nd_info *net_detect; 3876 }; 3877 3878 /** 3879 * struct cfg80211_gtk_rekey_data - rekey data 3880 * @kek: key encryption key (@kek_len bytes) 3881 * @kck: key confirmation key (@kck_len bytes) 3882 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 3883 * @kek_len: length of kek 3884 * @kck_len: length of kck 3885 * @akm: akm (oui, id) 3886 */ 3887 struct cfg80211_gtk_rekey_data { 3888 const u8 *kek, *kck, *replay_ctr; 3889 u32 akm; 3890 u8 kek_len, kck_len; 3891 }; 3892 3893 /** 3894 * struct cfg80211_update_ft_ies_params - FT IE Information 3895 * 3896 * This structure provides information needed to update the fast transition IE 3897 * 3898 * @md: The Mobility Domain ID, 2 Octet value 3899 * @ie: Fast Transition IEs 3900 * @ie_len: Length of ft_ie in octets 3901 */ 3902 struct cfg80211_update_ft_ies_params { 3903 u16 md; 3904 const u8 *ie; 3905 size_t ie_len; 3906 }; 3907 3908 /** 3909 * struct cfg80211_mgmt_tx_params - mgmt tx parameters 3910 * 3911 * This structure provides information needed to transmit a mgmt frame 3912 * 3913 * @chan: channel to use 3914 * @offchan: indicates whether off channel operation is required 3915 * @wait: duration for ROC 3916 * @buf: buffer to transmit 3917 * @len: buffer length 3918 * @no_cck: don't use cck rates for this frame 3919 * @dont_wait_for_ack: tells the low level not to wait for an ack 3920 * @n_csa_offsets: length of csa_offsets array 3921 * @csa_offsets: array of all the csa offsets in the frame 3922 * @link_id: for MLO, the link ID to transmit on, -1 if not given; note 3923 * that the link ID isn't validated (much), it's in range but the 3924 * link might not exist (or be used by the receiver STA) 3925 */ 3926 struct cfg80211_mgmt_tx_params { 3927 struct ieee80211_channel *chan; 3928 bool offchan; 3929 unsigned int wait; 3930 const u8 *buf; 3931 size_t len; 3932 bool no_cck; 3933 bool dont_wait_for_ack; 3934 int n_csa_offsets; 3935 const u16 *csa_offsets; 3936 int link_id; 3937 }; 3938 3939 /** 3940 * struct cfg80211_dscp_exception - DSCP exception 3941 * 3942 * @dscp: DSCP value that does not adhere to the user priority range definition 3943 * @up: user priority value to which the corresponding DSCP value belongs 3944 */ 3945 struct cfg80211_dscp_exception { 3946 u8 dscp; 3947 u8 up; 3948 }; 3949 3950 /** 3951 * struct cfg80211_dscp_range - DSCP range definition for user priority 3952 * 3953 * @low: lowest DSCP value of this user priority range, inclusive 3954 * @high: highest DSCP value of this user priority range, inclusive 3955 */ 3956 struct cfg80211_dscp_range { 3957 u8 low; 3958 u8 high; 3959 }; 3960 3961 /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 3962 #define IEEE80211_QOS_MAP_MAX_EX 21 3963 #define IEEE80211_QOS_MAP_LEN_MIN 16 3964 #define IEEE80211_QOS_MAP_LEN_MAX \ 3965 (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 3966 3967 /** 3968 * struct cfg80211_qos_map - QoS Map Information 3969 * 3970 * This struct defines the Interworking QoS map setting for DSCP values 3971 * 3972 * @num_des: number of DSCP exceptions (0..21) 3973 * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 3974 * the user priority DSCP range definition 3975 * @up: DSCP range definition for a particular user priority 3976 */ 3977 struct cfg80211_qos_map { 3978 u8 num_des; 3979 struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 3980 struct cfg80211_dscp_range up[8]; 3981 }; 3982 3983 /** 3984 * struct cfg80211_nan_band_config - NAN band specific configuration 3985 * 3986 * @chan: Pointer to the IEEE 802.11 channel structure. The channel to be used 3987 * for NAN operations on this band. For 2.4 GHz band, this is always 3988 * channel 6. For 5 GHz band, the channel is either 44 or 149, according 3989 * to the regulatory constraints. If chan pointer is NULL the entire band 3990 * configuration entry is considered invalid and should not be used. 3991 * @rssi_close: RSSI close threshold used for NAN state transition algorithm 3992 * as described in chapters 3.3.6 and 3.3.7 "NAN Device Role and State 3993 * Transition" of Wi-Fi Aware Specification v4.0. If not 3994 * specified (set to 0), default device value is used. The value should 3995 * be greater than -60 dBm. 3996 * @rssi_middle: RSSI middle threshold used for NAN state transition algorithm. 3997 * as described in chapters 3.3.6 and 3.3.7 "NAN Device Role and State 3998 * Transition" of Wi-Fi Aware Specification v4.0. If not 3999 * specified (set to 0), default device value is used. The value should be 4000 * greater than -75 dBm and less than rssi_close. 4001 * @awake_dw_interval: Committed DW interval. Valid values range: 0-5. 0 4002 * indicates no wakeup for DW and can't be used on 2.4GHz band, otherwise 4003 * 2^(n-1). 4004 * @disable_scan: If true, the device will not scan this band for cluster 4005 * merge. Disabling scan on 2.4 GHz band is not allowed. 4006 */ 4007 struct cfg80211_nan_band_config { 4008 struct ieee80211_channel *chan; 4009 s8 rssi_close; 4010 s8 rssi_middle; 4011 u8 awake_dw_interval; 4012 bool disable_scan; 4013 }; 4014 4015 /** 4016 * struct cfg80211_nan_conf - NAN configuration 4017 * 4018 * This struct defines NAN configuration parameters 4019 * 4020 * @master_pref: master preference (1 - 255) 4021 * @bands: operating bands, a bitmap of &enum nl80211_band values. 4022 * For instance, for NL80211_BAND_2GHZ, bit 0 would be set 4023 * (i.e. BIT(NL80211_BAND_2GHZ)). 4024 * @cluster_id: cluster ID used for NAN synchronization. This is a MAC address 4025 * that can take a value from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF. 4026 * @scan_period: period (in seconds) between NAN scans. 4027 * @scan_dwell_time: dwell time (in milliseconds) for NAN scans. 4028 * @discovery_beacon_interval: interval (in TUs) for discovery beacons. 4029 * @enable_dw_notification: flag to enable/disable discovery window 4030 * notifications. 4031 * @band_cfgs: array of band specific configurations, indexed by 4032 * &enum nl80211_band values. 4033 * @extra_nan_attrs: pointer to additional NAN attributes. 4034 * @extra_nan_attrs_len: length of the additional NAN attributes. 4035 * @vendor_elems: pointer to vendor-specific elements. 4036 * @vendor_elems_len: length of the vendor-specific elements. 4037 */ 4038 struct cfg80211_nan_conf { 4039 u8 master_pref; 4040 u8 bands; 4041 u8 cluster_id[ETH_ALEN] __aligned(2); 4042 u16 scan_period; 4043 u16 scan_dwell_time; 4044 u8 discovery_beacon_interval; 4045 bool enable_dw_notification; 4046 struct cfg80211_nan_band_config band_cfgs[NUM_NL80211_BANDS]; 4047 const u8 *extra_nan_attrs; 4048 u16 extra_nan_attrs_len; 4049 const u8 *vendor_elems; 4050 u16 vendor_elems_len; 4051 }; 4052 4053 /** 4054 * enum cfg80211_nan_conf_changes - indicates changed fields in NAN 4055 * configuration 4056 * 4057 * @CFG80211_NAN_CONF_CHANGED_PREF: master preference 4058 * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands 4059 * @CFG80211_NAN_CONF_CHANGED_CONFIG: changed additional configuration. 4060 * When this flag is set, it indicates that some additional attribute(s) 4061 * (other then master_pref and bands) have been changed. In this case, 4062 * all the unchanged attributes will be properly configured to their 4063 * previous values. The driver doesn't need to store any 4064 * previous configuration besides master_pref and bands. 4065 */ 4066 enum cfg80211_nan_conf_changes { 4067 CFG80211_NAN_CONF_CHANGED_PREF = BIT(0), 4068 CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1), 4069 CFG80211_NAN_CONF_CHANGED_CONFIG = BIT(2), 4070 }; 4071 4072 /** 4073 * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter 4074 * 4075 * @filter: the content of the filter 4076 * @len: the length of the filter 4077 */ 4078 struct cfg80211_nan_func_filter { 4079 const u8 *filter; 4080 u8 len; 4081 }; 4082 4083 /** 4084 * struct cfg80211_nan_func - a NAN function 4085 * 4086 * @type: &enum nl80211_nan_function_type 4087 * @service_id: the service ID of the function 4088 * @publish_type: &nl80211_nan_publish_type 4089 * @close_range: if true, the range should be limited. Threshold is 4090 * implementation specific. 4091 * @publish_bcast: if true, the solicited publish should be broadcasted 4092 * @subscribe_active: if true, the subscribe is active 4093 * @followup_id: the instance ID for follow up 4094 * @followup_reqid: the requester instance ID for follow up 4095 * @followup_dest: MAC address of the recipient of the follow up 4096 * @ttl: time to live counter in DW. 4097 * @serv_spec_info: Service Specific Info 4098 * @serv_spec_info_len: Service Specific Info length 4099 * @srf_include: if true, SRF is inclusive 4100 * @srf_bf: Bloom Filter 4101 * @srf_bf_len: Bloom Filter length 4102 * @srf_bf_idx: Bloom Filter index 4103 * @srf_macs: SRF MAC addresses 4104 * @srf_num_macs: number of MAC addresses in SRF 4105 * @rx_filters: rx filters that are matched with corresponding peer's tx_filter 4106 * @tx_filters: filters that should be transmitted in the SDF. 4107 * @num_rx_filters: length of &rx_filters. 4108 * @num_tx_filters: length of &tx_filters. 4109 * @instance_id: driver allocated id of the function. 4110 * @cookie: unique NAN function identifier. 4111 */ 4112 struct cfg80211_nan_func { 4113 enum nl80211_nan_function_type type; 4114 u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; 4115 u8 publish_type; 4116 bool close_range; 4117 bool publish_bcast; 4118 bool subscribe_active; 4119 u8 followup_id; 4120 u8 followup_reqid; 4121 struct mac_address followup_dest; 4122 u32 ttl; 4123 const u8 *serv_spec_info; 4124 u8 serv_spec_info_len; 4125 bool srf_include; 4126 const u8 *srf_bf; 4127 u8 srf_bf_len; 4128 u8 srf_bf_idx; 4129 struct mac_address *srf_macs; 4130 int srf_num_macs; 4131 struct cfg80211_nan_func_filter *rx_filters; 4132 struct cfg80211_nan_func_filter *tx_filters; 4133 u8 num_tx_filters; 4134 u8 num_rx_filters; 4135 u8 instance_id; 4136 u64 cookie; 4137 }; 4138 4139 /** 4140 * struct cfg80211_pmk_conf - PMK configuration 4141 * 4142 * @aa: authenticator address 4143 * @pmk_len: PMK length in bytes. 4144 * @pmk: the PMK material 4145 * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK 4146 * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field 4147 * holds PMK-R0. 4148 */ 4149 struct cfg80211_pmk_conf { 4150 const u8 *aa; 4151 u8 pmk_len; 4152 const u8 *pmk; 4153 const u8 *pmk_r0_name; 4154 }; 4155 4156 /** 4157 * struct cfg80211_external_auth_params - Trigger External authentication. 4158 * 4159 * Commonly used across the external auth request and event interfaces. 4160 * 4161 * @action: action type / trigger for external authentication. Only significant 4162 * for the authentication request event interface (driver to user space). 4163 * @bssid: BSSID of the peer with which the authentication has 4164 * to happen. Used by both the authentication request event and 4165 * authentication response command interface. 4166 * @ssid: SSID of the AP. Used by both the authentication request event and 4167 * authentication response command interface. 4168 * @key_mgmt_suite: AKM suite of the respective authentication. Used by the 4169 * authentication request event interface. 4170 * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication, 4171 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you 4172 * the real status code for failures. Used only for the authentication 4173 * response command interface (user space to driver). 4174 * @pmkid: The identifier to refer a PMKSA. 4175 * @mld_addr: MLD address of the peer. Used by the authentication request event 4176 * interface. Driver indicates this to enable MLO during the authentication 4177 * offload to user space. Driver shall look at %NL80211_ATTR_MLO_SUPPORT 4178 * flag capability in NL80211_CMD_CONNECT to know whether the user space 4179 * supports enabling MLO during the authentication offload. 4180 * User space should use the address of the interface (on which the 4181 * authentication request event reported) as self MLD address. User space 4182 * and driver should use MLD addresses in RA, TA and BSSID fields of 4183 * authentication frames sent or received via cfg80211. The driver 4184 * translates the MLD addresses to/from link addresses based on the link 4185 * chosen for the authentication. 4186 */ 4187 struct cfg80211_external_auth_params { 4188 enum nl80211_external_auth_action action; 4189 u8 bssid[ETH_ALEN] __aligned(2); 4190 struct cfg80211_ssid ssid; 4191 unsigned int key_mgmt_suite; 4192 u16 status; 4193 const u8 *pmkid; 4194 u8 mld_addr[ETH_ALEN] __aligned(2); 4195 }; 4196 4197 /** 4198 * struct cfg80211_ftm_responder_stats - FTM responder statistics 4199 * 4200 * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to 4201 * indicate the relevant values in this struct for them 4202 * @success_num: number of FTM sessions in which all frames were successfully 4203 * answered 4204 * @partial_num: number of FTM sessions in which part of frames were 4205 * successfully answered 4206 * @failed_num: number of failed FTM sessions 4207 * @asap_num: number of ASAP FTM sessions 4208 * @non_asap_num: number of non-ASAP FTM sessions 4209 * @total_duration_ms: total sessions durations - gives an indication 4210 * of how much time the responder was busy 4211 * @unknown_triggers_num: number of unknown FTM triggers - triggers from 4212 * initiators that didn't finish successfully the negotiation phase with 4213 * the responder 4214 * @reschedule_requests_num: number of FTM reschedule requests - initiator asks 4215 * for a new scheduling although it already has scheduled FTM slot 4216 * @out_of_window_triggers_num: total FTM triggers out of scheduled window 4217 */ 4218 struct cfg80211_ftm_responder_stats { 4219 u32 filled; 4220 u32 success_num; 4221 u32 partial_num; 4222 u32 failed_num; 4223 u32 asap_num; 4224 u32 non_asap_num; 4225 u64 total_duration_ms; 4226 u32 unknown_triggers_num; 4227 u32 reschedule_requests_num; 4228 u32 out_of_window_triggers_num; 4229 }; 4230 4231 /** 4232 * struct cfg80211_pmsr_ftm_result - FTM result 4233 * @failure_reason: if this measurement failed (PMSR status is 4234 * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise 4235 * reason than just "failure" 4236 * @burst_index: if reporting partial results, this is the index 4237 * in [0 .. num_bursts-1] of the burst that's being reported 4238 * @num_ftmr_attempts: number of FTM request frames transmitted 4239 * @num_ftmr_successes: number of FTM request frames acked 4240 * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY, 4241 * fill this to indicate in how many seconds a retry is deemed possible 4242 * by the responder 4243 * @num_bursts_exp: actual number of bursts exponent negotiated 4244 * @burst_duration: actual burst duration negotiated 4245 * @ftms_per_burst: actual FTMs per burst negotiated 4246 * @burst_period: actual burst period negotiated in units of 100ms 4247 * @lci_len: length of LCI information (if present) 4248 * @civicloc_len: length of civic location information (if present) 4249 * @lci: LCI data (may be %NULL) 4250 * @civicloc: civic location data (may be %NULL) 4251 * @rssi_avg: average RSSI over FTM action frames reported 4252 * @rssi_spread: spread of the RSSI over FTM action frames reported 4253 * @tx_rate: bitrate for transmitted FTM action frame response 4254 * @rx_rate: bitrate of received FTM action frame 4255 * @rtt_avg: average of RTTs measured (must have either this or @dist_avg) 4256 * @rtt_variance: variance of RTTs measured (note that standard deviation is 4257 * the square root of the variance) 4258 * @rtt_spread: spread of the RTTs measured 4259 * @dist_avg: average of distances (mm) measured 4260 * (must have either this or @rtt_avg) 4261 * @dist_variance: variance of distances measured (see also @rtt_variance) 4262 * @dist_spread: spread of distances measured (see also @rtt_spread) 4263 * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid 4264 * @num_ftmr_successes_valid: @num_ftmr_successes is valid 4265 * @rssi_avg_valid: @rssi_avg is valid 4266 * @rssi_spread_valid: @rssi_spread is valid 4267 * @tx_rate_valid: @tx_rate is valid 4268 * @rx_rate_valid: @rx_rate is valid 4269 * @rtt_avg_valid: @rtt_avg is valid 4270 * @rtt_variance_valid: @rtt_variance is valid 4271 * @rtt_spread_valid: @rtt_spread is valid 4272 * @dist_avg_valid: @dist_avg is valid 4273 * @dist_variance_valid: @dist_variance is valid 4274 * @dist_spread_valid: @dist_spread is valid 4275 */ 4276 struct cfg80211_pmsr_ftm_result { 4277 const u8 *lci; 4278 const u8 *civicloc; 4279 unsigned int lci_len; 4280 unsigned int civicloc_len; 4281 enum nl80211_peer_measurement_ftm_failure_reasons failure_reason; 4282 u32 num_ftmr_attempts, num_ftmr_successes; 4283 s16 burst_index; 4284 u8 busy_retry_time; 4285 u8 num_bursts_exp; 4286 u8 burst_duration; 4287 u8 ftms_per_burst; 4288 u16 burst_period; 4289 s32 rssi_avg; 4290 s32 rssi_spread; 4291 struct rate_info tx_rate, rx_rate; 4292 s64 rtt_avg; 4293 s64 rtt_variance; 4294 s64 rtt_spread; 4295 s64 dist_avg; 4296 s64 dist_variance; 4297 s64 dist_spread; 4298 4299 u16 num_ftmr_attempts_valid:1, 4300 num_ftmr_successes_valid:1, 4301 rssi_avg_valid:1, 4302 rssi_spread_valid:1, 4303 tx_rate_valid:1, 4304 rx_rate_valid:1, 4305 rtt_avg_valid:1, 4306 rtt_variance_valid:1, 4307 rtt_spread_valid:1, 4308 dist_avg_valid:1, 4309 dist_variance_valid:1, 4310 dist_spread_valid:1; 4311 }; 4312 4313 /** 4314 * struct cfg80211_pmsr_result - peer measurement result 4315 * @addr: address of the peer 4316 * @host_time: host time (use ktime_get_boottime() adjust to the time when the 4317 * measurement was made) 4318 * @ap_tsf: AP's TSF at measurement time 4319 * @status: status of the measurement 4320 * @final: if reporting partial results, mark this as the last one; if not 4321 * reporting partial results always set this flag 4322 * @ap_tsf_valid: indicates the @ap_tsf value is valid 4323 * @type: type of the measurement reported, note that we only support reporting 4324 * one type at a time, but you can report multiple results separately and 4325 * they're all aggregated for userspace. 4326 * @ftm: FTM result 4327 */ 4328 struct cfg80211_pmsr_result { 4329 u64 host_time, ap_tsf; 4330 enum nl80211_peer_measurement_status status; 4331 4332 u8 addr[ETH_ALEN]; 4333 4334 u8 final:1, 4335 ap_tsf_valid:1; 4336 4337 enum nl80211_peer_measurement_type type; 4338 4339 union { 4340 struct cfg80211_pmsr_ftm_result ftm; 4341 }; 4342 }; 4343 4344 /** 4345 * struct cfg80211_pmsr_ftm_request_peer - FTM request data 4346 * @requested: indicates FTM is requested 4347 * @preamble: frame preamble to use 4348 * @burst_period: burst period to use 4349 * @asap: indicates to use ASAP mode 4350 * @num_bursts_exp: number of bursts exponent 4351 * @burst_duration: burst duration. If @trigger_based or @non_trigger_based is 4352 * set, this is the burst duration in milliseconds, and zero means the 4353 * device should pick an appropriate value based on @ftms_per_burst. 4354 * @ftms_per_burst: number of FTMs per burst 4355 * @ftmr_retries: number of retries for FTM request 4356 * @request_lci: request LCI information 4357 * @request_civicloc: request civic location information 4358 * @trigger_based: use trigger based ranging for the measurement 4359 * If neither @trigger_based nor @non_trigger_based is set, 4360 * EDCA based ranging will be used. 4361 * @non_trigger_based: use non trigger based ranging for the measurement 4362 * If neither @trigger_based nor @non_trigger_based is set, 4363 * EDCA based ranging will be used. 4364 * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either 4365 * @trigger_based or @non_trigger_based is set. 4366 * @rsta: Operate as the RSTA in the measurement. Only valid if @lmr_feedback 4367 * and either @trigger_based or @non_trigger_based is set. 4368 * @bss_color: the bss color of the responder. Optional. Set to zero to 4369 * indicate the driver should set the BSS color. Only valid if 4370 * @non_trigger_based or @trigger_based is set. 4371 * 4372 * See also nl80211 for the respective attribute documentation. 4373 */ 4374 struct cfg80211_pmsr_ftm_request_peer { 4375 enum nl80211_preamble preamble; 4376 u16 burst_period; 4377 u8 requested:1, 4378 asap:1, 4379 request_lci:1, 4380 request_civicloc:1, 4381 trigger_based:1, 4382 non_trigger_based:1, 4383 lmr_feedback:1, 4384 rsta:1; 4385 u8 num_bursts_exp; 4386 u8 burst_duration; 4387 u8 ftms_per_burst; 4388 u8 ftmr_retries; 4389 u8 bss_color; 4390 }; 4391 4392 /** 4393 * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request 4394 * @addr: MAC address 4395 * @chandef: channel to use 4396 * @report_ap_tsf: report the associated AP's TSF 4397 * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer 4398 */ 4399 struct cfg80211_pmsr_request_peer { 4400 u8 addr[ETH_ALEN]; 4401 struct cfg80211_chan_def chandef; 4402 u8 report_ap_tsf:1; 4403 struct cfg80211_pmsr_ftm_request_peer ftm; 4404 }; 4405 4406 /** 4407 * struct cfg80211_pmsr_request - peer measurement request 4408 * @cookie: cookie, set by cfg80211 4409 * @nl_portid: netlink portid - used by cfg80211 4410 * @drv_data: driver data for this request, if required for aborting, 4411 * not otherwise freed or anything by cfg80211 4412 * @mac_addr: MAC address used for (randomised) request 4413 * @mac_addr_mask: MAC address mask used for randomisation, bits that 4414 * are 0 in the mask should be randomised, bits that are 1 should 4415 * be taken from the @mac_addr 4416 * @list: used by cfg80211 to hold on to the request 4417 * @timeout: timeout (in milliseconds) for the whole operation, if 4418 * zero it means there's no timeout 4419 * @n_peers: number of peers to do measurements with 4420 * @peers: per-peer measurement request data 4421 */ 4422 struct cfg80211_pmsr_request { 4423 u64 cookie; 4424 void *drv_data; 4425 u32 n_peers; 4426 u32 nl_portid; 4427 4428 u32 timeout; 4429 4430 u8 mac_addr[ETH_ALEN] __aligned(2); 4431 u8 mac_addr_mask[ETH_ALEN] __aligned(2); 4432 4433 struct list_head list; 4434 4435 struct cfg80211_pmsr_request_peer peers[] __counted_by(n_peers); 4436 }; 4437 4438 /** 4439 * struct cfg80211_update_owe_info - OWE Information 4440 * 4441 * This structure provides information needed for the drivers to offload OWE 4442 * (Opportunistic Wireless Encryption) processing to the user space. 4443 * 4444 * Commonly used across update_owe_info request and event interfaces. 4445 * 4446 * @peer: MAC address of the peer device for which the OWE processing 4447 * has to be done. 4448 * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info 4449 * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space 4450 * cannot give you the real status code for failures. Used only for 4451 * OWE update request command interface (user space to driver). 4452 * @ie: IEs obtained from the peer or constructed by the user space. These are 4453 * the IEs of the remote peer in the event from the host driver and 4454 * the constructed IEs by the user space in the request interface. 4455 * @ie_len: Length of IEs in octets. 4456 * @assoc_link_id: MLO link ID of the AP, with which (re)association requested 4457 * by peer. This will be filled by driver for both MLO and non-MLO station 4458 * connections when the AP affiliated with an MLD. For non-MLD AP mode, it 4459 * will be -1. Used only with OWE update event (driver to user space). 4460 * @peer_mld_addr: For MLO connection, MLD address of the peer. For non-MLO 4461 * connection, it will be all zeros. This is applicable only when 4462 * @assoc_link_id is not -1, i.e., the AP affiliated with an MLD. Used only 4463 * with OWE update event (driver to user space). 4464 */ 4465 struct cfg80211_update_owe_info { 4466 u8 peer[ETH_ALEN] __aligned(2); 4467 u16 status; 4468 const u8 *ie; 4469 size_t ie_len; 4470 int assoc_link_id; 4471 u8 peer_mld_addr[ETH_ALEN] __aligned(2); 4472 }; 4473 4474 /** 4475 * struct mgmt_frame_regs - management frame registrations data 4476 * @global_stypes: bitmap of management frame subtypes registered 4477 * for the entire device 4478 * @interface_stypes: bitmap of management frame subtypes registered 4479 * for the given interface 4480 * @global_mcast_stypes: mcast RX is needed globally for these subtypes 4481 * @interface_mcast_stypes: mcast RX is needed on this interface 4482 * for these subtypes 4483 */ 4484 struct mgmt_frame_regs { 4485 u32 global_stypes, interface_stypes; 4486 u32 global_mcast_stypes, interface_mcast_stypes; 4487 }; 4488 4489 /** 4490 * struct cfg80211_ops - backend description for wireless configuration 4491 * 4492 * This struct is registered by fullmac card drivers and/or wireless stacks 4493 * in order to handle configuration requests on their interfaces. 4494 * 4495 * All callbacks except where otherwise noted should return 0 4496 * on success or a negative error code. 4497 * 4498 * All operations are invoked with the wiphy mutex held. The RTNL may be 4499 * held in addition (due to wireless extensions) but this cannot be relied 4500 * upon except in cases where documented below. Note that due to ordering, 4501 * the RTNL also cannot be acquired in any handlers. 4502 * 4503 * @suspend: wiphy device needs to be suspended. The variable @wow will 4504 * be %NULL or contain the enabled Wake-on-Wireless triggers that are 4505 * configured for the device. 4506 * @resume: wiphy device needs to be resumed 4507 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 4508 * to call device_set_wakeup_enable() to enable/disable wakeup from 4509 * the device. 4510 * 4511 * @add_virtual_intf: create a new virtual interface with the given name, 4512 * must set the struct wireless_dev's iftype. Beware: You must create 4513 * the new netdev in the wiphy's network namespace! Returns the struct 4514 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 4515 * also set the address member in the wdev. 4516 * This additionally holds the RTNL to be able to do netdev changes. 4517 * 4518 * @del_virtual_intf: remove the virtual interface 4519 * This additionally holds the RTNL to be able to do netdev changes. 4520 * 4521 * @change_virtual_intf: change type/configuration of virtual interface, 4522 * keep the struct wireless_dev's iftype updated. 4523 * This additionally holds the RTNL to be able to do netdev changes. 4524 * 4525 * @add_intf_link: Add a new MLO link to the given interface. Note that 4526 * the wdev->link[] data structure has been updated, so the new link 4527 * address is available. 4528 * @del_intf_link: Remove an MLO link from the given interface. 4529 * 4530 * @add_key: add a key with the given parameters. @mac_addr will be %NULL 4531 * when adding a group key. @link_id will be -1 for non-MLO connection. 4532 * For MLO connection, @link_id will be >= 0 for group key and -1 for 4533 * pairwise key, @mac_addr will be peer's MLD address for MLO pairwise key. 4534 * 4535 * @get_key: get information about the key with the given parameters. 4536 * @mac_addr will be %NULL when requesting information for a group 4537 * key. All pointers given to the @callback function need not be valid 4538 * after it returns. This function should return an error if it is 4539 * not possible to retrieve the key, -ENOENT if it doesn't exist. 4540 * @link_id will be -1 for non-MLO connection. For MLO connection, 4541 * @link_id will be >= 0 for group key and -1 for pairwise key, @mac_addr 4542 * will be peer's MLD address for MLO pairwise key. 4543 * 4544 * @del_key: remove a key given the @mac_addr (%NULL for a group key) 4545 * and @key_index, return -ENOENT if the key doesn't exist. @link_id will 4546 * be -1 for non-MLO connection. For MLO connection, @link_id will be >= 0 4547 * for group key and -1 for pairwise key, @mac_addr will be peer's MLD 4548 * address for MLO pairwise key. 4549 * 4550 * @set_default_key: set the default key on an interface. @link_id will be >= 0 4551 * for MLO connection and -1 for non-MLO connection. 4552 * 4553 * @set_default_mgmt_key: set the default management frame key on an interface. 4554 * @link_id will be >= 0 for MLO connection and -1 for non-MLO connection. 4555 * 4556 * @set_default_beacon_key: set the default Beacon frame key on an interface. 4557 * @link_id will be >= 0 for MLO connection and -1 for non-MLO connection. 4558 * 4559 * @set_rekey_data: give the data necessary for GTK rekeying to the driver 4560 * 4561 * @start_ap: Start acting in AP mode defined by the parameters. 4562 * @change_beacon: Change the beacon parameters for an access point mode 4563 * interface. This should reject the call when AP mode wasn't started. 4564 * @stop_ap: Stop being an AP, including stopping beaconing. 4565 * 4566 * @add_station: Add a new station. 4567 * @del_station: Remove a station 4568 * @change_station: Modify a given station. Note that flags changes are not much 4569 * validated in cfg80211, in particular the auth/assoc/authorized flags 4570 * might come to the driver in invalid combinations -- make sure to check 4571 * them, also against the existing state! Drivers must call 4572 * cfg80211_check_station_change() to validate the information. 4573 * @get_station: get station information for the station identified by @mac 4574 * @dump_station: dump station callback -- resume dump at index @idx 4575 * 4576 * @add_mpath: add a fixed mesh path 4577 * @del_mpath: delete a given mesh path 4578 * @change_mpath: change a given mesh path 4579 * @get_mpath: get a mesh path for the given parameters 4580 * @dump_mpath: dump mesh path callback -- resume dump at index @idx 4581 * @get_mpp: get a mesh proxy path for the given parameters 4582 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 4583 * @join_mesh: join the mesh network with the specified parameters 4584 * (invoked with the wireless_dev mutex held) 4585 * @leave_mesh: leave the current mesh network 4586 * (invoked with the wireless_dev mutex held) 4587 * 4588 * @get_mesh_config: Get the current mesh configuration 4589 * 4590 * @update_mesh_config: Update mesh parameters on a running mesh. 4591 * The mask is a bitfield which tells us which parameters to 4592 * set, and which to leave alone. 4593 * 4594 * @change_bss: Modify parameters for a given BSS. 4595 * 4596 * @inform_bss: Called by cfg80211 while being informed about new BSS data 4597 * for every BSS found within the reported data or frame. This is called 4598 * from within the cfg8011 inform_bss handlers while holding the bss_lock. 4599 * The data parameter is passed through from drv_data inside 4600 * struct cfg80211_inform_bss. 4601 * The new IE data for the BSS is explicitly passed. 4602 * 4603 * @set_txq_params: Set TX queue parameters 4604 * 4605 * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 4606 * as it doesn't implement join_mesh and needs to set the channel to 4607 * join the mesh instead. 4608 * 4609 * @set_monitor_channel: Set the monitor mode channel for the device. If other 4610 * interfaces are active this callback should reject the configuration. 4611 * If no interfaces are active or the device is down, the channel should 4612 * be stored for when a monitor interface becomes active. 4613 * 4614 * @scan: Request to do a scan. If returning zero, the scan request is given 4615 * the driver, and will be valid until passed to cfg80211_scan_done(). 4616 * For scan results, call cfg80211_inform_bss(); you can call this outside 4617 * the scan/scan_done bracket too. 4618 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall 4619 * indicate the status of the scan through cfg80211_scan_done(). 4620 * 4621 * @auth: Request to authenticate with the specified peer 4622 * (invoked with the wireless_dev mutex held) 4623 * @assoc: Request to (re)associate with the specified peer 4624 * (invoked with the wireless_dev mutex held) 4625 * @deauth: Request to deauthenticate from the specified peer 4626 * (invoked with the wireless_dev mutex held) 4627 * @disassoc: Request to disassociate from the specified peer 4628 * (invoked with the wireless_dev mutex held) 4629 * 4630 * @connect: Connect to the ESS with the specified parameters. When connected, 4631 * call cfg80211_connect_result()/cfg80211_connect_bss() with status code 4632 * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call 4633 * cfg80211_connect_result()/cfg80211_connect_bss() with the status code 4634 * from the AP or cfg80211_connect_timeout() if no frame with status code 4635 * was received. 4636 * The driver is allowed to roam to other BSSes within the ESS when the 4637 * other BSS matches the connect parameters. When such roaming is initiated 4638 * by the driver, the driver is expected to verify that the target matches 4639 * the configured security parameters and to use Reassociation Request 4640 * frame instead of Association Request frame. 4641 * The connect function can also be used to request the driver to perform a 4642 * specific roam when connected to an ESS. In that case, the prev_bssid 4643 * parameter is set to the BSSID of the currently associated BSS as an 4644 * indication of requesting reassociation. 4645 * In both the driver-initiated and new connect() call initiated roaming 4646 * cases, the result of roaming is indicated with a call to 4647 * cfg80211_roamed(). (invoked with the wireless_dev mutex held) 4648 * @update_connect_params: Update the connect parameters while connected to a 4649 * BSS. The updated parameters can be used by driver/firmware for 4650 * subsequent BSS selection (roaming) decisions and to form the 4651 * Authentication/(Re)Association Request frames. This call does not 4652 * request an immediate disassociation or reassociation with the current 4653 * BSS, i.e., this impacts only subsequent (re)associations. The bits in 4654 * changed are defined in &enum cfg80211_connect_params_changed. 4655 * (invoked with the wireless_dev mutex held) 4656 * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if 4657 * connection is in progress. Once done, call cfg80211_disconnected() in 4658 * case connection was already established (invoked with the 4659 * wireless_dev mutex held), otherwise call cfg80211_connect_timeout(). 4660 * 4661 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 4662 * cfg80211_ibss_joined(), also call that function when changing BSSID due 4663 * to a merge. 4664 * (invoked with the wireless_dev mutex held) 4665 * @leave_ibss: Leave the IBSS. 4666 * (invoked with the wireless_dev mutex held) 4667 * 4668 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 4669 * MESH mode) 4670 * 4671 * @set_wiphy_params: Notify that wiphy parameters have changed; 4672 * @changed bitfield (see &enum wiphy_params_flags) describes which values 4673 * have changed. The actual parameter values are available in 4674 * struct wiphy. If returning an error, no value should be changed. 4675 * 4676 * @set_tx_power: set the transmit power according to the parameters, 4677 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 4678 * wdev may be %NULL if power was set for the wiphy, and will 4679 * always be %NULL unless the driver supports per-vif TX power 4680 * (as advertised by the nl80211 feature flag.) 4681 * @get_tx_power: store the current TX power into the dbm variable; 4682 * return 0 if successful 4683 * 4684 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 4685 * functions to adjust rfkill hw state 4686 * 4687 * @dump_survey: get site survey information. 4688 * 4689 * @remain_on_channel: Request the driver to remain awake on the specified 4690 * channel for the specified duration to complete an off-channel 4691 * operation (e.g., public action frame exchange). When the driver is 4692 * ready on the requested channel, it must indicate this with an event 4693 * notification by calling cfg80211_ready_on_channel(). 4694 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 4695 * This allows the operation to be terminated prior to timeout based on 4696 * the duration value. 4697 * @mgmt_tx: Transmit a management frame. 4698 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 4699 * frame on another channel 4700 * 4701 * @testmode_cmd: run a test mode command; @wdev may be %NULL 4702 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 4703 * used by the function, but 0 and 1 must not be touched. Additionally, 4704 * return error codes other than -ENOBUFS and -ENOENT will terminate the 4705 * dump and return to userspace with an error, so be careful. If any data 4706 * was passed in from userspace then the data/len arguments will be present 4707 * and point to the data contained in %NL80211_ATTR_TESTDATA. 4708 * 4709 * @set_bitrate_mask: set the bitrate mask configuration 4710 * 4711 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 4712 * devices running firmwares capable of generating the (re) association 4713 * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 4714 * @del_pmksa: Delete a cached PMKID. 4715 * @flush_pmksa: Flush all cached PMKIDs. 4716 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 4717 * allows the driver to adjust the dynamic ps timeout value. 4718 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 4719 * After configuration, the driver should (soon) send an event indicating 4720 * the current level is above/below the configured threshold; this may 4721 * need some care when the configuration is changed (without first being 4722 * disabled.) 4723 * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the 4724 * connection quality monitor. An event is to be sent only when the 4725 * signal level is found to be outside the two values. The driver should 4726 * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented. 4727 * If it is provided then there's no point providing @set_cqm_rssi_config. 4728 * @set_cqm_txe_config: Configure connection quality monitor TX error 4729 * thresholds. 4730 * @sched_scan_start: Tell the driver to start a scheduled scan. 4731 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with 4732 * given request id. This call must stop the scheduled scan and be ready 4733 * for starting a new one before it returns, i.e. @sched_scan_start may be 4734 * called immediately after that again and should not fail in that case. 4735 * The driver should not call cfg80211_sched_scan_stopped() for a requested 4736 * stop (when this method returns 0). 4737 * 4738 * @update_mgmt_frame_registrations: Notify the driver that management frame 4739 * registrations were updated. The callback is allowed to sleep. 4740 * 4741 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 4742 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 4743 * reject TX/RX mask combinations they cannot support by returning -EINVAL 4744 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 4745 * 4746 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 4747 * 4748 * @tdls_mgmt: Transmit a TDLS management frame. 4749 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 4750 * 4751 * @probe_client: probe an associated client, must return a cookie that it 4752 * later passes to cfg80211_probe_status(). 4753 * 4754 * @set_noack_map: Set the NoAck Map for the TIDs. 4755 * 4756 * @get_channel: Get the current operating channel for the virtual interface. 4757 * For monitor interfaces, it should return %NULL unless there's a single 4758 * current monitoring channel. 4759 * 4760 * @start_p2p_device: Start the given P2P device. 4761 * @stop_p2p_device: Stop the given P2P device. 4762 * 4763 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 4764 * Parameters include ACL policy, an array of MAC address of stations 4765 * and the number of MAC addresses. If there is already a list in driver 4766 * this new list replaces the existing one. Driver has to clear its ACL 4767 * when number of MAC addresses entries is passed as 0. Drivers which 4768 * advertise the support for MAC based ACL have to implement this callback. 4769 * 4770 * @start_radar_detection: Start radar detection in the driver. 4771 * 4772 * @end_cac: End running CAC, probably because a related CAC 4773 * was finished on another phy. 4774 * 4775 * @update_ft_ies: Provide updated Fast BSS Transition information to the 4776 * driver. If the SME is in the driver/firmware, this information can be 4777 * used in building Authentication and Reassociation Request frames. 4778 * 4779 * @crit_proto_start: Indicates a critical protocol needs more link reliability 4780 * for a given duration (milliseconds). The protocol is provided so the 4781 * driver can take the most appropriate actions. 4782 * @crit_proto_stop: Indicates critical protocol no longer needs increased link 4783 * reliability. This operation can not fail. 4784 * @set_coalesce: Set coalesce parameters. 4785 * 4786 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 4787 * responsible for veryfing if the switch is possible. Since this is 4788 * inherently tricky driver may decide to disconnect an interface later 4789 * with cfg80211_stop_iface(). This doesn't mean driver can accept 4790 * everything. It should do it's best to verify requests and reject them 4791 * as soon as possible. 4792 * 4793 * @set_qos_map: Set QoS mapping information to the driver 4794 * 4795 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 4796 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 4797 * changes during the lifetime of the BSS. 4798 * 4799 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 4800 * with the given parameters; action frame exchange has been handled by 4801 * userspace so this just has to modify the TX path to take the TS into 4802 * account. 4803 * If the admitted time is 0 just validate the parameters to make sure 4804 * the session can be created at all; it is valid to just always return 4805 * success for that but that may result in inefficient behaviour (handshake 4806 * with the peer followed by immediate teardown when the addition is later 4807 * rejected) 4808 * @del_tx_ts: remove an existing TX TS 4809 * 4810 * @join_ocb: join the OCB network with the specified parameters 4811 * (invoked with the wireless_dev mutex held) 4812 * @leave_ocb: leave the current OCB network 4813 * (invoked with the wireless_dev mutex held) 4814 * 4815 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 4816 * is responsible for continually initiating channel-switching operations 4817 * and returning to the base channel for communication with the AP. 4818 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 4819 * peers must be on the base channel when the call completes. 4820 * @start_nan: Start the NAN interface. 4821 * @stop_nan: Stop the NAN interface. 4822 * @add_nan_func: Add a NAN function. Returns negative value on failure. 4823 * On success @nan_func ownership is transferred to the driver and 4824 * it may access it outside of the scope of this function. The driver 4825 * should free the @nan_func when no longer needed by calling 4826 * cfg80211_free_nan_func(). 4827 * On success the driver should assign an instance_id in the 4828 * provided @nan_func. 4829 * @del_nan_func: Delete a NAN function. 4830 * @nan_change_conf: changes NAN configuration. The changed parameters must 4831 * be specified in @changes (using &enum cfg80211_nan_conf_changes); 4832 * All other parameters must be ignored. 4833 * 4834 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS 4835 * 4836 * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this 4837 * function should return phy stats, and interface stats otherwise. 4838 * 4839 * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake. 4840 * If not deleted through @del_pmk the PMK remains valid until disconnect 4841 * upon which the driver should clear it. 4842 * (invoked with the wireless_dev mutex held) 4843 * @del_pmk: delete the previously configured PMK for the given authenticator. 4844 * (invoked with the wireless_dev mutex held) 4845 * 4846 * @external_auth: indicates result of offloaded authentication processing from 4847 * user space 4848 * 4849 * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter 4850 * tells the driver that the frame should not be encrypted. 4851 * 4852 * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available. 4853 * Statistics should be cumulative, currently no way to reset is provided. 4854 * @start_pmsr: start peer measurement (e.g. FTM) 4855 * @abort_pmsr: abort peer measurement 4856 * 4857 * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME 4858 * but offloading OWE processing to the user space will get the updated 4859 * DH IE through this interface. 4860 * 4861 * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame 4862 * and overrule HWMP path selection algorithm. 4863 * @set_tid_config: TID specific configuration, this can be peer or BSS specific 4864 * This callback may sleep. 4865 * @reset_tid_config: Reset TID specific configuration for the peer, for the 4866 * given TIDs. This callback may sleep. 4867 * 4868 * @set_sar_specs: Update the SAR (TX power) settings. 4869 * 4870 * @color_change: Initiate a color change. 4871 * 4872 * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use 4873 * those to decrypt (Re)Association Request and encrypt (Re)Association 4874 * Response frame. 4875 * 4876 * @set_radar_background: Configure dedicated offchannel chain available for 4877 * radar/CAC detection on some hw. This chain can't be used to transmit 4878 * or receive frames and it is bounded to a running wdev. 4879 * Background radar/CAC detection allows to avoid the CAC downtime 4880 * switching to a different channel during CAC detection on the selected 4881 * radar channel. 4882 * The caller is expected to set chandef pointer to NULL in order to 4883 * disable background CAC/radar detection. 4884 * @add_link_station: Add a link to a station. 4885 * @mod_link_station: Modify a link of a station. 4886 * @del_link_station: Remove a link of a station. 4887 * 4888 * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. 4889 * @set_ttlm: set the TID to link mapping. 4890 * @set_epcs: Enable/Disable EPCS for station mode. 4891 * @get_radio_mask: get bitmask of radios in use. 4892 * (invoked with the wiphy mutex held) 4893 * @assoc_ml_reconf: Request a non-AP MLO connection to perform ML 4894 * reconfiguration, i.e., add and/or remove links to/from the 4895 * association using ML reconfiguration action frames. Successfully added 4896 * links will be added to the set of valid links. Successfully removed 4897 * links will be removed from the set of valid links. The driver must 4898 * indicate removed links by calling cfg80211_links_removed() and added 4899 * links by calling cfg80211_mlo_reconf_add_done(). When calling 4900 * cfg80211_mlo_reconf_add_done() the bss pointer must be given for each 4901 * link for which MLO reconfiguration 'add' operation was requested. 4902 */ 4903 struct cfg80211_ops { 4904 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 4905 int (*resume)(struct wiphy *wiphy); 4906 void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 4907 4908 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 4909 const char *name, 4910 unsigned char name_assign_type, 4911 enum nl80211_iftype type, 4912 struct vif_params *params); 4913 int (*del_virtual_intf)(struct wiphy *wiphy, 4914 struct wireless_dev *wdev); 4915 int (*change_virtual_intf)(struct wiphy *wiphy, 4916 struct net_device *dev, 4917 enum nl80211_iftype type, 4918 struct vif_params *params); 4919 4920 int (*add_intf_link)(struct wiphy *wiphy, 4921 struct wireless_dev *wdev, 4922 unsigned int link_id); 4923 void (*del_intf_link)(struct wiphy *wiphy, 4924 struct wireless_dev *wdev, 4925 unsigned int link_id); 4926 4927 int (*add_key)(struct wiphy *wiphy, struct wireless_dev *wdev, 4928 int link_id, u8 key_index, bool pairwise, 4929 const u8 *mac_addr, struct key_params *params); 4930 int (*get_key)(struct wiphy *wiphy, struct wireless_dev *wdev, 4931 int link_id, u8 key_index, bool pairwise, 4932 const u8 *mac_addr, void *cookie, 4933 void (*callback)(void *cookie, struct key_params*)); 4934 int (*del_key)(struct wiphy *wiphy, struct wireless_dev *wdev, 4935 int link_id, u8 key_index, bool pairwise, 4936 const u8 *mac_addr); 4937 int (*set_default_key)(struct wiphy *wiphy, 4938 struct net_device *netdev, int link_id, 4939 u8 key_index, bool unicast, bool multicast); 4940 int (*set_default_mgmt_key)(struct wiphy *wiphy, 4941 struct wireless_dev *wdev, int link_id, 4942 u8 key_index); 4943 int (*set_default_beacon_key)(struct wiphy *wiphy, 4944 struct wireless_dev *wdev, 4945 int link_id, 4946 u8 key_index); 4947 4948 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 4949 struct cfg80211_ap_settings *settings); 4950 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 4951 struct cfg80211_ap_update *info); 4952 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev, 4953 unsigned int link_id); 4954 4955 4956 int (*add_station)(struct wiphy *wiphy, struct wireless_dev *wdev, 4957 const u8 *mac, 4958 struct station_parameters *params); 4959 int (*del_station)(struct wiphy *wiphy, struct wireless_dev *wdev, 4960 struct station_del_parameters *params); 4961 int (*change_station)(struct wiphy *wiphy, struct wireless_dev *wdev, 4962 const u8 *mac, 4963 struct station_parameters *params); 4964 int (*get_station)(struct wiphy *wiphy, struct wireless_dev *wdev, 4965 const u8 *mac, struct station_info *sinfo); 4966 int (*dump_station)(struct wiphy *wiphy, struct wireless_dev *wdev, 4967 int idx, u8 *mac, struct station_info *sinfo); 4968 4969 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 4970 const u8 *dst, const u8 *next_hop); 4971 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 4972 const u8 *dst); 4973 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 4974 const u8 *dst, const u8 *next_hop); 4975 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 4976 u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 4977 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 4978 int idx, u8 *dst, u8 *next_hop, 4979 struct mpath_info *pinfo); 4980 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 4981 u8 *dst, u8 *mpp, struct mpath_info *pinfo); 4982 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 4983 int idx, u8 *dst, u8 *mpp, 4984 struct mpath_info *pinfo); 4985 int (*get_mesh_config)(struct wiphy *wiphy, 4986 struct net_device *dev, 4987 struct mesh_config *conf); 4988 int (*update_mesh_config)(struct wiphy *wiphy, 4989 struct net_device *dev, u32 mask, 4990 const struct mesh_config *nconf); 4991 int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 4992 const struct mesh_config *conf, 4993 const struct mesh_setup *setup); 4994 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 4995 4996 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 4997 struct ocb_setup *setup); 4998 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 4999 5000 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 5001 struct bss_parameters *params); 5002 5003 void (*inform_bss)(struct wiphy *wiphy, struct cfg80211_bss *bss, 5004 const struct cfg80211_bss_ies *ies, void *data); 5005 5006 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 5007 struct ieee80211_txq_params *params); 5008 5009 int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 5010 struct net_device *dev, 5011 struct ieee80211_channel *chan); 5012 5013 int (*set_monitor_channel)(struct wiphy *wiphy, 5014 struct net_device *dev, 5015 struct cfg80211_chan_def *chandef); 5016 5017 int (*scan)(struct wiphy *wiphy, 5018 struct cfg80211_scan_request *request); 5019 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev); 5020 5021 int (*auth)(struct wiphy *wiphy, struct net_device *dev, 5022 struct cfg80211_auth_request *req); 5023 int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 5024 struct cfg80211_assoc_request *req); 5025 int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 5026 struct cfg80211_deauth_request *req); 5027 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 5028 struct cfg80211_disassoc_request *req); 5029 5030 int (*connect)(struct wiphy *wiphy, struct net_device *dev, 5031 struct cfg80211_connect_params *sme); 5032 int (*update_connect_params)(struct wiphy *wiphy, 5033 struct net_device *dev, 5034 struct cfg80211_connect_params *sme, 5035 u32 changed); 5036 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 5037 u16 reason_code); 5038 5039 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 5040 struct cfg80211_ibss_params *params); 5041 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 5042 5043 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 5044 int rate[NUM_NL80211_BANDS]); 5045 5046 int (*set_wiphy_params)(struct wiphy *wiphy, int radio_idx, 5047 u32 changed); 5048 5049 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 5050 int radio_idx, 5051 enum nl80211_tx_power_setting type, int mbm); 5052 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 5053 int radio_idx, unsigned int link_id, int *dbm); 5054 5055 void (*rfkill_poll)(struct wiphy *wiphy); 5056 5057 #ifdef CONFIG_NL80211_TESTMODE 5058 int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 5059 void *data, int len); 5060 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 5061 struct netlink_callback *cb, 5062 void *data, int len); 5063 #endif 5064 5065 int (*set_bitrate_mask)(struct wiphy *wiphy, 5066 struct net_device *dev, 5067 unsigned int link_id, 5068 const u8 *peer, 5069 const struct cfg80211_bitrate_mask *mask); 5070 5071 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 5072 int idx, struct survey_info *info); 5073 5074 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 5075 struct cfg80211_pmksa *pmksa); 5076 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 5077 struct cfg80211_pmksa *pmksa); 5078 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 5079 5080 int (*remain_on_channel)(struct wiphy *wiphy, 5081 struct wireless_dev *wdev, 5082 struct ieee80211_channel *chan, 5083 unsigned int duration, 5084 u64 *cookie); 5085 int (*cancel_remain_on_channel)(struct wiphy *wiphy, 5086 struct wireless_dev *wdev, 5087 u64 cookie); 5088 5089 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 5090 struct cfg80211_mgmt_tx_params *params, 5091 u64 *cookie); 5092 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 5093 struct wireless_dev *wdev, 5094 u64 cookie); 5095 5096 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 5097 bool enabled, int timeout); 5098 5099 int (*set_cqm_rssi_config)(struct wiphy *wiphy, 5100 struct net_device *dev, 5101 s32 rssi_thold, u32 rssi_hyst); 5102 5103 int (*set_cqm_rssi_range_config)(struct wiphy *wiphy, 5104 struct net_device *dev, 5105 s32 rssi_low, s32 rssi_high); 5106 5107 int (*set_cqm_txe_config)(struct wiphy *wiphy, 5108 struct net_device *dev, 5109 u32 rate, u32 pkts, u32 intvl); 5110 5111 void (*update_mgmt_frame_registrations)(struct wiphy *wiphy, 5112 struct wireless_dev *wdev, 5113 struct mgmt_frame_regs *upd); 5114 5115 int (*set_antenna)(struct wiphy *wiphy, int radio_idx, 5116 u32 tx_ant, u32 rx_ant); 5117 int (*get_antenna)(struct wiphy *wiphy, int radio_idx, 5118 u32 *tx_ant, u32 *rx_ant); 5119 5120 int (*sched_scan_start)(struct wiphy *wiphy, 5121 struct net_device *dev, 5122 struct cfg80211_sched_scan_request *request); 5123 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev, 5124 u64 reqid); 5125 5126 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 5127 struct cfg80211_gtk_rekey_data *data); 5128 5129 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 5130 const u8 *peer, int link_id, 5131 u8 action_code, u8 dialog_token, u16 status_code, 5132 u32 peer_capability, bool initiator, 5133 const u8 *buf, size_t len); 5134 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 5135 const u8 *peer, enum nl80211_tdls_operation oper); 5136 5137 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 5138 const u8 *peer, u64 *cookie); 5139 5140 int (*set_noack_map)(struct wiphy *wiphy, 5141 struct net_device *dev, 5142 u16 noack_map); 5143 5144 int (*get_channel)(struct wiphy *wiphy, 5145 struct wireless_dev *wdev, 5146 unsigned int link_id, 5147 struct cfg80211_chan_def *chandef); 5148 5149 int (*start_p2p_device)(struct wiphy *wiphy, 5150 struct wireless_dev *wdev); 5151 void (*stop_p2p_device)(struct wiphy *wiphy, 5152 struct wireless_dev *wdev); 5153 5154 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 5155 const struct cfg80211_acl_data *params); 5156 5157 int (*start_radar_detection)(struct wiphy *wiphy, 5158 struct net_device *dev, 5159 struct cfg80211_chan_def *chandef, 5160 u32 cac_time_ms, int link_id); 5161 void (*end_cac)(struct wiphy *wiphy, 5162 struct net_device *dev, unsigned int link_id); 5163 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 5164 struct cfg80211_update_ft_ies_params *ftie); 5165 int (*crit_proto_start)(struct wiphy *wiphy, 5166 struct wireless_dev *wdev, 5167 enum nl80211_crit_proto_id protocol, 5168 u16 duration); 5169 void (*crit_proto_stop)(struct wiphy *wiphy, 5170 struct wireless_dev *wdev); 5171 int (*set_coalesce)(struct wiphy *wiphy, 5172 struct cfg80211_coalesce *coalesce); 5173 5174 int (*channel_switch)(struct wiphy *wiphy, 5175 struct net_device *dev, 5176 struct cfg80211_csa_settings *params); 5177 5178 int (*set_qos_map)(struct wiphy *wiphy, 5179 struct net_device *dev, 5180 struct cfg80211_qos_map *qos_map); 5181 5182 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 5183 unsigned int link_id, 5184 struct cfg80211_chan_def *chandef); 5185 5186 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 5187 u8 tsid, const u8 *peer, u8 user_prio, 5188 u16 admitted_time); 5189 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 5190 u8 tsid, const u8 *peer); 5191 5192 int (*tdls_channel_switch)(struct wiphy *wiphy, 5193 struct net_device *dev, 5194 const u8 *addr, u8 oper_class, 5195 struct cfg80211_chan_def *chandef); 5196 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 5197 struct net_device *dev, 5198 const u8 *addr); 5199 int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev, 5200 struct cfg80211_nan_conf *conf); 5201 void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev); 5202 int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 5203 struct cfg80211_nan_func *nan_func); 5204 void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 5205 u64 cookie); 5206 int (*nan_change_conf)(struct wiphy *wiphy, 5207 struct wireless_dev *wdev, 5208 struct cfg80211_nan_conf *conf, 5209 u32 changes); 5210 5211 int (*set_multicast_to_unicast)(struct wiphy *wiphy, 5212 struct net_device *dev, 5213 const bool enabled); 5214 5215 int (*get_txq_stats)(struct wiphy *wiphy, 5216 struct wireless_dev *wdev, 5217 struct cfg80211_txq_stats *txqstats); 5218 5219 int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev, 5220 const struct cfg80211_pmk_conf *conf); 5221 int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev, 5222 const u8 *aa); 5223 int (*external_auth)(struct wiphy *wiphy, struct net_device *dev, 5224 struct cfg80211_external_auth_params *params); 5225 5226 int (*tx_control_port)(struct wiphy *wiphy, 5227 struct net_device *dev, 5228 const u8 *buf, size_t len, 5229 const u8 *dest, const __be16 proto, 5230 const bool noencrypt, int link_id, 5231 u64 *cookie); 5232 5233 int (*get_ftm_responder_stats)(struct wiphy *wiphy, 5234 struct net_device *dev, 5235 struct cfg80211_ftm_responder_stats *ftm_stats); 5236 5237 int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev, 5238 struct cfg80211_pmsr_request *request); 5239 void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev, 5240 struct cfg80211_pmsr_request *request); 5241 int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev, 5242 struct cfg80211_update_owe_info *owe_info); 5243 int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev, 5244 const u8 *buf, size_t len); 5245 int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev, 5246 struct cfg80211_tid_config *tid_conf); 5247 int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev, 5248 const u8 *peer, u8 tids); 5249 int (*set_sar_specs)(struct wiphy *wiphy, 5250 struct cfg80211_sar_specs *sar); 5251 int (*color_change)(struct wiphy *wiphy, 5252 struct net_device *dev, 5253 struct cfg80211_color_change_settings *params); 5254 int (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev, 5255 struct cfg80211_fils_aad *fils_aad); 5256 int (*set_radar_background)(struct wiphy *wiphy, 5257 struct cfg80211_chan_def *chandef); 5258 int (*add_link_station)(struct wiphy *wiphy, struct net_device *dev, 5259 struct link_station_parameters *params); 5260 int (*mod_link_station)(struct wiphy *wiphy, struct net_device *dev, 5261 struct link_station_parameters *params); 5262 int (*del_link_station)(struct wiphy *wiphy, struct net_device *dev, 5263 struct link_station_del_parameters *params); 5264 int (*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev, 5265 struct cfg80211_set_hw_timestamp *hwts); 5266 int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev, 5267 struct cfg80211_ttlm_params *params); 5268 u32 (*get_radio_mask)(struct wiphy *wiphy, struct net_device *dev); 5269 int (*assoc_ml_reconf)(struct wiphy *wiphy, struct net_device *dev, 5270 struct cfg80211_ml_reconf_req *req); 5271 int (*set_epcs)(struct wiphy *wiphy, struct net_device *dev, 5272 bool val); 5273 }; 5274 5275 /* 5276 * wireless hardware and networking interfaces structures 5277 * and registration/helper functions 5278 */ 5279 5280 /** 5281 * enum wiphy_flags - wiphy capability flags 5282 * 5283 * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split 5284 * into two, first for legacy bands and second for 6 GHz. 5285 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 5286 * wiphy at all 5287 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 5288 * by default -- this flag will be set depending on the kernel's default 5289 * on wiphy_new(), but can be changed by the driver if it has a good 5290 * reason to override the default 5291 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 5292 * on a VLAN interface). This flag also serves an extra purpose of 5293 * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype. 5294 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 5295 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 5296 * control port protocol ethertype. The device also honours the 5297 * control_port_no_encrypt flag. 5298 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 5299 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 5300 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 5301 * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 5302 * firmware. 5303 * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 5304 * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 5305 * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 5306 * link setup/discovery operations internally. Setup, discovery and 5307 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 5308 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 5309 * used for asking the driver/firmware to perform a TDLS operation. 5310 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 5311 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 5312 * when there are virtual interfaces in AP mode by calling 5313 * cfg80211_report_obss_beacon(). 5314 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 5315 * responds to probe-requests in hardware. 5316 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 5317 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 5318 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 5319 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 5320 * beaconing mode (AP, IBSS, Mesh, ...). 5321 * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys 5322 * @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs, 5323 * in order to not have them reachable in normal drivers, until we have 5324 * complete feature/interface combinations/etc. advertisement. No driver 5325 * should set this flag for now. 5326 * @WIPHY_FLAG_SUPPORTS_EXT_KCK_32: The device supports 32-byte KCK keys. 5327 * @WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER: The device could handle reg notify for 5328 * NL80211_REGDOM_SET_BY_DRIVER. 5329 * @WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON: reg_call_notifier() is called if driver 5330 * set this flag to update channels on beacon hints. 5331 * @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link 5332 * of an NSTR mobile AP MLD. 5333 * @WIPHY_FLAG_DISABLE_WEXT: disable wireless extensions for this device 5334 */ 5335 enum wiphy_flags { 5336 WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0), 5337 WIPHY_FLAG_SUPPORTS_MLO = BIT(1), 5338 WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2), 5339 WIPHY_FLAG_NETNS_OK = BIT(3), 5340 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 5341 WIPHY_FLAG_4ADDR_AP = BIT(5), 5342 WIPHY_FLAG_4ADDR_STATION = BIT(6), 5343 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 5344 WIPHY_FLAG_IBSS_RSN = BIT(8), 5345 WIPHY_FLAG_DISABLE_WEXT = BIT(9), 5346 WIPHY_FLAG_MESH_AUTH = BIT(10), 5347 WIPHY_FLAG_SUPPORTS_EXT_KCK_32 = BIT(11), 5348 WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY = BIT(12), 5349 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 5350 WIPHY_FLAG_AP_UAPSD = BIT(14), 5351 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 5352 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 5353 WIPHY_FLAG_HAVE_AP_SME = BIT(17), 5354 WIPHY_FLAG_REPORTS_OBSS = BIT(18), 5355 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 5356 WIPHY_FLAG_OFFCHAN_TX = BIT(20), 5357 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 5358 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 5359 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 5360 WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER = BIT(24), 5361 WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON = BIT(25), 5362 }; 5363 5364 /** 5365 * struct ieee80211_iface_limit - limit on certain interface types 5366 * @max: maximum number of interfaces of these types 5367 * @types: interface types (bits) 5368 */ 5369 struct ieee80211_iface_limit { 5370 u16 max; 5371 u16 types; 5372 }; 5373 5374 /** 5375 * struct ieee80211_iface_combination - possible interface combination 5376 * 5377 * With this structure the driver can describe which interface 5378 * combinations it supports concurrently. When set in a struct wiphy_radio, 5379 * the combinations refer to combinations of interfaces currently active on 5380 * that radio. 5381 * 5382 * Examples: 5383 * 5384 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 5385 * 5386 * .. code-block:: c 5387 * 5388 * struct ieee80211_iface_limit limits1[] = { 5389 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 5390 * { .max = 1, .types = BIT(NL80211_IFTYPE_AP), }, 5391 * }; 5392 * struct ieee80211_iface_combination combination1 = { 5393 * .limits = limits1, 5394 * .n_limits = ARRAY_SIZE(limits1), 5395 * .max_interfaces = 2, 5396 * .beacon_int_infra_match = true, 5397 * }; 5398 * 5399 * 5400 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 5401 * 5402 * .. code-block:: c 5403 * 5404 * struct ieee80211_iface_limit limits2[] = { 5405 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 5406 * BIT(NL80211_IFTYPE_P2P_GO), }, 5407 * }; 5408 * struct ieee80211_iface_combination combination2 = { 5409 * .limits = limits2, 5410 * .n_limits = ARRAY_SIZE(limits2), 5411 * .max_interfaces = 8, 5412 * .num_different_channels = 1, 5413 * }; 5414 * 5415 * 5416 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 5417 * 5418 * This allows for an infrastructure connection and three P2P connections. 5419 * 5420 * .. code-block:: c 5421 * 5422 * struct ieee80211_iface_limit limits3[] = { 5423 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 5424 * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 5425 * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 5426 * }; 5427 * struct ieee80211_iface_combination combination3 = { 5428 * .limits = limits3, 5429 * .n_limits = ARRAY_SIZE(limits3), 5430 * .max_interfaces = 4, 5431 * .num_different_channels = 2, 5432 * }; 5433 * 5434 */ 5435 struct ieee80211_iface_combination { 5436 /** 5437 * @limits: 5438 * limits for the given interface types 5439 */ 5440 const struct ieee80211_iface_limit *limits; 5441 5442 /** 5443 * @num_different_channels: 5444 * can use up to this many different channels 5445 */ 5446 u32 num_different_channels; 5447 5448 /** 5449 * @max_interfaces: 5450 * maximum number of interfaces in total allowed in this group 5451 */ 5452 u16 max_interfaces; 5453 5454 /** 5455 * @n_limits: 5456 * number of limitations 5457 */ 5458 u8 n_limits; 5459 5460 /** 5461 * @beacon_int_infra_match: 5462 * In this combination, the beacon intervals between infrastructure 5463 * and AP types must match. This is required only in special cases. 5464 */ 5465 bool beacon_int_infra_match; 5466 5467 /** 5468 * @radar_detect_widths: 5469 * bitmap of channel widths supported for radar detection 5470 */ 5471 u8 radar_detect_widths; 5472 5473 /** 5474 * @radar_detect_regions: 5475 * bitmap of regions supported for radar detection 5476 */ 5477 u8 radar_detect_regions; 5478 5479 /** 5480 * @beacon_int_min_gcd: 5481 * This interface combination supports different beacon intervals. 5482 * 5483 * = 0 5484 * all beacon intervals for different interface must be same. 5485 * > 0 5486 * any beacon interval for the interface part of this combination AND 5487 * GCD of all beacon intervals from beaconing interfaces of this 5488 * combination must be greater or equal to this value. 5489 */ 5490 u32 beacon_int_min_gcd; 5491 }; 5492 5493 struct ieee80211_txrx_stypes { 5494 u16 tx, rx; 5495 }; 5496 5497 /** 5498 * enum wiphy_wowlan_support_flags - WoWLAN support flags 5499 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 5500 * trigger that keeps the device operating as-is and 5501 * wakes up the host on any activity, for example a 5502 * received packet that passed filtering; note that the 5503 * packet should be preserved in that case 5504 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 5505 * (see nl80211.h) 5506 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 5507 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 5508 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 5509 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 5510 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 5511 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 5512 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 5513 */ 5514 enum wiphy_wowlan_support_flags { 5515 WIPHY_WOWLAN_ANY = BIT(0), 5516 WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 5517 WIPHY_WOWLAN_DISCONNECT = BIT(2), 5518 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 5519 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 5520 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 5521 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 5522 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 5523 WIPHY_WOWLAN_NET_DETECT = BIT(8), 5524 }; 5525 5526 struct wiphy_wowlan_tcp_support { 5527 const struct nl80211_wowlan_tcp_data_token_feature *tok; 5528 u32 data_payload_max; 5529 u32 data_interval_max; 5530 u32 wake_payload_max; 5531 bool seq; 5532 }; 5533 5534 /** 5535 * struct wiphy_wowlan_support - WoWLAN support data 5536 * @flags: see &enum wiphy_wowlan_support_flags 5537 * @n_patterns: number of supported wakeup patterns 5538 * (see nl80211.h for the pattern definition) 5539 * @pattern_max_len: maximum length of each pattern 5540 * @pattern_min_len: minimum length of each pattern 5541 * @max_pkt_offset: maximum Rx packet offset 5542 * @max_nd_match_sets: maximum number of matchsets for net-detect, 5543 * similar, but not necessarily identical, to max_match_sets for 5544 * scheduled scans. 5545 * See &struct cfg80211_sched_scan_request.@match_sets for more 5546 * details. 5547 * @tcp: TCP wakeup support information 5548 */ 5549 struct wiphy_wowlan_support { 5550 u32 flags; 5551 int n_patterns; 5552 int pattern_max_len; 5553 int pattern_min_len; 5554 int max_pkt_offset; 5555 int max_nd_match_sets; 5556 const struct wiphy_wowlan_tcp_support *tcp; 5557 }; 5558 5559 /** 5560 * struct wiphy_coalesce_support - coalesce support data 5561 * @n_rules: maximum number of coalesce rules 5562 * @max_delay: maximum supported coalescing delay in msecs 5563 * @n_patterns: number of supported patterns in a rule 5564 * (see nl80211.h for the pattern definition) 5565 * @pattern_max_len: maximum length of each pattern 5566 * @pattern_min_len: minimum length of each pattern 5567 * @max_pkt_offset: maximum Rx packet offset 5568 */ 5569 struct wiphy_coalesce_support { 5570 int n_rules; 5571 int max_delay; 5572 int n_patterns; 5573 int pattern_max_len; 5574 int pattern_min_len; 5575 int max_pkt_offset; 5576 }; 5577 5578 /** 5579 * enum wiphy_vendor_command_flags - validation flags for vendor commands 5580 * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 5581 * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 5582 * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 5583 * (must be combined with %_WDEV or %_NETDEV) 5584 */ 5585 enum wiphy_vendor_command_flags { 5586 WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 5587 WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 5588 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 5589 }; 5590 5591 /** 5592 * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags 5593 * 5594 * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed 5595 * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed 5596 * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed 5597 * 5598 */ 5599 enum wiphy_opmode_flag { 5600 STA_OPMODE_MAX_BW_CHANGED = BIT(0), 5601 STA_OPMODE_SMPS_MODE_CHANGED = BIT(1), 5602 STA_OPMODE_N_SS_CHANGED = BIT(2), 5603 }; 5604 5605 /** 5606 * struct sta_opmode_info - Station's ht/vht operation mode information 5607 * @changed: contains value from &enum wiphy_opmode_flag 5608 * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station 5609 * @bw: new max bandwidth value from &enum nl80211_chan_width of a station 5610 * @rx_nss: new rx_nss value of a station 5611 */ 5612 5613 struct sta_opmode_info { 5614 u32 changed; 5615 enum nl80211_smps_mode smps_mode; 5616 enum nl80211_chan_width bw; 5617 u8 rx_nss; 5618 }; 5619 5620 #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA)) 5621 5622 /** 5623 * struct wiphy_vendor_command - vendor command definition 5624 * @info: vendor command identifying information, as used in nl80211 5625 * @flags: flags, see &enum wiphy_vendor_command_flags 5626 * @doit: callback for the operation, note that wdev is %NULL if the 5627 * flags didn't ask for a wdev and non-%NULL otherwise; the data 5628 * pointer may be %NULL if userspace provided no data at all 5629 * @dumpit: dump callback, for transferring bigger/multiple items. The 5630 * @storage points to cb->args[5], ie. is preserved over the multiple 5631 * dumpit calls. 5632 * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA. 5633 * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the 5634 * attribute is just raw data (e.g. a firmware command). 5635 * @maxattr: highest attribute number in policy 5636 * It's recommended to not have the same sub command with both @doit and 5637 * @dumpit, so that userspace can assume certain ones are get and others 5638 * are used with dump requests. 5639 */ 5640 struct wiphy_vendor_command { 5641 struct nl80211_vendor_cmd_info info; 5642 u32 flags; 5643 int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 5644 const void *data, int data_len); 5645 int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, 5646 struct sk_buff *skb, const void *data, int data_len, 5647 unsigned long *storage); 5648 const struct nla_policy *policy; 5649 unsigned int maxattr; 5650 }; 5651 5652 /** 5653 * struct wiphy_iftype_ext_capab - extended capabilities per interface type 5654 * @iftype: interface type 5655 * @extended_capabilities: extended capabilities supported by the driver, 5656 * additional capabilities might be supported by userspace; these are the 5657 * 802.11 extended capabilities ("Extended Capabilities element") and are 5658 * in the same format as in the information element. See IEEE Std 5659 * 802.11-2012 8.4.2.29 for the defined fields. 5660 * @extended_capabilities_mask: mask of the valid values 5661 * @extended_capabilities_len: length of the extended capabilities 5662 * @eml_capabilities: EML capabilities (for MLO) 5663 * @mld_capa_and_ops: MLD capabilities and operations (for MLO) 5664 */ 5665 struct wiphy_iftype_ext_capab { 5666 enum nl80211_iftype iftype; 5667 const u8 *extended_capabilities; 5668 const u8 *extended_capabilities_mask; 5669 u8 extended_capabilities_len; 5670 u16 eml_capabilities; 5671 u16 mld_capa_and_ops; 5672 }; 5673 5674 /** 5675 * cfg80211_get_iftype_ext_capa - lookup interface type extended capability 5676 * @wiphy: the wiphy to look up from 5677 * @type: the interface type to look up 5678 * 5679 * Return: The extended capability for the given interface @type, may be %NULL 5680 */ 5681 const struct wiphy_iftype_ext_capab * 5682 cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type); 5683 5684 /** 5685 * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities 5686 * @max_peers: maximum number of peers in a single measurement 5687 * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement 5688 * @randomize_mac_addr: can randomize MAC address for measurement 5689 * @ftm: FTM measurement data 5690 * @ftm.supported: FTM measurement is supported 5691 * @ftm.asap: ASAP-mode is supported 5692 * @ftm.non_asap: non-ASAP-mode is supported 5693 * @ftm.request_lci: can request LCI data 5694 * @ftm.request_civicloc: can request civic location data 5695 * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble) 5696 * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width) 5697 * @ftm.max_bursts_exponent: maximum burst exponent supported 5698 * (set to -1 if not limited; note that setting this will necessarily 5699 * forbid using the value 15 to let the responder pick) 5700 * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if 5701 * not limited) 5702 * @ftm.trigger_based: trigger based ranging measurement is supported 5703 * @ftm.non_trigger_based: non trigger based ranging measurement is supported 5704 * @ftm.support_6ghz: supports ranging in 6 GHz band 5705 * @ftm.max_tx_ltf_rep: maximum number of TX LTF repetitions supported (0 means 5706 * only one LTF, no repetitions) 5707 * @ftm.max_rx_ltf_rep: maximum number of RX LTF repetitions supported (0 means 5708 * only one LTF, no repetitions) 5709 * @ftm.max_tx_sts: maximum number of TX STS supported (zero based) 5710 * @ftm.max_rx_sts: maximum number of RX STS supported (zero based) 5711 * @ftm.max_total_ltf_tx: maximum total number of LTFs that can be transmitted 5712 * (0 means unknown) 5713 * @ftm.max_total_ltf_rx: maximum total number of LTFs that can be received 5714 * (0 means unknown) 5715 * @ftm.support_rsta: supports operating as RSTA in PMSR FTM request 5716 */ 5717 struct cfg80211_pmsr_capabilities { 5718 unsigned int max_peers; 5719 u8 report_ap_tsf:1, 5720 randomize_mac_addr:1; 5721 5722 struct { 5723 u32 preambles; 5724 u32 bandwidths; 5725 s8 max_bursts_exponent; 5726 u8 max_ftms_per_burst; 5727 u8 supported:1, 5728 asap:1, 5729 non_asap:1, 5730 request_lci:1, 5731 request_civicloc:1, 5732 trigger_based:1, 5733 non_trigger_based:1, 5734 support_6ghz:1; 5735 u8 max_tx_ltf_rep; 5736 u8 max_rx_ltf_rep; 5737 u8 max_tx_sts; 5738 u8 max_rx_sts; 5739 u8 max_total_ltf_tx; 5740 u8 max_total_ltf_rx; 5741 u8 support_rsta:1; 5742 } ftm; 5743 }; 5744 5745 /** 5746 * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm 5747 * suites for interface types defined in @iftypes_mask. Each type in the 5748 * @iftypes_mask must be unique across all instances of iftype_akm_suites. 5749 * 5750 * @iftypes_mask: bitmask of interfaces types 5751 * @akm_suites: points to an array of supported akm suites 5752 * @n_akm_suites: number of supported AKM suites 5753 */ 5754 struct wiphy_iftype_akm_suites { 5755 u16 iftypes_mask; 5756 const u32 *akm_suites; 5757 int n_akm_suites; 5758 }; 5759 5760 /** 5761 * struct wiphy_radio_cfg - physical radio config of a wiphy 5762 * This structure describes the configurations of a physical radio in a 5763 * wiphy. It is used to denote per-radio attributes belonging to a wiphy. 5764 * 5765 * @rts_threshold: RTS threshold (dot11RTSThreshold); 5766 * -1 (default) = RTS/CTS disabled 5767 * @radio_debugfsdir: Pointer to debugfs directory containing the radio- 5768 * specific parameters. 5769 * NULL (default) = Debugfs directory not created 5770 */ 5771 struct wiphy_radio_cfg { 5772 u32 rts_threshold; 5773 struct dentry *radio_debugfsdir; 5774 }; 5775 5776 /** 5777 * struct wiphy_radio_freq_range - wiphy frequency range 5778 * @start_freq: start range edge frequency (kHz) 5779 * @end_freq: end range edge frequency (kHz) 5780 */ 5781 struct wiphy_radio_freq_range { 5782 u32 start_freq; 5783 u32 end_freq; 5784 }; 5785 5786 5787 /** 5788 * struct wiphy_radio - physical radio of a wiphy 5789 * This structure describes a physical radio belonging to a wiphy. 5790 * It is used to describe concurrent-channel capabilities. Only one channel 5791 * can be active on the radio described by struct wiphy_radio. 5792 * 5793 * @freq_range: frequency range that the radio can operate on. 5794 * @n_freq_range: number of elements in @freq_range 5795 * 5796 * @iface_combinations: Valid interface combinations array, should not 5797 * list single interface types. 5798 * @n_iface_combinations: number of entries in @iface_combinations array. 5799 * 5800 * @antenna_mask: bitmask of antennas connected to this radio. 5801 */ 5802 struct wiphy_radio { 5803 const struct wiphy_radio_freq_range *freq_range; 5804 int n_freq_range; 5805 5806 const struct ieee80211_iface_combination *iface_combinations; 5807 int n_iface_combinations; 5808 5809 u32 antenna_mask; 5810 }; 5811 5812 /** 5813 * enum wiphy_nan_flags - NAN capabilities 5814 * 5815 * @WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC: Device supports NAN configurable 5816 * synchronization. 5817 * @WIPHY_NAN_FLAGS_USERSPACE_DE: Device doesn't support DE offload. 5818 */ 5819 enum wiphy_nan_flags { 5820 WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0), 5821 WIPHY_NAN_FLAGS_USERSPACE_DE = BIT(1), 5822 }; 5823 5824 /** 5825 * struct wiphy_nan_capa - NAN capabilities 5826 * 5827 * This structure describes the NAN capabilities of a wiphy. 5828 * 5829 * @flags: NAN capabilities flags, see &enum wiphy_nan_flags 5830 * @op_mode: NAN operation mode, as defined in Wi-Fi Aware (TM) specification 5831 * Table 81. 5832 * @n_antennas: number of antennas supported by the device for Tx/Rx. Lower 5833 * nibble indicates the number of TX antennas and upper nibble indicates the 5834 * number of RX antennas. Value 0 indicates the information is not 5835 * available. 5836 * @max_channel_switch_time: maximum channel switch time in milliseconds. 5837 * @dev_capabilities: NAN device capabilities as defined in Wi-Fi Aware (TM) 5838 * specification Table 79 (Capabilities field). 5839 */ 5840 struct wiphy_nan_capa { 5841 u32 flags; 5842 u8 op_mode; 5843 u8 n_antennas; 5844 u16 max_channel_switch_time; 5845 u8 dev_capabilities; 5846 }; 5847 5848 #define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff 5849 5850 /** 5851 * struct wiphy - wireless hardware description 5852 * @mtx: mutex for the data (structures) of this device 5853 * @reg_notifier: the driver's regulatory notification callback, 5854 * note that if your driver uses wiphy_apply_custom_regulatory() 5855 * the reg_notifier's request can be passed as NULL 5856 * @regd: the driver's regulatory domain, if one was requested via 5857 * the regulatory_hint() API. This can be used by the driver 5858 * on the reg_notifier() if it chooses to ignore future 5859 * regulatory domain changes caused by other drivers. 5860 * @signal_type: signal type reported in &struct cfg80211_bss. 5861 * @cipher_suites: supported cipher suites 5862 * @n_cipher_suites: number of supported cipher suites 5863 * @akm_suites: supported AKM suites. These are the default AKMs supported if 5864 * the supported AKMs not advertized for a specific interface type in 5865 * iftype_akm_suites. 5866 * @n_akm_suites: number of supported AKM suites 5867 * @iftype_akm_suites: array of supported akm suites info per interface type. 5868 * Note that the bits in @iftypes_mask inside this structure cannot 5869 * overlap (i.e. only one occurrence of each type is allowed across all 5870 * instances of iftype_akm_suites). 5871 * @num_iftype_akm_suites: number of interface types for which supported akm 5872 * suites are specified separately. 5873 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 5874 * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 5875 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 5876 * -1 = fragmentation disabled, only odd values >= 256 used 5877 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 5878 * @_net: the network namespace this wiphy currently lives in 5879 * @perm_addr: permanent MAC address of this device 5880 * @addr_mask: If the device supports multiple MAC addresses by masking, 5881 * set this to a mask with variable bits set to 1, e.g. if the last 5882 * four bits are variable then set it to 00-00-00-00-00-0f. The actual 5883 * variable bits shall be determined by the interfaces added, with 5884 * interfaces not matching the mask being rejected to be brought up. 5885 * @n_addresses: number of addresses in @addresses. 5886 * @addresses: If the device has more than one address, set this pointer 5887 * to a list of addresses (6 bytes each). The first one will be used 5888 * by default for perm_addr. In this case, the mask should be set to 5889 * all-zeroes. In this case it is assumed that the device can handle 5890 * the same number of arbitrary MAC addresses. 5891 * @registered: protects ->resume and ->suspend sysfs callbacks against 5892 * unregister hardware 5893 * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>). 5894 * It will be renamed automatically on wiphy renames 5895 * @dev: (virtual) struct device for this wiphy. The item in 5896 * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev() 5897 * (see below). 5898 * @wext: wireless extension handlers 5899 * @priv: driver private data (sized according to wiphy_new() parameter) 5900 * @interface_modes: bitmask of interfaces types valid for this wiphy, 5901 * must be set by driver 5902 * @iface_combinations: Valid interface combinations array, should not 5903 * list single interface types. 5904 * @n_iface_combinations: number of entries in @iface_combinations array. 5905 * @software_iftypes: bitmask of software interface types, these are not 5906 * subject to any restrictions since they are purely managed in SW. 5907 * @flags: wiphy flags, see &enum wiphy_flags 5908 * @regulatory_flags: wiphy regulatory flags, see 5909 * &enum ieee80211_regulatory_flags 5910 * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 5911 * @ext_features: extended features advertised to nl80211, see 5912 * &enum nl80211_ext_feature_index. 5913 * @bss_priv_size: each BSS struct has private data allocated with it, 5914 * this variable determines its size 5915 * @max_scan_ssids: maximum number of SSIDs the device can scan for in 5916 * any given scan 5917 * @max_sched_scan_reqs: maximum number of scheduled scan requests that 5918 * the device can run concurrently. 5919 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 5920 * for in any given scheduled scan 5921 * @max_match_sets: maximum number of match sets the device can handle 5922 * when performing a scheduled scan, 0 if filtering is not 5923 * supported. 5924 * @max_scan_ie_len: maximum length of user-controlled IEs device can 5925 * add to probe request frames transmitted during a scan, must not 5926 * include fixed IEs like supported rates 5927 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 5928 * scans 5929 * @max_sched_scan_plans: maximum number of scan plans (scan interval and number 5930 * of iterations) for scheduled scan supported by the device. 5931 * @max_sched_scan_plan_interval: maximum interval (in seconds) for a 5932 * single scan plan supported by the device. 5933 * @max_sched_scan_plan_iterations: maximum number of iterations for a single 5934 * scan plan supported by the device. 5935 * @coverage_class: current coverage class 5936 * @fw_version: firmware version for ethtool reporting 5937 * @hw_version: hardware version for ethtool reporting 5938 * @max_num_pmkids: maximum number of PMKIDs supported by device 5939 * @privid: a pointer that drivers can use to identify if an arbitrary 5940 * wiphy is theirs, e.g. in global notifiers 5941 * @bands: information about bands/channels supported by this device 5942 * 5943 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 5944 * transmitted through nl80211, points to an array indexed by interface 5945 * type 5946 * 5947 * @available_antennas_tx: bitmap of antennas which are available to be 5948 * configured as TX antennas. Antenna configuration commands will be 5949 * rejected unless this or @available_antennas_rx is set. 5950 * 5951 * @available_antennas_rx: bitmap of antennas which are available to be 5952 * configured as RX antennas. Antenna configuration commands will be 5953 * rejected unless this or @available_antennas_tx is set. 5954 * 5955 * @probe_resp_offload: 5956 * Bitmap of supported protocols for probe response offloading. 5957 * See &enum nl80211_probe_resp_offload_support_attr. Only valid 5958 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 5959 * 5960 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 5961 * may request, if implemented. 5962 * 5963 * @wowlan: WoWLAN support information 5964 * @wowlan_config: current WoWLAN configuration; this should usually not be 5965 * used since access to it is necessarily racy, use the parameter passed 5966 * to the suspend() operation instead. 5967 * 5968 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 5969 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 5970 * If null, then none can be over-ridden. 5971 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 5972 * If null, then none can be over-ridden. 5973 * 5974 * @wdev_list: the list of associated (virtual) interfaces; this list must 5975 * not be modified by the driver, but can be read with RTNL/RCU protection. 5976 * 5977 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 5978 * supports for ACL. 5979 * 5980 * @extended_capabilities: extended capabilities supported by the driver, 5981 * additional capabilities might be supported by userspace; these are 5982 * the 802.11 extended capabilities ("Extended Capabilities element") 5983 * and are in the same format as in the information element. See 5984 * 802.11-2012 8.4.2.29 for the defined fields. These are the default 5985 * extended capabilities to be used if the capabilities are not specified 5986 * for a specific interface type in iftype_ext_capab. 5987 * @extended_capabilities_mask: mask of the valid values 5988 * @extended_capabilities_len: length of the extended capabilities 5989 * @iftype_ext_capab: array of extended capabilities per interface type 5990 * @num_iftype_ext_capab: number of interface types for which extended 5991 * capabilities are specified separately. 5992 * @coalesce: packet coalescing support information 5993 * 5994 * @vendor_commands: array of vendor commands supported by the hardware 5995 * @n_vendor_commands: number of vendor commands 5996 * @vendor_events: array of vendor events supported by the hardware 5997 * @n_vendor_events: number of vendor events 5998 * 5999 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 6000 * (including P2P GO) or 0 to indicate no such limit is advertised. The 6001 * driver is allowed to advertise a theoretical limit that it can reach in 6002 * some cases, but may not always reach. 6003 * 6004 * @max_num_csa_counters: Number of supported csa_counters in beacons 6005 * and probe responses. This value should be set if the driver 6006 * wishes to limit the number of csa counters. Default (0) means 6007 * infinite. 6008 * @bss_param_support: bitmask indicating which bss_parameters as defined in 6009 * &struct bss_parameters the driver can actually handle in the 6010 * .change_bss() callback. The bit positions are defined in &enum 6011 * wiphy_bss_param_flags. 6012 * 6013 * @bss_select_support: bitmask indicating the BSS selection criteria supported 6014 * by the driver in the .connect() callback. The bit position maps to the 6015 * attribute indices defined in &enum nl80211_bss_select_attr. 6016 * 6017 * @nan_supported_bands: bands supported by the device in NAN mode, a 6018 * bitmap of &enum nl80211_band values. For instance, for 6019 * NL80211_BAND_2GHZ, bit 0 would be set 6020 * (i.e. BIT(NL80211_BAND_2GHZ)). 6021 * @nan_capa: NAN capabilities 6022 * 6023 * @txq_limit: configuration of internal TX queue frame limit 6024 * @txq_memory_limit: configuration internal TX queue memory limit 6025 * @txq_quantum: configuration of internal TX queue scheduler quantum 6026 * 6027 * @tx_queue_len: allow setting transmit queue len for drivers not using 6028 * wake_tx_queue 6029 * 6030 * @support_mbssid: can HW support association with nontransmitted AP 6031 * @support_only_he_mbssid: don't parse MBSSID elements if it is not 6032 * HE AP, in order to avoid compatibility issues. 6033 * @support_mbssid must be set for this to have any effect. 6034 * 6035 * @pmsr_capa: peer measurement capabilities 6036 * 6037 * @tid_config_support: describes the per-TID config support that the 6038 * device has 6039 * @tid_config_support.vif: bitmap of attributes (configurations) 6040 * supported by the driver for each vif 6041 * @tid_config_support.peer: bitmap of attributes (configurations) 6042 * supported by the driver for each peer 6043 * @tid_config_support.max_retry: maximum supported retry count for 6044 * long/short retry configuration 6045 * 6046 * @max_data_retry_count: maximum supported per TID retry count for 6047 * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and 6048 * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes 6049 * @sar_capa: SAR control capabilities 6050 * @rfkill: a pointer to the rfkill structure 6051 * 6052 * @mbssid_max_interfaces: maximum number of interfaces supported by the driver 6053 * in a multiple BSSID set. This field must be set to a non-zero value 6054 * by the driver to advertise MBSSID support. 6055 * @ema_max_profile_periodicity: maximum profile periodicity supported by 6056 * the driver. Setting this field to a non-zero value indicates that the 6057 * driver supports enhanced multi-BSSID advertisements (EMA AP). 6058 * @max_num_akm_suites: maximum number of AKM suites allowed for 6059 * configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and 6060 * %NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by 6061 * driver. If set by driver minimum allowed value is 6062 * NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with 6063 * legacy userspace and maximum allowed value is 6064 * CFG80211_MAX_NUM_AKM_SUITES. 6065 * 6066 * @hw_timestamp_max_peers: maximum number of peers that the driver supports 6067 * enabling HW timestamping for concurrently. Setting this field to a 6068 * non-zero value indicates that the driver supports HW timestamping. 6069 * A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver 6070 * supports enabling HW timestamping for all peers (i.e. no need to 6071 * specify a mac address). 6072 * 6073 * @radio_cfg: configuration of radios belonging to a muli-radio wiphy. This 6074 * struct contains a list of all radio specific attributes and should be 6075 * used only for multi-radio wiphy. 6076 * 6077 * @radio: radios belonging to this wiphy 6078 * @n_radio: number of radios 6079 */ 6080 struct wiphy { 6081 struct mutex mtx; 6082 6083 /* assign these fields before you register the wiphy */ 6084 6085 u8 perm_addr[ETH_ALEN]; 6086 u8 addr_mask[ETH_ALEN]; 6087 6088 struct mac_address *addresses; 6089 6090 const struct ieee80211_txrx_stypes *mgmt_stypes; 6091 6092 const struct ieee80211_iface_combination *iface_combinations; 6093 int n_iface_combinations; 6094 u16 software_iftypes; 6095 6096 u16 n_addresses; 6097 6098 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 6099 u16 interface_modes; 6100 6101 u16 max_acl_mac_addrs; 6102 6103 u32 flags, regulatory_flags, features; 6104 u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 6105 6106 u32 ap_sme_capa; 6107 6108 enum cfg80211_signal_type signal_type; 6109 6110 int bss_priv_size; 6111 u8 max_scan_ssids; 6112 u8 max_sched_scan_reqs; 6113 u8 max_sched_scan_ssids; 6114 u8 max_match_sets; 6115 u16 max_scan_ie_len; 6116 u16 max_sched_scan_ie_len; 6117 u32 max_sched_scan_plans; 6118 u32 max_sched_scan_plan_interval; 6119 u32 max_sched_scan_plan_iterations; 6120 6121 int n_cipher_suites; 6122 const u32 *cipher_suites; 6123 6124 int n_akm_suites; 6125 const u32 *akm_suites; 6126 6127 const struct wiphy_iftype_akm_suites *iftype_akm_suites; 6128 unsigned int num_iftype_akm_suites; 6129 6130 u8 retry_short; 6131 u8 retry_long; 6132 u32 frag_threshold; 6133 u32 rts_threshold; 6134 u8 coverage_class; 6135 6136 char fw_version[ETHTOOL_FWVERS_LEN]; 6137 u32 hw_version; 6138 6139 #ifdef CONFIG_PM 6140 const struct wiphy_wowlan_support *wowlan; 6141 struct cfg80211_wowlan *wowlan_config; 6142 #endif 6143 6144 u16 max_remain_on_channel_duration; 6145 6146 u8 max_num_pmkids; 6147 6148 u32 available_antennas_tx; 6149 u32 available_antennas_rx; 6150 6151 u32 probe_resp_offload; 6152 6153 const u8 *extended_capabilities, *extended_capabilities_mask; 6154 u8 extended_capabilities_len; 6155 6156 const struct wiphy_iftype_ext_capab *iftype_ext_capab; 6157 unsigned int num_iftype_ext_capab; 6158 6159 const void *privid; 6160 6161 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 6162 6163 void (*reg_notifier)(struct wiphy *wiphy, 6164 struct regulatory_request *request); 6165 6166 struct wiphy_radio_cfg *radio_cfg; 6167 6168 /* fields below are read-only, assigned by cfg80211 */ 6169 6170 const struct ieee80211_regdomain __rcu *regd; 6171 6172 struct device dev; 6173 6174 bool registered; 6175 6176 struct dentry *debugfsdir; 6177 6178 const struct ieee80211_ht_cap *ht_capa_mod_mask; 6179 const struct ieee80211_vht_cap *vht_capa_mod_mask; 6180 6181 struct list_head wdev_list; 6182 6183 possible_net_t _net; 6184 6185 #ifdef CONFIG_CFG80211_WEXT 6186 const struct iw_handler_def *wext; 6187 #endif 6188 6189 const struct wiphy_coalesce_support *coalesce; 6190 6191 const struct wiphy_vendor_command *vendor_commands; 6192 const struct nl80211_vendor_cmd_info *vendor_events; 6193 int n_vendor_commands, n_vendor_events; 6194 6195 u16 max_ap_assoc_sta; 6196 6197 u8 max_num_csa_counters; 6198 6199 u32 bss_param_support; 6200 u32 bss_select_support; 6201 6202 u8 nan_supported_bands; 6203 struct wiphy_nan_capa nan_capa; 6204 6205 u32 txq_limit; 6206 u32 txq_memory_limit; 6207 u32 txq_quantum; 6208 6209 unsigned long tx_queue_len; 6210 6211 u8 support_mbssid:1, 6212 support_only_he_mbssid:1; 6213 6214 const struct cfg80211_pmsr_capabilities *pmsr_capa; 6215 6216 struct { 6217 u64 peer, vif; 6218 u8 max_retry; 6219 } tid_config_support; 6220 6221 u8 max_data_retry_count; 6222 6223 const struct cfg80211_sar_capa *sar_capa; 6224 6225 struct rfkill *rfkill; 6226 6227 u8 mbssid_max_interfaces; 6228 u8 ema_max_profile_periodicity; 6229 u16 max_num_akm_suites; 6230 6231 u16 hw_timestamp_max_peers; 6232 6233 int n_radio; 6234 const struct wiphy_radio *radio; 6235 6236 char priv[] __aligned(NETDEV_ALIGN); 6237 }; 6238 6239 static inline struct net *wiphy_net(struct wiphy *wiphy) 6240 { 6241 return read_pnet(&wiphy->_net); 6242 } 6243 6244 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 6245 { 6246 write_pnet(&wiphy->_net, net); 6247 } 6248 6249 /** 6250 * wiphy_priv - return priv from wiphy 6251 * 6252 * @wiphy: the wiphy whose priv pointer to return 6253 * Return: The priv of @wiphy. 6254 */ 6255 static inline void *wiphy_priv(struct wiphy *wiphy) 6256 { 6257 BUG_ON(!wiphy); 6258 return &wiphy->priv; 6259 } 6260 6261 /** 6262 * priv_to_wiphy - return the wiphy containing the priv 6263 * 6264 * @priv: a pointer previously returned by wiphy_priv 6265 * Return: The wiphy of @priv. 6266 */ 6267 static inline struct wiphy *priv_to_wiphy(void *priv) 6268 { 6269 BUG_ON(!priv); 6270 return container_of(priv, struct wiphy, priv); 6271 } 6272 6273 /** 6274 * set_wiphy_dev - set device pointer for wiphy 6275 * 6276 * @wiphy: The wiphy whose device to bind 6277 * @dev: The device to parent it to 6278 */ 6279 static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 6280 { 6281 wiphy->dev.parent = dev; 6282 } 6283 6284 /** 6285 * wiphy_dev - get wiphy dev pointer 6286 * 6287 * @wiphy: The wiphy whose device struct to look up 6288 * Return: The dev of @wiphy. 6289 */ 6290 static inline struct device *wiphy_dev(struct wiphy *wiphy) 6291 { 6292 return wiphy->dev.parent; 6293 } 6294 6295 /** 6296 * wiphy_name - get wiphy name 6297 * 6298 * @wiphy: The wiphy whose name to return 6299 * Return: The name of @wiphy. 6300 */ 6301 static inline const char *wiphy_name(const struct wiphy *wiphy) 6302 { 6303 return dev_name(&wiphy->dev); 6304 } 6305 6306 /** 6307 * wiphy_new_nm - create a new wiphy for use with cfg80211 6308 * 6309 * @ops: The configuration operations for this device 6310 * @sizeof_priv: The size of the private area to allocate 6311 * @requested_name: Request a particular name. 6312 * NULL is valid value, and means use the default phy%d naming. 6313 * 6314 * Create a new wiphy and associate the given operations with it. 6315 * @sizeof_priv bytes are allocated for private use. 6316 * 6317 * Return: A pointer to the new wiphy. This pointer must be 6318 * assigned to each netdev's ieee80211_ptr for proper operation. 6319 */ 6320 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 6321 const char *requested_name); 6322 6323 /** 6324 * wiphy_new - create a new wiphy for use with cfg80211 6325 * 6326 * @ops: The configuration operations for this device 6327 * @sizeof_priv: The size of the private area to allocate 6328 * 6329 * Create a new wiphy and associate the given operations with it. 6330 * @sizeof_priv bytes are allocated for private use. 6331 * 6332 * Return: A pointer to the new wiphy. This pointer must be 6333 * assigned to each netdev's ieee80211_ptr for proper operation. 6334 */ 6335 static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 6336 int sizeof_priv) 6337 { 6338 return wiphy_new_nm(ops, sizeof_priv, NULL); 6339 } 6340 6341 /** 6342 * wiphy_register - register a wiphy with cfg80211 6343 * 6344 * @wiphy: The wiphy to register. 6345 * 6346 * Return: A non-negative wiphy index or a negative error code. 6347 */ 6348 int wiphy_register(struct wiphy *wiphy); 6349 6350 /* this is a define for better error reporting (file/line) */ 6351 #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx) 6352 6353 /** 6354 * rcu_dereference_wiphy - rcu_dereference with debug checking 6355 * @wiphy: the wiphy to check the locking on 6356 * @p: The pointer to read, prior to dereferencing 6357 * 6358 * Do an rcu_dereference(p), but check caller either holds rcu_read_lock() 6359 * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference(). 6360 */ 6361 #define rcu_dereference_wiphy(wiphy, p) \ 6362 rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx)) 6363 6364 /** 6365 * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx 6366 * @wiphy: the wiphy to check the locking on 6367 * @p: The pointer to read, prior to dereferencing 6368 * 6369 * Return: the value of the specified RCU-protected pointer, but omit the 6370 * READ_ONCE(), because caller holds the wiphy mutex used for updates. 6371 */ 6372 #define wiphy_dereference(wiphy, p) \ 6373 rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx)) 6374 6375 /** 6376 * get_wiphy_regdom - get custom regdomain for the given wiphy 6377 * @wiphy: the wiphy to get the regdomain from 6378 * 6379 * Context: Requires any of RTNL, wiphy mutex or RCU protection. 6380 * 6381 * Return: pointer to the regulatory domain associated with the wiphy 6382 */ 6383 const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy); 6384 6385 /** 6386 * wiphy_unregister - deregister a wiphy from cfg80211 6387 * 6388 * @wiphy: The wiphy to unregister. 6389 * 6390 * After this call, no more requests can be made with this priv 6391 * pointer, but the call may sleep to wait for an outstanding 6392 * request that is being handled. 6393 */ 6394 void wiphy_unregister(struct wiphy *wiphy); 6395 6396 /** 6397 * wiphy_free - free wiphy 6398 * 6399 * @wiphy: The wiphy to free 6400 */ 6401 void wiphy_free(struct wiphy *wiphy); 6402 6403 /* internal structs */ 6404 struct cfg80211_conn; 6405 struct cfg80211_internal_bss; 6406 struct cfg80211_cached_keys; 6407 struct cfg80211_cqm_config; 6408 6409 /** 6410 * wiphy_lock - lock the wiphy 6411 * @wiphy: the wiphy to lock 6412 * 6413 * This is needed around registering and unregistering netdevs that 6414 * aren't created through cfg80211 calls, since that requires locking 6415 * in cfg80211 when the notifiers is called, but that cannot 6416 * differentiate which way it's called. 6417 * 6418 * It can also be used by drivers for their own purposes. 6419 * 6420 * When cfg80211 ops are called, the wiphy is already locked. 6421 * 6422 * Note that this makes sure that no workers that have been queued 6423 * with wiphy_queue_work() are running. 6424 */ 6425 static inline void wiphy_lock(struct wiphy *wiphy) 6426 __acquires(&wiphy->mtx) 6427 { 6428 mutex_lock(&wiphy->mtx); 6429 __acquire(&wiphy->mtx); 6430 } 6431 6432 /** 6433 * wiphy_unlock - unlock the wiphy again 6434 * @wiphy: the wiphy to unlock 6435 */ 6436 static inline void wiphy_unlock(struct wiphy *wiphy) 6437 __releases(&wiphy->mtx) 6438 { 6439 __release(&wiphy->mtx); 6440 mutex_unlock(&wiphy->mtx); 6441 } 6442 6443 DEFINE_GUARD(wiphy, struct wiphy *, 6444 mutex_lock(&_T->mtx), 6445 mutex_unlock(&_T->mtx)) 6446 6447 struct wiphy_work; 6448 typedef void (*wiphy_work_func_t)(struct wiphy *, struct wiphy_work *); 6449 6450 struct wiphy_work { 6451 struct list_head entry; 6452 wiphy_work_func_t func; 6453 }; 6454 6455 static inline void wiphy_work_init(struct wiphy_work *work, 6456 wiphy_work_func_t func) 6457 { 6458 INIT_LIST_HEAD(&work->entry); 6459 work->func = func; 6460 } 6461 6462 /** 6463 * wiphy_work_queue - queue work for the wiphy 6464 * @wiphy: the wiphy to queue for 6465 * @work: the work item 6466 * 6467 * This is useful for work that must be done asynchronously, and work 6468 * queued here has the special property that the wiphy mutex will be 6469 * held as if wiphy_lock() was called, and that it cannot be running 6470 * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can 6471 * use just cancel_work() instead of cancel_work_sync(), it requires 6472 * being in a section protected by wiphy_lock(). 6473 */ 6474 void wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *work); 6475 6476 /** 6477 * wiphy_work_cancel - cancel previously queued work 6478 * @wiphy: the wiphy, for debug purposes 6479 * @work: the work to cancel 6480 * 6481 * Cancel the work *without* waiting for it, this assumes being 6482 * called under the wiphy mutex acquired by wiphy_lock(). 6483 */ 6484 void wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *work); 6485 6486 /** 6487 * wiphy_work_flush - flush previously queued work 6488 * @wiphy: the wiphy, for debug purposes 6489 * @work: the work to flush, this can be %NULL to flush all work 6490 * 6491 * Flush the work (i.e. run it if pending). This must be called 6492 * under the wiphy mutex acquired by wiphy_lock(). 6493 */ 6494 void wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *work); 6495 6496 struct wiphy_delayed_work { 6497 struct wiphy_work work; 6498 struct wiphy *wiphy; 6499 struct timer_list timer; 6500 }; 6501 6502 void wiphy_delayed_work_timer(struct timer_list *t); 6503 6504 static inline void wiphy_delayed_work_init(struct wiphy_delayed_work *dwork, 6505 wiphy_work_func_t func) 6506 { 6507 timer_setup(&dwork->timer, wiphy_delayed_work_timer, 0); 6508 wiphy_work_init(&dwork->work, func); 6509 } 6510 6511 /** 6512 * wiphy_delayed_work_queue - queue delayed work for the wiphy 6513 * @wiphy: the wiphy to queue for 6514 * @dwork: the delayable worker 6515 * @delay: number of jiffies to wait before queueing 6516 * 6517 * This is useful for work that must be done asynchronously, and work 6518 * queued here has the special property that the wiphy mutex will be 6519 * held as if wiphy_lock() was called, and that it cannot be running 6520 * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can 6521 * use just cancel_work() instead of cancel_work_sync(), it requires 6522 * being in a section protected by wiphy_lock(). 6523 * 6524 * Note that these are scheduled with a timer where the accuracy 6525 * becomes less the longer in the future the scheduled timer is. Use 6526 * wiphy_hrtimer_work_queue() if the timer must be not be late by more 6527 * than approximately 10 percent. 6528 */ 6529 void wiphy_delayed_work_queue(struct wiphy *wiphy, 6530 struct wiphy_delayed_work *dwork, 6531 unsigned long delay); 6532 6533 /** 6534 * wiphy_delayed_work_cancel - cancel previously queued delayed work 6535 * @wiphy: the wiphy, for debug purposes 6536 * @dwork: the delayed work to cancel 6537 * 6538 * Cancel the work *without* waiting for it, this assumes being 6539 * called under the wiphy mutex acquired by wiphy_lock(). 6540 */ 6541 void wiphy_delayed_work_cancel(struct wiphy *wiphy, 6542 struct wiphy_delayed_work *dwork); 6543 6544 /** 6545 * wiphy_delayed_work_flush - flush previously queued delayed work 6546 * @wiphy: the wiphy, for debug purposes 6547 * @dwork: the delayed work to flush 6548 * 6549 * Flush the work (i.e. run it if pending). This must be called 6550 * under the wiphy mutex acquired by wiphy_lock(). 6551 */ 6552 void wiphy_delayed_work_flush(struct wiphy *wiphy, 6553 struct wiphy_delayed_work *dwork); 6554 6555 /** 6556 * wiphy_delayed_work_pending - Find out whether a wiphy delayable 6557 * work item is currently pending. 6558 * 6559 * @wiphy: the wiphy, for debug purposes 6560 * @dwork: the delayed work in question 6561 * 6562 * Return: true if timer is pending, false otherwise 6563 * 6564 * How wiphy_delayed_work_queue() works is by setting a timer which 6565 * when it expires calls wiphy_work_queue() to queue the wiphy work. 6566 * Because wiphy_delayed_work_queue() uses mod_timer(), if it is 6567 * called twice and the second call happens before the first call 6568 * deadline, the work will rescheduled for the second deadline and 6569 * won't run before that. 6570 * 6571 * wiphy_delayed_work_pending() can be used to detect if calling 6572 * wiphy_work_delayed_work_queue() would start a new work schedule 6573 * or delayed a previous one. As seen below it cannot be used to 6574 * detect precisely if the work has finished to execute nor if it 6575 * is currently executing. 6576 * 6577 * CPU0 CPU1 6578 * wiphy_delayed_work_queue(wk) 6579 * mod_timer(wk->timer) 6580 * wiphy_delayed_work_pending(wk) -> true 6581 * 6582 * [...] 6583 * expire_timers(wk->timer) 6584 * detach_timer(wk->timer) 6585 * wiphy_delayed_work_pending(wk) -> false 6586 * wk->timer->function() | 6587 * wiphy_work_queue(wk) | delayed work pending 6588 * list_add_tail() | returns false but 6589 * queue_work(cfg80211_wiphy_work) | wk->func() has not 6590 * | been run yet 6591 * [...] | 6592 * cfg80211_wiphy_work() | 6593 * wk->func() V 6594 * 6595 */ 6596 bool wiphy_delayed_work_pending(struct wiphy *wiphy, 6597 struct wiphy_delayed_work *dwork); 6598 6599 struct wiphy_hrtimer_work { 6600 struct wiphy_work work; 6601 struct wiphy *wiphy; 6602 struct hrtimer timer; 6603 }; 6604 6605 enum hrtimer_restart wiphy_hrtimer_work_timer(struct hrtimer *t); 6606 6607 static inline void wiphy_hrtimer_work_init(struct wiphy_hrtimer_work *hrwork, 6608 wiphy_work_func_t func) 6609 { 6610 hrtimer_setup(&hrwork->timer, wiphy_hrtimer_work_timer, 6611 CLOCK_BOOTTIME, HRTIMER_MODE_REL); 6612 wiphy_work_init(&hrwork->work, func); 6613 } 6614 6615 /** 6616 * wiphy_hrtimer_work_queue - queue hrtimer work for the wiphy 6617 * @wiphy: the wiphy to queue for 6618 * @hrwork: the high resolution timer worker 6619 * @delay: the delay given as a ktime_t 6620 * 6621 * Please refer to wiphy_delayed_work_queue(). The difference is that 6622 * the hrtimer work uses a high resolution timer for scheduling. This 6623 * may be needed if timeouts might be scheduled further in the future 6624 * and the accuracy of the normal timer is not sufficient. 6625 * 6626 * Expect a delay of a few milliseconds as the timer is scheduled 6627 * with some slack and some more time may pass between queueing the 6628 * work and its start. 6629 */ 6630 void wiphy_hrtimer_work_queue(struct wiphy *wiphy, 6631 struct wiphy_hrtimer_work *hrwork, 6632 ktime_t delay); 6633 6634 /** 6635 * wiphy_hrtimer_work_cancel - cancel previously queued hrtimer work 6636 * @wiphy: the wiphy, for debug purposes 6637 * @hrtimer: the hrtimer work to cancel 6638 * 6639 * Cancel the work *without* waiting for it, this assumes being 6640 * called under the wiphy mutex acquired by wiphy_lock(). 6641 */ 6642 void wiphy_hrtimer_work_cancel(struct wiphy *wiphy, 6643 struct wiphy_hrtimer_work *hrtimer); 6644 6645 /** 6646 * wiphy_hrtimer_work_flush - flush previously queued hrtimer work 6647 * @wiphy: the wiphy, for debug purposes 6648 * @hrwork: the hrtimer work to flush 6649 * 6650 * Flush the work (i.e. run it if pending). This must be called 6651 * under the wiphy mutex acquired by wiphy_lock(). 6652 */ 6653 void wiphy_hrtimer_work_flush(struct wiphy *wiphy, 6654 struct wiphy_hrtimer_work *hrwork); 6655 6656 /** 6657 * wiphy_hrtimer_work_pending - Find out whether a wiphy hrtimer 6658 * work item is currently pending. 6659 * 6660 * @wiphy: the wiphy, for debug purposes 6661 * @hrwork: the hrtimer work in question 6662 * 6663 * Return: true if timer is pending, false otherwise 6664 * 6665 * Please refer to the wiphy_delayed_work_pending() documentation as 6666 * this is the equivalent function for hrtimer based delayed work 6667 * items. 6668 */ 6669 bool wiphy_hrtimer_work_pending(struct wiphy *wiphy, 6670 struct wiphy_hrtimer_work *hrwork); 6671 6672 /** 6673 * enum ieee80211_ap_reg_power - regulatory power for an Access Point 6674 * 6675 * @IEEE80211_REG_UNSET_AP: Access Point has no regulatory power mode 6676 * @IEEE80211_REG_LPI_AP: Indoor Access Point 6677 * @IEEE80211_REG_SP_AP: Standard power Access Point 6678 * @IEEE80211_REG_VLP_AP: Very low power Access Point 6679 */ 6680 enum ieee80211_ap_reg_power { 6681 IEEE80211_REG_UNSET_AP, 6682 IEEE80211_REG_LPI_AP, 6683 IEEE80211_REG_SP_AP, 6684 IEEE80211_REG_VLP_AP, 6685 }; 6686 6687 /** 6688 * struct wireless_dev - wireless device state 6689 * 6690 * For netdevs, this structure must be allocated by the driver 6691 * that uses the ieee80211_ptr field in struct net_device (this 6692 * is intentional so it can be allocated along with the netdev.) 6693 * It need not be registered then as netdev registration will 6694 * be intercepted by cfg80211 to see the new wireless device, 6695 * however, drivers must lock the wiphy before registering or 6696 * unregistering netdevs if they pre-create any netdevs (in ops 6697 * called from cfg80211, the wiphy is already locked.) 6698 * 6699 * For non-netdev uses, it must also be allocated by the driver 6700 * in response to the cfg80211 callbacks that require it, as 6701 * there's no netdev registration in that case it may not be 6702 * allocated outside of callback operations that return it. 6703 * 6704 * @wiphy: pointer to hardware description 6705 * @iftype: interface type 6706 * @registered: is this wdev already registered with cfg80211 6707 * @registering: indicates we're doing registration under wiphy lock 6708 * for the notifier 6709 * @list: (private) Used to collect the interfaces 6710 * @netdev: (private) Used to reference back to the netdev, may be %NULL 6711 * @identifier: (private) Identifier used in nl80211 to identify this 6712 * wireless device if it has no netdev 6713 * @u: union containing data specific to @iftype 6714 * @connected: indicates if connected or not (STA mode) 6715 * @wext: (private) Used by the internal wireless extensions compat code 6716 * @wext.ibss: (private) IBSS data part of wext handling 6717 * @wext.connect: (private) connection handling data 6718 * @wext.keys: (private) (WEP) key data 6719 * @wext.ie: (private) extra elements for association 6720 * @wext.ie_len: (private) length of extra elements 6721 * @wext.bssid: (private) selected network BSSID 6722 * @wext.ssid: (private) selected network SSID 6723 * @wext.default_key: (private) selected default key index 6724 * @wext.default_mgmt_key: (private) selected default management key index 6725 * @wext.prev_bssid: (private) previous BSSID for reassociation 6726 * @wext.prev_bssid_valid: (private) previous BSSID validity 6727 * @use_4addr: indicates 4addr mode is used on this interface, must be 6728 * set by driver (if supported) on add_interface BEFORE registering the 6729 * netdev and may otherwise be used by driver read-only, will be update 6730 * by cfg80211 on change_interface 6731 * @mgmt_registrations: list of registrations for management frames 6732 * @mgmt_registrations_need_update: mgmt registrations were updated, 6733 * need to propagate the update to the driver 6734 * @address: The address for this device, valid only if @netdev is %NULL 6735 * @is_running: true if this is a non-netdev device that has been started, e.g. 6736 * the P2P Device. 6737 * @ps: powersave mode is enabled 6738 * @ps_timeout: dynamic powersave timeout 6739 * @ap_unexpected_nlportid: (private) netlink port ID of application 6740 * registered for unexpected class 3 frames (AP mode) 6741 * @conn: (private) cfg80211 software SME connection state machine data 6742 * @connect_keys: (private) keys to set after connection is established 6743 * @conn_bss_type: connecting/connected BSS type 6744 * @conn_owner_nlportid: (private) connection owner socket port ID 6745 * @disconnect_wk: (private) auto-disconnect work 6746 * @disconnect_bssid: (private) the BSSID to use for auto-disconnect 6747 * @event_list: (private) list for internal event processing 6748 * @event_lock: (private) lock for event list 6749 * @owner_nlportid: (private) owner socket port ID 6750 * @nl_owner_dead: (private) owner socket went away 6751 * @cqm_rssi_work: (private) CQM RSSI reporting work 6752 * @cqm_config: (private) nl80211 RSSI monitor state 6753 * @pmsr_list: (private) peer measurement requests 6754 * @pmsr_lock: (private) peer measurements requests/results lock 6755 * @pmsr_free_wk: (private) peer measurements cleanup work 6756 * @unprot_beacon_reported: (private) timestamp of last 6757 * unprotected beacon report 6758 * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr 6759 * @ap and @client for each link 6760 * @links.cac_started: true if DFS channel availability check has been 6761 * started 6762 * @links.cac_start_time: timestamp (jiffies) when the dfs state was 6763 * entered. 6764 * @links.cac_time_ms: CAC time in ms 6765 * @valid_links: bitmap describing what elements of @links are valid 6766 * @radio_mask: Bitmask of radios that this interface is allowed to operate on. 6767 */ 6768 struct wireless_dev { 6769 struct wiphy *wiphy; 6770 enum nl80211_iftype iftype; 6771 6772 /* the remainder of this struct should be private to cfg80211 */ 6773 struct list_head list; 6774 struct net_device *netdev; 6775 6776 u32 identifier; 6777 6778 struct list_head mgmt_registrations; 6779 u8 mgmt_registrations_need_update:1; 6780 6781 bool use_4addr, is_running, registered, registering; 6782 6783 u8 address[ETH_ALEN] __aligned(sizeof(u16)); 6784 6785 /* currently used for IBSS and SME - might be rearranged later */ 6786 struct cfg80211_conn *conn; 6787 struct cfg80211_cached_keys *connect_keys; 6788 enum ieee80211_bss_type conn_bss_type; 6789 u32 conn_owner_nlportid; 6790 6791 struct work_struct disconnect_wk; 6792 u8 disconnect_bssid[ETH_ALEN]; 6793 6794 struct list_head event_list; 6795 spinlock_t event_lock; 6796 6797 u8 connected:1; 6798 6799 bool ps; 6800 int ps_timeout; 6801 6802 u32 ap_unexpected_nlportid; 6803 6804 u32 owner_nlportid; 6805 bool nl_owner_dead; 6806 6807 #ifdef CONFIG_CFG80211_WEXT 6808 /* wext data */ 6809 struct { 6810 struct cfg80211_ibss_params ibss; 6811 struct cfg80211_connect_params connect; 6812 struct cfg80211_cached_keys *keys; 6813 const u8 *ie; 6814 size_t ie_len; 6815 u8 bssid[ETH_ALEN]; 6816 u8 prev_bssid[ETH_ALEN]; 6817 u8 ssid[IEEE80211_MAX_SSID_LEN]; 6818 s8 default_key, default_mgmt_key; 6819 bool prev_bssid_valid; 6820 } wext; 6821 #endif 6822 6823 struct wiphy_work cqm_rssi_work; 6824 struct cfg80211_cqm_config __rcu *cqm_config; 6825 6826 struct list_head pmsr_list; 6827 spinlock_t pmsr_lock; 6828 struct work_struct pmsr_free_wk; 6829 6830 unsigned long unprot_beacon_reported; 6831 6832 union { 6833 struct { 6834 u8 connected_addr[ETH_ALEN] __aligned(2); 6835 u8 ssid[IEEE80211_MAX_SSID_LEN]; 6836 u8 ssid_len; 6837 } client; 6838 struct { 6839 int beacon_interval; 6840 struct cfg80211_chan_def preset_chandef; 6841 struct cfg80211_chan_def chandef; 6842 u8 id[IEEE80211_MAX_MESH_ID_LEN]; 6843 u8 id_len, id_up_len; 6844 } mesh; 6845 struct { 6846 struct cfg80211_chan_def preset_chandef; 6847 u8 ssid[IEEE80211_MAX_SSID_LEN]; 6848 u8 ssid_len; 6849 } ap; 6850 struct { 6851 struct cfg80211_internal_bss *current_bss; 6852 struct cfg80211_chan_def chandef; 6853 int beacon_interval; 6854 u8 ssid[IEEE80211_MAX_SSID_LEN]; 6855 u8 ssid_len; 6856 } ibss; 6857 struct { 6858 struct cfg80211_chan_def chandef; 6859 } ocb; 6860 struct { 6861 u8 cluster_id[ETH_ALEN] __aligned(2); 6862 } nan; 6863 } u; 6864 6865 struct { 6866 u8 addr[ETH_ALEN] __aligned(2); 6867 union { 6868 struct { 6869 unsigned int beacon_interval; 6870 struct cfg80211_chan_def chandef; 6871 } ap; 6872 struct { 6873 struct cfg80211_internal_bss *current_bss; 6874 } client; 6875 }; 6876 6877 bool cac_started; 6878 unsigned long cac_start_time; 6879 unsigned int cac_time_ms; 6880 } links[IEEE80211_MLD_MAX_NUM_LINKS]; 6881 u16 valid_links; 6882 6883 u32 radio_mask; 6884 }; 6885 6886 static inline const u8 *wdev_address(struct wireless_dev *wdev) 6887 { 6888 if (wdev->netdev) 6889 return wdev->netdev->dev_addr; 6890 return wdev->address; 6891 } 6892 6893 static inline bool wdev_running(struct wireless_dev *wdev) 6894 { 6895 if (wdev->netdev) 6896 return netif_running(wdev->netdev); 6897 return wdev->is_running; 6898 } 6899 6900 /** 6901 * wdev_priv - return wiphy priv from wireless_dev 6902 * 6903 * @wdev: The wireless device whose wiphy's priv pointer to return 6904 * Return: The wiphy priv of @wdev. 6905 */ 6906 static inline void *wdev_priv(struct wireless_dev *wdev) 6907 { 6908 BUG_ON(!wdev); 6909 return wiphy_priv(wdev->wiphy); 6910 } 6911 6912 /** 6913 * wdev_chandef - return chandef pointer from wireless_dev 6914 * @wdev: the wdev 6915 * @link_id: the link ID for MLO 6916 * 6917 * Return: The chandef depending on the mode, or %NULL. 6918 */ 6919 struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev, 6920 unsigned int link_id); 6921 6922 static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev, 6923 unsigned int link_id) 6924 { 6925 WARN_ON(link_id && !wdev->valid_links); 6926 WARN_ON(wdev->valid_links && 6927 !(wdev->valid_links & BIT(link_id))); 6928 } 6929 6930 #define for_each_valid_link(link_info, link_id) \ 6931 for (link_id = 0; \ 6932 link_id < ((link_info)->valid_links ? \ 6933 ARRAY_SIZE((link_info)->links) : 1); \ 6934 link_id++) \ 6935 if (!(link_info)->valid_links || \ 6936 ((link_info)->valid_links & BIT(link_id))) 6937 6938 /** 6939 * DOC: Utility functions 6940 * 6941 * cfg80211 offers a number of utility functions that can be useful. 6942 */ 6943 6944 /** 6945 * ieee80211_channel_equal - compare two struct ieee80211_channel 6946 * 6947 * @a: 1st struct ieee80211_channel 6948 * @b: 2nd struct ieee80211_channel 6949 * Return: true if center frequency of @a == @b 6950 */ 6951 static inline bool 6952 ieee80211_channel_equal(struct ieee80211_channel *a, 6953 struct ieee80211_channel *b) 6954 { 6955 return (a->center_freq == b->center_freq && 6956 a->freq_offset == b->freq_offset); 6957 } 6958 6959 /** 6960 * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz 6961 * @chan: struct ieee80211_channel to convert 6962 * Return: The corresponding frequency (in KHz) 6963 */ 6964 static inline u32 6965 ieee80211_channel_to_khz(const struct ieee80211_channel *chan) 6966 { 6967 return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset; 6968 } 6969 6970 /** 6971 * ieee80211_channel_to_freq_khz - convert channel number to frequency 6972 * @chan: channel number 6973 * @band: band, necessary due to channel number overlap 6974 * Return: The corresponding frequency (in KHz), or 0 if the conversion failed. 6975 */ 6976 u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band); 6977 6978 /** 6979 * ieee80211_channel_to_frequency - convert channel number to frequency 6980 * @chan: channel number 6981 * @band: band, necessary due to channel number overlap 6982 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 6983 */ 6984 static inline int 6985 ieee80211_channel_to_frequency(int chan, enum nl80211_band band) 6986 { 6987 return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band)); 6988 } 6989 6990 /** 6991 * ieee80211_freq_khz_to_channel - convert frequency to channel number 6992 * @freq: center frequency in KHz 6993 * Return: The corresponding channel, or 0 if the conversion failed. 6994 */ 6995 int ieee80211_freq_khz_to_channel(u32 freq); 6996 6997 /** 6998 * ieee80211_frequency_to_channel - convert frequency to channel number 6999 * @freq: center frequency in MHz 7000 * Return: The corresponding channel, or 0 if the conversion failed. 7001 */ 7002 static inline int 7003 ieee80211_frequency_to_channel(int freq) 7004 { 7005 return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq)); 7006 } 7007 7008 /** 7009 * ieee80211_get_channel_khz - get channel struct from wiphy for specified 7010 * frequency 7011 * @wiphy: the struct wiphy to get the channel for 7012 * @freq: the center frequency (in KHz) of the channel 7013 * Return: The channel struct from @wiphy at @freq. 7014 */ 7015 struct ieee80211_channel * 7016 ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq); 7017 7018 /** 7019 * ieee80211_get_channel - get channel struct from wiphy for specified frequency 7020 * 7021 * @wiphy: the struct wiphy to get the channel for 7022 * @freq: the center frequency (in MHz) of the channel 7023 * Return: The channel struct from @wiphy at @freq. 7024 */ 7025 static inline struct ieee80211_channel * 7026 ieee80211_get_channel(struct wiphy *wiphy, int freq) 7027 { 7028 return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq)); 7029 } 7030 7031 /** 7032 * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC 7033 * @chan: control channel to check 7034 * 7035 * The Preferred Scanning Channels (PSC) are defined in 7036 * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3 7037 * 7038 * Return: %true if channel is a PSC, %false otherwise 7039 */ 7040 static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan) 7041 { 7042 if (chan->band != NL80211_BAND_6GHZ) 7043 return false; 7044 7045 return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5; 7046 } 7047 7048 /** 7049 * ieee80211_radio_freq_range_valid - Check if the radio supports the 7050 * specified frequency range 7051 * 7052 * @radio: wiphy radio 7053 * @freq: the frequency (in KHz) to be queried 7054 * @width: the bandwidth (in KHz) to be queried 7055 * 7056 * Return: whether or not the given frequency range is valid for the given radio 7057 */ 7058 bool ieee80211_radio_freq_range_valid(const struct wiphy_radio *radio, 7059 u32 freq, u32 width); 7060 7061 /** 7062 * cfg80211_radio_chandef_valid - Check if the radio supports the chandef 7063 * 7064 * @radio: wiphy radio 7065 * @chandef: chandef for current channel 7066 * 7067 * Return: whether or not the given chandef is valid for the given radio 7068 */ 7069 bool cfg80211_radio_chandef_valid(const struct wiphy_radio *radio, 7070 const struct cfg80211_chan_def *chandef); 7071 7072 /** 7073 * cfg80211_wdev_channel_allowed - Check if the wdev may use the channel 7074 * 7075 * @wdev: the wireless device 7076 * @chan: channel to check 7077 * 7078 * Return: whether or not the wdev may use the channel 7079 */ 7080 bool cfg80211_wdev_channel_allowed(struct wireless_dev *wdev, 7081 struct ieee80211_channel *chan); 7082 7083 /** 7084 * ieee80211_get_response_rate - get basic rate for a given rate 7085 * 7086 * @sband: the band to look for rates in 7087 * @basic_rates: bitmap of basic rates 7088 * @bitrate: the bitrate for which to find the basic rate 7089 * 7090 * Return: The basic rate corresponding to a given bitrate, that 7091 * is the next lower bitrate contained in the basic rate map, 7092 * which is, for this function, given as a bitmap of indices of 7093 * rates in the band's bitrate table. 7094 */ 7095 const struct ieee80211_rate * 7096 ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 7097 u32 basic_rates, int bitrate); 7098 7099 /** 7100 * ieee80211_mandatory_rates - get mandatory rates for a given band 7101 * @sband: the band to look for rates in 7102 * 7103 * Return: a bitmap of the mandatory rates for the given band, bits 7104 * are set according to the rate position in the bitrates array. 7105 */ 7106 u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband); 7107 7108 /* 7109 * Radiotap parsing functions -- for controlled injection support 7110 * 7111 * Implemented in net/wireless/radiotap.c 7112 * Documentation in Documentation/networking/radiotap-headers.rst 7113 */ 7114 7115 struct radiotap_align_size { 7116 uint8_t align:4, size:4; 7117 }; 7118 7119 struct ieee80211_radiotap_namespace { 7120 const struct radiotap_align_size *align_size; 7121 int n_bits; 7122 uint32_t oui; 7123 uint8_t subns; 7124 }; 7125 7126 struct ieee80211_radiotap_vendor_namespaces { 7127 const struct ieee80211_radiotap_namespace *ns; 7128 int n_ns; 7129 }; 7130 7131 /** 7132 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 7133 * @this_arg_index: index of current arg, valid after each successful call 7134 * to ieee80211_radiotap_iterator_next() 7135 * @this_arg: pointer to current radiotap arg; it is valid after each 7136 * call to ieee80211_radiotap_iterator_next() but also after 7137 * ieee80211_radiotap_iterator_init() where it will point to 7138 * the beginning of the actual data portion 7139 * @this_arg_size: length of the current arg, for convenience 7140 * @current_namespace: pointer to the current namespace definition 7141 * (or internally %NULL if the current namespace is unknown) 7142 * @is_radiotap_ns: indicates whether the current namespace is the default 7143 * radiotap namespace or not 7144 * 7145 * @_rtheader: pointer to the radiotap header we are walking through 7146 * @_max_length: length of radiotap header in cpu byte ordering 7147 * @_arg_index: next argument index 7148 * @_arg: next argument pointer 7149 * @_next_bitmap: internal pointer to next present u32 7150 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 7151 * @_vns: vendor namespace definitions 7152 * @_next_ns_data: beginning of the next namespace's data 7153 * @_reset_on_ext: internal; reset the arg index to 0 when going to the 7154 * next bitmap word 7155 * 7156 * Describes the radiotap parser state. Fields prefixed with an underscore 7157 * must not be used by users of the parser, only by the parser internally. 7158 */ 7159 7160 struct ieee80211_radiotap_iterator { 7161 struct ieee80211_radiotap_header *_rtheader; 7162 const struct ieee80211_radiotap_vendor_namespaces *_vns; 7163 const struct ieee80211_radiotap_namespace *current_namespace; 7164 7165 unsigned char *_arg, *_next_ns_data; 7166 __le32 *_next_bitmap; 7167 7168 unsigned char *this_arg; 7169 int this_arg_index; 7170 int this_arg_size; 7171 7172 int is_radiotap_ns; 7173 7174 int _max_length; 7175 int _arg_index; 7176 uint32_t _bitmap_shifter; 7177 int _reset_on_ext; 7178 }; 7179 7180 int 7181 ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 7182 struct ieee80211_radiotap_header *radiotap_header, 7183 int max_length, 7184 const struct ieee80211_radiotap_vendor_namespaces *vns); 7185 7186 int 7187 ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 7188 7189 7190 extern const unsigned char rfc1042_header[6]; 7191 extern const unsigned char bridge_tunnel_header[6]; 7192 7193 /** 7194 * ieee80211_get_hdrlen_from_skb - get header length from data 7195 * 7196 * @skb: the frame 7197 * 7198 * Given an skb with a raw 802.11 header at the data pointer this function 7199 * returns the 802.11 header length. 7200 * 7201 * Return: The 802.11 header length in bytes (not including encryption 7202 * headers). Or 0 if the data in the sk_buff is too short to contain a valid 7203 * 802.11 header. 7204 */ 7205 unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 7206 7207 /** 7208 * ieee80211_hdrlen - get header length in bytes from frame control 7209 * @fc: frame control field in little-endian format 7210 * Return: The header length in bytes. 7211 */ 7212 unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 7213 7214 /** 7215 * ieee80211_get_mesh_hdrlen - get mesh extension header length 7216 * @meshhdr: the mesh extension header, only the flags field 7217 * (first byte) will be accessed 7218 * Return: The length of the extension header, which is always at 7219 * least 6 bytes and at most 18 if address 5 and 6 are present. 7220 */ 7221 unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 7222 7223 /** 7224 * DOC: Data path helpers 7225 * 7226 * In addition to generic utilities, cfg80211 also offers 7227 * functions that help implement the data path for devices 7228 * that do not do the 802.11/802.3 conversion on the device. 7229 */ 7230 7231 /** 7232 * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3 7233 * @skb: the 802.11 data frame 7234 * @ehdr: pointer to a &struct ethhdr that will get the header, instead 7235 * of it being pushed into the SKB 7236 * @addr: the device MAC address 7237 * @iftype: the virtual interface type 7238 * @data_offset: offset of payload after the 802.11 header 7239 * @is_amsdu: true if the 802.11 header is A-MSDU 7240 * Return: 0 on success. Non-zero on error. 7241 */ 7242 int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, 7243 const u8 *addr, enum nl80211_iftype iftype, 7244 u8 data_offset, bool is_amsdu); 7245 7246 /** 7247 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 7248 * @skb: the 802.11 data frame 7249 * @addr: the device MAC address 7250 * @iftype: the virtual interface type 7251 * Return: 0 on success. Non-zero on error. 7252 */ 7253 static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 7254 enum nl80211_iftype iftype) 7255 { 7256 return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false); 7257 } 7258 7259 /** 7260 * ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid 7261 * 7262 * This is used to detect non-standard A-MSDU frames, e.g. the ones generated 7263 * by ath10k and ath11k, where the subframe length includes the length of the 7264 * mesh control field. 7265 * 7266 * @skb: The input A-MSDU frame without any headers. 7267 * @mesh_hdr: the type of mesh header to test 7268 * 0: non-mesh A-MSDU length field 7269 * 1: big-endian mesh A-MSDU length field 7270 * 2: little-endian mesh A-MSDU length field 7271 * Returns: true if subframe header lengths are valid for the @mesh_hdr mode 7272 */ 7273 bool ieee80211_is_valid_amsdu(struct sk_buff *skb, u8 mesh_hdr); 7274 7275 /** 7276 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 7277 * 7278 * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames. 7279 * The @list will be empty if the decode fails. The @skb must be fully 7280 * header-less before being passed in here; it is freed in this function. 7281 * 7282 * @skb: The input A-MSDU frame without any headers. 7283 * @list: The output list of 802.3 frames. It must be allocated and 7284 * initialized by the caller. 7285 * @addr: The device MAC address. 7286 * @iftype: The device interface type. 7287 * @extra_headroom: The hardware extra headroom for SKBs in the @list. 7288 * @check_da: DA to check in the inner ethernet header, or NULL 7289 * @check_sa: SA to check in the inner ethernet header, or NULL 7290 * @mesh_control: see mesh_hdr in ieee80211_is_valid_amsdu 7291 */ 7292 void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 7293 const u8 *addr, enum nl80211_iftype iftype, 7294 const unsigned int extra_headroom, 7295 const u8 *check_da, const u8 *check_sa, 7296 u8 mesh_control); 7297 7298 /** 7299 * ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol 7300 * 7301 * Check for RFC1042 or bridge tunnel header and fetch the encapsulated 7302 * protocol. 7303 * 7304 * @hdr: pointer to the MSDU payload 7305 * @proto: destination pointer to store the protocol 7306 * Return: true if encapsulation was found 7307 */ 7308 bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto); 7309 7310 /** 7311 * ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames 7312 * 7313 * Strip the mesh header, which was left in by ieee80211_data_to_8023 as part 7314 * of the MSDU data. Also move any source/destination addresses from the mesh 7315 * header to the ethernet header (if present). 7316 * 7317 * @skb: The 802.3 frame with embedded mesh header 7318 * 7319 * Return: 0 on success. Non-zero on error. 7320 */ 7321 int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb); 7322 7323 /** 7324 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 7325 * @skb: the data frame 7326 * @qos_map: Interworking QoS mapping or %NULL if not in use 7327 * Return: The 802.1p/1d tag. 7328 */ 7329 unsigned int cfg80211_classify8021d(struct sk_buff *skb, 7330 struct cfg80211_qos_map *qos_map); 7331 7332 /** 7333 * cfg80211_find_elem_match - match information element and byte array in data 7334 * 7335 * @eid: element ID 7336 * @ies: data consisting of IEs 7337 * @len: length of data 7338 * @match: byte array to match 7339 * @match_len: number of bytes in the match array 7340 * @match_offset: offset in the IE data where the byte array should match. 7341 * Note the difference to cfg80211_find_ie_match() which considers 7342 * the offset to start from the element ID byte, but here we take 7343 * the data portion instead. 7344 * 7345 * Return: %NULL if the element ID could not be found or if 7346 * the element is invalid (claims to be longer than the given 7347 * data) or if the byte array doesn't match; otherwise return the 7348 * requested element struct. 7349 * 7350 * Note: There are no checks on the element length other than 7351 * having to fit into the given data and being large enough for the 7352 * byte array to match. 7353 */ 7354 const struct element * 7355 cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len, 7356 const u8 *match, unsigned int match_len, 7357 unsigned int match_offset); 7358 7359 /** 7360 * cfg80211_find_ie_match - match information element and byte array in data 7361 * 7362 * @eid: element ID 7363 * @ies: data consisting of IEs 7364 * @len: length of data 7365 * @match: byte array to match 7366 * @match_len: number of bytes in the match array 7367 * @match_offset: offset in the IE where the byte array should match. 7368 * If match_len is zero, this must also be set to zero. 7369 * Otherwise this must be set to 2 or more, because the first 7370 * byte is the element id, which is already compared to eid, and 7371 * the second byte is the IE length. 7372 * 7373 * Return: %NULL if the element ID could not be found or if 7374 * the element is invalid (claims to be longer than the given 7375 * data) or if the byte array doesn't match, or a pointer to the first 7376 * byte of the requested element, that is the byte containing the 7377 * element ID. 7378 * 7379 * Note: There are no checks on the element length other than 7380 * having to fit into the given data and being large enough for the 7381 * byte array to match. 7382 */ 7383 static inline const u8 * 7384 cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len, 7385 const u8 *match, unsigned int match_len, 7386 unsigned int match_offset) 7387 { 7388 /* match_offset can't be smaller than 2, unless match_len is 7389 * zero, in which case match_offset must be zero as well. 7390 */ 7391 if (WARN_ON((match_len && match_offset < 2) || 7392 (!match_len && match_offset))) 7393 return NULL; 7394 7395 return (const void *)cfg80211_find_elem_match(eid, ies, len, 7396 match, match_len, 7397 match_offset ? 7398 match_offset - 2 : 0); 7399 } 7400 7401 /** 7402 * cfg80211_find_elem - find information element in data 7403 * 7404 * @eid: element ID 7405 * @ies: data consisting of IEs 7406 * @len: length of data 7407 * 7408 * Return: %NULL if the element ID could not be found or if 7409 * the element is invalid (claims to be longer than the given 7410 * data) or if the byte array doesn't match; otherwise return the 7411 * requested element struct. 7412 * 7413 * Note: There are no checks on the element length other than 7414 * having to fit into the given data. 7415 */ 7416 static inline const struct element * 7417 cfg80211_find_elem(u8 eid, const u8 *ies, int len) 7418 { 7419 return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0); 7420 } 7421 7422 /** 7423 * cfg80211_find_ie - find information element in data 7424 * 7425 * @eid: element ID 7426 * @ies: data consisting of IEs 7427 * @len: length of data 7428 * 7429 * Return: %NULL if the element ID could not be found or if 7430 * the element is invalid (claims to be longer than the given 7431 * data), or a pointer to the first byte of the requested 7432 * element, that is the byte containing the element ID. 7433 * 7434 * Note: There are no checks on the element length other than 7435 * having to fit into the given data. 7436 */ 7437 static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) 7438 { 7439 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0); 7440 } 7441 7442 /** 7443 * cfg80211_find_ext_elem - find information element with EID Extension in data 7444 * 7445 * @ext_eid: element ID Extension 7446 * @ies: data consisting of IEs 7447 * @len: length of data 7448 * 7449 * Return: %NULL if the extended element could not be found or if 7450 * the element is invalid (claims to be longer than the given 7451 * data) or if the byte array doesn't match; otherwise return the 7452 * requested element struct. 7453 * 7454 * Note: There are no checks on the element length other than 7455 * having to fit into the given data. 7456 */ 7457 static inline const struct element * 7458 cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len) 7459 { 7460 return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len, 7461 &ext_eid, 1, 0); 7462 } 7463 7464 /** 7465 * cfg80211_find_ext_ie - find information element with EID Extension in data 7466 * 7467 * @ext_eid: element ID Extension 7468 * @ies: data consisting of IEs 7469 * @len: length of data 7470 * 7471 * Return: %NULL if the extended element ID could not be found or if 7472 * the element is invalid (claims to be longer than the given 7473 * data), or a pointer to the first byte of the requested 7474 * element, that is the byte containing the element ID. 7475 * 7476 * Note: There are no checks on the element length other than 7477 * having to fit into the given data. 7478 */ 7479 static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len) 7480 { 7481 return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len, 7482 &ext_eid, 1, 2); 7483 } 7484 7485 /** 7486 * cfg80211_find_vendor_elem - find vendor specific information element in data 7487 * 7488 * @oui: vendor OUI 7489 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 7490 * @ies: data consisting of IEs 7491 * @len: length of data 7492 * 7493 * Return: %NULL if the vendor specific element ID could not be found or if the 7494 * element is invalid (claims to be longer than the given data); otherwise 7495 * return the element structure for the requested element. 7496 * 7497 * Note: There are no checks on the element length other than having to fit into 7498 * the given data. 7499 */ 7500 const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type, 7501 const u8 *ies, 7502 unsigned int len); 7503 7504 /** 7505 * cfg80211_find_vendor_ie - find vendor specific information element in data 7506 * 7507 * @oui: vendor OUI 7508 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 7509 * @ies: data consisting of IEs 7510 * @len: length of data 7511 * 7512 * Return: %NULL if the vendor specific element ID could not be found or if the 7513 * element is invalid (claims to be longer than the given data), or a pointer to 7514 * the first byte of the requested element, that is the byte containing the 7515 * element ID. 7516 * 7517 * Note: There are no checks on the element length other than having to fit into 7518 * the given data. 7519 */ 7520 static inline const u8 * 7521 cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 7522 const u8 *ies, unsigned int len) 7523 { 7524 return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len); 7525 } 7526 7527 /** 7528 * enum cfg80211_rnr_iter_ret - reduced neighbor report iteration state 7529 * @RNR_ITER_CONTINUE: continue iterating with the next entry 7530 * @RNR_ITER_BREAK: break iteration and return success 7531 * @RNR_ITER_ERROR: break iteration and return error 7532 */ 7533 enum cfg80211_rnr_iter_ret { 7534 RNR_ITER_CONTINUE, 7535 RNR_ITER_BREAK, 7536 RNR_ITER_ERROR, 7537 }; 7538 7539 /** 7540 * cfg80211_iter_rnr - iterate reduced neighbor report entries 7541 * @elems: the frame elements to iterate RNR elements and then 7542 * their entries in 7543 * @elems_len: length of the elements 7544 * @iter: iteration function, see also &enum cfg80211_rnr_iter_ret 7545 * for the return value 7546 * @iter_data: additional data passed to the iteration function 7547 * Return: %true on success (after successfully iterating all entries 7548 * or if the iteration function returned %RNR_ITER_BREAK), 7549 * %false on error (iteration function returned %RNR_ITER_ERROR 7550 * or elements were malformed.) 7551 */ 7552 bool cfg80211_iter_rnr(const u8 *elems, size_t elems_len, 7553 enum cfg80211_rnr_iter_ret 7554 (*iter)(void *data, u8 type, 7555 const struct ieee80211_neighbor_ap_info *info, 7556 const u8 *tbtt_info, u8 tbtt_info_len), 7557 void *iter_data); 7558 7559 /** 7560 * cfg80211_defragment_element - Defrag the given element data into a buffer 7561 * 7562 * @elem: the element to defragment 7563 * @ies: elements where @elem is contained 7564 * @ieslen: length of @ies 7565 * @data: buffer to store element data, or %NULL to just determine size 7566 * @data_len: length of @data, or 0 7567 * @frag_id: the element ID of fragments 7568 * 7569 * Return: length of @data, or -EINVAL on error 7570 * 7571 * Copy out all data from an element that may be fragmented into @data, while 7572 * skipping all headers. 7573 * 7574 * The function uses memmove() internally. It is acceptable to defragment an 7575 * element in-place. 7576 */ 7577 ssize_t cfg80211_defragment_element(const struct element *elem, const u8 *ies, 7578 size_t ieslen, u8 *data, size_t data_len, 7579 u8 frag_id); 7580 7581 /** 7582 * cfg80211_send_layer2_update - send layer 2 update frame 7583 * 7584 * @dev: network device 7585 * @addr: STA MAC address 7586 * 7587 * Wireless drivers can use this function to update forwarding tables in bridge 7588 * devices upon STA association. 7589 */ 7590 void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr); 7591 7592 /** 7593 * DOC: Regulatory enforcement infrastructure 7594 * 7595 * TODO 7596 */ 7597 7598 /** 7599 * regulatory_hint - driver hint to the wireless core a regulatory domain 7600 * @wiphy: the wireless device giving the hint (used only for reporting 7601 * conflicts) 7602 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 7603 * should be in. If @rd is set this should be NULL. Note that if you 7604 * set this to NULL you should still set rd->alpha2 to some accepted 7605 * alpha2. 7606 * 7607 * Wireless drivers can use this function to hint to the wireless core 7608 * what it believes should be the current regulatory domain by 7609 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 7610 * domain should be in or by providing a completely build regulatory domain. 7611 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 7612 * for a regulatory domain structure for the respective country. 7613 * 7614 * The wiphy must have been registered to cfg80211 prior to this call. 7615 * For cfg80211 drivers this means you must first use wiphy_register(), 7616 * for mac80211 drivers you must first use ieee80211_register_hw(). 7617 * 7618 * Drivers should check the return value, its possible you can get 7619 * an -ENOMEM. 7620 * 7621 * Return: 0 on success. -ENOMEM. 7622 */ 7623 int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 7624 7625 /** 7626 * regulatory_set_wiphy_regd - set regdom info for self managed drivers 7627 * @wiphy: the wireless device we want to process the regulatory domain on 7628 * @rd: the regulatory domain information to use for this wiphy 7629 * 7630 * Set the regulatory domain information for self-managed wiphys, only they 7631 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 7632 * information. 7633 * 7634 * Return: 0 on success. -EINVAL, -EPERM 7635 */ 7636 int regulatory_set_wiphy_regd(struct wiphy *wiphy, 7637 struct ieee80211_regdomain *rd); 7638 7639 /** 7640 * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers 7641 * @wiphy: the wireless device we want to process the regulatory domain on 7642 * @rd: the regulatory domain information to use for this wiphy 7643 * 7644 * This functions requires the RTNL and the wiphy mutex to be held and 7645 * applies the new regdomain synchronously to this wiphy. For more details 7646 * see regulatory_set_wiphy_regd(). 7647 * 7648 * Return: 0 on success. -EINVAL, -EPERM 7649 */ 7650 int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, 7651 struct ieee80211_regdomain *rd); 7652 7653 /** 7654 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 7655 * @wiphy: the wireless device we want to process the regulatory domain on 7656 * @regd: the custom regulatory domain to use for this wiphy 7657 * 7658 * Drivers can sometimes have custom regulatory domains which do not apply 7659 * to a specific country. Drivers can use this to apply such custom regulatory 7660 * domains. This routine must be called prior to wiphy registration. The 7661 * custom regulatory domain will be trusted completely and as such previous 7662 * default channel settings will be disregarded. If no rule is found for a 7663 * channel on the regulatory domain the channel will be disabled. 7664 * Drivers using this for a wiphy should also set the wiphy flag 7665 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 7666 * that called this helper. 7667 */ 7668 void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 7669 const struct ieee80211_regdomain *regd); 7670 7671 /** 7672 * freq_reg_info - get regulatory information for the given frequency 7673 * @wiphy: the wiphy for which we want to process this rule for 7674 * @center_freq: Frequency in KHz for which we want regulatory information for 7675 * 7676 * Use this function to get the regulatory rule for a specific frequency on 7677 * a given wireless device. If the device has a specific regulatory domain 7678 * it wants to follow we respect that unless a country IE has been received 7679 * and processed already. 7680 * 7681 * Return: A valid pointer, or, when an error occurs, for example if no rule 7682 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 7683 * check and PTR_ERR() to obtain the numeric return value. The numeric return 7684 * value will be -ERANGE if we determine the given center_freq does not even 7685 * have a regulatory rule for a frequency range in the center_freq's band. 7686 * See freq_in_rule_band() for our current definition of a band -- this is 7687 * purely subjective and right now it's 802.11 specific. 7688 */ 7689 const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 7690 u32 center_freq); 7691 7692 /** 7693 * reg_initiator_name - map regulatory request initiator enum to name 7694 * @initiator: the regulatory request initiator 7695 * 7696 * You can use this to map the regulatory request initiator enum to a 7697 * proper string representation. 7698 * 7699 * Return: pointer to string representation of the initiator 7700 */ 7701 const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 7702 7703 /** 7704 * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom 7705 * @wiphy: wiphy for which pre-CAC capability is checked. 7706 * 7707 * Pre-CAC is allowed only in some regdomains (notable ETSI). 7708 * 7709 * Return: %true if allowed, %false otherwise 7710 */ 7711 bool regulatory_pre_cac_allowed(struct wiphy *wiphy); 7712 7713 /** 7714 * DOC: Internal regulatory db functions 7715 * 7716 */ 7717 7718 /** 7719 * reg_query_regdb_wmm - Query internal regulatory db for wmm rule 7720 * Regulatory self-managed driver can use it to proactively 7721 * 7722 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried. 7723 * @freq: the frequency (in MHz) to be queried. 7724 * @rule: pointer to store the wmm rule from the regulatory db. 7725 * 7726 * Self-managed wireless drivers can use this function to query 7727 * the internal regulatory database to check whether the given 7728 * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations. 7729 * 7730 * Drivers should check the return value, its possible you can get 7731 * an -ENODATA. 7732 * 7733 * Return: 0 on success. -ENODATA. 7734 */ 7735 int reg_query_regdb_wmm(char *alpha2, int freq, 7736 struct ieee80211_reg_rule *rule); 7737 7738 /* 7739 * callbacks for asynchronous cfg80211 methods, notification 7740 * functions and BSS handling helpers 7741 */ 7742 7743 /** 7744 * cfg80211_scan_done - notify that scan finished 7745 * 7746 * @request: the corresponding scan request 7747 * @info: information about the completed scan 7748 */ 7749 void cfg80211_scan_done(struct cfg80211_scan_request *request, 7750 struct cfg80211_scan_info *info); 7751 7752 /** 7753 * cfg80211_sched_scan_results - notify that new scan results are available 7754 * 7755 * @wiphy: the wiphy which got scheduled scan results 7756 * @reqid: identifier for the related scheduled scan request 7757 */ 7758 void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid); 7759 7760 /** 7761 * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 7762 * 7763 * @wiphy: the wiphy on which the scheduled scan stopped 7764 * @reqid: identifier for the related scheduled scan request 7765 * 7766 * The driver can call this function to inform cfg80211 that the 7767 * scheduled scan had to be stopped, for whatever reason. The driver 7768 * is then called back via the sched_scan_stop operation when done. 7769 */ 7770 void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid); 7771 7772 /** 7773 * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped 7774 * 7775 * @wiphy: the wiphy on which the scheduled scan stopped 7776 * @reqid: identifier for the related scheduled scan request 7777 * 7778 * The driver can call this function to inform cfg80211 that the 7779 * scheduled scan had to be stopped, for whatever reason. The driver 7780 * is then called back via the sched_scan_stop operation when done. 7781 * This function should be called with the wiphy mutex held. 7782 */ 7783 void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid); 7784 7785 /** 7786 * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame 7787 * @wiphy: the wiphy reporting the BSS 7788 * @data: the BSS metadata 7789 * @mgmt: the management frame (probe response or beacon) 7790 * @len: length of the management frame 7791 * @gfp: context flags 7792 * 7793 * This informs cfg80211 that BSS information was found and 7794 * the BSS should be updated/added. 7795 * 7796 * Return: A referenced struct, must be released with cfg80211_put_bss()! 7797 * Or %NULL on error. 7798 */ 7799 struct cfg80211_bss * __must_check 7800 cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 7801 struct cfg80211_inform_bss *data, 7802 struct ieee80211_mgmt *mgmt, size_t len, 7803 gfp_t gfp); 7804 7805 static inline struct cfg80211_bss * __must_check 7806 cfg80211_inform_bss_frame(struct wiphy *wiphy, 7807 struct ieee80211_channel *rx_channel, 7808 struct ieee80211_mgmt *mgmt, size_t len, 7809 s32 signal, gfp_t gfp) 7810 { 7811 struct cfg80211_inform_bss data = { 7812 .chan = rx_channel, 7813 .signal = signal, 7814 }; 7815 7816 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 7817 } 7818 7819 /** 7820 * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID 7821 * @bssid: transmitter BSSID 7822 * @max_bssid: max BSSID indicator, taken from Multiple BSSID element 7823 * @mbssid_index: BSSID index, taken from Multiple BSSID index element 7824 * @new_bssid: calculated nontransmitted BSSID 7825 */ 7826 static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid, 7827 u8 mbssid_index, u8 *new_bssid) 7828 { 7829 u64 bssid_u64 = ether_addr_to_u64(bssid); 7830 u64 mask = GENMASK_ULL(max_bssid - 1, 0); 7831 u64 new_bssid_u64; 7832 7833 new_bssid_u64 = bssid_u64 & ~mask; 7834 7835 new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask; 7836 7837 u64_to_ether_addr(new_bssid_u64, new_bssid); 7838 } 7839 7840 /** 7841 * cfg80211_is_element_inherited - returns if element ID should be inherited 7842 * @element: element to check 7843 * @non_inherit_element: non inheritance element 7844 * 7845 * Return: %true if should be inherited, %false otherwise 7846 */ 7847 bool cfg80211_is_element_inherited(const struct element *element, 7848 const struct element *non_inherit_element); 7849 7850 /** 7851 * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs 7852 * @ie: ies 7853 * @ielen: length of IEs 7854 * @mbssid_elem: current MBSSID element 7855 * @sub_elem: current MBSSID subelement (profile) 7856 * @merged_ie: location of the merged profile 7857 * @max_copy_len: max merged profile length 7858 * 7859 * Return: the number of bytes merged 7860 */ 7861 size_t cfg80211_merge_profile(const u8 *ie, size_t ielen, 7862 const struct element *mbssid_elem, 7863 const struct element *sub_elem, 7864 u8 *merged_ie, size_t max_copy_len); 7865 7866 /** 7867 * enum cfg80211_bss_frame_type - frame type that the BSS data came from 7868 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 7869 * from a beacon or probe response 7870 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 7871 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 7872 * @CFG80211_BSS_FTYPE_S1G_BEACON: data comes from an S1G beacon 7873 */ 7874 enum cfg80211_bss_frame_type { 7875 CFG80211_BSS_FTYPE_UNKNOWN, 7876 CFG80211_BSS_FTYPE_BEACON, 7877 CFG80211_BSS_FTYPE_PRESP, 7878 CFG80211_BSS_FTYPE_S1G_BEACON, 7879 }; 7880 7881 /** 7882 * cfg80211_get_ies_channel_number - returns the channel number from ies 7883 * @ie: IEs 7884 * @ielen: length of IEs 7885 * @band: enum nl80211_band of the channel 7886 * 7887 * Return: the channel number, or -1 if none could be determined. 7888 */ 7889 int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen, 7890 enum nl80211_band band); 7891 7892 /** 7893 * cfg80211_ssid_eq - compare two SSIDs 7894 * @a: first SSID 7895 * @b: second SSID 7896 * 7897 * Return: %true if SSIDs are equal, %false otherwise. 7898 */ 7899 static inline bool 7900 cfg80211_ssid_eq(struct cfg80211_ssid *a, struct cfg80211_ssid *b) 7901 { 7902 if (WARN_ON(!a || !b)) 7903 return false; 7904 if (a->ssid_len != b->ssid_len) 7905 return false; 7906 return memcmp(a->ssid, b->ssid, a->ssid_len) ? false : true; 7907 } 7908 7909 /** 7910 * cfg80211_inform_bss_data - inform cfg80211 of a new BSS 7911 * 7912 * @wiphy: the wiphy reporting the BSS 7913 * @data: the BSS metadata 7914 * @ftype: frame type (if known) 7915 * @bssid: the BSSID of the BSS 7916 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 7917 * @capability: the capability field sent by the peer 7918 * @beacon_interval: the beacon interval announced by the peer 7919 * @ie: additional IEs sent by the peer 7920 * @ielen: length of the additional IEs 7921 * @gfp: context flags 7922 * 7923 * This informs cfg80211 that BSS information was found and 7924 * the BSS should be updated/added. 7925 * 7926 * Return: A referenced struct, must be released with cfg80211_put_bss()! 7927 * Or %NULL on error. 7928 */ 7929 struct cfg80211_bss * __must_check 7930 cfg80211_inform_bss_data(struct wiphy *wiphy, 7931 struct cfg80211_inform_bss *data, 7932 enum cfg80211_bss_frame_type ftype, 7933 const u8 *bssid, u64 tsf, u16 capability, 7934 u16 beacon_interval, const u8 *ie, size_t ielen, 7935 gfp_t gfp); 7936 7937 static inline struct cfg80211_bss * __must_check 7938 cfg80211_inform_bss(struct wiphy *wiphy, 7939 struct ieee80211_channel *rx_channel, 7940 enum cfg80211_bss_frame_type ftype, 7941 const u8 *bssid, u64 tsf, u16 capability, 7942 u16 beacon_interval, const u8 *ie, size_t ielen, 7943 s32 signal, gfp_t gfp) 7944 { 7945 struct cfg80211_inform_bss data = { 7946 .chan = rx_channel, 7947 .signal = signal, 7948 }; 7949 7950 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 7951 capability, beacon_interval, ie, ielen, 7952 gfp); 7953 } 7954 7955 /** 7956 * __cfg80211_get_bss - get a BSS reference 7957 * @wiphy: the wiphy this BSS struct belongs to 7958 * @channel: the channel to search on (or %NULL) 7959 * @bssid: the desired BSSID (or %NULL) 7960 * @ssid: the desired SSID (or %NULL) 7961 * @ssid_len: length of the SSID (or 0) 7962 * @bss_type: type of BSS, see &enum ieee80211_bss_type 7963 * @privacy: privacy filter, see &enum ieee80211_privacy 7964 * @use_for: indicates which use is intended 7965 * 7966 * Return: Reference-counted BSS on success. %NULL on error. 7967 */ 7968 struct cfg80211_bss *__cfg80211_get_bss(struct wiphy *wiphy, 7969 struct ieee80211_channel *channel, 7970 const u8 *bssid, 7971 const u8 *ssid, size_t ssid_len, 7972 enum ieee80211_bss_type bss_type, 7973 enum ieee80211_privacy privacy, 7974 u32 use_for); 7975 7976 /** 7977 * cfg80211_get_bss - get a BSS reference 7978 * @wiphy: the wiphy this BSS struct belongs to 7979 * @channel: the channel to search on (or %NULL) 7980 * @bssid: the desired BSSID (or %NULL) 7981 * @ssid: the desired SSID (or %NULL) 7982 * @ssid_len: length of the SSID (or 0) 7983 * @bss_type: type of BSS, see &enum ieee80211_bss_type 7984 * @privacy: privacy filter, see &enum ieee80211_privacy 7985 * 7986 * This version implies regular usage, %NL80211_BSS_USE_FOR_NORMAL. 7987 * 7988 * Return: Reference-counted BSS on success. %NULL on error. 7989 */ 7990 static inline struct cfg80211_bss * 7991 cfg80211_get_bss(struct wiphy *wiphy, struct ieee80211_channel *channel, 7992 const u8 *bssid, const u8 *ssid, size_t ssid_len, 7993 enum ieee80211_bss_type bss_type, 7994 enum ieee80211_privacy privacy) 7995 { 7996 return __cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len, 7997 bss_type, privacy, 7998 NL80211_BSS_USE_FOR_NORMAL); 7999 } 8000 8001 static inline struct cfg80211_bss * 8002 cfg80211_get_ibss(struct wiphy *wiphy, 8003 struct ieee80211_channel *channel, 8004 const u8 *ssid, size_t ssid_len) 8005 { 8006 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 8007 IEEE80211_BSS_TYPE_IBSS, 8008 IEEE80211_PRIVACY_ANY); 8009 } 8010 8011 /** 8012 * cfg80211_ref_bss - reference BSS struct 8013 * @wiphy: the wiphy this BSS struct belongs to 8014 * @bss: the BSS struct to reference 8015 * 8016 * Increments the refcount of the given BSS struct. 8017 */ 8018 void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 8019 8020 /** 8021 * cfg80211_put_bss - unref BSS struct 8022 * @wiphy: the wiphy this BSS struct belongs to 8023 * @bss: the BSS struct 8024 * 8025 * Decrements the refcount of the given BSS struct. 8026 */ 8027 void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 8028 8029 /** 8030 * cfg80211_unlink_bss - unlink BSS from internal data structures 8031 * @wiphy: the wiphy 8032 * @bss: the bss to remove 8033 * 8034 * This function removes the given BSS from the internal data structures 8035 * thereby making it no longer show up in scan results etc. Use this 8036 * function when you detect a BSS is gone. Normally BSSes will also time 8037 * out, so it is not necessary to use this function at all. 8038 */ 8039 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 8040 8041 /** 8042 * cfg80211_bss_iter - iterate all BSS entries 8043 * 8044 * This function iterates over the BSS entries associated with the given wiphy 8045 * and calls the callback for the iterated BSS. The iterator function is not 8046 * allowed to call functions that might modify the internal state of the BSS DB. 8047 * 8048 * @wiphy: the wiphy 8049 * @chandef: if given, the iterator function will be called only if the channel 8050 * of the currently iterated BSS is a subset of the given channel. 8051 * @iter: the iterator function to call 8052 * @iter_data: an argument to the iterator function 8053 */ 8054 void cfg80211_bss_iter(struct wiphy *wiphy, 8055 struct cfg80211_chan_def *chandef, 8056 void (*iter)(struct wiphy *wiphy, 8057 struct cfg80211_bss *bss, 8058 void *data), 8059 void *iter_data); 8060 8061 /** 8062 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 8063 * @dev: network device 8064 * @buf: authentication frame (header + body) 8065 * @len: length of the frame data 8066 * 8067 * This function is called whenever an authentication, disassociation or 8068 * deauthentication frame has been received and processed in station mode. 8069 * After being asked to authenticate via cfg80211_ops::auth() the driver must 8070 * call either this function or cfg80211_auth_timeout(). 8071 * After being asked to associate via cfg80211_ops::assoc() the driver must 8072 * call either this function or cfg80211_auth_timeout(). 8073 * While connected, the driver must calls this for received and processed 8074 * disassociation and deauthentication frames. If the frame couldn't be used 8075 * because it was unprotected, the driver must call the function 8076 * cfg80211_rx_unprot_mlme_mgmt() instead. 8077 * 8078 * This function may sleep. The caller must hold the corresponding wdev's mutex. 8079 */ 8080 void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 8081 8082 /** 8083 * cfg80211_auth_timeout - notification of timed out authentication 8084 * @dev: network device 8085 * @addr: The MAC address of the device with which the authentication timed out 8086 * 8087 * This function may sleep. The caller must hold the corresponding wdev's 8088 * mutex. 8089 */ 8090 void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 8091 8092 /** 8093 * struct cfg80211_rx_assoc_resp_data - association response data 8094 * @buf: (Re)Association Response frame (header + body) 8095 * @len: length of the frame data 8096 * @uapsd_queues: bitmap of queues configured for uapsd. Same format 8097 * as the AC bitmap in the QoS info field 8098 * @req_ies: information elements from the (Re)Association Request frame 8099 * @req_ies_len: length of req_ies data 8100 * @ap_mld_addr: AP MLD address (in case of MLO) 8101 * @links: per-link information indexed by link ID, use links[0] for 8102 * non-MLO connections 8103 * @links.bss: the BSS that association was requested with, ownership of the 8104 * pointer moves to cfg80211 in the call to cfg80211_rx_assoc_resp() 8105 * @links.status: Set this (along with a BSS pointer) for links that 8106 * were rejected by the AP. 8107 */ 8108 struct cfg80211_rx_assoc_resp_data { 8109 const u8 *buf; 8110 size_t len; 8111 const u8 *req_ies; 8112 size_t req_ies_len; 8113 int uapsd_queues; 8114 const u8 *ap_mld_addr; 8115 struct { 8116 u8 addr[ETH_ALEN] __aligned(2); 8117 struct cfg80211_bss *bss; 8118 u16 status; 8119 } links[IEEE80211_MLD_MAX_NUM_LINKS]; 8120 }; 8121 8122 /** 8123 * cfg80211_rx_assoc_resp - notification of processed association response 8124 * @dev: network device 8125 * @data: association response data, &struct cfg80211_rx_assoc_resp_data 8126 * 8127 * After being asked to associate via cfg80211_ops::assoc() the driver must 8128 * call either this function or cfg80211_auth_timeout(). 8129 * 8130 * This function may sleep. The caller must hold the corresponding wdev's mutex. 8131 */ 8132 void cfg80211_rx_assoc_resp(struct net_device *dev, 8133 const struct cfg80211_rx_assoc_resp_data *data); 8134 8135 /** 8136 * struct cfg80211_assoc_failure - association failure data 8137 * @ap_mld_addr: AP MLD address, or %NULL 8138 * @bss: list of BSSes, must use entry 0 for non-MLO connections 8139 * (@ap_mld_addr is %NULL) 8140 * @timeout: indicates the association failed due to timeout, otherwise 8141 * the association was abandoned for a reason reported through some 8142 * other API (e.g. deauth RX) 8143 */ 8144 struct cfg80211_assoc_failure { 8145 const u8 *ap_mld_addr; 8146 struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS]; 8147 bool timeout; 8148 }; 8149 8150 /** 8151 * cfg80211_assoc_failure - notification of association failure 8152 * @dev: network device 8153 * @data: data describing the association failure 8154 * 8155 * This function may sleep. The caller must hold the corresponding wdev's mutex. 8156 */ 8157 void cfg80211_assoc_failure(struct net_device *dev, 8158 struct cfg80211_assoc_failure *data); 8159 8160 /** 8161 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 8162 * @dev: network device 8163 * @buf: 802.11 frame (header + body) 8164 * @len: length of the frame data 8165 * @reconnect: immediate reconnect is desired (include the nl80211 attribute) 8166 * 8167 * This function is called whenever deauthentication has been processed in 8168 * station mode. This includes both received deauthentication frames and 8169 * locally generated ones. This function may sleep. The caller must hold the 8170 * corresponding wdev's mutex. 8171 */ 8172 void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len, 8173 bool reconnect); 8174 8175 /** 8176 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 8177 * @dev: network device 8178 * @buf: received management frame (header + body) 8179 * @len: length of the frame data 8180 * 8181 * This function is called whenever a received deauthentication or dissassoc 8182 * frame has been dropped in station mode because of MFP being used but the 8183 * frame was not protected. This is also used to notify reception of a Beacon 8184 * frame that was dropped because it did not include a valid MME MIC while 8185 * beacon protection was enabled (BIGTK configured in station mode). 8186 * 8187 * This function may sleep. 8188 */ 8189 void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 8190 const u8 *buf, size_t len); 8191 8192 /** 8193 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 8194 * @dev: network device 8195 * @addr: The source MAC address of the frame 8196 * @key_type: The key type that the received frame used 8197 * @key_id: Key identifier (0..3). Can be -1 if missing. 8198 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 8199 * @gfp: allocation flags 8200 * 8201 * This function is called whenever the local MAC detects a MIC failure in a 8202 * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 8203 * primitive. 8204 */ 8205 void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 8206 enum nl80211_key_type key_type, int key_id, 8207 const u8 *tsc, gfp_t gfp); 8208 8209 /** 8210 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 8211 * 8212 * @dev: network device 8213 * @bssid: the BSSID of the IBSS joined 8214 * @channel: the channel of the IBSS joined 8215 * @gfp: allocation flags 8216 * 8217 * This function notifies cfg80211 that the device joined an IBSS or 8218 * switched to a different BSSID. Before this function can be called, 8219 * either a beacon has to have been received from the IBSS, or one of 8220 * the cfg80211_inform_bss{,_frame} functions must have been called 8221 * with the locally generated beacon -- this guarantees that there is 8222 * always a scan result for this IBSS. cfg80211 will handle the rest. 8223 */ 8224 void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 8225 struct ieee80211_channel *channel, gfp_t gfp); 8226 8227 /** 8228 * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer 8229 * candidate 8230 * 8231 * @dev: network device 8232 * @macaddr: the MAC address of the new candidate 8233 * @ie: information elements advertised by the peer candidate 8234 * @ie_len: length of the information elements buffer 8235 * @sig_dbm: signal level in dBm 8236 * @gfp: allocation flags 8237 * 8238 * This function notifies cfg80211 that the mesh peer candidate has been 8239 * detected, most likely via a beacon or, less likely, via a probe response. 8240 * cfg80211 then sends a notification to userspace. 8241 */ 8242 void cfg80211_notify_new_peer_candidate(struct net_device *dev, 8243 const u8 *macaddr, const u8 *ie, u8 ie_len, 8244 int sig_dbm, gfp_t gfp); 8245 8246 /** 8247 * DOC: RFkill integration 8248 * 8249 * RFkill integration in cfg80211 is almost invisible to drivers, 8250 * as cfg80211 automatically registers an rfkill instance for each 8251 * wireless device it knows about. Soft kill is also translated 8252 * into disconnecting and turning all interfaces off. Drivers are 8253 * expected to turn off the device when all interfaces are down. 8254 * 8255 * However, devices may have a hard RFkill line, in which case they 8256 * also need to interact with the rfkill subsystem, via cfg80211. 8257 * They can do this with a few helper functions documented here. 8258 */ 8259 8260 /** 8261 * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state 8262 * @wiphy: the wiphy 8263 * @blocked: block status 8264 * @reason: one of reasons in &enum rfkill_hard_block_reasons 8265 */ 8266 void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked, 8267 enum rfkill_hard_block_reasons reason); 8268 8269 static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked) 8270 { 8271 wiphy_rfkill_set_hw_state_reason(wiphy, blocked, 8272 RFKILL_HARD_BLOCK_SIGNAL); 8273 } 8274 8275 /** 8276 * wiphy_rfkill_start_polling - start polling rfkill 8277 * @wiphy: the wiphy 8278 */ 8279 void wiphy_rfkill_start_polling(struct wiphy *wiphy); 8280 8281 /** 8282 * wiphy_rfkill_stop_polling - stop polling rfkill 8283 * @wiphy: the wiphy 8284 */ 8285 static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy) 8286 { 8287 rfkill_pause_polling(wiphy->rfkill); 8288 } 8289 8290 /** 8291 * DOC: Vendor commands 8292 * 8293 * Occasionally, there are special protocol or firmware features that 8294 * can't be implemented very openly. For this and similar cases, the 8295 * vendor command functionality allows implementing the features with 8296 * (typically closed-source) userspace and firmware, using nl80211 as 8297 * the configuration mechanism. 8298 * 8299 * A driver supporting vendor commands must register them as an array 8300 * in struct wiphy, with handlers for each one. Each command has an 8301 * OUI and sub command ID to identify it. 8302 * 8303 * Note that this feature should not be (ab)used to implement protocol 8304 * features that could openly be shared across drivers. In particular, 8305 * it must never be required to use vendor commands to implement any 8306 * "normal" functionality that higher-level userspace like connection 8307 * managers etc. need. 8308 */ 8309 8310 struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 8311 enum nl80211_commands cmd, 8312 enum nl80211_attrs attr, 8313 int approxlen); 8314 8315 struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 8316 struct wireless_dev *wdev, 8317 enum nl80211_commands cmd, 8318 enum nl80211_attrs attr, 8319 unsigned int portid, 8320 int vendor_event_idx, 8321 int approxlen, gfp_t gfp); 8322 8323 void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 8324 8325 /** 8326 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 8327 * @wiphy: the wiphy 8328 * @approxlen: an upper bound of the length of the data that will 8329 * be put into the skb 8330 * 8331 * This function allocates and pre-fills an skb for a reply to 8332 * a vendor command. Since it is intended for a reply, calling 8333 * it outside of a vendor command's doit() operation is invalid. 8334 * 8335 * The returned skb is pre-filled with some identifying data in 8336 * a way that any data that is put into the skb (with skb_put(), 8337 * nla_put() or similar) will end up being within the 8338 * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 8339 * with the skb is adding data for the corresponding userspace tool 8340 * which can then read that data out of the vendor data attribute. 8341 * You must not modify the skb in any other way. 8342 * 8343 * When done, call cfg80211_vendor_cmd_reply() with the skb and return 8344 * its error code as the result of the doit() operation. 8345 * 8346 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 8347 */ 8348 static inline struct sk_buff * 8349 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 8350 { 8351 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 8352 NL80211_ATTR_VENDOR_DATA, approxlen); 8353 } 8354 8355 /** 8356 * cfg80211_vendor_cmd_reply - send the reply skb 8357 * @skb: The skb, must have been allocated with 8358 * cfg80211_vendor_cmd_alloc_reply_skb() 8359 * 8360 * Since calling this function will usually be the last thing 8361 * before returning from the vendor command doit() you should 8362 * return the error code. Note that this function consumes the 8363 * skb regardless of the return value. 8364 * 8365 * Return: An error code or 0 on success. 8366 */ 8367 int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 8368 8369 /** 8370 * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID 8371 * @wiphy: the wiphy 8372 * 8373 * Return: the current netlink port ID in a vendor command handler. 8374 * 8375 * Context: May only be called from a vendor command handler 8376 */ 8377 unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy); 8378 8379 /** 8380 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 8381 * @wiphy: the wiphy 8382 * @wdev: the wireless device 8383 * @event_idx: index of the vendor event in the wiphy's vendor_events 8384 * @approxlen: an upper bound of the length of the data that will 8385 * be put into the skb 8386 * @gfp: allocation flags 8387 * 8388 * This function allocates and pre-fills an skb for an event on the 8389 * vendor-specific multicast group. 8390 * 8391 * If wdev != NULL, both the ifindex and identifier of the specified 8392 * wireless device are added to the event message before the vendor data 8393 * attribute. 8394 * 8395 * When done filling the skb, call cfg80211_vendor_event() with the 8396 * skb to send the event. 8397 * 8398 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 8399 */ 8400 static inline struct sk_buff * 8401 cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev, 8402 int approxlen, int event_idx, gfp_t gfp) 8403 { 8404 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 8405 NL80211_ATTR_VENDOR_DATA, 8406 0, event_idx, approxlen, gfp); 8407 } 8408 8409 /** 8410 * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb 8411 * @wiphy: the wiphy 8412 * @wdev: the wireless device 8413 * @event_idx: index of the vendor event in the wiphy's vendor_events 8414 * @portid: port ID of the receiver 8415 * @approxlen: an upper bound of the length of the data that will 8416 * be put into the skb 8417 * @gfp: allocation flags 8418 * 8419 * This function allocates and pre-fills an skb for an event to send to 8420 * a specific (userland) socket. This socket would previously have been 8421 * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take 8422 * care to register a netlink notifier to see when the socket closes. 8423 * 8424 * If wdev != NULL, both the ifindex and identifier of the specified 8425 * wireless device are added to the event message before the vendor data 8426 * attribute. 8427 * 8428 * When done filling the skb, call cfg80211_vendor_event() with the 8429 * skb to send the event. 8430 * 8431 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 8432 */ 8433 static inline struct sk_buff * 8434 cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy, 8435 struct wireless_dev *wdev, 8436 unsigned int portid, int approxlen, 8437 int event_idx, gfp_t gfp) 8438 { 8439 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 8440 NL80211_ATTR_VENDOR_DATA, 8441 portid, event_idx, approxlen, gfp); 8442 } 8443 8444 /** 8445 * cfg80211_vendor_event - send the event 8446 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 8447 * @gfp: allocation flags 8448 * 8449 * This function sends the given @skb, which must have been allocated 8450 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 8451 */ 8452 static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 8453 { 8454 __cfg80211_send_event_skb(skb, gfp); 8455 } 8456 8457 #ifdef CONFIG_NL80211_TESTMODE 8458 /** 8459 * DOC: Test mode 8460 * 8461 * Test mode is a set of utility functions to allow drivers to 8462 * interact with driver-specific tools to aid, for instance, 8463 * factory programming. 8464 * 8465 * This chapter describes how drivers interact with it. For more 8466 * information see the nl80211 book's chapter on it. 8467 */ 8468 8469 /** 8470 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 8471 * @wiphy: the wiphy 8472 * @approxlen: an upper bound of the length of the data that will 8473 * be put into the skb 8474 * 8475 * This function allocates and pre-fills an skb for a reply to 8476 * the testmode command. Since it is intended for a reply, calling 8477 * it outside of the @testmode_cmd operation is invalid. 8478 * 8479 * The returned skb is pre-filled with the wiphy index and set up in 8480 * a way that any data that is put into the skb (with skb_put(), 8481 * nla_put() or similar) will end up being within the 8482 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 8483 * with the skb is adding data for the corresponding userspace tool 8484 * which can then read that data out of the testdata attribute. You 8485 * must not modify the skb in any other way. 8486 * 8487 * When done, call cfg80211_testmode_reply() with the skb and return 8488 * its error code as the result of the @testmode_cmd operation. 8489 * 8490 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 8491 */ 8492 static inline struct sk_buff * 8493 cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 8494 { 8495 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 8496 NL80211_ATTR_TESTDATA, approxlen); 8497 } 8498 8499 /** 8500 * cfg80211_testmode_reply - send the reply skb 8501 * @skb: The skb, must have been allocated with 8502 * cfg80211_testmode_alloc_reply_skb() 8503 * 8504 * Since calling this function will usually be the last thing 8505 * before returning from the @testmode_cmd you should return 8506 * the error code. Note that this function consumes the skb 8507 * regardless of the return value. 8508 * 8509 * Return: An error code or 0 on success. 8510 */ 8511 static inline int cfg80211_testmode_reply(struct sk_buff *skb) 8512 { 8513 return cfg80211_vendor_cmd_reply(skb); 8514 } 8515 8516 /** 8517 * cfg80211_testmode_alloc_event_skb - allocate testmode event 8518 * @wiphy: the wiphy 8519 * @approxlen: an upper bound of the length of the data that will 8520 * be put into the skb 8521 * @gfp: allocation flags 8522 * 8523 * This function allocates and pre-fills an skb for an event on the 8524 * testmode multicast group. 8525 * 8526 * The returned skb is set up in the same way as with 8527 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 8528 * there, you should simply add data to it that will then end up in the 8529 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 8530 * in any other way. 8531 * 8532 * When done filling the skb, call cfg80211_testmode_event() with the 8533 * skb to send the event. 8534 * 8535 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 8536 */ 8537 static inline struct sk_buff * 8538 cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 8539 { 8540 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE, 8541 NL80211_ATTR_TESTDATA, 0, -1, 8542 approxlen, gfp); 8543 } 8544 8545 /** 8546 * cfg80211_testmode_event - send the event 8547 * @skb: The skb, must have been allocated with 8548 * cfg80211_testmode_alloc_event_skb() 8549 * @gfp: allocation flags 8550 * 8551 * This function sends the given @skb, which must have been allocated 8552 * by cfg80211_testmode_alloc_event_skb(), as an event. It always 8553 * consumes it. 8554 */ 8555 static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 8556 { 8557 __cfg80211_send_event_skb(skb, gfp); 8558 } 8559 8560 #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 8561 #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 8562 #else 8563 #define CFG80211_TESTMODE_CMD(cmd) 8564 #define CFG80211_TESTMODE_DUMP(cmd) 8565 #endif 8566 8567 /** 8568 * struct cfg80211_fils_resp_params - FILS connection response params 8569 * @kek: KEK derived from a successful FILS connection (may be %NULL) 8570 * @kek_len: Length of @fils_kek in octets 8571 * @update_erp_next_seq_num: Boolean value to specify whether the value in 8572 * @erp_next_seq_num is valid. 8573 * @erp_next_seq_num: The next sequence number to use in ERP message in 8574 * FILS Authentication. This value should be specified irrespective of the 8575 * status for a FILS connection. 8576 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL). 8577 * @pmk_len: Length of @pmk in octets 8578 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID 8579 * used for this FILS connection (may be %NULL). 8580 */ 8581 struct cfg80211_fils_resp_params { 8582 const u8 *kek; 8583 size_t kek_len; 8584 bool update_erp_next_seq_num; 8585 u16 erp_next_seq_num; 8586 const u8 *pmk; 8587 size_t pmk_len; 8588 const u8 *pmkid; 8589 }; 8590 8591 /** 8592 * struct cfg80211_connect_resp_params - Connection response params 8593 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use 8594 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 8595 * the real status code for failures. If this call is used to report a 8596 * failure due to a timeout (e.g., not receiving an Authentication frame 8597 * from the AP) instead of an explicit rejection by the AP, -1 is used to 8598 * indicate that this is a failure, but without a status code. 8599 * @timeout_reason is used to report the reason for the timeout in that 8600 * case. 8601 * @req_ie: Association request IEs (may be %NULL) 8602 * @req_ie_len: Association request IEs length 8603 * @resp_ie: Association response IEs (may be %NULL) 8604 * @resp_ie_len: Association response IEs length 8605 * @fils: FILS connection response parameters. 8606 * @timeout_reason: Reason for connection timeout. This is used when the 8607 * connection fails due to a timeout instead of an explicit rejection from 8608 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 8609 * not known. This value is used only if @status < 0 to indicate that the 8610 * failure is due to a timeout and not due to explicit rejection by the AP. 8611 * This value is ignored in other cases (@status >= 0). 8612 * @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise 8613 * zero. 8614 * @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL. 8615 * @links : For MLO connection, contains link info for the valid links indicated 8616 * using @valid_links. For non-MLO connection, links[0] contains the 8617 * connected AP info. 8618 * @links.addr: For MLO connection, MAC address of the STA link. Otherwise 8619 * %NULL. 8620 * @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO 8621 * connection, links[0].bssid points to the BSSID of the AP (may be %NULL). 8622 * @links.bss: For MLO connection, entry of bss to which STA link is connected. 8623 * For non-MLO connection, links[0].bss points to entry of bss to which STA 8624 * is connected. It can be obtained through cfg80211_get_bss() (may be 8625 * %NULL). It is recommended to store the bss from the connect_request and 8626 * hold a reference to it and return through this param to avoid a warning 8627 * if the bss is expired during the connection, esp. for those drivers 8628 * implementing connect op. Only one parameter among @bssid and @bss needs 8629 * to be specified. 8630 * @links.status: per-link status code, to report a status code that's not 8631 * %WLAN_STATUS_SUCCESS for a given link, it must also be in the 8632 * @valid_links bitmap and may have a BSS pointer (which is then released) 8633 */ 8634 struct cfg80211_connect_resp_params { 8635 int status; 8636 const u8 *req_ie; 8637 size_t req_ie_len; 8638 const u8 *resp_ie; 8639 size_t resp_ie_len; 8640 struct cfg80211_fils_resp_params fils; 8641 enum nl80211_timeout_reason timeout_reason; 8642 8643 const u8 *ap_mld_addr; 8644 u16 valid_links; 8645 struct { 8646 const u8 *addr; 8647 const u8 *bssid; 8648 struct cfg80211_bss *bss; 8649 u16 status; 8650 } links[IEEE80211_MLD_MAX_NUM_LINKS]; 8651 }; 8652 8653 /** 8654 * cfg80211_connect_done - notify cfg80211 of connection result 8655 * 8656 * @dev: network device 8657 * @params: connection response parameters 8658 * @gfp: allocation flags 8659 * 8660 * It should be called by the underlying driver once execution of the connection 8661 * request from connect() has been completed. This is similar to 8662 * cfg80211_connect_bss(), but takes a structure pointer for connection response 8663 * parameters. Only one of the functions among cfg80211_connect_bss(), 8664 * cfg80211_connect_result(), cfg80211_connect_timeout(), 8665 * and cfg80211_connect_done() should be called. 8666 */ 8667 void cfg80211_connect_done(struct net_device *dev, 8668 struct cfg80211_connect_resp_params *params, 8669 gfp_t gfp); 8670 8671 /** 8672 * cfg80211_connect_bss - notify cfg80211 of connection result 8673 * 8674 * @dev: network device 8675 * @bssid: the BSSID of the AP 8676 * @bss: Entry of bss to which STA got connected to, can be obtained through 8677 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the 8678 * bss from the connect_request and hold a reference to it and return 8679 * through this param to avoid a warning if the bss is expired during the 8680 * connection, esp. for those drivers implementing connect op. 8681 * Only one parameter among @bssid and @bss needs to be specified. 8682 * @req_ie: association request IEs (maybe be %NULL) 8683 * @req_ie_len: association request IEs length 8684 * @resp_ie: association response IEs (may be %NULL) 8685 * @resp_ie_len: assoc response IEs length 8686 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 8687 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 8688 * the real status code for failures. If this call is used to report a 8689 * failure due to a timeout (e.g., not receiving an Authentication frame 8690 * from the AP) instead of an explicit rejection by the AP, -1 is used to 8691 * indicate that this is a failure, but without a status code. 8692 * @timeout_reason is used to report the reason for the timeout in that 8693 * case. 8694 * @gfp: allocation flags 8695 * @timeout_reason: reason for connection timeout. This is used when the 8696 * connection fails due to a timeout instead of an explicit rejection from 8697 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 8698 * not known. This value is used only if @status < 0 to indicate that the 8699 * failure is due to a timeout and not due to explicit rejection by the AP. 8700 * This value is ignored in other cases (@status >= 0). 8701 * 8702 * It should be called by the underlying driver once execution of the connection 8703 * request from connect() has been completed. This is similar to 8704 * cfg80211_connect_result(), but with the option of identifying the exact bss 8705 * entry for the connection. Only one of the functions among 8706 * cfg80211_connect_bss(), cfg80211_connect_result(), 8707 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 8708 */ 8709 static inline void 8710 cfg80211_connect_bss(struct net_device *dev, const u8 *bssid, 8711 struct cfg80211_bss *bss, const u8 *req_ie, 8712 size_t req_ie_len, const u8 *resp_ie, 8713 size_t resp_ie_len, int status, gfp_t gfp, 8714 enum nl80211_timeout_reason timeout_reason) 8715 { 8716 struct cfg80211_connect_resp_params params; 8717 8718 memset(¶ms, 0, sizeof(params)); 8719 params.status = status; 8720 params.links[0].bssid = bssid; 8721 params.links[0].bss = bss; 8722 params.req_ie = req_ie; 8723 params.req_ie_len = req_ie_len; 8724 params.resp_ie = resp_ie; 8725 params.resp_ie_len = resp_ie_len; 8726 params.timeout_reason = timeout_reason; 8727 8728 cfg80211_connect_done(dev, ¶ms, gfp); 8729 } 8730 8731 /** 8732 * cfg80211_connect_result - notify cfg80211 of connection result 8733 * 8734 * @dev: network device 8735 * @bssid: the BSSID of the AP 8736 * @req_ie: association request IEs (maybe be %NULL) 8737 * @req_ie_len: association request IEs length 8738 * @resp_ie: association response IEs (may be %NULL) 8739 * @resp_ie_len: assoc response IEs length 8740 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 8741 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 8742 * the real status code for failures. 8743 * @gfp: allocation flags 8744 * 8745 * It should be called by the underlying driver once execution of the connection 8746 * request from connect() has been completed. This is similar to 8747 * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only 8748 * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(), 8749 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 8750 */ 8751 static inline void 8752 cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 8753 const u8 *req_ie, size_t req_ie_len, 8754 const u8 *resp_ie, size_t resp_ie_len, 8755 u16 status, gfp_t gfp) 8756 { 8757 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie, 8758 resp_ie_len, status, gfp, 8759 NL80211_TIMEOUT_UNSPECIFIED); 8760 } 8761 8762 /** 8763 * cfg80211_connect_timeout - notify cfg80211 of connection timeout 8764 * 8765 * @dev: network device 8766 * @bssid: the BSSID of the AP 8767 * @req_ie: association request IEs (maybe be %NULL) 8768 * @req_ie_len: association request IEs length 8769 * @gfp: allocation flags 8770 * @timeout_reason: reason for connection timeout. 8771 * 8772 * It should be called by the underlying driver whenever connect() has failed 8773 * in a sequence where no explicit authentication/association rejection was 8774 * received from the AP. This could happen, e.g., due to not being able to send 8775 * out the Authentication or Association Request frame or timing out while 8776 * waiting for the response. Only one of the functions among 8777 * cfg80211_connect_bss(), cfg80211_connect_result(), 8778 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 8779 */ 8780 static inline void 8781 cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, 8782 const u8 *req_ie, size_t req_ie_len, gfp_t gfp, 8783 enum nl80211_timeout_reason timeout_reason) 8784 { 8785 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1, 8786 gfp, timeout_reason); 8787 } 8788 8789 /** 8790 * struct cfg80211_roam_info - driver initiated roaming information 8791 * 8792 * @req_ie: association request IEs (maybe be %NULL) 8793 * @req_ie_len: association request IEs length 8794 * @resp_ie: association response IEs (may be %NULL) 8795 * @resp_ie_len: assoc response IEs length 8796 * @fils: FILS related roaming information. 8797 * @valid_links: For MLO roaming, BIT mask of the new valid links is set. 8798 * Otherwise zero. 8799 * @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL. 8800 * @links : For MLO roaming, contains new link info for the valid links set in 8801 * @valid_links. For non-MLO roaming, links[0] contains the new AP info. 8802 * @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL. 8803 * @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO 8804 * roaming, links[0].bssid points to the BSSID of the new AP. May be 8805 * %NULL if %links.bss is set. 8806 * @links.channel: the channel of the new AP. 8807 * @links.bss: For MLO roaming, entry of new bss to which STA link got 8808 * roamed. For non-MLO roaming, links[0].bss points to entry of bss to 8809 * which STA got roamed (may be %NULL if %links.bssid is set) 8810 */ 8811 struct cfg80211_roam_info { 8812 const u8 *req_ie; 8813 size_t req_ie_len; 8814 const u8 *resp_ie; 8815 size_t resp_ie_len; 8816 struct cfg80211_fils_resp_params fils; 8817 8818 const u8 *ap_mld_addr; 8819 u16 valid_links; 8820 struct { 8821 const u8 *addr; 8822 const u8 *bssid; 8823 struct ieee80211_channel *channel; 8824 struct cfg80211_bss *bss; 8825 } links[IEEE80211_MLD_MAX_NUM_LINKS]; 8826 }; 8827 8828 /** 8829 * cfg80211_roamed - notify cfg80211 of roaming 8830 * 8831 * @dev: network device 8832 * @info: information about the new BSS. struct &cfg80211_roam_info. 8833 * @gfp: allocation flags 8834 * 8835 * This function may be called with the driver passing either the BSSID of the 8836 * new AP or passing the bss entry to avoid a race in timeout of the bss entry. 8837 * It should be called by the underlying driver whenever it roamed from one AP 8838 * to another while connected. Drivers which have roaming implemented in 8839 * firmware should pass the bss entry to avoid a race in bss entry timeout where 8840 * the bss entry of the new AP is seen in the driver, but gets timed out by the 8841 * time it is accessed in __cfg80211_roamed() due to delay in scheduling 8842 * rdev->event_work. In case of any failures, the reference is released 8843 * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be 8844 * released while disconnecting from the current bss. 8845 */ 8846 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, 8847 gfp_t gfp); 8848 8849 /** 8850 * cfg80211_port_authorized - notify cfg80211 of successful security association 8851 * 8852 * @dev: network device 8853 * @peer_addr: BSSID of the AP/P2P GO in case of STA/GC or STA/GC MAC address 8854 * in case of AP/P2P GO 8855 * @td_bitmap: transition disable policy 8856 * @td_bitmap_len: Length of transition disable policy 8857 * @gfp: allocation flags 8858 * 8859 * This function should be called by a driver that supports 4 way handshake 8860 * offload after a security association was successfully established (i.e., 8861 * the 4 way handshake was completed successfully). The call to this function 8862 * should be preceded with a call to cfg80211_connect_result(), 8863 * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to 8864 * indicate the 802.11 association. 8865 * This function can also be called by AP/P2P GO driver that supports 8866 * authentication offload. In this case the peer_mac passed is that of 8867 * associated STA/GC. 8868 */ 8869 void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_addr, 8870 const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp); 8871 8872 /** 8873 * cfg80211_disconnected - notify cfg80211 that connection was dropped 8874 * 8875 * @dev: network device 8876 * @ie: information elements of the deauth/disassoc frame (may be %NULL) 8877 * @ie_len: length of IEs 8878 * @reason: reason code for the disconnection, set it to 0 if unknown 8879 * @locally_generated: disconnection was requested locally 8880 * @gfp: allocation flags 8881 * 8882 * After it calls this function, the driver should enter an idle state 8883 * and not try to connect to any AP any more. 8884 */ 8885 void cfg80211_disconnected(struct net_device *dev, u16 reason, 8886 const u8 *ie, size_t ie_len, 8887 bool locally_generated, gfp_t gfp); 8888 8889 /** 8890 * cfg80211_ready_on_channel - notification of remain_on_channel start 8891 * @wdev: wireless device 8892 * @cookie: the request cookie 8893 * @chan: The current channel (from remain_on_channel request) 8894 * @duration: Duration in milliseconds that the driver intents to remain on the 8895 * channel 8896 * @gfp: allocation flags 8897 */ 8898 void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 8899 struct ieee80211_channel *chan, 8900 unsigned int duration, gfp_t gfp); 8901 8902 /** 8903 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 8904 * @wdev: wireless device 8905 * @cookie: the request cookie 8906 * @chan: The current channel (from remain_on_channel request) 8907 * @gfp: allocation flags 8908 */ 8909 void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 8910 struct ieee80211_channel *chan, 8911 gfp_t gfp); 8912 8913 /** 8914 * cfg80211_tx_mgmt_expired - tx_mgmt duration expired 8915 * @wdev: wireless device 8916 * @cookie: the requested cookie 8917 * @chan: The current channel (from tx_mgmt request) 8918 * @gfp: allocation flags 8919 */ 8920 void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie, 8921 struct ieee80211_channel *chan, gfp_t gfp); 8922 8923 /** 8924 * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics. 8925 * 8926 * @sinfo: the station information 8927 * @gfp: allocation flags 8928 * 8929 * Return: 0 on success. Non-zero on error. 8930 */ 8931 int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp); 8932 8933 /** 8934 * cfg80211_link_sinfo_alloc_tid_stats - allocate per-tid statistics. 8935 * 8936 * @link_sinfo: the link station information 8937 * @gfp: allocation flags 8938 * 8939 * Return: 0 on success. Non-zero on error. 8940 */ 8941 int cfg80211_link_sinfo_alloc_tid_stats(struct link_station_info *link_sinfo, 8942 gfp_t gfp); 8943 8944 /** 8945 * cfg80211_sinfo_release_content - release contents of station info 8946 * @sinfo: the station information 8947 * 8948 * Releases any potentially allocated sub-information of the station 8949 * information, but not the struct itself (since it's typically on 8950 * the stack.) 8951 */ 8952 static inline void cfg80211_sinfo_release_content(struct station_info *sinfo) 8953 { 8954 kfree(sinfo->pertid); 8955 8956 for (int link_id = 0; link_id < ARRAY_SIZE(sinfo->links); link_id++) { 8957 if (sinfo->links[link_id]) { 8958 kfree(sinfo->links[link_id]->pertid); 8959 kfree(sinfo->links[link_id]); 8960 } 8961 } 8962 } 8963 8964 /** 8965 * cfg80211_new_sta - notify userspace about station 8966 * 8967 * @wdev: the wireless device 8968 * @mac_addr: the station's address 8969 * @sinfo: the station information 8970 * @gfp: allocation flags 8971 */ 8972 void cfg80211_new_sta(struct wireless_dev *wdev, const u8 *mac_addr, 8973 struct station_info *sinfo, gfp_t gfp); 8974 8975 /** 8976 * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 8977 * @wdev: the wireless device 8978 * @mac_addr: the station's address. For MLD station, MLD address is used. 8979 * @sinfo: the station information/statistics 8980 * @gfp: allocation flags 8981 */ 8982 void cfg80211_del_sta_sinfo(struct wireless_dev *wdev, const u8 *mac_addr, 8983 struct station_info *sinfo, gfp_t gfp); 8984 8985 /** 8986 * cfg80211_del_sta - notify userspace about deletion of a station 8987 * 8988 * @wdev: the wireless device 8989 * @mac_addr: the station's address. For MLD station, MLD address is used. 8990 * @gfp: allocation flags 8991 */ 8992 static inline void cfg80211_del_sta(struct wireless_dev *wdev, 8993 const u8 *mac_addr, gfp_t gfp) 8994 { 8995 cfg80211_del_sta_sinfo(wdev, mac_addr, NULL, gfp); 8996 } 8997 8998 /** 8999 * cfg80211_conn_failed - connection request failed notification 9000 * 9001 * @dev: the netdev 9002 * @mac_addr: the station's address 9003 * @reason: the reason for connection failure 9004 * @gfp: allocation flags 9005 * 9006 * Whenever a station tries to connect to an AP and if the station 9007 * could not connect to the AP as the AP has rejected the connection 9008 * for some reasons, this function is called. 9009 * 9010 * The reason for connection failure can be any of the value from 9011 * nl80211_connect_failed_reason enum 9012 */ 9013 void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 9014 enum nl80211_connect_failed_reason reason, 9015 gfp_t gfp); 9016 9017 /** 9018 * struct cfg80211_rx_info - received management frame info 9019 * 9020 * @freq: Frequency on which the frame was received in kHz 9021 * @sig_dbm: signal strength in dBm, or 0 if unknown 9022 * @have_link_id: indicates the frame was received on a link of 9023 * an MLD, i.e. the @link_id field is valid 9024 * @link_id: the ID of the link the frame was received on 9025 * @buf: Management frame (header + body) 9026 * @len: length of the frame data 9027 * @flags: flags, as defined in &enum nl80211_rxmgmt_flags 9028 * @rx_tstamp: Hardware timestamp of frame RX in nanoseconds 9029 * @ack_tstamp: Hardware timestamp of ack TX in nanoseconds 9030 */ 9031 struct cfg80211_rx_info { 9032 int freq; 9033 int sig_dbm; 9034 bool have_link_id; 9035 u8 link_id; 9036 const u8 *buf; 9037 size_t len; 9038 u32 flags; 9039 u64 rx_tstamp; 9040 u64 ack_tstamp; 9041 }; 9042 9043 /** 9044 * cfg80211_rx_mgmt_ext - management frame notification with extended info 9045 * @wdev: wireless device receiving the frame 9046 * @info: RX info as defined in struct cfg80211_rx_info 9047 * 9048 * This function is called whenever an Action frame is received for a station 9049 * mode interface, but is not processed in kernel. 9050 * 9051 * Return: %true if a user space application has registered for this frame. 9052 * For action frames, that makes it responsible for rejecting unrecognized 9053 * action frames; %false otherwise, in which case for action frames the 9054 * driver is responsible for rejecting the frame. 9055 */ 9056 bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev, 9057 struct cfg80211_rx_info *info); 9058 9059 /** 9060 * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame 9061 * @wdev: wireless device receiving the frame 9062 * @freq: Frequency on which the frame was received in KHz 9063 * @sig_dbm: signal strength in dBm, or 0 if unknown 9064 * @buf: Management frame (header + body) 9065 * @len: length of the frame data 9066 * @flags: flags, as defined in enum nl80211_rxmgmt_flags 9067 * 9068 * This function is called whenever an Action frame is received for a station 9069 * mode interface, but is not processed in kernel. 9070 * 9071 * Return: %true if a user space application has registered for this frame. 9072 * For action frames, that makes it responsible for rejecting unrecognized 9073 * action frames; %false otherwise, in which case for action frames the 9074 * driver is responsible for rejecting the frame. 9075 */ 9076 static inline bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, 9077 int sig_dbm, const u8 *buf, size_t len, 9078 u32 flags) 9079 { 9080 struct cfg80211_rx_info info = { 9081 .freq = freq, 9082 .sig_dbm = sig_dbm, 9083 .buf = buf, 9084 .len = len, 9085 .flags = flags 9086 }; 9087 9088 return cfg80211_rx_mgmt_ext(wdev, &info); 9089 } 9090 9091 /** 9092 * cfg80211_rx_mgmt - notification of received, unprocessed management frame 9093 * @wdev: wireless device receiving the frame 9094 * @freq: Frequency on which the frame was received in MHz 9095 * @sig_dbm: signal strength in dBm, or 0 if unknown 9096 * @buf: Management frame (header + body) 9097 * @len: length of the frame data 9098 * @flags: flags, as defined in enum nl80211_rxmgmt_flags 9099 * 9100 * This function is called whenever an Action frame is received for a station 9101 * mode interface, but is not processed in kernel. 9102 * 9103 * Return: %true if a user space application has registered for this frame. 9104 * For action frames, that makes it responsible for rejecting unrecognized 9105 * action frames; %false otherwise, in which case for action frames the 9106 * driver is responsible for rejecting the frame. 9107 */ 9108 static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, 9109 int sig_dbm, const u8 *buf, size_t len, 9110 u32 flags) 9111 { 9112 struct cfg80211_rx_info info = { 9113 .freq = MHZ_TO_KHZ(freq), 9114 .sig_dbm = sig_dbm, 9115 .buf = buf, 9116 .len = len, 9117 .flags = flags 9118 }; 9119 9120 return cfg80211_rx_mgmt_ext(wdev, &info); 9121 } 9122 9123 /** 9124 * struct cfg80211_tx_status - TX status for management frame information 9125 * 9126 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 9127 * @tx_tstamp: hardware TX timestamp in nanoseconds 9128 * @ack_tstamp: hardware ack RX timestamp in nanoseconds 9129 * @buf: Management frame (header + body) 9130 * @len: length of the frame data 9131 * @ack: Whether frame was acknowledged 9132 */ 9133 struct cfg80211_tx_status { 9134 u64 cookie; 9135 u64 tx_tstamp; 9136 u64 ack_tstamp; 9137 const u8 *buf; 9138 size_t len; 9139 bool ack; 9140 }; 9141 9142 /** 9143 * cfg80211_mgmt_tx_status_ext - TX status notification with extended info 9144 * @wdev: wireless device receiving the frame 9145 * @status: TX status data 9146 * @gfp: context flags 9147 * 9148 * This function is called whenever a management frame was requested to be 9149 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 9150 * transmission attempt with extended info. 9151 */ 9152 void cfg80211_mgmt_tx_status_ext(struct wireless_dev *wdev, 9153 struct cfg80211_tx_status *status, gfp_t gfp); 9154 9155 /** 9156 * cfg80211_mgmt_tx_status - notification of TX status for management frame 9157 * @wdev: wireless device receiving the frame 9158 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 9159 * @buf: Management frame (header + body) 9160 * @len: length of the frame data 9161 * @ack: Whether frame was acknowledged 9162 * @gfp: context flags 9163 * 9164 * This function is called whenever a management frame was requested to be 9165 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 9166 * transmission attempt. 9167 */ 9168 static inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, 9169 u64 cookie, const u8 *buf, 9170 size_t len, bool ack, gfp_t gfp) 9171 { 9172 struct cfg80211_tx_status status = { 9173 .cookie = cookie, 9174 .buf = buf, 9175 .len = len, 9176 .ack = ack 9177 }; 9178 9179 cfg80211_mgmt_tx_status_ext(wdev, &status, gfp); 9180 } 9181 9182 /** 9183 * cfg80211_control_port_tx_status - notification of TX status for control 9184 * port frames 9185 * @wdev: wireless device receiving the frame 9186 * @cookie: Cookie returned by cfg80211_ops::tx_control_port() 9187 * @buf: Data frame (header + body) 9188 * @len: length of the frame data 9189 * @ack: Whether frame was acknowledged 9190 * @gfp: context flags 9191 * 9192 * This function is called whenever a control port frame was requested to be 9193 * transmitted with cfg80211_ops::tx_control_port() to report the TX status of 9194 * the transmission attempt. 9195 */ 9196 void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie, 9197 const u8 *buf, size_t len, bool ack, 9198 gfp_t gfp); 9199 9200 /** 9201 * cfg80211_rx_control_port - notification about a received control port frame 9202 * @dev: The device the frame matched to 9203 * @skb: The skbuf with the control port frame. It is assumed that the skbuf 9204 * is 802.3 formatted (with 802.3 header). The skb can be non-linear. 9205 * This function does not take ownership of the skb, so the caller is 9206 * responsible for any cleanup. The caller must also ensure that 9207 * skb->protocol is set appropriately. 9208 * @unencrypted: Whether the frame was received unencrypted 9209 * @link_id: the link the frame was received on, -1 if not applicable or unknown 9210 * 9211 * This function is used to inform userspace about a received control port 9212 * frame. It should only be used if userspace indicated it wants to receive 9213 * control port frames over nl80211. 9214 * 9215 * The frame is the data portion of the 802.3 or 802.11 data frame with all 9216 * network layer headers removed (e.g. the raw EAPoL frame). 9217 * 9218 * Return: %true if the frame was passed to userspace 9219 */ 9220 bool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb, 9221 bool unencrypted, int link_id); 9222 9223 /** 9224 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 9225 * @dev: network device 9226 * @rssi_event: the triggered RSSI event 9227 * @rssi_level: new RSSI level value or 0 if not available 9228 * @gfp: context flags 9229 * 9230 * This function is called when a configured connection quality monitoring 9231 * rssi threshold reached event occurs. 9232 */ 9233 void cfg80211_cqm_rssi_notify(struct net_device *dev, 9234 enum nl80211_cqm_rssi_threshold_event rssi_event, 9235 s32 rssi_level, gfp_t gfp); 9236 9237 /** 9238 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 9239 * @dev: network device 9240 * @peer: peer's MAC address 9241 * @num_packets: how many packets were lost -- should be a fixed threshold 9242 * but probably no less than maybe 50, or maybe a throughput dependent 9243 * threshold (to account for temporary interference) 9244 * @gfp: context flags 9245 */ 9246 void cfg80211_cqm_pktloss_notify(struct net_device *dev, 9247 const u8 *peer, u32 num_packets, gfp_t gfp); 9248 9249 /** 9250 * cfg80211_cqm_txe_notify - TX error rate event 9251 * @dev: network device 9252 * @peer: peer's MAC address 9253 * @num_packets: how many packets were lost 9254 * @rate: % of packets which failed transmission 9255 * @intvl: interval (in s) over which the TX failure threshold was breached. 9256 * @gfp: context flags 9257 * 9258 * Notify userspace when configured % TX failures over number of packets in a 9259 * given interval is exceeded. 9260 */ 9261 void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 9262 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 9263 9264 /** 9265 * cfg80211_cqm_beacon_loss_notify - beacon loss event 9266 * @dev: network device 9267 * @gfp: context flags 9268 * 9269 * Notify userspace about beacon loss from the connected AP. 9270 */ 9271 void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 9272 9273 /** 9274 * __cfg80211_radar_event - radar detection event 9275 * @wiphy: the wiphy 9276 * @chandef: chandef for the current channel 9277 * @offchan: the radar has been detected on the offchannel chain 9278 * @gfp: context flags 9279 * 9280 * This function is called when a radar is detected on the current chanenl. 9281 */ 9282 void __cfg80211_radar_event(struct wiphy *wiphy, 9283 struct cfg80211_chan_def *chandef, 9284 bool offchan, gfp_t gfp); 9285 9286 static inline void 9287 cfg80211_radar_event(struct wiphy *wiphy, 9288 struct cfg80211_chan_def *chandef, 9289 gfp_t gfp) 9290 { 9291 __cfg80211_radar_event(wiphy, chandef, false, gfp); 9292 } 9293 9294 static inline void 9295 cfg80211_background_radar_event(struct wiphy *wiphy, 9296 struct cfg80211_chan_def *chandef, 9297 gfp_t gfp) 9298 { 9299 __cfg80211_radar_event(wiphy, chandef, true, gfp); 9300 } 9301 9302 /** 9303 * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event 9304 * @dev: network device 9305 * @mac: MAC address of a station which opmode got modified 9306 * @sta_opmode: station's current opmode value 9307 * @gfp: context flags 9308 * 9309 * Driver should call this function when station's opmode modified via action 9310 * frame. 9311 */ 9312 void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac, 9313 struct sta_opmode_info *sta_opmode, 9314 gfp_t gfp); 9315 9316 /** 9317 * cfg80211_cac_event - Channel availability check (CAC) event 9318 * @netdev: network device 9319 * @chandef: chandef for the current channel 9320 * @event: type of event 9321 * @gfp: context flags 9322 * @link_id: valid link_id for MLO operation or 0 otherwise. 9323 * 9324 * This function is called when a Channel availability check (CAC) is finished 9325 * or aborted. This must be called to notify the completion of a CAC process, 9326 * also by full-MAC drivers. 9327 */ 9328 void cfg80211_cac_event(struct net_device *netdev, 9329 const struct cfg80211_chan_def *chandef, 9330 enum nl80211_radar_event event, gfp_t gfp, 9331 unsigned int link_id); 9332 9333 /** 9334 * cfg80211_background_cac_abort - Channel Availability Check offchan abort event 9335 * @wiphy: the wiphy 9336 * 9337 * This function is called by the driver when a Channel Availability Check 9338 * (CAC) is aborted by a offchannel dedicated chain. 9339 */ 9340 void cfg80211_background_cac_abort(struct wiphy *wiphy); 9341 9342 /** 9343 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 9344 * @dev: network device 9345 * @bssid: BSSID of AP (to avoid races) 9346 * @replay_ctr: new replay counter 9347 * @gfp: allocation flags 9348 */ 9349 void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 9350 const u8 *replay_ctr, gfp_t gfp); 9351 9352 /** 9353 * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 9354 * @dev: network device 9355 * @index: candidate index (the smaller the index, the higher the priority) 9356 * @bssid: BSSID of AP 9357 * @preauth: Whether AP advertises support for RSN pre-authentication 9358 * @gfp: allocation flags 9359 */ 9360 void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 9361 const u8 *bssid, bool preauth, gfp_t gfp); 9362 9363 /** 9364 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 9365 * @dev: The device the frame matched to 9366 * @link_id: the link the frame was received on, -1 if not applicable or unknown 9367 * @addr: the transmitter address 9368 * @gfp: context flags 9369 * 9370 * This function is used in AP mode (only!) to inform userspace that 9371 * a spurious class 3 frame was received, to be able to deauth the 9372 * sender. 9373 * Return: %true if the frame was passed to userspace (or this failed 9374 * for a reason other than not having a subscription.) 9375 */ 9376 bool cfg80211_rx_spurious_frame(struct net_device *dev, const u8 *addr, 9377 int link_id, gfp_t gfp); 9378 9379 /** 9380 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 9381 * @dev: The device the frame matched to 9382 * @addr: the transmitter address 9383 * @link_id: the link the frame was received on, -1 if not applicable or unknown 9384 * @gfp: context flags 9385 * 9386 * This function is used in AP mode (only!) to inform userspace that 9387 * an associated station sent a 4addr frame but that wasn't expected. 9388 * It is allowed and desirable to send this event only once for each 9389 * station to avoid event flooding. 9390 * Return: %true if the frame was passed to userspace (or this failed 9391 * for a reason other than not having a subscription.) 9392 */ 9393 bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, const u8 *addr, 9394 int link_id, gfp_t gfp); 9395 9396 /** 9397 * cfg80211_probe_status - notify userspace about probe status 9398 * @dev: the device the probe was sent on 9399 * @addr: the address of the peer 9400 * @cookie: the cookie filled in @probe_client previously 9401 * @acked: indicates whether probe was acked or not 9402 * @ack_signal: signal strength (in dBm) of the ACK frame. 9403 * @is_valid_ack_signal: indicates the ack_signal is valid or not. 9404 * @gfp: allocation flags 9405 */ 9406 void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 9407 u64 cookie, bool acked, s32 ack_signal, 9408 bool is_valid_ack_signal, gfp_t gfp); 9409 9410 /** 9411 * cfg80211_report_obss_beacon_khz - report beacon from other APs 9412 * @wiphy: The wiphy that received the beacon 9413 * @frame: the frame 9414 * @len: length of the frame 9415 * @freq: frequency the frame was received on in KHz 9416 * @sig_dbm: signal strength in dBm, or 0 if unknown 9417 * 9418 * Use this function to report to userspace when a beacon was 9419 * received. It is not useful to call this when there is no 9420 * netdev that is in AP/GO mode. 9421 */ 9422 void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame, 9423 size_t len, int freq, int sig_dbm); 9424 9425 /** 9426 * cfg80211_report_obss_beacon - report beacon from other APs 9427 * @wiphy: The wiphy that received the beacon 9428 * @frame: the frame 9429 * @len: length of the frame 9430 * @freq: frequency the frame was received on 9431 * @sig_dbm: signal strength in dBm, or 0 if unknown 9432 * 9433 * Use this function to report to userspace when a beacon was 9434 * received. It is not useful to call this when there is no 9435 * netdev that is in AP/GO mode. 9436 */ 9437 static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy, 9438 const u8 *frame, size_t len, 9439 int freq, int sig_dbm) 9440 { 9441 cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq), 9442 sig_dbm); 9443 } 9444 9445 /** 9446 * struct cfg80211_beaconing_check_config - beacon check configuration 9447 * @iftype: the interface type to check for 9448 * @relax: allow IR-relaxation conditions to apply (e.g. another 9449 * interface connected already on the same channel) 9450 * NOTE: If this is set, wiphy mutex must be held. 9451 * @reg_power: &enum ieee80211_ap_reg_power value indicating the 9452 * advertised/used 6 GHz regulatory power setting 9453 */ 9454 struct cfg80211_beaconing_check_config { 9455 enum nl80211_iftype iftype; 9456 enum ieee80211_ap_reg_power reg_power; 9457 bool relax; 9458 }; 9459 9460 /** 9461 * cfg80211_reg_check_beaconing - check if beaconing is allowed 9462 * @wiphy: the wiphy 9463 * @chandef: the channel definition 9464 * @cfg: additional parameters for the checking 9465 * 9466 * Return: %true if there is no secondary channel or the secondary channel(s) 9467 * can be used for beaconing (i.e. is not a radar channel etc.) 9468 */ 9469 bool cfg80211_reg_check_beaconing(struct wiphy *wiphy, 9470 struct cfg80211_chan_def *chandef, 9471 struct cfg80211_beaconing_check_config *cfg); 9472 9473 /** 9474 * cfg80211_reg_can_beacon - check if beaconing is allowed 9475 * @wiphy: the wiphy 9476 * @chandef: the channel definition 9477 * @iftype: interface type 9478 * 9479 * Return: %true if there is no secondary channel or the secondary channel(s) 9480 * can be used for beaconing (i.e. is not a radar channel etc.) 9481 */ 9482 static inline bool 9483 cfg80211_reg_can_beacon(struct wiphy *wiphy, 9484 struct cfg80211_chan_def *chandef, 9485 enum nl80211_iftype iftype) 9486 { 9487 struct cfg80211_beaconing_check_config config = { 9488 .iftype = iftype, 9489 }; 9490 9491 return cfg80211_reg_check_beaconing(wiphy, chandef, &config); 9492 } 9493 9494 /** 9495 * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation 9496 * @wiphy: the wiphy 9497 * @chandef: the channel definition 9498 * @iftype: interface type 9499 * 9500 * Return: %true if there is no secondary channel or the secondary channel(s) 9501 * can be used for beaconing (i.e. is not a radar channel etc.). This version 9502 * also checks if IR-relaxation conditions apply, to allow beaconing under 9503 * more permissive conditions. 9504 * 9505 * Context: Requires the wiphy mutex to be held. 9506 */ 9507 static inline bool 9508 cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, 9509 struct cfg80211_chan_def *chandef, 9510 enum nl80211_iftype iftype) 9511 { 9512 struct cfg80211_beaconing_check_config config = { 9513 .iftype = iftype, 9514 .relax = true, 9515 }; 9516 9517 return cfg80211_reg_check_beaconing(wiphy, chandef, &config); 9518 } 9519 9520 /** 9521 * cfg80211_ch_switch_notify - update wdev channel and notify userspace 9522 * @dev: the device which switched channels 9523 * @chandef: the new channel definition 9524 * @link_id: the link ID for MLO, must be 0 for non-MLO 9525 * 9526 * Caller must hold wiphy mutex, therefore must only be called from sleepable 9527 * driver context! 9528 */ 9529 void cfg80211_ch_switch_notify(struct net_device *dev, 9530 struct cfg80211_chan_def *chandef, 9531 unsigned int link_id); 9532 9533 /** 9534 * cfg80211_ch_switch_started_notify - notify channel switch start 9535 * @dev: the device on which the channel switch started 9536 * @chandef: the future channel definition 9537 * @link_id: the link ID for MLO, must be 0 for non-MLO 9538 * @count: the number of TBTTs until the channel switch happens 9539 * @quiet: whether or not immediate quiet was requested by the AP 9540 * 9541 * Inform the userspace about the channel switch that has just 9542 * started, so that it can take appropriate actions (eg. starting 9543 * channel switch on other vifs), if necessary. 9544 */ 9545 void cfg80211_ch_switch_started_notify(struct net_device *dev, 9546 struct cfg80211_chan_def *chandef, 9547 unsigned int link_id, u8 count, 9548 bool quiet); 9549 9550 /** 9551 * ieee80211_operating_class_to_band - convert operating class to band 9552 * 9553 * @operating_class: the operating class to convert 9554 * @band: band pointer to fill 9555 * 9556 * Return: %true if the conversion was successful, %false otherwise. 9557 */ 9558 bool ieee80211_operating_class_to_band(u8 operating_class, 9559 enum nl80211_band *band); 9560 9561 /** 9562 * ieee80211_operating_class_to_chandef - convert operating class to chandef 9563 * 9564 * @operating_class: the operating class to convert 9565 * @chan: the ieee80211_channel to convert 9566 * @chandef: a pointer to the resulting chandef 9567 * 9568 * Return: %true if the conversion was successful, %false otherwise. 9569 */ 9570 bool ieee80211_operating_class_to_chandef(u8 operating_class, 9571 struct ieee80211_channel *chan, 9572 struct cfg80211_chan_def *chandef); 9573 9574 /** 9575 * ieee80211_chandef_to_operating_class - convert chandef to operation class 9576 * 9577 * @chandef: the chandef to convert 9578 * @op_class: a pointer to the resulting operating class 9579 * 9580 * Return: %true if the conversion was successful, %false otherwise. 9581 */ 9582 bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, 9583 u8 *op_class); 9584 9585 /** 9586 * ieee80211_chandef_to_khz - convert chandef to frequency in KHz 9587 * 9588 * @chandef: the chandef to convert 9589 * 9590 * Return: the center frequency of chandef (1st segment) in KHz. 9591 */ 9592 static inline u32 9593 ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef) 9594 { 9595 return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset; 9596 } 9597 9598 /** 9599 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 9600 * @dev: the device on which the operation is requested 9601 * @peer: the MAC address of the peer device 9602 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 9603 * NL80211_TDLS_TEARDOWN) 9604 * @reason_code: the reason code for teardown request 9605 * @gfp: allocation flags 9606 * 9607 * This function is used to request userspace to perform TDLS operation that 9608 * requires knowledge of keys, i.e., link setup or teardown when the AP 9609 * connection uses encryption. This is optional mechanism for the driver to use 9610 * if it can automatically determine when a TDLS link could be useful (e.g., 9611 * based on traffic and signal strength for a peer). 9612 */ 9613 void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 9614 enum nl80211_tdls_operation oper, 9615 u16 reason_code, gfp_t gfp); 9616 9617 /** 9618 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 9619 * @rate: given rate_info to calculate bitrate from 9620 * 9621 * Return: calculated bitrate 9622 */ 9623 u32 cfg80211_calculate_bitrate(struct rate_info *rate); 9624 9625 /** 9626 * cfg80211_unregister_wdev - remove the given wdev 9627 * @wdev: struct wireless_dev to remove 9628 * 9629 * This function removes the device so it can no longer be used. It is necessary 9630 * to call this function even when cfg80211 requests the removal of the device 9631 * by calling the del_virtual_intf() callback. The function must also be called 9632 * when the driver wishes to unregister the wdev, e.g. when the hardware device 9633 * is unbound from the driver. 9634 * 9635 * Context: Requires the RTNL and wiphy mutex to be held. 9636 */ 9637 void cfg80211_unregister_wdev(struct wireless_dev *wdev); 9638 9639 /** 9640 * cfg80211_register_netdevice - register the given netdev 9641 * @dev: the netdev to register 9642 * 9643 * Note: In contexts coming from cfg80211 callbacks, you must call this rather 9644 * than register_netdevice(), unregister_netdev() is impossible as the RTNL is 9645 * held. Otherwise, both register_netdevice() and register_netdev() are usable 9646 * instead as well. 9647 * 9648 * Context: Requires the RTNL and wiphy mutex to be held. 9649 * 9650 * Return: 0 on success. Non-zero on error. 9651 */ 9652 int cfg80211_register_netdevice(struct net_device *dev); 9653 9654 /** 9655 * cfg80211_unregister_netdevice - unregister the given netdev 9656 * @dev: the netdev to register 9657 * 9658 * Note: In contexts coming from cfg80211 callbacks, you must call this rather 9659 * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL 9660 * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are 9661 * usable instead as well. 9662 * 9663 * Context: Requires the RTNL and wiphy mutex to be held. 9664 */ 9665 static inline void cfg80211_unregister_netdevice(struct net_device *dev) 9666 { 9667 #if IS_ENABLED(CONFIG_CFG80211) 9668 cfg80211_unregister_wdev(dev->ieee80211_ptr); 9669 #endif 9670 } 9671 9672 /** 9673 * struct cfg80211_ft_event_params - FT Information Elements 9674 * @ies: FT IEs 9675 * @ies_len: length of the FT IE in bytes 9676 * @target_ap: target AP's MAC address 9677 * @ric_ies: RIC IE 9678 * @ric_ies_len: length of the RIC IE in bytes 9679 */ 9680 struct cfg80211_ft_event_params { 9681 const u8 *ies; 9682 size_t ies_len; 9683 const u8 *target_ap; 9684 const u8 *ric_ies; 9685 size_t ric_ies_len; 9686 }; 9687 9688 /** 9689 * cfg80211_ft_event - notify userspace about FT IE and RIC IE 9690 * @netdev: network device 9691 * @ft_event: IE information 9692 */ 9693 void cfg80211_ft_event(struct net_device *netdev, 9694 struct cfg80211_ft_event_params *ft_event); 9695 9696 /** 9697 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 9698 * @ies: the input IE buffer 9699 * @len: the input length 9700 * @attr: the attribute ID to find 9701 * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 9702 * if the function is only called to get the needed buffer size 9703 * @bufsize: size of the output buffer 9704 * 9705 * The function finds a given P2P attribute in the (vendor) IEs and 9706 * copies its contents to the given buffer. 9707 * 9708 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 9709 * malformed or the attribute can't be found (respectively), or the 9710 * length of the found attribute (which can be zero). 9711 */ 9712 int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 9713 enum ieee80211_p2p_attr_id attr, 9714 u8 *buf, unsigned int bufsize); 9715 9716 /** 9717 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC) 9718 * @ies: the IE buffer 9719 * @ielen: the length of the IE buffer 9720 * @ids: an array with element IDs that are allowed before 9721 * the split. A WLAN_EID_EXTENSION value means that the next 9722 * EID in the list is a sub-element of the EXTENSION IE. 9723 * @n_ids: the size of the element ID array 9724 * @after_ric: array IE types that come after the RIC element 9725 * @n_after_ric: size of the @after_ric array 9726 * @offset: offset where to start splitting in the buffer 9727 * 9728 * This function splits an IE buffer by updating the @offset 9729 * variable to point to the location where the buffer should be 9730 * split. 9731 * 9732 * It assumes that the given IE buffer is well-formed, this 9733 * has to be guaranteed by the caller! 9734 * 9735 * It also assumes that the IEs in the buffer are ordered 9736 * correctly, if not the result of using this function will not 9737 * be ordered correctly either, i.e. it does no reordering. 9738 * 9739 * Return: The offset where the next part of the buffer starts, which 9740 * may be @ielen if the entire (remainder) of the buffer should be 9741 * used. 9742 */ 9743 size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen, 9744 const u8 *ids, int n_ids, 9745 const u8 *after_ric, int n_after_ric, 9746 size_t offset); 9747 9748 /** 9749 * ieee80211_ie_split - split an IE buffer according to ordering 9750 * @ies: the IE buffer 9751 * @ielen: the length of the IE buffer 9752 * @ids: an array with element IDs that are allowed before 9753 * the split. A WLAN_EID_EXTENSION value means that the next 9754 * EID in the list is a sub-element of the EXTENSION IE. 9755 * @n_ids: the size of the element ID array 9756 * @offset: offset where to start splitting in the buffer 9757 * 9758 * This function splits an IE buffer by updating the @offset 9759 * variable to point to the location where the buffer should be 9760 * split. 9761 * 9762 * It assumes that the given IE buffer is well-formed, this 9763 * has to be guaranteed by the caller! 9764 * 9765 * It also assumes that the IEs in the buffer are ordered 9766 * correctly, if not the result of using this function will not 9767 * be ordered correctly either, i.e. it does no reordering. 9768 * 9769 * Return: The offset where the next part of the buffer starts, which 9770 * may be @ielen if the entire (remainder) of the buffer should be 9771 * used. 9772 */ 9773 static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 9774 const u8 *ids, int n_ids, size_t offset) 9775 { 9776 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset); 9777 } 9778 9779 /** 9780 * ieee80211_fragment_element - fragment the last element in skb 9781 * @skb: The skbuf that the element was added to 9782 * @len_pos: Pointer to length of the element to fragment 9783 * @frag_id: The element ID to use for fragments 9784 * 9785 * This function fragments all data after @len_pos, adding fragmentation 9786 * elements with the given ID as appropriate. The SKB will grow in size 9787 * accordingly. 9788 */ 9789 void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id); 9790 9791 /** 9792 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 9793 * @wdev: the wireless device reporting the wakeup 9794 * @wakeup: the wakeup report 9795 * @gfp: allocation flags 9796 * 9797 * This function reports that the given device woke up. If it 9798 * caused the wakeup, report the reason(s), otherwise you may 9799 * pass %NULL as the @wakeup parameter to advertise that something 9800 * else caused the wakeup. 9801 */ 9802 void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 9803 struct cfg80211_wowlan_wakeup *wakeup, 9804 gfp_t gfp); 9805 9806 /** 9807 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 9808 * 9809 * @wdev: the wireless device for which critical protocol is stopped. 9810 * @gfp: allocation flags 9811 * 9812 * This function can be called by the driver to indicate it has reverted 9813 * operation back to normal. One reason could be that the duration given 9814 * by .crit_proto_start() has expired. 9815 */ 9816 void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 9817 9818 /** 9819 * ieee80211_get_num_supported_channels - get number of channels device has 9820 * @wiphy: the wiphy 9821 * 9822 * Return: the number of channels supported by the device. 9823 */ 9824 unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 9825 9826 /** 9827 * cfg80211_check_combinations - check interface combinations 9828 * 9829 * @wiphy: the wiphy 9830 * @params: the interface combinations parameter 9831 * 9832 * This function can be called by the driver to check whether a 9833 * combination of interfaces and their types are allowed according to 9834 * the interface combinations. 9835 * 9836 * Return: 0 if combinations are allowed. Non-zero on error. 9837 */ 9838 int cfg80211_check_combinations(struct wiphy *wiphy, 9839 struct iface_combination_params *params); 9840 9841 /** 9842 * cfg80211_iter_combinations - iterate over matching combinations 9843 * 9844 * @wiphy: the wiphy 9845 * @params: the interface combinations parameter 9846 * @iter: function to call for each matching combination 9847 * @data: pointer to pass to iter function 9848 * 9849 * This function can be called by the driver to check what possible 9850 * combinations it fits in at a given moment, e.g. for channel switching 9851 * purposes. 9852 * 9853 * Return: 0 on success. Non-zero on error. 9854 */ 9855 int cfg80211_iter_combinations(struct wiphy *wiphy, 9856 struct iface_combination_params *params, 9857 void (*iter)(const struct ieee80211_iface_combination *c, 9858 void *data), 9859 void *data); 9860 /** 9861 * cfg80211_get_radio_idx_by_chan - get the radio index by the channel 9862 * 9863 * @wiphy: the wiphy 9864 * @chan: channel for which the supported radio index is required 9865 * 9866 * Return: radio index on success or -EINVAL otherwise 9867 */ 9868 int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy, 9869 const struct ieee80211_channel *chan); 9870 9871 /** 9872 * cfg80211_stop_link - stop AP/P2P_GO link if link_id is non-negative or stops 9873 * all links on the interface. 9874 * 9875 * @wiphy: the wiphy 9876 * @wdev: wireless device 9877 * @link_id: valid link ID in case of MLO AP/P2P_GO Operation or else -1 9878 * @gfp: context flags 9879 * 9880 * If link_id is set during MLO operation, stops only the specified AP/P2P_GO 9881 * link and if link_id is set to -1 or last link is stopped, the entire 9882 * interface is stopped as if AP was stopped, IBSS/mesh left, STA disconnected. 9883 */ 9884 void cfg80211_stop_link(struct wiphy *wiphy, struct wireless_dev *wdev, 9885 int link_id, gfp_t gfp); 9886 9887 /** 9888 * cfg80211_stop_iface - trigger interface disconnection 9889 * 9890 * @wiphy: the wiphy 9891 * @wdev: wireless device 9892 * @gfp: context flags 9893 * 9894 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 9895 * disconnected. 9896 * 9897 * Note: This doesn't need any locks and is asynchronous. 9898 */ 9899 static inline void 9900 cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, gfp_t gfp) 9901 { 9902 cfg80211_stop_link(wiphy, wdev, -1, gfp); 9903 } 9904 9905 /** 9906 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 9907 * @wiphy: the wiphy to shut down 9908 * 9909 * This function shuts down all interfaces belonging to this wiphy by 9910 * calling dev_close() (and treating non-netdev interfaces as needed). 9911 * It shouldn't really be used unless there are some fatal device errors 9912 * that really can't be recovered in any other way. 9913 * 9914 * Callers must hold the RTNL and be able to deal with callbacks into 9915 * the driver while the function is running. 9916 */ 9917 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 9918 9919 /** 9920 * wiphy_ext_feature_set - set the extended feature flag 9921 * 9922 * @wiphy: the wiphy to modify. 9923 * @ftidx: extended feature bit index. 9924 * 9925 * The extended features are flagged in multiple bytes (see 9926 * &struct wiphy.@ext_features) 9927 */ 9928 static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 9929 enum nl80211_ext_feature_index ftidx) 9930 { 9931 u8 *ft_byte; 9932 9933 ft_byte = &wiphy->ext_features[ftidx / 8]; 9934 *ft_byte |= BIT(ftidx % 8); 9935 } 9936 9937 /** 9938 * wiphy_ext_feature_isset - check the extended feature flag 9939 * 9940 * @wiphy: the wiphy to modify. 9941 * @ftidx: extended feature bit index. 9942 * 9943 * The extended features are flagged in multiple bytes (see 9944 * &struct wiphy.@ext_features) 9945 * 9946 * Return: %true if extended feature flag is set, %false otherwise 9947 */ 9948 static inline bool 9949 wiphy_ext_feature_isset(struct wiphy *wiphy, 9950 enum nl80211_ext_feature_index ftidx) 9951 { 9952 u8 ft_byte; 9953 9954 ft_byte = wiphy->ext_features[ftidx / 8]; 9955 return (ft_byte & BIT(ftidx % 8)) != 0; 9956 } 9957 9958 /** 9959 * cfg80211_free_nan_func - free NAN function 9960 * @f: NAN function that should be freed 9961 * 9962 * Frees all the NAN function and all it's allocated members. 9963 */ 9964 void cfg80211_free_nan_func(struct cfg80211_nan_func *f); 9965 9966 /** 9967 * struct cfg80211_nan_match_params - NAN match parameters 9968 * @type: the type of the function that triggered a match. If it is 9969 * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber. 9970 * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery 9971 * result. 9972 * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up. 9973 * @inst_id: the local instance id 9974 * @peer_inst_id: the instance id of the peer's function 9975 * @addr: the MAC address of the peer 9976 * @info_len: the length of the &info 9977 * @info: the Service Specific Info from the peer (if any) 9978 * @cookie: unique identifier of the corresponding function 9979 */ 9980 struct cfg80211_nan_match_params { 9981 enum nl80211_nan_function_type type; 9982 u8 inst_id; 9983 u8 peer_inst_id; 9984 const u8 *addr; 9985 u8 info_len; 9986 const u8 *info; 9987 u64 cookie; 9988 }; 9989 9990 /** 9991 * cfg80211_nan_match - report a match for a NAN function. 9992 * @wdev: the wireless device reporting the match 9993 * @match: match notification parameters 9994 * @gfp: allocation flags 9995 * 9996 * This function reports that the a NAN function had a match. This 9997 * can be a subscribe that had a match or a solicited publish that 9998 * was sent. It can also be a follow up that was received. 9999 */ 10000 void cfg80211_nan_match(struct wireless_dev *wdev, 10001 struct cfg80211_nan_match_params *match, gfp_t gfp); 10002 10003 /** 10004 * cfg80211_nan_func_terminated - notify about NAN function termination. 10005 * 10006 * @wdev: the wireless device reporting the match 10007 * @inst_id: the local instance id 10008 * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*) 10009 * @cookie: unique NAN function identifier 10010 * @gfp: allocation flags 10011 * 10012 * This function reports that the a NAN function is terminated. 10013 */ 10014 void cfg80211_nan_func_terminated(struct wireless_dev *wdev, 10015 u8 inst_id, 10016 enum nl80211_nan_func_term_reason reason, 10017 u64 cookie, gfp_t gfp); 10018 10019 /* ethtool helper */ 10020 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 10021 10022 /** 10023 * cfg80211_external_auth_request - userspace request for authentication 10024 * @netdev: network device 10025 * @params: External authentication parameters 10026 * @gfp: allocation flags 10027 * Returns: 0 on success, < 0 on error 10028 */ 10029 int cfg80211_external_auth_request(struct net_device *netdev, 10030 struct cfg80211_external_auth_params *params, 10031 gfp_t gfp); 10032 10033 /** 10034 * cfg80211_pmsr_report - report peer measurement result data 10035 * @wdev: the wireless device reporting the measurement 10036 * @req: the original measurement request 10037 * @result: the result data 10038 * @gfp: allocation flags 10039 */ 10040 void cfg80211_pmsr_report(struct wireless_dev *wdev, 10041 struct cfg80211_pmsr_request *req, 10042 struct cfg80211_pmsr_result *result, 10043 gfp_t gfp); 10044 10045 /** 10046 * cfg80211_pmsr_complete - report peer measurement completed 10047 * @wdev: the wireless device reporting the measurement 10048 * @req: the original measurement request 10049 * @gfp: allocation flags 10050 * 10051 * Report that the entire measurement completed, after this 10052 * the request pointer will no longer be valid. 10053 */ 10054 void cfg80211_pmsr_complete(struct wireless_dev *wdev, 10055 struct cfg80211_pmsr_request *req, 10056 gfp_t gfp); 10057 10058 /** 10059 * cfg80211_iftype_allowed - check whether the interface can be allowed 10060 * @wiphy: the wiphy 10061 * @iftype: interface type 10062 * @is_4addr: use_4addr flag, must be '0' when check_swif is '1' 10063 * @check_swif: check iftype against software interfaces 10064 * 10065 * Check whether the interface is allowed to operate; additionally, this API 10066 * can be used to check iftype against the software interfaces when 10067 * check_swif is '1'. 10068 * 10069 * Return: %true if allowed, %false otherwise 10070 */ 10071 bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype, 10072 bool is_4addr, u8 check_swif); 10073 10074 10075 /** 10076 * cfg80211_assoc_comeback - notification of association that was 10077 * temporarily rejected with a comeback 10078 * @netdev: network device 10079 * @ap_addr: AP (MLD) address that rejected the association 10080 * @timeout: timeout interval value TUs. 10081 * 10082 * this function may sleep. the caller must hold the corresponding wdev's mutex. 10083 */ 10084 void cfg80211_assoc_comeback(struct net_device *netdev, 10085 const u8 *ap_addr, u32 timeout); 10086 10087 /* Logging, debugging and troubleshooting/diagnostic helpers. */ 10088 10089 /* wiphy_printk helpers, similar to dev_printk */ 10090 10091 #define wiphy_printk(level, wiphy, format, args...) \ 10092 dev_printk(level, &(wiphy)->dev, format, ##args) 10093 #define wiphy_emerg(wiphy, format, args...) \ 10094 dev_emerg(&(wiphy)->dev, format, ##args) 10095 #define wiphy_alert(wiphy, format, args...) \ 10096 dev_alert(&(wiphy)->dev, format, ##args) 10097 #define wiphy_crit(wiphy, format, args...) \ 10098 dev_crit(&(wiphy)->dev, format, ##args) 10099 #define wiphy_err(wiphy, format, args...) \ 10100 dev_err(&(wiphy)->dev, format, ##args) 10101 #define wiphy_warn(wiphy, format, args...) \ 10102 dev_warn(&(wiphy)->dev, format, ##args) 10103 #define wiphy_notice(wiphy, format, args...) \ 10104 dev_notice(&(wiphy)->dev, format, ##args) 10105 #define wiphy_info(wiphy, format, args...) \ 10106 dev_info(&(wiphy)->dev, format, ##args) 10107 #define wiphy_info_once(wiphy, format, args...) \ 10108 dev_info_once(&(wiphy)->dev, format, ##args) 10109 10110 #define wiphy_err_ratelimited(wiphy, format, args...) \ 10111 dev_err_ratelimited(&(wiphy)->dev, format, ##args) 10112 #define wiphy_warn_ratelimited(wiphy, format, args...) \ 10113 dev_warn_ratelimited(&(wiphy)->dev, format, ##args) 10114 10115 #define wiphy_debug(wiphy, format, args...) \ 10116 wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 10117 10118 #define wiphy_dbg(wiphy, format, args...) \ 10119 dev_dbg(&(wiphy)->dev, format, ##args) 10120 10121 #if defined(VERBOSE_DEBUG) 10122 #define wiphy_vdbg wiphy_dbg 10123 #else 10124 #define wiphy_vdbg(wiphy, format, args...) \ 10125 ({ \ 10126 if (0) \ 10127 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 10128 0; \ 10129 }) 10130 #endif 10131 10132 /* 10133 * wiphy_WARN() acts like wiphy_printk(), but with the key difference 10134 * of using a WARN/WARN_ON to get the message out, including the 10135 * file/line information and a backtrace. 10136 */ 10137 #define wiphy_WARN(wiphy, format, args...) \ 10138 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 10139 10140 /** 10141 * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space 10142 * @netdev: network device 10143 * @owe_info: peer's owe info 10144 * @gfp: allocation flags 10145 */ 10146 void cfg80211_update_owe_info_event(struct net_device *netdev, 10147 struct cfg80211_update_owe_info *owe_info, 10148 gfp_t gfp); 10149 10150 /** 10151 * cfg80211_bss_flush - resets all the scan entries 10152 * @wiphy: the wiphy 10153 */ 10154 void cfg80211_bss_flush(struct wiphy *wiphy); 10155 10156 /** 10157 * cfg80211_bss_color_notify - notify about bss color event 10158 * @dev: network device 10159 * @cmd: the actual event we want to notify 10160 * @count: the number of TBTTs until the color change happens 10161 * @color_bitmap: representations of the colors that the local BSS is aware of 10162 * @link_id: valid link_id in case of MLO or 0 for non-MLO. 10163 * 10164 * Return: 0 on success. Non-zero on error. 10165 */ 10166 int cfg80211_bss_color_notify(struct net_device *dev, 10167 enum nl80211_commands cmd, u8 count, 10168 u64 color_bitmap, u8 link_id); 10169 10170 /** 10171 * cfg80211_obss_color_collision_notify - notify about bss color collision 10172 * @dev: network device 10173 * @color_bitmap: representations of the colors that the local BSS is aware of 10174 * @link_id: valid link_id in case of MLO or 0 for non-MLO. 10175 * 10176 * Return: 0 on success. Non-zero on error. 10177 */ 10178 static inline int cfg80211_obss_color_collision_notify(struct net_device *dev, 10179 u64 color_bitmap, 10180 u8 link_id) 10181 { 10182 return cfg80211_bss_color_notify(dev, NL80211_CMD_OBSS_COLOR_COLLISION, 10183 0, color_bitmap, link_id); 10184 } 10185 10186 /** 10187 * cfg80211_color_change_started_notify - notify color change start 10188 * @dev: the device on which the color is switched 10189 * @count: the number of TBTTs until the color change happens 10190 * @link_id: valid link_id in case of MLO or 0 for non-MLO. 10191 * 10192 * Inform the userspace about the color change that has started. 10193 * 10194 * Return: 0 on success. Non-zero on error. 10195 */ 10196 static inline int cfg80211_color_change_started_notify(struct net_device *dev, 10197 u8 count, u8 link_id) 10198 { 10199 return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_STARTED, 10200 count, 0, link_id); 10201 } 10202 10203 /** 10204 * cfg80211_color_change_aborted_notify - notify color change abort 10205 * @dev: the device on which the color is switched 10206 * @link_id: valid link_id in case of MLO or 0 for non-MLO. 10207 * 10208 * Inform the userspace about the color change that has aborted. 10209 * 10210 * Return: 0 on success. Non-zero on error. 10211 */ 10212 static inline int cfg80211_color_change_aborted_notify(struct net_device *dev, 10213 u8 link_id) 10214 { 10215 return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_ABORTED, 10216 0, 0, link_id); 10217 } 10218 10219 /** 10220 * cfg80211_color_change_notify - notify color change completion 10221 * @dev: the device on which the color was switched 10222 * @link_id: valid link_id in case of MLO or 0 for non-MLO. 10223 * 10224 * Inform the userspace about the color change that has completed. 10225 * 10226 * Return: 0 on success. Non-zero on error. 10227 */ 10228 static inline int cfg80211_color_change_notify(struct net_device *dev, 10229 u8 link_id) 10230 { 10231 return cfg80211_bss_color_notify(dev, 10232 NL80211_CMD_COLOR_CHANGE_COMPLETED, 10233 0, 0, link_id); 10234 } 10235 10236 /** 10237 * cfg80211_6ghz_power_type - determine AP regulatory power type 10238 * @control: control flags 10239 * @client_flags: &enum ieee80211_channel_flags for station mode to enable 10240 * SP to LPI fallback, zero otherwise. 10241 * 10242 * Return: regulatory power type from &enum ieee80211_ap_reg_power 10243 */ 10244 static inline enum ieee80211_ap_reg_power 10245 cfg80211_6ghz_power_type(u8 control, u32 client_flags) 10246 { 10247 switch (u8_get_bits(control, IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO)) { 10248 case IEEE80211_6GHZ_CTRL_REG_LPI_AP: 10249 case IEEE80211_6GHZ_CTRL_REG_INDOOR_LPI_AP: 10250 case IEEE80211_6GHZ_CTRL_REG_AP_ROLE_NOT_RELEVANT: 10251 case IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP_OLD: 10252 return IEEE80211_REG_LPI_AP; 10253 case IEEE80211_6GHZ_CTRL_REG_SP_AP: 10254 return IEEE80211_REG_SP_AP; 10255 case IEEE80211_6GHZ_CTRL_REG_VLP_AP: 10256 return IEEE80211_REG_VLP_AP; 10257 case IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP: 10258 if (client_flags & IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT) 10259 return IEEE80211_REG_LPI_AP; 10260 return IEEE80211_REG_SP_AP; 10261 default: 10262 return IEEE80211_REG_UNSET_AP; 10263 } 10264 } 10265 10266 /** 10267 * cfg80211_links_removed - Notify about removed STA MLD setup links. 10268 * @dev: network device. 10269 * @link_mask: BIT mask of removed STA MLD setup link IDs. 10270 * 10271 * Inform cfg80211 and the userspace about removed STA MLD setup links due to 10272 * AP MLD removing the corresponding affiliated APs with Multi-Link 10273 * reconfiguration. Note that it's not valid to remove all links, in this 10274 * case disconnect instead. 10275 * Also note that the wdev mutex must be held. 10276 */ 10277 void cfg80211_links_removed(struct net_device *dev, u16 link_mask); 10278 10279 /** 10280 * struct cfg80211_mlo_reconf_done_data - MLO reconfiguration data 10281 * @buf: MLO Reconfiguration Response frame (header + body) 10282 * @len: length of the frame data 10283 * @driver_initiated: Indicates whether the add links request is initiated by 10284 * driver. This is set to true when the link reconfiguration request 10285 * initiated by driver due to AP link recommendation requests 10286 * (Ex: BTM (BSS Transition Management) request) handling offloaded to 10287 * driver. 10288 * @added_links: BIT mask of links successfully added to the association 10289 * @links: per-link information indexed by link ID 10290 * @links.bss: the BSS that MLO reconfiguration was requested for, ownership of 10291 * the pointer moves to cfg80211 in the call to 10292 * cfg80211_mlo_reconf_add_done(). 10293 * 10294 * The BSS pointer must be set for each link for which 'add' operation was 10295 * requested in the assoc_ml_reconf callback. 10296 */ 10297 struct cfg80211_mlo_reconf_done_data { 10298 const u8 *buf; 10299 size_t len; 10300 bool driver_initiated; 10301 u16 added_links; 10302 struct { 10303 struct cfg80211_bss *bss; 10304 u8 *addr; 10305 } links[IEEE80211_MLD_MAX_NUM_LINKS]; 10306 }; 10307 10308 /** 10309 * cfg80211_mlo_reconf_add_done - Notify about MLO reconfiguration result 10310 * @dev: network device. 10311 * @data: MLO reconfiguration done data, &struct cfg80211_mlo_reconf_done_data 10312 * 10313 * Inform cfg80211 and the userspace that processing of ML reconfiguration 10314 * request to add links to the association is done. 10315 */ 10316 void cfg80211_mlo_reconf_add_done(struct net_device *dev, 10317 struct cfg80211_mlo_reconf_done_data *data); 10318 10319 /** 10320 * cfg80211_schedule_channels_check - schedule regulatory check if needed 10321 * @wdev: the wireless device to check 10322 * 10323 * In case the device supports NO_IR or DFS relaxations, schedule regulatory 10324 * channels check, as previous concurrent operation conditions may not 10325 * hold anymore. 10326 */ 10327 void cfg80211_schedule_channels_check(struct wireless_dev *wdev); 10328 10329 /** 10330 * cfg80211_epcs_changed - Notify about a change in EPCS state 10331 * @netdev: the wireless device whose EPCS state changed 10332 * @enabled: set to true if EPCS was enabled, otherwise set to false. 10333 */ 10334 void cfg80211_epcs_changed(struct net_device *netdev, bool enabled); 10335 10336 /** 10337 * cfg80211_next_nan_dw_notif - Notify about the next NAN Discovery Window (DW) 10338 * @wdev: Pointer to the wireless device structure 10339 * @chan: DW channel (6, 44 or 149) 10340 * @gfp: Memory allocation flags 10341 */ 10342 void cfg80211_next_nan_dw_notif(struct wireless_dev *wdev, 10343 struct ieee80211_channel *chan, gfp_t gfp); 10344 10345 /** 10346 * cfg80211_nan_cluster_joined - Notify about NAN cluster join 10347 * @wdev: Pointer to the wireless device structure 10348 * @cluster_id: Cluster ID of the NAN cluster that was joined or started 10349 * @new_cluster: Indicates if this is a new cluster or an existing one 10350 * @gfp: Memory allocation flags 10351 * 10352 * This function is used to notify user space when a NAN cluster has been 10353 * joined, providing the cluster ID and a flag whether it is a new cluster. 10354 */ 10355 void cfg80211_nan_cluster_joined(struct wireless_dev *wdev, 10356 const u8 *cluster_id, bool new_cluster, 10357 gfp_t gfp); 10358 10359 #ifdef CONFIG_CFG80211_DEBUGFS 10360 /** 10361 * wiphy_locked_debugfs_read - do a locked read in debugfs 10362 * @wiphy: the wiphy to use 10363 * @file: the file being read 10364 * @buf: the buffer to fill and then read from 10365 * @bufsize: size of the buffer 10366 * @userbuf: the user buffer to copy to 10367 * @count: read count 10368 * @ppos: read position 10369 * @handler: the read handler to call (under wiphy lock) 10370 * @data: additional data to pass to the read handler 10371 * 10372 * Return: the number of characters read, or a negative errno 10373 */ 10374 ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file, 10375 char *buf, size_t bufsize, 10376 char __user *userbuf, size_t count, 10377 loff_t *ppos, 10378 ssize_t (*handler)(struct wiphy *wiphy, 10379 struct file *file, 10380 char *buf, 10381 size_t bufsize, 10382 void *data), 10383 void *data); 10384 10385 /** 10386 * wiphy_locked_debugfs_write - do a locked write in debugfs 10387 * @wiphy: the wiphy to use 10388 * @file: the file being written to 10389 * @buf: the buffer to copy the user data to 10390 * @bufsize: size of the buffer 10391 * @userbuf: the user buffer to copy from 10392 * @count: read count 10393 * @handler: the write handler to call (under wiphy lock) 10394 * @data: additional data to pass to the write handler 10395 * 10396 * Return: the number of characters written, or a negative errno 10397 */ 10398 ssize_t wiphy_locked_debugfs_write(struct wiphy *wiphy, struct file *file, 10399 char *buf, size_t bufsize, 10400 const char __user *userbuf, size_t count, 10401 ssize_t (*handler)(struct wiphy *wiphy, 10402 struct file *file, 10403 char *buf, 10404 size_t count, 10405 void *data), 10406 void *data); 10407 #endif 10408 10409 /** 10410 * cfg80211_s1g_get_start_freq_khz - get S1G chandef start frequency 10411 * @chandef: the chandef to use 10412 * 10413 * Return: the chandefs starting frequency in KHz 10414 */ 10415 static inline u32 10416 cfg80211_s1g_get_start_freq_khz(const struct cfg80211_chan_def *chandef) 10417 { 10418 u32 bw_mhz = cfg80211_chandef_get_width(chandef); 10419 u32 center_khz = 10420 MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset; 10421 return center_khz - bw_mhz * 500 + 500; 10422 } 10423 10424 /** 10425 * cfg80211_s1g_get_end_freq_khz - get S1G chandef end frequency 10426 * @chandef: the chandef to use 10427 * 10428 * Return: the chandefs ending frequency in KHz 10429 */ 10430 static inline u32 10431 cfg80211_s1g_get_end_freq_khz(const struct cfg80211_chan_def *chandef) 10432 { 10433 u32 bw_mhz = cfg80211_chandef_get_width(chandef); 10434 u32 center_khz = 10435 MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset; 10436 return center_khz + bw_mhz * 500 - 500; 10437 } 10438 10439 /** 10440 * cfg80211_s1g_get_primary_sibling - retrieve the sibling 1MHz subchannel 10441 * for an S1G chandef using a 2MHz primary channel. 10442 * @wiphy: wiphy the channel belongs to 10443 * @chandef: the chandef to use 10444 * 10445 * When chandef::s1g_primary_2mhz is set to true, we are operating on a 2MHz 10446 * primary channel. The 1MHz subchannel designated by the primary channel 10447 * location exists within chandef::chan, whilst the 'sibling' is denoted as 10448 * being the other 1MHz subchannel that make up the 2MHz primary channel. 10449 * 10450 * Returns: the sibling 1MHz &struct ieee80211_channel, or %NULL on failure. 10451 */ 10452 static inline struct ieee80211_channel * 10453 cfg80211_s1g_get_primary_sibling(struct wiphy *wiphy, 10454 const struct cfg80211_chan_def *chandef) 10455 { 10456 int width_mhz = cfg80211_chandef_get_width(chandef); 10457 u32 pri_1mhz_khz, sibling_1mhz_khz, op_low_1mhz_khz, pri_index; 10458 10459 if (!chandef->s1g_primary_2mhz || width_mhz < 2) 10460 return NULL; 10461 10462 pri_1mhz_khz = ieee80211_channel_to_khz(chandef->chan); 10463 op_low_1mhz_khz = cfg80211_s1g_get_start_freq_khz(chandef); 10464 10465 /* 10466 * Compute the index of the primary 1 MHz subchannel within the 10467 * operating channel, relative to the lowest 1 MHz center frequency. 10468 * Flip the least significant bit to select the even/odd sibling, 10469 * then translate that index back into a channel frequency. 10470 */ 10471 pri_index = (pri_1mhz_khz - op_low_1mhz_khz) / 1000; 10472 sibling_1mhz_khz = op_low_1mhz_khz + ((pri_index ^ 1) * 1000); 10473 10474 return ieee80211_get_channel_khz(wiphy, sibling_1mhz_khz); 10475 } 10476 10477 10478 /** 10479 * cfg80211_incumbent_signal_notify - Notify userspace of incumbent signal detection 10480 * @wiphy: the wiphy to use 10481 * @chandef: channel definition in which the interference was detected 10482 * @signal_interference_bitmap: bitmap indicating interference across 20 MHz segments 10483 * @gfp: allocation context for message creation and multicast; pass GFP_ATOMIC 10484 * if called from atomic context (e.g. firmware event handler), otherwise 10485 * GFP_KERNEL 10486 * 10487 * Use this function to notify userspace when an incumbent signal is detected on 10488 * the operating channel in the 6 GHz band. The notification includes the 10489 * current channel definition and a bitmap representing interference across 10490 * the operating bandwidth. Each bit in the bitmap corresponds to a 20 MHz 10491 * segment, with the lowest bit representing the lowest frequency segment. 10492 * Punctured sub-channels are included in the bitmap structure but are always 10493 * set to zero since interference detection is not performed on them. 10494 */ 10495 void cfg80211_incumbent_signal_notify(struct wiphy *wiphy, 10496 const struct cfg80211_chan_def *chandef, 10497 u32 signal_interference_bitmap, 10498 gfp_t gfp); 10499 10500 #endif /* __NET_CFG80211_H */ 10501