33 #include <linux/sched.h>
34 #include <linux/slab.h>
46 #ifdef CONFIG_IPW2200_DEBUG
52 #ifdef CONFIG_IPW2200_MONITOR
58 #ifdef CONFIG_IPW2200_PROMISCUOUS
64 #ifdef CONFIG_IPW2200_RADIOTAP
70 #ifdef CONFIG_IPW2200_QOS
76 #define IPW2200_VERSION "1.2.2" VK VD VM VP VR VQ
77 #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver"
78 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation"
79 #define DRV_VERSION IPW2200_VERSION
81 #define ETH_P_80211_STATS (ETH_P_80211_RAW + 1)
88 #ifdef CONFIG_IPW2200_MONITOR
93 static int cmdlog = 0;
95 static int default_channel = 0;
96 static int network_mode = 0;
98 static u32 ipw_debug_level;
100 static int auto_create = 1;
101 static int led_support = 1;
103 static int bt_coexist = 0;
104 static int hwcrypto = 0;
105 static int roaming = 1;
106 static const char ipw_modes[] = {
111 #ifdef CONFIG_IPW2200_PROMISCUOUS
112 static int rtap_iface = 0;
130 #define ipw2200_a_rates (ipw2200_rates + 4)
131 #define ipw2200_num_a_rates 8
132 #define ipw2200_bg_rates (ipw2200_rates + 0)
133 #define ipw2200_num_bg_rates 12
138 #define ieee80211chan2mhz(x) \
140 (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \
143 #ifdef CONFIG_IPW2200_QOS
144 static int qos_enable = 0;
145 static int qos_burst_enable = 0;
146 static int qos_no_ack_mask = 0;
147 static int burst_duration_CCK = 0;
148 static int burst_duration_OFDM = 0;
196 static int from_priority_to_tx_queue[] = {
210 static void ipw_remove_current_network(
struct ipw_priv *
priv);
216 static int ipw_queue_tx_hcmd(
struct ipw_priv *
priv,
int hcmd,
void *
buf,
219 static void ipw_tx_queue_free(
struct ipw_priv *);
223 static void ipw_rx_queue_replenish(
void *);
224 static int ipw_up(
struct ipw_priv *);
226 static void ipw_down(
struct ipw_priv *);
228 static int ipw_config(
struct ipw_priv *);
231 static void ipw_set_hwcrypto_keys(
struct ipw_priv *);
232 static void ipw_send_wep_keys(
struct ipw_priv *,
int);
234 static int snprint_line(
char *
buf,
size_t count,
240 out =
snprintf(buf, count,
"%08X", ofs);
242 for (l = 0, i = 0; i < 2; i++) {
243 out +=
snprintf(buf + out, count - out,
" ");
244 for (j = 0; j < 8 && l < len; j++, l++)
245 out +=
snprintf(buf + out, count - out,
"%02X ",
248 out +=
snprintf(buf + out, count - out,
" ");
251 out +=
snprintf(buf + out, count - out,
" ");
252 for (l = 0, i = 0; i < 2; i++) {
253 out +=
snprintf(buf + out, count - out,
" ");
254 for (j = 0; j < 8 && l < len; j++, l++) {
255 c = data[(i * 8 +
j)];
259 out +=
snprintf(buf + out, count - out,
"%c", c);
263 out +=
snprintf(buf + out, count - out,
" ");
269 static void printk_buf(
int level,
const u8 * data,
u32 len)
273 if (!(ipw_debug_level & level))
277 snprint_line(line,
sizeof(line), &data[ofs],
281 len -=
min(len, 16
U);
285 static int snprintk_buf(
u8 * output,
size_t size,
const u8 * data,
size_t len)
291 while (size && len) {
292 out = snprint_line(output, size, &data[ofs],
293 min_t(
size_t, len, 16
U), ofs);
298 len -=
min_t(
size_t, len, 16
U);
306 #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b)
310 #define ipw_read_reg8(a, b) _ipw_read_reg8(a, b)
316 IPW_DEBUG_IO(
"%s %d: write_indirect8(0x%08X, 0x%08X)\n", __FILE__,
317 __LINE__, (
u32) (b), (
u32) (c));
318 _ipw_write_reg8(a, b, c);
323 static inline void ipw_write_reg16(
struct ipw_priv *a,
u32 b,
u16 c)
325 IPW_DEBUG_IO(
"%s %d: write_indirect16(0x%08X, 0x%08X)\n", __FILE__,
326 __LINE__, (
u32) (b), (
u32) (c));
327 _ipw_write_reg16(a, b, c);
332 static inline void ipw_write_reg32(
struct ipw_priv *a,
u32 b,
u32 c)
334 IPW_DEBUG_IO(
"%s %d: write_indirect32(0x%08X, 0x%08X)\n", __FILE__,
335 __LINE__, (
u32) (b), (
u32) (c));
336 _ipw_write_reg32(a, b, c);
340 static inline void _ipw_write8(
struct ipw_priv *ipw,
unsigned long ofs,
347 #define ipw_write8(ipw, ofs, val) do { \
348 IPW_DEBUG_IO("%s %d: write_direct8(0x%08X, 0x%08X)\n", __FILE__, \
349 __LINE__, (u32)(ofs), (u32)(val)); \
350 _ipw_write8(ipw, ofs, val); \
354 static inline void _ipw_write16(
struct ipw_priv *ipw,
unsigned long ofs,
361 #define ipw_write16(ipw, ofs, val) do { \
362 IPW_DEBUG_IO("%s %d: write_direct16(0x%08X, 0x%08X)\n", __FILE__, \
363 __LINE__, (u32)(ofs), (u32)(val)); \
364 _ipw_write16(ipw, ofs, val); \
368 static inline void _ipw_write32(
struct ipw_priv *ipw,
unsigned long ofs,
375 #define ipw_write32(ipw, ofs, val) do { \
376 IPW_DEBUG_IO("%s %d: write_direct32(0x%08X, 0x%08X)\n", __FILE__, \
377 __LINE__, (u32)(ofs), (u32)(val)); \
378 _ipw_write32(ipw, ofs, val); \
382 static inline u8 _ipw_read8(
struct ipw_priv *ipw,
unsigned long ofs)
388 #define ipw_read8(ipw, ofs) ({ \
389 IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", __FILE__, __LINE__, \
391 _ipw_read8(ipw, ofs); \
395 static inline u16 _ipw_read16(
struct ipw_priv *ipw,
unsigned long ofs)
401 #define ipw_read16(ipw, ofs) ({ \
402 IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", __FILE__, __LINE__, \
404 _ipw_read16(ipw, ofs); \
408 static inline u32 _ipw_read32(
struct ipw_priv *ipw,
unsigned long ofs)
414 #define ipw_read32(ipw, ofs) ({ \
415 IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", __FILE__, __LINE__, \
417 _ipw_read32(ipw, ofs); \
420 static void _ipw_read_indirect(
struct ipw_priv *,
u32,
u8 *,
int);
422 #define ipw_read_indirect(a, b, c, d) ({ \
423 IPW_DEBUG_IO("%s %d: read_indirect(0x%08X) %u bytes\n", __FILE__, \
424 __LINE__, (u32)(b), (u32)(d)); \
425 _ipw_read_indirect(a, b, c, d); \
431 #define ipw_write_indirect(a, b, c, d) do { \
432 IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %u bytes\n", __FILE__, \
433 __LINE__, (u32)(b), (u32)(d)); \
434 _ipw_write_indirect(a, b, c, d); \
440 IPW_DEBUG_IO(
" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value);
449 u32 dif_len = reg - aligned_addr;
451 IPW_DEBUG_IO(
" reg = 0x%8X : value = 0x%8X\n", reg, value);
460 u32 dif_len = (reg - aligned_addr) & (~0x1ul);
462 IPW_DEBUG_IO(
" reg = 0x%8X : value = 0x%8X\n", reg, value);
474 return (word >> ((reg & 0x3) * 8)) & 0xff;
486 IPW_DEBUG_IO(
" reg = 0x%4X : value = 0x%4x\n", reg, value);
496 u32 dif_len = addr - aligned_addr;
499 IPW_DEBUG_IO(
"addr = %i, buf = %p, num = %i\n", addr, buf, num);
509 for (i = dif_len; ((i < 4) && (num > 0)); i++, num--)
516 for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4)
522 for (i = 0; num > 0; i++, num--)
529 static void _ipw_write_indirect(
struct ipw_priv *priv,
u32 addr,
u8 * buf,
533 u32 dif_len = addr - aligned_addr;
536 IPW_DEBUG_IO(
"addr = %i, buf = %p, num = %i\n", addr, buf, num);
546 for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++)
553 for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4)
559 for (i = 0; num > 0; i++, num--, buf++)
566 static void ipw_write_direct(
struct ipw_priv *priv,
u32 addr,
void *buf,
579 static inline void ipw_clear_bit(
struct ipw_priv *priv,
u32 reg,
u32 mask)
584 static inline void __ipw_enable_interrupts(
struct ipw_priv *priv)
592 static inline void __ipw_disable_interrupts(
struct ipw_priv *priv)
600 static inline void ipw_enable_interrupts(
struct ipw_priv *priv)
605 __ipw_enable_interrupts(priv);
606 spin_unlock_irqrestore(&priv->
irq_lock, flags);
609 static inline void ipw_disable_interrupts(
struct ipw_priv *priv)
614 __ipw_disable_interrupts(priv);
615 spin_unlock_irqrestore(&priv->
irq_lock, flags);
618 static char *ipw_error_desc(
u32 val)
626 return "MEMORY_UNDERFLOW";
628 return "MEMORY_OVERFLOW";
632 return "BAD_CHECKSUM";
634 return "NMI_INTERRUPT";
636 return "BAD_DATABASE";
640 return "DMA_UNDERRUN";
646 return "EEPROM_ERROR";
650 return "FATAL_ERROR";
652 return "UNKNOWN_ERROR";
656 static void ipw_dump_error_log(
struct ipw_priv *priv,
662 IPW_ERROR(
"Error allocating and capturing error log. "
663 "Nothing to dump.\n");
667 IPW_ERROR(
"Start IPW Error Log Dump:\n");
668 IPW_ERROR(
"Status: 0x%08X, Config: %08X\n",
671 for (i = 0; i < error->
elem_len; i++)
672 IPW_ERROR(
"%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n",
673 ipw_error_desc(error->
elem[i].desc),
675 error->
elem[i].blink1,
676 error->
elem[i].blink2,
677 error->
elem[i].link1,
678 error->
elem[i].link2, error->
elem[i].data);
679 for (i = 0; i < error->
log_len; i++)
682 error->
log[i].data, error->
log[i].event);
685 static inline int ipw_is_init(
struct ipw_priv *priv)
696 if (!priv || !val || !len) {
727 if (*len <
sizeof(
u32)) {
729 "need %zd\n",
sizeof(
u32));
760 if (*len <
sizeof(
u32)) {
762 "need %zd\n",
sizeof(
u32));
801 field_len = *((
u16 *) & field_info);
804 field_count = *(((
u16 *) & field_info) + 1);
807 total_len = field_len * field_count;
808 if (total_len > *len) {
818 "field_info = 0x%08x\n",
819 addr, total_len, field_info);
832 static void ipw_init_ordinals(
struct ipw_priv *priv)
855 static u32 ipw_register_toggle(
u32 reg)
859 reg &= ~IPW_GATE_ODMA;
861 reg &= ~IPW_GATE_IDMA;
863 reg &= ~IPW_GATE_ADMA;
876 #define LD_TIME_LINK_ON msecs_to_jiffies(300)
877 #define LD_TIME_LINK_OFF msecs_to_jiffies(2700)
878 #define LD_TIME_ACT_ON msecs_to_jiffies(250)
880 static void ipw_led_link_on(
struct ipw_priv *priv)
898 led = ipw_register_toggle(led);
911 spin_unlock_irqrestore(&priv->
lock, flags);
919 ipw_led_link_on(priv);
923 static void ipw_led_link_off(
struct ipw_priv *priv)
938 led = ipw_register_toggle(led);
956 spin_unlock_irqrestore(&priv->
lock, flags);
964 ipw_led_link_off(priv);
968 static void __ipw_led_activity_on(
struct ipw_priv *priv)
982 led = ipw_register_toggle(led);
1001 void ipw_led_activity_on(
struct ipw_priv *priv)
1003 unsigned long flags;
1005 __ipw_led_activity_on(priv);
1006 spin_unlock_irqrestore(&priv->
lock, flags);
1010 static void ipw_led_activity_off(
struct ipw_priv *priv)
1012 unsigned long flags;
1024 led = ipw_register_toggle(led);
1034 spin_unlock_irqrestore(&priv->
lock, flags);
1042 ipw_led_activity_off(priv);
1046 static void ipw_led_band_on(
struct ipw_priv *priv)
1048 unsigned long flags;
1073 led = ipw_register_toggle(led);
1078 spin_unlock_irqrestore(&priv->
lock, flags);
1081 static void ipw_led_band_off(
struct ipw_priv *priv)
1083 unsigned long flags;
1096 led = ipw_register_toggle(led);
1101 spin_unlock_irqrestore(&priv->
lock, flags);
1104 static void ipw_led_radio_on(
struct ipw_priv *priv)
1106 ipw_led_link_on(priv);
1109 static void ipw_led_radio_off(
struct ipw_priv *priv)
1111 ipw_led_activity_off(priv);
1112 ipw_led_link_off(priv);
1115 static void ipw_led_link_up(
struct ipw_priv *priv)
1118 ipw_led_link_on(priv);
1121 static void ipw_led_link_down(
struct ipw_priv *priv)
1123 ipw_led_activity_off(priv);
1124 ipw_led_link_off(priv);
1127 ipw_led_radio_off(priv);
1130 static void ipw_led_init(
struct ipw_priv *priv)
1154 ipw_led_band_on(priv);
1175 ipw_led_link_on(priv);
1177 ipw_led_link_off(priv);
1181 static void ipw_led_shutdown(
struct ipw_priv *priv)
1183 ipw_led_activity_off(priv);
1184 ipw_led_link_off(priv);
1185 ipw_led_band_off(priv);
1200 return sprintf(buf,
"0x%08X\n", ipw_debug_level);
1206 char *
p = (
char *)buf;
1209 if (p[1] ==
'x' || p[1] ==
'X' || p[0] ==
'x' || p[0] ==
'X') {
1211 if (p[0] ==
'x' || p[0] ==
'X')
1218 ": %s is not in hex or decimal form.\n", buf);
1220 ipw_debug_level =
val;
1226 show_debug_level, store_debug_level);
1228 static inline u32 ipw_get_event_log_len(
struct ipw_priv *priv)
1234 static void ipw_capture_event_log(
struct ipw_priv *priv,
1242 (
u8 *) log,
sizeof(*log) * log_len);
1249 u32 log_len = ipw_get_event_log_len(priv);
1253 error =
kmalloc(
sizeof(*error) +
1254 sizeof(*error->
elem) * elem_len +
1257 IPW_ERROR(
"Memory allocation for firmware error log "
1269 ipw_capture_event_log(priv, log_len, error->
log);
1273 sizeof(*error->
elem) * elem_len);
1282 u32 log_len = ipw_get_event_log_len(priv);
1288 log_size =
PAGE_SIZE /
sizeof(*log) > log_len ?
1292 IPW_ERROR(
"Unable to allocate memory for log\n");
1295 log_len = log_size /
sizeof(*log);
1296 ipw_capture_event_log(priv, log_len, log);
1299 for (i = 0; i < log_len; i++)
1302 log[i].
time, log[i].
event, log[i].data);
1318 "%08lX%08X%08X%08X",
1319 priv->
error->jiffies,
1320 priv->
error->status,
1322 for (i = 0; i < priv->
error->elem_len; i++)
1324 "\n%08X%08X%08X%08X%08X%08X%08X",
1325 priv->
error->elem[i].time,
1326 priv->
error->elem[i].desc,
1327 priv->
error->elem[i].blink1,
1328 priv->
error->elem[i].blink2,
1329 priv->
error->elem[i].link1,
1330 priv->
error->elem[i].link2,
1331 priv->
error->elem[i].data);
1334 "\n%08X", priv->
error->log_len);
1335 for (i = 0; i < priv->
error->log_len; i++)
1338 priv->
error->log[i].time,
1339 priv->
error->log[i].event,
1340 priv->
error->log[i].data);
1347 const char *buf,
size_t count)
1370 "\n%08lX%08X%08X%08X\n", priv->
cmdlog[i].jiffies,
1372 priv->
cmdlog[i].cmd.len);
1374 snprintk_buf(buf + len,
PAGE_SIZE - len,
1376 priv->
cmdlog[i].cmd.len);
1385 #ifdef CONFIG_IPW2200_PROMISCUOUS
1386 static void ipw_prom_free(
struct ipw_priv *priv);
1387 static int ipw_prom_alloc(
struct ipw_priv *priv);
1390 const char *buf,
size_t count)
1403 if (netif_running(priv->prom_net_dev)) {
1404 IPW_WARNING(
"Interface is up. Cannot unregister.\n");
1408 ipw_prom_free(priv);
1416 rc = ipw_prom_alloc(priv);
1426 IPW_ERROR(
"Failed to register promiscuous network "
1427 "device (error %d).\n", rc);
1439 return sprintf(buf,
"%s", priv->prom_net_dev->name);
1453 const char *buf,
size_t count)
1457 if (!priv->prom_priv) {
1458 IPW_ERROR(
"Attempting to set filter without "
1459 "rtap_iface enabled.\n");
1477 priv->prom_priv ? priv->prom_priv->filter : 0);
1488 return sprintf(buf,
"%d\n", priv->
ieee->scan_age);
1492 const char *buf,
size_t count)
1496 char buffer[] =
"00000000";
1498 (
sizeof(
buffer) - 1) > count ? count :
sizeof(
buffer) - 1;
1507 if (p[1] ==
'x' || p[1] ==
'X' || p[0] ==
'x' || p[0] ==
'X') {
1509 if (p[0] ==
'x' || p[0] ==
'X')
1535 const char *buf,
size_t count)
1547 ipw_led_shutdown(priv);
1624 return sprintf(buf,
"%i\n", n);
1628 const char *buf,
size_t count)
1636 show_eeprom_delay, store_eeprom_delay);
1645 return sprintf(buf,
"0x%08x\n", reg);
1649 const char *buf,
size_t count)
1660 show_command_event_reg, store_command_event_reg);
1669 return sprintf(buf,
"0x%08x\n", reg);
1673 const char *buf,
size_t count)
1679 ipw_write_reg32(p, 0x301100, reg);
1684 show_mem_gpio_reg, store_mem_gpio_reg);
1697 return sprintf(buf,
"0x%08x\n", reg);
1701 const char *buf,
size_t count)
1711 show_indirect_dword, store_indirect_dword);
1724 return sprintf(buf,
"0x%02x\n", reg);
1728 const char *buf,
size_t count)
1738 show_indirect_byte, store_indirect_byte);
1751 return sprintf(buf,
"0x%08x\n", reg);
1755 const char *buf,
size_t count)
1765 show_direct_dword, store_direct_dword);
1767 static int rf_kill_active(
struct ipw_priv *priv)
1769 if (0 == (
ipw_read32(priv, 0x30) & 0x10000)) {
1789 (rf_kill_active(priv) ? 0x2 : 0x0);
1790 return sprintf(buf,
"%i\n", val);
1793 static int ipw_radio_kill_sw(
struct ipw_priv *priv,
int disable_radio)
1795 if ((disable_radio ? 1 : 0) ==
1800 disable_radio ?
"OFF" :
"ON");
1802 if (disable_radio) {
1812 if (rf_kill_active(priv)) {
1814 "disabled by HW switch\n");
1827 const char *buf,
size_t count)
1831 ipw_radio_kill_sw(priv, buf[0] ==
'1');
1842 int pos = 0, len = 0;
1845 len +=
sprintf(&buf[len],
"%d ",
1847 return len +
sprintf(&buf[len],
"\n");
1854 const char *buf,
size_t count)
1858 const char *p =
buf;
1870 IPW_WARNING(
"Skipping invalid channel request: %d\n",
1875 while (*p ==
' ' || *p ==
'\t')
1900 const char *buf,
size_t count)
1912 show_net_stats, store_net_stats);
1923 "Displaying %d channels in 2.4Ghz band "
1927 len +=
sprintf(&buf[len],
"%d: BSS%s%s, %s, Band %s.\n",
1930 " (radar spectrum)" :
"",
1932 (geo->
bg[i].flags & LIBIPW_CH_RADAR_DETECT))
1935 "passive only" :
"active/passive",
1941 "Displaying %d channels in 5.2Ghz band "
1944 len +=
sprintf(&buf[len],
"%d: BSS%s%s, %s.\n",
1947 " (radar spectrum)" :
"",
1949 (geo->
a[i].flags & LIBIPW_CH_RADAR_DETECT))
1952 "passive only" :
"active/passive");
1971 static void ipw_irq_tasklet(
struct ipw_priv *priv)
1973 u32 inta, inta_mask, handled = 0;
1974 unsigned long flags;
1982 if (inta == 0xFFFFFFFF) {
1993 spin_unlock_irqrestore(&priv->
irq_lock, flags);
2005 rc = ipw_queue_tx_reclaim(priv, &priv->
txq_cmd, -1);
2013 rc = ipw_queue_tx_reclaim(priv, &priv->
txq[0], 0);
2019 rc = ipw_queue_tx_reclaim(priv, &priv->
txq[1], 1);
2025 rc = ipw_queue_tx_reclaim(priv, &priv->
txq[2], 2);
2031 rc = ipw_queue_tx_reclaim(priv, &priv->
txq[3], 3);
2076 IPW_WARNING(
"Firmware error detected. Restarting.\n");
2081 ipw_alloc_error_log(priv);
2082 ipw_dump_error_log(priv, error);
2086 priv->
error = ipw_alloc_error_log(priv);
2093 ipw_dump_error_log(priv, priv->
error);
2098 if (priv->
ieee->sec.encrypt) {
2120 if (handled != inta) {
2121 IPW_ERROR(
"Unhandled INTA bits 0x%08x\n", inta & ~handled);
2124 spin_unlock_irqrestore(&priv->
lock, flags);
2127 ipw_enable_interrupts(priv);
2130 #define IPW_CMD(x) case IPW_CMD_ ## x : return #x
2131 static char *get_cmd_string(
u8 cmd)
2171 IPW_CMD(VAP_LOCAL_TX_PWR_CONSTRAINT);
2174 IPW_CMD(VAP_MANDATORY_CHANNELS);
2177 IPW_CMD(VAP_SET_BEACONING_STATE);
2189 #define HOST_COMPLETE_TIMEOUT HZ
2194 unsigned long flags;
2195 unsigned long now,
end;
2199 IPW_ERROR(
"Failed to send %s: Already sending a command.\n",
2200 get_cmd_string(cmd->
cmd));
2201 spin_unlock_irqrestore(&priv->
lock, flags);
2217 get_cmd_string(cmd->
cmd), cmd->
cmd, cmd->
len,
2220 #ifndef DEBUG_CMD_WEP_KEY
2222 IPW_DEBUG_HC(
"WEP_KEY command masked out for secure.\n");
2227 rc = ipw_queue_tx_hcmd(priv, cmd->
cmd, cmd->
param, cmd->
len, 0);
2230 IPW_ERROR(
"Failed to send %s: Reason %d\n",
2231 get_cmd_string(cmd->
cmd), rc);
2232 spin_unlock_irqrestore(&priv->
lock, flags);
2235 spin_unlock_irqrestore(&priv->
lock, flags);
2253 if (priv->
status & STATUS_HCMD_ACTIVE) {
2254 IPW_ERROR(
"Failed to send %s: Command timed out.\n",
2255 get_cmd_string(cmd->
cmd));
2256 priv->
status &= ~STATUS_HCMD_ACTIVE;
2257 spin_unlock_irqrestore(&priv->
lock, flags);
2261 spin_unlock_irqrestore(&priv->
lock, flags);
2266 IPW_ERROR(
"Failed to send %s: Aborted due to RF kill switch.\n",
2267 get_cmd_string(cmd->
cmd));
2286 return __ipw_send_cmd(priv, &cmd);
2298 return __ipw_send_cmd(priv, &cmd);
2301 static int ipw_send_host_complete(
struct ipw_priv *priv)
2311 static int ipw_send_system_config(
struct ipw_priv *priv)
2318 static int ipw_send_ssid(
struct ipw_priv *priv,
u8 *
ssid,
int len)
2320 if (!priv || !ssid) {
2329 static int ipw_send_adapter_address(
struct ipw_priv *priv,
u8 *
mac)
2331 if (!priv || !mac) {
2342 static void ipw_adapter_restart(
void *
adapter)
2353 ipw_remove_current_network(priv);
2366 ipw_adapter_restart(priv);
2370 static void ipw_abort_scan(
struct ipw_priv *priv);
2372 #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ)
2374 static void ipw_scan_check(
void *data)
2380 "adapter after (%dms).\n",
2387 ipw_abort_scan(priv);
2397 ipw_scan_check(priv);
2401 static int ipw_send_scan_request_ext(
struct ipw_priv *priv,
2405 sizeof(*request), request);
2408 static int ipw_send_scan_abort(
struct ipw_priv *priv)
2418 static int ipw_set_sensitivity(
struct ipw_priv *priv,
u16 sens)
2428 static int ipw_send_associate(
struct ipw_priv *priv,
2431 if (!priv || !associate) {
2440 static int ipw_send_supported_rates(
struct ipw_priv *priv,
2443 if (!priv || !rates) {
2452 static int ipw_set_random_seed(
struct ipw_priv *priv)
2466 static int ipw_send_card_disable(
struct ipw_priv *priv,
u32 phy_off)
2479 if (!priv || !power) {
2487 static int ipw_set_tx_power(
struct ipw_priv *priv)
2500 max_power = geo->
bg[
i].max_power;
2501 tx_power.channels_tx_power[
i].channel_number =
2503 tx_power.channels_tx_power[
i].tx_power = max_power ?
2506 if (ipw_send_tx_power(priv, &
tx_power))
2511 if (ipw_send_tx_power(priv, &
tx_power))
2515 if (priv->
ieee->abg_true) {
2518 for (i = 0; i <
tx_power.num_channels; i++) {
2519 max_power = geo->
a[
i].max_power;
2520 tx_power.channels_tx_power[
i].channel_number =
2522 tx_power.channels_tx_power[
i].tx_power = max_power ?
2525 if (ipw_send_tx_power(priv, &
tx_power))
2531 static int ipw_send_rts_threshold(
struct ipw_priv *priv,
u16 rts)
2543 sizeof(rts_threshold), &rts_threshold);
2558 sizeof(frag_threshold), &frag_threshold);
2592 .long_retry_limit = llimit
2622 static inline void eeprom_write_reg(
struct ipw_priv *p,
u32 data)
2631 static void eeprom_cs(
struct ipw_priv *priv)
2633 eeprom_write_reg(priv, 0);
2640 static void eeprom_disable_cs(
struct ipw_priv *priv)
2643 eeprom_write_reg(priv, 0);
2648 static inline void eeprom_write_bit(
struct ipw_priv *p,
u8 bit)
2661 eeprom_write_bit(priv, 1);
2662 eeprom_write_bit(priv, op & 2);
2663 eeprom_write_bit(priv, op & 1);
2664 for (i = 7; i >= 0; i--) {
2665 eeprom_write_bit(priv, addr & (1 << i));
2682 for (i = 0; i < 16; i++) {
2691 eeprom_write_reg(priv, 0);
2692 eeprom_disable_cs(priv);
2699 static void eeprom_parse_mac(
struct ipw_priv *priv,
u8 * mac)
2704 static void ipw_read_eeprom(
struct ipw_priv *priv)
2712 for (i = 0; i < 128; i++)
2726 static void ipw_eeprom_init_sram(
struct ipw_priv *priv)
2766 static inline void ipw_fw_dma_reset_command_blocks(
struct ipw_priv *priv)
2773 static int ipw_fw_dma_enable(
struct ipw_priv *priv)
2779 ipw_fw_dma_reset_command_blocks(priv);
2788 static void ipw_fw_dma_abort(
struct ipw_priv *priv)
2802 static int ipw_fw_dma_write_command_block(
struct ipw_priv *priv,
int index,
2818 static int ipw_fw_dma_kick(
struct ipw_priv *priv)
2825 for (index = 0; index < priv->
sram_desc.last_cb_index; index++)
2826 ipw_fw_dma_write_command_block(priv, index,
2842 static void ipw_fw_dma_dump_command_block(
struct ipw_priv *priv)
2845 u32 register_value = 0;
2846 u32 cb_fields_address = 0;
2861 cb_fields_address +=
sizeof(
u32);
2865 cb_fields_address +=
sizeof(
u32);
2870 cb_fields_address +=
sizeof(
u32);
2877 static int ipw_fw_dma_command_block_index(
struct ipw_priv *priv)
2879 u32 current_cb_address = 0;
2880 u32 current_cb_index = 0;
2889 current_cb_index, current_cb_address);
2892 return current_cb_index;
2896 static int ipw_fw_dma_add_command_block(
struct ipw_priv *priv,
2900 int interrupt_enabled,
int is_last)
2907 u32 last_cb_element = 0;
2910 src_address, dest_address, length);
2915 last_cb_element = priv->
sram_desc.last_cb_index;
2916 cb = &priv->
sram_desc.cb_list[last_cb_element];
2920 if (interrupt_enabled)
2949 nr, dest_address, len);
2951 for (i = 0; i <
nr; i++) {
2953 ret = ipw_fw_dma_add_command_block(priv, src_address[i],
2968 static int ipw_fw_dma_wait(
struct ipw_priv *priv)
2970 u32 current_index = 0, previous_index;
2975 current_index = ipw_fw_dma_command_block_index(priv);
2979 while (current_index < priv->sram_desc.last_cb_index) {
2981 previous_index = current_index;
2982 current_index = ipw_fw_dma_command_block_index(priv);
2984 if (previous_index < current_index) {
2988 if (++watchdog > 400) {
2990 ipw_fw_dma_dump_command_block(priv);
2991 ipw_fw_dma_abort(priv);
2996 ipw_fw_dma_abort(priv);
3006 static void ipw_remove_current_network(
struct ipw_priv *priv)
3010 unsigned long flags;
3018 &priv->
ieee->network_free_list);
3021 spin_unlock_irqrestore(&priv->
ieee->lock, flags);
3033 static inline int ipw_alive(
struct ipw_priv *priv)
3039 static int ipw_poll_bit(
struct ipw_priv *priv,
u32 addr,
u32 mask,
3049 }
while (i < timeout);
3059 static int ipw_stop_master(
struct ipw_priv *priv)
3071 IPW_ERROR(
"wait for stop master failed after 100ms\n");
3080 static void ipw_arc_release(
struct ipw_priv *priv)
3096 static int ipw_load_ucode(
struct ipw_priv *priv,
u8 * data,
size_t len)
3098 int rc = 0,
i,
addr;
3106 rc = ipw_stop_master(priv);
3122 ipw_arc_release(priv);
3147 for (i = 0; i < len / 2; i++)
3158 for (i = 0; i < 100; i++) {
3170 for (i = 0; i <
ARRAY_SIZE(response_buffer); i++)
3171 response_buffer[i] =
3180 (
"Microcode OK, rev. %d (0x%x) dev. %d (0x%x) "
3181 "of %02d/%02d/%02d %02d:%02d\n",
3207 static int ipw_load_firmware(
struct ipw_priv *priv,
u8 * data,
size_t len)
3214 struct pci_pool *
pool;
3240 ret = ipw_fw_dma_enable(priv);
3251 chunk = (
struct fw_chunk *)(data + offset);
3257 for (i = 0; i <
nr; i++) {
3258 virts[total_nr] = pci_pool_alloc(pool,
GFP_KERNEL,
3260 if (!virts[total_nr]) {
3266 memcpy(virts[total_nr], start, size);
3277 ret = ipw_fw_dma_add_buffer(priv, &phys[total_nr - nr],
3285 offset += chunk_len;
3286 }
while (offset < len);
3289 ret = ipw_fw_dma_kick(priv);
3295 ret = ipw_fw_dma_wait(priv);
3301 for (i = 0; i < total_nr; i++)
3302 pci_pool_free(pool, virts[i], phys[i]);
3304 pci_pool_destroy(pool);
3312 static int ipw_stop_nic(
struct ipw_priv *priv)
3322 IPW_ERROR(
"wait for reg master disabled failed after 500ms\n");
3331 static void ipw_start_nic(
struct ipw_priv *priv)
3348 static int ipw_init_nic(
struct ipw_priv *priv)
3383 static int ipw_reset_nic(
struct ipw_priv *priv)
3386 unsigned long flags;
3390 rc = ipw_init_nic(priv);
3398 spin_unlock_irqrestore(&priv->
lock, flags);
3413 static int ipw_get_fw(
struct ipw_priv *priv,
3422 IPW_ERROR(
"%s request_firmware failed: Reason %d\n", name, rc);
3426 if ((*raw)->size <
sizeof(*fw)) {
3427 IPW_ERROR(
"%s is too small (%zd)\n", name, (*raw)->size);
3431 fw = (
void *)(*raw)->
data;
3435 IPW_ERROR(
"%s is too small or corrupt (%zd)\n",
3436 name, (*raw)->size);
3444 (*raw)->size -
sizeof(*fw));
3448 #define IPW_RX_BUF_SIZE (3000)
3450 static void ipw_rx_queue_reset(
struct ipw_priv *priv,
3453 unsigned long flags;
3458 INIT_LIST_HEAD(&rxq->
rx_free);
3459 INIT_LIST_HEAD(&rxq->
rx_used);
3466 pci_unmap_single(priv->
pci_dev, rxq->
pool[i].dma_addr,
3468 dev_kfree_skb(rxq->
pool[i].skb);
3478 spin_unlock_irqrestore(&rxq->
lock, flags);
3482 static int fw_loaded = 0;
3494 #define free_firmware() do {} while (0)
3497 static int ipw_load(
struct ipw_priv *priv)
3507 switch (priv->
ieee->iw_mode) {
3509 name =
"ipw2200-ibss.fw";
3511 #ifdef CONFIG_IPW2200_MONITOR
3513 name =
"ipw2200-sniffer.fw";
3517 name =
"ipw2200-bss.fw";
3529 rc = ipw_get_fw(priv, &raw, name);
3536 fw = (
void *)raw->
data;
3537 boot_img = &fw->
data[0];
3546 priv->
rxq = ipw_rx_queue_alloc(priv);
3548 ipw_rx_queue_reset(priv, priv->
rxq);
3550 IPW_ERROR(
"Unable to initialize Rx queue\n");
3564 rc = ipw_reset_nic(priv);
3576 IPW_ERROR(
"Unable to load boot firmware: %d\n", rc);
3581 ipw_start_nic(priv);
3585 IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500);
3587 IPW_ERROR(
"device failed to boot initial fw image\n");
3598 IPW_ERROR(
"Unable to load ucode: %d\n", rc);
3608 IPW_ERROR(
"Unable to load firmware: %d\n", rc);
3617 rc = ipw_queue_reset(priv);
3619 IPW_ERROR(
"Unable to initialize queues\n");
3629 ipw_start_nic(priv);
3638 IPW_ERROR(
"TODO: Handle parity error -- schedule restart?\n");
3645 IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500);
3647 IPW_ERROR(
"device failed to start within 500ms\n");
3657 ipw_read_eeprom(priv);
3659 ipw_eeprom_init_sram(priv);
3662 ipw_enable_interrupts(priv);
3665 ipw_rx_queue_replenish(priv);
3679 ipw_rx_queue_free(priv, priv->
rxq);
3682 ipw_tx_queue_free(priv);
3734 static inline int ipw_tx_queue_space(
const struct clx2_queue *q)
3745 static inline int ipw_queue_inc_wrap(
int index,
int n_bd)
3747 return (++index == n_bd) ? 0 :
index;
3786 _ipw_read32(priv, 0x90);
3789 static int ipw_queue_tx_init(
struct ipw_priv *priv,
3797 IPW_ERROR(
"vmalloc for auxiliary BD structures failed\n");
3804 IPW_ERROR(
"pci_alloc_consistent(%zd) failed\n",
3805 sizeof(q->
bd[0]) * count);
3811 ipw_queue_init(priv, &q->
q, count, read, write, base, size);
3822 static void ipw_queue_tx_free_tfd(
struct ipw_priv *priv,
3847 if (txq->
txb[txq->
q.last_used]) {
3874 ipw_queue_tx_free_tfd(priv, txq);
3883 memset(txq, 0,
sizeof(*txq));
3891 static void ipw_tx_queue_free(
struct ipw_priv *priv)
3894 ipw_queue_tx_free(priv, &priv->
txq_cmd);
3897 ipw_queue_tx_free(priv, &priv->
txq[0]);
3898 ipw_queue_tx_free(priv, &priv->
txq[1]);
3899 ipw_queue_tx_free(priv, &priv->
txq[2]);
3900 ipw_queue_tx_free(priv, &priv->
txq[3]);
3940 entry.support_mode = 0;
3950 static u8 ipw_find_station(
struct ipw_priv *priv,
u8 * bssid)
3961 static void ipw_send_disassociate(
struct ipw_priv *priv,
int quiet)
3998 static int ipw_disassociate(
void *data)
4003 ipw_send_disassociate(data, 0);
4013 ipw_disassociate(priv);
4022 #ifdef CONFIG_IPW2200_PROMISCUOUS
4023 if (priv->prom_net_dev && netif_running(priv->prom_net_dev)) {
4025 priv->
sys_config.accept_non_directed_frames = 1;
4031 ipw_send_system_config(priv);
4040 {0x00,
"Successful"},
4041 {0x01,
"Unspecified failure"},
4042 {0x0A,
"Cannot support all requested capabilities in the "
4043 "Capability information field"},
4044 {0x0B,
"Reassociation denied due to inability to confirm that "
4045 "association exists"},
4046 {0x0C,
"Association denied due to reason outside the scope of this "
4049 "Responding station does not support the specified authentication "
4052 "Received an Authentication frame with authentication sequence "
4053 "transaction sequence number out of expected sequence"},
4054 {0x0F,
"Authentication rejected because of challenge failure"},
4055 {0x10,
"Authentication rejected due to timeout waiting for next "
4056 "frame in sequence"},
4057 {0x11,
"Association denied because AP is unable to handle additional "
4058 "associated stations"},
4060 "Association denied due to requesting station not supporting all "
4061 "of the datarates in the BSSBasicServiceSet Parameter"},
4063 "Association denied due to requesting station not supporting "
4064 "short preamble operation"},
4066 "Association denied due to requesting station not supporting "
4069 "Association denied due to requesting station not supporting "
4072 "Association denied due to requesting station not supporting "
4073 "short slot operation"},
4075 "Association denied due to requesting station not supporting "
4076 "DSSS-OFDM operation"},
4077 {0x28,
"Invalid Information Element"},
4078 {0x29,
"Group Cipher is not valid"},
4079 {0x2A,
"Pairwise Cipher is not valid"},
4080 {0x2B,
"AKMP is not valid"},
4081 {0x2C,
"Unsupported RSN IE version"},
4082 {0x2D,
"Invalid RSN IE Capabilities"},
4083 {0x2E,
"Cipher suite is rejected per security policy"},
4086 static const char *ipw_get_status_code(
u16 status)
4089 for (i = 0; i <
ARRAY_SIZE(ipw_status_codes); i++)
4090 if (ipw_status_codes[i].status == (status & 0xff))
4091 return ipw_status_codes[i].
reason;
4092 return "Unknown status value.";
4095 static void inline average_init(
struct average *
avg)
4097 memset(avg, 0,
sizeof(*avg));
4100 #define DEPTH_RSSI 8
4101 #define DEPTH_NOISE 16
4104 return ((depth-1)*prev_avg + val)/
depth;
4107 static void average_add(
struct average *avg,
s16 val)
4118 static s16 average_value(
struct average *avg)
4122 return avg->
sum / avg->
pos;
4129 static void ipw_reset_stats(
struct ipw_priv *priv)
4160 static u32 ipw_get_max_rate(
struct ipw_priv *priv)
4172 while (i && !(mask & i))
4207 static u32 ipw_get_current_rate(
struct ipw_priv *priv)
4223 return ipw_get_max_rate(priv);
4255 #define IPW_STATS_INTERVAL (2 * HZ)
4256 static void ipw_gather_stats(
struct ipw_priv *priv)
4258 u32 rx_err, rx_err_delta, rx_packets_delta;
4259 u32 tx_failures, tx_failures_delta, tx_packets_delta;
4260 u32 missed_beacons_percent, missed_beacons_delta;
4264 u32 beacon_quality, signal_quality, tx_quality, rx_quality,
4279 missed_beacons_percent = missed_beacons_delta *
4283 missed_beacons_percent = 0;
4312 #define BEACON_THRESHOLD 5
4313 beacon_quality = 100 - missed_beacons_percent;
4320 beacon_quality, missed_beacons_percent);
4322 priv->
last_rate = ipw_get_current_rate(priv);
4323 max_rate = ipw_get_max_rate(priv);
4324 rate_quality = priv->
last_rate * 40 / max_rate + 60;
4326 rate_quality, priv->
last_rate / 1000000);
4328 if (rx_packets_delta > 100 && rx_packets_delta + rx_err_delta)
4329 rx_quality = 100 - (rx_err_delta * 100) /
4330 (rx_packets_delta + rx_err_delta);
4334 rx_quality, rx_err_delta, rx_packets_delta);
4336 if (tx_packets_delta > 100 && tx_packets_delta + tx_failures_delta)
4337 tx_quality = 100 - (tx_failures_delta * 100) /
4338 (tx_packets_delta + tx_failures_delta);
4342 tx_quality, tx_failures_delta, tx_packets_delta);
4347 (priv->
ieee->perfect_rssi - priv->
ieee->worst_rssi) *
4348 (priv->
ieee->perfect_rssi - priv->
ieee->worst_rssi) -
4349 (priv->
ieee->perfect_rssi - rssi) *
4350 (15 * (priv->
ieee->perfect_rssi - priv->
ieee->worst_rssi) +
4351 62 * (priv->
ieee->perfect_rssi - rssi))) /
4352 ((priv->
ieee->perfect_rssi - priv->
ieee->worst_rssi) *
4353 (priv->
ieee->perfect_rssi - priv->
ieee->worst_rssi));
4354 if (signal_quality > 100)
4355 signal_quality = 100;
4356 else if (signal_quality < 1)
4360 signal_quality, rssi);
4362 quality =
min(rx_quality, signal_quality);
4363 quality =
min(tx_quality, quality);
4364 quality =
min(rate_quality, quality);
4365 quality =
min(beacon_quality, quality);
4366 if (quality == beacon_quality)
4369 if (quality == rate_quality)
4372 if (quality == tx_quality)
4375 if (quality == rx_quality)
4378 if (quality == signal_quality)
4387 static void ipw_bg_gather_stats(
struct work_struct *work)
4392 ipw_gather_stats(priv);
4401 static void ipw_handle_missed_beacon(
struct ipw_priv *priv,
4413 "Missed beacon: %d - disassociate\n", missed_count);
4418 "Aborting scan with missed beacon.\n");
4430 "Missed beacon: %d - roam in progress\n",
4443 "Missed beacon: %d - initiate "
4444 "roaming\n", missed_count);
4460 "Aborting scan with missed beacon.\n");
4467 static void ipw_scan_event(
struct work_struct *work)
4474 wrqu.data.length = 0;
4475 wrqu.data.flags = 0;
4479 static void handle_scan_event(
struct ipw_priv *priv)
4492 wrqu.data.length = 0;
4493 wrqu.data.flags = 0;
4514 switch (assoc->
state) {
4518 "associated: '%s' %pM\n",
4523 switch (priv->
ieee->iw_mode) {
4537 (
"queueing adhoc check\n");
4550 #ifdef CONFIG_IPW2200_QOS
4551 #define IPW_GET_PACKET_STYPE(x) WLAN_FC_GET_STYPE( \
4552 le16_to_cpu(((struct ieee80211_hdr *)(x))->frame_control))
4554 (IPW_GET_PACKET_STYPE(¬if->
u.
raw)
4560 && (size <= 2314)) {
4575 ¬if->
u.
raw, &stats);
4594 "deauthenticated: '%s' "
4596 ": (0x%04X) - %s\n",
4619 "authenticated: '%s' %pM\n",
4638 "association failed (0x%04X): %s\n",
4647 "disassociated: '%s' %pM\n",
4660 ipw_remove_current_network
4682 switch (auth->
state) {
4685 "authenticated: '%s' %pM\n",
4696 "authentication failed (0x%04X): %s\n",
4704 "deauthenticated: '%s' %pM\n",
4773 if (size ==
sizeof(*x)) {
4778 "(should be %zd)\n",
4786 if (size ==
sizeof(*x)) {
4788 (
"Scan completed: type %d, %d channels, "
4792 IPW_ERROR(
"Scan completed of wrong size %d "
4793 "(should be %zd)\n",
4806 priv->
ieee->scans++;
4808 #ifdef CONFIG_IPW2200_MONITOR
4853 handle_scan_event(priv);
4860 if (size ==
sizeof(*x))
4864 IPW_ERROR(
"Frag length of wrong size %d "
4865 "(should be %zd)\n",
4874 if (size ==
sizeof(*x)) {
4876 "link deterioration: type %d, cnt %d\n",
4882 IPW_ERROR(
"Link Deterioration of wrong size %d "
4883 "(should be %zd)\n",
4893 IPW_ERROR(
"Unexpected DINO_CONFIG_RESPONSE\n");
4900 if (size !=
sizeof(*x)) {
4902 (
"Beacon state of wrong size %d (should "
4903 "be %zd)\n", size,
sizeof(*x));
4909 ipw_handle_missed_beacon(priv,
4918 if (size ==
sizeof(*x)) {
4919 IPW_ERROR(
"TGi Tx Key: state 0x%02x sec type "
4920 "0x%02x station %d\n",
4927 (
"TGi Tx Key of wrong size %d (should be %zd)\n",
4935 if (size ==
sizeof(*x)) {
4942 (
"Calibration of wrong size %d (should be %zd)\n",
4948 if (size ==
sizeof(
u32)) {
4957 (
"Noise stat is wrong size %d (should be %zd)\n",
4964 "subtype=%d,flags=0x%2x,size=%d\n",
4975 static int ipw_queue_reset(
struct ipw_priv *priv)
4979 int nTx = 64, nTxCmd = 8;
4980 ipw_tx_queue_free(priv);
4982 rc = ipw_queue_tx_init(priv, &priv->
txq_cmd, nTxCmd,
4988 IPW_ERROR(
"Tx Cmd queue init failed\n");
4992 rc = ipw_queue_tx_init(priv, &priv->
txq[0], nTx,
5000 rc = ipw_queue_tx_init(priv, &priv->
txq[1], nTx,
5008 rc = ipw_queue_tx_init(priv, &priv->
txq[2], nTx,
5016 rc = ipw_queue_tx_init(priv, &priv->
txq[3], nTx,
5030 ipw_tx_queue_free(priv);
5047 static int ipw_queue_tx_reclaim(
struct ipw_priv *priv,
5055 if (hw_tail >= q->
n_bd) {
5057 (
"Read index for DMA queue (%d) is out of range [0-%d)\n",
5063 ipw_queue_tx_free_tfd(priv, txq);
5067 if ((ipw_tx_queue_space(q) > q->
low_mark) &&
5069 netif_wake_queue(priv->
net_dev);
5077 static int ipw_queue_tx_hcmd(
struct ipw_priv *priv,
int hcmd,
void *buf,
5084 if (ipw_tx_queue_space(q) < (sync ? 1 : 2)) {
5092 memset(tfd, 0,
sizeof(*tfd));
5096 tfd->
u.
cmd.index = hcmd;
5097 tfd->
u.
cmd.length = len;
5101 _ipw_read32(priv, 0x90);
5179 static void ipw_rx_queue_restock(
struct ipw_priv *priv)
5184 unsigned long flags;
5189 while ((ipw_rx_queue_space(rxq) > 0) && (rxq->
free_count)) {
5200 spin_unlock_irqrestore(&rxq->
lock, flags);
5208 if (write != rxq->
write)
5218 static void ipw_rx_queue_replenish(
void *data)
5224 unsigned long flags;
5227 while (!list_empty(&rxq->
rx_used)) {
5242 pci_map_single(priv->
pci_dev, rxb->
skb->data,
5248 spin_unlock_irqrestore(&rxq->
lock, flags);
5250 ipw_rx_queue_restock(priv);
5253 static void ipw_bg_rx_queue_replenish(
struct work_struct *work)
5258 ipw_rx_queue_replenish(priv);
5276 pci_unmap_single(priv->
pci_dev, rxq->
pool[i].dma_addr,
5278 dev_kfree_skb(rxq->
pool[i].skb);
5292 IPW_ERROR(
"memory allocation failed\n");
5296 INIT_LIST_HEAD(&rxq->
rx_free);
5297 INIT_LIST_HEAD(&rxq->
rx_used);
5311 static int ipw_is_rate_in_mask(
struct ipw_priv *priv,
int ieee_mode,
u8 rate)
5314 if (ieee_mode ==
IEEE_A) {
5384 static int ipw_compatible_rates(
struct ipw_priv *priv,
5390 memset(rates, 0,
sizeof(*rates));
5393 for (i = 0; i < num_rates; i++) {
5394 if (!ipw_is_rate_in_mask(priv, network->
mode,
5395 network->
rates[i])) {
5416 for (i = 0; i < num_rates; i++) {
5417 if (!ipw_is_rate_in_mask(priv, network->
mode,
5453 u8 modulation,
u32 rate_mask)
5476 u8 modulation,
u32 rate_mask)
5519 static int ipw_find_adhoc_network(
struct ipw_priv *priv,
5532 "capability mismatch.\n",
5546 "because of non-network ESSID.\n",
5566 "because of ESSID mismatch: '%s'.\n",
5567 escaped, network->
bssid,
5579 "current network.\n",
5585 "current network.\n",
5592 if (priv->
ieee->scan_age != 0 &&
5595 "because of age: %ums.\n",
5607 "because of channel mismatch: %d != %d.\n",
5619 "because of privacy mismatch: %s != %s.\n",
5633 "because of the same BSSID match: %pM"
5642 if (!libipw_is_valid_mode(priv->
ieee, network->
mode)) {
5644 "because of invalid frequency/mode "
5654 if (!ipw_compatible_rates(priv, network, &rates)) {
5656 "because configured rate mask excludes "
5657 "AP mandatory rate.\n",
5666 "because of no compatible rates.\n",
5678 ipw_copy_rates(&match->
rates, &rates);
5687 static void ipw_merge_adhoc_network(
struct work_struct *work)
5701 unsigned long flags;
5706 ipw_find_adhoc_network(priv, &match, network,
5709 spin_unlock_irqrestore(&priv->
ieee->lock, flags);
5722 ipw_remove_current_network(priv);
5725 ipw_disassociate(priv);
5732 static int ipw_best_network(
struct ipw_priv *priv,
5746 "capability mismatch.\n",
5760 "because of non-network ESSID.\n",
5779 "because of ESSID mismatch: '%s'.\n",
5780 escaped, network->
bssid,
5795 "'%s (%pM)' has a stronger signal.\n",
5796 escaped, network->
bssid,
5808 "because of storming (%ums since last "
5809 "assoc attempt).\n",
5819 if (priv->
ieee->scan_age != 0 &&
5822 "because of age: %ums.\n",
5834 "because of channel mismatch: %d != %d.\n",
5846 "because of privacy mismatch: %s != %s.\n",
5860 "because of BSSID mismatch: %pM.\n",
5868 if (!libipw_is_valid_mode(priv->
ieee, network->
mode)) {
5870 "because of invalid frequency/mode "
5881 "because of invalid channel in current GEO\n",
5890 if (!ipw_compatible_rates(priv, network, &rates)) {
5892 "because configured rate mask excludes "
5893 "AP mandatory rate.\n",
5902 "because of no compatible rates.\n",
5914 ipw_copy_rates(&match->
rates, &rates);
5924 static void ipw_adhoc_create(
struct ipw_priv *priv,
5960 if (geo->
bg[i].flags & LIBIPW_CH_PASSIVE_ONLY) {
5983 ipw_create_bssid(priv, network->
bssid);
6010 static void ipw_send_tgi_tx_key(
struct ipw_priv *priv,
int type,
int index)
6014 if (!(priv->
ieee->sec.flags & (1 << index)))
6020 key.station_index = 0;
6029 static void ipw_send_wep_keys(
struct ipw_priv *priv,
int type)
6039 for (i = 0; i < 4; i++) {
6041 if (!(priv->
ieee->sec.flags & (1 << i))) {
6046 key.key_size = priv->
ieee->sec.key_sizes[
i];
6053 static void ipw_set_hw_decrypt_unicast(
struct ipw_priv *priv,
int level)
6055 if (priv->
ieee->host_encrypt)
6060 priv->
sys_config.disable_unicast_decryption = 0;
6061 priv->
ieee->host_decrypt = 0;
6064 priv->
sys_config.disable_unicast_decryption = 1;
6065 priv->
ieee->host_decrypt = 1;
6068 priv->
sys_config.disable_unicast_decryption = 0;
6069 priv->
ieee->host_decrypt = 0;
6072 priv->
sys_config.disable_unicast_decryption = 1;
6079 static void ipw_set_hw_decrypt_multicast(
struct ipw_priv *priv,
int level)
6081 if (priv->
ieee->host_encrypt)
6086 priv->
sys_config.disable_multicast_decryption = 0;
6089 priv->
sys_config.disable_multicast_decryption = 1;
6092 priv->
sys_config.disable_multicast_decryption = 0;
6095 priv->
sys_config.disable_multicast_decryption = 1;
6102 static void ipw_set_hwcrypto_keys(
struct ipw_priv *priv)
6104 switch (priv->
ieee->sec.level) {
6107 ipw_send_tgi_tx_key(priv,
6109 priv->
ieee->sec.active_key);
6111 if (!priv->
ieee->host_mc_decrypt)
6116 ipw_send_tgi_tx_key(priv,
6118 priv->
ieee->sec.active_key);
6122 ipw_set_hw_decrypt_unicast(priv, priv->
ieee->sec.level);
6123 ipw_set_hw_decrypt_multicast(priv, priv->
ieee->sec.level);
6131 static void ipw_adhoc_check(
void *data)
6139 "Missed beacon: %d - disassociate\n",
6141 ipw_remove_current_network(priv);
6142 ipw_disassociate(priv);
6150 static void ipw_bg_adhoc_check(
struct work_struct *work)
6155 ipw_adhoc_check(priv);
6159 static void ipw_debug_config(
struct ipw_priv *priv)
6163 "[CFG 0x%08X]\n", priv->
config);
6184 static void ipw_set_fixed_rate(
struct ipw_priv *priv,
int mode)
6195 switch (priv->
ieee->freq_band) {
6201 (
"invalid fixed rate mask in ipw_set_fixed_rate\n");
6215 (
"invalid fixed rate mask in ipw_set_fixed_rate\n");
6226 (
"invalid fixed rate mask in ipw_set_fixed_rate\n");
6231 if (LIBIPW_OFDM_RATE_6MB_MASK & new_tx_rates) {
6232 mask |= (LIBIPW_OFDM_RATE_6MB_MASK >> 1);
6233 new_tx_rates &= ~LIBIPW_OFDM_RATE_6MB_MASK;
6236 if (LIBIPW_OFDM_RATE_9MB_MASK & new_tx_rates) {
6237 mask |= (LIBIPW_OFDM_RATE_9MB_MASK >> 1);
6238 new_tx_rates &= ~LIBIPW_OFDM_RATE_9MB_MASK;
6241 if (LIBIPW_OFDM_RATE_12MB_MASK & new_tx_rates) {
6242 mask |= (LIBIPW_OFDM_RATE_12MB_MASK >> 1);
6243 new_tx_rates &= ~LIBIPW_OFDM_RATE_12MB_MASK;
6246 new_tx_rates |=
mask;
6253 ipw_write_reg32(priv, reg, *(
u32 *) & fr);
6256 static void ipw_abort_scan(
struct ipw_priv *priv)
6261 IPW_DEBUG_HC(
"Ignoring concurrent scan abort request.\n");
6266 err = ipw_send_scan_abort(priv);
6271 static void ipw_add_scan_channels(
struct ipw_priv *priv,
6275 int channel_index = 0;
6282 int start = channel_index;
6285 geo->
a[i].channel == priv->
channel)
6289 ipw_set_scan_type(scan, channel_index,
6291 flags & LIBIPW_CH_PASSIVE_ONLY ?
6296 if (start != channel_index) {
6298 (channel_index -
start);
6304 int start = channel_index;
6331 if (channels[channel - 1] != 0)
6334 channels[channel - 1] = 1;
6340 ipw_set_scan_type(scan, channel_index,
6343 LIBIPW_CH_PASSIVE_ONLY ?
6355 ipw_set_scan_type(scan, channel_index,
6358 LIBIPW_CH_PASSIVE_ONLY ?
6364 if (start != channel_index) {
6366 (channel_index -
start);
6371 static int ipw_passive_dwell_time(
struct ipw_priv *priv)
6385 static int ipw_request_scan_helper(
struct ipw_priv *priv,
int type,
int direct)
6397 IPW_DEBUG_HC(
"Direct scan requested but no SSID to scan for\n");
6411 IPW_DEBUG_HC(
"Scan request while abort pending. Queuing.\n");
6418 IPW_DEBUG_HC(
"Queuing scan due to RF Kill activation\n");
6424 memset(&scan, 0,
sizeof(scan));
6432 ipw_add_scan_channels(priv, &scan, scan_type);
6451 #ifdef CONFIG_IPW2200_MONITOR
6517 ipw_add_scan_channels(priv, &scan, scan_type);
6518 #ifdef CONFIG_IPW2200_MONITOR
6523 err = ipw_send_scan_request_ext(priv, &scan);
6525 IPW_DEBUG_HC(
"Sending scan command failed: %08X\n", err);
6542 static void ipw_request_passive_scan(
struct work_struct *work)
6549 static void ipw_request_scan(
struct work_struct *work)
6556 static void ipw_request_direct_scan(
struct work_struct *work)
6563 static void ipw_bg_abort_scan(
struct work_struct *work)
6568 ipw_abort_scan(priv);
6572 static int ipw_wpa_enable(
struct ipw_priv *priv,
int value)
6580 static int ipw_wpa_set_auth_algs(
struct ipw_priv *priv,
int value)
6608 static void ipw_wpa_assoc_frame(
struct ipw_priv *priv,
char *wpa_ie,
6612 ipw_wpa_enable(priv, 1);
6615 static int ipw_set_rsn_capa(
struct ipw_priv *priv,
6629 static int ipw_wx_set_genie(
struct net_device *dev,
6633 struct ipw_priv *priv = libipw_priv(dev);
6639 (wrqu->
data.length && extra ==
NULL))
6642 if (wrqu->
data.length) {
6664 static int ipw_wx_get_genie(
struct net_device *dev,
6668 struct ipw_priv *priv = libipw_priv(dev);
6673 wrqu->
data.length = 0;
6689 static int wext_cipher2level(
int cipher)
6707 static int ipw_wx_set_auth(
struct net_device *dev,
6711 struct ipw_priv *priv = libipw_priv(dev);
6715 unsigned long flags;
6722 ipw_set_hw_decrypt_unicast(priv,
6723 wext_cipher2level(param->
value));
6726 ipw_set_hw_decrypt_multicast(priv,
6727 wext_cipher2level(param->
value));
6736 crypt = priv->
ieee->crypt_info.crypt[priv->
ieee->crypt_info.tx_keyidx];
6737 if (!crypt || !crypt->
ops->set_flags || !crypt->
ops->get_flags)
6740 flags = crypt->
ops->get_flags(crypt->
priv);
6747 crypt->
ops->set_flags(flags, crypt->
priv);
6765 .enabled = param->
value,
6767 priv->
ieee->drop_unencrypted = param->
value;
6771 if (!param->
value) {
6778 if (priv->
ieee->set_security)
6779 priv->
ieee->set_security(priv->
ieee->dev, &sec);
6784 ret = ipw_wpa_set_auth_algs(priv, param->
value);
6788 ret = ipw_wpa_enable(priv, param->
value);
6789 ipw_disassociate(priv);
6807 static int ipw_wx_get_auth(
struct net_device *dev,
6811 struct ipw_priv *priv = libipw_priv(dev);
6829 crypt = priv->
ieee->crypt_info.crypt[priv->
ieee->crypt_info.tx_keyidx];
6830 if (!crypt || !crypt->
ops->get_flags)
6843 param->
value = ieee->
sec.auth_mode;
6866 static int ipw_wx_set_encodeext(
struct net_device *dev,
6870 struct ipw_priv *priv = libipw_priv(dev);
6878 priv->
ieee->host_mc_decrypt = 1;
6880 priv->
ieee->host_encrypt = 0;
6881 priv->
ieee->host_encrypt_msdu = 1;
6882 priv->
ieee->host_decrypt = 1;
6885 priv->
ieee->host_encrypt = 0;
6886 priv->
ieee->host_encrypt_msdu = 0;
6887 priv->
ieee->host_decrypt = 0;
6888 priv->
ieee->host_mc_decrypt = 0;
6896 static int ipw_wx_get_encodeext(
struct net_device *dev,
6900 struct ipw_priv *priv = libipw_priv(dev);
6905 static int ipw_wx_set_mlme(
struct net_device *dev,
6909 struct ipw_priv *priv = libipw_priv(dev);
6915 switch (mlme->
cmd) {
6921 ipw_disassociate(priv);
6930 #ifdef CONFIG_IPW2200_QOS
6937 static u8 ipw_qos_current_mode(
struct ipw_priv * priv)
6942 unsigned long flags;
6946 spin_unlock_irqrestore(&priv->
ieee->lock, flags);
6948 mode = priv->
ieee->mode;
6957 static int ipw_qos_handle_probe_response(
struct ipw_priv *priv,
6967 if (active_network &&
6971 if ((network->
qos_data.active == 1) && (active_network == 1) &&
6973 (network->
qos_data.old_param_count !=
6975 network->
qos_data.old_param_count =
6984 &def_parameters_CCK, size);
6987 &def_parameters_OFDM, size);
6989 if ((network->
qos_data.active == 1) && (active_network == 1)) {
7017 static int ipw_qos_activate(
struct ipw_priv *priv,
7028 type = ipw_qos_current_mode(priv);
7035 if (qos_network_data ==
NULL) {
7038 active_one = &def_parameters_CCK;
7040 active_one = &def_parameters_OFDM;
7043 burst_duration = ipw_qos_get_burst_duration(priv);
7051 if (priv->
qos_data.qos_enable == 0)
7052 active_one = &def_parameters_CCK;
7054 active_one = priv->
qos_data.def_qos_parm_CCK;
7056 if (priv->
qos_data.qos_enable == 0)
7057 active_one = &def_parameters_OFDM;
7059 active_one = priv->
qos_data.def_qos_parm_OFDM;
7063 unsigned long flags;
7067 active_one = &(qos_network_data->
parameters);
7072 spin_unlock_irqrestore(&priv->
ieee->lock, flags);
7075 burst_duration = ipw_qos_get_burst_duration(priv);
7083 err = ipw_send_qos_params_command(priv, &qos_parameters[0]);
7093 static int ipw_qos_set_info_element(
struct ipw_priv *priv)
7111 ret = ipw_send_qos_info_command(priv, &
qos_info);
7113 IPW_DEBUG_QOS(
"QoS error calling ipw_send_qos_info_command\n");
7121 static int ipw_qos_association(
struct ipw_priv *priv,
7131 switch (priv->
ieee->iw_mode) {
7135 qos_data = &ibss_data;
7147 err = ipw_qos_activate(priv, qos_data);
7154 IPW_DEBUG_QOS(
"QoS will be enabled for this association\n");
7156 return ipw_qos_set_info_element(priv);
7167 static int ipw_qos_association_resp(
struct ipw_priv *priv,
7171 unsigned long flags;
7173 int set_qos_param = 0;
7175 if ((priv ==
NULL) || (network ==
NULL) ||
7190 if ((network->
qos_data.old_param_count !=
7193 network->
qos_data.old_param_count =
7200 &def_parameters_CCK, size);
7203 &def_parameters_OFDM, size);
7209 spin_unlock_irqrestore(&priv->
ieee->lock, flags);
7211 if (set_qos_param == 1)
7217 static u32 ipw_qos_get_burst_duration(
struct ipw_priv *priv)
7225 ret = priv->
qos_data.burst_duration_CCK;
7227 ret = priv->
qos_data.burst_duration_OFDM;
7236 int burst_enable,
u32 burst_duration_CCK,
7237 u32 burst_duration_OFDM)
7242 priv->
qos_data.def_qos_parm_CCK = &def_qos_parameters_CCK;
7243 priv->
qos_data.def_qos_parm_OFDM = &def_qos_parameters_OFDM;
7246 priv->
qos_data.def_qos_parm_CCK = &def_parameters_CCK;
7247 priv->
qos_data.def_qos_parm_OFDM = &def_parameters_OFDM;
7251 priv->
qos_data.burst_enable = burst_enable;
7254 priv->
qos_data.burst_duration_CCK = burst_duration_CCK;
7255 priv->
qos_data.burst_duration_OFDM = burst_duration_OFDM;
7257 priv->
qos_data.burst_duration_CCK = 0;
7258 priv->
qos_data.burst_duration_OFDM = 0;
7267 if (priority > 7 || !priv->
qos_data.qos_enable)
7270 return from_priority_to_tx_queue[
priority] - 1;
7273 static int ipw_is_qos_active(
struct net_device *dev,
7276 struct ipw_priv *priv = libipw_priv(dev);
7280 int unicast = !is_multicast_ether_addr(daddr);
7293 active = qos_data->
active;
7295 IPW_DEBUG_QOS(
"QoS %d network is QoS active %d supported %d "
7297 priv->
qos_data.qos_enable, active, supported, unicast);
7298 if (active && priv->
qos_data.qos_enable)
7307 static int ipw_qos_set_tx_queue_command(
struct ipw_priv *priv,
7311 int tx_queue_id = 0;
7314 tx_queue_id = from_priority_to_tx_queue[
priority] - 1;
7317 if (priv->
qos_data.qos_no_ack_mask & (1UL << tx_queue_id)) {
7327 static void ipw_bg_qos_activate(
struct work_struct *work)
7340 static int ipw_handle_probe_response(
struct net_device *dev,
7344 struct ipw_priv *priv = libipw_priv(dev);
7348 ipw_qos_handle_probe_response(priv, active_network, network);
7353 static int ipw_handle_beacon(
struct net_device *dev,
7357 struct ipw_priv *priv = libipw_priv(dev);
7361 ipw_qos_handle_probe_response(priv, active_network, network);
7366 static int ipw_handle_assoc_response(
struct net_device *dev,
7370 struct ipw_priv *priv = libipw_priv(dev);
7371 ipw_qos_association_resp(priv, network);
7379 sizeof(*qos_param) * 3, qos_param);
7391 static int ipw_associate_network(
struct ipw_priv *priv,
7399 ipw_set_fixed_rate(priv, network->
mode);
7427 if (priv->
ieee->wpa_ie_len) {
7429 ipw_set_rsn_capa(priv, priv->
ieee->wpa_ie,
7430 priv->
ieee->wpa_ie_len);
7463 "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n",
7464 roaming ?
"Rea" :
"A",
7479 '1' + priv->
ieee->sec.active_key :
'.',
7511 IPW_DEBUG_HC(
"Attempt to send SSID command failed.\n");
7517 ipw_send_supported_rates(priv, rates);
7525 priv->
sys_config.answer_broadcast_ssid_probe = 1;
7527 priv->
sys_config.answer_broadcast_ssid_probe = 0;
7529 err = ipw_send_system_config(priv);
7531 IPW_DEBUG_HC(
"Attempt to send sys config command failed.\n");
7538 IPW_DEBUG_HC(
"Attempt to send associate command failed.\n");
7554 #ifdef CONFIG_IPW2200_QOS
7555 ipw_qos_association(priv, network);
7560 IPW_DEBUG_HC(
"Attempt to send associate command failed.\n");
7571 static void ipw_roam(
void *data)
7605 unsigned long flags;
7611 ipw_best_network(priv, &match, network, 1);
7613 spin_unlock_irqrestore(&priv->
ieee->lock, flags);
7620 ipw_debug_config(priv);
7624 ipw_send_disassociate(priv, 1);
7655 unsigned long flags;
7671 "disassociating)\n ");
7691 ipw_best_network(priv, &match, network, 0);
7693 network = match.network;
7694 rates = &match.rates;
7702 if (list_empty(&priv->ieee->network_free_list)) {
7707 if ((oldest ==
NULL) ||
7721 &priv->ieee->network_free_list);
7724 element = priv->ieee->network_free_list.
next;
7726 ipw_adhoc_create(priv, network);
7727 rates = &priv->rates;
7731 spin_unlock_irqrestore(&priv->ieee->lock, flags);
7736 ipw_debug_config(priv);
7749 ipw_associate_network(priv, network, rates, 0);
7754 static void ipw_bg_associate(
struct work_struct *work)
7763 static void ipw_rebuild_decrypted_skb(
struct ipw_priv *priv,
7774 fc &= ~IEEE80211_FCTL_PROTECTED;
7776 switch (priv->
ieee->sec.level) {
7797 priv->
ieee->sec.level);
7802 static void ipw_handle_data_packet(
struct ipw_priv *priv,
7816 skb_tailroom(rxb->
skb))) {
7817 dev->
stats.rx_errors++;
7818 priv->
wstats.discard.misc++;
7822 dev->
stats.rx_dropped++;
7823 priv->
wstats.discard.misc++;
7839 (is_multicast_ether_addr(hdr->
addr1) ?
7840 !priv->
ieee->host_mc_decrypt : !priv->
ieee->host_decrypt))
7841 ipw_rebuild_decrypted_skb(priv, rxb->
skb);
7844 dev->
stats.rx_errors++;
7847 __ipw_led_activity_on(priv);
7851 #ifdef CONFIG_IPW2200_RADIOTAP
7852 static void ipw_handle_data_packet_monitor(
struct ipw_priv *priv,
7861 u16 received_channel =
frame->received_channel;
7862 u8 antennaAndPhy =
frame->antennaAndPhy;
7869 struct ipw_rt_hdr *ipw_rt;
7879 skb_tailroom(rxb->
skb))) {
7880 dev->
stats.rx_errors++;
7881 priv->
wstats.discard.misc++;
7885 dev->
stats.rx_dropped++;
7886 priv->
wstats.discard.misc++;
7895 dev->
stats.rx_dropped++;
7896 priv->
wstats.discard.misc++;
7902 memmove(rxb->
skb->data +
sizeof(
struct ipw_rt_hdr),
7905 ipw_rt = (
struct ipw_rt_hdr *)rxb->
skb->data;
7908 ipw_rt->rt_hdr.it_pad = 0;
7909 ipw_rt->rt_hdr.it_len =
cpu_to_le16(
sizeof(
struct ipw_rt_hdr));
7922 ipw_rt->rt_flags = 0;
7923 ipw_rt->rt_tsf = (
u64)(
frame->parent_tsf[3] << 24 |
7924 frame->parent_tsf[2] << 16 |
7925 frame->parent_tsf[1] << 8 |
7926 frame->parent_tsf[0]);
7929 ipw_rt->rt_dbmsignal = antsignal;
7934 if (received_channel > 14) {
7935 ipw_rt->rt_chbitmask =
7937 }
else if (antennaAndPhy & 32) {
7938 ipw_rt->rt_chbitmask =
7941 ipw_rt->rt_chbitmask =
7948 ipw_rt->rt_rate = 2;
7951 ipw_rt->rt_rate = 4;
7954 ipw_rt->rt_rate = 10;
7957 ipw_rt->rt_rate = 12;
7960 ipw_rt->rt_rate = 18;
7963 ipw_rt->rt_rate = 22;
7966 ipw_rt->rt_rate = 24;
7969 ipw_rt->rt_rate = 36;
7972 ipw_rt->rt_rate = 48;
7975 ipw_rt->rt_rate = 72;
7978 ipw_rt->rt_rate = 96;
7981 ipw_rt->rt_rate = 108;
7984 ipw_rt->rt_rate = 0;
7989 ipw_rt->rt_antenna = (antennaAndPhy & 3);
7992 if ((antennaAndPhy & 64))
7996 skb_put(rxb->
skb, len +
sizeof(
struct ipw_rt_hdr));
8001 dev->
stats.rx_errors++;
8009 #ifdef CONFIG_IPW2200_PROMISCUOUS
8010 #define libipw_is_probe_response(fc) \
8011 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT && \
8012 (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP )
8014 #define libipw_is_management(fc) \
8015 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)
8017 #define libipw_is_control(fc) \
8018 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL)
8020 #define libipw_is_data(fc) \
8021 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)
8023 #define libipw_is_assoc_request(fc) \
8024 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ)
8026 #define libipw_is_reassoc_request(fc) \
8027 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_REASSOC_REQ)
8029 static void ipw_handle_promiscuous_rx(
struct ipw_priv *priv,
8036 struct ipw_rt_hdr *ipw_rt;
8041 u16 channel =
frame->received_channel;
8042 u8 phy_flags =
frame->antennaAndPhy;
8052 if (filter & IPW_PROM_NO_RX)
8059 dev->
stats.rx_errors++;
8065 if (
unlikely(!netif_running(dev))) {
8066 dev->
stats.rx_dropped++;
8075 dev->
stats.rx_dropped++;
8081 if (libipw_is_management(
le16_to_cpu(hdr->frame_control))) {
8082 if (filter & IPW_PROM_NO_MGMT)
8084 if (filter & IPW_PROM_MGMT_HEADER_ONLY)
8086 }
else if (libipw_is_control(
le16_to_cpu(hdr->frame_control))) {
8087 if (filter & IPW_PROM_NO_CTL)
8089 if (filter & IPW_PROM_CTL_HEADER_ONLY)
8091 }
else if (libipw_is_data(
le16_to_cpu(hdr->frame_control))) {
8092 if (filter & IPW_PROM_NO_DATA)
8094 if (filter & IPW_PROM_DATA_HEADER_ONLY)
8101 IPW_ERROR(
"skb_clone failed for promiscuous copy.\n");
8106 ipw_rt = (
void *)skb->
data;
8109 len = libipw_get_hdrlen(
le16_to_cpu(hdr->frame_control));
8111 memcpy(ipw_rt->payload, hdr, len);
8114 ipw_rt->rt_hdr.it_pad = 0;
8115 ipw_rt->rt_hdr.it_len =
cpu_to_le16(
sizeof(*ipw_rt));
8118 skb_put(skb,
sizeof(*ipw_rt) + len);
8131 ipw_rt->rt_flags = 0;
8132 ipw_rt->rt_tsf = (
u64)(
frame->parent_tsf[3] << 24 |
8133 frame->parent_tsf[2] << 16 |
8134 frame->parent_tsf[1] << 8 |
8135 frame->parent_tsf[0]);
8138 ipw_rt->rt_dbmsignal = signal;
8139 ipw_rt->rt_dbmnoise = noise;
8144 ipw_rt->rt_chbitmask =
8146 }
else if (phy_flags & (1 << 5)) {
8147 ipw_rt->rt_chbitmask =
8150 ipw_rt->rt_chbitmask =
8157 ipw_rt->rt_rate = 2;
8160 ipw_rt->rt_rate = 4;
8163 ipw_rt->rt_rate = 10;
8166 ipw_rt->rt_rate = 12;
8169 ipw_rt->rt_rate = 18;
8172 ipw_rt->rt_rate = 22;
8175 ipw_rt->rt_rate = 24;
8178 ipw_rt->rt_rate = 36;
8181 ipw_rt->rt_rate = 48;
8184 ipw_rt->rt_rate = 72;
8187 ipw_rt->rt_rate = 96;
8190 ipw_rt->rt_rate = 108;
8193 ipw_rt->rt_rate = 0;
8198 ipw_rt->rt_antenna = (phy_flags & 3);
8201 if (phy_flags & (1 << 6))
8207 dev->
stats.rx_errors++;
8213 static int is_network_packet(
struct ipw_priv *priv,
8218 switch (priv->
ieee->iw_mode) {
8225 if (is_multicast_ether_addr(header->
addr1))
8238 if (is_multicast_ether_addr(header->
addr1))
8249 #define IPW_PACKET_RETRY_TIME HZ
8251 static int is_duplicate_packet(
struct ipw_priv *priv,
8257 u16 *last_seq, *last_frag;
8260 switch (priv->
ieee->iw_mode) {
8278 (
"Cannot malloc new mac entry\n");
8285 list_add(&entry->
list,
8302 if ((*last_seq == seq) &&
8304 if (*last_frag == frag)
8306 if (*last_frag + 1 != frag)
8324 static void ipw_handle_mgmt_packet(
struct ipw_priv *priv,
8341 ipw_add_station(priv, header->
addr2);
8361 skb_reset_mac_header(skb);
8365 memset(skb->cb, 0,
sizeof(rxb->
skb->cb));
8376 static void ipw_rx(
struct ipw_priv *priv)
8387 i = priv->
rxq->read;
8389 if (ipw_rx_queue_space (priv->
rxq) > (RX_QUEUE_SIZE / 2))
8393 rxb = priv->
rxq->queue[
i];
8406 pkt->
header.message_type,
8409 switch (pkt->
header.message_type) {
8419 .rate = pkt->
u.
frame.rate,
8422 pkt->
u.
frame.received_channel,
8425 control & (1 << 0)) ?
8431 if (stats.
rssi != 0)
8435 if (stats.
noise != 0)
8437 if (stats.
rate != 0)
8442 #ifdef CONFIG_IPW2200_PROMISCUOUS
8443 if (priv->prom_net_dev && netif_running(priv->prom_net_dev))
8444 ipw_handle_promiscuous_rx(priv, rxb, &stats);
8447 #ifdef CONFIG_IPW2200_MONITOR
8449 #ifdef CONFIG_IPW2200_RADIOTAP
8451 ipw_handle_data_packet_monitor(priv,
8455 ipw_handle_data_packet(priv, rxb,
8473 is_network_packet(priv, header);
8489 (
"Received packet is too small. "
8491 priv->
net_dev->stats.rx_errors++;
8492 priv->
wstats.discard.misc++;
8500 ipw_handle_mgmt_packet(priv, rxb,
8509 is_duplicate_packet(priv,
8522 ipw_handle_data_packet(priv, rxb,
8532 (
"Notification: subtype=%02X flags=%02X size=%d\n",
8542 pkt->
header.message_type);
8558 i = (i + 1) % RX_QUEUE_SIZE;
8563 priv->
rxq->read =
i;
8564 ipw_rx_queue_replenish(priv);
8569 priv->
rxq->read =
i;
8570 ipw_rx_queue_restock(priv);
8573 #define DEFAULT_RTS_THRESHOLD 2304U
8574 #define MIN_RTS_THRESHOLD 1U
8575 #define MAX_RTS_THRESHOLD 2304U
8576 #define DEFAULT_BEACON_INTERVAL 100U
8577 #define DEFAULT_SHORT_RETRY_LIMIT 7U
8578 #define DEFAULT_LONG_RETRY_LIMIT 4U
8589 int band, modulation;
8590 int old_mode = priv->
ieee->iw_mode;
8619 if (default_channel != 0) {
8621 priv->
channel = default_channel;
8625 #ifdef CONFIG_IPW2200_QOS
8626 ipw_qos_init(priv, qos_enable, qos_burst_enable,
8627 burst_duration_CCK, burst_duration_OFDM);
8630 switch (network_mode) {
8636 #ifdef CONFIG_IPW2200_MONITOR
8639 #ifdef CONFIG_IPW2200_RADIOTAP
8654 priv->
ieee->host_encrypt = 0;
8655 priv->
ieee->host_encrypt_msdu = 0;
8656 priv->
ieee->host_decrypt = 0;
8657 priv->
ieee->host_mc_decrypt = 0;
8659 IPW_DEBUG_INFO(
"Hardware crypto [%s]\n", hwcrypto ?
"on" :
"off");
8662 priv->
ieee->host_open_frag = 0;
8664 if ((priv->
pci_dev->device == 0x4223) ||
8665 (priv->
pci_dev->device == 0x4224)) {
8668 ": Detected Intel PRO/Wireless 2915ABG Network "
8670 priv->
ieee->abg_true = 1;
8679 ": Detected Intel PRO/Wireless 2200BG Network "
8682 priv->
ieee->abg_true = 0;
8690 priv->
ieee->freq_band = band;
8691 priv->
ieee->modulation = modulation;
8706 return old_mode == priv->
ieee->iw_mode;
8719 static int ipw_set_channel(
struct ipw_priv *priv,
u8 channel)
8723 priv->
config &= ~CFG_STATIC_CHANNEL;
8732 if (priv->
channel == channel) {
8741 #ifdef CONFIG_IPW2200_MONITOR
8746 "channel change.\n");
8747 ipw_abort_scan(priv);
8764 IPW_DEBUG_ASSOC(
"[re]association triggered due to channel change.\n");
8765 if (!ipw_disassociate(priv))
8771 static int ipw_wx_set_freq(
struct net_device *dev,
8775 struct ipw_priv *priv = libipw_priv(dev);
8785 ret = ipw_set_channel(priv, 0);
8806 geo->
bg[i].flags : geo->
a[i].flags;
8807 if (flags & LIBIPW_CH_PASSIVE_ONLY) {
8815 ret = ipw_set_channel(priv, channel);
8820 static int ipw_wx_get_freq(
struct net_device *dev,
8824 struct ipw_priv *priv = libipw_priv(dev);
8831 if (priv->
config & CFG_STATIC_CHANNEL ||
8841 wrqu->
freq.m = priv->
ieee->geo.a[
i].freq * 100000;
8845 wrqu->
freq.m = priv->
ieee->geo.bg[
i].freq * 100000;
8859 static int ipw_wx_set_mode(
struct net_device *dev,
8863 struct ipw_priv *priv = libipw_priv(dev);
8868 switch (wrqu->
mode) {
8869 #ifdef CONFIG_IPW2200_MONITOR
8881 if (wrqu->
mode == priv->
ieee->iw_mode)
8886 ipw_sw_reset(priv, 0);
8888 #ifdef CONFIG_IPW2200_MONITOR
8893 #ifdef CONFIG_IPW2200_RADIOTAP
8911 static int ipw_wx_get_mode(
struct net_device *dev,
8915 struct ipw_priv *priv = libipw_priv(dev);
8924 static const s32 timeout_duration[] = {
8932 static const s32 period_duration[] = {
8940 static int ipw_wx_get_range(
struct net_device *dev,
8944 struct ipw_priv *priv = libipw_priv(dev);
8949 wrqu->
data.length =
sizeof(*range);
8950 memset(range, 0,
sizeof(*range));
8970 range->
bitrate[i] = (priv->
rates.supported_rates[i] & 0x7F) *
8990 (geo->
bg[j].flags & LIBIPW_CH_PASSIVE_ONLY))
8993 range->
freq[
i].i = geo->
bg[
j].channel;
8994 range->
freq[
i].m = geo->
bg[
j].freq * 100000;
8995 range->
freq[
i].e = 1;
9003 (geo->
a[j].flags & LIBIPW_CH_PASSIVE_ONLY))
9006 range->
freq[
i].i = geo->
a[
j].channel;
9007 range->
freq[
i].m = geo->
a[
j].freq * 100000;
9008 range->
freq[
i].e = 1;
9034 static int ipw_wx_set_wap(
struct net_device *dev,
9038 struct ipw_priv *priv = libipw_priv(dev);
9043 if (is_broadcast_ether_addr(wrqu->
ap_addr.sa_data) ||
9044 is_zero_ether_addr(wrqu->
ap_addr.sa_data)) {
9069 if (!ipw_disassociate(priv))
9076 static int ipw_wx_get_wap(
struct net_device *dev,
9080 struct ipw_priv *priv = libipw_priv(dev);
9098 static int ipw_wx_set_essid(
struct net_device *dev,
9102 struct ipw_priv *priv = libipw_priv(dev);
9108 if (!wrqu->
essid.flags)
9111 ipw_disassociate(priv);
9137 if (!ipw_disassociate(priv))
9144 static int ipw_wx_get_essid(
struct net_device *dev,
9148 struct ipw_priv *priv = libipw_priv(dev);
9160 wrqu->
essid.flags = 1;
9163 wrqu->
essid.length = 0;
9164 wrqu->
essid.flags = 0;
9170 static int ipw_wx_set_nick(
struct net_device *dev,
9174 struct ipw_priv *priv = libipw_priv(dev);
9180 wrqu->
data.length =
min((
size_t) wrqu->
data.length,
sizeof(priv->
nick));
9189 static int ipw_wx_get_nick(
struct net_device *dev,
9193 struct ipw_priv *priv = libipw_priv(dev);
9198 wrqu->
data.flags = 1;
9203 static int ipw_wx_set_sens(
struct net_device *dev,
9207 struct ipw_priv *priv = libipw_priv(dev);
9211 IPW_DEBUG_WX(
"Setting disassociate threshold to %d\n", 3*wrqu->
sens.value);
9214 if (wrqu->
sens.fixed == 0)
9233 static int ipw_wx_get_sens(
struct net_device *dev,
9237 struct ipw_priv *priv = libipw_priv(dev);
9239 wrqu->
sens.fixed = 1;
9244 wrqu->
power.disabled ?
"OFF" :
"ON", wrqu->
power.value);
9249 static int ipw_wx_set_rate(
struct net_device *dev,
9254 struct ipw_priv *priv = libipw_priv(dev);
9262 if (target_rate == -1) {
9272 if (target_rate == 1000000 || !fixed)
9274 if (target_rate == 1000000)
9277 if (target_rate == 2000000 || !fixed)
9279 if (target_rate == 2000000)
9282 if (target_rate == 5500000 || !fixed)
9284 if (target_rate == 5500000)
9287 if (target_rate == 6000000 || !fixed)
9289 if (target_rate == 6000000)
9292 if (target_rate == 9000000 || !fixed)
9294 if (target_rate == 9000000)
9297 if (target_rate == 11000000 || !fixed)
9299 if (target_rate == 11000000)
9302 if (target_rate == 12000000 || !fixed)
9304 if (target_rate == 12000000)
9307 if (target_rate == 18000000 || !fixed)
9309 if (target_rate == 18000000)
9312 if (target_rate == 24000000 || !fixed)
9314 if (target_rate == 24000000)
9317 if (target_rate == 36000000 || !fixed)
9319 if (target_rate == 36000000)
9322 if (target_rate == 48000000 || !fixed)
9324 if (target_rate == 48000000)
9327 if (target_rate == 54000000 || !fixed)
9329 if (target_rate == 54000000)
9332 IPW_DEBUG_WX(
"invalid rate specified, returning error\n");
9337 mask, fixed ?
"fixed" :
"sub-rates");
9341 ipw_set_fixed_rate(priv, priv->
ieee->mode);
9355 if (!ipw_disassociate(priv))
9362 static int ipw_wx_get_rate(
struct net_device *dev,
9366 struct ipw_priv *priv = libipw_priv(dev);
9375 static int ipw_wx_set_rts(
struct net_device *dev,
9379 struct ipw_priv *priv = libipw_priv(dev);
9381 if (wrqu->
rts.disabled || !wrqu->
rts.fixed)
9398 static int ipw_wx_get_rts(
struct net_device *dev,
9402 struct ipw_priv *priv = libipw_priv(dev);
9405 wrqu->
rts.fixed = 0;
9412 static int ipw_wx_set_txpow(
struct net_device *dev,
9416 struct ipw_priv *priv = libipw_priv(dev);
9420 if (ipw_radio_kill_sw(priv, wrqu->
power.disabled)) {
9425 if (!wrqu->
power.fixed)
9440 err = ipw_set_tx_power(priv);
9446 static int ipw_wx_get_txpow(
struct net_device *dev,
9450 struct ipw_priv *priv = libipw_priv(dev);
9453 wrqu->
power.fixed = 1;
9459 wrqu->
power.disabled ?
"OFF" :
"ON", wrqu->
power.value);
9464 static int ipw_wx_set_frag(
struct net_device *dev,
9468 struct ipw_priv *priv = libipw_priv(dev);
9470 if (wrqu->
frag.disabled || !wrqu->
frag.fixed)
9479 priv->
ieee->fts = wrqu->
frag.value & ~0x1;
9482 ipw_send_frag_threshold(priv, wrqu->
frag.value);
9488 static int ipw_wx_get_frag(
struct net_device *dev,
9492 struct ipw_priv *priv = libipw_priv(dev);
9494 wrqu->
frag.value = priv->
ieee->fts;
9495 wrqu->
frag.fixed = 0;
9503 static int ipw_wx_set_retry(
struct net_device *dev,
9507 struct ipw_priv *priv = libipw_priv(dev);
9515 if (wrqu->
retry.value < 0 || wrqu->
retry.value >= 255)
9536 static int ipw_wx_get_retry(
struct net_device *dev,
9540 struct ipw_priv *priv = libipw_priv(dev);
9543 wrqu->
retry.disabled = 0;
9567 static int ipw_wx_set_scan(
struct net_device *dev,
9571 struct ipw_priv *priv = libipw_priv(dev);
9603 static int ipw_wx_get_scan(
struct net_device *dev,
9607 struct ipw_priv *priv = libipw_priv(dev);
9611 static int ipw_wx_set_encode(
struct net_device *dev,
9615 struct ipw_priv *priv = libipw_priv(dev);
9627 ipw_disassociate(priv);
9633 static int ipw_wx_get_encode(
struct net_device *dev,
9637 struct ipw_priv *priv = libipw_priv(dev);
9641 static int ipw_wx_set_power(
struct net_device *dev,
9645 struct ipw_priv *priv = libipw_priv(dev);
9648 if (wrqu->
power.disabled) {
9692 static int ipw_wx_get_power(
struct net_device *dev,
9696 struct ipw_priv *priv = libipw_priv(dev);
9699 wrqu->
power.disabled = 1;
9701 wrqu->
power.disabled = 0;
9709 static int ipw_wx_set_powermode(
struct net_device *dev,
9713 struct ipw_priv *priv = libipw_priv(dev);
9714 int mode = *(
int *)extra;
9722 err = ipw_send_power_mode(priv, mode);
9734 #define MAX_WX_STRING 80
9735 static int ipw_wx_get_powermode(
struct net_device *dev,
9739 struct ipw_priv *priv = libipw_priv(dev);
9754 "(Timeout %dms, Period %dms)",
9755 timeout_duration[level - 1] / 1000,
9756 period_duration[level - 1] / 1000);
9762 wrqu->
data.length = p - extra + 1;
9767 static int ipw_wx_set_wireless_mode(
struct net_device *dev,
9771 struct ipw_priv *priv = libipw_priv(dev);
9772 int mode = *(
int *)extra;
9773 u8 band = 0, modulation = 0;
9776 IPW_WARNING(
"Attempt to set invalid wireless mode: %d\n", mode);
9781 priv->
ieee->abg_true = 1;
9786 priv->
ieee->abg_true = 0;
9795 priv->
ieee->abg_true = 0;
9802 priv->
ieee->abg_true = 0;
9808 priv->
ieee->abg_true = 0;
9811 priv->
ieee->freq_band = band;
9812 priv->
ieee->modulation = modulation;
9813 init_supported_rates(priv, &priv->
rates);
9817 if (!ipw_disassociate(priv)) {
9818 ipw_send_supported_rates(priv, &priv->
rates);
9823 ipw_led_band_on(priv);
9826 mode &
IEEE_A ?
'a' :
'.',
9827 mode & IEEE_B ?
'b' :
'.', mode & IEEE_G ?
'g' :
'.');
9832 static int ipw_wx_get_wireless_mode(
struct net_device *dev,
9836 struct ipw_priv *priv = libipw_priv(dev);
9838 switch (priv->
ieee->mode) {
9854 case IEEE_B | IEEE_G:
9857 case IEEE_A | IEEE_B | IEEE_G:
9873 static int ipw_wx_set_preamble(
struct net_device *dev,
9877 struct ipw_priv *priv = libipw_priv(dev);
9878 int mode = *(
int *)extra;
9887 (
"[re]association triggered due to preamble change.\n");
9888 if (!ipw_disassociate(priv))
9906 static int ipw_wx_get_preamble(
struct net_device *dev,
9910 struct ipw_priv *priv = libipw_priv(dev);
9920 #ifdef CONFIG_IPW2200_MONITOR
9921 static int ipw_wx_set_monitor(
struct net_device *dev,
9925 struct ipw_priv *priv = libipw_priv(dev);
9926 int *
parms = (
int *)extra;
9927 int enable = (parms[0] > 0);
9929 IPW_DEBUG_WX(
"SET MONITOR: %d %d\n", enable, parms[1]);
9932 #ifdef CONFIG_IPW2200_RADIOTAP
9940 ipw_set_channel(priv, parms[1]);
9955 static int ipw_wx_reset(
struct net_device *dev,
9959 struct ipw_priv *priv = libipw_priv(dev);
9965 static int ipw_wx_sw_reset(
struct net_device *dev,
9969 struct ipw_priv *priv = libipw_priv(dev);
9981 ret = ipw_sw_reset(priv, 2);
9984 ipw_adapter_restart(priv);
9999 if (!ipw_disassociate(priv))
10062 #ifdef CONFIG_IPW2200_MONITOR
10063 IPW_PRIV_SET_MONITOR,
10071 .name =
"set_power"},
10075 .name =
"get_power"},
10079 .name =
"set_mode"},
10083 .name =
"get_mode"},
10087 .name =
"set_preamble"},
10091 .name =
"get_preamble"},
10098 #ifdef CONFIG_IPW2200_MONITOR
10100 IPW_PRIV_SET_MONITOR,
10106 ipw_wx_set_powermode,
10107 ipw_wx_get_powermode,
10108 ipw_wx_set_wireless_mode,
10109 ipw_wx_get_wireless_mode,
10110 ipw_wx_set_preamble,
10111 ipw_wx_get_preamble,
10114 #ifdef CONFIG_IPW2200_MONITOR
10115 ipw_wx_set_monitor,
10120 .standard = ipw_wx_handlers,
10121 .num_standard =
ARRAY_SIZE(ipw_wx_handlers),
10122 .num_private =
ARRAY_SIZE(ipw_priv_handler),
10123 .num_private_args =
ARRAY_SIZE(ipw_priv_args),
10124 .private = ipw_priv_handler,
10125 .private_args = ipw_priv_args,
10126 .get_wireless_stats = ipw_get_wireless_stats,
10136 struct ipw_priv *priv = libipw_priv(dev);
10147 wstats->
miss.beacon = 0;
10149 wstats->
qual.qual = 0;
10150 wstats->
qual.level = 0;
10151 wstats->
qual.noise = 0;
10152 wstats->
qual.updated = 7;
10166 wstats->
discard.code = priv->
ieee->ieee_stats.rx_discards_undecryptable;
10199 static int ipw_net_open(
struct net_device *dev)
10202 netif_start_queue(dev);
10206 static int ipw_net_stop(
struct net_device *dev)
10209 netif_stop_queue(dev);
10227 #ifdef CONFIG_IPW2200_QOS
10228 int tx_id = ipw_get_tx_queue_number(priv, pri);
10241 switch (priv->
ieee->iw_mode) {
10243 unicast = !is_multicast_ether_addr(hdr->
addr1);
10244 id = ipw_find_station(priv, hdr->
addr1);
10246 id = ipw_add_station(priv, hdr->
addr1);
10249 "invalid cell: %pM\n",
10258 unicast = !is_multicast_ether_addr(hdr->
addr3);
10265 memset(tfd, 0,
sizeof(*tfd));
10291 switch (priv->
ieee->sec.level) {
10293 tfd->u.data.
tfd.
tfd_24.mchdr.frame_ctl |=
10308 tfd->u.data.
tfd.
tfd_24.mchdr.frame_ctl |=
10315 tfd->u.data.
tfd.
tfd_24.mchdr.frame_ctl |=
10318 if (priv->
ieee->sec.key_sizes[priv->
ieee->crypt_info.tx_keyidx] <=
10328 priv->
ieee->sec.level);
10335 #ifdef CONFIG_IPW2200_QOS
10337 ipw_qos_set_tx_queue_command(priv, pri, &(tfd->u.data));
10349 IPW_DEBUG_TX(
"Dumping TX packet frag %i of %i (%d bytes):\n",
10367 u16 remaining_bytes = 0;
10370 for (j = i; j < txb->
nr_frags; j++)
10371 remaining_bytes += txb->
fragments[j]->len - hdr_len;
10375 skb = alloc_skb(remaining_bytes,
GFP_ATOMIC);
10378 for (j = i; j < txb->
nr_frags; j++) {
10384 txb->
fragments[j]->data + hdr_len, size);
10402 if (ipw_tx_queue_space(q) < q->
high_mark)
10403 netif_stop_queue(priv->
net_dev);
10413 static int ipw_net_is_queue_full(
struct net_device *dev,
int pri)
10415 struct ipw_priv *priv = libipw_priv(dev);
10416 #ifdef CONFIG_IPW2200_QOS
10417 int tx_id = ipw_get_tx_queue_number(priv, pri);
10423 if (ipw_tx_queue_space(&txq->
q) < txq->
q.high_mark)
10429 #ifdef CONFIG_IPW2200_PROMISCUOUS
10430 static void ipw_handle_promiscuous_tx(
struct ipw_priv *priv,
10436 u16 filter = priv->prom_priv->filter;
10439 if (filter & IPW_PROM_NO_TX)
10442 memset(&dummystats, 0,
sizeof(dummystats));
10447 if (filter & IPW_PROM_NO_MGMT)
10449 if (filter & IPW_PROM_MGMT_HEADER_ONLY)
10452 if (filter & IPW_PROM_NO_CTL)
10454 if (filter & IPW_PROM_CTL_HEADER_ONLY)
10457 if (filter & IPW_PROM_NO_DATA)
10459 if (filter & IPW_PROM_DATA_HEADER_ONLY)
10470 hdr = (
void *)src->
data;
10475 dst = alloc_skb(len +
sizeof(*rt_hdr) +
sizeof(
u16)*2,
GFP_ATOMIC);
10479 rt_hdr = (
void *)
skb_put(dst,
sizeof(*rt_hdr));
10492 else if (priv->
ieee->mode == IEEE_B)
10503 skb_copy_from_linear_data(src,
skb_put(dst, len), len);
10514 struct ipw_priv *priv = libipw_priv(dev);
10515 unsigned long flags;
10521 #ifdef CONFIG_IPW2200_PROMISCUOUS
10522 if (rtap_iface && netif_running(priv->prom_net_dev))
10523 ipw_handle_promiscuous_tx(priv, txb);
10526 ret = ipw_tx_skb(priv, txb, pri);
10528 __ipw_led_activity_on(priv);
10529 spin_unlock_irqrestore(&priv->
lock, flags);
10534 static void ipw_net_set_multicast_list(
struct net_device *dev)
10539 static int ipw_net_set_mac_address(
struct net_device *dev,
void *p)
10541 struct ipw_priv *priv = libipw_priv(dev);
10544 if (!is_valid_ether_addr(addr->
sa_data))
10556 static void ipw_ethtool_get_drvinfo(
struct net_device *dev,
10559 struct ipw_priv *p = libipw_priv(dev);
10567 len =
sizeof(vers);
10569 len =
sizeof(
date);
10581 struct ipw_priv *priv = libipw_priv(dev);
10585 static int ipw_ethtool_get_eeprom_len(
struct net_device *dev)
10590 static int ipw_ethtool_get_eeprom(
struct net_device *dev,
10593 struct ipw_priv *p = libipw_priv(dev);
10603 static int ipw_ethtool_set_eeprom(
struct net_device *dev,
10606 struct ipw_priv *p = libipw_priv(dev);
10619 static const struct ethtool_ops ipw_ethtool_ops = {
10620 .get_link = ipw_ethtool_get_link,
10621 .get_drvinfo = ipw_ethtool_get_drvinfo,
10622 .get_eeprom_len = ipw_ethtool_get_eeprom_len,
10623 .get_eeprom = ipw_ethtool_get_eeprom,
10624 .set_eeprom = ipw_ethtool_set_eeprom,
10630 u32 inta, inta_mask;
10645 if (inta == 0xFFFFFFFF) {
10657 __ipw_disable_interrupts(priv);
10676 static void ipw_rf_kill(
void *adapter)
10679 unsigned long flags;
10683 if (rf_kill_active(priv)) {
10702 spin_unlock_irqrestore(&priv->
lock, flags);
10705 static void ipw_bg_rf_kill(
struct work_struct *work)
10714 static void ipw_link_up(
struct ipw_priv *priv)
10726 ipw_reset_stats(priv);
10728 priv->
last_rate = ipw_get_current_rate(priv);
10729 ipw_gather_stats(priv);
10730 ipw_led_link_up(priv);
10737 static void ipw_bg_link_up(
struct work_struct *work)
10746 static void ipw_link_down(
struct ipw_priv *priv)
10748 ipw_led_link_down(priv);
10759 ipw_reset_stats(priv);
10768 static void ipw_bg_link_down(
struct work_struct *work)
10773 ipw_link_down(priv);
10808 #ifdef CONFIG_IPW2200_QOS
10813 ipw_irq_tasklet, (
unsigned long)priv);
10818 static void shim__set_security(
struct net_device *dev,
10821 struct ipw_priv *priv = libipw_priv(dev);
10823 for (i = 0; i < 4; i++) {
10824 if (sec->
flags & (1 << i)) {
10828 priv->
ieee->sec.flags &= ~(1 <<
i);
10832 priv->
ieee->sec.flags |= (1 <<
i);
10836 priv->
ieee->sec.flags &= ~(1 <<
i);
10880 ipw_set_hwcrypto_keys(priv);
10893 ipw_disassociate(priv);
10898 static int init_supported_rates(
struct ipw_priv *priv,
10903 memset(rates, 0,
sizeof(*rates));
10905 switch (priv->
ieee->freq_band) {
10928 static int ipw_config(
struct ipw_priv *priv)
10933 if (ipw_set_tx_power(priv))
10937 if (ipw_send_adapter_address(priv, priv->
net_dev->dev_addr))
10956 #ifdef CONFIG_IPW2200_PROMISCUOUS
10957 if (priv->prom_net_dev && netif_running(priv->prom_net_dev)) {
10958 priv->
sys_config.accept_all_data_frames = 1;
10959 priv->
sys_config.accept_non_directed_frames = 1;
10961 priv->
sys_config.accept_all_mgmt_frames = 1;
10966 priv->
sys_config.answer_broadcast_ssid_probe = 1;
10968 priv->
sys_config.answer_broadcast_ssid_probe = 0;
10970 if (ipw_send_system_config(priv))
10973 init_supported_rates(priv, &priv->
rates);
10974 if (ipw_send_supported_rates(priv, &priv->
rates))
10982 #ifdef CONFIG_IPW2200_QOS
10984 ipw_qos_activate(priv,
NULL);
10987 if (ipw_set_random_seed(priv))
10991 if (ipw_send_host_complete(priv))
10996 ipw_led_init(priv);
10997 ipw_led_radio_on(priv);
11003 !(priv->
ieee->host_encrypt || priv->
ieee->host_decrypt))
11004 ipw_set_hwcrypto_keys(priv);
11026 static const struct libipw_geo ipw_geos[] = {
11030 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11031 {2427, 4}, {2432, 5}, {2437, 6},
11032 {2442, 7}, {2447, 8}, {2452, 9},
11033 {2457, 10}, {2462, 11}},
11039 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11040 {2427, 4}, {2432, 5}, {2437, 6},
11041 {2442, 7}, {2447, 8}, {2452, 9},
11042 {2457, 10}, {2462, 11}},
11048 {5260, 52, LIBIPW_CH_PASSIVE_ONLY},
11049 {5280, 56, LIBIPW_CH_PASSIVE_ONLY},
11050 {5300, 60, LIBIPW_CH_PASSIVE_ONLY},
11051 {5320, 64, LIBIPW_CH_PASSIVE_ONLY}},
11057 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11058 {2427, 4}, {2432, 5}, {2437, 6},
11059 {2442, 7}, {2447, 8}, {2452, 9},
11060 {2457, 10}, {2462, 11}, {2467, 12},
11067 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11068 {2427, 4}, {2432, 5}, {2437, 6},
11069 {2442, 7}, {2447, 8}, {2452, 9},
11070 {2457, 10}, {2462, 11}},
11076 {5260, 52, LIBIPW_CH_PASSIVE_ONLY},
11077 {5280, 56, LIBIPW_CH_PASSIVE_ONLY},
11078 {5300, 60, LIBIPW_CH_PASSIVE_ONLY},
11079 {5320, 64, LIBIPW_CH_PASSIVE_ONLY},
11090 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11091 {2427, 4}, {2432, 5}, {2437, 6},
11092 {2442, 7}, {2447, 8}, {2452, 9},
11093 {2457, 10}, {2462, 11}},
11099 {5260, 52, LIBIPW_CH_PASSIVE_ONLY},
11100 {5280, 56, LIBIPW_CH_PASSIVE_ONLY},
11101 {5300, 60, LIBIPW_CH_PASSIVE_ONLY},
11102 {5320, 64, LIBIPW_CH_PASSIVE_ONLY},
11103 {5745, 149, LIBIPW_CH_PASSIVE_ONLY},
11104 {5765, 153, LIBIPW_CH_PASSIVE_ONLY},
11105 {5785, 157, LIBIPW_CH_PASSIVE_ONLY},
11106 {5805, 161, LIBIPW_CH_PASSIVE_ONLY},
11107 {5825, 165, LIBIPW_CH_PASSIVE_ONLY}},
11113 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11114 {2427, 4}, {2432, 5}, {2437, 6},
11115 {2442, 7}, {2447, 8}, {2452, 9},
11116 {2457, 10}, {2462, 11}},
11118 .a = {{5170, 34}, {5190, 38},
11119 {5210, 42}, {5230, 46}},
11125 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11126 {2427, 4}, {2432, 5}, {2437, 6},
11127 {2442, 7}, {2447, 8}, {2452, 9},
11128 {2457, 10}, {2462, 11}},
11134 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11135 {2427, 4}, {2432, 5}, {2437, 6},
11136 {2442, 7}, {2447, 8}, {2452, 9},
11137 {2457, 10}, {2462, 11}, {2467, 12},
11144 {5260, 52, LIBIPW_CH_PASSIVE_ONLY},
11145 {5280, 56, LIBIPW_CH_PASSIVE_ONLY},
11146 {5300, 60, LIBIPW_CH_PASSIVE_ONLY},
11147 {5320, 64, LIBIPW_CH_PASSIVE_ONLY},
11148 {5500, 100, LIBIPW_CH_PASSIVE_ONLY},
11149 {5520, 104, LIBIPW_CH_PASSIVE_ONLY},
11150 {5540, 108, LIBIPW_CH_PASSIVE_ONLY},
11151 {5560, 112, LIBIPW_CH_PASSIVE_ONLY},
11152 {5580, 116, LIBIPW_CH_PASSIVE_ONLY},
11153 {5600, 120, LIBIPW_CH_PASSIVE_ONLY},
11154 {5620, 124, LIBIPW_CH_PASSIVE_ONLY},
11155 {5640, 128, LIBIPW_CH_PASSIVE_ONLY},
11156 {5660, 132, LIBIPW_CH_PASSIVE_ONLY},
11157 {5680, 136, LIBIPW_CH_PASSIVE_ONLY},
11158 {5700, 140, LIBIPW_CH_PASSIVE_ONLY}},
11164 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11165 {2427, 4}, {2432, 5}, {2437, 6},
11166 {2442, 7}, {2447, 8}, {2452, 9},
11167 {2457, 10}, {2462, 11}, {2467, 12},
11170 .a = {{5170, 34}, {5190, 38},
11171 {5210, 42}, {5230, 46}},
11177 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11178 {2427, 4}, {2432, 5}, {2437, 6},
11179 {2442, 7}, {2447, 8}, {2452, 9},
11180 {2457, 10}, {2462, 11}, {2467, 12},
11182 LIBIPW_CH_PASSIVE_ONLY}},
11188 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11189 {2427, 4}, {2432, 5}, {2437, 6},
11190 {2442, 7}, {2447, 8}, {2452, 9},
11191 {2457, 10}, {2462, 11},
11192 {2467, 12, LIBIPW_CH_PASSIVE_ONLY},
11193 {2472, 13, LIBIPW_CH_PASSIVE_ONLY}},
11195 .a = {{5745, 149}, {5765, 153},
11196 {5785, 157}, {5805, 161}},
11202 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11203 {2427, 4}, {2432, 5}, {2437, 6},
11204 {2442, 7}, {2447, 8}, {2452, 9},
11205 {2457, 10}, {2462, 11},
11206 {2467, 12}, {2472, 13}},
11208 .a = {{5180, 36}, {5200, 40},
11209 {5220, 44}, {5240, 48}},
11215 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11216 {2427, 4}, {2432, 5}, {2437, 6},
11217 {2442, 7}, {2447, 8}, {2452, 9},
11218 {2457, 10}, {2462, 11},
11219 {2467, 12, LIBIPW_CH_PASSIVE_ONLY},
11220 {2472, 13, LIBIPW_CH_PASSIVE_ONLY}},
11222 .a = {{5180, 36, LIBIPW_CH_PASSIVE_ONLY},
11223 {5200, 40, LIBIPW_CH_PASSIVE_ONLY},
11224 {5220, 44, LIBIPW_CH_PASSIVE_ONLY},
11225 {5240, 48, LIBIPW_CH_PASSIVE_ONLY},
11226 {5260, 52, LIBIPW_CH_PASSIVE_ONLY},
11227 {5280, 56, LIBIPW_CH_PASSIVE_ONLY},
11228 {5300, 60, LIBIPW_CH_PASSIVE_ONLY},
11229 {5320, 64, LIBIPW_CH_PASSIVE_ONLY},
11230 {5500, 100, LIBIPW_CH_PASSIVE_ONLY},
11231 {5520, 104, LIBIPW_CH_PASSIVE_ONLY},
11232 {5540, 108, LIBIPW_CH_PASSIVE_ONLY},
11233 {5560, 112, LIBIPW_CH_PASSIVE_ONLY},
11234 {5580, 116, LIBIPW_CH_PASSIVE_ONLY},
11235 {5600, 120, LIBIPW_CH_PASSIVE_ONLY},
11236 {5620, 124, LIBIPW_CH_PASSIVE_ONLY},
11237 {5640, 128, LIBIPW_CH_PASSIVE_ONLY},
11238 {5660, 132, LIBIPW_CH_PASSIVE_ONLY},
11239 {5680, 136, LIBIPW_CH_PASSIVE_ONLY},
11240 {5700, 140, LIBIPW_CH_PASSIVE_ONLY},
11241 {5745, 149, LIBIPW_CH_PASSIVE_ONLY},
11242 {5765, 153, LIBIPW_CH_PASSIVE_ONLY},
11243 {5785, 157, LIBIPW_CH_PASSIVE_ONLY},
11244 {5805, 161, LIBIPW_CH_PASSIVE_ONLY},
11245 {5825, 165, LIBIPW_CH_PASSIVE_ONLY}},
11251 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
11252 {2427, 4}, {2432, 5}, {2437, 6},
11253 {2442, 7}, {2447, 8}, {2452, 9},
11254 {2457, 10}, {2462, 11}},
11256 .a = {{5180, 36, LIBIPW_CH_PASSIVE_ONLY},
11257 {5200, 40, LIBIPW_CH_PASSIVE_ONLY},
11258 {5220, 44, LIBIPW_CH_PASSIVE_ONLY},
11259 {5240, 48, LIBIPW_CH_PASSIVE_ONLY},
11260 {5260, 52, LIBIPW_CH_PASSIVE_ONLY},
11261 {5280, 56, LIBIPW_CH_PASSIVE_ONLY},
11262 {5300, 60, LIBIPW_CH_PASSIVE_ONLY},
11263 {5320, 64, LIBIPW_CH_PASSIVE_ONLY},
11264 {5745, 149, LIBIPW_CH_PASSIVE_ONLY},
11265 {5765, 153, LIBIPW_CH_PASSIVE_ONLY},
11266 {5785, 157, LIBIPW_CH_PASSIVE_ONLY},
11267 {5805, 161, LIBIPW_CH_PASSIVE_ONLY},
11268 {5825, 165, LIBIPW_CH_PASSIVE_ONLY}},
11272 #define MAX_HW_RESTARTS 5
11273 static int ipw_up(
struct ipw_priv *priv)
11286 if (cmdlog && !priv->
cmdlog) {
11290 IPW_ERROR(
"Error allocating %d command log entries.\n",
11301 rc = ipw_load(priv);
11303 IPW_ERROR(
"Unable to load firmware: %d\n", rc);
11307 ipw_init_ordinals(priv);
11309 eeprom_parse_mac(priv, priv->
mac_addr);
11313 for (j = 0; j <
ARRAY_SIZE(ipw_geos); j++) {
11315 ipw_geos[j].
name, 3))
11331 IPW_WARNING(
"Radio disabled by module parameter.\n");
11333 }
else if (rf_kill_active(priv)) {
11334 IPW_WARNING(
"Radio Frequency Kill Switch is On:\n"
11335 "Kill switch must be turned off for "
11336 "wireless networking to work.\n");
11341 rc = ipw_config(priv);
11354 i, MAX_HW_RESTARTS);
11363 IPW_ERROR(
"Unable to initialize device after %d attempts.\n", i);
11377 static void ipw_deinit(
struct ipw_priv *priv)
11383 ipw_abort_scan(priv);
11388 ipw_disassociate(priv);
11391 ipw_led_shutdown(priv);
11396 for (i = 1000; i && (priv->
status &
11408 ipw_send_card_disable(priv, 0);
11413 static void ipw_down(
struct ipw_priv *priv)
11419 if (ipw_is_init(priv))
11428 ipw_disable_interrupts(priv);
11434 ipw_stop_nic(priv);
11436 ipw_led_radio_off(priv);
11439 static void ipw_bg_down(
struct work_struct *work)
11448 static int ipw_wdev_init(
struct net_device *dev)
11451 struct ipw_priv *priv = libipw_priv(dev);
11475 bg_band->
channels[
i].max_power = geo->
bg[
i].max_power;
11476 if (geo->
bg[i].flags & LIBIPW_CH_PASSIVE_ONLY)
11512 a_band->
channels[
i].center_freq = geo->
a[
i].freq;
11513 a_band->
channels[
i].hw_value = geo->
a[
i].channel;
11514 a_band->
channels[
i].max_power = geo->
a[
i].max_power;
11515 if (geo->
a[i].flags & LIBIPW_CH_PASSIVE_ONLY)
11535 wdev->
wiphy->cipher_suites = ipw_cipher_suites;
11578 static struct attribute *ipw_sysfs_entries[] = {
11579 &dev_attr_rf_kill.attr,
11580 &dev_attr_direct_dword.attr,
11581 &dev_attr_indirect_byte.attr,
11582 &dev_attr_indirect_dword.attr,
11583 &dev_attr_mem_gpio_reg.attr,
11584 &dev_attr_command_event_reg.attr,
11585 &dev_attr_nic_type.attr,
11586 &dev_attr_status.attr,
11587 &dev_attr_cfg.attr,
11588 &dev_attr_error.attr,
11589 &dev_attr_event_log.attr,
11590 &dev_attr_cmd_log.attr,
11591 &dev_attr_eeprom_delay.attr,
11592 &dev_attr_ucode_version.attr,
11593 &dev_attr_rtc.attr,
11594 &dev_attr_scan_age.attr,
11595 &dev_attr_led.attr,
11596 &dev_attr_speed_scan.attr,
11597 &dev_attr_net_stats.attr,
11598 &dev_attr_channels.attr,
11599 #ifdef CONFIG_IPW2200_PROMISCUOUS
11600 &dev_attr_rtap_iface.attr,
11601 &dev_attr_rtap_filter.attr,
11608 .attrs = ipw_sysfs_entries,
11611 #ifdef CONFIG_IPW2200_PROMISCUOUS
11612 static int ipw_prom_open(
struct net_device *dev)
11614 struct ipw_prom_priv *prom_priv = libipw_priv(dev);
11615 struct ipw_priv *priv = prom_priv->priv;
11621 priv->
sys_config.accept_all_data_frames = 1;
11622 priv->
sys_config.accept_non_directed_frames = 1;
11624 priv->
sys_config.accept_all_mgmt_frames = 1;
11626 ipw_send_system_config(priv);
11632 static int ipw_prom_stop(
struct net_device *dev)
11634 struct ipw_prom_priv *prom_priv = libipw_priv(dev);
11635 struct ipw_priv *priv = prom_priv->priv;
11640 priv->
sys_config.accept_all_data_frames = 0;
11641 priv->
sys_config.accept_non_directed_frames = 0;
11643 priv->
sys_config.accept_all_mgmt_frames = 0;
11645 ipw_send_system_config(priv);
11655 dev_kfree_skb(skb);
11661 .ndo_stop = ipw_prom_stop,
11662 .ndo_start_xmit = ipw_prom_hard_start_xmit,
11668 static int ipw_prom_alloc(
struct ipw_priv *priv)
11672 if (priv->prom_net_dev)
11675 priv->prom_net_dev =
alloc_libipw(
sizeof(
struct ipw_prom_priv), 1);
11676 if (priv->prom_net_dev ==
NULL)
11679 priv->prom_priv = libipw_priv(priv->prom_net_dev);
11680 priv->prom_priv->
ieee = netdev_priv(priv->prom_net_dev);
11681 priv->prom_priv->priv =
priv;
11683 strcpy(priv->prom_net_dev->name,
"rtap%d");
11687 priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops;
11695 priv->prom_net_dev =
NULL;
11702 static void ipw_prom_free(
struct ipw_priv *priv)
11704 if (!priv->prom_net_dev)
11710 priv->prom_net_dev =
NULL;
11716 .ndo_open = ipw_net_open,
11717 .ndo_stop = ipw_net_stop,
11718 .ndo_set_rx_mode = ipw_net_set_multicast_list,
11719 .ndo_set_mac_address = ipw_net_set_mac_address,
11736 if (net_dev ==
NULL) {
11741 priv = libipw_priv(net_dev);
11742 priv->
ieee = netdev_priv(net_dev);
11746 ipw_debug_level =
debug;
11755 goto out_free_libipw;
11762 err = pci_set_consistent_dma_mask(pdev,
DMA_BIT_MASK(32));
11765 goto out_pci_disable_device;
11768 pci_set_drvdata(pdev, priv);
11772 goto out_pci_disable_device;
11776 pci_read_config_dword(pdev, 0x40, &val);
11777 if ((val & 0x0000ff00) != 0)
11778 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
11786 goto out_pci_release_regions;
11793 err = ipw_setup_deferred_work(priv);
11795 IPW_ERROR(
"Unable to setup deferred work\n");
11799 ipw_sw_reset(priv, 1);
11811 priv->
ieee->hard_start_xmit = ipw_net_hard_start_xmit;
11812 priv->
ieee->set_security = shim__set_security;
11813 priv->
ieee->is_queue_full = ipw_net_is_queue_full;
11815 #ifdef CONFIG_IPW2200_QOS
11816 priv->
ieee->is_qos_active = ipw_is_qos_active;
11817 priv->
ieee->handle_probe_response = ipw_handle_beacon;
11818 priv->
ieee->handle_beacon = ipw_handle_probe_response;
11819 priv->
ieee->handle_assoc_response = ipw_handle_assoc_response;
11822 priv->
ieee->perfect_rssi = -20;
11823 priv->
ieee->worst_rssi = -85;
11828 net_dev->wireless_handlers = &ipw_wx_handler_def;
11833 IPW_ERROR(
"failed to create sysfs device attributes\n");
11835 goto out_release_irq;
11838 if (ipw_up(priv)) {
11841 goto out_remove_sysfs;
11846 err = ipw_wdev_init(net_dev);
11848 IPW_ERROR(
"failed to register wireless device\n");
11849 goto out_remove_sysfs;
11854 IPW_ERROR(
"failed to register network device\n");
11855 goto out_unregister_wiphy;
11858 #ifdef CONFIG_IPW2200_PROMISCUOUS
11860 err = ipw_prom_alloc(priv);
11862 IPW_ERROR(
"Failed to register promiscuous network "
11863 "device (error %d).\n", err);
11865 goto out_unregister_wiphy;
11871 "channels, %d 802.11a channels)\n",
11872 priv->
ieee->geo.name, priv->
ieee->geo.bg_channels,
11873 priv->
ieee->geo.a_channels);
11877 out_unregister_wiphy:
11887 out_pci_release_regions:
11889 out_pci_disable_device:
11891 pci_set_drvdata(pdev,
NULL);
11900 struct ipw_priv *priv = pci_get_drvdata(pdev);
11918 ipw_rx_queue_free(priv, priv->
rxq);
11921 ipw_tx_queue_free(priv);
11964 #ifdef CONFIG_IPW2200_PROMISCUOUS
11965 ipw_prom_free(priv);
11972 pci_set_drvdata(pdev,
NULL);
11984 struct ipw_priv *priv = pci_get_drvdata(pdev);
12004 static int ipw_pci_resume(
struct pci_dev *pdev)
12006 struct ipw_priv *priv = pci_get_drvdata(pdev);
12028 pci_read_config_dword(pdev, 0x40, &val);
12029 if ((val & 0x0000ff00) != 0)
12030 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
12045 static void ipw_pci_shutdown(
struct pci_dev *pdev)
12047 struct ipw_priv *priv = pci_get_drvdata(pdev);
12058 .id_table = card_ids,
12059 .probe = ipw_pci_probe,
12062 .suspend = ipw_pci_suspend,
12063 .resume = ipw_pci_resume,
12065 .shutdown = ipw_pci_shutdown,
12068 static int __init ipw_init(
void)
12075 ret = pci_register_driver(&ipw_driver);
12077 IPW_ERROR(
"Unable to initialize PCI module\n");
12083 IPW_ERROR(
"Unable to create driver sysfs file\n");
12091 static void __exit ipw_exit(
void)
12101 MODULE_PARM_DESC(associate,
"auto associate when scanning (default off)");
12107 MODULE_PARM_DESC(led,
"enable led control on some systems (default 1 on)");
12113 MODULE_PARM_DESC(channel,
"channel to limit associate to (default 0 [ANY])");
12115 #ifdef CONFIG_IPW2200_PROMISCUOUS
12117 MODULE_PARM_DESC(rtap_iface,
"create the rtap interface (1 - create, default 0)");
12120 #ifdef CONFIG_IPW2200_QOS
12137 #ifdef CONFIG_IPW2200_MONITOR
12146 MODULE_PARM_DESC(bt_coexist,
"enable bluetooth coexistence (default off)");
12153 "allocate a ring buffer for logging firmware commands");
12159 MODULE_PARM_DESC(
antenna,
"select antenna 1=Main, 3=Aux, default 0 [both], 2=slow_diversity (choose the one with lower background noise)");