![]() |
|
|||
0001 0002 #ifndef __NET_REGULATORY_H 0003 #define __NET_REGULATORY_H 0004 /* 0005 * regulatory support structures 0006 * 0007 * Copyright 2008-2009 Luis R. Rodriguez <mcgrof@qca.qualcomm.com> 0008 * Copyright (C) 2018 Intel Corporation 0009 * 0010 * Permission to use, copy, modify, and/or distribute this software for any 0011 * purpose with or without fee is hereby granted, provided that the above 0012 * copyright notice and this permission notice appear in all copies. 0013 * 0014 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 0015 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 0016 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 0017 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 0018 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 0019 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 0020 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 0021 */ 0022 0023 #include <linux/ieee80211.h> 0024 #include <linux/nl80211.h> 0025 #include <linux/rcupdate.h> 0026 0027 /** 0028 * enum environment_cap - Environment parsed from country IE 0029 * @ENVIRON_ANY: indicates country IE applies to both indoor and 0030 * outdoor operation. 0031 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation 0032 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation 0033 */ 0034 enum environment_cap { 0035 ENVIRON_ANY, 0036 ENVIRON_INDOOR, 0037 ENVIRON_OUTDOOR, 0038 }; 0039 0040 /** 0041 * struct regulatory_request - used to keep track of regulatory requests 0042 * 0043 * @rcu_head: RCU head struct used to free the request 0044 * @wiphy_idx: this is set if this request's initiator is 0045 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This 0046 * can be used by the wireless core to deal with conflicts 0047 * and potentially inform users of which devices specifically 0048 * cased the conflicts. 0049 * @initiator: indicates who sent this request, could be any of 0050 * those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*) 0051 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested 0052 * regulatory domain. We have a few special codes: 0053 * 00 - World regulatory domain 0054 * 99 - built by driver but a specific alpha2 cannot be determined 0055 * 98 - result of an intersection between two regulatory domains 0056 * 97 - regulatory domain has not yet been configured 0057 * @dfs_region: If CRDA responded with a regulatory domain that requires 0058 * DFS master operation on a known DFS region (NL80211_DFS_*), 0059 * dfs_region represents that region. Drivers can use this and the 0060 * @alpha2 to adjust their device's DFS parameters as required. 0061 * @user_reg_hint_type: if the @initiator was of type 0062 * %NL80211_REGDOM_SET_BY_USER, this classifies the type 0063 * of hint passed. This could be any of the %NL80211_USER_REG_HINT_* 0064 * types. 0065 * @intersect: indicates whether the wireless core should intersect 0066 * the requested regulatory domain with the presently set regulatory 0067 * domain. 0068 * @processed: indicates whether or not this requests has already been 0069 * processed. When the last request is processed it means that the 0070 * currently regulatory domain set on cfg80211 is updated from 0071 * CRDA and can be used by other regulatory requests. When a 0072 * the last request is not yet processed we must yield until it 0073 * is processed before processing any new requests. 0074 * @country_ie_checksum: checksum of the last processed and accepted 0075 * country IE 0076 * @country_ie_env: lets us know if the AP is telling us we are outdoor, 0077 * indoor, or if it doesn't matter 0078 * @list: used to insert into the reg_requests_list linked list 0079 */ 0080 struct regulatory_request { 0081 struct rcu_head rcu_head; 0082 int wiphy_idx; 0083 enum nl80211_reg_initiator initiator; 0084 enum nl80211_user_reg_hint_type user_reg_hint_type; 0085 char alpha2[3]; 0086 enum nl80211_dfs_regions dfs_region; 0087 bool intersect; 0088 bool processed; 0089 enum environment_cap country_ie_env; 0090 struct list_head list; 0091 }; 0092 0093 /** 0094 * enum ieee80211_regulatory_flags - device regulatory flags 0095 * 0096 * @REGULATORY_CUSTOM_REG: tells us the driver for this device 0097 * has its own custom regulatory domain and cannot identify the 0098 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 0099 * we will disregard the first regulatory hint (when the 0100 * initiator is %REGDOM_SET_BY_CORE). Drivers that use 0101 * wiphy_apply_custom_regulatory() should have this flag set 0102 * or the regulatory core will set it for the wiphy. 0103 * If you use regulatory_hint() *after* using 0104 * wiphy_apply_custom_regulatory() the wireless core will 0105 * clear the REGULATORY_CUSTOM_REG for your wiphy as it would be 0106 * implied that the device somehow gained knowledge of its region. 0107 * @REGULATORY_STRICT_REG: tells us that the wiphy for this device 0108 * has regulatory domain that it wishes to be considered as the 0109 * superset for regulatory rules. After this device gets its regulatory 0110 * domain programmed further regulatory hints shall only be considered 0111 * for this device to enhance regulatory compliance, forcing the 0112 * device to only possibly use subsets of the original regulatory 0113 * rules. For example if channel 13 and 14 are disabled by this 0114 * device's regulatory domain no user specified regulatory hint which 0115 * has these channels enabled would enable them for this wiphy, 0116 * the device's original regulatory domain will be trusted as the 0117 * base. You can program the superset of regulatory rules for this 0118 * wiphy with regulatory_hint() for cards programmed with an 0119 * ISO3166-alpha2 country code. wiphys that use regulatory_hint() 0120 * will have their wiphy->regd programmed once the regulatory 0121 * domain is set, and all other regulatory hints will be ignored 0122 * until their own regulatory domain gets programmed. 0123 * @REGULATORY_DISABLE_BEACON_HINTS: enable this if your driver needs to 0124 * ensure that passive scan flags and beaconing flags may not be lifted by 0125 * cfg80211 due to regulatory beacon hints. For more information on beacon 0126 * hints read the documenation for regulatory_hint_found_beacon() 0127 * @REGULATORY_COUNTRY_IE_FOLLOW_POWER: for devices that have a preference 0128 * that even though they may have programmed their own custom power 0129 * setting prior to wiphy registration, they want to ensure their channel 0130 * power settings are updated for this connection with the power settings 0131 * derived from the regulatory domain. The regulatory domain used will be 0132 * based on the ISO3166-alpha2 from country IE provided through 0133 * regulatory_hint_country_ie() 0134 * @REGULATORY_COUNTRY_IE_IGNORE: for devices that have a preference to ignore 0135 * all country IE information processed by the regulatory core. This will 0136 * override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will 0137 * be ignored. 0138 * @REGULATORY_ENABLE_RELAX_NO_IR: for devices that wish to allow the 0139 * NO_IR relaxation, which enables transmissions on channels on which 0140 * otherwise initiating radiation is not allowed. This will enable the 0141 * relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration 0142 * option 0143 * @REGULATORY_IGNORE_STALE_KICKOFF: the regulatory core will _not_ make sure 0144 * all interfaces on this wiphy reside on allowed channels. If this flag 0145 * is not set, upon a regdomain change, the interfaces are given a grace 0146 * period (currently 60 seconds) to disconnect or move to an allowed 0147 * channel. Interfaces on forbidden channels are forcibly disconnected. 0148 * Currently these types of interfaces are supported for enforcement: 0149 * NL80211_IFTYPE_ADHOC, NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP, 0150 * NL80211_IFTYPE_AP_VLAN, NL80211_IFTYPE_MONITOR, 0151 * NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO, 0152 * NL80211_IFTYPE_P2P_DEVICE. The flag will be set by default if a device 0153 * includes any modes unsupported for enforcement checking. 0154 * @REGULATORY_WIPHY_SELF_MANAGED: for devices that employ wiphy-specific 0155 * regdom management. These devices will ignore all regdom changes not 0156 * originating from their own wiphy. 0157 * A self-managed wiphys only employs regulatory information obtained from 0158 * the FW and driver and does not use other cfg80211 sources like 0159 * beacon-hints, country-code IEs and hints from other devices on the same 0160 * system. Conversely, a self-managed wiphy does not share its regulatory 0161 * hints with other devices in the system. If a system contains several 0162 * devices, one or more of which are self-managed, there might be 0163 * contradictory regulatory settings between them. Usage of flag is 0164 * generally discouraged. Only use it if the FW/driver is incompatible 0165 * with non-locally originated hints. 0166 * This flag is incompatible with the flags: %REGULATORY_CUSTOM_REG, 0167 * %REGULATORY_STRICT_REG, %REGULATORY_COUNTRY_IE_FOLLOW_POWER, 0168 * %REGULATORY_COUNTRY_IE_IGNORE and %REGULATORY_DISABLE_BEACON_HINTS. 0169 * Mixing any of the above flags with this flag will result in a failure 0170 * to register the wiphy. This flag implies 0171 * %REGULATORY_DISABLE_BEACON_HINTS and %REGULATORY_COUNTRY_IE_IGNORE. 0172 */ 0173 enum ieee80211_regulatory_flags { 0174 REGULATORY_CUSTOM_REG = BIT(0), 0175 REGULATORY_STRICT_REG = BIT(1), 0176 REGULATORY_DISABLE_BEACON_HINTS = BIT(2), 0177 REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3), 0178 REGULATORY_COUNTRY_IE_IGNORE = BIT(4), 0179 REGULATORY_ENABLE_RELAX_NO_IR = BIT(5), 0180 REGULATORY_IGNORE_STALE_KICKOFF = BIT(6), 0181 REGULATORY_WIPHY_SELF_MANAGED = BIT(7), 0182 }; 0183 0184 struct ieee80211_freq_range { 0185 u32 start_freq_khz; 0186 u32 end_freq_khz; 0187 u32 max_bandwidth_khz; 0188 }; 0189 0190 struct ieee80211_power_rule { 0191 u32 max_antenna_gain; 0192 u32 max_eirp; 0193 }; 0194 0195 /** 0196 * struct ieee80211_wmm_ac - used to store per ac wmm regulatory limitation 0197 * 0198 * The information provided in this structure is required for QoS 0199 * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29. 0200 * 0201 * @cw_min: minimum contention window [a value of the form 0202 * 2^n-1 in the range 1..32767] 0203 * @cw_max: maximum contention window [like @cw_min] 0204 * @cot: maximum burst time in units of 32 usecs, 0 meaning disabled 0205 * @aifsn: arbitration interframe space [0..255] 0206 * 0207 */ 0208 struct ieee80211_wmm_ac { 0209 u16 cw_min; 0210 u16 cw_max; 0211 u16 cot; 0212 u8 aifsn; 0213 }; 0214 0215 struct ieee80211_wmm_rule { 0216 struct ieee80211_wmm_ac client[IEEE80211_NUM_ACS]; 0217 struct ieee80211_wmm_ac ap[IEEE80211_NUM_ACS]; 0218 }; 0219 0220 struct ieee80211_reg_rule { 0221 struct ieee80211_freq_range freq_range; 0222 struct ieee80211_power_rule power_rule; 0223 struct ieee80211_wmm_rule wmm_rule; 0224 u32 flags; 0225 u32 dfs_cac_ms; 0226 bool has_wmm; 0227 }; 0228 0229 struct ieee80211_regdomain { 0230 struct rcu_head rcu_head; 0231 u32 n_reg_rules; 0232 char alpha2[3]; 0233 enum nl80211_dfs_regions dfs_region; 0234 struct ieee80211_reg_rule reg_rules[]; 0235 }; 0236 0237 #define REG_RULE_EXT(start, end, bw, gain, eirp, dfs_cac, reg_flags) \ 0238 { \ 0239 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ 0240 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ 0241 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ 0242 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \ 0243 .power_rule.max_eirp = DBM_TO_MBM(eirp), \ 0244 .flags = reg_flags, \ 0245 .dfs_cac_ms = dfs_cac, \ 0246 } 0247 0248 #define REG_RULE(start, end, bw, gain, eirp, reg_flags) \ 0249 REG_RULE_EXT(start, end, bw, gain, eirp, 0, reg_flags) 0250 0251 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |