^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) #ifndef __NET_REGULATORY_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #define __NET_REGULATORY_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * regulatory support structures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright 2008-2009 Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (C) 2018 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Permission to use, copy, modify, and/or distribute this software for any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * purpose with or without fee is hereby granted, provided that the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * copyright notice and this permission notice appear in all copies.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/rcupdate.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * enum environment_cap - Environment parsed from country IE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * @ENVIRON_ANY: indicates country IE applies to both indoor and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * outdoor operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) enum environment_cap {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ENVIRON_ANY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) ENVIRON_INDOOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) ENVIRON_OUTDOOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * struct regulatory_request - used to keep track of regulatory requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * @rcu_head: RCU head struct used to free the request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * @wiphy_idx: this is set if this request's initiator is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * can be used by the wireless core to deal with conflicts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * and potentially inform users of which devices specifically
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * cased the conflicts.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * @initiator: indicates who sent this request, could be any of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * regulatory domain. We have a few special codes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * 00 - World regulatory domain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * 99 - built by driver but a specific alpha2 cannot be determined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) * 98 - result of an intersection between two regulatory domains
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * 97 - regulatory domain has not yet been configured
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * @dfs_region: If CRDA responded with a regulatory domain that requires
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * DFS master operation on a known DFS region (NL80211_DFS_*),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * dfs_region represents that region. Drivers can use this and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * @alpha2 to adjust their device's DFS parameters as required.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * @user_reg_hint_type: if the @initiator was of type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * %NL80211_REGDOM_SET_BY_USER, this classifies the type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * of hint passed. This could be any of the %NL80211_USER_REG_HINT_*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * types.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * @intersect: indicates whether the wireless core should intersect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * the requested regulatory domain with the presently set regulatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * @processed: indicates whether or not this requests has already been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * processed. When the last request is processed it means that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * currently regulatory domain set on cfg80211 is updated from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * CRDA and can be used by other regulatory requests. When a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * the last request is not yet processed we must yield until it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * is processed before processing any new requests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * @country_ie_checksum: checksum of the last processed and accepted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * country IE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * @country_ie_env: lets us know if the AP is telling us we are outdoor,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * indoor, or if it doesn't matter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * @list: used to insert into the reg_requests_list linked list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) struct regulatory_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) struct rcu_head rcu_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) int wiphy_idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) enum nl80211_reg_initiator initiator;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) enum nl80211_user_reg_hint_type user_reg_hint_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) char alpha2[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) enum nl80211_dfs_regions dfs_region;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) bool intersect;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) bool processed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) enum environment_cap country_ie_env;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * enum ieee80211_regulatory_flags - device regulatory flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * @REGULATORY_CUSTOM_REG: tells us the driver for this device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * has its own custom regulatory domain and cannot identify the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) * we will disregard the first regulatory hint (when the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * initiator is %REGDOM_SET_BY_CORE). Drivers that use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) * wiphy_apply_custom_regulatory() should have this flag set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * or the regulatory core will set it for the wiphy.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * If you use regulatory_hint() *after* using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * wiphy_apply_custom_regulatory() the wireless core will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * clear the REGULATORY_CUSTOM_REG for your wiphy as it would be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * implied that the device somehow gained knowledge of its region.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * @REGULATORY_STRICT_REG: tells us that the wiphy for this device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * has regulatory domain that it wishes to be considered as the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * superset for regulatory rules. After this device gets its regulatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * domain programmed further regulatory hints shall only be considered
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * for this device to enhance regulatory compliance, forcing the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) * device to only possibly use subsets of the original regulatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * rules. For example if channel 13 and 14 are disabled by this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * device's regulatory domain no user specified regulatory hint which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * has these channels enabled would enable them for this wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) * the device's original regulatory domain will be trusted as the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) * base. You can program the superset of regulatory rules for this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * wiphy with regulatory_hint() for cards programmed with an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) * ISO3166-alpha2 country code. wiphys that use regulatory_hint()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * will have their wiphy->regd programmed once the regulatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * domain is set, and all other regulatory hints will be ignored
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * until their own regulatory domain gets programmed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * @REGULATORY_DISABLE_BEACON_HINTS: enable this if your driver needs to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) * ensure that passive scan flags and beaconing flags may not be lifted by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * cfg80211 due to regulatory beacon hints. For more information on beacon
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * hints read the documenation for regulatory_hint_found_beacon()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * @REGULATORY_COUNTRY_IE_FOLLOW_POWER: for devices that have a preference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * that even though they may have programmed their own custom power
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * setting prior to wiphy registration, they want to ensure their channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * power settings are updated for this connection with the power settings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * derived from the regulatory domain. The regulatory domain used will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * based on the ISO3166-alpha2 from country IE provided through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * regulatory_hint_country_ie()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * @REGULATORY_COUNTRY_IE_IGNORE: for devices that have a preference to ignore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * all country IE information processed by the regulatory core. This will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * be ignored.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * @REGULATORY_ENABLE_RELAX_NO_IR: for devices that wish to allow the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * NO_IR relaxation, which enables transmissions on channels on which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * otherwise initiating radiation is not allowed. This will enable the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * @REGULATORY_IGNORE_STALE_KICKOFF: the regulatory core will _not_ make sure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * all interfaces on this wiphy reside on allowed channels. If this flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * is not set, upon a regdomain change, the interfaces are given a grace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * period (currently 60 seconds) to disconnect or move to an allowed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * channel. Interfaces on forbidden channels are forcibly disconnected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * Currently these types of interfaces are supported for enforcement:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * NL80211_IFTYPE_ADHOC, NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * NL80211_IFTYPE_AP_VLAN, NL80211_IFTYPE_MONITOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) * NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * NL80211_IFTYPE_P2P_DEVICE. The flag will be set by default if a device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * includes any modes unsupported for enforcement checking.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * @REGULATORY_WIPHY_SELF_MANAGED: for devices that employ wiphy-specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * regdom management. These devices will ignore all regdom changes not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * originating from their own wiphy.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * A self-managed wiphys only employs regulatory information obtained from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * the FW and driver and does not use other cfg80211 sources like
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) * beacon-hints, country-code IEs and hints from other devices on the same
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) * system. Conversely, a self-managed wiphy does not share its regulatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) * hints with other devices in the system. If a system contains several
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * devices, one or more of which are self-managed, there might be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * contradictory regulatory settings between them. Usage of flag is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * generally discouraged. Only use it if the FW/driver is incompatible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * with non-locally originated hints.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * This flag is incompatible with the flags: %REGULATORY_CUSTOM_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) * %REGULATORY_STRICT_REG, %REGULATORY_COUNTRY_IE_FOLLOW_POWER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) * %REGULATORY_COUNTRY_IE_IGNORE and %REGULATORY_DISABLE_BEACON_HINTS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) * Mixing any of the above flags with this flag will result in a failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * to register the wiphy. This flag implies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) * %REGULATORY_DISABLE_BEACON_HINTS and %REGULATORY_COUNTRY_IE_IGNORE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) enum ieee80211_regulatory_flags {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) REGULATORY_CUSTOM_REG = BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) REGULATORY_STRICT_REG = BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) REGULATORY_DISABLE_BEACON_HINTS = BIT(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) REGULATORY_COUNTRY_IE_IGNORE = BIT(4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) REGULATORY_ENABLE_RELAX_NO_IR = BIT(5),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) REGULATORY_IGNORE_STALE_KICKOFF = BIT(6),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) REGULATORY_WIPHY_SELF_MANAGED = BIT(7),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) struct ieee80211_freq_range {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) u32 start_freq_khz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) u32 end_freq_khz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) u32 max_bandwidth_khz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) struct ieee80211_power_rule {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) u32 max_antenna_gain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) u32 max_eirp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) * struct ieee80211_wmm_ac - used to store per ac wmm regulatory limitation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * The information provided in this structure is required for QoS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * @cw_min: minimum contention window [a value of the form
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * 2^n-1 in the range 1..32767]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) * @cw_max: maximum contention window [like @cw_min]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) * @cot: maximum burst time in units of 32 usecs, 0 meaning disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) * @aifsn: arbitration interframe space [0..255]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) struct ieee80211_wmm_ac {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) u16 cw_min;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) u16 cw_max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) u16 cot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) u8 aifsn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) struct ieee80211_wmm_rule {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) struct ieee80211_wmm_ac client[IEEE80211_NUM_ACS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) struct ieee80211_wmm_ac ap[IEEE80211_NUM_ACS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) struct ieee80211_reg_rule {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) struct ieee80211_freq_range freq_range;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) struct ieee80211_power_rule power_rule;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) struct ieee80211_wmm_rule wmm_rule;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) u32 dfs_cac_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) bool has_wmm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) struct ieee80211_regdomain {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) struct rcu_head rcu_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) u32 n_reg_rules;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) char alpha2[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) enum nl80211_dfs_regions dfs_region;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) struct ieee80211_reg_rule reg_rules[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) #define REG_RULE_EXT(start, end, bw, gain, eirp, dfs_cac, reg_flags) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) .power_rule.max_eirp = DBM_TO_MBM(eirp), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) .flags = reg_flags, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) .dfs_cac_ms = dfs_cac, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) #define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) REG_RULE_EXT(start, end, bw, gain, eirp, 0, reg_flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) #endif