diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-07 00:48:31 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-07 00:48:31 -0400 |
commit | 0edd5b44913cd0aba6f23b626b407f70bb3fb018 (patch) | |
tree | dcb79cd9f99e7a20fef43af8e4029a4d8b7671a8 | |
parent | bbeec90b98a3066f6f2b8d41c80561f5665e4631 (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.
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 2270 | ||||
-rw-r--r-- | drivers/net/wireless/ipw2200.h | 406 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt.c | 27 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt_ccmp.c | 47 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt_tkip.c | 133 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt_wep.c | 30 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_module.c | 40 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_rx.c | 310 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_tx.c | 66 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_wx.c | 68 |
10 files changed, 1648 insertions, 1749 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 2a3bd607a5cd..b7f275c00de3 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -72,7 +72,8 @@ static void ipw_rx_queue_replenish(void *); | |||
72 | static int ipw_up(struct ipw_priv *); | 72 | static int ipw_up(struct ipw_priv *); |
73 | static void ipw_down(struct ipw_priv *); | 73 | static void ipw_down(struct ipw_priv *); |
74 | static int ipw_config(struct ipw_priv *); | 74 | static int ipw_config(struct ipw_priv *); |
75 | static int init_supported_rates(struct ipw_priv *priv, struct ipw_supported_rates *prates); | 75 | static int init_supported_rates(struct ipw_priv *priv, |
76 | struct ipw_supported_rates *prates); | ||
76 | 77 | ||
77 | static u8 band_b_active_channel[MAX_B_CHANNELS] = { | 78 | static u8 band_b_active_channel[MAX_B_CHANNELS] = { |
78 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0 | 79 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0 |
@@ -102,7 +103,7 @@ static int is_valid_channel(int mode_mask, int channel) | |||
102 | } | 103 | } |
103 | 104 | ||
104 | static char *snprint_line(char *buf, size_t count, | 105 | static char *snprint_line(char *buf, size_t count, |
105 | const u8 *data, u32 len, u32 ofs) | 106 | const u8 * data, u32 len, u32 ofs) |
106 | { | 107 | { |
107 | int out, i, j, l; | 108 | int out, i, j, l; |
108 | char c; | 109 | char c; |
@@ -136,7 +137,7 @@ static char *snprint_line(char *buf, size_t count, | |||
136 | return buf; | 137 | return buf; |
137 | } | 138 | } |
138 | 139 | ||
139 | static void printk_buf(int level, const u8 *data, u32 len) | 140 | static void printk_buf(int level, const u8 * data, u32 len) |
140 | { | 141 | { |
141 | char line[81]; | 142 | char line[81]; |
142 | u32 ofs = 0; | 143 | u32 ofs = 0; |
@@ -161,21 +162,24 @@ static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg); | |||
161 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); | 162 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); |
162 | static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) | 163 | static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) |
163 | { | 164 | { |
164 | IPW_DEBUG_IO("%s %d: write_indirect8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c)); | 165 | IPW_DEBUG_IO("%s %d: write_indirect8(0x%08X, 0x%08X)\n", __FILE__, |
166 | __LINE__, (u32) (b), (u32) (c)); | ||
165 | _ipw_write_reg8(a, b, c); | 167 | _ipw_write_reg8(a, b, c); |
166 | } | 168 | } |
167 | 169 | ||
168 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); | 170 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); |
169 | static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) | 171 | static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) |
170 | { | 172 | { |
171 | IPW_DEBUG_IO("%s %d: write_indirect16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c)); | 173 | IPW_DEBUG_IO("%s %d: write_indirect16(0x%08X, 0x%08X)\n", __FILE__, |
174 | __LINE__, (u32) (b), (u32) (c)); | ||
172 | _ipw_write_reg16(a, b, c); | 175 | _ipw_write_reg16(a, b, c); |
173 | } | 176 | } |
174 | 177 | ||
175 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); | 178 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); |
176 | static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) | 179 | static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) |
177 | { | 180 | { |
178 | IPW_DEBUG_IO("%s %d: write_indirect32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c)); | 181 | IPW_DEBUG_IO("%s %d: write_indirect32(0x%08X, 0x%08X)\n", __FILE__, |
182 | __LINE__, (u32) (b), (u32) (c)); | ||
179 | _ipw_write_reg32(a, b, c); | 183 | _ipw_write_reg32(a, b, c); |
180 | } | 184 | } |
181 | 185 | ||
@@ -195,24 +199,30 @@ static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) | |||
195 | _ipw_write32(ipw, ofs, val) | 199 | _ipw_write32(ipw, ofs, val) |
196 | 200 | ||
197 | #define _ipw_read8(ipw, ofs) readb((ipw)->hw_base + (ofs)) | 201 | #define _ipw_read8(ipw, ofs) readb((ipw)->hw_base + (ofs)) |
198 | static inline u8 __ipw_read8(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) { | 202 | static inline u8 __ipw_read8(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
199 | IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", f, l, (u32)(ofs)); | 203 | { |
204 | IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", f, l, (u32) (ofs)); | ||
200 | return _ipw_read8(ipw, ofs); | 205 | return _ipw_read8(ipw, ofs); |
201 | } | 206 | } |
207 | |||
202 | #define ipw_read8(ipw, ofs) __ipw_read8(__FILE__, __LINE__, ipw, ofs) | 208 | #define ipw_read8(ipw, ofs) __ipw_read8(__FILE__, __LINE__, ipw, ofs) |
203 | 209 | ||
204 | #define _ipw_read16(ipw, ofs) readw((ipw)->hw_base + (ofs)) | 210 | #define _ipw_read16(ipw, ofs) readw((ipw)->hw_base + (ofs)) |
205 | static inline u16 __ipw_read16(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) { | 211 | static inline u16 __ipw_read16(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
206 | IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", f, l, (u32)(ofs)); | 212 | { |
213 | IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", f, l, (u32) (ofs)); | ||
207 | return _ipw_read16(ipw, ofs); | 214 | return _ipw_read16(ipw, ofs); |
208 | } | 215 | } |
216 | |||
209 | #define ipw_read16(ipw, ofs) __ipw_read16(__FILE__, __LINE__, ipw, ofs) | 217 | #define ipw_read16(ipw, ofs) __ipw_read16(__FILE__, __LINE__, ipw, ofs) |
210 | 218 | ||
211 | #define _ipw_read32(ipw, ofs) readl((ipw)->hw_base + (ofs)) | 219 | #define _ipw_read32(ipw, ofs) readl((ipw)->hw_base + (ofs)) |
212 | static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) { | 220 | static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
213 | IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", f, l, (u32)(ofs)); | 221 | { |
222 | IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", f, l, (u32) (ofs)); | ||
214 | return _ipw_read32(ipw, ofs); | 223 | return _ipw_read32(ipw, ofs); |
215 | } | 224 | } |
225 | |||
216 | #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) | 226 | #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) |
217 | 227 | ||
218 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); | 228 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); |
@@ -220,34 +230,30 @@ static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); | |||
220 | IPW_DEBUG_IO("%s %d: read_inddirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ | 230 | IPW_DEBUG_IO("%s %d: read_inddirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ |
221 | _ipw_read_indirect(a, b, c, d) | 231 | _ipw_read_indirect(a, b, c, d) |
222 | 232 | ||
223 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *data, int num); | 233 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, |
234 | int num); | ||
224 | #define ipw_write_indirect(a, b, c, d) \ | 235 | #define ipw_write_indirect(a, b, c, d) \ |
225 | IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ | 236 | IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ |
226 | _ipw_write_indirect(a, b, c, d) | 237 | _ipw_write_indirect(a, b, c, d) |
227 | 238 | ||
228 | /* indirect write s */ | 239 | /* indirect write s */ |
229 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, | 240 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) |
230 | u32 value) | ||
231 | { | 241 | { |
232 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", | 242 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); |
233 | priv, reg, value); | ||
234 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg); | 243 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg); |
235 | _ipw_write32(priv, CX2_INDIRECT_DATA, value); | 244 | _ipw_write32(priv, CX2_INDIRECT_DATA, value); |
236 | } | 245 | } |
237 | 246 | ||
238 | |||
239 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) | 247 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) |
240 | { | 248 | { |
241 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 249 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
242 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); | 250 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); |
243 | _ipw_write8(priv, CX2_INDIRECT_DATA, value); | 251 | _ipw_write8(priv, CX2_INDIRECT_DATA, value); |
244 | IPW_DEBUG_IO(" reg = 0x%8lX : value = 0x%8X\n", | 252 | IPW_DEBUG_IO(" reg = 0x%8lX : value = 0x%8X\n", |
245 | (unsigned long)(priv->hw_base + CX2_INDIRECT_DATA), | 253 | (unsigned long)(priv->hw_base + CX2_INDIRECT_DATA), value); |
246 | value); | ||
247 | } | 254 | } |
248 | 255 | ||
249 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, | 256 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) |
250 | u16 value) | ||
251 | { | 257 | { |
252 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 258 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
253 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); | 259 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); |
@@ -262,7 +268,7 @@ static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) | |||
262 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); | 268 | _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); |
263 | IPW_DEBUG_IO(" reg = 0x%8X : \n", reg); | 269 | IPW_DEBUG_IO(" reg = 0x%8X : \n", reg); |
264 | word = _ipw_read32(priv, CX2_INDIRECT_DATA); | 270 | word = _ipw_read32(priv, CX2_INDIRECT_DATA); |
265 | return (word >> ((reg & 0x3)*8)) & 0xff; | 271 | return (word >> ((reg & 0x3) * 8)) & 0xff; |
266 | } | 272 | } |
267 | 273 | ||
268 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) | 274 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) |
@@ -302,7 +308,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
302 | _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); | 308 | _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); |
303 | aligned_len = num & CX2_INDIRECT_ADDR_MASK; | 309 | aligned_len = num & CX2_INDIRECT_ADDR_MASK; |
304 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) | 310 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) |
305 | *(u32*)buf = ipw_read32(priv, CX2_AUTOINC_DATA); | 311 | *(u32 *) buf = ipw_read32(priv, CX2_AUTOINC_DATA); |
306 | 312 | ||
307 | /* Copy the last nibble */ | 313 | /* Copy the last nibble */ |
308 | dif_len = num - aligned_len; | 314 | dif_len = num - aligned_len; |
@@ -311,7 +317,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
311 | *buf = ipw_read8(priv, CX2_INDIRECT_DATA + i); | 317 | *buf = ipw_read8(priv, CX2_INDIRECT_DATA + i); |
312 | } | 318 | } |
313 | 319 | ||
314 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf, | 320 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, |
315 | int num) | 321 | int num) |
316 | { | 322 | { |
317 | u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; | 323 | u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; |
@@ -335,7 +341,7 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf, | |||
335 | _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); | 341 | _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); |
336 | aligned_len = num & CX2_INDIRECT_ADDR_MASK; | 342 | aligned_len = num & CX2_INDIRECT_ADDR_MASK; |
337 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) | 343 | for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) |
338 | _ipw_write32(priv, CX2_AUTOINC_DATA, *(u32*)buf); | 344 | _ipw_write32(priv, CX2_AUTOINC_DATA, *(u32 *) buf); |
339 | 345 | ||
340 | /* Copy the last nibble */ | 346 | /* Copy the last nibble */ |
341 | dif_len = num - aligned_len; | 347 | dif_len = num - aligned_len; |
@@ -428,20 +434,18 @@ static void ipw_dump_nic_error_log(struct ipw_priv *priv) | |||
428 | } | 434 | } |
429 | 435 | ||
430 | for (i = ERROR_START_OFFSET; | 436 | for (i = ERROR_START_OFFSET; |
431 | i <= count * ERROR_ELEM_SIZE; | 437 | i <= count * ERROR_ELEM_SIZE; i += ERROR_ELEM_SIZE) { |
432 | i += ERROR_ELEM_SIZE) { | 438 | desc = ipw_read_reg32(priv, base + i); |
433 | desc = ipw_read_reg32(priv, base + i); | 439 | time = ipw_read_reg32(priv, base + i + 1 * sizeof(u32)); |
434 | time = ipw_read_reg32(priv, base + i + 1*sizeof(u32)); | 440 | blink1 = ipw_read_reg32(priv, base + i + 2 * sizeof(u32)); |
435 | blink1 = ipw_read_reg32(priv, base + i + 2*sizeof(u32)); | 441 | blink2 = ipw_read_reg32(priv, base + i + 3 * sizeof(u32)); |
436 | blink2 = ipw_read_reg32(priv, base + i + 3*sizeof(u32)); | 442 | ilink1 = ipw_read_reg32(priv, base + i + 4 * sizeof(u32)); |
437 | ilink1 = ipw_read_reg32(priv, base + i + 4*sizeof(u32)); | 443 | ilink2 = ipw_read_reg32(priv, base + i + 5 * sizeof(u32)); |
438 | ilink2 = ipw_read_reg32(priv, base + i + 5*sizeof(u32)); | 444 | idata = ipw_read_reg32(priv, base + i + 6 * sizeof(u32)); |
439 | idata = ipw_read_reg32(priv, base + i + 6*sizeof(u32)); | ||
440 | 445 | ||
441 | IPW_ERROR( | 446 | IPW_ERROR("%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", |
442 | "%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", | 447 | ipw_error_desc(desc), time, blink1, blink2, |
443 | ipw_error_desc(desc), time, blink1, blink2, | 448 | ilink1, ilink2, idata); |
444 | ilink1, ilink2, idata); | ||
445 | } | 449 | } |
446 | } | 450 | } |
447 | 451 | ||
@@ -456,11 +460,10 @@ static void ipw_dump_nic_event_log(struct ipw_priv *priv) | |||
456 | IPW_ERROR("Start IPW Event Log Dump:\n"); | 460 | IPW_ERROR("Start IPW Event Log Dump:\n"); |
457 | 461 | ||
458 | for (i = EVENT_START_OFFSET; | 462 | for (i = EVENT_START_OFFSET; |
459 | i <= count * EVENT_ELEM_SIZE; | 463 | i <= count * EVENT_ELEM_SIZE; i += EVENT_ELEM_SIZE) { |
460 | i += EVENT_ELEM_SIZE) { | ||
461 | ev = ipw_read_reg32(priv, base + i); | 464 | ev = ipw_read_reg32(priv, base + i); |
462 | time = ipw_read_reg32(priv, base + i + 1*sizeof(u32)); | 465 | time = ipw_read_reg32(priv, base + i + 1 * sizeof(u32)); |
463 | data = ipw_read_reg32(priv, base + i + 2*sizeof(u32)); | 466 | data = ipw_read_reg32(priv, base + i + 2 * sizeof(u32)); |
464 | 467 | ||
465 | #ifdef CONFIG_IPW_DEBUG | 468 | #ifdef CONFIG_IPW_DEBUG |
466 | IPW_ERROR("%i\t0x%08x\t%i\n", time, data, ev); | 469 | IPW_ERROR("%i\t0x%08x\t%i\n", time, data, ev); |
@@ -468,8 +471,7 @@ static void ipw_dump_nic_event_log(struct ipw_priv *priv) | |||
468 | } | 471 | } |
469 | } | 472 | } |
470 | 473 | ||
471 | static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, | 474 | static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, u32 * len) |
472 | u32 *len) | ||
473 | { | 475 | { |
474 | u32 addr, field_info, field_len, field_count, total_len; | 476 | u32 addr, field_info, field_len, field_count, total_len; |
475 | 477 | ||
@@ -513,11 +515,11 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, | |||
513 | } | 515 | } |
514 | 516 | ||
515 | IPW_DEBUG_ORD("Reading TABLE0[%i] from offset 0x%08x\n", | 517 | IPW_DEBUG_ORD("Reading TABLE0[%i] from offset 0x%08x\n", |
516 | ord, priv->table0_addr + (ord << 2)); | 518 | ord, priv->table0_addr + (ord << 2)); |
517 | 519 | ||
518 | *len = sizeof(u32); | 520 | *len = sizeof(u32); |
519 | ord <<= 2; | 521 | ord <<= 2; |
520 | *((u32 *)val) = ipw_read32(priv, priv->table0_addr + ord); | 522 | *((u32 *) val) = ipw_read32(priv, priv->table0_addr + ord); |
521 | break; | 523 | break; |
522 | 524 | ||
523 | case IPW_ORD_TABLE_1_MASK: | 525 | case IPW_ORD_TABLE_1_MASK: |
@@ -545,7 +547,8 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, | |||
545 | return -EINVAL; | 547 | return -EINVAL; |
546 | } | 548 | } |
547 | 549 | ||
548 | *((u32 *)val) = ipw_read_reg32(priv, (priv->table1_addr + (ord << 2))); | 550 | *((u32 *) val) = |
551 | ipw_read_reg32(priv, (priv->table1_addr + (ord << 2))); | ||
549 | *len = sizeof(u32); | 552 | *len = sizeof(u32); |
550 | break; | 553 | break; |
551 | 554 | ||
@@ -573,13 +576,16 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, | |||
573 | 576 | ||
574 | /* get the second DW of statistics ; | 577 | /* get the second DW of statistics ; |
575 | * two 16-bit words - first is length, second is count */ | 578 | * two 16-bit words - first is length, second is count */ |
576 | field_info = ipw_read_reg32(priv, priv->table2_addr + (ord << 3) + sizeof(u32)); | 579 | field_info = |
580 | ipw_read_reg32(priv, | ||
581 | priv->table2_addr + (ord << 3) + | ||
582 | sizeof(u32)); | ||
577 | 583 | ||
578 | /* get each entry length */ | 584 | /* get each entry length */ |
579 | field_len = *((u16 *)&field_info); | 585 | field_len = *((u16 *) & field_info); |
580 | 586 | ||
581 | /* get number of entries */ | 587 | /* get number of entries */ |
582 | field_count = *(((u16 *)&field_info) + 1); | 588 | field_count = *(((u16 *) & field_info) + 1); |
583 | 589 | ||
584 | /* abort if not enought memory */ | 590 | /* abort if not enought memory */ |
585 | total_len = field_len * field_count; | 591 | total_len = field_len * field_count; |
@@ -604,7 +610,6 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, | |||
604 | 610 | ||
605 | } | 611 | } |
606 | 612 | ||
607 | |||
608 | return 0; | 613 | return 0; |
609 | } | 614 | } |
610 | 615 | ||
@@ -624,7 +629,7 @@ static void ipw_init_ordinals(struct ipw_priv *priv) | |||
624 | 629 | ||
625 | priv->table2_addr = ipw_read32(priv, IPW_ORDINALS_TABLE_2); | 630 | priv->table2_addr = ipw_read32(priv, IPW_ORDINALS_TABLE_2); |
626 | priv->table2_len = ipw_read_reg32(priv, priv->table2_addr); | 631 | priv->table2_len = ipw_read_reg32(priv, priv->table2_addr); |
627 | priv->table2_len &= 0x0000ffff; /* use first two bytes */ | 632 | priv->table2_len &= 0x0000ffff; /* use first two bytes */ |
628 | 633 | ||
629 | IPW_DEBUG_ORD("table 2 offset at 0x%08x, len = %i\n", | 634 | IPW_DEBUG_ORD("table 2 offset at 0x%08x, len = %i\n", |
630 | priv->table2_addr, priv->table2_len); | 635 | priv->table2_addr, priv->table2_len); |
@@ -643,7 +648,7 @@ static ssize_t show_debug_level(struct device_driver *d, char *buf) | |||
643 | return sprintf(buf, "0x%08X\n", ipw_debug_level); | 648 | return sprintf(buf, "0x%08X\n", ipw_debug_level); |
644 | } | 649 | } |
645 | static ssize_t store_debug_level(struct device_driver *d, | 650 | static ssize_t store_debug_level(struct device_driver *d, |
646 | const char *buf, size_t count) | 651 | const char *buf, size_t count) |
647 | { | 652 | { |
648 | char *p = (char *)buf; | 653 | char *p = (char *)buf; |
649 | u32 val; | 654 | u32 val; |
@@ -668,11 +673,12 @@ static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, | |||
668 | show_debug_level, store_debug_level); | 673 | show_debug_level, store_debug_level); |
669 | 674 | ||
670 | static ssize_t show_status(struct device *d, | 675 | static ssize_t show_status(struct device *d, |
671 | struct device_attribute *attr, char *buf) | 676 | struct device_attribute *attr, char *buf) |
672 | { | 677 | { |
673 | struct ipw_priv *p = d->driver_data; | 678 | struct ipw_priv *p = d->driver_data; |
674 | return sprintf(buf, "0x%08x\n", (int)p->status); | 679 | return sprintf(buf, "0x%08x\n", (int)p->status); |
675 | } | 680 | } |
681 | |||
676 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); | 682 | static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); |
677 | 683 | ||
678 | static ssize_t show_cfg(struct device *d, struct device_attribute *attr, | 684 | static ssize_t show_cfg(struct device *d, struct device_attribute *attr, |
@@ -681,10 +687,11 @@ static ssize_t show_cfg(struct device *d, struct device_attribute *attr, | |||
681 | struct ipw_priv *p = d->driver_data; | 687 | struct ipw_priv *p = d->driver_data; |
682 | return sprintf(buf, "0x%08x\n", (int)p->config); | 688 | return sprintf(buf, "0x%08x\n", (int)p->config); |
683 | } | 689 | } |
690 | |||
684 | static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); | 691 | static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); |
685 | 692 | ||
686 | static ssize_t show_nic_type(struct device *d, | 693 | static ssize_t show_nic_type(struct device *d, |
687 | struct device_attribute *attr, char *buf) | 694 | struct device_attribute *attr, char *buf) |
688 | { | 695 | { |
689 | struct ipw_priv *p = d->driver_data; | 696 | struct ipw_priv *p = d->driver_data; |
690 | u8 type = p->eeprom[EEPROM_NIC_TYPE]; | 697 | u8 type = p->eeprom[EEPROM_NIC_TYPE]; |
@@ -704,44 +711,50 @@ static ssize_t show_nic_type(struct device *d, | |||
704 | 711 | ||
705 | return sprintf(buf, "UNKNOWN\n"); | 712 | return sprintf(buf, "UNKNOWN\n"); |
706 | } | 713 | } |
714 | |||
707 | static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); | 715 | static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); |
708 | 716 | ||
709 | static ssize_t dump_error_log(struct device *d, | 717 | static ssize_t dump_error_log(struct device *d, |
710 | struct device_attribute *attr, const char *buf, size_t count) | 718 | struct device_attribute *attr, const char *buf, |
719 | size_t count) | ||
711 | { | 720 | { |
712 | char *p = (char *)buf; | 721 | char *p = (char *)buf; |
713 | 722 | ||
714 | if (p[0] == '1') | 723 | if (p[0] == '1') |
715 | ipw_dump_nic_error_log((struct ipw_priv*)d->driver_data); | 724 | ipw_dump_nic_error_log((struct ipw_priv *)d->driver_data); |
716 | 725 | ||
717 | return strnlen(buf, count); | 726 | return strnlen(buf, count); |
718 | } | 727 | } |
728 | |||
719 | static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log); | 729 | static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log); |
720 | 730 | ||
721 | static ssize_t dump_event_log(struct device *d, | 731 | static ssize_t dump_event_log(struct device *d, |
722 | struct device_attribute *attr, const char *buf, size_t count) | 732 | struct device_attribute *attr, const char *buf, |
733 | size_t count) | ||
723 | { | 734 | { |
724 | char *p = (char *)buf; | 735 | char *p = (char *)buf; |
725 | 736 | ||
726 | if (p[0] == '1') | 737 | if (p[0] == '1') |
727 | ipw_dump_nic_event_log((struct ipw_priv*)d->driver_data); | 738 | ipw_dump_nic_event_log((struct ipw_priv *)d->driver_data); |
728 | 739 | ||
729 | return strnlen(buf, count); | 740 | return strnlen(buf, count); |
730 | } | 741 | } |
742 | |||
731 | static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log); | 743 | static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log); |
732 | 744 | ||
733 | static ssize_t show_ucode_version(struct device *d, | 745 | static ssize_t show_ucode_version(struct device *d, |
734 | struct device_attribute *attr, char *buf) | 746 | struct device_attribute *attr, char *buf) |
735 | { | 747 | { |
736 | u32 len = sizeof(u32), tmp = 0; | 748 | u32 len = sizeof(u32), tmp = 0; |
737 | struct ipw_priv *p = d->driver_data; | 749 | struct ipw_priv *p = d->driver_data; |
738 | 750 | ||
739 | if(ipw_get_ordinal(p, IPW_ORD_STAT_UCODE_VERSION, &tmp, &len)) | 751 | if (ipw_get_ordinal(p, IPW_ORD_STAT_UCODE_VERSION, &tmp, &len)) |
740 | return 0; | 752 | return 0; |
741 | 753 | ||
742 | return sprintf(buf, "0x%08x\n", tmp); | 754 | return sprintf(buf, "0x%08x\n", tmp); |
743 | } | 755 | } |
744 | static DEVICE_ATTR(ucode_version, S_IWUSR|S_IRUGO, show_ucode_version, NULL); | 756 | |
757 | static DEVICE_ATTR(ucode_version, S_IWUSR | S_IRUGO, show_ucode_version, NULL); | ||
745 | 758 | ||
746 | static ssize_t show_rtc(struct device *d, struct device_attribute *attr, | 759 | static ssize_t show_rtc(struct device *d, struct device_attribute *attr, |
747 | char *buf) | 760 | char *buf) |
@@ -749,36 +762,38 @@ static ssize_t show_rtc(struct device *d, struct device_attribute *attr, | |||
749 | u32 len = sizeof(u32), tmp = 0; | 762 | u32 len = sizeof(u32), tmp = 0; |
750 | struct ipw_priv *p = d->driver_data; | 763 | struct ipw_priv *p = d->driver_data; |
751 | 764 | ||
752 | if(ipw_get_ordinal(p, IPW_ORD_STAT_RTC, &tmp, &len)) | 765 | if (ipw_get_ordinal(p, IPW_ORD_STAT_RTC, &tmp, &len)) |
753 | return 0; | 766 | return 0; |
754 | 767 | ||
755 | return sprintf(buf, "0x%08x\n", tmp); | 768 | return sprintf(buf, "0x%08x\n", tmp); |
756 | } | 769 | } |
757 | static DEVICE_ATTR(rtc, S_IWUSR|S_IRUGO, show_rtc, NULL); | 770 | |
771 | static DEVICE_ATTR(rtc, S_IWUSR | S_IRUGO, show_rtc, NULL); | ||
758 | 772 | ||
759 | /* | 773 | /* |
760 | * Add a device attribute to view/control the delay between eeprom | 774 | * Add a device attribute to view/control the delay between eeprom |
761 | * operations. | 775 | * operations. |
762 | */ | 776 | */ |
763 | static ssize_t show_eeprom_delay(struct device *d, | 777 | static ssize_t show_eeprom_delay(struct device *d, |
764 | struct device_attribute *attr, char *buf) | 778 | struct device_attribute *attr, char *buf) |
765 | { | 779 | { |
766 | int n = ((struct ipw_priv*)d->driver_data)->eeprom_delay; | 780 | int n = ((struct ipw_priv *)d->driver_data)->eeprom_delay; |
767 | return sprintf(buf, "%i\n", n); | 781 | return sprintf(buf, "%i\n", n); |
768 | } | 782 | } |
769 | static ssize_t store_eeprom_delay(struct device *d, | 783 | static ssize_t store_eeprom_delay(struct device *d, |
770 | struct device_attribute *attr, const char *buf, | 784 | struct device_attribute *attr, |
771 | size_t count) | 785 | const char *buf, size_t count) |
772 | { | 786 | { |
773 | struct ipw_priv *p = d->driver_data; | 787 | struct ipw_priv *p = d->driver_data; |
774 | sscanf(buf, "%i", &p->eeprom_delay); | 788 | sscanf(buf, "%i", &p->eeprom_delay); |
775 | return strnlen(buf, count); | 789 | return strnlen(buf, count); |
776 | } | 790 | } |
777 | static DEVICE_ATTR(eeprom_delay, S_IWUSR|S_IRUGO, | 791 | |
778 | show_eeprom_delay,store_eeprom_delay); | 792 | static DEVICE_ATTR(eeprom_delay, S_IWUSR | S_IRUGO, |
793 | show_eeprom_delay, store_eeprom_delay); | ||
779 | 794 | ||
780 | static ssize_t show_command_event_reg(struct device *d, | 795 | static ssize_t show_command_event_reg(struct device *d, |
781 | struct device_attribute *attr, char *buf) | 796 | struct device_attribute *attr, char *buf) |
782 | { | 797 | { |
783 | u32 reg = 0; | 798 | u32 reg = 0; |
784 | struct ipw_priv *p = d->driver_data; | 799 | struct ipw_priv *p = d->driver_data; |
@@ -787,8 +802,8 @@ static ssize_t show_command_event_reg(struct device *d, | |||
787 | return sprintf(buf, "0x%08x\n", reg); | 802 | return sprintf(buf, "0x%08x\n", reg); |
788 | } | 803 | } |
789 | static ssize_t store_command_event_reg(struct device *d, | 804 | static ssize_t store_command_event_reg(struct device *d, |
790 | struct device_attribute *attr, const char *buf, | 805 | struct device_attribute *attr, |
791 | size_t count) | 806 | const char *buf, size_t count) |
792 | { | 807 | { |
793 | u32 reg; | 808 | u32 reg; |
794 | struct ipw_priv *p = d->driver_data; | 809 | struct ipw_priv *p = d->driver_data; |
@@ -797,11 +812,12 @@ static ssize_t store_command_event_reg(struct device *d, | |||
797 | ipw_write_reg32(p, CX2_INTERNAL_CMD_EVENT, reg); | 812 | ipw_write_reg32(p, CX2_INTERNAL_CMD_EVENT, reg); |
798 | return strnlen(buf, count); | 813 | return strnlen(buf, count); |
799 | } | 814 | } |
800 | static DEVICE_ATTR(command_event_reg, S_IWUSR|S_IRUGO, | 815 | |
801 | show_command_event_reg,store_command_event_reg); | 816 | static DEVICE_ATTR(command_event_reg, S_IWUSR | S_IRUGO, |
817 | show_command_event_reg, store_command_event_reg); | ||
802 | 818 | ||
803 | static ssize_t show_mem_gpio_reg(struct device *d, | 819 | static ssize_t show_mem_gpio_reg(struct device *d, |
804 | struct device_attribute *attr, char *buf) | 820 | struct device_attribute *attr, char *buf) |
805 | { | 821 | { |
806 | u32 reg = 0; | 822 | u32 reg = 0; |
807 | struct ipw_priv *p = d->driver_data; | 823 | struct ipw_priv *p = d->driver_data; |
@@ -810,8 +826,8 @@ static ssize_t show_mem_gpio_reg(struct device *d, | |||
810 | return sprintf(buf, "0x%08x\n", reg); | 826 | return sprintf(buf, "0x%08x\n", reg); |
811 | } | 827 | } |
812 | static ssize_t store_mem_gpio_reg(struct device *d, | 828 | static ssize_t store_mem_gpio_reg(struct device *d, |
813 | struct device_attribute *attr, const char *buf, | 829 | struct device_attribute *attr, |
814 | size_t count) | 830 | const char *buf, size_t count) |
815 | { | 831 | { |
816 | u32 reg; | 832 | u32 reg; |
817 | struct ipw_priv *p = d->driver_data; | 833 | struct ipw_priv *p = d->driver_data; |
@@ -820,11 +836,12 @@ static ssize_t store_mem_gpio_reg(struct device *d, | |||
820 | ipw_write_reg32(p, 0x301100, reg); | 836 | ipw_write_reg32(p, 0x301100, reg); |
821 | return strnlen(buf, count); | 837 | return strnlen(buf, count); |
822 | } | 838 | } |
823 | static DEVICE_ATTR(mem_gpio_reg, S_IWUSR|S_IRUGO, | 839 | |
824 | show_mem_gpio_reg,store_mem_gpio_reg); | 840 | static DEVICE_ATTR(mem_gpio_reg, S_IWUSR | S_IRUGO, |
841 | show_mem_gpio_reg, store_mem_gpio_reg); | ||
825 | 842 | ||
826 | static ssize_t show_indirect_dword(struct device *d, | 843 | static ssize_t show_indirect_dword(struct device *d, |
827 | struct device_attribute *attr, char *buf) | 844 | struct device_attribute *attr, char *buf) |
828 | { | 845 | { |
829 | u32 reg = 0; | 846 | u32 reg = 0; |
830 | struct ipw_priv *priv = d->driver_data; | 847 | struct ipw_priv *priv = d->driver_data; |
@@ -836,8 +853,8 @@ static ssize_t show_indirect_dword(struct device *d, | |||
836 | return sprintf(buf, "0x%08x\n", reg); | 853 | return sprintf(buf, "0x%08x\n", reg); |
837 | } | 854 | } |
838 | static ssize_t store_indirect_dword(struct device *d, | 855 | static ssize_t store_indirect_dword(struct device *d, |
839 | struct device_attribute *attr, const char *buf, | 856 | struct device_attribute *attr, |
840 | size_t count) | 857 | const char *buf, size_t count) |
841 | { | 858 | { |
842 | struct ipw_priv *priv = d->driver_data; | 859 | struct ipw_priv *priv = d->driver_data; |
843 | 860 | ||
@@ -845,11 +862,12 @@ static ssize_t store_indirect_dword(struct device *d, | |||
845 | priv->status |= STATUS_INDIRECT_DWORD; | 862 | priv->status |= STATUS_INDIRECT_DWORD; |
846 | return strnlen(buf, count); | 863 | return strnlen(buf, count); |
847 | } | 864 | } |
848 | static DEVICE_ATTR(indirect_dword, S_IWUSR|S_IRUGO, | 865 | |
849 | show_indirect_dword,store_indirect_dword); | 866 | static DEVICE_ATTR(indirect_dword, S_IWUSR | S_IRUGO, |
867 | show_indirect_dword, store_indirect_dword); | ||
850 | 868 | ||
851 | static ssize_t show_indirect_byte(struct device *d, | 869 | static ssize_t show_indirect_byte(struct device *d, |
852 | struct device_attribute *attr, char *buf) | 870 | struct device_attribute *attr, char *buf) |
853 | { | 871 | { |
854 | u8 reg = 0; | 872 | u8 reg = 0; |
855 | struct ipw_priv *priv = d->driver_data; | 873 | struct ipw_priv *priv = d->driver_data; |
@@ -861,8 +879,8 @@ static ssize_t show_indirect_byte(struct device *d, | |||
861 | return sprintf(buf, "0x%02x\n", reg); | 879 | return sprintf(buf, "0x%02x\n", reg); |
862 | } | 880 | } |
863 | static ssize_t store_indirect_byte(struct device *d, | 881 | static ssize_t store_indirect_byte(struct device *d, |
864 | struct device_attribute *attr, const char *buf, | 882 | struct device_attribute *attr, |
865 | size_t count) | 883 | const char *buf, size_t count) |
866 | { | 884 | { |
867 | struct ipw_priv *priv = d->driver_data; | 885 | struct ipw_priv *priv = d->driver_data; |
868 | 886 | ||
@@ -870,11 +888,12 @@ static ssize_t store_indirect_byte(struct device *d, | |||
870 | priv->status |= STATUS_INDIRECT_BYTE; | 888 | priv->status |= STATUS_INDIRECT_BYTE; |
871 | return strnlen(buf, count); | 889 | return strnlen(buf, count); |
872 | } | 890 | } |
873 | static DEVICE_ATTR(indirect_byte, S_IWUSR|S_IRUGO, | 891 | |
892 | static DEVICE_ATTR(indirect_byte, S_IWUSR | S_IRUGO, | ||
874 | show_indirect_byte, store_indirect_byte); | 893 | show_indirect_byte, store_indirect_byte); |
875 | 894 | ||
876 | static ssize_t show_direct_dword(struct device *d, | 895 | static ssize_t show_direct_dword(struct device *d, |
877 | struct device_attribute *attr, char *buf) | 896 | struct device_attribute *attr, char *buf) |
878 | { | 897 | { |
879 | u32 reg = 0; | 898 | u32 reg = 0; |
880 | struct ipw_priv *priv = d->driver_data; | 899 | struct ipw_priv *priv = d->driver_data; |
@@ -887,8 +906,8 @@ static ssize_t show_direct_dword(struct device *d, | |||
887 | return sprintf(buf, "0x%08x\n", reg); | 906 | return sprintf(buf, "0x%08x\n", reg); |
888 | } | 907 | } |
889 | static ssize_t store_direct_dword(struct device *d, | 908 | static ssize_t store_direct_dword(struct device *d, |
890 | struct device_attribute *attr, const char *buf, | 909 | struct device_attribute *attr, |
891 | size_t count) | 910 | const char *buf, size_t count) |
892 | { | 911 | { |
893 | struct ipw_priv *priv = d->driver_data; | 912 | struct ipw_priv *priv = d->driver_data; |
894 | 913 | ||
@@ -896,9 +915,9 @@ static ssize_t store_direct_dword(struct device *d, | |||
896 | priv->status |= STATUS_DIRECT_DWORD; | 915 | priv->status |= STATUS_DIRECT_DWORD; |
897 | return strnlen(buf, count); | 916 | return strnlen(buf, count); |
898 | } | 917 | } |
899 | static DEVICE_ATTR(direct_dword, S_IWUSR|S_IRUGO, | ||
900 | show_direct_dword,store_direct_dword); | ||
901 | 918 | ||
919 | static DEVICE_ATTR(direct_dword, S_IWUSR | S_IRUGO, | ||
920 | show_direct_dword, store_direct_dword); | ||
902 | 921 | ||
903 | static inline int rf_kill_active(struct ipw_priv *priv) | 922 | static inline int rf_kill_active(struct ipw_priv *priv) |
904 | { | 923 | { |
@@ -911,7 +930,7 @@ static inline int rf_kill_active(struct ipw_priv *priv) | |||
911 | } | 930 | } |
912 | 931 | ||
913 | static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, | 932 | static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, |
914 | char *buf) | 933 | char *buf) |
915 | { | 934 | { |
916 | /* 0 - RF kill not enabled | 935 | /* 0 - RF kill not enabled |
917 | 1 - SW based RF kill active (sysfs) | 936 | 1 - SW based RF kill active (sysfs) |
@@ -919,7 +938,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, | |||
919 | 3 - Both HW and SW baed RF kill active */ | 938 | 3 - Both HW and SW baed RF kill active */ |
920 | struct ipw_priv *priv = d->driver_data; | 939 | struct ipw_priv *priv = d->driver_data; |
921 | int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | | 940 | int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | |
922 | (rf_kill_active(priv) ? 0x2 : 0x0); | 941 | (rf_kill_active(priv) ? 0x2 : 0x0); |
923 | return sprintf(buf, "%i\n", val); | 942 | return sprintf(buf, "%i\n", val); |
924 | } | 943 | } |
925 | 944 | ||
@@ -927,7 +946,7 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) | |||
927 | { | 946 | { |
928 | if ((disable_radio ? 1 : 0) == | 947 | if ((disable_radio ? 1 : 0) == |
929 | (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) | 948 | (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) |
930 | return 0 ; | 949 | return 0; |
931 | 950 | ||
932 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", | 951 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", |
933 | disable_radio ? "OFF" : "ON"); | 952 | disable_radio ? "OFF" : "ON"); |
@@ -956,8 +975,8 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) | |||
956 | return 1; | 975 | return 1; |
957 | } | 976 | } |
958 | 977 | ||
959 | static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, | 978 | static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, |
960 | const char *buf, size_t count) | 979 | const char *buf, size_t count) |
961 | { | 980 | { |
962 | struct ipw_priv *priv = d->driver_data; | 981 | struct ipw_priv *priv = d->driver_data; |
963 | 982 | ||
@@ -965,7 +984,8 @@ static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, | |||
965 | 984 | ||
966 | return count; | 985 | return count; |
967 | } | 986 | } |
968 | static DEVICE_ATTR(rf_kill, S_IWUSR|S_IRUGO, show_rf_kill, store_rf_kill); | 987 | |
988 | static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); | ||
969 | 989 | ||
970 | static void ipw_irq_tasklet(struct ipw_priv *priv) | 990 | static void ipw_irq_tasklet(struct ipw_priv *priv) |
971 | { | 991 | { |
@@ -990,7 +1010,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
990 | 1010 | ||
991 | if (inta & CX2_INTA_BIT_TX_CMD_QUEUE) { | 1011 | if (inta & CX2_INTA_BIT_TX_CMD_QUEUE) { |
992 | IPW_DEBUG_HC("Command completed.\n"); | 1012 | IPW_DEBUG_HC("Command completed.\n"); |
993 | rc = ipw_queue_tx_reclaim( priv, &priv->txq_cmd, -1); | 1013 | rc = ipw_queue_tx_reclaim(priv, &priv->txq_cmd, -1); |
994 | priv->status &= ~STATUS_HCMD_ACTIVE; | 1014 | priv->status &= ~STATUS_HCMD_ACTIVE; |
995 | wake_up_interruptible(&priv->wait_command_queue); | 1015 | wake_up_interruptible(&priv->wait_command_queue); |
996 | handled |= CX2_INTA_BIT_TX_CMD_QUEUE; | 1016 | handled |= CX2_INTA_BIT_TX_CMD_QUEUE; |
@@ -998,25 +1018,25 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
998 | 1018 | ||
999 | if (inta & CX2_INTA_BIT_TX_QUEUE_1) { | 1019 | if (inta & CX2_INTA_BIT_TX_QUEUE_1) { |
1000 | IPW_DEBUG_TX("TX_QUEUE_1\n"); | 1020 | IPW_DEBUG_TX("TX_QUEUE_1\n"); |
1001 | rc = ipw_queue_tx_reclaim( priv, &priv->txq[0], 0); | 1021 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[0], 0); |
1002 | handled |= CX2_INTA_BIT_TX_QUEUE_1; | 1022 | handled |= CX2_INTA_BIT_TX_QUEUE_1; |
1003 | } | 1023 | } |
1004 | 1024 | ||
1005 | if (inta & CX2_INTA_BIT_TX_QUEUE_2) { | 1025 | if (inta & CX2_INTA_BIT_TX_QUEUE_2) { |
1006 | IPW_DEBUG_TX("TX_QUEUE_2\n"); | 1026 | IPW_DEBUG_TX("TX_QUEUE_2\n"); |
1007 | rc = ipw_queue_tx_reclaim( priv, &priv->txq[1], 1); | 1027 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[1], 1); |
1008 | handled |= CX2_INTA_BIT_TX_QUEUE_2; | 1028 | handled |= CX2_INTA_BIT_TX_QUEUE_2; |
1009 | } | 1029 | } |
1010 | 1030 | ||
1011 | if (inta & CX2_INTA_BIT_TX_QUEUE_3) { | 1031 | if (inta & CX2_INTA_BIT_TX_QUEUE_3) { |
1012 | IPW_DEBUG_TX("TX_QUEUE_3\n"); | 1032 | IPW_DEBUG_TX("TX_QUEUE_3\n"); |
1013 | rc = ipw_queue_tx_reclaim( priv, &priv->txq[2], 2); | 1033 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[2], 2); |
1014 | handled |= CX2_INTA_BIT_TX_QUEUE_3; | 1034 | handled |= CX2_INTA_BIT_TX_QUEUE_3; |
1015 | } | 1035 | } |
1016 | 1036 | ||
1017 | if (inta & CX2_INTA_BIT_TX_QUEUE_4) { | 1037 | if (inta & CX2_INTA_BIT_TX_QUEUE_4) { |
1018 | IPW_DEBUG_TX("TX_QUEUE_4\n"); | 1038 | IPW_DEBUG_TX("TX_QUEUE_4\n"); |
1019 | rc = ipw_queue_tx_reclaim( priv, &priv->txq[3], 3); | 1039 | rc = ipw_queue_tx_reclaim(priv, &priv->txq[3], 3); |
1020 | handled |= CX2_INTA_BIT_TX_QUEUE_4; | 1040 | handled |= CX2_INTA_BIT_TX_QUEUE_4; |
1021 | } | 1041 | } |
1022 | 1042 | ||
@@ -1074,8 +1094,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
1074 | } | 1094 | } |
1075 | 1095 | ||
1076 | if (handled != inta) { | 1096 | if (handled != inta) { |
1077 | IPW_ERROR("Unhandled INTA bits 0x%08x\n", | 1097 | IPW_ERROR("Unhandled INTA bits 0x%08x\n", inta & ~handled); |
1078 | inta & ~handled); | ||
1079 | } | 1098 | } |
1080 | 1099 | ||
1081 | /* enable all interrupts */ | 1100 | /* enable all interrupts */ |
@@ -1143,7 +1162,7 @@ static char *get_cmd_string(u8 cmd) | |||
1143 | return "UNKNOWN"; | 1162 | return "UNKNOWN"; |
1144 | } | 1163 | } |
1145 | } | 1164 | } |
1146 | #endif /* CONFIG_IPW_DEBUG */ | 1165 | #endif /* CONFIG_IPW_DEBUG */ |
1147 | 1166 | ||
1148 | #define HOST_COMPLETE_TIMEOUT HZ | 1167 | #define HOST_COMPLETE_TIMEOUT HZ |
1149 | static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | 1168 | static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) |
@@ -1159,15 +1178,16 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
1159 | 1178 | ||
1160 | IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", | 1179 | IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", |
1161 | get_cmd_string(cmd->cmd), cmd->cmd, cmd->len); | 1180 | get_cmd_string(cmd->cmd), cmd->cmd, cmd->len); |
1162 | printk_buf(IPW_DL_HOST_COMMAND, (u8*)cmd->param, cmd->len); | 1181 | printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); |
1163 | 1182 | ||
1164 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); | 1183 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); |
1165 | if (rc) | 1184 | if (rc) |
1166 | return rc; | 1185 | return rc; |
1167 | 1186 | ||
1168 | rc = wait_event_interruptible_timeout( | 1187 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, |
1169 | priv->wait_command_queue, !(priv->status & STATUS_HCMD_ACTIVE), | 1188 | !(priv-> |
1170 | HOST_COMPLETE_TIMEOUT); | 1189 | status & STATUS_HCMD_ACTIVE), |
1190 | HOST_COMPLETE_TIMEOUT); | ||
1171 | if (rc == 0) { | 1191 | if (rc == 0) { |
1172 | IPW_DEBUG_INFO("Command completion failed out after %dms.\n", | 1192 | IPW_DEBUG_INFO("Command completion failed out after %dms.\n", |
1173 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); | 1193 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); |
@@ -1215,7 +1235,7 @@ static int ipw_send_system_config(struct ipw_priv *priv, | |||
1215 | return -1; | 1235 | return -1; |
1216 | } | 1236 | } |
1217 | 1237 | ||
1218 | memcpy(&cmd.param,config,sizeof(*config)); | 1238 | memcpy(&cmd.param, config, sizeof(*config)); |
1219 | if (ipw_send_cmd(priv, &cmd)) { | 1239 | if (ipw_send_cmd(priv, &cmd)) { |
1220 | IPW_ERROR("failed to send SYSTEM_CONFIG command\n"); | 1240 | IPW_ERROR("failed to send SYSTEM_CONFIG command\n"); |
1221 | return -1; | 1241 | return -1; |
@@ -1224,7 +1244,7 @@ static int ipw_send_system_config(struct ipw_priv *priv, | |||
1224 | return 0; | 1244 | return 0; |
1225 | } | 1245 | } |
1226 | 1246 | ||
1227 | static int ipw_send_ssid(struct ipw_priv *priv, u8 *ssid, int len) | 1247 | static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) |
1228 | { | 1248 | { |
1229 | struct host_cmd cmd = { | 1249 | struct host_cmd cmd = { |
1230 | .cmd = IPW_CMD_SSID, | 1250 | .cmd = IPW_CMD_SSID, |
@@ -1245,7 +1265,7 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 *ssid, int len) | |||
1245 | return 0; | 1265 | return 0; |
1246 | } | 1266 | } |
1247 | 1267 | ||
1248 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 *mac) | 1268 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) |
1249 | { | 1269 | { |
1250 | struct host_cmd cmd = { | 1270 | struct host_cmd cmd = { |
1251 | .cmd = IPW_CMD_ADAPTER_ADDRESS, | 1271 | .cmd = IPW_CMD_ADAPTER_ADDRESS, |
@@ -1284,9 +1304,6 @@ static void ipw_adapter_restart(void *adapter) | |||
1284 | } | 1304 | } |
1285 | } | 1305 | } |
1286 | 1306 | ||
1287 | |||
1288 | |||
1289 | |||
1290 | #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) | 1307 | #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) |
1291 | 1308 | ||
1292 | static void ipw_scan_check(void *data) | 1309 | static void ipw_scan_check(void *data) |
@@ -1313,7 +1330,7 @@ static int ipw_send_scan_request_ext(struct ipw_priv *priv, | |||
1313 | return -1; | 1330 | return -1; |
1314 | } | 1331 | } |
1315 | 1332 | ||
1316 | memcpy(&cmd.param,request,sizeof(*request)); | 1333 | memcpy(&cmd.param, request, sizeof(*request)); |
1317 | if (ipw_send_cmd(priv, &cmd)) { | 1334 | if (ipw_send_cmd(priv, &cmd)) { |
1318 | IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n"); | 1335 | IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n"); |
1319 | return -1; | 1336 | return -1; |
@@ -1351,7 +1368,7 @@ static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) | |||
1351 | .len = sizeof(struct ipw_sensitivity_calib) | 1368 | .len = sizeof(struct ipw_sensitivity_calib) |
1352 | }; | 1369 | }; |
1353 | struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) | 1370 | struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) |
1354 | &cmd.param; | 1371 | &cmd.param; |
1355 | calib->beacon_rssi_raw = sens; | 1372 | calib->beacon_rssi_raw = sens; |
1356 | if (ipw_send_cmd(priv, &cmd)) { | 1373 | if (ipw_send_cmd(priv, &cmd)) { |
1357 | IPW_ERROR("failed to send SENSITIVITY CALIB command\n"); | 1374 | IPW_ERROR("failed to send SENSITIVITY CALIB command\n"); |
@@ -1374,7 +1391,7 @@ static int ipw_send_associate(struct ipw_priv *priv, | |||
1374 | return -1; | 1391 | return -1; |
1375 | } | 1392 | } |
1376 | 1393 | ||
1377 | memcpy(&cmd.param,associate,sizeof(*associate)); | 1394 | memcpy(&cmd.param, associate, sizeof(*associate)); |
1378 | if (ipw_send_cmd(priv, &cmd)) { | 1395 | if (ipw_send_cmd(priv, &cmd)) { |
1379 | IPW_ERROR("failed to send ASSOCIATE command\n"); | 1396 | IPW_ERROR("failed to send ASSOCIATE command\n"); |
1380 | return -1; | 1397 | return -1; |
@@ -1396,7 +1413,7 @@ static int ipw_send_supported_rates(struct ipw_priv *priv, | |||
1396 | return -1; | 1413 | return -1; |
1397 | } | 1414 | } |
1398 | 1415 | ||
1399 | memcpy(&cmd.param,rates,sizeof(*rates)); | 1416 | memcpy(&cmd.param, rates, sizeof(*rates)); |
1400 | if (ipw_send_cmd(priv, &cmd)) { | 1417 | if (ipw_send_cmd(priv, &cmd)) { |
1401 | IPW_ERROR("failed to send SUPPORTED_RATES command\n"); | 1418 | IPW_ERROR("failed to send SUPPORTED_RATES command\n"); |
1402 | return -1; | 1419 | return -1; |
@@ -1440,7 +1457,7 @@ static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) | |||
1440 | return -1; | 1457 | return -1; |
1441 | } | 1458 | } |
1442 | 1459 | ||
1443 | *((u32*)&cmd.param) = phy_off; | 1460 | *((u32 *) & cmd.param) = phy_off; |
1444 | 1461 | ||
1445 | if (ipw_send_cmd(priv, &cmd)) { | 1462 | if (ipw_send_cmd(priv, &cmd)) { |
1446 | IPW_ERROR("failed to send CARD_DISABLE command\n"); | 1463 | IPW_ERROR("failed to send CARD_DISABLE command\n"); |
@@ -1451,8 +1468,7 @@ static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) | |||
1451 | } | 1468 | } |
1452 | #endif | 1469 | #endif |
1453 | 1470 | ||
1454 | static int ipw_send_tx_power(struct ipw_priv *priv, | 1471 | static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) |
1455 | struct ipw_tx_power *power) | ||
1456 | { | 1472 | { |
1457 | struct host_cmd cmd = { | 1473 | struct host_cmd cmd = { |
1458 | .cmd = IPW_CMD_TX_POWER, | 1474 | .cmd = IPW_CMD_TX_POWER, |
@@ -1464,7 +1480,7 @@ static int ipw_send_tx_power(struct ipw_priv *priv, | |||
1464 | return -1; | 1480 | return -1; |
1465 | } | 1481 | } |
1466 | 1482 | ||
1467 | memcpy(&cmd.param,power,sizeof(*power)); | 1483 | memcpy(&cmd.param, power, sizeof(*power)); |
1468 | if (ipw_send_cmd(priv, &cmd)) { | 1484 | if (ipw_send_cmd(priv, &cmd)) { |
1469 | IPW_ERROR("failed to send TX_POWER command\n"); | 1485 | IPW_ERROR("failed to send TX_POWER command\n"); |
1470 | return -1; | 1486 | return -1; |
@@ -1527,7 +1543,7 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | |||
1527 | .cmd = IPW_CMD_POWER_MODE, | 1543 | .cmd = IPW_CMD_POWER_MODE, |
1528 | .len = sizeof(u32) | 1544 | .len = sizeof(u32) |
1529 | }; | 1545 | }; |
1530 | u32 *param = (u32*)(&cmd.param); | 1546 | u32 *param = (u32 *) (&cmd.param); |
1531 | 1547 | ||
1532 | if (!priv) { | 1548 | if (!priv) { |
1533 | IPW_ERROR("Invalid args\n"); | 1549 | IPW_ERROR("Invalid args\n"); |
@@ -1585,67 +1601,67 @@ static inline void eeprom_write_reg(struct ipw_priv *p, u32 data) | |||
1585 | } | 1601 | } |
1586 | 1602 | ||
1587 | /* perform a chip select operation */ | 1603 | /* perform a chip select operation */ |
1588 | static inline void eeprom_cs(struct ipw_priv* priv) | 1604 | static inline void eeprom_cs(struct ipw_priv *priv) |
1589 | { | 1605 | { |
1590 | eeprom_write_reg(priv,0); | 1606 | eeprom_write_reg(priv, 0); |
1591 | eeprom_write_reg(priv,EEPROM_BIT_CS); | 1607 | eeprom_write_reg(priv, EEPROM_BIT_CS); |
1592 | eeprom_write_reg(priv,EEPROM_BIT_CS|EEPROM_BIT_SK); | 1608 | eeprom_write_reg(priv, EEPROM_BIT_CS | EEPROM_BIT_SK); |
1593 | eeprom_write_reg(priv,EEPROM_BIT_CS); | 1609 | eeprom_write_reg(priv, EEPROM_BIT_CS); |
1594 | } | 1610 | } |
1595 | 1611 | ||
1596 | /* perform a chip select operation */ | 1612 | /* perform a chip select operation */ |
1597 | static inline void eeprom_disable_cs(struct ipw_priv* priv) | 1613 | static inline void eeprom_disable_cs(struct ipw_priv *priv) |
1598 | { | 1614 | { |
1599 | eeprom_write_reg(priv,EEPROM_BIT_CS); | 1615 | eeprom_write_reg(priv, EEPROM_BIT_CS); |
1600 | eeprom_write_reg(priv,0); | 1616 | eeprom_write_reg(priv, 0); |
1601 | eeprom_write_reg(priv,EEPROM_BIT_SK); | 1617 | eeprom_write_reg(priv, EEPROM_BIT_SK); |
1602 | } | 1618 | } |
1603 | 1619 | ||
1604 | /* push a single bit down to the eeprom */ | 1620 | /* push a single bit down to the eeprom */ |
1605 | static inline void eeprom_write_bit(struct ipw_priv *p,u8 bit) | 1621 | static inline void eeprom_write_bit(struct ipw_priv *p, u8 bit) |
1606 | { | 1622 | { |
1607 | int d = ( bit ? EEPROM_BIT_DI : 0); | 1623 | int d = (bit ? EEPROM_BIT_DI : 0); |
1608 | eeprom_write_reg(p,EEPROM_BIT_CS|d); | 1624 | eeprom_write_reg(p, EEPROM_BIT_CS | d); |
1609 | eeprom_write_reg(p,EEPROM_BIT_CS|d|EEPROM_BIT_SK); | 1625 | eeprom_write_reg(p, EEPROM_BIT_CS | d | EEPROM_BIT_SK); |
1610 | } | 1626 | } |
1611 | 1627 | ||
1612 | /* push an opcode followed by an address down to the eeprom */ | 1628 | /* push an opcode followed by an address down to the eeprom */ |
1613 | static void eeprom_op(struct ipw_priv* priv, u8 op, u8 addr) | 1629 | static void eeprom_op(struct ipw_priv *priv, u8 op, u8 addr) |
1614 | { | 1630 | { |
1615 | int i; | 1631 | int i; |
1616 | 1632 | ||
1617 | eeprom_cs(priv); | 1633 | eeprom_cs(priv); |
1618 | eeprom_write_bit(priv,1); | 1634 | eeprom_write_bit(priv, 1); |
1619 | eeprom_write_bit(priv,op&2); | 1635 | eeprom_write_bit(priv, op & 2); |
1620 | eeprom_write_bit(priv,op&1); | 1636 | eeprom_write_bit(priv, op & 1); |
1621 | for ( i=7; i>=0; i-- ) { | 1637 | for (i = 7; i >= 0; i--) { |
1622 | eeprom_write_bit(priv,addr&(1<<i)); | 1638 | eeprom_write_bit(priv, addr & (1 << i)); |
1623 | } | 1639 | } |
1624 | } | 1640 | } |
1625 | 1641 | ||
1626 | /* pull 16 bits off the eeprom, one bit at a time */ | 1642 | /* pull 16 bits off the eeprom, one bit at a time */ |
1627 | static u16 eeprom_read_u16(struct ipw_priv* priv, u8 addr) | 1643 | static u16 eeprom_read_u16(struct ipw_priv *priv, u8 addr) |
1628 | { | 1644 | { |
1629 | int i; | 1645 | int i; |
1630 | u16 r=0; | 1646 | u16 r = 0; |
1631 | 1647 | ||
1632 | /* Send READ Opcode */ | 1648 | /* Send READ Opcode */ |
1633 | eeprom_op(priv,EEPROM_CMD_READ,addr); | 1649 | eeprom_op(priv, EEPROM_CMD_READ, addr); |
1634 | 1650 | ||
1635 | /* Send dummy bit */ | 1651 | /* Send dummy bit */ |
1636 | eeprom_write_reg(priv,EEPROM_BIT_CS); | 1652 | eeprom_write_reg(priv, EEPROM_BIT_CS); |
1637 | 1653 | ||
1638 | /* Read the byte off the eeprom one bit at a time */ | 1654 | /* Read the byte off the eeprom one bit at a time */ |
1639 | for ( i=0; i<16; i++ ) { | 1655 | for (i = 0; i < 16; i++) { |
1640 | u32 data = 0; | 1656 | u32 data = 0; |
1641 | eeprom_write_reg(priv,EEPROM_BIT_CS|EEPROM_BIT_SK); | 1657 | eeprom_write_reg(priv, EEPROM_BIT_CS | EEPROM_BIT_SK); |
1642 | eeprom_write_reg(priv,EEPROM_BIT_CS); | 1658 | eeprom_write_reg(priv, EEPROM_BIT_CS); |
1643 | data = ipw_read_reg32(priv,FW_MEM_REG_EEPROM_ACCESS); | 1659 | data = ipw_read_reg32(priv, FW_MEM_REG_EEPROM_ACCESS); |
1644 | r = (r<<1) | ((data & EEPROM_BIT_DO)?1:0); | 1660 | r = (r << 1) | ((data & EEPROM_BIT_DO) ? 1 : 0); |
1645 | } | 1661 | } |
1646 | 1662 | ||
1647 | /* Send another dummy bit */ | 1663 | /* Send another dummy bit */ |
1648 | eeprom_write_reg(priv,0); | 1664 | eeprom_write_reg(priv, 0); |
1649 | eeprom_disable_cs(priv); | 1665 | eeprom_disable_cs(priv); |
1650 | 1666 | ||
1651 | return r; | 1667 | return r; |
@@ -1653,9 +1669,9 @@ static u16 eeprom_read_u16(struct ipw_priv* priv, u8 addr) | |||
1653 | 1669 | ||
1654 | /* helper function for pulling the mac address out of the private */ | 1670 | /* helper function for pulling the mac address out of the private */ |
1655 | /* data's copy of the eeprom data */ | 1671 | /* data's copy of the eeprom data */ |
1656 | static void eeprom_parse_mac(struct ipw_priv* priv, u8* mac) | 1672 | static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac) |
1657 | { | 1673 | { |
1658 | u8* ee = (u8*)priv->eeprom; | 1674 | u8 *ee = (u8 *) priv->eeprom; |
1659 | memcpy(mac, &ee[EEPROM_MAC_ADDRESS], 6); | 1675 | memcpy(mac, &ee[EEPROM_MAC_ADDRESS], 6); |
1660 | } | 1676 | } |
1661 | 1677 | ||
@@ -1670,26 +1686,25 @@ static void eeprom_parse_mac(struct ipw_priv* priv, u8* mac) | |||
1670 | static void ipw_eeprom_init_sram(struct ipw_priv *priv) | 1686 | static void ipw_eeprom_init_sram(struct ipw_priv *priv) |
1671 | { | 1687 | { |
1672 | int i; | 1688 | int i; |
1673 | u16 *eeprom = (u16 *)priv->eeprom; | 1689 | u16 *eeprom = (u16 *) priv->eeprom; |
1674 | 1690 | ||
1675 | IPW_DEBUG_TRACE(">>\n"); | 1691 | IPW_DEBUG_TRACE(">>\n"); |
1676 | 1692 | ||
1677 | /* read entire contents of eeprom into private buffer */ | 1693 | /* read entire contents of eeprom into private buffer */ |
1678 | for ( i=0; i<128; i++ ) | 1694 | for (i = 0; i < 128; i++) |
1679 | eeprom[i] = eeprom_read_u16(priv,(u8)i); | 1695 | eeprom[i] = eeprom_read_u16(priv, (u8) i); |
1680 | 1696 | ||
1681 | /* | 1697 | /* |
1682 | If the data looks correct, then copy it to our private | 1698 | If the data looks correct, then copy it to our private |
1683 | copy. Otherwise let the firmware know to perform the operation | 1699 | copy. Otherwise let the firmware know to perform the operation |
1684 | on it's own | 1700 | on it's own |
1685 | */ | 1701 | */ |
1686 | if ((priv->eeprom + EEPROM_VERSION) != 0) { | 1702 | if ((priv->eeprom + EEPROM_VERSION) != 0) { |
1687 | IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); | 1703 | IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); |
1688 | 1704 | ||
1689 | /* write the eeprom data to sram */ | 1705 | /* write the eeprom data to sram */ |
1690 | for( i=0; i<CX2_EEPROM_IMAGE_SIZE; i++ ) | 1706 | for (i = 0; i < CX2_EEPROM_IMAGE_SIZE; i++) |
1691 | ipw_write8(priv, IPW_EEPROM_DATA + i, | 1707 | ipw_write8(priv, IPW_EEPROM_DATA + i, priv->eeprom[i]); |
1692 | priv->eeprom[i]); | ||
1693 | 1708 | ||
1694 | /* Do not load eeprom data on fatal error or suspend */ | 1709 | /* Do not load eeprom data on fatal error or suspend */ |
1695 | ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 0); | 1710 | ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 0); |
@@ -1703,11 +1718,11 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv) | |||
1703 | IPW_DEBUG_TRACE("<<\n"); | 1718 | IPW_DEBUG_TRACE("<<\n"); |
1704 | } | 1719 | } |
1705 | 1720 | ||
1706 | |||
1707 | static inline void ipw_zero_memory(struct ipw_priv *priv, u32 start, u32 count) | 1721 | static inline void ipw_zero_memory(struct ipw_priv *priv, u32 start, u32 count) |
1708 | { | 1722 | { |
1709 | count >>= 2; | 1723 | count >>= 2; |
1710 | if (!count) return; | 1724 | if (!count) |
1725 | return; | ||
1711 | _ipw_write32(priv, CX2_AUTOINC_ADDR, start); | 1726 | _ipw_write32(priv, CX2_AUTOINC_ADDR, start); |
1712 | while (count--) | 1727 | while (count--) |
1713 | _ipw_write32(priv, CX2_AUTOINC_DATA, 0); | 1728 | _ipw_write32(priv, CX2_AUTOINC_DATA, 0); |
@@ -1721,7 +1736,7 @@ static inline void ipw_fw_dma_reset_command_blocks(struct ipw_priv *priv) | |||
1721 | } | 1736 | } |
1722 | 1737 | ||
1723 | static int ipw_fw_dma_enable(struct ipw_priv *priv) | 1738 | static int ipw_fw_dma_enable(struct ipw_priv *priv) |
1724 | { /* start dma engine but no transfers yet*/ | 1739 | { /* start dma engine but no transfers yet */ |
1725 | 1740 | ||
1726 | IPW_DEBUG_FW(">> : \n"); | 1741 | IPW_DEBUG_FW(">> : \n"); |
1727 | 1742 | ||
@@ -1749,12 +1764,16 @@ static void ipw_fw_dma_abort(struct ipw_priv *priv) | |||
1749 | IPW_DEBUG_FW("<< \n"); | 1764 | IPW_DEBUG_FW("<< \n"); |
1750 | } | 1765 | } |
1751 | 1766 | ||
1752 | static int ipw_fw_dma_write_command_block(struct ipw_priv *priv, int index, struct command_block *cb) | 1767 | static int ipw_fw_dma_write_command_block(struct ipw_priv *priv, int index, |
1768 | struct command_block *cb) | ||
1753 | { | 1769 | { |
1754 | u32 address = CX2_SHARED_SRAM_DMA_CONTROL + (sizeof(struct command_block) * index); | 1770 | u32 address = |
1771 | CX2_SHARED_SRAM_DMA_CONTROL + | ||
1772 | (sizeof(struct command_block) * index); | ||
1755 | IPW_DEBUG_FW(">> :\n"); | 1773 | IPW_DEBUG_FW(">> :\n"); |
1756 | 1774 | ||
1757 | ipw_write_indirect(priv, address, (u8*)cb, (int)sizeof(struct command_block)); | 1775 | ipw_write_indirect(priv, address, (u8 *) cb, |
1776 | (int)sizeof(struct command_block)); | ||
1758 | 1777 | ||
1759 | IPW_DEBUG_FW("<< :\n"); | 1778 | IPW_DEBUG_FW("<< :\n"); |
1760 | return 0; | 1779 | return 0; |
@@ -1764,17 +1783,20 @@ static int ipw_fw_dma_write_command_block(struct ipw_priv *priv, int index, stru | |||
1764 | static int ipw_fw_dma_kick(struct ipw_priv *priv) | 1783 | static int ipw_fw_dma_kick(struct ipw_priv *priv) |
1765 | { | 1784 | { |
1766 | u32 control = 0; | 1785 | u32 control = 0; |
1767 | u32 index=0; | 1786 | u32 index = 0; |
1768 | 1787 | ||
1769 | IPW_DEBUG_FW(">> :\n"); | 1788 | IPW_DEBUG_FW(">> :\n"); |
1770 | 1789 | ||
1771 | for (index = 0; index < priv->sram_desc.last_cb_index; index++) | 1790 | for (index = 0; index < priv->sram_desc.last_cb_index; index++) |
1772 | ipw_fw_dma_write_command_block(priv, index, &priv->sram_desc.cb_list[index]); | 1791 | ipw_fw_dma_write_command_block(priv, index, |
1792 | &priv->sram_desc.cb_list[index]); | ||
1773 | 1793 | ||
1774 | /* Enable the DMA in the CSR register */ | 1794 | /* Enable the DMA in the CSR register */ |
1775 | ipw_clear_bit(priv, CX2_RESET_REG,CX2_RESET_REG_MASTER_DISABLED | CX2_RESET_REG_STOP_MASTER); | 1795 | ipw_clear_bit(priv, CX2_RESET_REG, |
1796 | CX2_RESET_REG_MASTER_DISABLED | | ||
1797 | CX2_RESET_REG_STOP_MASTER); | ||
1776 | 1798 | ||
1777 | /* Set the Start bit. */ | 1799 | /* Set the Start bit. */ |
1778 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_START; | 1800 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_START; |
1779 | ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control); | 1801 | ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control); |
1780 | 1802 | ||
@@ -1785,25 +1807,25 @@ static int ipw_fw_dma_kick(struct ipw_priv *priv) | |||
1785 | static void ipw_fw_dma_dump_command_block(struct ipw_priv *priv) | 1807 | static void ipw_fw_dma_dump_command_block(struct ipw_priv *priv) |
1786 | { | 1808 | { |
1787 | u32 address; | 1809 | u32 address; |
1788 | u32 register_value=0; | 1810 | u32 register_value = 0; |
1789 | u32 cb_fields_address=0; | 1811 | u32 cb_fields_address = 0; |
1790 | 1812 | ||
1791 | IPW_DEBUG_FW(">> :\n"); | 1813 | IPW_DEBUG_FW(">> :\n"); |
1792 | address = ipw_read_reg32(priv,CX2_DMA_I_CURRENT_CB); | 1814 | address = ipw_read_reg32(priv, CX2_DMA_I_CURRENT_CB); |
1793 | IPW_DEBUG_FW_INFO("Current CB is 0x%x \n",address); | 1815 | IPW_DEBUG_FW_INFO("Current CB is 0x%x \n", address); |
1794 | 1816 | ||
1795 | /* Read the DMA Controlor register */ | 1817 | /* Read the DMA Controlor register */ |
1796 | register_value = ipw_read_reg32(priv, CX2_DMA_I_DMA_CONTROL); | 1818 | register_value = ipw_read_reg32(priv, CX2_DMA_I_DMA_CONTROL); |
1797 | IPW_DEBUG_FW_INFO("CX2_DMA_I_DMA_CONTROL is 0x%x \n",register_value); | 1819 | IPW_DEBUG_FW_INFO("CX2_DMA_I_DMA_CONTROL is 0x%x \n", register_value); |
1798 | 1820 | ||
1799 | /* Print the CB values*/ | 1821 | /* Print the CB values */ |
1800 | cb_fields_address = address; | 1822 | cb_fields_address = address; |
1801 | register_value = ipw_read_reg32(priv, cb_fields_address); | 1823 | register_value = ipw_read_reg32(priv, cb_fields_address); |
1802 | IPW_DEBUG_FW_INFO("Current CB ControlField is 0x%x \n",register_value); | 1824 | IPW_DEBUG_FW_INFO("Current CB ControlField is 0x%x \n", register_value); |
1803 | 1825 | ||
1804 | cb_fields_address += sizeof(u32); | 1826 | cb_fields_address += sizeof(u32); |
1805 | register_value = ipw_read_reg32(priv, cb_fields_address); | 1827 | register_value = ipw_read_reg32(priv, cb_fields_address); |
1806 | IPW_DEBUG_FW_INFO("Current CB Source Field is 0x%x \n",register_value); | 1828 | IPW_DEBUG_FW_INFO("Current CB Source Field is 0x%x \n", register_value); |
1807 | 1829 | ||
1808 | cb_fields_address += sizeof(u32); | 1830 | cb_fields_address += sizeof(u32); |
1809 | register_value = ipw_read_reg32(priv, cb_fields_address); | 1831 | register_value = ipw_read_reg32(priv, cb_fields_address); |
@@ -1812,7 +1834,7 @@ static void ipw_fw_dma_dump_command_block(struct ipw_priv *priv) | |||
1812 | 1834 | ||
1813 | cb_fields_address += sizeof(u32); | 1835 | cb_fields_address += sizeof(u32); |
1814 | register_value = ipw_read_reg32(priv, cb_fields_address); | 1836 | register_value = ipw_read_reg32(priv, cb_fields_address); |
1815 | IPW_DEBUG_FW_INFO("Current CB Status Field is 0x%x \n",register_value); | 1837 | IPW_DEBUG_FW_INFO("Current CB Status Field is 0x%x \n", register_value); |
1816 | 1838 | ||
1817 | IPW_DEBUG_FW(">> :\n"); | 1839 | IPW_DEBUG_FW(">> :\n"); |
1818 | } | 1840 | } |
@@ -1823,13 +1845,13 @@ static int ipw_fw_dma_command_block_index(struct ipw_priv *priv) | |||
1823 | u32 current_cb_index = 0; | 1845 | u32 current_cb_index = 0; |
1824 | 1846 | ||
1825 | IPW_DEBUG_FW("<< :\n"); | 1847 | IPW_DEBUG_FW("<< :\n"); |
1826 | current_cb_address= ipw_read_reg32(priv, CX2_DMA_I_CURRENT_CB); | 1848 | current_cb_address = ipw_read_reg32(priv, CX2_DMA_I_CURRENT_CB); |
1827 | 1849 | ||
1828 | current_cb_index = (current_cb_address - CX2_SHARED_SRAM_DMA_CONTROL )/ | 1850 | current_cb_index = (current_cb_address - CX2_SHARED_SRAM_DMA_CONTROL) / |
1829 | sizeof (struct command_block); | 1851 | sizeof(struct command_block); |
1830 | 1852 | ||
1831 | IPW_DEBUG_FW_INFO("Current CB index 0x%x address = 0x%X \n", | 1853 | IPW_DEBUG_FW_INFO("Current CB index 0x%x address = 0x%X \n", |
1832 | current_cb_index, current_cb_address ); | 1854 | current_cb_index, current_cb_address); |
1833 | 1855 | ||
1834 | IPW_DEBUG_FW(">> :\n"); | 1856 | IPW_DEBUG_FW(">> :\n"); |
1835 | return current_cb_index; | 1857 | return current_cb_index; |
@@ -1840,15 +1862,14 @@ static int ipw_fw_dma_add_command_block(struct ipw_priv *priv, | |||
1840 | u32 src_address, | 1862 | u32 src_address, |
1841 | u32 dest_address, | 1863 | u32 dest_address, |
1842 | u32 length, | 1864 | u32 length, |
1843 | int interrupt_enabled, | 1865 | int interrupt_enabled, int is_last) |
1844 | int is_last) | ||
1845 | { | 1866 | { |
1846 | 1867 | ||
1847 | u32 control = CB_VALID | CB_SRC_LE | CB_DEST_LE | CB_SRC_AUTOINC | | 1868 | u32 control = CB_VALID | CB_SRC_LE | CB_DEST_LE | CB_SRC_AUTOINC | |
1848 | CB_SRC_IO_GATED | CB_DEST_AUTOINC | CB_SRC_SIZE_LONG | | 1869 | CB_SRC_IO_GATED | CB_DEST_AUTOINC | CB_SRC_SIZE_LONG | |
1849 | CB_DEST_SIZE_LONG; | 1870 | CB_DEST_SIZE_LONG; |
1850 | struct command_block *cb; | 1871 | struct command_block *cb; |
1851 | u32 last_cb_element=0; | 1872 | u32 last_cb_element = 0; |
1852 | 1873 | ||
1853 | IPW_DEBUG_FW_INFO("src_address=0x%x dest_address=0x%x length=0x%x\n", | 1874 | IPW_DEBUG_FW_INFO("src_address=0x%x dest_address=0x%x length=0x%x\n", |
1854 | src_address, dest_address, length); | 1875 | src_address, dest_address, length); |
@@ -1861,7 +1882,7 @@ static int ipw_fw_dma_add_command_block(struct ipw_priv *priv, | |||
1861 | priv->sram_desc.last_cb_index++; | 1882 | priv->sram_desc.last_cb_index++; |
1862 | 1883 | ||
1863 | /* Calculate the new CB control word */ | 1884 | /* Calculate the new CB control word */ |
1864 | if (interrupt_enabled ) | 1885 | if (interrupt_enabled) |
1865 | control |= CB_INT_ENABLED; | 1886 | control |= CB_INT_ENABLED; |
1866 | 1887 | ||
1867 | if (is_last) | 1888 | if (is_last) |
@@ -1870,7 +1891,7 @@ static int ipw_fw_dma_add_command_block(struct ipw_priv *priv, | |||
1870 | control |= length; | 1891 | control |= length; |
1871 | 1892 | ||
1872 | /* Calculate the CB Element's checksum value */ | 1893 | /* Calculate the CB Element's checksum value */ |
1873 | cb->status = control ^src_address ^dest_address; | 1894 | cb->status = control ^ src_address ^ dest_address; |
1874 | 1895 | ||
1875 | /* Copy the Source and Destination addresses */ | 1896 | /* Copy the Source and Destination addresses */ |
1876 | cb->dest_addr = dest_address; | 1897 | cb->dest_addr = dest_address; |
@@ -1883,22 +1904,21 @@ static int ipw_fw_dma_add_command_block(struct ipw_priv *priv, | |||
1883 | } | 1904 | } |
1884 | 1905 | ||
1885 | static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, | 1906 | static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, |
1886 | u32 src_phys, | 1907 | u32 src_phys, u32 dest_address, u32 length) |
1887 | u32 dest_address, | ||
1888 | u32 length) | ||
1889 | { | 1908 | { |
1890 | u32 bytes_left = length; | 1909 | u32 bytes_left = length; |
1891 | u32 src_offset=0; | 1910 | u32 src_offset = 0; |
1892 | u32 dest_offset=0; | 1911 | u32 dest_offset = 0; |
1893 | int status = 0; | 1912 | int status = 0; |
1894 | IPW_DEBUG_FW(">> \n"); | 1913 | IPW_DEBUG_FW(">> \n"); |
1895 | IPW_DEBUG_FW_INFO("src_phys=0x%x dest_address=0x%x length=0x%x\n", | 1914 | IPW_DEBUG_FW_INFO("src_phys=0x%x dest_address=0x%x length=0x%x\n", |
1896 | src_phys, dest_address, length); | 1915 | src_phys, dest_address, length); |
1897 | while (bytes_left > CB_MAX_LENGTH) { | 1916 | while (bytes_left > CB_MAX_LENGTH) { |
1898 | status = ipw_fw_dma_add_command_block( priv, | 1917 | status = ipw_fw_dma_add_command_block(priv, |
1899 | src_phys + src_offset, | 1918 | src_phys + src_offset, |
1900 | dest_address + dest_offset, | 1919 | dest_address + |
1901 | CB_MAX_LENGTH, 0, 0); | 1920 | dest_offset, |
1921 | CB_MAX_LENGTH, 0, 0); | ||
1902 | if (status) { | 1922 | if (status) { |
1903 | IPW_DEBUG_FW_INFO(": Failed\n"); | 1923 | IPW_DEBUG_FW_INFO(": Failed\n"); |
1904 | return -1; | 1924 | return -1; |
@@ -1912,18 +1932,18 @@ static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, | |||
1912 | 1932 | ||
1913 | /* add the buffer tail */ | 1933 | /* add the buffer tail */ |
1914 | if (bytes_left > 0) { | 1934 | if (bytes_left > 0) { |
1915 | status = ipw_fw_dma_add_command_block( | 1935 | status = |
1916 | priv, src_phys + src_offset, | 1936 | ipw_fw_dma_add_command_block(priv, src_phys + src_offset, |
1917 | dest_address + dest_offset, | 1937 | dest_address + dest_offset, |
1918 | bytes_left, 0, 0); | 1938 | bytes_left, 0, 0); |
1919 | if (status) { | 1939 | if (status) { |
1920 | IPW_DEBUG_FW_INFO(": Failed on the buffer tail\n"); | 1940 | IPW_DEBUG_FW_INFO(": Failed on the buffer tail\n"); |
1921 | return -1; | 1941 | return -1; |
1922 | } else | 1942 | } else |
1923 | IPW_DEBUG_FW_INFO(": Adding new cb - the buffer tail\n"); | 1943 | IPW_DEBUG_FW_INFO |
1944 | (": Adding new cb - the buffer tail\n"); | ||
1924 | } | 1945 | } |
1925 | 1946 | ||
1926 | |||
1927 | IPW_DEBUG_FW("<< \n"); | 1947 | IPW_DEBUG_FW("<< \n"); |
1928 | return 0; | 1948 | return 0; |
1929 | } | 1949 | } |
@@ -1937,7 +1957,7 @@ static int ipw_fw_dma_wait(struct ipw_priv *priv) | |||
1937 | 1957 | ||
1938 | current_index = ipw_fw_dma_command_block_index(priv); | 1958 | current_index = ipw_fw_dma_command_block_index(priv); |
1939 | IPW_DEBUG_FW_INFO("sram_desc.last_cb_index:0x%8X\n", | 1959 | IPW_DEBUG_FW_INFO("sram_desc.last_cb_index:0x%8X\n", |
1940 | (int) priv->sram_desc.last_cb_index); | 1960 | (int)priv->sram_desc.last_cb_index); |
1941 | 1961 | ||
1942 | while (current_index < priv->sram_desc.last_cb_index) { | 1962 | while (current_index < priv->sram_desc.last_cb_index) { |
1943 | udelay(50); | 1963 | udelay(50); |
@@ -1955,8 +1975,8 @@ static int ipw_fw_dma_wait(struct ipw_priv *priv) | |||
1955 | 1975 | ||
1956 | ipw_fw_dma_abort(priv); | 1976 | ipw_fw_dma_abort(priv); |
1957 | 1977 | ||
1958 | /*Disable the DMA in the CSR register*/ | 1978 | /*Disable the DMA in the CSR register */ |
1959 | ipw_set_bit(priv, CX2_RESET_REG, | 1979 | ipw_set_bit(priv, CX2_RESET_REG, |
1960 | CX2_RESET_REG_MASTER_DISABLED | CX2_RESET_REG_STOP_MASTER); | 1980 | CX2_RESET_REG_MASTER_DISABLED | CX2_RESET_REG_STOP_MASTER); |
1961 | 1981 | ||
1962 | IPW_DEBUG_FW("<< dmaWaitSync \n"); | 1982 | IPW_DEBUG_FW("<< dmaWaitSync \n"); |
@@ -2011,8 +2031,7 @@ static inline int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask, | |||
2011 | * image and the caller is handling the memory allocation and clean up. | 2031 | * image and the caller is handling the memory allocation and clean up. |
2012 | */ | 2032 | */ |
2013 | 2033 | ||
2014 | 2034 | static int ipw_stop_master(struct ipw_priv *priv) | |
2015 | static int ipw_stop_master(struct ipw_priv * priv) | ||
2016 | { | 2035 | { |
2017 | int rc; | 2036 | int rc; |
2018 | 2037 | ||
@@ -2071,14 +2090,13 @@ struct fw_chunk { | |||
2071 | #define IPW_FW_NAME(x) "ipw2200_" x ".fw" | 2090 | #define IPW_FW_NAME(x) "ipw2200_" x ".fw" |
2072 | #endif | 2091 | #endif |
2073 | 2092 | ||
2074 | static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, | 2093 | static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) |
2075 | size_t len) | ||
2076 | { | 2094 | { |
2077 | int rc = 0, i, addr; | 2095 | int rc = 0, i, addr; |
2078 | u8 cr = 0; | 2096 | u8 cr = 0; |
2079 | u16 *image; | 2097 | u16 *image; |
2080 | 2098 | ||
2081 | image = (u16 *)data; | 2099 | image = (u16 *) data; |
2082 | 2100 | ||
2083 | IPW_DEBUG_TRACE(">> \n"); | 2101 | IPW_DEBUG_TRACE(">> \n"); |
2084 | 2102 | ||
@@ -2087,7 +2105,7 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, | |||
2087 | if (rc < 0) | 2105 | if (rc < 0) |
2088 | return rc; | 2106 | return rc; |
2089 | 2107 | ||
2090 | // spin_lock_irqsave(&priv->lock, flags); | 2108 | // spin_lock_irqsave(&priv->lock, flags); |
2091 | 2109 | ||
2092 | for (addr = CX2_SHARED_LOWER_BOUND; | 2110 | for (addr = CX2_SHARED_LOWER_BOUND; |
2093 | addr < CX2_REGISTER_DOMAIN1_END; addr += 4) { | 2111 | addr < CX2_REGISTER_DOMAIN1_END; addr += 4) { |
@@ -2099,7 +2117,7 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, | |||
2099 | /* destroy DMA queues */ | 2117 | /* destroy DMA queues */ |
2100 | /* reset sequence */ | 2118 | /* reset sequence */ |
2101 | 2119 | ||
2102 | ipw_write_reg32(priv, CX2_MEM_HALT_AND_RESET ,CX2_BIT_HALT_RESET_ON); | 2120 | ipw_write_reg32(priv, CX2_MEM_HALT_AND_RESET, CX2_BIT_HALT_RESET_ON); |
2103 | ipw_arc_release(priv); | 2121 | ipw_arc_release(priv); |
2104 | ipw_write_reg32(priv, CX2_MEM_HALT_AND_RESET, CX2_BIT_HALT_RESET_OFF); | 2122 | ipw_write_reg32(priv, CX2_MEM_HALT_AND_RESET, CX2_BIT_HALT_RESET_OFF); |
2105 | mdelay(1); | 2123 | mdelay(1); |
@@ -2128,13 +2146,11 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, | |||
2128 | for (i = 0; i < len / 2; i++) | 2146 | for (i = 0; i < len / 2; i++) |
2129 | ipw_write_reg16(priv, CX2_BASEBAND_CONTROL_STORE, image[i]); | 2147 | ipw_write_reg16(priv, CX2_BASEBAND_CONTROL_STORE, image[i]); |
2130 | 2148 | ||
2131 | |||
2132 | /* enable DINO */ | 2149 | /* enable DINO */ |
2133 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); | 2150 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); |
2134 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, | 2151 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, DINO_ENABLE_SYSTEM); |
2135 | DINO_ENABLE_SYSTEM ); | ||
2136 | 2152 | ||
2137 | /* this is where the igx / win driver deveates from the VAP driver.*/ | 2153 | /* this is where the igx / win driver deveates from the VAP driver. */ |
2138 | 2154 | ||
2139 | /* wait for alive response */ | 2155 | /* wait for alive response */ |
2140 | for (i = 0; i < 100; i++) { | 2156 | for (i = 0; i < 100; i++) { |
@@ -2151,25 +2167,24 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, | |||
2151 | 2167 | ||
2152 | for (i = 0; i < ARRAY_SIZE(response_buffer); i++) | 2168 | for (i = 0; i < ARRAY_SIZE(response_buffer); i++) |
2153 | response_buffer[i] = | 2169 | response_buffer[i] = |
2154 | ipw_read_reg32(priv, | 2170 | ipw_read_reg32(priv, CX2_BASEBAND_RX_FIFO_READ); |
2155 | CX2_BASEBAND_RX_FIFO_READ); | ||
2156 | memcpy(&priv->dino_alive, response_buffer, | 2171 | memcpy(&priv->dino_alive, response_buffer, |
2157 | sizeof(priv->dino_alive)); | 2172 | sizeof(priv->dino_alive)); |
2158 | if (priv->dino_alive.alive_command == 1 | 2173 | if (priv->dino_alive.alive_command == 1 |
2159 | && priv->dino_alive.ucode_valid == 1) { | 2174 | && priv->dino_alive.ucode_valid == 1) { |
2160 | rc = 0; | 2175 | rc = 0; |
2161 | IPW_DEBUG_INFO( | 2176 | IPW_DEBUG_INFO |
2162 | "Microcode OK, rev. %d (0x%x) dev. %d (0x%x) " | 2177 | ("Microcode OK, rev. %d (0x%x) dev. %d (0x%x) " |
2163 | "of %02d/%02d/%02d %02d:%02d\n", | 2178 | "of %02d/%02d/%02d %02d:%02d\n", |
2164 | priv->dino_alive.software_revision, | 2179 | priv->dino_alive.software_revision, |
2165 | priv->dino_alive.software_revision, | 2180 | priv->dino_alive.software_revision, |
2166 | priv->dino_alive.device_identifier, | 2181 | priv->dino_alive.device_identifier, |
2167 | priv->dino_alive.device_identifier, | 2182 | priv->dino_alive.device_identifier, |
2168 | priv->dino_alive.time_stamp[0], | 2183 | priv->dino_alive.time_stamp[0], |
2169 | priv->dino_alive.time_stamp[1], | 2184 | priv->dino_alive.time_stamp[1], |
2170 | priv->dino_alive.time_stamp[2], | 2185 | priv->dino_alive.time_stamp[2], |
2171 | priv->dino_alive.time_stamp[3], | 2186 | priv->dino_alive.time_stamp[3], |
2172 | priv->dino_alive.time_stamp[4]); | 2187 | priv->dino_alive.time_stamp[4]); |
2173 | } else { | 2188 | } else { |
2174 | IPW_DEBUG_INFO("Microcode is not alive\n"); | 2189 | IPW_DEBUG_INFO("Microcode is not alive\n"); |
2175 | rc = -EINVAL; | 2190 | rc = -EINVAL; |
@@ -2183,13 +2198,12 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, | |||
2183 | firmware have problem getting alive resp. */ | 2198 | firmware have problem getting alive resp. */ |
2184 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); | 2199 | ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); |
2185 | 2200 | ||
2186 | // spin_unlock_irqrestore(&priv->lock, flags); | 2201 | // spin_unlock_irqrestore(&priv->lock, flags); |
2187 | 2202 | ||
2188 | return rc; | 2203 | return rc; |
2189 | } | 2204 | } |
2190 | 2205 | ||
2191 | static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, | 2206 | static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len) |
2192 | size_t len) | ||
2193 | { | 2207 | { |
2194 | int rc = -1; | 2208 | int rc = -1; |
2195 | int offset = 0; | 2209 | int offset = 0; |
@@ -2231,7 +2245,7 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, | |||
2231 | offset += chunk->length; | 2245 | offset += chunk->length; |
2232 | } while (offset < len); | 2246 | } while (offset < len); |
2233 | 2247 | ||
2234 | /* Run the DMA and wait for the answer*/ | 2248 | /* Run the DMA and wait for the answer */ |
2235 | rc = ipw_fw_dma_kick(priv); | 2249 | rc = ipw_fw_dma_kick(priv); |
2236 | if (rc) { | 2250 | if (rc) { |
2237 | IPW_ERROR("dmaKick Failed\n"); | 2251 | IPW_ERROR("dmaKick Failed\n"); |
@@ -2243,8 +2257,8 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, | |||
2243 | IPW_ERROR("dmaWaitSync Failed\n"); | 2257 | IPW_ERROR("dmaWaitSync Failed\n"); |
2244 | goto out; | 2258 | goto out; |
2245 | } | 2259 | } |
2246 | out: | 2260 | out: |
2247 | pci_free_consistent( priv->pci_dev, len, shared_virt, shared_phys); | 2261 | pci_free_consistent(priv->pci_dev, len, shared_virt, shared_phys); |
2248 | return rc; | 2262 | return rc; |
2249 | } | 2263 | } |
2250 | 2264 | ||
@@ -2253,7 +2267,7 @@ static int ipw_stop_nic(struct ipw_priv *priv) | |||
2253 | { | 2267 | { |
2254 | int rc = 0; | 2268 | int rc = 0; |
2255 | 2269 | ||
2256 | /* stop*/ | 2270 | /* stop */ |
2257 | ipw_write32(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER); | 2271 | ipw_write32(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER); |
2258 | 2272 | ||
2259 | rc = ipw_poll_bit(priv, CX2_RESET_REG, | 2273 | rc = ipw_poll_bit(priv, CX2_RESET_REG, |
@@ -2272,14 +2286,15 @@ static void ipw_start_nic(struct ipw_priv *priv) | |||
2272 | { | 2286 | { |
2273 | IPW_DEBUG_TRACE(">>\n"); | 2287 | IPW_DEBUG_TRACE(">>\n"); |
2274 | 2288 | ||
2275 | /* prvHwStartNic release ARC*/ | 2289 | /* prvHwStartNic release ARC */ |
2276 | ipw_clear_bit(priv, CX2_RESET_REG, | 2290 | ipw_clear_bit(priv, CX2_RESET_REG, |
2277 | CX2_RESET_REG_MASTER_DISABLED | | 2291 | CX2_RESET_REG_MASTER_DISABLED | |
2278 | CX2_RESET_REG_STOP_MASTER | | 2292 | CX2_RESET_REG_STOP_MASTER | |
2279 | CBD_RESET_REG_PRINCETON_RESET); | 2293 | CBD_RESET_REG_PRINCETON_RESET); |
2280 | 2294 | ||
2281 | /* enable power management */ | 2295 | /* enable power management */ |
2282 | ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); | 2296 | ipw_set_bit(priv, CX2_GP_CNTRL_RW, |
2297 | CX2_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); | ||
2283 | 2298 | ||
2284 | IPW_DEBUG_TRACE("<<\n"); | 2299 | IPW_DEBUG_TRACE("<<\n"); |
2285 | } | 2300 | } |
@@ -2295,12 +2310,13 @@ static int ipw_init_nic(struct ipw_priv *priv) | |||
2295 | ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_INIT_DONE); | 2310 | ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_INIT_DONE); |
2296 | 2311 | ||
2297 | /* low-level PLL activation */ | 2312 | /* low-level PLL activation */ |
2298 | ipw_write32(priv, CX2_READ_INT_REGISTER, CX2_BIT_INT_HOST_SRAM_READ_INT_REGISTER); | 2313 | ipw_write32(priv, CX2_READ_INT_REGISTER, |
2314 | CX2_BIT_INT_HOST_SRAM_READ_INT_REGISTER); | ||
2299 | 2315 | ||
2300 | /* wait for clock stabilization */ | 2316 | /* wait for clock stabilization */ |
2301 | rc = ipw_poll_bit(priv, CX2_GP_CNTRL_RW, | 2317 | rc = ipw_poll_bit(priv, CX2_GP_CNTRL_RW, |
2302 | CX2_GP_CNTRL_BIT_CLOCK_READY, 250); | 2318 | CX2_GP_CNTRL_BIT_CLOCK_READY, 250); |
2303 | if (rc < 0 ) | 2319 | if (rc < 0) |
2304 | IPW_DEBUG_INFO("FAILED wait for clock stablization\n"); | 2320 | IPW_DEBUG_INFO("FAILED wait for clock stablization\n"); |
2305 | 2321 | ||
2306 | /* assert SW reset */ | 2322 | /* assert SW reset */ |
@@ -2315,7 +2331,6 @@ static int ipw_init_nic(struct ipw_priv *priv) | |||
2315 | return 0; | 2331 | return 0; |
2316 | } | 2332 | } |
2317 | 2333 | ||
2318 | |||
2319 | /* Call this function from process context, it will sleep in request_firmware. | 2334 | /* Call this function from process context, it will sleep in request_firmware. |
2320 | * Probe is an ok place to call this from. | 2335 | * Probe is an ok place to call this from. |
2321 | */ | 2336 | */ |
@@ -2383,8 +2398,7 @@ static inline void ipw_rx_queue_reset(struct ipw_priv *priv, | |||
2383 | * to an SKB, so we need to unmap and free potential storage */ | 2398 | * to an SKB, so we need to unmap and free potential storage */ |
2384 | if (rxq->pool[i].skb != NULL) { | 2399 | if (rxq->pool[i].skb != NULL) { |
2385 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, | 2400 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, |
2386 | CX2_RX_BUF_SIZE, | 2401 | CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
2387 | PCI_DMA_FROMDEVICE); | ||
2388 | dev_kfree_skb(rxq->pool[i].skb); | 2402 | dev_kfree_skb(rxq->pool[i].skb); |
2389 | } | 2403 | } |
2390 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 2404 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
@@ -2438,12 +2452,12 @@ static int ipw_load(struct ipw_priv *priv) | |||
2438 | if (rc) | 2452 | if (rc) |
2439 | goto error; | 2453 | goto error; |
2440 | 2454 | ||
2441 | rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("sniffer")); | 2455 | rc = ipw_get_fw(priv, &firmware, |
2456 | IPW_FW_NAME("sniffer")); | ||
2442 | break; | 2457 | break; |
2443 | #endif | 2458 | #endif |
2444 | case IW_MODE_INFRA: | 2459 | case IW_MODE_INFRA: |
2445 | rc = ipw_get_fw(priv, &ucode, | 2460 | rc = ipw_get_fw(priv, &ucode, IPW_FW_NAME("bss_ucode")); |
2446 | IPW_FW_NAME("bss_ucode")); | ||
2447 | if (rc) | 2461 | if (rc) |
2448 | goto error; | 2462 | goto error; |
2449 | 2463 | ||
@@ -2471,7 +2485,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
2471 | goto error; | 2485 | goto error; |
2472 | } | 2486 | } |
2473 | 2487 | ||
2474 | retry: | 2488 | retry: |
2475 | /* Ensure interrupts are disabled */ | 2489 | /* Ensure interrupts are disabled */ |
2476 | ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); | 2490 | ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); |
2477 | priv->status &= ~STATUS_INT_ENABLED; | 2491 | priv->status &= ~STATUS_INT_ENABLED; |
@@ -2528,7 +2542,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
2528 | rc = ipw_load_firmware(priv, firmware->data + | 2542 | rc = ipw_load_firmware(priv, firmware->data + |
2529 | sizeof(struct fw_header), | 2543 | sizeof(struct fw_header), |
2530 | firmware->size - sizeof(struct fw_header)); | 2544 | firmware->size - sizeof(struct fw_header)); |
2531 | if (rc < 0 ) { | 2545 | if (rc < 0) { |
2532 | IPW_ERROR("Unable to load firmware\n"); | 2546 | IPW_ERROR("Unable to load firmware\n"); |
2533 | goto error; | 2547 | goto error; |
2534 | } | 2548 | } |
@@ -2593,7 +2607,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
2593 | #endif | 2607 | #endif |
2594 | return 0; | 2608 | return 0; |
2595 | 2609 | ||
2596 | error: | 2610 | error: |
2597 | if (priv->rxq) { | 2611 | if (priv->rxq) { |
2598 | ipw_rx_queue_free(priv, priv->rxq); | 2612 | ipw_rx_queue_free(priv, priv->rxq); |
2599 | priv->rxq = NULL; | 2613 | priv->rxq = NULL; |
@@ -2671,8 +2685,7 @@ static inline int ipw_queue_inc_wrap(int index, int n_bd) | |||
2671 | * (not offset within BAR, full address) | 2685 | * (not offset within BAR, full address) |
2672 | */ | 2686 | */ |
2673 | static void ipw_queue_init(struct ipw_priv *priv, struct clx2_queue *q, | 2687 | static void ipw_queue_init(struct ipw_priv *priv, struct clx2_queue *q, |
2674 | int count, u32 read, u32 write, | 2688 | int count, u32 read, u32 write, u32 base, u32 size) |
2675 | u32 base, u32 size) | ||
2676 | { | 2689 | { |
2677 | q->n_bd = count; | 2690 | q->n_bd = count; |
2678 | 2691 | ||
@@ -2698,8 +2711,7 @@ static void ipw_queue_init(struct ipw_priv *priv, struct clx2_queue *q, | |||
2698 | 2711 | ||
2699 | static int ipw_queue_tx_init(struct ipw_priv *priv, | 2712 | static int ipw_queue_tx_init(struct ipw_priv *priv, |
2700 | struct clx2_tx_queue *q, | 2713 | struct clx2_tx_queue *q, |
2701 | int count, u32 read, u32 write, | 2714 | int count, u32 read, u32 write, u32 base, u32 size) |
2702 | u32 base, u32 size) | ||
2703 | { | 2715 | { |
2704 | struct pci_dev *dev = priv->pci_dev; | 2716 | struct pci_dev *dev = priv->pci_dev; |
2705 | 2717 | ||
@@ -2709,10 +2721,11 @@ static int ipw_queue_tx_init(struct ipw_priv *priv, | |||
2709 | return -ENOMEM; | 2721 | return -ENOMEM; |
2710 | } | 2722 | } |
2711 | 2723 | ||
2712 | q->bd = pci_alloc_consistent(dev,sizeof(q->bd[0])*count, &q->q.dma_addr); | 2724 | q->bd = |
2725 | pci_alloc_consistent(dev, sizeof(q->bd[0]) * count, &q->q.dma_addr); | ||
2713 | if (!q->bd) { | 2726 | if (!q->bd) { |
2714 | IPW_ERROR("pci_alloc_consistent(%zd) failed\n", | 2727 | IPW_ERROR("pci_alloc_consistent(%zd) failed\n", |
2715 | sizeof(q->bd[0]) * count); | 2728 | sizeof(q->bd[0]) * count); |
2716 | kfree(q->txb); | 2729 | kfree(q->txb); |
2717 | q->txb = NULL; | 2730 | q->txb = NULL; |
2718 | return -ENOMEM; | 2731 | return -ENOMEM; |
@@ -2768,8 +2781,7 @@ static void ipw_queue_tx_free_tfd(struct ipw_priv *priv, | |||
2768 | * @param dev | 2781 | * @param dev |
2769 | * @param q | 2782 | * @param q |
2770 | */ | 2783 | */ |
2771 | static void ipw_queue_tx_free(struct ipw_priv *priv, | 2784 | static void ipw_queue_tx_free(struct ipw_priv *priv, struct clx2_tx_queue *txq) |
2772 | struct clx2_tx_queue *txq) | ||
2773 | { | 2785 | { |
2774 | struct clx2_queue *q = &txq->q; | 2786 | struct clx2_queue *q = &txq->q; |
2775 | struct pci_dev *dev = priv->pci_dev; | 2787 | struct pci_dev *dev = priv->pci_dev; |
@@ -2784,7 +2796,7 @@ static void ipw_queue_tx_free(struct ipw_priv *priv, | |||
2784 | } | 2796 | } |
2785 | 2797 | ||
2786 | /* free buffers belonging to queue itself */ | 2798 | /* free buffers belonging to queue itself */ |
2787 | pci_free_consistent(dev, sizeof(txq->bd[0])*q->n_bd, txq->bd, | 2799 | pci_free_consistent(dev, sizeof(txq->bd[0]) * q->n_bd, txq->bd, |
2788 | q->dma_addr); | 2800 | q->dma_addr); |
2789 | kfree(txq->txb); | 2801 | kfree(txq->txb); |
2790 | 2802 | ||
@@ -2792,7 +2804,6 @@ static void ipw_queue_tx_free(struct ipw_priv *priv, | |||
2792 | memset(txq, 0, sizeof(*txq)); | 2804 | memset(txq, 0, sizeof(*txq)); |
2793 | } | 2805 | } |
2794 | 2806 | ||
2795 | |||
2796 | /** | 2807 | /** |
2797 | * Destroy all DMA queues and structures | 2808 | * Destroy all DMA queues and structures |
2798 | * | 2809 | * |
@@ -2825,7 +2836,7 @@ static void inline __maybe_wake_tx(struct ipw_priv *priv) | |||
2825 | 2836 | ||
2826 | } | 2837 | } |
2827 | 2838 | ||
2828 | static inline void ipw_create_bssid(struct ipw_priv *priv, u8 *bssid) | 2839 | static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid) |
2829 | { | 2840 | { |
2830 | /* First 3 bytes are manufacturer */ | 2841 | /* First 3 bytes are manufacturer */ |
2831 | bssid[0] = priv->mac_addr[0]; | 2842 | bssid[0] = priv->mac_addr[0]; |
@@ -2833,13 +2844,13 @@ static inline void ipw_create_bssid(struct ipw_priv *priv, u8 *bssid) | |||
2833 | bssid[2] = priv->mac_addr[2]; | 2844 | bssid[2] = priv->mac_addr[2]; |
2834 | 2845 | ||
2835 | /* Last bytes are random */ | 2846 | /* Last bytes are random */ |
2836 | get_random_bytes(&bssid[3], ETH_ALEN-3); | 2847 | get_random_bytes(&bssid[3], ETH_ALEN - 3); |
2837 | 2848 | ||
2838 | bssid[0] &= 0xfe; /* clear multicast bit */ | 2849 | bssid[0] &= 0xfe; /* clear multicast bit */ |
2839 | bssid[0] |= 0x02; /* set local assignment bit (IEEE802) */ | 2850 | bssid[0] |= 0x02; /* set local assignment bit (IEEE802) */ |
2840 | } | 2851 | } |
2841 | 2852 | ||
2842 | static inline u8 ipw_add_station(struct ipw_priv *priv, u8 *bssid) | 2853 | static inline u8 ipw_add_station(struct ipw_priv *priv, u8 * bssid) |
2843 | { | 2854 | { |
2844 | struct ipw_station_entry entry; | 2855 | struct ipw_station_entry entry; |
2845 | int i; | 2856 | int i; |
@@ -2866,14 +2877,13 @@ static inline u8 ipw_add_station(struct ipw_priv *priv, u8 *bssid) | |||
2866 | memcpy(entry.mac_addr, bssid, ETH_ALEN); | 2877 | memcpy(entry.mac_addr, bssid, ETH_ALEN); |
2867 | memcpy(priv->stations[i], bssid, ETH_ALEN); | 2878 | memcpy(priv->stations[i], bssid, ETH_ALEN); |
2868 | ipw_write_direct(priv, IPW_STATION_TABLE_LOWER + i * sizeof(entry), | 2879 | ipw_write_direct(priv, IPW_STATION_TABLE_LOWER + i * sizeof(entry), |
2869 | &entry, | 2880 | &entry, sizeof(entry)); |
2870 | sizeof(entry)); | ||
2871 | priv->num_stations++; | 2881 | priv->num_stations++; |
2872 | 2882 | ||
2873 | return i; | 2883 | return i; |
2874 | } | 2884 | } |
2875 | 2885 | ||
2876 | static inline u8 ipw_find_station(struct ipw_priv *priv, u8 *bssid) | 2886 | static inline u8 ipw_find_station(struct ipw_priv *priv, u8 * bssid) |
2877 | { | 2887 | { |
2878 | int i; | 2888 | int i; |
2879 | 2889 | ||
@@ -2944,26 +2954,34 @@ static const struct ipw_status_code ipw_status_codes[] = { | |||
2944 | "association exists"}, | 2954 | "association exists"}, |
2945 | {0x0C, "Association denied due to reason outside the scope of this " | 2955 | {0x0C, "Association denied due to reason outside the scope of this " |
2946 | "standard"}, | 2956 | "standard"}, |
2947 | {0x0D, "Responding station does not support the specified authentication " | 2957 | {0x0D, |
2958 | "Responding station does not support the specified authentication " | ||
2948 | "algorithm"}, | 2959 | "algorithm"}, |
2949 | {0x0E, "Received an Authentication frame with authentication sequence " | 2960 | {0x0E, |
2961 | "Received an Authentication frame with authentication sequence " | ||
2950 | "transaction sequence number out of expected sequence"}, | 2962 | "transaction sequence number out of expected sequence"}, |
2951 | {0x0F, "Authentication rejected because of challenge failure"}, | 2963 | {0x0F, "Authentication rejected because of challenge failure"}, |
2952 | {0x10, "Authentication rejected due to timeout waiting for next " | 2964 | {0x10, "Authentication rejected due to timeout waiting for next " |
2953 | "frame in sequence"}, | 2965 | "frame in sequence"}, |
2954 | {0x11, "Association denied because AP is unable to handle additional " | 2966 | {0x11, "Association denied because AP is unable to handle additional " |
2955 | "associated stations"}, | 2967 | "associated stations"}, |
2956 | {0x12, "Association denied due to requesting station not supporting all " | 2968 | {0x12, |
2969 | "Association denied due to requesting station not supporting all " | ||
2957 | "of the datarates in the BSSBasicServiceSet Parameter"}, | 2970 | "of the datarates in the BSSBasicServiceSet Parameter"}, |
2958 | {0x13, "Association denied due to requesting station not supporting " | 2971 | {0x13, |
2972 | "Association denied due to requesting station not supporting " | ||
2959 | "short preamble operation"}, | 2973 | "short preamble operation"}, |
2960 | {0x14, "Association denied due to requesting station not supporting " | 2974 | {0x14, |
2975 | "Association denied due to requesting station not supporting " | ||
2961 | "PBCC encoding"}, | 2976 | "PBCC encoding"}, |
2962 | {0x15, "Association denied due to requesting station not supporting " | 2977 | {0x15, |
2978 | "Association denied due to requesting station not supporting " | ||
2963 | "channel agility"}, | 2979 | "channel agility"}, |
2964 | {0x19, "Association denied due to requesting station not supporting " | 2980 | {0x19, |
2981 | "Association denied due to requesting station not supporting " | ||
2965 | "short slot operation"}, | 2982 | "short slot operation"}, |
2966 | {0x1A, "Association denied due to requesting station not supporting " | 2983 | {0x1A, |
2984 | "Association denied due to requesting station not supporting " | ||
2967 | "DSSS-OFDM operation"}, | 2985 | "DSSS-OFDM operation"}, |
2968 | {0x28, "Invalid Information Element"}, | 2986 | {0x28, "Invalid Information Element"}, |
2969 | {0x29, "Group Cipher is not valid"}, | 2987 | {0x29, "Group Cipher is not valid"}, |
@@ -3043,7 +3061,6 @@ static void ipw_reset_stats(struct ipw_priv *priv) | |||
3043 | 3061 | ||
3044 | } | 3062 | } |
3045 | 3063 | ||
3046 | |||
3047 | static inline u32 ipw_get_max_rate(struct ipw_priv *priv) | 3064 | static inline u32 ipw_get_max_rate(struct ipw_priv *priv) |
3048 | { | 3065 | { |
3049 | u32 i = 0x80000000; | 3066 | u32 i = 0x80000000; |
@@ -3056,20 +3073,21 @@ static inline u32 ipw_get_max_rate(struct ipw_priv *priv) | |||
3056 | /* TODO: Verify that the rate is supported by the current rates | 3073 | /* TODO: Verify that the rate is supported by the current rates |
3057 | * list. */ | 3074 | * list. */ |
3058 | 3075 | ||
3059 | while (i && !(mask & i)) i >>= 1; | 3076 | while (i && !(mask & i)) |
3077 | i >>= 1; | ||
3060 | switch (i) { | 3078 | switch (i) { |
3061 | case IEEE80211_CCK_RATE_1MB_MASK: return 1000000; | 3079 | case IEEE80211_CCK_RATE_1MB_MASK: return 1000000; |
3062 | case IEEE80211_CCK_RATE_2MB_MASK: return 2000000; | 3080 | case IEEE80211_CCK_RATE_2MB_MASK: return 2000000; |
3063 | case IEEE80211_CCK_RATE_5MB_MASK: return 5500000; | 3081 | case IEEE80211_CCK_RATE_5MB_MASK: return 5500000; |
3064 | case IEEE80211_OFDM_RATE_6MB_MASK: return 6000000; | 3082 | case IEEE80211_OFDM_RATE_6MB_MASK: return 6000000; |
3065 | case IEEE80211_OFDM_RATE_9MB_MASK: return 9000000; | 3083 | case IEEE80211_OFDM_RATE_9MB_MASK: return 9000000; |
3066 | case IEEE80211_CCK_RATE_11MB_MASK: return 11000000; | 3084 | case IEEE80211_CCK_RATE_11MB_MASK: return 11000000; |
3067 | case IEEE80211_OFDM_RATE_12MB_MASK: return 12000000; | 3085 | case IEEE80211_OFDM_RATE_12MB_MASK: return 12000000; |
3068 | case IEEE80211_OFDM_RATE_18MB_MASK: return 18000000; | 3086 | case IEEE80211_OFDM_RATE_18MB_MASK: return 18000000; |
3069 | case IEEE80211_OFDM_RATE_24MB_MASK: return 24000000; | 3087 | case IEEE80211_OFDM_RATE_24MB_MASK: return 24000000; |
3070 | case IEEE80211_OFDM_RATE_36MB_MASK: return 36000000; | 3088 | case IEEE80211_OFDM_RATE_36MB_MASK: return 36000000; |
3071 | case IEEE80211_OFDM_RATE_48MB_MASK: return 48000000; | 3089 | case IEEE80211_OFDM_RATE_48MB_MASK: return 48000000; |
3072 | case IEEE80211_OFDM_RATE_54MB_MASK: return 54000000; | 3090 | case IEEE80211_OFDM_RATE_54MB_MASK: return 54000000; |
3073 | } | 3091 | } |
3074 | 3092 | ||
3075 | if (priv->ieee->mode == IEEE_B) | 3093 | if (priv->ieee->mode == IEEE_B) |
@@ -3097,18 +3115,18 @@ static u32 ipw_get_current_rate(struct ipw_priv *priv) | |||
3097 | return ipw_get_max_rate(priv); | 3115 | return ipw_get_max_rate(priv); |
3098 | 3116 | ||
3099 | switch (rate) { | 3117 | switch (rate) { |
3100 | case IPW_TX_RATE_1MB: return 1000000; | 3118 | case IPW_TX_RATE_1MB: return 1000000; |
3101 | case IPW_TX_RATE_2MB: return 2000000; | 3119 | case IPW_TX_RATE_2MB: return 2000000; |
3102 | case IPW_TX_RATE_5MB: return 5500000; | 3120 | case IPW_TX_RATE_5MB: return 5500000; |
3103 | case IPW_TX_RATE_6MB: return 6000000; | 3121 | case IPW_TX_RATE_6MB: return 6000000; |
3104 | case IPW_TX_RATE_9MB: return 9000000; | 3122 | case IPW_TX_RATE_9MB: return 9000000; |
3105 | case IPW_TX_RATE_11MB: return 11000000; | 3123 | case IPW_TX_RATE_11MB: return 11000000; |
3106 | case IPW_TX_RATE_12MB: return 12000000; | 3124 | case IPW_TX_RATE_12MB: return 12000000; |
3107 | case IPW_TX_RATE_18MB: return 18000000; | 3125 | case IPW_TX_RATE_18MB: return 18000000; |
3108 | case IPW_TX_RATE_24MB: return 24000000; | 3126 | case IPW_TX_RATE_24MB: return 24000000; |
3109 | case IPW_TX_RATE_36MB: return 36000000; | 3127 | case IPW_TX_RATE_36MB: return 36000000; |
3110 | case IPW_TX_RATE_48MB: return 48000000; | 3128 | case IPW_TX_RATE_48MB: return 48000000; |
3111 | case IPW_TX_RATE_54MB: return 54000000; | 3129 | case IPW_TX_RATE_54MB: return 54000000; |
3112 | } | 3130 | } |
3113 | 3131 | ||
3114 | return 0; | 3132 | return 0; |
@@ -3126,7 +3144,7 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3126 | u32 len = sizeof(u32); | 3144 | u32 len = sizeof(u32); |
3127 | s16 rssi; | 3145 | s16 rssi; |
3128 | u32 beacon_quality, signal_quality, tx_quality, rx_quality, | 3146 | u32 beacon_quality, signal_quality, tx_quality, rx_quality, |
3129 | rate_quality; | 3147 | rate_quality; |
3130 | 3148 | ||
3131 | if (!(priv->status & STATUS_ASSOCIATED)) { | 3149 | if (!(priv->status & STATUS_ASSOCIATED)) { |
3132 | priv->quality = 0; | 3150 | priv->quality = 0; |
@@ -3136,13 +3154,12 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3136 | /* Update the statistics */ | 3154 | /* Update the statistics */ |
3137 | ipw_get_ordinal(priv, IPW_ORD_STAT_MISSED_BEACONS, | 3155 | ipw_get_ordinal(priv, IPW_ORD_STAT_MISSED_BEACONS, |
3138 | &priv->missed_beacons, &len); | 3156 | &priv->missed_beacons, &len); |
3139 | missed_beacons_delta = priv->missed_beacons - | 3157 | missed_beacons_delta = priv->missed_beacons - priv->last_missed_beacons; |
3140 | priv->last_missed_beacons; | ||
3141 | priv->last_missed_beacons = priv->missed_beacons; | 3158 | priv->last_missed_beacons = priv->missed_beacons; |
3142 | if (priv->assoc_request.beacon_interval) { | 3159 | if (priv->assoc_request.beacon_interval) { |
3143 | missed_beacons_percent = missed_beacons_delta * | 3160 | missed_beacons_percent = missed_beacons_delta * |
3144 | (HZ * priv->assoc_request.beacon_interval) / | 3161 | (HZ * priv->assoc_request.beacon_interval) / |
3145 | (IPW_STATS_INTERVAL * 10); | 3162 | (IPW_STATS_INTERVAL * 10); |
3146 | } else { | 3163 | } else { |
3147 | missed_beacons_percent = 0; | 3164 | missed_beacons_percent = 0; |
3148 | } | 3165 | } |
@@ -3179,28 +3196,26 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3179 | beacon_quality = 0; | 3196 | beacon_quality = 0; |
3180 | else | 3197 | else |
3181 | beacon_quality = (beacon_quality - BEACON_THRESHOLD) * 100 / | 3198 | beacon_quality = (beacon_quality - BEACON_THRESHOLD) * 100 / |
3182 | (100 - BEACON_THRESHOLD); | 3199 | (100 - BEACON_THRESHOLD); |
3183 | IPW_DEBUG_STATS("Missed beacon: %3d%% (%d%%)\n", | 3200 | IPW_DEBUG_STATS("Missed beacon: %3d%% (%d%%)\n", |
3184 | beacon_quality, missed_beacons_percent); | 3201 | beacon_quality, missed_beacons_percent); |
3185 | 3202 | ||
3186 | priv->last_rate = ipw_get_current_rate(priv); | 3203 | priv->last_rate = ipw_get_current_rate(priv); |
3187 | rate_quality = priv->last_rate * 40 / priv->last_rate + 60; | 3204 | rate_quality = priv->last_rate * 40 / priv->last_rate + 60; |
3188 | IPW_DEBUG_STATS("Rate quality : %3d%% (%dMbs)\n", | 3205 | IPW_DEBUG_STATS("Rate quality : %3d%% (%dMbs)\n", |
3189 | rate_quality, priv->last_rate / 1000000); | 3206 | rate_quality, priv->last_rate / 1000000); |
3190 | 3207 | ||
3191 | if (rx_packets_delta > 100 && | 3208 | if (rx_packets_delta > 100 && rx_packets_delta + rx_err_delta) |
3192 | rx_packets_delta + rx_err_delta) | ||
3193 | rx_quality = 100 - (rx_err_delta * 100) / | 3209 | rx_quality = 100 - (rx_err_delta * 100) / |
3194 | (rx_packets_delta + rx_err_delta); | 3210 | (rx_packets_delta + rx_err_delta); |
3195 | else | 3211 | else |
3196 | rx_quality = 100; | 3212 | rx_quality = 100; |
3197 | IPW_DEBUG_STATS("Rx quality : %3d%% (%u errors, %u packets)\n", | 3213 | IPW_DEBUG_STATS("Rx quality : %3d%% (%u errors, %u packets)\n", |
3198 | rx_quality, rx_err_delta, rx_packets_delta); | 3214 | rx_quality, rx_err_delta, rx_packets_delta); |
3199 | 3215 | ||
3200 | if (tx_packets_delta > 100 && | 3216 | if (tx_packets_delta > 100 && tx_packets_delta + tx_failures_delta) |
3201 | tx_packets_delta + tx_failures_delta) | ||
3202 | tx_quality = 100 - (tx_failures_delta * 100) / | 3217 | tx_quality = 100 - (tx_failures_delta * 100) / |
3203 | (tx_packets_delta + tx_failures_delta); | 3218 | (tx_packets_delta + tx_failures_delta); |
3204 | else | 3219 | else |
3205 | tx_quality = 100; | 3220 | tx_quality = 100; |
3206 | IPW_DEBUG_STATS("Tx quality : %3d%% (%u errors, %u packets)\n", | 3221 | IPW_DEBUG_STATS("Tx quality : %3d%% (%u errors, %u packets)\n", |
@@ -3213,7 +3228,7 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3213 | signal_quality = 0; | 3228 | signal_quality = 0; |
3214 | else | 3229 | else |
3215 | signal_quality = (rssi - WORST_RSSI) * 100 / | 3230 | signal_quality = (rssi - WORST_RSSI) * 100 / |
3216 | (PERFECT_RSSI - WORST_RSSI); | 3231 | (PERFECT_RSSI - WORST_RSSI); |
3217 | IPW_DEBUG_STATS("Signal level : %3d%% (%d dBm)\n", | 3232 | IPW_DEBUG_STATS("Signal level : %3d%% (%d dBm)\n", |
3218 | signal_quality, rssi); | 3233 | signal_quality, rssi); |
3219 | 3234 | ||
@@ -3221,25 +3236,20 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3221 | min(rate_quality, | 3236 | min(rate_quality, |
3222 | min(tx_quality, min(rx_quality, signal_quality)))); | 3237 | min(tx_quality, min(rx_quality, signal_quality)))); |
3223 | if (quality == beacon_quality) | 3238 | if (quality == beacon_quality) |
3224 | IPW_DEBUG_STATS( | 3239 | IPW_DEBUG_STATS("Quality (%d%%): Clamped to missed beacons.\n", |
3225 | "Quality (%d%%): Clamped to missed beacons.\n", | 3240 | quality); |
3226 | quality); | ||
3227 | if (quality == rate_quality) | 3241 | if (quality == rate_quality) |
3228 | IPW_DEBUG_STATS( | 3242 | IPW_DEBUG_STATS("Quality (%d%%): Clamped to rate quality.\n", |
3229 | "Quality (%d%%): Clamped to rate quality.\n", | 3243 | quality); |
3230 | quality); | ||
3231 | if (quality == tx_quality) | 3244 | if (quality == tx_quality) |
3232 | IPW_DEBUG_STATS( | 3245 | IPW_DEBUG_STATS("Quality (%d%%): Clamped to Tx quality.\n", |
3233 | "Quality (%d%%): Clamped to Tx quality.\n", | 3246 | quality); |
3234 | quality); | ||
3235 | if (quality == rx_quality) | 3247 | if (quality == rx_quality) |
3236 | IPW_DEBUG_STATS( | 3248 | IPW_DEBUG_STATS("Quality (%d%%): Clamped to Rx quality.\n", |
3237 | "Quality (%d%%): Clamped to Rx quality.\n", | 3249 | quality); |
3238 | quality); | ||
3239 | if (quality == signal_quality) | 3250 | if (quality == signal_quality) |
3240 | IPW_DEBUG_STATS( | 3251 | IPW_DEBUG_STATS("Quality (%d%%): Clamped to signal quality.\n", |
3241 | "Quality (%d%%): Clamped to signal quality.\n", | 3252 | quality); |
3242 | quality); | ||
3243 | 3253 | ||
3244 | priv->quality = quality; | 3254 | priv->quality = quality; |
3245 | 3255 | ||
@@ -3251,402 +3261,454 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
3251 | * Handle host notification packet. | 3261 | * Handle host notification packet. |
3252 | * Called from interrupt routine | 3262 | * Called from interrupt routine |
3253 | */ | 3263 | */ |
3254 | static inline void ipw_rx_notification(struct ipw_priv* priv, | 3264 | static inline void ipw_rx_notification(struct ipw_priv *priv, |
3255 | struct ipw_rx_notification *notif) | 3265 | struct ipw_rx_notification *notif) |
3256 | { | 3266 | { |
3257 | IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", | 3267 | IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", notif->subtype, notif->size); |
3258 | notif->subtype, notif->size); | ||
3259 | 3268 | ||
3260 | switch (notif->subtype) { | 3269 | switch (notif->subtype) { |
3261 | case HOST_NOTIFICATION_STATUS_ASSOCIATED: { | 3270 | case HOST_NOTIFICATION_STATUS_ASSOCIATED:{ |
3262 | struct notif_association *assoc = ¬if->u.assoc; | 3271 | struct notif_association *assoc = ¬if->u.assoc; |
3263 | 3272 | ||
3264 | switch (assoc->state) { | 3273 | switch (assoc->state) { |
3265 | case CMAS_ASSOCIATED: { | 3274 | case CMAS_ASSOCIATED:{ |
3266 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | 3275 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | |
3267 | "associated: '%s' " MAC_FMT " \n", | 3276 | IPW_DL_ASSOC, |
3268 | escape_essid(priv->essid, priv->essid_len), | 3277 | "associated: '%s' " MAC_FMT |
3269 | MAC_ARG(priv->bssid)); | 3278 | " \n", |
3270 | 3279 | escape_essid(priv->essid, | |
3271 | switch (priv->ieee->iw_mode) { | 3280 | priv->essid_len), |
3272 | case IW_MODE_INFRA: | 3281 | MAC_ARG(priv->bssid)); |
3273 | memcpy(priv->ieee->bssid, priv->bssid, | 3282 | |
3274 | ETH_ALEN); | 3283 | switch (priv->ieee->iw_mode) { |
3275 | break; | 3284 | case IW_MODE_INFRA: |
3276 | 3285 | memcpy(priv->ieee->bssid, | |
3277 | case IW_MODE_ADHOC: | 3286 | priv->bssid, ETH_ALEN); |
3278 | memcpy(priv->ieee->bssid, priv->bssid, | 3287 | break; |
3279 | ETH_ALEN); | 3288 | |
3280 | 3289 | case IW_MODE_ADHOC: | |
3281 | /* clear out the station table */ | 3290 | memcpy(priv->ieee->bssid, |
3282 | priv->num_stations = 0; | 3291 | priv->bssid, ETH_ALEN); |
3283 | 3292 | ||
3284 | IPW_DEBUG_ASSOC("queueing adhoc check\n"); | 3293 | /* clear out the station table */ |
3285 | queue_delayed_work(priv->workqueue, | 3294 | priv->num_stations = 0; |
3286 | &priv->adhoc_check, | 3295 | |
3287 | priv->assoc_request.beacon_interval); | 3296 | IPW_DEBUG_ASSOC |
3288 | break; | 3297 | ("queueing adhoc check\n"); |
3289 | } | 3298 | queue_delayed_work(priv-> |
3290 | 3299 | workqueue, | |
3291 | priv->status &= ~STATUS_ASSOCIATING; | 3300 | &priv-> |
3292 | priv->status |= STATUS_ASSOCIATED; | 3301 | adhoc_check, |
3293 | 3302 | priv-> | |
3294 | netif_carrier_on(priv->net_dev); | 3303 | assoc_request. |
3295 | if (netif_queue_stopped(priv->net_dev)) { | 3304 | beacon_interval); |
3296 | IPW_DEBUG_NOTIF("waking queue\n"); | 3305 | break; |
3297 | netif_wake_queue(priv->net_dev); | 3306 | } |
3298 | } else { | 3307 | |
3299 | IPW_DEBUG_NOTIF("starting queue\n"); | 3308 | priv->status &= ~STATUS_ASSOCIATING; |
3300 | netif_start_queue(priv->net_dev); | 3309 | priv->status |= STATUS_ASSOCIATED; |
3301 | } | 3310 | |
3302 | 3311 | netif_carrier_on(priv->net_dev); | |
3303 | ipw_reset_stats(priv); | 3312 | if (netif_queue_stopped(priv->net_dev)) { |
3304 | /* Ensure the rate is updated immediately */ | 3313 | IPW_DEBUG_NOTIF |
3305 | priv->last_rate = ipw_get_current_rate(priv); | 3314 | ("waking queue\n"); |
3306 | schedule_work(&priv->gather_stats); | 3315 | netif_wake_queue(priv->net_dev); |
3307 | notify_wx_assoc_event(priv); | 3316 | } else { |
3317 | IPW_DEBUG_NOTIF | ||
3318 | ("starting queue\n"); | ||
3319 | netif_start_queue(priv-> | ||
3320 | net_dev); | ||
3321 | } | ||
3322 | |||
3323 | ipw_reset_stats(priv); | ||
3324 | /* Ensure the rate is updated immediately */ | ||
3325 | priv->last_rate = | ||
3326 | ipw_get_current_rate(priv); | ||
3327 | schedule_work(&priv->gather_stats); | ||
3328 | notify_wx_assoc_event(priv); | ||
3308 | 3329 | ||
3309 | /* queue_delayed_work(priv->workqueue, | 3330 | /* queue_delayed_work(priv->workqueue, |
3310 | &priv->request_scan, | 3331 | &priv->request_scan, |
3311 | SCAN_ASSOCIATED_INTERVAL); | 3332 | SCAN_ASSOCIATED_INTERVAL); |
3312 | */ | 3333 | */ |
3313 | break; | 3334 | break; |
3314 | } | 3335 | } |
3315 | 3336 | ||
3316 | case CMAS_AUTHENTICATED: { | 3337 | case CMAS_AUTHENTICATED:{ |
3317 | if (priv->status & (STATUS_ASSOCIATED | STATUS_AUTH)) { | 3338 | if (priv-> |
3339 | status & (STATUS_ASSOCIATED | | ||
3340 | STATUS_AUTH)) { | ||
3318 | #ifdef CONFIG_IPW_DEBUG | 3341 | #ifdef CONFIG_IPW_DEBUG |
3319 | struct notif_authenticate *auth = ¬if->u.auth; | 3342 | struct notif_authenticate *auth |
3320 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | 3343 | = ¬if->u.auth; |
3321 | "deauthenticated: '%s' " MAC_FMT ": (0x%04X) - %s \n", | 3344 | IPW_DEBUG(IPW_DL_NOTIF | |
3322 | escape_essid(priv->essid, priv->essid_len), | 3345 | IPW_DL_STATE | |
3323 | MAC_ARG(priv->bssid), | 3346 | IPW_DL_ASSOC, |
3324 | ntohs(auth->status), | 3347 | "deauthenticated: '%s' " |
3325 | ipw_get_status_code(ntohs(auth->status))); | 3348 | MAC_FMT |
3349 | ": (0x%04X) - %s \n", | ||
3350 | escape_essid(priv-> | ||
3351 | essid, | ||
3352 | priv-> | ||
3353 | essid_len), | ||
3354 | MAC_ARG(priv->bssid), | ||
3355 | ntohs(auth->status), | ||
3356 | ipw_get_status_code | ||
3357 | (ntohs | ||
3358 | (auth->status))); | ||
3326 | #endif | 3359 | #endif |
3327 | 3360 | ||
3328 | priv->status &= ~(STATUS_ASSOCIATING | | 3361 | priv->status &= |
3329 | STATUS_AUTH | | 3362 | ~(STATUS_ASSOCIATING | |
3330 | STATUS_ASSOCIATED); | 3363 | STATUS_AUTH | |
3364 | STATUS_ASSOCIATED); | ||
3365 | |||
3366 | netif_carrier_off(priv-> | ||
3367 | net_dev); | ||
3368 | netif_stop_queue(priv->net_dev); | ||
3369 | queue_work(priv->workqueue, | ||
3370 | &priv->request_scan); | ||
3371 | notify_wx_assoc_event(priv); | ||
3372 | break; | ||
3373 | } | ||
3374 | |||
3375 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3376 | IPW_DL_ASSOC, | ||
3377 | "authenticated: '%s' " MAC_FMT | ||
3378 | "\n", | ||
3379 | escape_essid(priv->essid, | ||
3380 | priv->essid_len), | ||
3381 | MAC_ARG(priv->bssid)); | ||
3382 | break; | ||
3383 | } | ||
3384 | |||
3385 | case CMAS_INIT:{ | ||
3386 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3387 | IPW_DL_ASSOC, | ||
3388 | "disassociated: '%s' " MAC_FMT | ||
3389 | " \n", | ||
3390 | escape_essid(priv->essid, | ||
3391 | priv->essid_len), | ||
3392 | MAC_ARG(priv->bssid)); | ||
3393 | |||
3394 | priv->status &= | ||
3395 | ~(STATUS_DISASSOCIATING | | ||
3396 | STATUS_ASSOCIATING | | ||
3397 | STATUS_ASSOCIATED | STATUS_AUTH); | ||
3398 | |||
3399 | netif_stop_queue(priv->net_dev); | ||
3400 | if (!(priv->status & STATUS_ROAMING)) { | ||
3401 | netif_carrier_off(priv-> | ||
3402 | net_dev); | ||
3403 | notify_wx_assoc_event(priv); | ||
3404 | |||
3405 | /* Cancel any queued work ... */ | ||
3406 | cancel_delayed_work(&priv-> | ||
3407 | request_scan); | ||
3408 | cancel_delayed_work(&priv-> | ||
3409 | adhoc_check); | ||
3410 | |||
3411 | /* Queue up another scan... */ | ||
3412 | queue_work(priv->workqueue, | ||
3413 | &priv->request_scan); | ||
3414 | |||
3415 | cancel_delayed_work(&priv-> | ||
3416 | gather_stats); | ||
3417 | } else { | ||
3418 | priv->status |= STATUS_ROAMING; | ||
3419 | queue_work(priv->workqueue, | ||
3420 | &priv->request_scan); | ||
3421 | } | ||
3422 | |||
3423 | ipw_reset_stats(priv); | ||
3424 | break; | ||
3425 | } | ||
3331 | 3426 | ||
3332 | netif_carrier_off(priv->net_dev); | 3427 | default: |
3333 | netif_stop_queue(priv->net_dev); | 3428 | IPW_ERROR("assoc: unknown (%d)\n", |
3334 | queue_work(priv->workqueue, &priv->request_scan); | 3429 | assoc->state); |
3335 | notify_wx_assoc_event(priv); | ||
3336 | break; | 3430 | break; |
3337 | } | 3431 | } |
3338 | 3432 | ||
3339 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3340 | "authenticated: '%s' " MAC_FMT "\n", | ||
3341 | escape_essid(priv->essid, priv->essid_len), | ||
3342 | MAC_ARG(priv->bssid)); | ||
3343 | break; | 3433 | break; |
3344 | } | 3434 | } |
3345 | 3435 | ||
3346 | case CMAS_INIT: { | 3436 | case HOST_NOTIFICATION_STATUS_AUTHENTICATE:{ |
3347 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | 3437 | struct notif_authenticate *auth = ¬if->u.auth; |
3348 | "disassociated: '%s' " MAC_FMT " \n", | 3438 | switch (auth->state) { |
3349 | escape_essid(priv->essid, priv->essid_len), | 3439 | case CMAS_AUTHENTICATED: |
3350 | MAC_ARG(priv->bssid)); | 3440 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, |
3441 | "authenticated: '%s' " MAC_FMT " \n", | ||
3442 | escape_essid(priv->essid, | ||
3443 | priv->essid_len), | ||
3444 | MAC_ARG(priv->bssid)); | ||
3445 | priv->status |= STATUS_AUTH; | ||
3446 | break; | ||
3351 | 3447 | ||
3352 | priv->status &= ~( | 3448 | case CMAS_INIT: |
3353 | STATUS_DISASSOCIATING | | 3449 | if (priv->status & STATUS_AUTH) { |
3354 | STATUS_ASSOCIATING | | 3450 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | |
3355 | STATUS_ASSOCIATED | | 3451 | IPW_DL_ASSOC, |
3356 | STATUS_AUTH); | 3452 | "authentication failed (0x%04X): %s\n", |
3453 | ntohs(auth->status), | ||
3454 | ipw_get_status_code(ntohs | ||
3455 | (auth-> | ||
3456 | status))); | ||
3457 | } | ||
3458 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3459 | IPW_DL_ASSOC, | ||
3460 | "deauthenticated: '%s' " MAC_FMT "\n", | ||
3461 | escape_essid(priv->essid, | ||
3462 | priv->essid_len), | ||
3463 | MAC_ARG(priv->bssid)); | ||
3357 | 3464 | ||
3358 | netif_stop_queue(priv->net_dev); | 3465 | priv->status &= ~(STATUS_ASSOCIATING | |
3359 | if (!(priv->status & STATUS_ROAMING)) { | 3466 | STATUS_AUTH | |
3360 | netif_carrier_off(priv->net_dev); | 3467 | STATUS_ASSOCIATED); |
3361 | notify_wx_assoc_event(priv); | ||
3362 | |||
3363 | /* Cancel any queued work ... */ | ||
3364 | cancel_delayed_work(&priv->request_scan); | ||
3365 | cancel_delayed_work(&priv->adhoc_check); | ||
3366 | 3468 | ||
3367 | /* Queue up another scan... */ | 3469 | netif_carrier_off(priv->net_dev); |
3470 | netif_stop_queue(priv->net_dev); | ||
3368 | queue_work(priv->workqueue, | 3471 | queue_work(priv->workqueue, |
3369 | &priv->request_scan); | 3472 | &priv->request_scan); |
3473 | notify_wx_assoc_event(priv); | ||
3474 | break; | ||
3370 | 3475 | ||
3371 | cancel_delayed_work(&priv->gather_stats); | 3476 | case CMAS_TX_AUTH_SEQ_1: |
3372 | } else { | 3477 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | |
3373 | priv->status |= STATUS_ROAMING; | 3478 | IPW_DL_ASSOC, "AUTH_SEQ_1\n"); |
3374 | queue_work(priv->workqueue, | 3479 | break; |
3375 | &priv->request_scan); | 3480 | case CMAS_RX_AUTH_SEQ_2: |
3481 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3482 | IPW_DL_ASSOC, "AUTH_SEQ_2\n"); | ||
3483 | break; | ||
3484 | case CMAS_AUTH_SEQ_1_PASS: | ||
3485 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3486 | IPW_DL_ASSOC, "AUTH_SEQ_1_PASS\n"); | ||
3487 | break; | ||
3488 | case CMAS_AUTH_SEQ_1_FAIL: | ||
3489 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3490 | IPW_DL_ASSOC, "AUTH_SEQ_1_FAIL\n"); | ||
3491 | break; | ||
3492 | case CMAS_TX_AUTH_SEQ_3: | ||
3493 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3494 | IPW_DL_ASSOC, "AUTH_SEQ_3\n"); | ||
3495 | break; | ||
3496 | case CMAS_RX_AUTH_SEQ_4: | ||
3497 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3498 | IPW_DL_ASSOC, "RX_AUTH_SEQ_4\n"); | ||
3499 | break; | ||
3500 | case CMAS_AUTH_SEQ_2_PASS: | ||
3501 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3502 | IPW_DL_ASSOC, "AUTH_SEQ_2_PASS\n"); | ||
3503 | break; | ||
3504 | case CMAS_AUTH_SEQ_2_FAIL: | ||
3505 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3506 | IPW_DL_ASSOC, "AUT_SEQ_2_FAIL\n"); | ||
3507 | break; | ||
3508 | case CMAS_TX_ASSOC: | ||
3509 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3510 | IPW_DL_ASSOC, "TX_ASSOC\n"); | ||
3511 | break; | ||
3512 | case CMAS_RX_ASSOC_RESP: | ||
3513 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3514 | IPW_DL_ASSOC, "RX_ASSOC_RESP\n"); | ||
3515 | break; | ||
3516 | case CMAS_ASSOCIATED: | ||
3517 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | | ||
3518 | IPW_DL_ASSOC, "ASSOCIATED\n"); | ||
3519 | break; | ||
3520 | default: | ||
3521 | IPW_DEBUG_NOTIF("auth: failure - %d\n", | ||
3522 | auth->state); | ||
3523 | break; | ||
3376 | } | 3524 | } |
3377 | |||
3378 | ipw_reset_stats(priv); | ||
3379 | break; | ||
3380 | } | ||
3381 | |||
3382 | default: | ||
3383 | IPW_ERROR("assoc: unknown (%d)\n", | ||
3384 | assoc->state); | ||
3385 | break; | 3525 | break; |
3386 | } | 3526 | } |
3387 | 3527 | ||
3388 | break; | 3528 | case HOST_NOTIFICATION_STATUS_SCAN_CHANNEL_RESULT:{ |
3389 | } | 3529 | struct notif_channel_result *x = |
3530 | ¬if->u.channel_result; | ||
3390 | 3531 | ||
3391 | case HOST_NOTIFICATION_STATUS_AUTHENTICATE: { | 3532 | if (notif->size == sizeof(*x)) { |
3392 | struct notif_authenticate *auth = ¬if->u.auth; | 3533 | IPW_DEBUG_SCAN("Scan result for channel %d\n", |
3393 | switch (auth->state) { | 3534 | x->channel_num); |
3394 | case CMAS_AUTHENTICATED: | 3535 | } else { |
3395 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | 3536 | IPW_DEBUG_SCAN("Scan result of wrong size %d " |
3396 | "authenticated: '%s' " MAC_FMT " \n", | 3537 | "(should be %zd)\n", |
3397 | escape_essid(priv->essid, priv->essid_len), | 3538 | notif->size, sizeof(*x)); |
3398 | MAC_ARG(priv->bssid)); | ||
3399 | priv->status |= STATUS_AUTH; | ||
3400 | break; | ||
3401 | |||
3402 | case CMAS_INIT: | ||
3403 | if (priv->status & STATUS_AUTH) { | ||
3404 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3405 | "authentication failed (0x%04X): %s\n", | ||
3406 | ntohs(auth->status), | ||
3407 | ipw_get_status_code(ntohs(auth->status))); | ||
3408 | } | 3539 | } |
3409 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3410 | "deauthenticated: '%s' " MAC_FMT "\n", | ||
3411 | escape_essid(priv->essid, priv->essid_len), | ||
3412 | MAC_ARG(priv->bssid)); | ||
3413 | |||
3414 | priv->status &= ~(STATUS_ASSOCIATING | | ||
3415 | STATUS_AUTH | | ||
3416 | STATUS_ASSOCIATED); | ||
3417 | |||
3418 | netif_carrier_off(priv->net_dev); | ||
3419 | netif_stop_queue(priv->net_dev); | ||
3420 | queue_work(priv->workqueue, &priv->request_scan); | ||
3421 | notify_wx_assoc_event(priv); | ||
3422 | break; | ||
3423 | |||
3424 | case CMAS_TX_AUTH_SEQ_1: | ||
3425 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3426 | "AUTH_SEQ_1\n"); | ||
3427 | break; | ||
3428 | case CMAS_RX_AUTH_SEQ_2: | ||
3429 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3430 | "AUTH_SEQ_2\n"); | ||
3431 | break; | ||
3432 | case CMAS_AUTH_SEQ_1_PASS: | ||
3433 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3434 | "AUTH_SEQ_1_PASS\n"); | ||
3435 | break; | ||
3436 | case CMAS_AUTH_SEQ_1_FAIL: | ||
3437 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3438 | "AUTH_SEQ_1_FAIL\n"); | ||
3439 | break; | ||
3440 | case CMAS_TX_AUTH_SEQ_3: | ||
3441 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3442 | "AUTH_SEQ_3\n"); | ||
3443 | break; | ||
3444 | case CMAS_RX_AUTH_SEQ_4: | ||
3445 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3446 | "RX_AUTH_SEQ_4\n"); | ||
3447 | break; | ||
3448 | case CMAS_AUTH_SEQ_2_PASS: | ||
3449 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3450 | "AUTH_SEQ_2_PASS\n"); | ||
3451 | break; | ||
3452 | case CMAS_AUTH_SEQ_2_FAIL: | ||
3453 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3454 | "AUT_SEQ_2_FAIL\n"); | ||
3455 | break; | ||
3456 | case CMAS_TX_ASSOC: | ||
3457 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3458 | "TX_ASSOC\n"); | ||
3459 | break; | ||
3460 | case CMAS_RX_ASSOC_RESP: | ||
3461 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3462 | "RX_ASSOC_RESP\n"); | ||
3463 | break; | ||
3464 | case CMAS_ASSOCIATED: | ||
3465 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, | ||
3466 | "ASSOCIATED\n"); | ||
3467 | break; | ||
3468 | default: | ||
3469 | IPW_DEBUG_NOTIF("auth: failure - %d\n", auth->state); | ||
3470 | break; | 3540 | break; |
3471 | } | 3541 | } |
3472 | break; | ||
3473 | } | ||
3474 | |||
3475 | case HOST_NOTIFICATION_STATUS_SCAN_CHANNEL_RESULT: { | ||
3476 | struct notif_channel_result *x = ¬if->u.channel_result; | ||
3477 | |||
3478 | if (notif->size == sizeof(*x)) { | ||
3479 | IPW_DEBUG_SCAN("Scan result for channel %d\n", | ||
3480 | x->channel_num); | ||
3481 | } else { | ||
3482 | IPW_DEBUG_SCAN("Scan result of wrong size %d " | ||
3483 | "(should be %zd)\n", | ||
3484 | notif->size, sizeof(*x)); | ||
3485 | } | ||
3486 | break; | ||
3487 | } | ||
3488 | 3542 | ||
3489 | case HOST_NOTIFICATION_STATUS_SCAN_COMPLETED: { | 3543 | case HOST_NOTIFICATION_STATUS_SCAN_COMPLETED:{ |
3490 | struct notif_scan_complete* x = ¬if->u.scan_complete; | 3544 | struct notif_scan_complete *x = ¬if->u.scan_complete; |
3491 | if (notif->size == sizeof(*x)) { | 3545 | if (notif->size == sizeof(*x)) { |
3492 | IPW_DEBUG_SCAN("Scan completed: type %d, %d channels, " | 3546 | IPW_DEBUG_SCAN |
3493 | "%d status\n", | 3547 | ("Scan completed: type %d, %d channels, " |
3494 | x->scan_type, | 3548 | "%d status\n", x->scan_type, |
3495 | x->num_channels, | 3549 | x->num_channels, x->status); |
3496 | x->status); | 3550 | } else { |
3497 | } else { | 3551 | IPW_ERROR("Scan completed of wrong size %d " |
3498 | IPW_ERROR("Scan completed of wrong size %d " | 3552 | "(should be %zd)\n", |
3499 | "(should be %zd)\n", | 3553 | notif->size, sizeof(*x)); |
3500 | notif->size, sizeof(*x)); | 3554 | } |
3501 | } | ||
3502 | |||
3503 | priv->status &= ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); | ||
3504 | |||
3505 | cancel_delayed_work(&priv->scan_check); | ||
3506 | |||
3507 | if (!(priv->status & (STATUS_ASSOCIATED | | ||
3508 | STATUS_ASSOCIATING | | ||
3509 | STATUS_ROAMING | | ||
3510 | STATUS_DISASSOCIATING))) | ||
3511 | queue_work(priv->workqueue, &priv->associate); | ||
3512 | else if (priv->status & STATUS_ROAMING) { | ||
3513 | /* If a scan completed and we are in roam mode, then | ||
3514 | * the scan that completed was the one requested as a | ||
3515 | * result of entering roam... so, schedule the | ||
3516 | * roam work */ | ||
3517 | queue_work(priv->workqueue, &priv->roam); | ||
3518 | } else if (priv->status & STATUS_SCAN_PENDING) | ||
3519 | queue_work(priv->workqueue, &priv->request_scan); | ||
3520 | |||
3521 | priv->ieee->scans++; | ||
3522 | break; | ||
3523 | } | ||
3524 | 3555 | ||
3525 | case HOST_NOTIFICATION_STATUS_FRAG_LENGTH: { | 3556 | priv->status &= |
3526 | struct notif_frag_length *x = ¬if->u.frag_len; | 3557 | ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); |
3558 | |||
3559 | cancel_delayed_work(&priv->scan_check); | ||
3560 | |||
3561 | if (!(priv->status & (STATUS_ASSOCIATED | | ||
3562 | STATUS_ASSOCIATING | | ||
3563 | STATUS_ROAMING | | ||
3564 | STATUS_DISASSOCIATING))) | ||
3565 | queue_work(priv->workqueue, &priv->associate); | ||
3566 | else if (priv->status & STATUS_ROAMING) { | ||
3567 | /* If a scan completed and we are in roam mode, then | ||
3568 | * the scan that completed was the one requested as a | ||
3569 | * result of entering roam... so, schedule the | ||
3570 | * roam work */ | ||
3571 | queue_work(priv->workqueue, &priv->roam); | ||
3572 | } else if (priv->status & STATUS_SCAN_PENDING) | ||
3573 | queue_work(priv->workqueue, | ||
3574 | &priv->request_scan); | ||
3527 | 3575 | ||
3528 | if (notif->size == sizeof(*x)) { | 3576 | priv->ieee->scans++; |
3529 | IPW_ERROR("Frag length: %d\n", x->frag_length); | 3577 | break; |
3530 | } else { | ||
3531 | IPW_ERROR("Frag length of wrong size %d " | ||
3532 | "(should be %zd)\n", | ||
3533 | notif->size, sizeof(*x)); | ||
3534 | } | 3578 | } |
3535 | break; | ||
3536 | } | ||
3537 | 3579 | ||
3538 | case HOST_NOTIFICATION_STATUS_LINK_DETERIORATION: { | 3580 | case HOST_NOTIFICATION_STATUS_FRAG_LENGTH:{ |
3539 | struct notif_link_deterioration *x = | 3581 | struct notif_frag_length *x = ¬if->u.frag_len; |
3540 | ¬if->u.link_deterioration; | ||
3541 | if (notif->size==sizeof(*x)) { | ||
3542 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | ||
3543 | "link deterioration: '%s' " MAC_FMT " \n", | ||
3544 | escape_essid(priv->essid, priv->essid_len), | ||
3545 | MAC_ARG(priv->bssid)); | ||
3546 | memcpy(&priv->last_link_deterioration, x, sizeof(*x)); | ||
3547 | } else { | ||
3548 | IPW_ERROR("Link Deterioration of wrong size %d " | ||
3549 | "(should be %zd)\n", | ||
3550 | notif->size, sizeof(*x)); | ||
3551 | } | ||
3552 | break; | ||
3553 | } | ||
3554 | 3582 | ||
3555 | case HOST_NOTIFICATION_DINO_CONFIG_RESPONSE: { | 3583 | if (notif->size == sizeof(*x)) { |
3556 | IPW_ERROR("Dino config\n"); | 3584 | IPW_ERROR("Frag length: %d\n", x->frag_length); |
3557 | if (priv->hcmd && priv->hcmd->cmd == HOST_CMD_DINO_CONFIG) { | 3585 | } else { |
3558 | /* TODO: Do anything special? */ | 3586 | IPW_ERROR("Frag length of wrong size %d " |
3559 | } else { | 3587 | "(should be %zd)\n", |
3560 | IPW_ERROR("Unexpected DINO_CONFIG_RESPONSE\n"); | 3588 | notif->size, sizeof(*x)); |
3589 | } | ||
3590 | break; | ||
3561 | } | 3591 | } |
3562 | break; | ||
3563 | } | ||
3564 | 3592 | ||
3565 | case HOST_NOTIFICATION_STATUS_BEACON_STATE: { | 3593 | case HOST_NOTIFICATION_STATUS_LINK_DETERIORATION:{ |
3566 | struct notif_beacon_state *x = ¬if->u.beacon_state; | 3594 | struct notif_link_deterioration *x = |
3567 | if (notif->size != sizeof(*x)) { | 3595 | ¬if->u.link_deterioration; |
3568 | IPW_ERROR("Beacon state of wrong size %d (should " | 3596 | if (notif->size == sizeof(*x)) { |
3569 | "be %zd)\n", notif->size, sizeof(*x)); | 3597 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, |
3598 | "link deterioration: '%s' " MAC_FMT | ||
3599 | " \n", escape_essid(priv->essid, | ||
3600 | priv->essid_len), | ||
3601 | MAC_ARG(priv->bssid)); | ||
3602 | memcpy(&priv->last_link_deterioration, x, | ||
3603 | sizeof(*x)); | ||
3604 | } else { | ||
3605 | IPW_ERROR("Link Deterioration of wrong size %d " | ||
3606 | "(should be %zd)\n", | ||
3607 | notif->size, sizeof(*x)); | ||
3608 | } | ||
3570 | break; | 3609 | break; |
3571 | } | 3610 | } |
3572 | 3611 | ||
3573 | if (x->state == HOST_NOTIFICATION_STATUS_BEACON_MISSING) { | 3612 | case HOST_NOTIFICATION_DINO_CONFIG_RESPONSE:{ |
3574 | if (priv->status & STATUS_SCANNING) { | 3613 | IPW_ERROR("Dino config\n"); |
3575 | /* Stop scan to keep fw from getting | 3614 | if (priv->hcmd |
3576 | * stuck... */ | 3615 | && priv->hcmd->cmd == HOST_CMD_DINO_CONFIG) { |
3577 | queue_work(priv->workqueue, | 3616 | /* TODO: Do anything special? */ |
3578 | &priv->abort_scan); | 3617 | } else { |
3618 | IPW_ERROR("Unexpected DINO_CONFIG_RESPONSE\n"); | ||
3579 | } | 3619 | } |
3620 | break; | ||
3621 | } | ||
3580 | 3622 | ||
3581 | if (x->number > priv->missed_beacon_threshold && | 3623 | case HOST_NOTIFICATION_STATUS_BEACON_STATE:{ |
3582 | priv->status & STATUS_ASSOCIATED) { | 3624 | struct notif_beacon_state *x = ¬if->u.beacon_state; |
3583 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | | 3625 | if (notif->size != sizeof(*x)) { |
3584 | IPW_DL_STATE, | 3626 | IPW_ERROR |
3585 | "Missed beacon: %d - disassociate\n", | 3627 | ("Beacon state of wrong size %d (should " |
3586 | x->number); | 3628 | "be %zd)\n", notif->size, sizeof(*x)); |
3587 | queue_work(priv->workqueue, | 3629 | break; |
3588 | &priv->disassociate); | ||
3589 | } else if (x->number > priv->roaming_threshold) { | ||
3590 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | ||
3591 | "Missed beacon: %d - initiate " | ||
3592 | "roaming\n", | ||
3593 | x->number); | ||
3594 | queue_work(priv->workqueue, | ||
3595 | &priv->roam); | ||
3596 | } else { | ||
3597 | IPW_DEBUG_NOTIF("Missed beacon: %d\n", | ||
3598 | x->number); | ||
3599 | } | 3630 | } |
3600 | 3631 | ||
3601 | priv->notif_missed_beacons = x->number; | 3632 | if (x->state == HOST_NOTIFICATION_STATUS_BEACON_MISSING) { |
3633 | if (priv->status & STATUS_SCANNING) { | ||
3634 | /* Stop scan to keep fw from getting | ||
3635 | * stuck... */ | ||
3636 | queue_work(priv->workqueue, | ||
3637 | &priv->abort_scan); | ||
3638 | } | ||
3639 | |||
3640 | if (x->number > priv->missed_beacon_threshold && | ||
3641 | priv->status & STATUS_ASSOCIATED) { | ||
3642 | IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | | ||
3643 | IPW_DL_STATE, | ||
3644 | "Missed beacon: %d - disassociate\n", | ||
3645 | x->number); | ||
3646 | queue_work(priv->workqueue, | ||
3647 | &priv->disassociate); | ||
3648 | } else if (x->number > priv->roaming_threshold) { | ||
3649 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | ||
3650 | "Missed beacon: %d - initiate " | ||
3651 | "roaming\n", x->number); | ||
3652 | queue_work(priv->workqueue, | ||
3653 | &priv->roam); | ||
3654 | } else { | ||
3655 | IPW_DEBUG_NOTIF("Missed beacon: %d\n", | ||
3656 | x->number); | ||
3657 | } | ||
3658 | |||
3659 | priv->notif_missed_beacons = x->number; | ||
3602 | 3660 | ||
3603 | } | 3661 | } |
3604 | 3662 | ||
3663 | break; | ||
3664 | } | ||
3605 | 3665 | ||
3606 | break; | 3666 | case HOST_NOTIFICATION_STATUS_TGI_TX_KEY:{ |
3607 | } | 3667 | struct notif_tgi_tx_key *x = ¬if->u.tgi_tx_key; |
3668 | if (notif->size == sizeof(*x)) { | ||
3669 | IPW_ERROR("TGi Tx Key: state 0x%02x sec type " | ||
3670 | "0x%02x station %d\n", | ||
3671 | x->key_state, x->security_type, | ||
3672 | x->station_index); | ||
3673 | break; | ||
3674 | } | ||
3608 | 3675 | ||
3609 | case HOST_NOTIFICATION_STATUS_TGI_TX_KEY: { | 3676 | IPW_ERROR |
3610 | struct notif_tgi_tx_key *x = ¬if->u.tgi_tx_key; | 3677 | ("TGi Tx Key of wrong size %d (should be %zd)\n", |
3611 | if (notif->size==sizeof(*x)) { | 3678 | notif->size, sizeof(*x)); |
3612 | IPW_ERROR("TGi Tx Key: state 0x%02x sec type " | ||
3613 | "0x%02x station %d\n", | ||
3614 | x->key_state,x->security_type, | ||
3615 | x->station_index); | ||
3616 | break; | 3679 | break; |
3617 | } | 3680 | } |
3618 | 3681 | ||
3619 | IPW_ERROR("TGi Tx Key of wrong size %d (should be %zd)\n", | 3682 | case HOST_NOTIFICATION_CALIB_KEEP_RESULTS:{ |
3620 | notif->size, sizeof(*x)); | 3683 | struct notif_calibration *x = ¬if->u.calibration; |
3621 | break; | ||
3622 | } | ||
3623 | 3684 | ||
3624 | case HOST_NOTIFICATION_CALIB_KEEP_RESULTS: { | 3685 | if (notif->size == sizeof(*x)) { |
3625 | struct notif_calibration *x = ¬if->u.calibration; | 3686 | memcpy(&priv->calib, x, sizeof(*x)); |
3687 | IPW_DEBUG_INFO("TODO: Calibration\n"); | ||
3688 | break; | ||
3689 | } | ||
3626 | 3690 | ||
3627 | if (notif->size == sizeof(*x)) { | 3691 | IPW_ERROR |
3628 | memcpy(&priv->calib, x, sizeof(*x)); | 3692 | ("Calibration of wrong size %d (should be %zd)\n", |
3629 | IPW_DEBUG_INFO("TODO: Calibration\n"); | 3693 | notif->size, sizeof(*x)); |
3630 | break; | 3694 | break; |
3631 | } | 3695 | } |
3632 | 3696 | ||
3633 | IPW_ERROR("Calibration of wrong size %d (should be %zd)\n", | 3697 | case HOST_NOTIFICATION_NOISE_STATS:{ |
3634 | notif->size, sizeof(*x)); | 3698 | if (notif->size == sizeof(u32)) { |
3635 | break; | 3699 | priv->last_noise = |
3636 | } | 3700 | (u8) (notif->u.noise.value & 0xff); |
3701 | average_add(&priv->average_noise, | ||
3702 | priv->last_noise); | ||
3703 | break; | ||
3704 | } | ||
3637 | 3705 | ||
3638 | case HOST_NOTIFICATION_NOISE_STATS: { | 3706 | IPW_ERROR |
3639 | if (notif->size == sizeof(u32)) { | 3707 | ("Noise stat is wrong size %d (should be %zd)\n", |
3640 | priv->last_noise = (u8)(notif->u.noise.value & 0xff); | 3708 | notif->size, sizeof(u32)); |
3641 | average_add(&priv->average_noise, priv->last_noise); | ||
3642 | break; | 3709 | break; |
3643 | } | 3710 | } |
3644 | 3711 | ||
3645 | IPW_ERROR("Noise stat is wrong size %d (should be %zd)\n", | ||
3646 | notif->size, sizeof(u32)); | ||
3647 | break; | ||
3648 | } | ||
3649 | |||
3650 | default: | 3712 | default: |
3651 | IPW_ERROR("Unknown notification: " | 3713 | IPW_ERROR("Unknown notification: " |
3652 | "subtype=%d,flags=0x%2x,size=%d\n", | 3714 | "subtype=%d,flags=0x%2x,size=%d\n", |
@@ -3680,8 +3742,7 @@ static int ipw_queue_reset(struct ipw_priv *priv) | |||
3680 | rc = ipw_queue_tx_init(priv, &priv->txq[0], nTx, | 3742 | rc = ipw_queue_tx_init(priv, &priv->txq[0], nTx, |
3681 | CX2_TX_QUEUE_0_READ_INDEX, | 3743 | CX2_TX_QUEUE_0_READ_INDEX, |
3682 | CX2_TX_QUEUE_0_WRITE_INDEX, | 3744 | CX2_TX_QUEUE_0_WRITE_INDEX, |
3683 | CX2_TX_QUEUE_0_BD_BASE, | 3745 | CX2_TX_QUEUE_0_BD_BASE, CX2_TX_QUEUE_0_BD_SIZE); |
3684 | CX2_TX_QUEUE_0_BD_SIZE); | ||
3685 | if (rc) { | 3746 | if (rc) { |
3686 | IPW_ERROR("Tx 0 queue init failed\n"); | 3747 | IPW_ERROR("Tx 0 queue init failed\n"); |
3687 | goto error; | 3748 | goto error; |
@@ -3689,8 +3750,7 @@ static int ipw_queue_reset(struct ipw_priv *priv) | |||
3689 | rc = ipw_queue_tx_init(priv, &priv->txq[1], nTx, | 3750 | rc = ipw_queue_tx_init(priv, &priv->txq[1], nTx, |
3690 | CX2_TX_QUEUE_1_READ_INDEX, | 3751 | CX2_TX_QUEUE_1_READ_INDEX, |
3691 | CX2_TX_QUEUE_1_WRITE_INDEX, | 3752 | CX2_TX_QUEUE_1_WRITE_INDEX, |
3692 | CX2_TX_QUEUE_1_BD_BASE, | 3753 | CX2_TX_QUEUE_1_BD_BASE, CX2_TX_QUEUE_1_BD_SIZE); |
3693 | CX2_TX_QUEUE_1_BD_SIZE); | ||
3694 | if (rc) { | 3754 | if (rc) { |
3695 | IPW_ERROR("Tx 1 queue init failed\n"); | 3755 | IPW_ERROR("Tx 1 queue init failed\n"); |
3696 | goto error; | 3756 | goto error; |
@@ -3698,8 +3758,7 @@ static int ipw_queue_reset(struct ipw_priv *priv) | |||
3698 | rc = ipw_queue_tx_init(priv, &priv->txq[2], nTx, | 3758 | rc = ipw_queue_tx_init(priv, &priv->txq[2], nTx, |
3699 | CX2_TX_QUEUE_2_READ_INDEX, | 3759 | CX2_TX_QUEUE_2_READ_INDEX, |
3700 | CX2_TX_QUEUE_2_WRITE_INDEX, | 3760 | CX2_TX_QUEUE_2_WRITE_INDEX, |
3701 | CX2_TX_QUEUE_2_BD_BASE, | 3761 | CX2_TX_QUEUE_2_BD_BASE, CX2_TX_QUEUE_2_BD_SIZE); |
3702 | CX2_TX_QUEUE_2_BD_SIZE); | ||
3703 | if (rc) { | 3762 | if (rc) { |
3704 | IPW_ERROR("Tx 2 queue init failed\n"); | 3763 | IPW_ERROR("Tx 2 queue init failed\n"); |
3705 | goto error; | 3764 | goto error; |
@@ -3707,8 +3766,7 @@ static int ipw_queue_reset(struct ipw_priv *priv) | |||
3707 | rc = ipw_queue_tx_init(priv, &priv->txq[3], nTx, | 3766 | rc = ipw_queue_tx_init(priv, &priv->txq[3], nTx, |
3708 | CX2_TX_QUEUE_3_READ_INDEX, | 3767 | CX2_TX_QUEUE_3_READ_INDEX, |
3709 | CX2_TX_QUEUE_3_WRITE_INDEX, | 3768 | CX2_TX_QUEUE_3_WRITE_INDEX, |
3710 | CX2_TX_QUEUE_3_BD_BASE, | 3769 | CX2_TX_QUEUE_3_BD_BASE, CX2_TX_QUEUE_3_BD_SIZE); |
3711 | CX2_TX_QUEUE_3_BD_SIZE); | ||
3712 | if (rc) { | 3770 | if (rc) { |
3713 | IPW_ERROR("Tx 3 queue init failed\n"); | 3771 | IPW_ERROR("Tx 3 queue init failed\n"); |
3714 | goto error; | 3772 | goto error; |
@@ -3718,7 +3776,7 @@ static int ipw_queue_reset(struct ipw_priv *priv) | |||
3718 | priv->rx_pend_max = 0; | 3776 | priv->rx_pend_max = 0; |
3719 | return rc; | 3777 | return rc; |
3720 | 3778 | ||
3721 | error: | 3779 | error: |
3722 | ipw_tx_queue_free(priv); | 3780 | ipw_tx_queue_free(priv); |
3723 | return rc; | 3781 | return rc; |
3724 | } | 3782 | } |
@@ -3746,8 +3804,8 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv, | |||
3746 | hw_tail = ipw_read32(priv, q->reg_r); | 3804 | hw_tail = ipw_read32(priv, q->reg_r); |
3747 | if (hw_tail >= q->n_bd) { | 3805 | if (hw_tail >= q->n_bd) { |
3748 | IPW_ERROR | 3806 | IPW_ERROR |
3749 | ("Read index for DMA queue (%d) is out of range [0-%d)\n", | 3807 | ("Read index for DMA queue (%d) is out of range [0-%d)\n", |
3750 | hw_tail, q->n_bd); | 3808 | hw_tail, q->n_bd); |
3751 | goto done; | 3809 | goto done; |
3752 | } | 3810 | } |
3753 | for (; q->last_used != hw_tail; | 3811 | for (; q->last_used != hw_tail; |
@@ -3755,7 +3813,7 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv, | |||
3755 | ipw_queue_tx_free_tfd(priv, txq); | 3813 | ipw_queue_tx_free_tfd(priv, txq); |
3756 | priv->tx_packets++; | 3814 | priv->tx_packets++; |
3757 | } | 3815 | } |
3758 | done: | 3816 | done: |
3759 | if (ipw_queue_space(q) > q->low_mark && qindex >= 0) { | 3817 | if (ipw_queue_space(q) > q->low_mark && qindex >= 0) { |
3760 | __maybe_wake_tx(priv); | 3818 | __maybe_wake_tx(priv); |
3761 | } | 3819 | } |
@@ -3795,8 +3853,6 @@ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf, | |||
3795 | return 0; | 3853 | return 0; |
3796 | } | 3854 | } |
3797 | 3855 | ||
3798 | |||
3799 | |||
3800 | /* | 3856 | /* |
3801 | * Rx theory of operation | 3857 | * Rx theory of operation |
3802 | * | 3858 | * |
@@ -3933,9 +3989,9 @@ static void ipw_rx_queue_replenish(void *data) | |||
3933 | list_del(element); | 3989 | list_del(element); |
3934 | 3990 | ||
3935 | rxb->rxb = (struct ipw_rx_buffer *)rxb->skb->data; | 3991 | rxb->rxb = (struct ipw_rx_buffer *)rxb->skb->data; |
3936 | rxb->dma_addr = pci_map_single( | 3992 | rxb->dma_addr = |
3937 | priv->pci_dev, rxb->skb->data, CX2_RX_BUF_SIZE, | 3993 | pci_map_single(priv->pci_dev, rxb->skb->data, |
3938 | PCI_DMA_FROMDEVICE); | 3994 | CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
3939 | 3995 | ||
3940 | list_add_tail(&rxb->list, &rxq->rx_free); | 3996 | list_add_tail(&rxb->list, &rxq->rx_free); |
3941 | rxq->free_count++; | 3997 | rxq->free_count++; |
@@ -3950,8 +4006,7 @@ static void ipw_rx_queue_replenish(void *data) | |||
3950 | * This free routine walks the list of POOL entries and if SKB is set to | 4006 | * This free routine walks the list of POOL entries and if SKB is set to |
3951 | * non NULL it is unmapped and freed | 4007 | * non NULL it is unmapped and freed |
3952 | */ | 4008 | */ |
3953 | static void ipw_rx_queue_free(struct ipw_priv *priv, | 4009 | static void ipw_rx_queue_free(struct ipw_priv *priv, struct ipw_rx_queue *rxq) |
3954 | struct ipw_rx_queue *rxq) | ||
3955 | { | 4010 | { |
3956 | int i; | 4011 | int i; |
3957 | 4012 | ||
@@ -3961,8 +4016,7 @@ static void ipw_rx_queue_free(struct ipw_priv *priv, | |||
3961 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { | 4016 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { |
3962 | if (rxq->pool[i].skb != NULL) { | 4017 | if (rxq->pool[i].skb != NULL) { |
3963 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, | 4018 | pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, |
3964 | CX2_RX_BUF_SIZE, | 4019 | CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
3965 | PCI_DMA_FROMDEVICE); | ||
3966 | dev_kfree_skb(rxq->pool[i].skb); | 4020 | dev_kfree_skb(rxq->pool[i].skb); |
3967 | } | 4021 | } |
3968 | } | 4022 | } |
@@ -4001,28 +4055,28 @@ static int ipw_is_rate_in_mask(struct ipw_priv *priv, int ieee_mode, u8 rate) | |||
4001 | switch (rate) { | 4055 | switch (rate) { |
4002 | case IEEE80211_OFDM_RATE_6MB: | 4056 | case IEEE80211_OFDM_RATE_6MB: |
4003 | return priv->rates_mask & IEEE80211_OFDM_RATE_6MB_MASK ? | 4057 | return priv->rates_mask & IEEE80211_OFDM_RATE_6MB_MASK ? |
4004 | 1 : 0; | 4058 | 1 : 0; |
4005 | case IEEE80211_OFDM_RATE_9MB: | 4059 | case IEEE80211_OFDM_RATE_9MB: |
4006 | return priv->rates_mask & IEEE80211_OFDM_RATE_9MB_MASK ? | 4060 | return priv->rates_mask & IEEE80211_OFDM_RATE_9MB_MASK ? |
4007 | 1 : 0; | 4061 | 1 : 0; |
4008 | case IEEE80211_OFDM_RATE_12MB: | 4062 | case IEEE80211_OFDM_RATE_12MB: |
4009 | return priv->rates_mask & IEEE80211_OFDM_RATE_12MB_MASK ? | 4063 | return priv-> |
4010 | 1 : 0; | 4064 | rates_mask & IEEE80211_OFDM_RATE_12MB_MASK ? 1 : 0; |
4011 | case IEEE80211_OFDM_RATE_18MB: | 4065 | case IEEE80211_OFDM_RATE_18MB: |
4012 | return priv->rates_mask & IEEE80211_OFDM_RATE_18MB_MASK ? | 4066 | return priv-> |
4013 | 1 : 0; | 4067 | rates_mask & IEEE80211_OFDM_RATE_18MB_MASK ? 1 : 0; |
4014 | case IEEE80211_OFDM_RATE_24MB: | 4068 | case IEEE80211_OFDM_RATE_24MB: |
4015 | return priv->rates_mask & IEEE80211_OFDM_RATE_24MB_MASK ? | 4069 | return priv-> |
4016 | 1 : 0; | 4070 | rates_mask & IEEE80211_OFDM_RATE_24MB_MASK ? 1 : 0; |
4017 | case IEEE80211_OFDM_RATE_36MB: | 4071 | case IEEE80211_OFDM_RATE_36MB: |
4018 | return priv->rates_mask & IEEE80211_OFDM_RATE_36MB_MASK ? | 4072 | return priv-> |
4019 | 1 : 0; | 4073 | rates_mask & IEEE80211_OFDM_RATE_36MB_MASK ? 1 : 0; |
4020 | case IEEE80211_OFDM_RATE_48MB: | 4074 | case IEEE80211_OFDM_RATE_48MB: |
4021 | return priv->rates_mask & IEEE80211_OFDM_RATE_48MB_MASK ? | 4075 | return priv-> |
4022 | 1 : 0; | 4076 | rates_mask & IEEE80211_OFDM_RATE_48MB_MASK ? 1 : 0; |
4023 | case IEEE80211_OFDM_RATE_54MB: | 4077 | case IEEE80211_OFDM_RATE_54MB: |
4024 | return priv->rates_mask & IEEE80211_OFDM_RATE_54MB_MASK ? | 4078 | return priv-> |
4025 | 1 : 0; | 4079 | rates_mask & IEEE80211_OFDM_RATE_54MB_MASK ? 1 : 0; |
4026 | default: | 4080 | default: |
4027 | return 0; | 4081 | return 0; |
4028 | } | 4082 | } |
@@ -4074,10 +4128,11 @@ static int ipw_compatible_rates(struct ipw_priv *priv, | |||
4074 | int num_rates, i; | 4128 | int num_rates, i; |
4075 | 4129 | ||
4076 | memset(rates, 0, sizeof(*rates)); | 4130 | memset(rates, 0, sizeof(*rates)); |
4077 | num_rates = min(network->rates_len, (u8)IPW_MAX_RATES); | 4131 | num_rates = min(network->rates_len, (u8) IPW_MAX_RATES); |
4078 | rates->num_rates = 0; | 4132 | rates->num_rates = 0; |
4079 | for (i = 0; i < num_rates; i++) { | 4133 | for (i = 0; i < num_rates; i++) { |
4080 | if (!ipw_is_rate_in_mask(priv, network->mode, network->rates[i])) { | 4134 | if (!ipw_is_rate_in_mask |
4135 | (priv, network->mode, network->rates[i])) { | ||
4081 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", | 4136 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", |
4082 | network->rates[i], priv->rates_mask); | 4137 | network->rates[i], priv->rates_mask); |
4083 | continue; | 4138 | continue; |
@@ -4086,15 +4141,18 @@ static int ipw_compatible_rates(struct ipw_priv *priv, | |||
4086 | rates->supported_rates[rates->num_rates++] = network->rates[i]; | 4141 | rates->supported_rates[rates->num_rates++] = network->rates[i]; |
4087 | } | 4142 | } |
4088 | 4143 | ||
4089 | num_rates = min(network->rates_ex_len, (u8)(IPW_MAX_RATES - num_rates)); | 4144 | num_rates = |
4145 | min(network->rates_ex_len, (u8) (IPW_MAX_RATES - num_rates)); | ||
4090 | for (i = 0; i < num_rates; i++) { | 4146 | for (i = 0; i < num_rates; i++) { |
4091 | if (!ipw_is_rate_in_mask(priv, network->mode, network->rates_ex[i])) { | 4147 | if (!ipw_is_rate_in_mask |
4148 | (priv, network->mode, network->rates_ex[i])) { | ||
4092 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", | 4149 | IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", |
4093 | network->rates_ex[i], priv->rates_mask); | 4150 | network->rates_ex[i], priv->rates_mask); |
4094 | continue; | 4151 | continue; |
4095 | } | 4152 | } |
4096 | 4153 | ||
4097 | rates->supported_rates[rates->num_rates++] = network->rates_ex[i]; | 4154 | rates->supported_rates[rates->num_rates++] = |
4155 | network->rates_ex[i]; | ||
4098 | } | 4156 | } |
4099 | 4157 | ||
4100 | return rates->num_rates; | 4158 | return rates->num_rates; |
@@ -4113,65 +4171,65 @@ static inline void ipw_copy_rates(struct ipw_supported_rates *dest, | |||
4113 | * mask should ever be used -- right now all callers to add the scan rates are | 4171 | * mask should ever be used -- right now all callers to add the scan rates are |
4114 | * set with the modulation = CCK, so BASIC_RATE_MASK is never set... */ | 4172 | * set with the modulation = CCK, so BASIC_RATE_MASK is never set... */ |
4115 | static void ipw_add_cck_scan_rates(struct ipw_supported_rates *rates, | 4173 | static void ipw_add_cck_scan_rates(struct ipw_supported_rates *rates, |
4116 | u8 modulation, u32 rate_mask) | 4174 | u8 modulation, u32 rate_mask) |
4117 | { | 4175 | { |
4118 | u8 basic_mask = (IEEE80211_OFDM_MODULATION == modulation) ? | 4176 | u8 basic_mask = (IEEE80211_OFDM_MODULATION == modulation) ? |
4119 | IEEE80211_BASIC_RATE_MASK : 0; | 4177 | IEEE80211_BASIC_RATE_MASK : 0; |
4120 | 4178 | ||
4121 | if (rate_mask & IEEE80211_CCK_RATE_1MB_MASK) | 4179 | if (rate_mask & IEEE80211_CCK_RATE_1MB_MASK) |
4122 | rates->supported_rates[rates->num_rates++] = | 4180 | rates->supported_rates[rates->num_rates++] = |
4123 | IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; | 4181 | IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; |
4124 | 4182 | ||
4125 | if (rate_mask & IEEE80211_CCK_RATE_2MB_MASK) | 4183 | if (rate_mask & IEEE80211_CCK_RATE_2MB_MASK) |
4126 | rates->supported_rates[rates->num_rates++] = | 4184 | rates->supported_rates[rates->num_rates++] = |
4127 | IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; | 4185 | IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; |
4128 | 4186 | ||
4129 | if (rate_mask & IEEE80211_CCK_RATE_5MB_MASK) | 4187 | if (rate_mask & IEEE80211_CCK_RATE_5MB_MASK) |
4130 | rates->supported_rates[rates->num_rates++] = basic_mask | | 4188 | rates->supported_rates[rates->num_rates++] = basic_mask | |
4131 | IEEE80211_CCK_RATE_5MB; | 4189 | IEEE80211_CCK_RATE_5MB; |
4132 | 4190 | ||
4133 | if (rate_mask & IEEE80211_CCK_RATE_11MB_MASK) | 4191 | if (rate_mask & IEEE80211_CCK_RATE_11MB_MASK) |
4134 | rates->supported_rates[rates->num_rates++] = basic_mask | | 4192 | rates->supported_rates[rates->num_rates++] = basic_mask | |
4135 | IEEE80211_CCK_RATE_11MB; | 4193 | IEEE80211_CCK_RATE_11MB; |
4136 | } | 4194 | } |
4137 | 4195 | ||
4138 | static void ipw_add_ofdm_scan_rates(struct ipw_supported_rates *rates, | 4196 | static void ipw_add_ofdm_scan_rates(struct ipw_supported_rates *rates, |
4139 | u8 modulation, u32 rate_mask) | 4197 | u8 modulation, u32 rate_mask) |
4140 | { | 4198 | { |
4141 | u8 basic_mask = (IEEE80211_OFDM_MODULATION == modulation) ? | 4199 | u8 basic_mask = (IEEE80211_OFDM_MODULATION == modulation) ? |
4142 | IEEE80211_BASIC_RATE_MASK : 0; | 4200 | IEEE80211_BASIC_RATE_MASK : 0; |
4143 | 4201 | ||
4144 | if (rate_mask & IEEE80211_OFDM_RATE_6MB_MASK) | 4202 | if (rate_mask & IEEE80211_OFDM_RATE_6MB_MASK) |
4145 | rates->supported_rates[rates->num_rates++] = basic_mask | | 4203 | rates->supported_rates[rates->num_rates++] = basic_mask | |
4146 | IEEE80211_OFDM_RATE_6MB; | 4204 | IEEE80211_OFDM_RATE_6MB; |
4147 | 4205 | ||
4148 | if (rate_mask & IEEE80211_OFDM_RATE_9MB_MASK) | 4206 | if (rate_mask & IEEE80211_OFDM_RATE_9MB_MASK) |
4149 | rates->supported_rates[rates->num_rates++] = | 4207 | rates->supported_rates[rates->num_rates++] = |
4150 | IEEE80211_OFDM_RATE_9MB; | 4208 | IEEE80211_OFDM_RATE_9MB; |
4151 | 4209 | ||
4152 | if (rate_mask & IEEE80211_OFDM_RATE_12MB_MASK) | 4210 | if (rate_mask & IEEE80211_OFDM_RATE_12MB_MASK) |
4153 | rates->supported_rates[rates->num_rates++] = basic_mask | | 4211 | rates->supported_rates[rates->num_rates++] = basic_mask | |
4154 | IEEE80211_OFDM_RATE_12MB; | 4212 | IEEE80211_OFDM_RATE_12MB; |
4155 | 4213 | ||
4156 | if (rate_mask & IEEE80211_OFDM_RATE_18MB_MASK) | 4214 | if (rate_mask & IEEE80211_OFDM_RATE_18MB_MASK) |
4157 | rates->supported_rates[rates->num_rates++] = | 4215 | rates->supported_rates[rates->num_rates++] = |
4158 | IEEE80211_OFDM_RATE_18MB; | 4216 | IEEE80211_OFDM_RATE_18MB; |
4159 | 4217 | ||
4160 | if (rate_mask & IEEE80211_OFDM_RATE_24MB_MASK) | 4218 | if (rate_mask & IEEE80211_OFDM_RATE_24MB_MASK) |
4161 | rates->supported_rates[rates->num_rates++] = basic_mask | | 4219 | rates->supported_rates[rates->num_rates++] = basic_mask | |
4162 | IEEE80211_OFDM_RATE_24MB; | 4220 | IEEE80211_OFDM_RATE_24MB; |
4163 | 4221 | ||
4164 | if (rate_mask & IEEE80211_OFDM_RATE_36MB_MASK) | 4222 | if (rate_mask & IEEE80211_OFDM_RATE_36MB_MASK) |
4165 | rates->supported_rates[rates->num_rates++] = | 4223 | rates->supported_rates[rates->num_rates++] = |
4166 | IEEE80211_OFDM_RATE_36MB; | 4224 | IEEE80211_OFDM_RATE_36MB; |
4167 | 4225 | ||
4168 | if (rate_mask & IEEE80211_OFDM_RATE_48MB_MASK) | 4226 | if (rate_mask & IEEE80211_OFDM_RATE_48MB_MASK) |
4169 | rates->supported_rates[rates->num_rates++] = | 4227 | rates->supported_rates[rates->num_rates++] = |
4170 | IEEE80211_OFDM_RATE_48MB; | 4228 | IEEE80211_OFDM_RATE_48MB; |
4171 | 4229 | ||
4172 | if (rate_mask & IEEE80211_OFDM_RATE_54MB_MASK) | 4230 | if (rate_mask & IEEE80211_OFDM_RATE_54MB_MASK) |
4173 | rates->supported_rates[rates->num_rates++] = | 4231 | rates->supported_rates[rates->num_rates++] = |
4174 | IEEE80211_OFDM_RATE_54MB; | 4232 | IEEE80211_OFDM_RATE_54MB; |
4175 | } | 4233 | } |
4176 | 4234 | ||
4177 | struct ipw_network_match { | 4235 | struct ipw_network_match { |
@@ -4179,11 +4237,9 @@ struct ipw_network_match { | |||
4179 | struct ipw_supported_rates rates; | 4237 | struct ipw_supported_rates rates; |
4180 | }; | 4238 | }; |
4181 | 4239 | ||
4182 | static int ipw_best_network( | 4240 | static int ipw_best_network(struct ipw_priv *priv, |
4183 | struct ipw_priv *priv, | 4241 | struct ipw_network_match *match, |
4184 | struct ipw_network_match *match, | 4242 | struct ieee80211_network *network, int roaming) |
4185 | struct ieee80211_network *network, | ||
4186 | int roaming) | ||
4187 | { | 4243 | { |
4188 | struct ipw_supported_rates rates; | 4244 | struct ipw_supported_rates rates; |
4189 | 4245 | ||
@@ -4231,21 +4287,21 @@ static int ipw_best_network( | |||
4231 | memcmp(network->ssid, priv->essid, | 4287 | memcmp(network->ssid, priv->essid, |
4232 | min(network->ssid_len, priv->essid_len)))) { | 4288 | min(network->ssid_len, priv->essid_len)))) { |
4233 | char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | 4289 | char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; |
4234 | strncpy(escaped, escape_essid( | 4290 | strncpy(escaped, |
4235 | network->ssid, network->ssid_len), | 4291 | escape_essid(network->ssid, network->ssid_len), |
4236 | sizeof(escaped)); | 4292 | sizeof(escaped)); |
4237 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 4293 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
4238 | "because of ESSID mismatch: '%s'.\n", | 4294 | "because of ESSID mismatch: '%s'.\n", |
4239 | escaped, MAC_ARG(network->bssid), | 4295 | escaped, MAC_ARG(network->bssid), |
4240 | escape_essid(priv->essid, priv->essid_len)); | 4296 | escape_essid(priv->essid, |
4297 | priv->essid_len)); | ||
4241 | return 0; | 4298 | return 0; |
4242 | } | 4299 | } |
4243 | } | 4300 | } |
4244 | 4301 | ||
4245 | /* If the old network rate is better than this one, don't bother | 4302 | /* If the old network rate is better than this one, don't bother |
4246 | * testing everything else. */ | 4303 | * testing everything else. */ |
4247 | if (match->network && match->network->stats.rssi > | 4304 | if (match->network && match->network->stats.rssi > network->stats.rssi) { |
4248 | network->stats.rssi) { | ||
4249 | char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | 4305 | char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; |
4250 | strncpy(escaped, | 4306 | strncpy(escaped, |
4251 | escape_essid(network->ssid, network->ssid_len), | 4307 | escape_essid(network->ssid, network->ssid_len), |
@@ -4303,7 +4359,7 @@ static int ipw_best_network( | |||
4303 | priv->capability & CAP_PRIVACY_ON ? "on" : | 4359 | priv->capability & CAP_PRIVACY_ON ? "on" : |
4304 | "off", | 4360 | "off", |
4305 | network->capability & | 4361 | network->capability & |
4306 | WLAN_CAPABILITY_PRIVACY ?"on" : "off"); | 4362 | WLAN_CAPABILITY_PRIVACY ? "on" : "off"); |
4307 | return 0; | 4363 | return 0; |
4308 | } | 4364 | } |
4309 | 4365 | ||
@@ -4312,8 +4368,7 @@ static int ipw_best_network( | |||
4312 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 4368 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
4313 | "because of BSSID mismatch: " MAC_FMT ".\n", | 4369 | "because of BSSID mismatch: " MAC_FMT ".\n", |
4314 | escape_essid(network->ssid, network->ssid_len), | 4370 | escape_essid(network->ssid, network->ssid_len), |
4315 | MAC_ARG(network->bssid), | 4371 | MAC_ARG(network->bssid), MAC_ARG(priv->bssid)); |
4316 | MAC_ARG(priv->bssid)); | ||
4317 | return 0; | 4372 | return 0; |
4318 | } | 4373 | } |
4319 | 4374 | ||
@@ -4351,9 +4406,8 @@ static int ipw_best_network( | |||
4351 | return 1; | 4406 | return 1; |
4352 | } | 4407 | } |
4353 | 4408 | ||
4354 | |||
4355 | static void ipw_adhoc_create(struct ipw_priv *priv, | 4409 | static void ipw_adhoc_create(struct ipw_priv *priv, |
4356 | struct ieee80211_network *network) | 4410 | struct ieee80211_network *network) |
4357 | { | 4411 | { |
4358 | /* | 4412 | /* |
4359 | * For the purposes of scanning, we can set our wireless mode | 4413 | * For the purposes of scanning, we can set our wireless mode |
@@ -4393,8 +4447,7 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
4393 | if (priv->capability & CAP_PRIVACY_ON) | 4447 | if (priv->capability & CAP_PRIVACY_ON) |
4394 | network->capability |= WLAN_CAPABILITY_PRIVACY; | 4448 | network->capability |= WLAN_CAPABILITY_PRIVACY; |
4395 | network->rates_len = min(priv->rates.num_rates, MAX_RATES_LENGTH); | 4449 | network->rates_len = min(priv->rates.num_rates, MAX_RATES_LENGTH); |
4396 | memcpy(network->rates, priv->rates.supported_rates, | 4450 | memcpy(network->rates, priv->rates.supported_rates, network->rates_len); |
4397 | network->rates_len); | ||
4398 | network->rates_ex_len = priv->rates.num_rates - network->rates_len; | 4451 | network->rates_ex_len = priv->rates.num_rates - network->rates_len; |
4399 | memcpy(network->rates_ex, | 4452 | memcpy(network->rates_ex, |
4400 | &priv->rates.supported_rates[network->rates_len], | 4453 | &priv->rates.supported_rates[network->rates_len], |
@@ -4404,13 +4457,13 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
4404 | network->last_associate = 0; | 4457 | network->last_associate = 0; |
4405 | network->time_stamp[0] = 0; | 4458 | network->time_stamp[0] = 0; |
4406 | network->time_stamp[1] = 0; | 4459 | network->time_stamp[1] = 0; |
4407 | network->beacon_interval = 100; /* Default */ | 4460 | network->beacon_interval = 100; /* Default */ |
4408 | network->listen_interval = 10; /* Default */ | 4461 | network->listen_interval = 10; /* Default */ |
4409 | network->atim_window = 0; /* Default */ | 4462 | network->atim_window = 0; /* Default */ |
4410 | #ifdef CONFIG_IEEE80211_WPA | 4463 | #ifdef CONFIG_IEEE80211_WPA |
4411 | network->wpa_ie_len = 0; | 4464 | network->wpa_ie_len = 0; |
4412 | network->rsn_ie_len = 0; | 4465 | network->rsn_ie_len = 0; |
4413 | #endif /* CONFIG_IEEE80211_WPA */ | 4466 | #endif /* CONFIG_IEEE80211_WPA */ |
4414 | } | 4467 | } |
4415 | 4468 | ||
4416 | static void ipw_send_wep_keys(struct ipw_priv *priv) | 4469 | static void ipw_send_wep_keys(struct ipw_priv *priv) |
@@ -4464,14 +4517,12 @@ static void ipw_debug_config(struct ipw_priv *priv) | |||
4464 | IPW_DEBUG_INFO("Scan completed, no valid APs matched " | 4517 | IPW_DEBUG_INFO("Scan completed, no valid APs matched " |
4465 | "[CFG 0x%08X]\n", priv->config); | 4518 | "[CFG 0x%08X]\n", priv->config); |
4466 | if (priv->config & CFG_STATIC_CHANNEL) | 4519 | if (priv->config & CFG_STATIC_CHANNEL) |
4467 | IPW_DEBUG_INFO("Channel locked to %d\n", | 4520 | IPW_DEBUG_INFO("Channel locked to %d\n", priv->channel); |
4468 | priv->channel); | ||
4469 | else | 4521 | else |
4470 | IPW_DEBUG_INFO("Channel unlocked.\n"); | 4522 | IPW_DEBUG_INFO("Channel unlocked.\n"); |
4471 | if (priv->config & CFG_STATIC_ESSID) | 4523 | if (priv->config & CFG_STATIC_ESSID) |
4472 | IPW_DEBUG_INFO("ESSID locked to '%s'\n", | 4524 | IPW_DEBUG_INFO("ESSID locked to '%s'\n", |
4473 | escape_essid(priv->essid, | 4525 | escape_essid(priv->essid, priv->essid_len)); |
4474 | priv->essid_len)); | ||
4475 | else | 4526 | else |
4476 | IPW_DEBUG_INFO("ESSID unlocked.\n"); | 4527 | IPW_DEBUG_INFO("ESSID unlocked.\n"); |
4477 | if (priv->config & CFG_STATIC_BSSID) | 4528 | if (priv->config & CFG_STATIC_BSSID) |
@@ -4502,7 +4553,7 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | |||
4502 | * Tx rates */ | 4553 | * Tx rates */ |
4503 | 4554 | ||
4504 | switch (priv->ieee->freq_band) { | 4555 | switch (priv->ieee->freq_band) { |
4505 | case IEEE80211_52GHZ_BAND: /* A only */ | 4556 | case IEEE80211_52GHZ_BAND: /* A only */ |
4506 | /* IEEE_A */ | 4557 | /* IEEE_A */ |
4507 | if (priv->rates_mask & ~IEEE80211_OFDM_RATES_MASK) { | 4558 | if (priv->rates_mask & ~IEEE80211_OFDM_RATES_MASK) { |
4508 | /* Invalid fixed rate mask */ | 4559 | /* Invalid fixed rate mask */ |
@@ -4513,7 +4564,7 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | |||
4513 | fr.tx_rates >>= IEEE80211_OFDM_SHIFT_MASK_A; | 4564 | fr.tx_rates >>= IEEE80211_OFDM_SHIFT_MASK_A; |
4514 | break; | 4565 | break; |
4515 | 4566 | ||
4516 | default: /* 2.4Ghz or Mixed */ | 4567 | default: /* 2.4Ghz or Mixed */ |
4517 | /* IEEE_B */ | 4568 | /* IEEE_B */ |
4518 | if (network->mode == IEEE_B) { | 4569 | if (network->mode == IEEE_B) { |
4519 | if (fr.tx_rates & ~IEEE80211_CCK_RATES_MASK) { | 4570 | if (fr.tx_rates & ~IEEE80211_CCK_RATES_MASK) { |
@@ -4551,13 +4602,12 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, | |||
4551 | } | 4602 | } |
4552 | 4603 | ||
4553 | reg = ipw_read32(priv, IPW_MEM_FIXED_OVERRIDE); | 4604 | reg = ipw_read32(priv, IPW_MEM_FIXED_OVERRIDE); |
4554 | ipw_write_reg32(priv, reg, *(u32*)&fr); | 4605 | ipw_write_reg32(priv, reg, *(u32 *) & fr); |
4555 | } | 4606 | } |
4556 | 4607 | ||
4557 | static int ipw_associate_network(struct ipw_priv *priv, | 4608 | static int ipw_associate_network(struct ipw_priv *priv, |
4558 | struct ieee80211_network *network, | 4609 | struct ieee80211_network *network, |
4559 | struct ipw_supported_rates *rates, | 4610 | struct ipw_supported_rates *rates, int roaming) |
4560 | int roaming) | ||
4561 | { | 4611 | { |
4562 | int err; | 4612 | int err; |
4563 | 4613 | ||
@@ -4566,7 +4616,7 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4566 | 4616 | ||
4567 | if (!(priv->config & CFG_STATIC_ESSID)) { | 4617 | if (!(priv->config & CFG_STATIC_ESSID)) { |
4568 | priv->essid_len = min(network->ssid_len, | 4618 | priv->essid_len = min(network->ssid_len, |
4569 | (u8)IW_ESSID_MAX_SIZE); | 4619 | (u8) IW_ESSID_MAX_SIZE); |
4570 | memcpy(priv->essid, network->ssid, priv->essid_len); | 4620 | memcpy(priv->essid, network->ssid, priv->essid_len); |
4571 | } | 4621 | } |
4572 | 4622 | ||
@@ -4612,13 +4662,11 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4612 | priv->capability & CAP_PRIVACY_ON ? " key=" : "", | 4662 | priv->capability & CAP_PRIVACY_ON ? " key=" : "", |
4613 | priv->capability & CAP_PRIVACY_ON ? | 4663 | priv->capability & CAP_PRIVACY_ON ? |
4614 | '1' + priv->sec.active_key : '.', | 4664 | '1' + priv->sec.active_key : '.', |
4615 | priv->capability & CAP_PRIVACY_ON ? | 4665 | priv->capability & CAP_PRIVACY_ON ? '.' : ' '); |
4616 | '.' : ' '); | ||
4617 | 4666 | ||
4618 | priv->assoc_request.beacon_interval = network->beacon_interval; | 4667 | priv->assoc_request.beacon_interval = network->beacon_interval; |
4619 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC) && | 4668 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC) && |
4620 | (network->time_stamp[0] == 0) && | 4669 | (network->time_stamp[0] == 0) && (network->time_stamp[1] == 0)) { |
4621 | (network->time_stamp[1] == 0)) { | ||
4622 | priv->assoc_request.assoc_type = HC_IBSS_START; | 4670 | priv->assoc_request.assoc_type = HC_IBSS_START; |
4623 | priv->assoc_request.assoc_tsf_msw = 0; | 4671 | priv->assoc_request.assoc_tsf_msw = 0; |
4624 | priv->assoc_request.assoc_tsf_lsw = 0; | 4672 | priv->assoc_request.assoc_tsf_lsw = 0; |
@@ -4637,8 +4685,7 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
4637 | memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN); | 4685 | memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN); |
4638 | priv->assoc_request.atim_window = network->atim_window; | 4686 | priv->assoc_request.atim_window = network->atim_window; |
4639 | } else { | 4687 | } else { |
4640 | memcpy(&priv->assoc_request.dest, network->bssid, | 4688 | memcpy(&priv->assoc_request.dest, network->bssid, ETH_ALEN); |
4641 | ETH_ALEN); | ||
4642 | priv->assoc_request.atim_window = 0; | 4689 | priv->assoc_request.atim_window = 0; |
4643 | } | 4690 | } |
4644 | 4691 | ||
@@ -4772,14 +4819,13 @@ static void ipw_associate(void *data) | |||
4772 | 4819 | ||
4773 | if (!(priv->config & CFG_ASSOCIATE) && | 4820 | if (!(priv->config & CFG_ASSOCIATE) && |
4774 | !(priv->config & (CFG_STATIC_ESSID | | 4821 | !(priv->config & (CFG_STATIC_ESSID | |
4775 | CFG_STATIC_CHANNEL | | 4822 | CFG_STATIC_CHANNEL | CFG_STATIC_BSSID))) { |
4776 | CFG_STATIC_BSSID))) { | ||
4777 | IPW_DEBUG_ASSOC("Not attempting association (associate=0)\n"); | 4823 | IPW_DEBUG_ASSOC("Not attempting association (associate=0)\n"); |
4778 | return; | 4824 | return; |
4779 | } | 4825 | } |
4780 | 4826 | ||
4781 | list_for_each_entry(network, &priv->ieee->network_list, list) | 4827 | list_for_each_entry(network, &priv->ieee->network_list, list) |
4782 | ipw_best_network(priv, &match, network, 0); | 4828 | ipw_best_network(priv, &match, network, 0); |
4783 | 4829 | ||
4784 | network = match.network; | 4830 | network = match.network; |
4785 | rates = &match.rates; | 4831 | rates = &match.rates; |
@@ -4790,8 +4836,7 @@ static void ipw_associate(void *data) | |||
4790 | priv->config & CFG_STATIC_ESSID && | 4836 | priv->config & CFG_STATIC_ESSID && |
4791 | !list_empty(&priv->ieee->network_free_list)) { | 4837 | !list_empty(&priv->ieee->network_free_list)) { |
4792 | element = priv->ieee->network_free_list.next; | 4838 | element = priv->ieee->network_free_list.next; |
4793 | network = list_entry(element, struct ieee80211_network, | 4839 | network = list_entry(element, struct ieee80211_network, list); |
4794 | list); | ||
4795 | ipw_adhoc_create(priv, network); | 4840 | ipw_adhoc_create(priv, network); |
4796 | rates = &priv->rates; | 4841 | rates = &priv->rates; |
4797 | list_del(element); | 4842 | list_del(element); |
@@ -4813,8 +4858,8 @@ static void ipw_associate(void *data) | |||
4813 | } | 4858 | } |
4814 | 4859 | ||
4815 | static inline void ipw_handle_data_packet(struct ipw_priv *priv, | 4860 | static inline void ipw_handle_data_packet(struct ipw_priv *priv, |
4816 | struct ipw_rx_mem_buffer *rxb, | 4861 | struct ipw_rx_mem_buffer *rxb, |
4817 | struct ieee80211_rx_stats *stats) | 4862 | struct ieee80211_rx_stats *stats) |
4818 | { | 4863 | { |
4819 | struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; | 4864 | struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; |
4820 | 4865 | ||
@@ -4846,11 +4891,10 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv, | |||
4846 | 4891 | ||
4847 | if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) | 4892 | if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) |
4848 | priv->ieee->stats.rx_errors++; | 4893 | priv->ieee->stats.rx_errors++; |
4849 | else /* ieee80211_rx succeeded, so it now owns the SKB */ | 4894 | else /* ieee80211_rx succeeded, so it now owns the SKB */ |
4850 | rxb->skb = NULL; | 4895 | rxb->skb = NULL; |
4851 | } | 4896 | } |
4852 | 4897 | ||
4853 | |||
4854 | /* | 4898 | /* |
4855 | * Main entry function for recieving a packet with 80211 headers. This | 4899 | * Main entry function for recieving a packet with 80211 headers. This |
4856 | * should be called when ever the FW has notified us that there is a new | 4900 | * should be called when ever the FW has notified us that there is a new |
@@ -4885,125 +4929,152 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4885 | pkt = (struct ipw_rx_packet *)rxb->skb->data; | 4929 | pkt = (struct ipw_rx_packet *)rxb->skb->data; |
4886 | IPW_DEBUG_RX("Packet: type=%02X seq=%02X bits=%02X\n", | 4930 | IPW_DEBUG_RX("Packet: type=%02X seq=%02X bits=%02X\n", |
4887 | pkt->header.message_type, | 4931 | pkt->header.message_type, |
4888 | pkt->header.rx_seq_num, | 4932 | pkt->header.rx_seq_num, pkt->header.control_bits); |
4889 | pkt->header.control_bits); | ||
4890 | 4933 | ||
4891 | switch (pkt->header.message_type) { | 4934 | switch (pkt->header.message_type) { |
4892 | case RX_FRAME_TYPE: /* 802.11 frame */ { | 4935 | case RX_FRAME_TYPE: /* 802.11 frame */ { |
4893 | struct ieee80211_rx_stats stats = { | 4936 | struct ieee80211_rx_stats stats = { |
4894 | .rssi = pkt->u.frame.rssi_dbm - | 4937 | .rssi = pkt->u.frame.rssi_dbm - |
4895 | IPW_RSSI_TO_DBM, | 4938 | IPW_RSSI_TO_DBM, |
4896 | .signal = pkt->u.frame.signal, | 4939 | .signal = pkt->u.frame.signal, |
4897 | .rate = pkt->u.frame.rate, | 4940 | .rate = pkt->u.frame.rate, |
4898 | .mac_time = jiffies, | 4941 | .mac_time = jiffies, |
4899 | .received_channel = | 4942 | .received_channel = |
4900 | pkt->u.frame.received_channel, | 4943 | pkt->u.frame.received_channel, |
4901 | .freq = (pkt->u.frame.control & (1<<0)) ? | 4944 | .freq = |
4902 | IEEE80211_24GHZ_BAND : IEEE80211_52GHZ_BAND, | 4945 | (pkt->u.frame. |
4903 | .len = pkt->u.frame.length, | 4946 | control & (1 << 0)) ? |
4904 | }; | 4947 | IEEE80211_24GHZ_BAND : |
4905 | 4948 | IEEE80211_52GHZ_BAND, | |
4906 | if (stats.rssi != 0) | 4949 | .len = pkt->u.frame.length, |
4907 | stats.mask |= IEEE80211_STATMASK_RSSI; | 4950 | }; |
4908 | if (stats.signal != 0) | 4951 | |
4909 | stats.mask |= IEEE80211_STATMASK_SIGNAL; | 4952 | if (stats.rssi != 0) |
4910 | if (stats.rate != 0) | 4953 | stats.mask |= IEEE80211_STATMASK_RSSI; |
4911 | stats.mask |= IEEE80211_STATMASK_RATE; | 4954 | if (stats.signal != 0) |
4912 | 4955 | stats.mask |= IEEE80211_STATMASK_SIGNAL; | |
4913 | priv->rx_packets++; | 4956 | if (stats.rate != 0) |
4957 | stats.mask |= IEEE80211_STATMASK_RATE; | ||
4958 | |||
4959 | priv->rx_packets++; | ||
4914 | 4960 | ||
4915 | #ifdef CONFIG_IPW_PROMISC | 4961 | #ifdef CONFIG_IPW_PROMISC |
4916 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | 4962 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { |
4917 | ipw_handle_data_packet(priv, rxb, &stats); | 4963 | ipw_handle_data_packet(priv, rxb, |
4918 | break; | 4964 | &stats); |
4919 | } | 4965 | break; |
4966 | } | ||
4920 | #endif | 4967 | #endif |
4921 | 4968 | ||
4922 | header = (struct ieee80211_hdr *)(rxb->skb->data + | 4969 | header = |
4923 | IPW_RX_FRAME_SIZE); | 4970 | (struct ieee80211_hdr *)(rxb->skb->data + |
4971 | IPW_RX_FRAME_SIZE); | ||
4924 | /* TODO: Check Ad-Hoc dest/source and make sure | 4972 | /* TODO: Check Ad-Hoc dest/source and make sure |
4925 | * that we are actually parsing these packets | 4973 | * that we are actually parsing these packets |
4926 | * correctly -- we should probably use the | 4974 | * correctly -- we should probably use the |
4927 | * frame control of the packet and disregard | 4975 | * frame control of the packet and disregard |
4928 | * the current iw_mode */ | 4976 | * the current iw_mode */ |
4929 | switch (priv->ieee->iw_mode) { | 4977 | switch (priv->ieee->iw_mode) { |
4930 | case IW_MODE_ADHOC: | 4978 | case IW_MODE_ADHOC: |
4931 | network_packet = | 4979 | network_packet = |
4932 | !memcmp(header->addr1, | 4980 | !memcmp(header->addr1, |
4933 | priv->net_dev->dev_addr, | 4981 | priv->net_dev->dev_addr, |
4934 | ETH_ALEN) || | 4982 | ETH_ALEN) || |
4935 | !memcmp(header->addr3, | 4983 | !memcmp(header->addr3, |
4936 | priv->bssid, ETH_ALEN) || | 4984 | priv->bssid, ETH_ALEN) || |
4937 | is_broadcast_ether_addr(header->addr1) || | 4985 | is_broadcast_ether_addr(header-> |
4938 | is_multicast_ether_addr(header->addr1); | 4986 | addr1) |
4939 | break; | 4987 | || is_multicast_ether_addr(header-> |
4940 | 4988 | addr1); | |
4941 | case IW_MODE_INFRA: | 4989 | break; |
4942 | default: | 4990 | |
4943 | network_packet = | 4991 | case IW_MODE_INFRA: |
4944 | !memcmp(header->addr3, | 4992 | default: |
4945 | priv->bssid, ETH_ALEN) || | 4993 | network_packet = |
4946 | !memcmp(header->addr1, | 4994 | !memcmp(header->addr3, |
4947 | priv->net_dev->dev_addr, | 4995 | priv->bssid, ETH_ALEN) || |
4948 | ETH_ALEN) || | 4996 | !memcmp(header->addr1, |
4949 | is_broadcast_ether_addr(header->addr1) || | 4997 | priv->net_dev->dev_addr, |
4950 | is_multicast_ether_addr(header->addr1); | 4998 | ETH_ALEN) || |
4999 | is_broadcast_ether_addr(header-> | ||
5000 | addr1) | ||
5001 | || is_multicast_ether_addr(header-> | ||
5002 | addr1); | ||
5003 | break; | ||
5004 | } | ||
5005 | |||
5006 | if (network_packet && priv->assoc_network) { | ||
5007 | priv->assoc_network->stats.rssi = | ||
5008 | stats.rssi; | ||
5009 | average_add(&priv->average_rssi, | ||
5010 | stats.rssi); | ||
5011 | priv->last_rx_rssi = stats.rssi; | ||
5012 | } | ||
5013 | |||
5014 | IPW_DEBUG_RX("Frame: len=%u\n", | ||
5015 | pkt->u.frame.length); | ||
5016 | |||
5017 | if (pkt->u.frame.length < frame_hdr_len(header)) { | ||
5018 | IPW_DEBUG_DROP | ||
5019 | ("Received packet is too small. " | ||
5020 | "Dropping.\n"); | ||
5021 | priv->ieee->stats.rx_errors++; | ||
5022 | priv->wstats.discard.misc++; | ||
5023 | break; | ||
5024 | } | ||
5025 | |||
5026 | switch (WLAN_FC_GET_TYPE(header->frame_ctl)) { | ||
5027 | case IEEE80211_FTYPE_MGMT: | ||
5028 | ieee80211_rx_mgt(priv->ieee, header, | ||
5029 | &stats); | ||
5030 | if (priv->ieee->iw_mode == IW_MODE_ADHOC | ||
5031 | && | ||
5032 | ((WLAN_FC_GET_STYPE | ||
5033 | (header->frame_ctl) == | ||
5034 | IEEE80211_STYPE_PROBE_RESP) | ||
5035 | || | ||
5036 | (WLAN_FC_GET_STYPE | ||
5037 | (header->frame_ctl) == | ||
5038 | IEEE80211_STYPE_BEACON)) | ||
5039 | && !memcmp(header->addr3, | ||
5040 | priv->bssid, ETH_ALEN)) | ||
5041 | ipw_add_station(priv, | ||
5042 | header->addr2); | ||
5043 | break; | ||
5044 | |||
5045 | case IEEE80211_FTYPE_CTL: | ||
5046 | break; | ||
5047 | |||
5048 | case IEEE80211_FTYPE_DATA: | ||
5049 | if (network_packet) | ||
5050 | ipw_handle_data_packet(priv, | ||
5051 | rxb, | ||
5052 | &stats); | ||
5053 | else | ||
5054 | IPW_DEBUG_DROP("Dropping: " | ||
5055 | MAC_FMT ", " | ||
5056 | MAC_FMT ", " | ||
5057 | MAC_FMT "\n", | ||
5058 | MAC_ARG(header-> | ||
5059 | addr1), | ||
5060 | MAC_ARG(header-> | ||
5061 | addr2), | ||
5062 | MAC_ARG(header-> | ||
5063 | addr3)); | ||
5064 | break; | ||
5065 | } | ||
4951 | break; | 5066 | break; |
4952 | } | 5067 | } |
4953 | 5068 | ||
4954 | if (network_packet && priv->assoc_network) { | 5069 | case RX_HOST_NOTIFICATION_TYPE:{ |
4955 | priv->assoc_network->stats.rssi = stats.rssi; | 5070 | IPW_DEBUG_RX |
4956 | average_add(&priv->average_rssi, | 5071 | ("Notification: subtype=%02X flags=%02X size=%d\n", |
4957 | stats.rssi); | ||
4958 | priv->last_rx_rssi = stats.rssi; | ||
4959 | } | ||
4960 | |||
4961 | IPW_DEBUG_RX("Frame: len=%u\n", pkt->u.frame.length); | ||
4962 | |||
4963 | if (pkt->u.frame.length < frame_hdr_len(header)) { | ||
4964 | IPW_DEBUG_DROP("Received packet is too small. " | ||
4965 | "Dropping.\n"); | ||
4966 | priv->ieee->stats.rx_errors++; | ||
4967 | priv->wstats.discard.misc++; | ||
4968 | break; | ||
4969 | } | ||
4970 | |||
4971 | switch (WLAN_FC_GET_TYPE(header->frame_ctl)) { | ||
4972 | case IEEE80211_FTYPE_MGMT: | ||
4973 | ieee80211_rx_mgt(priv->ieee, header, &stats); | ||
4974 | if (priv->ieee->iw_mode == IW_MODE_ADHOC && | ||
4975 | ((WLAN_FC_GET_STYPE(header->frame_ctl) == | ||
4976 | IEEE80211_STYPE_PROBE_RESP) || | ||
4977 | (WLAN_FC_GET_STYPE(header->frame_ctl) == | ||
4978 | IEEE80211_STYPE_BEACON)) && | ||
4979 | !memcmp(header->addr3, priv->bssid, ETH_ALEN)) | ||
4980 | ipw_add_station(priv, header->addr2); | ||
4981 | break; | ||
4982 | |||
4983 | case IEEE80211_FTYPE_CTL: | ||
4984 | break; | ||
4985 | |||
4986 | case IEEE80211_FTYPE_DATA: | ||
4987 | if (network_packet) | ||
4988 | ipw_handle_data_packet(priv, rxb, &stats); | ||
4989 | else | ||
4990 | IPW_DEBUG_DROP("Dropping: " MAC_FMT | ||
4991 | ", " MAC_FMT ", " MAC_FMT "\n", | ||
4992 | MAC_ARG(header->addr1), MAC_ARG(header->addr2), | ||
4993 | MAC_ARG(header->addr3)); | ||
4994 | break; | ||
4995 | } | ||
4996 | break; | ||
4997 | } | ||
4998 | |||
4999 | case RX_HOST_NOTIFICATION_TYPE: { | ||
5000 | IPW_DEBUG_RX("Notification: subtype=%02X flags=%02X size=%d\n", | ||
5001 | pkt->u.notification.subtype, | 5072 | pkt->u.notification.subtype, |
5002 | pkt->u.notification.flags, | 5073 | pkt->u.notification.flags, |
5003 | pkt->u.notification.size); | 5074 | pkt->u.notification.size); |
5004 | ipw_rx_notification(priv, &pkt->u.notification); | 5075 | ipw_rx_notification(priv, &pkt->u.notification); |
5005 | break; | 5076 | break; |
5006 | } | 5077 | } |
5007 | 5078 | ||
5008 | default: | 5079 | default: |
5009 | IPW_DEBUG_RX("Bad Rx packet of type %d\n", | 5080 | IPW_DEBUG_RX("Bad Rx packet of type %d\n", |
@@ -5088,10 +5159,10 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
5088 | /* If we are roaming, then make this a directed scan for the current | 5159 | /* If we are roaming, then make this a directed scan for the current |
5089 | * network. Otherwise, ensure that every other scan is a fast | 5160 | * network. Otherwise, ensure that every other scan is a fast |
5090 | * channel hop scan */ | 5161 | * channel hop scan */ |
5091 | if ((priv->status & STATUS_ROAMING) || ( | 5162 | if ((priv->status & STATUS_ROAMING) |
5092 | !(priv->status & STATUS_ASSOCIATED) && | 5163 | || (!(priv->status & STATUS_ASSOCIATED) |
5093 | (priv->config & CFG_STATIC_ESSID) && | 5164 | && (priv->config & CFG_STATIC_ESSID) |
5094 | (scan.full_scan_index % 2))) { | 5165 | && (scan.full_scan_index % 2))) { |
5095 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); | 5166 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); |
5096 | if (err) { | 5167 | if (err) { |
5097 | IPW_DEBUG_HC("Attempt to send SSID command failed.\n"); | 5168 | IPW_DEBUG_HC("Attempt to send SSID command failed.\n"); |
@@ -5103,7 +5174,7 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
5103 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; | 5174 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; |
5104 | } | 5175 | } |
5105 | 5176 | ||
5106 | if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { | 5177 | if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { |
5107 | int start = channel_index; | 5178 | int start = channel_index; |
5108 | for (i = 0; i < MAX_A_CHANNELS; i++) { | 5179 | for (i = 0; i < MAX_A_CHANNELS; i++) { |
5109 | if (band_a_active_channel[i] == 0) | 5180 | if (band_a_active_channel[i] == 0) |
@@ -5113,18 +5184,18 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
5113 | continue; | 5184 | continue; |
5114 | channel_index++; | 5185 | channel_index++; |
5115 | scan.channels_list[channel_index] = | 5186 | scan.channels_list[channel_index] = |
5116 | band_a_active_channel[i]; | 5187 | band_a_active_channel[i]; |
5117 | ipw_set_scan_type(&scan, channel_index, scan_type); | 5188 | ipw_set_scan_type(&scan, channel_index, scan_type); |
5118 | } | 5189 | } |
5119 | 5190 | ||
5120 | if (start != channel_index) { | 5191 | if (start != channel_index) { |
5121 | scan.channels_list[start] = (u8)(IPW_A_MODE << 6) | | 5192 | scan.channels_list[start] = (u8) (IPW_A_MODE << 6) | |
5122 | (channel_index - start); | 5193 | (channel_index - start); |
5123 | channel_index++; | 5194 | channel_index++; |
5124 | } | 5195 | } |
5125 | } | 5196 | } |
5126 | 5197 | ||
5127 | if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { | 5198 | if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { |
5128 | int start = channel_index; | 5199 | int start = channel_index; |
5129 | for (i = 0; i < MAX_B_CHANNELS; i++) { | 5200 | for (i = 0; i < MAX_B_CHANNELS; i++) { |
5130 | if (band_b_active_channel[i] == 0) | 5201 | if (band_b_active_channel[i] == 0) |
@@ -5134,20 +5205,19 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
5134 | continue; | 5205 | continue; |
5135 | channel_index++; | 5206 | channel_index++; |
5136 | scan.channels_list[channel_index] = | 5207 | scan.channels_list[channel_index] = |
5137 | band_b_active_channel[i]; | 5208 | band_b_active_channel[i]; |
5138 | ipw_set_scan_type(&scan, channel_index, scan_type); | 5209 | ipw_set_scan_type(&scan, channel_index, scan_type); |
5139 | } | 5210 | } |
5140 | 5211 | ||
5141 | if (start != channel_index) { | 5212 | if (start != channel_index) { |
5142 | scan.channels_list[start] = (u8)(IPW_B_MODE << 6) | | 5213 | scan.channels_list[start] = (u8) (IPW_B_MODE << 6) | |
5143 | (channel_index - start); | 5214 | (channel_index - start); |
5144 | } | 5215 | } |
5145 | } | 5216 | } |
5146 | 5217 | ||
5147 | err = ipw_send_scan_request_ext(priv, &scan); | 5218 | err = ipw_send_scan_request_ext(priv, &scan); |
5148 | if (err) { | 5219 | if (err) { |
5149 | IPW_DEBUG_HC("Sending scan command failed: %08X\n", | 5220 | IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); |
5150 | err); | ||
5151 | return -EIO; | 5221 | return -EIO; |
5152 | } | 5222 | } |
5153 | 5223 | ||
@@ -5199,9 +5269,8 @@ static int ipw_set_channel(struct ipw_priv *priv, u8 channel) | |||
5199 | priv->config |= CFG_STATIC_CHANNEL; | 5269 | priv->config |= CFG_STATIC_CHANNEL; |
5200 | 5270 | ||
5201 | if (priv->channel == channel) { | 5271 | if (priv->channel == channel) { |
5202 | IPW_DEBUG_INFO( | 5272 | IPW_DEBUG_INFO("Request to set channel to current value (%d)\n", |
5203 | "Request to set channel to current value (%d)\n", | 5273 | channel); |
5204 | channel); | ||
5205 | return 0; | 5274 | return 0; |
5206 | } | 5275 | } |
5207 | 5276 | ||
@@ -5229,8 +5298,7 @@ static int ipw_wx_set_freq(struct net_device *dev, | |||
5229 | 5298 | ||
5230 | /* if setting by freq convert to channel */ | 5299 | /* if setting by freq convert to channel */ |
5231 | if (fwrq->e == 1) { | 5300 | if (fwrq->e == 1) { |
5232 | if ((fwrq->m >= (int) 2.412e8 && | 5301 | if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) { |
5233 | fwrq->m <= (int) 2.487e8)) { | ||
5234 | int f = fwrq->m / 100000; | 5302 | int f = fwrq->m / 100000; |
5235 | int c = 0; | 5303 | int c = 0; |
5236 | 5304 | ||
@@ -5248,12 +5316,11 @@ static int ipw_wx_set_freq(struct net_device *dev, | |||
5248 | return -EOPNOTSUPP; | 5316 | return -EOPNOTSUPP; |
5249 | 5317 | ||
5250 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); | 5318 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); |
5251 | return ipw_set_channel(priv, (u8)fwrq->m); | 5319 | return ipw_set_channel(priv, (u8) fwrq->m); |
5252 | 5320 | ||
5253 | return 0; | 5321 | return 0; |
5254 | } | 5322 | } |
5255 | 5323 | ||
5256 | |||
5257 | static int ipw_wx_get_freq(struct net_device *dev, | 5324 | static int ipw_wx_get_freq(struct net_device *dev, |
5258 | struct iw_request_info *info, | 5325 | struct iw_request_info *info, |
5259 | union iwreq_data *wrqu, char *extra) | 5326 | union iwreq_data *wrqu, char *extra) |
@@ -5306,7 +5373,7 @@ static int ipw_wx_set_mode(struct net_device *dev, | |||
5306 | 5373 | ||
5307 | if (wrqu->mode == IW_MODE_MONITOR) | 5374 | if (wrqu->mode == IW_MODE_MONITOR) |
5308 | priv->net_dev->type = ARPHRD_IEEE80211; | 5375 | priv->net_dev->type = ARPHRD_IEEE80211; |
5309 | #endif /* CONFIG_IPW_PROMISC */ | 5376 | #endif /* CONFIG_IPW_PROMISC */ |
5310 | 5377 | ||
5311 | #ifdef CONFIG_PM | 5378 | #ifdef CONFIG_PM |
5312 | /* Free the existing firmware and reset the fw_loaded | 5379 | /* Free the existing firmware and reset the fw_loaded |
@@ -5324,12 +5391,12 @@ static int ipw_wx_set_mode(struct net_device *dev, | |||
5324 | priv->ieee->iw_mode = wrqu->mode; | 5391 | priv->ieee->iw_mode = wrqu->mode; |
5325 | ipw_adapter_restart(priv); | 5392 | ipw_adapter_restart(priv); |
5326 | 5393 | ||
5327 | return err; | 5394 | return err; |
5328 | } | 5395 | } |
5329 | 5396 | ||
5330 | static int ipw_wx_get_mode(struct net_device *dev, | 5397 | static int ipw_wx_get_mode(struct net_device *dev, |
5331 | struct iw_request_info *info, | 5398 | struct iw_request_info *info, |
5332 | union iwreq_data *wrqu, char *extra) | 5399 | union iwreq_data *wrqu, char *extra) |
5333 | { | 5400 | { |
5334 | struct ipw_priv *priv = ieee80211_priv(dev); | 5401 | struct ipw_priv *priv = ieee80211_priv(dev); |
5335 | 5402 | ||
@@ -5339,7 +5406,6 @@ static int ipw_wx_get_mode(struct net_device *dev, | |||
5339 | return 0; | 5406 | return 0; |
5340 | } | 5407 | } |
5341 | 5408 | ||
5342 | |||
5343 | #define DEFAULT_RTS_THRESHOLD 2304U | 5409 | #define DEFAULT_RTS_THRESHOLD 2304U |
5344 | #define MIN_RTS_THRESHOLD 1U | 5410 | #define MIN_RTS_THRESHOLD 1U |
5345 | #define MAX_RTS_THRESHOLD 2304U | 5411 | #define MAX_RTS_THRESHOLD 2304U |
@@ -5383,19 +5449,19 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
5383 | /* TODO: Find real max RSSI and stick here */ | 5449 | /* TODO: Find real max RSSI and stick here */ |
5384 | range->max_qual.level = 0; | 5450 | range->max_qual.level = 0; |
5385 | range->max_qual.noise = 0; | 5451 | range->max_qual.noise = 0; |
5386 | range->max_qual.updated = 7; /* Updated all three */ | 5452 | range->max_qual.updated = 7; /* Updated all three */ |
5387 | 5453 | ||
5388 | range->avg_qual.qual = 70; | 5454 | range->avg_qual.qual = 70; |
5389 | /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ | 5455 | /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ |
5390 | range->avg_qual.level = 0; /* FIXME to real average level */ | 5456 | range->avg_qual.level = 0; /* FIXME to real average level */ |
5391 | range->avg_qual.noise = 0; | 5457 | range->avg_qual.noise = 0; |
5392 | range->avg_qual.updated = 7; /* Updated all three */ | 5458 | range->avg_qual.updated = 7; /* Updated all three */ |
5393 | 5459 | ||
5394 | range->num_bitrates = min(priv->rates.num_rates, (u8)IW_MAX_BITRATES); | 5460 | range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); |
5395 | 5461 | ||
5396 | for (i = 0; i < range->num_bitrates; i++) | 5462 | for (i = 0; i < range->num_bitrates; i++) |
5397 | range->bitrate[i] = (priv->rates.supported_rates[i] & 0x7F) * | 5463 | range->bitrate[i] = (priv->rates.supported_rates[i] & 0x7F) * |
5398 | 500000; | 5464 | 500000; |
5399 | 5465 | ||
5400 | range->max_rts = DEFAULT_RTS_THRESHOLD; | 5466 | range->max_rts = DEFAULT_RTS_THRESHOLD; |
5401 | range->min_frag = MIN_FRAG_THRESHOLD; | 5467 | range->min_frag = MIN_FRAG_THRESHOLD; |
@@ -5410,7 +5476,7 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
5410 | range->we_version_compiled = WIRELESS_EXT; | 5476 | range->we_version_compiled = WIRELESS_EXT; |
5411 | range->we_version_source = 16; | 5477 | range->we_version_source = 16; |
5412 | 5478 | ||
5413 | range->num_channels = FREQ_COUNT; | 5479 | range->num_channels = FREQ_COUNT; |
5414 | 5480 | ||
5415 | val = 0; | 5481 | val = 0; |
5416 | for (i = 0; i < FREQ_COUNT; i++) { | 5482 | for (i = 0; i < FREQ_COUNT; i++) { |
@@ -5506,7 +5572,7 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
5506 | union iwreq_data *wrqu, char *extra) | 5572 | union iwreq_data *wrqu, char *extra) |
5507 | { | 5573 | { |
5508 | struct ipw_priv *priv = ieee80211_priv(dev); | 5574 | struct ipw_priv *priv = ieee80211_priv(dev); |
5509 | char *essid = ""; /* ANY */ | 5575 | char *essid = ""; /* ANY */ |
5510 | int length = 0; | 5576 | int length = 0; |
5511 | 5577 | ||
5512 | if (wrqu->essid.flags && wrqu->essid.length) { | 5578 | if (wrqu->essid.flags && wrqu->essid.length) { |
@@ -5567,11 +5633,11 @@ static int ipw_wx_get_essid(struct net_device *dev, | |||
5567 | escape_essid(priv->essid, priv->essid_len)); | 5633 | escape_essid(priv->essid, priv->essid_len)); |
5568 | memcpy(extra, priv->essid, priv->essid_len); | 5634 | memcpy(extra, priv->essid, priv->essid_len); |
5569 | wrqu->essid.length = priv->essid_len; | 5635 | wrqu->essid.length = priv->essid_len; |
5570 | wrqu->essid.flags = 1; /* active */ | 5636 | wrqu->essid.flags = 1; /* active */ |
5571 | } else { | 5637 | } else { |
5572 | IPW_DEBUG_WX("Getting essid: ANY\n"); | 5638 | IPW_DEBUG_WX("Getting essid: ANY\n"); |
5573 | wrqu->essid.length = 0; | 5639 | wrqu->essid.length = 0; |
5574 | wrqu->essid.flags = 0; /* active */ | 5640 | wrqu->essid.flags = 0; /* active */ |
5575 | } | 5641 | } |
5576 | 5642 | ||
5577 | return 0; | 5643 | return 0; |
@@ -5587,15 +5653,14 @@ static int ipw_wx_set_nick(struct net_device *dev, | |||
5587 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) | 5653 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) |
5588 | return -E2BIG; | 5654 | return -E2BIG; |
5589 | 5655 | ||
5590 | wrqu->data.length = min((size_t)wrqu->data.length, sizeof(priv->nick)); | 5656 | wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); |
5591 | memset(priv->nick, 0, sizeof(priv->nick)); | 5657 | memset(priv->nick, 0, sizeof(priv->nick)); |
5592 | memcpy(priv->nick, extra, wrqu->data.length); | 5658 | memcpy(priv->nick, extra, wrqu->data.length); |
5593 | IPW_DEBUG_TRACE("<<\n"); | 5659 | IPW_DEBUG_TRACE("<<\n"); |
5594 | return 0; | 5660 | return 0; |
5595 | 5661 | ||
5596 | } | 5662 | } |
5597 | 5663 | ||
5598 | |||
5599 | static int ipw_wx_get_nick(struct net_device *dev, | 5664 | static int ipw_wx_get_nick(struct net_device *dev, |
5600 | struct iw_request_info *info, | 5665 | struct iw_request_info *info, |
5601 | union iwreq_data *wrqu, char *extra) | 5666 | union iwreq_data *wrqu, char *extra) |
@@ -5604,11 +5669,10 @@ static int ipw_wx_get_nick(struct net_device *dev, | |||
5604 | IPW_DEBUG_WX("Getting nick\n"); | 5669 | IPW_DEBUG_WX("Getting nick\n"); |
5605 | wrqu->data.length = strlen(priv->nick) + 1; | 5670 | wrqu->data.length = strlen(priv->nick) + 1; |
5606 | memcpy(extra, priv->nick, wrqu->data.length); | 5671 | memcpy(extra, priv->nick, wrqu->data.length); |
5607 | wrqu->data.flags = 1; /* active */ | 5672 | wrqu->data.flags = 1; /* active */ |
5608 | return 0; | 5673 | return 0; |
5609 | } | 5674 | } |
5610 | 5675 | ||
5611 | |||
5612 | static int ipw_wx_set_rate(struct net_device *dev, | 5676 | static int ipw_wx_set_rate(struct net_device *dev, |
5613 | struct iw_request_info *info, | 5677 | struct iw_request_info *info, |
5614 | union iwreq_data *wrqu, char *extra) | 5678 | union iwreq_data *wrqu, char *extra) |
@@ -5621,14 +5685,13 @@ static int ipw_wx_get_rate(struct net_device *dev, | |||
5621 | struct iw_request_info *info, | 5685 | struct iw_request_info *info, |
5622 | union iwreq_data *wrqu, char *extra) | 5686 | union iwreq_data *wrqu, char *extra) |
5623 | { | 5687 | { |
5624 | struct ipw_priv * priv = ieee80211_priv(dev); | 5688 | struct ipw_priv *priv = ieee80211_priv(dev); |
5625 | wrqu->bitrate.value = priv->last_rate; | 5689 | wrqu->bitrate.value = priv->last_rate; |
5626 | 5690 | ||
5627 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); | 5691 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); |
5628 | return 0; | 5692 | return 0; |
5629 | } | 5693 | } |
5630 | 5694 | ||
5631 | |||
5632 | static int ipw_wx_set_rts(struct net_device *dev, | 5695 | static int ipw_wx_set_rts(struct net_device *dev, |
5633 | struct iw_request_info *info, | 5696 | struct iw_request_info *info, |
5634 | union iwreq_data *wrqu, char *extra) | 5697 | union iwreq_data *wrqu, char *extra) |
@@ -5657,14 +5720,12 @@ static int ipw_wx_get_rts(struct net_device *dev, | |||
5657 | struct ipw_priv *priv = ieee80211_priv(dev); | 5720 | struct ipw_priv *priv = ieee80211_priv(dev); |
5658 | wrqu->rts.value = priv->rts_threshold; | 5721 | wrqu->rts.value = priv->rts_threshold; |
5659 | wrqu->rts.fixed = 0; /* no auto select */ | 5722 | wrqu->rts.fixed = 0; /* no auto select */ |
5660 | wrqu->rts.disabled = | 5723 | wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); |
5661 | (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); | ||
5662 | 5724 | ||
5663 | IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); | 5725 | IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); |
5664 | return 0; | 5726 | return 0; |
5665 | } | 5727 | } |
5666 | 5728 | ||
5667 | |||
5668 | static int ipw_wx_set_txpow(struct net_device *dev, | 5729 | static int ipw_wx_set_txpow(struct net_device *dev, |
5669 | struct iw_request_info *info, | 5730 | struct iw_request_info *info, |
5670 | union iwreq_data *wrqu, char *extra) | 5731 | union iwreq_data *wrqu, char *extra) |
@@ -5679,8 +5740,7 @@ static int ipw_wx_set_txpow(struct net_device *dev, | |||
5679 | if (wrqu->power.flags != IW_TXPOW_DBM) | 5740 | if (wrqu->power.flags != IW_TXPOW_DBM) |
5680 | return -EINVAL; | 5741 | return -EINVAL; |
5681 | 5742 | ||
5682 | if ((wrqu->power.value > 20) || | 5743 | if ((wrqu->power.value > 20) || (wrqu->power.value < -12)) |
5683 | (wrqu->power.value < -12)) | ||
5684 | return -EINVAL; | 5744 | return -EINVAL; |
5685 | 5745 | ||
5686 | priv->tx_power = wrqu->power.value; | 5746 | priv->tx_power = wrqu->power.value; |
@@ -5704,11 +5764,10 @@ static int ipw_wx_set_txpow(struct net_device *dev, | |||
5704 | 5764 | ||
5705 | return 0; | 5765 | return 0; |
5706 | 5766 | ||
5707 | error: | 5767 | error: |
5708 | return -EIO; | 5768 | return -EIO; |
5709 | } | 5769 | } |
5710 | 5770 | ||
5711 | |||
5712 | static int ipw_wx_get_txpow(struct net_device *dev, | 5771 | static int ipw_wx_get_txpow(struct net_device *dev, |
5713 | struct iw_request_info *info, | 5772 | struct iw_request_info *info, |
5714 | union iwreq_data *wrqu, char *extra) | 5773 | union iwreq_data *wrqu, char *extra) |
@@ -5721,15 +5780,14 @@ static int ipw_wx_get_txpow(struct net_device *dev, | |||
5721 | wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; | 5780 | wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; |
5722 | 5781 | ||
5723 | IPW_DEBUG_WX("GET TX Power -> %s %d \n", | 5782 | IPW_DEBUG_WX("GET TX Power -> %s %d \n", |
5724 | wrqu->power.disabled ? "ON" : "OFF", | 5783 | wrqu->power.disabled ? "ON" : "OFF", wrqu->power.value); |
5725 | wrqu->power.value); | ||
5726 | 5784 | ||
5727 | return 0; | 5785 | return 0; |
5728 | } | 5786 | } |
5729 | 5787 | ||
5730 | static int ipw_wx_set_frag(struct net_device *dev, | 5788 | static int ipw_wx_set_frag(struct net_device *dev, |
5731 | struct iw_request_info *info, | 5789 | struct iw_request_info *info, |
5732 | union iwreq_data *wrqu, char *extra) | 5790 | union iwreq_data *wrqu, char *extra) |
5733 | { | 5791 | { |
5734 | struct ipw_priv *priv = ieee80211_priv(dev); | 5792 | struct ipw_priv *priv = ieee80211_priv(dev); |
5735 | 5793 | ||
@@ -5749,14 +5807,13 @@ static int ipw_wx_set_frag(struct net_device *dev, | |||
5749 | } | 5807 | } |
5750 | 5808 | ||
5751 | static int ipw_wx_get_frag(struct net_device *dev, | 5809 | static int ipw_wx_get_frag(struct net_device *dev, |
5752 | struct iw_request_info *info, | 5810 | struct iw_request_info *info, |
5753 | union iwreq_data *wrqu, char *extra) | 5811 | union iwreq_data *wrqu, char *extra) |
5754 | { | 5812 | { |
5755 | struct ipw_priv *priv = ieee80211_priv(dev); | 5813 | struct ipw_priv *priv = ieee80211_priv(dev); |
5756 | wrqu->frag.value = priv->ieee->fts; | 5814 | wrqu->frag.value = priv->ieee->fts; |
5757 | wrqu->frag.fixed = 0; /* no auto select */ | 5815 | wrqu->frag.fixed = 0; /* no auto select */ |
5758 | wrqu->frag.disabled = | 5816 | wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); |
5759 | (wrqu->frag.value == DEFAULT_FTS); | ||
5760 | 5817 | ||
5761 | IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); | 5818 | IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); |
5762 | 5819 | ||
@@ -5771,7 +5828,6 @@ static int ipw_wx_set_retry(struct net_device *dev, | |||
5771 | return -EOPNOTSUPP; | 5828 | return -EOPNOTSUPP; |
5772 | } | 5829 | } |
5773 | 5830 | ||
5774 | |||
5775 | static int ipw_wx_get_retry(struct net_device *dev, | 5831 | static int ipw_wx_get_retry(struct net_device *dev, |
5776 | struct iw_request_info *info, | 5832 | struct iw_request_info *info, |
5777 | union iwreq_data *wrqu, char *extra) | 5833 | union iwreq_data *wrqu, char *extra) |
@@ -5780,7 +5836,6 @@ static int ipw_wx_get_retry(struct net_device *dev, | |||
5780 | return -EOPNOTSUPP; | 5836 | return -EOPNOTSUPP; |
5781 | } | 5837 | } |
5782 | 5838 | ||
5783 | |||
5784 | static int ipw_wx_set_scan(struct net_device *dev, | 5839 | static int ipw_wx_set_scan(struct net_device *dev, |
5785 | struct iw_request_info *info, | 5840 | struct iw_request_info *info, |
5786 | union iwreq_data *wrqu, char *extra) | 5841 | union iwreq_data *wrqu, char *extra) |
@@ -5801,24 +5856,24 @@ static int ipw_wx_get_scan(struct net_device *dev, | |||
5801 | } | 5856 | } |
5802 | 5857 | ||
5803 | static int ipw_wx_set_encode(struct net_device *dev, | 5858 | static int ipw_wx_set_encode(struct net_device *dev, |
5804 | struct iw_request_info *info, | 5859 | struct iw_request_info *info, |
5805 | union iwreq_data *wrqu, char *key) | 5860 | union iwreq_data *wrqu, char *key) |
5806 | { | 5861 | { |
5807 | struct ipw_priv *priv = ieee80211_priv(dev); | 5862 | struct ipw_priv *priv = ieee80211_priv(dev); |
5808 | return ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); | 5863 | return ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); |
5809 | } | 5864 | } |
5810 | 5865 | ||
5811 | static int ipw_wx_get_encode(struct net_device *dev, | 5866 | static int ipw_wx_get_encode(struct net_device *dev, |
5812 | struct iw_request_info *info, | 5867 | struct iw_request_info *info, |
5813 | union iwreq_data *wrqu, char *key) | 5868 | union iwreq_data *wrqu, char *key) |
5814 | { | 5869 | { |
5815 | struct ipw_priv *priv = ieee80211_priv(dev); | 5870 | struct ipw_priv *priv = ieee80211_priv(dev); |
5816 | return ieee80211_wx_get_encode(priv->ieee, info, wrqu, key); | 5871 | return ieee80211_wx_get_encode(priv->ieee, info, wrqu, key); |
5817 | } | 5872 | } |
5818 | 5873 | ||
5819 | static int ipw_wx_set_power(struct net_device *dev, | 5874 | static int ipw_wx_set_power(struct net_device *dev, |
5820 | struct iw_request_info *info, | 5875 | struct iw_request_info *info, |
5821 | union iwreq_data *wrqu, char *extra) | 5876 | union iwreq_data *wrqu, char *extra) |
5822 | { | 5877 | { |
5823 | struct ipw_priv *priv = ieee80211_priv(dev); | 5878 | struct ipw_priv *priv = ieee80211_priv(dev); |
5824 | int err; | 5879 | int err; |
@@ -5837,11 +5892,11 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
5837 | } | 5892 | } |
5838 | 5893 | ||
5839 | switch (wrqu->power.flags & IW_POWER_MODE) { | 5894 | switch (wrqu->power.flags & IW_POWER_MODE) { |
5840 | case IW_POWER_ON: /* If not specified */ | 5895 | case IW_POWER_ON: /* If not specified */ |
5841 | case IW_POWER_MODE: /* If set all mask */ | 5896 | case IW_POWER_MODE: /* If set all mask */ |
5842 | case IW_POWER_ALL_R: /* If explicitely state all */ | 5897 | case IW_POWER_ALL_R: /* If explicitely state all */ |
5843 | break; | 5898 | break; |
5844 | default: /* Otherwise we don't support it */ | 5899 | default: /* Otherwise we don't support it */ |
5845 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", | 5900 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", |
5846 | wrqu->power.flags); | 5901 | wrqu->power.flags); |
5847 | return -EOPNOTSUPP; | 5902 | return -EOPNOTSUPP; |
@@ -5849,7 +5904,7 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
5849 | 5904 | ||
5850 | /* If the user hasn't specified a power management mode yet, default | 5905 | /* If the user hasn't specified a power management mode yet, default |
5851 | * to BATTERY */ | 5906 | * to BATTERY */ |
5852 | if (IPW_POWER_LEVEL(priv->power_mode) == IPW_POWER_AC) | 5907 | if (IPW_POWER_LEVEL(priv->power_mode) == IPW_POWER_AC) |
5853 | priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY; | 5908 | priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY; |
5854 | else | 5909 | else |
5855 | priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; | 5910 | priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; |
@@ -5859,15 +5914,14 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
5859 | return err; | 5914 | return err; |
5860 | } | 5915 | } |
5861 | 5916 | ||
5862 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", | 5917 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); |
5863 | priv->power_mode); | ||
5864 | 5918 | ||
5865 | return 0; | 5919 | return 0; |
5866 | } | 5920 | } |
5867 | 5921 | ||
5868 | static int ipw_wx_get_power(struct net_device *dev, | 5922 | static int ipw_wx_get_power(struct net_device *dev, |
5869 | struct iw_request_info *info, | 5923 | struct iw_request_info *info, |
5870 | union iwreq_data *wrqu, char *extra) | 5924 | union iwreq_data *wrqu, char *extra) |
5871 | { | 5925 | { |
5872 | struct ipw_priv *priv = ieee80211_priv(dev); | 5926 | struct ipw_priv *priv = ieee80211_priv(dev); |
5873 | 5927 | ||
@@ -5883,8 +5937,8 @@ static int ipw_wx_get_power(struct net_device *dev, | |||
5883 | } | 5937 | } |
5884 | 5938 | ||
5885 | static int ipw_wx_set_powermode(struct net_device *dev, | 5939 | static int ipw_wx_set_powermode(struct net_device *dev, |
5886 | struct iw_request_info *info, | 5940 | struct iw_request_info *info, |
5887 | union iwreq_data *wrqu, char *extra) | 5941 | union iwreq_data *wrqu, char *extra) |
5888 | { | 5942 | { |
5889 | struct ipw_priv *priv = ieee80211_priv(dev); | 5943 | struct ipw_priv *priv = ieee80211_priv(dev); |
5890 | int mode = *(int *)extra; | 5944 | int mode = *(int *)extra; |
@@ -5911,8 +5965,8 @@ static int ipw_wx_set_powermode(struct net_device *dev, | |||
5911 | 5965 | ||
5912 | #define MAX_WX_STRING 80 | 5966 | #define MAX_WX_STRING 80 |
5913 | static int ipw_wx_get_powermode(struct net_device *dev, | 5967 | static int ipw_wx_get_powermode(struct net_device *dev, |
5914 | struct iw_request_info *info, | 5968 | struct iw_request_info *info, |
5915 | union iwreq_data *wrqu, char *extra) | 5969 | union iwreq_data *wrqu, char *extra) |
5916 | { | 5970 | { |
5917 | struct ipw_priv *priv = ieee80211_priv(dev); | 5971 | struct ipw_priv *priv = ieee80211_priv(dev); |
5918 | int level = IPW_POWER_LEVEL(priv->power_mode); | 5972 | int level = IPW_POWER_LEVEL(priv->power_mode); |
@@ -5935,7 +5989,7 @@ static int ipw_wx_get_powermode(struct net_device *dev, | |||
5935 | } | 5989 | } |
5936 | 5990 | ||
5937 | if (!(priv->power_mode & IPW_POWER_ENABLED)) | 5991 | if (!(priv->power_mode & IPW_POWER_ENABLED)) |
5938 | p += snprintf(p, MAX_WX_STRING - (p - extra)," OFF"); | 5992 | p += snprintf(p, MAX_WX_STRING - (p - extra), " OFF"); |
5939 | 5993 | ||
5940 | wrqu->data.length = p - extra + 1; | 5994 | wrqu->data.length = p - extra + 1; |
5941 | 5995 | ||
@@ -5943,16 +5997,15 @@ static int ipw_wx_get_powermode(struct net_device *dev, | |||
5943 | } | 5997 | } |
5944 | 5998 | ||
5945 | static int ipw_wx_set_wireless_mode(struct net_device *dev, | 5999 | static int ipw_wx_set_wireless_mode(struct net_device *dev, |
5946 | struct iw_request_info *info, | 6000 | struct iw_request_info *info, |
5947 | union iwreq_data *wrqu, char *extra) | 6001 | union iwreq_data *wrqu, char *extra) |
5948 | { | 6002 | { |
5949 | struct ipw_priv *priv = ieee80211_priv(dev); | 6003 | struct ipw_priv *priv = ieee80211_priv(dev); |
5950 | int mode = *(int *)extra; | 6004 | int mode = *(int *)extra; |
5951 | u8 band = 0, modulation = 0; | 6005 | u8 band = 0, modulation = 0; |
5952 | 6006 | ||
5953 | if (mode == 0 || mode & ~IEEE_MODE_MASK) { | 6007 | if (mode == 0 || mode & ~IEEE_MODE_MASK) { |
5954 | IPW_WARNING("Attempt to set invalid wireless mode: %d\n", | 6008 | IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); |
5955 | mode); | ||
5956 | return -EINVAL; | 6009 | return -EINVAL; |
5957 | } | 6010 | } |
5958 | 6011 | ||
@@ -5988,31 +6041,30 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
5988 | priv->ieee->mode = mode; | 6041 | priv->ieee->mode = mode; |
5989 | priv->ieee->freq_band = band; | 6042 | priv->ieee->freq_band = band; |
5990 | priv->ieee->modulation = modulation; | 6043 | priv->ieee->modulation = modulation; |
5991 | init_supported_rates(priv, &priv->rates); | 6044 | init_supported_rates(priv, &priv->rates); |
5992 | 6045 | ||
5993 | /* If we are currently associated, or trying to associate | 6046 | /* If we are currently associated, or trying to associate |
5994 | * then see if this is a new configuration (causing us to | 6047 | * then see if this is a new configuration (causing us to |
5995 | * disassociate) */ | 6048 | * disassociate) */ |
5996 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 6049 | if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { |
5997 | /* The resulting association will trigger | 6050 | /* The resulting association will trigger |
5998 | * the new rates to be sent to the device */ | 6051 | * the new rates to be sent to the device */ |
5999 | IPW_DEBUG_ASSOC("Disassociating due to mode change.\n"); | 6052 | IPW_DEBUG_ASSOC("Disassociating due to mode change.\n"); |
6000 | ipw_disassociate(priv); | 6053 | ipw_disassociate(priv); |
6001 | } else | 6054 | } else |
6002 | ipw_send_supported_rates(priv, &priv->rates); | 6055 | ipw_send_supported_rates(priv, &priv->rates); |
6003 | 6056 | ||
6004 | IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", | 6057 | IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", |
6005 | mode & IEEE_A ? 'a' : '.', | 6058 | mode & IEEE_A ? 'a' : '.', |
6006 | mode & IEEE_B ? 'b' : '.', | 6059 | mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); |
6007 | mode & IEEE_G ? 'g' : '.'); | ||
6008 | return 0; | 6060 | return 0; |
6009 | } | 6061 | } |
6010 | 6062 | ||
6011 | static int ipw_wx_get_wireless_mode(struct net_device *dev, | 6063 | static int ipw_wx_get_wireless_mode(struct net_device *dev, |
6012 | struct iw_request_info *info, | 6064 | struct iw_request_info *info, |
6013 | union iwreq_data *wrqu, char *extra) | 6065 | union iwreq_data *wrqu, char *extra) |
6014 | { | 6066 | { |
6015 | struct ipw_priv *priv = ieee80211_priv(dev); | 6067 | struct ipw_priv *priv = ieee80211_priv(dev); |
6016 | 6068 | ||
6017 | switch (priv->ieee->freq_band) { | 6069 | switch (priv->ieee->freq_band) { |
6018 | case IEEE80211_24GHZ_BAND: | 6070 | case IEEE80211_24GHZ_BAND: |
@@ -6033,7 +6085,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, | |||
6033 | strncpy(extra, "802.11a (1)", MAX_WX_STRING); | 6085 | strncpy(extra, "802.11a (1)", MAX_WX_STRING); |
6034 | break; | 6086 | break; |
6035 | 6087 | ||
6036 | default: /* Mixed Band */ | 6088 | default: /* Mixed Band */ |
6037 | switch (priv->ieee->modulation) { | 6089 | switch (priv->ieee->modulation) { |
6038 | case IEEE80211_CCK_MODULATION: | 6090 | case IEEE80211_CCK_MODULATION: |
6039 | strncpy(extra, "802.11ab (3)", MAX_WX_STRING); | 6091 | strncpy(extra, "802.11ab (3)", MAX_WX_STRING); |
@@ -6050,9 +6102,9 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, | |||
6050 | 6102 | ||
6051 | IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); | 6103 | IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); |
6052 | 6104 | ||
6053 | wrqu->data.length = strlen(extra) + 1; | 6105 | wrqu->data.length = strlen(extra) + 1; |
6054 | 6106 | ||
6055 | return 0; | 6107 | return 0; |
6056 | } | 6108 | } |
6057 | 6109 | ||
6058 | #ifdef CONFIG_IPW_PROMISC | 6110 | #ifdef CONFIG_IPW_PROMISC |
@@ -6081,7 +6133,6 @@ static int ipw_wx_set_promisc(struct net_device *dev, | |||
6081 | return 0; | 6133 | return 0; |
6082 | } | 6134 | } |
6083 | 6135 | ||
6084 | |||
6085 | static int ipw_wx_reset(struct net_device *dev, | 6136 | static int ipw_wx_reset(struct net_device *dev, |
6086 | struct iw_request_info *info, | 6137 | struct iw_request_info *info, |
6087 | union iwreq_data *wrqu, char *extra) | 6138 | union iwreq_data *wrqu, char *extra) |
@@ -6091,40 +6142,39 @@ static int ipw_wx_reset(struct net_device *dev, | |||
6091 | ipw_adapter_restart(priv); | 6142 | ipw_adapter_restart(priv); |
6092 | return 0; | 6143 | return 0; |
6093 | } | 6144 | } |
6094 | #endif // CONFIG_IPW_PROMISC | 6145 | #endif // CONFIG_IPW_PROMISC |
6095 | 6146 | ||
6096 | /* Rebase the WE IOCTLs to zero for the handler array */ | 6147 | /* Rebase the WE IOCTLs to zero for the handler array */ |
6097 | #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] | 6148 | #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] |
6098 | static iw_handler ipw_wx_handlers[] = | 6149 | static iw_handler ipw_wx_handlers[] = { |
6099 | { | 6150 | IW_IOCTL(SIOCGIWNAME) = ipw_wx_get_name, |
6100 | IW_IOCTL(SIOCGIWNAME) = ipw_wx_get_name, | 6151 | IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, |
6101 | IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, | 6152 | IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, |
6102 | IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, | 6153 | IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, |
6103 | IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, | 6154 | IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode, |
6104 | IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode, | 6155 | IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range, |
6105 | IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range, | 6156 | IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap, |
6106 | IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap, | 6157 | IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap, |
6107 | IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap, | 6158 | IW_IOCTL(SIOCSIWSCAN) = ipw_wx_set_scan, |
6108 | IW_IOCTL(SIOCSIWSCAN) = ipw_wx_set_scan, | 6159 | IW_IOCTL(SIOCGIWSCAN) = ipw_wx_get_scan, |
6109 | IW_IOCTL(SIOCGIWSCAN) = ipw_wx_get_scan, | 6160 | IW_IOCTL(SIOCSIWESSID) = ipw_wx_set_essid, |
6110 | IW_IOCTL(SIOCSIWESSID) = ipw_wx_set_essid, | 6161 | IW_IOCTL(SIOCGIWESSID) = ipw_wx_get_essid, |
6111 | IW_IOCTL(SIOCGIWESSID) = ipw_wx_get_essid, | 6162 | IW_IOCTL(SIOCSIWNICKN) = ipw_wx_set_nick, |
6112 | IW_IOCTL(SIOCSIWNICKN) = ipw_wx_set_nick, | 6163 | IW_IOCTL(SIOCGIWNICKN) = ipw_wx_get_nick, |
6113 | IW_IOCTL(SIOCGIWNICKN) = ipw_wx_get_nick, | 6164 | IW_IOCTL(SIOCSIWRATE) = ipw_wx_set_rate, |
6114 | IW_IOCTL(SIOCSIWRATE) = ipw_wx_set_rate, | 6165 | IW_IOCTL(SIOCGIWRATE) = ipw_wx_get_rate, |
6115 | IW_IOCTL(SIOCGIWRATE) = ipw_wx_get_rate, | 6166 | IW_IOCTL(SIOCSIWRTS) = ipw_wx_set_rts, |
6116 | IW_IOCTL(SIOCSIWRTS) = ipw_wx_set_rts, | 6167 | IW_IOCTL(SIOCGIWRTS) = ipw_wx_get_rts, |
6117 | IW_IOCTL(SIOCGIWRTS) = ipw_wx_get_rts, | 6168 | IW_IOCTL(SIOCSIWFRAG) = ipw_wx_set_frag, |
6118 | IW_IOCTL(SIOCSIWFRAG) = ipw_wx_set_frag, | 6169 | IW_IOCTL(SIOCGIWFRAG) = ipw_wx_get_frag, |
6119 | IW_IOCTL(SIOCGIWFRAG) = ipw_wx_get_frag, | 6170 | IW_IOCTL(SIOCSIWTXPOW) = ipw_wx_set_txpow, |
6120 | IW_IOCTL(SIOCSIWTXPOW) = ipw_wx_set_txpow, | 6171 | IW_IOCTL(SIOCGIWTXPOW) = ipw_wx_get_txpow, |
6121 | IW_IOCTL(SIOCGIWTXPOW) = ipw_wx_get_txpow, | 6172 | IW_IOCTL(SIOCSIWRETRY) = ipw_wx_set_retry, |
6122 | IW_IOCTL(SIOCSIWRETRY) = ipw_wx_set_retry, | 6173 | IW_IOCTL(SIOCGIWRETRY) = ipw_wx_get_retry, |
6123 | IW_IOCTL(SIOCGIWRETRY) = ipw_wx_get_retry, | 6174 | IW_IOCTL(SIOCSIWENCODE) = ipw_wx_set_encode, |
6124 | IW_IOCTL(SIOCSIWENCODE) = ipw_wx_set_encode, | 6175 | IW_IOCTL(SIOCGIWENCODE) = ipw_wx_get_encode, |
6125 | IW_IOCTL(SIOCGIWENCODE) = ipw_wx_get_encode, | 6176 | IW_IOCTL(SIOCSIWPOWER) = ipw_wx_set_power, |
6126 | IW_IOCTL(SIOCSIWPOWER) = ipw_wx_set_power, | 6177 | IW_IOCTL(SIOCGIWPOWER) = ipw_wx_get_power, |
6127 | IW_IOCTL(SIOCGIWPOWER) = ipw_wx_get_power, | ||
6128 | }; | 6178 | }; |
6129 | 6179 | ||
6130 | #define IPW_PRIV_SET_POWER SIOCIWFIRSTPRIV | 6180 | #define IPW_PRIV_SET_POWER SIOCIWFIRSTPRIV |
@@ -6134,38 +6184,31 @@ static iw_handler ipw_wx_handlers[] = | |||
6134 | #define IPW_PRIV_SET_PROMISC SIOCIWFIRSTPRIV+4 | 6184 | #define IPW_PRIV_SET_PROMISC SIOCIWFIRSTPRIV+4 |
6135 | #define IPW_PRIV_RESET SIOCIWFIRSTPRIV+5 | 6185 | #define IPW_PRIV_RESET SIOCIWFIRSTPRIV+5 |
6136 | 6186 | ||
6137 | |||
6138 | static struct iw_priv_args ipw_priv_args[] = { | 6187 | static struct iw_priv_args ipw_priv_args[] = { |
6139 | { | 6188 | { |
6140 | .cmd = IPW_PRIV_SET_POWER, | 6189 | .cmd = IPW_PRIV_SET_POWER, |
6141 | .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, | 6190 | .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
6142 | .name = "set_power" | 6191 | .name = "set_power"}, |
6143 | }, | ||
6144 | { | 6192 | { |
6145 | .cmd = IPW_PRIV_GET_POWER, | 6193 | .cmd = IPW_PRIV_GET_POWER, |
6146 | .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, | 6194 | .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, |
6147 | .name = "get_power" | 6195 | .name = "get_power"}, |
6148 | }, | ||
6149 | { | 6196 | { |
6150 | .cmd = IPW_PRIV_SET_MODE, | 6197 | .cmd = IPW_PRIV_SET_MODE, |
6151 | .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, | 6198 | .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
6152 | .name = "set_mode" | 6199 | .name = "set_mode"}, |
6153 | }, | ||
6154 | { | 6200 | { |
6155 | .cmd = IPW_PRIV_GET_MODE, | 6201 | .cmd = IPW_PRIV_GET_MODE, |
6156 | .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, | 6202 | .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, |
6157 | .name = "get_mode" | 6203 | .name = "get_mode"}, |
6158 | }, | ||
6159 | #ifdef CONFIG_IPW_PROMISC | 6204 | #ifdef CONFIG_IPW_PROMISC |
6160 | { | 6205 | { |
6161 | IPW_PRIV_SET_PROMISC, | 6206 | IPW_PRIV_SET_PROMISC, |
6162 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor" | 6207 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, |
6163 | }, | ||
6164 | { | 6208 | { |
6165 | IPW_PRIV_RESET, | 6209 | IPW_PRIV_RESET, |
6166 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset" | 6210 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, |
6167 | }, | 6211 | #endif /* CONFIG_IPW_PROMISC */ |
6168 | #endif /* CONFIG_IPW_PROMISC */ | ||
6169 | }; | 6212 | }; |
6170 | 6213 | ||
6171 | static iw_handler ipw_priv_handler[] = { | 6214 | static iw_handler ipw_priv_handler[] = { |
@@ -6179,25 +6222,21 @@ static iw_handler ipw_priv_handler[] = { | |||
6179 | #endif | 6222 | #endif |
6180 | }; | 6223 | }; |
6181 | 6224 | ||
6182 | static struct iw_handler_def ipw_wx_handler_def = | 6225 | static struct iw_handler_def ipw_wx_handler_def = { |
6183 | { | 6226 | .standard = ipw_wx_handlers, |
6184 | .standard = ipw_wx_handlers, | 6227 | .num_standard = ARRAY_SIZE(ipw_wx_handlers), |
6185 | .num_standard = ARRAY_SIZE(ipw_wx_handlers), | 6228 | .num_private = ARRAY_SIZE(ipw_priv_handler), |
6186 | .num_private = ARRAY_SIZE(ipw_priv_handler), | 6229 | .num_private_args = ARRAY_SIZE(ipw_priv_args), |
6187 | .num_private_args = ARRAY_SIZE(ipw_priv_args), | 6230 | .private = ipw_priv_handler, |
6188 | .private = ipw_priv_handler, | 6231 | .private_args = ipw_priv_args, |
6189 | .private_args = ipw_priv_args, | ||
6190 | }; | 6232 | }; |
6191 | 6233 | ||
6192 | |||
6193 | |||
6194 | |||
6195 | /* | 6234 | /* |
6196 | * Get wireless statistics. | 6235 | * Get wireless statistics. |
6197 | * Called by /proc/net/wireless | 6236 | * Called by /proc/net/wireless |
6198 | * Also called by SIOCGIWSTATS | 6237 | * Also called by SIOCGIWSTATS |
6199 | */ | 6238 | */ |
6200 | static struct iw_statistics *ipw_get_wireless_stats(struct net_device * dev) | 6239 | static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev) |
6201 | { | 6240 | { |
6202 | struct ipw_priv *priv = ieee80211_priv(dev); | 6241 | struct ipw_priv *priv = ieee80211_priv(dev); |
6203 | struct iw_statistics *wstats; | 6242 | struct iw_statistics *wstats; |
@@ -6217,7 +6256,7 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device * dev) | |||
6217 | wstats->qual.noise = 0; | 6256 | wstats->qual.noise = 0; |
6218 | wstats->qual.updated = 7; | 6257 | wstats->qual.updated = 7; |
6219 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID | | 6258 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID | |
6220 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; | 6259 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; |
6221 | return wstats; | 6260 | return wstats; |
6222 | } | 6261 | } |
6223 | 6262 | ||
@@ -6225,7 +6264,7 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device * dev) | |||
6225 | wstats->qual.level = average_value(&priv->average_rssi); | 6264 | wstats->qual.level = average_value(&priv->average_rssi); |
6226 | wstats->qual.noise = average_value(&priv->average_noise); | 6265 | wstats->qual.noise = average_value(&priv->average_noise); |
6227 | wstats->qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | | 6266 | wstats->qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | |
6228 | IW_QUAL_NOISE_UPDATED; | 6267 | IW_QUAL_NOISE_UPDATED; |
6229 | 6268 | ||
6230 | wstats->miss.beacon = average_value(&priv->average_missed_beacons); | 6269 | wstats->miss.beacon = average_value(&priv->average_missed_beacons); |
6231 | wstats->discard.retries = priv->last_tx_failures; | 6270 | wstats->discard.retries = priv->last_tx_failures; |
@@ -6238,13 +6277,12 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device * dev) | |||
6238 | return wstats; | 6277 | return wstats; |
6239 | } | 6278 | } |
6240 | 6279 | ||
6241 | |||
6242 | /* net device stuff */ | 6280 | /* net device stuff */ |
6243 | 6281 | ||
6244 | static inline void init_sys_config(struct ipw_sys_config *sys_config) | 6282 | static inline void init_sys_config(struct ipw_sys_config *sys_config) |
6245 | { | 6283 | { |
6246 | memset(sys_config, 0, sizeof(struct ipw_sys_config)); | 6284 | memset(sys_config, 0, sizeof(struct ipw_sys_config)); |
6247 | sys_config->bt_coexistence = 1; /* We may need to look into prvStaBtConfig */ | 6285 | sys_config->bt_coexistence = 1; /* We may need to look into prvStaBtConfig */ |
6248 | sys_config->answer_broadcast_ssid_probe = 0; | 6286 | sys_config->answer_broadcast_ssid_probe = 0; |
6249 | sys_config->accept_all_data_frames = 0; | 6287 | sys_config->accept_all_data_frames = 0; |
6250 | sys_config->accept_non_directed_frames = 1; | 6288 | sys_config->accept_non_directed_frames = 1; |
@@ -6253,7 +6291,7 @@ static inline void init_sys_config(struct ipw_sys_config *sys_config) | |||
6253 | sys_config->exclude_multicast_unencrypted = 0; | 6291 | sys_config->exclude_multicast_unencrypted = 0; |
6254 | sys_config->disable_multicast_decryption = 1; | 6292 | sys_config->disable_multicast_decryption = 1; |
6255 | sys_config->antenna_diversity = CFG_SYS_ANTENNA_BOTH; | 6293 | sys_config->antenna_diversity = CFG_SYS_ANTENNA_BOTH; |
6256 | sys_config->pass_crc_to_host = 0; /* TODO: See if 1 gives us FCS */ | 6294 | sys_config->pass_crc_to_host = 0; /* TODO: See if 1 gives us FCS */ |
6257 | sys_config->dot11g_auto_detection = 0; | 6295 | sys_config->dot11g_auto_detection = 0; |
6258 | sys_config->enable_cts_to_self = 0; | 6296 | sys_config->enable_cts_to_self = 0; |
6259 | sys_config->bt_coexist_collision_thr = 0; | 6297 | sys_config->bt_coexist_collision_thr = 0; |
@@ -6288,7 +6326,7 @@ we need to heavily modify the ieee80211_skb_to_txb. | |||
6288 | static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | 6326 | static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) |
6289 | { | 6327 | { |
6290 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) | 6328 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) |
6291 | txb->fragments[0]->data; | 6329 | txb->fragments[0]->data; |
6292 | int i = 0; | 6330 | int i = 0; |
6293 | struct tfd_frame *tfd; | 6331 | struct tfd_frame *tfd; |
6294 | struct clx2_tx_queue *txq = &priv->txq[0]; | 6332 | struct clx2_tx_queue *txq = &priv->txq[0]; |
@@ -6300,7 +6338,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6300 | case IW_MODE_ADHOC: | 6338 | case IW_MODE_ADHOC: |
6301 | hdr_len = IEEE80211_3ADDR_LEN; | 6339 | hdr_len = IEEE80211_3ADDR_LEN; |
6302 | unicast = !is_broadcast_ether_addr(hdr->addr1) && | 6340 | unicast = !is_broadcast_ether_addr(hdr->addr1) && |
6303 | !is_multicast_ether_addr(hdr->addr1); | 6341 | !is_multicast_ether_addr(hdr->addr1); |
6304 | id = ipw_find_station(priv, hdr->addr1); | 6342 | id = ipw_find_station(priv, hdr->addr1); |
6305 | if (id == IPW_INVALID_STATION) { | 6343 | if (id == IPW_INVALID_STATION) { |
6306 | id = ipw_add_station(priv, hdr->addr1); | 6344 | id = ipw_add_station(priv, hdr->addr1); |
@@ -6316,7 +6354,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6316 | case IW_MODE_INFRA: | 6354 | case IW_MODE_INFRA: |
6317 | default: | 6355 | default: |
6318 | unicast = !is_broadcast_ether_addr(hdr->addr3) && | 6356 | unicast = !is_broadcast_ether_addr(hdr->addr3) && |
6319 | !is_multicast_ether_addr(hdr->addr3); | 6357 | !is_multicast_ether_addr(hdr->addr3); |
6320 | hdr_len = IEEE80211_3ADDR_LEN; | 6358 | hdr_len = IEEE80211_3ADDR_LEN; |
6321 | id = 0; | 6359 | id = 0; |
6322 | break; | 6360 | break; |
@@ -6349,7 +6387,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6349 | memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len); | 6387 | memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len); |
6350 | 6388 | ||
6351 | /* payload */ | 6389 | /* payload */ |
6352 | tfd->u.data.num_chunks = min((u8)(NUM_TFD_CHUNKS - 2), txb->nr_frags); | 6390 | tfd->u.data.num_chunks = min((u8) (NUM_TFD_CHUNKS - 2), txb->nr_frags); |
6353 | for (i = 0; i < tfd->u.data.num_chunks; i++) { | 6391 | for (i = 0; i < tfd->u.data.num_chunks; i++) { |
6354 | IPW_DEBUG_TX("Dumping TX packet frag %i of %i (%d bytes):\n", | 6392 | IPW_DEBUG_TX("Dumping TX packet frag %i of %i (%d bytes):\n", |
6355 | i, tfd->u.data.num_chunks, | 6393 | i, tfd->u.data.num_chunks, |
@@ -6357,9 +6395,11 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6357 | printk_buf(IPW_DL_TX, txb->fragments[i]->data + hdr_len, | 6395 | printk_buf(IPW_DL_TX, txb->fragments[i]->data + hdr_len, |
6358 | txb->fragments[i]->len - hdr_len); | 6396 | txb->fragments[i]->len - hdr_len); |
6359 | 6397 | ||
6360 | tfd->u.data.chunk_ptr[i] = pci_map_single( | 6398 | tfd->u.data.chunk_ptr[i] = |
6361 | priv->pci_dev, txb->fragments[i]->data + hdr_len, | 6399 | pci_map_single(priv->pci_dev, |
6362 | txb->fragments[i]->len - hdr_len, PCI_DMA_TODEVICE); | 6400 | txb->fragments[i]->data + hdr_len, |
6401 | txb->fragments[i]->len - hdr_len, | ||
6402 | PCI_DMA_TODEVICE); | ||
6363 | tfd->u.data.chunk_len[i] = txb->fragments[i]->len - hdr_len; | 6403 | tfd->u.data.chunk_len[i] = txb->fragments[i]->len - hdr_len; |
6364 | } | 6404 | } |
6365 | 6405 | ||
@@ -6379,16 +6419,16 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6379 | for (j = i; j < txb->nr_frags; j++) { | 6419 | for (j = i; j < txb->nr_frags; j++) { |
6380 | int size = txb->fragments[j]->len - hdr_len; | 6420 | int size = txb->fragments[j]->len - hdr_len; |
6381 | printk(KERN_INFO "Adding frag %d %d...\n", | 6421 | printk(KERN_INFO "Adding frag %d %d...\n", |
6382 | j, size); | 6422 | j, size); |
6383 | memcpy(skb_put(skb, size), | 6423 | memcpy(skb_put(skb, size), |
6384 | txb->fragments[j]->data + hdr_len, | 6424 | txb->fragments[j]->data + hdr_len, size); |
6385 | size); | ||
6386 | } | 6425 | } |
6387 | dev_kfree_skb_any(txb->fragments[i]); | 6426 | dev_kfree_skb_any(txb->fragments[i]); |
6388 | txb->fragments[i] = skb; | 6427 | txb->fragments[i] = skb; |
6389 | tfd->u.data.chunk_ptr[i] = pci_map_single( | 6428 | tfd->u.data.chunk_ptr[i] = |
6390 | priv->pci_dev, skb->data, | 6429 | pci_map_single(priv->pci_dev, skb->data, |
6391 | tfd->u.data.chunk_len[i], PCI_DMA_TODEVICE); | 6430 | tfd->u.data.chunk_len[i], |
6431 | PCI_DMA_TODEVICE); | ||
6392 | tfd->u.data.num_chunks++; | 6432 | tfd->u.data.num_chunks++; |
6393 | } | 6433 | } |
6394 | } | 6434 | } |
@@ -6402,7 +6442,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6402 | 6442 | ||
6403 | return; | 6443 | return; |
6404 | 6444 | ||
6405 | drop: | 6445 | drop: |
6406 | IPW_DEBUG_DROP("Silently dropping Tx packet.\n"); | 6446 | IPW_DEBUG_DROP("Silently dropping Tx packet.\n"); |
6407 | ieee80211_txb_free(txb); | 6447 | ieee80211_txb_free(txb); |
6408 | } | 6448 | } |
@@ -6429,7 +6469,7 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, | |||
6429 | spin_unlock_irqrestore(&priv->lock, flags); | 6469 | spin_unlock_irqrestore(&priv->lock, flags); |
6430 | return 0; | 6470 | return 0; |
6431 | 6471 | ||
6432 | fail_unlock: | 6472 | fail_unlock: |
6433 | spin_unlock_irqrestore(&priv->lock, flags); | 6473 | spin_unlock_irqrestore(&priv->lock, flags); |
6434 | return 1; | 6474 | return 1; |
6435 | } | 6475 | } |
@@ -6478,7 +6518,7 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, | |||
6478 | len = sizeof(date); | 6518 | len = sizeof(date); |
6479 | ipw_get_ordinal(p, IPW_ORD_STAT_FW_DATE, date, &len); | 6519 | ipw_get_ordinal(p, IPW_ORD_STAT_FW_DATE, date, &len); |
6480 | 6520 | ||
6481 | snprintf(info->fw_version, sizeof(info->fw_version),"%s (%s)", | 6521 | snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", |
6482 | vers, date); | 6522 | vers, date); |
6483 | strcpy(info->bus_info, pci_name(p->pci_dev)); | 6523 | strcpy(info->bus_info, pci_name(p->pci_dev)); |
6484 | info->eedump_len = CX2_EEPROM_IMAGE_SIZE; | 6524 | info->eedump_len = CX2_EEPROM_IMAGE_SIZE; |
@@ -6496,19 +6536,19 @@ static int ipw_ethtool_get_eeprom_len(struct net_device *dev) | |||
6496 | } | 6536 | } |
6497 | 6537 | ||
6498 | static int ipw_ethtool_get_eeprom(struct net_device *dev, | 6538 | static int ipw_ethtool_get_eeprom(struct net_device *dev, |
6499 | struct ethtool_eeprom *eeprom, u8 *bytes) | 6539 | struct ethtool_eeprom *eeprom, u8 * bytes) |
6500 | { | 6540 | { |
6501 | struct ipw_priv *p = ieee80211_priv(dev); | 6541 | struct ipw_priv *p = ieee80211_priv(dev); |
6502 | 6542 | ||
6503 | if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) | 6543 | if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) |
6504 | return -EINVAL; | 6544 | return -EINVAL; |
6505 | 6545 | ||
6506 | memcpy(bytes, &((u8 *)p->eeprom)[eeprom->offset], eeprom->len); | 6546 | memcpy(bytes, &((u8 *) p->eeprom)[eeprom->offset], eeprom->len); |
6507 | return 0; | 6547 | return 0; |
6508 | } | 6548 | } |
6509 | 6549 | ||
6510 | static int ipw_ethtool_set_eeprom(struct net_device *dev, | 6550 | static int ipw_ethtool_set_eeprom(struct net_device *dev, |
6511 | struct ethtool_eeprom *eeprom, u8 *bytes) | 6551 | struct ethtool_eeprom *eeprom, u8 * bytes) |
6512 | { | 6552 | { |
6513 | struct ipw_priv *p = ieee80211_priv(dev); | 6553 | struct ipw_priv *p = ieee80211_priv(dev); |
6514 | int i; | 6554 | int i; |
@@ -6516,21 +6556,20 @@ static int ipw_ethtool_set_eeprom(struct net_device *dev, | |||
6516 | if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) | 6556 | if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) |
6517 | return -EINVAL; | 6557 | return -EINVAL; |
6518 | 6558 | ||
6519 | memcpy(&((u8 *)p->eeprom)[eeprom->offset], bytes, eeprom->len); | 6559 | memcpy(&((u8 *) p->eeprom)[eeprom->offset], bytes, eeprom->len); |
6520 | for (i = IPW_EEPROM_DATA; | 6560 | for (i = IPW_EEPROM_DATA; |
6521 | i < IPW_EEPROM_DATA + CX2_EEPROM_IMAGE_SIZE; | 6561 | i < IPW_EEPROM_DATA + CX2_EEPROM_IMAGE_SIZE; i++) |
6522 | i++) | ||
6523 | ipw_write8(p, i, p->eeprom[i]); | 6562 | ipw_write8(p, i, p->eeprom[i]); |
6524 | 6563 | ||
6525 | return 0; | 6564 | return 0; |
6526 | } | 6565 | } |
6527 | 6566 | ||
6528 | static struct ethtool_ops ipw_ethtool_ops = { | 6567 | static struct ethtool_ops ipw_ethtool_ops = { |
6529 | .get_link = ipw_ethtool_get_link, | 6568 | .get_link = ipw_ethtool_get_link, |
6530 | .get_drvinfo = ipw_ethtool_get_drvinfo, | 6569 | .get_drvinfo = ipw_ethtool_get_drvinfo, |
6531 | .get_eeprom_len = ipw_ethtool_get_eeprom_len, | 6570 | .get_eeprom_len = ipw_ethtool_get_eeprom_len, |
6532 | .get_eeprom = ipw_ethtool_get_eeprom, | 6571 | .get_eeprom = ipw_ethtool_get_eeprom, |
6533 | .set_eeprom = ipw_ethtool_set_eeprom, | 6572 | .set_eeprom = ipw_ethtool_set_eeprom, |
6534 | }; | 6573 | }; |
6535 | 6574 | ||
6536 | static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) | 6575 | static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) |
@@ -6574,10 +6613,10 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) | |||
6574 | 6613 | ||
6575 | tasklet_schedule(&priv->irq_tasklet); | 6614 | tasklet_schedule(&priv->irq_tasklet); |
6576 | 6615 | ||
6577 | spin_unlock(&priv->lock); | 6616 | spin_unlock(&priv->lock); |
6578 | 6617 | ||
6579 | return IRQ_HANDLED; | 6618 | return IRQ_HANDLED; |
6580 | none: | 6619 | none: |
6581 | spin_unlock(&priv->lock); | 6620 | spin_unlock(&priv->lock); |
6582 | return IRQ_NONE; | 6621 | return IRQ_NONE; |
6583 | } | 6622 | } |
@@ -6609,7 +6648,7 @@ static void ipw_rf_kill(void *adapter) | |||
6609 | IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " | 6648 | IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " |
6610 | "enabled\n"); | 6649 | "enabled\n"); |
6611 | 6650 | ||
6612 | exit_unlock: | 6651 | exit_unlock: |
6613 | spin_unlock_irqrestore(&priv->lock, flags); | 6652 | spin_unlock_irqrestore(&priv->lock, flags); |
6614 | } | 6653 | } |
6615 | 6654 | ||
@@ -6642,7 +6681,6 @@ static int ipw_setup_deferred_work(struct ipw_priv *priv) | |||
6642 | return ret; | 6681 | return ret; |
6643 | } | 6682 | } |
6644 | 6683 | ||
6645 | |||
6646 | static void shim__set_security(struct net_device *dev, | 6684 | static void shim__set_security(struct net_device *dev, |
6647 | struct ieee80211_security *sec) | 6685 | struct ieee80211_security *sec) |
6648 | { | 6686 | { |
@@ -6683,8 +6721,7 @@ static void shim__set_security(struct net_device *dev, | |||
6683 | priv->status |= STATUS_SECURITY_UPDATED; | 6721 | priv->status |= STATUS_SECURITY_UPDATED; |
6684 | } | 6722 | } |
6685 | 6723 | ||
6686 | if (sec->flags & SEC_ENABLED && | 6724 | if (sec->flags & SEC_ENABLED && priv->sec.enabled != sec->enabled) { |
6687 | priv->sec.enabled != sec->enabled) { | ||
6688 | priv->sec.flags |= SEC_ENABLED; | 6725 | priv->sec.flags |= SEC_ENABLED; |
6689 | priv->sec.enabled = sec->enabled; | 6726 | priv->sec.enabled = sec->enabled; |
6690 | priv->status |= STATUS_SECURITY_UPDATED; | 6727 | priv->status |= STATUS_SECURITY_UPDATED; |
@@ -6694,8 +6731,7 @@ static void shim__set_security(struct net_device *dev, | |||
6694 | priv->capability &= ~CAP_PRIVACY_ON; | 6731 | priv->capability &= ~CAP_PRIVACY_ON; |
6695 | } | 6732 | } |
6696 | 6733 | ||
6697 | if (sec->flags & SEC_LEVEL && | 6734 | if (sec->flags & SEC_LEVEL && priv->sec.level != sec->level) { |
6698 | priv->sec.level != sec->level) { | ||
6699 | priv->sec.level = sec->level; | 6735 | priv->sec.level = sec->level; |
6700 | priv->sec.flags |= SEC_LEVEL; | 6736 | priv->sec.flags |= SEC_LEVEL; |
6701 | priv->status |= STATUS_SECURITY_UPDATED; | 6737 | priv->status |= STATUS_SECURITY_UPDATED; |
@@ -6709,7 +6745,7 @@ static void shim__set_security(struct net_device *dev, | |||
6709 | (((priv->assoc_request.capability & | 6745 | (((priv->assoc_request.capability & |
6710 | WLAN_CAPABILITY_PRIVACY) && !sec->enabled) || | 6746 | WLAN_CAPABILITY_PRIVACY) && !sec->enabled) || |
6711 | (!(priv->assoc_request.capability & | 6747 | (!(priv->assoc_request.capability & |
6712 | WLAN_CAPABILITY_PRIVACY) && sec->enabled))) { | 6748 | WLAN_CAPABILITY_PRIVACY) && sec->enabled))) { |
6713 | IPW_DEBUG_ASSOC("Disassociating due to capability " | 6749 | IPW_DEBUG_ASSOC("Disassociating due to capability " |
6714 | "change.\n"); | 6750 | "change.\n"); |
6715 | ipw_disassociate(priv); | 6751 | ipw_disassociate(priv); |
@@ -6723,7 +6759,7 @@ static int init_supported_rates(struct ipw_priv *priv, | |||
6723 | /* TODO: Mask out rates based on priv->rates_mask */ | 6759 | /* TODO: Mask out rates based on priv->rates_mask */ |
6724 | 6760 | ||
6725 | memset(rates, 0, sizeof(*rates)); | 6761 | memset(rates, 0, sizeof(*rates)); |
6726 | /* configure supported rates */ | 6762 | /* configure supported rates */ |
6727 | switch (priv->ieee->freq_band) { | 6763 | switch (priv->ieee->freq_band) { |
6728 | case IEEE80211_52GHZ_BAND: | 6764 | case IEEE80211_52GHZ_BAND: |
6729 | rates->ieee_mode = IPW_A_MODE; | 6765 | rates->ieee_mode = IPW_A_MODE; |
@@ -6732,7 +6768,7 @@ static int init_supported_rates(struct ipw_priv *priv, | |||
6732 | IEEE80211_OFDM_DEFAULT_RATES_MASK); | 6768 | IEEE80211_OFDM_DEFAULT_RATES_MASK); |
6733 | break; | 6769 | break; |
6734 | 6770 | ||
6735 | default: /* Mixed or 2.4Ghz */ | 6771 | default: /* Mixed or 2.4Ghz */ |
6736 | rates->ieee_mode = IPW_G_MODE; | 6772 | rates->ieee_mode = IPW_G_MODE; |
6737 | rates->purpose = IPW_RATE_CAPABILITIES; | 6773 | rates->purpose = IPW_RATE_CAPABILITIES; |
6738 | ipw_add_cck_scan_rates(rates, IEEE80211_CCK_MODULATION, | 6774 | ipw_add_cck_scan_rates(rates, IEEE80211_CCK_MODULATION, |
@@ -6783,8 +6819,8 @@ static int ipw_config(struct ipw_priv *priv) | |||
6783 | if (ipw_send_system_config(priv, &priv->sys_config)) | 6819 | if (ipw_send_system_config(priv, &priv->sys_config)) |
6784 | goto error; | 6820 | goto error; |
6785 | 6821 | ||
6786 | init_supported_rates(priv, &priv->rates); | 6822 | init_supported_rates(priv, &priv->rates); |
6787 | if (ipw_send_supported_rates(priv, &priv->rates)) | 6823 | if (ipw_send_supported_rates(priv, &priv->rates)) |
6788 | goto error; | 6824 | goto error; |
6789 | 6825 | ||
6790 | /* Set request-to-send threshold */ | 6826 | /* Set request-to-send threshold */ |
@@ -6806,7 +6842,7 @@ static int ipw_config(struct ipw_priv *priv) | |||
6806 | 6842 | ||
6807 | return 0; | 6843 | return 0; |
6808 | 6844 | ||
6809 | error: | 6845 | error: |
6810 | return -EIO; | 6846 | return -EIO; |
6811 | } | 6847 | } |
6812 | 6848 | ||
@@ -6818,13 +6854,12 @@ static int ipw_up(struct ipw_priv *priv) | |||
6818 | if (priv->status & STATUS_EXIT_PENDING) | 6854 | if (priv->status & STATUS_EXIT_PENDING) |
6819 | return -EIO; | 6855 | return -EIO; |
6820 | 6856 | ||
6821 | for (i = 0; i < MAX_HW_RESTARTS; i++ ) { | 6857 | for (i = 0; i < MAX_HW_RESTARTS; i++) { |
6822 | /* Load the microcode, firmware, and eeprom. | 6858 | /* Load the microcode, firmware, and eeprom. |
6823 | * Also start the clocks. */ | 6859 | * Also start the clocks. */ |
6824 | rc = ipw_load(priv); | 6860 | rc = ipw_load(priv); |
6825 | if (rc) { | 6861 | if (rc) { |
6826 | IPW_ERROR("Unable to load firmware: 0x%08X\n", | 6862 | IPW_ERROR("Unable to load firmware: 0x%08X\n", rc); |
6827 | rc); | ||
6828 | return rc; | 6863 | return rc; |
6829 | } | 6864 | } |
6830 | 6865 | ||
@@ -6857,8 +6892,7 @@ static int ipw_up(struct ipw_priv *priv) | |||
6857 | 6892 | ||
6858 | /* tried to restart and config the device for as long as our | 6893 | /* tried to restart and config the device for as long as our |
6859 | * patience could withstand */ | 6894 | * patience could withstand */ |
6860 | IPW_ERROR("Unable to initialize device after %d attempts.\n", | 6895 | IPW_ERROR("Unable to initialize device after %d attempts.\n", i); |
6861 | i); | ||
6862 | return -EIO; | 6896 | return -EIO; |
6863 | } | 6897 | } |
6864 | 6898 | ||
@@ -6923,10 +6957,10 @@ static struct pci_device_id card_ids[] = { | |||
6923 | {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2761, 0, 0, 0}, | 6957 | {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2761, 0, 0, 0}, |
6924 | {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2762, 0, 0, 0}, | 6958 | {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2762, 0, 0, 0}, |
6925 | {PCI_VENDOR_ID_INTEL, 0x104f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 6959 | {PCI_VENDOR_ID_INTEL, 0x104f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
6926 | {PCI_VENDOR_ID_INTEL, 0x4220, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* BG */ | 6960 | {PCI_VENDOR_ID_INTEL, 0x4220, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* BG */ |
6927 | {PCI_VENDOR_ID_INTEL, 0x4221, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* 2225BG */ | 6961 | {PCI_VENDOR_ID_INTEL, 0x4221, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* 2225BG */ |
6928 | {PCI_VENDOR_ID_INTEL, 0x4223, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ | 6962 | {PCI_VENDOR_ID_INTEL, 0x4223, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ |
6929 | {PCI_VENDOR_ID_INTEL, 0x4224, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ | 6963 | {PCI_VENDOR_ID_INTEL, 0x4224, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ |
6930 | 6964 | ||
6931 | /* required last entry */ | 6965 | /* required last entry */ |
6932 | {0,} | 6966 | {0,} |
@@ -6954,11 +6988,10 @@ static struct attribute *ipw_sysfs_entries[] = { | |||
6954 | 6988 | ||
6955 | static struct attribute_group ipw_attribute_group = { | 6989 | static struct attribute_group ipw_attribute_group = { |
6956 | .name = NULL, /* put in device directory */ | 6990 | .name = NULL, /* put in device directory */ |
6957 | .attrs = ipw_sysfs_entries, | 6991 | .attrs = ipw_sysfs_entries, |
6958 | }; | 6992 | }; |
6959 | 6993 | ||
6960 | static int ipw_pci_probe(struct pci_dev *pdev, | 6994 | static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
6961 | const struct pci_device_id *ent) | ||
6962 | { | 6995 | { |
6963 | int err = 0; | 6996 | int err = 0; |
6964 | struct net_device *net_dev; | 6997 | struct net_device *net_dev; |
@@ -7051,7 +7084,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, | |||
7051 | priv->config |= CFG_STATIC_CHANNEL; | 7084 | priv->config |= CFG_STATIC_CHANNEL; |
7052 | priv->channel = channel; | 7085 | priv->channel = channel; |
7053 | IPW_DEBUG_INFO("Bind to static channel %d\n", channel); | 7086 | IPW_DEBUG_INFO("Bind to static channel %d\n", channel); |
7054 | IPW_DEBUG_INFO("Bind to static channel %d\n", channel); | 7087 | IPW_DEBUG_INFO("Bind to static channel %d\n", channel); |
7055 | /* TODO: Validate that provided channel is in range */ | 7088 | /* TODO: Validate that provided channel is in range */ |
7056 | } | 7089 | } |
7057 | 7090 | ||
@@ -7078,9 +7111,9 @@ static int ipw_pci_probe(struct pci_dev *pdev, | |||
7078 | priv->ieee->abg_ture = 1; | 7111 | priv->ieee->abg_ture = 1; |
7079 | band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; | 7112 | band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; |
7080 | modulation = IEEE80211_OFDM_MODULATION | | 7113 | modulation = IEEE80211_OFDM_MODULATION | |
7081 | IEEE80211_CCK_MODULATION; | 7114 | IEEE80211_CCK_MODULATION; |
7082 | priv->adapter = IPW_2915ABG; | 7115 | priv->adapter = IPW_2915ABG; |
7083 | priv->ieee->mode = IEEE_A|IEEE_G|IEEE_B; | 7116 | priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; |
7084 | } else { | 7117 | } else { |
7085 | if (priv->pci_dev->device == 0x4221) | 7118 | if (priv->pci_dev->device == 0x4221) |
7086 | printk(KERN_INFO DRV_NAME | 7119 | printk(KERN_INFO DRV_NAME |
@@ -7094,9 +7127,9 @@ static int ipw_pci_probe(struct pci_dev *pdev, | |||
7094 | priv->ieee->abg_ture = 0; | 7127 | priv->ieee->abg_ture = 0; |
7095 | band = IEEE80211_24GHZ_BAND; | 7128 | band = IEEE80211_24GHZ_BAND; |
7096 | modulation = IEEE80211_OFDM_MODULATION | | 7129 | modulation = IEEE80211_OFDM_MODULATION | |
7097 | IEEE80211_CCK_MODULATION; | 7130 | IEEE80211_CCK_MODULATION; |
7098 | priv->adapter = IPW_2200BG; | 7131 | priv->adapter = IPW_2200BG; |
7099 | priv->ieee->mode = IEEE_G|IEEE_B; | 7132 | priv->ieee->mode = IEEE_G | IEEE_B; |
7100 | } | 7133 | } |
7101 | 7134 | ||
7102 | priv->ieee->freq_band = band; | 7135 | priv->ieee->freq_band = band; |
@@ -7110,11 +7143,10 @@ static int ipw_pci_probe(struct pci_dev *pdev, | |||
7110 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; | 7143 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; |
7111 | 7144 | ||
7112 | /* If power management is turned on, default to AC mode */ | 7145 | /* If power management is turned on, default to AC mode */ |
7113 | priv->power_mode = IPW_POWER_AC; | 7146 | priv->power_mode = IPW_POWER_AC; |
7114 | priv->tx_power = IPW_DEFAULT_TX_POWER; | 7147 | priv->tx_power = IPW_DEFAULT_TX_POWER; |
7115 | 7148 | ||
7116 | err = request_irq(pdev->irq, ipw_isr, SA_SHIRQ, DRV_NAME, | 7149 | err = request_irq(pdev->irq, ipw_isr, SA_SHIRQ, DRV_NAME, priv); |
7117 | priv); | ||
7118 | if (err) { | 7150 | if (err) { |
7119 | IPW_ERROR("Error allocating IRQ %d\n", pdev->irq); | 7151 | IPW_ERROR("Error allocating IRQ %d\n", pdev->irq); |
7120 | goto out_destroy_workqueue; | 7152 | goto out_destroy_workqueue; |
@@ -7136,7 +7168,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, | |||
7136 | net_dev->wireless_handlers = &ipw_wx_handler_def; | 7168 | net_dev->wireless_handlers = &ipw_wx_handler_def; |
7137 | net_dev->ethtool_ops = &ipw_ethtool_ops; | 7169 | net_dev->ethtool_ops = &ipw_ethtool_ops; |
7138 | net_dev->irq = pdev->irq; | 7170 | net_dev->irq = pdev->irq; |
7139 | net_dev->base_addr = (unsigned long )priv->hw_base; | 7171 | net_dev->base_addr = (unsigned long)priv->hw_base; |
7140 | net_dev->mem_start = pci_resource_start(pdev, 0); | 7172 | net_dev->mem_start = pci_resource_start(pdev, 0); |
7141 | net_dev->mem_end = net_dev->mem_start + pci_resource_len(pdev, 0) - 1; | 7173 | net_dev->mem_end = net_dev->mem_start + pci_resource_len(pdev, 0) - 1; |
7142 | 7174 | ||
@@ -7154,23 +7186,23 @@ static int ipw_pci_probe(struct pci_dev *pdev, | |||
7154 | 7186 | ||
7155 | return 0; | 7187 | return 0; |
7156 | 7188 | ||
7157 | out_remove_group: | 7189 | out_remove_group: |
7158 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); | 7190 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); |
7159 | out_release_irq: | 7191 | out_release_irq: |
7160 | free_irq(pdev->irq, priv); | 7192 | free_irq(pdev->irq, priv); |
7161 | out_destroy_workqueue: | 7193 | out_destroy_workqueue: |
7162 | destroy_workqueue(priv->workqueue); | 7194 | destroy_workqueue(priv->workqueue); |
7163 | priv->workqueue = NULL; | 7195 | priv->workqueue = NULL; |
7164 | out_iounmap: | 7196 | out_iounmap: |
7165 | iounmap(priv->hw_base); | 7197 | iounmap(priv->hw_base); |
7166 | out_pci_release_regions: | 7198 | out_pci_release_regions: |
7167 | pci_release_regions(pdev); | 7199 | pci_release_regions(pdev); |
7168 | out_pci_disable_device: | 7200 | out_pci_disable_device: |
7169 | pci_disable_device(pdev); | 7201 | pci_disable_device(pdev); |
7170 | pci_set_drvdata(pdev, NULL); | 7202 | pci_set_drvdata(pdev, NULL); |
7171 | out_free_ieee80211: | 7203 | out_free_ieee80211: |
7172 | free_ieee80211(priv->net_dev); | 7204 | free_ieee80211(priv->net_dev); |
7173 | out: | 7205 | out: |
7174 | return err; | 7206 | return err; |
7175 | } | 7207 | } |
7176 | 7208 | ||
@@ -7223,7 +7255,6 @@ static void ipw_pci_remove(struct pci_dev *pdev) | |||
7223 | #endif | 7255 | #endif |
7224 | } | 7256 | } |
7225 | 7257 | ||
7226 | |||
7227 | #ifdef CONFIG_PM | 7258 | #ifdef CONFIG_PM |
7228 | static int ipw_pci_suspend(struct pci_dev *pdev, pm_message_t state) | 7259 | static int ipw_pci_suspend(struct pci_dev *pdev, pm_message_t state) |
7229 | { | 7260 | { |
@@ -7232,7 +7263,7 @@ static int ipw_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
7232 | 7263 | ||
7233 | printk(KERN_INFO "%s: Going into suspend...\n", dev->name); | 7264 | printk(KERN_INFO "%s: Going into suspend...\n", dev->name); |
7234 | 7265 | ||
7235 | /* Take down the device; powers it off, etc. */ | 7266 | /* Take down the device; powers it off, etc. */ |
7236 | ipw_down(priv); | 7267 | ipw_down(priv); |
7237 | 7268 | ||
7238 | /* Remove the PRESENT state of the device */ | 7269 | /* Remove the PRESENT state of the device */ |
@@ -7306,8 +7337,7 @@ static int __init ipw_init(void) | |||
7306 | return ret; | 7337 | return ret; |
7307 | } | 7338 | } |
7308 | 7339 | ||
7309 | ret = driver_create_file(&ipw_driver.driver, | 7340 | ret = driver_create_file(&ipw_driver.driver, &driver_attr_debug_level); |
7310 | &driver_attr_debug_level); | ||
7311 | if (ret) { | 7341 | if (ret) { |
7312 | IPW_ERROR("Unable to create driver sysfs file\n"); | 7342 | IPW_ERROR("Unable to create driver sysfs file\n"); |
7313 | pci_unregister_driver(&ipw_driver); | 7343 | pci_unregister_driver(&ipw_driver); |
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 66bb5903537f..5b00882133f9 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h | |||
@@ -56,8 +56,7 @@ | |||
56 | #include <linux/workqueue.h> | 56 | #include <linux/workqueue.h> |
57 | 57 | ||
58 | /* Authentication and Association States */ | 58 | /* Authentication and Association States */ |
59 | enum connection_manager_assoc_states | 59 | enum connection_manager_assoc_states { |
60 | { | ||
61 | CMAS_INIT = 0, | 60 | CMAS_INIT = 0, |
62 | CMAS_TX_AUTH_SEQ_1, | 61 | CMAS_TX_AUTH_SEQ_1, |
63 | CMAS_RX_AUTH_SEQ_2, | 62 | CMAS_RX_AUTH_SEQ_2, |
@@ -74,7 +73,6 @@ enum connection_manager_assoc_states | |||
74 | CMAS_LAST | 73 | CMAS_LAST |
75 | }; | 74 | }; |
76 | 75 | ||
77 | |||
78 | #define IPW_WAIT (1<<0) | 76 | #define IPW_WAIT (1<<0) |
79 | #define IPW_QUIET (1<<1) | 77 | #define IPW_QUIET (1<<1) |
80 | #define IPW_ROAMING (1<<2) | 78 | #define IPW_ROAMING (1<<2) |
@@ -190,7 +188,6 @@ enum connection_manager_assoc_states | |||
190 | #define DCT_FLAG_EXT_MODE_CCK 0x01 | 188 | #define DCT_FLAG_EXT_MODE_CCK 0x01 |
191 | #define DCT_FLAG_EXT_MODE_OFDM 0x00 | 189 | #define DCT_FLAG_EXT_MODE_OFDM 0x00 |
192 | 190 | ||
193 | |||
194 | #define TX_RX_TYPE_MASK 0xFF | 191 | #define TX_RX_TYPE_MASK 0xFF |
195 | #define TX_FRAME_TYPE 0x00 | 192 | #define TX_FRAME_TYPE 0x00 |
196 | #define TX_HOST_COMMAND_TYPE 0x01 | 193 | #define TX_HOST_COMMAND_TYPE 0x01 |
@@ -242,107 +239,97 @@ enum connection_manager_assoc_states | |||
242 | * Contains common data for Rx and Tx queues | 239 | * Contains common data for Rx and Tx queues |
243 | */ | 240 | */ |
244 | struct clx2_queue { | 241 | struct clx2_queue { |
245 | int n_bd; /**< number of BDs in this queue */ | 242 | int n_bd; /**< number of BDs in this queue */ |
246 | int first_empty; /**< 1-st empty entry (index) */ | 243 | int first_empty; /**< 1-st empty entry (index) */ |
247 | int last_used; /**< last used entry (index) */ | 244 | int last_used; /**< last used entry (index) */ |
248 | u32 reg_w; /**< 'write' reg (queue head), addr in domain 1 */ | 245 | u32 reg_w; /**< 'write' reg (queue head), addr in domain 1 */ |
249 | u32 reg_r; /**< 'read' reg (queue tail), addr in domain 1 */ | 246 | u32 reg_r; /**< 'read' reg (queue tail), addr in domain 1 */ |
250 | dma_addr_t dma_addr; /**< physical addr for BD's */ | 247 | dma_addr_t dma_addr; /**< physical addr for BD's */ |
251 | int low_mark; /**< low watermark, resume queue if free space more than this */ | 248 | int low_mark; /**< low watermark, resume queue if free space more than this */ |
252 | int high_mark; /**< high watermark, stop queue if free space less than this */ | 249 | int high_mark; /**< high watermark, stop queue if free space less than this */ |
253 | } __attribute__ ((packed)); | 250 | } __attribute__ ((packed)); |
254 | 251 | ||
255 | struct machdr32 | 252 | struct machdr32 { |
256 | { | ||
257 | u16 frame_ctl; | 253 | u16 frame_ctl; |
258 | u16 duration; // watch out for endians! | 254 | u16 duration; // watch out for endians! |
259 | u8 addr1[ MACADRR_BYTE_LEN ]; | 255 | u8 addr1[MACADRR_BYTE_LEN]; |
260 | u8 addr2[ MACADRR_BYTE_LEN ]; | 256 | u8 addr2[MACADRR_BYTE_LEN]; |
261 | u8 addr3[ MACADRR_BYTE_LEN ]; | 257 | u8 addr3[MACADRR_BYTE_LEN]; |
262 | u16 seq_ctrl; // more endians! | 258 | u16 seq_ctrl; // more endians! |
263 | u8 addr4[ MACADRR_BYTE_LEN ]; | 259 | u8 addr4[MACADRR_BYTE_LEN]; |
264 | u16 qos_ctrl; | 260 | u16 qos_ctrl; |
265 | } __attribute__ ((packed)) ; | 261 | } __attribute__ ((packed)); |
266 | 262 | ||
267 | struct machdr30 | 263 | struct machdr30 { |
268 | { | ||
269 | u16 frame_ctl; | 264 | u16 frame_ctl; |
270 | u16 duration; // watch out for endians! | 265 | u16 duration; // watch out for endians! |
271 | u8 addr1[ MACADRR_BYTE_LEN ]; | 266 | u8 addr1[MACADRR_BYTE_LEN]; |
272 | u8 addr2[ MACADRR_BYTE_LEN ]; | 267 | u8 addr2[MACADRR_BYTE_LEN]; |
273 | u8 addr3[ MACADRR_BYTE_LEN ]; | 268 | u8 addr3[MACADRR_BYTE_LEN]; |
274 | u16 seq_ctrl; // more endians! | 269 | u16 seq_ctrl; // more endians! |
275 | u8 addr4[ MACADRR_BYTE_LEN ]; | 270 | u8 addr4[MACADRR_BYTE_LEN]; |
276 | } __attribute__ ((packed)) ; | 271 | } __attribute__ ((packed)); |
277 | 272 | ||
278 | struct machdr26 | 273 | struct machdr26 { |
279 | { | ||
280 | u16 frame_ctl; | 274 | u16 frame_ctl; |
281 | u16 duration; // watch out for endians! | 275 | u16 duration; // watch out for endians! |
282 | u8 addr1[ MACADRR_BYTE_LEN ]; | 276 | u8 addr1[MACADRR_BYTE_LEN]; |
283 | u8 addr2[ MACADRR_BYTE_LEN ]; | 277 | u8 addr2[MACADRR_BYTE_LEN]; |
284 | u8 addr3[ MACADRR_BYTE_LEN ]; | 278 | u8 addr3[MACADRR_BYTE_LEN]; |
285 | u16 seq_ctrl; // more endians! | 279 | u16 seq_ctrl; // more endians! |
286 | u16 qos_ctrl; | 280 | u16 qos_ctrl; |
287 | } __attribute__ ((packed)) ; | 281 | } __attribute__ ((packed)); |
288 | 282 | ||
289 | struct machdr24 | 283 | struct machdr24 { |
290 | { | ||
291 | u16 frame_ctl; | 284 | u16 frame_ctl; |
292 | u16 duration; // watch out for endians! | 285 | u16 duration; // watch out for endians! |
293 | u8 addr1[ MACADRR_BYTE_LEN ]; | 286 | u8 addr1[MACADRR_BYTE_LEN]; |
294 | u8 addr2[ MACADRR_BYTE_LEN ]; | 287 | u8 addr2[MACADRR_BYTE_LEN]; |
295 | u8 addr3[ MACADRR_BYTE_LEN ]; | 288 | u8 addr3[MACADRR_BYTE_LEN]; |
296 | u16 seq_ctrl; // more endians! | 289 | u16 seq_ctrl; // more endians! |
297 | } __attribute__ ((packed)) ; | 290 | } __attribute__ ((packed)); |
298 | 291 | ||
299 | // TX TFD with 32 byte MAC Header | 292 | // TX TFD with 32 byte MAC Header |
300 | struct tx_tfd_32 | 293 | struct tx_tfd_32 { |
301 | { | 294 | struct machdr32 mchdr; // 32 |
302 | struct machdr32 mchdr; // 32 | 295 | u32 uivplaceholder[2]; // 8 |
303 | u32 uivplaceholder[2]; // 8 | 296 | } __attribute__ ((packed)); |
304 | } __attribute__ ((packed)) ; | ||
305 | 297 | ||
306 | // TX TFD with 30 byte MAC Header | 298 | // TX TFD with 30 byte MAC Header |
307 | struct tx_tfd_30 | 299 | struct tx_tfd_30 { |
308 | { | 300 | struct machdr30 mchdr; // 30 |
309 | struct machdr30 mchdr; // 30 | 301 | u8 reserved[2]; // 2 |
310 | u8 reserved[2]; // 2 | 302 | u32 uivplaceholder[2]; // 8 |
311 | u32 uivplaceholder[2]; // 8 | 303 | } __attribute__ ((packed)); |
312 | } __attribute__ ((packed)) ; | ||
313 | 304 | ||
314 | // tx tfd with 26 byte mac header | 305 | // tx tfd with 26 byte mac header |
315 | struct tx_tfd_26 | 306 | struct tx_tfd_26 { |
316 | { | 307 | struct machdr26 mchdr; // 26 |
317 | struct machdr26 mchdr; // 26 | 308 | u8 reserved1[2]; // 2 |
318 | u8 reserved1[2]; // 2 | 309 | u32 uivplaceholder[2]; // 8 |
319 | u32 uivplaceholder[2]; // 8 | 310 | u8 reserved2[4]; // 4 |
320 | u8 reserved2[4]; // 4 | 311 | } __attribute__ ((packed)); |
321 | } __attribute__ ((packed)) ; | ||
322 | 312 | ||
323 | // tx tfd with 24 byte mac header | 313 | // tx tfd with 24 byte mac header |
324 | struct tx_tfd_24 | 314 | struct tx_tfd_24 { |
325 | { | 315 | struct machdr24 mchdr; // 24 |
326 | struct machdr24 mchdr; // 24 | 316 | u32 uivplaceholder[2]; // 8 |
327 | u32 uivplaceholder[2]; // 8 | 317 | u8 reserved[8]; // 8 |
328 | u8 reserved[8]; // 8 | 318 | } __attribute__ ((packed)); |
329 | } __attribute__ ((packed)) ; | ||
330 | |||
331 | 319 | ||
332 | #define DCT_WEP_KEY_FIELD_LENGTH 16 | 320 | #define DCT_WEP_KEY_FIELD_LENGTH 16 |
333 | 321 | ||
334 | struct tfd_command | 322 | struct tfd_command { |
335 | { | ||
336 | u8 index; | 323 | u8 index; |
337 | u8 length; | 324 | u8 length; |
338 | u16 reserved; | 325 | u16 reserved; |
339 | u8 payload[0]; | 326 | u8 payload[0]; |
340 | } __attribute__ ((packed)) ; | 327 | } __attribute__ ((packed)); |
341 | 328 | ||
342 | struct tfd_data { | 329 | struct tfd_data { |
343 | /* Header */ | 330 | /* Header */ |
344 | u32 work_area_ptr; | 331 | u32 work_area_ptr; |
345 | u8 station_number; /* 0 for BSS */ | 332 | u8 station_number; /* 0 for BSS */ |
346 | u8 reserved1; | 333 | u8 reserved1; |
347 | u16 reserved2; | 334 | u16 reserved2; |
348 | 335 | ||
@@ -359,14 +346,13 @@ struct tfd_data { | |||
359 | u8 antenna; | 346 | u8 antenna; |
360 | u16 next_packet_duration; | 347 | u16 next_packet_duration; |
361 | u16 next_frag_len; | 348 | u16 next_frag_len; |
362 | u16 back_off_counter; //////txop; | 349 | u16 back_off_counter; //////txop; |
363 | u8 retrylimit; | 350 | u8 retrylimit; |
364 | u16 cwcurrent; | 351 | u16 cwcurrent; |
365 | u8 reserved3; | 352 | u8 reserved3; |
366 | 353 | ||
367 | /* 802.11 MAC Header */ | 354 | /* 802.11 MAC Header */ |
368 | union | 355 | union { |
369 | { | ||
370 | struct tx_tfd_24 tfd_24; | 356 | struct tx_tfd_24 tfd_24; |
371 | struct tx_tfd_26 tfd_26; | 357 | struct tx_tfd_26 tfd_26; |
372 | struct tx_tfd_30 tfd_30; | 358 | struct tx_tfd_30 tfd_30; |
@@ -379,8 +365,7 @@ struct tfd_data { | |||
379 | u16 chunk_len[NUM_TFD_CHUNKS]; | 365 | u16 chunk_len[NUM_TFD_CHUNKS]; |
380 | } __attribute__ ((packed)); | 366 | } __attribute__ ((packed)); |
381 | 367 | ||
382 | struct txrx_control_flags | 368 | struct txrx_control_flags { |
383 | { | ||
384 | u8 message_type; | 369 | u8 message_type; |
385 | u8 rx_seq_num; | 370 | u8 rx_seq_num; |
386 | u8 control_bits; | 371 | u8 control_bits; |
@@ -390,17 +375,16 @@ struct txrx_control_flags | |||
390 | #define TFD_SIZE 128 | 375 | #define TFD_SIZE 128 |
391 | #define TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH (TFD_SIZE - sizeof(struct txrx_control_flags)) | 376 | #define TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH (TFD_SIZE - sizeof(struct txrx_control_flags)) |
392 | 377 | ||
393 | struct tfd_frame | 378 | struct tfd_frame { |
394 | { | ||
395 | struct txrx_control_flags control_flags; | 379 | struct txrx_control_flags control_flags; |
396 | union { | 380 | union { |
397 | struct tfd_data data; | 381 | struct tfd_data data; |
398 | struct tfd_command cmd; | 382 | struct tfd_command cmd; |
399 | u8 raw[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; | 383 | u8 raw[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; |
400 | } u; | 384 | } u; |
401 | } __attribute__ ((packed)) ; | 385 | } __attribute__ ((packed)); |
402 | 386 | ||
403 | typedef void destructor_func(const void*); | 387 | typedef void destructor_func(const void *); |
404 | 388 | ||
405 | /** | 389 | /** |
406 | * Tx Queue for DMA. Queue consists of circular buffer of | 390 | * Tx Queue for DMA. Queue consists of circular buffer of |
@@ -408,7 +392,7 @@ typedef void destructor_func(const void*); | |||
408 | */ | 392 | */ |
409 | struct clx2_tx_queue { | 393 | struct clx2_tx_queue { |
410 | struct clx2_queue q; | 394 | struct clx2_queue q; |
411 | struct tfd_frame* bd; | 395 | struct tfd_frame *bd; |
412 | struct ieee80211_txb **txb; | 396 | struct ieee80211_txb **txb; |
413 | }; | 397 | }; |
414 | 398 | ||
@@ -423,8 +407,7 @@ struct clx2_tx_queue { | |||
423 | #define SUP_RATE_11G_MAX_NUM_CHANNELS (12) | 407 | #define SUP_RATE_11G_MAX_NUM_CHANNELS (12) |
424 | 408 | ||
425 | // Used for passing to driver number of successes and failures per rate | 409 | // Used for passing to driver number of successes and failures per rate |
426 | struct rate_histogram | 410 | struct rate_histogram { |
427 | { | ||
428 | union { | 411 | union { |
429 | u32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; | 412 | u32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; |
430 | u32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; | 413 | u32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; |
@@ -475,12 +458,12 @@ struct notif_scan_complete { | |||
475 | u8 num_channels; | 458 | u8 num_channels; |
476 | u8 status; | 459 | u8 status; |
477 | u8 reserved; | 460 | u8 reserved; |
478 | } __attribute__ ((packed)); | 461 | } __attribute__ ((packed)); |
479 | 462 | ||
480 | struct notif_frag_length { | 463 | struct notif_frag_length { |
481 | u16 frag_length; | 464 | u16 frag_length; |
482 | u16 reserved; | 465 | u16 reserved; |
483 | } __attribute__ ((packed)); | 466 | } __attribute__ ((packed)); |
484 | 467 | ||
485 | struct notif_beacon_state { | 468 | struct notif_beacon_state { |
486 | u32 state; | 469 | u32 state; |
@@ -543,11 +526,11 @@ struct ipw_rx_notification { | |||
543 | 526 | ||
544 | struct ipw_rx_frame { | 527 | struct ipw_rx_frame { |
545 | u32 reserved1; | 528 | u32 reserved1; |
546 | u8 parent_tsf[4]; // fw_use[0] is boolean for OUR_TSF_IS_GREATER | 529 | u8 parent_tsf[4]; // fw_use[0] is boolean for OUR_TSF_IS_GREATER |
547 | u8 received_channel; // The channel that this frame was received on. | 530 | u8 received_channel; // The channel that this frame was received on. |
548 | // Note that for .11b this does not have to be | 531 | // Note that for .11b this does not have to be |
549 | // the same as the channel that it was sent. | 532 | // the same as the channel that it was sent. |
550 | // Filled by LMAC | 533 | // Filled by LMAC |
551 | u8 frameStatus; | 534 | u8 frameStatus; |
552 | u8 rate; | 535 | u8 rate; |
553 | u8 rssi; | 536 | u8 rssi; |
@@ -556,10 +539,10 @@ struct ipw_rx_frame { | |||
556 | u16 signal; | 539 | u16 signal; |
557 | u16 noise; | 540 | u16 noise; |
558 | u8 antennaAndPhy; | 541 | u8 antennaAndPhy; |
559 | u8 control; // control bit should be on in bg | 542 | u8 control; // control bit should be on in bg |
560 | u8 rtscts_rate; // rate of rts or cts (in rts cts sequence rate | 543 | u8 rtscts_rate; // rate of rts or cts (in rts cts sequence rate |
561 | // is identical) | 544 | // is identical) |
562 | u8 rtscts_seen; // 0x1 RTS seen ; 0x2 CTS seen | 545 | u8 rtscts_seen; // 0x1 RTS seen ; 0x2 CTS seen |
563 | u16 length; | 546 | u16 length; |
564 | u8 data[0]; | 547 | u8 data[0]; |
565 | } __attribute__ ((packed)); | 548 | } __attribute__ ((packed)); |
@@ -571,8 +554,7 @@ struct ipw_rx_header { | |||
571 | u8 reserved; | 554 | u8 reserved; |
572 | } __attribute__ ((packed)); | 555 | } __attribute__ ((packed)); |
573 | 556 | ||
574 | struct ipw_rx_packet | 557 | struct ipw_rx_packet { |
575 | { | ||
576 | struct ipw_rx_header header; | 558 | struct ipw_rx_header header; |
577 | union { | 559 | union { |
578 | struct ipw_rx_frame frame; | 560 | struct ipw_rx_frame frame; |
@@ -589,21 +571,20 @@ struct ipw_rx_mem_buffer { | |||
589 | struct ipw_rx_buffer *rxb; | 571 | struct ipw_rx_buffer *rxb; |
590 | struct sk_buff *skb; | 572 | struct sk_buff *skb; |
591 | struct list_head list; | 573 | struct list_head list; |
592 | }; /* Not transferred over network, so not __attribute__ ((packed)) */ | 574 | }; /* Not transferred over network, so not __attribute__ ((packed)) */ |
593 | 575 | ||
594 | struct ipw_rx_queue { | 576 | struct ipw_rx_queue { |
595 | struct ipw_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; | 577 | struct ipw_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; |
596 | struct ipw_rx_mem_buffer *queue[RX_QUEUE_SIZE]; | 578 | struct ipw_rx_mem_buffer *queue[RX_QUEUE_SIZE]; |
597 | u32 processed; /* Internal index to last handled Rx packet */ | 579 | u32 processed; /* Internal index to last handled Rx packet */ |
598 | u32 read; /* Shared index to newest available Rx buffer */ | 580 | u32 read; /* Shared index to newest available Rx buffer */ |
599 | u32 write; /* Shared index to oldest written Rx packet */ | 581 | u32 write; /* Shared index to oldest written Rx packet */ |
600 | u32 free_count;/* Number of pre-allocated buffers in rx_free */ | 582 | u32 free_count; /* Number of pre-allocated buffers in rx_free */ |
601 | /* Each of these lists is used as a FIFO for ipw_rx_mem_buffers */ | 583 | /* Each of these lists is used as a FIFO for ipw_rx_mem_buffers */ |
602 | struct list_head rx_free; /* Own an SKBs */ | 584 | struct list_head rx_free; /* Own an SKBs */ |
603 | struct list_head rx_used; /* No SKB allocated */ | 585 | struct list_head rx_used; /* No SKB allocated */ |
604 | spinlock_t lock; | 586 | spinlock_t lock; |
605 | }; /* Not transferred over network, so not __attribute__ ((packed)) */ | 587 | }; /* Not transferred over network, so not __attribute__ ((packed)) */ |
606 | |||
607 | 588 | ||
608 | struct alive_command_responce { | 589 | struct alive_command_responce { |
609 | u8 alive_command; | 590 | u8 alive_command; |
@@ -627,8 +608,7 @@ struct ipw_rates { | |||
627 | u8 rates[IPW_MAX_RATES]; | 608 | u8 rates[IPW_MAX_RATES]; |
628 | } __attribute__ ((packed)); | 609 | } __attribute__ ((packed)); |
629 | 610 | ||
630 | struct command_block | 611 | struct command_block { |
631 | { | ||
632 | unsigned int control; | 612 | unsigned int control; |
633 | u32 source_addr; | 613 | u32 source_addr; |
634 | u32 dest_addr; | 614 | u32 dest_addr; |
@@ -636,18 +616,16 @@ struct command_block | |||
636 | } __attribute__ ((packed)); | 616 | } __attribute__ ((packed)); |
637 | 617 | ||
638 | #define CB_NUMBER_OF_ELEMENTS_SMALL 64 | 618 | #define CB_NUMBER_OF_ELEMENTS_SMALL 64 |
639 | struct fw_image_desc | 619 | struct fw_image_desc { |
640 | { | ||
641 | unsigned long last_cb_index; | 620 | unsigned long last_cb_index; |
642 | unsigned long current_cb_index; | 621 | unsigned long current_cb_index; |
643 | struct command_block cb_list[CB_NUMBER_OF_ELEMENTS_SMALL]; | 622 | struct command_block cb_list[CB_NUMBER_OF_ELEMENTS_SMALL]; |
644 | void * v_addr; | 623 | void *v_addr; |
645 | unsigned long p_addr; | 624 | unsigned long p_addr; |
646 | unsigned long len; | 625 | unsigned long len; |
647 | }; | 626 | }; |
648 | 627 | ||
649 | struct ipw_sys_config | 628 | struct ipw_sys_config { |
650 | { | ||
651 | u8 bt_coexistence; | 629 | u8 bt_coexistence; |
652 | u8 reserved1; | 630 | u8 reserved1; |
653 | u8 answer_broadcast_ssid_probe; | 631 | u8 answer_broadcast_ssid_probe; |
@@ -670,8 +648,7 @@ struct ipw_sys_config | |||
670 | u8 reserved3; | 648 | u8 reserved3; |
671 | } __attribute__ ((packed)); | 649 | } __attribute__ ((packed)); |
672 | 650 | ||
673 | struct ipw_multicast_addr | 651 | struct ipw_multicast_addr { |
674 | { | ||
675 | u8 num_of_multicast_addresses; | 652 | u8 num_of_multicast_addresses; |
676 | u8 reserved[3]; | 653 | u8 reserved[3]; |
677 | u8 mac1[6]; | 654 | u8 mac1[6]; |
@@ -680,8 +657,7 @@ struct ipw_multicast_addr | |||
680 | u8 mac4[6]; | 657 | u8 mac4[6]; |
681 | } __attribute__ ((packed)); | 658 | } __attribute__ ((packed)); |
682 | 659 | ||
683 | struct ipw_wep_key | 660 | struct ipw_wep_key { |
684 | { | ||
685 | u8 cmd_id; | 661 | u8 cmd_id; |
686 | u8 seq_num; | 662 | u8 seq_num; |
687 | u8 key_index; | 663 | u8 key_index; |
@@ -689,8 +665,7 @@ struct ipw_wep_key | |||
689 | u8 key[16]; | 665 | u8 key[16]; |
690 | } __attribute__ ((packed)); | 666 | } __attribute__ ((packed)); |
691 | 667 | ||
692 | struct ipw_tgi_tx_key | 668 | struct ipw_tgi_tx_key { |
693 | { | ||
694 | u8 key_id; | 669 | u8 key_id; |
695 | u8 security_type; | 670 | u8 security_type; |
696 | u8 station_index; | 671 | u8 station_index; |
@@ -701,8 +676,7 @@ struct ipw_tgi_tx_key | |||
701 | 676 | ||
702 | #define IPW_SCAN_CHANNELS 54 | 677 | #define IPW_SCAN_CHANNELS 54 |
703 | 678 | ||
704 | struct ipw_scan_request | 679 | struct ipw_scan_request { |
705 | { | ||
706 | u8 scan_type; | 680 | u8 scan_type; |
707 | u16 dwell_time; | 681 | u16 dwell_time; |
708 | u8 channels_list[IPW_SCAN_CHANNELS]; | 682 | u8 channels_list[IPW_SCAN_CHANNELS]; |
@@ -718,8 +692,7 @@ enum { | |||
718 | IPW_SCAN_TYPES | 692 | IPW_SCAN_TYPES |
719 | }; | 693 | }; |
720 | 694 | ||
721 | struct ipw_scan_request_ext | 695 | struct ipw_scan_request_ext { |
722 | { | ||
723 | u32 full_scan_index; | 696 | u32 full_scan_index; |
724 | u8 channels_list[IPW_SCAN_CHANNELS]; | 697 | u8 channels_list[IPW_SCAN_CHANNELS]; |
725 | u8 scan_type[IPW_SCAN_CHANNELS / 2]; | 698 | u8 scan_type[IPW_SCAN_CHANNELS / 2]; |
@@ -740,19 +713,16 @@ extern inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan, | |||
740 | { | 713 | { |
741 | if (index % 2) | 714 | if (index % 2) |
742 | scan->scan_type[index / 2] = | 715 | scan->scan_type[index / 2] = |
743 | (scan->scan_type[index / 2] & 0xF0) | | 716 | (scan->scan_type[index / 2] & 0xF0) | (scan_type & 0x0F); |
744 | (scan_type & 0x0F); | ||
745 | else | 717 | else |
746 | scan->scan_type[index / 2] = | 718 | scan->scan_type[index / 2] = |
747 | (scan->scan_type[index / 2] & 0x0F) | | 719 | (scan->scan_type[index / 2] & 0x0F) | |
748 | ((scan_type & 0x0F) << 4); | 720 | ((scan_type & 0x0F) << 4); |
749 | } | 721 | } |
750 | 722 | ||
751 | struct ipw_associate | 723 | struct ipw_associate { |
752 | { | ||
753 | u8 channel; | 724 | u8 channel; |
754 | u8 auth_type:4, | 725 | u8 auth_type:4, auth_key:4; |
755 | auth_key:4; | ||
756 | u8 assoc_type; | 726 | u8 assoc_type; |
757 | u8 reserved; | 727 | u8 reserved; |
758 | u16 policy_support; | 728 | u16 policy_support; |
@@ -771,8 +741,7 @@ struct ipw_associate | |||
771 | u16 reserved2; | 741 | u16 reserved2; |
772 | } __attribute__ ((packed)); | 742 | } __attribute__ ((packed)); |
773 | 743 | ||
774 | struct ipw_supported_rates | 744 | struct ipw_supported_rates { |
775 | { | ||
776 | u8 ieee_mode; | 745 | u8 ieee_mode; |
777 | u8 num_rates; | 746 | u8 num_rates; |
778 | u8 purpose; | 747 | u8 purpose; |
@@ -780,42 +749,36 @@ struct ipw_supported_rates | |||
780 | u8 supported_rates[IPW_MAX_RATES]; | 749 | u8 supported_rates[IPW_MAX_RATES]; |
781 | } __attribute__ ((packed)); | 750 | } __attribute__ ((packed)); |
782 | 751 | ||
783 | struct ipw_rts_threshold | 752 | struct ipw_rts_threshold { |
784 | { | ||
785 | u16 rts_threshold; | 753 | u16 rts_threshold; |
786 | u16 reserved; | 754 | u16 reserved; |
787 | } __attribute__ ((packed)); | 755 | } __attribute__ ((packed)); |
788 | 756 | ||
789 | struct ipw_frag_threshold | 757 | struct ipw_frag_threshold { |
790 | { | ||
791 | u16 frag_threshold; | 758 | u16 frag_threshold; |
792 | u16 reserved; | 759 | u16 reserved; |
793 | } __attribute__ ((packed)); | 760 | } __attribute__ ((packed)); |
794 | 761 | ||
795 | struct ipw_retry_limit | 762 | struct ipw_retry_limit { |
796 | { | ||
797 | u8 short_retry_limit; | 763 | u8 short_retry_limit; |
798 | u8 long_retry_limit; | 764 | u8 long_retry_limit; |
799 | u16 reserved; | 765 | u16 reserved; |
800 | } __attribute__ ((packed)); | 766 | } __attribute__ ((packed)); |
801 | 767 | ||
802 | struct ipw_dino_config | 768 | struct ipw_dino_config { |
803 | { | ||
804 | u32 dino_config_addr; | 769 | u32 dino_config_addr; |
805 | u16 dino_config_size; | 770 | u16 dino_config_size; |
806 | u8 dino_response; | 771 | u8 dino_response; |
807 | u8 reserved; | 772 | u8 reserved; |
808 | } __attribute__ ((packed)); | 773 | } __attribute__ ((packed)); |
809 | 774 | ||
810 | struct ipw_aironet_info | 775 | struct ipw_aironet_info { |
811 | { | ||
812 | u8 id; | 776 | u8 id; |
813 | u8 length; | 777 | u8 length; |
814 | u16 reserved; | 778 | u16 reserved; |
815 | } __attribute__ ((packed)); | 779 | } __attribute__ ((packed)); |
816 | 780 | ||
817 | struct ipw_rx_key | 781 | struct ipw_rx_key { |
818 | { | ||
819 | u8 station_index; | 782 | u8 station_index; |
820 | u8 key_type; | 783 | u8 key_type; |
821 | u8 key_id; | 784 | u8 key_id; |
@@ -826,23 +789,20 @@ struct ipw_rx_key | |||
826 | u8 reserved; | 789 | u8 reserved; |
827 | } __attribute__ ((packed)); | 790 | } __attribute__ ((packed)); |
828 | 791 | ||
829 | struct ipw_country_channel_info | 792 | struct ipw_country_channel_info { |
830 | { | ||
831 | u8 first_channel; | 793 | u8 first_channel; |
832 | u8 no_channels; | 794 | u8 no_channels; |
833 | s8 max_tx_power; | 795 | s8 max_tx_power; |
834 | } __attribute__ ((packed)); | 796 | } __attribute__ ((packed)); |
835 | 797 | ||
836 | struct ipw_country_info | 798 | struct ipw_country_info { |
837 | { | ||
838 | u8 id; | 799 | u8 id; |
839 | u8 length; | 800 | u8 length; |
840 | u8 country_str[3]; | 801 | u8 country_str[3]; |
841 | struct ipw_country_channel_info groups[7]; | 802 | struct ipw_country_channel_info groups[7]; |
842 | } __attribute__ ((packed)); | 803 | } __attribute__ ((packed)); |
843 | 804 | ||
844 | struct ipw_channel_tx_power | 805 | struct ipw_channel_tx_power { |
845 | { | ||
846 | u8 channel_number; | 806 | u8 channel_number; |
847 | s8 tx_power; | 807 | s8 tx_power; |
848 | } __attribute__ ((packed)); | 808 | } __attribute__ ((packed)); |
@@ -852,15 +812,13 @@ struct ipw_channel_tx_power | |||
852 | #define MAX_A_CHANNELS 37 | 812 | #define MAX_A_CHANNELS 37 |
853 | #define MAX_B_CHANNELS 14 | 813 | #define MAX_B_CHANNELS 14 |
854 | 814 | ||
855 | struct ipw_tx_power | 815 | struct ipw_tx_power { |
856 | { | ||
857 | u8 num_channels; | 816 | u8 num_channels; |
858 | u8 ieee_mode; | 817 | u8 ieee_mode; |
859 | struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS]; | 818 | struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS]; |
860 | } __attribute__ ((packed)); | 819 | } __attribute__ ((packed)); |
861 | 820 | ||
862 | struct ipw_qos_parameters | 821 | struct ipw_qos_parameters { |
863 | { | ||
864 | u16 cw_min[4]; | 822 | u16 cw_min[4]; |
865 | u16 cw_max[4]; | 823 | u16 cw_max[4]; |
866 | u8 aifs[4]; | 824 | u8 aifs[4]; |
@@ -868,15 +826,13 @@ struct ipw_qos_parameters | |||
868 | u16 tx_op_limit[4]; | 826 | u16 tx_op_limit[4]; |
869 | } __attribute__ ((packed)); | 827 | } __attribute__ ((packed)); |
870 | 828 | ||
871 | struct ipw_rsn_capabilities | 829 | struct ipw_rsn_capabilities { |
872 | { | ||
873 | u8 id; | 830 | u8 id; |
874 | u8 length; | 831 | u8 length; |
875 | u16 version; | 832 | u16 version; |
876 | } __attribute__ ((packed)); | 833 | } __attribute__ ((packed)); |
877 | 834 | ||
878 | struct ipw_sensitivity_calib | 835 | struct ipw_sensitivity_calib { |
879 | { | ||
880 | u16 beacon_rssi_raw; | 836 | u16 beacon_rssi_raw; |
881 | u16 reserved; | 837 | u16 reserved; |
882 | } __attribute__ ((packed)); | 838 | } __attribute__ ((packed)); |
@@ -895,10 +851,11 @@ struct ipw_sensitivity_calib | |||
895 | * - \a param filled with status parameters. | 851 | * - \a param filled with status parameters. |
896 | */ | 852 | */ |
897 | struct ipw_cmd { | 853 | struct ipw_cmd { |
898 | u32 cmd; /**< Host command */ | 854 | u32 cmd; /**< Host command */ |
899 | u32 status; /**< Status */ | 855 | u32 status;/**< Status */ |
900 | u32 status_len; /**< How many 32 bit parameters in the status */ | 856 | u32 status_len; |
901 | u32 len; /**< incoming parameters length, bytes */ | 857 | /**< How many 32 bit parameters in the status */ |
858 | u32 len; /**< incoming parameters length, bytes */ | ||
902 | /** | 859 | /** |
903 | * command parameters. | 860 | * command parameters. |
904 | * There should be enough space for incoming and | 861 | * There should be enough space for incoming and |
@@ -906,10 +863,10 @@ struct ipw_cmd { | |||
906 | * Incoming parameters listed 1-st, followed by outcoming params. | 863 | * Incoming parameters listed 1-st, followed by outcoming params. |
907 | * nParams=(len+3)/4+status_len | 864 | * nParams=(len+3)/4+status_len |
908 | */ | 865 | */ |
909 | u32 param[0]; | 866 | u32 param[0]; |
910 | } __attribute__ ((packed)); | 867 | } __attribute__ ((packed)); |
911 | 868 | ||
912 | #define STATUS_HCMD_ACTIVE (1<<0) /**< host command in progress */ | 869 | #define STATUS_HCMD_ACTIVE (1<<0) /**< host command in progress */ |
913 | 870 | ||
914 | #define STATUS_INT_ENABLED (1<<1) | 871 | #define STATUS_INT_ENABLED (1<<1) |
915 | #define STATUS_RF_KILL_HW (1<<2) | 872 | #define STATUS_RF_KILL_HW (1<<2) |
@@ -932,15 +889,15 @@ struct ipw_cmd { | |||
932 | #define STATUS_SCANNING (1<<21) | 889 | #define STATUS_SCANNING (1<<21) |
933 | #define STATUS_SCAN_ABORTING (1<<22) | 890 | #define STATUS_SCAN_ABORTING (1<<22) |
934 | 891 | ||
935 | #define STATUS_INDIRECT_BYTE (1<<28) /* sysfs entry configured for access */ | 892 | #define STATUS_INDIRECT_BYTE (1<<28) /* sysfs entry configured for access */ |
936 | #define STATUS_INDIRECT_DWORD (1<<29) /* sysfs entry configured for access */ | 893 | #define STATUS_INDIRECT_DWORD (1<<29) /* sysfs entry configured for access */ |
937 | #define STATUS_DIRECT_DWORD (1<<30) /* sysfs entry configured for access */ | 894 | #define STATUS_DIRECT_DWORD (1<<30) /* sysfs entry configured for access */ |
938 | 895 | ||
939 | #define STATUS_SECURITY_UPDATED (1<<31) /* Security sync needed */ | 896 | #define STATUS_SECURITY_UPDATED (1<<31) /* Security sync needed */ |
940 | 897 | ||
941 | #define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */ | 898 | #define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */ |
942 | #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ | 899 | #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ |
943 | #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ | 900 | #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ |
944 | #define CFG_CUSTOM_MAC (1<<3) | 901 | #define CFG_CUSTOM_MAC (1<<3) |
945 | #define CFG_PREAMBLE (1<<4) | 902 | #define CFG_PREAMBLE (1<<4) |
946 | #define CFG_ADHOC_PERSIST (1<<5) | 903 | #define CFG_ADHOC_PERSIST (1<<5) |
@@ -948,8 +905,8 @@ struct ipw_cmd { | |||
948 | #define CFG_FIXED_RATE (1<<7) | 905 | #define CFG_FIXED_RATE (1<<7) |
949 | #define CFG_ADHOC_CREATE (1<<8) | 906 | #define CFG_ADHOC_CREATE (1<<8) |
950 | 907 | ||
951 | #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ | 908 | #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ |
952 | #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ | 909 | #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ |
953 | 910 | ||
954 | #define MAX_STATIONS 32 | 911 | #define MAX_STATIONS 32 |
955 | #define IPW_INVALID_STATION (0xff) | 912 | #define IPW_INVALID_STATION (0xff) |
@@ -989,8 +946,8 @@ struct ipw_priv { | |||
989 | /* result of ucode download */ | 946 | /* result of ucode download */ |
990 | struct alive_command_responce dino_alive; | 947 | struct alive_command_responce dino_alive; |
991 | 948 | ||
992 | wait_queue_head_t wait_command_queue; | 949 | wait_queue_head_t wait_command_queue; |
993 | wait_queue_head_t wait_state; | 950 | wait_queue_head_t wait_state; |
994 | 951 | ||
995 | /* Rx and Tx DMA processing queues */ | 952 | /* Rx and Tx DMA processing queues */ |
996 | struct ipw_rx_queue *rxq; | 953 | struct ipw_rx_queue *rxq; |
@@ -1006,9 +963,9 @@ struct ipw_priv { | |||
1006 | struct average average_rssi; | 963 | struct average average_rssi; |
1007 | struct average average_noise; | 964 | struct average average_noise; |
1008 | u32 port_type; | 965 | u32 port_type; |
1009 | int rx_bufs_min; /**< minimum number of bufs in Rx queue */ | 966 | int rx_bufs_min; /**< minimum number of bufs in Rx queue */ |
1010 | int rx_pend_max; /**< maximum pending buffers for one IRQ */ | 967 | int rx_pend_max; /**< maximum pending buffers for one IRQ */ |
1011 | u32 hcmd_seq; /**< sequence number for hcmd */ | 968 | u32 hcmd_seq; /**< sequence number for hcmd */ |
1012 | u32 missed_beacon_threshold; | 969 | u32 missed_beacon_threshold; |
1013 | u32 roaming_threshold; | 970 | u32 roaming_threshold; |
1014 | 971 | ||
@@ -1017,17 +974,17 @@ struct ipw_priv { | |||
1017 | 974 | ||
1018 | unsigned long ts_scan_abort; | 975 | unsigned long ts_scan_abort; |
1019 | struct ipw_supported_rates rates; | 976 | struct ipw_supported_rates rates; |
1020 | struct ipw_rates phy[3]; /**< PHY restrictions, per band */ | 977 | struct ipw_rates phy[3]; /**< PHY restrictions, per band */ |
1021 | struct ipw_rates supp; /**< software defined */ | 978 | struct ipw_rates supp; /**< software defined */ |
1022 | struct ipw_rates extended; /**< use for corresp. IE, AP only */ | 979 | struct ipw_rates extended; /**< use for corresp. IE, AP only */ |
1023 | 980 | ||
1024 | struct notif_link_deterioration last_link_deterioration; /** for statistics */ | 981 | struct notif_link_deterioration last_link_deterioration; /** for statistics */ |
1025 | struct ipw_cmd* hcmd; /**< host command currently executed */ | 982 | struct ipw_cmd *hcmd; /**< host command currently executed */ |
1026 | 983 | ||
1027 | wait_queue_head_t hcmd_wq; /**< host command waits for execution */ | 984 | wait_queue_head_t hcmd_wq; /**< host command waits for execution */ |
1028 | u32 tsf_bcn[2]; /**< TSF from latest beacon */ | 985 | u32 tsf_bcn[2]; /**< TSF from latest beacon */ |
1029 | 986 | ||
1030 | struct notif_calibration calib; /**< last calibration */ | 987 | struct notif_calibration calib; /**< last calibration */ |
1031 | 988 | ||
1032 | /* ordinal interface with firmware */ | 989 | /* ordinal interface with firmware */ |
1033 | u32 table0_addr; | 990 | u32 table0_addr; |
@@ -1067,8 +1024,8 @@ struct ipw_priv { | |||
1067 | u32 tx_packets; | 1024 | u32 tx_packets; |
1068 | u32 quality; | 1025 | u32 quality; |
1069 | 1026 | ||
1070 | /* eeprom */ | 1027 | /* eeprom */ |
1071 | u8 eeprom[0x100]; /* 256 bytes of eeprom */ | 1028 | u8 eeprom[0x100]; /* 256 bytes of eeprom */ |
1072 | int eeprom_delay; | 1029 | int eeprom_delay; |
1073 | 1030 | ||
1074 | struct iw_statistics wstats; | 1031 | struct iw_statistics wstats; |
@@ -1091,7 +1048,6 @@ struct ipw_priv { | |||
1091 | 1048 | ||
1092 | struct tasklet_struct irq_tasklet; | 1049 | struct tasklet_struct irq_tasklet; |
1093 | 1050 | ||
1094 | |||
1095 | #define IPW_2200BG 1 | 1051 | #define IPW_2200BG 1 |
1096 | #define IPW_2915ABG 2 | 1052 | #define IPW_2915ABG 2 |
1097 | u8 adapter; | 1053 | u8 adapter; |
@@ -1114,7 +1070,6 @@ struct ipw_priv { | |||
1114 | u32 indirect_byte; | 1070 | u32 indirect_byte; |
1115 | }; /*ipw_priv */ | 1071 | }; /*ipw_priv */ |
1116 | 1072 | ||
1117 | |||
1118 | /* debug macros */ | 1073 | /* debug macros */ |
1119 | 1074 | ||
1120 | #ifdef CONFIG_IPW_DEBUG | 1075 | #ifdef CONFIG_IPW_DEBUG |
@@ -1170,7 +1125,6 @@ do { if (ipw_debug_level & (level)) \ | |||
1170 | #define IPW_DL_RF_KILL (1<<17) | 1125 | #define IPW_DL_RF_KILL (1<<17) |
1171 | #define IPW_DL_FW_ERRORS (1<<18) | 1126 | #define IPW_DL_FW_ERRORS (1<<18) |
1172 | 1127 | ||
1173 | |||
1174 | #define IPW_DL_ORD (1<<20) | 1128 | #define IPW_DL_ORD (1<<20) |
1175 | 1129 | ||
1176 | #define IPW_DL_FRAG (1<<21) | 1130 | #define IPW_DL_FRAG (1<<21) |
@@ -1184,7 +1138,6 @@ do { if (ipw_debug_level & (level)) \ | |||
1184 | 1138 | ||
1185 | #define IPW_DL_STATS (1<<29) | 1139 | #define IPW_DL_STATS (1<<29) |
1186 | 1140 | ||
1187 | |||
1188 | #define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) | 1141 | #define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) |
1189 | #define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) | 1142 | #define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) |
1190 | #define IPW_DEBUG_INFO(f, a...) IPW_DEBUG(IPW_DL_INFO, f, ## a) | 1143 | #define IPW_DEBUG_INFO(f, a...) IPW_DEBUG(IPW_DL_INFO, f, ## a) |
@@ -1253,12 +1206,12 @@ do { if (ipw_debug_level & (level)) \ | |||
1253 | /* | 1206 | /* |
1254 | * RESET Register Bit Indexes | 1207 | * RESET Register Bit Indexes |
1255 | */ | 1208 | */ |
1256 | #define CBD_RESET_REG_PRINCETON_RESET 0x00000001 /* Bit 0 (LSB) */ | 1209 | #define CBD_RESET_REG_PRINCETON_RESET 0x00000001 /* Bit 0 (LSB) */ |
1257 | #define CX2_RESET_REG_SW_RESET 0x00000080 /* Bit 7 */ | 1210 | #define CX2_RESET_REG_SW_RESET 0x00000080 /* Bit 7 */ |
1258 | #define CX2_RESET_REG_MASTER_DISABLED 0x00000100 /* Bit 8 */ | 1211 | #define CX2_RESET_REG_MASTER_DISABLED 0x00000100 /* Bit 8 */ |
1259 | #define CX2_RESET_REG_STOP_MASTER 0x00000200 /* Bit 9 */ | 1212 | #define CX2_RESET_REG_STOP_MASTER 0x00000200 /* Bit 9 */ |
1260 | #define CX2_ARC_KESHET_CONFIG 0x08000000 /* Bit 27 */ | 1213 | #define CX2_ARC_KESHET_CONFIG 0x08000000 /* Bit 27 */ |
1261 | #define CX2_START_STANDBY 0x00000004 /* Bit 2 */ | 1214 | #define CX2_START_STANDBY 0x00000004 /* Bit 2 */ |
1262 | 1215 | ||
1263 | #define CX2_CSR_CIS_UPPER_BOUND 0x00000200 | 1216 | #define CX2_CSR_CIS_UPPER_BOUND 0x00000200 |
1264 | #define CX2_DOMAIN_0_END 0x1000 | 1217 | #define CX2_DOMAIN_0_END 0x1000 |
@@ -1289,14 +1242,12 @@ do { if (ipw_debug_level & (level)) \ | |||
1289 | #define CB_SRC_SIZE_LONG 0x00200000 | 1242 | #define CB_SRC_SIZE_LONG 0x00200000 |
1290 | #define CB_DEST_SIZE_LONG 0x00020000 | 1243 | #define CB_DEST_SIZE_LONG 0x00020000 |
1291 | 1244 | ||
1292 | |||
1293 | /* DMA DEFINES */ | 1245 | /* DMA DEFINES */ |
1294 | 1246 | ||
1295 | #define DMA_CONTROL_SMALL_CB_CONST_VALUE 0x00540000 | 1247 | #define DMA_CONTROL_SMALL_CB_CONST_VALUE 0x00540000 |
1296 | #define DMA_CB_STOP_AND_ABORT 0x00000C00 | 1248 | #define DMA_CB_STOP_AND_ABORT 0x00000C00 |
1297 | #define DMA_CB_START 0x00000100 | 1249 | #define DMA_CB_START 0x00000100 |
1298 | 1250 | ||
1299 | |||
1300 | #define CX2_SHARED_SRAM_SIZE 0x00030000 | 1251 | #define CX2_SHARED_SRAM_SIZE 0x00030000 |
1301 | #define CX2_SHARED_SRAM_DMA_CONTROL 0x00027000 | 1252 | #define CX2_SHARED_SRAM_DMA_CONTROL 0x00027000 |
1302 | #define CB_MAX_LENGTH 0x1FFF | 1253 | #define CB_MAX_LENGTH 0x1FFF |
@@ -1304,7 +1255,6 @@ do { if (ipw_debug_level & (level)) \ | |||
1304 | #define CX2_HOST_EEPROM_DATA_SRAM_SIZE 0xA18 | 1255 | #define CX2_HOST_EEPROM_DATA_SRAM_SIZE 0xA18 |
1305 | #define CX2_EEPROM_IMAGE_SIZE 0x100 | 1256 | #define CX2_EEPROM_IMAGE_SIZE 0x100 |
1306 | 1257 | ||
1307 | |||
1308 | /* DMA defs */ | 1258 | /* DMA defs */ |
1309 | #define CX2_DMA_I_CURRENT_CB 0x003000D0 | 1259 | #define CX2_DMA_I_CURRENT_CB 0x003000D0 |
1310 | #define CX2_DMA_O_CURRENT_CB 0x003000D4 | 1260 | #define CX2_DMA_O_CURRENT_CB 0x003000D4 |
@@ -1356,7 +1306,6 @@ do { if (ipw_debug_level & (level)) \ | |||
1356 | #define IPW_WHO_IS_AWAKE (CX2_SHARED_LOWER_BOUND + 0xB14) | 1306 | #define IPW_WHO_IS_AWAKE (CX2_SHARED_LOWER_BOUND + 0xB14) |
1357 | #define IPW_DURING_ATIM_WINDOW (CX2_SHARED_LOWER_BOUND + 0xB18) | 1307 | #define IPW_DURING_ATIM_WINDOW (CX2_SHARED_LOWER_BOUND + 0xB18) |
1358 | 1308 | ||
1359 | |||
1360 | #define MSB 1 | 1309 | #define MSB 1 |
1361 | #define LSB 0 | 1310 | #define LSB 0 |
1362 | #define WORD_TO_BYTE(_word) ((_word) * sizeof(u16)) | 1311 | #define WORD_TO_BYTE(_word) ((_word) * sizeof(u16)) |
@@ -1365,16 +1314,16 @@ do { if (ipw_debug_level & (level)) \ | |||
1365 | ( WORD_TO_BYTE(_wordoffset) + (_byteoffset) ) | 1314 | ( WORD_TO_BYTE(_wordoffset) + (_byteoffset) ) |
1366 | 1315 | ||
1367 | /* EEPROM access by BYTE */ | 1316 | /* EEPROM access by BYTE */ |
1368 | #define EEPROM_PME_CAPABILITY (GET_EEPROM_ADDR(0x09,MSB)) /* 1 byte */ | 1317 | #define EEPROM_PME_CAPABILITY (GET_EEPROM_ADDR(0x09,MSB)) /* 1 byte */ |
1369 | #define EEPROM_MAC_ADDRESS (GET_EEPROM_ADDR(0x21,LSB)) /* 6 byte */ | 1318 | #define EEPROM_MAC_ADDRESS (GET_EEPROM_ADDR(0x21,LSB)) /* 6 byte */ |
1370 | #define EEPROM_VERSION (GET_EEPROM_ADDR(0x24,MSB)) /* 1 byte */ | 1319 | #define EEPROM_VERSION (GET_EEPROM_ADDR(0x24,MSB)) /* 1 byte */ |
1371 | #define EEPROM_NIC_TYPE (GET_EEPROM_ADDR(0x25,LSB)) /* 1 byte */ | 1320 | #define EEPROM_NIC_TYPE (GET_EEPROM_ADDR(0x25,LSB)) /* 1 byte */ |
1372 | #define EEPROM_SKU_CAPABILITY (GET_EEPROM_ADDR(0x25,MSB)) /* 1 byte */ | 1321 | #define EEPROM_SKU_CAPABILITY (GET_EEPROM_ADDR(0x25,MSB)) /* 1 byte */ |
1373 | #define EEPROM_COUNTRY_CODE (GET_EEPROM_ADDR(0x26,LSB)) /* 3 bytes */ | 1322 | #define EEPROM_COUNTRY_CODE (GET_EEPROM_ADDR(0x26,LSB)) /* 3 bytes */ |
1374 | #define EEPROM_IBSS_CHANNELS_BG (GET_EEPROM_ADDR(0x28,LSB)) /* 2 bytes */ | 1323 | #define EEPROM_IBSS_CHANNELS_BG (GET_EEPROM_ADDR(0x28,LSB)) /* 2 bytes */ |
1375 | #define EEPROM_IBSS_CHANNELS_A (GET_EEPROM_ADDR(0x29,MSB)) /* 5 bytes */ | 1324 | #define EEPROM_IBSS_CHANNELS_A (GET_EEPROM_ADDR(0x29,MSB)) /* 5 bytes */ |
1376 | #define EEPROM_BSS_CHANNELS_BG (GET_EEPROM_ADDR(0x2c,LSB)) /* 2 bytes */ | 1325 | #define EEPROM_BSS_CHANNELS_BG (GET_EEPROM_ADDR(0x2c,LSB)) /* 2 bytes */ |
1377 | #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ | 1326 | #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ |
1378 | 1327 | ||
1379 | /* NIC type as found in the one byte EEPROM_NIC_TYPE offset*/ | 1328 | /* NIC type as found in the one byte EEPROM_NIC_TYPE offset*/ |
1380 | #define EEPROM_NIC_TYPE_STANDARD 0 | 1329 | #define EEPROM_NIC_TYPE_STANDARD 0 |
@@ -1479,7 +1428,6 @@ enum { | |||
1479 | #define IPW_RATE_CAPABILITIES 1 | 1428 | #define IPW_RATE_CAPABILITIES 1 |
1480 | #define IPW_RATE_CONNECT 0 | 1429 | #define IPW_RATE_CONNECT 0 |
1481 | 1430 | ||
1482 | |||
1483 | /* | 1431 | /* |
1484 | * Rate values and masks | 1432 | * Rate values and masks |
1485 | */ | 1433 | */ |
@@ -1524,12 +1472,6 @@ enum { | |||
1524 | IPW_ORD_STAT_TX_DIR_DATA_B_11, | 1472 | IPW_ORD_STAT_TX_DIR_DATA_B_11, |
1525 | /* Hole */ | 1473 | /* Hole */ |
1526 | 1474 | ||
1527 | |||
1528 | |||
1529 | |||
1530 | |||
1531 | |||
1532 | |||
1533 | IPW_ORD_STAT_TX_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 19, | 1475 | IPW_ORD_STAT_TX_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 19, |
1534 | IPW_ORD_STAT_TX_DIR_DATA_G_2, | 1476 | IPW_ORD_STAT_TX_DIR_DATA_G_2, |
1535 | IPW_ORD_STAT_TX_DIR_DATA_G_5_5, | 1477 | IPW_ORD_STAT_TX_DIR_DATA_G_5_5, |
@@ -1549,12 +1491,6 @@ enum { | |||
1549 | IPW_ORD_STAT_TX_NON_DIR_DATA_B_11, | 1491 | IPW_ORD_STAT_TX_NON_DIR_DATA_B_11, |
1550 | /* Hole */ | 1492 | /* Hole */ |
1551 | 1493 | ||
1552 | |||
1553 | |||
1554 | |||
1555 | |||
1556 | |||
1557 | |||
1558 | IPW_ORD_STAT_TX_NON_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 44, | 1494 | IPW_ORD_STAT_TX_NON_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 44, |
1559 | IPW_ORD_STAT_TX_NON_DIR_DATA_G_2, | 1495 | IPW_ORD_STAT_TX_NON_DIR_DATA_G_2, |
1560 | IPW_ORD_STAT_TX_NON_DIR_DATA_G_5_5, | 1496 | IPW_ORD_STAT_TX_NON_DIR_DATA_G_5_5, |
@@ -1685,7 +1621,7 @@ struct host_cmd { | |||
1685 | #define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 | 1621 | #define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 |
1686 | #define CFG_BT_COEXISTENCE_OOB 0x10 | 1622 | #define CFG_BT_COEXISTENCE_OOB 0x10 |
1687 | #define CFG_BT_COEXISTENCE_MAX 0xFF | 1623 | #define CFG_BT_COEXISTENCE_MAX 0xFF |
1688 | #define CFG_BT_COEXISTENCE_DEF 0x80 /* read Bt from EEPROM*/ | 1624 | #define CFG_BT_COEXISTENCE_DEF 0x80 /* read Bt from EEPROM */ |
1689 | 1625 | ||
1690 | #define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x0 | 1626 | #define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x0 |
1691 | #define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x1 | 1627 | #define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x1 |
@@ -1727,11 +1663,11 @@ static inline u32 frame_hdr_len(struct ieee80211_hdr *hdr) | |||
1727 | fc = le16_to_cpu(hdr->frame_ctl); | 1663 | fc = le16_to_cpu(hdr->frame_ctl); |
1728 | 1664 | ||
1729 | /* | 1665 | /* |
1730 | * Function ToDS FromDS | 1666 | * Function ToDS FromDS |
1731 | * IBSS 0 0 | 1667 | * IBSS 0 0 |
1732 | * To AP 1 0 | 1668 | * To AP 1 0 |
1733 | * From AP 0 1 | 1669 | * From AP 0 1 |
1734 | * WDS (bridge) 1 1 | 1670 | * WDS (bridge) 1 1 |
1735 | * | 1671 | * |
1736 | * Only WDS frames use Address4 among them. --YZ | 1672 | * Only WDS frames use Address4 among them. --YZ |
1737 | */ | 1673 | */ |
@@ -1741,4 +1677,4 @@ static inline u32 frame_hdr_len(struct ieee80211_hdr *hdr) | |||
1741 | return retval; | 1677 | return retval; |
1742 | } | 1678 | } |
1743 | 1679 | ||
1744 | #endif /* __ipw2200_h__ */ | 1680 | #endif /* __ipw2200_h__ */ |
diff --git a/net/ieee80211/ieee80211_crypt.c b/net/ieee80211/ieee80211_crypt.c index 05a6f2f298db..61a9d92e455b 100644 --- a/net/ieee80211/ieee80211_crypt.c +++ b/net/ieee80211/ieee80211_crypt.c | |||
@@ -30,7 +30,6 @@ struct ieee80211_crypto_alg { | |||
30 | struct ieee80211_crypto_ops *ops; | 30 | struct ieee80211_crypto_ops *ops; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | |||
34 | struct ieee80211_crypto { | 33 | struct ieee80211_crypto { |
35 | struct list_head algs; | 34 | struct list_head algs; |
36 | spinlock_t lock; | 35 | spinlock_t lock; |
@@ -38,8 +37,7 @@ struct ieee80211_crypto { | |||
38 | 37 | ||
39 | static struct ieee80211_crypto *hcrypt; | 38 | static struct ieee80211_crypto *hcrypt; |
40 | 39 | ||
41 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, | 40 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) |
42 | int force) | ||
43 | { | 41 | { |
44 | struct list_head *ptr, *n; | 42 | struct list_head *ptr, *n; |
45 | struct ieee80211_crypt_data *entry; | 43 | struct ieee80211_crypt_data *entry; |
@@ -140,7 +138,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) | |||
140 | spin_lock_irqsave(&hcrypt->lock, flags); | 138 | spin_lock_irqsave(&hcrypt->lock, flags); |
141 | for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { | 139 | for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { |
142 | struct ieee80211_crypto_alg *alg = | 140 | struct ieee80211_crypto_alg *alg = |
143 | (struct ieee80211_crypto_alg *) ptr; | 141 | (struct ieee80211_crypto_alg *)ptr; |
144 | if (alg->ops == ops) { | 142 | if (alg->ops == ops) { |
145 | list_del(&alg->list); | 143 | list_del(&alg->list); |
146 | del_alg = alg; | 144 | del_alg = alg; |
@@ -158,8 +156,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) | |||
158 | return del_alg ? 0 : -1; | 156 | return del_alg ? 0 : -1; |
159 | } | 157 | } |
160 | 158 | ||
161 | 159 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) | |
162 | struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) | ||
163 | { | 160 | { |
164 | unsigned long flags; | 161 | unsigned long flags; |
165 | struct list_head *ptr; | 162 | struct list_head *ptr; |
@@ -171,7 +168,7 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) | |||
171 | spin_lock_irqsave(&hcrypt->lock, flags); | 168 | spin_lock_irqsave(&hcrypt->lock, flags); |
172 | for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { | 169 | for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { |
173 | struct ieee80211_crypto_alg *alg = | 170 | struct ieee80211_crypto_alg *alg = |
174 | (struct ieee80211_crypto_alg *) ptr; | 171 | (struct ieee80211_crypto_alg *)ptr; |
175 | if (strcmp(alg->ops->name, name) == 0) { | 172 | if (strcmp(alg->ops->name, name) == 0) { |
176 | found_alg = alg; | 173 | found_alg = alg; |
177 | break; | 174 | break; |
@@ -185,9 +182,13 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) | |||
185 | return NULL; | 182 | return NULL; |
186 | } | 183 | } |
187 | 184 | ||
188 | 185 | static void *ieee80211_crypt_null_init(int keyidx) | |
189 | static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } | 186 | { |
190 | static void ieee80211_crypt_null_deinit(void *priv) {} | 187 | return (void *)1; |
188 | } | ||
189 | static void ieee80211_crypt_null_deinit(void *priv) | ||
190 | { | ||
191 | } | ||
191 | 192 | ||
192 | static struct ieee80211_crypto_ops ieee80211_crypt_null = { | 193 | static struct ieee80211_crypto_ops ieee80211_crypt_null = { |
193 | .name = "NULL", | 194 | .name = "NULL", |
@@ -204,7 +205,6 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = { | |||
204 | .owner = THIS_MODULE, | 205 | .owner = THIS_MODULE, |
205 | }; | 206 | }; |
206 | 207 | ||
207 | |||
208 | static int __init ieee80211_crypto_init(void) | 208 | static int __init ieee80211_crypto_init(void) |
209 | { | 209 | { |
210 | int ret = -ENOMEM; | 210 | int ret = -ENOMEM; |
@@ -222,11 +222,10 @@ static int __init ieee80211_crypto_init(void) | |||
222 | kfree(hcrypt); | 222 | kfree(hcrypt); |
223 | hcrypt = NULL; | 223 | hcrypt = NULL; |
224 | } | 224 | } |
225 | out: | 225 | out: |
226 | return ret; | 226 | return ret; |
227 | } | 227 | } |
228 | 228 | ||
229 | |||
230 | static void __exit ieee80211_crypto_deinit(void) | 229 | static void __exit ieee80211_crypto_deinit(void) |
231 | { | 230 | { |
232 | struct list_head *ptr, *n; | 231 | struct list_head *ptr, *n; |
@@ -237,7 +236,7 @@ static void __exit ieee80211_crypto_deinit(void) | |||
237 | for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; | 236 | for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; |
238 | ptr = n, n = ptr->next) { | 237 | ptr = n, n = ptr->next) { |
239 | struct ieee80211_crypto_alg *alg = | 238 | struct ieee80211_crypto_alg *alg = |
240 | (struct ieee80211_crypto_alg *) ptr; | 239 | (struct ieee80211_crypto_alg *)ptr; |
241 | list_del(ptr); | 240 | list_del(ptr); |
242 | printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " | 241 | printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " |
243 | "'%s' (deinit)\n", alg->ops->name); | 242 | "'%s' (deinit)\n", alg->ops->name); |
diff --git a/net/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c index 11d15573b26a..8fc13f45971e 100644 --- a/net/ieee80211/ieee80211_crypt_ccmp.c +++ b/net/ieee80211/ieee80211_crypt_ccmp.c | |||
@@ -24,7 +24,6 @@ | |||
24 | 24 | ||
25 | #include <net/ieee80211.h> | 25 | #include <net/ieee80211.h> |
26 | 26 | ||
27 | |||
28 | #include <linux/crypto.h> | 27 | #include <linux/crypto.h> |
29 | #include <asm/scatterlist.h> | 28 | #include <asm/scatterlist.h> |
30 | 29 | ||
@@ -55,7 +54,7 @@ struct ieee80211_ccmp_data { | |||
55 | 54 | ||
56 | /* scratch buffers for virt_to_page() (crypto API) */ | 55 | /* scratch buffers for virt_to_page() (crypto API) */ |
57 | u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN], | 56 | u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN], |
58 | tx_e[AES_BLOCK_LEN], tx_s0[AES_BLOCK_LEN]; | 57 | tx_e[AES_BLOCK_LEN], tx_s0[AES_BLOCK_LEN]; |
59 | u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN]; | 58 | u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN]; |
60 | }; | 59 | }; |
61 | 60 | ||
@@ -75,7 +74,7 @@ static void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, | |||
75 | crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN); | 74 | crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN); |
76 | } | 75 | } |
77 | 76 | ||
78 | static void * ieee80211_ccmp_init(int key_idx) | 77 | static void *ieee80211_ccmp_init(int key_idx) |
79 | { | 78 | { |
80 | struct ieee80211_ccmp_data *priv; | 79 | struct ieee80211_ccmp_data *priv; |
81 | 80 | ||
@@ -94,7 +93,7 @@ static void * ieee80211_ccmp_init(int key_idx) | |||
94 | 93 | ||
95 | return priv; | 94 | return priv; |
96 | 95 | ||
97 | fail: | 96 | fail: |
98 | if (priv) { | 97 | if (priv) { |
99 | if (priv->tfm) | 98 | if (priv->tfm) |
100 | crypto_free_tfm(priv->tfm); | 99 | crypto_free_tfm(priv->tfm); |
@@ -104,7 +103,6 @@ fail: | |||
104 | return NULL; | 103 | return NULL; |
105 | } | 104 | } |
106 | 105 | ||
107 | |||
108 | static void ieee80211_ccmp_deinit(void *priv) | 106 | static void ieee80211_ccmp_deinit(void *priv) |
109 | { | 107 | { |
110 | struct ieee80211_ccmp_data *_priv = priv; | 108 | struct ieee80211_ccmp_data *_priv = priv; |
@@ -113,19 +111,16 @@ static void ieee80211_ccmp_deinit(void *priv) | |||
113 | kfree(priv); | 111 | kfree(priv); |
114 | } | 112 | } |
115 | 113 | ||
116 | 114 | static inline void xor_block(u8 * b, u8 * a, size_t len) | |
117 | static inline void xor_block(u8 *b, u8 *a, size_t len) | ||
118 | { | 115 | { |
119 | int i; | 116 | int i; |
120 | for (i = 0; i < len; i++) | 117 | for (i = 0; i < len; i++) |
121 | b[i] ^= a[i]; | 118 | b[i] ^= a[i]; |
122 | } | 119 | } |
123 | 120 | ||
124 | |||
125 | static void ccmp_init_blocks(struct crypto_tfm *tfm, | 121 | static void ccmp_init_blocks(struct crypto_tfm *tfm, |
126 | struct ieee80211_hdr *hdr, | 122 | struct ieee80211_hdr *hdr, |
127 | u8 *pn, size_t dlen, u8 *b0, u8 *auth, | 123 | u8 * pn, size_t dlen, u8 * b0, u8 * auth, u8 * s0) |
128 | u8 *s0) | ||
129 | { | 124 | { |
130 | u8 *pos, qc = 0; | 125 | u8 *pos, qc = 0; |
131 | size_t aad_len; | 126 | size_t aad_len; |
@@ -142,7 +137,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, | |||
142 | if (a4_included) | 137 | if (a4_included) |
143 | aad_len += 6; | 138 | aad_len += 6; |
144 | if (qc_included) { | 139 | if (qc_included) { |
145 | pos = (u8 *) &hdr->addr4; | 140 | pos = (u8 *) & hdr->addr4; |
146 | if (a4_included) | 141 | if (a4_included) |
147 | pos += 6; | 142 | pos += 6; |
148 | qc = *pos & 0x0f; | 143 | qc = *pos & 0x0f; |
@@ -169,14 +164,14 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, | |||
169 | * QC (if present) | 164 | * QC (if present) |
170 | */ | 165 | */ |
171 | pos = (u8 *) hdr; | 166 | pos = (u8 *) hdr; |
172 | aad[0] = 0; /* aad_len >> 8 */ | 167 | aad[0] = 0; /* aad_len >> 8 */ |
173 | aad[1] = aad_len & 0xff; | 168 | aad[1] = aad_len & 0xff; |
174 | aad[2] = pos[0] & 0x8f; | 169 | aad[2] = pos[0] & 0x8f; |
175 | aad[3] = pos[1] & 0xc7; | 170 | aad[3] = pos[1] & 0xc7; |
176 | memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN); | 171 | memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN); |
177 | pos = (u8 *) &hdr->seq_ctl; | 172 | pos = (u8 *) & hdr->seq_ctl; |
178 | aad[22] = pos[0] & 0x0f; | 173 | aad[22] = pos[0] & 0x0f; |
179 | aad[23] = 0; /* all bits masked */ | 174 | aad[23] = 0; /* all bits masked */ |
180 | memset(aad + 24, 0, 8); | 175 | memset(aad + 24, 0, 8); |
181 | if (a4_included) | 176 | if (a4_included) |
182 | memcpy(aad + 24, hdr->addr4, ETH_ALEN); | 177 | memcpy(aad + 24, hdr->addr4, ETH_ALEN); |
@@ -196,7 +191,6 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, | |||
196 | ieee80211_ccmp_aes_encrypt(tfm, b0, s0); | 191 | ieee80211_ccmp_aes_encrypt(tfm, b0, s0); |
197 | } | 192 | } |
198 | 193 | ||
199 | |||
200 | static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | 194 | static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) |
201 | { | 195 | { |
202 | struct ieee80211_ccmp_data *key = priv; | 196 | struct ieee80211_ccmp_data *key = priv; |
@@ -209,8 +203,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
209 | u8 *s0 = key->tx_s0; | 203 | u8 *s0 = key->tx_s0; |
210 | 204 | ||
211 | if (skb_headroom(skb) < CCMP_HDR_LEN || | 205 | if (skb_headroom(skb) < CCMP_HDR_LEN || |
212 | skb_tailroom(skb) < CCMP_MIC_LEN || | 206 | skb_tailroom(skb) < CCMP_MIC_LEN || skb->len < hdr_len) |
213 | skb->len < hdr_len) | ||
214 | return -1; | 207 | return -1; |
215 | 208 | ||
216 | data_len = skb->len - hdr_len; | 209 | data_len = skb->len - hdr_len; |
@@ -230,13 +223,13 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
230 | *pos++ = key->tx_pn[5]; | 223 | *pos++ = key->tx_pn[5]; |
231 | *pos++ = key->tx_pn[4]; | 224 | *pos++ = key->tx_pn[4]; |
232 | *pos++ = 0; | 225 | *pos++ = 0; |
233 | *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */; | 226 | *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */ ; |
234 | *pos++ = key->tx_pn[3]; | 227 | *pos++ = key->tx_pn[3]; |
235 | *pos++ = key->tx_pn[2]; | 228 | *pos++ = key->tx_pn[2]; |
236 | *pos++ = key->tx_pn[1]; | 229 | *pos++ = key->tx_pn[1]; |
237 | *pos++ = key->tx_pn[0]; | 230 | *pos++ = key->tx_pn[0]; |
238 | 231 | ||
239 | hdr = (struct ieee80211_hdr *) skb->data; | 232 | hdr = (struct ieee80211_hdr *)skb->data; |
240 | ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); | 233 | ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); |
241 | 234 | ||
242 | blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; | 235 | blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; |
@@ -261,7 +254,6 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
261 | return 0; | 254 | return 0; |
262 | } | 255 | } |
263 | 256 | ||
264 | |||
265 | static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | 257 | static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) |
266 | { | 258 | { |
267 | struct ieee80211_ccmp_data *key = priv; | 259 | struct ieee80211_ccmp_data *key = priv; |
@@ -280,7 +272,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
280 | return -1; | 272 | return -1; |
281 | } | 273 | } |
282 | 274 | ||
283 | hdr = (struct ieee80211_hdr *) skb->data; | 275 | hdr = (struct ieee80211_hdr *)skb->data; |
284 | pos = skb->data + hdr_len; | 276 | pos = skb->data + hdr_len; |
285 | keyidx = pos[3]; | 277 | keyidx = pos[3]; |
286 | if (!(keyidx & (1 << 5))) { | 278 | if (!(keyidx & (1 << 5))) { |
@@ -364,8 +356,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
364 | return keyidx; | 356 | return keyidx; |
365 | } | 357 | } |
366 | 358 | ||
367 | 359 | static int ieee80211_ccmp_set_key(void *key, int len, u8 * seq, void *priv) | |
368 | static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv) | ||
369 | { | 360 | { |
370 | struct ieee80211_ccmp_data *data = priv; | 361 | struct ieee80211_ccmp_data *data = priv; |
371 | int keyidx; | 362 | int keyidx; |
@@ -395,8 +386,7 @@ static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv) | |||
395 | return 0; | 386 | return 0; |
396 | } | 387 | } |
397 | 388 | ||
398 | 389 | static int ieee80211_ccmp_get_key(void *key, int len, u8 * seq, void *priv) | |
399 | static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) | ||
400 | { | 390 | { |
401 | struct ieee80211_ccmp_data *data = priv; | 391 | struct ieee80211_ccmp_data *data = priv; |
402 | 392 | ||
@@ -419,8 +409,7 @@ static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) | |||
419 | return CCMP_TK_LEN; | 409 | return CCMP_TK_LEN; |
420 | } | 410 | } |
421 | 411 | ||
422 | 412 | static char *ieee80211_ccmp_print_stats(char *p, void *priv) | |
423 | static char * ieee80211_ccmp_print_stats(char *p, void *priv) | ||
424 | { | 413 | { |
425 | struct ieee80211_ccmp_data *ccmp = priv; | 414 | struct ieee80211_ccmp_data *ccmp = priv; |
426 | p += sprintf(p, "key[%d] alg=CCMP key_set=%d " | 415 | p += sprintf(p, "key[%d] alg=CCMP key_set=%d " |
@@ -436,7 +425,6 @@ static char * ieee80211_ccmp_print_stats(char *p, void *priv) | |||
436 | return p; | 425 | return p; |
437 | } | 426 | } |
438 | 427 | ||
439 | |||
440 | static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { | 428 | static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { |
441 | .name = "CCMP", | 429 | .name = "CCMP", |
442 | .init = ieee80211_ccmp_init, | 430 | .init = ieee80211_ccmp_init, |
@@ -453,18 +441,15 @@ static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { | |||
453 | .owner = THIS_MODULE, | 441 | .owner = THIS_MODULE, |
454 | }; | 442 | }; |
455 | 443 | ||
456 | |||
457 | static int __init ieee80211_crypto_ccmp_init(void) | 444 | static int __init ieee80211_crypto_ccmp_init(void) |
458 | { | 445 | { |
459 | return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); | 446 | return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); |
460 | } | 447 | } |
461 | 448 | ||
462 | |||
463 | static void __exit ieee80211_crypto_ccmp_exit(void) | 449 | static void __exit ieee80211_crypto_ccmp_exit(void) |
464 | { | 450 | { |
465 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); | 451 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); |
466 | } | 452 | } |
467 | 453 | ||
468 | |||
469 | module_init(ieee80211_crypto_ccmp_init); | 454 | module_init(ieee80211_crypto_ccmp_init); |
470 | module_exit(ieee80211_crypto_ccmp_exit); | 455 | module_exit(ieee80211_crypto_ccmp_exit); |
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c index f91d92c6df25..d4f9164be1a1 100644 --- a/net/ieee80211/ieee80211_crypt_tkip.c +++ b/net/ieee80211/ieee80211_crypt_tkip.c | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #include <net/ieee80211.h> | 24 | #include <net/ieee80211.h> |
25 | 25 | ||
26 | |||
27 | #include <linux/crypto.h> | 26 | #include <linux/crypto.h> |
28 | #include <asm/scatterlist.h> | 27 | #include <asm/scatterlist.h> |
29 | #include <linux/crc32.h> | 28 | #include <linux/crc32.h> |
@@ -62,7 +61,7 @@ struct ieee80211_tkip_data { | |||
62 | u8 rx_hdr[16], tx_hdr[16]; | 61 | u8 rx_hdr[16], tx_hdr[16]; |
63 | }; | 62 | }; |
64 | 63 | ||
65 | static void * ieee80211_tkip_init(int key_idx) | 64 | static void *ieee80211_tkip_init(int key_idx) |
66 | { | 65 | { |
67 | struct ieee80211_tkip_data *priv; | 66 | struct ieee80211_tkip_data *priv; |
68 | 67 | ||
@@ -88,7 +87,7 @@ static void * ieee80211_tkip_init(int key_idx) | |||
88 | 87 | ||
89 | return priv; | 88 | return priv; |
90 | 89 | ||
91 | fail: | 90 | fail: |
92 | if (priv) { | 91 | if (priv) { |
93 | if (priv->tfm_michael) | 92 | if (priv->tfm_michael) |
94 | crypto_free_tfm(priv->tfm_michael); | 93 | crypto_free_tfm(priv->tfm_michael); |
@@ -100,7 +99,6 @@ fail: | |||
100 | return NULL; | 99 | return NULL; |
101 | } | 100 | } |
102 | 101 | ||
103 | |||
104 | static void ieee80211_tkip_deinit(void *priv) | 102 | static void ieee80211_tkip_deinit(void *priv) |
105 | { | 103 | { |
106 | struct ieee80211_tkip_data *_priv = priv; | 104 | struct ieee80211_tkip_data *_priv = priv; |
@@ -111,51 +109,42 @@ static void ieee80211_tkip_deinit(void *priv) | |||
111 | kfree(priv); | 109 | kfree(priv); |
112 | } | 110 | } |
113 | 111 | ||
114 | |||
115 | static inline u16 RotR1(u16 val) | 112 | static inline u16 RotR1(u16 val) |
116 | { | 113 | { |
117 | return (val >> 1) | (val << 15); | 114 | return (val >> 1) | (val << 15); |
118 | } | 115 | } |
119 | 116 | ||
120 | |||
121 | static inline u8 Lo8(u16 val) | 117 | static inline u8 Lo8(u16 val) |
122 | { | 118 | { |
123 | return val & 0xff; | 119 | return val & 0xff; |
124 | } | 120 | } |
125 | 121 | ||
126 | |||
127 | static inline u8 Hi8(u16 val) | 122 | static inline u8 Hi8(u16 val) |
128 | { | 123 | { |
129 | return val >> 8; | 124 | return val >> 8; |
130 | } | 125 | } |
131 | 126 | ||
132 | |||
133 | static inline u16 Lo16(u32 val) | 127 | static inline u16 Lo16(u32 val) |
134 | { | 128 | { |
135 | return val & 0xffff; | 129 | return val & 0xffff; |
136 | } | 130 | } |
137 | 131 | ||
138 | |||
139 | static inline u16 Hi16(u32 val) | 132 | static inline u16 Hi16(u32 val) |
140 | { | 133 | { |
141 | return val >> 16; | 134 | return val >> 16; |
142 | } | 135 | } |
143 | 136 | ||
144 | |||
145 | static inline u16 Mk16(u8 hi, u8 lo) | 137 | static inline u16 Mk16(u8 hi, u8 lo) |
146 | { | 138 | { |
147 | return lo | (((u16) hi) << 8); | 139 | return lo | (((u16) hi) << 8); |
148 | } | 140 | } |
149 | 141 | ||
150 | 142 | static inline u16 Mk16_le(u16 * v) | |
151 | static inline u16 Mk16_le(u16 *v) | ||
152 | { | 143 | { |
153 | return le16_to_cpu(*v); | 144 | return le16_to_cpu(*v); |
154 | } | 145 | } |
155 | 146 | ||
156 | 147 | static const u16 Sbox[256] = { | |
157 | static const u16 Sbox[256] = | ||
158 | { | ||
159 | 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, | 148 | 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, |
160 | 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, | 149 | 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, |
161 | 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, | 150 | 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, |
@@ -190,17 +179,16 @@ static const u16 Sbox[256] = | |||
190 | 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, | 179 | 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, |
191 | }; | 180 | }; |
192 | 181 | ||
193 | |||
194 | static inline u16 _S_(u16 v) | 182 | static inline u16 _S_(u16 v) |
195 | { | 183 | { |
196 | u16 t = Sbox[Hi8(v)]; | 184 | u16 t = Sbox[Hi8(v)]; |
197 | return Sbox[Lo8(v)] ^ ((t << 8) | (t >> 8)); | 185 | return Sbox[Lo8(v)] ^ ((t << 8) | (t >> 8)); |
198 | } | 186 | } |
199 | 187 | ||
200 | |||
201 | #define PHASE1_LOOP_COUNT 8 | 188 | #define PHASE1_LOOP_COUNT 8 |
202 | 189 | ||
203 | static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) | 190 | static void tkip_mixing_phase1(u16 * TTAK, const u8 * TK, const u8 * TA, |
191 | u32 IV32) | ||
204 | { | 192 | { |
205 | int i, j; | 193 | int i, j; |
206 | 194 | ||
@@ -221,13 +209,12 @@ static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) | |||
221 | } | 209 | } |
222 | } | 210 | } |
223 | 211 | ||
224 | 212 | static void tkip_mixing_phase2(u8 * WEPSeed, const u8 * TK, const u16 * TTAK, | |
225 | static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, | ||
226 | u16 IV16) | 213 | u16 IV16) |
227 | { | 214 | { |
228 | /* Make temporary area overlap WEP seed so that the final copy can be | 215 | /* Make temporary area overlap WEP seed so that the final copy can be |
229 | * avoided on little endian hosts. */ | 216 | * avoided on little endian hosts. */ |
230 | u16 *PPK = (u16 *) &WEPSeed[4]; | 217 | u16 *PPK = (u16 *) & WEPSeed[4]; |
231 | 218 | ||
232 | /* Step 1 - make copy of TTAK and bring in TSC */ | 219 | /* Step 1 - make copy of TTAK and bring in TSC */ |
233 | PPK[0] = TTAK[0]; | 220 | PPK[0] = TTAK[0]; |
@@ -238,15 +225,15 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, | |||
238 | PPK[5] = TTAK[4] + IV16; | 225 | PPK[5] = TTAK[4] + IV16; |
239 | 226 | ||
240 | /* Step 2 - 96-bit bijective mixing using S-box */ | 227 | /* Step 2 - 96-bit bijective mixing using S-box */ |
241 | PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0])); | 228 | PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) & TK[0])); |
242 | PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) &TK[2])); | 229 | PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) & TK[2])); |
243 | PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) &TK[4])); | 230 | PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) & TK[4])); |
244 | PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) &TK[6])); | 231 | PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) & TK[6])); |
245 | PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) &TK[8])); | 232 | PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) & TK[8])); |
246 | PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) &TK[10])); | 233 | PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) & TK[10])); |
247 | 234 | ||
248 | PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) &TK[12])); | 235 | PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) & TK[12])); |
249 | PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) &TK[14])); | 236 | PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) & TK[14])); |
250 | PPK[2] += RotR1(PPK[1]); | 237 | PPK[2] += RotR1(PPK[1]); |
251 | PPK[3] += RotR1(PPK[2]); | 238 | PPK[3] += RotR1(PPK[2]); |
252 | PPK[4] += RotR1(PPK[3]); | 239 | PPK[4] += RotR1(PPK[3]); |
@@ -257,7 +244,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, | |||
257 | WEPSeed[0] = Hi8(IV16); | 244 | WEPSeed[0] = Hi8(IV16); |
258 | WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; | 245 | WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; |
259 | WEPSeed[2] = Lo8(IV16); | 246 | WEPSeed[2] = Lo8(IV16); |
260 | WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) &TK[0])) >> 1); | 247 | WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) & TK[0])) >> 1); |
261 | 248 | ||
262 | #ifdef __BIG_ENDIAN | 249 | #ifdef __BIG_ENDIAN |
263 | { | 250 | { |
@@ -281,7 +268,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
281 | skb->len < hdr_len) | 268 | skb->len < hdr_len) |
282 | return -1; | 269 | return -1; |
283 | 270 | ||
284 | hdr = (struct ieee80211_hdr *) skb->data; | 271 | hdr = (struct ieee80211_hdr *)skb->data; |
285 | if (!tkey->tx_phase1_done) { | 272 | if (!tkey->tx_phase1_done) { |
286 | tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, | 273 | tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, |
287 | tkey->tx_iv32); | 274 | tkey->tx_iv32); |
@@ -298,7 +285,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
298 | *pos++ = rc4key[0]; | 285 | *pos++ = rc4key[0]; |
299 | *pos++ = rc4key[1]; | 286 | *pos++ = rc4key[1]; |
300 | *pos++ = rc4key[2]; | 287 | *pos++ = rc4key[2]; |
301 | *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */; | 288 | *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */ ; |
302 | *pos++ = tkey->tx_iv32 & 0xff; | 289 | *pos++ = tkey->tx_iv32 & 0xff; |
303 | *pos++ = (tkey->tx_iv32 >> 8) & 0xff; | 290 | *pos++ = (tkey->tx_iv32 >> 8) & 0xff; |
304 | *pos++ = (tkey->tx_iv32 >> 16) & 0xff; | 291 | *pos++ = (tkey->tx_iv32 >> 16) & 0xff; |
@@ -341,7 +328,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
341 | if (skb->len < hdr_len + 8 + 4) | 328 | if (skb->len < hdr_len + 8 + 4) |
342 | return -1; | 329 | return -1; |
343 | 330 | ||
344 | hdr = (struct ieee80211_hdr *) skb->data; | 331 | hdr = (struct ieee80211_hdr *)skb->data; |
345 | pos = skb->data + hdr_len; | 332 | pos = skb->data + hdr_len; |
346 | keyidx = pos[3]; | 333 | keyidx = pos[3]; |
347 | if (!(keyidx & (1 << 5))) { | 334 | if (!(keyidx & (1 << 5))) { |
@@ -427,9 +414,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
427 | return keyidx; | 414 | return keyidx; |
428 | } | 415 | } |
429 | 416 | ||
430 | 417 | static int michael_mic(struct ieee80211_tkip_data *tkey, u8 * key, u8 * hdr, | |
431 | static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr, | 418 | u8 * data, size_t data_len, u8 * mic) |
432 | u8 *data, size_t data_len, u8 *mic) | ||
433 | { | 419 | { |
434 | struct scatterlist sg[2]; | 420 | struct scatterlist sg[2]; |
435 | 421 | ||
@@ -453,37 +439,37 @@ static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr, | |||
453 | return 0; | 439 | return 0; |
454 | } | 440 | } |
455 | 441 | ||
456 | static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) | 442 | static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr) |
457 | { | 443 | { |
458 | struct ieee80211_hdr *hdr11; | 444 | struct ieee80211_hdr *hdr11; |
459 | 445 | ||
460 | hdr11 = (struct ieee80211_hdr *) skb->data; | 446 | hdr11 = (struct ieee80211_hdr *)skb->data; |
461 | switch (le16_to_cpu(hdr11->frame_ctl) & | 447 | switch (le16_to_cpu(hdr11->frame_ctl) & |
462 | (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { | 448 | (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { |
463 | case IEEE80211_FCTL_TODS: | 449 | case IEEE80211_FCTL_TODS: |
464 | memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ | 450 | memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ |
465 | memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ | 451 | memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ |
466 | break; | 452 | break; |
467 | case IEEE80211_FCTL_FROMDS: | 453 | case IEEE80211_FCTL_FROMDS: |
468 | memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ | 454 | memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ |
469 | memcpy(hdr + ETH_ALEN, hdr11->addr3, ETH_ALEN); /* SA */ | 455 | memcpy(hdr + ETH_ALEN, hdr11->addr3, ETH_ALEN); /* SA */ |
470 | break; | 456 | break; |
471 | case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: | 457 | case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: |
472 | memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ | 458 | memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ |
473 | memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */ | 459 | memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */ |
474 | break; | 460 | break; |
475 | case 0: | 461 | case 0: |
476 | memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ | 462 | memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ |
477 | memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ | 463 | memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ |
478 | break; | 464 | break; |
479 | } | 465 | } |
480 | 466 | ||
481 | hdr[12] = 0; /* priority */ | 467 | hdr[12] = 0; /* priority */ |
482 | hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */ | 468 | hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */ |
483 | } | 469 | } |
484 | 470 | ||
485 | 471 | static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, | |
486 | static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) | 472 | void *priv) |
487 | { | 473 | { |
488 | struct ieee80211_tkip_data *tkey = priv; | 474 | struct ieee80211_tkip_data *tkey = priv; |
489 | u8 *pos; | 475 | u8 *pos; |
@@ -504,11 +490,9 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri | |||
504 | return 0; | 490 | return 0; |
505 | } | 491 | } |
506 | 492 | ||
507 | |||
508 | #if WIRELESS_EXT >= 18 | 493 | #if WIRELESS_EXT >= 18 |
509 | static void ieee80211_michael_mic_failure(struct net_device *dev, | 494 | static void ieee80211_michael_mic_failure(struct net_device *dev, |
510 | struct ieee80211_hdr *hdr, | 495 | struct ieee80211_hdr *hdr, int keyidx) |
511 | int keyidx) | ||
512 | { | 496 | { |
513 | union iwreq_data wrqu; | 497 | union iwreq_data wrqu; |
514 | struct iw_michaelmicfailure ev; | 498 | struct iw_michaelmicfailure ev; |
@@ -524,12 +508,11 @@ static void ieee80211_michael_mic_failure(struct net_device *dev, | |||
524 | memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN); | 508 | memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN); |
525 | memset(&wrqu, 0, sizeof(wrqu)); | 509 | memset(&wrqu, 0, sizeof(wrqu)); |
526 | wrqu.data.length = sizeof(ev); | 510 | wrqu.data.length = sizeof(ev); |
527 | wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); | 511 | wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&ev); |
528 | } | 512 | } |
529 | #elif WIRELESS_EXT >= 15 | 513 | #elif WIRELESS_EXT >= 15 |
530 | static void ieee80211_michael_mic_failure(struct net_device *dev, | 514 | static void ieee80211_michael_mic_failure(struct net_device *dev, |
531 | struct ieee80211_hdr *hdr, | 515 | struct ieee80211_hdr *hdr, int keyidx) |
532 | int keyidx) | ||
533 | { | 516 | { |
534 | union iwreq_data wrqu; | 517 | union iwreq_data wrqu; |
535 | char buf[128]; | 518 | char buf[128]; |
@@ -542,17 +525,16 @@ static void ieee80211_michael_mic_failure(struct net_device *dev, | |||
542 | wrqu.data.length = strlen(buf); | 525 | wrqu.data.length = strlen(buf); |
543 | wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); | 526 | wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); |
544 | } | 527 | } |
545 | #else /* WIRELESS_EXT >= 15 */ | 528 | #else /* WIRELESS_EXT >= 15 */ |
546 | static inline void ieee80211_michael_mic_failure(struct net_device *dev, | 529 | static inline void ieee80211_michael_mic_failure(struct net_device *dev, |
547 | struct ieee80211_hdr *hdr, | 530 | struct ieee80211_hdr *hdr, |
548 | int keyidx) | 531 | int keyidx) |
549 | { | 532 | { |
550 | } | 533 | } |
551 | #endif /* WIRELESS_EXT >= 15 */ | 534 | #endif /* WIRELESS_EXT >= 15 */ |
552 | |||
553 | 535 | ||
554 | static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, | 536 | static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, |
555 | int hdr_len, void *priv) | 537 | int hdr_len, void *priv) |
556 | { | 538 | { |
557 | struct ieee80211_tkip_data *tkey = priv; | 539 | struct ieee80211_tkip_data *tkey = priv; |
558 | u8 mic[8]; | 540 | u8 mic[8]; |
@@ -566,7 +548,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, | |||
566 | return -1; | 548 | return -1; |
567 | if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { | 549 | if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { |
568 | struct ieee80211_hdr *hdr; | 550 | struct ieee80211_hdr *hdr; |
569 | hdr = (struct ieee80211_hdr *) skb->data; | 551 | hdr = (struct ieee80211_hdr *)skb->data; |
570 | printk(KERN_DEBUG "%s: Michael MIC verification failed for " | 552 | printk(KERN_DEBUG "%s: Michael MIC verification failed for " |
571 | "MSDU from " MAC_FMT " keyidx=%d\n", | 553 | "MSDU from " MAC_FMT " keyidx=%d\n", |
572 | skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), | 554 | skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), |
@@ -587,8 +569,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, | |||
587 | return 0; | 569 | return 0; |
588 | } | 570 | } |
589 | 571 | ||
590 | 572 | static int ieee80211_tkip_set_key(void *key, int len, u8 * seq, void *priv) | |
591 | static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) | ||
592 | { | 573 | { |
593 | struct ieee80211_tkip_data *tkey = priv; | 574 | struct ieee80211_tkip_data *tkey = priv; |
594 | int keyidx; | 575 | int keyidx; |
@@ -603,10 +584,10 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) | |||
603 | if (len == TKIP_KEY_LEN) { | 584 | if (len == TKIP_KEY_LEN) { |
604 | memcpy(tkey->key, key, TKIP_KEY_LEN); | 585 | memcpy(tkey->key, key, TKIP_KEY_LEN); |
605 | tkey->key_set = 1; | 586 | tkey->key_set = 1; |
606 | tkey->tx_iv16 = 1; /* TSC is initialized to 1 */ | 587 | tkey->tx_iv16 = 1; /* TSC is initialized to 1 */ |
607 | if (seq) { | 588 | if (seq) { |
608 | tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) | | 589 | tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) | |
609 | (seq[3] << 8) | seq[2]; | 590 | (seq[3] << 8) | seq[2]; |
610 | tkey->rx_iv16 = (seq[1] << 8) | seq[0]; | 591 | tkey->rx_iv16 = (seq[1] << 8) | seq[0]; |
611 | } | 592 | } |
612 | } else if (len == 0) | 593 | } else if (len == 0) |
@@ -617,8 +598,7 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) | |||
617 | return 0; | 598 | return 0; |
618 | } | 599 | } |
619 | 600 | ||
620 | 601 | static int ieee80211_tkip_get_key(void *key, int len, u8 * seq, void *priv) | |
621 | static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) | ||
622 | { | 602 | { |
623 | struct ieee80211_tkip_data *tkey = priv; | 603 | struct ieee80211_tkip_data *tkey = priv; |
624 | 604 | ||
@@ -647,8 +627,7 @@ static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) | |||
647 | return TKIP_KEY_LEN; | 627 | return TKIP_KEY_LEN; |
648 | } | 628 | } |
649 | 629 | ||
650 | 630 | static char *ieee80211_tkip_print_stats(char *p, void *priv) | |
651 | static char * ieee80211_tkip_print_stats(char *p, void *priv) | ||
652 | { | 631 | { |
653 | struct ieee80211_tkip_data *tkip = priv; | 632 | struct ieee80211_tkip_data *tkip = priv; |
654 | p += sprintf(p, "key[%d] alg=TKIP key_set=%d " | 633 | p += sprintf(p, "key[%d] alg=TKIP key_set=%d " |
@@ -674,7 +653,6 @@ static char * ieee80211_tkip_print_stats(char *p, void *priv) | |||
674 | return p; | 653 | return p; |
675 | } | 654 | } |
676 | 655 | ||
677 | |||
678 | static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { | 656 | static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { |
679 | .name = "TKIP", | 657 | .name = "TKIP", |
680 | .init = ieee80211_tkip_init, | 658 | .init = ieee80211_tkip_init, |
@@ -686,23 +664,20 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { | |||
686 | .set_key = ieee80211_tkip_set_key, | 664 | .set_key = ieee80211_tkip_set_key, |
687 | .get_key = ieee80211_tkip_get_key, | 665 | .get_key = ieee80211_tkip_get_key, |
688 | .print_stats = ieee80211_tkip_print_stats, | 666 | .print_stats = ieee80211_tkip_print_stats, |
689 | .extra_prefix_len = 4 + 4, /* IV + ExtIV */ | 667 | .extra_prefix_len = 4 + 4, /* IV + ExtIV */ |
690 | .extra_postfix_len = 8 + 4, /* MIC + ICV */ | 668 | .extra_postfix_len = 8 + 4, /* MIC + ICV */ |
691 | .owner = THIS_MODULE, | 669 | .owner = THIS_MODULE, |
692 | }; | 670 | }; |
693 | 671 | ||
694 | |||
695 | static int __init ieee80211_crypto_tkip_init(void) | 672 | static int __init ieee80211_crypto_tkip_init(void) |
696 | { | 673 | { |
697 | return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); | 674 | return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); |
698 | } | 675 | } |
699 | 676 | ||
700 | |||
701 | static void __exit ieee80211_crypto_tkip_exit(void) | 677 | static void __exit ieee80211_crypto_tkip_exit(void) |
702 | { | 678 | { |
703 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); | 679 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); |
704 | } | 680 | } |
705 | 681 | ||
706 | |||
707 | module_init(ieee80211_crypto_tkip_init); | 682 | module_init(ieee80211_crypto_tkip_init); |
708 | module_exit(ieee80211_crypto_tkip_exit); | 683 | module_exit(ieee80211_crypto_tkip_exit); |
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c index bec1d3470d39..b4d2514a0902 100644 --- a/net/ieee80211/ieee80211_crypt_wep.c +++ b/net/ieee80211/ieee80211_crypt_wep.c | |||
@@ -20,7 +20,6 @@ | |||
20 | 20 | ||
21 | #include <net/ieee80211.h> | 21 | #include <net/ieee80211.h> |
22 | 22 | ||
23 | |||
24 | #include <linux/crypto.h> | 23 | #include <linux/crypto.h> |
25 | #include <asm/scatterlist.h> | 24 | #include <asm/scatterlist.h> |
26 | #include <linux/crc32.h> | 25 | #include <linux/crc32.h> |
@@ -29,7 +28,6 @@ MODULE_AUTHOR("Jouni Malinen"); | |||
29 | MODULE_DESCRIPTION("Host AP crypt: WEP"); | 28 | MODULE_DESCRIPTION("Host AP crypt: WEP"); |
30 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
31 | 30 | ||
32 | |||
33 | struct prism2_wep_data { | 31 | struct prism2_wep_data { |
34 | u32 iv; | 32 | u32 iv; |
35 | #define WEP_KEY_LEN 13 | 33 | #define WEP_KEY_LEN 13 |
@@ -39,8 +37,7 @@ struct prism2_wep_data { | |||
39 | struct crypto_tfm *tfm; | 37 | struct crypto_tfm *tfm; |
40 | }; | 38 | }; |
41 | 39 | ||
42 | 40 | static void *prism2_wep_init(int keyidx) | |
43 | static void * prism2_wep_init(int keyidx) | ||
44 | { | 41 | { |
45 | struct prism2_wep_data *priv; | 42 | struct prism2_wep_data *priv; |
46 | 43 | ||
@@ -62,7 +59,7 @@ static void * prism2_wep_init(int keyidx) | |||
62 | 59 | ||
63 | return priv; | 60 | return priv; |
64 | 61 | ||
65 | fail: | 62 | fail: |
66 | if (priv) { | 63 | if (priv) { |
67 | if (priv->tfm) | 64 | if (priv->tfm) |
68 | crypto_free_tfm(priv->tfm); | 65 | crypto_free_tfm(priv->tfm); |
@@ -71,7 +68,6 @@ fail: | |||
71 | return NULL; | 68 | return NULL; |
72 | } | 69 | } |
73 | 70 | ||
74 | |||
75 | static void prism2_wep_deinit(void *priv) | 71 | static void prism2_wep_deinit(void *priv) |
76 | { | 72 | { |
77 | struct prism2_wep_data *_priv = priv; | 73 | struct prism2_wep_data *_priv = priv; |
@@ -80,7 +76,6 @@ static void prism2_wep_deinit(void *priv) | |||
80 | kfree(priv); | 76 | kfree(priv); |
81 | } | 77 | } |
82 | 78 | ||
83 | |||
84 | /* Perform WEP encryption on given skb that has at least 4 bytes of headroom | 79 | /* Perform WEP encryption on given skb that has at least 4 bytes of headroom |
85 | * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, | 80 | * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, |
86 | * so the payload length increases with 8 bytes. | 81 | * so the payload length increases with 8 bytes. |
@@ -143,7 +138,6 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
143 | return 0; | 138 | return 0; |
144 | } | 139 | } |
145 | 140 | ||
146 | |||
147 | /* Perform WEP decryption on given buffer. Buffer includes whole WEP part of | 141 | /* Perform WEP decryption on given buffer. Buffer includes whole WEP part of |
148 | * the frame: IV (4 bytes), encrypted payload (including SNAP header), | 142 | * the frame: IV (4 bytes), encrypted payload (including SNAP header), |
149 | * ICV (4 bytes). len includes both IV and ICV. | 143 | * ICV (4 bytes). len includes both IV and ICV. |
@@ -202,8 +196,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
202 | return 0; | 196 | return 0; |
203 | } | 197 | } |
204 | 198 | ||
205 | 199 | static int prism2_wep_set_key(void *key, int len, u8 * seq, void *priv) | |
206 | static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv) | ||
207 | { | 200 | { |
208 | struct prism2_wep_data *wep = priv; | 201 | struct prism2_wep_data *wep = priv; |
209 | 202 | ||
@@ -216,8 +209,7 @@ static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv) | |||
216 | return 0; | 209 | return 0; |
217 | } | 210 | } |
218 | 211 | ||
219 | 212 | static int prism2_wep_get_key(void *key, int len, u8 * seq, void *priv) | |
220 | static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) | ||
221 | { | 213 | { |
222 | struct prism2_wep_data *wep = priv; | 214 | struct prism2_wep_data *wep = priv; |
223 | 215 | ||
@@ -229,16 +221,13 @@ static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) | |||
229 | return wep->key_len; | 221 | return wep->key_len; |
230 | } | 222 | } |
231 | 223 | ||
232 | 224 | static char *prism2_wep_print_stats(char *p, void *priv) | |
233 | static char * prism2_wep_print_stats(char *p, void *priv) | ||
234 | { | 225 | { |
235 | struct prism2_wep_data *wep = priv; | 226 | struct prism2_wep_data *wep = priv; |
236 | p += sprintf(p, "key[%d] alg=WEP len=%d\n", | 227 | p += sprintf(p, "key[%d] alg=WEP len=%d\n", wep->key_idx, wep->key_len); |
237 | wep->key_idx, wep->key_len); | ||
238 | return p; | 228 | return p; |
239 | } | 229 | } |
240 | 230 | ||
241 | |||
242 | static struct ieee80211_crypto_ops ieee80211_crypt_wep = { | 231 | static struct ieee80211_crypto_ops ieee80211_crypt_wep = { |
243 | .name = "WEP", | 232 | .name = "WEP", |
244 | .init = prism2_wep_init, | 233 | .init = prism2_wep_init, |
@@ -250,23 +239,20 @@ static struct ieee80211_crypto_ops ieee80211_crypt_wep = { | |||
250 | .set_key = prism2_wep_set_key, | 239 | .set_key = prism2_wep_set_key, |
251 | .get_key = prism2_wep_get_key, | 240 | .get_key = prism2_wep_get_key, |
252 | .print_stats = prism2_wep_print_stats, | 241 | .print_stats = prism2_wep_print_stats, |
253 | .extra_prefix_len = 4, /* IV */ | 242 | .extra_prefix_len = 4, /* IV */ |
254 | .extra_postfix_len = 4, /* ICV */ | 243 | .extra_postfix_len = 4, /* ICV */ |
255 | .owner = THIS_MODULE, | 244 | .owner = THIS_MODULE, |
256 | }; | 245 | }; |
257 | 246 | ||
258 | |||
259 | static int __init ieee80211_crypto_wep_init(void) | 247 | static int __init ieee80211_crypto_wep_init(void) |
260 | { | 248 | { |
261 | return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); | 249 | return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); |
262 | } | 250 | } |
263 | 251 | ||
264 | |||
265 | static void __exit ieee80211_crypto_wep_exit(void) | 252 | static void __exit ieee80211_crypto_wep_exit(void) |
266 | { | 253 | { |
267 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); | 254 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); |
268 | } | 255 | } |
269 | 256 | ||
270 | |||
271 | module_init(ieee80211_crypto_wep_init); | 257 | module_init(ieee80211_crypto_wep_init); |
272 | module_exit(ieee80211_crypto_wep_exit); | 258 | module_exit(ieee80211_crypto_wep_exit); |
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c index 553acb2e93d5..03a47343ddc7 100644 --- a/net/ieee80211/ieee80211_module.c +++ b/net/ieee80211/ieee80211_module.c | |||
@@ -54,7 +54,8 @@ | |||
54 | #include <net/ieee80211.h> | 54 | #include <net/ieee80211.h> |
55 | 55 | ||
56 | MODULE_DESCRIPTION("802.11 data/management/control stack"); | 56 | MODULE_DESCRIPTION("802.11 data/management/control stack"); |
57 | MODULE_AUTHOR("Copyright (C) 2004 Intel Corporation <jketreno@linux.intel.com>"); | 57 | MODULE_AUTHOR |
58 | ("Copyright (C) 2004 Intel Corporation <jketreno@linux.intel.com>"); | ||
58 | MODULE_LICENSE("GPL"); | 59 | MODULE_LICENSE("GPL"); |
59 | 60 | ||
60 | #define DRV_NAME "ieee80211" | 61 | #define DRV_NAME "ieee80211" |
@@ -64,9 +65,9 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) | |||
64 | if (ieee->networks) | 65 | if (ieee->networks) |
65 | return 0; | 66 | return 0; |
66 | 67 | ||
67 | ieee->networks = kmalloc( | 68 | ieee->networks = |
68 | MAX_NETWORK_COUNT * sizeof(struct ieee80211_network), | 69 | kmalloc(MAX_NETWORK_COUNT * sizeof(struct ieee80211_network), |
69 | GFP_KERNEL); | 70 | GFP_KERNEL); |
70 | if (!ieee->networks) { | 71 | if (!ieee->networks) { |
71 | printk(KERN_WARNING "%s: Out of memory allocating beacons\n", | 72 | printk(KERN_WARNING "%s: Out of memory allocating beacons\n", |
72 | ieee->dev->name); | 73 | ieee->dev->name); |
@@ -94,10 +95,10 @@ static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee) | |||
94 | INIT_LIST_HEAD(&ieee->network_free_list); | 95 | INIT_LIST_HEAD(&ieee->network_free_list); |
95 | INIT_LIST_HEAD(&ieee->network_list); | 96 | INIT_LIST_HEAD(&ieee->network_list); |
96 | for (i = 0; i < MAX_NETWORK_COUNT; i++) | 97 | for (i = 0; i < MAX_NETWORK_COUNT; i++) |
97 | list_add_tail(&ieee->networks[i].list, &ieee->network_free_list); | 98 | list_add_tail(&ieee->networks[i].list, |
99 | &ieee->network_free_list); | ||
98 | } | 100 | } |
99 | 101 | ||
100 | |||
101 | struct net_device *alloc_ieee80211(int sizeof_priv) | 102 | struct net_device *alloc_ieee80211(int sizeof_priv) |
102 | { | 103 | { |
103 | struct ieee80211_device *ieee; | 104 | struct ieee80211_device *ieee; |
@@ -118,8 +119,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
118 | 119 | ||
119 | err = ieee80211_networks_allocate(ieee); | 120 | err = ieee80211_networks_allocate(ieee); |
120 | if (err) { | 121 | if (err) { |
121 | IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", | 122 | IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", err); |
122 | err); | ||
123 | goto failed; | 123 | goto failed; |
124 | } | 124 | } |
125 | ieee80211_networks_initialize(ieee); | 125 | ieee80211_networks_initialize(ieee); |
@@ -132,7 +132,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
132 | /* Default to enabling full open WEP with host based encrypt/decrypt */ | 132 | /* Default to enabling full open WEP with host based encrypt/decrypt */ |
133 | ieee->host_encrypt = 1; | 133 | ieee->host_encrypt = 1; |
134 | ieee->host_decrypt = 1; | 134 | ieee->host_decrypt = 1; |
135 | ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ | 135 | ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ |
136 | 136 | ||
137 | INIT_LIST_HEAD(&ieee->crypt_deinit_list); | 137 | INIT_LIST_HEAD(&ieee->crypt_deinit_list); |
138 | init_timer(&ieee->crypt_deinit_timer); | 138 | init_timer(&ieee->crypt_deinit_timer); |
@@ -141,21 +141,20 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
141 | 141 | ||
142 | spin_lock_init(&ieee->lock); | 142 | spin_lock_init(&ieee->lock); |
143 | 143 | ||
144 | ieee->wpa_enabled = 0; | 144 | ieee->wpa_enabled = 0; |
145 | ieee->tkip_countermeasures = 0; | 145 | ieee->tkip_countermeasures = 0; |
146 | ieee->drop_unencrypted = 0; | 146 | ieee->drop_unencrypted = 0; |
147 | ieee->privacy_invoked = 0; | 147 | ieee->privacy_invoked = 0; |
148 | ieee->ieee802_1x = 1; | 148 | ieee->ieee802_1x = 1; |
149 | 149 | ||
150 | return dev; | 150 | return dev; |
151 | 151 | ||
152 | failed: | 152 | failed: |
153 | if (dev) | 153 | if (dev) |
154 | free_netdev(dev); | 154 | free_netdev(dev); |
155 | return NULL; | 155 | return NULL; |
156 | } | 156 | } |
157 | 157 | ||
158 | |||
159 | void free_ieee80211(struct net_device *dev) | 158 | void free_ieee80211(struct net_device *dev) |
160 | { | 159 | { |
161 | struct ieee80211_device *ieee = netdev_priv(dev); | 160 | struct ieee80211_device *ieee = netdev_priv(dev); |
@@ -193,7 +192,7 @@ static int show_debug_level(char *page, char **start, off_t offset, | |||
193 | return snprintf(page, count, "0x%08X\n", ieee80211_debug_level); | 192 | return snprintf(page, count, "0x%08X\n", ieee80211_debug_level); |
194 | } | 193 | } |
195 | 194 | ||
196 | static int store_debug_level(struct file *file, const char __user *buffer, | 195 | static int store_debug_level(struct file *file, const char __user * buffer, |
197 | unsigned long count, void *data) | 196 | unsigned long count, void *data) |
198 | { | 197 | { |
199 | char buf[] = "0x00000000"; | 198 | char buf[] = "0x00000000"; |
@@ -264,13 +263,12 @@ static void __exit ieee80211_exit(void) | |||
264 | module_param(debug, int, 0444); | 263 | module_param(debug, int, 0444); |
265 | MODULE_PARM_DESC(debug, "debug output mask"); | 264 | MODULE_PARM_DESC(debug, "debug output mask"); |
266 | 265 | ||
267 | |||
268 | module_exit(ieee80211_exit); | 266 | module_exit(ieee80211_exit); |
269 | module_init(ieee80211_init); | 267 | module_init(ieee80211_init); |
270 | #endif | 268 | #endif |
271 | 269 | ||
272 | 270 | const char *escape_essid(const char *essid, u8 essid_len) | |
273 | const char *escape_essid(const char *essid, u8 essid_len) { | 271 | { |
274 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | 272 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; |
275 | const char *s = essid; | 273 | const char *s = essid; |
276 | char *d = escaped; | 274 | char *d = escaped; |
@@ -280,7 +278,7 @@ const char *escape_essid(const char *essid, u8 essid_len) { | |||
280 | return escaped; | 278 | return escaped; |
281 | } | 279 | } |
282 | 280 | ||
283 | essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); | 281 | essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE); |
284 | while (essid_len--) { | 282 | while (essid_len--) { |
285 | if (*s == '\0') { | 283 | if (*s == '\0') { |
286 | *d++ = '\\'; | 284 | *d++ = '\\'; |
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index a5905f53aed7..f7dcd854139e 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -52,11 +52,14 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, | |||
52 | netif_rx(skb); | 52 | netif_rx(skb); |
53 | } | 53 | } |
54 | 54 | ||
55 | |||
56 | /* Called only as a tasklet (software IRQ) */ | 55 | /* Called only as a tasklet (software IRQ) */ |
57 | static struct ieee80211_frag_entry * | 56 | static struct ieee80211_frag_entry *ieee80211_frag_cache_find(struct |
58 | ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, | 57 | ieee80211_device |
59 | unsigned int frag, u8 *src, u8 *dst) | 58 | *ieee, |
59 | unsigned int seq, | ||
60 | unsigned int frag, | ||
61 | u8 * src, | ||
62 | u8 * dst) | ||
60 | { | 63 | { |
61 | struct ieee80211_frag_entry *entry; | 64 | struct ieee80211_frag_entry *entry; |
62 | int i; | 65 | int i; |
@@ -65,10 +68,9 @@ ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, | |||
65 | entry = &ieee->frag_cache[i]; | 68 | entry = &ieee->frag_cache[i]; |
66 | if (entry->skb != NULL && | 69 | if (entry->skb != NULL && |
67 | time_after(jiffies, entry->first_frag_time + 2 * HZ)) { | 70 | time_after(jiffies, entry->first_frag_time + 2 * HZ)) { |
68 | IEEE80211_DEBUG_FRAG( | 71 | IEEE80211_DEBUG_FRAG("expiring fragment cache entry " |
69 | "expiring fragment cache entry " | 72 | "seq=%u last_frag=%u\n", |
70 | "seq=%u last_frag=%u\n", | 73 | entry->seq, entry->last_frag); |
71 | entry->seq, entry->last_frag); | ||
72 | dev_kfree_skb_any(entry->skb); | 74 | dev_kfree_skb_any(entry->skb); |
73 | entry->skb = NULL; | 75 | entry->skb = NULL; |
74 | } | 76 | } |
@@ -84,9 +86,8 @@ ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, | |||
84 | } | 86 | } |
85 | 87 | ||
86 | /* Called only as a tasklet (software IRQ) */ | 88 | /* Called only as a tasklet (software IRQ) */ |
87 | static struct sk_buff * | 89 | static struct sk_buff *ieee80211_frag_cache_get(struct ieee80211_device *ieee, |
88 | ieee80211_frag_cache_get(struct ieee80211_device *ieee, | 90 | struct ieee80211_hdr *hdr) |
89 | struct ieee80211_hdr *hdr) | ||
90 | { | 91 | { |
91 | struct sk_buff *skb = NULL; | 92 | struct sk_buff *skb = NULL; |
92 | u16 sc; | 93 | u16 sc; |
@@ -101,9 +102,9 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, | |||
101 | /* Reserve enough space to fit maximum frame length */ | 102 | /* Reserve enough space to fit maximum frame length */ |
102 | skb = dev_alloc_skb(ieee->dev->mtu + | 103 | skb = dev_alloc_skb(ieee->dev->mtu + |
103 | sizeof(struct ieee80211_hdr) + | 104 | sizeof(struct ieee80211_hdr) + |
104 | 8 /* LLC */ + | 105 | 8 /* LLC */ + |
105 | 2 /* alignment */ + | 106 | 2 /* alignment */ + |
106 | 8 /* WEP */ + ETH_ALEN /* WDS */); | 107 | 8 /* WEP */ + ETH_ALEN /* WDS */ ); |
107 | if (skb == NULL) | 108 | if (skb == NULL) |
108 | return NULL; | 109 | return NULL; |
109 | 110 | ||
@@ -135,7 +136,6 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, | |||
135 | return skb; | 136 | return skb; |
136 | } | 137 | } |
137 | 138 | ||
138 | |||
139 | /* Called only as a tasklet (software IRQ) */ | 139 | /* Called only as a tasklet (software IRQ) */ |
140 | static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, | 140 | static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, |
141 | struct ieee80211_hdr *hdr) | 141 | struct ieee80211_hdr *hdr) |
@@ -151,9 +151,8 @@ static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, | |||
151 | hdr->addr1); | 151 | hdr->addr1); |
152 | 152 | ||
153 | if (entry == NULL) { | 153 | if (entry == NULL) { |
154 | IEEE80211_DEBUG_FRAG( | 154 | IEEE80211_DEBUG_FRAG("could not invalidate fragment cache " |
155 | "could not invalidate fragment cache " | 155 | "entry (seq=%u)\n", seq); |
156 | "entry (seq=%u)\n", seq); | ||
157 | return -1; | 156 | return -1; |
158 | } | 157 | } |
159 | 158 | ||
@@ -161,7 +160,6 @@ static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, | |||
161 | return 0; | 160 | return 0; |
162 | } | 161 | } |
163 | 162 | ||
164 | |||
165 | #ifdef NOT_YET | 163 | #ifdef NOT_YET |
166 | /* ieee80211_rx_frame_mgtmt | 164 | /* ieee80211_rx_frame_mgtmt |
167 | * | 165 | * |
@@ -201,7 +199,7 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
201 | return 0; | 199 | return 0; |
202 | } | 200 | } |
203 | 201 | ||
204 | if (ieee->iw_mode == IW_MODE_MASTER) { | 202 | if (ieee->iw_mode == IW_MODE_MASTER) { |
205 | if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) { | 203 | if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) { |
206 | printk(KERN_DEBUG "%s: unknown management frame " | 204 | printk(KERN_DEBUG "%s: unknown management frame " |
207 | "(type=0x%02x, stype=0x%02x) dropped\n", | 205 | "(type=0x%02x, stype=0x%02x) dropped\n", |
@@ -219,14 +217,13 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
219 | } | 217 | } |
220 | #endif | 218 | #endif |
221 | 219 | ||
222 | |||
223 | /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ | 220 | /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ |
224 | /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ | 221 | /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ |
225 | static unsigned char rfc1042_header[] = | 222 | static unsigned char rfc1042_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; |
226 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; | 223 | |
227 | /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ | 224 | /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ |
228 | static unsigned char bridge_tunnel_header[] = | 225 | static unsigned char bridge_tunnel_header[] = |
229 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; | 226 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; |
230 | /* No encapsulation header if EtherType < 0x600 (=length) */ | 227 | /* No encapsulation header if EtherType < 0x600 (=length) */ |
231 | 228 | ||
232 | /* Called by ieee80211_rx_frame_decrypt */ | 229 | /* Called by ieee80211_rx_frame_decrypt */ |
@@ -241,7 +238,7 @@ static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, | |||
241 | if (skb->len < 24) | 238 | if (skb->len < 24) |
242 | return 0; | 239 | return 0; |
243 | 240 | ||
244 | hdr = (struct ieee80211_hdr *) skb->data; | 241 | hdr = (struct ieee80211_hdr *)skb->data; |
245 | fc = le16_to_cpu(hdr->frame_ctl); | 242 | fc = le16_to_cpu(hdr->frame_ctl); |
246 | 243 | ||
247 | /* check that the frame is unicast frame to us */ | 244 | /* check that the frame is unicast frame to us */ |
@@ -271,7 +268,7 @@ static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, | |||
271 | 268 | ||
272 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ | 269 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ |
273 | static inline int | 270 | static inline int |
274 | ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, | 271 | ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, |
275 | struct ieee80211_crypt_data *crypt) | 272 | struct ieee80211_crypt_data *crypt) |
276 | { | 273 | { |
277 | struct ieee80211_hdr *hdr; | 274 | struct ieee80211_hdr *hdr; |
@@ -280,12 +277,11 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, | |||
280 | if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) | 277 | if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) |
281 | return 0; | 278 | return 0; |
282 | 279 | ||
283 | hdr = (struct ieee80211_hdr *) skb->data; | 280 | hdr = (struct ieee80211_hdr *)skb->data; |
284 | hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); | 281 | hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); |
285 | 282 | ||
286 | #ifdef CONFIG_IEEE80211_CRYPT_TKIP | 283 | #ifdef CONFIG_IEEE80211_CRYPT_TKIP |
287 | if (ieee->tkip_countermeasures && | 284 | if (ieee->tkip_countermeasures && strcmp(crypt->ops->name, "TKIP") == 0) { |
288 | strcmp(crypt->ops->name, "TKIP") == 0) { | ||
289 | if (net_ratelimit()) { | 285 | if (net_ratelimit()) { |
290 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " | 286 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " |
291 | "received packet from " MAC_FMT "\n", | 287 | "received packet from " MAC_FMT "\n", |
@@ -299,9 +295,8 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, | |||
299 | res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); | 295 | res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); |
300 | atomic_dec(&crypt->refcnt); | 296 | atomic_dec(&crypt->refcnt); |
301 | if (res < 0) { | 297 | if (res < 0) { |
302 | IEEE80211_DEBUG_DROP( | 298 | IEEE80211_DEBUG_DROP("decryption failed (SA=" MAC_FMT |
303 | "decryption failed (SA=" MAC_FMT | 299 | ") res=%d\n", MAC_ARG(hdr->addr2), res); |
304 | ") res=%d\n", MAC_ARG(hdr->addr2), res); | ||
305 | if (res == -2) | 300 | if (res == -2) |
306 | IEEE80211_DEBUG_DROP("Decryption failed ICV " | 301 | IEEE80211_DEBUG_DROP("Decryption failed ICV " |
307 | "mismatch (key %d)\n", | 302 | "mismatch (key %d)\n", |
@@ -313,11 +308,11 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, | |||
313 | return res; | 308 | return res; |
314 | } | 309 | } |
315 | 310 | ||
316 | |||
317 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ | 311 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ |
318 | static inline int | 312 | static inline int |
319 | ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb, | 313 | ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, |
320 | int keyidx, struct ieee80211_crypt_data *crypt) | 314 | struct sk_buff *skb, int keyidx, |
315 | struct ieee80211_crypt_data *crypt) | ||
321 | { | 316 | { |
322 | struct ieee80211_hdr *hdr; | 317 | struct ieee80211_hdr *hdr; |
323 | int res, hdrlen; | 318 | int res, hdrlen; |
@@ -325,7 +320,7 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *s | |||
325 | if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) | 320 | if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) |
326 | return 0; | 321 | return 0; |
327 | 322 | ||
328 | hdr = (struct ieee80211_hdr *) skb->data; | 323 | hdr = (struct ieee80211_hdr *)skb->data; |
329 | hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); | 324 | hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); |
330 | 325 | ||
331 | atomic_inc(&crypt->refcnt); | 326 | atomic_inc(&crypt->refcnt); |
@@ -341,7 +336,6 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *s | |||
341 | return 0; | 336 | return 0; |
342 | } | 337 | } |
343 | 338 | ||
344 | |||
345 | /* All received frames are sent to this function. @skb contains the frame in | 339 | /* All received frames are sent to this function. @skb contains the frame in |
346 | * IEEE 802.11 format, i.e., in the format it was sent over air. | 340 | * IEEE 802.11 format, i.e., in the format it was sent over air. |
347 | * This function is called only as a tasklet (software IRQ). */ | 341 | * This function is called only as a tasklet (software IRQ). */ |
@@ -373,8 +367,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
373 | stats = &ieee->stats; | 367 | stats = &ieee->stats; |
374 | 368 | ||
375 | if (skb->len < 10) { | 369 | if (skb->len < 10) { |
376 | printk(KERN_INFO "%s: SKB length < 10\n", | 370 | printk(KERN_INFO "%s: SKB length < 10\n", dev->name); |
377 | dev->name); | ||
378 | goto rx_dropped; | 371 | goto rx_dropped; |
379 | } | 372 | } |
380 | 373 | ||
@@ -399,8 +392,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
399 | /* Update spy records */ | 392 | /* Update spy records */ |
400 | wireless_spy_update(dev, hdr->addr2, &wstats); | 393 | wireless_spy_update(dev, hdr->addr2, &wstats); |
401 | } | 394 | } |
402 | #endif /* IW_WIRELESS_SPY */ | 395 | #endif /* IW_WIRELESS_SPY */ |
403 | #endif /* WIRELESS_EXT > 15 */ | 396 | #endif /* WIRELESS_EXT > 15 */ |
404 | hostap_update_rx_stats(local->ap, hdr, rx_stats); | 397 | hostap_update_rx_stats(local->ap, hdr, rx_stats); |
405 | #endif | 398 | #endif |
406 | 399 | ||
@@ -429,8 +422,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
429 | * stations that do not support WEP key mapping). */ | 422 | * stations that do not support WEP key mapping). */ |
430 | 423 | ||
431 | if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key) | 424 | if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key) |
432 | (void) hostap_handle_sta_crypto(local, hdr, &crypt, | 425 | (void)hostap_handle_sta_crypto(local, hdr, &crypt, |
433 | &sta); | 426 | &sta); |
434 | #endif | 427 | #endif |
435 | 428 | ||
436 | /* allow NULL decrypt to indicate an station specific override | 429 | /* allow NULL decrypt to indicate an station specific override |
@@ -451,13 +444,11 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
451 | goto rx_dropped; | 444 | goto rx_dropped; |
452 | } | 445 | } |
453 | } | 446 | } |
454 | |||
455 | #ifdef NOT_YET | 447 | #ifdef NOT_YET |
456 | if (type != WLAN_FC_TYPE_DATA) { | 448 | if (type != WLAN_FC_TYPE_DATA) { |
457 | if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_AUTH && | 449 | if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_AUTH && |
458 | fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt && | 450 | fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt && |
459 | (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) | 451 | (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) { |
460 | { | ||
461 | printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " | 452 | printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " |
462 | "from " MAC_FMT "\n", dev->name, | 453 | "from " MAC_FMT "\n", dev->name, |
463 | MAC_ARG(hdr->addr2)); | 454 | MAC_ARG(hdr->addr2)); |
@@ -507,9 +498,9 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
507 | } | 498 | } |
508 | 499 | ||
509 | if (ieee->iw_mode == IW_MODE_MASTER && !wds && | 500 | if (ieee->iw_mode == IW_MODE_MASTER && !wds && |
510 | (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == IEEE80211_FCTL_FROMDS && | 501 | (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == |
511 | ieee->stadev && | 502 | IEEE80211_FCTL_FROMDS && ieee->stadev |
512 | memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) { | 503 | && memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) { |
513 | /* Frame from BSSID of the AP for which we are a client */ | 504 | /* Frame from BSSID of the AP for which we are a client */ |
514 | skb->dev = dev = ieee->stadev; | 505 | skb->dev = dev = ieee->stadev; |
515 | stats = hostap_get_stats(dev); | 506 | stats = hostap_get_stats(dev); |
@@ -521,8 +512,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
521 | 512 | ||
522 | #ifdef NOT_YET | 513 | #ifdef NOT_YET |
523 | if ((ieee->iw_mode == IW_MODE_MASTER || | 514 | if ((ieee->iw_mode == IW_MODE_MASTER || |
524 | ieee->iw_mode == IW_MODE_REPEAT) && | 515 | ieee->iw_mode == IW_MODE_REPEAT) && !from_assoc_ap) { |
525 | !from_assoc_ap) { | ||
526 | switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats, | 516 | switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats, |
527 | wds != NULL)) { | 517 | wds != NULL)) { |
528 | case AP_RX_CONTINUE_NOT_AUTHORIZED: | 518 | case AP_RX_CONTINUE_NOT_AUTHORIZED: |
@@ -546,11 +536,10 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
546 | stype != IEEE80211_STYPE_DATA_CFPOLL && | 536 | stype != IEEE80211_STYPE_DATA_CFPOLL && |
547 | stype != IEEE80211_STYPE_DATA_CFACKPOLL) { | 537 | stype != IEEE80211_STYPE_DATA_CFACKPOLL) { |
548 | if (stype != IEEE80211_STYPE_NULLFUNC) | 538 | if (stype != IEEE80211_STYPE_NULLFUNC) |
549 | IEEE80211_DEBUG_DROP( | 539 | IEEE80211_DEBUG_DROP("RX: dropped data frame " |
550 | "RX: dropped data frame " | 540 | "with no data (type=0x%02x, " |
551 | "with no data (type=0x%02x, " | 541 | "subtype=0x%02x, len=%d)\n", |
552 | "subtype=0x%02x, len=%d)\n", | 542 | type, stype, skb->len); |
553 | type, stype, skb->len); | ||
554 | goto rx_dropped; | 543 | goto rx_dropped; |
555 | } | 544 | } |
556 | 545 | ||
@@ -560,7 +549,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
560 | (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) | 549 | (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) |
561 | goto rx_dropped; | 550 | goto rx_dropped; |
562 | 551 | ||
563 | hdr = (struct ieee80211_hdr *) skb->data; | 552 | hdr = (struct ieee80211_hdr *)skb->data; |
564 | 553 | ||
565 | /* skb: hdr + (possibly fragmented) plaintext payload */ | 554 | /* skb: hdr + (possibly fragmented) plaintext payload */ |
566 | // PR: FIXME: hostap has additional conditions in the "if" below: | 555 | // PR: FIXME: hostap has additional conditions in the "if" below: |
@@ -614,7 +603,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
614 | /* this was the last fragment and the frame will be | 603 | /* this was the last fragment and the frame will be |
615 | * delivered, so remove skb from fragment cache */ | 604 | * delivered, so remove skb from fragment cache */ |
616 | skb = frag_skb; | 605 | skb = frag_skb; |
617 | hdr = (struct ieee80211_hdr *) skb->data; | 606 | hdr = (struct ieee80211_hdr *)skb->data; |
618 | ieee80211_frag_cache_invalidate(ieee, hdr); | 607 | ieee80211_frag_cache_invalidate(ieee, hdr); |
619 | } | 608 | } |
620 | 609 | ||
@@ -624,28 +613,26 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
624 | ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) | 613 | ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) |
625 | goto rx_dropped; | 614 | goto rx_dropped; |
626 | 615 | ||
627 | hdr = (struct ieee80211_hdr *) skb->data; | 616 | hdr = (struct ieee80211_hdr *)skb->data; |
628 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep) { | 617 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep) { |
629 | if (/*ieee->ieee802_1x &&*/ | 618 | if ( /*ieee->ieee802_1x && */ |
630 | ieee80211_is_eapol_frame(ieee, skb)) { | 619 | ieee80211_is_eapol_frame(ieee, skb)) { |
631 | /* pass unencrypted EAPOL frames even if encryption is | 620 | /* pass unencrypted EAPOL frames even if encryption is |
632 | * configured */ | 621 | * configured */ |
633 | } else { | 622 | } else { |
634 | IEEE80211_DEBUG_DROP( | 623 | IEEE80211_DEBUG_DROP("encryption configured, but RX " |
635 | "encryption configured, but RX " | 624 | "frame not encrypted (SA=" MAC_FMT |
636 | "frame not encrypted (SA=" MAC_FMT ")\n", | 625 | ")\n", MAC_ARG(hdr->addr2)); |
637 | MAC_ARG(hdr->addr2)); | ||
638 | goto rx_dropped; | 626 | goto rx_dropped; |
639 | } | 627 | } |
640 | } | 628 | } |
641 | 629 | ||
642 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep && | 630 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep && |
643 | !ieee80211_is_eapol_frame(ieee, skb)) { | 631 | !ieee80211_is_eapol_frame(ieee, skb)) { |
644 | IEEE80211_DEBUG_DROP( | 632 | IEEE80211_DEBUG_DROP("dropped unencrypted RX data " |
645 | "dropped unencrypted RX data " | 633 | "frame from " MAC_FMT |
646 | "frame from " MAC_FMT | 634 | " (drop_unencrypted=1)\n", |
647 | " (drop_unencrypted=1)\n", | 635 | MAC_ARG(hdr->addr2)); |
648 | MAC_ARG(hdr->addr2)); | ||
649 | goto rx_dropped; | 636 | goto rx_dropped; |
650 | } | 637 | } |
651 | 638 | ||
@@ -673,8 +660,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
673 | } else if (!frame_authorized) { | 660 | } else if (!frame_authorized) { |
674 | printk(KERN_DEBUG "%s: dropped frame from " | 661 | printk(KERN_DEBUG "%s: dropped frame from " |
675 | "unauthorized port (IEEE 802.1X): " | 662 | "unauthorized port (IEEE 802.1X): " |
676 | "ethertype=0x%04x\n", | 663 | "ethertype=0x%04x\n", dev->name, ethertype); |
677 | dev->name, ethertype); | ||
678 | goto rx_dropped; | 664 | goto rx_dropped; |
679 | } | 665 | } |
680 | } | 666 | } |
@@ -702,8 +688,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
702 | 688 | ||
703 | #ifdef NOT_YET | 689 | #ifdef NOT_YET |
704 | if (wds && ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == | 690 | if (wds && ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == |
705 | IEEE80211_FCTL_TODS) && | 691 | IEEE80211_FCTL_TODS) && skb->len >= ETH_HLEN + ETH_ALEN) { |
706 | skb->len >= ETH_HLEN + ETH_ALEN) { | ||
707 | /* Non-standard frame: get addr4 from its bogus location after | 692 | /* Non-standard frame: get addr4 from its bogus location after |
708 | * the payload */ | 693 | * the payload */ |
709 | memcpy(skb->data + ETH_ALEN, | 694 | memcpy(skb->data + ETH_ALEN, |
@@ -716,8 +701,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
716 | stats->rx_bytes += skb->len; | 701 | stats->rx_bytes += skb->len; |
717 | 702 | ||
718 | #ifdef NOT_YET | 703 | #ifdef NOT_YET |
719 | if (ieee->iw_mode == IW_MODE_MASTER && !wds && | 704 | if (ieee->iw_mode == IW_MODE_MASTER && !wds && ieee->ap->bridge_packets) { |
720 | ieee->ap->bridge_packets) { | ||
721 | if (dst[0] & 0x01) { | 705 | if (dst[0] & 0x01) { |
722 | /* copy multicast frame both to the higher layers and | 706 | /* copy multicast frame both to the higher layers and |
723 | * to the wireless media */ | 707 | * to the wireless media */ |
@@ -743,25 +727,24 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
743 | skb2->dev = dev; | 727 | skb2->dev = dev; |
744 | dev_queue_xmit(skb2); | 728 | dev_queue_xmit(skb2); |
745 | } | 729 | } |
746 | |||
747 | #endif | 730 | #endif |
748 | 731 | ||
749 | if (skb) { | 732 | if (skb) { |
750 | skb->protocol = eth_type_trans(skb, dev); | 733 | skb->protocol = eth_type_trans(skb, dev); |
751 | memset(skb->cb, 0, sizeof(skb->cb)); | 734 | memset(skb->cb, 0, sizeof(skb->cb)); |
752 | skb->dev = dev; | 735 | skb->dev = dev; |
753 | skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ | 736 | skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ |
754 | netif_rx(skb); | 737 | netif_rx(skb); |
755 | } | 738 | } |
756 | 739 | ||
757 | rx_exit: | 740 | rx_exit: |
758 | #ifdef NOT_YET | 741 | #ifdef NOT_YET |
759 | if (sta) | 742 | if (sta) |
760 | hostap_handle_sta_release(sta); | 743 | hostap_handle_sta_release(sta); |
761 | #endif | 744 | #endif |
762 | return 1; | 745 | return 1; |
763 | 746 | ||
764 | rx_dropped: | 747 | rx_dropped: |
765 | stats->rx_dropped++; | 748 | stats->rx_dropped++; |
766 | 749 | ||
767 | /* Returning 0 indicates to caller that we have not handled the SKB-- | 750 | /* Returning 0 indicates to caller that we have not handled the SKB-- |
@@ -785,22 +768,21 @@ static inline int ieee80211_is_ofdm_rate(u8 rate) | |||
785 | case IEEE80211_OFDM_RATE_54MB: | 768 | case IEEE80211_OFDM_RATE_54MB: |
786 | return 1; | 769 | return 1; |
787 | } | 770 | } |
788 | return 0; | 771 | return 0; |
789 | } | 772 | } |
790 | 773 | ||
791 | 774 | static inline int ieee80211_network_init(struct ieee80211_device *ieee, | |
792 | static inline int ieee80211_network_init( | 775 | struct ieee80211_probe_response |
793 | struct ieee80211_device *ieee, | 776 | *beacon, |
794 | struct ieee80211_probe_response *beacon, | 777 | struct ieee80211_network *network, |
795 | struct ieee80211_network *network, | 778 | struct ieee80211_rx_stats *stats) |
796 | struct ieee80211_rx_stats *stats) | ||
797 | { | 779 | { |
798 | #ifdef CONFIG_IEEE80211_DEBUG | 780 | #ifdef CONFIG_IEEE80211_DEBUG |
799 | char rates_str[64]; | 781 | char rates_str[64]; |
800 | char *p; | 782 | char *p; |
801 | #endif | 783 | #endif |
802 | struct ieee80211_info_element *info_element; | 784 | struct ieee80211_info_element *info_element; |
803 | u16 left; | 785 | u16 left; |
804 | u8 i; | 786 | u8 i; |
805 | 787 | ||
806 | /* Pull out fixed field data */ | 788 | /* Pull out fixed field data */ |
@@ -810,7 +792,7 @@ static inline int ieee80211_network_init( | |||
810 | network->time_stamp[0] = beacon->time_stamp[0]; | 792 | network->time_stamp[0] = beacon->time_stamp[0]; |
811 | network->time_stamp[1] = beacon->time_stamp[1]; | 793 | network->time_stamp[1] = beacon->time_stamp[1]; |
812 | network->beacon_interval = beacon->beacon_interval; | 794 | network->beacon_interval = beacon->beacon_interval; |
813 | /* Where to pull this? beacon->listen_interval;*/ | 795 | /* Where to pull this? beacon->listen_interval; */ |
814 | network->listen_interval = 0x0A; | 796 | network->listen_interval = 0x0A; |
815 | network->rates_len = network->rates_ex_len = 0; | 797 | network->rates_len = network->rates_ex_len = 0; |
816 | network->last_associate = 0; | 798 | network->last_associate = 0; |
@@ -824,18 +806,20 @@ static inline int ieee80211_network_init( | |||
824 | } else | 806 | } else |
825 | network->flags |= NETWORK_HAS_CCK; | 807 | network->flags |= NETWORK_HAS_CCK; |
826 | 808 | ||
827 | network->wpa_ie_len = 0; | 809 | network->wpa_ie_len = 0; |
828 | network->rsn_ie_len = 0; | 810 | network->rsn_ie_len = 0; |
829 | 811 | ||
830 | info_element = &beacon->info_element; | 812 | info_element = &beacon->info_element; |
831 | left = stats->len - ((void *)info_element - (void *)beacon); | 813 | left = stats->len - ((void *)info_element - (void *)beacon); |
832 | while (left >= sizeof(struct ieee80211_info_element_hdr)) { | 814 | while (left >= sizeof(struct ieee80211_info_element_hdr)) { |
833 | if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) { | 815 | if (sizeof(struct ieee80211_info_element_hdr) + |
834 | IEEE80211_DEBUG_SCAN("SCAN: parse failed: info_element->len + 2 > left : info_element->len+2=%Zd left=%d.\n", | 816 | info_element->len > left) { |
835 | info_element->len + sizeof(struct ieee80211_info_element), | 817 | IEEE80211_DEBUG_SCAN |
836 | left); | 818 | ("SCAN: parse failed: info_element->len + 2 > left : info_element->len+2=%Zd left=%d.\n", |
819 | info_element->len + | ||
820 | sizeof(struct ieee80211_info_element), left); | ||
837 | return 1; | 821 | return 1; |
838 | } | 822 | } |
839 | 823 | ||
840 | switch (info_element->id) { | 824 | switch (info_element->id) { |
841 | case MFIE_TYPE_SSID: | 825 | case MFIE_TYPE_SSID: |
@@ -846,10 +830,11 @@ static inline int ieee80211_network_init( | |||
846 | } | 830 | } |
847 | 831 | ||
848 | network->ssid_len = min(info_element->len, | 832 | network->ssid_len = min(info_element->len, |
849 | (u8)IW_ESSID_MAX_SIZE); | 833 | (u8) IW_ESSID_MAX_SIZE); |
850 | memcpy(network->ssid, info_element->data, network->ssid_len); | 834 | memcpy(network->ssid, info_element->data, |
851 | if (network->ssid_len < IW_ESSID_MAX_SIZE) | 835 | network->ssid_len); |
852 | memset(network->ssid + network->ssid_len, 0, | 836 | if (network->ssid_len < IW_ESSID_MAX_SIZE) |
837 | memset(network->ssid + network->ssid_len, 0, | ||
853 | IW_ESSID_MAX_SIZE - network->ssid_len); | 838 | IW_ESSID_MAX_SIZE - network->ssid_len); |
854 | 839 | ||
855 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_SSID: '%s' len=%d.\n", | 840 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_SSID: '%s' len=%d.\n", |
@@ -860,18 +845,23 @@ static inline int ieee80211_network_init( | |||
860 | #ifdef CONFIG_IEEE80211_DEBUG | 845 | #ifdef CONFIG_IEEE80211_DEBUG |
861 | p = rates_str; | 846 | p = rates_str; |
862 | #endif | 847 | #endif |
863 | network->rates_len = min(info_element->len, MAX_RATES_LENGTH); | 848 | network->rates_len = |
849 | min(info_element->len, MAX_RATES_LENGTH); | ||
864 | for (i = 0; i < network->rates_len; i++) { | 850 | for (i = 0; i < network->rates_len; i++) { |
865 | network->rates[i] = info_element->data[i]; | 851 | network->rates[i] = info_element->data[i]; |
866 | #ifdef CONFIG_IEEE80211_DEBUG | 852 | #ifdef CONFIG_IEEE80211_DEBUG |
867 | p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); | 853 | p += snprintf(p, |
854 | sizeof(rates_str) - (p - | ||
855 | rates_str), | ||
856 | "%02X ", network->rates[i]); | ||
868 | #endif | 857 | #endif |
869 | if (ieee80211_is_ofdm_rate(info_element->data[i])) { | 858 | if (ieee80211_is_ofdm_rate |
859 | (info_element->data[i])) { | ||
870 | network->flags |= NETWORK_HAS_OFDM; | 860 | network->flags |= NETWORK_HAS_OFDM; |
871 | if (info_element->data[i] & | 861 | if (info_element->data[i] & |
872 | IEEE80211_BASIC_RATE_MASK) | 862 | IEEE80211_BASIC_RATE_MASK) |
873 | network->flags &= | 863 | network->flags &= |
874 | ~NETWORK_HAS_CCK; | 864 | ~NETWORK_HAS_CCK; |
875 | } | 865 | } |
876 | } | 866 | } |
877 | 867 | ||
@@ -883,18 +873,23 @@ static inline int ieee80211_network_init( | |||
883 | #ifdef CONFIG_IEEE80211_DEBUG | 873 | #ifdef CONFIG_IEEE80211_DEBUG |
884 | p = rates_str; | 874 | p = rates_str; |
885 | #endif | 875 | #endif |
886 | network->rates_ex_len = min(info_element->len, MAX_RATES_EX_LENGTH); | 876 | network->rates_ex_len = |
877 | min(info_element->len, MAX_RATES_EX_LENGTH); | ||
887 | for (i = 0; i < network->rates_ex_len; i++) { | 878 | for (i = 0; i < network->rates_ex_len; i++) { |
888 | network->rates_ex[i] = info_element->data[i]; | 879 | network->rates_ex[i] = info_element->data[i]; |
889 | #ifdef CONFIG_IEEE80211_DEBUG | 880 | #ifdef CONFIG_IEEE80211_DEBUG |
890 | p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); | 881 | p += snprintf(p, |
882 | sizeof(rates_str) - (p - | ||
883 | rates_str), | ||
884 | "%02X ", network->rates[i]); | ||
891 | #endif | 885 | #endif |
892 | if (ieee80211_is_ofdm_rate(info_element->data[i])) { | 886 | if (ieee80211_is_ofdm_rate |
887 | (info_element->data[i])) { | ||
893 | network->flags |= NETWORK_HAS_OFDM; | 888 | network->flags |= NETWORK_HAS_OFDM; |
894 | if (info_element->data[i] & | 889 | if (info_element->data[i] & |
895 | IEEE80211_BASIC_RATE_MASK) | 890 | IEEE80211_BASIC_RATE_MASK) |
896 | network->flags &= | 891 | network->flags &= |
897 | ~NETWORK_HAS_CCK; | 892 | ~NETWORK_HAS_CCK; |
898 | } | 893 | } |
899 | } | 894 | } |
900 | 895 | ||
@@ -903,14 +898,14 @@ static inline int ieee80211_network_init( | |||
903 | break; | 898 | break; |
904 | 899 | ||
905 | case MFIE_TYPE_DS_SET: | 900 | case MFIE_TYPE_DS_SET: |
906 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_DS_SET: %d\n", | 901 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_DS_SET: %d\n", |
907 | info_element->data[0]); | 902 | info_element->data[0]); |
908 | if (stats->freq == IEEE80211_24GHZ_BAND) | 903 | if (stats->freq == IEEE80211_24GHZ_BAND) |
909 | network->channel = info_element->data[0]; | 904 | network->channel = info_element->data[0]; |
910 | break; | 905 | break; |
911 | 906 | ||
912 | case MFIE_TYPE_FH_SET: | 907 | case MFIE_TYPE_FH_SET: |
913 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_FH_SET: ignored\n"); | 908 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_FH_SET: ignored\n"); |
914 | break; | 909 | break; |
915 | 910 | ||
916 | case MFIE_TYPE_CF_SET: | 911 | case MFIE_TYPE_CF_SET: |
@@ -932,13 +927,13 @@ static inline int ieee80211_network_init( | |||
932 | case MFIE_TYPE_GENERIC: | 927 | case MFIE_TYPE_GENERIC: |
933 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", | 928 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", |
934 | info_element->len); | 929 | info_element->len); |
935 | if (info_element->len >= 4 && | 930 | if (info_element->len >= 4 && |
936 | info_element->data[0] == 0x00 && | 931 | info_element->data[0] == 0x00 && |
937 | info_element->data[1] == 0x50 && | 932 | info_element->data[1] == 0x50 && |
938 | info_element->data[2] == 0xf2 && | 933 | info_element->data[2] == 0xf2 && |
939 | info_element->data[3] == 0x01) { | 934 | info_element->data[3] == 0x01) { |
940 | network->wpa_ie_len = min(info_element->len + 2, | 935 | network->wpa_ie_len = min(info_element->len + 2, |
941 | MAX_WPA_IE_LEN); | 936 | MAX_WPA_IE_LEN); |
942 | memcpy(network->wpa_ie, info_element, | 937 | memcpy(network->wpa_ie, info_element, |
943 | network->wpa_ie_len); | 938 | network->wpa_ie_len); |
944 | } | 939 | } |
@@ -948,7 +943,7 @@ static inline int ieee80211_network_init( | |||
948 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_RSN: %d bytes\n", | 943 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_RSN: %d bytes\n", |
949 | info_element->len); | 944 | info_element->len); |
950 | network->rsn_ie_len = min(info_element->len + 2, | 945 | network->rsn_ie_len = min(info_element->len + 2, |
951 | MAX_WPA_IE_LEN); | 946 | MAX_WPA_IE_LEN); |
952 | memcpy(network->rsn_ie, info_element, | 947 | memcpy(network->rsn_ie, info_element, |
953 | network->rsn_ie_len); | 948 | network->rsn_ie_len); |
954 | break; | 949 | break; |
@@ -956,14 +951,14 @@ static inline int ieee80211_network_init( | |||
956 | default: | 951 | default: |
957 | IEEE80211_DEBUG_SCAN("unsupported IE %d\n", | 952 | IEEE80211_DEBUG_SCAN("unsupported IE %d\n", |
958 | info_element->id); | 953 | info_element->id); |
959 | break; | 954 | break; |
960 | } | 955 | } |
961 | 956 | ||
962 | left -= sizeof(struct ieee80211_info_element_hdr) + | 957 | left -= sizeof(struct ieee80211_info_element_hdr) + |
963 | info_element->len; | 958 | info_element->len; |
964 | info_element = (struct ieee80211_info_element *) | 959 | info_element = (struct ieee80211_info_element *) |
965 | &info_element->data[info_element->len]; | 960 | &info_element->data[info_element->len]; |
966 | } | 961 | } |
967 | 962 | ||
968 | network->mode = 0; | 963 | network->mode = 0; |
969 | if (stats->freq == IEEE80211_52GHZ_BAND) | 964 | if (stats->freq == IEEE80211_52GHZ_BAND) |
@@ -1032,10 +1027,13 @@ static inline void update_network(struct ieee80211_network *dst, | |||
1032 | /* dst->last_associate is not overwritten */ | 1027 | /* dst->last_associate is not overwritten */ |
1033 | } | 1028 | } |
1034 | 1029 | ||
1035 | static inline void ieee80211_process_probe_response( | 1030 | static inline void ieee80211_process_probe_response(struct ieee80211_device |
1036 | struct ieee80211_device *ieee, | 1031 | *ieee, |
1037 | struct ieee80211_probe_response *beacon, | 1032 | struct |
1038 | struct ieee80211_rx_stats *stats) | 1033 | ieee80211_probe_response |
1034 | *beacon, | ||
1035 | struct ieee80211_rx_stats | ||
1036 | *stats) | ||
1039 | { | 1037 | { |
1040 | struct ieee80211_network network; | 1038 | struct ieee80211_network network; |
1041 | struct ieee80211_network *target; | 1039 | struct ieee80211_network *target; |
@@ -1045,33 +1043,35 @@ static inline void ieee80211_process_probe_response( | |||
1045 | #endif | 1043 | #endif |
1046 | unsigned long flags; | 1044 | unsigned long flags; |
1047 | 1045 | ||
1048 | IEEE80211_DEBUG_SCAN( | 1046 | IEEE80211_DEBUG_SCAN("'%s' (" MAC_FMT |
1049 | "'%s' (" MAC_FMT "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", | 1047 | "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", |
1050 | escape_essid(info_element->data, info_element->len), | 1048 | escape_essid(info_element->data, |
1051 | MAC_ARG(beacon->header.addr3), | 1049 | info_element->len), |
1052 | (beacon->capability & (1<<0xf)) ? '1' : '0', | 1050 | MAC_ARG(beacon->header.addr3), |
1053 | (beacon->capability & (1<<0xe)) ? '1' : '0', | 1051 | (beacon->capability & (1 << 0xf)) ? '1' : '0', |
1054 | (beacon->capability & (1<<0xd)) ? '1' : '0', | 1052 | (beacon->capability & (1 << 0xe)) ? '1' : '0', |
1055 | (beacon->capability & (1<<0xc)) ? '1' : '0', | 1053 | (beacon->capability & (1 << 0xd)) ? '1' : '0', |
1056 | (beacon->capability & (1<<0xb)) ? '1' : '0', | 1054 | (beacon->capability & (1 << 0xc)) ? '1' : '0', |
1057 | (beacon->capability & (1<<0xa)) ? '1' : '0', | 1055 | (beacon->capability & (1 << 0xb)) ? '1' : '0', |
1058 | (beacon->capability & (1<<0x9)) ? '1' : '0', | 1056 | (beacon->capability & (1 << 0xa)) ? '1' : '0', |
1059 | (beacon->capability & (1<<0x8)) ? '1' : '0', | 1057 | (beacon->capability & (1 << 0x9)) ? '1' : '0', |
1060 | (beacon->capability & (1<<0x7)) ? '1' : '0', | 1058 | (beacon->capability & (1 << 0x8)) ? '1' : '0', |
1061 | (beacon->capability & (1<<0x6)) ? '1' : '0', | 1059 | (beacon->capability & (1 << 0x7)) ? '1' : '0', |
1062 | (beacon->capability & (1<<0x5)) ? '1' : '0', | 1060 | (beacon->capability & (1 << 0x6)) ? '1' : '0', |
1063 | (beacon->capability & (1<<0x4)) ? '1' : '0', | 1061 | (beacon->capability & (1 << 0x5)) ? '1' : '0', |
1064 | (beacon->capability & (1<<0x3)) ? '1' : '0', | 1062 | (beacon->capability & (1 << 0x4)) ? '1' : '0', |
1065 | (beacon->capability & (1<<0x2)) ? '1' : '0', | 1063 | (beacon->capability & (1 << 0x3)) ? '1' : '0', |
1066 | (beacon->capability & (1<<0x1)) ? '1' : '0', | 1064 | (beacon->capability & (1 << 0x2)) ? '1' : '0', |
1067 | (beacon->capability & (1<<0x0)) ? '1' : '0'); | 1065 | (beacon->capability & (1 << 0x1)) ? '1' : '0', |
1066 | (beacon->capability & (1 << 0x0)) ? '1' : '0'); | ||
1068 | 1067 | ||
1069 | if (ieee80211_network_init(ieee, beacon, &network, stats)) { | 1068 | if (ieee80211_network_init(ieee, beacon, &network, stats)) { |
1070 | IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n", | 1069 | IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n", |
1071 | escape_essid(info_element->data, | 1070 | escape_essid(info_element->data, |
1072 | info_element->len), | 1071 | info_element->len), |
1073 | MAC_ARG(beacon->header.addr3), | 1072 | MAC_ARG(beacon->header.addr3), |
1074 | WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == | 1073 | WLAN_FC_GET_STYPE(beacon->header. |
1074 | frame_ctl) == | ||
1075 | IEEE80211_STYPE_PROBE_RESP ? | 1075 | IEEE80211_STYPE_PROBE_RESP ? |
1076 | "PROBE RESPONSE" : "BEACON"); | 1076 | "PROBE RESPONSE" : "BEACON"); |
1077 | return; | 1077 | return; |
@@ -1117,13 +1117,13 @@ static inline void ieee80211_process_probe_response( | |||
1117 | list_del(ieee->network_free_list.next); | 1117 | list_del(ieee->network_free_list.next); |
1118 | } | 1118 | } |
1119 | 1119 | ||
1120 | |||
1121 | #ifdef CONFIG_IEEE80211_DEBUG | 1120 | #ifdef CONFIG_IEEE80211_DEBUG |
1122 | IEEE80211_DEBUG_SCAN("Adding '%s' (" MAC_FMT ") via %s.\n", | 1121 | IEEE80211_DEBUG_SCAN("Adding '%s' (" MAC_FMT ") via %s.\n", |
1123 | escape_essid(network.ssid, | 1122 | escape_essid(network.ssid, |
1124 | network.ssid_len), | 1123 | network.ssid_len), |
1125 | MAC_ARG(network.bssid), | 1124 | MAC_ARG(network.bssid), |
1126 | WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == | 1125 | WLAN_FC_GET_STYPE(beacon->header. |
1126 | frame_ctl) == | ||
1127 | IEEE80211_STYPE_PROBE_RESP ? | 1127 | IEEE80211_STYPE_PROBE_RESP ? |
1128 | "PROBE RESPONSE" : "BEACON"); | 1128 | "PROBE RESPONSE" : "BEACON"); |
1129 | #endif | 1129 | #endif |
@@ -1134,7 +1134,8 @@ static inline void ieee80211_process_probe_response( | |||
1134 | escape_essid(target->ssid, | 1134 | escape_essid(target->ssid, |
1135 | target->ssid_len), | 1135 | target->ssid_len), |
1136 | MAC_ARG(target->bssid), | 1136 | MAC_ARG(target->bssid), |
1137 | WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == | 1137 | WLAN_FC_GET_STYPE(beacon->header. |
1138 | frame_ctl) == | ||
1138 | IEEE80211_STYPE_PROBE_RESP ? | 1139 | IEEE80211_STYPE_PROBE_RESP ? |
1139 | "PROBE RESPONSE" : "BEACON"); | 1140 | "PROBE RESPONSE" : "BEACON"); |
1140 | update_network(target, &network); | 1141 | update_network(target, &network); |
@@ -1162,16 +1163,20 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee, | |||
1162 | IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", | 1163 | IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", |
1163 | WLAN_FC_GET_STYPE(header->frame_ctl)); | 1164 | WLAN_FC_GET_STYPE(header->frame_ctl)); |
1164 | IEEE80211_DEBUG_SCAN("Probe response\n"); | 1165 | IEEE80211_DEBUG_SCAN("Probe response\n"); |
1165 | ieee80211_process_probe_response( | 1166 | ieee80211_process_probe_response(ieee, |
1166 | ieee, (struct ieee80211_probe_response *)header, stats); | 1167 | (struct |
1168 | ieee80211_probe_response *) | ||
1169 | header, stats); | ||
1167 | break; | 1170 | break; |
1168 | 1171 | ||
1169 | case IEEE80211_STYPE_BEACON: | 1172 | case IEEE80211_STYPE_BEACON: |
1170 | IEEE80211_DEBUG_MGMT("received BEACON (%d)\n", | 1173 | IEEE80211_DEBUG_MGMT("received BEACON (%d)\n", |
1171 | WLAN_FC_GET_STYPE(header->frame_ctl)); | 1174 | WLAN_FC_GET_STYPE(header->frame_ctl)); |
1172 | IEEE80211_DEBUG_SCAN("Beacon\n"); | 1175 | IEEE80211_DEBUG_SCAN("Beacon\n"); |
1173 | ieee80211_process_probe_response( | 1176 | ieee80211_process_probe_response(ieee, |
1174 | ieee, (struct ieee80211_probe_response *)header, stats); | 1177 | (struct |
1178 | ieee80211_probe_response *) | ||
1179 | header, stats); | ||
1175 | break; | 1180 | break; |
1176 | 1181 | ||
1177 | default: | 1182 | default: |
@@ -1184,6 +1189,5 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee, | |||
1184 | } | 1189 | } |
1185 | } | 1190 | } |
1186 | 1191 | ||
1187 | |||
1188 | EXPORT_SYMBOL(ieee80211_rx_mgt); | 1192 | EXPORT_SYMBOL(ieee80211_rx_mgt); |
1189 | EXPORT_SYMBOL(ieee80211_rx); | 1193 | EXPORT_SYMBOL(ieee80211_rx); |
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index b7ea3e25e25d..c9aaff3fea1e 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c | |||
@@ -45,10 +45,8 @@ | |||
45 | 45 | ||
46 | #include <net/ieee80211.h> | 46 | #include <net/ieee80211.h> |
47 | 47 | ||
48 | |||
49 | /* | 48 | /* |
50 | 49 | ||
51 | |||
52 | 802.11 Data Frame | 50 | 802.11 Data Frame |
53 | 51 | ||
54 | ,-------------------------------------------------------------------. | 52 | ,-------------------------------------------------------------------. |
@@ -82,7 +80,6 @@ Desc. | IV | Encrypted | ICV | | |||
82 | `-----------------------' | 80 | `-----------------------' |
83 | Total: 8 non-data bytes | 81 | Total: 8 non-data bytes |
84 | 82 | ||
85 | |||
86 | 802.3 Ethernet Data Frame | 83 | 802.3 Ethernet Data Frame |
87 | 84 | ||
88 | ,-----------------------------------------. | 85 | ,-----------------------------------------. |
@@ -131,7 +128,7 @@ payload of each frame is reduced to 492 bytes. | |||
131 | static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; | 128 | static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; |
132 | static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; | 129 | static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; |
133 | 130 | ||
134 | static inline int ieee80211_put_snap(u8 *data, u16 h_proto) | 131 | static inline int ieee80211_put_snap(u8 * data, u16 h_proto) |
135 | { | 132 | { |
136 | struct ieee80211_snap_hdr *snap; | 133 | struct ieee80211_snap_hdr *snap; |
137 | u8 *oui; | 134 | u8 *oui; |
@@ -149,17 +146,15 @@ static inline int ieee80211_put_snap(u8 *data, u16 h_proto) | |||
149 | snap->oui[1] = oui[1]; | 146 | snap->oui[1] = oui[1]; |
150 | snap->oui[2] = oui[2]; | 147 | snap->oui[2] = oui[2]; |
151 | 148 | ||
152 | *(u16 *)(data + SNAP_SIZE) = htons(h_proto); | 149 | *(u16 *) (data + SNAP_SIZE) = htons(h_proto); |
153 | 150 | ||
154 | return SNAP_SIZE + sizeof(u16); | 151 | return SNAP_SIZE + sizeof(u16); |
155 | } | 152 | } |
156 | 153 | ||
157 | static inline int ieee80211_encrypt_fragment( | 154 | static inline int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, |
158 | struct ieee80211_device *ieee, | 155 | struct sk_buff *frag, int hdr_len) |
159 | struct sk_buff *frag, | ||
160 | int hdr_len) | ||
161 | { | 156 | { |
162 | struct ieee80211_crypt_data* crypt = ieee->crypt[ieee->tx_keyidx]; | 157 | struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx]; |
163 | int res; | 158 | int res; |
164 | 159 | ||
165 | #ifdef CONFIG_IEEE80211_CRYPT_TKIP | 160 | #ifdef CONFIG_IEEE80211_CRYPT_TKIP |
@@ -167,7 +162,7 @@ static inline int ieee80211_encrypt_fragment( | |||
167 | 162 | ||
168 | if (ieee->tkip_countermeasures && | 163 | if (ieee->tkip_countermeasures && |
169 | crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { | 164 | crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { |
170 | header = (struct ieee80211_hdr *) frag->data; | 165 | header = (struct ieee80211_hdr *)frag->data; |
171 | if (net_ratelimit()) { | 166 | if (net_ratelimit()) { |
172 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " | 167 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " |
173 | "TX packet to " MAC_FMT "\n", | 168 | "TX packet to " MAC_FMT "\n", |
@@ -200,8 +195,8 @@ static inline int ieee80211_encrypt_fragment( | |||
200 | return 0; | 195 | return 0; |
201 | } | 196 | } |
202 | 197 | ||
203 | 198 | void ieee80211_txb_free(struct ieee80211_txb *txb) | |
204 | void ieee80211_txb_free(struct ieee80211_txb *txb) { | 199 | { |
205 | int i; | 200 | int i; |
206 | if (unlikely(!txb)) | 201 | if (unlikely(!txb)) |
207 | return; | 202 | return; |
@@ -216,9 +211,8 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, | |||
216 | { | 211 | { |
217 | struct ieee80211_txb *txb; | 212 | struct ieee80211_txb *txb; |
218 | int i; | 213 | int i; |
219 | txb = kmalloc( | 214 | txb = kmalloc(sizeof(struct ieee80211_txb) + (sizeof(u8 *) * nr_frags), |
220 | sizeof(struct ieee80211_txb) + (sizeof(u8*) * nr_frags), | 215 | gfp_mask); |
221 | gfp_mask); | ||
222 | if (!txb) | 216 | if (!txb) |
223 | return NULL; | 217 | return NULL; |
224 | 218 | ||
@@ -243,8 +237,7 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, | |||
243 | } | 237 | } |
244 | 238 | ||
245 | /* SKBs are added to the ieee->tx_queue. */ | 239 | /* SKBs are added to the ieee->tx_queue. */ |
246 | int ieee80211_xmit(struct sk_buff *skb, | 240 | int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) |
247 | struct net_device *dev) | ||
248 | { | 241 | { |
249 | struct ieee80211_device *ieee = netdev_priv(dev); | 242 | struct ieee80211_device *ieee = netdev_priv(dev); |
250 | struct ieee80211_txb *txb = NULL; | 243 | struct ieee80211_txb *txb = NULL; |
@@ -255,21 +248,20 @@ int ieee80211_xmit(struct sk_buff *skb, | |||
255 | int ether_type, encrypt; | 248 | int ether_type, encrypt; |
256 | int bytes, fc, hdr_len; | 249 | int bytes, fc, hdr_len; |
257 | struct sk_buff *skb_frag; | 250 | struct sk_buff *skb_frag; |
258 | struct ieee80211_hdr header = { /* Ensure zero initialized */ | 251 | struct ieee80211_hdr header = { /* Ensure zero initialized */ |
259 | .duration_id = 0, | 252 | .duration_id = 0, |
260 | .seq_ctl = 0 | 253 | .seq_ctl = 0 |
261 | }; | 254 | }; |
262 | u8 dest[ETH_ALEN], src[ETH_ALEN]; | 255 | u8 dest[ETH_ALEN], src[ETH_ALEN]; |
263 | 256 | ||
264 | struct ieee80211_crypt_data* crypt; | 257 | struct ieee80211_crypt_data *crypt; |
265 | 258 | ||
266 | spin_lock_irqsave(&ieee->lock, flags); | 259 | spin_lock_irqsave(&ieee->lock, flags); |
267 | 260 | ||
268 | /* If there is no driver handler to take the TXB, dont' bother | 261 | /* If there is no driver handler to take the TXB, dont' bother |
269 | * creating it... */ | 262 | * creating it... */ |
270 | if (!ieee->hard_start_xmit) { | 263 | if (!ieee->hard_start_xmit) { |
271 | printk(KERN_WARNING "%s: No xmit handler.\n", | 264 | printk(KERN_WARNING "%s: No xmit handler.\n", ieee->dev->name); |
272 | ieee->dev->name); | ||
273 | goto success; | 265 | goto success; |
274 | } | 266 | } |
275 | 267 | ||
@@ -284,7 +276,7 @@ int ieee80211_xmit(struct sk_buff *skb, | |||
284 | crypt = ieee->crypt[ieee->tx_keyidx]; | 276 | crypt = ieee->crypt[ieee->tx_keyidx]; |
285 | 277 | ||
286 | encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && | 278 | encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && |
287 | ieee->host_encrypt && crypt && crypt->ops; | 279 | ieee->host_encrypt && crypt && crypt->ops; |
288 | 280 | ||
289 | if (!encrypt && ieee->ieee802_1x && | 281 | if (!encrypt && ieee->ieee802_1x && |
290 | ieee->drop_unencrypted && ether_type != ETH_P_PAE) { | 282 | ieee->drop_unencrypted && ether_type != ETH_P_PAE) { |
@@ -294,7 +286,7 @@ int ieee80211_xmit(struct sk_buff *skb, | |||
294 | 286 | ||
295 | /* Save source and destination addresses */ | 287 | /* Save source and destination addresses */ |
296 | memcpy(&dest, skb->data, ETH_ALEN); | 288 | memcpy(&dest, skb->data, ETH_ALEN); |
297 | memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN); | 289 | memcpy(&src, skb->data + ETH_ALEN, ETH_ALEN); |
298 | 290 | ||
299 | /* Advance the SKB to the start of the payload */ | 291 | /* Advance the SKB to the start of the payload */ |
300 | skb_pull(skb, sizeof(struct ethhdr)); | 292 | skb_pull(skb, sizeof(struct ethhdr)); |
@@ -304,7 +296,7 @@ int ieee80211_xmit(struct sk_buff *skb, | |||
304 | 296 | ||
305 | if (encrypt) | 297 | if (encrypt) |
306 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | | 298 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | |
307 | IEEE80211_FCTL_PROTECTED; | 299 | IEEE80211_FCTL_PROTECTED; |
308 | else | 300 | else |
309 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; | 301 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; |
310 | 302 | ||
@@ -327,8 +319,7 @@ int ieee80211_xmit(struct sk_buff *skb, | |||
327 | 319 | ||
328 | /* Determine fragmentation size based on destination (multicast | 320 | /* Determine fragmentation size based on destination (multicast |
329 | * and broadcast are not fragmented) */ | 321 | * and broadcast are not fragmented) */ |
330 | if (is_multicast_ether_addr(dest) || | 322 | if (is_multicast_ether_addr(dest) || is_broadcast_ether_addr(dest)) |
331 | is_broadcast_ether_addr(dest)) | ||
332 | frag_size = MAX_FRAG_THRESHOLD; | 323 | frag_size = MAX_FRAG_THRESHOLD; |
333 | else | 324 | else |
334 | frag_size = ieee->fts; | 325 | frag_size = ieee->fts; |
@@ -345,7 +336,7 @@ int ieee80211_xmit(struct sk_buff *skb, | |||
345 | /* Each fragment may need to have room for encryptiong pre/postfix */ | 336 | /* Each fragment may need to have room for encryptiong pre/postfix */ |
346 | if (encrypt) | 337 | if (encrypt) |
347 | bytes_per_frag -= crypt->ops->extra_prefix_len + | 338 | bytes_per_frag -= crypt->ops->extra_prefix_len + |
348 | crypt->ops->extra_postfix_len; | 339 | crypt->ops->extra_postfix_len; |
349 | 340 | ||
350 | /* Number of fragments is the total bytes_per_frag / | 341 | /* Number of fragments is the total bytes_per_frag / |
351 | * payload_per_fragment */ | 342 | * payload_per_fragment */ |
@@ -380,19 +371,19 @@ int ieee80211_xmit(struct sk_buff *skb, | |||
380 | /* If this is not the last fragment, then add the MOREFRAGS | 371 | /* If this is not the last fragment, then add the MOREFRAGS |
381 | * bit to the frame control */ | 372 | * bit to the frame control */ |
382 | if (i != nr_frags - 1) { | 373 | if (i != nr_frags - 1) { |
383 | frag_hdr->frame_ctl = cpu_to_le16( | 374 | frag_hdr->frame_ctl = |
384 | fc | IEEE80211_FCTL_MOREFRAGS); | 375 | cpu_to_le16(fc | IEEE80211_FCTL_MOREFRAGS); |
385 | bytes = bytes_per_frag; | 376 | bytes = bytes_per_frag; |
386 | } else { | 377 | } else { |
387 | /* The last fragment takes the remaining length */ | 378 | /* The last fragment takes the remaining length */ |
388 | bytes = bytes_last_frag; | 379 | bytes = bytes_last_frag; |
389 | } | 380 | } |
390 | 381 | ||
391 | /* Put a SNAP header on the first fragment */ | 382 | /* Put a SNAP header on the first fragment */ |
392 | if (i == 0) { | 383 | if (i == 0) { |
393 | ieee80211_put_snap( | 384 | ieee80211_put_snap(skb_put |
394 | skb_put(skb_frag, SNAP_SIZE + sizeof(u16)), | 385 | (skb_frag, SNAP_SIZE + sizeof(u16)), |
395 | ether_type); | 386 | ether_type); |
396 | bytes -= SNAP_SIZE + sizeof(u16); | 387 | bytes -= SNAP_SIZE + sizeof(u16); |
397 | } | 388 | } |
398 | 389 | ||
@@ -410,14 +401,13 @@ int ieee80211_xmit(struct sk_buff *skb, | |||
410 | skb_put(skb_frag, 4); | 401 | skb_put(skb_frag, 4); |
411 | } | 402 | } |
412 | 403 | ||
413 | 404 | success: | |
414 | success: | ||
415 | spin_unlock_irqrestore(&ieee->lock, flags); | 405 | spin_unlock_irqrestore(&ieee->lock, flags); |
416 | 406 | ||
417 | dev_kfree_skb_any(skb); | 407 | dev_kfree_skb_any(skb); |
418 | 408 | ||
419 | if (txb) { | 409 | if (txb) { |
420 | if ((*ieee->hard_start_xmit)(txb, dev) == 0) { | 410 | if ((*ieee->hard_start_xmit) (txb, dev) == 0) { |
421 | stats->tx_packets++; | 411 | stats->tx_packets++; |
422 | stats->tx_bytes += txb->payload_size; | 412 | stats->tx_bytes += txb->payload_size; |
423 | return 0; | 413 | return 0; |
@@ -427,7 +417,7 @@ int ieee80211_xmit(struct sk_buff *skb, | |||
427 | 417 | ||
428 | return 0; | 418 | return 0; |
429 | 419 | ||
430 | failed: | 420 | failed: |
431 | spin_unlock_irqrestore(&ieee->lock, flags); | 421 | spin_unlock_irqrestore(&ieee->lock, flags); |
432 | netif_stop_queue(dev); | 422 | netif_stop_queue(dev); |
433 | stats->tx_errors++; | 423 | stats->tx_errors++; |
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 |
44 | static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | 44 | static 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); |