aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/ieee80211_wx.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-09-07 00:48:31 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-07 00:48:31 -0400
commit0edd5b44913cd0aba6f23b626b407f70bb3fb018 (patch)
treedcb79cd9f99e7a20fef43af8e4029a4d8b7671a8 /net/ieee80211/ieee80211_wx.c
parentbbeec90b98a3066f6f2b8d41c80561f5665e4631 (diff)
[wireless ieee80211,ipw2200] Lindent source code
No code changes, just Lindent + manual fixups. This prepares us for updating to the latest Intel driver code, plus gives the source code a nice facelift.
Diffstat (limited to 'net/ieee80211/ieee80211_wx.c')
-rw-r--r--net/ieee80211/ieee80211_wx.c68
1 files changed, 32 insertions, 36 deletions
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c
index 510a1716a4f0..94882f39b072 100644
--- a/net/ieee80211/ieee80211_wx.c
+++ b/net/ieee80211/ieee80211_wx.c
@@ -42,7 +42,7 @@ static const char *ieee80211_modes[] = {
42 42
43#define MAX_CUSTOM_LEN 64 43#define MAX_CUSTOM_LEN 64
44static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, 44static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
45 char *start, char *stop, 45 char *start, char *stop,
46 struct ieee80211_network *network) 46 struct ieee80211_network *network)
47{ 47{
48 char custom[MAX_CUSTOM_LEN]; 48 char custom[MAX_CUSTOM_LEN];
@@ -66,29 +66,28 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
66 iwe.u.data.length = sizeof("<hidden>"); 66 iwe.u.data.length = sizeof("<hidden>");
67 start = iwe_stream_add_point(start, stop, &iwe, "<hidden>"); 67 start = iwe_stream_add_point(start, stop, &iwe, "<hidden>");
68 } else { 68 } else {
69 iwe.u.data.length = min(network->ssid_len, (u8)32); 69 iwe.u.data.length = min(network->ssid_len, (u8) 32);
70 start = iwe_stream_add_point(start, stop, &iwe, network->ssid); 70 start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
71 } 71 }
72 72
73 /* Add the protocol name */ 73 /* Add the protocol name */
74 iwe.cmd = SIOCGIWNAME; 74 iwe.cmd = SIOCGIWNAME;
75 snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", ieee80211_modes[network->mode]); 75 snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s",
76 ieee80211_modes[network->mode]);
76 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN); 77 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN);
77 78
78 /* Add mode */ 79 /* Add mode */
79 iwe.cmd = SIOCGIWMODE; 80 iwe.cmd = SIOCGIWMODE;
80 if (network->capability & 81 if (network->capability & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
81 (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
82 if (network->capability & WLAN_CAPABILITY_ESS) 82 if (network->capability & WLAN_CAPABILITY_ESS)
83 iwe.u.mode = IW_MODE_MASTER; 83 iwe.u.mode = IW_MODE_MASTER;
84 else 84 else
85 iwe.u.mode = IW_MODE_ADHOC; 85 iwe.u.mode = IW_MODE_ADHOC;
86 86
87 start = iwe_stream_add_event(start, stop, &iwe, 87 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN);
88 IW_EV_UINT_LEN);
89 } 88 }
90 89
91 /* Add frequency/channel */ 90 /* Add frequency/channel */
92 iwe.cmd = SIOCGIWFREQ; 91 iwe.cmd = SIOCGIWFREQ;
93/* iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode); 92/* iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode);
94 iwe.u.freq.e = 3; */ 93 iwe.u.freq.e = 3; */
@@ -110,7 +109,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
110 max_rate = 0; 109 max_rate = 0;
111 p = custom; 110 p = custom;
112 p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): "); 111 p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): ");
113 for (i = 0, j = 0; i < network->rates_len; ) { 112 for (i = 0, j = 0; i < network->rates_len;) {
114 if (j < network->rates_ex_len && 113 if (j < network->rates_ex_len &&
115 ((network->rates_ex[j] & 0x7F) < 114 ((network->rates_ex[j] & 0x7F) <
116 (network->rates[i] & 0x7F))) 115 (network->rates[i] & 0x7F)))
@@ -133,8 +132,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
133 iwe.cmd = SIOCGIWRATE; 132 iwe.cmd = SIOCGIWRATE;
134 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; 133 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
135 iwe.u.bitrate.value = max_rate * 500000; 134 iwe.u.bitrate.value = max_rate * 500000;
136 start = iwe_stream_add_event(start, stop, &iwe, 135 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_PARAM_LEN);
137 IW_EV_PARAM_LEN);
138 136
139 iwe.cmd = IWEVCUSTOM; 137 iwe.cmd = IWEVCUSTOM;
140 iwe.u.data.length = p - custom; 138 iwe.u.data.length = p - custom;
@@ -164,7 +162,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
164 if (iwe.u.data.length) 162 if (iwe.u.data.length)
165 start = iwe_stream_add_point(start, stop, &iwe, custom); 163 start = iwe_stream_add_point(start, stop, &iwe, custom);
166 164
167 if (ieee->wpa_enabled && network->wpa_ie_len){ 165 if (ieee->wpa_enabled && network->wpa_ie_len) {
168 char buf[MAX_WPA_IE_LEN * 2 + 30]; 166 char buf[MAX_WPA_IE_LEN * 2 + 30];
169 167
170 u8 *p = buf; 168 u8 *p = buf;
@@ -179,7 +177,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
179 start = iwe_stream_add_point(start, stop, &iwe, buf); 177 start = iwe_stream_add_point(start, stop, &iwe, buf);
180 } 178 }
181 179
182 if (ieee->wpa_enabled && network->rsn_ie_len){ 180 if (ieee->wpa_enabled && network->rsn_ie_len) {
183 char buf[MAX_WPA_IE_LEN * 2 + 30]; 181 char buf[MAX_WPA_IE_LEN * 2 + 30];
184 182
185 u8 *p = buf; 183 u8 *p = buf;
@@ -199,12 +197,12 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
199 iwe.cmd = IWEVCUSTOM; 197 iwe.cmd = IWEVCUSTOM;
200 p = custom; 198 p = custom;
201 p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), 199 p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),
202 " Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100)); 200 " Last beacon: %lums ago",
201 (jiffies - network->last_scanned) / (HZ / 100));
203 iwe.u.data.length = p - custom; 202 iwe.u.data.length = p - custom;
204 if (iwe.u.data.length) 203 if (iwe.u.data.length)
205 start = iwe_stream_add_point(start, stop, &iwe, custom); 204 start = iwe_stream_add_point(start, stop, &iwe, custom);
206 205
207
208 return start; 206 return start;
209} 207}
210 208
@@ -229,18 +227,19 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
229 time_after(network->last_scanned + ieee->scan_age, jiffies)) 227 time_after(network->last_scanned + ieee->scan_age, jiffies))
230 ev = ipw2100_translate_scan(ieee, ev, stop, network); 228 ev = ipw2100_translate_scan(ieee, ev, stop, network);
231 else 229 else
232 IEEE80211_DEBUG_SCAN( 230 IEEE80211_DEBUG_SCAN("Not showing network '%s ("
233 "Not showing network '%s (" 231 MAC_FMT ")' due to age (%lums).\n",
234 MAC_FMT ")' due to age (%lums).\n", 232 escape_essid(network->ssid,
235 escape_essid(network->ssid, 233 network->ssid_len),
236 network->ssid_len), 234 MAC_ARG(network->bssid),
237 MAC_ARG(network->bssid), 235 (jiffies -
238 (jiffies - network->last_scanned) / (HZ / 100)); 236 network->last_scanned) / (HZ /
237 100));
239 } 238 }
240 239
241 spin_unlock_irqrestore(&ieee->lock, flags); 240 spin_unlock_irqrestore(&ieee->lock, flags);
242 241
243 wrqu->data.length = ev - extra; 242 wrqu->data.length = ev - extra;
244 wrqu->data.flags = 0; 243 wrqu->data.flags = 0;
245 244
246 IEEE80211_DEBUG_WX("exit: %d networks returned.\n", i); 245 IEEE80211_DEBUG_WX("exit: %d networks returned.\n", i);
@@ -292,8 +291,8 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
292 if (ieee->crypt[i] != NULL) { 291 if (ieee->crypt[i] != NULL) {
293 if (key_provided) 292 if (key_provided)
294 break; 293 break;
295 ieee80211_crypt_delayed_deinit( 294 ieee80211_crypt_delayed_deinit(ieee,
296 ieee, &ieee->crypt[i]); 295 &ieee->crypt[i]);
297 } 296 }
298 } 297 }
299 298
@@ -306,8 +305,6 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
306 goto done; 305 goto done;
307 } 306 }
308 307
309
310
311 sec.enabled = 1; 308 sec.enabled = 1;
312 sec.flags |= SEC_ENABLED; 309 sec.flags |= SEC_ENABLED;
313 310
@@ -341,8 +338,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
341 new_crypt = NULL; 338 new_crypt = NULL;
342 339
343 printk(KERN_WARNING "%s: could not initialize WEP: " 340 printk(KERN_WARNING "%s: could not initialize WEP: "
344 "load module ieee80211_crypt_wep\n", 341 "load module ieee80211_crypt_wep\n", dev->name);
345 dev->name);
346 return -EOPNOTSUPP; 342 return -EOPNOTSUPP;
347 } 343 }
348 *crypt = new_crypt; 344 *crypt = new_crypt;
@@ -359,7 +355,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
359 key, escape_essid(sec.keys[key], len), 355 key, escape_essid(sec.keys[key], len),
360 erq->length, len); 356 erq->length, len);
361 sec.key_sizes[key] = len; 357 sec.key_sizes[key] = len;
362 (*crypt)->ops->set_key(sec.keys[key], len, NULL, 358 (*crypt)->ops->set_key(sec.keys[key], len, NULL,
363 (*crypt)->priv); 359 (*crypt)->priv);
364 sec.flags |= (1 << key); 360 sec.flags |= (1 << key);
365 /* This ensures a key will be activated if no key is 361 /* This ensures a key will be activated if no key is
@@ -382,15 +378,15 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
382 378
383 /* No key data - just set the default TX key index */ 379 /* No key data - just set the default TX key index */
384 if (key_provided) { 380 if (key_provided) {
385 IEEE80211_DEBUG_WX( 381 IEEE80211_DEBUG_WX
386 "Setting key %d to default Tx key.\n", key); 382 ("Setting key %d to default Tx key.\n", key);
387 ieee->tx_keyidx = key; 383 ieee->tx_keyidx = key;
388 sec.active_key = key; 384 sec.active_key = key;
389 sec.flags |= SEC_ACTIVE_KEY; 385 sec.flags |= SEC_ACTIVE_KEY;
390 } 386 }
391 } 387 }
392 388
393 done: 389 done:
394 ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED); 390 ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED);
395 sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; 391 sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
396 sec.flags |= SEC_AUTH_MODE; 392 sec.flags |= SEC_AUTH_MODE;
@@ -400,7 +396,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
400 /* For now we just support WEP, so only set that security level... 396 /* For now we just support WEP, so only set that security level...
401 * TODO: When WPA is added this is one place that needs to change */ 397 * TODO: When WPA is added this is one place that needs to change */
402 sec.flags |= SEC_LEVEL; 398 sec.flags |= SEC_LEVEL;
403 sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ 399 sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */
404 400
405 if (ieee->set_security) 401 if (ieee->set_security)
406 ieee->set_security(dev, &sec); 402 ieee->set_security(dev, &sec);