![]() |
|
|||
0001 #ifndef __NET_WIRELESS_REG_H 0002 #define __NET_WIRELESS_REG_H 0003 0004 #include <net/cfg80211.h> 0005 0006 /* 0007 * Copyright 2008-2011 Luis R. Rodriguez <mcgrof@qca.qualcomm.com> 0008 * Copyright (C) 2019 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 enum ieee80211_regd_source { 0024 REGD_SOURCE_INTERNAL_DB, 0025 REGD_SOURCE_CRDA, 0026 REGD_SOURCE_CACHED, 0027 }; 0028 0029 extern const struct ieee80211_regdomain __rcu *cfg80211_regdomain; 0030 0031 bool reg_is_valid_request(const char *alpha2); 0032 bool is_world_regdom(const char *alpha2); 0033 bool reg_supported_dfs_region(enum nl80211_dfs_regions dfs_region); 0034 enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy); 0035 0036 int regulatory_hint_user(const char *alpha2, 0037 enum nl80211_user_reg_hint_type user_reg_hint_type); 0038 0039 /** 0040 * regulatory_hint_indoor - hint operation in indoor env. or not 0041 * @is_indoor: if true indicates that user space thinks that the 0042 * device is operating in an indoor environment. 0043 * @portid: the netlink port ID on which the hint was given. 0044 */ 0045 int regulatory_hint_indoor(bool is_indoor, u32 portid); 0046 0047 /** 0048 * regulatory_netlink_notify - notify on released netlink socket 0049 * @portid: the netlink socket port ID 0050 */ 0051 void regulatory_netlink_notify(u32 portid); 0052 0053 void wiphy_regulatory_register(struct wiphy *wiphy); 0054 void wiphy_regulatory_deregister(struct wiphy *wiphy); 0055 0056 int __init regulatory_init(void); 0057 void regulatory_exit(void); 0058 0059 int set_regdom(const struct ieee80211_regdomain *rd, 0060 enum ieee80211_regd_source regd_src); 0061 0062 unsigned int reg_get_max_bandwidth(const struct ieee80211_regdomain *rd, 0063 const struct ieee80211_reg_rule *rule); 0064 0065 bool reg_last_request_cell_base(void); 0066 0067 /** 0068 * regulatory_hint_found_beacon - hints a beacon was found on a channel 0069 * @wiphy: the wireless device where the beacon was found on 0070 * @beacon_chan: the channel on which the beacon was found on 0071 * @gfp: context flags 0072 * 0073 * This informs the wireless core that a beacon from an AP was found on 0074 * the channel provided. This allows the wireless core to make educated 0075 * guesses on regulatory to help with world roaming. This is only used for 0076 * world roaming -- when we do not know our current location. This is 0077 * only useful on channels 12, 13 and 14 on the 2 GHz band as channels 0078 * 1-11 are already enabled by the world regulatory domain; and on 0079 * non-radar 5 GHz channels. 0080 * 0081 * Drivers do not need to call this, cfg80211 will do it for after a scan 0082 * on a newly found BSS. If you cannot make use of this feature you can 0083 * set the wiphy->disable_beacon_hints to true. 0084 */ 0085 int regulatory_hint_found_beacon(struct wiphy *wiphy, 0086 struct ieee80211_channel *beacon_chan, 0087 gfp_t gfp); 0088 0089 /** 0090 * regulatory_hint_country_ie - hints a country IE as a regulatory domain 0091 * @wiphy: the wireless device giving the hint (used only for reporting 0092 * conflicts) 0093 * @band: the band on which the country IE was received on. This determines 0094 * the band we'll process the country IE channel triplets for. 0095 * @country_ie: pointer to the country IE 0096 * @country_ie_len: length of the country IE 0097 * 0098 * We will intersect the rd with the what CRDA tells us should apply 0099 * for the alpha2 this country IE belongs to, this prevents APs from 0100 * sending us incorrect or outdated information against a country. 0101 * 0102 * The AP is expected to provide Country IE channel triplets for the 0103 * band it is on. It is technically possible for APs to send channel 0104 * country IE triplets even for channels outside of the band they are 0105 * in but for that they would have to use the regulatory extension 0106 * in combination with a triplet but this behaviour is currently 0107 * not observed. For this reason if a triplet is seen with channel 0108 * information for a band the BSS is not present in it will be ignored. 0109 */ 0110 void regulatory_hint_country_ie(struct wiphy *wiphy, 0111 enum nl80211_band band, 0112 const u8 *country_ie, 0113 u8 country_ie_len); 0114 0115 /** 0116 * regulatory_hint_disconnect - informs all devices have been disconnected 0117 * 0118 * Regulotory rules can be enhanced further upon scanning and upon 0119 * connection to an AP. These rules become stale if we disconnect 0120 * and go to another country, whether or not we suspend and resume. 0121 * If we suspend, go to another country and resume we'll automatically 0122 * get disconnected shortly after resuming and things will be reset as well. 0123 * This routine is a helper to restore regulatory settings to how they were 0124 * prior to our first connect attempt. This includes ignoring country IE and 0125 * beacon regulatory hints. The ieee80211_regdom module parameter will always 0126 * be respected but if a user had set the regulatory domain that will take 0127 * precedence. 0128 * 0129 * Must be called from process context. 0130 */ 0131 void regulatory_hint_disconnect(void); 0132 0133 /** 0134 * cfg80211_get_unii - get the U-NII band for the frequency 0135 * @freq: the frequency for which we want to get the UNII band. 0136 0137 * Get a value specifying the U-NII band frequency belongs to. 0138 * U-NII bands are defined by the FCC in C.F.R 47 part 15. 0139 * 0140 * Returns -EINVAL if freq is invalid, 0 for UNII-1, 1 for UNII-2A, 0141 * 2 for UNII-2B, 3 for UNII-2C and 4 for UNII-3. 0142 */ 0143 int cfg80211_get_unii(int freq); 0144 0145 /** 0146 * regulatory_indoor_allowed - is indoor operation allowed 0147 */ 0148 bool regulatory_indoor_allowed(void); 0149 0150 /* 0151 * Grace period to timeout pre-CAC results on the dfs channels. This timeout 0152 * value is used for Non-ETSI domain. 0153 * TODO: May be make this timeout available through regdb? 0154 */ 0155 #define REG_PRE_CAC_EXPIRY_GRACE_MS 2000 0156 0157 /** 0158 * regulatory_propagate_dfs_state - Propagate DFS channel state to other wiphys 0159 * @wiphy - wiphy on which radar is detected and the event will be propagated 0160 * to other available wiphys having the same DFS domain 0161 * @chandef - Channel definition of radar detected channel 0162 * @dfs_state - DFS channel state to be set 0163 * @event - Type of radar event which triggered this DFS state change 0164 * 0165 * This function should be called with rtnl lock held. 0166 */ 0167 void regulatory_propagate_dfs_state(struct wiphy *wiphy, 0168 struct cfg80211_chan_def *chandef, 0169 enum nl80211_dfs_state dfs_state, 0170 enum nl80211_radar_event event); 0171 0172 /** 0173 * reg_dfs_domain_same - Checks if both wiphy have same DFS domain configured 0174 * @wiphy1 - wiphy it's dfs_region to be checked against that of wiphy2 0175 * @wiphy2 - wiphy it's dfs_region to be checked against that of wiphy1 0176 */ 0177 bool reg_dfs_domain_same(struct wiphy *wiphy1, struct wiphy *wiphy2); 0178 0179 /** 0180 * reg_reload_regdb - reload the regulatory.db firmware file 0181 */ 0182 int reg_reload_regdb(void); 0183 0184 extern const u8 shipped_regdb_certs[]; 0185 extern unsigned int shipped_regdb_certs_len; 0186 extern const u8 extra_regdb_certs[]; 0187 extern unsigned int extra_regdb_certs_len; 0188 0189 #endif /* __NET_WIRELESS_REG_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |