aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2006-01-10 12:56:32 -0500
committerJohn W. Linville <linville@tuxdriver.com>2006-03-22 22:16:54 -0500
commit78e4f36e053b4d2c4623fdc1f6ac63f33d5b7c81 (patch)
tree2408dc01abd1cdf646bcf94bb13501d1ecf10dcf
parent51da28a847027fdf80e55a2a0d7bd0f7a8617d3d (diff)
[PATCH] softmac: select "best" network based on rssi
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_assoc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c
index 700244c3af82..9fd409099b53 100644
--- a/net/ieee80211/softmac/ieee80211softmac_assoc.c
+++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c
@@ -167,6 +167,8 @@ ieee80211softmac_assoc_work(void *d)
167 /* Search the ieee80211 networks for this network if we didn't find it */ 167 /* Search the ieee80211 networks for this network if we didn't find it */
168 if (!found) 168 if (!found)
169 { 169 {
170 s8 rssi = -128; /* if I don't initialise, gcc emits an invalid warning
171 because it cannot follow the best pointer logic. */
170 spin_lock_irqsave(&mac->ieee->lock, flags); 172 spin_lock_irqsave(&mac->ieee->lock, flags);
171 list_for_each_entry(net, &mac->ieee->network_list, list) { 173 list_for_each_entry(net, &mac->ieee->network_list, list) {
172 /* we're supposed to find the network with 174 /* we're supposed to find the network with
@@ -174,7 +176,7 @@ ieee80211softmac_assoc_work(void *d)
174 * any network with a specific ESSID, and many 176 * any network with a specific ESSID, and many
175 * different ones could have that. 177 * different ones could have that.
176 * 178 *
177 * I'll for now implement just finding one at all 179 * I'll for now just go with the reported rssi.
178 * 180 *
179 * We also should take into account the rateset 181 * We also should take into account the rateset
180 * here to find the best BSSID to try. 182 * here to find the best BSSID to try.
@@ -182,15 +184,17 @@ ieee80211softmac_assoc_work(void *d)
182 if (network_matches_request(mac, net)) { 184 if (network_matches_request(mac, net)) {
183 if (!best) { 185 if (!best) {
184 best = net; 186 best = net;
187 rssi = best->stats.rssi;
185 continue; 188 continue;
186 } 189 }
187 /* we already had a matching network, so 190 /* we already had a matching network, so
188 * compare their properties to get the 191 * compare their properties to get the
189 * better of the two ... (see above) 192 * better of the two ... (see above)
190 */ 193 */
191 /* TODO */ 194 if (rssi < net->stats.rssi) {
192 /* for now, just */ 195 best = net;
193 break; 196 rssi = best->stats.rssi;
197 }
194 } 198 }
195 } 199 }
196 /* if we unlock here, we might get interrupted and the `best' 200 /* if we unlock here, we might get interrupted and the `best'