aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-10-21 13:22:25 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-11-25 14:49:35 -0500
commit8fe02e167efa8ed4a4503a5eedc0f49fcb7e3eb9 (patch)
tree751497c11ae0b02cd90113a379e1fc35c84783ac /net/wireless
parentc17bff87bed4bda1835ee41dc908e926414d8d85 (diff)
cfg80211: consolidate passive-scan and no-ibss flags
These two flags are used for the same purpose, just combine them into a no-ir flag to annotate no initiating radiation is allowed. Old userspace sending either flag will have it treated as the no-ir flag. To be considerate to older userspace we also send both the no-ir flag and the old no-ibss flags. Newer userspace will have to be aware of older kernels. Update all places in the tree using these flags with the following semantic patch: @@ @@ -NL80211_RRF_PASSIVE_SCAN +NL80211_RRF_NO_IR @@ @@ -NL80211_RRF_NO_IBSS +NL80211_RRF_NO_IR @@ @@ -IEEE80211_CHAN_PASSIVE_SCAN +IEEE80211_CHAN_NO_IR @@ @@ -IEEE80211_CHAN_NO_IBSS +IEEE80211_CHAN_NO_IR @@ @@ -NL80211_RRF_NO_IR | NL80211_RRF_NO_IR +NL80211_RRF_NO_IR @@ @@ -IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_NO_IR +IEEE80211_CHAN_NO_IR @@ @@ -(NL80211_RRF_NO_IR) +NL80211_RRF_NO_IR @@ @@ -(IEEE80211_CHAN_NO_IR) +IEEE80211_CHAN_NO_IR Along with some hand-optimisations in documentation, to remove duplicates and to fix some indentation. Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> [do all the driver updates in one go] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/chan.c3
-rw-r--r--net/wireless/genregdb.awk7
-rw-r--r--net/wireless/ibss.c4
-rw-r--r--net/wireless/mesh.c3
-rw-r--r--net/wireless/nl80211.c12
-rw-r--r--net/wireless/reg.c33
6 files changed, 25 insertions, 37 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 9b8cc877eb19..344966496b70 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -467,8 +467,7 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
467 467
468 res = cfg80211_chandef_usable(wiphy, chandef, 468 res = cfg80211_chandef_usable(wiphy, chandef,
469 IEEE80211_CHAN_DISABLED | 469 IEEE80211_CHAN_DISABLED |
470 IEEE80211_CHAN_PASSIVE_SCAN | 470 IEEE80211_CHAN_NO_IR |
471 IEEE80211_CHAN_NO_IBSS |
472 IEEE80211_CHAN_RADAR); 471 IEEE80211_CHAN_RADAR);
473 472
474 trace_cfg80211_return_bool(res); 473 trace_cfg80211_return_bool(res);
diff --git a/net/wireless/genregdb.awk b/net/wireless/genregdb.awk
index 42ed274e81f4..c808619ac9c6 100644
--- a/net/wireless/genregdb.awk
+++ b/net/wireless/genregdb.awk
@@ -107,10 +107,13 @@ active && /^[ \t]*\(/ {
107 } else if (flagarray[arg] == "PTMP-ONLY") { 107 } else if (flagarray[arg] == "PTMP-ONLY") {
108 flags = flags "\n\t\t\tNL80211_RRF_PTMP_ONLY | " 108 flags = flags "\n\t\t\tNL80211_RRF_PTMP_ONLY | "
109 } else if (flagarray[arg] == "PASSIVE-SCAN") { 109 } else if (flagarray[arg] == "PASSIVE-SCAN") {
110 flags = flags "\n\t\t\tNL80211_RRF_PASSIVE_SCAN | " 110 flags = flags "\n\t\t\tNL80211_RRF_NO_IR | "
111 } else if (flagarray[arg] == "NO-IBSS") { 111 } else if (flagarray[arg] == "NO-IBSS") {
112 flags = flags "\n\t\t\tNL80211_RRF_NO_IBSS | " 112 flags = flags "\n\t\t\tNL80211_RRF_NO_IR | "
113 } else if (flagarray[arg] == "NO-IR") {
114 flags = flags "\n\t\t\tNL80211_RRF_NO_IR | "
113 } 115 }
116
114 } 117 }
115 flags = flags "0" 118 flags = flags "0"
116 printf "\t\tREG_RULE(%d, %d, %d, %d, %d, %s),\n", start, end, bw, gain, power, flags 119 printf "\t\tREG_RULE(%d, %d, %d, %d, %d, %s),\n", start, end, bw, gain, power, flags
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 9d797df56649..f79105712949 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -274,7 +274,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
274 274
275 for (i = 0; i < sband->n_channels; i++) { 275 for (i = 0; i < sband->n_channels; i++) {
276 chan = &sband->channels[i]; 276 chan = &sband->channels[i];
277 if (chan->flags & IEEE80211_CHAN_NO_IBSS) 277 if (chan->flags & IEEE80211_CHAN_NO_IR)
278 continue; 278 continue;
279 if (chan->flags & IEEE80211_CHAN_DISABLED) 279 if (chan->flags & IEEE80211_CHAN_DISABLED)
280 continue; 280 continue;
@@ -345,7 +345,7 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
345 chan = ieee80211_get_channel(wdev->wiphy, freq); 345 chan = ieee80211_get_channel(wdev->wiphy, freq);
346 if (!chan) 346 if (!chan)
347 return -EINVAL; 347 return -EINVAL;
348 if (chan->flags & IEEE80211_CHAN_NO_IBSS || 348 if (chan->flags & IEEE80211_CHAN_NO_IR ||
349 chan->flags & IEEE80211_CHAN_DISABLED) 349 chan->flags & IEEE80211_CHAN_DISABLED)
350 return -EINVAL; 350 return -EINVAL;
351 } 351 }
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index 0553fd4d85ae..b0e1869de7de 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -141,8 +141,7 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
141 141
142 for (i = 0; i < sband->n_channels; i++) { 142 for (i = 0; i < sband->n_channels; i++) {
143 chan = &sband->channels[i]; 143 chan = &sband->channels[i];
144 if (chan->flags & (IEEE80211_CHAN_NO_IBSS | 144 if (chan->flags & (IEEE80211_CHAN_NO_IR |
145 IEEE80211_CHAN_PASSIVE_SCAN |
146 IEEE80211_CHAN_DISABLED | 145 IEEE80211_CHAN_DISABLED |
147 IEEE80211_CHAN_RADAR)) 146 IEEE80211_CHAN_RADAR))
148 continue; 147 continue;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a7f4e7902104..41af3a0e9961 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -545,12 +545,12 @@ static int nl80211_msg_put_channel(struct sk_buff *msg,
545 if ((chan->flags & IEEE80211_CHAN_DISABLED) && 545 if ((chan->flags & IEEE80211_CHAN_DISABLED) &&
546 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_DISABLED)) 546 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_DISABLED))
547 goto nla_put_failure; 547 goto nla_put_failure;
548 if ((chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) && 548 if (chan->flags & IEEE80211_CHAN_NO_IR) {
549 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_PASSIVE_SCAN)) 549 if (nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_IR))
550 goto nla_put_failure; 550 goto nla_put_failure;
551 if ((chan->flags & IEEE80211_CHAN_NO_IBSS) && 551 if (nla_put_flag(msg, __NL80211_FREQUENCY_ATTR_NO_IBSS))
552 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_IBSS)) 552 goto nla_put_failure;
553 goto nla_put_failure; 553 }
554 if (chan->flags & IEEE80211_CHAN_RADAR) { 554 if (chan->flags & IEEE80211_CHAN_RADAR) {
555 if (nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR)) 555 if (nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR))
556 goto nla_put_failure; 556 goto nla_put_failure;
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 7da67fd0b418..e4e3337ba296 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -163,35 +163,29 @@ static const struct ieee80211_regdomain world_regdom = {
163 REG_RULE(2412-10, 2462+10, 40, 6, 20, 0), 163 REG_RULE(2412-10, 2462+10, 40, 6, 20, 0),
164 /* IEEE 802.11b/g, channels 12..13. */ 164 /* IEEE 802.11b/g, channels 12..13. */
165 REG_RULE(2467-10, 2472+10, 40, 6, 20, 165 REG_RULE(2467-10, 2472+10, 40, 6, 20,
166 NL80211_RRF_PASSIVE_SCAN | 166 NL80211_RRF_NO_IR),
167 NL80211_RRF_NO_IBSS),
168 /* IEEE 802.11 channel 14 - Only JP enables 167 /* IEEE 802.11 channel 14 - Only JP enables
169 * this and for 802.11b only */ 168 * this and for 802.11b only */
170 REG_RULE(2484-10, 2484+10, 20, 6, 20, 169 REG_RULE(2484-10, 2484+10, 20, 6, 20,
171 NL80211_RRF_PASSIVE_SCAN | 170 NL80211_RRF_NO_IR |
172 NL80211_RRF_NO_IBSS |
173 NL80211_RRF_NO_OFDM), 171 NL80211_RRF_NO_OFDM),
174 /* IEEE 802.11a, channel 36..48 */ 172 /* IEEE 802.11a, channel 36..48 */
175 REG_RULE(5180-10, 5240+10, 160, 6, 20, 173 REG_RULE(5180-10, 5240+10, 160, 6, 20,
176 NL80211_RRF_PASSIVE_SCAN | 174 NL80211_RRF_NO_IR),
177 NL80211_RRF_NO_IBSS),
178 175
179 /* IEEE 802.11a, channel 52..64 - DFS required */ 176 /* IEEE 802.11a, channel 52..64 - DFS required */
180 REG_RULE(5260-10, 5320+10, 160, 6, 20, 177 REG_RULE(5260-10, 5320+10, 160, 6, 20,
181 NL80211_RRF_PASSIVE_SCAN | 178 NL80211_RRF_NO_IR |
182 NL80211_RRF_NO_IBSS |
183 NL80211_RRF_DFS), 179 NL80211_RRF_DFS),
184 180
185 /* IEEE 802.11a, channel 100..144 - DFS required */ 181 /* IEEE 802.11a, channel 100..144 - DFS required */
186 REG_RULE(5500-10, 5720+10, 160, 6, 20, 182 REG_RULE(5500-10, 5720+10, 160, 6, 20,
187 NL80211_RRF_PASSIVE_SCAN | 183 NL80211_RRF_NO_IR |
188 NL80211_RRF_NO_IBSS |
189 NL80211_RRF_DFS), 184 NL80211_RRF_DFS),
190 185
191 /* IEEE 802.11a, channel 149..165 */ 186 /* IEEE 802.11a, channel 149..165 */
192 REG_RULE(5745-10, 5825+10, 80, 6, 20, 187 REG_RULE(5745-10, 5825+10, 80, 6, 20,
193 NL80211_RRF_PASSIVE_SCAN | 188 NL80211_RRF_NO_IR),
194 NL80211_RRF_NO_IBSS),
195 189
196 /* IEEE 802.11ad (60gHz), channels 1..3 */ 190 /* IEEE 802.11ad (60gHz), channels 1..3 */
197 REG_RULE(56160+2160*1-1080, 56160+2160*3+1080, 2160, 0, 0, 0), 191 REG_RULE(56160+2160*1-1080, 56160+2160*3+1080, 2160, 0, 0, 0),
@@ -698,10 +692,8 @@ regdom_intersect(const struct ieee80211_regdomain *rd1,
698static u32 map_regdom_flags(u32 rd_flags) 692static u32 map_regdom_flags(u32 rd_flags)
699{ 693{
700 u32 channel_flags = 0; 694 u32 channel_flags = 0;
701 if (rd_flags & NL80211_RRF_PASSIVE_SCAN) 695 if (rd_flags & NL80211_RRF_NO_IR_ALL)
702 channel_flags |= IEEE80211_CHAN_PASSIVE_SCAN; 696 channel_flags |= IEEE80211_CHAN_NO_IR;
703 if (rd_flags & NL80211_RRF_NO_IBSS)
704 channel_flags |= IEEE80211_CHAN_NO_IBSS;
705 if (rd_flags & NL80211_RRF_DFS) 697 if (rd_flags & NL80211_RRF_DFS)
706 channel_flags |= IEEE80211_CHAN_RADAR; 698 channel_flags |= IEEE80211_CHAN_RADAR;
707 if (rd_flags & NL80211_RRF_NO_OFDM) 699 if (rd_flags & NL80211_RRF_NO_OFDM)
@@ -1066,13 +1058,8 @@ static void handle_reg_beacon(struct wiphy *wiphy, unsigned int chan_idx,
1066 chan_before.center_freq = chan->center_freq; 1058 chan_before.center_freq = chan->center_freq;
1067 chan_before.flags = chan->flags; 1059 chan_before.flags = chan->flags;
1068 1060
1069 if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) { 1061 if (chan->flags & IEEE80211_CHAN_NO_IR) {
1070 chan->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; 1062 chan->flags &= ~IEEE80211_CHAN_NO_IR;
1071 channel_changed = true;
1072 }
1073
1074 if (chan->flags & IEEE80211_CHAN_NO_IBSS) {
1075 chan->flags &= ~IEEE80211_CHAN_NO_IBSS;
1076 channel_changed = true; 1063 channel_changed = true;
1077 } 1064 }
1078 1065