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-2020 Intel Corporation 11 */ 12 13 #include <linux/netdevice.h> 14 #include <linux/debugfs.h> 15 #include <linux/list.h> 16 #include <linux/bug.h> 17 #include <linux/netlink.h> 18 #include <linux/skbuff.h> 19 #include <linux/nl80211.h> 20 #include <linux/if_ether.h> 21 #include <linux/ieee80211.h> 22 #include <linux/net.h> 23 #include <net/regulatory.h> 24 25 /** 26 * DOC: Introduction 27 * 28 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges 29 * userspace and drivers, and offers some utility functionality associated 30 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used 31 * by all modern wireless drivers in Linux, so that they offer a consistent 32 * API through nl80211. For backward compatibility, cfg80211 also offers 33 * wireless extensions to userspace, but hides them from drivers completely. 34 * 35 * Additionally, cfg80211 contains code to help enforce regulatory spectrum 36 * use restrictions. 37 */ 38 39 40 /** 41 * DOC: Device registration 42 * 43 * In order for a driver to use cfg80211, it must register the hardware device 44 * with cfg80211. This happens through a number of hardware capability structs 45 * described below. 46 * 47 * The fundamental structure for each device is the 'wiphy', of which each 48 * instance describes a physical wireless device connected to the system. Each 49 * such wiphy can have zero, one, or many virtual interfaces associated with 50 * it, which need to be identified as such by pointing the network interface's 51 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes 52 * the wireless part of the interface, normally this struct is embedded in the 53 * network interface's private data area. Drivers can optionally allow creating 54 * or destroying virtual interfaces on the fly, but without at least one or the 55 * ability to create some the wireless device isn't useful. 56 * 57 * Each wiphy structure contains device capability information, and also has 58 * a pointer to the various operations the driver offers. The definitions and 59 * structures here describe these capabilities in detail. 60 */ 61 62 struct wiphy; 63 64 /* 65 * wireless hardware capability structures 66 */ 67 68 /** 69 * enum ieee80211_channel_flags - channel flags 70 * 71 * Channel flags set by the regulatory control code. 72 * 73 * @IEEE80211_CHAN_DISABLED: This channel is disabled. 74 * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes 75 * sending probe requests or beaconing. 76 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 77 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 78 * is not permitted. 79 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 80 * is not permitted. 81 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel. 82 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band, 83 * this flag indicates that an 80 MHz channel cannot use this 84 * channel as the control or any of the secondary channels. 85 * This may be due to the driver or due to regulatory bandwidth 86 * restrictions. 87 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band, 88 * this flag indicates that an 160 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_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY 93 * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT 94 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted 95 * on this channel. 96 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted 97 * on this channel. 98 * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel. 99 * 100 */ 101 enum ieee80211_channel_flags { 102 IEEE80211_CHAN_DISABLED = 1<<0, 103 IEEE80211_CHAN_NO_IR = 1<<1, 104 /* hole at 1<<2 */ 105 IEEE80211_CHAN_RADAR = 1<<3, 106 IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 107 IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 108 IEEE80211_CHAN_NO_OFDM = 1<<6, 109 IEEE80211_CHAN_NO_80MHZ = 1<<7, 110 IEEE80211_CHAN_NO_160MHZ = 1<<8, 111 IEEE80211_CHAN_INDOOR_ONLY = 1<<9, 112 IEEE80211_CHAN_IR_CONCURRENT = 1<<10, 113 IEEE80211_CHAN_NO_20MHZ = 1<<11, 114 IEEE80211_CHAN_NO_10MHZ = 1<<12, 115 IEEE80211_CHAN_NO_HE = 1<<13, 116 }; 117 118 #define IEEE80211_CHAN_NO_HT40 \ 119 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 120 121 #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000 122 #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000) 123 124 /** 125 * struct ieee80211_channel - channel definition 126 * 127 * This structure describes a single channel for use 128 * with cfg80211. 129 * 130 * @center_freq: center frequency in MHz 131 * @freq_offset: offset from @center_freq, in KHz 132 * @hw_value: hardware-specific value for the channel 133 * @flags: channel flags from &enum ieee80211_channel_flags. 134 * @orig_flags: channel flags at registration time, used by regulatory 135 * code to support devices with additional restrictions 136 * @band: band this channel belongs to. 137 * @max_antenna_gain: maximum antenna gain in dBi 138 * @max_power: maximum transmission power (in dBm) 139 * @max_reg_power: maximum regulatory transmission power (in dBm) 140 * @beacon_found: helper to regulatory code to indicate when a beacon 141 * has been found on this channel. Use regulatory_hint_found_beacon() 142 * to enable this, this is useful only on 5 GHz band. 143 * @orig_mag: internal use 144 * @orig_mpwr: internal use 145 * @dfs_state: current state of this channel. Only relevant if radar is required 146 * on this channel. 147 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 148 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. 149 */ 150 struct ieee80211_channel { 151 enum nl80211_band band; 152 u32 center_freq; 153 u16 freq_offset; 154 u16 hw_value; 155 u32 flags; 156 int max_antenna_gain; 157 int max_power; 158 int max_reg_power; 159 bool beacon_found; 160 u32 orig_flags; 161 int orig_mag, orig_mpwr; 162 enum nl80211_dfs_state dfs_state; 163 unsigned long dfs_state_entered; 164 unsigned int dfs_cac_ms; 165 }; 166 167 /** 168 * enum ieee80211_rate_flags - rate flags 169 * 170 * Hardware/specification flags for rates. These are structured 171 * in a way that allows using the same bitrate structure for 172 * different bands/PHY modes. 173 * 174 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 175 * preamble on this bitrate; only relevant in 2.4GHz band and 176 * with CCK rates. 177 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 178 * when used with 802.11a (on the 5 GHz band); filled by the 179 * core code when registering the wiphy. 180 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 181 * when used with 802.11b (on the 2.4 GHz band); filled by the 182 * core code when registering the wiphy. 183 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 184 * when used with 802.11g (on the 2.4 GHz band); filled by the 185 * core code when registering the wiphy. 186 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 187 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode 188 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode 189 */ 190 enum ieee80211_rate_flags { 191 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 192 IEEE80211_RATE_MANDATORY_A = 1<<1, 193 IEEE80211_RATE_MANDATORY_B = 1<<2, 194 IEEE80211_RATE_MANDATORY_G = 1<<3, 195 IEEE80211_RATE_ERP_G = 1<<4, 196 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5, 197 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6, 198 }; 199 200 /** 201 * enum ieee80211_bss_type - BSS type filter 202 * 203 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS 204 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS 205 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS 206 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS 207 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type 208 */ 209 enum ieee80211_bss_type { 210 IEEE80211_BSS_TYPE_ESS, 211 IEEE80211_BSS_TYPE_PBSS, 212 IEEE80211_BSS_TYPE_IBSS, 213 IEEE80211_BSS_TYPE_MBSS, 214 IEEE80211_BSS_TYPE_ANY 215 }; 216 217 /** 218 * enum ieee80211_privacy - BSS privacy filter 219 * 220 * @IEEE80211_PRIVACY_ON: privacy bit set 221 * @IEEE80211_PRIVACY_OFF: privacy bit clear 222 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting 223 */ 224 enum ieee80211_privacy { 225 IEEE80211_PRIVACY_ON, 226 IEEE80211_PRIVACY_OFF, 227 IEEE80211_PRIVACY_ANY 228 }; 229 230 #define IEEE80211_PRIVACY(x) \ 231 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF) 232 233 /** 234 * struct ieee80211_rate - bitrate definition 235 * 236 * This structure describes a bitrate that an 802.11 PHY can 237 * operate with. The two values @hw_value and @hw_value_short 238 * are only for driver use when pointers to this structure are 239 * passed around. 240 * 241 * @flags: rate-specific flags 242 * @bitrate: bitrate in units of 100 Kbps 243 * @hw_value: driver/hardware value for this rate 244 * @hw_value_short: driver/hardware value for this rate when 245 * short preamble is used 246 */ 247 struct ieee80211_rate { 248 u32 flags; 249 u16 bitrate; 250 u16 hw_value, hw_value_short; 251 }; 252 253 /** 254 * struct ieee80211_he_obss_pd - AP settings for spatial reuse 255 * 256 * @enable: is the feature enabled. 257 * @min_offset: minimal tx power offset an associated station shall use 258 * @max_offset: maximum tx power offset an associated station shall use 259 */ 260 struct ieee80211_he_obss_pd { 261 bool enable; 262 u8 min_offset; 263 u8 max_offset; 264 }; 265 266 /** 267 * struct cfg80211_he_bss_color - AP settings for BSS coloring 268 * 269 * @color: the current color. 270 * @enabled: HE BSS color is used 271 * @partial: define the AID equation. 272 */ 273 struct cfg80211_he_bss_color { 274 u8 color; 275 bool enabled; 276 bool partial; 277 }; 278 279 /** 280 * struct ieee80211_he_bss_color - AP settings for BSS coloring 281 * 282 * @color: the current color. 283 * @disabled: is the feature disabled. 284 * @partial: define the AID equation. 285 */ 286 struct ieee80211_he_bss_color { 287 u8 color; 288 bool disabled; 289 bool partial; 290 }; 291 292 /** 293 * struct ieee80211_sta_ht_cap - STA's HT capabilities 294 * 295 * This structure describes most essential parameters needed 296 * to describe 802.11n HT capabilities for an STA. 297 * 298 * @ht_supported: is HT supported by the STA 299 * @cap: HT capabilities map as described in 802.11n spec 300 * @ampdu_factor: Maximum A-MPDU length factor 301 * @ampdu_density: Minimum A-MPDU spacing 302 * @mcs: Supported MCS rates 303 */ 304 struct ieee80211_sta_ht_cap { 305 u16 cap; /* use IEEE80211_HT_CAP_ */ 306 bool ht_supported; 307 u8 ampdu_factor; 308 u8 ampdu_density; 309 struct ieee80211_mcs_info mcs; 310 }; 311 312 /** 313 * struct ieee80211_sta_vht_cap - STA's VHT capabilities 314 * 315 * This structure describes most essential parameters needed 316 * to describe 802.11ac VHT capabilities for an STA. 317 * 318 * @vht_supported: is VHT supported by the STA 319 * @cap: VHT capabilities map as described in 802.11ac spec 320 * @vht_mcs: Supported VHT MCS rates 321 */ 322 struct ieee80211_sta_vht_cap { 323 bool vht_supported; 324 u32 cap; /* use IEEE80211_VHT_CAP_ */ 325 struct ieee80211_vht_mcs_info vht_mcs; 326 }; 327 328 #define IEEE80211_HE_PPE_THRES_MAX_LEN 25 329 330 /** 331 * struct ieee80211_sta_he_cap - STA's HE capabilities 332 * 333 * This structure describes most essential parameters needed 334 * to describe 802.11ax HE capabilities for a STA. 335 * 336 * @has_he: true iff HE data is valid. 337 * @he_cap_elem: Fixed portion of the HE capabilities element. 338 * @he_mcs_nss_supp: The supported NSS/MCS combinations. 339 * @ppe_thres: Holds the PPE Thresholds data. 340 */ 341 struct ieee80211_sta_he_cap { 342 bool has_he; 343 struct ieee80211_he_cap_elem he_cap_elem; 344 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp; 345 u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN]; 346 }; 347 348 /** 349 * struct ieee80211_sband_iftype_data 350 * 351 * This structure encapsulates sband data that is relevant for the 352 * interface types defined in @types_mask. Each type in the 353 * @types_mask must be unique across all instances of iftype_data. 354 * 355 * @types_mask: interface types mask 356 * @he_cap: holds the HE capabilities 357 * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a 358 * 6 GHz band channel (and 0 may be valid value). 359 */ 360 struct ieee80211_sband_iftype_data { 361 u16 types_mask; 362 struct ieee80211_sta_he_cap he_cap; 363 struct ieee80211_he_6ghz_capa he_6ghz_capa; 364 }; 365 366 /** 367 * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations 368 * 369 * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz 370 * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz 371 * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz 372 * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz 373 * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz 374 * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz 375 * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz 376 * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and 377 * 2.16GHz+2.16GHz 378 * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and 379 * 4.32GHz + 4.32GHz 380 * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and 381 * 4.32GHz + 4.32GHz 382 * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz 383 * and 4.32GHz + 4.32GHz 384 * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz, 385 * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz 386 */ 387 enum ieee80211_edmg_bw_config { 388 IEEE80211_EDMG_BW_CONFIG_4 = 4, 389 IEEE80211_EDMG_BW_CONFIG_5 = 5, 390 IEEE80211_EDMG_BW_CONFIG_6 = 6, 391 IEEE80211_EDMG_BW_CONFIG_7 = 7, 392 IEEE80211_EDMG_BW_CONFIG_8 = 8, 393 IEEE80211_EDMG_BW_CONFIG_9 = 9, 394 IEEE80211_EDMG_BW_CONFIG_10 = 10, 395 IEEE80211_EDMG_BW_CONFIG_11 = 11, 396 IEEE80211_EDMG_BW_CONFIG_12 = 12, 397 IEEE80211_EDMG_BW_CONFIG_13 = 13, 398 IEEE80211_EDMG_BW_CONFIG_14 = 14, 399 IEEE80211_EDMG_BW_CONFIG_15 = 15, 400 }; 401 402 /** 403 * struct ieee80211_edmg - EDMG configuration 404 * 405 * This structure describes most essential parameters needed 406 * to describe 802.11ay EDMG configuration 407 * 408 * @channels: bitmap that indicates the 2.16 GHz channel(s) 409 * that are allowed to be used for transmissions. 410 * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc. 411 * Set to 0 indicate EDMG not supported. 412 * @bw_config: Channel BW Configuration subfield encodes 413 * the allowed channel bandwidth configurations 414 */ 415 struct ieee80211_edmg { 416 u8 channels; 417 enum ieee80211_edmg_bw_config bw_config; 418 }; 419 420 /** 421 * struct ieee80211_sta_s1g_cap - STA's S1G capabilities 422 * 423 * This structure describes most essential parameters needed 424 * to describe 802.11ah S1G capabilities for a STA. 425 * 426 * @s1g_supported: is STA an S1G STA 427 * @cap: S1G capabilities information 428 * @nss_mcs: Supported NSS MCS set 429 */ 430 struct ieee80211_sta_s1g_cap { 431 bool s1g; 432 u8 cap[10]; /* use S1G_CAPAB_ */ 433 u8 nss_mcs[5]; 434 }; 435 436 /** 437 * struct ieee80211_supported_band - frequency band definition 438 * 439 * This structure describes a frequency band a wiphy 440 * is able to operate in. 441 * 442 * @channels: Array of channels the hardware can operate with 443 * in this band. 444 * @band: the band this structure represents 445 * @n_channels: Number of channels in @channels 446 * @bitrates: Array of bitrates the hardware can operate with 447 * in this band. Must be sorted to give a valid "supported 448 * rates" IE, i.e. CCK rates first, then OFDM. 449 * @n_bitrates: Number of bitrates in @bitrates 450 * @ht_cap: HT capabilities in this band 451 * @vht_cap: VHT capabilities in this band 452 * @edmg_cap: EDMG capabilities in this band 453 * @n_iftype_data: number of iftype data entries 454 * @iftype_data: interface type data entries. Note that the bits in 455 * @types_mask inside this structure cannot overlap (i.e. only 456 * one occurrence of each type is allowed across all instances of 457 * iftype_data). 458 */ 459 struct ieee80211_supported_band { 460 struct ieee80211_channel *channels; 461 struct ieee80211_rate *bitrates; 462 enum nl80211_band band; 463 int n_channels; 464 int n_bitrates; 465 struct ieee80211_sta_ht_cap ht_cap; 466 struct ieee80211_sta_vht_cap vht_cap; 467 struct ieee80211_sta_s1g_cap s1g_cap; 468 struct ieee80211_edmg edmg_cap; 469 u16 n_iftype_data; 470 const struct ieee80211_sband_iftype_data *iftype_data; 471 }; 472 473 /** 474 * ieee80211_get_sband_iftype_data - return sband data for a given iftype 475 * @sband: the sband to search for the STA on 476 * @iftype: enum nl80211_iftype 477 * 478 * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found 479 */ 480 static inline const struct ieee80211_sband_iftype_data * 481 ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband, 482 u8 iftype) 483 { 484 int i; 485 486 if (WARN_ON(iftype >= NL80211_IFTYPE_MAX)) 487 return NULL; 488 489 for (i = 0; i < sband->n_iftype_data; i++) { 490 const struct ieee80211_sband_iftype_data *data = 491 &sband->iftype_data[i]; 492 493 if (data->types_mask & BIT(iftype)) 494 return data; 495 } 496 497 return NULL; 498 } 499 500 /** 501 * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype 502 * @sband: the sband to search for the iftype on 503 * @iftype: enum nl80211_iftype 504 * 505 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found 506 */ 507 static inline const struct ieee80211_sta_he_cap * 508 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband, 509 u8 iftype) 510 { 511 const struct ieee80211_sband_iftype_data *data = 512 ieee80211_get_sband_iftype_data(sband, iftype); 513 514 if (data && data->he_cap.has_he) 515 return &data->he_cap; 516 517 return NULL; 518 } 519 520 /** 521 * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA 522 * @sband: the sband to search for the STA on 523 * 524 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found 525 */ 526 static inline const struct ieee80211_sta_he_cap * 527 ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband) 528 { 529 return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION); 530 } 531 532 /** 533 * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities 534 * @sband: the sband to search for the STA on 535 * @iftype: the iftype to search for 536 * 537 * Return: the 6GHz capabilities 538 */ 539 static inline __le16 540 ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband, 541 enum nl80211_iftype iftype) 542 { 543 const struct ieee80211_sband_iftype_data *data = 544 ieee80211_get_sband_iftype_data(sband, iftype); 545 546 if (WARN_ON(!data || !data->he_cap.has_he)) 547 return 0; 548 549 return data->he_6ghz_capa.capa; 550 } 551 552 /** 553 * wiphy_read_of_freq_limits - read frequency limits from device tree 554 * 555 * @wiphy: the wireless device to get extra limits for 556 * 557 * Some devices may have extra limitations specified in DT. This may be useful 558 * for chipsets that normally support more bands but are limited due to board 559 * design (e.g. by antennas or external power amplifier). 560 * 561 * This function reads info from DT and uses it to *modify* channels (disable 562 * unavailable ones). It's usually a *bad* idea to use it in drivers with 563 * shared channel data as DT limitations are device specific. You should make 564 * sure to call it only if channels in wiphy are copied and can be modified 565 * without affecting other devices. 566 * 567 * As this function access device node it has to be called after set_wiphy_dev. 568 * It also modifies channels so they have to be set first. 569 * If using this helper, call it before wiphy_register(). 570 */ 571 #ifdef CONFIG_OF 572 void wiphy_read_of_freq_limits(struct wiphy *wiphy); 573 #else /* CONFIG_OF */ 574 static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy) 575 { 576 } 577 #endif /* !CONFIG_OF */ 578 579 580 /* 581 * Wireless hardware/device configuration structures and methods 582 */ 583 584 /** 585 * DOC: Actions and configuration 586 * 587 * Each wireless device and each virtual interface offer a set of configuration 588 * operations and other actions that are invoked by userspace. Each of these 589 * actions is described in the operations structure, and the parameters these 590 * operations use are described separately. 591 * 592 * Additionally, some operations are asynchronous and expect to get status 593 * information via some functions that drivers need to call. 594 * 595 * Scanning and BSS list handling with its associated functionality is described 596 * in a separate chapter. 597 */ 598 599 #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\ 600 WLAN_USER_POSITION_LEN) 601 602 /** 603 * struct vif_params - describes virtual interface parameters 604 * @flags: monitor interface flags, unchanged if 0, otherwise 605 * %MONITOR_FLAG_CHANGED will be set 606 * @use_4addr: use 4-address frames 607 * @macaddr: address to use for this virtual interface. 608 * If this parameter is set to zero address the driver may 609 * determine the address as needed. 610 * This feature is only fully supported by drivers that enable the 611 * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating 612 ** only p2p devices with specified MAC. 613 * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets 614 * belonging to that MU-MIMO groupID; %NULL if not changed 615 * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring 616 * MU-MIMO packets going to the specified station; %NULL if not changed 617 */ 618 struct vif_params { 619 u32 flags; 620 int use_4addr; 621 u8 macaddr[ETH_ALEN]; 622 const u8 *vht_mumimo_groups; 623 const u8 *vht_mumimo_follow_addr; 624 }; 625 626 /** 627 * struct key_params - key information 628 * 629 * Information about a key 630 * 631 * @key: key material 632 * @key_len: length of key material 633 * @cipher: cipher suite selector 634 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 635 * with the get_key() callback, must be in little endian, 636 * length given by @seq_len. 637 * @seq_len: length of @seq. 638 * @vlan_id: vlan_id for VLAN group key (if nonzero) 639 * @mode: key install mode (RX_TX, NO_TX or SET_TX) 640 */ 641 struct key_params { 642 const u8 *key; 643 const u8 *seq; 644 int key_len; 645 int seq_len; 646 u16 vlan_id; 647 u32 cipher; 648 enum nl80211_key_mode mode; 649 }; 650 651 /** 652 * struct cfg80211_chan_def - channel definition 653 * @chan: the (control) channel 654 * @width: channel width 655 * @center_freq1: center frequency of first segment 656 * @center_freq2: center frequency of second segment 657 * (only with 80+80 MHz) 658 * @edmg: define the EDMG channels configuration. 659 * If edmg is requested (i.e. the .channels member is non-zero), 660 * chan will define the primary channel and all other 661 * parameters are ignored. 662 * @freq1_offset: offset from @center_freq1, in KHz 663 */ 664 struct cfg80211_chan_def { 665 struct ieee80211_channel *chan; 666 enum nl80211_chan_width width; 667 u32 center_freq1; 668 u32 center_freq2; 669 struct ieee80211_edmg edmg; 670 u16 freq1_offset; 671 }; 672 673 /* 674 * cfg80211_bitrate_mask - masks for bitrate control 675 */ 676 struct cfg80211_bitrate_mask { 677 struct { 678 u32 legacy; 679 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 680 u16 vht_mcs[NL80211_VHT_NSS_MAX]; 681 u16 he_mcs[NL80211_HE_NSS_MAX]; 682 enum nl80211_txrate_gi gi; 683 enum nl80211_he_gi he_gi; 684 enum nl80211_he_ltf he_ltf; 685 } control[NUM_NL80211_BANDS]; 686 }; 687 688 689 /** 690 * struct cfg80211_tid_cfg - TID specific configuration 691 * @config_override: Flag to notify driver to reset TID configuration 692 * of the peer. 693 * @tids: bitmap of TIDs to modify 694 * @mask: bitmap of attributes indicating which parameter changed, 695 * similar to &nl80211_tid_config_supp. 696 * @noack: noack configuration value for the TID 697 * @retry_long: retry count value 698 * @retry_short: retry count value 699 * @ampdu: Enable/Disable MPDU aggregation 700 * @rtscts: Enable/Disable RTS/CTS 701 * @amsdu: Enable/Disable MSDU aggregation 702 * @txrate_type: Tx bitrate mask type 703 * @txrate_mask: Tx bitrate to be applied for the TID 704 */ 705 struct cfg80211_tid_cfg { 706 bool config_override; 707 u8 tids; 708 u64 mask; 709 enum nl80211_tid_config noack; 710 u8 retry_long, retry_short; 711 enum nl80211_tid_config ampdu; 712 enum nl80211_tid_config rtscts; 713 enum nl80211_tid_config amsdu; 714 enum nl80211_tx_rate_setting txrate_type; 715 struct cfg80211_bitrate_mask txrate_mask; 716 }; 717 718 /** 719 * struct cfg80211_tid_config - TID configuration 720 * @peer: Station's MAC address 721 * @n_tid_conf: Number of TID specific configurations to be applied 722 * @tid_conf: Configuration change info 723 */ 724 struct cfg80211_tid_config { 725 const u8 *peer; 726 u32 n_tid_conf; 727 struct cfg80211_tid_cfg tid_conf[]; 728 }; 729 730 /** 731 * cfg80211_get_chandef_type - return old channel type from chandef 732 * @chandef: the channel definition 733 * 734 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given 735 * chandef, which must have a bandwidth allowing this conversion. 736 */ 737 static inline enum nl80211_channel_type 738 cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef) 739 { 740 switch (chandef->width) { 741 case NL80211_CHAN_WIDTH_20_NOHT: 742 return NL80211_CHAN_NO_HT; 743 case NL80211_CHAN_WIDTH_20: 744 return NL80211_CHAN_HT20; 745 case NL80211_CHAN_WIDTH_40: 746 if (chandef->center_freq1 > chandef->chan->center_freq) 747 return NL80211_CHAN_HT40PLUS; 748 return NL80211_CHAN_HT40MINUS; 749 default: 750 WARN_ON(1); 751 return NL80211_CHAN_NO_HT; 752 } 753 } 754 755 /** 756 * cfg80211_chandef_create - create channel definition using channel type 757 * @chandef: the channel definition struct to fill 758 * @channel: the control channel 759 * @chantype: the channel type 760 * 761 * Given a channel type, create a channel definition. 762 */ 763 void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 764 struct ieee80211_channel *channel, 765 enum nl80211_channel_type chantype); 766 767 /** 768 * cfg80211_chandef_identical - check if two channel definitions are identical 769 * @chandef1: first channel definition 770 * @chandef2: second channel definition 771 * 772 * Return: %true if the channels defined by the channel definitions are 773 * identical, %false otherwise. 774 */ 775 static inline bool 776 cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1, 777 const struct cfg80211_chan_def *chandef2) 778 { 779 return (chandef1->chan == chandef2->chan && 780 chandef1->width == chandef2->width && 781 chandef1->center_freq1 == chandef2->center_freq1 && 782 chandef1->freq1_offset == chandef2->freq1_offset && 783 chandef1->center_freq2 == chandef2->center_freq2); 784 } 785 786 /** 787 * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel 788 * 789 * @chandef: the channel definition 790 * 791 * Return: %true if EDMG defined, %false otherwise. 792 */ 793 static inline bool 794 cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef) 795 { 796 return chandef->edmg.channels || chandef->edmg.bw_config; 797 } 798 799 /** 800 * cfg80211_chandef_compatible - check if two channel definitions are compatible 801 * @chandef1: first channel definition 802 * @chandef2: second channel definition 803 * 804 * Return: %NULL if the given channel definitions are incompatible, 805 * chandef1 or chandef2 otherwise. 806 */ 807 const struct cfg80211_chan_def * 808 cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, 809 const struct cfg80211_chan_def *chandef2); 810 811 /** 812 * cfg80211_chandef_valid - check if a channel definition is valid 813 * @chandef: the channel definition to check 814 * Return: %true if the channel definition is valid. %false otherwise. 815 */ 816 bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 817 818 /** 819 * cfg80211_chandef_usable - check if secondary channels can be used 820 * @wiphy: the wiphy to validate against 821 * @chandef: the channel definition to check 822 * @prohibited_flags: the regulatory channel flags that must not be set 823 * Return: %true if secondary channels are usable. %false otherwise. 824 */ 825 bool cfg80211_chandef_usable(struct wiphy *wiphy, 826 const struct cfg80211_chan_def *chandef, 827 u32 prohibited_flags); 828 829 /** 830 * cfg80211_chandef_dfs_required - checks if radar detection is required 831 * @wiphy: the wiphy to validate against 832 * @chandef: the channel definition to check 833 * @iftype: the interface type as specified in &enum nl80211_iftype 834 * Returns: 835 * 1 if radar detection is required, 0 if it is not, < 0 on error 836 */ 837 int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 838 const struct cfg80211_chan_def *chandef, 839 enum nl80211_iftype iftype); 840 841 /** 842 * ieee80211_chandef_rate_flags - returns rate flags for a channel 843 * 844 * In some channel types, not all rates may be used - for example CCK 845 * rates may not be used in 5/10 MHz channels. 846 * 847 * @chandef: channel definition for the channel 848 * 849 * Returns: rate flags which apply for this channel 850 */ 851 static inline enum ieee80211_rate_flags 852 ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef) 853 { 854 switch (chandef->width) { 855 case NL80211_CHAN_WIDTH_5: 856 return IEEE80211_RATE_SUPPORTS_5MHZ; 857 case NL80211_CHAN_WIDTH_10: 858 return IEEE80211_RATE_SUPPORTS_10MHZ; 859 default: 860 break; 861 } 862 return 0; 863 } 864 865 /** 866 * ieee80211_chandef_max_power - maximum transmission power for the chandef 867 * 868 * In some regulations, the transmit power may depend on the configured channel 869 * bandwidth which may be defined as dBm/MHz. This function returns the actual 870 * max_power for non-standard (20 MHz) channels. 871 * 872 * @chandef: channel definition for the channel 873 * 874 * Returns: maximum allowed transmission power in dBm for the chandef 875 */ 876 static inline int 877 ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef) 878 { 879 switch (chandef->width) { 880 case NL80211_CHAN_WIDTH_5: 881 return min(chandef->chan->max_reg_power - 6, 882 chandef->chan->max_power); 883 case NL80211_CHAN_WIDTH_10: 884 return min(chandef->chan->max_reg_power - 3, 885 chandef->chan->max_power); 886 default: 887 break; 888 } 889 return chandef->chan->max_power; 890 } 891 892 /** 893 * enum survey_info_flags - survey information flags 894 * 895 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 896 * @SURVEY_INFO_IN_USE: channel is currently being used 897 * @SURVEY_INFO_TIME: active time (in ms) was filled in 898 * @SURVEY_INFO_TIME_BUSY: busy time was filled in 899 * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in 900 * @SURVEY_INFO_TIME_RX: receive time was filled in 901 * @SURVEY_INFO_TIME_TX: transmit time was filled in 902 * @SURVEY_INFO_TIME_SCAN: scan time was filled in 903 * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in 904 * 905 * Used by the driver to indicate which info in &struct survey_info 906 * it has filled in during the get_survey(). 907 */ 908 enum survey_info_flags { 909 SURVEY_INFO_NOISE_DBM = BIT(0), 910 SURVEY_INFO_IN_USE = BIT(1), 911 SURVEY_INFO_TIME = BIT(2), 912 SURVEY_INFO_TIME_BUSY = BIT(3), 913 SURVEY_INFO_TIME_EXT_BUSY = BIT(4), 914 SURVEY_INFO_TIME_RX = BIT(5), 915 SURVEY_INFO_TIME_TX = BIT(6), 916 SURVEY_INFO_TIME_SCAN = BIT(7), 917 SURVEY_INFO_TIME_BSS_RX = BIT(8), 918 }; 919 920 /** 921 * struct survey_info - channel survey response 922 * 923 * @channel: the channel this survey record reports, may be %NULL for a single 924 * record to report global statistics 925 * @filled: bitflag of flags from &enum survey_info_flags 926 * @noise: channel noise in dBm. This and all following fields are 927 * optional 928 * @time: amount of time in ms the radio was turn on (on the channel) 929 * @time_busy: amount of time the primary channel was sensed busy 930 * @time_ext_busy: amount of time the extension channel was sensed busy 931 * @time_rx: amount of time the radio spent receiving data 932 * @time_tx: amount of time the radio spent transmitting data 933 * @time_scan: amount of time the radio spent for scanning 934 * @time_bss_rx: amount of time the radio spent receiving data on a local BSS 935 * 936 * Used by dump_survey() to report back per-channel survey information. 937 * 938 * This structure can later be expanded with things like 939 * channel duty cycle etc. 940 */ 941 struct survey_info { 942 struct ieee80211_channel *channel; 943 u64 time; 944 u64 time_busy; 945 u64 time_ext_busy; 946 u64 time_rx; 947 u64 time_tx; 948 u64 time_scan; 949 u64 time_bss_rx; 950 u32 filled; 951 s8 noise; 952 }; 953 954 #define CFG80211_MAX_WEP_KEYS 4 955 956 /** 957 * struct cfg80211_crypto_settings - Crypto settings 958 * @wpa_versions: indicates which, if any, WPA versions are enabled 959 * (from enum nl80211_wpa_versions) 960 * @cipher_group: group key cipher suite (or 0 if unset) 961 * @n_ciphers_pairwise: number of AP supported unicast ciphers 962 * @ciphers_pairwise: unicast key cipher suites 963 * @n_akm_suites: number of AKM suites 964 * @akm_suites: AKM suites 965 * @control_port: Whether user space controls IEEE 802.1X port, i.e., 966 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 967 * required to assume that the port is unauthorized until authorized by 968 * user space. Otherwise, port is marked authorized by default. 969 * @control_port_ethertype: the control port protocol that should be 970 * allowed through even on unauthorized ports 971 * @control_port_no_encrypt: TRUE to prevent encryption of control port 972 * protocol frames. 973 * @control_port_over_nl80211: TRUE if userspace expects to exchange control 974 * port frames over NL80211 instead of the network interface. 975 * @control_port_no_preauth: disables pre-auth rx over the nl80211 control 976 * port for mac80211 977 * @wep_keys: static WEP keys, if not NULL points to an array of 978 * CFG80211_MAX_WEP_KEYS WEP keys 979 * @wep_tx_key: key index (0..3) of the default TX static WEP key 980 * @psk: PSK (for devices supporting 4-way-handshake offload) 981 * @sae_pwd: password for SAE authentication (for devices supporting SAE 982 * offload) 983 * @sae_pwd_len: length of SAE password (for devices supporting SAE offload) 984 */ 985 struct cfg80211_crypto_settings { 986 u32 wpa_versions; 987 u32 cipher_group; 988 int n_ciphers_pairwise; 989 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 990 int n_akm_suites; 991 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 992 bool control_port; 993 __be16 control_port_ethertype; 994 bool control_port_no_encrypt; 995 bool control_port_over_nl80211; 996 bool control_port_no_preauth; 997 struct key_params *wep_keys; 998 int wep_tx_key; 999 const u8 *psk; 1000 const u8 *sae_pwd; 1001 u8 sae_pwd_len; 1002 }; 1003 1004 /** 1005 * struct cfg80211_beacon_data - beacon data 1006 * @head: head portion of beacon (before TIM IE) 1007 * or %NULL if not changed 1008 * @tail: tail portion of beacon (after TIM IE) 1009 * or %NULL if not changed 1010 * @head_len: length of @head 1011 * @tail_len: length of @tail 1012 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 1013 * @beacon_ies_len: length of beacon_ies in octets 1014 * @proberesp_ies: extra information element(s) to add into Probe Response 1015 * frames or %NULL 1016 * @proberesp_ies_len: length of proberesp_ies in octets 1017 * @assocresp_ies: extra information element(s) to add into (Re)Association 1018 * Response frames or %NULL 1019 * @assocresp_ies_len: length of assocresp_ies in octets 1020 * @probe_resp_len: length of probe response template (@probe_resp) 1021 * @probe_resp: probe response template (AP mode only) 1022 * @ftm_responder: enable FTM responder functionality; -1 for no change 1023 * (which also implies no change in LCI/civic location data) 1024 * @lci: Measurement Report element content, starting with Measurement Token 1025 * (measurement type 8) 1026 * @civicloc: Measurement Report element content, starting with Measurement 1027 * Token (measurement type 11) 1028 * @lci_len: LCI data length 1029 * @civicloc_len: Civic location data length 1030 */ 1031 struct cfg80211_beacon_data { 1032 const u8 *head, *tail; 1033 const u8 *beacon_ies; 1034 const u8 *proberesp_ies; 1035 const u8 *assocresp_ies; 1036 const u8 *probe_resp; 1037 const u8 *lci; 1038 const u8 *civicloc; 1039 s8 ftm_responder; 1040 1041 size_t head_len, tail_len; 1042 size_t beacon_ies_len; 1043 size_t proberesp_ies_len; 1044 size_t assocresp_ies_len; 1045 size_t probe_resp_len; 1046 size_t lci_len; 1047 size_t civicloc_len; 1048 }; 1049 1050 struct mac_address { 1051 u8 addr[ETH_ALEN]; 1052 }; 1053 1054 /** 1055 * struct cfg80211_acl_data - Access control list data 1056 * 1057 * @acl_policy: ACL policy to be applied on the station's 1058 * entry specified by mac_addr 1059 * @n_acl_entries: Number of MAC address entries passed 1060 * @mac_addrs: List of MAC addresses of stations to be used for ACL 1061 */ 1062 struct cfg80211_acl_data { 1063 enum nl80211_acl_policy acl_policy; 1064 int n_acl_entries; 1065 1066 /* Keep it last */ 1067 struct mac_address mac_addrs[]; 1068 }; 1069 1070 /** 1071 * enum cfg80211_ap_settings_flags - AP settings flags 1072 * 1073 * Used by cfg80211_ap_settings 1074 * 1075 * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication 1076 */ 1077 enum cfg80211_ap_settings_flags { 1078 AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0), 1079 }; 1080 1081 /** 1082 * struct cfg80211_ap_settings - AP configuration 1083 * 1084 * Used to configure an AP interface. 1085 * 1086 * @chandef: defines the channel to use 1087 * @beacon: beacon data 1088 * @beacon_interval: beacon interval 1089 * @dtim_period: DTIM period 1090 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 1091 * user space) 1092 * @ssid_len: length of @ssid 1093 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 1094 * @crypto: crypto settings 1095 * @privacy: the BSS uses privacy 1096 * @auth_type: Authentication type (algorithm) 1097 * @smps_mode: SMPS mode 1098 * @inactivity_timeout: time in seconds to determine station's inactivity. 1099 * @p2p_ctwindow: P2P CT Window 1100 * @p2p_opp_ps: P2P opportunistic PS 1101 * @acl: ACL configuration used by the drivers which has support for 1102 * MAC address based access control 1103 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG 1104 * networks. 1105 * @beacon_rate: bitrate to be used for beacons 1106 * @ht_cap: HT capabilities (or %NULL if HT isn't enabled) 1107 * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled) 1108 * @he_cap: HE capabilities (or %NULL if HE isn't enabled) 1109 * @ht_required: stations must support HT 1110 * @vht_required: stations must support VHT 1111 * @twt_responder: Enable Target Wait Time 1112 * @he_required: stations must support HE 1113 * @flags: flags, as defined in enum cfg80211_ap_settings_flags 1114 * @he_obss_pd: OBSS Packet Detection settings 1115 * @he_bss_color: BSS Color settings 1116 * @he_oper: HE operation IE (or %NULL if HE isn't enabled) 1117 */ 1118 struct cfg80211_ap_settings { 1119 struct cfg80211_chan_def chandef; 1120 1121 struct cfg80211_beacon_data beacon; 1122 1123 int beacon_interval, dtim_period; 1124 const u8 *ssid; 1125 size_t ssid_len; 1126 enum nl80211_hidden_ssid hidden_ssid; 1127 struct cfg80211_crypto_settings crypto; 1128 bool privacy; 1129 enum nl80211_auth_type auth_type; 1130 enum nl80211_smps_mode smps_mode; 1131 int inactivity_timeout; 1132 u8 p2p_ctwindow; 1133 bool p2p_opp_ps; 1134 const struct cfg80211_acl_data *acl; 1135 bool pbss; 1136 struct cfg80211_bitrate_mask beacon_rate; 1137 1138 const struct ieee80211_ht_cap *ht_cap; 1139 const struct ieee80211_vht_cap *vht_cap; 1140 const struct ieee80211_he_cap_elem *he_cap; 1141 const struct ieee80211_he_operation *he_oper; 1142 bool ht_required, vht_required, he_required; 1143 bool twt_responder; 1144 u32 flags; 1145 struct ieee80211_he_obss_pd he_obss_pd; 1146 struct cfg80211_he_bss_color he_bss_color; 1147 }; 1148 1149 /** 1150 * struct cfg80211_csa_settings - channel switch settings 1151 * 1152 * Used for channel switch 1153 * 1154 * @chandef: defines the channel to use after the switch 1155 * @beacon_csa: beacon data while performing the switch 1156 * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 1157 * @counter_offsets_presp: offsets of the counters within the probe response 1158 * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 1159 * @n_counter_offsets_presp: number of csa counters in the probe response 1160 * @beacon_after: beacon data to be used on the new channel 1161 * @radar_required: whether radar detection is required on the new channel 1162 * @block_tx: whether transmissions should be blocked while changing 1163 * @count: number of beacons until switch 1164 */ 1165 struct cfg80211_csa_settings { 1166 struct cfg80211_chan_def chandef; 1167 struct cfg80211_beacon_data beacon_csa; 1168 const u16 *counter_offsets_beacon; 1169 const u16 *counter_offsets_presp; 1170 unsigned int n_counter_offsets_beacon; 1171 unsigned int n_counter_offsets_presp; 1172 struct cfg80211_beacon_data beacon_after; 1173 bool radar_required; 1174 bool block_tx; 1175 u8 count; 1176 }; 1177 1178 #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 1179 1180 /** 1181 * struct iface_combination_params - input parameters for interface combinations 1182 * 1183 * Used to pass interface combination parameters 1184 * 1185 * @num_different_channels: the number of different channels we want 1186 * to use for verification 1187 * @radar_detect: a bitmap where each bit corresponds to a channel 1188 * width where radar detection is needed, as in the definition of 1189 * &struct ieee80211_iface_combination.@radar_detect_widths 1190 * @iftype_num: array with the number of interfaces of each interface 1191 * type. The index is the interface type as specified in &enum 1192 * nl80211_iftype. 1193 * @new_beacon_int: set this to the beacon interval of a new interface 1194 * that's not operating yet, if such is to be checked as part of 1195 * the verification 1196 */ 1197 struct iface_combination_params { 1198 int num_different_channels; 1199 u8 radar_detect; 1200 int iftype_num[NUM_NL80211_IFTYPES]; 1201 u32 new_beacon_int; 1202 }; 1203 1204 /** 1205 * enum station_parameters_apply_mask - station parameter values to apply 1206 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 1207 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 1208 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 1209 * 1210 * Not all station parameters have in-band "no change" signalling, 1211 * for those that don't these flags will are used. 1212 */ 1213 enum station_parameters_apply_mask { 1214 STATION_PARAM_APPLY_UAPSD = BIT(0), 1215 STATION_PARAM_APPLY_CAPABILITY = BIT(1), 1216 STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 1217 STATION_PARAM_APPLY_STA_TXPOWER = BIT(3), 1218 }; 1219 1220 /** 1221 * struct sta_txpwr - station txpower configuration 1222 * 1223 * Used to configure txpower for station. 1224 * 1225 * @power: tx power (in dBm) to be used for sending data traffic. If tx power 1226 * is not provided, the default per-interface tx power setting will be 1227 * overriding. Driver should be picking up the lowest tx power, either tx 1228 * power per-interface or per-station. 1229 * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power 1230 * will be less than or equal to specified from userspace, whereas if TPC 1231 * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power. 1232 * NL80211_TX_POWER_FIXED is not a valid configuration option for 1233 * per peer TPC. 1234 */ 1235 struct sta_txpwr { 1236 s16 power; 1237 enum nl80211_tx_power_setting type; 1238 }; 1239 1240 /** 1241 * struct station_parameters - station parameters 1242 * 1243 * Used to change and create a new station. 1244 * 1245 * @vlan: vlan interface station should belong to 1246 * @supported_rates: supported rates in IEEE 802.11 format 1247 * (or NULL for no change) 1248 * @supported_rates_len: number of supported rates 1249 * @sta_flags_mask: station flags that changed 1250 * (bitmask of BIT(%NL80211_STA_FLAG_...)) 1251 * @sta_flags_set: station flags values 1252 * (bitmask of BIT(%NL80211_STA_FLAG_...)) 1253 * @listen_interval: listen interval or -1 for no change 1254 * @aid: AID or zero for no change 1255 * @vlan_id: VLAN ID for station (if nonzero) 1256 * @peer_aid: mesh peer AID or zero for no change 1257 * @plink_action: plink action to take 1258 * @plink_state: set the peer link state for a station 1259 * @ht_capa: HT capabilities of station 1260 * @vht_capa: VHT capabilities of station 1261 * @uapsd_queues: bitmap of queues configured for uapsd. same format 1262 * as the AC bitmap in the QoS info field 1263 * @max_sp: max Service Period. same format as the MAX_SP in the 1264 * QoS info field (but already shifted down) 1265 * @sta_modify_mask: bitmap indicating which parameters changed 1266 * (for those that don't have a natural "no change" value), 1267 * see &enum station_parameters_apply_mask 1268 * @local_pm: local link-specific mesh power save mode (no change when set 1269 * to unknown) 1270 * @capability: station capability 1271 * @ext_capab: extended capabilities of the station 1272 * @ext_capab_len: number of extended capabilities 1273 * @supported_channels: supported channels in IEEE 802.11 format 1274 * @supported_channels_len: number of supported channels 1275 * @supported_oper_classes: supported oper classes in IEEE 802.11 format 1276 * @supported_oper_classes_len: number of supported operating classes 1277 * @opmode_notif: operating mode field from Operating Mode Notification 1278 * @opmode_notif_used: information if operating mode field is used 1279 * @support_p2p_ps: information if station supports P2P PS mechanism 1280 * @he_capa: HE capabilities of station 1281 * @he_capa_len: the length of the HE capabilities 1282 * @airtime_weight: airtime scheduler weight for this station 1283 * @txpwr: transmit power for an associated station 1284 * @he_6ghz_capa: HE 6 GHz Band capabilities of station 1285 */ 1286 struct station_parameters { 1287 const u8 *supported_rates; 1288 struct net_device *vlan; 1289 u32 sta_flags_mask, sta_flags_set; 1290 u32 sta_modify_mask; 1291 int listen_interval; 1292 u16 aid; 1293 u16 vlan_id; 1294 u16 peer_aid; 1295 u8 supported_rates_len; 1296 u8 plink_action; 1297 u8 plink_state; 1298 const struct ieee80211_ht_cap *ht_capa; 1299 const struct ieee80211_vht_cap *vht_capa; 1300 u8 uapsd_queues; 1301 u8 max_sp; 1302 enum nl80211_mesh_power_mode local_pm; 1303 u16 capability; 1304 const u8 *ext_capab; 1305 u8 ext_capab_len; 1306 const u8 *supported_channels; 1307 u8 supported_channels_len; 1308 const u8 *supported_oper_classes; 1309 u8 supported_oper_classes_len; 1310 u8 opmode_notif; 1311 bool opmode_notif_used; 1312 int support_p2p_ps; 1313 const struct ieee80211_he_cap_elem *he_capa; 1314 u8 he_capa_len; 1315 u16 airtime_weight; 1316 struct sta_txpwr txpwr; 1317 const struct ieee80211_he_6ghz_capa *he_6ghz_capa; 1318 }; 1319 1320 /** 1321 * struct station_del_parameters - station deletion parameters 1322 * 1323 * Used to delete a station entry (or all stations). 1324 * 1325 * @mac: MAC address of the station to remove or NULL to remove all stations 1326 * @subtype: Management frame subtype to use for indicating removal 1327 * (10 = Disassociation, 12 = Deauthentication) 1328 * @reason_code: Reason code for the Disassociation/Deauthentication frame 1329 */ 1330 struct station_del_parameters { 1331 const u8 *mac; 1332 u8 subtype; 1333 u16 reason_code; 1334 }; 1335 1336 /** 1337 * enum cfg80211_station_type - the type of station being modified 1338 * @CFG80211_STA_AP_CLIENT: client of an AP interface 1339 * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still 1340 * unassociated (update properties for this type of client is permitted) 1341 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 1342 * the AP MLME in the device 1343 * @CFG80211_STA_AP_STA: AP station on managed interface 1344 * @CFG80211_STA_IBSS: IBSS station 1345 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 1346 * while TDLS setup is in progress, it moves out of this state when 1347 * being marked authorized; use this only if TDLS with external setup is 1348 * supported/used) 1349 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 1350 * entry that is operating, has been marked authorized by userspace) 1351 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 1352 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 1353 */ 1354 enum cfg80211_station_type { 1355 CFG80211_STA_AP_CLIENT, 1356 CFG80211_STA_AP_CLIENT_UNASSOC, 1357 CFG80211_STA_AP_MLME_CLIENT, 1358 CFG80211_STA_AP_STA, 1359 CFG80211_STA_IBSS, 1360 CFG80211_STA_TDLS_PEER_SETUP, 1361 CFG80211_STA_TDLS_PEER_ACTIVE, 1362 CFG80211_STA_MESH_PEER_KERNEL, 1363 CFG80211_STA_MESH_PEER_USER, 1364 }; 1365 1366 /** 1367 * cfg80211_check_station_change - validate parameter changes 1368 * @wiphy: the wiphy this operates on 1369 * @params: the new parameters for a station 1370 * @statype: the type of station being modified 1371 * 1372 * Utility function for the @change_station driver method. Call this function 1373 * with the appropriate station type looking up the station (and checking that 1374 * it exists). It will verify whether the station change is acceptable, and if 1375 * not will return an error code. Note that it may modify the parameters for 1376 * backward compatibility reasons, so don't use them before calling this. 1377 */ 1378 int cfg80211_check_station_change(struct wiphy *wiphy, 1379 struct station_parameters *params, 1380 enum cfg80211_station_type statype); 1381 1382 /** 1383 * enum station_info_rate_flags - bitrate info flags 1384 * 1385 * Used by the driver to indicate the specific rate transmission 1386 * type for 802.11n transmissions. 1387 * 1388 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 1389 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 1390 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 1391 * @RATE_INFO_FLAGS_DMG: 60GHz MCS 1392 * @RATE_INFO_FLAGS_HE_MCS: HE MCS information 1393 * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode 1394 */ 1395 enum rate_info_flags { 1396 RATE_INFO_FLAGS_MCS = BIT(0), 1397 RATE_INFO_FLAGS_VHT_MCS = BIT(1), 1398 RATE_INFO_FLAGS_SHORT_GI = BIT(2), 1399 RATE_INFO_FLAGS_DMG = BIT(3), 1400 RATE_INFO_FLAGS_HE_MCS = BIT(4), 1401 RATE_INFO_FLAGS_EDMG = BIT(5), 1402 }; 1403 1404 /** 1405 * enum rate_info_bw - rate bandwidth information 1406 * 1407 * Used by the driver to indicate the rate bandwidth. 1408 * 1409 * @RATE_INFO_BW_5: 5 MHz bandwidth 1410 * @RATE_INFO_BW_10: 10 MHz bandwidth 1411 * @RATE_INFO_BW_20: 20 MHz bandwidth 1412 * @RATE_INFO_BW_40: 40 MHz bandwidth 1413 * @RATE_INFO_BW_80: 80 MHz bandwidth 1414 * @RATE_INFO_BW_160: 160 MHz bandwidth 1415 * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation 1416 */ 1417 enum rate_info_bw { 1418 RATE_INFO_BW_20 = 0, 1419 RATE_INFO_BW_5, 1420 RATE_INFO_BW_10, 1421 RATE_INFO_BW_40, 1422 RATE_INFO_BW_80, 1423 RATE_INFO_BW_160, 1424 RATE_INFO_BW_HE_RU, 1425 }; 1426 1427 /** 1428 * struct rate_info - bitrate information 1429 * 1430 * Information about a receiving or transmitting bitrate 1431 * 1432 * @flags: bitflag of flags from &enum rate_info_flags 1433 * @mcs: mcs index if struct describes an HT/VHT/HE rate 1434 * @legacy: bitrate in 100kbit/s for 802.11abg 1435 * @nss: number of streams (VHT & HE only) 1436 * @bw: bandwidth (from &enum rate_info_bw) 1437 * @he_gi: HE guard interval (from &enum nl80211_he_gi) 1438 * @he_dcm: HE DCM value 1439 * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc, 1440 * only valid if bw is %RATE_INFO_BW_HE_RU) 1441 * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4) 1442 */ 1443 struct rate_info { 1444 u8 flags; 1445 u8 mcs; 1446 u16 legacy; 1447 u8 nss; 1448 u8 bw; 1449 u8 he_gi; 1450 u8 he_dcm; 1451 u8 he_ru_alloc; 1452 u8 n_bonded_ch; 1453 }; 1454 1455 /** 1456 * enum station_info_rate_flags - bitrate info flags 1457 * 1458 * Used by the driver to indicate the specific rate transmission 1459 * type for 802.11n transmissions. 1460 * 1461 * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 1462 * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 1463 * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 1464 */ 1465 enum bss_param_flags { 1466 BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 1467 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 1468 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 1469 }; 1470 1471 /** 1472 * struct sta_bss_parameters - BSS parameters for the attached station 1473 * 1474 * Information about the currently associated BSS 1475 * 1476 * @flags: bitflag of flags from &enum bss_param_flags 1477 * @dtim_period: DTIM period for the BSS 1478 * @beacon_interval: beacon interval 1479 */ 1480 struct sta_bss_parameters { 1481 u8 flags; 1482 u8 dtim_period; 1483 u16 beacon_interval; 1484 }; 1485 1486 /** 1487 * struct cfg80211_txq_stats - TXQ statistics for this TID 1488 * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to 1489 * indicate the relevant values in this struct are filled 1490 * @backlog_bytes: total number of bytes currently backlogged 1491 * @backlog_packets: total number of packets currently backlogged 1492 * @flows: number of new flows seen 1493 * @drops: total number of packets dropped 1494 * @ecn_marks: total number of packets marked with ECN CE 1495 * @overlimit: number of drops due to queue space overflow 1496 * @overmemory: number of drops due to memory limit overflow 1497 * @collisions: number of hash collisions 1498 * @tx_bytes: total number of bytes dequeued 1499 * @tx_packets: total number of packets dequeued 1500 * @max_flows: maximum number of flows supported 1501 */ 1502 struct cfg80211_txq_stats { 1503 u32 filled; 1504 u32 backlog_bytes; 1505 u32 backlog_packets; 1506 u32 flows; 1507 u32 drops; 1508 u32 ecn_marks; 1509 u32 overlimit; 1510 u32 overmemory; 1511 u32 collisions; 1512 u32 tx_bytes; 1513 u32 tx_packets; 1514 u32 max_flows; 1515 }; 1516 1517 /** 1518 * struct cfg80211_tid_stats - per-TID statistics 1519 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 1520 * indicate the relevant values in this struct are filled 1521 * @rx_msdu: number of received MSDUs 1522 * @tx_msdu: number of (attempted) transmitted MSDUs 1523 * @tx_msdu_retries: number of retries (not counting the first) for 1524 * transmitted MSDUs 1525 * @tx_msdu_failed: number of failed transmitted MSDUs 1526 * @txq_stats: TXQ statistics 1527 */ 1528 struct cfg80211_tid_stats { 1529 u32 filled; 1530 u64 rx_msdu; 1531 u64 tx_msdu; 1532 u64 tx_msdu_retries; 1533 u64 tx_msdu_failed; 1534 struct cfg80211_txq_stats txq_stats; 1535 }; 1536 1537 #define IEEE80211_MAX_CHAINS 4 1538 1539 /** 1540 * struct station_info - station information 1541 * 1542 * Station information filled by driver for get_station() and dump_station. 1543 * 1544 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to 1545 * indicate the relevant values in this struct for them 1546 * @connected_time: time(in secs) since a station is last connected 1547 * @inactive_time: time since last station activity (tx/rx) in milliseconds 1548 * @assoc_at: bootime (ns) of the last association 1549 * @rx_bytes: bytes (size of MPDUs) received from this station 1550 * @tx_bytes: bytes (size of MPDUs) transmitted to this station 1551 * @llid: mesh local link id 1552 * @plid: mesh peer link id 1553 * @plink_state: mesh peer link state 1554 * @signal: The signal strength, type depends on the wiphy's signal_type. 1555 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1556 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 1557 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1558 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 1559 * @chain_signal: per-chain signal strength of last received packet in dBm 1560 * @chain_signal_avg: per-chain signal strength average in dBm 1561 * @txrate: current unicast bitrate from this station 1562 * @rxrate: current unicast bitrate to this station 1563 * @rx_packets: packets (MSDUs & MMPDUs) received from this station 1564 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station 1565 * @tx_retries: cumulative retry counts (MPDUs) 1566 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 1567 * @rx_dropped_misc: Dropped for un-specified reason. 1568 * @bss_param: current BSS parameters 1569 * @generation: generation number for nl80211 dumps. 1570 * This number should increase every time the list of stations 1571 * changes, i.e. when a station is added or removed, so that 1572 * userspace can tell whether it got a consistent snapshot. 1573 * @assoc_req_ies: IEs from (Re)Association Request. 1574 * This is used only when in AP mode with drivers that do not use 1575 * user space MLME/SME implementation. The information is provided for 1576 * the cfg80211_new_sta() calls to notify user space of the IEs. 1577 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 1578 * @sta_flags: station flags mask & values 1579 * @beacon_loss_count: Number of times beacon loss event has triggered. 1580 * @t_offset: Time offset of the station relative to this host. 1581 * @local_pm: local mesh STA power save mode 1582 * @peer_pm: peer mesh STA power save mode 1583 * @nonpeer_pm: non-peer mesh STA power save mode 1584 * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1585 * towards this station. 1586 * @rx_beacon: number of beacons received from this peer 1587 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 1588 * from this peer 1589 * @connected_to_gate: true if mesh STA has a path to mesh gate 1590 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 1591 * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer 1592 * @airtime_weight: current airtime scheduling weight 1593 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 1594 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 1595 * Note that this doesn't use the @filled bit, but is used if non-NULL. 1596 * @ack_signal: signal strength (in dBm) of the last ACK frame. 1597 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has 1598 * been sent. 1599 * @rx_mpdu_count: number of MPDUs received from this station 1600 * @fcs_err_count: number of packets (MPDUs) received from this station with 1601 * an FCS error. This counter should be incremented only when TA of the 1602 * received packet with an FCS error matches the peer MAC address. 1603 * @airtime_link_metric: mesh airtime link metric. 1604 * @connected_to_as: true if mesh STA has a path to authentication server 1605 */ 1606 struct station_info { 1607 u64 filled; 1608 u32 connected_time; 1609 u32 inactive_time; 1610 u64 assoc_at; 1611 u64 rx_bytes; 1612 u64 tx_bytes; 1613 u16 llid; 1614 u16 plid; 1615 u8 plink_state; 1616 s8 signal; 1617 s8 signal_avg; 1618 1619 u8 chains; 1620 s8 chain_signal[IEEE80211_MAX_CHAINS]; 1621 s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 1622 1623 struct rate_info txrate; 1624 struct rate_info rxrate; 1625 u32 rx_packets; 1626 u32 tx_packets; 1627 u32 tx_retries; 1628 u32 tx_failed; 1629 u32 rx_dropped_misc; 1630 struct sta_bss_parameters bss_param; 1631 struct nl80211_sta_flag_update sta_flags; 1632 1633 int generation; 1634 1635 const u8 *assoc_req_ies; 1636 size_t assoc_req_ies_len; 1637 1638 u32 beacon_loss_count; 1639 s64 t_offset; 1640 enum nl80211_mesh_power_mode local_pm; 1641 enum nl80211_mesh_power_mode peer_pm; 1642 enum nl80211_mesh_power_mode nonpeer_pm; 1643 1644 u32 expected_throughput; 1645 1646 u64 tx_duration; 1647 u64 rx_duration; 1648 u64 rx_beacon; 1649 u8 rx_beacon_signal_avg; 1650 u8 connected_to_gate; 1651 1652 struct cfg80211_tid_stats *pertid; 1653 s8 ack_signal; 1654 s8 avg_ack_signal; 1655 1656 u16 airtime_weight; 1657 1658 u32 rx_mpdu_count; 1659 u32 fcs_err_count; 1660 1661 u32 airtime_link_metric; 1662 1663 u8 connected_to_as; 1664 }; 1665 1666 #if IS_ENABLED(CONFIG_CFG80211) 1667 /** 1668 * cfg80211_get_station - retrieve information about a given station 1669 * @dev: the device where the station is supposed to be connected to 1670 * @mac_addr: the mac address of the station of interest 1671 * @sinfo: pointer to the structure to fill with the information 1672 * 1673 * Returns 0 on success and sinfo is filled with the available information 1674 * otherwise returns a negative error code and the content of sinfo has to be 1675 * considered undefined. 1676 */ 1677 int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 1678 struct station_info *sinfo); 1679 #else 1680 static inline int cfg80211_get_station(struct net_device *dev, 1681 const u8 *mac_addr, 1682 struct station_info *sinfo) 1683 { 1684 return -ENOENT; 1685 } 1686 #endif 1687 1688 /** 1689 * enum monitor_flags - monitor flags 1690 * 1691 * Monitor interface configuration flags. Note that these must be the bits 1692 * according to the nl80211 flags. 1693 * 1694 * @MONITOR_FLAG_CHANGED: set if the flags were changed 1695 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 1696 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 1697 * @MONITOR_FLAG_CONTROL: pass control frames 1698 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 1699 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 1700 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 1701 */ 1702 enum monitor_flags { 1703 MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID, 1704 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 1705 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 1706 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 1707 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 1708 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 1709 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 1710 }; 1711 1712 /** 1713 * enum mpath_info_flags - mesh path information flags 1714 * 1715 * Used by the driver to indicate which info in &struct mpath_info it has filled 1716 * in during get_station() or dump_station(). 1717 * 1718 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 1719 * @MPATH_INFO_SN: @sn filled 1720 * @MPATH_INFO_METRIC: @metric filled 1721 * @MPATH_INFO_EXPTIME: @exptime filled 1722 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 1723 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 1724 * @MPATH_INFO_FLAGS: @flags filled 1725 * @MPATH_INFO_HOP_COUNT: @hop_count filled 1726 * @MPATH_INFO_PATH_CHANGE: @path_change_count filled 1727 */ 1728 enum mpath_info_flags { 1729 MPATH_INFO_FRAME_QLEN = BIT(0), 1730 MPATH_INFO_SN = BIT(1), 1731 MPATH_INFO_METRIC = BIT(2), 1732 MPATH_INFO_EXPTIME = BIT(3), 1733 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 1734 MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 1735 MPATH_INFO_FLAGS = BIT(6), 1736 MPATH_INFO_HOP_COUNT = BIT(7), 1737 MPATH_INFO_PATH_CHANGE = BIT(8), 1738 }; 1739 1740 /** 1741 * struct mpath_info - mesh path information 1742 * 1743 * Mesh path information filled by driver for get_mpath() and dump_mpath(). 1744 * 1745 * @filled: bitfield of flags from &enum mpath_info_flags 1746 * @frame_qlen: number of queued frames for this destination 1747 * @sn: target sequence number 1748 * @metric: metric (cost) of this mesh path 1749 * @exptime: expiration time for the mesh path from now, in msecs 1750 * @flags: mesh path flags 1751 * @discovery_timeout: total mesh path discovery timeout, in msecs 1752 * @discovery_retries: mesh path discovery retries 1753 * @generation: generation number for nl80211 dumps. 1754 * This number should increase every time the list of mesh paths 1755 * changes, i.e. when a station is added or removed, so that 1756 * userspace can tell whether it got a consistent snapshot. 1757 * @hop_count: hops to destination 1758 * @path_change_count: total number of path changes to destination 1759 */ 1760 struct mpath_info { 1761 u32 filled; 1762 u32 frame_qlen; 1763 u32 sn; 1764 u32 metric; 1765 u32 exptime; 1766 u32 discovery_timeout; 1767 u8 discovery_retries; 1768 u8 flags; 1769 u8 hop_count; 1770 u32 path_change_count; 1771 1772 int generation; 1773 }; 1774 1775 /** 1776 * struct bss_parameters - BSS parameters 1777 * 1778 * Used to change BSS parameters (mainly for AP mode). 1779 * 1780 * @use_cts_prot: Whether to use CTS protection 1781 * (0 = no, 1 = yes, -1 = do not change) 1782 * @use_short_preamble: Whether the use of short preambles is allowed 1783 * (0 = no, 1 = yes, -1 = do not change) 1784 * @use_short_slot_time: Whether the use of short slot time is allowed 1785 * (0 = no, 1 = yes, -1 = do not change) 1786 * @basic_rates: basic rates in IEEE 802.11 format 1787 * (or NULL for no change) 1788 * @basic_rates_len: number of basic rates 1789 * @ap_isolate: do not forward packets between connected stations 1790 * @ht_opmode: HT Operation mode 1791 * (u16 = opmode, -1 = do not change) 1792 * @p2p_ctwindow: P2P CT Window (-1 = no change) 1793 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 1794 */ 1795 struct bss_parameters { 1796 int use_cts_prot; 1797 int use_short_preamble; 1798 int use_short_slot_time; 1799 const u8 *basic_rates; 1800 u8 basic_rates_len; 1801 int ap_isolate; 1802 int ht_opmode; 1803 s8 p2p_ctwindow, p2p_opp_ps; 1804 }; 1805 1806 /** 1807 * struct mesh_config - 802.11s mesh configuration 1808 * 1809 * These parameters can be changed while the mesh is active. 1810 * 1811 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 1812 * by the Mesh Peering Open message 1813 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 1814 * used by the Mesh Peering Open message 1815 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 1816 * the mesh peering management to close a mesh peering 1817 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 1818 * mesh interface 1819 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 1820 * be sent to establish a new peer link instance in a mesh 1821 * @dot11MeshTTL: the value of TTL field set at a source mesh STA 1822 * @element_ttl: the value of TTL field set at a mesh STA for path selection 1823 * elements 1824 * @auto_open_plinks: whether we should automatically open peer links when we 1825 * detect compatible mesh peers 1826 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 1827 * synchronize to for 11s default synchronization method 1828 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 1829 * that an originator mesh STA can send to a particular path target 1830 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 1831 * @min_discovery_timeout: the minimum length of time to wait until giving up on 1832 * a path discovery in milliseconds 1833 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 1834 * receiving a PREQ shall consider the forwarding information from the 1835 * root to be valid. (TU = time unit) 1836 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 1837 * which a mesh STA can send only one action frame containing a PREQ 1838 * element 1839 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 1840 * which a mesh STA can send only one Action frame containing a PERR 1841 * element 1842 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 1843 * it takes for an HWMP information element to propagate across the mesh 1844 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 1845 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 1846 * announcements are transmitted 1847 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 1848 * station has access to a broader network beyond the MBSS. (This is 1849 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 1850 * only means that the station will announce others it's a mesh gate, but 1851 * not necessarily using the gate announcement protocol. Still keeping the 1852 * same nomenclature to be in sync with the spec) 1853 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 1854 * entity (default is TRUE - forwarding entity) 1855 * @rssi_threshold: the threshold for average signal strength of candidate 1856 * station to establish a peer link 1857 * @ht_opmode: mesh HT protection mode 1858 * 1859 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 1860 * receiving a proactive PREQ shall consider the forwarding information to 1861 * the root mesh STA to be valid. 1862 * 1863 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 1864 * PREQs are transmitted. 1865 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1866 * during which a mesh STA can send only one Action frame containing 1867 * a PREQ element for root path confirmation. 1868 * @power_mode: The default mesh power save mode which will be the initial 1869 * setting for new peer links. 1870 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 1871 * after transmitting its beacon. 1872 * @plink_timeout: If no tx activity is seen from a STA we've established 1873 * peering with for longer than this time (in seconds), then remove it 1874 * from the STA's list of peers. Default is 30 minutes. 1875 * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is 1876 * connected to a mesh gate in mesh formation info. If false, the 1877 * value in mesh formation is determined by the presence of root paths 1878 * in the mesh path table 1879 * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP 1880 * for HWMP) if the destination is a direct neighbor. Note that this might 1881 * not be the optimal decision as a multi-hop route might be better. So 1882 * if using this setting you will likely also want to disable 1883 * dot11MeshForwarding and use another mesh routing protocol on top. 1884 */ 1885 struct mesh_config { 1886 u16 dot11MeshRetryTimeout; 1887 u16 dot11MeshConfirmTimeout; 1888 u16 dot11MeshHoldingTimeout; 1889 u16 dot11MeshMaxPeerLinks; 1890 u8 dot11MeshMaxRetries; 1891 u8 dot11MeshTTL; 1892 u8 element_ttl; 1893 bool auto_open_plinks; 1894 u32 dot11MeshNbrOffsetMaxNeighbor; 1895 u8 dot11MeshHWMPmaxPREQretries; 1896 u32 path_refresh_time; 1897 u16 min_discovery_timeout; 1898 u32 dot11MeshHWMPactivePathTimeout; 1899 u16 dot11MeshHWMPpreqMinInterval; 1900 u16 dot11MeshHWMPperrMinInterval; 1901 u16 dot11MeshHWMPnetDiameterTraversalTime; 1902 u8 dot11MeshHWMPRootMode; 1903 bool dot11MeshConnectedToMeshGate; 1904 bool dot11MeshConnectedToAuthServer; 1905 u16 dot11MeshHWMPRannInterval; 1906 bool dot11MeshGateAnnouncementProtocol; 1907 bool dot11MeshForwarding; 1908 s32 rssi_threshold; 1909 u16 ht_opmode; 1910 u32 dot11MeshHWMPactivePathToRootTimeout; 1911 u16 dot11MeshHWMProotInterval; 1912 u16 dot11MeshHWMPconfirmationInterval; 1913 enum nl80211_mesh_power_mode power_mode; 1914 u16 dot11MeshAwakeWindowDuration; 1915 u32 plink_timeout; 1916 bool dot11MeshNolearn; 1917 }; 1918 1919 /** 1920 * struct mesh_setup - 802.11s mesh setup configuration 1921 * @chandef: defines the channel to use 1922 * @mesh_id: the mesh ID 1923 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1924 * @sync_method: which synchronization method to use 1925 * @path_sel_proto: which path selection protocol to use 1926 * @path_metric: which metric to use 1927 * @auth_id: which authentication method this mesh is using 1928 * @ie: vendor information elements (optional) 1929 * @ie_len: length of vendor information elements 1930 * @is_authenticated: this mesh requires authentication 1931 * @is_secure: this mesh uses security 1932 * @user_mpm: userspace handles all MPM functions 1933 * @dtim_period: DTIM period to use 1934 * @beacon_interval: beacon interval to use 1935 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1936 * @basic_rates: basic rates to use when creating the mesh 1937 * @beacon_rate: bitrate to be used for beacons 1938 * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 1939 * changes the channel when a radar is detected. This is required 1940 * to operate on DFS channels. 1941 * @control_port_over_nl80211: TRUE if userspace expects to exchange control 1942 * port frames over NL80211 instead of the network interface. 1943 * 1944 * These parameters are fixed when the mesh is created. 1945 */ 1946 struct mesh_setup { 1947 struct cfg80211_chan_def chandef; 1948 const u8 *mesh_id; 1949 u8 mesh_id_len; 1950 u8 sync_method; 1951 u8 path_sel_proto; 1952 u8 path_metric; 1953 u8 auth_id; 1954 const u8 *ie; 1955 u8 ie_len; 1956 bool is_authenticated; 1957 bool is_secure; 1958 bool user_mpm; 1959 u8 dtim_period; 1960 u16 beacon_interval; 1961 int mcast_rate[NUM_NL80211_BANDS]; 1962 u32 basic_rates; 1963 struct cfg80211_bitrate_mask beacon_rate; 1964 bool userspace_handles_dfs; 1965 bool control_port_over_nl80211; 1966 }; 1967 1968 /** 1969 * struct ocb_setup - 802.11p OCB mode setup configuration 1970 * @chandef: defines the channel to use 1971 * 1972 * These parameters are fixed when connecting to the network 1973 */ 1974 struct ocb_setup { 1975 struct cfg80211_chan_def chandef; 1976 }; 1977 1978 /** 1979 * struct ieee80211_txq_params - TX queue parameters 1980 * @ac: AC identifier 1981 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 1982 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 1983 * 1..32767] 1984 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 1985 * 1..32767] 1986 * @aifs: Arbitration interframe space [0..255] 1987 */ 1988 struct ieee80211_txq_params { 1989 enum nl80211_ac ac; 1990 u16 txop; 1991 u16 cwmin; 1992 u16 cwmax; 1993 u8 aifs; 1994 }; 1995 1996 /** 1997 * DOC: Scanning and BSS list handling 1998 * 1999 * The scanning process itself is fairly simple, but cfg80211 offers quite 2000 * a bit of helper functionality. To start a scan, the scan operation will 2001 * be invoked with a scan definition. This scan definition contains the 2002 * channels to scan, and the SSIDs to send probe requests for (including the 2003 * wildcard, if desired). A passive scan is indicated by having no SSIDs to 2004 * probe. Additionally, a scan request may contain extra information elements 2005 * that should be added to the probe request. The IEs are guaranteed to be 2006 * well-formed, and will not exceed the maximum length the driver advertised 2007 * in the wiphy structure. 2008 * 2009 * When scanning finds a BSS, cfg80211 needs to be notified of that, because 2010 * it is responsible for maintaining the BSS list; the driver should not 2011 * maintain a list itself. For this notification, various functions exist. 2012 * 2013 * Since drivers do not maintain a BSS list, there are also a number of 2014 * functions to search for a BSS and obtain information about it from the 2015 * BSS structure cfg80211 maintains. The BSS list is also made available 2016 * to userspace. 2017 */ 2018 2019 /** 2020 * struct cfg80211_ssid - SSID description 2021 * @ssid: the SSID 2022 * @ssid_len: length of the ssid 2023 */ 2024 struct cfg80211_ssid { 2025 u8 ssid[IEEE80211_MAX_SSID_LEN]; 2026 u8 ssid_len; 2027 }; 2028 2029 /** 2030 * struct cfg80211_scan_info - information about completed scan 2031 * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the 2032 * wireless device that requested the scan is connected to. If this 2033 * information is not available, this field is left zero. 2034 * @tsf_bssid: the BSSID according to which %scan_start_tsf is set. 2035 * @aborted: set to true if the scan was aborted for any reason, 2036 * userspace will be notified of that 2037 */ 2038 struct cfg80211_scan_info { 2039 u64 scan_start_tsf; 2040 u8 tsf_bssid[ETH_ALEN] __aligned(2); 2041 bool aborted; 2042 }; 2043 2044 /** 2045 * struct cfg80211_scan_request - scan request description 2046 * 2047 * @ssids: SSIDs to scan for (active scan only) 2048 * @n_ssids: number of SSIDs 2049 * @channels: channels to scan on. 2050 * @n_channels: total number of channels to scan 2051 * @scan_width: channel width for scanning 2052 * @ie: optional information element(s) to add into Probe Request or %NULL 2053 * @ie_len: length of ie in octets 2054 * @duration: how long to listen on each channel, in TUs. If 2055 * %duration_mandatory is not set, this is the maximum dwell time and 2056 * the actual dwell time may be shorter. 2057 * @duration_mandatory: if set, the scan duration must be as specified by the 2058 * %duration field. 2059 * @flags: bit field of flags controlling operation 2060 * @rates: bitmap of rates to advertise for each band 2061 * @wiphy: the wiphy this was for 2062 * @scan_start: time (in jiffies) when the scan started 2063 * @wdev: the wireless device to scan for 2064 * @info: (internal) information about completed scan 2065 * @notified: (internal) scan request was notified as done or aborted 2066 * @no_cck: used to send probe requests at non CCK rate in 2GHz band 2067 * @mac_addr: MAC address used with randomisation 2068 * @mac_addr_mask: MAC address mask used with randomisation, bits that 2069 * are 0 in the mask should be randomised, bits that are 1 should 2070 * be taken from the @mac_addr 2071 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID) 2072 */ 2073 struct cfg80211_scan_request { 2074 struct cfg80211_ssid *ssids; 2075 int n_ssids; 2076 u32 n_channels; 2077 enum nl80211_bss_scan_width scan_width; 2078 const u8 *ie; 2079 size_t ie_len; 2080 u16 duration; 2081 bool duration_mandatory; 2082 u32 flags; 2083 2084 u32 rates[NUM_NL80211_BANDS]; 2085 2086 struct wireless_dev *wdev; 2087 2088 u8 mac_addr[ETH_ALEN] __aligned(2); 2089 u8 mac_addr_mask[ETH_ALEN] __aligned(2); 2090 u8 bssid[ETH_ALEN] __aligned(2); 2091 2092 /* internal */ 2093 struct wiphy *wiphy; 2094 unsigned long scan_start; 2095 struct cfg80211_scan_info info; 2096 bool notified; 2097 bool no_cck; 2098 2099 /* keep last */ 2100 struct ieee80211_channel *channels[]; 2101 }; 2102 2103 static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 2104 { 2105 int i; 2106 2107 get_random_bytes(buf, ETH_ALEN); 2108 for (i = 0; i < ETH_ALEN; i++) { 2109 buf[i] &= ~mask[i]; 2110 buf[i] |= addr[i] & mask[i]; 2111 } 2112 } 2113 2114 /** 2115 * struct cfg80211_match_set - sets of attributes to match 2116 * 2117 * @ssid: SSID to be matched; may be zero-length in case of BSSID match 2118 * or no match (RSSI only) 2119 * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match 2120 * or no match (RSSI only) 2121 * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 2122 * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied 2123 * for filtering out scan results received. Drivers advertize this support 2124 * of band specific rssi based filtering through the feature capability 2125 * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band 2126 * specific rssi thresholds take precedence over rssi_thold, if specified. 2127 * If not specified for any band, it will be assigned with rssi_thold of 2128 * corresponding matchset. 2129 */ 2130 struct cfg80211_match_set { 2131 struct cfg80211_ssid ssid; 2132 u8 bssid[ETH_ALEN]; 2133 s32 rssi_thold; 2134 s32 per_band_rssi_thold[NUM_NL80211_BANDS]; 2135 }; 2136 2137 /** 2138 * struct cfg80211_sched_scan_plan - scan plan for scheduled scan 2139 * 2140 * @interval: interval between scheduled scan iterations. In seconds. 2141 * @iterations: number of scan iterations in this scan plan. Zero means 2142 * infinite loop. 2143 * The last scan plan will always have this parameter set to zero, 2144 * all other scan plans will have a finite number of iterations. 2145 */ 2146 struct cfg80211_sched_scan_plan { 2147 u32 interval; 2148 u32 iterations; 2149 }; 2150 2151 /** 2152 * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment. 2153 * 2154 * @band: band of BSS which should match for RSSI level adjustment. 2155 * @delta: value of RSSI level adjustment. 2156 */ 2157 struct cfg80211_bss_select_adjust { 2158 enum nl80211_band band; 2159 s8 delta; 2160 }; 2161 2162 /** 2163 * struct cfg80211_sched_scan_request - scheduled scan request description 2164 * 2165 * @reqid: identifies this request. 2166 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 2167 * @n_ssids: number of SSIDs 2168 * @n_channels: total number of channels to scan 2169 * @scan_width: channel width for scanning 2170 * @ie: optional information element(s) to add into Probe Request or %NULL 2171 * @ie_len: length of ie in octets 2172 * @flags: bit field of flags controlling operation 2173 * @match_sets: sets of parameters to be matched for a scan result 2174 * entry to be considered valid and to be passed to the host 2175 * (others are filtered out). 2176 * If ommited, all results are passed. 2177 * @n_match_sets: number of match sets 2178 * @report_results: indicates that results were reported for this request 2179 * @wiphy: the wiphy this was for 2180 * @dev: the interface 2181 * @scan_start: start time of the scheduled scan 2182 * @channels: channels to scan 2183 * @min_rssi_thold: for drivers only supporting a single threshold, this 2184 * contains the minimum over all matchsets 2185 * @mac_addr: MAC address used with randomisation 2186 * @mac_addr_mask: MAC address mask used with randomisation, bits that 2187 * are 0 in the mask should be randomised, bits that are 1 should 2188 * be taken from the @mac_addr 2189 * @scan_plans: scan plans to be executed in this scheduled scan. Lowest 2190 * index must be executed first. 2191 * @n_scan_plans: number of scan plans, at least 1. 2192 * @rcu_head: RCU callback used to free the struct 2193 * @owner_nlportid: netlink portid of owner (if this should is a request 2194 * owned by a particular socket) 2195 * @nl_owner_dead: netlink owner socket was closed - this request be freed 2196 * @list: for keeping list of requests. 2197 * @delay: delay in seconds to use before starting the first scan 2198 * cycle. The driver may ignore this parameter and start 2199 * immediately (or at any other time), if this feature is not 2200 * supported. 2201 * @relative_rssi_set: Indicates whether @relative_rssi is set or not. 2202 * @relative_rssi: Relative RSSI threshold in dB to restrict scan result 2203 * reporting in connected state to cases where a matching BSS is determined 2204 * to have better or slightly worse RSSI than the current connected BSS. 2205 * The relative RSSI threshold values are ignored in disconnected state. 2206 * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong 2207 * to the specified band while deciding whether a better BSS is reported 2208 * using @relative_rssi. If delta is a negative number, the BSSs that 2209 * belong to the specified band will be penalized by delta dB in relative 2210 * comparisions. 2211 */ 2212 struct cfg80211_sched_scan_request { 2213 u64 reqid; 2214 struct cfg80211_ssid *ssids; 2215 int n_ssids; 2216 u32 n_channels; 2217 enum nl80211_bss_scan_width scan_width; 2218 const u8 *ie; 2219 size_t ie_len; 2220 u32 flags; 2221 struct cfg80211_match_set *match_sets; 2222 int n_match_sets; 2223 s32 min_rssi_thold; 2224 u32 delay; 2225 struct cfg80211_sched_scan_plan *scan_plans; 2226 int n_scan_plans; 2227 2228 u8 mac_addr[ETH_ALEN] __aligned(2); 2229 u8 mac_addr_mask[ETH_ALEN] __aligned(2); 2230 2231 bool relative_rssi_set; 2232 s8 relative_rssi; 2233 struct cfg80211_bss_select_adjust rssi_adjust; 2234 2235 /* internal */ 2236 struct wiphy *wiphy; 2237 struct net_device *dev; 2238 unsigned long scan_start; 2239 bool report_results; 2240 struct rcu_head rcu_head; 2241 u32 owner_nlportid; 2242 bool nl_owner_dead; 2243 struct list_head list; 2244 2245 /* keep last */ 2246 struct ieee80211_channel *channels[]; 2247 }; 2248 2249 /** 2250 * enum cfg80211_signal_type - signal type 2251 * 2252 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 2253 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 2254 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 2255 */ 2256 enum cfg80211_signal_type { 2257 CFG80211_SIGNAL_TYPE_NONE, 2258 CFG80211_SIGNAL_TYPE_MBM, 2259 CFG80211_SIGNAL_TYPE_UNSPEC, 2260 }; 2261 2262 /** 2263 * struct cfg80211_inform_bss - BSS inform data 2264 * @chan: channel the frame was received on 2265 * @scan_width: scan width that was used 2266 * @signal: signal strength value, according to the wiphy's 2267 * signal type 2268 * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was 2269 * received; should match the time when the frame was actually 2270 * received by the device (not just by the host, in case it was 2271 * buffered on the device) and be accurate to about 10ms. 2272 * If the frame isn't buffered, just passing the return value of 2273 * ktime_get_boottime_ns() is likely appropriate. 2274 * @parent_tsf: the time at the start of reception of the first octet of the 2275 * timestamp field of the frame. The time is the TSF of the BSS specified 2276 * by %parent_bssid. 2277 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to 2278 * the BSS that requested the scan in which the beacon/probe was received. 2279 * @chains: bitmask for filled values in @chain_signal. 2280 * @chain_signal: per-chain signal strength of last received BSS in dBm. 2281 */ 2282 struct cfg80211_inform_bss { 2283 struct ieee80211_channel *chan; 2284 enum nl80211_bss_scan_width scan_width; 2285 s32 signal; 2286 u64 boottime_ns; 2287 u64 parent_tsf; 2288 u8 parent_bssid[ETH_ALEN] __aligned(2); 2289 u8 chains; 2290 s8 chain_signal[IEEE80211_MAX_CHAINS]; 2291 }; 2292 2293 /** 2294 * struct cfg80211_bss_ies - BSS entry IE data 2295 * @tsf: TSF contained in the frame that carried these IEs 2296 * @rcu_head: internal use, for freeing 2297 * @len: length of the IEs 2298 * @from_beacon: these IEs are known to come from a beacon 2299 * @data: IE data 2300 */ 2301 struct cfg80211_bss_ies { 2302 u64 tsf; 2303 struct rcu_head rcu_head; 2304 int len; 2305 bool from_beacon; 2306 u8 data[]; 2307 }; 2308 2309 /** 2310 * struct cfg80211_bss - BSS description 2311 * 2312 * This structure describes a BSS (which may also be a mesh network) 2313 * for use in scan results and similar. 2314 * 2315 * @channel: channel this BSS is on 2316 * @scan_width: width of the control channel 2317 * @bssid: BSSID of the BSS 2318 * @beacon_interval: the beacon interval as from the frame 2319 * @capability: the capability field in host byte order 2320 * @ies: the information elements (Note that there is no guarantee that these 2321 * are well-formed!); this is a pointer to either the beacon_ies or 2322 * proberesp_ies depending on whether Probe Response frame has been 2323 * received. It is always non-%NULL. 2324 * @beacon_ies: the information elements from the last Beacon frame 2325 * (implementation note: if @hidden_beacon_bss is set this struct doesn't 2326 * own the beacon_ies, but they're just pointers to the ones from the 2327 * @hidden_beacon_bss struct) 2328 * @proberesp_ies: the information elements from the last Probe Response frame 2329 * @hidden_beacon_bss: in case this BSS struct represents a probe response from 2330 * a BSS that hides the SSID in its beacon, this points to the BSS struct 2331 * that holds the beacon data. @beacon_ies is still valid, of course, and 2332 * points to the same data as hidden_beacon_bss->beacon_ies in that case. 2333 * @transmitted_bss: pointer to the transmitted BSS, if this is a 2334 * non-transmitted one (multi-BSSID support) 2335 * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one 2336 * (multi-BSSID support) 2337 * @signal: signal strength value (type depends on the wiphy's signal_type) 2338 * @chains: bitmask for filled values in @chain_signal. 2339 * @chain_signal: per-chain signal strength of last received BSS in dBm. 2340 * @bssid_index: index in the multiple BSS set 2341 * @max_bssid_indicator: max number of members in the BSS set 2342 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 2343 */ 2344 struct cfg80211_bss { 2345 struct ieee80211_channel *channel; 2346 enum nl80211_bss_scan_width scan_width; 2347 2348 const struct cfg80211_bss_ies __rcu *ies; 2349 const struct cfg80211_bss_ies __rcu *beacon_ies; 2350 const struct cfg80211_bss_ies __rcu *proberesp_ies; 2351 2352 struct cfg80211_bss *hidden_beacon_bss; 2353 struct cfg80211_bss *transmitted_bss; 2354 struct list_head nontrans_list; 2355 2356 s32 signal; 2357 2358 u16 beacon_interval; 2359 u16 capability; 2360 2361 u8 bssid[ETH_ALEN]; 2362 u8 chains; 2363 s8 chain_signal[IEEE80211_MAX_CHAINS]; 2364 2365 u8 bssid_index; 2366 u8 max_bssid_indicator; 2367 2368 u8 priv[] __aligned(sizeof(void *)); 2369 }; 2370 2371 /** 2372 * ieee80211_bss_get_elem - find element with given ID 2373 * @bss: the bss to search 2374 * @id: the element ID 2375 * 2376 * Note that the return value is an RCU-protected pointer, so 2377 * rcu_read_lock() must be held when calling this function. 2378 * Return: %NULL if not found. 2379 */ 2380 const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id); 2381 2382 /** 2383 * ieee80211_bss_get_ie - find IE with given ID 2384 * @bss: the bss to search 2385 * @id: the element ID 2386 * 2387 * Note that the return value is an RCU-protected pointer, so 2388 * rcu_read_lock() must be held when calling this function. 2389 * Return: %NULL if not found. 2390 */ 2391 static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id) 2392 { 2393 return (void *)ieee80211_bss_get_elem(bss, id); 2394 } 2395 2396 2397 /** 2398 * struct cfg80211_auth_request - Authentication request data 2399 * 2400 * This structure provides information needed to complete IEEE 802.11 2401 * authentication. 2402 * 2403 * @bss: The BSS to authenticate with, the callee must obtain a reference 2404 * to it if it needs to keep it. 2405 * @auth_type: Authentication type (algorithm) 2406 * @ie: Extra IEs to add to Authentication frame or %NULL 2407 * @ie_len: Length of ie buffer in octets 2408 * @key_len: length of WEP key for shared key authentication 2409 * @key_idx: index of WEP key for shared key authentication 2410 * @key: WEP key for shared key authentication 2411 * @auth_data: Fields and elements in Authentication frames. This contains 2412 * the authentication frame body (non-IE and IE data), excluding the 2413 * Authentication algorithm number, i.e., starting at the Authentication 2414 * transaction sequence number field. 2415 * @auth_data_len: Length of auth_data buffer in octets 2416 */ 2417 struct cfg80211_auth_request { 2418 struct cfg80211_bss *bss; 2419 const u8 *ie; 2420 size_t ie_len; 2421 enum nl80211_auth_type auth_type; 2422 const u8 *key; 2423 u8 key_len, key_idx; 2424 const u8 *auth_data; 2425 size_t auth_data_len; 2426 }; 2427 2428 /** 2429 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 2430 * 2431 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 2432 * @ASSOC_REQ_DISABLE_VHT: Disable VHT 2433 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 2434 * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external 2435 * authentication capability. Drivers can offload authentication to 2436 * userspace if this flag is set. Only applicable for cfg80211_connect() 2437 * request (connect callback). 2438 */ 2439 enum cfg80211_assoc_req_flags { 2440 ASSOC_REQ_DISABLE_HT = BIT(0), 2441 ASSOC_REQ_DISABLE_VHT = BIT(1), 2442 ASSOC_REQ_USE_RRM = BIT(2), 2443 CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3), 2444 }; 2445 2446 /** 2447 * struct cfg80211_assoc_request - (Re)Association request data 2448 * 2449 * This structure provides information needed to complete IEEE 802.11 2450 * (re)association. 2451 * @bss: The BSS to associate with. If the call is successful the driver is 2452 * given a reference that it must give back to cfg80211_send_rx_assoc() 2453 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 2454 * association requests while already associating must be rejected. 2455 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 2456 * @ie_len: Length of ie buffer in octets 2457 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 2458 * @crypto: crypto settings 2459 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 2460 * to indicate a request to reassociate within the ESS instead of a request 2461 * do the initial association with the ESS. When included, this is set to 2462 * the BSSID of the current association, i.e., to the value that is 2463 * included in the Current AP address field of the Reassociation Request 2464 * frame. 2465 * @flags: See &enum cfg80211_assoc_req_flags 2466 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 2467 * will be used in ht_capa. Un-supported values will be ignored. 2468 * @ht_capa_mask: The bits of ht_capa which are to be used. 2469 * @vht_capa: VHT capability override 2470 * @vht_capa_mask: VHT capability mask indicating which fields to use 2471 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or 2472 * %NULL if FILS is not used. 2473 * @fils_kek_len: Length of fils_kek in octets 2474 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association 2475 * Request/Response frame or %NULL if FILS is not used. This field starts 2476 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce. 2477 */ 2478 struct cfg80211_assoc_request { 2479 struct cfg80211_bss *bss; 2480 const u8 *ie, *prev_bssid; 2481 size_t ie_len; 2482 struct cfg80211_crypto_settings crypto; 2483 bool use_mfp; 2484 u32 flags; 2485 struct ieee80211_ht_cap ht_capa; 2486 struct ieee80211_ht_cap ht_capa_mask; 2487 struct ieee80211_vht_cap vht_capa, vht_capa_mask; 2488 const u8 *fils_kek; 2489 size_t fils_kek_len; 2490 const u8 *fils_nonces; 2491 }; 2492 2493 /** 2494 * struct cfg80211_deauth_request - Deauthentication request data 2495 * 2496 * This structure provides information needed to complete IEEE 802.11 2497 * deauthentication. 2498 * 2499 * @bssid: the BSSID of the BSS to deauthenticate from 2500 * @ie: Extra IEs to add to Deauthentication frame or %NULL 2501 * @ie_len: Length of ie buffer in octets 2502 * @reason_code: The reason code for the deauthentication 2503 * @local_state_change: if set, change local state only and 2504 * do not set a deauth frame 2505 */ 2506 struct cfg80211_deauth_request { 2507 const u8 *bssid; 2508 const u8 *ie; 2509 size_t ie_len; 2510 u16 reason_code; 2511 bool local_state_change; 2512 }; 2513 2514 /** 2515 * struct cfg80211_disassoc_request - Disassociation request data 2516 * 2517 * This structure provides information needed to complete IEEE 802.11 2518 * disassociation. 2519 * 2520 * @bss: the BSS to disassociate from 2521 * @ie: Extra IEs to add to Disassociation frame or %NULL 2522 * @ie_len: Length of ie buffer in octets 2523 * @reason_code: The reason code for the disassociation 2524 * @local_state_change: This is a request for a local state only, i.e., no 2525 * Disassociation frame is to be transmitted. 2526 */ 2527 struct cfg80211_disassoc_request { 2528 struct cfg80211_bss *bss; 2529 const u8 *ie; 2530 size_t ie_len; 2531 u16 reason_code; 2532 bool local_state_change; 2533 }; 2534 2535 /** 2536 * struct cfg80211_ibss_params - IBSS parameters 2537 * 2538 * This structure defines the IBSS parameters for the join_ibss() 2539 * method. 2540 * 2541 * @ssid: The SSID, will always be non-null. 2542 * @ssid_len: The length of the SSID, will always be non-zero. 2543 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 2544 * search for IBSSs with a different BSSID. 2545 * @chandef: defines the channel to use if no other IBSS to join can be found 2546 * @channel_fixed: The channel should be fixed -- do not search for 2547 * IBSSs to join on other channels. 2548 * @ie: information element(s) to include in the beacon 2549 * @ie_len: length of that 2550 * @beacon_interval: beacon interval to use 2551 * @privacy: this is a protected network, keys will be configured 2552 * after joining 2553 * @control_port: whether user space controls IEEE 802.1X port, i.e., 2554 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 2555 * required to assume that the port is unauthorized until authorized by 2556 * user space. Otherwise, port is marked authorized by default. 2557 * @control_port_over_nl80211: TRUE if userspace expects to exchange control 2558 * port frames over NL80211 instead of the network interface. 2559 * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 2560 * changes the channel when a radar is detected. This is required 2561 * to operate on DFS channels. 2562 * @basic_rates: bitmap of basic rates to use when creating the IBSS 2563 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 2564 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 2565 * will be used in ht_capa. Un-supported values will be ignored. 2566 * @ht_capa_mask: The bits of ht_capa which are to be used. 2567 * @wep_keys: static WEP keys, if not NULL points to an array of 2568 * CFG80211_MAX_WEP_KEYS WEP keys 2569 * @wep_tx_key: key index (0..3) of the default TX static WEP key 2570 */ 2571 struct cfg80211_ibss_params { 2572 const u8 *ssid; 2573 const u8 *bssid; 2574 struct cfg80211_chan_def chandef; 2575 const u8 *ie; 2576 u8 ssid_len, ie_len; 2577 u16 beacon_interval; 2578 u32 basic_rates; 2579 bool channel_fixed; 2580 bool privacy; 2581 bool control_port; 2582 bool control_port_over_nl80211; 2583 bool userspace_handles_dfs; 2584 int mcast_rate[NUM_NL80211_BANDS]; 2585 struct ieee80211_ht_cap ht_capa; 2586 struct ieee80211_ht_cap ht_capa_mask; 2587 struct key_params *wep_keys; 2588 int wep_tx_key; 2589 }; 2590 2591 /** 2592 * struct cfg80211_bss_selection - connection parameters for BSS selection. 2593 * 2594 * @behaviour: requested BSS selection behaviour. 2595 * @param: parameters for requestion behaviour. 2596 * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF. 2597 * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST. 2598 */ 2599 struct cfg80211_bss_selection { 2600 enum nl80211_bss_select_attr behaviour; 2601 union { 2602 enum nl80211_band band_pref; 2603 struct cfg80211_bss_select_adjust adjust; 2604 } param; 2605 }; 2606 2607 /** 2608 * struct cfg80211_connect_params - Connection parameters 2609 * 2610 * This structure provides information needed to complete IEEE 802.11 2611 * authentication and association. 2612 * 2613 * @channel: The channel to use or %NULL if not specified (auto-select based 2614 * on scan results) 2615 * @channel_hint: The channel of the recommended BSS for initial connection or 2616 * %NULL if not specified 2617 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 2618 * results) 2619 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 2620 * %NULL if not specified. Unlike the @bssid parameter, the driver is 2621 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 2622 * to use. 2623 * @ssid: SSID 2624 * @ssid_len: Length of ssid in octets 2625 * @auth_type: Authentication type (algorithm) 2626 * @ie: IEs for association request 2627 * @ie_len: Length of assoc_ie in octets 2628 * @privacy: indicates whether privacy-enabled APs should be used 2629 * @mfp: indicate whether management frame protection is used 2630 * @crypto: crypto settings 2631 * @key_len: length of WEP key for shared key authentication 2632 * @key_idx: index of WEP key for shared key authentication 2633 * @key: WEP key for shared key authentication 2634 * @flags: See &enum cfg80211_assoc_req_flags 2635 * @bg_scan_period: Background scan period in seconds 2636 * or -1 to indicate that default value is to be used. 2637 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 2638 * will be used in ht_capa. Un-supported values will be ignored. 2639 * @ht_capa_mask: The bits of ht_capa which are to be used. 2640 * @vht_capa: VHT Capability overrides 2641 * @vht_capa_mask: The bits of vht_capa which are to be used. 2642 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG 2643 * networks. 2644 * @bss_select: criteria to be used for BSS selection. 2645 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 2646 * to indicate a request to reassociate within the ESS instead of a request 2647 * do the initial association with the ESS. When included, this is set to 2648 * the BSSID of the current association, i.e., to the value that is 2649 * included in the Current AP address field of the Reassociation Request 2650 * frame. 2651 * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the 2652 * NAI or %NULL if not specified. This is used to construct FILS wrapped 2653 * data IE. 2654 * @fils_erp_username_len: Length of @fils_erp_username in octets. 2655 * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or 2656 * %NULL if not specified. This specifies the domain name of ER server and 2657 * is used to construct FILS wrapped data IE. 2658 * @fils_erp_realm_len: Length of @fils_erp_realm in octets. 2659 * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP 2660 * messages. This is also used to construct FILS wrapped data IE. 2661 * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional 2662 * keys in FILS or %NULL if not specified. 2663 * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets. 2664 * @want_1x: indicates user-space supports and wants to use 802.1X driver 2665 * offload of 4-way handshake. 2666 * @edmg: define the EDMG channels. 2667 * This may specify multiple channels and bonding options for the driver 2668 * to choose from, based on BSS configuration. 2669 */ 2670 struct cfg80211_connect_params { 2671 struct ieee80211_channel *channel; 2672 struct ieee80211_channel *channel_hint; 2673 const u8 *bssid; 2674 const u8 *bssid_hint; 2675 const u8 *ssid; 2676 size_t ssid_len; 2677 enum nl80211_auth_type auth_type; 2678 const u8 *ie; 2679 size_t ie_len; 2680 bool privacy; 2681 enum nl80211_mfp mfp; 2682 struct cfg80211_crypto_settings crypto; 2683 const u8 *key; 2684 u8 key_len, key_idx; 2685 u32 flags; 2686 int bg_scan_period; 2687 struct ieee80211_ht_cap ht_capa; 2688 struct ieee80211_ht_cap ht_capa_mask; 2689 struct ieee80211_vht_cap vht_capa; 2690 struct ieee80211_vht_cap vht_capa_mask; 2691 bool pbss; 2692 struct cfg80211_bss_selection bss_select; 2693 const u8 *prev_bssid; 2694 const u8 *fils_erp_username; 2695 size_t fils_erp_username_len; 2696 const u8 *fils_erp_realm; 2697 size_t fils_erp_realm_len; 2698 u16 fils_erp_next_seq_num; 2699 const u8 *fils_erp_rrk; 2700 size_t fils_erp_rrk_len; 2701 bool want_1x; 2702 struct ieee80211_edmg edmg; 2703 }; 2704 2705 /** 2706 * enum cfg80211_connect_params_changed - Connection parameters being updated 2707 * 2708 * This enum provides information of all connect parameters that 2709 * have to be updated as part of update_connect_params() call. 2710 * 2711 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated 2712 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm, 2713 * username, erp sequence number and rrk) are updated 2714 * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated 2715 */ 2716 enum cfg80211_connect_params_changed { 2717 UPDATE_ASSOC_IES = BIT(0), 2718 UPDATE_FILS_ERP_INFO = BIT(1), 2719 UPDATE_AUTH_TYPE = BIT(2), 2720 }; 2721 2722 /** 2723 * enum wiphy_params_flags - set_wiphy_params bitfield values 2724 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 2725 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 2726 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 2727 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 2728 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 2729 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 2730 * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed 2731 * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed 2732 * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum 2733 */ 2734 enum wiphy_params_flags { 2735 WIPHY_PARAM_RETRY_SHORT = 1 << 0, 2736 WIPHY_PARAM_RETRY_LONG = 1 << 1, 2737 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 2738 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 2739 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 2740 WIPHY_PARAM_DYN_ACK = 1 << 5, 2741 WIPHY_PARAM_TXQ_LIMIT = 1 << 6, 2742 WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7, 2743 WIPHY_PARAM_TXQ_QUANTUM = 1 << 8, 2744 }; 2745 2746 #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256 2747 2748 /* The per TXQ device queue limit in airtime */ 2749 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000 2750 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000 2751 2752 /* The per interface airtime threshold to switch to lower queue limit */ 2753 #define IEEE80211_AQL_THRESHOLD 24000 2754 2755 /** 2756 * struct cfg80211_pmksa - PMK Security Association 2757 * 2758 * This structure is passed to the set/del_pmksa() method for PMKSA 2759 * caching. 2760 * 2761 * @bssid: The AP's BSSID (may be %NULL). 2762 * @pmkid: The identifier to refer a PMKSA. 2763 * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key 2764 * derivation by a FILS STA. Otherwise, %NULL. 2765 * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on 2766 * the hash algorithm used to generate this. 2767 * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS 2768 * cache identifier (may be %NULL). 2769 * @ssid_len: Length of the @ssid in octets. 2770 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the 2771 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be 2772 * %NULL). 2773 * @pmk_lifetime: Maximum lifetime for PMKSA in seconds 2774 * (dot11RSNAConfigPMKLifetime) or 0 if not specified. 2775 * The configured PMKSA must not be used for PMKSA caching after 2776 * expiration and any keys derived from this PMK become invalid on 2777 * expiration, i.e., the current association must be dropped if the PMK 2778 * used for it expires. 2779 * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of 2780 * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified. 2781 * Drivers are expected to trigger a full authentication instead of using 2782 * this PMKSA for caching when reassociating to a new BSS after this 2783 * threshold to generate a new PMK before the current one expires. 2784 */ 2785 struct cfg80211_pmksa { 2786 const u8 *bssid; 2787 const u8 *pmkid; 2788 const u8 *pmk; 2789 size_t pmk_len; 2790 const u8 *ssid; 2791 size_t ssid_len; 2792 const u8 *cache_id; 2793 u32 pmk_lifetime; 2794 u8 pmk_reauth_threshold; 2795 }; 2796 2797 /** 2798 * struct cfg80211_pkt_pattern - packet pattern 2799 * @mask: bitmask where to match pattern and where to ignore bytes, 2800 * one bit per byte, in same format as nl80211 2801 * @pattern: bytes to match where bitmask is 1 2802 * @pattern_len: length of pattern (in bytes) 2803 * @pkt_offset: packet offset (in bytes) 2804 * 2805 * Internal note: @mask and @pattern are allocated in one chunk of 2806 * memory, free @mask only! 2807 */ 2808 struct cfg80211_pkt_pattern { 2809 const u8 *mask, *pattern; 2810 int pattern_len; 2811 int pkt_offset; 2812 }; 2813 2814 /** 2815 * struct cfg80211_wowlan_tcp - TCP connection parameters 2816 * 2817 * @sock: (internal) socket for source port allocation 2818 * @src: source IP address 2819 * @dst: destination IP address 2820 * @dst_mac: destination MAC address 2821 * @src_port: source port 2822 * @dst_port: destination port 2823 * @payload_len: data payload length 2824 * @payload: data payload buffer 2825 * @payload_seq: payload sequence stamping configuration 2826 * @data_interval: interval at which to send data packets 2827 * @wake_len: wakeup payload match length 2828 * @wake_data: wakeup payload match data 2829 * @wake_mask: wakeup payload match mask 2830 * @tokens_size: length of the tokens buffer 2831 * @payload_tok: payload token usage configuration 2832 */ 2833 struct cfg80211_wowlan_tcp { 2834 struct socket *sock; 2835 __be32 src, dst; 2836 u16 src_port, dst_port; 2837 u8 dst_mac[ETH_ALEN]; 2838 int payload_len; 2839 const u8 *payload; 2840 struct nl80211_wowlan_tcp_data_seq payload_seq; 2841 u32 data_interval; 2842 u32 wake_len; 2843 const u8 *wake_data, *wake_mask; 2844 u32 tokens_size; 2845 /* must be last, variable member */ 2846 struct nl80211_wowlan_tcp_data_token payload_tok; 2847 }; 2848 2849 /** 2850 * struct cfg80211_wowlan - Wake on Wireless-LAN support info 2851 * 2852 * This structure defines the enabled WoWLAN triggers for the device. 2853 * @any: wake up on any activity -- special trigger if device continues 2854 * operating as normal during suspend 2855 * @disconnect: wake up if getting disconnected 2856 * @magic_pkt: wake up on receiving magic packet 2857 * @patterns: wake up on receiving packet matching a pattern 2858 * @n_patterns: number of patterns 2859 * @gtk_rekey_failure: wake up on GTK rekey failure 2860 * @eap_identity_req: wake up on EAP identity request packet 2861 * @four_way_handshake: wake up on 4-way handshake 2862 * @rfkill_release: wake up when rfkill is released 2863 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 2864 * NULL if not configured. 2865 * @nd_config: configuration for the scan to be used for net detect wake. 2866 */ 2867 struct cfg80211_wowlan { 2868 bool any, disconnect, magic_pkt, gtk_rekey_failure, 2869 eap_identity_req, four_way_handshake, 2870 rfkill_release; 2871 struct cfg80211_pkt_pattern *patterns; 2872 struct cfg80211_wowlan_tcp *tcp; 2873 int n_patterns; 2874 struct cfg80211_sched_scan_request *nd_config; 2875 }; 2876 2877 /** 2878 * struct cfg80211_coalesce_rules - Coalesce rule parameters 2879 * 2880 * This structure defines coalesce rule for the device. 2881 * @delay: maximum coalescing delay in msecs. 2882 * @condition: condition for packet coalescence. 2883 * see &enum nl80211_coalesce_condition. 2884 * @patterns: array of packet patterns 2885 * @n_patterns: number of patterns 2886 */ 2887 struct cfg80211_coalesce_rules { 2888 int delay; 2889 enum nl80211_coalesce_condition condition; 2890 struct cfg80211_pkt_pattern *patterns; 2891 int n_patterns; 2892 }; 2893 2894 /** 2895 * struct cfg80211_coalesce - Packet coalescing settings 2896 * 2897 * This structure defines coalescing settings. 2898 * @rules: array of coalesce rules 2899 * @n_rules: number of rules 2900 */ 2901 struct cfg80211_coalesce { 2902 struct cfg80211_coalesce_rules *rules; 2903 int n_rules; 2904 }; 2905 2906 /** 2907 * struct cfg80211_wowlan_nd_match - information about the match 2908 * 2909 * @ssid: SSID of the match that triggered the wake up 2910 * @n_channels: Number of channels where the match occurred. This 2911 * value may be zero if the driver can't report the channels. 2912 * @channels: center frequencies of the channels where a match 2913 * occurred (in MHz) 2914 */ 2915 struct cfg80211_wowlan_nd_match { 2916 struct cfg80211_ssid ssid; 2917 int n_channels; 2918 u32 channels[]; 2919 }; 2920 2921 /** 2922 * struct cfg80211_wowlan_nd_info - net detect wake up information 2923 * 2924 * @n_matches: Number of match information instances provided in 2925 * @matches. This value may be zero if the driver can't provide 2926 * match information. 2927 * @matches: Array of pointers to matches containing information about 2928 * the matches that triggered the wake up. 2929 */ 2930 struct cfg80211_wowlan_nd_info { 2931 int n_matches; 2932 struct cfg80211_wowlan_nd_match *matches[]; 2933 }; 2934 2935 /** 2936 * struct cfg80211_wowlan_wakeup - wakeup report 2937 * @disconnect: woke up by getting disconnected 2938 * @magic_pkt: woke up by receiving magic packet 2939 * @gtk_rekey_failure: woke up by GTK rekey failure 2940 * @eap_identity_req: woke up by EAP identity request packet 2941 * @four_way_handshake: woke up by 4-way handshake 2942 * @rfkill_release: woke up by rfkill being released 2943 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 2944 * @packet_present_len: copied wakeup packet data 2945 * @packet_len: original wakeup packet length 2946 * @packet: The packet causing the wakeup, if any. 2947 * @packet_80211: For pattern match, magic packet and other data 2948 * frame triggers an 802.3 frame should be reported, for 2949 * disconnect due to deauth 802.11 frame. This indicates which 2950 * it is. 2951 * @tcp_match: TCP wakeup packet received 2952 * @tcp_connlost: TCP connection lost or failed to establish 2953 * @tcp_nomoretokens: TCP data ran out of tokens 2954 * @net_detect: if not %NULL, woke up because of net detect 2955 */ 2956 struct cfg80211_wowlan_wakeup { 2957 bool disconnect, magic_pkt, gtk_rekey_failure, 2958 eap_identity_req, four_way_handshake, 2959 rfkill_release, packet_80211, 2960 tcp_match, tcp_connlost, tcp_nomoretokens; 2961 s32 pattern_idx; 2962 u32 packet_present_len, packet_len; 2963 const void *packet; 2964 struct cfg80211_wowlan_nd_info *net_detect; 2965 }; 2966 2967 /** 2968 * struct cfg80211_gtk_rekey_data - rekey data 2969 * @kek: key encryption key (@kek_len bytes) 2970 * @kck: key confirmation key (@kck_len bytes) 2971 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 2972 * @kek_len: length of kek 2973 * @kck_len length of kck 2974 * @akm: akm (oui, id) 2975 */ 2976 struct cfg80211_gtk_rekey_data { 2977 const u8 *kek, *kck, *replay_ctr; 2978 u32 akm; 2979 u8 kek_len, kck_len; 2980 }; 2981 2982 /** 2983 * struct cfg80211_update_ft_ies_params - FT IE Information 2984 * 2985 * This structure provides information needed to update the fast transition IE 2986 * 2987 * @md: The Mobility Domain ID, 2 Octet value 2988 * @ie: Fast Transition IEs 2989 * @ie_len: Length of ft_ie in octets 2990 */ 2991 struct cfg80211_update_ft_ies_params { 2992 u16 md; 2993 const u8 *ie; 2994 size_t ie_len; 2995 }; 2996 2997 /** 2998 * struct cfg80211_mgmt_tx_params - mgmt tx parameters 2999 * 3000 * This structure provides information needed to transmit a mgmt frame 3001 * 3002 * @chan: channel to use 3003 * @offchan: indicates wether off channel operation is required 3004 * @wait: duration for ROC 3005 * @buf: buffer to transmit 3006 * @len: buffer length 3007 * @no_cck: don't use cck rates for this frame 3008 * @dont_wait_for_ack: tells the low level not to wait for an ack 3009 * @n_csa_offsets: length of csa_offsets array 3010 * @csa_offsets: array of all the csa offsets in the frame 3011 */ 3012 struct cfg80211_mgmt_tx_params { 3013 struct ieee80211_channel *chan; 3014 bool offchan; 3015 unsigned int wait; 3016 const u8 *buf; 3017 size_t len; 3018 bool no_cck; 3019 bool dont_wait_for_ack; 3020 int n_csa_offsets; 3021 const u16 *csa_offsets; 3022 }; 3023 3024 /** 3025 * struct cfg80211_dscp_exception - DSCP exception 3026 * 3027 * @dscp: DSCP value that does not adhere to the user priority range definition 3028 * @up: user priority value to which the corresponding DSCP value belongs 3029 */ 3030 struct cfg80211_dscp_exception { 3031 u8 dscp; 3032 u8 up; 3033 }; 3034 3035 /** 3036 * struct cfg80211_dscp_range - DSCP range definition for user priority 3037 * 3038 * @low: lowest DSCP value of this user priority range, inclusive 3039 * @high: highest DSCP value of this user priority range, inclusive 3040 */ 3041 struct cfg80211_dscp_range { 3042 u8 low; 3043 u8 high; 3044 }; 3045 3046 /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 3047 #define IEEE80211_QOS_MAP_MAX_EX 21 3048 #define IEEE80211_QOS_MAP_LEN_MIN 16 3049 #define IEEE80211_QOS_MAP_LEN_MAX \ 3050 (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 3051 3052 /** 3053 * struct cfg80211_qos_map - QoS Map Information 3054 * 3055 * This struct defines the Interworking QoS map setting for DSCP values 3056 * 3057 * @num_des: number of DSCP exceptions (0..21) 3058 * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 3059 * the user priority DSCP range definition 3060 * @up: DSCP range definition for a particular user priority 3061 */ 3062 struct cfg80211_qos_map { 3063 u8 num_des; 3064 struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 3065 struct cfg80211_dscp_range up[8]; 3066 }; 3067 3068 /** 3069 * struct cfg80211_nan_conf - NAN configuration 3070 * 3071 * This struct defines NAN configuration parameters 3072 * 3073 * @master_pref: master preference (1 - 255) 3074 * @bands: operating bands, a bitmap of &enum nl80211_band values. 3075 * For instance, for NL80211_BAND_2GHZ, bit 0 would be set 3076 * (i.e. BIT(NL80211_BAND_2GHZ)). 3077 */ 3078 struct cfg80211_nan_conf { 3079 u8 master_pref; 3080 u8 bands; 3081 }; 3082 3083 /** 3084 * enum cfg80211_nan_conf_changes - indicates changed fields in NAN 3085 * configuration 3086 * 3087 * @CFG80211_NAN_CONF_CHANGED_PREF: master preference 3088 * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands 3089 */ 3090 enum cfg80211_nan_conf_changes { 3091 CFG80211_NAN_CONF_CHANGED_PREF = BIT(0), 3092 CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1), 3093 }; 3094 3095 /** 3096 * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter 3097 * 3098 * @filter: the content of the filter 3099 * @len: the length of the filter 3100 */ 3101 struct cfg80211_nan_func_filter { 3102 const u8 *filter; 3103 u8 len; 3104 }; 3105 3106 /** 3107 * struct cfg80211_nan_func - a NAN function 3108 * 3109 * @type: &enum nl80211_nan_function_type 3110 * @service_id: the service ID of the function 3111 * @publish_type: &nl80211_nan_publish_type 3112 * @close_range: if true, the range should be limited. Threshold is 3113 * implementation specific. 3114 * @publish_bcast: if true, the solicited publish should be broadcasted 3115 * @subscribe_active: if true, the subscribe is active 3116 * @followup_id: the instance ID for follow up 3117 * @followup_reqid: the requestor instance ID for follow up 3118 * @followup_dest: MAC address of the recipient of the follow up 3119 * @ttl: time to live counter in DW. 3120 * @serv_spec_info: Service Specific Info 3121 * @serv_spec_info_len: Service Specific Info length 3122 * @srf_include: if true, SRF is inclusive 3123 * @srf_bf: Bloom Filter 3124 * @srf_bf_len: Bloom Filter length 3125 * @srf_bf_idx: Bloom Filter index 3126 * @srf_macs: SRF MAC addresses 3127 * @srf_num_macs: number of MAC addresses in SRF 3128 * @rx_filters: rx filters that are matched with corresponding peer's tx_filter 3129 * @tx_filters: filters that should be transmitted in the SDF. 3130 * @num_rx_filters: length of &rx_filters. 3131 * @num_tx_filters: length of &tx_filters. 3132 * @instance_id: driver allocated id of the function. 3133 * @cookie: unique NAN function identifier. 3134 */ 3135 struct cfg80211_nan_func { 3136 enum nl80211_nan_function_type type; 3137 u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; 3138 u8 publish_type; 3139 bool close_range; 3140 bool publish_bcast; 3141 bool subscribe_active; 3142 u8 followup_id; 3143 u8 followup_reqid; 3144 struct mac_address followup_dest; 3145 u32 ttl; 3146 const u8 *serv_spec_info; 3147 u8 serv_spec_info_len; 3148 bool srf_include; 3149 const u8 *srf_bf; 3150 u8 srf_bf_len; 3151 u8 srf_bf_idx; 3152 struct mac_address *srf_macs; 3153 int srf_num_macs; 3154 struct cfg80211_nan_func_filter *rx_filters; 3155 struct cfg80211_nan_func_filter *tx_filters; 3156 u8 num_tx_filters; 3157 u8 num_rx_filters; 3158 u8 instance_id; 3159 u64 cookie; 3160 }; 3161 3162 /** 3163 * struct cfg80211_pmk_conf - PMK configuration 3164 * 3165 * @aa: authenticator address 3166 * @pmk_len: PMK length in bytes. 3167 * @pmk: the PMK material 3168 * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK 3169 * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field 3170 * holds PMK-R0. 3171 */ 3172 struct cfg80211_pmk_conf { 3173 const u8 *aa; 3174 u8 pmk_len; 3175 const u8 *pmk; 3176 const u8 *pmk_r0_name; 3177 }; 3178 3179 /** 3180 * struct cfg80211_external_auth_params - Trigger External authentication. 3181 * 3182 * Commonly used across the external auth request and event interfaces. 3183 * 3184 * @action: action type / trigger for external authentication. Only significant 3185 * for the authentication request event interface (driver to user space). 3186 * @bssid: BSSID of the peer with which the authentication has 3187 * to happen. Used by both the authentication request event and 3188 * authentication response command interface. 3189 * @ssid: SSID of the AP. Used by both the authentication request event and 3190 * authentication response command interface. 3191 * @key_mgmt_suite: AKM suite of the respective authentication. Used by the 3192 * authentication request event interface. 3193 * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication, 3194 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you 3195 * the real status code for failures. Used only for the authentication 3196 * response command interface (user space to driver). 3197 * @pmkid: The identifier to refer a PMKSA. 3198 */ 3199 struct cfg80211_external_auth_params { 3200 enum nl80211_external_auth_action action; 3201 u8 bssid[ETH_ALEN] __aligned(2); 3202 struct cfg80211_ssid ssid; 3203 unsigned int key_mgmt_suite; 3204 u16 status; 3205 const u8 *pmkid; 3206 }; 3207 3208 /** 3209 * struct cfg80211_ftm_responder_stats - FTM responder statistics 3210 * 3211 * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to 3212 * indicate the relevant values in this struct for them 3213 * @success_num: number of FTM sessions in which all frames were successfully 3214 * answered 3215 * @partial_num: number of FTM sessions in which part of frames were 3216 * successfully answered 3217 * @failed_num: number of failed FTM sessions 3218 * @asap_num: number of ASAP FTM sessions 3219 * @non_asap_num: number of non-ASAP FTM sessions 3220 * @total_duration_ms: total sessions durations - gives an indication 3221 * of how much time the responder was busy 3222 * @unknown_triggers_num: number of unknown FTM triggers - triggers from 3223 * initiators that didn't finish successfully the negotiation phase with 3224 * the responder 3225 * @reschedule_requests_num: number of FTM reschedule requests - initiator asks 3226 * for a new scheduling although it already has scheduled FTM slot 3227 * @out_of_window_triggers_num: total FTM triggers out of scheduled window 3228 */ 3229 struct cfg80211_ftm_responder_stats { 3230 u32 filled; 3231 u32 success_num; 3232 u32 partial_num; 3233 u32 failed_num; 3234 u32 asap_num; 3235 u32 non_asap_num; 3236 u64 total_duration_ms; 3237 u32 unknown_triggers_num; 3238 u32 reschedule_requests_num; 3239 u32 out_of_window_triggers_num; 3240 }; 3241 3242 /** 3243 * struct cfg80211_pmsr_ftm_result - FTM result 3244 * @failure_reason: if this measurement failed (PMSR status is 3245 * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise 3246 * reason than just "failure" 3247 * @burst_index: if reporting partial results, this is the index 3248 * in [0 .. num_bursts-1] of the burst that's being reported 3249 * @num_ftmr_attempts: number of FTM request frames transmitted 3250 * @num_ftmr_successes: number of FTM request frames acked 3251 * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY, 3252 * fill this to indicate in how many seconds a retry is deemed possible 3253 * by the responder 3254 * @num_bursts_exp: actual number of bursts exponent negotiated 3255 * @burst_duration: actual burst duration negotiated 3256 * @ftms_per_burst: actual FTMs per burst negotiated 3257 * @lci_len: length of LCI information (if present) 3258 * @civicloc_len: length of civic location information (if present) 3259 * @lci: LCI data (may be %NULL) 3260 * @civicloc: civic location data (may be %NULL) 3261 * @rssi_avg: average RSSI over FTM action frames reported 3262 * @rssi_spread: spread of the RSSI over FTM action frames reported 3263 * @tx_rate: bitrate for transmitted FTM action frame response 3264 * @rx_rate: bitrate of received FTM action frame 3265 * @rtt_avg: average of RTTs measured (must have either this or @dist_avg) 3266 * @rtt_variance: variance of RTTs measured (note that standard deviation is 3267 * the square root of the variance) 3268 * @rtt_spread: spread of the RTTs measured 3269 * @dist_avg: average of distances (mm) measured 3270 * (must have either this or @rtt_avg) 3271 * @dist_variance: variance of distances measured (see also @rtt_variance) 3272 * @dist_spread: spread of distances measured (see also @rtt_spread) 3273 * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid 3274 * @num_ftmr_successes_valid: @num_ftmr_successes is valid 3275 * @rssi_avg_valid: @rssi_avg is valid 3276 * @rssi_spread_valid: @rssi_spread is valid 3277 * @tx_rate_valid: @tx_rate is valid 3278 * @rx_rate_valid: @rx_rate is valid 3279 * @rtt_avg_valid: @rtt_avg is valid 3280 * @rtt_variance_valid: @rtt_variance is valid 3281 * @rtt_spread_valid: @rtt_spread is valid 3282 * @dist_avg_valid: @dist_avg is valid 3283 * @dist_variance_valid: @dist_variance is valid 3284 * @dist_spread_valid: @dist_spread is valid 3285 */ 3286 struct cfg80211_pmsr_ftm_result { 3287 const u8 *lci; 3288 const u8 *civicloc; 3289 unsigned int lci_len; 3290 unsigned int civicloc_len; 3291 enum nl80211_peer_measurement_ftm_failure_reasons failure_reason; 3292 u32 num_ftmr_attempts, num_ftmr_successes; 3293 s16 burst_index; 3294 u8 busy_retry_time; 3295 u8 num_bursts_exp; 3296 u8 burst_duration; 3297 u8 ftms_per_burst; 3298 s32 rssi_avg; 3299 s32 rssi_spread; 3300 struct rate_info tx_rate, rx_rate; 3301 s64 rtt_avg; 3302 s64 rtt_variance; 3303 s64 rtt_spread; 3304 s64 dist_avg; 3305 s64 dist_variance; 3306 s64 dist_spread; 3307 3308 u16 num_ftmr_attempts_valid:1, 3309 num_ftmr_successes_valid:1, 3310 rssi_avg_valid:1, 3311 rssi_spread_valid:1, 3312 tx_rate_valid:1, 3313 rx_rate_valid:1, 3314 rtt_avg_valid:1, 3315 rtt_variance_valid:1, 3316 rtt_spread_valid:1, 3317 dist_avg_valid:1, 3318 dist_variance_valid:1, 3319 dist_spread_valid:1; 3320 }; 3321 3322 /** 3323 * struct cfg80211_pmsr_result - peer measurement result 3324 * @addr: address of the peer 3325 * @host_time: host time (use ktime_get_boottime() adjust to the time when the 3326 * measurement was made) 3327 * @ap_tsf: AP's TSF at measurement time 3328 * @status: status of the measurement 3329 * @final: if reporting partial results, mark this as the last one; if not 3330 * reporting partial results always set this flag 3331 * @ap_tsf_valid: indicates the @ap_tsf value is valid 3332 * @type: type of the measurement reported, note that we only support reporting 3333 * one type at a time, but you can report multiple results separately and 3334 * they're all aggregated for userspace. 3335 */ 3336 struct cfg80211_pmsr_result { 3337 u64 host_time, ap_tsf; 3338 enum nl80211_peer_measurement_status status; 3339 3340 u8 addr[ETH_ALEN]; 3341 3342 u8 final:1, 3343 ap_tsf_valid:1; 3344 3345 enum nl80211_peer_measurement_type type; 3346 3347 union { 3348 struct cfg80211_pmsr_ftm_result ftm; 3349 }; 3350 }; 3351 3352 /** 3353 * struct cfg80211_pmsr_ftm_request_peer - FTM request data 3354 * @requested: indicates FTM is requested 3355 * @preamble: frame preamble to use 3356 * @burst_period: burst period to use 3357 * @asap: indicates to use ASAP mode 3358 * @num_bursts_exp: number of bursts exponent 3359 * @burst_duration: burst duration 3360 * @ftms_per_burst: number of FTMs per burst 3361 * @ftmr_retries: number of retries for FTM request 3362 * @request_lci: request LCI information 3363 * @request_civicloc: request civic location information 3364 * @trigger_based: use trigger based ranging for the measurement 3365 * If neither @trigger_based nor @non_trigger_based is set, 3366 * EDCA based ranging will be used. 3367 * @non_trigger_based: use non trigger based ranging for the measurement 3368 * If neither @trigger_based nor @non_trigger_based is set, 3369 * EDCA based ranging will be used. 3370 * 3371 * See also nl80211 for the respective attribute documentation. 3372 */ 3373 struct cfg80211_pmsr_ftm_request_peer { 3374 enum nl80211_preamble preamble; 3375 u16 burst_period; 3376 u8 requested:1, 3377 asap:1, 3378 request_lci:1, 3379 request_civicloc:1, 3380 trigger_based:1, 3381 non_trigger_based:1; 3382 u8 num_bursts_exp; 3383 u8 burst_duration; 3384 u8 ftms_per_burst; 3385 u8 ftmr_retries; 3386 }; 3387 3388 /** 3389 * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request 3390 * @addr: MAC address 3391 * @chandef: channel to use 3392 * @report_ap_tsf: report the associated AP's TSF 3393 * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer 3394 */ 3395 struct cfg80211_pmsr_request_peer { 3396 u8 addr[ETH_ALEN]; 3397 struct cfg80211_chan_def chandef; 3398 u8 report_ap_tsf:1; 3399 struct cfg80211_pmsr_ftm_request_peer ftm; 3400 }; 3401 3402 /** 3403 * struct cfg80211_pmsr_request - peer measurement request 3404 * @cookie: cookie, set by cfg80211 3405 * @nl_portid: netlink portid - used by cfg80211 3406 * @drv_data: driver data for this request, if required for aborting, 3407 * not otherwise freed or anything by cfg80211 3408 * @mac_addr: MAC address used for (randomised) request 3409 * @mac_addr_mask: MAC address mask used for randomisation, bits that 3410 * are 0 in the mask should be randomised, bits that are 1 should 3411 * be taken from the @mac_addr 3412 * @list: used by cfg80211 to hold on to the request 3413 * @timeout: timeout (in milliseconds) for the whole operation, if 3414 * zero it means there's no timeout 3415 * @n_peers: number of peers to do measurements with 3416 * @peers: per-peer measurement request data 3417 */ 3418 struct cfg80211_pmsr_request { 3419 u64 cookie; 3420 void *drv_data; 3421 u32 n_peers; 3422 u32 nl_portid; 3423 3424 u32 timeout; 3425 3426 u8 mac_addr[ETH_ALEN] __aligned(2); 3427 u8 mac_addr_mask[ETH_ALEN] __aligned(2); 3428 3429 struct list_head list; 3430 3431 struct cfg80211_pmsr_request_peer peers[]; 3432 }; 3433 3434 /** 3435 * struct cfg80211_update_owe_info - OWE Information 3436 * 3437 * This structure provides information needed for the drivers to offload OWE 3438 * (Opportunistic Wireless Encryption) processing to the user space. 3439 * 3440 * Commonly used across update_owe_info request and event interfaces. 3441 * 3442 * @peer: MAC address of the peer device for which the OWE processing 3443 * has to be done. 3444 * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info 3445 * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space 3446 * cannot give you the real status code for failures. Used only for 3447 * OWE update request command interface (user space to driver). 3448 * @ie: IEs obtained from the peer or constructed by the user space. These are 3449 * the IEs of the remote peer in the event from the host driver and 3450 * the constructed IEs by the user space in the request interface. 3451 * @ie_len: Length of IEs in octets. 3452 */ 3453 struct cfg80211_update_owe_info { 3454 u8 peer[ETH_ALEN] __aligned(2); 3455 u16 status; 3456 const u8 *ie; 3457 size_t ie_len; 3458 }; 3459 3460 /** 3461 * struct mgmt_frame_regs - management frame registrations data 3462 * @global_stypes: bitmap of management frame subtypes registered 3463 * for the entire device 3464 * @interface_stypes: bitmap of management frame subtypes registered 3465 * for the given interface 3466 * @global_mcast_rx: mcast RX is needed globally for these subtypes 3467 * @interface_mcast_stypes: mcast RX is needed on this interface 3468 * for these subtypes 3469 */ 3470 struct mgmt_frame_regs { 3471 u32 global_stypes, interface_stypes; 3472 u32 global_mcast_stypes, interface_mcast_stypes; 3473 }; 3474 3475 /** 3476 * struct cfg80211_ops - backend description for wireless configuration 3477 * 3478 * This struct is registered by fullmac card drivers and/or wireless stacks 3479 * in order to handle configuration requests on their interfaces. 3480 * 3481 * All callbacks except where otherwise noted should return 0 3482 * on success or a negative error code. 3483 * 3484 * All operations are currently invoked under rtnl for consistency with the 3485 * wireless extensions but this is subject to reevaluation as soon as this 3486 * code is used more widely and we have a first user without wext. 3487 * 3488 * @suspend: wiphy device needs to be suspended. The variable @wow will 3489 * be %NULL or contain the enabled Wake-on-Wireless triggers that are 3490 * configured for the device. 3491 * @resume: wiphy device needs to be resumed 3492 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 3493 * to call device_set_wakeup_enable() to enable/disable wakeup from 3494 * the device. 3495 * 3496 * @add_virtual_intf: create a new virtual interface with the given name, 3497 * must set the struct wireless_dev's iftype. Beware: You must create 3498 * the new netdev in the wiphy's network namespace! Returns the struct 3499 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 3500 * also set the address member in the wdev. 3501 * 3502 * @del_virtual_intf: remove the virtual interface 3503 * 3504 * @change_virtual_intf: change type/configuration of virtual interface, 3505 * keep the struct wireless_dev's iftype updated. 3506 * 3507 * @add_key: add a key with the given parameters. @mac_addr will be %NULL 3508 * when adding a group key. 3509 * 3510 * @get_key: get information about the key with the given parameters. 3511 * @mac_addr will be %NULL when requesting information for a group 3512 * key. All pointers given to the @callback function need not be valid 3513 * after it returns. This function should return an error if it is 3514 * not possible to retrieve the key, -ENOENT if it doesn't exist. 3515 * 3516 * @del_key: remove a key given the @mac_addr (%NULL for a group key) 3517 * and @key_index, return -ENOENT if the key doesn't exist. 3518 * 3519 * @set_default_key: set the default key on an interface 3520 * 3521 * @set_default_mgmt_key: set the default management frame key on an interface 3522 * 3523 * @set_default_beacon_key: set the default Beacon frame key on an interface 3524 * 3525 * @set_rekey_data: give the data necessary for GTK rekeying to the driver 3526 * 3527 * @start_ap: Start acting in AP mode defined by the parameters. 3528 * @change_beacon: Change the beacon parameters for an access point mode 3529 * interface. This should reject the call when AP mode wasn't started. 3530 * @stop_ap: Stop being an AP, including stopping beaconing. 3531 * 3532 * @add_station: Add a new station. 3533 * @del_station: Remove a station 3534 * @change_station: Modify a given station. Note that flags changes are not much 3535 * validated in cfg80211, in particular the auth/assoc/authorized flags 3536 * might come to the driver in invalid combinations -- make sure to check 3537 * them, also against the existing state! Drivers must call 3538 * cfg80211_check_station_change() to validate the information. 3539 * @get_station: get station information for the station identified by @mac 3540 * @dump_station: dump station callback -- resume dump at index @idx 3541 * 3542 * @add_mpath: add a fixed mesh path 3543 * @del_mpath: delete a given mesh path 3544 * @change_mpath: change a given mesh path 3545 * @get_mpath: get a mesh path for the given parameters 3546 * @dump_mpath: dump mesh path callback -- resume dump at index @idx 3547 * @get_mpp: get a mesh proxy path for the given parameters 3548 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 3549 * @join_mesh: join the mesh network with the specified parameters 3550 * (invoked with the wireless_dev mutex held) 3551 * @leave_mesh: leave the current mesh network 3552 * (invoked with the wireless_dev mutex held) 3553 * 3554 * @get_mesh_config: Get the current mesh configuration 3555 * 3556 * @update_mesh_config: Update mesh parameters on a running mesh. 3557 * The mask is a bitfield which tells us which parameters to 3558 * set, and which to leave alone. 3559 * 3560 * @change_bss: Modify parameters for a given BSS. 3561 * 3562 * @set_txq_params: Set TX queue parameters 3563 * 3564 * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 3565 * as it doesn't implement join_mesh and needs to set the channel to 3566 * join the mesh instead. 3567 * 3568 * @set_monitor_channel: Set the monitor mode channel for the device. If other 3569 * interfaces are active this callback should reject the configuration. 3570 * If no interfaces are active or the device is down, the channel should 3571 * be stored for when a monitor interface becomes active. 3572 * 3573 * @scan: Request to do a scan. If returning zero, the scan request is given 3574 * the driver, and will be valid until passed to cfg80211_scan_done(). 3575 * For scan results, call cfg80211_inform_bss(); you can call this outside 3576 * the scan/scan_done bracket too. 3577 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall 3578 * indicate the status of the scan through cfg80211_scan_done(). 3579 * 3580 * @auth: Request to authenticate with the specified peer 3581 * (invoked with the wireless_dev mutex held) 3582 * @assoc: Request to (re)associate with the specified peer 3583 * (invoked with the wireless_dev mutex held) 3584 * @deauth: Request to deauthenticate from the specified peer 3585 * (invoked with the wireless_dev mutex held) 3586 * @disassoc: Request to disassociate from the specified peer 3587 * (invoked with the wireless_dev mutex held) 3588 * 3589 * @connect: Connect to the ESS with the specified parameters. When connected, 3590 * call cfg80211_connect_result()/cfg80211_connect_bss() with status code 3591 * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call 3592 * cfg80211_connect_result()/cfg80211_connect_bss() with the status code 3593 * from the AP or cfg80211_connect_timeout() if no frame with status code 3594 * was received. 3595 * The driver is allowed to roam to other BSSes within the ESS when the 3596 * other BSS matches the connect parameters. When such roaming is initiated 3597 * by the driver, the driver is expected to verify that the target matches 3598 * the configured security parameters and to use Reassociation Request 3599 * frame instead of Association Request frame. 3600 * The connect function can also be used to request the driver to perform a 3601 * specific roam when connected to an ESS. In that case, the prev_bssid 3602 * parameter is set to the BSSID of the currently associated BSS as an 3603 * indication of requesting reassociation. 3604 * In both the driver-initiated and new connect() call initiated roaming 3605 * cases, the result of roaming is indicated with a call to 3606 * cfg80211_roamed(). (invoked with the wireless_dev mutex held) 3607 * @update_connect_params: Update the connect parameters while connected to a 3608 * BSS. The updated parameters can be used by driver/firmware for 3609 * subsequent BSS selection (roaming) decisions and to form the 3610 * Authentication/(Re)Association Request frames. This call does not 3611 * request an immediate disassociation or reassociation with the current 3612 * BSS, i.e., this impacts only subsequent (re)associations. The bits in 3613 * changed are defined in &enum cfg80211_connect_params_changed. 3614 * (invoked with the wireless_dev mutex held) 3615 * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if 3616 * connection is in progress. Once done, call cfg80211_disconnected() in 3617 * case connection was already established (invoked with the 3618 * wireless_dev mutex held), otherwise call cfg80211_connect_timeout(). 3619 * 3620 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 3621 * cfg80211_ibss_joined(), also call that function when changing BSSID due 3622 * to a merge. 3623 * (invoked with the wireless_dev mutex held) 3624 * @leave_ibss: Leave the IBSS. 3625 * (invoked with the wireless_dev mutex held) 3626 * 3627 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 3628 * MESH mode) 3629 * 3630 * @set_wiphy_params: Notify that wiphy parameters have changed; 3631 * @changed bitfield (see &enum wiphy_params_flags) describes which values 3632 * have changed. The actual parameter values are available in 3633 * struct wiphy. If returning an error, no value should be changed. 3634 * 3635 * @set_tx_power: set the transmit power according to the parameters, 3636 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 3637 * wdev may be %NULL if power was set for the wiphy, and will 3638 * always be %NULL unless the driver supports per-vif TX power 3639 * (as advertised by the nl80211 feature flag.) 3640 * @get_tx_power: store the current TX power into the dbm variable; 3641 * return 0 if successful 3642 * 3643 * @set_wds_peer: set the WDS peer for a WDS interface 3644 * 3645 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 3646 * functions to adjust rfkill hw state 3647 * 3648 * @dump_survey: get site survey information. 3649 * 3650 * @remain_on_channel: Request the driver to remain awake on the specified 3651 * channel for the specified duration to complete an off-channel 3652 * operation (e.g., public action frame exchange). When the driver is 3653 * ready on the requested channel, it must indicate this with an event 3654 * notification by calling cfg80211_ready_on_channel(). 3655 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 3656 * This allows the operation to be terminated prior to timeout based on 3657 * the duration value. 3658 * @mgmt_tx: Transmit a management frame. 3659 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 3660 * frame on another channel 3661 * 3662 * @testmode_cmd: run a test mode command; @wdev may be %NULL 3663 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 3664 * used by the function, but 0 and 1 must not be touched. Additionally, 3665 * return error codes other than -ENOBUFS and -ENOENT will terminate the 3666 * dump and return to userspace with an error, so be careful. If any data 3667 * was passed in from userspace then the data/len arguments will be present 3668 * and point to the data contained in %NL80211_ATTR_TESTDATA. 3669 * 3670 * @set_bitrate_mask: set the bitrate mask configuration 3671 * 3672 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 3673 * devices running firmwares capable of generating the (re) association 3674 * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 3675 * @del_pmksa: Delete a cached PMKID. 3676 * @flush_pmksa: Flush all cached PMKIDs. 3677 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 3678 * allows the driver to adjust the dynamic ps timeout value. 3679 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 3680 * After configuration, the driver should (soon) send an event indicating 3681 * the current level is above/below the configured threshold; this may 3682 * need some care when the configuration is changed (without first being 3683 * disabled.) 3684 * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the 3685 * connection quality monitor. An event is to be sent only when the 3686 * signal level is found to be outside the two values. The driver should 3687 * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented. 3688 * If it is provided then there's no point providing @set_cqm_rssi_config. 3689 * @set_cqm_txe_config: Configure connection quality monitor TX error 3690 * thresholds. 3691 * @sched_scan_start: Tell the driver to start a scheduled scan. 3692 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with 3693 * given request id. This call must stop the scheduled scan and be ready 3694 * for starting a new one before it returns, i.e. @sched_scan_start may be 3695 * called immediately after that again and should not fail in that case. 3696 * The driver should not call cfg80211_sched_scan_stopped() for a requested 3697 * stop (when this method returns 0). 3698 * 3699 * @update_mgmt_frame_registrations: Notify the driver that management frame 3700 * registrations were updated. The callback is allowed to sleep. 3701 * 3702 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 3703 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 3704 * reject TX/RX mask combinations they cannot support by returning -EINVAL 3705 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 3706 * 3707 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 3708 * 3709 * @tdls_mgmt: Transmit a TDLS management frame. 3710 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 3711 * 3712 * @probe_client: probe an associated client, must return a cookie that it 3713 * later passes to cfg80211_probe_status(). 3714 * 3715 * @set_noack_map: Set the NoAck Map for the TIDs. 3716 * 3717 * @get_channel: Get the current operating channel for the virtual interface. 3718 * For monitor interfaces, it should return %NULL unless there's a single 3719 * current monitoring channel. 3720 * 3721 * @start_p2p_device: Start the given P2P device. 3722 * @stop_p2p_device: Stop the given P2P device. 3723 * 3724 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 3725 * Parameters include ACL policy, an array of MAC address of stations 3726 * and the number of MAC addresses. If there is already a list in driver 3727 * this new list replaces the existing one. Driver has to clear its ACL 3728 * when number of MAC addresses entries is passed as 0. Drivers which 3729 * advertise the support for MAC based ACL have to implement this callback. 3730 * 3731 * @start_radar_detection: Start radar detection in the driver. 3732 * 3733 * @end_cac: End running CAC, probably because a related CAC 3734 * was finished on another phy. 3735 * 3736 * @update_ft_ies: Provide updated Fast BSS Transition information to the 3737 * driver. If the SME is in the driver/firmware, this information can be 3738 * used in building Authentication and Reassociation Request frames. 3739 * 3740 * @crit_proto_start: Indicates a critical protocol needs more link reliability 3741 * for a given duration (milliseconds). The protocol is provided so the 3742 * driver can take the most appropriate actions. 3743 * @crit_proto_stop: Indicates critical protocol no longer needs increased link 3744 * reliability. This operation can not fail. 3745 * @set_coalesce: Set coalesce parameters. 3746 * 3747 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 3748 * responsible for veryfing if the switch is possible. Since this is 3749 * inherently tricky driver may decide to disconnect an interface later 3750 * with cfg80211_stop_iface(). This doesn't mean driver can accept 3751 * everything. It should do it's best to verify requests and reject them 3752 * as soon as possible. 3753 * 3754 * @set_qos_map: Set QoS mapping information to the driver 3755 * 3756 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 3757 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 3758 * changes during the lifetime of the BSS. 3759 * 3760 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 3761 * with the given parameters; action frame exchange has been handled by 3762 * userspace so this just has to modify the TX path to take the TS into 3763 * account. 3764 * If the admitted time is 0 just validate the parameters to make sure 3765 * the session can be created at all; it is valid to just always return 3766 * success for that but that may result in inefficient behaviour (handshake 3767 * with the peer followed by immediate teardown when the addition is later 3768 * rejected) 3769 * @del_tx_ts: remove an existing TX TS 3770 * 3771 * @join_ocb: join the OCB network with the specified parameters 3772 * (invoked with the wireless_dev mutex held) 3773 * @leave_ocb: leave the current OCB network 3774 * (invoked with the wireless_dev mutex held) 3775 * 3776 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 3777 * is responsible for continually initiating channel-switching operations 3778 * and returning to the base channel for communication with the AP. 3779 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 3780 * peers must be on the base channel when the call completes. 3781 * @start_nan: Start the NAN interface. 3782 * @stop_nan: Stop the NAN interface. 3783 * @add_nan_func: Add a NAN function. Returns negative value on failure. 3784 * On success @nan_func ownership is transferred to the driver and 3785 * it may access it outside of the scope of this function. The driver 3786 * should free the @nan_func when no longer needed by calling 3787 * cfg80211_free_nan_func(). 3788 * On success the driver should assign an instance_id in the 3789 * provided @nan_func. 3790 * @del_nan_func: Delete a NAN function. 3791 * @nan_change_conf: changes NAN configuration. The changed parameters must 3792 * be specified in @changes (using &enum cfg80211_nan_conf_changes); 3793 * All other parameters must be ignored. 3794 * 3795 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS 3796 * 3797 * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this 3798 * function should return phy stats, and interface stats otherwise. 3799 * 3800 * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake. 3801 * If not deleted through @del_pmk the PMK remains valid until disconnect 3802 * upon which the driver should clear it. 3803 * (invoked with the wireless_dev mutex held) 3804 * @del_pmk: delete the previously configured PMK for the given authenticator. 3805 * (invoked with the wireless_dev mutex held) 3806 * 3807 * @external_auth: indicates result of offloaded authentication processing from 3808 * user space 3809 * 3810 * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter 3811 * tells the driver that the frame should not be encrypted. 3812 * 3813 * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available. 3814 * Statistics should be cumulative, currently no way to reset is provided. 3815 * @start_pmsr: start peer measurement (e.g. FTM) 3816 * @abort_pmsr: abort peer measurement 3817 * 3818 * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME 3819 * but offloading OWE processing to the user space will get the updated 3820 * DH IE through this interface. 3821 * 3822 * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame 3823 * and overrule HWMP path selection algorithm. 3824 * @set_tid_config: TID specific configuration, this can be peer or BSS specific 3825 * This callback may sleep. 3826 * @reset_tid_config: Reset TID specific configuration for the peer, for the 3827 * given TIDs. This callback may sleep. 3828 */ 3829 struct cfg80211_ops { 3830 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 3831 int (*resume)(struct wiphy *wiphy); 3832 void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 3833 3834 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 3835 const char *name, 3836 unsigned char name_assign_type, 3837 enum nl80211_iftype type, 3838 struct vif_params *params); 3839 int (*del_virtual_intf)(struct wiphy *wiphy, 3840 struct wireless_dev *wdev); 3841 int (*change_virtual_intf)(struct wiphy *wiphy, 3842 struct net_device *dev, 3843 enum nl80211_iftype type, 3844 struct vif_params *params); 3845 3846 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 3847 u8 key_index, bool pairwise, const u8 *mac_addr, 3848 struct key_params *params); 3849 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 3850 u8 key_index, bool pairwise, const u8 *mac_addr, 3851 void *cookie, 3852 void (*callback)(void *cookie, struct key_params*)); 3853 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 3854 u8 key_index, bool pairwise, const u8 *mac_addr); 3855 int (*set_default_key)(struct wiphy *wiphy, 3856 struct net_device *netdev, 3857 u8 key_index, bool unicast, bool multicast); 3858 int (*set_default_mgmt_key)(struct wiphy *wiphy, 3859 struct net_device *netdev, 3860 u8 key_index); 3861 int (*set_default_beacon_key)(struct wiphy *wiphy, 3862 struct net_device *netdev, 3863 u8 key_index); 3864 3865 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 3866 struct cfg80211_ap_settings *settings); 3867 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 3868 struct cfg80211_beacon_data *info); 3869 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 3870 3871 3872 int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 3873 const u8 *mac, 3874 struct station_parameters *params); 3875 int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 3876 struct station_del_parameters *params); 3877 int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 3878 const u8 *mac, 3879 struct station_parameters *params); 3880 int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 3881 const u8 *mac, struct station_info *sinfo); 3882 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 3883 int idx, u8 *mac, struct station_info *sinfo); 3884 3885 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 3886 const u8 *dst, const u8 *next_hop); 3887 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 3888 const u8 *dst); 3889 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 3890 const u8 *dst, const u8 *next_hop); 3891 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 3892 u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 3893 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 3894 int idx, u8 *dst, u8 *next_hop, 3895 struct mpath_info *pinfo); 3896 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 3897 u8 *dst, u8 *mpp, struct mpath_info *pinfo); 3898 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 3899 int idx, u8 *dst, u8 *mpp, 3900 struct mpath_info *pinfo); 3901 int (*get_mesh_config)(struct wiphy *wiphy, 3902 struct net_device *dev, 3903 struct mesh_config *conf); 3904 int (*update_mesh_config)(struct wiphy *wiphy, 3905 struct net_device *dev, u32 mask, 3906 const struct mesh_config *nconf); 3907 int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 3908 const struct mesh_config *conf, 3909 const struct mesh_setup *setup); 3910 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 3911 3912 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 3913 struct ocb_setup *setup); 3914 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 3915 3916 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 3917 struct bss_parameters *params); 3918 3919 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 3920 struct ieee80211_txq_params *params); 3921 3922 int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 3923 struct net_device *dev, 3924 struct ieee80211_channel *chan); 3925 3926 int (*set_monitor_channel)(struct wiphy *wiphy, 3927 struct cfg80211_chan_def *chandef); 3928 3929 int (*scan)(struct wiphy *wiphy, 3930 struct cfg80211_scan_request *request); 3931 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev); 3932 3933 int (*auth)(struct wiphy *wiphy, struct net_device *dev, 3934 struct cfg80211_auth_request *req); 3935 int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 3936 struct cfg80211_assoc_request *req); 3937 int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 3938 struct cfg80211_deauth_request *req); 3939 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 3940 struct cfg80211_disassoc_request *req); 3941 3942 int (*connect)(struct wiphy *wiphy, struct net_device *dev, 3943 struct cfg80211_connect_params *sme); 3944 int (*update_connect_params)(struct wiphy *wiphy, 3945 struct net_device *dev, 3946 struct cfg80211_connect_params *sme, 3947 u32 changed); 3948 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 3949 u16 reason_code); 3950 3951 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 3952 struct cfg80211_ibss_params *params); 3953 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 3954 3955 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 3956 int rate[NUM_NL80211_BANDS]); 3957 3958 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 3959 3960 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 3961 enum nl80211_tx_power_setting type, int mbm); 3962 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 3963 int *dbm); 3964 3965 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 3966 const u8 *addr); 3967 3968 void (*rfkill_poll)(struct wiphy *wiphy); 3969 3970 #ifdef CONFIG_NL80211_TESTMODE 3971 int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 3972 void *data, int len); 3973 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 3974 struct netlink_callback *cb, 3975 void *data, int len); 3976 #endif 3977 3978 int (*set_bitrate_mask)(struct wiphy *wiphy, 3979 struct net_device *dev, 3980 const u8 *peer, 3981 const struct cfg80211_bitrate_mask *mask); 3982 3983 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 3984 int idx, struct survey_info *info); 3985 3986 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 3987 struct cfg80211_pmksa *pmksa); 3988 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 3989 struct cfg80211_pmksa *pmksa); 3990 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 3991 3992 int (*remain_on_channel)(struct wiphy *wiphy, 3993 struct wireless_dev *wdev, 3994 struct ieee80211_channel *chan, 3995 unsigned int duration, 3996 u64 *cookie); 3997 int (*cancel_remain_on_channel)(struct wiphy *wiphy, 3998 struct wireless_dev *wdev, 3999 u64 cookie); 4000 4001 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 4002 struct cfg80211_mgmt_tx_params *params, 4003 u64 *cookie); 4004 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 4005 struct wireless_dev *wdev, 4006 u64 cookie); 4007 4008 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 4009 bool enabled, int timeout); 4010 4011 int (*set_cqm_rssi_config)(struct wiphy *wiphy, 4012 struct net_device *dev, 4013 s32 rssi_thold, u32 rssi_hyst); 4014 4015 int (*set_cqm_rssi_range_config)(struct wiphy *wiphy, 4016 struct net_device *dev, 4017 s32 rssi_low, s32 rssi_high); 4018 4019 int (*set_cqm_txe_config)(struct wiphy *wiphy, 4020 struct net_device *dev, 4021 u32 rate, u32 pkts, u32 intvl); 4022 4023 void (*update_mgmt_frame_registrations)(struct wiphy *wiphy, 4024 struct wireless_dev *wdev, 4025 struct mgmt_frame_regs *upd); 4026 4027 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 4028 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 4029 4030 int (*sched_scan_start)(struct wiphy *wiphy, 4031 struct net_device *dev, 4032 struct cfg80211_sched_scan_request *request); 4033 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev, 4034 u64 reqid); 4035 4036 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 4037 struct cfg80211_gtk_rekey_data *data); 4038 4039 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 4040 const u8 *peer, u8 action_code, u8 dialog_token, 4041 u16 status_code, u32 peer_capability, 4042 bool initiator, const u8 *buf, size_t len); 4043 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 4044 const u8 *peer, enum nl80211_tdls_operation oper); 4045 4046 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 4047 const u8 *peer, u64 *cookie); 4048 4049 int (*set_noack_map)(struct wiphy *wiphy, 4050 struct net_device *dev, 4051 u16 noack_map); 4052 4053 int (*get_channel)(struct wiphy *wiphy, 4054 struct wireless_dev *wdev, 4055 struct cfg80211_chan_def *chandef); 4056 4057 int (*start_p2p_device)(struct wiphy *wiphy, 4058 struct wireless_dev *wdev); 4059 void (*stop_p2p_device)(struct wiphy *wiphy, 4060 struct wireless_dev *wdev); 4061 4062 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 4063 const struct cfg80211_acl_data *params); 4064 4065 int (*start_radar_detection)(struct wiphy *wiphy, 4066 struct net_device *dev, 4067 struct cfg80211_chan_def *chandef, 4068 u32 cac_time_ms); 4069 void (*end_cac)(struct wiphy *wiphy, 4070 struct net_device *dev); 4071 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 4072 struct cfg80211_update_ft_ies_params *ftie); 4073 int (*crit_proto_start)(struct wiphy *wiphy, 4074 struct wireless_dev *wdev, 4075 enum nl80211_crit_proto_id protocol, 4076 u16 duration); 4077 void (*crit_proto_stop)(struct wiphy *wiphy, 4078 struct wireless_dev *wdev); 4079 int (*set_coalesce)(struct wiphy *wiphy, 4080 struct cfg80211_coalesce *coalesce); 4081 4082 int (*channel_switch)(struct wiphy *wiphy, 4083 struct net_device *dev, 4084 struct cfg80211_csa_settings *params); 4085 4086 int (*set_qos_map)(struct wiphy *wiphy, 4087 struct net_device *dev, 4088 struct cfg80211_qos_map *qos_map); 4089 4090 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 4091 struct cfg80211_chan_def *chandef); 4092 4093 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 4094 u8 tsid, const u8 *peer, u8 user_prio, 4095 u16 admitted_time); 4096 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 4097 u8 tsid, const u8 *peer); 4098 4099 int (*tdls_channel_switch)(struct wiphy *wiphy, 4100 struct net_device *dev, 4101 const u8 *addr, u8 oper_class, 4102 struct cfg80211_chan_def *chandef); 4103 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 4104 struct net_device *dev, 4105 const u8 *addr); 4106 int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev, 4107 struct cfg80211_nan_conf *conf); 4108 void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev); 4109 int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 4110 struct cfg80211_nan_func *nan_func); 4111 void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 4112 u64 cookie); 4113 int (*nan_change_conf)(struct wiphy *wiphy, 4114 struct wireless_dev *wdev, 4115 struct cfg80211_nan_conf *conf, 4116 u32 changes); 4117 4118 int (*set_multicast_to_unicast)(struct wiphy *wiphy, 4119 struct net_device *dev, 4120 const bool enabled); 4121 4122 int (*get_txq_stats)(struct wiphy *wiphy, 4123 struct wireless_dev *wdev, 4124 struct cfg80211_txq_stats *txqstats); 4125 4126 int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev, 4127 const struct cfg80211_pmk_conf *conf); 4128 int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev, 4129 const u8 *aa); 4130 int (*external_auth)(struct wiphy *wiphy, struct net_device *dev, 4131 struct cfg80211_external_auth_params *params); 4132 4133 int (*tx_control_port)(struct wiphy *wiphy, 4134 struct net_device *dev, 4135 const u8 *buf, size_t len, 4136 const u8 *dest, const __be16 proto, 4137 const bool noencrypt, 4138 u64 *cookie); 4139 4140 int (*get_ftm_responder_stats)(struct wiphy *wiphy, 4141 struct net_device *dev, 4142 struct cfg80211_ftm_responder_stats *ftm_stats); 4143 4144 int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev, 4145 struct cfg80211_pmsr_request *request); 4146 void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev, 4147 struct cfg80211_pmsr_request *request); 4148 int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev, 4149 struct cfg80211_update_owe_info *owe_info); 4150 int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev, 4151 const u8 *buf, size_t len); 4152 int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev, 4153 struct cfg80211_tid_config *tid_conf); 4154 int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev, 4155 const u8 *peer, u8 tids); 4156 }; 4157 4158 /* 4159 * wireless hardware and networking interfaces structures 4160 * and registration/helper functions 4161 */ 4162 4163 /** 4164 * enum wiphy_flags - wiphy capability flags 4165 * 4166 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 4167 * wiphy at all 4168 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 4169 * by default -- this flag will be set depending on the kernel's default 4170 * on wiphy_new(), but can be changed by the driver if it has a good 4171 * reason to override the default 4172 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 4173 * on a VLAN interface). This flag also serves an extra purpose of 4174 * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype. 4175 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 4176 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 4177 * control port protocol ethertype. The device also honours the 4178 * control_port_no_encrypt flag. 4179 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 4180 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 4181 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 4182 * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 4183 * firmware. 4184 * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 4185 * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 4186 * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 4187 * link setup/discovery operations internally. Setup, discovery and 4188 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 4189 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 4190 * used for asking the driver/firmware to perform a TDLS operation. 4191 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 4192 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 4193 * when there are virtual interfaces in AP mode by calling 4194 * cfg80211_report_obss_beacon(). 4195 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 4196 * responds to probe-requests in hardware. 4197 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 4198 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 4199 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 4200 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 4201 * beaconing mode (AP, IBSS, Mesh, ...). 4202 * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation 4203 * before connection. 4204 * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys 4205 */ 4206 enum wiphy_flags { 4207 WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0), 4208 /* use hole at 1 */ 4209 /* use hole at 2 */ 4210 WIPHY_FLAG_NETNS_OK = BIT(3), 4211 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 4212 WIPHY_FLAG_4ADDR_AP = BIT(5), 4213 WIPHY_FLAG_4ADDR_STATION = BIT(6), 4214 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 4215 WIPHY_FLAG_IBSS_RSN = BIT(8), 4216 WIPHY_FLAG_MESH_AUTH = BIT(10), 4217 /* use hole at 11 */ 4218 /* use hole at 12 */ 4219 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 4220 WIPHY_FLAG_AP_UAPSD = BIT(14), 4221 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 4222 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 4223 WIPHY_FLAG_HAVE_AP_SME = BIT(17), 4224 WIPHY_FLAG_REPORTS_OBSS = BIT(18), 4225 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 4226 WIPHY_FLAG_OFFCHAN_TX = BIT(20), 4227 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 4228 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 4229 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 4230 WIPHY_FLAG_HAS_STATIC_WEP = BIT(24), 4231 }; 4232 4233 /** 4234 * struct ieee80211_iface_limit - limit on certain interface types 4235 * @max: maximum number of interfaces of these types 4236 * @types: interface types (bits) 4237 */ 4238 struct ieee80211_iface_limit { 4239 u16 max; 4240 u16 types; 4241 }; 4242 4243 /** 4244 * struct ieee80211_iface_combination - possible interface combination 4245 * 4246 * With this structure the driver can describe which interface 4247 * combinations it supports concurrently. 4248 * 4249 * Examples: 4250 * 4251 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 4252 * 4253 * .. code-block:: c 4254 * 4255 * struct ieee80211_iface_limit limits1[] = { 4256 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 4257 * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 4258 * }; 4259 * struct ieee80211_iface_combination combination1 = { 4260 * .limits = limits1, 4261 * .n_limits = ARRAY_SIZE(limits1), 4262 * .max_interfaces = 2, 4263 * .beacon_int_infra_match = true, 4264 * }; 4265 * 4266 * 4267 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 4268 * 4269 * .. code-block:: c 4270 * 4271 * struct ieee80211_iface_limit limits2[] = { 4272 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 4273 * BIT(NL80211_IFTYPE_P2P_GO), }, 4274 * }; 4275 * struct ieee80211_iface_combination combination2 = { 4276 * .limits = limits2, 4277 * .n_limits = ARRAY_SIZE(limits2), 4278 * .max_interfaces = 8, 4279 * .num_different_channels = 1, 4280 * }; 4281 * 4282 * 4283 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 4284 * 4285 * This allows for an infrastructure connection and three P2P connections. 4286 * 4287 * .. code-block:: c 4288 * 4289 * struct ieee80211_iface_limit limits3[] = { 4290 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 4291 * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 4292 * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 4293 * }; 4294 * struct ieee80211_iface_combination combination3 = { 4295 * .limits = limits3, 4296 * .n_limits = ARRAY_SIZE(limits3), 4297 * .max_interfaces = 4, 4298 * .num_different_channels = 2, 4299 * }; 4300 * 4301 */ 4302 struct ieee80211_iface_combination { 4303 /** 4304 * @limits: 4305 * limits for the given interface types 4306 */ 4307 const struct ieee80211_iface_limit *limits; 4308 4309 /** 4310 * @num_different_channels: 4311 * can use up to this many different channels 4312 */ 4313 u32 num_different_channels; 4314 4315 /** 4316 * @max_interfaces: 4317 * maximum number of interfaces in total allowed in this group 4318 */ 4319 u16 max_interfaces; 4320 4321 /** 4322 * @n_limits: 4323 * number of limitations 4324 */ 4325 u8 n_limits; 4326 4327 /** 4328 * @beacon_int_infra_match: 4329 * In this combination, the beacon intervals between infrastructure 4330 * and AP types must match. This is required only in special cases. 4331 */ 4332 bool beacon_int_infra_match; 4333 4334 /** 4335 * @radar_detect_widths: 4336 * bitmap of channel widths supported for radar detection 4337 */ 4338 u8 radar_detect_widths; 4339 4340 /** 4341 * @radar_detect_regions: 4342 * bitmap of regions supported for radar detection 4343 */ 4344 u8 radar_detect_regions; 4345 4346 /** 4347 * @beacon_int_min_gcd: 4348 * This interface combination supports different beacon intervals. 4349 * 4350 * = 0 4351 * all beacon intervals for different interface must be same. 4352 * > 0 4353 * any beacon interval for the interface part of this combination AND 4354 * GCD of all beacon intervals from beaconing interfaces of this 4355 * combination must be greater or equal to this value. 4356 */ 4357 u32 beacon_int_min_gcd; 4358 }; 4359 4360 struct ieee80211_txrx_stypes { 4361 u16 tx, rx; 4362 }; 4363 4364 /** 4365 * enum wiphy_wowlan_support_flags - WoWLAN support flags 4366 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 4367 * trigger that keeps the device operating as-is and 4368 * wakes up the host on any activity, for example a 4369 * received packet that passed filtering; note that the 4370 * packet should be preserved in that case 4371 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 4372 * (see nl80211.h) 4373 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 4374 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 4375 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 4376 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 4377 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 4378 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 4379 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 4380 */ 4381 enum wiphy_wowlan_support_flags { 4382 WIPHY_WOWLAN_ANY = BIT(0), 4383 WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 4384 WIPHY_WOWLAN_DISCONNECT = BIT(2), 4385 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 4386 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 4387 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 4388 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 4389 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 4390 WIPHY_WOWLAN_NET_DETECT = BIT(8), 4391 }; 4392 4393 struct wiphy_wowlan_tcp_support { 4394 const struct nl80211_wowlan_tcp_data_token_feature *tok; 4395 u32 data_payload_max; 4396 u32 data_interval_max; 4397 u32 wake_payload_max; 4398 bool seq; 4399 }; 4400 4401 /** 4402 * struct wiphy_wowlan_support - WoWLAN support data 4403 * @flags: see &enum wiphy_wowlan_support_flags 4404 * @n_patterns: number of supported wakeup patterns 4405 * (see nl80211.h for the pattern definition) 4406 * @pattern_max_len: maximum length of each pattern 4407 * @pattern_min_len: minimum length of each pattern 4408 * @max_pkt_offset: maximum Rx packet offset 4409 * @max_nd_match_sets: maximum number of matchsets for net-detect, 4410 * similar, but not necessarily identical, to max_match_sets for 4411 * scheduled scans. 4412 * See &struct cfg80211_sched_scan_request.@match_sets for more 4413 * details. 4414 * @tcp: TCP wakeup support information 4415 */ 4416 struct wiphy_wowlan_support { 4417 u32 flags; 4418 int n_patterns; 4419 int pattern_max_len; 4420 int pattern_min_len; 4421 int max_pkt_offset; 4422 int max_nd_match_sets; 4423 const struct wiphy_wowlan_tcp_support *tcp; 4424 }; 4425 4426 /** 4427 * struct wiphy_coalesce_support - coalesce support data 4428 * @n_rules: maximum number of coalesce rules 4429 * @max_delay: maximum supported coalescing delay in msecs 4430 * @n_patterns: number of supported patterns in a rule 4431 * (see nl80211.h for the pattern definition) 4432 * @pattern_max_len: maximum length of each pattern 4433 * @pattern_min_len: minimum length of each pattern 4434 * @max_pkt_offset: maximum Rx packet offset 4435 */ 4436 struct wiphy_coalesce_support { 4437 int n_rules; 4438 int max_delay; 4439 int n_patterns; 4440 int pattern_max_len; 4441 int pattern_min_len; 4442 int max_pkt_offset; 4443 }; 4444 4445 /** 4446 * enum wiphy_vendor_command_flags - validation flags for vendor commands 4447 * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 4448 * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 4449 * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 4450 * (must be combined with %_WDEV or %_NETDEV) 4451 */ 4452 enum wiphy_vendor_command_flags { 4453 WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 4454 WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 4455 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 4456 }; 4457 4458 /** 4459 * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags 4460 * 4461 * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed 4462 * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed 4463 * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed 4464 * 4465 */ 4466 enum wiphy_opmode_flag { 4467 STA_OPMODE_MAX_BW_CHANGED = BIT(0), 4468 STA_OPMODE_SMPS_MODE_CHANGED = BIT(1), 4469 STA_OPMODE_N_SS_CHANGED = BIT(2), 4470 }; 4471 4472 /** 4473 * struct sta_opmode_info - Station's ht/vht operation mode information 4474 * @changed: contains value from &enum wiphy_opmode_flag 4475 * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station 4476 * @bw: new max bandwidth value from &enum nl80211_chan_width of a station 4477 * @rx_nss: new rx_nss value of a station 4478 */ 4479 4480 struct sta_opmode_info { 4481 u32 changed; 4482 enum nl80211_smps_mode smps_mode; 4483 enum nl80211_chan_width bw; 4484 u8 rx_nss; 4485 }; 4486 4487 #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA)) 4488 4489 /** 4490 * struct wiphy_vendor_command - vendor command definition 4491 * @info: vendor command identifying information, as used in nl80211 4492 * @flags: flags, see &enum wiphy_vendor_command_flags 4493 * @doit: callback for the operation, note that wdev is %NULL if the 4494 * flags didn't ask for a wdev and non-%NULL otherwise; the data 4495 * pointer may be %NULL if userspace provided no data at all 4496 * @dumpit: dump callback, for transferring bigger/multiple items. The 4497 * @storage points to cb->args[5], ie. is preserved over the multiple 4498 * dumpit calls. 4499 * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA. 4500 * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the 4501 * attribute is just raw data (e.g. a firmware command). 4502 * @maxattr: highest attribute number in policy 4503 * It's recommended to not have the same sub command with both @doit and 4504 * @dumpit, so that userspace can assume certain ones are get and others 4505 * are used with dump requests. 4506 */ 4507 struct wiphy_vendor_command { 4508 struct nl80211_vendor_cmd_info info; 4509 u32 flags; 4510 int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 4511 const void *data, int data_len); 4512 int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, 4513 struct sk_buff *skb, const void *data, int data_len, 4514 unsigned long *storage); 4515 const struct nla_policy *policy; 4516 unsigned int maxattr; 4517 }; 4518 4519 /** 4520 * struct wiphy_iftype_ext_capab - extended capabilities per interface type 4521 * @iftype: interface type 4522 * @extended_capabilities: extended capabilities supported by the driver, 4523 * additional capabilities might be supported by userspace; these are the 4524 * 802.11 extended capabilities ("Extended Capabilities element") and are 4525 * in the same format as in the information element. See IEEE Std 4526 * 802.11-2012 8.4.2.29 for the defined fields. 4527 * @extended_capabilities_mask: mask of the valid values 4528 * @extended_capabilities_len: length of the extended capabilities 4529 */ 4530 struct wiphy_iftype_ext_capab { 4531 enum nl80211_iftype iftype; 4532 const u8 *extended_capabilities; 4533 const u8 *extended_capabilities_mask; 4534 u8 extended_capabilities_len; 4535 }; 4536 4537 /** 4538 * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities 4539 * @max_peers: maximum number of peers in a single measurement 4540 * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement 4541 * @randomize_mac_addr: can randomize MAC address for measurement 4542 * @ftm.supported: FTM measurement is supported 4543 * @ftm.asap: ASAP-mode is supported 4544 * @ftm.non_asap: non-ASAP-mode is supported 4545 * @ftm.request_lci: can request LCI data 4546 * @ftm.request_civicloc: can request civic location data 4547 * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble) 4548 * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width) 4549 * @ftm.max_bursts_exponent: maximum burst exponent supported 4550 * (set to -1 if not limited; note that setting this will necessarily 4551 * forbid using the value 15 to let the responder pick) 4552 * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if 4553 * not limited) 4554 * @ftm.trigger_based: trigger based ranging measurement is supported 4555 * @ftm.non_trigger_based: non trigger based ranging measurement is supported 4556 */ 4557 struct cfg80211_pmsr_capabilities { 4558 unsigned int max_peers; 4559 u8 report_ap_tsf:1, 4560 randomize_mac_addr:1; 4561 4562 struct { 4563 u32 preambles; 4564 u32 bandwidths; 4565 s8 max_bursts_exponent; 4566 u8 max_ftms_per_burst; 4567 u8 supported:1, 4568 asap:1, 4569 non_asap:1, 4570 request_lci:1, 4571 request_civicloc:1, 4572 trigger_based:1, 4573 non_trigger_based:1; 4574 } ftm; 4575 }; 4576 4577 /** 4578 * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm 4579 * suites for interface types defined in @iftypes_mask. Each type in the 4580 * @iftypes_mask must be unique across all instances of iftype_akm_suites. 4581 * 4582 * @iftypes_mask: bitmask of interfaces types 4583 * @akm_suites: points to an array of supported akm suites 4584 * @n_akm_suites: number of supported AKM suites 4585 */ 4586 struct wiphy_iftype_akm_suites { 4587 u16 iftypes_mask; 4588 const u32 *akm_suites; 4589 int n_akm_suites; 4590 }; 4591 4592 /** 4593 * struct wiphy - wireless hardware description 4594 * @reg_notifier: the driver's regulatory notification callback, 4595 * note that if your driver uses wiphy_apply_custom_regulatory() 4596 * the reg_notifier's request can be passed as NULL 4597 * @regd: the driver's regulatory domain, if one was requested via 4598 * the regulatory_hint() API. This can be used by the driver 4599 * on the reg_notifier() if it chooses to ignore future 4600 * regulatory domain changes caused by other drivers. 4601 * @signal_type: signal type reported in &struct cfg80211_bss. 4602 * @cipher_suites: supported cipher suites 4603 * @n_cipher_suites: number of supported cipher suites 4604 * @akm_suites: supported AKM suites. These are the default AKMs supported if 4605 * the supported AKMs not advertized for a specific interface type in 4606 * iftype_akm_suites. 4607 * @n_akm_suites: number of supported AKM suites 4608 * @iftype_akm_suites: array of supported akm suites info per interface type. 4609 * Note that the bits in @iftypes_mask inside this structure cannot 4610 * overlap (i.e. only one occurrence of each type is allowed across all 4611 * instances of iftype_akm_suites). 4612 * @num_iftype_akm_suites: number of interface types for which supported akm 4613 * suites are specified separately. 4614 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 4615 * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 4616 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 4617 * -1 = fragmentation disabled, only odd values >= 256 used 4618 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 4619 * @_net: the network namespace this wiphy currently lives in 4620 * @perm_addr: permanent MAC address of this device 4621 * @addr_mask: If the device supports multiple MAC addresses by masking, 4622 * set this to a mask with variable bits set to 1, e.g. if the last 4623 * four bits are variable then set it to 00-00-00-00-00-0f. The actual 4624 * variable bits shall be determined by the interfaces added, with 4625 * interfaces not matching the mask being rejected to be brought up. 4626 * @n_addresses: number of addresses in @addresses. 4627 * @addresses: If the device has more than one address, set this pointer 4628 * to a list of addresses (6 bytes each). The first one will be used 4629 * by default for perm_addr. In this case, the mask should be set to 4630 * all-zeroes. In this case it is assumed that the device can handle 4631 * the same number of arbitrary MAC addresses. 4632 * @registered: protects ->resume and ->suspend sysfs callbacks against 4633 * unregister hardware 4634 * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>). 4635 * It will be renamed automatically on wiphy renames 4636 * @dev: (virtual) struct device for this wiphy. The item in 4637 * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev() 4638 * (see below). 4639 * @wext: wireless extension handlers 4640 * @priv: driver private data (sized according to wiphy_new() parameter) 4641 * @interface_modes: bitmask of interfaces types valid for this wiphy, 4642 * must be set by driver 4643 * @iface_combinations: Valid interface combinations array, should not 4644 * list single interface types. 4645 * @n_iface_combinations: number of entries in @iface_combinations array. 4646 * @software_iftypes: bitmask of software interface types, these are not 4647 * subject to any restrictions since they are purely managed in SW. 4648 * @flags: wiphy flags, see &enum wiphy_flags 4649 * @regulatory_flags: wiphy regulatory flags, see 4650 * &enum ieee80211_regulatory_flags 4651 * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 4652 * @ext_features: extended features advertised to nl80211, see 4653 * &enum nl80211_ext_feature_index. 4654 * @bss_priv_size: each BSS struct has private data allocated with it, 4655 * this variable determines its size 4656 * @max_scan_ssids: maximum number of SSIDs the device can scan for in 4657 * any given scan 4658 * @max_sched_scan_reqs: maximum number of scheduled scan requests that 4659 * the device can run concurrently. 4660 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 4661 * for in any given scheduled scan 4662 * @max_match_sets: maximum number of match sets the device can handle 4663 * when performing a scheduled scan, 0 if filtering is not 4664 * supported. 4665 * @max_scan_ie_len: maximum length of user-controlled IEs device can 4666 * add to probe request frames transmitted during a scan, must not 4667 * include fixed IEs like supported rates 4668 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 4669 * scans 4670 * @max_sched_scan_plans: maximum number of scan plans (scan interval and number 4671 * of iterations) for scheduled scan supported by the device. 4672 * @max_sched_scan_plan_interval: maximum interval (in seconds) for a 4673 * single scan plan supported by the device. 4674 * @max_sched_scan_plan_iterations: maximum number of iterations for a single 4675 * scan plan supported by the device. 4676 * @coverage_class: current coverage class 4677 * @fw_version: firmware version for ethtool reporting 4678 * @hw_version: hardware version for ethtool reporting 4679 * @max_num_pmkids: maximum number of PMKIDs supported by device 4680 * @privid: a pointer that drivers can use to identify if an arbitrary 4681 * wiphy is theirs, e.g. in global notifiers 4682 * @bands: information about bands/channels supported by this device 4683 * 4684 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 4685 * transmitted through nl80211, points to an array indexed by interface 4686 * type 4687 * 4688 * @available_antennas_tx: bitmap of antennas which are available to be 4689 * configured as TX antennas. Antenna configuration commands will be 4690 * rejected unless this or @available_antennas_rx is set. 4691 * 4692 * @available_antennas_rx: bitmap of antennas which are available to be 4693 * configured as RX antennas. Antenna configuration commands will be 4694 * rejected unless this or @available_antennas_tx is set. 4695 * 4696 * @probe_resp_offload: 4697 * Bitmap of supported protocols for probe response offloading. 4698 * See &enum nl80211_probe_resp_offload_support_attr. Only valid 4699 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 4700 * 4701 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 4702 * may request, if implemented. 4703 * 4704 * @wowlan: WoWLAN support information 4705 * @wowlan_config: current WoWLAN configuration; this should usually not be 4706 * used since access to it is necessarily racy, use the parameter passed 4707 * to the suspend() operation instead. 4708 * 4709 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 4710 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 4711 * If null, then none can be over-ridden. 4712 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 4713 * If null, then none can be over-ridden. 4714 * 4715 * @wdev_list: the list of associated (virtual) interfaces; this list must 4716 * not be modified by the driver, but can be read with RTNL/RCU protection. 4717 * 4718 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 4719 * supports for ACL. 4720 * 4721 * @extended_capabilities: extended capabilities supported by the driver, 4722 * additional capabilities might be supported by userspace; these are 4723 * the 802.11 extended capabilities ("Extended Capabilities element") 4724 * and are in the same format as in the information element. See 4725 * 802.11-2012 8.4.2.29 for the defined fields. These are the default 4726 * extended capabilities to be used if the capabilities are not specified 4727 * for a specific interface type in iftype_ext_capab. 4728 * @extended_capabilities_mask: mask of the valid values 4729 * @extended_capabilities_len: length of the extended capabilities 4730 * @iftype_ext_capab: array of extended capabilities per interface type 4731 * @num_iftype_ext_capab: number of interface types for which extended 4732 * capabilities are specified separately. 4733 * @coalesce: packet coalescing support information 4734 * 4735 * @vendor_commands: array of vendor commands supported by the hardware 4736 * @n_vendor_commands: number of vendor commands 4737 * @vendor_events: array of vendor events supported by the hardware 4738 * @n_vendor_events: number of vendor events 4739 * 4740 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 4741 * (including P2P GO) or 0 to indicate no such limit is advertised. The 4742 * driver is allowed to advertise a theoretical limit that it can reach in 4743 * some cases, but may not always reach. 4744 * 4745 * @max_num_csa_counters: Number of supported csa_counters in beacons 4746 * and probe responses. This value should be set if the driver 4747 * wishes to limit the number of csa counters. Default (0) means 4748 * infinite. 4749 * @bss_select_support: bitmask indicating the BSS selection criteria supported 4750 * by the driver in the .connect() callback. The bit position maps to the 4751 * attribute indices defined in &enum nl80211_bss_select_attr. 4752 * 4753 * @nan_supported_bands: bands supported by the device in NAN mode, a 4754 * bitmap of &enum nl80211_band values. For instance, for 4755 * NL80211_BAND_2GHZ, bit 0 would be set 4756 * (i.e. BIT(NL80211_BAND_2GHZ)). 4757 * 4758 * @txq_limit: configuration of internal TX queue frame limit 4759 * @txq_memory_limit: configuration internal TX queue memory limit 4760 * @txq_quantum: configuration of internal TX queue scheduler quantum 4761 * 4762 * @tx_queue_len: allow setting transmit queue len for drivers not using 4763 * wake_tx_queue 4764 * 4765 * @support_mbssid: can HW support association with nontransmitted AP 4766 * @support_only_he_mbssid: don't parse MBSSID elements if it is not 4767 * HE AP, in order to avoid compatibility issues. 4768 * @support_mbssid must be set for this to have any effect. 4769 * 4770 * @pmsr_capa: peer measurement capabilities 4771 * 4772 * @tid_config_support: describes the per-TID config support that the 4773 * device has 4774 * @tid_config_support.vif: bitmap of attributes (configurations) 4775 * supported by the driver for each vif 4776 * @tid_config_support.peer: bitmap of attributes (configurations) 4777 * supported by the driver for each peer 4778 * @tid_config_support.max_retry: maximum supported retry count for 4779 * long/short retry configuration 4780 * 4781 * @max_data_retry_count: maximum supported per TID retry count for 4782 * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and 4783 * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes 4784 */ 4785 struct wiphy { 4786 /* assign these fields before you register the wiphy */ 4787 4788 u8 perm_addr[ETH_ALEN]; 4789 u8 addr_mask[ETH_ALEN]; 4790 4791 struct mac_address *addresses; 4792 4793 const struct ieee80211_txrx_stypes *mgmt_stypes; 4794 4795 const struct ieee80211_iface_combination *iface_combinations; 4796 int n_iface_combinations; 4797 u16 software_iftypes; 4798 4799 u16 n_addresses; 4800 4801 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 4802 u16 interface_modes; 4803 4804 u16 max_acl_mac_addrs; 4805 4806 u32 flags, regulatory_flags, features; 4807 u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 4808 4809 u32 ap_sme_capa; 4810 4811 enum cfg80211_signal_type signal_type; 4812 4813 int bss_priv_size; 4814 u8 max_scan_ssids; 4815 u8 max_sched_scan_reqs; 4816 u8 max_sched_scan_ssids; 4817 u8 max_match_sets; 4818 u16 max_scan_ie_len; 4819 u16 max_sched_scan_ie_len; 4820 u32 max_sched_scan_plans; 4821 u32 max_sched_scan_plan_interval; 4822 u32 max_sched_scan_plan_iterations; 4823 4824 int n_cipher_suites; 4825 const u32 *cipher_suites; 4826 4827 int n_akm_suites; 4828 const u32 *akm_suites; 4829 4830 const struct wiphy_iftype_akm_suites *iftype_akm_suites; 4831 unsigned int num_iftype_akm_suites; 4832 4833 u8 retry_short; 4834 u8 retry_long; 4835 u32 frag_threshold; 4836 u32 rts_threshold; 4837 u8 coverage_class; 4838 4839 char fw_version[ETHTOOL_FWVERS_LEN]; 4840 u32 hw_version; 4841 4842 #ifdef CONFIG_PM 4843 const struct wiphy_wowlan_support *wowlan; 4844 struct cfg80211_wowlan *wowlan_config; 4845 #endif 4846 4847 u16 max_remain_on_channel_duration; 4848 4849 u8 max_num_pmkids; 4850 4851 u32 available_antennas_tx; 4852 u32 available_antennas_rx; 4853 4854 u32 probe_resp_offload; 4855 4856 const u8 *extended_capabilities, *extended_capabilities_mask; 4857 u8 extended_capabilities_len; 4858 4859 const struct wiphy_iftype_ext_capab *iftype_ext_capab; 4860 unsigned int num_iftype_ext_capab; 4861 4862 const void *privid; 4863 4864 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 4865 4866 void (*reg_notifier)(struct wiphy *wiphy, 4867 struct regulatory_request *request); 4868 4869 /* fields below are read-only, assigned by cfg80211 */ 4870 4871 const struct ieee80211_regdomain __rcu *regd; 4872 4873 struct device dev; 4874 4875 bool registered; 4876 4877 struct dentry *debugfsdir; 4878 4879 const struct ieee80211_ht_cap *ht_capa_mod_mask; 4880 const struct ieee80211_vht_cap *vht_capa_mod_mask; 4881 4882 struct list_head wdev_list; 4883 4884 possible_net_t _net; 4885 4886 #ifdef CONFIG_CFG80211_WEXT 4887 const struct iw_handler_def *wext; 4888 #endif 4889 4890 const struct wiphy_coalesce_support *coalesce; 4891 4892 const struct wiphy_vendor_command *vendor_commands; 4893 const struct nl80211_vendor_cmd_info *vendor_events; 4894 int n_vendor_commands, n_vendor_events; 4895 4896 u16 max_ap_assoc_sta; 4897 4898 u8 max_num_csa_counters; 4899 4900 u32 bss_select_support; 4901 4902 u8 nan_supported_bands; 4903 4904 u32 txq_limit; 4905 u32 txq_memory_limit; 4906 u32 txq_quantum; 4907 4908 unsigned long tx_queue_len; 4909 4910 u8 support_mbssid:1, 4911 support_only_he_mbssid:1; 4912 4913 const struct cfg80211_pmsr_capabilities *pmsr_capa; 4914 4915 struct { 4916 u64 peer, vif; 4917 u8 max_retry; 4918 } tid_config_support; 4919 4920 u8 max_data_retry_count; 4921 4922 char priv[] __aligned(NETDEV_ALIGN); 4923 }; 4924 4925 static inline struct net *wiphy_net(struct wiphy *wiphy) 4926 { 4927 return read_pnet(&wiphy->_net); 4928 } 4929 4930 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 4931 { 4932 write_pnet(&wiphy->_net, net); 4933 } 4934 4935 /** 4936 * wiphy_priv - return priv from wiphy 4937 * 4938 * @wiphy: the wiphy whose priv pointer to return 4939 * Return: The priv of @wiphy. 4940 */ 4941 static inline void *wiphy_priv(struct wiphy *wiphy) 4942 { 4943 BUG_ON(!wiphy); 4944 return &wiphy->priv; 4945 } 4946 4947 /** 4948 * priv_to_wiphy - return the wiphy containing the priv 4949 * 4950 * @priv: a pointer previously returned by wiphy_priv 4951 * Return: The wiphy of @priv. 4952 */ 4953 static inline struct wiphy *priv_to_wiphy(void *priv) 4954 { 4955 BUG_ON(!priv); 4956 return container_of(priv, struct wiphy, priv); 4957 } 4958 4959 /** 4960 * set_wiphy_dev - set device pointer for wiphy 4961 * 4962 * @wiphy: The wiphy whose device to bind 4963 * @dev: The device to parent it to 4964 */ 4965 static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 4966 { 4967 wiphy->dev.parent = dev; 4968 } 4969 4970 /** 4971 * wiphy_dev - get wiphy dev pointer 4972 * 4973 * @wiphy: The wiphy whose device struct to look up 4974 * Return: The dev of @wiphy. 4975 */ 4976 static inline struct device *wiphy_dev(struct wiphy *wiphy) 4977 { 4978 return wiphy->dev.parent; 4979 } 4980 4981 /** 4982 * wiphy_name - get wiphy name 4983 * 4984 * @wiphy: The wiphy whose name to return 4985 * Return: The name of @wiphy. 4986 */ 4987 static inline const char *wiphy_name(const struct wiphy *wiphy) 4988 { 4989 return dev_name(&wiphy->dev); 4990 } 4991 4992 /** 4993 * wiphy_new_nm - create a new wiphy for use with cfg80211 4994 * 4995 * @ops: The configuration operations for this device 4996 * @sizeof_priv: The size of the private area to allocate 4997 * @requested_name: Request a particular name. 4998 * NULL is valid value, and means use the default phy%d naming. 4999 * 5000 * Create a new wiphy and associate the given operations with it. 5001 * @sizeof_priv bytes are allocated for private use. 5002 * 5003 * Return: A pointer to the new wiphy. This pointer must be 5004 * assigned to each netdev's ieee80211_ptr for proper operation. 5005 */ 5006 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 5007 const char *requested_name); 5008 5009 /** 5010 * wiphy_new - create a new wiphy for use with cfg80211 5011 * 5012 * @ops: The configuration operations for this device 5013 * @sizeof_priv: The size of the private area to allocate 5014 * 5015 * Create a new wiphy and associate the given operations with it. 5016 * @sizeof_priv bytes are allocated for private use. 5017 * 5018 * Return: A pointer to the new wiphy. This pointer must be 5019 * assigned to each netdev's ieee80211_ptr for proper operation. 5020 */ 5021 static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 5022 int sizeof_priv) 5023 { 5024 return wiphy_new_nm(ops, sizeof_priv, NULL); 5025 } 5026 5027 /** 5028 * wiphy_register - register a wiphy with cfg80211 5029 * 5030 * @wiphy: The wiphy to register. 5031 * 5032 * Return: A non-negative wiphy index or a negative error code. 5033 */ 5034 int wiphy_register(struct wiphy *wiphy); 5035 5036 /** 5037 * wiphy_unregister - deregister a wiphy from cfg80211 5038 * 5039 * @wiphy: The wiphy to unregister. 5040 * 5041 * After this call, no more requests can be made with this priv 5042 * pointer, but the call may sleep to wait for an outstanding 5043 * request that is being handled. 5044 */ 5045 void wiphy_unregister(struct wiphy *wiphy); 5046 5047 /** 5048 * wiphy_free - free wiphy 5049 * 5050 * @wiphy: The wiphy to free 5051 */ 5052 void wiphy_free(struct wiphy *wiphy); 5053 5054 /* internal structs */ 5055 struct cfg80211_conn; 5056 struct cfg80211_internal_bss; 5057 struct cfg80211_cached_keys; 5058 struct cfg80211_cqm_config; 5059 5060 /** 5061 * struct wireless_dev - wireless device state 5062 * 5063 * For netdevs, this structure must be allocated by the driver 5064 * that uses the ieee80211_ptr field in struct net_device (this 5065 * is intentional so it can be allocated along with the netdev.) 5066 * It need not be registered then as netdev registration will 5067 * be intercepted by cfg80211 to see the new wireless device. 5068 * 5069 * For non-netdev uses, it must also be allocated by the driver 5070 * in response to the cfg80211 callbacks that require it, as 5071 * there's no netdev registration in that case it may not be 5072 * allocated outside of callback operations that return it. 5073 * 5074 * @wiphy: pointer to hardware description 5075 * @iftype: interface type 5076 * @list: (private) Used to collect the interfaces 5077 * @netdev: (private) Used to reference back to the netdev, may be %NULL 5078 * @identifier: (private) Identifier used in nl80211 to identify this 5079 * wireless device if it has no netdev 5080 * @current_bss: (private) Used by the internal configuration code 5081 * @chandef: (private) Used by the internal configuration code to track 5082 * the user-set channel definition. 5083 * @preset_chandef: (private) Used by the internal configuration code to 5084 * track the channel to be used for AP later 5085 * @bssid: (private) Used by the internal configuration code 5086 * @ssid: (private) Used by the internal configuration code 5087 * @ssid_len: (private) Used by the internal configuration code 5088 * @mesh_id_len: (private) Used by the internal configuration code 5089 * @mesh_id_up_len: (private) Used by the internal configuration code 5090 * @wext: (private) Used by the internal wireless extensions compat code 5091 * @wext.ibss: (private) IBSS data part of wext handling 5092 * @wext.connect: (private) connection handling data 5093 * @wext.keys: (private) (WEP) key data 5094 * @wext.ie: (private) extra elements for association 5095 * @wext.ie_len: (private) length of extra elements 5096 * @wext.bssid: (private) selected network BSSID 5097 * @wext.ssid: (private) selected network SSID 5098 * @wext.default_key: (private) selected default key index 5099 * @wext.default_mgmt_key: (private) selected default management key index 5100 * @wext.prev_bssid: (private) previous BSSID for reassociation 5101 * @wext.prev_bssid_valid: (private) previous BSSID validity 5102 * @use_4addr: indicates 4addr mode is used on this interface, must be 5103 * set by driver (if supported) on add_interface BEFORE registering the 5104 * netdev and may otherwise be used by driver read-only, will be update 5105 * by cfg80211 on change_interface 5106 * @mgmt_registrations: list of registrations for management frames 5107 * @mgmt_registrations_lock: lock for the list 5108 * @mgmt_registrations_need_update: mgmt registrations were updated, 5109 * need to propagate the update to the driver 5110 * @mtx: mutex used to lock data in this struct, may be used by drivers 5111 * and some API functions require it held 5112 * @beacon_interval: beacon interval used on this device for transmitting 5113 * beacons, 0 when not valid 5114 * @address: The address for this device, valid only if @netdev is %NULL 5115 * @is_running: true if this is a non-netdev device that has been started, e.g. 5116 * the P2P Device. 5117 * @cac_started: true if DFS channel availability check has been started 5118 * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 5119 * @cac_time_ms: CAC time in ms 5120 * @ps: powersave mode is enabled 5121 * @ps_timeout: dynamic powersave timeout 5122 * @ap_unexpected_nlportid: (private) netlink port ID of application 5123 * registered for unexpected class 3 frames (AP mode) 5124 * @conn: (private) cfg80211 software SME connection state machine data 5125 * @connect_keys: (private) keys to set after connection is established 5126 * @conn_bss_type: connecting/connected BSS type 5127 * @conn_owner_nlportid: (private) connection owner socket port ID 5128 * @disconnect_wk: (private) auto-disconnect work 5129 * @disconnect_bssid: (private) the BSSID to use for auto-disconnect 5130 * @ibss_fixed: (private) IBSS is using fixed BSSID 5131 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 5132 * @event_list: (private) list for internal event processing 5133 * @event_lock: (private) lock for event list 5134 * @owner_nlportid: (private) owner socket port ID 5135 * @nl_owner_dead: (private) owner socket went away 5136 * @cqm_config: (private) nl80211 RSSI monitor state 5137 * @pmsr_list: (private) peer measurement requests 5138 * @pmsr_lock: (private) peer measurements requests/results lock 5139 * @pmsr_free_wk: (private) peer measurements cleanup work 5140 * @unprot_beacon_reported: (private) timestamp of last 5141 * unprotected beacon report 5142 */ 5143 struct wireless_dev { 5144 struct wiphy *wiphy; 5145 enum nl80211_iftype iftype; 5146 5147 /* the remainder of this struct should be private to cfg80211 */ 5148 struct list_head list; 5149 struct net_device *netdev; 5150 5151 u32 identifier; 5152 5153 struct list_head mgmt_registrations; 5154 spinlock_t mgmt_registrations_lock; 5155 u8 mgmt_registrations_need_update:1; 5156 5157 struct mutex mtx; 5158 5159 bool use_4addr, is_running; 5160 5161 u8 address[ETH_ALEN] __aligned(sizeof(u16)); 5162 5163 /* currently used for IBSS and SME - might be rearranged later */ 5164 u8 ssid[IEEE80211_MAX_SSID_LEN]; 5165 u8 ssid_len, mesh_id_len, mesh_id_up_len; 5166 struct cfg80211_conn *conn; 5167 struct cfg80211_cached_keys *connect_keys; 5168 enum ieee80211_bss_type conn_bss_type; 5169 u32 conn_owner_nlportid; 5170 5171 struct work_struct disconnect_wk; 5172 u8 disconnect_bssid[ETH_ALEN]; 5173 5174 struct list_head event_list; 5175 spinlock_t event_lock; 5176 5177 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 5178 struct cfg80211_chan_def preset_chandef; 5179 struct cfg80211_chan_def chandef; 5180 5181 bool ibss_fixed; 5182 bool ibss_dfs_possible; 5183 5184 bool ps; 5185 int ps_timeout; 5186 5187 int beacon_interval; 5188 5189 u32 ap_unexpected_nlportid; 5190 5191 u32 owner_nlportid; 5192 bool nl_owner_dead; 5193 5194 bool cac_started; 5195 unsigned long cac_start_time; 5196 unsigned int cac_time_ms; 5197 5198 #ifdef CONFIG_CFG80211_WEXT 5199 /* wext data */ 5200 struct { 5201 struct cfg80211_ibss_params ibss; 5202 struct cfg80211_connect_params connect; 5203 struct cfg80211_cached_keys *keys; 5204 const u8 *ie; 5205 size_t ie_len; 5206 u8 bssid[ETH_ALEN]; 5207 u8 prev_bssid[ETH_ALEN]; 5208 u8 ssid[IEEE80211_MAX_SSID_LEN]; 5209 s8 default_key, default_mgmt_key; 5210 bool prev_bssid_valid; 5211 } wext; 5212 #endif 5213 5214 struct cfg80211_cqm_config *cqm_config; 5215 5216 struct list_head pmsr_list; 5217 spinlock_t pmsr_lock; 5218 struct work_struct pmsr_free_wk; 5219 5220 unsigned long unprot_beacon_reported; 5221 }; 5222 5223 static inline u8 *wdev_address(struct wireless_dev *wdev) 5224 { 5225 if (wdev->netdev) 5226 return wdev->netdev->dev_addr; 5227 return wdev->address; 5228 } 5229 5230 static inline bool wdev_running(struct wireless_dev *wdev) 5231 { 5232 if (wdev->netdev) 5233 return netif_running(wdev->netdev); 5234 return wdev->is_running; 5235 } 5236 5237 /** 5238 * wdev_priv - return wiphy priv from wireless_dev 5239 * 5240 * @wdev: The wireless device whose wiphy's priv pointer to return 5241 * Return: The wiphy priv of @wdev. 5242 */ 5243 static inline void *wdev_priv(struct wireless_dev *wdev) 5244 { 5245 BUG_ON(!wdev); 5246 return wiphy_priv(wdev->wiphy); 5247 } 5248 5249 /** 5250 * DOC: Utility functions 5251 * 5252 * cfg80211 offers a number of utility functions that can be useful. 5253 */ 5254 5255 /** 5256 * ieee80211_channel_equal - compare two struct ieee80211_channel 5257 * 5258 * @a: 1st struct ieee80211_channel 5259 * @b: 2nd struct ieee80211_channel 5260 * Return: true if center frequency of @a == @b 5261 */ 5262 static inline bool 5263 ieee80211_channel_equal(struct ieee80211_channel *a, 5264 struct ieee80211_channel *b) 5265 { 5266 return (a->center_freq == b->center_freq && 5267 a->freq_offset == b->freq_offset); 5268 } 5269 5270 /** 5271 * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz 5272 * @chan: struct ieee80211_channel to convert 5273 * Return: The corresponding frequency (in KHz) 5274 */ 5275 static inline u32 5276 ieee80211_channel_to_khz(const struct ieee80211_channel *chan) 5277 { 5278 return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset; 5279 } 5280 5281 /** 5282 * ieee80211_channel_to_freq_khz - convert channel number to frequency 5283 * @chan: channel number 5284 * @band: band, necessary due to channel number overlap 5285 * Return: The corresponding frequency (in KHz), or 0 if the conversion failed. 5286 */ 5287 u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band); 5288 5289 /** 5290 * ieee80211_channel_to_frequency - convert channel number to frequency 5291 * @chan: channel number 5292 * @band: band, necessary due to channel number overlap 5293 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 5294 */ 5295 static inline int 5296 ieee80211_channel_to_frequency(int chan, enum nl80211_band band) 5297 { 5298 return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band)); 5299 } 5300 5301 /** 5302 * ieee80211_freq_khz_to_channel - convert frequency to channel number 5303 * @freq: center frequency in KHz 5304 * Return: The corresponding channel, or 0 if the conversion failed. 5305 */ 5306 int ieee80211_freq_khz_to_channel(u32 freq); 5307 5308 /** 5309 * ieee80211_frequency_to_channel - convert frequency to channel number 5310 * @freq: center frequency in MHz 5311 * Return: The corresponding channel, or 0 if the conversion failed. 5312 */ 5313 static inline int 5314 ieee80211_frequency_to_channel(int freq) 5315 { 5316 return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq)); 5317 } 5318 5319 /** 5320 * ieee80211_get_channel_khz - get channel struct from wiphy for specified 5321 * frequency 5322 * @wiphy: the struct wiphy to get the channel for 5323 * @freq: the center frequency (in KHz) of the channel 5324 * Return: The channel struct from @wiphy at @freq. 5325 */ 5326 struct ieee80211_channel * 5327 ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq); 5328 5329 /** 5330 * ieee80211_get_channel - get channel struct from wiphy for specified frequency 5331 * 5332 * @wiphy: the struct wiphy to get the channel for 5333 * @freq: the center frequency (in MHz) of the channel 5334 * Return: The channel struct from @wiphy at @freq. 5335 */ 5336 static inline struct ieee80211_channel * 5337 ieee80211_get_channel(struct wiphy *wiphy, int freq) 5338 { 5339 return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq)); 5340 } 5341 5342 /** 5343 * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC 5344 * @chan: control channel to check 5345 * 5346 * The Preferred Scanning Channels (PSC) are defined in 5347 * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3 5348 */ 5349 static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan) 5350 { 5351 if (chan->band != NL80211_BAND_6GHZ) 5352 return false; 5353 5354 return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5; 5355 } 5356 5357 /** 5358 * ieee80211_get_response_rate - get basic rate for a given rate 5359 * 5360 * @sband: the band to look for rates in 5361 * @basic_rates: bitmap of basic rates 5362 * @bitrate: the bitrate for which to find the basic rate 5363 * 5364 * Return: The basic rate corresponding to a given bitrate, that 5365 * is the next lower bitrate contained in the basic rate map, 5366 * which is, for this function, given as a bitmap of indices of 5367 * rates in the band's bitrate table. 5368 */ 5369 struct ieee80211_rate * 5370 ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 5371 u32 basic_rates, int bitrate); 5372 5373 /** 5374 * ieee80211_mandatory_rates - get mandatory rates for a given band 5375 * @sband: the band to look for rates in 5376 * @scan_width: width of the control channel 5377 * 5378 * This function returns a bitmap of the mandatory rates for the given 5379 * band, bits are set according to the rate position in the bitrates array. 5380 */ 5381 u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 5382 enum nl80211_bss_scan_width scan_width); 5383 5384 /* 5385 * Radiotap parsing functions -- for controlled injection support 5386 * 5387 * Implemented in net/wireless/radiotap.c 5388 * Documentation in Documentation/networking/radiotap-headers.rst 5389 */ 5390 5391 struct radiotap_align_size { 5392 uint8_t align:4, size:4; 5393 }; 5394 5395 struct ieee80211_radiotap_namespace { 5396 const struct radiotap_align_size *align_size; 5397 int n_bits; 5398 uint32_t oui; 5399 uint8_t subns; 5400 }; 5401 5402 struct ieee80211_radiotap_vendor_namespaces { 5403 const struct ieee80211_radiotap_namespace *ns; 5404 int n_ns; 5405 }; 5406 5407 /** 5408 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 5409 * @this_arg_index: index of current arg, valid after each successful call 5410 * to ieee80211_radiotap_iterator_next() 5411 * @this_arg: pointer to current radiotap arg; it is valid after each 5412 * call to ieee80211_radiotap_iterator_next() but also after 5413 * ieee80211_radiotap_iterator_init() where it will point to 5414 * the beginning of the actual data portion 5415 * @this_arg_size: length of the current arg, for convenience 5416 * @current_namespace: pointer to the current namespace definition 5417 * (or internally %NULL if the current namespace is unknown) 5418 * @is_radiotap_ns: indicates whether the current namespace is the default 5419 * radiotap namespace or not 5420 * 5421 * @_rtheader: pointer to the radiotap header we are walking through 5422 * @_max_length: length of radiotap header in cpu byte ordering 5423 * @_arg_index: next argument index 5424 * @_arg: next argument pointer 5425 * @_next_bitmap: internal pointer to next present u32 5426 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 5427 * @_vns: vendor namespace definitions 5428 * @_next_ns_data: beginning of the next namespace's data 5429 * @_reset_on_ext: internal; reset the arg index to 0 when going to the 5430 * next bitmap word 5431 * 5432 * Describes the radiotap parser state. Fields prefixed with an underscore 5433 * must not be used by users of the parser, only by the parser internally. 5434 */ 5435 5436 struct ieee80211_radiotap_iterator { 5437 struct ieee80211_radiotap_header *_rtheader; 5438 const struct ieee80211_radiotap_vendor_namespaces *_vns; 5439 const struct ieee80211_radiotap_namespace *current_namespace; 5440 5441 unsigned char *_arg, *_next_ns_data; 5442 __le32 *_next_bitmap; 5443 5444 unsigned char *this_arg; 5445 int this_arg_index; 5446 int this_arg_size; 5447 5448 int is_radiotap_ns; 5449 5450 int _max_length; 5451 int _arg_index; 5452 uint32_t _bitmap_shifter; 5453 int _reset_on_ext; 5454 }; 5455 5456 int 5457 ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 5458 struct ieee80211_radiotap_header *radiotap_header, 5459 int max_length, 5460 const struct ieee80211_radiotap_vendor_namespaces *vns); 5461 5462 int 5463 ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 5464 5465 5466 extern const unsigned char rfc1042_header[6]; 5467 extern const unsigned char bridge_tunnel_header[6]; 5468 5469 /** 5470 * ieee80211_get_hdrlen_from_skb - get header length from data 5471 * 5472 * @skb: the frame 5473 * 5474 * Given an skb with a raw 802.11 header at the data pointer this function 5475 * returns the 802.11 header length. 5476 * 5477 * Return: The 802.11 header length in bytes (not including encryption 5478 * headers). Or 0 if the data in the sk_buff is too short to contain a valid 5479 * 802.11 header. 5480 */ 5481 unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 5482 5483 /** 5484 * ieee80211_hdrlen - get header length in bytes from frame control 5485 * @fc: frame control field in little-endian format 5486 * Return: The header length in bytes. 5487 */ 5488 unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 5489 5490 /** 5491 * ieee80211_get_mesh_hdrlen - get mesh extension header length 5492 * @meshhdr: the mesh extension header, only the flags field 5493 * (first byte) will be accessed 5494 * Return: The length of the extension header, which is always at 5495 * least 6 bytes and at most 18 if address 5 and 6 are present. 5496 */ 5497 unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 5498 5499 /** 5500 * DOC: Data path helpers 5501 * 5502 * In addition to generic utilities, cfg80211 also offers 5503 * functions that help implement the data path for devices 5504 * that do not do the 802.11/802.3 conversion on the device. 5505 */ 5506 5507 /** 5508 * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3 5509 * @skb: the 802.11 data frame 5510 * @ehdr: pointer to a &struct ethhdr that will get the header, instead 5511 * of it being pushed into the SKB 5512 * @addr: the device MAC address 5513 * @iftype: the virtual interface type 5514 * @data_offset: offset of payload after the 802.11 header 5515 * Return: 0 on success. Non-zero on error. 5516 */ 5517 int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, 5518 const u8 *addr, enum nl80211_iftype iftype, 5519 u8 data_offset); 5520 5521 /** 5522 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 5523 * @skb: the 802.11 data frame 5524 * @addr: the device MAC address 5525 * @iftype: the virtual interface type 5526 * Return: 0 on success. Non-zero on error. 5527 */ 5528 static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 5529 enum nl80211_iftype iftype) 5530 { 5531 return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0); 5532 } 5533 5534 /** 5535 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 5536 * 5537 * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames. 5538 * The @list will be empty if the decode fails. The @skb must be fully 5539 * header-less before being passed in here; it is freed in this function. 5540 * 5541 * @skb: The input A-MSDU frame without any headers. 5542 * @list: The output list of 802.3 frames. It must be allocated and 5543 * initialized by the caller. 5544 * @addr: The device MAC address. 5545 * @iftype: The device interface type. 5546 * @extra_headroom: The hardware extra headroom for SKBs in the @list. 5547 * @check_da: DA to check in the inner ethernet header, or NULL 5548 * @check_sa: SA to check in the inner ethernet header, or NULL 5549 */ 5550 void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 5551 const u8 *addr, enum nl80211_iftype iftype, 5552 const unsigned int extra_headroom, 5553 const u8 *check_da, const u8 *check_sa); 5554 5555 /** 5556 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 5557 * @skb: the data frame 5558 * @qos_map: Interworking QoS mapping or %NULL if not in use 5559 * Return: The 802.1p/1d tag. 5560 */ 5561 unsigned int cfg80211_classify8021d(struct sk_buff *skb, 5562 struct cfg80211_qos_map *qos_map); 5563 5564 /** 5565 * cfg80211_find_elem_match - match information element and byte array in data 5566 * 5567 * @eid: element ID 5568 * @ies: data consisting of IEs 5569 * @len: length of data 5570 * @match: byte array to match 5571 * @match_len: number of bytes in the match array 5572 * @match_offset: offset in the IE data where the byte array should match. 5573 * Note the difference to cfg80211_find_ie_match() which considers 5574 * the offset to start from the element ID byte, but here we take 5575 * the data portion instead. 5576 * 5577 * Return: %NULL if the element ID could not be found or if 5578 * the element is invalid (claims to be longer than the given 5579 * data) or if the byte array doesn't match; otherwise return the 5580 * requested element struct. 5581 * 5582 * Note: There are no checks on the element length other than 5583 * having to fit into the given data and being large enough for the 5584 * byte array to match. 5585 */ 5586 const struct element * 5587 cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len, 5588 const u8 *match, unsigned int match_len, 5589 unsigned int match_offset); 5590 5591 /** 5592 * cfg80211_find_ie_match - match information element and byte array in data 5593 * 5594 * @eid: element ID 5595 * @ies: data consisting of IEs 5596 * @len: length of data 5597 * @match: byte array to match 5598 * @match_len: number of bytes in the match array 5599 * @match_offset: offset in the IE where the byte array should match. 5600 * If match_len is zero, this must also be set to zero. 5601 * Otherwise this must be set to 2 or more, because the first 5602 * byte is the element id, which is already compared to eid, and 5603 * the second byte is the IE length. 5604 * 5605 * Return: %NULL if the element ID could not be found or if 5606 * the element is invalid (claims to be longer than the given 5607 * data) or if the byte array doesn't match, or a pointer to the first 5608 * byte of the requested element, that is the byte containing the 5609 * element ID. 5610 * 5611 * Note: There are no checks on the element length other than 5612 * having to fit into the given data and being large enough for the 5613 * byte array to match. 5614 */ 5615 static inline const u8 * 5616 cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len, 5617 const u8 *match, unsigned int match_len, 5618 unsigned int match_offset) 5619 { 5620 /* match_offset can't be smaller than 2, unless match_len is 5621 * zero, in which case match_offset must be zero as well. 5622 */ 5623 if (WARN_ON((match_len && match_offset < 2) || 5624 (!match_len && match_offset))) 5625 return NULL; 5626 5627 return (void *)cfg80211_find_elem_match(eid, ies, len, 5628 match, match_len, 5629 match_offset ? 5630 match_offset - 2 : 0); 5631 } 5632 5633 /** 5634 * cfg80211_find_elem - find information element in data 5635 * 5636 * @eid: element ID 5637 * @ies: data consisting of IEs 5638 * @len: length of data 5639 * 5640 * Return: %NULL if the element ID could not be found or if 5641 * the element is invalid (claims to be longer than the given 5642 * data) or if the byte array doesn't match; otherwise return the 5643 * requested element struct. 5644 * 5645 * Note: There are no checks on the element length other than 5646 * having to fit into the given data. 5647 */ 5648 static inline const struct element * 5649 cfg80211_find_elem(u8 eid, const u8 *ies, int len) 5650 { 5651 return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0); 5652 } 5653 5654 /** 5655 * cfg80211_find_ie - find information element in data 5656 * 5657 * @eid: element ID 5658 * @ies: data consisting of IEs 5659 * @len: length of data 5660 * 5661 * Return: %NULL if the element ID could not be found or if 5662 * the element is invalid (claims to be longer than the given 5663 * data), or a pointer to the first byte of the requested 5664 * element, that is the byte containing the element ID. 5665 * 5666 * Note: There are no checks on the element length other than 5667 * having to fit into the given data. 5668 */ 5669 static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) 5670 { 5671 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0); 5672 } 5673 5674 /** 5675 * cfg80211_find_ext_elem - find information element with EID Extension in data 5676 * 5677 * @ext_eid: element ID Extension 5678 * @ies: data consisting of IEs 5679 * @len: length of data 5680 * 5681 * Return: %NULL if the etended element could not be found or if 5682 * the element is invalid (claims to be longer than the given 5683 * data) or if the byte array doesn't match; otherwise return the 5684 * requested element struct. 5685 * 5686 * Note: There are no checks on the element length other than 5687 * having to fit into the given data. 5688 */ 5689 static inline const struct element * 5690 cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len) 5691 { 5692 return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len, 5693 &ext_eid, 1, 0); 5694 } 5695 5696 /** 5697 * cfg80211_find_ext_ie - find information element with EID Extension in data 5698 * 5699 * @ext_eid: element ID Extension 5700 * @ies: data consisting of IEs 5701 * @len: length of data 5702 * 5703 * Return: %NULL if the extended element ID could not be found or if 5704 * the element is invalid (claims to be longer than the given 5705 * data), or a pointer to the first byte of the requested 5706 * element, that is the byte containing the element ID. 5707 * 5708 * Note: There are no checks on the element length other than 5709 * having to fit into the given data. 5710 */ 5711 static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len) 5712 { 5713 return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len, 5714 &ext_eid, 1, 2); 5715 } 5716 5717 /** 5718 * cfg80211_find_vendor_elem - find vendor specific information element in data 5719 * 5720 * @oui: vendor OUI 5721 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 5722 * @ies: data consisting of IEs 5723 * @len: length of data 5724 * 5725 * Return: %NULL if the vendor specific element ID could not be found or if the 5726 * element is invalid (claims to be longer than the given data); otherwise 5727 * return the element structure for the requested element. 5728 * 5729 * Note: There are no checks on the element length other than having to fit into 5730 * the given data. 5731 */ 5732 const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type, 5733 const u8 *ies, 5734 unsigned int len); 5735 5736 /** 5737 * cfg80211_find_vendor_ie - find vendor specific information element in data 5738 * 5739 * @oui: vendor OUI 5740 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 5741 * @ies: data consisting of IEs 5742 * @len: length of data 5743 * 5744 * Return: %NULL if the vendor specific element ID could not be found or if the 5745 * element is invalid (claims to be longer than the given data), or a pointer to 5746 * the first byte of the requested element, that is the byte containing the 5747 * element ID. 5748 * 5749 * Note: There are no checks on the element length other than having to fit into 5750 * the given data. 5751 */ 5752 static inline const u8 * 5753 cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 5754 const u8 *ies, unsigned int len) 5755 { 5756 return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len); 5757 } 5758 5759 /** 5760 * cfg80211_send_layer2_update - send layer 2 update frame 5761 * 5762 * @dev: network device 5763 * @addr: STA MAC address 5764 * 5765 * Wireless drivers can use this function to update forwarding tables in bridge 5766 * devices upon STA association. 5767 */ 5768 void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr); 5769 5770 /** 5771 * DOC: Regulatory enforcement infrastructure 5772 * 5773 * TODO 5774 */ 5775 5776 /** 5777 * regulatory_hint - driver hint to the wireless core a regulatory domain 5778 * @wiphy: the wireless device giving the hint (used only for reporting 5779 * conflicts) 5780 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 5781 * should be in. If @rd is set this should be NULL. Note that if you 5782 * set this to NULL you should still set rd->alpha2 to some accepted 5783 * alpha2. 5784 * 5785 * Wireless drivers can use this function to hint to the wireless core 5786 * what it believes should be the current regulatory domain by 5787 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 5788 * domain should be in or by providing a completely build regulatory domain. 5789 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 5790 * for a regulatory domain structure for the respective country. 5791 * 5792 * The wiphy must have been registered to cfg80211 prior to this call. 5793 * For cfg80211 drivers this means you must first use wiphy_register(), 5794 * for mac80211 drivers you must first use ieee80211_register_hw(). 5795 * 5796 * Drivers should check the return value, its possible you can get 5797 * an -ENOMEM. 5798 * 5799 * Return: 0 on success. -ENOMEM. 5800 */ 5801 int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 5802 5803 /** 5804 * regulatory_set_wiphy_regd - set regdom info for self managed drivers 5805 * @wiphy: the wireless device we want to process the regulatory domain on 5806 * @rd: the regulatory domain informatoin to use for this wiphy 5807 * 5808 * Set the regulatory domain information for self-managed wiphys, only they 5809 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 5810 * information. 5811 * 5812 * Return: 0 on success. -EINVAL, -EPERM 5813 */ 5814 int regulatory_set_wiphy_regd(struct wiphy *wiphy, 5815 struct ieee80211_regdomain *rd); 5816 5817 /** 5818 * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers 5819 * @wiphy: the wireless device we want to process the regulatory domain on 5820 * @rd: the regulatory domain information to use for this wiphy 5821 * 5822 * This functions requires the RTNL to be held and applies the new regdomain 5823 * synchronously to this wiphy. For more details see 5824 * regulatory_set_wiphy_regd(). 5825 * 5826 * Return: 0 on success. -EINVAL, -EPERM 5827 */ 5828 int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 5829 struct ieee80211_regdomain *rd); 5830 5831 /** 5832 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 5833 * @wiphy: the wireless device we want to process the regulatory domain on 5834 * @regd: the custom regulatory domain to use for this wiphy 5835 * 5836 * Drivers can sometimes have custom regulatory domains which do not apply 5837 * to a specific country. Drivers can use this to apply such custom regulatory 5838 * domains. This routine must be called prior to wiphy registration. The 5839 * custom regulatory domain will be trusted completely and as such previous 5840 * default channel settings will be disregarded. If no rule is found for a 5841 * channel on the regulatory domain the channel will be disabled. 5842 * Drivers using this for a wiphy should also set the wiphy flag 5843 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 5844 * that called this helper. 5845 */ 5846 void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 5847 const struct ieee80211_regdomain *regd); 5848 5849 /** 5850 * freq_reg_info - get regulatory information for the given frequency 5851 * @wiphy: the wiphy for which we want to process this rule for 5852 * @center_freq: Frequency in KHz for which we want regulatory information for 5853 * 5854 * Use this function to get the regulatory rule for a specific frequency on 5855 * a given wireless device. If the device has a specific regulatory domain 5856 * it wants to follow we respect that unless a country IE has been received 5857 * and processed already. 5858 * 5859 * Return: A valid pointer, or, when an error occurs, for example if no rule 5860 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 5861 * check and PTR_ERR() to obtain the numeric return value. The numeric return 5862 * value will be -ERANGE if we determine the given center_freq does not even 5863 * have a regulatory rule for a frequency range in the center_freq's band. 5864 * See freq_in_rule_band() for our current definition of a band -- this is 5865 * purely subjective and right now it's 802.11 specific. 5866 */ 5867 const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 5868 u32 center_freq); 5869 5870 /** 5871 * reg_initiator_name - map regulatory request initiator enum to name 5872 * @initiator: the regulatory request initiator 5873 * 5874 * You can use this to map the regulatory request initiator enum to a 5875 * proper string representation. 5876 */ 5877 const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 5878 5879 /** 5880 * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom 5881 * @wiphy: wiphy for which pre-CAC capability is checked. 5882 * 5883 * Pre-CAC is allowed only in some regdomains (notable ETSI). 5884 */ 5885 bool regulatory_pre_cac_allowed(struct wiphy *wiphy); 5886 5887 /** 5888 * DOC: Internal regulatory db functions 5889 * 5890 */ 5891 5892 /** 5893 * reg_query_regdb_wmm - Query internal regulatory db for wmm rule 5894 * Regulatory self-managed driver can use it to proactively 5895 * 5896 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried. 5897 * @freq: the freqency(in MHz) to be queried. 5898 * @rule: pointer to store the wmm rule from the regulatory db. 5899 * 5900 * Self-managed wireless drivers can use this function to query 5901 * the internal regulatory database to check whether the given 5902 * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations. 5903 * 5904 * Drivers should check the return value, its possible you can get 5905 * an -ENODATA. 5906 * 5907 * Return: 0 on success. -ENODATA. 5908 */ 5909 int reg_query_regdb_wmm(char *alpha2, int freq, 5910 struct ieee80211_reg_rule *rule); 5911 5912 /* 5913 * callbacks for asynchronous cfg80211 methods, notification 5914 * functions and BSS handling helpers 5915 */ 5916 5917 /** 5918 * cfg80211_scan_done - notify that scan finished 5919 * 5920 * @request: the corresponding scan request 5921 * @info: information about the completed scan 5922 */ 5923 void cfg80211_scan_done(struct cfg80211_scan_request *request, 5924 struct cfg80211_scan_info *info); 5925 5926 /** 5927 * cfg80211_sched_scan_results - notify that new scan results are available 5928 * 5929 * @wiphy: the wiphy which got scheduled scan results 5930 * @reqid: identifier for the related scheduled scan request 5931 */ 5932 void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid); 5933 5934 /** 5935 * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 5936 * 5937 * @wiphy: the wiphy on which the scheduled scan stopped 5938 * @reqid: identifier for the related scheduled scan request 5939 * 5940 * The driver can call this function to inform cfg80211 that the 5941 * scheduled scan had to be stopped, for whatever reason. The driver 5942 * is then called back via the sched_scan_stop operation when done. 5943 */ 5944 void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid); 5945 5946 /** 5947 * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped 5948 * 5949 * @wiphy: the wiphy on which the scheduled scan stopped 5950 * @reqid: identifier for the related scheduled scan request 5951 * 5952 * The driver can call this function to inform cfg80211 that the 5953 * scheduled scan had to be stopped, for whatever reason. The driver 5954 * is then called back via the sched_scan_stop operation when done. 5955 * This function should be called with rtnl locked. 5956 */ 5957 void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid); 5958 5959 /** 5960 * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame 5961 * @wiphy: the wiphy reporting the BSS 5962 * @data: the BSS metadata 5963 * @mgmt: the management frame (probe response or beacon) 5964 * @len: length of the management frame 5965 * @gfp: context flags 5966 * 5967 * This informs cfg80211 that BSS information was found and 5968 * the BSS should be updated/added. 5969 * 5970 * Return: A referenced struct, must be released with cfg80211_put_bss()! 5971 * Or %NULL on error. 5972 */ 5973 struct cfg80211_bss * __must_check 5974 cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 5975 struct cfg80211_inform_bss *data, 5976 struct ieee80211_mgmt *mgmt, size_t len, 5977 gfp_t gfp); 5978 5979 static inline struct cfg80211_bss * __must_check 5980 cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 5981 struct ieee80211_channel *rx_channel, 5982 enum nl80211_bss_scan_width scan_width, 5983 struct ieee80211_mgmt *mgmt, size_t len, 5984 s32 signal, gfp_t gfp) 5985 { 5986 struct cfg80211_inform_bss data = { 5987 .chan = rx_channel, 5988 .scan_width = scan_width, 5989 .signal = signal, 5990 }; 5991 5992 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 5993 } 5994 5995 static inline struct cfg80211_bss * __must_check 5996 cfg80211_inform_bss_frame(struct wiphy *wiphy, 5997 struct ieee80211_channel *rx_channel, 5998 struct ieee80211_mgmt *mgmt, size_t len, 5999 s32 signal, gfp_t gfp) 6000 { 6001 struct cfg80211_inform_bss data = { 6002 .chan = rx_channel, 6003 .scan_width = NL80211_BSS_CHAN_WIDTH_20, 6004 .signal = signal, 6005 }; 6006 6007 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 6008 } 6009 6010 /** 6011 * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID 6012 * @bssid: transmitter BSSID 6013 * @max_bssid: max BSSID indicator, taken from Multiple BSSID element 6014 * @mbssid_index: BSSID index, taken from Multiple BSSID index element 6015 * @new_bssid: calculated nontransmitted BSSID 6016 */ 6017 static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid, 6018 u8 mbssid_index, u8 *new_bssid) 6019 { 6020 u64 bssid_u64 = ether_addr_to_u64(bssid); 6021 u64 mask = GENMASK_ULL(max_bssid - 1, 0); 6022 u64 new_bssid_u64; 6023 6024 new_bssid_u64 = bssid_u64 & ~mask; 6025 6026 new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask; 6027 6028 u64_to_ether_addr(new_bssid_u64, new_bssid); 6029 } 6030 6031 /** 6032 * cfg80211_is_element_inherited - returns if element ID should be inherited 6033 * @element: element to check 6034 * @non_inherit_element: non inheritance element 6035 */ 6036 bool cfg80211_is_element_inherited(const struct element *element, 6037 const struct element *non_inherit_element); 6038 6039 /** 6040 * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs 6041 * @ie: ies 6042 * @ielen: length of IEs 6043 * @mbssid_elem: current MBSSID element 6044 * @sub_elem: current MBSSID subelement (profile) 6045 * @merged_ie: location of the merged profile 6046 * @max_copy_len: max merged profile length 6047 */ 6048 size_t cfg80211_merge_profile(const u8 *ie, size_t ielen, 6049 const struct element *mbssid_elem, 6050 const struct element *sub_elem, 6051 u8 *merged_ie, size_t max_copy_len); 6052 6053 /** 6054 * enum cfg80211_bss_frame_type - frame type that the BSS data came from 6055 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 6056 * from a beacon or probe response 6057 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 6058 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 6059 */ 6060 enum cfg80211_bss_frame_type { 6061 CFG80211_BSS_FTYPE_UNKNOWN, 6062 CFG80211_BSS_FTYPE_BEACON, 6063 CFG80211_BSS_FTYPE_PRESP, 6064 }; 6065 6066 /** 6067 * cfg80211_inform_bss_data - inform cfg80211 of a new BSS 6068 * 6069 * @wiphy: the wiphy reporting the BSS 6070 * @data: the BSS metadata 6071 * @ftype: frame type (if known) 6072 * @bssid: the BSSID of the BSS 6073 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 6074 * @capability: the capability field sent by the peer 6075 * @beacon_interval: the beacon interval announced by the peer 6076 * @ie: additional IEs sent by the peer 6077 * @ielen: length of the additional IEs 6078 * @gfp: context flags 6079 * 6080 * This informs cfg80211 that BSS information was found and 6081 * the BSS should be updated/added. 6082 * 6083 * Return: A referenced struct, must be released with cfg80211_put_bss()! 6084 * Or %NULL on error. 6085 */ 6086 struct cfg80211_bss * __must_check 6087 cfg80211_inform_bss_data(struct wiphy *wiphy, 6088 struct cfg80211_inform_bss *data, 6089 enum cfg80211_bss_frame_type ftype, 6090 const u8 *bssid, u64 tsf, u16 capability, 6091 u16 beacon_interval, const u8 *ie, size_t ielen, 6092 gfp_t gfp); 6093 6094 static inline struct cfg80211_bss * __must_check 6095 cfg80211_inform_bss_width(struct wiphy *wiphy, 6096 struct ieee80211_channel *rx_channel, 6097 enum nl80211_bss_scan_width scan_width, 6098 enum cfg80211_bss_frame_type ftype, 6099 const u8 *bssid, u64 tsf, u16 capability, 6100 u16 beacon_interval, const u8 *ie, size_t ielen, 6101 s32 signal, gfp_t gfp) 6102 { 6103 struct cfg80211_inform_bss data = { 6104 .chan = rx_channel, 6105 .scan_width = scan_width, 6106 .signal = signal, 6107 }; 6108 6109 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 6110 capability, beacon_interval, ie, ielen, 6111 gfp); 6112 } 6113 6114 static inline struct cfg80211_bss * __must_check 6115 cfg80211_inform_bss(struct wiphy *wiphy, 6116 struct ieee80211_channel *rx_channel, 6117 enum cfg80211_bss_frame_type ftype, 6118 const u8 *bssid, u64 tsf, u16 capability, 6119 u16 beacon_interval, const u8 *ie, size_t ielen, 6120 s32 signal, gfp_t gfp) 6121 { 6122 struct cfg80211_inform_bss data = { 6123 .chan = rx_channel, 6124 .scan_width = NL80211_BSS_CHAN_WIDTH_20, 6125 .signal = signal, 6126 }; 6127 6128 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 6129 capability, beacon_interval, ie, ielen, 6130 gfp); 6131 } 6132 6133 /** 6134 * cfg80211_get_bss - get a BSS reference 6135 * @wiphy: the wiphy this BSS struct belongs to 6136 * @channel: the channel to search on (or %NULL) 6137 * @bssid: the desired BSSID (or %NULL) 6138 * @ssid: the desired SSID (or %NULL) 6139 * @ssid_len: length of the SSID (or 0) 6140 * @bss_type: type of BSS, see &enum ieee80211_bss_type 6141 * @privacy: privacy filter, see &enum ieee80211_privacy 6142 */ 6143 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 6144 struct ieee80211_channel *channel, 6145 const u8 *bssid, 6146 const u8 *ssid, size_t ssid_len, 6147 enum ieee80211_bss_type bss_type, 6148 enum ieee80211_privacy privacy); 6149 static inline struct cfg80211_bss * 6150 cfg80211_get_ibss(struct wiphy *wiphy, 6151 struct ieee80211_channel *channel, 6152 const u8 *ssid, size_t ssid_len) 6153 { 6154 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 6155 IEEE80211_BSS_TYPE_IBSS, 6156 IEEE80211_PRIVACY_ANY); 6157 } 6158 6159 /** 6160 * cfg80211_ref_bss - reference BSS struct 6161 * @wiphy: the wiphy this BSS struct belongs to 6162 * @bss: the BSS struct to reference 6163 * 6164 * Increments the refcount of the given BSS struct. 6165 */ 6166 void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 6167 6168 /** 6169 * cfg80211_put_bss - unref BSS struct 6170 * @wiphy: the wiphy this BSS struct belongs to 6171 * @bss: the BSS struct 6172 * 6173 * Decrements the refcount of the given BSS struct. 6174 */ 6175 void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 6176 6177 /** 6178 * cfg80211_unlink_bss - unlink BSS from internal data structures 6179 * @wiphy: the wiphy 6180 * @bss: the bss to remove 6181 * 6182 * This function removes the given BSS from the internal data structures 6183 * thereby making it no longer show up in scan results etc. Use this 6184 * function when you detect a BSS is gone. Normally BSSes will also time 6185 * out, so it is not necessary to use this function at all. 6186 */ 6187 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 6188 6189 /** 6190 * cfg80211_bss_iter - iterate all BSS entries 6191 * 6192 * This function iterates over the BSS entries associated with the given wiphy 6193 * and calls the callback for the iterated BSS. The iterator function is not 6194 * allowed to call functions that might modify the internal state of the BSS DB. 6195 * 6196 * @wiphy: the wiphy 6197 * @chandef: if given, the iterator function will be called only if the channel 6198 * of the currently iterated BSS is a subset of the given channel. 6199 * @iter: the iterator function to call 6200 * @iter_data: an argument to the iterator function 6201 */ 6202 void cfg80211_bss_iter(struct wiphy *wiphy, 6203 struct cfg80211_chan_def *chandef, 6204 void (*iter)(struct wiphy *wiphy, 6205 struct cfg80211_bss *bss, 6206 void *data), 6207 void *iter_data); 6208 6209 static inline enum nl80211_bss_scan_width 6210 cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 6211 { 6212 switch (chandef->width) { 6213 case NL80211_CHAN_WIDTH_5: 6214 return NL80211_BSS_CHAN_WIDTH_5; 6215 case NL80211_CHAN_WIDTH_10: 6216 return NL80211_BSS_CHAN_WIDTH_10; 6217 default: 6218 return NL80211_BSS_CHAN_WIDTH_20; 6219 } 6220 } 6221 6222 /** 6223 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 6224 * @dev: network device 6225 * @buf: authentication frame (header + body) 6226 * @len: length of the frame data 6227 * 6228 * This function is called whenever an authentication, disassociation or 6229 * deauthentication frame has been received and processed in station mode. 6230 * After being asked to authenticate via cfg80211_ops::auth() the driver must 6231 * call either this function or cfg80211_auth_timeout(). 6232 * After being asked to associate via cfg80211_ops::assoc() the driver must 6233 * call either this function or cfg80211_auth_timeout(). 6234 * While connected, the driver must calls this for received and processed 6235 * disassociation and deauthentication frames. If the frame couldn't be used 6236 * because it was unprotected, the driver must call the function 6237 * cfg80211_rx_unprot_mlme_mgmt() instead. 6238 * 6239 * This function may sleep. The caller must hold the corresponding wdev's mutex. 6240 */ 6241 void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 6242 6243 /** 6244 * cfg80211_auth_timeout - notification of timed out authentication 6245 * @dev: network device 6246 * @addr: The MAC address of the device with which the authentication timed out 6247 * 6248 * This function may sleep. The caller must hold the corresponding wdev's 6249 * mutex. 6250 */ 6251 void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 6252 6253 /** 6254 * cfg80211_rx_assoc_resp - notification of processed association response 6255 * @dev: network device 6256 * @bss: the BSS that association was requested with, ownership of the pointer 6257 * moves to cfg80211 in this call 6258 * @buf: (Re)Association Response frame (header + body) 6259 * @len: length of the frame data 6260 * @uapsd_queues: bitmap of queues configured for uapsd. Same format 6261 * as the AC bitmap in the QoS info field 6262 * @req_ies: information elements from the (Re)Association Request frame 6263 * @req_ies_len: length of req_ies data 6264 * 6265 * After being asked to associate via cfg80211_ops::assoc() the driver must 6266 * call either this function or cfg80211_auth_timeout(). 6267 * 6268 * This function may sleep. The caller must hold the corresponding wdev's mutex. 6269 */ 6270 void cfg80211_rx_assoc_resp(struct net_device *dev, 6271 struct cfg80211_bss *bss, 6272 const u8 *buf, size_t len, 6273 int uapsd_queues, 6274 const u8 *req_ies, size_t req_ies_len); 6275 6276 /** 6277 * cfg80211_assoc_timeout - notification of timed out association 6278 * @dev: network device 6279 * @bss: The BSS entry with which association timed out. 6280 * 6281 * This function may sleep. The caller must hold the corresponding wdev's mutex. 6282 */ 6283 void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss); 6284 6285 /** 6286 * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt 6287 * @dev: network device 6288 * @bss: The BSS entry with which association was abandoned. 6289 * 6290 * Call this whenever - for reasons reported through other API, like deauth RX, 6291 * an association attempt was abandoned. 6292 * This function may sleep. The caller must hold the corresponding wdev's mutex. 6293 */ 6294 void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss); 6295 6296 /** 6297 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 6298 * @dev: network device 6299 * @buf: 802.11 frame (header + body) 6300 * @len: length of the frame data 6301 * 6302 * This function is called whenever deauthentication has been processed in 6303 * station mode. This includes both received deauthentication frames and 6304 * locally generated ones. This function may sleep. The caller must hold the 6305 * corresponding wdev's mutex. 6306 */ 6307 void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 6308 6309 /** 6310 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 6311 * @dev: network device 6312 * @buf: received management frame (header + body) 6313 * @len: length of the frame data 6314 * 6315 * This function is called whenever a received deauthentication or dissassoc 6316 * frame has been dropped in station mode because of MFP being used but the 6317 * frame was not protected. This is also used to notify reception of a Beacon 6318 * frame that was dropped because it did not include a valid MME MIC while 6319 * beacon protection was enabled (BIGTK configured in station mode). 6320 * 6321 * This function may sleep. 6322 */ 6323 void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 6324 const u8 *buf, size_t len); 6325 6326 /** 6327 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 6328 * @dev: network device 6329 * @addr: The source MAC address of the frame 6330 * @key_type: The key type that the received frame used 6331 * @key_id: Key identifier (0..3). Can be -1 if missing. 6332 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 6333 * @gfp: allocation flags 6334 * 6335 * This function is called whenever the local MAC detects a MIC failure in a 6336 * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 6337 * primitive. 6338 */ 6339 void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 6340 enum nl80211_key_type key_type, int key_id, 6341 const u8 *tsc, gfp_t gfp); 6342 6343 /** 6344 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 6345 * 6346 * @dev: network device 6347 * @bssid: the BSSID of the IBSS joined 6348 * @channel: the channel of the IBSS joined 6349 * @gfp: allocation flags 6350 * 6351 * This function notifies cfg80211 that the device joined an IBSS or 6352 * switched to a different BSSID. Before this function can be called, 6353 * either a beacon has to have been received from the IBSS, or one of 6354 * the cfg80211_inform_bss{,_frame} functions must have been called 6355 * with the locally generated beacon -- this guarantees that there is 6356 * always a scan result for this IBSS. cfg80211 will handle the rest. 6357 */ 6358 void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 6359 struct ieee80211_channel *channel, gfp_t gfp); 6360 6361 /** 6362 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 6363 * 6364 * @dev: network device 6365 * @macaddr: the MAC address of the new candidate 6366 * @ie: information elements advertised by the peer candidate 6367 * @ie_len: length of the information elements buffer 6368 * @gfp: allocation flags 6369 * 6370 * This function notifies cfg80211 that the mesh peer candidate has been 6371 * detected, most likely via a beacon or, less likely, via a probe response. 6372 * cfg80211 then sends a notification to userspace. 6373 */ 6374 void cfg80211_notify_new_peer_candidate(struct net_device *dev, 6375 const u8 *macaddr, const u8 *ie, u8 ie_len, 6376 int sig_dbm, gfp_t gfp); 6377 6378 /** 6379 * DOC: RFkill integration 6380 * 6381 * RFkill integration in cfg80211 is almost invisible to drivers, 6382 * as cfg80211 automatically registers an rfkill instance for each 6383 * wireless device it knows about. Soft kill is also translated 6384 * into disconnecting and turning all interfaces off, drivers are 6385 * expected to turn off the device when all interfaces are down. 6386 * 6387 * However, devices may have a hard RFkill line, in which case they 6388 * also need to interact with the rfkill subsystem, via cfg80211. 6389 * They can do this with a few helper functions documented here. 6390 */ 6391 6392 /** 6393 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 6394 * @wiphy: the wiphy 6395 * @blocked: block status 6396 */ 6397 void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 6398 6399 /** 6400 * wiphy_rfkill_start_polling - start polling rfkill 6401 * @wiphy: the wiphy 6402 */ 6403 void wiphy_rfkill_start_polling(struct wiphy *wiphy); 6404 6405 /** 6406 * wiphy_rfkill_stop_polling - stop polling rfkill 6407 * @wiphy: the wiphy 6408 */ 6409 void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 6410 6411 /** 6412 * DOC: Vendor commands 6413 * 6414 * Occasionally, there are special protocol or firmware features that 6415 * can't be implemented very openly. For this and similar cases, the 6416 * vendor command functionality allows implementing the features with 6417 * (typically closed-source) userspace and firmware, using nl80211 as 6418 * the configuration mechanism. 6419 * 6420 * A driver supporting vendor commands must register them as an array 6421 * in struct wiphy, with handlers for each one, each command has an 6422 * OUI and sub command ID to identify it. 6423 * 6424 * Note that this feature should not be (ab)used to implement protocol 6425 * features that could openly be shared across drivers. In particular, 6426 * it must never be required to use vendor commands to implement any 6427 * "normal" functionality that higher-level userspace like connection 6428 * managers etc. need. 6429 */ 6430 6431 struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 6432 enum nl80211_commands cmd, 6433 enum nl80211_attrs attr, 6434 int approxlen); 6435 6436 struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 6437 struct wireless_dev *wdev, 6438 enum nl80211_commands cmd, 6439 enum nl80211_attrs attr, 6440 unsigned int portid, 6441 int vendor_event_idx, 6442 int approxlen, gfp_t gfp); 6443 6444 void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 6445 6446 /** 6447 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 6448 * @wiphy: the wiphy 6449 * @approxlen: an upper bound of the length of the data that will 6450 * be put into the skb 6451 * 6452 * This function allocates and pre-fills an skb for a reply to 6453 * a vendor command. Since it is intended for a reply, calling 6454 * it outside of a vendor command's doit() operation is invalid. 6455 * 6456 * The returned skb is pre-filled with some identifying data in 6457 * a way that any data that is put into the skb (with skb_put(), 6458 * nla_put() or similar) will end up being within the 6459 * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 6460 * with the skb is adding data for the corresponding userspace tool 6461 * which can then read that data out of the vendor data attribute. 6462 * You must not modify the skb in any other way. 6463 * 6464 * When done, call cfg80211_vendor_cmd_reply() with the skb and return 6465 * its error code as the result of the doit() operation. 6466 * 6467 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 6468 */ 6469 static inline struct sk_buff * 6470 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 6471 { 6472 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 6473 NL80211_ATTR_VENDOR_DATA, approxlen); 6474 } 6475 6476 /** 6477 * cfg80211_vendor_cmd_reply - send the reply skb 6478 * @skb: The skb, must have been allocated with 6479 * cfg80211_vendor_cmd_alloc_reply_skb() 6480 * 6481 * Since calling this function will usually be the last thing 6482 * before returning from the vendor command doit() you should 6483 * return the error code. Note that this function consumes the 6484 * skb regardless of the return value. 6485 * 6486 * Return: An error code or 0 on success. 6487 */ 6488 int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 6489 6490 /** 6491 * cfg80211_vendor_cmd_get_sender 6492 * @wiphy: the wiphy 6493 * 6494 * Return the current netlink port ID in a vendor command handler. 6495 * Valid to call only there. 6496 */ 6497 unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy); 6498 6499 /** 6500 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 6501 * @wiphy: the wiphy 6502 * @wdev: the wireless device 6503 * @event_idx: index of the vendor event in the wiphy's vendor_events 6504 * @approxlen: an upper bound of the length of the data that will 6505 * be put into the skb 6506 * @gfp: allocation flags 6507 * 6508 * This function allocates and pre-fills an skb for an event on the 6509 * vendor-specific multicast group. 6510 * 6511 * If wdev != NULL, both the ifindex and identifier of the specified 6512 * wireless device are added to the event message before the vendor data 6513 * attribute. 6514 * 6515 * When done filling the skb, call cfg80211_vendor_event() with the 6516 * skb to send the event. 6517 * 6518 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 6519 */ 6520 static inline struct sk_buff * 6521 cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev, 6522 int approxlen, int event_idx, gfp_t gfp) 6523 { 6524 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 6525 NL80211_ATTR_VENDOR_DATA, 6526 0, event_idx, approxlen, gfp); 6527 } 6528 6529 /** 6530 * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb 6531 * @wiphy: the wiphy 6532 * @wdev: the wireless device 6533 * @event_idx: index of the vendor event in the wiphy's vendor_events 6534 * @portid: port ID of the receiver 6535 * @approxlen: an upper bound of the length of the data that will 6536 * be put into the skb 6537 * @gfp: allocation flags 6538 * 6539 * This function allocates and pre-fills an skb for an event to send to 6540 * a specific (userland) socket. This socket would previously have been 6541 * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take 6542 * care to register a netlink notifier to see when the socket closes. 6543 * 6544 * If wdev != NULL, both the ifindex and identifier of the specified 6545 * wireless device are added to the event message before the vendor data 6546 * attribute. 6547 * 6548 * When done filling the skb, call cfg80211_vendor_event() with the 6549 * skb to send the event. 6550 * 6551 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 6552 */ 6553 static inline struct sk_buff * 6554 cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy, 6555 struct wireless_dev *wdev, 6556 unsigned int portid, int approxlen, 6557 int event_idx, gfp_t gfp) 6558 { 6559 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 6560 NL80211_ATTR_VENDOR_DATA, 6561 portid, event_idx, approxlen, gfp); 6562 } 6563 6564 /** 6565 * cfg80211_vendor_event - send the event 6566 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 6567 * @gfp: allocation flags 6568 * 6569 * This function sends the given @skb, which must have been allocated 6570 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 6571 */ 6572 static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 6573 { 6574 __cfg80211_send_event_skb(skb, gfp); 6575 } 6576 6577 #ifdef CONFIG_NL80211_TESTMODE 6578 /** 6579 * DOC: Test mode 6580 * 6581 * Test mode is a set of utility functions to allow drivers to 6582 * interact with driver-specific tools to aid, for instance, 6583 * factory programming. 6584 * 6585 * This chapter describes how drivers interact with it, for more 6586 * information see the nl80211 book's chapter on it. 6587 */ 6588 6589 /** 6590 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 6591 * @wiphy: the wiphy 6592 * @approxlen: an upper bound of the length of the data that will 6593 * be put into the skb 6594 * 6595 * This function allocates and pre-fills an skb for a reply to 6596 * the testmode command. Since it is intended for a reply, calling 6597 * it outside of the @testmode_cmd operation is invalid. 6598 * 6599 * The returned skb is pre-filled with the wiphy index and set up in 6600 * a way that any data that is put into the skb (with skb_put(), 6601 * nla_put() or similar) will end up being within the 6602 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 6603 * with the skb is adding data for the corresponding userspace tool 6604 * which can then read that data out of the testdata attribute. You 6605 * must not modify the skb in any other way. 6606 * 6607 * When done, call cfg80211_testmode_reply() with the skb and return 6608 * its error code as the result of the @testmode_cmd operation. 6609 * 6610 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 6611 */ 6612 static inline struct sk_buff * 6613 cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 6614 { 6615 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 6616 NL80211_ATTR_TESTDATA, approxlen); 6617 } 6618 6619 /** 6620 * cfg80211_testmode_reply - send the reply skb 6621 * @skb: The skb, must have been allocated with 6622 * cfg80211_testmode_alloc_reply_skb() 6623 * 6624 * Since calling this function will usually be the last thing 6625 * before returning from the @testmode_cmd you should return 6626 * the error code. Note that this function consumes the skb 6627 * regardless of the return value. 6628 * 6629 * Return: An error code or 0 on success. 6630 */ 6631 static inline int cfg80211_testmode_reply(struct sk_buff *skb) 6632 { 6633 return cfg80211_vendor_cmd_reply(skb); 6634 } 6635 6636 /** 6637 * cfg80211_testmode_alloc_event_skb - allocate testmode event 6638 * @wiphy: the wiphy 6639 * @approxlen: an upper bound of the length of the data that will 6640 * be put into the skb 6641 * @gfp: allocation flags 6642 * 6643 * This function allocates and pre-fills an skb for an event on the 6644 * testmode multicast group. 6645 * 6646 * The returned skb is set up in the same way as with 6647 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 6648 * there, you should simply add data to it that will then end up in the 6649 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 6650 * in any other way. 6651 * 6652 * When done filling the skb, call cfg80211_testmode_event() with the 6653 * skb to send the event. 6654 * 6655 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 6656 */ 6657 static inline struct sk_buff * 6658 cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 6659 { 6660 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE, 6661 NL80211_ATTR_TESTDATA, 0, -1, 6662 approxlen, gfp); 6663 } 6664 6665 /** 6666 * cfg80211_testmode_event - send the event 6667 * @skb: The skb, must have been allocated with 6668 * cfg80211_testmode_alloc_event_skb() 6669 * @gfp: allocation flags 6670 * 6671 * This function sends the given @skb, which must have been allocated 6672 * by cfg80211_testmode_alloc_event_skb(), as an event. It always 6673 * consumes it. 6674 */ 6675 static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 6676 { 6677 __cfg80211_send_event_skb(skb, gfp); 6678 } 6679 6680 #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 6681 #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 6682 #else 6683 #define CFG80211_TESTMODE_CMD(cmd) 6684 #define CFG80211_TESTMODE_DUMP(cmd) 6685 #endif 6686 6687 /** 6688 * struct cfg80211_fils_resp_params - FILS connection response params 6689 * @kek: KEK derived from a successful FILS connection (may be %NULL) 6690 * @kek_len: Length of @fils_kek in octets 6691 * @update_erp_next_seq_num: Boolean value to specify whether the value in 6692 * @erp_next_seq_num is valid. 6693 * @erp_next_seq_num: The next sequence number to use in ERP message in 6694 * FILS Authentication. This value should be specified irrespective of the 6695 * status for a FILS connection. 6696 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL). 6697 * @pmk_len: Length of @pmk in octets 6698 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID 6699 * used for this FILS connection (may be %NULL). 6700 */ 6701 struct cfg80211_fils_resp_params { 6702 const u8 *kek; 6703 size_t kek_len; 6704 bool update_erp_next_seq_num; 6705 u16 erp_next_seq_num; 6706 const u8 *pmk; 6707 size_t pmk_len; 6708 const u8 *pmkid; 6709 }; 6710 6711 /** 6712 * struct cfg80211_connect_resp_params - Connection response params 6713 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use 6714 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 6715 * the real status code for failures. If this call is used to report a 6716 * failure due to a timeout (e.g., not receiving an Authentication frame 6717 * from the AP) instead of an explicit rejection by the AP, -1 is used to 6718 * indicate that this is a failure, but without a status code. 6719 * @timeout_reason is used to report the reason for the timeout in that 6720 * case. 6721 * @bssid: The BSSID of the AP (may be %NULL) 6722 * @bss: Entry of bss to which STA got connected to, can be obtained through 6723 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the 6724 * bss from the connect_request and hold a reference to it and return 6725 * through this param to avoid a warning if the bss is expired during the 6726 * connection, esp. for those drivers implementing connect op. 6727 * Only one parameter among @bssid and @bss needs to be specified. 6728 * @req_ie: Association request IEs (may be %NULL) 6729 * @req_ie_len: Association request IEs length 6730 * @resp_ie: Association response IEs (may be %NULL) 6731 * @resp_ie_len: Association response IEs length 6732 * @fils: FILS connection response parameters. 6733 * @timeout_reason: Reason for connection timeout. This is used when the 6734 * connection fails due to a timeout instead of an explicit rejection from 6735 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 6736 * not known. This value is used only if @status < 0 to indicate that the 6737 * failure is due to a timeout and not due to explicit rejection by the AP. 6738 * This value is ignored in other cases (@status >= 0). 6739 */ 6740 struct cfg80211_connect_resp_params { 6741 int status; 6742 const u8 *bssid; 6743 struct cfg80211_bss *bss; 6744 const u8 *req_ie; 6745 size_t req_ie_len; 6746 const u8 *resp_ie; 6747 size_t resp_ie_len; 6748 struct cfg80211_fils_resp_params fils; 6749 enum nl80211_timeout_reason timeout_reason; 6750 }; 6751 6752 /** 6753 * cfg80211_connect_done - notify cfg80211 of connection result 6754 * 6755 * @dev: network device 6756 * @params: connection response parameters 6757 * @gfp: allocation flags 6758 * 6759 * It should be called by the underlying driver once execution of the connection 6760 * request from connect() has been completed. This is similar to 6761 * cfg80211_connect_bss(), but takes a structure pointer for connection response 6762 * parameters. Only one of the functions among cfg80211_connect_bss(), 6763 * cfg80211_connect_result(), cfg80211_connect_timeout(), 6764 * and cfg80211_connect_done() should be called. 6765 */ 6766 void cfg80211_connect_done(struct net_device *dev, 6767 struct cfg80211_connect_resp_params *params, 6768 gfp_t gfp); 6769 6770 /** 6771 * cfg80211_connect_bss - notify cfg80211 of connection result 6772 * 6773 * @dev: network device 6774 * @bssid: the BSSID of the AP 6775 * @bss: Entry of bss to which STA got connected to, can be obtained through 6776 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the 6777 * bss from the connect_request and hold a reference to it and return 6778 * through this param to avoid a warning if the bss is expired during the 6779 * connection, esp. for those drivers implementing connect op. 6780 * Only one parameter among @bssid and @bss needs to be specified. 6781 * @req_ie: association request IEs (maybe be %NULL) 6782 * @req_ie_len: association request IEs length 6783 * @resp_ie: association response IEs (may be %NULL) 6784 * @resp_ie_len: assoc response IEs length 6785 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 6786 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 6787 * the real status code for failures. If this call is used to report a 6788 * failure due to a timeout (e.g., not receiving an Authentication frame 6789 * from the AP) instead of an explicit rejection by the AP, -1 is used to 6790 * indicate that this is a failure, but without a status code. 6791 * @timeout_reason is used to report the reason for the timeout in that 6792 * case. 6793 * @gfp: allocation flags 6794 * @timeout_reason: reason for connection timeout. This is used when the 6795 * connection fails due to a timeout instead of an explicit rejection from 6796 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 6797 * not known. This value is used only if @status < 0 to indicate that the 6798 * failure is due to a timeout and not due to explicit rejection by the AP. 6799 * This value is ignored in other cases (@status >= 0). 6800 * 6801 * It should be called by the underlying driver once execution of the connection 6802 * request from connect() has been completed. This is similar to 6803 * cfg80211_connect_result(), but with the option of identifying the exact bss 6804 * entry for the connection. Only one of the functions among 6805 * cfg80211_connect_bss(), cfg80211_connect_result(), 6806 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 6807 */ 6808 static inline void 6809 cfg80211_connect_bss(struct net_device *dev, const u8 *bssid, 6810 struct cfg80211_bss *bss, const u8 *req_ie, 6811 size_t req_ie_len, const u8 *resp_ie, 6812 size_t resp_ie_len, int status, gfp_t gfp, 6813 enum nl80211_timeout_reason timeout_reason) 6814 { 6815 struct cfg80211_connect_resp_params params; 6816 6817 memset(¶ms, 0, sizeof(params)); 6818 params.status = status; 6819 params.bssid = bssid; 6820 params.bss = bss; 6821 params.req_ie = req_ie; 6822 params.req_ie_len = req_ie_len; 6823 params.resp_ie = resp_ie; 6824 params.resp_ie_len = resp_ie_len; 6825 params.timeout_reason = timeout_reason; 6826 6827 cfg80211_connect_done(dev, ¶ms, gfp); 6828 } 6829 6830 /** 6831 * cfg80211_connect_result - notify cfg80211 of connection result 6832 * 6833 * @dev: network device 6834 * @bssid: the BSSID of the AP 6835 * @req_ie: association request IEs (maybe be %NULL) 6836 * @req_ie_len: association request IEs length 6837 * @resp_ie: association response IEs (may be %NULL) 6838 * @resp_ie_len: assoc response IEs length 6839 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 6840 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 6841 * the real status code for failures. 6842 * @gfp: allocation flags 6843 * 6844 * It should be called by the underlying driver once execution of the connection 6845 * request from connect() has been completed. This is similar to 6846 * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only 6847 * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(), 6848 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 6849 */ 6850 static inline void 6851 cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 6852 const u8 *req_ie, size_t req_ie_len, 6853 const u8 *resp_ie, size_t resp_ie_len, 6854 u16 status, gfp_t gfp) 6855 { 6856 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie, 6857 resp_ie_len, status, gfp, 6858 NL80211_TIMEOUT_UNSPECIFIED); 6859 } 6860 6861 /** 6862 * cfg80211_connect_timeout - notify cfg80211 of connection timeout 6863 * 6864 * @dev: network device 6865 * @bssid: the BSSID of the AP 6866 * @req_ie: association request IEs (maybe be %NULL) 6867 * @req_ie_len: association request IEs length 6868 * @gfp: allocation flags 6869 * @timeout_reason: reason for connection timeout. 6870 * 6871 * It should be called by the underlying driver whenever connect() has failed 6872 * in a sequence where no explicit authentication/association rejection was 6873 * received from the AP. This could happen, e.g., due to not being able to send 6874 * out the Authentication or Association Request frame or timing out while 6875 * waiting for the response. Only one of the functions among 6876 * cfg80211_connect_bss(), cfg80211_connect_result(), 6877 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 6878 */ 6879 static inline void 6880 cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, 6881 const u8 *req_ie, size_t req_ie_len, gfp_t gfp, 6882 enum nl80211_timeout_reason timeout_reason) 6883 { 6884 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1, 6885 gfp, timeout_reason); 6886 } 6887 6888 /** 6889 * struct cfg80211_roam_info - driver initiated roaming information 6890 * 6891 * @channel: the channel of the new AP 6892 * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set) 6893 * @bssid: the BSSID of the new AP (may be %NULL if %bss is set) 6894 * @req_ie: association request IEs (maybe be %NULL) 6895 * @req_ie_len: association request IEs length 6896 * @resp_ie: association response IEs (may be %NULL) 6897 * @resp_ie_len: assoc response IEs length 6898 * @fils: FILS related roaming information. 6899 */ 6900 struct cfg80211_roam_info { 6901 struct ieee80211_channel *channel; 6902 struct cfg80211_bss *bss; 6903 const u8 *bssid; 6904 const u8 *req_ie; 6905 size_t req_ie_len; 6906 const u8 *resp_ie; 6907 size_t resp_ie_len; 6908 struct cfg80211_fils_resp_params fils; 6909 }; 6910 6911 /** 6912 * cfg80211_roamed - notify cfg80211 of roaming 6913 * 6914 * @dev: network device 6915 * @info: information about the new BSS. struct &cfg80211_roam_info. 6916 * @gfp: allocation flags 6917 * 6918 * This function may be called with the driver passing either the BSSID of the 6919 * new AP or passing the bss entry to avoid a race in timeout of the bss entry. 6920 * It should be called by the underlying driver whenever it roamed from one AP 6921 * to another while connected. Drivers which have roaming implemented in 6922 * firmware should pass the bss entry to avoid a race in bss entry timeout where 6923 * the bss entry of the new AP is seen in the driver, but gets timed out by the 6924 * time it is accessed in __cfg80211_roamed() due to delay in scheduling 6925 * rdev->event_work. In case of any failures, the reference is released 6926 * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be 6927 * released while disconnecting from the current bss. 6928 */ 6929 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, 6930 gfp_t gfp); 6931 6932 /** 6933 * cfg80211_port_authorized - notify cfg80211 of successful security association 6934 * 6935 * @dev: network device 6936 * @bssid: the BSSID of the AP 6937 * @gfp: allocation flags 6938 * 6939 * This function should be called by a driver that supports 4 way handshake 6940 * offload after a security association was successfully established (i.e., 6941 * the 4 way handshake was completed successfully). The call to this function 6942 * should be preceded with a call to cfg80211_connect_result(), 6943 * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to 6944 * indicate the 802.11 association. 6945 */ 6946 void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, 6947 gfp_t gfp); 6948 6949 /** 6950 * cfg80211_disconnected - notify cfg80211 that connection was dropped 6951 * 6952 * @dev: network device 6953 * @ie: information elements of the deauth/disassoc frame (may be %NULL) 6954 * @ie_len: length of IEs 6955 * @reason: reason code for the disconnection, set it to 0 if unknown 6956 * @locally_generated: disconnection was requested locally 6957 * @gfp: allocation flags 6958 * 6959 * After it calls this function, the driver should enter an idle state 6960 * and not try to connect to any AP any more. 6961 */ 6962 void cfg80211_disconnected(struct net_device *dev, u16 reason, 6963 const u8 *ie, size_t ie_len, 6964 bool locally_generated, gfp_t gfp); 6965 6966 /** 6967 * cfg80211_ready_on_channel - notification of remain_on_channel start 6968 * @wdev: wireless device 6969 * @cookie: the request cookie 6970 * @chan: The current channel (from remain_on_channel request) 6971 * @duration: Duration in milliseconds that the driver intents to remain on the 6972 * channel 6973 * @gfp: allocation flags 6974 */ 6975 void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 6976 struct ieee80211_channel *chan, 6977 unsigned int duration, gfp_t gfp); 6978 6979 /** 6980 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 6981 * @wdev: wireless device 6982 * @cookie: the request cookie 6983 * @chan: The current channel (from remain_on_channel request) 6984 * @gfp: allocation flags 6985 */ 6986 void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 6987 struct ieee80211_channel *chan, 6988 gfp_t gfp); 6989 6990 /** 6991 * cfg80211_tx_mgmt_expired - tx_mgmt duration expired 6992 * @wdev: wireless device 6993 * @cookie: the requested cookie 6994 * @chan: The current channel (from tx_mgmt request) 6995 * @gfp: allocation flags 6996 */ 6997 void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie, 6998 struct ieee80211_channel *chan, gfp_t gfp); 6999 7000 /** 7001 * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics. 7002 * 7003 * @sinfo: the station information 7004 * @gfp: allocation flags 7005 */ 7006 int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp); 7007 7008 /** 7009 * cfg80211_sinfo_release_content - release contents of station info 7010 * @sinfo: the station information 7011 * 7012 * Releases any potentially allocated sub-information of the station 7013 * information, but not the struct itself (since it's typically on 7014 * the stack.) 7015 */ 7016 static inline void cfg80211_sinfo_release_content(struct station_info *sinfo) 7017 { 7018 kfree(sinfo->pertid); 7019 } 7020 7021 /** 7022 * cfg80211_new_sta - notify userspace about station 7023 * 7024 * @dev: the netdev 7025 * @mac_addr: the station's address 7026 * @sinfo: the station information 7027 * @gfp: allocation flags 7028 */ 7029 void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 7030 struct station_info *sinfo, gfp_t gfp); 7031 7032 /** 7033 * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 7034 * @dev: the netdev 7035 * @mac_addr: the station's address 7036 * @sinfo: the station information/statistics 7037 * @gfp: allocation flags 7038 */ 7039 void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 7040 struct station_info *sinfo, gfp_t gfp); 7041 7042 /** 7043 * cfg80211_del_sta - notify userspace about deletion of a station 7044 * 7045 * @dev: the netdev 7046 * @mac_addr: the station's address 7047 * @gfp: allocation flags 7048 */ 7049 static inline void cfg80211_del_sta(struct net_device *dev, 7050 const u8 *mac_addr, gfp_t gfp) 7051 { 7052 cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp); 7053 } 7054 7055 /** 7056 * cfg80211_conn_failed - connection request failed notification 7057 * 7058 * @dev: the netdev 7059 * @mac_addr: the station's address 7060 * @reason: the reason for connection failure 7061 * @gfp: allocation flags 7062 * 7063 * Whenever a station tries to connect to an AP and if the station 7064 * could not connect to the AP as the AP has rejected the connection 7065 * for some reasons, this function is called. 7066 * 7067 * The reason for connection failure can be any of the value from 7068 * nl80211_connect_failed_reason enum 7069 */ 7070 void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 7071 enum nl80211_connect_failed_reason reason, 7072 gfp_t gfp); 7073 7074 /** 7075 * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame 7076 * @wdev: wireless device receiving the frame 7077 * @freq: Frequency on which the frame was received in KHz 7078 * @sig_dbm: signal strength in dBm, or 0 if unknown 7079 * @buf: Management frame (header + body) 7080 * @len: length of the frame data 7081 * @flags: flags, as defined in enum nl80211_rxmgmt_flags 7082 * 7083 * This function is called whenever an Action frame is received for a station 7084 * mode interface, but is not processed in kernel. 7085 * 7086 * Return: %true if a user space application has registered for this frame. 7087 * For action frames, that makes it responsible for rejecting unrecognized 7088 * action frames; %false otherwise, in which case for action frames the 7089 * driver is responsible for rejecting the frame. 7090 */ 7091 bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm, 7092 const u8 *buf, size_t len, u32 flags); 7093 7094 /** 7095 * cfg80211_rx_mgmt - notification of received, unprocessed management frame 7096 * @wdev: wireless device receiving the frame 7097 * @freq: Frequency on which the frame was received in MHz 7098 * @sig_dbm: signal strength in dBm, or 0 if unknown 7099 * @buf: Management frame (header + body) 7100 * @len: length of the frame data 7101 * @flags: flags, as defined in enum nl80211_rxmgmt_flags 7102 * 7103 * This function is called whenever an Action frame is received for a station 7104 * mode interface, but is not processed in kernel. 7105 * 7106 * Return: %true if a user space application has registered for this frame. 7107 * For action frames, that makes it responsible for rejecting unrecognized 7108 * action frames; %false otherwise, in which case for action frames the 7109 * driver is responsible for rejecting the frame. 7110 */ 7111 static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, 7112 int sig_dbm, const u8 *buf, size_t len, 7113 u32 flags) 7114 { 7115 return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len, 7116 flags); 7117 } 7118 7119 /** 7120 * cfg80211_mgmt_tx_status - notification of TX status for management frame 7121 * @wdev: wireless device receiving the frame 7122 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 7123 * @buf: Management frame (header + body) 7124 * @len: length of the frame data 7125 * @ack: Whether frame was acknowledged 7126 * @gfp: context flags 7127 * 7128 * This function is called whenever a management frame was requested to be 7129 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 7130 * transmission attempt. 7131 */ 7132 void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 7133 const u8 *buf, size_t len, bool ack, gfp_t gfp); 7134 7135 /** 7136 * cfg80211_control_port_tx_status - notification of TX status for control 7137 * port frames 7138 * @wdev: wireless device receiving the frame 7139 * @cookie: Cookie returned by cfg80211_ops::tx_control_port() 7140 * @buf: Data frame (header + body) 7141 * @len: length of the frame data 7142 * @ack: Whether frame was acknowledged 7143 * @gfp: context flags 7144 * 7145 * This function is called whenever a control port frame was requested to be 7146 * transmitted with cfg80211_ops::tx_control_port() to report the TX status of 7147 * the transmission attempt. 7148 */ 7149 void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie, 7150 const u8 *buf, size_t len, bool ack, 7151 gfp_t gfp); 7152 7153 /** 7154 * cfg80211_rx_control_port - notification about a received control port frame 7155 * @dev: The device the frame matched to 7156 * @skb: The skbuf with the control port frame. It is assumed that the skbuf 7157 * is 802.3 formatted (with 802.3 header). The skb can be non-linear. 7158 * This function does not take ownership of the skb, so the caller is 7159 * responsible for any cleanup. The caller must also ensure that 7160 * skb->protocol is set appropriately. 7161 * @unencrypted: Whether the frame was received unencrypted 7162 * 7163 * This function is used to inform userspace about a received control port 7164 * frame. It should only be used if userspace indicated it wants to receive 7165 * control port frames over nl80211. 7166 * 7167 * The frame is the data portion of the 802.3 or 802.11 data frame with all 7168 * network layer headers removed (e.g. the raw EAPoL frame). 7169 * 7170 * Return: %true if the frame was passed to userspace 7171 */ 7172 bool cfg80211_rx_control_port(struct net_device *dev, 7173 struct sk_buff *skb, bool unencrypted); 7174 7175 /** 7176 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 7177 * @dev: network device 7178 * @rssi_event: the triggered RSSI event 7179 * @rssi_level: new RSSI level value or 0 if not available 7180 * @gfp: context flags 7181 * 7182 * This function is called when a configured connection quality monitoring 7183 * rssi threshold reached event occurs. 7184 */ 7185 void cfg80211_cqm_rssi_notify(struct net_device *dev, 7186 enum nl80211_cqm_rssi_threshold_event rssi_event, 7187 s32 rssi_level, gfp_t gfp); 7188 7189 /** 7190 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 7191 * @dev: network device 7192 * @peer: peer's MAC address 7193 * @num_packets: how many packets were lost -- should be a fixed threshold 7194 * but probably no less than maybe 50, or maybe a throughput dependent 7195 * threshold (to account for temporary interference) 7196 * @gfp: context flags 7197 */ 7198 void cfg80211_cqm_pktloss_notify(struct net_device *dev, 7199 const u8 *peer, u32 num_packets, gfp_t gfp); 7200 7201 /** 7202 * cfg80211_cqm_txe_notify - TX error rate event 7203 * @dev: network device 7204 * @peer: peer's MAC address 7205 * @num_packets: how many packets were lost 7206 * @rate: % of packets which failed transmission 7207 * @intvl: interval (in s) over which the TX failure threshold was breached. 7208 * @gfp: context flags 7209 * 7210 * Notify userspace when configured % TX failures over number of packets in a 7211 * given interval is exceeded. 7212 */ 7213 void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 7214 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 7215 7216 /** 7217 * cfg80211_cqm_beacon_loss_notify - beacon loss event 7218 * @dev: network device 7219 * @gfp: context flags 7220 * 7221 * Notify userspace about beacon loss from the connected AP. 7222 */ 7223 void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 7224 7225 /** 7226 * cfg80211_radar_event - radar detection event 7227 * @wiphy: the wiphy 7228 * @chandef: chandef for the current channel 7229 * @gfp: context flags 7230 * 7231 * This function is called when a radar is detected on the current chanenl. 7232 */ 7233 void cfg80211_radar_event(struct wiphy *wiphy, 7234 struct cfg80211_chan_def *chandef, gfp_t gfp); 7235 7236 /** 7237 * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event 7238 * @dev: network device 7239 * @mac: MAC address of a station which opmode got modified 7240 * @sta_opmode: station's current opmode value 7241 * @gfp: context flags 7242 * 7243 * Driver should call this function when station's opmode modified via action 7244 * frame. 7245 */ 7246 void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac, 7247 struct sta_opmode_info *sta_opmode, 7248 gfp_t gfp); 7249 7250 /** 7251 * cfg80211_cac_event - Channel availability check (CAC) event 7252 * @netdev: network device 7253 * @chandef: chandef for the current channel 7254 * @event: type of event 7255 * @gfp: context flags 7256 * 7257 * This function is called when a Channel availability check (CAC) is finished 7258 * or aborted. This must be called to notify the completion of a CAC process, 7259 * also by full-MAC drivers. 7260 */ 7261 void cfg80211_cac_event(struct net_device *netdev, 7262 const struct cfg80211_chan_def *chandef, 7263 enum nl80211_radar_event event, gfp_t gfp); 7264 7265 7266 /** 7267 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 7268 * @dev: network device 7269 * @bssid: BSSID of AP (to avoid races) 7270 * @replay_ctr: new replay counter 7271 * @gfp: allocation flags 7272 */ 7273 void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 7274 const u8 *replay_ctr, gfp_t gfp); 7275 7276 /** 7277 * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 7278 * @dev: network device 7279 * @index: candidate index (the smaller the index, the higher the priority) 7280 * @bssid: BSSID of AP 7281 * @preauth: Whether AP advertises support for RSN pre-authentication 7282 * @gfp: allocation flags 7283 */ 7284 void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 7285 const u8 *bssid, bool preauth, gfp_t gfp); 7286 7287 /** 7288 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 7289 * @dev: The device the frame matched to 7290 * @addr: the transmitter address 7291 * @gfp: context flags 7292 * 7293 * This function is used in AP mode (only!) to inform userspace that 7294 * a spurious class 3 frame was received, to be able to deauth the 7295 * sender. 7296 * Return: %true if the frame was passed to userspace (or this failed 7297 * for a reason other than not having a subscription.) 7298 */ 7299 bool cfg80211_rx_spurious_frame(struct net_device *dev, 7300 const u8 *addr, gfp_t gfp); 7301 7302 /** 7303 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 7304 * @dev: The device the frame matched to 7305 * @addr: the transmitter address 7306 * @gfp: context flags 7307 * 7308 * This function is used in AP mode (only!) to inform userspace that 7309 * an associated station sent a 4addr frame but that wasn't expected. 7310 * It is allowed and desirable to send this event only once for each 7311 * station to avoid event flooding. 7312 * Return: %true if the frame was passed to userspace (or this failed 7313 * for a reason other than not having a subscription.) 7314 */ 7315 bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 7316 const u8 *addr, gfp_t gfp); 7317 7318 /** 7319 * cfg80211_probe_status - notify userspace about probe status 7320 * @dev: the device the probe was sent on 7321 * @addr: the address of the peer 7322 * @cookie: the cookie filled in @probe_client previously 7323 * @acked: indicates whether probe was acked or not 7324 * @ack_signal: signal strength (in dBm) of the ACK frame. 7325 * @is_valid_ack_signal: indicates the ack_signal is valid or not. 7326 * @gfp: allocation flags 7327 */ 7328 void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 7329 u64 cookie, bool acked, s32 ack_signal, 7330 bool is_valid_ack_signal, gfp_t gfp); 7331 7332 /** 7333 * cfg80211_report_obss_beacon_khz - report beacon from other APs 7334 * @wiphy: The wiphy that received the beacon 7335 * @frame: the frame 7336 * @len: length of the frame 7337 * @freq: frequency the frame was received on in KHz 7338 * @sig_dbm: signal strength in dBm, or 0 if unknown 7339 * 7340 * Use this function to report to userspace when a beacon was 7341 * received. It is not useful to call this when there is no 7342 * netdev that is in AP/GO mode. 7343 */ 7344 void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame, 7345 size_t len, int freq, int sig_dbm); 7346 7347 /** 7348 * cfg80211_report_obss_beacon - report beacon from other APs 7349 * @wiphy: The wiphy that received the beacon 7350 * @frame: the frame 7351 * @len: length of the frame 7352 * @freq: frequency the frame was received on 7353 * @sig_dbm: signal strength in dBm, or 0 if unknown 7354 * 7355 * Use this function to report to userspace when a beacon was 7356 * received. It is not useful to call this when there is no 7357 * netdev that is in AP/GO mode. 7358 */ 7359 static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy, 7360 const u8 *frame, size_t len, 7361 int freq, int sig_dbm) 7362 { 7363 cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq), 7364 sig_dbm); 7365 } 7366 7367 /** 7368 * cfg80211_reg_can_beacon - check if beaconing is allowed 7369 * @wiphy: the wiphy 7370 * @chandef: the channel definition 7371 * @iftype: interface type 7372 * 7373 * Return: %true if there is no secondary channel or the secondary channel(s) 7374 * can be used for beaconing (i.e. is not a radar channel etc.) 7375 */ 7376 bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 7377 struct cfg80211_chan_def *chandef, 7378 enum nl80211_iftype iftype); 7379 7380 /** 7381 * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation 7382 * @wiphy: the wiphy 7383 * @chandef: the channel definition 7384 * @iftype: interface type 7385 * 7386 * Return: %true if there is no secondary channel or the secondary channel(s) 7387 * can be used for beaconing (i.e. is not a radar channel etc.). This version 7388 * also checks if IR-relaxation conditions apply, to allow beaconing under 7389 * more permissive conditions. 7390 * 7391 * Requires the RTNL to be held. 7392 */ 7393 bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, 7394 struct cfg80211_chan_def *chandef, 7395 enum nl80211_iftype iftype); 7396 7397 /* 7398 * cfg80211_ch_switch_notify - update wdev channel and notify userspace 7399 * @dev: the device which switched channels 7400 * @chandef: the new channel definition 7401 * 7402 * Caller must acquire wdev_lock, therefore must only be called from sleepable 7403 * driver context! 7404 */ 7405 void cfg80211_ch_switch_notify(struct net_device *dev, 7406 struct cfg80211_chan_def *chandef); 7407 7408 /* 7409 * cfg80211_ch_switch_started_notify - notify channel switch start 7410 * @dev: the device on which the channel switch started 7411 * @chandef: the future channel definition 7412 * @count: the number of TBTTs until the channel switch happens 7413 * 7414 * Inform the userspace about the channel switch that has just 7415 * started, so that it can take appropriate actions (eg. starting 7416 * channel switch on other vifs), if necessary. 7417 */ 7418 void cfg80211_ch_switch_started_notify(struct net_device *dev, 7419 struct cfg80211_chan_def *chandef, 7420 u8 count); 7421 7422 /** 7423 * ieee80211_operating_class_to_band - convert operating class to band 7424 * 7425 * @operating_class: the operating class to convert 7426 * @band: band pointer to fill 7427 * 7428 * Returns %true if the conversion was successful, %false otherwise. 7429 */ 7430 bool ieee80211_operating_class_to_band(u8 operating_class, 7431 enum nl80211_band *band); 7432 7433 /** 7434 * ieee80211_chandef_to_operating_class - convert chandef to operation class 7435 * 7436 * @chandef: the chandef to convert 7437 * @op_class: a pointer to the resulting operating class 7438 * 7439 * Returns %true if the conversion was successful, %false otherwise. 7440 */ 7441 bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, 7442 u8 *op_class); 7443 7444 /** 7445 * ieee80211_chandef_to_khz - convert chandef to frequency in KHz 7446 * 7447 * @chandef: the chandef to convert 7448 * 7449 * Returns the center frequency of chandef (1st segment) in KHz. 7450 */ 7451 static inline u32 7452 ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef) 7453 { 7454 return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset; 7455 } 7456 7457 /* 7458 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 7459 * @dev: the device on which the operation is requested 7460 * @peer: the MAC address of the peer device 7461 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 7462 * NL80211_TDLS_TEARDOWN) 7463 * @reason_code: the reason code for teardown request 7464 * @gfp: allocation flags 7465 * 7466 * This function is used to request userspace to perform TDLS operation that 7467 * requires knowledge of keys, i.e., link setup or teardown when the AP 7468 * connection uses encryption. This is optional mechanism for the driver to use 7469 * if it can automatically determine when a TDLS link could be useful (e.g., 7470 * based on traffic and signal strength for a peer). 7471 */ 7472 void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 7473 enum nl80211_tdls_operation oper, 7474 u16 reason_code, gfp_t gfp); 7475 7476 /* 7477 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 7478 * @rate: given rate_info to calculate bitrate from 7479 * 7480 * return 0 if MCS index >= 32 7481 */ 7482 u32 cfg80211_calculate_bitrate(struct rate_info *rate); 7483 7484 /** 7485 * cfg80211_unregister_wdev - remove the given wdev 7486 * @wdev: struct wireless_dev to remove 7487 * 7488 * Call this function only for wdevs that have no netdev assigned, 7489 * e.g. P2P Devices. It removes the device from the list so that 7490 * it can no longer be used. It is necessary to call this function 7491 * even when cfg80211 requests the removal of the interface by 7492 * calling the del_virtual_intf() callback. The function must also 7493 * be called when the driver wishes to unregister the wdev, e.g. 7494 * when the device is unbound from the driver. 7495 * 7496 * Requires the RTNL to be held. 7497 */ 7498 void cfg80211_unregister_wdev(struct wireless_dev *wdev); 7499 7500 /** 7501 * struct cfg80211_ft_event - FT Information Elements 7502 * @ies: FT IEs 7503 * @ies_len: length of the FT IE in bytes 7504 * @target_ap: target AP's MAC address 7505 * @ric_ies: RIC IE 7506 * @ric_ies_len: length of the RIC IE in bytes 7507 */ 7508 struct cfg80211_ft_event_params { 7509 const u8 *ies; 7510 size_t ies_len; 7511 const u8 *target_ap; 7512 const u8 *ric_ies; 7513 size_t ric_ies_len; 7514 }; 7515 7516 /** 7517 * cfg80211_ft_event - notify userspace about FT IE and RIC IE 7518 * @netdev: network device 7519 * @ft_event: IE information 7520 */ 7521 void cfg80211_ft_event(struct net_device *netdev, 7522 struct cfg80211_ft_event_params *ft_event); 7523 7524 /** 7525 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 7526 * @ies: the input IE buffer 7527 * @len: the input length 7528 * @attr: the attribute ID to find 7529 * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 7530 * if the function is only called to get the needed buffer size 7531 * @bufsize: size of the output buffer 7532 * 7533 * The function finds a given P2P attribute in the (vendor) IEs and 7534 * copies its contents to the given buffer. 7535 * 7536 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 7537 * malformed or the attribute can't be found (respectively), or the 7538 * length of the found attribute (which can be zero). 7539 */ 7540 int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 7541 enum ieee80211_p2p_attr_id attr, 7542 u8 *buf, unsigned int bufsize); 7543 7544 /** 7545 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC) 7546 * @ies: the IE buffer 7547 * @ielen: the length of the IE buffer 7548 * @ids: an array with element IDs that are allowed before 7549 * the split. A WLAN_EID_EXTENSION value means that the next 7550 * EID in the list is a sub-element of the EXTENSION IE. 7551 * @n_ids: the size of the element ID array 7552 * @after_ric: array IE types that come after the RIC element 7553 * @n_after_ric: size of the @after_ric array 7554 * @offset: offset where to start splitting in the buffer 7555 * 7556 * This function splits an IE buffer by updating the @offset 7557 * variable to point to the location where the buffer should be 7558 * split. 7559 * 7560 * It assumes that the given IE buffer is well-formed, this 7561 * has to be guaranteed by the caller! 7562 * 7563 * It also assumes that the IEs in the buffer are ordered 7564 * correctly, if not the result of using this function will not 7565 * be ordered correctly either, i.e. it does no reordering. 7566 * 7567 * The function returns the offset where the next part of the 7568 * buffer starts, which may be @ielen if the entire (remainder) 7569 * of the buffer should be used. 7570 */ 7571 size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen, 7572 const u8 *ids, int n_ids, 7573 const u8 *after_ric, int n_after_ric, 7574 size_t offset); 7575 7576 /** 7577 * ieee80211_ie_split - split an IE buffer according to ordering 7578 * @ies: the IE buffer 7579 * @ielen: the length of the IE buffer 7580 * @ids: an array with element IDs that are allowed before 7581 * the split. A WLAN_EID_EXTENSION value means that the next 7582 * EID in the list is a sub-element of the EXTENSION IE. 7583 * @n_ids: the size of the element ID array 7584 * @offset: offset where to start splitting in the buffer 7585 * 7586 * This function splits an IE buffer by updating the @offset 7587 * variable to point to the location where the buffer should be 7588 * split. 7589 * 7590 * It assumes that the given IE buffer is well-formed, this 7591 * has to be guaranteed by the caller! 7592 * 7593 * It also assumes that the IEs in the buffer are ordered 7594 * correctly, if not the result of using this function will not 7595 * be ordered correctly either, i.e. it does no reordering. 7596 * 7597 * The function returns the offset where the next part of the 7598 * buffer starts, which may be @ielen if the entire (remainder) 7599 * of the buffer should be used. 7600 */ 7601 static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 7602 const u8 *ids, int n_ids, size_t offset) 7603 { 7604 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset); 7605 } 7606 7607 /** 7608 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 7609 * @wdev: the wireless device reporting the wakeup 7610 * @wakeup: the wakeup report 7611 * @gfp: allocation flags 7612 * 7613 * This function reports that the given device woke up. If it 7614 * caused the wakeup, report the reason(s), otherwise you may 7615 * pass %NULL as the @wakeup parameter to advertise that something 7616 * else caused the wakeup. 7617 */ 7618 void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 7619 struct cfg80211_wowlan_wakeup *wakeup, 7620 gfp_t gfp); 7621 7622 /** 7623 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 7624 * 7625 * @wdev: the wireless device for which critical protocol is stopped. 7626 * @gfp: allocation flags 7627 * 7628 * This function can be called by the driver to indicate it has reverted 7629 * operation back to normal. One reason could be that the duration given 7630 * by .crit_proto_start() has expired. 7631 */ 7632 void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 7633 7634 /** 7635 * ieee80211_get_num_supported_channels - get number of channels device has 7636 * @wiphy: the wiphy 7637 * 7638 * Return: the number of channels supported by the device. 7639 */ 7640 unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 7641 7642 /** 7643 * cfg80211_check_combinations - check interface combinations 7644 * 7645 * @wiphy: the wiphy 7646 * @params: the interface combinations parameter 7647 * 7648 * This function can be called by the driver to check whether a 7649 * combination of interfaces and their types are allowed according to 7650 * the interface combinations. 7651 */ 7652 int cfg80211_check_combinations(struct wiphy *wiphy, 7653 struct iface_combination_params *params); 7654 7655 /** 7656 * cfg80211_iter_combinations - iterate over matching combinations 7657 * 7658 * @wiphy: the wiphy 7659 * @params: the interface combinations parameter 7660 * @iter: function to call for each matching combination 7661 * @data: pointer to pass to iter function 7662 * 7663 * This function can be called by the driver to check what possible 7664 * combinations it fits in at a given moment, e.g. for channel switching 7665 * purposes. 7666 */ 7667 int cfg80211_iter_combinations(struct wiphy *wiphy, 7668 struct iface_combination_params *params, 7669 void (*iter)(const struct ieee80211_iface_combination *c, 7670 void *data), 7671 void *data); 7672 7673 /* 7674 * cfg80211_stop_iface - trigger interface disconnection 7675 * 7676 * @wiphy: the wiphy 7677 * @wdev: wireless device 7678 * @gfp: context flags 7679 * 7680 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 7681 * disconnected. 7682 * 7683 * Note: This doesn't need any locks and is asynchronous. 7684 */ 7685 void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 7686 gfp_t gfp); 7687 7688 /** 7689 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 7690 * @wiphy: the wiphy to shut down 7691 * 7692 * This function shuts down all interfaces belonging to this wiphy by 7693 * calling dev_close() (and treating non-netdev interfaces as needed). 7694 * It shouldn't really be used unless there are some fatal device errors 7695 * that really can't be recovered in any other way. 7696 * 7697 * Callers must hold the RTNL and be able to deal with callbacks into 7698 * the driver while the function is running. 7699 */ 7700 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 7701 7702 /** 7703 * wiphy_ext_feature_set - set the extended feature flag 7704 * 7705 * @wiphy: the wiphy to modify. 7706 * @ftidx: extended feature bit index. 7707 * 7708 * The extended features are flagged in multiple bytes (see 7709 * &struct wiphy.@ext_features) 7710 */ 7711 static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 7712 enum nl80211_ext_feature_index ftidx) 7713 { 7714 u8 *ft_byte; 7715 7716 ft_byte = &wiphy->ext_features[ftidx / 8]; 7717 *ft_byte |= BIT(ftidx % 8); 7718 } 7719 7720 /** 7721 * wiphy_ext_feature_isset - check the extended feature flag 7722 * 7723 * @wiphy: the wiphy to modify. 7724 * @ftidx: extended feature bit index. 7725 * 7726 * The extended features are flagged in multiple bytes (see 7727 * &struct wiphy.@ext_features) 7728 */ 7729 static inline bool 7730 wiphy_ext_feature_isset(struct wiphy *wiphy, 7731 enum nl80211_ext_feature_index ftidx) 7732 { 7733 u8 ft_byte; 7734 7735 ft_byte = wiphy->ext_features[ftidx / 8]; 7736 return (ft_byte & BIT(ftidx % 8)) != 0; 7737 } 7738 7739 /** 7740 * cfg80211_free_nan_func - free NAN function 7741 * @f: NAN function that should be freed 7742 * 7743 * Frees all the NAN function and all it's allocated members. 7744 */ 7745 void cfg80211_free_nan_func(struct cfg80211_nan_func *f); 7746 7747 /** 7748 * struct cfg80211_nan_match_params - NAN match parameters 7749 * @type: the type of the function that triggered a match. If it is 7750 * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber. 7751 * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery 7752 * result. 7753 * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up. 7754 * @inst_id: the local instance id 7755 * @peer_inst_id: the instance id of the peer's function 7756 * @addr: the MAC address of the peer 7757 * @info_len: the length of the &info 7758 * @info: the Service Specific Info from the peer (if any) 7759 * @cookie: unique identifier of the corresponding function 7760 */ 7761 struct cfg80211_nan_match_params { 7762 enum nl80211_nan_function_type type; 7763 u8 inst_id; 7764 u8 peer_inst_id; 7765 const u8 *addr; 7766 u8 info_len; 7767 const u8 *info; 7768 u64 cookie; 7769 }; 7770 7771 /** 7772 * cfg80211_nan_match - report a match for a NAN function. 7773 * @wdev: the wireless device reporting the match 7774 * @match: match notification parameters 7775 * @gfp: allocation flags 7776 * 7777 * This function reports that the a NAN function had a match. This 7778 * can be a subscribe that had a match or a solicited publish that 7779 * was sent. It can also be a follow up that was received. 7780 */ 7781 void cfg80211_nan_match(struct wireless_dev *wdev, 7782 struct cfg80211_nan_match_params *match, gfp_t gfp); 7783 7784 /** 7785 * cfg80211_nan_func_terminated - notify about NAN function termination. 7786 * 7787 * @wdev: the wireless device reporting the match 7788 * @inst_id: the local instance id 7789 * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*) 7790 * @cookie: unique NAN function identifier 7791 * @gfp: allocation flags 7792 * 7793 * This function reports that the a NAN function is terminated. 7794 */ 7795 void cfg80211_nan_func_terminated(struct wireless_dev *wdev, 7796 u8 inst_id, 7797 enum nl80211_nan_func_term_reason reason, 7798 u64 cookie, gfp_t gfp); 7799 7800 /* ethtool helper */ 7801 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 7802 7803 /** 7804 * cfg80211_external_auth_request - userspace request for authentication 7805 * @netdev: network device 7806 * @params: External authentication parameters 7807 * @gfp: allocation flags 7808 * Returns: 0 on success, < 0 on error 7809 */ 7810 int cfg80211_external_auth_request(struct net_device *netdev, 7811 struct cfg80211_external_auth_params *params, 7812 gfp_t gfp); 7813 7814 /** 7815 * cfg80211_pmsr_report - report peer measurement result data 7816 * @wdev: the wireless device reporting the measurement 7817 * @req: the original measurement request 7818 * @result: the result data 7819 * @gfp: allocation flags 7820 */ 7821 void cfg80211_pmsr_report(struct wireless_dev *wdev, 7822 struct cfg80211_pmsr_request *req, 7823 struct cfg80211_pmsr_result *result, 7824 gfp_t gfp); 7825 7826 /** 7827 * cfg80211_pmsr_complete - report peer measurement completed 7828 * @wdev: the wireless device reporting the measurement 7829 * @req: the original measurement request 7830 * @gfp: allocation flags 7831 * 7832 * Report that the entire measurement completed, after this 7833 * the request pointer will no longer be valid. 7834 */ 7835 void cfg80211_pmsr_complete(struct wireless_dev *wdev, 7836 struct cfg80211_pmsr_request *req, 7837 gfp_t gfp); 7838 7839 /** 7840 * cfg80211_iftype_allowed - check whether the interface can be allowed 7841 * @wiphy: the wiphy 7842 * @iftype: interface type 7843 * @is_4addr: use_4addr flag, must be '0' when check_swif is '1' 7844 * @check_swif: check iftype against software interfaces 7845 * 7846 * Check whether the interface is allowed to operate; additionally, this API 7847 * can be used to check iftype against the software interfaces when 7848 * check_swif is '1'. 7849 */ 7850 bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype, 7851 bool is_4addr, u8 check_swif); 7852 7853 7854 /* Logging, debugging and troubleshooting/diagnostic helpers. */ 7855 7856 /* wiphy_printk helpers, similar to dev_printk */ 7857 7858 #define wiphy_printk(level, wiphy, format, args...) \ 7859 dev_printk(level, &(wiphy)->dev, format, ##args) 7860 #define wiphy_emerg(wiphy, format, args...) \ 7861 dev_emerg(&(wiphy)->dev, format, ##args) 7862 #define wiphy_alert(wiphy, format, args...) \ 7863 dev_alert(&(wiphy)->dev, format, ##args) 7864 #define wiphy_crit(wiphy, format, args...) \ 7865 dev_crit(&(wiphy)->dev, format, ##args) 7866 #define wiphy_err(wiphy, format, args...) \ 7867 dev_err(&(wiphy)->dev, format, ##args) 7868 #define wiphy_warn(wiphy, format, args...) \ 7869 dev_warn(&(wiphy)->dev, format, ##args) 7870 #define wiphy_notice(wiphy, format, args...) \ 7871 dev_notice(&(wiphy)->dev, format, ##args) 7872 #define wiphy_info(wiphy, format, args...) \ 7873 dev_info(&(wiphy)->dev, format, ##args) 7874 7875 #define wiphy_err_ratelimited(wiphy, format, args...) \ 7876 dev_err_ratelimited(&(wiphy)->dev, format, ##args) 7877 #define wiphy_warn_ratelimited(wiphy, format, args...) \ 7878 dev_warn_ratelimited(&(wiphy)->dev, format, ##args) 7879 7880 #define wiphy_debug(wiphy, format, args...) \ 7881 wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 7882 7883 #define wiphy_dbg(wiphy, format, args...) \ 7884 dev_dbg(&(wiphy)->dev, format, ##args) 7885 7886 #if defined(VERBOSE_DEBUG) 7887 #define wiphy_vdbg wiphy_dbg 7888 #else 7889 #define wiphy_vdbg(wiphy, format, args...) \ 7890 ({ \ 7891 if (0) \ 7892 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 7893 0; \ 7894 }) 7895 #endif 7896 7897 /* 7898 * wiphy_WARN() acts like wiphy_printk(), but with the key difference 7899 * of using a WARN/WARN_ON to get the message out, including the 7900 * file/line information and a backtrace. 7901 */ 7902 #define wiphy_WARN(wiphy, format, args...) \ 7903 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 7904 7905 /** 7906 * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space 7907 * @netdev: network device 7908 * @owe_info: peer's owe info 7909 * @gfp: allocation flags 7910 */ 7911 void cfg80211_update_owe_info_event(struct net_device *netdev, 7912 struct cfg80211_update_owe_info *owe_info, 7913 gfp_t gfp); 7914 7915 /** 7916 * cfg80211_bss_flush - resets all the scan entries 7917 * @wiphy: the wiphy 7918 */ 7919 void cfg80211_bss_flush(struct wiphy *wiphy); 7920 7921 #endif /* __NET_CFG80211_H */ 7922