aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c94
1 files changed, 35 insertions, 59 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index f256dfffbf46..baa898add287 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -141,62 +141,35 @@ static const struct ieee80211_regdomain us_regdom = {
141 .reg_rules = { 141 .reg_rules = {
142 /* IEEE 802.11b/g, channels 1..11 */ 142 /* IEEE 802.11b/g, channels 1..11 */
143 REG_RULE(2412-10, 2462+10, 40, 6, 27, 0), 143 REG_RULE(2412-10, 2462+10, 40, 6, 27, 0),
144 /* IEEE 802.11a, channel 36 */ 144 /* IEEE 802.11a, channel 36..48 */
145 REG_RULE(5180-10, 5180+10, 40, 6, 23, 0), 145 REG_RULE(5180-10, 5240+10, 40, 6, 17, 0),
146 /* IEEE 802.11a, channel 40 */
147 REG_RULE(5200-10, 5200+10, 40, 6, 23, 0),
148 /* IEEE 802.11a, channel 44 */
149 REG_RULE(5220-10, 5220+10, 40, 6, 23, 0),
150 /* IEEE 802.11a, channels 48..64 */ 146 /* IEEE 802.11a, channels 48..64 */
151 REG_RULE(5240-10, 5320+10, 40, 6, 23, 0), 147 REG_RULE(5260-10, 5320+10, 40, 6, 20, NL80211_RRF_DFS),
148 /* IEEE 802.11a, channels 100..124 */
149 REG_RULE(5500-10, 5590+10, 40, 6, 20, NL80211_RRF_DFS),
150 /* IEEE 802.11a, channels 132..144 */
151 REG_RULE(5660-10, 5700+10, 40, 6, 20, NL80211_RRF_DFS),
152 /* IEEE 802.11a, channels 149..165, outdoor */ 152 /* IEEE 802.11a, channels 149..165, outdoor */
153 REG_RULE(5745-10, 5825+10, 40, 6, 30, 0), 153 REG_RULE(5745-10, 5825+10, 40, 6, 30, 0),
154 } 154 }
155}; 155};
156 156
157static const struct ieee80211_regdomain jp_regdom = { 157static const struct ieee80211_regdomain jp_regdom = {
158 .n_reg_rules = 3, 158 .n_reg_rules = 6,
159 .alpha2 = "JP", 159 .alpha2 = "JP",
160 .reg_rules = { 160 .reg_rules = {
161 /* IEEE 802.11b/g, channels 1..14 */ 161 /* IEEE 802.11b/g, channels 1..11 */
162 REG_RULE(2412-10, 2484+10, 40, 6, 20, 0), 162 REG_RULE(2412-10, 2462+10, 40, 6, 20, 0),
163 /* IEEE 802.11a, channels 34..48 */ 163 /* IEEE 802.11b/g, channels 12..13 */
164 REG_RULE(5170-10, 5240+10, 40, 6, 20, 164 REG_RULE(2467-10, 2472+10, 20, 6, 20, 0),
165 NL80211_RRF_PASSIVE_SCAN), 165 /* IEEE 802.11b/g, channel 14 */
166 REG_RULE(2484-10, 2484+10, 20, 6, 20, NL80211_RRF_NO_OFDM),
167 /* IEEE 802.11a, channels 36..48 */
168 REG_RULE(5180-10, 5240+10, 40, 6, 20, 0),
166 /* IEEE 802.11a, channels 52..64 */ 169 /* IEEE 802.11a, channels 52..64 */
167 REG_RULE(5260-10, 5320+10, 40, 6, 20, 170 REG_RULE(5260-10, 5320+10, 40, 6, 20, NL80211_RRF_DFS),
168 NL80211_RRF_NO_IBSS | 171 /* IEEE 802.11a, channels 100..144 */
169 NL80211_RRF_DFS), 172 REG_RULE(5500-10, 5700+10, 40, 6, 23, NL80211_RRF_DFS),
170 }
171};
172
173static const struct ieee80211_regdomain eu_regdom = {
174 .n_reg_rules = 6,
175 /*
176 * This alpha2 is bogus, we leave it here just for stupid
177 * backward compatibility
178 */
179 .alpha2 = "EU",
180 .reg_rules = {
181 /* IEEE 802.11b/g, channels 1..13 */
182 REG_RULE(2412-10, 2472+10, 40, 6, 20, 0),
183 /* IEEE 802.11a, channel 36 */
184 REG_RULE(5180-10, 5180+10, 40, 6, 23,
185 NL80211_RRF_PASSIVE_SCAN),
186 /* IEEE 802.11a, channel 40 */
187 REG_RULE(5200-10, 5200+10, 40, 6, 23,
188 NL80211_RRF_PASSIVE_SCAN),
189 /* IEEE 802.11a, channel 44 */
190 REG_RULE(5220-10, 5220+10, 40, 6, 23,
191 NL80211_RRF_PASSIVE_SCAN),
192 /* IEEE 802.11a, channels 48..64 */
193 REG_RULE(5240-10, 5320+10, 40, 6, 20,
194 NL80211_RRF_NO_IBSS |
195 NL80211_RRF_DFS),
196 /* IEEE 802.11a, channels 100..140 */
197 REG_RULE(5500-10, 5700+10, 40, 6, 30,
198 NL80211_RRF_NO_IBSS |
199 NL80211_RRF_DFS),
200 } 173 }
201}; 174};
202 175
@@ -206,15 +179,17 @@ static const struct ieee80211_regdomain *static_regdom(char *alpha2)
206 return &us_regdom; 179 return &us_regdom;
207 if (alpha2[0] == 'J' && alpha2[1] == 'P') 180 if (alpha2[0] == 'J' && alpha2[1] == 'P')
208 return &jp_regdom; 181 return &jp_regdom;
182 /* Use world roaming rules for "EU", since it was a pseudo
183 domain anyway... */
209 if (alpha2[0] == 'E' && alpha2[1] == 'U') 184 if (alpha2[0] == 'E' && alpha2[1] == 'U')
210 return &eu_regdom; 185 return &world_regdom;
211 /* Default, as per the old rules */ 186 /* Default, world roaming rules */
212 return &us_regdom; 187 return &world_regdom;
213} 188}
214 189
215static bool is_old_static_regdom(const struct ieee80211_regdomain *rd) 190static bool is_old_static_regdom(const struct ieee80211_regdomain *rd)
216{ 191{
217 if (rd == &us_regdom || rd == &jp_regdom || rd == &eu_regdom) 192 if (rd == &us_regdom || rd == &jp_regdom || rd == &world_regdom)
218 return true; 193 return true;
219 return false; 194 return false;
220} 195}
@@ -1008,7 +983,7 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
1008 983
1009 if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER && 984 if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER &&
1010 request_wiphy && request_wiphy == wiphy && 985 request_wiphy && request_wiphy == wiphy &&
1011 request_wiphy->strict_regulatory) { 986 request_wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) {
1012 /* 987 /*
1013 * This gaurantees the driver's requested regulatory domain 988 * This gaurantees the driver's requested regulatory domain
1014 * will always be used as a base for further regulatory 989 * will always be used as a base for further regulatory
@@ -1051,13 +1026,13 @@ static bool ignore_reg_update(struct wiphy *wiphy,
1051 if (!last_request) 1026 if (!last_request)
1052 return true; 1027 return true;
1053 if (initiator == NL80211_REGDOM_SET_BY_CORE && 1028 if (initiator == NL80211_REGDOM_SET_BY_CORE &&
1054 wiphy->custom_regulatory) 1029 wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY)
1055 return true; 1030 return true;
1056 /* 1031 /*
1057 * wiphy->regd will be set once the device has its own 1032 * wiphy->regd will be set once the device has its own
1058 * desired regulatory domain set 1033 * desired regulatory domain set
1059 */ 1034 */
1060 if (wiphy->strict_regulatory && !wiphy->regd && 1035 if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && !wiphy->regd &&
1061 !is_world_regdom(last_request->alpha2)) 1036 !is_world_regdom(last_request->alpha2))
1062 return true; 1037 return true;
1063 return false; 1038 return false;
@@ -1093,7 +1068,7 @@ static void handle_reg_beacon(struct wiphy *wiphy,
1093 1068
1094 chan->beacon_found = true; 1069 chan->beacon_found = true;
1095 1070
1096 if (wiphy->disable_beacon_hints) 1071 if (wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS)
1097 return; 1072 return;
1098 1073
1099 chan_before.center_freq = chan->center_freq; 1074 chan_before.center_freq = chan->center_freq;
@@ -1164,7 +1139,7 @@ static bool reg_is_world_roaming(struct wiphy *wiphy)
1164 return true; 1139 return true;
1165 if (last_request && 1140 if (last_request &&
1166 last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && 1141 last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
1167 wiphy->custom_regulatory) 1142 wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY)
1168 return true; 1143 return true;
1169 return false; 1144 return false;
1170} 1145}
@@ -1591,7 +1566,8 @@ static void reg_process_hint(struct regulatory_request *reg_request)
1591 1566
1592 r = __regulatory_hint(wiphy, reg_request); 1567 r = __regulatory_hint(wiphy, reg_request);
1593 /* This is required so that the orig_* parameters are saved */ 1568 /* This is required so that the orig_* parameters are saved */
1594 if (r == -EALREADY && wiphy && wiphy->strict_regulatory) 1569 if (r == -EALREADY && wiphy &&
1570 wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)
1595 wiphy_update_regulatory(wiphy, reg_request->initiator); 1571 wiphy_update_regulatory(wiphy, reg_request->initiator);
1596out: 1572out:
1597 mutex_unlock(&reg_mutex); 1573 mutex_unlock(&reg_mutex);
@@ -1930,7 +1906,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd)
1930 const struct ieee80211_freq_range *freq_range = NULL; 1906 const struct ieee80211_freq_range *freq_range = NULL;
1931 const struct ieee80211_power_rule *power_rule = NULL; 1907 const struct ieee80211_power_rule *power_rule = NULL;
1932 1908
1933 printk(KERN_INFO "\t(start_freq - end_freq @ bandwidth), " 1909 printk(KERN_INFO " (start_freq - end_freq @ bandwidth), "
1934 "(max_antenna_gain, max_eirp)\n"); 1910 "(max_antenna_gain, max_eirp)\n");
1935 1911
1936 for (i = 0; i < rd->n_reg_rules; i++) { 1912 for (i = 0; i < rd->n_reg_rules; i++) {
@@ -1943,7 +1919,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd)
1943 * in certain regions 1919 * in certain regions
1944 */ 1920 */
1945 if (power_rule->max_antenna_gain) 1921 if (power_rule->max_antenna_gain)
1946 printk(KERN_INFO "\t(%d KHz - %d KHz @ %d KHz), " 1922 printk(KERN_INFO " (%d KHz - %d KHz @ %d KHz), "
1947 "(%d mBi, %d mBm)\n", 1923 "(%d mBi, %d mBm)\n",
1948 freq_range->start_freq_khz, 1924 freq_range->start_freq_khz,
1949 freq_range->end_freq_khz, 1925 freq_range->end_freq_khz,
@@ -1951,7 +1927,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd)
1951 power_rule->max_antenna_gain, 1927 power_rule->max_antenna_gain,
1952 power_rule->max_eirp); 1928 power_rule->max_eirp);
1953 else 1929 else
1954 printk(KERN_INFO "\t(%d KHz - %d KHz @ %d KHz), " 1930 printk(KERN_INFO " (%d KHz - %d KHz @ %d KHz), "
1955 "(N/A, %d mBm)\n", 1931 "(N/A, %d mBm)\n",
1956 freq_range->start_freq_khz, 1932 freq_range->start_freq_khz,
1957 freq_range->end_freq_khz, 1933 freq_range->end_freq_khz,