diff options
author | Guido Guenther <agx@sigxcpu.org> | 2007-03-09 23:37:57 +0100 |
---|---|---|
committer | Guido Guenther <agx@bogon.sigxcpu.org> | 2007-03-09 23:37:57 +0100 |
commit | dd90c968339ddd84c51b966bb78c53ff921198ec (patch) | |
tree | 4d714a8217b51718d86665582ce07424935e88f0 | |
parent | 6a000872a375e22e6de364cc0372156f438f4a1a (diff) |
run through Lindent and merge in most of the hunks
-rw-r--r-- | at76_usb.c | 2218 | ||||
-rw-r--r-- | at76_usb.h | 494 | ||||
-rw-r--r-- | at76_usb_ids.h | 108 |
3 files changed, 1383 insertions, 1437 deletions
@@ -189,9 +189,9 @@ static int monitor_scan_max_time = 600; /* Function prototypes */ static void iwspy_update(struct at76c503 *dev, struct at76c503_rx_buffer *buf); -static void at76c503_read_bulk_callback (struct urb *urb); +static void at76c503_read_bulk_callback(struct urb *urb); static void at76c503_write_bulk_callback(struct urb *urb); -static void defer_kevent (struct at76c503 *dev, int flag); +static void defer_kevent(struct at76c503 *dev, int flag); static struct bss_info *find_matching_bss(struct at76c503 *dev, struct bss_info *curr); static int auth_req(struct at76c503 *dev, struct bss_info *bss, int seq_nr, @@ -250,14 +250,14 @@ struct dfu_ctx { }; static -int dfu_download_block(struct dfu_ctx *ctx, u8 *buffer, - int bytes, int block) +int dfu_download_block(struct dfu_ctx *ctx, u8 * buffer, int bytes, int block) { int result; u8 *tmpbuf = ctx->buf; struct usb_device *udev = ctx->udev; - dbg(DBG_DFU, "dfu_download_block(): buffer=%p, bytes=%d, block=%d", buffer, bytes, block); + dbg(DBG_DFU, "dfu_download_block(): buffer=%p, bytes=%d, block=%d", + buffer, bytes, block); if (tmpbuf == NULL) return -ENOMEM; @@ -293,7 +293,7 @@ int dfu_get_status(struct dfu_ctx *ctx, struct dfu_status *status) } static -u8 dfu_get_state(struct usb_device *udev, u8 *state) +u8 dfu_get_state(struct usb_device *udev, u8 * state) { int result; @@ -308,14 +308,13 @@ u8 dfu_get_state(struct usb_device *udev, u8 *state) return result; } -static inline -u32 __get_timeout(struct dfu_status *s) +static inline u32 __get_timeout(struct dfu_status *s) { unsigned long ret = 0; - ret = (unsigned long) (s->bwPollTimeout[2] << 16); - ret |= (unsigned long) (s->bwPollTimeout[1] << 8); - ret |= (unsigned long) (s->bwPollTimeout[0]); + ret = (unsigned long)(s->bwPollTimeout[2] << 16); + ret |= (unsigned long)(s->bwPollTimeout[1] << 8); + ret |= (unsigned long)(s->bwPollTimeout[0]); return ret; } @@ -347,7 +346,7 @@ static int usbdfu_download(struct usb_device *udev, u8 *dfu_buffer, int dfu_block_bytes = 0, dfu_bytes_left = dfu_len, dfu_buffer_offset = 0; int dfu_block_cnt = 0; - dbg(DBG_DFU, "%s( %p, %u, %d)", __FUNCTION__, dfu_buffer, + dbg(DBG_DFU, "%s( %p, %u, %d)", __FUNCTION__, dfu_buffer, dfu_len, manifest_sync_timeout); if (dfu_len == 0) { @@ -390,8 +389,8 @@ static int usbdfu_download(struct usb_device *udev, u8 *dfu_buffer, if (dfu_timeout >= 0) { dbg(DBG_DFU, "DFU: Resetting device"); - set_current_state( TASK_INTERRUPTIBLE ); - schedule_timeout(1+dfu_timeout*HZ/1000); + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(1 + dfu_timeout * HZ / 1000); } else dbg(DBG_DFU, "DFU: In progress"); @@ -410,10 +409,10 @@ static int usbdfu_download(struct usb_device *udev, u8 *dfu_buffer, dfu_bytes_left -= dfu_block_bytes; status = dfu_download_block(ctx, - dfu_buffer + - dfu_buffer_offset, - dfu_block_bytes, - dfu_block_cnt); + dfu_buffer + + dfu_buffer_offset, + dfu_block_bytes, + dfu_block_cnt); dfu_buffer_offset += dfu_block_bytes; dfu_block_cnt++; @@ -520,19 +519,19 @@ static char *hex2str(char *obuf, u8 *buf, int len, char delim) { #define BIN2HEX(x) ((x) < 10 ? '0'+(x) : (x)+'A'-10) - char *ret = obuf; - while (len--) { - *obuf++ = BIN2HEX(*buf>>4); - *obuf++ = BIN2HEX(*buf&0xf); - if (delim != '\0') - *obuf++ = delim; - buf++; - } - if (delim != '\0' && obuf > ret) - obuf--; /* remove last inserted delimiter */ - *obuf = '\0'; + char *ret = obuf; + while (len--) { + *obuf++ = BIN2HEX(*buf >> 4); + *obuf++ = BIN2HEX(*buf & 0xf); + if (delim != '\0') + *obuf++ = delim; + buf++; + } + if (delim != '\0' && obuf > ret) + obuf--; /* remove last inserted delimiter */ + *obuf = '\0'; - return ret; + return ret; } /* check if the given sisd is cloaked */ @@ -540,9 +539,9 @@ static inline int is_cloaked_ssid(u8 *ssid, int length) { static const u8 zeros[32]; - return (length == 0) || - (length == 1 && *ssid == ' ') || - (length > 0 && !memcmp(ssid,zeros,length)); + return (length == 0) || + (length == 1 && *ssid == ' ') || + (length > 0 && !memcmp(ssid, zeros, length)); } static inline void free_bss_list(struct at76c503 *dev) @@ -564,8 +563,8 @@ static inline void free_bss_list(struct at76c503 *dev) static inline char *mac2str(u8 *mac) { - static char str [6*3]; - + static char str[6 * 3]; + sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); return str; @@ -590,7 +589,7 @@ static void ledtrig_tx_timerfunc(unsigned long data) if (tx_lastactivity != tx_activity) { tx_lastactivity = tx_activity; led_trigger_event(ledtrig_tx, LED_FULL); - mod_timer(&ledtrig_tx_timer, jiffies + msecs_to_jiffies(250)); + mod_timer(&ledtrig_tx_timer, jiffies + msecs_to_jiffies(250)); } else { led_trigger_event(ledtrig_tx, LED_OFF); } @@ -600,10 +599,9 @@ static void ledtrig_tx_timerfunc(unsigned long data) static int at76c503_remap(struct usb_device *udev) { int ret; - ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0), + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0a, INTERFACE_VENDOR_REQUEST_OUT, - 0, 0, - NULL, 0, USB_CTRL_GET_TIMEOUT); + 0, 0, NULL, 0, USB_CTRL_GET_TIMEOUT); if (ret < 0) return ret; @@ -618,8 +616,7 @@ static int get_op_mode(struct usb_device *udev) ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, INTERFACE_VENDOR_REQUEST_IN, - 0x01, 0, - &op_mode, 1, USB_CTRL_GET_TIMEOUT); + 0x01, 0, &op_mode, 1, USB_CTRL_GET_TIMEOUT); if (ret < 0) return ret; return op_mode; @@ -627,18 +624,17 @@ static int get_op_mode(struct usb_device *udev) /* this loads a block of the second part of the firmware */ static inline int load_ext_fw_block(struct usb_device *udev, - int i, unsigned char *buf, int bsize) + int i, unsigned char *buf, int bsize) { - return usb_control_msg(udev, usb_sndctrlpipe(udev,0), + return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0e, DEVICE_VENDOR_REQUEST_OUT, - 0x0802, i, - buf, bsize, USB_CTRL_GET_TIMEOUT); + 0x0802, i, buf, bsize, USB_CTRL_GET_TIMEOUT); } static inline int get_hw_cfg_rfmd(struct usb_device *udev, - unsigned char *buf, int buf_size) + unsigned char *buf, int buf_size) { - return usb_control_msg(udev, usb_rcvctrlpipe(udev,0), + return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, INTERFACE_VENDOR_REQUEST_IN, ((0x0a << 8) | 0x02), 0, buf, buf_size, USB_CTRL_GET_TIMEOUT); @@ -664,8 +660,8 @@ static int get_hw_config(struct at76c503 *dev) int ret; union { struct hwcfg_intersil i; - struct hwcfg_rfmd r3; - struct hwcfg_r505 r5; + struct hwcfg_rfmd r3; + struct hwcfg_r505 r5; } *hwcfg = kmalloc(sizeof(*hwcfg), GFP_KERNEL); if (!hwcfg) @@ -673,10 +669,11 @@ static int get_hw_config(struct at76c503 *dev) switch (dev->board_type) { - case BOARDTYPE_503_INTERSIL_3861: - case BOARDTYPE_503_INTERSIL_3863: + case BOARDTYPE_503_INTERSIL_3861: + case BOARDTYPE_503_INTERSIL_3863: ret = get_hw_cfg_intersil(dev->udev, (unsigned char *)&hwcfg->i, sizeof(hwcfg->i)); - if (ret < 0) break; + if (ret < 0) + break; memcpy(dev->mac_addr, hwcfg->i.mac_addr, ETH_ALEN); memcpy(dev->cr31_values, hwcfg->i.cr31_values, 14); memcpy(dev->cr58_values, hwcfg->i.cr58_values, 14); @@ -684,10 +681,11 @@ static int get_hw_config(struct at76c503 *dev) dev->regulatory_domain = hwcfg->i.regulatory_domain; break; - case BOARDTYPE_503_RFMD: - case BOARDTYPE_503_RFMD_ACC: + case BOARDTYPE_503_RFMD: + case BOARDTYPE_503_RFMD_ACC: ret = get_hw_cfg_rfmd(dev->udev, (unsigned char *)&hwcfg->r3, sizeof(hwcfg->r3)); - if (ret < 0) break; + if (ret < 0) + break; memcpy(dev->cr20_values, hwcfg->r3.cr20_values, 14); memcpy(dev->cr21_values, hwcfg->r3.cr21_values, 14); memcpy(dev->bb_cr, hwcfg->r3.bb_cr, 14); @@ -698,11 +696,12 @@ static int get_hw_config(struct at76c503 *dev) memcpy(dev->normal_power_values, hwcfg->r3.normal_power_values, 14); break; - case BOARDTYPE_505_RFMD: - case BOARDTYPE_505_RFMD_2958: - case BOARDTYPE_505A_RFMD_2958: + case BOARDTYPE_505_RFMD: + case BOARDTYPE_505_RFMD_2958: + case BOARDTYPE_505A_RFMD_2958: ret = get_hw_cfg_rfmd(dev->udev, (unsigned char *)&hwcfg->r5, sizeof(hwcfg->r5)); - if (ret < 0) break; + if (ret < 0) + break; memcpy(dev->cr39_values, hwcfg->r5.cr39_values, 14); memcpy(dev->bb_cr, hwcfg->r5.bb_cr, 14); memcpy(dev->pidvid, hwcfg->r5.pidvid, 4); @@ -711,8 +710,9 @@ static int get_hw_config(struct at76c503 *dev) memcpy(dev->cr15_values, hwcfg->r5.cr15_values, 14); break; - default: - err("Bad board type set (%d). Unable to get hardware config.", dev->board_type); + default: + err("Bad board type set (%d). Unable to get hardware config.", + dev->board_type); ret = -EINVAL; } @@ -724,38 +724,36 @@ static int get_hw_config(struct at76c503 *dev) return ret; } - static struct reg_domain const *getRegDomain(u16 code) { static struct reg_domain const fd_tab[] = { - {0x10, "FCC (U.S)", 0x7ff}, /* ch 1-11 */ - {0x20, "IC (Canada)", 0x7ff}, /* ch 1-11 */ - {0x30, "ETSI (Europe - (Spain+France)", 0x1fff}, /* ch 1-13 */ - {0x31, "Spain", 0x600}, /* ch 10,11 */ - {0x32, "France", 0x1e00}, /* ch 10-13 */ - {0x40, "MKK (Japan)", 0x2000}, /* ch 14 */ - {0x41, "MKK1 (Japan)", 0x3fff}, /* ch 1-14 */ - {0x50, "Israel", 0x3fc}, /* ch 3-9 */ + {0x10, "FCC (U.S)", 0x7ff}, /* ch 1-11 */ + {0x20, "IC (Canada)", 0x7ff}, /* ch 1-11 */ + {0x30, "ETSI (Europe - (Spain+France)", 0x1fff}, /* ch 1-13 */ + {0x31, "Spain", 0x600}, /* ch 10,11 */ + {0x32, "France", 0x1e00}, /* ch 10-13 */ + {0x40, "MKK (Japan)", 0x2000}, /* ch 14 */ + {0x41, "MKK1 (Japan)", 0x3fff}, /* ch 1-14 */ + {0x50, "Israel", 0x3fc}, /* ch 3-9 */ }; static int const tab_len = ARRAY_SIZE(fd_tab); /* use this if an unknown code comes in */ - static struct reg_domain const unknown = - {0, "<unknown>", 0xffffffff}; - + static struct reg_domain const unknown = { 0, "<unknown>", 0xffffffff }; + int i; - for(i=0; i < tab_len; i++) + for (i = 0; i < tab_len; i++) if (code == fd_tab[i].code) break; return (i >= tab_len) ? &unknown : &fd_tab[i]; -} /* getFreqDomain */ +} static inline int get_mib(struct usb_device *udev, - u16 mib, u8 *buf, int buf_size) + u16 mib, u8 *buf, int buf_size) { - return usb_control_msg(udev, usb_rcvctrlpipe(udev,0), + return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, INTERFACE_VENDOR_REQUEST_IN, mib << 8, 0, buf, buf_size, USB_CTRL_GET_TIMEOUT); @@ -767,7 +765,7 @@ static inline int get_cmd_status(struct usb_device *udev, u8 cmd) u8 stat_buf[40]; int ret; - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev,0), 0x22, + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x22, INTERFACE_VENDOR_REQUEST_IN, cmd, 0, stat_buf, sizeof(stat_buf), USB_CTRL_GET_TIMEOUT); if (ret < 0) @@ -782,11 +780,14 @@ static int download_external_fw(struct usb_device *udev, u8 *buf, int size) int i = 0, ret = 0; u8 *block; - if (size < 0) return -EINVAL; - if ((size > 0) && (buf == NULL)) return -EFAULT; + if (size < 0) + return -EINVAL; + if ((size > 0) && (buf == NULL)) + return -EFAULT; block = kmalloc(EXT_FW_BLOCK_SIZE, GFP_KERNEL); - if (block == NULL) return -ENOMEM; + if (block == NULL) + return -ENOMEM; dbg(DBG_DEVSTART, "downloading external firmware"); @@ -818,13 +819,13 @@ static int download_external_fw(struct usb_device *udev, u8 *buf, int size) } static int set_card_command(struct usb_device *udev, int cmd, - unsigned char *buf, int buf_size) + unsigned char *buf, int buf_size) { int ret; struct at76c503_command *cmd_buf = - (struct at76c503_command *)kmalloc( - sizeof(struct at76c503_command) + buf_size, - GFP_KERNEL); + (struct at76c503_command *)kmalloc(sizeof(struct at76c503_command) + + buf_size, + GFP_KERNEL); if (cmd_buf) { cmd_buf->cmd = cmd; @@ -832,12 +833,12 @@ static int set_card_command(struct usb_device *udev, int cmd, cmd_buf->size = cpu_to_le16(buf_size); if (buf_size > 0) memcpy(&(cmd_buf[1]), buf, buf_size); - ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0), + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0e, DEVICE_VENDOR_REQUEST_OUT, 0, 0, cmd_buf, - sizeof(struct at76c503_command) + buf_size, - USB_CTRL_GET_TIMEOUT); + sizeof(struct at76c503_command) + + buf_size, USB_CTRL_GET_TIMEOUT); kfree(cmd_buf); return ret; } @@ -847,10 +848,9 @@ static int set_card_command(struct usb_device *udev, int cmd, #define MAKE_CMD_STATUS_CASE(c) case (c): return #c -static const char* get_cmd_status_string(u8 cmd_status) +static const char *get_cmd_status_string(u8 cmd_status) { - switch (cmd_status) - { + switch (cmd_status) { MAKE_CMD_STATUS_CASE(CMD_STATUS_IDLE); MAKE_CMD_STATUS_CASE(CMD_STATUS_COMPLETE); MAKE_CMD_STATUS_CASE(CMD_STATUS_UNKNOWN); @@ -878,13 +878,15 @@ static int wait_completion(struct at76c503 *dev, int cmd) break; } - dbg(DBG_WAIT_COMPLETE, "%s: Waiting on cmd %d, status = %d (%s)", - dev->netdev->name, cmd, status, get_cmd_status_string(status)); + dbg(DBG_WAIT_COMPLETE, + "%s: Waiting on cmd %d, status = %d (%s)", + dev->netdev->name, cmd, status, + get_cmd_status_string(status)); if (status == CMD_STATUS_IN_PROGRESS || status == CMD_STATUS_IDLE) { set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(HZ/10); /* 100 ms */ + schedule_timeout(HZ / 10); /* 100 ms */ } else break; } while (1); @@ -897,27 +899,26 @@ static int set_mib(struct at76c503 *dev, struct set_mib_buffer *buf) struct usb_device *udev = dev->udev; int ret; struct at76c503_command *cmd_buf = - (struct at76c503_command *)kmalloc( - sizeof(struct at76c503_command) + buf->size + 4, - GFP_KERNEL); + (struct at76c503_command *)kmalloc(sizeof(struct at76c503_command) + + buf->size + 4, + GFP_KERNEL); if (cmd_buf) { cmd_buf->cmd = CMD_SET_MIB; cmd_buf->reserved = 0; cmd_buf->size = cpu_to_le16(buf->size + 4); memcpy(&(cmd_buf[1]), buf, buf->size + 4); - ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0), + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0e, DEVICE_VENDOR_REQUEST_OUT, 0, 0, cmd_buf, - sizeof(struct at76c503_command) + buf->size + 4, - USB_CTRL_GET_TIMEOUT); + sizeof(struct at76c503_command) + + buf->size + 4, USB_CTRL_GET_TIMEOUT); if (ret >= 0) - if ((ret=wait_completion(dev, CMD_SET_MIB)) != + if ((ret = wait_completion(dev, CMD_SET_MIB)) != CMD_STATUS_COMPLETE) { - info("%s: set_mib: wait_completion failed with %d", - dev->netdev->name, ret); - ret = -156; /* ??? */ + info("%s: set_mib: wait_completion failed with %d", dev->netdev->name, ret); + ret = -156; /* ??? */ } kfree(cmd_buf); return ret; @@ -943,7 +944,6 @@ static int set_radio(struct at76c503 *dev, int on_off) return ret; } - /** * set_pm_mode - sets power save mode * (PM_ACTIVE/PM_SAVE/PM_SMART_SAVE) @@ -1032,7 +1032,7 @@ static int set_frag(struct at76c503 *dev, u16 size) dev->mib_buf.type = MIB_MAC; dev->mib_buf.size = 2; dev->mib_buf.index = FRAGMENTATION_OFFSET; - *(__le16*)dev->mib_buf.data = cpu_to_le16(size); + *(__le16 *) dev->mib_buf.data = cpu_to_le16(size); ret = set_mib(dev, &dev->mib_buf); if (ret < 0) { err("%s: set_mib (frag threshold) failed: %d", dev->netdev->name, ret); @@ -1048,7 +1048,7 @@ static int set_rts(struct at76c503 *dev, u16 size) dev->mib_buf.type = MIB_MAC; dev->mib_buf.size = 2; dev->mib_buf.index = RTS_OFFSET; - *(__le16*)dev->mib_buf.data = cpu_to_le16(size); + *(__le16 *) dev->mib_buf.data = cpu_to_le16(size); ret = set_mib(dev, &dev->mib_buf); if (ret < 0) { err("%s: set_mib (rts) failed: %d", dev->netdev->name, ret); @@ -1074,19 +1074,19 @@ static int set_autorate_fallback(struct at76c503 *dev, int onoff) static int set_mac_address(struct at76c503 *dev, void *addr) { - int ret = 0; + int ret = 0; - memset(&dev->mib_buf, 0, sizeof(struct set_mib_buffer)); - dev->mib_buf.type = MIB_MAC_ADD; - dev->mib_buf.size = ETH_ALEN; - dev->mib_buf.index = offsetof(struct mib_mac_addr, mac_addr); - memcpy(dev->mib_buf.data, addr, ETH_ALEN); - ret = set_mib(dev, &dev->mib_buf); - if (ret < 0) { - err("%s: set_mib (MAC_ADDR, mac_addr) failed: %d", - dev->netdev->name, ret); - } - return ret; + memset(&dev->mib_buf, 0, sizeof(struct set_mib_buffer)); + dev->mib_buf.type = MIB_MAC_ADD; + dev->mib_buf.size = ETH_ALEN; + dev->mib_buf.index = offsetof(struct mib_mac_addr, mac_addr); + memcpy(dev->mib_buf.data, addr, ETH_ALEN); + ret = set_mib(dev, &dev->mib_buf); + if (ret < 0) { + err("%s: set_mib (MAC_ADDR, mac_addr) failed: %d", + dev->netdev->name, ret); + } + return ret; } #if 0 @@ -1094,33 +1094,34 @@ static int set_mac_address(struct at76c503 *dev, void *addr) May still be useful for multicast eventually. */ static int set_group_address(struct at76c503 *dev, u8 *addr, int n) { - int ret = 0; - - memset(&dev->mib_buf, 0, sizeof(struct set_mib_buffer)); - dev->mib_buf.type = MIB_MAC_ADD; - dev->mib_buf.size = ETH_ALEN; - dev->mib_buf.index = offsetof(struct mib_mac_addr, group_addr) + n*ETH_ALEN; - memcpy(dev->mib_buf.data, addr, ETH_ALEN); - ret = set_mib(dev, &dev->mib_buf); - if (ret < 0) { - err("%s: set_mib (MIB_MAC_ADD, group_addr) failed: %d", - dev->netdev->name, ret); - } + int ret = 0; + memset(&dev->mib_buf, 0, sizeof(struct set_mib_buffer)); + dev->mib_buf.type = MIB_MAC_ADD; + dev->mib_buf.size = ETH_ALEN; + dev->mib_buf.index = + offsetof(struct mib_mac_addr, group_addr) + n * ETH_ALEN; + memcpy(dev->mib_buf.data, addr, ETH_ALEN); + ret = set_mib(dev, &dev->mib_buf); + if (ret < 0) { + err("%s: set_mib (MIB_MAC_ADD, group_addr) failed: %d", + dev->netdev->name, ret); + } #if 1 /* I do not know anything about the group_addr_status field... (oku) */ - memset(&dev->mib_buf, 0, sizeof(struct set_mib_buffer)); - dev->mib_buf.type = MIB_MAC_ADD; - dev->mib_buf.size = 1; - dev->mib_buf.index = offsetof(struct mib_mac_addr, group_addr_status) + n; - dev->mib_buf.data[0] = 1; - ret = set_mib(dev, &dev->mib_buf); - if (ret < 0) { - err("%s: set_mib (MIB_MAC_ADD, group_addr_status) failed: %d", - dev->netdev->name, ret); - } + memset(&dev->mib_buf, 0, sizeof(struct set_mib_buffer)); + dev->mib_buf.type = MIB_MAC_ADD; + dev->mib_buf.size = 1; + dev->mib_buf.index = + offsetof(struct mib_mac_addr, group_addr_status) + n; + dev->mib_buf.data[0] = 1; + ret = set_mib(dev, &dev->mib_buf); + if (ret < 0) { + err("%s: set_mib (MIB_MAC_ADD, group_addr_status) failed: %d", + dev->netdev->name, ret); + } #endif - return ret; + return ret; } #endif @@ -1144,17 +1145,18 @@ static int dump_mib_mac_addr(struct at76c503 *dev) { int ret = 0; struct mib_mac_addr *mac_addr = - kmalloc(sizeof(struct mib_mac_addr), GFP_KERNEL); + kmalloc(sizeof(struct mib_mac_addr), GFP_KERNEL); if (!mac_addr) { ret = -ENOMEM; goto exit; } - + ret = get_mib(dev->udev, MIB_MAC_ADD, - (u8*)mac_addr, sizeof(struct mib_mac_addr)); + (u8 *) mac_addr, sizeof(struct mib_mac_addr)); if (ret < 0) { - err("%s: get_mib (MAC_ADDR) failed: %d", dev->netdev->name, ret); + err("%s: get_mib (MAC_ADDR) failed: %d", dev->netdev->name, + ret); goto err; } @@ -1176,13 +1178,12 @@ static int dump_mib_mac_wep(struct at76c503 *dev) { int ret = 0; struct mib_mac_wep *mac_wep = - kmalloc(sizeof(struct mib_mac_wep), GFP_KERNEL); + kmalloc(sizeof(struct mib_mac_wep), GFP_KERNEL); if (!mac_wep) { ret = -ENOMEM; goto exit; } - ret = get_mib(dev->udev, MIB_MAC_WEP, (u8*)mac_wep, sizeof(struct mib_mac_wep)); if (ret < 0) { @@ -1191,17 +1192,25 @@ static int dump_mib_mac_wep(struct at76c503 *dev) } dbg_uc("%s: MIB MAC_WEP: priv_invoked %u def_key_id %u key_len %u " - "excl_unencr %u wep_icv_err %u wep_excluded %u encr_level %u key %d: %s", - dev->netdev->name, mac_wep->privacy_invoked, - mac_wep->wep_default_key_id, mac_wep->wep_key_mapping_len, - mac_wep->exclude_unencrypted,le32_to_cpu( mac_wep->wep_icv_error_count), - le32_to_cpu(mac_wep->wep_excluded_count), - mac_wep->encryption_level, mac_wep->wep_default_key_id, - mac_wep->wep_default_key_id < 4 ? - hex2str(dev->obuf, - mac_wep->wep_default_keyvalue[mac_wep->wep_default_key_id], - min((int)(sizeof(dev->obuf)-1)/2, - mac_wep->encryption_level == 2 ? 13 : 5), '\0') : + "excl_unencr %u wep_icv_err %u wep_excluded %u encr_level %u key %d: %s", + dev->netdev->name, mac_wep->privacy_invoked, + mac_wep->wep_default_key_id, mac_wep->wep_key_mapping_len, + mac_wep->exclude_unencrypted, + le32_to_cpu(mac_wep->wep_icv_error_count), + le32_to_cpu(mac_wep->wep_excluded_count), + mac_wep->encryption_level, mac_wep->wep_default_key_id, + mac_wep->wep_default_key_id < 4 ? hex2str(dev->obuf, + mac_wep-> + wep_default_keyvalue + [mac_wep-> + wep_default_key_id], + min((int) + (sizeof(dev->obuf) + - 1) / 2, + mac_wep-> + encryption_level == + 2 ? 13 : 5), + '\0') : "<invalid key id>"); err: @@ -1214,14 +1223,13 @@ static int dump_mib_mac_mgmt(struct at76c503 *dev) { int ret = 0; struct mib_mac_mgmt *mac_mgmt = - kmalloc(sizeof(struct mib_mac_mgmt), GFP_KERNEL); + kmalloc(sizeof(struct mib_mac_mgmt), GFP_KERNEL); char country_string[4]; if (!mac_mgmt) { ret = -ENOMEM; goto exit; } - ret = get_mib(dev->udev, MIB_MAC_MGMT, (u8*)mac_mgmt, sizeof(struct mib_mac_mgmt)); if (ret < 0) { @@ -1250,8 +1258,8 @@ static int dump_mib_mac_mgmt(struct at76c503 *dev) mac_mgmt->DTIM_period, mac_mgmt->CFP_period, mac2str(mac_mgmt->current_bssid), - hex2str(dev->obuf, (u8 *)mac_mgmt->current_essid, - min((int)(sizeof(dev->obuf)-1)/2, + hex2str(dev->obuf, (u8 *) mac_mgmt->current_essid, + min((int)(sizeof(dev->obuf) - 1) / 2, IW_ESSID_MAX_SIZE), '\0'), mac_mgmt->current_bss_type, mac_mgmt->power_mgmt_mode, @@ -1269,8 +1277,7 @@ static int dump_mib_mac_mgmt(struct at76c503 *dev) static int dump_mib_mac(struct at76c503 *dev) { int ret = 0; - struct mib_mac *mac = - kmalloc(sizeof(struct mib_mac), GFP_KERNEL); + struct mib_mac *mac = kmalloc(sizeof(struct mib_mac), GFP_KERNEL); if (!mac) { ret = -ENOMEM; @@ -1305,12 +1312,11 @@ static int dump_mib_mac(struct at76c503 *dev) le16_to_cpu(mac->min_channel_time), le16_to_cpu(mac->max_channel_time), le16_to_cpu(mac->listen_interval), - hex2str(dev->obuf, mac->desired_ssid, - min((int)(sizeof(dev->obuf)-1)/2, + hex2str(dev->obuf, mac->desired_ssid, + min((int)(sizeof(dev->obuf) - 1) / 2, IW_ESSID_MAX_SIZE), '\0'), - mac2str(mac->desired_bssid), - mac->desired_bsstype); - err: + mac2str(mac->desired_bssid), mac->desired_bsstype); + err: kfree(mac); exit: return ret; @@ -1319,16 +1325,14 @@ static int dump_mib_mac(struct at76c503 *dev) static int dump_mib_phy(struct at76c503 *dev) { int ret = 0; - struct mib_phy *phy = - kmalloc(sizeof(struct mib_phy), GFP_KERNEL); + struct mib_phy *phy = kmalloc(sizeof(struct mib_phy), GFP_KERNEL); if (!phy) { ret = -ENOMEM; goto exit; } - - ret = get_mib(dev->udev, MIB_PHY, - (u8*)phy, sizeof(struct mib_phy)); + + ret = get_mib(dev->udev, MIB_PHY, (u8*) phy, sizeof(struct mib_phy)); if (ret < 0) { err("%s: get_mib failed: %d", dev->netdev->name, ret); goto err; @@ -1350,9 +1354,7 @@ static int dump_mib_phy(struct at76c503 *dev) phy->operation_rate_set[0], phy->operation_rate_set[1], phy->operation_rate_set[2], phy->operation_rate_set[3], phy->channel_id, - phy->current_cca_mode, - phy->phy_type, - phy->current_reg_domain); + phy->current_cca_mode, phy->phy_type, phy->current_reg_domain); err: kfree(phy); exit: @@ -1362,14 +1364,13 @@ static int dump_mib_phy(struct at76c503 *dev) static int dump_mib_local(struct at76c503 *dev) { int ret = 0; - struct mib_local *local = - kmalloc(sizeof(struct mib_phy), GFP_KERNEL); + struct mib_local *local = kmalloc(sizeof(struct mib_phy), GFP_KERNEL); if (!local) { ret = -ENOMEM; goto exit; } - + ret = get_mib(dev->udev, MIB_LOCAL, (u8*)local, sizeof(struct mib_local)); if (ret < 0) { @@ -1382,27 +1383,24 @@ static int dump_mib_local(struct at76c503 *dev) dev->netdev->name, local->beacon_enable, local->txautorate_fallback, - local->ssid_size, - local->promiscuous_mode, - local->preamble_type); + local->ssid_size, local->promiscuous_mode, local->preamble_type); err: kfree(local); exit: return ret; } - static int get_mib_mdomain(struct at76c503 *dev, struct mib_mdomain *val) { int ret = 0; struct mib_mdomain *mdomain = - kmalloc(sizeof(struct mib_mdomain), GFP_KERNEL); + kmalloc(sizeof(struct mib_mdomain), GFP_KERNEL); if (!mdomain) { ret = -ENOMEM; goto exit; } - + ret = get_mib(dev->udev, MIB_MDOMAIN, (u8*)mdomain, sizeof(struct mib_mdomain)); if (ret < 0) { @@ -1429,13 +1427,13 @@ static void dump_mib_mdomain(struct at76c503 *dev) err("%s: get_mib_mdomain returned %d", __FUNCTION__, ret); return; } - + dbg(DBG_MIB, "%s: MIB MDOMAIN: channel_list %s tx_powerlevel %s", dev->netdev->name, hex2str(obuf1, mdomain.channel_list, - (sizeof(obuf1)-1)/2,'\0'), + (sizeof(obuf1) - 1) / 2, '\0'), hex2str(obuf2, mdomain.tx_powerlevel, - (sizeof(obuf2)-1)/2,'\0')); + (sizeof(obuf2) - 1) / 2, '\0')); } static @@ -1443,13 +1441,13 @@ int get_current_bssid(struct at76c503 *dev) { int ret = 0; struct mib_mac_mgmt *mac_mgmt = - kmalloc(sizeof(struct mib_mac_mgmt), GFP_KERNEL); + kmalloc(sizeof(struct mib_mac_mgmt), GFP_KERNEL); if (!mac_mgmt) { ret = -ENOMEM; goto exit; } - + ret = get_mib(dev->udev, MIB_MAC_MGMT, (u8*)mac_mgmt, sizeof(struct mib_mac_mgmt)); if (ret < 0) { @@ -1467,15 +1465,13 @@ int get_current_bssid(struct at76c503 *dev) static int get_current_channel(struct at76c503 *dev) { int ret = 0; - struct mib_phy *phy = - kmalloc(sizeof(struct mib_phy), GFP_KERNEL); + struct mib_phy *phy = kmalloc(sizeof(struct mib_phy), GFP_KERNEL); if (!phy) { ret = -ENOMEM; goto exit; } - ret = get_mib(dev->udev, MIB_PHY, (u8*)phy, - sizeof(struct mib_phy)); + ret = get_mib(dev->udev, MIB_PHY, (u8*) phy, sizeof(struct mib_phy)); if (ret < 0) { err("%s: get_mib(MIB_PHY) failed: %d", dev->netdev->name, ret); goto err; @@ -1511,9 +1507,9 @@ static int start_scan(struct at76c503 *dev, int use_essid, int ir_step) scan.channel = dev->channel; /* atmelwlandriver differs between scan type 0 and 1 (active/passive) - For ad-hoc mode, it uses type 0 only.*/ + For ad-hoc mode, it uses type 0 only. */ if ((dev->international_roaming == IR_ON && ir_step == 0) || - dev->iw_mode == IW_MODE_MONITOR) + dev->iw_mode == IW_MODE_MONITOR) scan.scan_type = SCAN_TYPE_PASSIVE; else scan.scan_type = dev->scan_mode; @@ -1547,7 +1543,7 @@ static int start_scan(struct at76c503 *dev, int use_essid, int ir_step) le16_to_cpu(scan.max_channel_time)); return set_card_command(dev->udev, CMD_SCAN, - (unsigned char*)&scan, sizeof(scan)); + (unsigned char *)&scan, sizeof(scan)); } static int start_ibss(struct at76c503 *dev) @@ -1581,12 +1577,12 @@ static int join_bss(struct at76c503 *dev, struct bss_info *ptr) join.timeout = cpu_to_le16(2000); dbg(DBG_PROGRESS, "%s join addr %s ssid %s type %d ch %d timeout %d", - dev->netdev->name, mac2str(join.bssid), + dev->netdev->name, mac2str(join.bssid), join.essid, join.bss_type, join.channel, le16_to_cpu(join.timeout)); return set_card_command(dev->udev, CMD_JOIN, (unsigned char*)&join, sizeof(struct at76c503_join)); -} /* join_bss */ +} /* the firmware download timeout (after remap) */ static void fw_dl_timeout(unsigned long par) @@ -1595,7 +1591,6 @@ static void fw_dl_timeout(unsigned long par) defer_kevent(dev, KEVENT_RESET_DEVICE); } - /* the restart timer timed out */ static void restart_timeout(unsigned long par) { @@ -1618,18 +1613,19 @@ static void bss_list_timeout(unsigned long par) ptr = list_entry(lptr, struct bss_info, list); if (ptr != dev->curr_bss && ptr != dev->new_bss && - time_after(jiffies, ptr->last_rx+BSS_LIST_TIMEOUT)) { + time_after(jiffies, ptr->last_rx + BSS_LIST_TIMEOUT)) { dbg(DBG_BSS_TABLE_RM, "%s: bss_list: removing old BSS %s ch %d", - dev->netdev->name, mac2str(ptr->bssid), ptr->channel); + dev->netdev->name, mac2str(ptr->bssid), + ptr->channel); list_del(&ptr->list); kfree(ptr); } } spin_unlock_irqrestore(&dev->bss_list_spinlock, flags); /* restart the timer */ - mod_timer(&dev->bss_list_timer, jiffies+BSS_LIST_TIMEOUT); - + mod_timer(&dev->bss_list_timer, jiffies + BSS_LIST_TIMEOUT); + } /* we got a timeout for a infrastructure mgmt packet */ @@ -1650,8 +1646,8 @@ static void handle_mgmt_timeout_scan(struct at76c503 *dev) if ((status = get_cmd_status(dev->udev, CMD_SCAN)) < 0) { err("%s: %s: get_cmd_status failed with %d", dev->netdev->name, __FUNCTION__, status); - status = CMD_STATUS_IN_PROGRESS; - /* INFO: Hope it was a one off error - if not, scanning + status = CMD_STATUS_IN_PROGRESS; + /* INFO: Hope it was a one off error - if not, scanning further down the line and stop this cycle */ } dbg(DBG_PROGRESS, "%s %s:%d got cmd_status %d (istate %d, " @@ -1660,7 +1656,7 @@ static void handle_mgmt_timeout_scan(struct at76c503 *dev) dev->istate, dev->scan_runs); if (status == CMD_STATUS_COMPLETE) { if (dev->istate == SCANNING) { - dump_bss_table(dev,0); + dump_bss_table(dev, 0); switch (dev->scan_runs) { case 1: @@ -1722,11 +1718,11 @@ static void handle_mgmt_timeout_scan(struct at76c503 *dev) mod_timer(&dev->mgmt_timer, jiffies + SCAN_POLL_INTERVAL); } - } else { + } else { if ((status != CMD_STATUS_IN_PROGRESS) && (status != CMD_STATUS_IDLE)) - err("%s: %s: Bad scan status: %s", - dev->netdev->name, __FUNCTION__, + err("%s: %s: Bad scan status: %s", + dev->netdev->name, __FUNCTION__, get_cmd_status_string(status)); /* the first cmd status after scan start is always a IDLE -> @@ -1740,16 +1736,16 @@ static void handle_mgmt_timeout_scan(struct at76c503 *dev) /* the deferred procedure called from kevent() */ static void handle_mgmt_timeout(struct at76c503 *dev) { - if ((dev->istate != SCANNING && dev->istate != MONITORING) || - (at76_debug & DBG_MGMT_TIMER)) + if ((dev->istate != SCANNING && dev->istate != MONITORING) || + (at76_debug & DBG_MGMT_TIMER)) /* this is normal behavior in states MONITORING, SCANNING ... */ dbg(DBG_PROGRESS, "%s: timeout, state %d", dev->netdev->name, dev->istate); - switch(dev->istate) { + switch (dev->istate) { case MONITORING: - case SCANNING: + case SCANNING: handle_mgmt_timeout_scan(dev); break; @@ -1757,8 +1753,8 @@ static void handle_mgmt_timeout(struct at76c503 *dev) assert(0); break; - case CONNECTED: /* we haven't received the beacon of this BSS for - BEACON_TIMEOUT seconds */ + case CONNECTED: /* we haven't received the beacon of this BSS for + BEACON_TIMEOUT seconds */ info("%s: lost beacon bssid %s", dev->netdev->name, mac2str(dev->curr_bss->bssid)); /* jal: starting mgmt_timer in ad-hoc mode is questionable, @@ -1768,7 +1764,7 @@ static void handle_mgmt_timeout(struct at76c503 *dev) netif_stop_queue(dev->netdev); iwevent_bss_disconnect(dev->netdev); dev->istate = SCANNING; - defer_kevent(dev,KEVENT_SCAN); + defer_kevent(dev, KEVENT_SCAN); } break; @@ -1777,20 +1773,20 @@ static void handle_mgmt_timeout(struct at76c503 *dev) auth_req(dev, dev->curr_bss, 1, NULL); dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", __FUNCTION__, __LINE__); - mod_timer(&dev->mgmt_timer, jiffies+HZ); + mod_timer(&dev->mgmt_timer, jiffies + HZ); } else { /* try to get next matching BSS */ dev->istate = JOINING; - defer_kevent(dev,KEVENT_JOIN); + defer_kevent(dev, KEVENT_JOIN); } break; case ASSOCIATING: if (dev->retries-- >= 0) { - assoc_req(dev,dev->curr_bss); + assoc_req(dev, dev->curr_bss); dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", __FUNCTION__, __LINE__); - mod_timer(&dev->mgmt_timer, jiffies+HZ); + mod_timer(&dev->mgmt_timer, jiffies + HZ); } else { /* jal: TODO: we may be authenticated to several BSS and may try to associate to the next of them here @@ -1798,7 +1794,7 @@ static void handle_mgmt_timeout(struct at76c503 *dev) /* try to get next matching BSS */ dev->istate = JOINING; - defer_kevent(dev,KEVENT_JOIN); + defer_kevent(dev, KEVENT_JOIN); } break; @@ -1814,7 +1810,7 @@ static void handle_mgmt_timeout(struct at76c503 *dev) } dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", __FUNCTION__, __LINE__); - mod_timer(&dev->mgmt_timer, jiffies+HZ); + mod_timer(&dev->mgmt_timer, jiffies + HZ); break; case DISASSOCIATING: @@ -1822,11 +1818,11 @@ static void handle_mgmt_timeout(struct at76c503 *dev) disassoc_req(dev, dev->curr_bss); dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", __FUNCTION__, __LINE__); - mod_timer(&dev->mgmt_timer,jiffies+HZ); + mod_timer(&dev->mgmt_timer, jiffies + HZ); } else { /* we scan again ... */ dev->istate = SCANNING; - defer_kevent(dev,KEVENT_SCAN); + defer_kevent(dev, KEVENT_SCAN); } break; @@ -1837,7 +1833,7 @@ static void handle_mgmt_timeout(struct at76c503 *dev) assert(0); } /* switch (dev->istate) */ -}/* handle_mgmt_timeout */ +} /* calc. the padding from txbuf->wlength (which excludes the USB TX header) guess this is needed to compensate a flaw in the AT76C503A USB part ... */ @@ -1851,7 +1847,7 @@ static inline int calc_padding(int wlen) if (wlen < 50) return 50 - wlen; - if (wlen >=61) + if (wlen >= 61) return 64 + 50 - wlen; return 0; @@ -1859,20 +1855,21 @@ static inline int calc_padding(int wlen) /* send a management frame on bulk-out. txbuf->wlength must be set (in LE format !) */ -static int send_mgmt_bulk(struct at76c503 *dev, struct at76c503_tx_buffer *txbuf) +static int send_mgmt_bulk(struct at76c503 *dev, + struct at76c503_tx_buffer *txbuf) { unsigned long flags; int ret = 0; int urb_status; void *oldbuf = NULL; - netif_carrier_off(dev->netdev); /* disable running netdev watchdog */ - netif_stop_queue(dev->netdev); /* stop tx data packets */ + netif_carrier_off(dev->netdev); /* disable running netdev watchdog */ + netif_stop_queue(dev->netdev); /* stop tx data packets */ spin_lock_irqsave(&dev->mgmt_spinlock, flags); - if ((urb_status=dev->write_urb->status) == -EINPROGRESS) { - oldbuf=dev->next_mgmt_bulk; /* to kfree below */ + if ((urb_status = dev->write_urb->status) == -EINPROGRESS) { + oldbuf = dev->next_mgmt_bulk; /* to kfree below */ dev->next_mgmt_bulk = txbuf; txbuf = NULL; } @@ -1884,8 +1881,8 @@ static int send_mgmt_bulk(struct at76c503 *dev, struct at76c503_tx_buffer *txbuf implement a queue or silently modify the old msg */ err("%s: %s removed pending mgmt buffer %s", dev->netdev->name, __FUNCTION__, - hex2str(dev->obuf, (u8 *)dev->next_mgmt_bulk, - min((int)(sizeof(dev->obuf))/3, 64),' ')); + hex2str(dev->obuf, (u8 *) dev->next_mgmt_bulk, + min((int)(sizeof(dev->obuf)) / 3, 64), ' ')); kfree(dev->next_mgmt_bulk); } @@ -1903,34 +1900,36 @@ static int send_mgmt_bulk(struct at76c503 *dev, struct at76c503_tx_buffer *txbuf dev->netdev->name, le16_to_cpu(txbuf->wlength), txbuf->tx_rate, txbuf->padding, hex2str(dev->obuf, txbuf->packet, - min((sizeof(dev->obuf)-1)/2, - (size_t)le16_to_cpu(txbuf->wlength)),'\0')); + min((sizeof(dev->obuf) - 1) / 2, + (size_t) le16_to_cpu(txbuf->wlength)), '\0')); /* txbuf was not consumed above -> send mgmt msg immediately */ memcpy(dev->bulk_out_buffer, txbuf, le16_to_cpu(txbuf->wlength) + AT76C503_TX_HDRLEN); usb_fill_bulk_urb(dev->write_urb, dev->udev, - usb_sndbulkpipe(dev->udev, - dev->bulk_out_endpointAddr), - dev->bulk_out_buffer, - le16_to_cpu(txbuf->wlength) + - txbuf->padding + - AT76C503_TX_HDRLEN, - (usb_complete_t)at76c503_write_bulk_callback, dev); + usb_sndbulkpipe(dev->udev, + dev->bulk_out_endpointAddr), + dev->bulk_out_buffer, + le16_to_cpu(txbuf->wlength) + + txbuf->padding + + AT76C503_TX_HDRLEN, + (usb_complete_t) at76c503_write_bulk_callback, + dev); ret = usb_submit_urb(dev->write_urb, GFP_ATOMIC); if (ret) { err("%s: %s error in tx submit urb: %d", dev->netdev->name, __FUNCTION__, ret); } kfree(txbuf); - } /* if (txbuf) */ - + } + /* if (txbuf) */ return ret; -} /* send_mgmt_bulk */ +} /* Go to the next information element */ -static inline void next_ie(struct ieee80211_info_element **ie) { +static inline void next_ie(struct ieee80211_info_element **ie) +{ *ie = (struct ieee80211_info_element *)(&(*ie)->data[(*ie)->len]); } @@ -1944,8 +1943,7 @@ static int disassoc_req(struct at76c503 *dev, struct bss_info *bss) if (bss == NULL) return -EFAULT; - tx_buffer = kmalloc(DISASSOC_FRAME_SIZE + MAX_PADDING_SIZE, - GFP_ATOMIC); + tx_buffer = kmalloc(DISASSOC_FRAME_SIZE + MAX_PADDING_SIZE, GFP_ATOMIC); if (!tx_buffer) return -ENOMEM; @@ -1964,16 +1962,16 @@ static int disassoc_req(struct at76c503 *dev, struct bss_info *bss) /* init. at76c503 tx header */ tx_buffer->wlength = cpu_to_le16(DISASSOC_FRAME_SIZE - - AT76C503_TX_HDRLEN); - + AT76C503_TX_HDRLEN); + dbg(DBG_TX_MGMT, "%s: DisAssocReq bssid %s", dev->netdev->name, mac2str(mgmt->addr3)); /* either send immediately (if no data tx is pending or put it in pending list */ - return send_mgmt_bulk(dev, tx_buffer); + return send_mgmt_bulk(dev, tx_buffer); -} /* disassoc_req */ +} /* challenge is the challenge string (in TLV format) we got with seq_nr 2 for shared secret authentication only and @@ -1985,13 +1983,11 @@ static int auth_req(struct at76c503 *dev, struct bss_info *bss, int seq_nr, struct at76c503_tx_buffer *tx_buffer; struct ieee80211_hdr_3addr *mgmt; struct ieee80211_auth *req; - - int buf_len = (seq_nr != 3 ? AUTH_FRAME_SIZE : + int buf_len = (seq_nr != 3 ? AUTH_FRAME_SIZE : AUTH_FRAME_SIZE + 1 + 1 + challenge->len); assert(bss != NULL); assert(seq_nr != 3 || challenge != NULL); - tx_buffer = kmalloc(buf_len + MAX_PADDING_SIZE, GFP_ATOMIC); if (!tx_buffer) return -ENOMEM; @@ -2015,26 +2011,25 @@ static int auth_req(struct at76c503 *dev, struct bss_info *bss, int seq_nr, req->status = cpu_to_le16(0); if (seq_nr == 3) - memcpy(req->info_element, challenge, 1+1+challenge->len); + memcpy(req->info_element, challenge, 1 + 1 + challenge->len); /* init. at76c503 tx header */ tx_buffer->wlength = cpu_to_le16(buf_len - AT76C503_TX_HDRLEN); - dbg(DBG_TX_MGMT, "%s: AuthReq bssid %s alg %d seq_nr %d", dev->netdev->name, mac2str(mgmt->addr3), le16_to_cpu(req->algorithm), le16_to_cpu(req->transaction)); if (seq_nr == 3) { dbg(DBG_TX_MGMT, "%s: AuthReq challenge: %s ...", dev->netdev->name, - hex2str(dev->obuf, (u8 *)req->info_element, - min((int)sizeof(dev->obuf)/3, 18),' ')); + hex2str(dev->obuf, (u8 *) req->info_element, + min((int)sizeof(dev->obuf) / 3, 18), ' ')); } /* either send immediately (if no data tx is pending or put it in pending list */ - return send_mgmt_bulk(dev, tx_buffer); + return send_mgmt_bulk(dev, tx_buffer); -} /* auth_req */ +} static int assoc_req(struct at76c503 *dev, struct bss_info *bss) { @@ -2045,8 +2040,7 @@ static int assoc_req(struct at76c503 *dev, struct bss_info *bss) assert(bss != NULL); - tx_buffer = kmalloc(ASSOCREQ_MAX_SIZE + MAX_PADDING_SIZE, - GFP_ATOMIC); + tx_buffer = kmalloc(ASSOCREQ_MAX_SIZE + MAX_PADDING_SIZE, GFP_ATOMIC); if (!tx_buffer) return -ENOMEM; @@ -2067,13 +2061,13 @@ static int assoc_req(struct at76c503 *dev, struct bss_info *bss) Agere-based AP with optional WEP transmits encrypted frames to us. AP only set the Privacy bit in their capabilities if WEP is mandatory in the BSS! */ - req->capability = cpu_to_le16(bss->capa | + req->capability = cpu_to_le16(bss->capa | (dev->wep_enabled ? WLAN_CAPABILITY_PRIVACY : 0) | (dev->preamble_type == PREAMBLE_TYPE_SHORT ? WLAN_CAPABILITY_SHORT_PREAMBLE : 0)); req->listen_interval = cpu_to_le16(2 * bss->beacon_interval); - + /* write TLV data elements */ tlv->id = MFIE_TYPE_SSID; @@ -2084,14 +2078,14 @@ static int assoc_req(struct at76c503 *dev, struct bss_info *bss) tlv->id = MFIE_TYPE_RATES; tlv->len = sizeof(hw_rates); memcpy(tlv->data, hw_rates, sizeof(hw_rates)); - next_ie(&tlv); /* tlv points behind the supp_rates field */ + next_ie(&tlv); /* tlv points behind the supp_rates field */ /* init. at76c503 tx header */ - tx_buffer->wlength = cpu_to_le16((u8 *)tlv-(u8 *)mgmt); - + tx_buffer->wlength = cpu_to_le16((u8 *) tlv - (u8 *) mgmt); + { /* output buffer for ssid and rates */ - char orates[4*2+1]; + char orates[4 * 2 + 1]; int len; tlv = req->info_element; @@ -2108,14 +2102,14 @@ static int assoc_req(struct at76c503 *dev, struct bss_info *bss) /* either send immediately (if no data tx is pending or put it in pending list */ - return send_mgmt_bulk(dev, tx_buffer); + return send_mgmt_bulk(dev, tx_buffer); -} /* assoc_req */ +} /* we are currently associated to curr_bss and want to reassoc to new_bss */ static int reassoc_req(struct at76c503 *dev, struct bss_info *curr_bss, - struct bss_info *new_bss) + struct bss_info *new_bss) { struct at76c503_tx_buffer *tx_buffer; struct ieee80211_hdr_3addr *mgmt; @@ -2127,8 +2121,7 @@ static int reassoc_req(struct at76c503 *dev, struct bss_info *curr_bss, if (curr_bss == NULL || new_bss == NULL) return -EFAULT; - tx_buffer = kmalloc(REASSOCREQ_MAX_SIZE + MAX_PADDING_SIZE, - GFP_ATOMIC); + tx_buffer = kmalloc(REASSOCREQ_MAX_SIZE + MAX_PADDING_SIZE, GFP_ATOMIC); if (!tx_buffer) return -ENOMEM; @@ -2155,7 +2148,7 @@ static int reassoc_req(struct at76c503 *dev, struct bss_info *curr_bss, WLAN_CAPABILITY_SHORT_PREAMBLE : 0)); req->listen_interval = cpu_to_le16(2 * new_bss->beacon_interval); - + memcpy(req->current_ap, curr_bss->bssid, ETH_ALEN); /* write TLV data elements */ @@ -2191,18 +2184,17 @@ static int reassoc_req(struct at76c503 *dev, struct bss_info *curr_bss, /* either send immediately (if no data tx is pending or put it in pending list */ - return send_mgmt_bulk(dev, tx_buffer); - -} /* reassoc_req */ + return send_mgmt_bulk(dev, tx_buffer); +} /* shamelessly copied from usbnet.c (oku) */ -static void defer_kevent (struct at76c503 *dev, int flag) +static void defer_kevent(struct at76c503 *dev, int flag) { - set_bit (flag, &dev->kevent_flags); - if (!schedule_work (&dev->kevent)) + set_bit(flag, &dev->kevent_flags); + if (!schedule_work(&dev->kevent)) dbg(DBG_KEVENT, "%s: kevent %d may have been dropped", - dev->netdev->name, flag); + dev->netdev->name, flag); else dbg(DBG_KEVENT, "%s: kevent %d scheduled", dev->netdev->name, flag); @@ -2230,7 +2222,7 @@ static void kevent(struct work_struct *work) usb_sndctrlpipe (dev->udev, 0)); if (ret < 0) err("usb_clear_halt() failed: %d", ret); - else{ + else { clear_bit(KEVENT_CTRL_HALT, &dev->kevent_flags); info("usb_clear_halt() successful"); } @@ -2249,7 +2241,7 @@ static void kevent(struct work_struct *work) dbg(DBG_PROGRESS, "ibss_change = 0x%2x", mac_mgmt.ibss_change); memcpy(dev->bssid, mac_mgmt.current_bssid, ETH_ALEN); dbg(DBG_PROGRESS, "using BSSID %s", mac2str(dev->bssid)); - + iwevent_bss_connect(dev->netdev, dev->bssid); memset(&dev->mib_buf, 0, sizeof(struct set_mib_buffer)); @@ -2262,7 +2254,7 @@ static void kevent(struct work_struct *work) goto new_bss_clean; } clear_bit(KEVENT_NEW_BSS, &dev->kevent_flags); - new_bss_clean: ; + new_bss_clean:; } if (test_bit(KEVENT_SET_PROMISC, &dev->kevent_flags)) { @@ -2290,10 +2282,12 @@ static void kevent(struct work_struct *work) } ret = get_current_bssid(dev); - if (ret < 0) goto end_startibss; + if (ret < 0) + goto end_startibss; ret = get_current_channel(dev); - if (ret < 0) goto end_startibss; + if (ret < 0) + goto end_startibss; /* not sure what this is good for ??? */ memset(&dev->mib_buf, 0, sizeof(struct set_mib_buffer)); @@ -2323,28 +2317,28 @@ end_startibss: /* secure the access to dev->curr_bss ! */ spin_lock_irqsave(&dev->bss_list_spinlock, flags); - dev->curr_bss=find_matching_bss(dev, dev->curr_bss); + dev->curr_bss = find_matching_bss(dev, dev->curr_bss); spin_unlock_irqrestore(&dev->bss_list_spinlock, flags); if (dev->curr_bss != NULL) { - if ((ret=join_bss(dev,dev->curr_bss)) < 0) { + if ((ret = join_bss(dev, dev->curr_bss)) < 0) { err("%s: join_bss failed with %d", dev->netdev->name, ret); goto end_join; } - - ret=wait_completion(dev,CMD_JOIN); + + ret = wait_completion(dev, CMD_JOIN); if (ret != CMD_STATUS_COMPLETE) { if (ret != CMD_STATUS_TIME_OUT) err("%s join_bss completed with %d", dev->netdev->name, ret); else info("%s join_bss ssid %s timed out", - dev->netdev->name, + dev->netdev->name, mac2str(dev->curr_bss->bssid)); /* retry next BSS immediately */ - defer_kevent(dev,KEVENT_JOIN); + defer_kevent(dev, KEVENT_JOIN); goto end_join; } @@ -2357,7 +2351,7 @@ end_startibss: memcpy(dev->essid, bptr->ssid, bptr->ssid_len); memcpy(dev->bssid, bptr->bssid, ETH_ALEN); dev->channel = bptr->channel; - iwevent_bss_connect(dev->netdev,bptr->bssid); + iwevent_bss_connect(dev->netdev, bptr->bssid); netif_carrier_on(dev->netdev); netif_start_queue(dev->netdev); /* just to be sure */ @@ -2368,15 +2362,15 @@ end_startibss: auth_req(dev, dev->curr_bss, 1, NULL); dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", __FUNCTION__, __LINE__); - mod_timer(&dev->mgmt_timer, jiffies+HZ); + mod_timer(&dev->mgmt_timer, jiffies + HZ); } goto end_join; - } /* if (dev->curr_bss != NULL) */ + } /* here we haven't found a matching (i)bss ... */ if (dev->iw_mode == IW_MODE_ADHOC) { dev->istate = STARTIBSS; - defer_kevent(dev,KEVENT_STARTIBSS); + defer_kevent(dev, KEVENT_STARTIBSS); goto end_join; } /* haven't found a matching BSS in infra mode - try again */ @@ -2417,7 +2411,6 @@ end_join: submit_rx_urb(dev); } - if (test_bit(KEVENT_RESTART, &dev->kevent_flags)) { clear_bit(KEVENT_RESTART, &dev->kevent_flags); #if 0 @@ -2432,17 +2425,19 @@ end_join: set_monitor_mode(dev, dev->monitor_prism_header); - netif_carrier_off(dev->netdev); /* disable running netdev watchdog */ - netif_stop_queue(dev->netdev); /* stop tx data packets */ + netif_carrier_off(dev->netdev); /* disable running netdev watchdog */ + netif_stop_queue(dev->netdev); /* stop tx data packets */ if (dev->iw_mode != IW_MODE_MONITOR) { dev->istate = SCANNING; - defer_kevent(dev,KEVENT_SCAN); + defer_kevent(dev, KEVENT_SCAN); } else { dev->istate = MONITORING; - start_scan(dev,0,0); - dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks", + start_scan(dev, 0, 0); + dbg(DBG_MGMT_TIMER, + "%s:%d: starting mgmt_timer for %d ticks", __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL); - mod_timer(&dev->mgmt_timer, jiffies + SCAN_POLL_INTERVAL); + mod_timer(&dev->mgmt_timer, + jiffies + SCAN_POLL_INTERVAL); } } @@ -2452,23 +2447,22 @@ end_join: dev->istate == REASSOCIATING); if (dev->iw_mode == IW_MODE_INFRA) { assert(dev->curr_bss != NULL); - if (dev->curr_bss != NULL && - dev->pm_mode != PM_ACTIVE) { + if (dev->curr_bss != NULL && dev->pm_mode != PM_ACTIVE) { /* calc the listen interval in units of beacon intervals of the curr_bss */ - dev->pm_period_beacon = (dev->pm_period_us >> 10) / - dev->curr_bss->beacon_interval; + dev->pm_period_beacon = + (dev->pm_period_us >> 10) / + dev->curr_bss->beacon_interval; -#ifdef DEBUG /* only to check if we need to set the listen interval here - or could do it in the (re)assoc_req parameter */ +#ifdef DEBUG /* only to check if we need to set the listen interval here + or could do it in the (re)assoc_req parameter */ dump_mib_mac(dev); #endif if (dev->pm_period_beacon < 2) dev->pm_period_beacon = 2; - else - if ( dev->pm_period_beacon > 0xffff) - dev->pm_period_beacon = 0xffff; + else if (dev->pm_period_beacon > 0xffff) + dev->pm_period_beacon = 0xffff; dbg(DBG_PM, "%s: pm_mode %d assoc id x%x listen int %d", dev->netdev->name, dev->pm_mode, @@ -2485,14 +2479,13 @@ end_join: } netif_carrier_on(dev->netdev); - netif_wake_queue(dev->netdev); /* _start_queue ??? */ + netif_wake_queue(dev->netdev); /* _start_queue ??? */ dev->istate = CONNECTED; - iwevent_bss_connect(dev->netdev,dev->curr_bss->bssid); + iwevent_bss_connect(dev->netdev, dev->curr_bss->bssid); dbg(DBG_PROGRESS, "%s: connected to BSSID %s", dev->netdev->name, mac2str(dev->curr_bss->bssid)); } - if (test_bit(KEVENT_RESET_DEVICE, &dev->kevent_flags)) { clear_bit(KEVENT_RESET_DEVICE, &dev->kevent_flags); @@ -2501,7 +2494,7 @@ end_join: usb_reset_device(dev->udev); - dev->istate = WAIT_FOR_DISCONNECT; + dev->istate = WAIT_FOR_DISCONNECT; } if (test_bit(KEVENT_EXTERNAL_FW, &dev->kevent_flags)) { @@ -2511,7 +2504,7 @@ end_join: op_mode = get_op_mode(dev->udev); dbg(DBG_DEVSTART, "opmode %d", op_mode); - + if (op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) { err("unexpected opmode %d", op_mode); goto end_external_fw; @@ -2528,7 +2521,7 @@ end_join: info("200 ms delay for board type 7"); /* jal: can I do this in kevent ??? */ set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(HZ/5+1); + schedule_timeout(HZ / 5 + 1); } } dev->istate = INIT; @@ -2541,27 +2534,28 @@ end_external_fw: dbg(DBG_DEVSTART, "downloading internal firmware"); - ret=usbdfu_download(dev->udev, dev->intfw, - dev->intfw_size, - dev->board_type == BOARDTYPE_505A_RFMD_2958 ? 2000: 0); + ret = usbdfu_download(dev->udev, dev->intfw, + dev->intfw_size, + dev->board_type == + BOARDTYPE_505A_RFMD_2958 ? 2000 : 0); if (ret < 0) { - err("downloading internal fw failed with %d",ret); + err("downloading internal fw failed with %d", ret); goto end_internal_fw; } - + dbg(DBG_DEVSTART, "sending REMAP"); /* no REMAP for 505A (see SF driver) */ if (dev->board_type != BOARDTYPE_505A_RFMD_2958) - if ((ret=at76c503_remap(dev->udev)) < 0) { - err("sending REMAP failed with %d",ret); + if ((ret = at76c503_remap(dev->udev)) < 0) { + err("sending REMAP failed with %d", ret); goto end_internal_fw; } dbg(DBG_DEVSTART, "sleeping for 2 seconds"); dev->istate = EXTFW_DOWNLOAD; - mod_timer(&dev->fw_dl_timer, jiffies+2*HZ+1); + mod_timer(&dev->fw_dl_timer, jiffies + 2 * HZ + 1); } end_internal_fw: @@ -2577,7 +2571,7 @@ static int essid_matched(struct at76c503 *dev, struct bss_info *ptr) { /* common criteria for both modi */ - int retval = (dev->essid_size == 0 /* ANY ssid */ || + int retval = (dev->essid_size == 0 /* ANY ssid */ || (dev->essid_size == ptr->ssid_len && !memcmp(dev->essid, ptr->ssid, ptr->ssid_len))); if (!retval) @@ -2591,9 +2585,9 @@ static inline int mode_matched(struct at76c503 *dev, struct bss_info *ptr) int retval; if (dev->iw_mode == IW_MODE_ADHOC) - retval = ptr->capa & WLAN_CAPABILITY_IBSS; + retval = ptr->capa & WLAN_CAPABILITY_IBSS; else - retval = ptr->capa & WLAN_CAPABILITY_ESS; + retval = ptr->capa & WLAN_CAPABILITY_ESS; if (!retval) dbg(DBG_BSS_MATCH, "%s bss table entry %p: mode didn't match", dev->netdev->name, ptr); @@ -2605,15 +2599,17 @@ static int rates_matched(struct at76c503 *dev, struct bss_info *ptr) int i; u8 *rate; - for(i=0,rate=ptr->rates; i < ptr->rates_len; i++,rate++) + for (i = 0, rate = ptr->rates; i < ptr->rates_len; i++, rate++) if (*rate & 0x80) { /* this is a basic rate we have to support (see IEEE802.11, ch. 7.3.2.2) */ - if (*rate != (0x80|hw_rates[0]) && *rate != (0x80|hw_rates[1]) && - *rate != (0x80|hw_rates[2]) && *rate != (0x80|hw_rates[3])) { + if (*rate != (0x80 | hw_rates[0]) + && *rate != (0x80 | hw_rates[1]) + && *rate != (0x80 | hw_rates[2]) + && *rate != (0x80 | hw_rates[3])) { dbg(DBG_BSS_MATCH, "%s: bss table entry %p: basic rate %02x not supported", - dev->netdev->name, ptr, *rate); + dev->netdev->name, ptr, *rate); return 0; } } @@ -2629,8 +2625,7 @@ static int rates_matched(struct at76c503 *dev, struct bss_info *ptr) static inline int wep_matched(struct at76c503 *dev, struct bss_info *ptr) { - if (!dev->wep_enabled && - ptr->capa & WLAN_CAPABILITY_PRIVACY) { + if (!dev->wep_enabled && ptr->capa & WLAN_CAPABILITY_PRIVACY) { /* we have disabled WEP, but the BSS signals privacy */ dbg(DBG_BSS_MATCH, "%s: bss table entry %p: requires encryption", dev->netdev->name, ptr); @@ -2644,14 +2639,14 @@ static inline int wep_matched(struct at76c503 *dev, struct bss_info *ptr) static inline int bssid_matched(struct at76c503 *dev, struct bss_info *ptr) { if (!dev->wanted_bssid_valid || - !compare_ether_addr(ptr->bssid, dev->wanted_bssid)) { + !compare_ether_addr(ptr->bssid, dev->wanted_bssid)) { return 1; } else { if (at76_debug & DBG_BSS_MATCH) { - dbg_uc("%s: requested bssid - %s does not match", - dev->netdev->name, mac2str(dev->wanted_bssid)); - dbg_uc(" AP bssid - %s of bss table entry %p", - mac2str(ptr->bssid), ptr); + dbg_uc("%s: requested bssid - %s does not match", + dev->netdev->name, mac2str(dev->wanted_bssid)); + dbg_uc(" AP bssid - %s of bss table entry %p", + mac2str(ptr->bssid), ptr); } return 0; } @@ -2673,17 +2668,17 @@ static void dump_bss_table(struct at76c503 *dev, int force_output) list_for_each(lptr, &dev->bss_list) { ptr = list_entry(lptr, struct bss_info, list); dbg_uc("0x%p: bssid %s channel %d ssid %s (%s)" - " capa x%04x rates %s rssi %d link %d noise %d", - ptr, mac2str(ptr->bssid), - ptr->channel, - ptr->ssid, - hex2str(dev->obuf, ptr->ssid, - min((sizeof(dev->obuf)-1)/2, - (size_t)ptr->ssid_len),'\0'), - ptr->capa, - hex2str(dev->obuf_s, ptr->rates, - min(sizeof(dev->obuf_s)/3, - (size_t)ptr->rates_len), ' '), + " capa x%04x rates %s rssi %d link %d noise %d", + ptr, mac2str(ptr->bssid), + ptr->channel, + ptr->ssid, + hex2str(dev->obuf, ptr->ssid, + min((sizeof(dev->obuf) - 1) / 2, + (size_t) ptr->ssid_len), '\0'), + ptr->capa, + hex2str(dev->obuf_s, ptr->rates, + min(sizeof(dev->obuf_s) / 3, + (size_t) ptr->rates_len), ' '), ptr->rssi, ptr->link_qual, ptr->noise_level); } @@ -2706,14 +2701,13 @@ static struct bss_info *find_matching_bss(struct at76c503 *dev, struct bss_info *ptr = NULL; struct list_head *curr; - curr = last != NULL ? last->list.next : dev->bss_list.next; + curr = last != NULL ? last->list.next : dev->bss_list.next; while (curr != &dev->bss_list) { ptr = list_entry(curr, struct bss_info, list); - if (essid_matched(dev,ptr) && - mode_matched(dev,ptr) && - wep_matched(dev,ptr) && - rates_matched(dev,ptr) && - bssid_matched(dev,ptr)) + if (essid_matched(dev, ptr) && + mode_matched(dev, ptr) && + wep_matched(dev, ptr) && + rates_matched(dev, ptr) && bssid_matched(dev, ptr)) break; curr = curr->next; } @@ -2729,15 +2723,14 @@ static struct bss_info *find_matching_bss(struct at76c503 *dev, /* we got an association response */ -static void rx_mgmt_assoc(struct at76c503 *dev, - struct at76c503_rx_buffer *buf) +static void rx_mgmt_assoc(struct at76c503 *dev, struct at76c503_rx_buffer *buf) { struct ieee80211_assoc_response *resp = - (struct ieee80211_assoc_response *)buf->packet; + (struct ieee80211_assoc_response *)buf->packet; struct ieee80211_hdr_3addr *mgmt = &resp->header; u16 assoc_id = le16_to_cpu(resp->aid); u16 status = le16_to_cpu(resp->status); - u16 capa = le16_to_cpu(resp->capability); + u16 capa = le16_to_cpu(resp->capability); dbg(DBG_RX_MGMT, "%s: rx AssocResp bssid %s capa x%04x status x%04x " "assoc_id x%04x rates %s", dev->netdev->name, mac2str(mgmt->addr3), capa, status, assoc_id, @@ -2756,10 +2749,10 @@ static void rx_mgmt_assoc(struct at76c503 *dev, memcpy(dev->essid, ptr->ssid, ptr->ssid_len); dev->essid_size = ptr->ssid_len; dev->channel = ptr->channel; - defer_kevent(dev,KEVENT_ASSOC_DONE); + defer_kevent(dev, KEVENT_ASSOC_DONE); } else { dev->istate = JOINING; - defer_kevent(dev,KEVENT_JOIN); + defer_kevent(dev, KEVENT_JOIN); } del_timer_sync(&dev->mgmt_timer); } else { @@ -2769,10 +2762,10 @@ static void rx_mgmt_assoc(struct at76c503 *dev, } /* rx_mgmt_assoc */ static void rx_mgmt_reassoc(struct at76c503 *dev, - struct at76c503_rx_buffer *buf) + struct at76c503_rx_buffer *buf) { struct ieee80211_assoc_response *resp = - (struct ieee80211_assoc_response *)buf->packet; + (struct ieee80211_assoc_response *)buf->packet; struct ieee80211_hdr_3addr *mgmt = &resp->header; unsigned long flags; u16 capa = le16_to_cpu(resp->capability); @@ -2783,7 +2776,8 @@ static void rx_mgmt_reassoc(struct at76c503 *dev, "assoc_id x%04x rates %s", dev->netdev->name, mac2str(mgmt->addr3), capa, status, assoc_id, hex2str(dev->obuf, resp->info_element->data, - min((size_t)resp->info_element->len, (sizeof(dev->obuf)-1)/2), '\0')); + min((size_t) resp->info_element->len, + (sizeof(dev->obuf) - 1) / 2), '\0')); if (dev->istate == REASSOCIATING) { assert(dev->new_bss != NULL); if (dev->new_bss == NULL) @@ -2794,7 +2788,7 @@ static void rx_mgmt_reassoc(struct at76c503 *dev, bptr->assoc_id = assoc_id; dev->istate = CONNECTED; - iwevent_bss_connect(dev->netdev,bptr->bssid); + iwevent_bss_connect(dev->netdev, bptr->bssid); spin_lock_irqsave(&dev->bss_list_spinlock, flags); dev->curr_bss = dev->new_bss; @@ -2812,7 +2806,7 @@ static void rx_mgmt_reassoc(struct at76c503 *dev, } else { del_timer_sync(&dev->mgmt_timer); dev->istate = JOINING; - defer_kevent(dev,KEVENT_JOIN); + defer_kevent(dev, KEVENT_JOIN); } } else { info("%s: ReAssocResp in state %d ignored", @@ -2821,17 +2815,17 @@ static void rx_mgmt_reassoc(struct at76c503 *dev, } /* rx_mgmt_reassoc */ static void rx_mgmt_disassoc(struct at76c503 *dev, - struct at76c503_rx_buffer *buf) + struct at76c503_rx_buffer *buf) { struct ieee80211_disassoc *resp = - (struct ieee80211_disassoc *)buf->packet; + (struct ieee80211_disassoc *)buf->packet; struct ieee80211_hdr_3addr *mgmt = &resp->header; dbg(DBG_RX_MGMT, "%s: rx DisAssoc bssid %s reason x%04x destination %s", dev->netdev->name, mac2str(mgmt->addr3), le16_to_cpu(resp->reason), - hex2str(dev->obuf, mgmt->addr1, - min((int)sizeof(dev->obuf)/3, ETH_ALEN), ':')); + hex2str(dev->obuf, mgmt->addr1, + min((int)sizeof(dev->obuf) / 3, ETH_ALEN), ':')); if (dev->istate == SCANNING || dev->istate == INIT) return; @@ -2844,18 +2838,16 @@ static void rx_mgmt_disassoc(struct at76c503 *dev, return; } if (!compare_ether_addr(mgmt->addr3, dev->curr_bss->bssid) && - (!compare_ether_addr(dev->netdev->dev_addr, mgmt->addr1) || - is_broadcast_ether_addr(mgmt->addr1))) { + (!compare_ether_addr(dev->netdev->dev_addr, mgmt->addr1) || + is_broadcast_ether_addr(mgmt->addr1))) { /* this is a DisAssoc from the BSS we are connected or trying to connect to, directed to us or broadcasted */ /* jal: TODO: can the DisAssoc also come from the BSS we've sent a ReAssocReq to (i.e. from dev->new_bss) ? */ if (dev->istate == DISASSOCIATING || - dev->istate == ASSOCIATING || - dev->istate == REASSOCIATING || - dev->istate == CONNECTED || - dev->istate == JOINING) - { + dev->istate == ASSOCIATING || + dev->istate == REASSOCIATING || + dev->istate == CONNECTED || dev->istate == JOINING) { if (dev->istate == CONNECTED) { netif_carrier_off(dev->netdev); netif_stop_queue(dev->netdev); @@ -2863,40 +2855,36 @@ static void rx_mgmt_disassoc(struct at76c503 *dev, } del_timer_sync(&dev->mgmt_timer); dev->istate = JOINING; - defer_kevent(dev,KEVENT_JOIN); + defer_kevent(dev, KEVENT_JOIN); } else { - - /* ignore DisAssoc in states AUTH, ASSOC */ + /* ignore DisAssoc in states AUTH, ASSOC */ info("%s: DisAssoc in state %d ignored", dev->netdev->name, dev->istate); } } /* ignore DisAssoc to other STA or from other BSSID */ -} /* rx_mgmt_disassoc */ +} /* rx_mgmt_disassoc */ -static void rx_mgmt_auth(struct at76c503 *dev, - struct at76c503_rx_buffer *buf) +static void rx_mgmt_auth(struct at76c503 *dev, struct at76c503_rx_buffer *buf) { - struct ieee80211_auth *resp = - (struct ieee80211_auth *)buf->packet; + struct ieee80211_auth *resp = (struct ieee80211_auth *)buf->packet; struct ieee80211_hdr_3addr *mgmt = &resp->header; int seq_nr = le16_to_cpu(resp->transaction); int alg = le16_to_cpu(resp->algorithm); int status = le16_to_cpu(resp->status); - dbg(DBG_RX_MGMT, "%s: rx AuthFrame bssid %s alg %d seq_nr %d status %d " + dbg(DBG_RX_MGMT, "%s: rx AuthFrame bssid %s alg %d seq_nr %d status %d " "destination %s", dev->netdev->name, mac2str(mgmt->addr3), alg, seq_nr, status, hex2str(dev->obuf, mgmt->addr1, - min((int)sizeof(dev->obuf)/3, ETH_ALEN), ':')); + min((int)sizeof(dev->obuf) / 3, ETH_ALEN), ':')); - if (alg == WLAN_AUTH_SHARED_KEY && - seq_nr == 2) { + if (alg == WLAN_AUTH_SHARED_KEY && seq_nr == 2) { dbg(DBG_RX_MGMT, "%s: AuthFrame challenge %s ...", dev->netdev->name, - hex2str(dev->obuf, (u8 *)resp->info_element, - min((int)sizeof(dev->obuf)/3,18), ' ')); + hex2str(dev->obuf, (u8 *) resp->info_element, + min((int)sizeof(dev->obuf) / 3, 18), ' ')); } if (dev->istate != AUTHENTICATING) { info("%s: ignored AuthFrame in state %d", @@ -2921,43 +2909,41 @@ static void rx_mgmt_auth(struct at76c503 *dev, del_timer_sync(&dev->mgmt_timer); /* try to join next bss */ dev->istate = JOINING; - defer_kevent(dev,KEVENT_JOIN); + defer_kevent(dev, KEVENT_JOIN); return; } - if (dev->auth_mode == WLAN_AUTH_OPEN || - seq_nr == 4) { + if (dev->auth_mode == WLAN_AUTH_OPEN || seq_nr == 4) { dev->retries = ASSOC_RETRIES; dev->istate = ASSOCIATING; assoc_req(dev, dev->curr_bss); dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", __FUNCTION__, __LINE__); - mod_timer(&dev->mgmt_timer,jiffies+HZ); + mod_timer(&dev->mgmt_timer, jiffies + HZ); return; } assert(seq_nr == 2); - auth_req(dev, dev->curr_bss, seq_nr+1, resp->info_element); + auth_req(dev, dev->curr_bss, seq_nr + 1, resp->info_element); dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", __FUNCTION__, __LINE__); - mod_timer(&dev->mgmt_timer,jiffies+HZ); + mod_timer(&dev->mgmt_timer, jiffies + HZ); } /* else: ignore AuthFrames to other recipients */ } /* rx_mgmt_auth */ -static void rx_mgmt_deauth(struct at76c503 *dev, - struct at76c503_rx_buffer *buf) +static void rx_mgmt_deauth(struct at76c503 *dev, struct at76c503_rx_buffer *buf) { struct ieee80211_disassoc *resp = - (struct ieee80211_disassoc *)buf->packet; + (struct ieee80211_disassoc *)buf->packet; struct ieee80211_hdr_3addr *mgmt = &resp->header; - dbg(DBG_RX_MGMT|DBG_PROGRESS, + dbg(DBG_RX_MGMT | DBG_PROGRESS, "%s: rx DeAuth bssid %s reason x%04x destination %s", dev->netdev->name, mac2str(mgmt->addr3), le16_to_cpu(resp->reason), hex2str(dev->obuf, mgmt->addr1, - min((int)sizeof(dev->obuf)/3,ETH_ALEN), ':')); + min((int)sizeof(dev->obuf) / 3, ETH_ALEN), ':')); if (dev->istate == DISASSOCIATING || dev->istate == AUTHENTICATING || dev->istate == ASSOCIATING || @@ -2976,7 +2962,7 @@ static void rx_mgmt_deauth(struct at76c503 *dev, iwevent_bss_disconnect(dev->netdev); } dev->istate = JOINING; - defer_kevent(dev,KEVENT_JOIN); + defer_kevent(dev, KEVENT_JOIN); del_timer_sync(&dev->mgmt_timer); } /* ignore DeAuth to other STA or from other BSSID */ @@ -2987,12 +2973,10 @@ static void rx_mgmt_deauth(struct at76c503 *dev, } } /* rx_mgmt_deauth */ -static void rx_mgmt_beacon(struct at76c503 *dev, - struct at76c503_rx_buffer *buf) +static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf) { /* beacon content */ - struct ieee80211_beacon *bdata = - (struct ieee80211_beacon *)buf->packet; + struct ieee80211_beacon *bdata = (struct ieee80211_beacon *)buf->packet; struct ieee80211_hdr_3addr *mgmt = &bdata->header; /* length of var length beacon parameters */ @@ -3001,7 +2985,7 @@ static void rx_mgmt_beacon(struct at76c503 *dev, BEACON_MAX_DATA_LENGTH); struct list_head *lptr; - struct bss_info *match; /* entry matching addr3 with its bssid */ + struct bss_info *match; /* entry matching addr3 with its bssid */ int new_entry = 0; int len; struct ieee80211_info_element *tlv; @@ -3010,7 +2994,7 @@ static void rx_mgmt_beacon(struct at76c503 *dev, int have_channel = 0; int keep_going = 1; unsigned long flags; - + spin_lock_irqsave(&dev->bss_list_spinlock, flags); if (dev->istate == CONNECTED) { /* in state CONNECTED we use the mgmt_timer to control @@ -3031,8 +3015,8 @@ static void rx_mgmt_beacon(struct at76c503 *dev, if (!list_empty(&dev->bss_list)) { list_for_each(lptr, &dev->bss_list) { - struct bss_info *bss_ptr = - list_entry(lptr, struct bss_info, list); + struct bss_info *bss_ptr = + list_entry(lptr, struct bss_info, list); if (!compare_ether_addr(bss_ptr->bssid, mgmt->addr3)) { match = bss_ptr; break; @@ -3047,31 +3031,30 @@ static void rx_mgmt_beacon(struct at76c503 *dev, dev->netdev->name, sizeof(struct bss_info)); goto rx_mgmt_beacon_end; } - memset(match,0,sizeof(*match)); + memset(match, 0, sizeof(*match)); new_entry = 1; /* append new struct into list */ list_add_tail(&match->list, &dev->bss_list); } - + /* we either overwrite an existing entry or append a new one match points to the entry in both cases */ - + match->capa = le16_to_cpu(bdata->capability); - + /* while beacon_interval is not (!) */ match->beacon_interval = le16_to_cpu(bdata->beacon_interval); - + match->rssi = buf->rssi; match->link_qual = buf->link_quality; match->noise_level = buf->noise_level; - - memcpy(match->mac,mgmt->addr2,ETH_ALEN); /* just for info */ - memcpy(match->bssid,mgmt->addr3,ETH_ALEN); - dbg(DBG_RX_BEACON, "%s: bssid %s", dev->netdev->name, - mac2str(match->bssid)); - + memcpy(match->mac, mgmt->addr2, ETH_ALEN); /* just for info */ + memcpy(match->bssid, mgmt->addr3, ETH_ALEN); + dbg(DBG_RX_BEACON, "%s: bssid %s", dev->netdev->name, + mac2str(match->bssid)); + tlv = bdata->info_element; - + /* This routine steps through the bdata->data array to try and get * some useful information about the access point. * Currently, this implementation supports receipt of: SSID, @@ -3090,54 +3073,53 @@ static void rx_mgmt_beacon(struct at76c503 *dev, ((&tlv->data[tlv->len] - (u8 *)bdata->info_element) <= varpar_len)) { switch (tlv->id) { - + case MFIE_TYPE_SSID: len = min_t(int, IW_ESSID_MAX_SIZE, tlv->len); - if (!have_ssid && ((new_entry) || - !is_cloaked_ssid(tlv->data, len))) { - /* we copy only if this is a new entry, - or the incoming SSID is not a cloaked SSID. This - will protect us from overwriting a real SSID read - in a ProbeResponse with a cloaked one from a - following beacon. */ - + if (!have_ssid && ((new_entry) || + !is_cloaked_ssid(tlv->data, len))) { + /* we copy only if this is a new entry, + or the incoming SSID is not a cloaked SSID. This + will protect us from overwriting a real SSID read + in a ProbeResponse with a cloaked one from a + following beacon. */ + match->ssid_len = len; memcpy(match->ssid, tlv->data, len); - match->ssid[len] = '\0'; /* terminate the - string for - printing */ - dbg(DBG_RX_BEACON, "%s: SSID - %s", - dev->netdev->name, match->ssid); + match->ssid[len] = '\0'; /* terminate the + string for + printing */ + dbg(DBG_RX_BEACON, "%s: SSID - %s", + dev->netdev->name, match->ssid); } have_ssid = 1; break; - + case MFIE_TYPE_RATES: if (!have_rates) { - match->rates_len = - min_t(int, sizeof(match->rates), - tlv->len); + match->rates_len = + min_t(int, sizeof(match->rates), tlv->len); memcpy(match->rates, tlv->data, - match->rates_len); + match->rates_len); have_rates = 1; - dbg(DBG_RX_BEACON, - "%s: SUPPORTED RATES %s", + dbg(DBG_RX_BEACON, + "%s: SUPPORTED RATES %s", dev->netdev->name, hex2str(dev->obuf, tlv->data, min_t(int, (sizeof(dev->obuf)-1)/2, tlv->len), '\0')); } break; - + case MFIE_TYPE_DS_SET: if (!have_channel) { match->channel = tlv->data[0]; have_channel = 1; - dbg(DBG_RX_BEACON, "%s: CHANNEL - %d", - dev->netdev->name, match->channel); + dbg(DBG_RX_BEACON, "%s: CHANNEL - %d", + dev->netdev->name, match->channel); } break; - + case MFIE_TYPE_CF_SET: case MFIE_TYPE_TIM: case MFIE_TYPE_IBSS_SET: @@ -3164,22 +3146,24 @@ static void rx_mgmt_beacon(struct at76c503 *dev, * Comment this out if you want to see what other information * comes from the AP - although little of it may be useful */ } - + dbg(DBG_RX_BEACON, "%s: Finished processing beacon data", dev->netdev->name); match->last_rx = jiffies; /* record last rx of beacon */ - + rx_mgmt_beacon_end: spin_unlock_irqrestore(&dev->bss_list_spinlock, flags); } /* rx_mgmt_beacon */ /* calc the link level from a given rx_buffer */ -static void calc_level(struct at76c503 *dev, struct at76c503_rx_buffer *buf, struct iw_quality* qual) -{ int max_rssi = 42; /* just a gues for now, might be different for other chips */ +static void calc_level(struct at76c503 *dev, struct at76c503_rx_buffer *buf, + struct iw_quality *qual) +{ + int max_rssi = 42; /* just a gues for now, might be different for other chips */ - qual->level = (buf->rssi * 100 / max_rssi); + qual->level = (buf->rssi * 100 / max_rssi); if (qual->level > 100) qual->level = 100; qual->updated |= IW_QUAL_LEVEL_UPDATED; @@ -3190,35 +3174,34 @@ static void calc_level(struct at76c503 *dev, struct at76c503_rx_buffer *buf, str static void calc_qual(struct at76c503 *dev, struct at76c503_rx_buffer *buf, struct iw_quality* qual) { if ((dev->board_type == BOARDTYPE_503_INTERSIL_3861) || - (dev->board_type == BOARDTYPE_503_INTERSIL_3863)) { - qual->qual=buf->link_quality; + (dev->board_type == BOARDTYPE_503_INTERSIL_3863)) { + qual->qual = buf->link_quality; } else { - unsigned long msec; + unsigned long msec; - /* Update qual at most once a second */ - msec = jiffies_to_msecs(jiffies) - dev->beacons_last_qual; - if (msec < 1000) - return; + /* Update qual at most once a second */ + msec = jiffies_to_msecs(jiffies) - dev->beacons_last_qual; + if (msec < 1000) + return; - qual->qual = qual->level * dev->beacons_received * - dev->beacon_period / msec; - - dev->beacons_last_qual = jiffies_to_msecs(jiffies); - dev->beacons_received = 0; + qual->qual = qual->level * dev->beacons_received * + dev->beacon_period / msec; + + dev->beacons_last_qual = jiffies_to_msecs(jiffies); + dev->beacons_received = 0; } qual->qual = (qual->qual > 100) ? 100 : qual->qual; qual->updated |= IW_QUAL_QUAL_UPDATED; } - /* calc the noise quality from a given rx_buffer */ -static void calc_noise(struct at76c503 *dev, struct at76c503_rx_buffer *buf, struct iw_quality* qual) +static void calc_noise(struct at76c503 *dev, struct at76c503_rx_buffer *buf, + struct iw_quality *qual) { qual->noise = 0; qual->updated |= IW_QUAL_NOISE_INVALID; } - static void update_wstats(struct at76c503 *dev, struct at76c503_rx_buffer *buf) { struct iw_quality *qual = &dev->wstats.qual; @@ -3239,7 +3222,7 @@ static void update_wstats(struct at76c503 *dev, struct at76c503_rx_buffer *buf) static void rx_mgmt(struct at76c503 *dev, struct at76c503_rx_buffer *buf) { struct ieee80211_hdr_3addr *mgmt = - (struct ieee80211_hdr_3addr *)buf->packet; + (struct ieee80211_hdr_3addr *)buf->packet; u16 subtype = le16_to_cpu(mgmt->frame_ctl) & IEEE80211_FCTL_STYPE; /* update wstats */ @@ -3258,35 +3241,35 @@ static void rx_mgmt(struct at76c503 *dev, struct at76c503_rx_buffer *buf) if (at76_debug & DBG_RX_MGMT_CONTENT) { dbg_uc("%s rx mgmt subtype x%x %s", dev->netdev->name, subtype, - hex2str(dev->obuf, (u8 *)mgmt, - min((sizeof(dev->obuf)-1)/2, - (size_t)le16_to_cpu(buf->wlength)), '\0')); + hex2str(dev->obuf, (u8 *) mgmt, + min((sizeof(dev->obuf) - 1) / 2, + (size_t) le16_to_cpu(buf->wlength)), '\0')); } switch (subtype) { case IEEE80211_STYPE_BEACON: case IEEE80211_STYPE_PROBE_RESP: - rx_mgmt_beacon(dev,buf); + rx_mgmt_beacon(dev, buf); break; case IEEE80211_STYPE_ASSOC_RESP: - rx_mgmt_assoc(dev,buf); + rx_mgmt_assoc(dev, buf); break; case IEEE80211_STYPE_REASSOC_RESP: - rx_mgmt_reassoc(dev,buf); + rx_mgmt_reassoc(dev, buf); break; case IEEE80211_STYPE_DISASSOC: - rx_mgmt_disassoc(dev,buf); + rx_mgmt_disassoc(dev, buf); break; case IEEE80211_STYPE_AUTH: - rx_mgmt_auth(dev,buf); + rx_mgmt_auth(dev, buf); break; case IEEE80211_STYPE_DEAUTH: - rx_mgmt_deauth(dev,buf); + rx_mgmt_deauth(dev, buf); break; default: @@ -3301,11 +3284,13 @@ static void dbg_dumpbuf(const char *tag, const u8 *buf, int size) { int i; - if (!at76_debug) return; + if (!at76_debug) + return; - for (i=0; i<size; i++) { + for (i = 0; i < size; i++) { if ((i % 8) == 0) { - if (i) printk("\n"); + if (i) + printk("\n"); printk(KERN_DEBUG __FILE__ ": %s: ", tag); } printk("%02x ", buf[i]); @@ -3378,14 +3363,15 @@ static void ieee80211_to_eth(struct sk_buff *skb, int iw_mode) { dbg_uc("%s: ENTRY skb len %d data %s", __FUNCTION__, skb->len, hex2str(dev->obuf, skb->data, - min((int)sizeof(dev->obuf)/3,64), ' ')); + min((int)sizeof(dev->obuf) / 3, 64), + ' ')); } #endif skb_pull(skb, sizeof(struct ieee80211_hdr_3addr)); src_addr = iw_mode == IW_MODE_ADHOC ? i802_11_hdr->addr2 - : i802_11_hdr->addr3; + : i802_11_hdr->addr3; dest_addr = i802_11_hdr->addr1; eth_hdr_p = (struct ethhdr *)skb->data; @@ -3397,8 +3383,8 @@ static void ieee80211_to_eth(struct sk_buff *skb, int iw_mode) build_ethhdr = 0; } else if (!memcmp(skb->data, snapsig, sizeof(snapsig))) { /* SNAP frame - collapse it */ - skb_pull(skb, sizeof(rfc1042sig)+2); - proto = *(__be16 *)(skb->data - 2); + skb_pull(skb, sizeof(rfc1042sig) + 2); + proto = *(__be16 *) (skb->data - 2); } else { #ifdef IEEE_STANDARD /* According to all standards, we should assume the data @@ -3459,7 +3445,7 @@ static void ieee80211_to_eth(struct sk_buff *skb, int iw_mode) /* Adjust the skb to trim the hardware header and CRC, and set up skb->mac, * skb->protocol, etc. - */ + */ static void ieee80211_fixup(struct sk_buff *skb, int iw_mode) { struct ieee80211_hdr_3addr *i802_11_hdr; @@ -3472,7 +3458,7 @@ static void ieee80211_fixup(struct sk_buff *skb, int iw_mode) skb_pull(skb, sizeof(struct ieee80211_hdr_3addr)); src_addr = iw_mode == IW_MODE_ADHOC ? i802_11_hdr->addr2 - : i802_11_hdr->addr3; + : i802_11_hdr->addr3; dest_addr = i802_11_hdr->addr1; skb->mac.raw = (unsigned char *)i802_11_hdr; @@ -3521,21 +3507,21 @@ static void ieee80211_fixup(struct sk_buff *skb, int iw_mode) Every returned skb starts with the ieee802_11 header and contains _no_ FCS at the end */ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev) -{ +{ struct sk_buff *skb = (struct sk_buff *)dev->rx_skb; struct at76c503_rx_buffer *buf = (struct at76c503_rx_buffer *)skb->data; struct ieee80211_hdr_3addr *i802_11_hdr = - (struct ieee80211_hdr_3addr *)buf->packet; + (struct ieee80211_hdr_3addr *)buf->packet; /* seq_ctrl, fragment_number, sequence number of new packet */ u16 sctl = le16_to_cpu(i802_11_hdr->seq_ctl); u16 fragnr = sctl & 0xf; - u16 seqnr = sctl>>4; + u16 seqnr = sctl >> 4; u16 frame_ctl = le16_to_cpu(i802_11_hdr->frame_ctl); /* length including the IEEE802.11 header, excl. the trailing FCS, excl. the struct at76c503_rx_buffer */ int length = le16_to_cpu(buf->wlength) - dev->rx_data_fcs_len; - + /* where does the data payload start in skb->data ? */ u8 *data = (u8 *)i802_11_hdr + sizeof(struct ieee80211_hdr_3addr); @@ -3552,7 +3538,7 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev) mac2str(i802_11_hdr->addr2), seqnr, fragnr, length, data_len, hex2str(dev->obuf, data, - min((int)(sizeof(dev->obuf)-1)/2,32), '\0')); + min((int)(sizeof(dev->obuf) - 1) / 2, 32), '\0')); dbg(DBG_RX_FRAGS_SKB, "%s: incoming skb: head %p data %p " "tail %p end %p len %d", @@ -3586,7 +3572,7 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev) /* we need the IEEE802.11 header (for the addresses) if this packet is the first of a chain */ - assert(length > AT76C503_RX_HDRLEN); + assert(length > AT76C503_RX_HDRLEN); skb_pull(skb, AT76C503_RX_HDRLEN); /* remove FCS at end */ skb_trim(skb, length); @@ -3620,7 +3606,7 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev) oldest = 0UL; } } - + if (i < NR_RX_DATA_BUF) { dbg(DBG_RX_FRAGS, "%s: %d. cacheentry (seq/frag=%d/%d) " @@ -3641,7 +3627,7 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev) if ((left=skb_tailroom(bptr->skb)) < data_len) { info("%s: only %d byte free (need %d)", dev->netdev->name, left, data_len); - } else + } else memcpy(skb_put(bptr->skb, data_len), data, data_len); bptr->fragnr = fragnr; @@ -3743,17 +3729,16 @@ static void rx_data(struct at76c503 *dev) dbg_dumpbuf(" rxhdr", skb->data, AT76C503_RX_HDRLEN); } if (at76_debug & DBG_RX_DATA_CONTENT) - dbg_dumpbuf("packet", skb->data + AT76C503_RX_HDRLEN, - length); + dbg_dumpbuf("packet", skb->data + AT76C503_RX_HDRLEN, length); - if ((skb=check_for_rx_frags(dev)) == NULL) + if ((skb = check_for_rx_frags(dev)) == NULL) return; /* if an skb is returned, the at76c503_rx_buffer and the FCS is already removed */ i802_11_hdr = (struct ieee80211_hdr_3addr *)skb->data; skb->dev = netdev; - skb->ip_summed = CHECKSUM_NONE; /* TODO: should check CRC */ + skb->ip_summed = CHECKSUM_NONE; /* TODO: should check CRC */ if (i802_11_hdr->addr1[0] & 1) { if (!compare_ether_addr(i802_11_hdr->addr1, netdev->broadcast)) @@ -3761,7 +3746,7 @@ static void rx_data(struct at76c503 *dev) else skb->pkt_type = PACKET_MULTICAST; } else if (compare_ether_addr(i802_11_hdr->addr1, netdev->dev_addr)) { - skb->pkt_type=PACKET_OTHERHOST; + skb->pkt_type = PACKET_OTHERHOST; } if (netdev->type == ARPHRD_ETHER) { @@ -3782,7 +3767,7 @@ static int submit_rx_urb(struct at76c503 *dev) { int ret, size; struct sk_buff *skb = dev->rx_skb; - + if (dev->read_urb == NULL) { err("%s: dev->read_urb is NULL", __FUNCTION__); return -EFAULT; @@ -3807,8 +3792,8 @@ static int submit_rx_urb(struct at76c503 *dev) skb_put(skb, size), size, (usb_complete_t)at76c503_read_bulk_callback, dev); ret = usb_submit_urb(dev->read_urb, GFP_ATOMIC); - if (ret < 0) { - if (ret == -ENODEV) + if (ret < 0) { + if (ret == -ENODEV) dbg(DBG_DEVSTART, "usb_submit_urb returned -ENODEV"); else err("%s: rx, usb_submit_urb failed: %d", dev->netdev->name, ret); @@ -3818,7 +3803,7 @@ exit: if (ret < 0) { if (ret != -ENODEV) { /* If we can't submit the URB, the adapter becomes completely - * useless, so try again later */ + * useless, so try again later */ if (--dev->nr_submit_rx_tries > 0) defer_kevent(dev, KEVENT_SUBMIT_RX); else { @@ -3833,7 +3818,6 @@ exit: return ret; } - /* we are doing a lot of things here in an interrupt. Need a bh handler (Watching TV with a TV card is probably a good test: if you see flickers, we are doing too much. @@ -3842,7 +3826,7 @@ exit: */ /* Or maybe because our BH handler is preempting bttv's BH handler.. BHs don't * solve everything.. (alex) */ -static void at76c503_read_bulk_callback (struct urb *urb) +static void at76c503_read_bulk_callback(struct urb *urb) { struct at76c503 *dev = (struct at76c503 *)urb->context; @@ -3855,10 +3839,10 @@ static void at76c503_read_bulk_callback (struct urb *urb) static void rx_monitor_mode(struct at76c503 *dev) { struct net_device *netdev = (struct net_device *)dev->netdev; - struct at76c503_rx_buffer *buf = - (struct at76c503_rx_buffer *)dev->rx_skb->data; + struct at76c503_rx_buffer *buf = + (struct at76c503_rx_buffer *)dev->rx_skb->data; /* length including the IEEE802.11 header, excl. the trailing FCS, - excl. the struct at76c503_rx_buffer */ + excl. the struct at76c503_rx_buffer */ int length = le16_to_cpu(buf->wlength) - dev->rx_data_fcs_len; struct sk_buff *skb = dev->rx_skb; struct net_device_stats *stats = &dev->stats; @@ -3876,7 +3860,7 @@ static void rx_monitor_mode(struct at76c503 *dev) if (netdev->type == ARPHRD_IEEE80211_PRISM) { int skblen = sizeof(struct p80211msg) + length; struct p80211msg *prism; - u8* payload; + u8 *payload; if ((skb = dev_alloc_skb(skblen)) == NULL) { err("%s: MONITOR MODE: dev_alloc_skb for Prism header " @@ -3886,7 +3870,7 @@ static void rx_monitor_mode(struct at76c503 *dev) skb_put(skb, skblen); - prism = (struct p80211msg*)skb->data; + prism = (struct p80211msg *)skb->data; payload = skb->data + sizeof(struct p80211msg); prism->msgcode = DIDmsg_lnxind_wlansniffrm; @@ -3975,7 +3959,8 @@ static void rx_tasklet(unsigned long param) struct ieee80211_hdr_3addr *i802_11_hdr; u16 frame_ctl; - if (!dev) return; + if (!dev) + return; urb = dev->rx_urb; netdev = (struct net_device *)dev->netdev; @@ -3987,21 +3972,24 @@ static void rx_tasklet(unsigned long param) } - if (!urb || !dev->rx_skb || !netdev || !dev->rx_skb->data) return; + if (!urb || !dev->rx_skb || !netdev || !dev->rx_skb->data) + return; buf = (struct at76c503_rx_buffer *)dev->rx_skb->data; - if (!buf) return; + if (!buf) + return; i802_11_hdr = (struct ieee80211_hdr_3addr *)buf->packet; - if (!i802_11_hdr) return; + if (!i802_11_hdr) + return; frame_ctl = le16_to_cpu(i802_11_hdr->frame_ctl); if (urb->status != 0) { - if ((urb->status != -ENOENT) && - (urb->status != -ECONNRESET)) { - dbg(DBG_URB,"%s %s: - nonzero read bulk status received: %d", + if ((urb->status != -ENOENT) && (urb->status != -ECONNRESET)) { + dbg(DBG_URB, + "%s %s: - nonzero read bulk status received: %d", __FUNCTION__, netdev->name, urb->status); goto no_more_urb; } @@ -4043,8 +4031,8 @@ static void rx_tasklet(unsigned long param) break; case IEEE80211_FTYPE_CTL: - dbg(DBG_RX_CTRL, "%s: ignored ctrl frame: %04x", dev->netdev->name, - frame_ctl); + dbg(DBG_RX_CTRL, "%s: ignored ctrl frame: %04x", + dev->netdev->name, frame_ctl); break; default: @@ -4057,7 +4045,7 @@ finish: return; } -static void at76c503_write_bulk_callback (struct urb *urb) +static void at76c503_write_bulk_callback(struct urb *urb) { struct at76c503 *dev = (struct at76c503 *)urb->context; struct net_device_stats *stats = &dev->stats; @@ -4066,9 +4054,9 @@ static void at76c503_write_bulk_callback (struct urb *urb) int ret; if (urb->status != 0) { - if ((urb->status != -ENOENT) && - (urb->status != -ECONNRESET)) { - dbg(DBG_URB, "%s - nonzero write bulk status received: %d", + if ((urb->status != -ENOENT) && (urb->status != -ECONNRESET)) { + dbg(DBG_URB, + "%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); } else return; /* urb has been unlinked */ @@ -4086,14 +4074,15 @@ static void at76c503_write_bulk_callback (struct urb *urb) to the length */ memcpy(dev->bulk_out_buffer, mgmt_buf, le16_to_cpu(mgmt_buf->wlength) + - offsetof(struct at76c503_tx_buffer,packet)); + offsetof(struct at76c503_tx_buffer, packet)); usb_fill_bulk_urb(dev->write_urb, dev->udev, - usb_sndbulkpipe(dev->udev, - dev->bulk_out_endpointAddr), - dev->bulk_out_buffer, - le16_to_cpu(mgmt_buf->wlength) + - mgmt_buf->padding + AT76C503_TX_HDRLEN, - (usb_complete_t)at76c503_write_bulk_callback, dev); + usb_sndbulkpipe(dev->udev, + dev->bulk_out_endpointAddr), + dev->bulk_out_buffer, + le16_to_cpu(mgmt_buf->wlength) + + mgmt_buf->padding + AT76C503_TX_HDRLEN, + (usb_complete_t) at76c503_write_bulk_callback, + dev); ret = usb_submit_urb(dev->write_urb, GFP_ATOMIC); if (ret) { err("%s: %s error in tx submit urb: %d", @@ -4113,9 +4102,9 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev) int wlen; int submit_len; struct at76c503_tx_buffer *tx_buffer = - (struct at76c503_tx_buffer *)dev->bulk_out_buffer; + (struct at76c503_tx_buffer *)dev->bulk_out_buffer; struct ieee80211_hdr_3addr *i802_11_hdr = - (struct ieee80211_hdr_3addr *)&(tx_buffer->packet); + (struct ieee80211_hdr_3addr *)&(tx_buffer->packet); u8 *payload = tx_buffer->packet + sizeof(struct ieee80211_hdr_3addr); if (netif_queue_stopped(netdev)) { @@ -4134,11 +4123,11 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev) return 0; } - if (skb->len < 2*ETH_ALEN) { + if (skb->len < 2 * ETH_ALEN) { err("%s: %s: skb too short (%d)", dev->netdev->name, __FUNCTION__, skb->len); - dev_kfree_skb(skb); - return 0; + dev_kfree_skb(skb); + return 0; } ledtrig_tx_activity(); /* tell the ledtrigger we send a packet */ @@ -4146,12 +4135,12 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev) /* we can get rid of memcpy, if we set netdev->hard_header_len to 8 + sizeof(struct ieee80211_hdr_3addr), because then we have enough space - dbg(DBG_TX, "skb->data - skb->head = %d", skb->data - skb->head); */ + dbg(DBG_TX, "skb->data - skb->head = %d", skb->data - skb->head); */ - if (ntohs(*(__be16 *)(skb->data + 2*ETH_ALEN)) <= 1518) { + if (ntohs(*(__be16 *) (skb->data + 2 * ETH_ALEN)) <= 1518) { /* this is a 802.3 packet */ - if (skb->data[2*ETH_ALEN+2] == rfc1042sig[0] && - skb->data[2*ETH_ALEN+2+1] == rfc1042sig[1]) { + if (skb->data[2 * ETH_ALEN + 2] == rfc1042sig[0] && + skb->data[2 * ETH_ALEN + 2 + 1] == rfc1042sig[1]) { /* higher layer delivered SNAP header - keep it */ memcpy(payload, skb->data + 2*ETH_ALEN+2, skb->len - 2*ETH_ALEN -2); wlen = sizeof(struct ieee80211_hdr_3addr) + skb->len - 2*ETH_ALEN -2; @@ -4159,8 +4148,9 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev) err("%s: %s: no support for non-SNAP 802.2 packets " "(DSAP x%02x SSAP x%02x cntrl x%02x)", dev->netdev->name, __FUNCTION__, - skb->data[2*ETH_ALEN+2], skb->data[2*ETH_ALEN+2+1], - skb->data[2*ETH_ALEN+2+2]); + skb->data[2 * ETH_ALEN + 2], + skb->data[2 * ETH_ALEN + 2 + 1], + skb->data[2 * ETH_ALEN + 2 + 2]); dev_kfree_skb(skb); return 0; } @@ -4175,18 +4165,19 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev) /* make wireless header */ i802_11_hdr->frame_ctl = - cpu_to_le16(IEEE80211_FTYPE_DATA | - (dev->wep_enabled ? IEEE80211_FCTL_PROTECTED : 0) | - (dev->iw_mode == IW_MODE_INFRA ? IEEE80211_FCTL_TODS : 0)); + cpu_to_le16(IEEE80211_FTYPE_DATA | + (dev->wep_enabled ? IEEE80211_FCTL_PROTECTED : 0) | + (dev->iw_mode == + IW_MODE_INFRA ? IEEE80211_FCTL_TODS : 0)); if (dev->iw_mode == IW_MODE_ADHOC) { - memcpy(i802_11_hdr->addr1, skb->data, ETH_ALEN); /* destination */ - memcpy(i802_11_hdr->addr2, skb->data+ETH_ALEN, ETH_ALEN); /* source */ + memcpy(i802_11_hdr->addr1, skb->data, ETH_ALEN); /* destination */ + memcpy(i802_11_hdr->addr2, skb->data + ETH_ALEN, ETH_ALEN); /* source */ memcpy(i802_11_hdr->addr3, dev->bssid, ETH_ALEN); } else if (dev->iw_mode == IW_MODE_INFRA) { memcpy(i802_11_hdr->addr1, dev->bssid, ETH_ALEN); - memcpy(i802_11_hdr->addr2, skb->data+ETH_ALEN, ETH_ALEN); /* source */ - memcpy(i802_11_hdr->addr3, skb->data, ETH_ALEN); /* destination */ + memcpy(i802_11_hdr->addr2, skb->data + ETH_ALEN, ETH_ALEN); /* source */ + memcpy(i802_11_hdr->addr3, skb->data, ETH_ALEN); /* destination */ } i802_11_hdr->duration_id = cpu_to_le16(0); @@ -4194,11 +4185,11 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev) /* setup 'Atmel' header */ tx_buffer->wlength = cpu_to_le16(wlen); - tx_buffer->tx_rate = dev->txrate; - /* for broadcast destination addresses, the firmware 0.100.x + tx_buffer->tx_rate = dev->txrate; + /* for broadcast destination addresses, the firmware 0.100.x seems to choose the highest rate set with CMD_STARTUP in basic_rate_set replacing this value */ - + memset(tx_buffer->reserved, 0, 4); tx_buffer->padding = calc_padding(wlen); @@ -4206,18 +4197,18 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev) { dbg(DBG_TX_DATA_CONTENT, "%s skb->data %s", dev->netdev->name, - hex2str(dev->obuf, skb->data, - min((int)(sizeof(dev->obuf)-1)/2,32),'\0')); + hex2str(dev->obuf, skb->data, + min((int)(sizeof(dev->obuf) - 1) / 2, 32), '\0')); dbg(DBG_TX_DATA, "%s tx wlen x%x pad x%x rate %d hdr %s", dev->netdev->name, le16_to_cpu(tx_buffer->wlength), - tx_buffer->padding, tx_buffer->tx_rate, - hex2str(dev->obuf, (u8 *)i802_11_hdr, - min((sizeof(dev->obuf)-1)/2, - sizeof(struct ieee80211_hdr_3addr)),'\0')); + tx_buffer->padding, tx_buffer->tx_rate, + hex2str(dev->obuf, (u8 *) i802_11_hdr, + min((sizeof(dev->obuf) - 1) / 2, + sizeof(struct ieee80211_hdr_3addr)), '\0')); dbg(DBG_TX_DATA_CONTENT, "%s payload %s", dev->netdev->name, - hex2str(dev->obuf, payload, - min((int)(sizeof(dev->obuf)-1)/2,48),'\0')); + hex2str(dev->obuf, payload, + min((int)(sizeof(dev->obuf) - 1) / 2, 48), '\0')); } /* send stuff */ @@ -4249,7 +4240,6 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev) return ret; } - static void at76c503_tx_timeout(struct net_device *netdev) { struct at76c503 *dev = netdev_priv(netdev); @@ -4268,7 +4258,7 @@ static int startup_device(struct at76c503 *dev) int ret; if (at76_debug & DBG_PARAMS) { - char ossid[IW_ESSID_MAX_SIZE+1]; + char ossid[IW_ESSID_MAX_SIZE + 1]; /* make dev->essid printable */ assert(dev->essid_size <= IW_ESSID_MAX_SIZE); @@ -4312,7 +4302,7 @@ static int startup_device(struct at76c503 *dev) ccfg->short_retry_limit = dev->short_retry_limit; if (dev->wep_enabled) { - if (dev->wep_keys_len[dev->wep_key_id] > WEP_SMALL_KEY_LEN) + if (dev->wep_keys_len[dev->wep_key_id] > WEP_SMALL_KEY_LEN) ccfg->encryption_type = 2; else ccfg->encryption_type = 1; @@ -4352,29 +4342,27 @@ static int startup_device(struct at76c503 *dev) /* remove BSSID from previous run */ memset(dev->bssid, 0, ETH_ALEN); - + if (set_radio(dev, 1) == 1) wait_completion(dev, CMD_RADIO); - if ((ret=set_preamble(dev, dev->preamble_type)) < 0) + if ((ret = set_preamble(dev, dev->preamble_type)) < 0) return ret; - if ((ret=set_frag(dev, dev->frag_threshold)) < 0) + if ((ret = set_frag(dev, dev->frag_threshold)) < 0) return ret; - if ((ret=set_rts(dev, dev->rts_threshold)) < 0) + if ((ret = set_rts(dev, dev->rts_threshold)) < 0) return ret; - - if ((ret=set_autorate_fallback(dev, dev->txrate == TX_RATE_AUTO ? 1 : 0)) < 0) + + if ((ret = set_autorate_fallback(dev, dev->txrate == TX_RATE_AUTO ? 1 : 0)) < 0) return ret; - if ((ret=set_pm_mode(dev, dev->pm_mode)) < 0) + if ((ret = set_pm_mode(dev, dev->pm_mode)) < 0) return ret; - - if ((ret=set_iroaming(dev, dev->international_roaming)) < 0) + if ((ret = set_iroaming(dev, dev->international_roaming)) < 0) return ret; - if (at76_debug & DBG_MIB) - { + if (at76_debug & DBG_MIB) { dump_mib_mac(dev); dump_mib_mac_addr(dev); dump_mib_mac_mgmt(dev); @@ -4395,25 +4383,24 @@ static int at76c503_open(struct net_device *netdev) dbg(DBG_PROC_ENTRY, "at76c503_open entry"); if (down_interruptible(&dev->sem)) - return -EINTR; + return -EINTR; /* if netdev->dev_addr != dev->mac_addr we must set the mac address in the device ! */ if (compare_ether_addr(netdev->dev_addr, dev->mac_addr)) { - if (set_mac_address(dev,netdev->dev_addr) >= 0) + if (set_mac_address(dev, netdev->dev_addr) >= 0) dbg(DBG_PROGRESS, "%s: set new MAC addr %s", netdev->name, mac2str(netdev->dev_addr)); } - #ifdef DEBUG dump_mib_mac_addr(dev); #endif - dev->site_survey_state=SITE_SURVEY_IDLE; + dev->site_survey_state = SITE_SURVEY_IDLE; dev->last_survey = jiffies; - dev->nr_submit_rx_tries = NR_SUBMIT_RX_TRIES; /* init counter */ + dev->nr_submit_rx_tries = NR_SUBMIT_RX_TRIES; /* init counter */ - if ((ret=submit_rx_urb(dev)) < 0) { + if ((ret = submit_rx_urb(dev)) < 0) { err("%s: open: submit_rx_urb failed: %d", netdev->name, ret); goto err; } @@ -4440,11 +4427,11 @@ static int at76c503_stop(struct net_device *netdev) netif_stop_queue(netdev); - dev->istate = INIT; + dev->istate = INIT; if (!(dev->device_unplugged)) { /* we are called by "ifconfig wlanX down", not because the - device isn't avail. anymore */ + device isn't avail. anymore */ set_radio(dev, 0); /* we unlink the read urb, because the _open() @@ -4455,12 +4442,12 @@ static int at76c503_stop(struct net_device *netdev) del_timer_sync(&dev->mgmt_timer); - spin_lock_irqsave(&dev->mgmt_spinlock,flags); + spin_lock_irqsave(&dev->mgmt_spinlock, flags); if (dev->next_mgmt_bulk) { kfree(dev->next_mgmt_bulk); dev->next_mgmt_bulk = NULL; } - spin_unlock_irqrestore(&dev->mgmt_spinlock,flags); + spin_unlock_irqrestore(&dev->mgmt_spinlock, flags); /* free the bss_list */ free_bss_list(dev); @@ -4480,14 +4467,15 @@ static struct net_device_stats *at76c503_get_stats(struct net_device *netdev) return &dev->stats; } -static struct iw_statistics *at76c503_get_wireless_stats(struct net_device *netdev) +static struct iw_statistics *at76c503_get_wireless_stats(struct net_device + *netdev) { struct at76c503 *dev = netdev_priv(netdev); dbg(DBG_IOCTL, "RETURN qual %d level %d noise %d updated %d", dev->wstats.qual.qual, dev->wstats.qual.level, dev->wstats.qual.noise, dev->wstats.qual.updated); - + return &dev->wstats; } @@ -4518,17 +4506,18 @@ static int at76c503_set_mac_address(struct net_device *netdev, void *addr) */ static void iwspy_update(struct at76c503 *dev, struct at76c503_rx_buffer *buf) { - struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *)buf->packet; + struct ieee80211_hdr_3addr *hdr = + (struct ieee80211_hdr_3addr *)buf->packet; struct iw_quality qual; /* We can only set the level here */ qual.updated = IW_QUAL_QUAL_INVALID | IW_QUAL_NOISE_INVALID; - qual.level = 0; - qual.noise = 0; + qual.level = 0; + qual.noise = 0; calc_level(dev, buf, &qual); spin_lock_bh(&(dev->spy_spinlock)); - + if (dev->spy_data.spy_number > 0) { wireless_spy_update(dev->netdev, hdr->addr2, &qual); } @@ -4540,68 +4529,65 @@ static void iwspy_update(struct at76c503 *dev, struct at76c503_rx_buffer *buf) * structure that describes the private ioctls/iw handlers of this driver */ static const struct iw_priv_args at76c503_priv_args[] = { - { PRIV_IOCTL_SET_SHORT_PREAMBLE, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "short_preamble" }, /* 0 - long, 1 -short */ - - { PRIV_IOCTL_SET_DEBUG, - /* we must pass the new debug mask as a string, - * 'cause iwpriv cannot parse hex numbers - * starting with 0x :-( */ - IW_PRIV_TYPE_CHAR | 10, 0, - "set_debug"}, /* set debug value */ - - { PRIV_IOCTL_SET_POWERSAVE_MODE, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "powersave_mode"}, /* 1 - active, 2 - power save, - 3 - smart power save */ - { PRIV_IOCTL_SET_SCAN_TIMES, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, - "scan_times"}, /* min_channel_time, - max_channel_time */ - { PRIV_IOCTL_SET_SCAN_MODE, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "scan_mode"}, /* 0 - active, 1 - passive scan */ - - { PRIV_IOCTL_SET_INTL_ROAMING, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "intl_roaming"}, + {PRIV_IOCTL_SET_SHORT_PREAMBLE, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, + "short_preamble"}, /* 0 - long, 1 -short */ + + {PRIV_IOCTL_SET_DEBUG, + /* we must pass the new debug mask as a string, + * 'cause iwpriv cannot parse hex numbers + * starting with 0x :-( */ + IW_PRIV_TYPE_CHAR | 10, 0, + "set_debug"}, /* set debug value */ + + {PRIV_IOCTL_SET_POWERSAVE_MODE, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, + "powersave_mode"}, /* 1 - active, 2 - power save, + 3 - smart power save */ + {PRIV_IOCTL_SET_SCAN_TIMES, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, + "scan_times"}, /* min_channel_time, + max_channel_time */ + {PRIV_IOCTL_SET_SCAN_MODE, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, + "scan_mode"}, /* 0 - active, 1 - passive scan */ + + {PRIV_IOCTL_SET_INTL_ROAMING, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, + "intl_roaming"}, /* needed for Kismet, orinoco mode */ - { PRIV_IOCTL_SET_MONITOR_MODE, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, - "monitor"}, /* param1: monitor mode: 0 (off), 1 (on,Prism header), - 2 (on, no Prism header) - param2: channel (to start scan at) */ + {PRIV_IOCTL_SET_MONITOR_MODE, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, + "monitor"}, /* param1: monitor mode: 0 (off), 1 (on,Prism header), + 2 (on, no Prism header) + param2: channel (to start scan at) */ }; - /******************************************************************************* * at76c503 implementations of iw_handler functions: */ static int at76c503_iw_handler_commit(struct net_device *netdev, - struct iw_request_info *info, - void *null, - char *extra) + struct iw_request_info *info, + void *null, char *extra) { struct at76c503 *dev = netdev_priv(netdev); unsigned long flags; - dbg(DBG_IOCTL, "%s %s: restarting the device", netdev->name, - __FUNCTION__); - + __FUNCTION__); + /* TODO: stop any pending tx bulk urb */ if (dev->istate != INIT) { dev->istate = INIT; /* stop pending management stuff */ del_timer_sync(&dev->mgmt_timer); - spin_lock_irqsave(&dev->mgmt_spinlock,flags); + spin_lock_irqsave(&dev->mgmt_spinlock, flags); if (dev->next_mgmt_bulk) { kfree(dev->next_mgmt_bulk); dev->next_mgmt_bulk = NULL; } - spin_unlock_irqrestore(&dev->mgmt_spinlock,flags); + spin_unlock_irqrestore(&dev->mgmt_spinlock, flags); netif_carrier_off(dev->netdev); netif_stop_queue(dev->netdev); @@ -4610,15 +4596,14 @@ static int at76c503_iw_handler_commit(struct net_device *netdev, /* do the restart after two seconds to catch * following ioctl's (from more params of iwconfig) * in _one_ restart */ - mod_timer(&dev->restart_timer, jiffies+2*HZ); - + mod_timer(&dev->restart_timer, jiffies + 2 * HZ); + return 0; } static int at76c503_iw_handler_get_name(struct net_device *netdev, - struct iw_request_info *info, - char *name, - char *extra) + struct iw_request_info *info, + char *name, char *extra) { strcpy(name, "IEEE 802.11b"); dbg(DBG_IOCTL, "%s: SIOCGIWNAME - name %s", netdev->name, name); @@ -4626,92 +4611,84 @@ static int at76c503_iw_handler_get_name(struct net_device *netdev, } static int at76c503_iw_handler_set_freq(struct net_device *netdev, - struct iw_request_info *info, - struct iw_freq *freq, - char *extra) + struct iw_request_info *info, + struct iw_freq *freq, char *extra) { struct at76c503 *dev = netdev_priv(netdev); int chan = -1; int ret = -EIWCOMMIT; - - dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - freq.m %d freq.e %d", netdev->name, - freq->m, freq->e); - + dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - freq.m %d freq.e %d", netdev->name, + freq->m, freq->e); + /* modelled on orinoco.c */ - if ((freq->e == 0) && (freq->m <= 1000)) - { + if ((freq->e == 0) && (freq->m <= 1000)) { /* Setting by channel number */ chan = freq->m; - } - else - { + } else { /* Setting by frequency - search the table */ int mult = 1; int i; - + for (i = 0; i < (6 - freq->e); i++) { mult *= 10; } - + for (i = 0; i < NUM_CHANNELS; i++) { if (freq->m == (channel_frequency[i] * mult)) chan = i + 1; } } - - if (chan < 1 || !dev->domain ) { + + if (chan < 1 || !dev->domain) { /* non-positive channels are invalid * we need a domain info to set the channel * either that or an invalid frequency was * provided by the user */ - ret = -EINVAL; + ret = -EINVAL; } else if (!dev->international_roaming) { - if (!(dev->domain->channel_map & (1 << (chan-1)))) { + if (!(dev->domain->channel_map & (1 << (chan - 1)))) { info("%s: channel %d not allowed for domain %s " "(and international_roaming is OFF)", dev->netdev->name, chan, dev->domain->name); ret = -EINVAL; } } - + if (ret == -EIWCOMMIT) { dev->channel = chan; dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - ch %d", netdev->name, chan); } - + return ret; } static int at76c503_iw_handler_get_freq(struct net_device *netdev, - struct iw_request_info *info, - struct iw_freq *freq, - char *extra) + struct iw_request_info *info, + struct iw_freq *freq, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + freq->m = dev->channel; freq->e = 0; - - if (dev->channel) - { - dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - freq %ld x 10e%d", netdev->name, - channel_frequency[dev->channel - 1], 6); + + if (dev->channel) { + dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - freq %ld x 10e%d", + netdev->name, channel_frequency[dev->channel - 1], 6); } dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - ch %d", netdev->name, dev->channel); - + return 0; } static int at76c503_iw_handler_set_mode(struct net_device *netdev, - struct iw_request_info *info, - __u32 *mode, - char *extra) + struct iw_request_info *info, + __u32 * mode, char *extra) { struct at76c503 *dev = netdev_priv(netdev); int ret = -EIWCOMMIT; - + dbg(DBG_IOCTL, "%s: SIOCSIWMODE - %d", netdev->name, *mode); - + if ((*mode != IW_MODE_ADHOC) && (*mode != IW_MODE_INFRA) && (*mode != IW_MODE_MONITOR)) { ret = -EINVAL; @@ -4722,78 +4699,72 @@ static int at76c503_iw_handler_set_mode(struct net_device *netdev, } static int at76c503_iw_handler_get_mode(struct net_device *netdev, - struct iw_request_info *info, - __u32 *mode, - char *extra) + struct iw_request_info *info, + __u32 * mode, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + *mode = dev->iw_mode; - + dbg(DBG_IOCTL, "%s: SIOCGIWMODE - %d", netdev->name, *mode); - + return 0; } static int at76c503_iw_handler_get_range(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *data, - char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { /* inspired by atmel.c */ struct at76c503 *dev = netdev_priv(netdev); - struct iw_range *range = (struct iw_range*)extra; + struct iw_range *range = (struct iw_range *)extra; int i; - + data->length = sizeof(struct iw_range); memset(range, 0, sizeof(struct iw_range)); - - + /* TODO: range->throughput = xxxxxx; */ - + range->min_nwid = 0x0000; range->max_nwid = 0x0000; - + /* this driver doesn't maintain sensitivity information */ range->sensitivity = 0; - + range->max_qual.qual = 100; range->max_qual.level = 100; range->max_qual.noise = 0; range->max_qual.updated = IW_QUAL_NOISE_INVALID; - + range->avg_qual.qual = 50; range->avg_qual.level = 50; range->avg_qual.noise = 0; range->avg_qual.updated = IW_QUAL_NOISE_INVALID; - + range->bitrate[0] = 1000000; range->bitrate[1] = 2000000; range->bitrate[2] = 5500000; range->bitrate[3] = 11000000; range->num_bitrates = 4; - - + range->min_rts = 0; range->max_rts = MAX_RTS_THRESHOLD; - + range->min_frag = MIN_FRAG_THRESHOLD; range->max_frag = MAX_FRAG_THRESHOLD; - - + /* TODO: find out what values we can use to describe PM capabilities */ range->pmp_flags = IW_POWER_ON; range->pmt_flags = IW_POWER_ON; range->pm_capa = 0; - - + range->encoding_size[0] = WEP_SMALL_KEY_LEN; range->encoding_size[1] = WEP_LARGE_KEY_LEN; range->num_encoding_sizes = 2; range->max_encoding_tokens = WEP_KEYS; /* TODO: do we need this? what is a valid value if we don't support? - range->encoding_login_index = -1; */ - + range->encoding_login_index = -1; */ + /* both WL-240U and Linksys WUSB11 v2.6 specify 15 dBm as output power - take this for all (ignore antenna gains) */ range->txpower[0] = 15; @@ -4802,125 +4773,117 @@ static int at76c503_iw_handler_get_range(struct net_device *netdev, range->we_version_source = WIRELESS_EXT; range->we_version_compiled = WIRELESS_EXT; - + /* same as the values used in atmel.c */ - range->retry_capa = IW_RETRY_LIMIT ; + range->retry_capa = IW_RETRY_LIMIT; range->retry_flags = IW_RETRY_LIMIT; range->r_time_flags = 0; range->min_retry = 1; range->max_retry = 255; - - + + range->num_channels = NUM_CHANNELS; range->num_frequency = 0; - - for (i = 0; - i < 32; /* number of bits in reg_domain.channel_map */ - i++) - { + + for (i = 0; i < 32; /* number of bits in reg_domain.channel_map */ + i++) { /* test if channel map bit is raised */ - if (dev->domain->channel_map & (0x1 << i)) - { + if (dev->domain->channel_map & (0x1 << i)) { range->num_frequency += 1; - + range->freq[i].i = i + 1; range->freq[i].m = channel_frequency[i] * 100000; - range->freq[i].e = 1; /* channel frequency*100000 * 10^1 */ + range->freq[i].e = 1; /* channel frequency*100000 * 10^1 */ } } - + dbg(DBG_IOCTL, "%s: SIOCGIWRANGE", netdev->name); - + return 0; } static int at76c503_iw_handler_set_spy(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *data, - char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { struct at76c503 *dev = netdev_priv(netdev); int ret = 0; - + dbg(DBG_IOCTL, "%s: SIOCSIWSPY - number of addresses %d", - netdev->name, data->length); - + netdev->name, data->length); + spin_lock_bh(&(dev->spy_spinlock)); - ret = iw_handler_set_spy(dev->netdev, info, (union iwreq_data *)data, - extra); + ret = iw_handler_set_spy(dev->netdev, info, (union iwreq_data *)data, + extra); spin_unlock_bh(&(dev->spy_spinlock)); - + return ret; } static int at76c503_iw_handler_get_spy(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *data, - char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { struct at76c503 *dev = netdev_priv(netdev); int ret = 0; - + spin_lock_bh(&(dev->spy_spinlock)); - ret = iw_handler_get_spy(dev->netdev, info, - (union iwreq_data *)data, extra); + ret = iw_handler_get_spy(dev->netdev, info, + (union iwreq_data *)data, extra); spin_unlock_bh(&(dev->spy_spinlock)); - + dbg(DBG_IOCTL, "%s: SIOCGIWSPY - number of addresses %d", - netdev->name, data->length); - + netdev->name, data->length); + return ret; } static int at76c503_iw_handler_set_thrspy(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *data, - char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { struct at76c503 *dev = netdev_priv(netdev); int ret; - + dbg(DBG_IOCTL, "%s: SIOCSIWTHRSPY - number of addresses %d)", - netdev->name, data->length); - + netdev->name, data->length); + spin_lock_bh(&(dev->spy_spinlock)); - ret = iw_handler_set_thrspy(netdev, info, (union iwreq_data *)data, - extra); + ret = iw_handler_set_thrspy(netdev, info, (union iwreq_data *)data, + extra); spin_unlock_bh(&(dev->spy_spinlock)); - + return ret; } static int at76c503_iw_handler_get_thrspy(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *data, - char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { struct at76c503 *dev = netdev_priv(netdev); int ret; - + spin_lock_bh(&(dev->spy_spinlock)); - ret = iw_handler_get_thrspy(netdev, info, (union iwreq_data *)data, - extra); + ret = iw_handler_get_thrspy(netdev, info, (union iwreq_data *)data, + extra); spin_unlock_bh(&(dev->spy_spinlock)); - + dbg(DBG_IOCTL, "%s: SIOCGIWTHRSPY - number of addresses %d)", - netdev->name, data->length); - + netdev->name, data->length); + return ret; } static int at76c503_iw_handler_set_wap(struct net_device *netdev, - struct iw_request_info *info, - struct sockaddr *ap_addr, - char *extra) + struct iw_request_info *info, + struct sockaddr *ap_addr, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - - dbg(DBG_IOCTL, "%s: SIOCSIWAP - wap/bssid %s", netdev->name, - mac2str(ap_addr->sa_data)); - + + dbg(DBG_IOCTL, "%s: SIOCSIWAP - wap/bssid %s", netdev->name, + mac2str(ap_addr->sa_data)); + /* if the incoming address == ff:ff:ff:ff:ff:ff, the user has chosen any or auto AP preference */ if (is_broadcast_ether_addr(ap_addr->sa_data) @@ -4931,37 +4894,34 @@ static int at76c503_iw_handler_set_wap(struct net_device *netdev, dev->wanted_bssid_valid = 1; memcpy(dev->wanted_bssid, ap_addr->sa_data, ETH_ALEN); } - + return -EIWCOMMIT; } static int at76c503_iw_handler_get_wap(struct net_device *netdev, - struct iw_request_info *info, - struct sockaddr *ap_addr, - char *extra) + struct iw_request_info *info, + struct sockaddr *ap_addr, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + ap_addr->sa_family = ARPHRD_ETHER; memcpy(ap_addr->sa_data, dev->bssid, ETH_ALEN); - - dbg(DBG_IOCTL, "%s: SIOCGIWAP - wap/bssid %s", netdev->name, - mac2str(ap_addr->sa_data)); - + + dbg(DBG_IOCTL, "%s: SIOCGIWAP - wap/bssid %s", netdev->name, + mac2str(ap_addr->sa_data)); + return 0; } - static int at76c503_iw_handler_set_scan(struct net_device *netdev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct at76c503 *dev = netdev_priv(netdev); unsigned long flags; int ret = 0; struct iw_scan_req *req = NULL; - + dbg(DBG_IOCTL, "%s: SIOCSIWSCAN", netdev->name); if (!netif_running(netdev)) @@ -4985,14 +4945,14 @@ static int at76c503_iw_handler_set_scan(struct net_device *netdev, /* stop pending management stuff */ del_timer_sync(&(dev->mgmt_timer)); - + spin_lock_irqsave(&(dev->mgmt_spinlock), flags); if (dev->next_mgmt_bulk) { kfree(dev->next_mgmt_bulk); dev->next_mgmt_bulk = NULL; } spin_unlock_irqrestore(&(dev->mgmt_spinlock), flags); - + if (netif_running(dev->netdev)) { /* pause network activity */ netif_carrier_off(dev->netdev); @@ -5011,29 +4971,30 @@ static int at76c503_iw_handler_set_scan(struct net_device *netdev, /* Sanity check values? */ if (req->min_channel_time > 0) { if (dev->istate == MONITORING) - dev->monitor_scan_min_time = req->min_channel_time; + dev->monitor_scan_min_time = + req->min_channel_time; else dev->scan_min_time = req->min_channel_time; } if (req->max_channel_time > 0) { if (dev->istate == MONITORING) - dev->monitor_scan_max_time = req->max_channel_time; + dev->monitor_scan_max_time = + req->max_channel_time; else dev->scan_max_time = req->max_channel_time; } - } - + } + /* change to scanning state */ - dev->istate = SCANNING; + dev->istate = SCANNING; defer_kevent(dev, KEVENT_SCAN); - + return ret; } static int at76c503_iw_handler_get_scan(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *data, - char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { struct at76c503 *dev = netdev_priv(netdev); unsigned long flags; @@ -5053,40 +5014,42 @@ static int at76c503_iw_handler_get_scan(struct net_device *netdev, return -EAGAIN; spin_lock_irqsave(&(dev->bss_list_spinlock), flags); - + list_for_each_safe(lptr, nptr, &(dev->bss_list)) { curr_bss = list_entry(lptr, struct bss_info, list); - + iwe->cmd = SIOCGIWAP; iwe->u.ap_addr.sa_family = ARPHRD_ETHER; memcpy(iwe->u.ap_addr.sa_data, curr_bss->bssid, 6); - curr_pos = iwe_stream_add_event(curr_pos, - extra + IW_SCAN_MAX_DATA, iwe, IW_EV_ADDR_LEN); - + curr_pos = iwe_stream_add_event(curr_pos, + extra + IW_SCAN_MAX_DATA, iwe, + IW_EV_ADDR_LEN); + iwe->u.data.length = curr_bss->ssid_len; iwe->cmd = SIOCGIWESSID; iwe->u.data.flags = 1; - + curr_pos = iwe_stream_add_point(curr_pos, extra + IW_SCAN_MAX_DATA, iwe, curr_bss->ssid); - + iwe->cmd = SIOCGIWMODE; - iwe->u.mode = (curr_bss->capa & WLAN_CAPABILITY_IBSS) ? - IW_MODE_ADHOC : - (curr_bss->capa & WLAN_CAPABILITY_ESS) ? - IW_MODE_MASTER : - IW_MODE_AUTO; - /* IW_MODE_AUTO = 0 which I thought is - * the most logical value to return in this case */ - curr_pos = iwe_stream_add_event(curr_pos, - extra + IW_SCAN_MAX_DATA, iwe, IW_EV_UINT_LEN); - + iwe->u.mode = (curr_bss->capa & WLAN_CAPABILITY_IBSS) ? + IW_MODE_ADHOC : + (curr_bss->capa & WLAN_CAPABILITY_ESS) ? + IW_MODE_MASTER : IW_MODE_AUTO; + /* IW_MODE_AUTO = 0 which I thought is + * the most logical value to return in this case */ + curr_pos = iwe_stream_add_event(curr_pos, + extra + IW_SCAN_MAX_DATA, iwe, + IW_EV_UINT_LEN); + iwe->cmd = SIOCGIWFREQ; iwe->u.freq.m = curr_bss->channel; iwe->u.freq.e = 0; - curr_pos = iwe_stream_add_event(curr_pos, - extra + IW_SCAN_MAX_DATA, iwe, IW_EV_FREQ_LEN); - + curr_pos = iwe_stream_add_event(curr_pos, + extra + IW_SCAN_MAX_DATA, iwe, + IW_EV_FREQ_LEN); + iwe->cmd = SIOCGIWENCODE; if (curr_bss->capa & WLAN_CAPABILITY_PRIVACY) { iwe->u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; @@ -5094,26 +5057,29 @@ static int at76c503_iw_handler_get_scan(struct net_device *netdev, iwe->u.data.flags = IW_ENCODE_DISABLED; } iwe->u.data.length = 0; - curr_pos = iwe_stream_add_point(curr_pos, - extra + IW_SCAN_MAX_DATA, iwe, NULL); + curr_pos = iwe_stream_add_point(curr_pos, + extra + IW_SCAN_MAX_DATA, iwe, + NULL); /* Add quality statistics */ iwe->cmd = IWEVQUAL; - iwe->u.qual.noise=0; - iwe->u.qual.updated=IW_QUAL_NOISE_INVALID | IW_QUAL_LEVEL_UPDATED; - iwe->u.qual.level = (curr_bss->rssi * 100 / 42); + iwe->u.qual.noise = 0; + iwe->u.qual.updated = + IW_QUAL_NOISE_INVALID | IW_QUAL_LEVEL_UPDATED; + iwe->u.qual.level = (curr_bss->rssi * 100 / 42); if (iwe->u.qual.level > 100) iwe->u.qual.level = 100; if ((dev->board_type == BOARDTYPE_503_INTERSIL_3861) || - (dev->board_type == BOARDTYPE_503_INTERSIL_3863)) { - iwe->u.qual.qual=curr_bss->link_qual; + (dev->board_type == BOARDTYPE_503_INTERSIL_3863)) { + iwe->u.qual.qual = curr_bss->link_qual; } else { - iwe->u.qual.qual=0; - iwe->u.qual.updated |= IW_QUAL_QUAL_INVALID; + iwe->u.qual.qual = 0; + iwe->u.qual.updated |= IW_QUAL_QUAL_INVALID; } /* Add new value to event */ - curr_pos = iwe_stream_add_event(curr_pos, - extra + IW_SCAN_MAX_DATA, iwe, IW_EV_QUAL_LEN); + curr_pos = iwe_stream_add_event(curr_pos, + extra + IW_SCAN_MAX_DATA, iwe, + IW_EV_QUAL_LEN); /* Rate : stuffing multiple values in a single event require a bit * more of magic - Jean II */ @@ -5123,63 +5089,59 @@ static int at76c503_iw_handler_get_scan(struct net_device *netdev, /* Those two flags are ignored... */ iwe->u.bitrate.fixed = iwe->u.bitrate.disabled = 0; /* Max 8 values */ - for(i=0; i < curr_bss->rates_len; i++) { + for (i = 0; i < curr_bss->rates_len; i++) { /* Bit rate given in 500 kb/s units (+ 0x80) */ - iwe->u.bitrate.value = - ((curr_bss->rates[i] & 0x7f) * 500000); + iwe->u.bitrate.value = + ((curr_bss->rates[i] & 0x7f) * 500000); /* Add new value to event */ - curr_val = iwe_stream_add_value(curr_pos, curr_val, - extra + IW_SCAN_MAX_DATA, - iwe, IW_EV_PARAM_LEN); + curr_val = iwe_stream_add_value(curr_pos, curr_val, + extra + + IW_SCAN_MAX_DATA, iwe, + IW_EV_PARAM_LEN); } /* Check if we added any event */ if ((curr_val - curr_pos) > IW_EV_LCP_LEN) curr_pos = curr_val; - /* more information may be sent back using IWECUSTOM */ } - + spin_unlock_irqrestore(&(dev->bss_list_spinlock), flags); - + data->length = (curr_pos - extra); data->flags = 0; - + kfree(iwe); return 0; } - static int at76c503_iw_handler_set_essid(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *data, - char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + dbg(DBG_IOCTL, "%s: SIOCSIWESSID - %s", netdev->name, extra); - + if (data->flags) { memcpy(dev->essid, extra, data->length); dev->essid_size = data->length; - } - else { + } else { /* Use any SSID */ dev->essid_size = 0; } - + return -EIWCOMMIT; } static int at76c503_iw_handler_get_essid(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *data, - char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + if (dev->essid_size) { /* not the ANY ssid in dev->essid */ data->flags = 1; @@ -5189,8 +5151,7 @@ static int at76c503_iw_handler_get_essid(struct net_device *netdev, data->length += 1; } else { /* the ANY ssid was specified */ - if (dev->istate == CONNECTED && - dev->curr_bss != NULL) { + if (dev->istate == CONNECTED && dev->curr_bss != NULL) { /* report the SSID we have found */ data->flags = 1; data->length = dev->curr_bss->ssid_len; @@ -5199,217 +5160,222 @@ static int at76c503_iw_handler_get_essid(struct net_device *netdev, data->length += 1; } else { /* report ANY back */ - data->flags=0; - data->length=0; + data->flags = 0; + data->length = 0; } } - + dbg(DBG_IOCTL, "%s: SIOCGIWESSID - %s", netdev->name, extra); - + return 0; } static int at76c503_iw_handler_set_nickname(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *data, - char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + dbg(DBG_IOCTL, "%s: SIOCSIWNICKN - %s", netdev->name, extra); - + /* iwconfig gives length including 0 byte like in the case of essid */ memcpy(dev->nickn, extra, data->length); - + return 0; } static int at76c503_iw_handler_get_nickname(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *data, - char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + data->length = strlen(dev->nickn); memcpy(extra, dev->nickn, data->length); extra[data->length] = '\0'; data->length += 1; - + dbg(DBG_IOCTL, "%s: SIOCGIWNICKN - %s", netdev->name, extra); - + return 0; } static int at76c503_iw_handler_set_rate(struct net_device *netdev, - struct iw_request_info *info, - struct iw_param *bitrate, - char *extra) + struct iw_request_info *info, + struct iw_param *bitrate, char *extra) { struct at76c503 *dev = netdev_priv(netdev); int ret = -EIWCOMMIT; - - dbg(DBG_IOCTL, "%s: SIOCSIWRATE - %d", netdev->name, - bitrate->value); - - switch (bitrate->value) - { - case -1: dev->txrate = TX_RATE_AUTO; break; /* auto rate */ - case 1000000: dev->txrate = TX_RATE_1MBIT; break; - case 2000000: dev->txrate = TX_RATE_2MBIT; break; - case 5500000: dev->txrate = TX_RATE_5_5MBIT; break; - case 11000000: dev->txrate = TX_RATE_11MBIT; break; - default: ret = -EINVAL; + + dbg(DBG_IOCTL, "%s: SIOCSIWRATE - %d", netdev->name, bitrate->value); + + switch (bitrate->value) { + case -1: + dev->txrate = TX_RATE_AUTO; + break; /* auto rate */ + case 1000000: + dev->txrate = TX_RATE_1MBIT; + break; + case 2000000: + dev->txrate = TX_RATE_2MBIT; + break; + case 5500000: + dev->txrate = TX_RATE_5_5MBIT; + break; + case 11000000: + dev->txrate = TX_RATE_11MBIT; + break; + default: + ret = -EINVAL; } - + return ret; } static int at76c503_iw_handler_get_rate(struct net_device *netdev, - struct iw_request_info *info, - struct iw_param *bitrate, - char *extra) + struct iw_request_info *info, + struct iw_param *bitrate, char *extra) { struct at76c503 *dev = netdev_priv(netdev); int ret = 0; - - switch (dev->txrate) - { + + switch (dev->txrate) { /* return max rate if RATE_AUTO */ - case TX_RATE_AUTO: bitrate->value = 11000000; break; - case TX_RATE_1MBIT: bitrate->value = 1000000; break; - case TX_RATE_2MBIT: bitrate->value = 2000000; break; - case TX_RATE_5_5MBIT: bitrate->value = 5500000; break; - case TX_RATE_11MBIT: bitrate->value = 11000000; break; - default: ret = -EINVAL; + case TX_RATE_AUTO: + bitrate->value = 11000000; + break; + case TX_RATE_1MBIT: + bitrate->value = 1000000; + break; + case TX_RATE_2MBIT: + bitrate->value = 2000000; + break; + case TX_RATE_5_5MBIT: + bitrate->value = 5500000; + break; + case TX_RATE_11MBIT: + bitrate->value = 11000000; + break; + default: + ret = -EINVAL; } - + bitrate->fixed = (dev->txrate != TX_RATE_AUTO); bitrate->disabled = 0; - + dbg(DBG_IOCTL, "%s: SIOCGIWRATE - %d", netdev->name, bitrate->value); - + return ret; } static int at76c503_iw_handler_set_rts(struct net_device *netdev, - struct iw_request_info *info, - struct iw_param *rts, - char *extra) + struct iw_request_info *info, + struct iw_param *rts, char *extra) { struct at76c503 *dev = netdev_priv(netdev); int ret = -EIWCOMMIT; int rthr = rts->value; - + dbg(DBG_IOCTL, "%s: SIOCSIWRTS - value %d disabled %s", - netdev->name, rts->value, - (rts->disabled) ? "true" : "false"); - + netdev->name, rts->value, (rts->disabled) ? "true" : "false"); + if (rts->disabled) rthr = MAX_RTS_THRESHOLD; - + if ((rthr < 0) || (rthr > MAX_RTS_THRESHOLD)) { ret = -EINVAL; } else { dev->rts_threshold = rthr; } - + return ret; } static int at76c503_iw_handler_get_rts(struct net_device *netdev, - struct iw_request_info *info, - struct iw_param *rts, - char *extra) + struct iw_request_info *info, + struct iw_param *rts, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + rts->value = dev->rts_threshold; rts->disabled = (rts->value >= MAX_RTS_THRESHOLD); rts->fixed = 1; - + dbg(DBG_IOCTL, "%s: SIOCGIWRTS - value %d disabled %s", - netdev->name, rts->value, - (rts->disabled) ? "true" : "false"); - + netdev->name, rts->value, (rts->disabled) ? "true" : "false"); + return 0; } static int at76c503_iw_handler_set_frag(struct net_device *netdev, - struct iw_request_info *info, - struct iw_param *frag, - char *extra) + struct iw_request_info *info, + struct iw_param *frag, char *extra) { struct at76c503 *dev = netdev_priv(netdev); int ret = -EIWCOMMIT; int fthr = frag->value; - + dbg(DBG_IOCTL, "%s: SIOCSIWFRAG - value %d, disabled %s", - netdev->name, frag->value, - (frag->disabled) ? "true" : "false"); - + netdev->name, frag->value, (frag->disabled) ? "true" : "false"); + if (frag->disabled) fthr = MAX_FRAG_THRESHOLD; - + if ((fthr < MIN_FRAG_THRESHOLD) || (fthr > MAX_FRAG_THRESHOLD)) { ret = -EINVAL; } else { dev->frag_threshold = fthr & ~0x1; /* get an even value */ } - + return ret; } static int at76c503_iw_handler_get_frag(struct net_device *netdev, - struct iw_request_info *info, - struct iw_param *frag, - char *extra) + struct iw_request_info *info, + struct iw_param *frag, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + frag->value = dev->frag_threshold; frag->disabled = (frag->value >= MAX_FRAG_THRESHOLD); frag->fixed = 1; - + dbg(DBG_IOCTL, "%s: SIOCGIWFRAG - value %d, disabled %s", - netdev->name, frag->value, - (frag->disabled) ? "true" : "false"); - + netdev->name, frag->value, (frag->disabled) ? "true" : "false"); + return 0; } static int at76c503_iw_handler_get_txpow(struct net_device *netdev, - struct iw_request_info *info, - struct iw_param *power, - char *extra) + struct iw_request_info *info, + struct iw_param *power, char *extra) { power->value = 15; power->fixed = 1; /* No power control */ power->disabled = 0; power->flags = IW_TXPOW_DBM; - - dbg(DBG_IOCTL, "%s: SIOCGIWTXPOW - txpow %d dBm", netdev->name, - power->value); - + + dbg(DBG_IOCTL, "%s: SIOCGIWTXPOW - txpow %d dBm", netdev->name, + power->value); + return 0; } /* jal: short retry is handled by the firmware (at least 0.90.x), while long retry is not (?) */ static int at76c503_iw_handler_set_retry(struct net_device *netdev, - struct iw_request_info *info, - struct iw_param *retry, - char *extra) + struct iw_request_info *info, + struct iw_param *retry, char *extra) { struct at76c503 *dev = netdev_priv(netdev); int ret = -EIWCOMMIT; - + dbg(DBG_IOCTL, "%s: SIOCSIWRETRY disabled %d flags x%x val %d", netdev->name, retry->disabled, retry->flags, retry->value); - + if (!retry->disabled && (retry->flags & IW_RETRY_LIMIT)) { - if ((retry->flags & IW_RETRY_MIN) || + if ((retry->flags & IW_RETRY_MIN) || !(retry->flags & IW_RETRY_MAX)) { dev->short_retry_limit = retry->value; } else @@ -5417,109 +5383,104 @@ static int at76c503_iw_handler_set_retry(struct net_device *netdev, } else { ret = -EINVAL; } - + return ret; } /* adapted (ripped) from atmel.c */ static int at76c503_iw_handler_get_retry(struct net_device *netdev, - struct iw_request_info *info, - struct iw_param *retry, - char *extra) + struct iw_request_info *info, + struct iw_param *retry, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + dbg(DBG_IOCTL, "%s: SIOCGIWRETRY", netdev->name); - + retry->disabled = 0; /* Can't be disabled */ - + retry->flags = IW_RETRY_LIMIT; retry->value = dev->short_retry_limit; - + return 0; } static int at76c503_iw_handler_set_encode(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *encoding, - char *extra) + struct iw_request_info *info, + struct iw_point *encoding, + char *extra) { struct at76c503 *dev = netdev_priv(netdev); int index = (encoding->flags & IW_ENCODE_INDEX) - 1; int len = encoding->length; - + dbg(DBG_IOCTL, "%s: SIOCSIWENCODE - enc.flags %08x " - "pointer %p len %d", netdev->name, encoding->flags, - encoding->pointer, encoding->length); + "pointer %p len %d", netdev->name, encoding->flags, + encoding->pointer, encoding->length); dbg(DBG_IOCTL, "%s: SIOCSIWENCODE - old wepstate: enabled %s key_id %d " - "auth_mode %s", - netdev->name, (dev->wep_enabled) ? "true" : "false", - dev->wep_key_id, - (dev->auth_mode == WLAN_AUTH_SHARED_KEY) ? - "restricted" : "open"); - + "auth_mode %s", + netdev->name, (dev->wep_enabled) ? "true" : "false", + dev->wep_key_id, + (dev->auth_mode == WLAN_AUTH_SHARED_KEY) ? "restricted" : "open"); + /* take the old default key if index is invalid */ if ((index < 0) || (index >= WEP_KEYS)) index = dev->wep_key_id; - - if (len > 0) - { + + if (len > 0) { if (len > WEP_LARGE_KEY_LEN) len = WEP_LARGE_KEY_LEN; - + memset(dev->wep_keys[index], 0, WEP_KEY_LEN); memcpy(dev->wep_keys[index], extra, len); dev->wep_keys_len[index] = (len <= WEP_SMALL_KEY_LEN) ? - WEP_SMALL_KEY_LEN : WEP_LARGE_KEY_LEN; + WEP_SMALL_KEY_LEN : WEP_LARGE_KEY_LEN; dev->wep_enabled = 1; } - + dev->wep_key_id = index; dev->wep_enabled = ((encoding->flags & IW_ENCODE_DISABLED) == 0); - + if (encoding->flags & IW_ENCODE_RESTRICTED) dev->auth_mode = WLAN_AUTH_SHARED_KEY; if (encoding->flags & IW_ENCODE_OPEN) dev->auth_mode = WLAN_AUTH_OPEN; - + dbg(DBG_IOCTL, "%s: SIOCSIWENCODE - new wepstate: enabled %s key_id %d " - "key_len %d auth_mode %s", - netdev->name, (dev->wep_enabled) ? "true" : "false", - dev->wep_key_id + 1, dev->wep_keys_len[dev->wep_key_id], - (dev->auth_mode == WLAN_AUTH_SHARED_KEY) ? - "restricted" : "open"); - + "key_len %d auth_mode %s", + netdev->name, (dev->wep_enabled) ? "true" : "false", + dev->wep_key_id + 1, dev->wep_keys_len[dev->wep_key_id], + (dev->auth_mode == WLAN_AUTH_SHARED_KEY) ? "restricted" : "open"); + return -EIWCOMMIT; } static int at76c503_iw_handler_get_encode(struct net_device *netdev, - struct iw_request_info *info, - struct iw_point *encoding, - char *extra) + struct iw_request_info *info, + struct iw_point *encoding, + char *extra) { struct at76c503 *dev = netdev_priv(netdev); int index = (encoding->flags & IW_ENCODE_INDEX) - 1; - + if ((index < 0) || (index >= WEP_KEYS)) index = dev->wep_key_id; - - encoding->flags = - (dev->auth_mode == WLAN_AUTH_SHARED_KEY) ? - IW_ENCODE_RESTRICTED : IW_ENCODE_OPEN; - + + encoding->flags = + (dev->auth_mode == WLAN_AUTH_SHARED_KEY) ? + IW_ENCODE_RESTRICTED : IW_ENCODE_OPEN; + if (!dev->wep_enabled) encoding->flags |= IW_ENCODE_DISABLED; - - if (encoding->pointer) - { + + if (encoding->pointer) { encoding->length = dev->wep_keys_len[index]; - + memcpy(extra, dev->wep_keys[index], dev->wep_keys_len[index]); - + encoding->flags |= (index + 1); } - + dbg(DBG_IOCTL, "%s: SIOCGIWENCODE - enc.flags %08x " "pointer %p len %d", netdev->name, encoding->flags, encoding->pointer, encoding->length); @@ -5529,83 +5490,71 @@ static int at76c503_iw_handler_get_encode(struct net_device *netdev, dev->wep_key_id + 1, dev->wep_keys_len[dev->wep_key_id], (dev->auth_mode == WLAN_AUTH_SHARED_KEY) ? "restricted" : "open"); - + return 0; } static int at76c503_iw_handler_set_power(struct net_device *netdev, - struct iw_request_info *info, - struct iw_param *power, - char *extra) + struct iw_request_info *info, + struct iw_param *power, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + dbg(DBG_IOCTL, "%s: SIOCSIWPOWER - disabled %s flags x%x value x%x", netdev->name, (power->disabled) ? "true" : "false", power->flags, power->value); - - if (power->disabled) - { + + if (power->disabled) { dev->pm_mode = PM_ACTIVE; - } - else - { + } else { /* we set the listen_interval based on the period given no idea how to handle the timeout of iwconfig ??? */ - if (power->flags & IW_POWER_PERIOD) - { + if (power->flags & IW_POWER_PERIOD) { dev->pm_period_us = power->value; } - + dev->pm_mode = PM_SAVE; /* use iw_priv to select SMART_SAVE */ } - + return -EIWCOMMIT; } static int at76c503_iw_handler_get_power(struct net_device *netdev, - struct iw_request_info *info, - struct iw_param *power, - char *extra) + struct iw_request_info *info, + struct iw_param *power, char *extra) { struct at76c503 *dev = netdev_priv(netdev); - + power->disabled = dev->pm_mode == PM_ACTIVE; - - if ((power->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) - { + + if ((power->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { power->flags = IW_POWER_TIMEOUT; power->value = 0; - } - else - { + } else { unsigned long flags; u16 beacon_int; /* of the current bss */ - + power->flags = IW_POWER_PERIOD; spin_lock_irqsave(&dev->bss_list_spinlock, flags); beacon_int = dev->curr_bss != NULL ? - dev->curr_bss->beacon_interval : 0; + dev->curr_bss->beacon_interval : 0; spin_unlock_irqrestore(&dev->bss_list_spinlock, flags); - - if (beacon_int != 0) - { + + if (beacon_int != 0) { power->value = - (beacon_int * dev->pm_period_beacon) << 10; - } - else - { + (beacon_int * dev->pm_period_beacon) << 10; + } else { power->value = dev->pm_period_us; } } - + power->flags |= IW_POWER_ALL_R; - + dbg(DBG_IOCTL, "%s: SIOCGIWPOWER - disabled %s flags x%x value x%x", netdev->name, (power->disabled) ? "true" : "false", power->flags, power->value); - + return 0; } @@ -5620,10 +5569,10 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_SHORT_PREAMBLE struct at76c503 *dev = netdev_priv(netdev); int val = *((int *)name); int ret = -EIWCOMMIT; - + dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_SHORT_PREAMBLE, %d", - netdev->name, val); - + netdev->name, val); + if (val < 0 || val > 2) { /* allow value of 2 - in the win98 driver it stands for "auto preamble" ...? */ @@ -5631,7 +5580,7 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_SHORT_PREAMBLE } else { dev->preamble_type = val; } - + return ret; } @@ -5641,32 +5590,31 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_DEBUG { char *ptr; u32 val; - + if (data->length > 0) { val = simple_strtol(extra, &ptr, 0); - + if (ptr == extra) { val = DBG_DEFAULTS; } - + dbg_uc("%s: PRIV_IOCTL_SET_DEBUG input %d: %s -> x%x", netdev->name, data->length, extra, val); } else { val = DBG_DEFAULTS; } - + dbg_uc("%s: PRIV_IOCTL_SET_DEBUG, old 0x%x new 0x%x", - netdev->name, at76_debug, val); - + netdev->name, at76_debug, val); + /* jal: some more output to pin down lockups */ dbg_uc("%s: netif running %d queue_stopped %d carrier_ok %d", - netdev->name, - netif_running(netdev), - netif_queue_stopped(netdev), - netif_carrier_ok(netdev)); - + netdev->name, + netif_running(netdev), + netif_queue_stopped(netdev), netif_carrier_ok(netdev)); + at76_debug = val; - + return 0; } @@ -5677,17 +5625,17 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_POWERSAVE_MODE struct at76c503 *dev = netdev_priv(netdev); int val = *((int *)name); int ret = -EIWCOMMIT; - + dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_POWERSAVE_MODE, %d (%s)", - netdev->name, val, - val == PM_ACTIVE ? "active" : val == PM_SAVE ? "save" : - val == PM_SMART_SAVE ? "smart save" : "<invalid>"); + netdev->name, val, + val == PM_ACTIVE ? "active" : val == PM_SAVE ? "save" : + val == PM_SMART_SAVE ? "smart save" : "<invalid>"); if (val < PM_ACTIVE || val > PM_SMART_SAVE) { ret = -EINVAL; } else { dev->pm_mode = val; } - + return ret; } @@ -5699,9 +5647,9 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_SCAN_TIMES int mint = *((int *)name); int maxt = *((int *)name + 1); int ret = -EIWCOMMIT; - + dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_SCAN_TIMES - min %d max %d", - netdev->name, mint, maxt); + netdev->name, mint, maxt); if (mint <= 0 || maxt <= 0 || mint > maxt) { ret = -EINVAL; } else { @@ -5714,7 +5662,7 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_SCAN_TIMES dev->scan_max_time = maxt; } } - + return ret; } @@ -5725,17 +5673,17 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_SCAN_MODE struct at76c503 *dev = netdev_priv(netdev); int val = *((int *)name); int ret = -EIWCOMMIT; - + dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_SCAN_MODE - mode %s", netdev->name, (val = SCAN_TYPE_ACTIVE) ? "active" : (val = SCAN_TYPE_PASSIVE) ? "passive" : "<invalid>"); - + if (val != SCAN_TYPE_ACTIVE && val != SCAN_TYPE_PASSIVE) { ret = -EINVAL; } else { dev->scan_mode = val; } - + return ret; } @@ -5765,8 +5713,8 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_INTL_ROAMING int ret = -EIWCOMMIT; dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_INTL_ROAMING - mode %s", - netdev->name, (val == IR_OFF) ? "off" : - (val == IR_ON) ? "on" : "<invalid>"); + netdev->name, (val == IR_OFF) ? "off" : + (val == IR_ON) ? "on" : "<invalid>"); if (val != IR_OFF && val != IR_ON) { ret = -EINVAL; @@ -5796,7 +5744,7 @@ static void set_monitor_mode(struct at76c503 *dev, int use_prism) dev->netdev->type = ARPHRD_IEEE80211; } } else { - dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE OFF", + dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE OFF", dev->netdev->name); dev->netdev->type = ARPHRD_ETHER; } @@ -5812,18 +5760,18 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_MONITOR_MODE int channel = params[1]; int ret = 0; - dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_MONITOR_MODE - mode %d ch %d", + dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_MONITOR_MODE - mode %d ch %d", netdev->name, mode, channel); if (mode != MM_OFF && mode != MM_ON && mode != MM_ON_NO_PRISM) ret = -EINVAL; else { if (mode != MM_OFF) { - if ((channel >= 1) && - (channel <= (sizeof(channel_frequency) / - sizeof(channel_frequency[0])))) - /* INFO: This doesn't actually affect the scan */ - dev->channel = channel; + if ((channel >= 1) && + (channel <= (sizeof(channel_frequency) / + sizeof(channel_frequency[0])))) + /* INFO: This doesn't actually affect the scan */ + dev->channel = channel; dev->monitor_prism_header = (mode == MM_ON); @@ -5884,8 +5832,7 @@ static const iw_handler at76c503_handlers[] = }; /*structure that advertises the private iw handlers of this driver */ -static const iw_handler at76c503_priv_handlers[] = -{ +static const iw_handler at76c503_priv_handlers[] = { (iw_handler) at76c503_iw_handler_PRIV_IOCTL_SET_SHORT_PREAMBLE, (iw_handler) NULL, (iw_handler) at76c503_iw_handler_PRIV_IOCTL_SET_DEBUG, @@ -5915,14 +5862,14 @@ static const struct iw_handler_def at76c503_handler_def = static void at76c503_ethtool_get_drvinfo(struct net_device *netdev, - struct ethtool_drvinfo *info) + struct ethtool_drvinfo *info) { struct at76c503 *dev = netdev_priv(netdev); strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1); strncpy(info->version, DRIVER_VERSION, sizeof(info->version)); - info->version[sizeof(info->version)-1] = '\0'; + info->version[sizeof(info->version) - 1] = '\0'; snprintf(info->bus_info, sizeof(info->bus_info) - 1, "usb%d:%d", dev->udev->bus->busnum, dev->udev->devnum); @@ -5948,7 +5895,7 @@ static void at76c503_delete_device(struct at76c503 *dev) { int i; - if (!dev) + if (!dev) return; /* signal to _stop() that the device is gone */ @@ -5963,7 +5910,7 @@ static void at76c503_delete_device(struct at76c503 *dev) usb_put_dev(dev->udev); /* assuming we used keventd, it must quiesce too */ - flush_scheduled_work (); + flush_scheduled_work(); if (dev->bulk_out_buffer != NULL) kfree(dev->bulk_out_buffer); @@ -5983,7 +5930,7 @@ static void at76c503_delete_device(struct at76c503 *dev) usb_free_urb(dev->ctrl_urb); } - dbg(DBG_PROC_ENTRY,"%s: unlinked urbs",__FUNCTION__); + dbg(DBG_PROC_ENTRY, "%s: unlinked urbs", __FUNCTION__); if (dev->rx_skb != NULL) kfree_skb(dev->rx_skb); @@ -5992,10 +5939,10 @@ static void at76c503_delete_device(struct at76c503 *dev) del_timer_sync(&dev->bss_list_timer); if (dev->istate == CONNECTED) { - iwevent_bss_disconnect(dev->netdev); + iwevent_bss_disconnect(dev->netdev); } - for(i=0; i < NR_RX_DATA_BUF; i++) + for (i = 0; i < NR_RX_DATA_BUF; i++) if (dev->rx_data[i].skb != NULL) { dev_kfree_skb(dev->rx_data[i].skb); dev->rx_data[i].skb = NULL; @@ -6006,7 +5953,6 @@ static void at76c503_delete_device(struct at76c503 *dev) dbg(DBG_PROC_ENTRY, "%s: EXIT", __FUNCTION__); } - static int at76c503_alloc_urbs(struct at76c503 *dev) { struct usb_interface *interface = dev->interface; @@ -6026,9 +5972,7 @@ static int at76c503_alloc_urbs(struct at76c503 *dev) dbg(DBG_URB, "%s: %d. endpoint: addr x%x attr x%x", __FUNCTION__, - i, - endpoint->bEndpointAddress, - endpoint->bmAttributes); + i, endpoint->bEndpointAddress, endpoint->bmAttributes); if ((endpoint->bEndpointAddress & 0x80) && ((endpoint->bmAttributes & 3) == 0x02)) { @@ -6041,7 +5985,7 @@ static int at76c503_alloc_urbs(struct at76c503 *dev) } dev->bulk_in_endpointAddr = endpoint->bEndpointAddress; } - + if (((endpoint->bEndpointAddress & 0x80) == 0x00) && ((endpoint->bmAttributes & 3) == 0x02)) { /* we found a bulk out endpoint */ @@ -6050,11 +5994,11 @@ static int at76c503_alloc_urbs(struct at76c503 *dev) err("no free urbs available"); return -1; } - buffer_size = sizeof(struct at76c503_tx_buffer) + - MAX_PADDING_SIZE; + buffer_size = sizeof(struct at76c503_tx_buffer) + + MAX_PADDING_SIZE; dev->bulk_out_size = buffer_size; dev->bulk_out_endpointAddr = endpoint->bEndpointAddress; - dev->bulk_out_buffer = kmalloc (buffer_size, GFP_KERNEL); + dev->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL); if (!dev->bulk_out_buffer) { err("couldn't allocate bulk_out_buffer"); return -1; @@ -6083,7 +6027,6 @@ static int at76c503_alloc_urbs(struct at76c503 *dev) return 0; } - static struct at76c503 *alloc_new_device(struct usb_device *udev, int board_type) { @@ -6104,8 +6047,8 @@ static struct at76c503 *alloc_new_device(struct usb_device *udev, dev->udev = udev; dev->netdev = netdev; - init_MUTEX (&dev->sem); - INIT_WORK (&dev->kevent, kevent); + init_MUTEX(&dev->sem); + INIT_WORK(&dev->kevent, kevent); dev->open_count = 0; @@ -6121,7 +6064,6 @@ static struct at76c503 *alloc_new_device(struct usb_device *udev, dev->fw_dl_timer.data = (unsigned long)dev; dev->fw_dl_timer.function = fw_dl_timeout; - spin_lock_init(&dev->mgmt_spinlock); dev->next_mgmt_bulk = NULL; dev->istate = INTFW_DOWNLOAD; @@ -6138,7 +6080,7 @@ static struct at76c503 *alloc_new_device(struct usb_device *udev, spin_lock_init(&dev->spy_spinlock); /* mark all rx data entries as unused */ - for(i=0; i < NR_RX_DATA_BUF; i++) + for (i = 0; i < NR_RX_DATA_BUF; i++) dev->rx_data[i].skb = NULL; dev->tasklet.func = rx_tasklet; @@ -6205,12 +6147,11 @@ static int init_new_device(struct at76c503 *dev) goto error; } - dev->domain = getRegDomain(dev->regulatory_domain); + dev->domain = getRegDomain(dev->regulatory_domain); /* init. netdev->dev_addr */ memcpy(netdev->dev_addr, dev->mac_addr, ETH_ALEN); info("device's MAC %s, regulatory domain %s (id %d)", - mac2str(dev->mac_addr), dev->domain->name, - dev->regulatory_domain); + mac2str(dev->mac_addr), dev->domain->name, dev->regulatory_domain); /* initializing */ dev->international_roaming = international_roaming; @@ -6226,9 +6167,8 @@ static int init_new_device(struct at76c503 *dev) dev->txrate = TX_RATE_AUTO; dev->preamble_type = preamble_type; dev->beacon_period = 100; - dev->beacons_last_qual=jiffies_to_msecs(jiffies); - dev->auth_mode = auth_mode ? WLAN_AUTH_SHARED_KEY : - WLAN_AUTH_OPEN; + dev->beacons_last_qual = jiffies_to_msecs(jiffies); + dev->auth_mode = auth_mode ? WLAN_AUTH_SHARED_KEY : WLAN_AUTH_OPEN; dev->scan_min_time = scan_min_time; dev->scan_max_time = scan_max_time; dev->scan_mode = scan_mode; @@ -6248,8 +6188,8 @@ static int init_new_device(struct at76c503 *dev) netdev->hard_start_xmit = at76c503_tx; netdev->tx_timeout = at76c503_tx_timeout; netdev->watchdog_timeo = 2 * HZ; - netdev->wireless_handlers = - (struct iw_handler_def*)&at76c503_handler_def; + netdev->wireless_handlers = + (struct iw_handler_def *)&at76c503_handler_def; netdev->set_multicast_list = at76c503_set_multicast; netdev->set_mac_address = at76c503_set_mac_address; @@ -6263,7 +6203,7 @@ static int init_new_device(struct at76c503 *dev) dev->netdev_registered = 1; /* we let this timer run the whole time this driver instance lives */ - mod_timer(&dev->bss_list_timer, jiffies+BSS_LIST_TIMEOUT); + mod_timer(&dev->bss_list_timer, jiffies + BSS_LIST_TIMEOUT); return 0; @@ -6300,31 +6240,31 @@ static int at76c503_get_fw_info(u8 *fw_data, int fw_size, */ __le32 val; - + if (fw_size < 0x21) { - err("fw too short (x%x)",fw_size); + err("fw too short (x%x)", fw_size); return -EFAULT; } /* crc currently not checked */ - memcpy(&val,fw_data+4,4); + memcpy(&val, fw_data + 4, 4); *board = le32_to_cpu(val); - memcpy(&val,fw_data+8,4); + memcpy(&val, fw_data + 8, 4); *version = le32_to_cpu(val); - memcpy(&val,fw_data+0xc,4); + memcpy(&val, fw_data + 0xc, 4); *str = fw_data + le32_to_cpu(val); - memcpy(&val,fw_data+0x10,4); + memcpy(&val, fw_data + 0x10, 4); *int_fw = fw_data + le32_to_cpu(val); - memcpy(&val,fw_data+0x14,4); + memcpy(&val, fw_data + 0x14, 4); *int_fw_size = le32_to_cpu(val); - memcpy(&val,fw_data+0x18,4); + memcpy(&val, fw_data + 0x18, 4); *ext_fw = fw_data + le32_to_cpu(val); - memcpy(&val,fw_data+0x1c,4); + memcpy(&val, fw_data + 0x1c, 4); *ext_fw_size = le32_to_cpu(val); return 0; @@ -6345,7 +6285,7 @@ static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size, usb_get_dev(udev); - if ((dev = alloc_new_device(udev, (u8)board_type)) == NULL) { + if ((dev = alloc_new_device(udev, (u8) board_type)) == NULL) { ret = -ENOMEM; goto error; } @@ -6361,9 +6301,10 @@ static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size, we get 204 with 2.4.23, Fiberline FL-WL240u (505A+RFMD2958) ??? */ if (op_mode == OPMODE_HW_CONFIG_MODE) { - err("cannot handle a device in HW_CONFIG_MODE (opmode %d)", op_mode); - ret = -ENODEV; - goto error; + err("cannot handle a device in HW_CONFIG_MODE (opmode %d)", + op_mode); + ret = -ENODEV; + goto error; } if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH && @@ -6372,19 +6313,20 @@ static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size, dbg(DBG_DEVSTART, "need to download firmware"); /* disassem. the firmware */ - if ((ret=at76c503_get_fw_info(fw_data, fw_size, &dev->board_type, - &version, &id_str, - &dev->intfw, &dev->intfw_size, - &dev->extfw, &dev->extfw_size))) { + if ((ret = + at76c503_get_fw_info(fw_data, fw_size, &dev->board_type, + &version, &id_str, &dev->intfw, + &dev->intfw_size, &dev->extfw, + &dev->extfw_size))) { goto error; } dbg(DBG_DEVSTART, "firmware board %u version %u.%u.%u#%u " "(int %x:%tx, ext %x:%tx)", - dev->board_type, version>>24,(version>>16)&0xff, - (version>>8)&0xff, version&0xff, - dev->intfw_size, dev->intfw-fw_data, - dev->extfw_size, dev->extfw-fw_data); + dev->board_type, version >> 24, (version >> 16) & 0xff, + (version >> 8) & 0xff, version & 0xff, + dev->intfw_size, dev->intfw - fw_data, + dev->extfw_size, dev->extfw - fw_data); if (*id_str) dbg(DBG_DEVSTART, "firmware id %s",id_str); @@ -6398,7 +6340,7 @@ static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size, /* download internal firmware part */ dbg(DBG_DEVSTART, "downloading internal firmware"); dev->istate = INTFW_DOWNLOAD; - defer_kevent(dev,KEVENT_INTERNAL_FW); + defer_kevent(dev, KEVENT_INTERNAL_FW); } else { /* internal firmware already inside the device */ @@ -6409,38 +6351,44 @@ static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size, int force_fw_dwl = 0; /* disassem. the firmware */ - if ((ret=at76c503_get_fw_info(fw_data, fw_size, &dev->board_type, - &version, &id_str, - &dev->intfw, &dev->intfw_size, - &dev->extfw, &dev->extfw_size))) { + if ((ret = + at76c503_get_fw_info(fw_data, fw_size, &dev->board_type, + &version, &id_str, &dev->intfw, + &dev->intfw_size, &dev->extfw, + &dev->extfw_size))) { goto error; } - + /* if version >= 0.100.x.y or device with built-in flash we can query the device * for the fw version */ - if (version >= ((0<<24)|(100<<16)) || (op_mode == OPMODE_NORMAL_NIC_WITH_FLASH)) { - ret = get_mib(udev, MIB_FW_VERSION, (u8*)&dev->fw_version, - sizeof(dev->fw_version)); + if (version >= ((0 << 24) | (100 << 16)) + || (op_mode == OPMODE_NORMAL_NIC_WITH_FLASH)) { + ret = + get_mib(udev, MIB_FW_VERSION, + (u8 *) & dev->fw_version, + sizeof(dev->fw_version)); } else { /* force fw download only if the device has no flash inside */ force_fw_dwl = 1; } - if ((force_fw_dwl) || (ret < 0) || ((dev->fw_version.major == 0) && - (dev->fw_version.minor == 0) && - (dev->fw_version.patch == 0) && - (dev->fw_version.build == 0))) { + if ((force_fw_dwl) || (ret < 0) + || ((dev->fw_version.major == 0) + && (dev->fw_version.minor == 0) + && (dev->fw_version.patch == 0) + && (dev->fw_version.build == 0))) { if (force_fw_dwl) dbg(DBG_DEVSTART, "forced download of external firmware part"); else dbg(DBG_DEVSTART, "cannot get firmware (ret %d) or all zeros " "- download external firmware", ret); - dbg(DBG_DEVSTART, "firmware board %u version %u.%u.%u#%u " - "(int %x:%tx, ext %x:%tx)", - dev->board_type, version>>24,(version>>16)&0xff, - (version>>8)&0xff, version&0xff, - dev->intfw_size, dev->intfw-fw_data, - dev->extfw_size, dev->extfw-fw_data); + dbg(DBG_DEVSTART, + "firmware board %u version %u.%u.%u#%u " + "(int %x:%tx, ext %x:%tx)", dev->board_type, + version >> 24, (version >> 16) & 0xff, + (version >> 8) & 0xff, version & 0xff, + dev->intfw_size, dev->intfw - fw_data, + dev->extfw_size, dev->extfw - fw_data); if (*id_str) dbg(DBG_DEVSTART, "firmware id %s",id_str); @@ -6452,7 +6400,7 @@ static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size, } dev->istate = EXTFW_DOWNLOAD; - defer_kevent(dev,KEVENT_EXTERNAL_FW); + defer_kevent(dev, KEVENT_EXTERNAL_FW); } else { dev->istate = INIT; if (init_new_device(dev) < 0) { @@ -6503,7 +6451,7 @@ static void at76c50x_disconnect(struct usb_interface *interface) { struct at76c503 *ptr; - ptr = usb_get_intfdata (interface); + ptr = usb_get_intfdata(interface); usb_set_intfdata(interface, NULL); info("%s disconnecting", ((struct at76c503 *)ptr)->netdev->name); @@ -6528,8 +6476,8 @@ static int __init mod_init(void) #ifdef CONFIG_IPAQ_HANDHELD if (machine_is_h5400()) { /* turn WLAN power on,both needed? */ - SET_H5400_ASIC_GPIO (GPB, RF_POWER_ON, 1); - SET_H5400_ASIC_GPIO (GPB, WLAN_POWER_ON, 1); + SET_H5400_ASIC_GPIO(GPB, RF_POWER_ON, 1); + SET_H5400_ASIC_GPIO(GPB, WLAN_POWER_ON, 1); } #endif @@ -6559,8 +6507,8 @@ static void __exit mod_exit(void) #ifdef CONFIG_IPAQ_HANDHELD if (machine_is_h5400()) { /* turn WLAN power off */ - SET_H5400_ASIC_GPIO (GPB, RF_POWER_ON, 0); - SET_H5400_ASIC_GPIO (GPB, WLAN_POWER_ON, 0); + SET_H5400_ASIC_GPIO(GPB, RF_POWER_ON, 0); + SET_H5400_ASIC_GPIO(GPB, WLAN_POWER_ON, 0); } #endif } @@ -118,7 +118,7 @@ #define TX_AUTORATE_FALLBACK_OFFSET offsetof(struct mib_local,txautorate_fallback) #define FRAGMENTATION_OFFSET offsetof(struct mib_mac,frag_threshold) #define PREAMBLE_TYPE_OFFSET offsetof(struct mib_local,preamble_type) -#define RTS_OFFSET offsetof(struct mib_mac, rts_threshold) +#define RTS_OFFSET offsetof(struct mib_mac, rts_threshold) /* valid only for rfmd and 505 !*/ #define IBSS_CHANGE_OK_OFFSET offsetof(struct mib_mac_mgmt, ibss_change) @@ -145,41 +145,41 @@ struct hwcfg_r505 { } __attribute__ ((packed)); struct hwcfg_rfmd { - u8 cr20_values[14]; - u8 cr21_values[14]; - u8 bb_cr[14]; - u8 pidvid[4]; - u8 mac_addr[ETH_ALEN]; - u8 regulatory_domain; - u8 low_power_values[14]; - u8 normal_power_values[14]; - u8 reserved1[3]; + u8 cr20_values[14]; + u8 cr21_values[14]; + u8 bb_cr[14]; + u8 pidvid[4]; + u8 mac_addr[ETH_ALEN]; + u8 regulatory_domain; + u8 low_power_values[14]; + u8 normal_power_values[14]; + u8 reserved1[3]; } __attribute__ ((packed)); struct hwcfg_intersil { - u8 mac_addr[ETH_ALEN]; - u8 cr31_values[14]; - u8 cr58_values[14]; - u8 pidvid[4]; - u8 regulatory_domain; - u8 reserved[1]; + u8 mac_addr[ETH_ALEN]; + u8 cr31_values[14]; + u8 cr58_values[14]; + u8 pidvid[4]; + u8 regulatory_domain; + u8 reserved[1]; } __attribute__ ((packed)); #define WEP_SMALL_KEY_LEN (40/8) #define WEP_LARGE_KEY_LEN (104/8) -struct at76c503_card_config{ +struct at76c503_card_config { u8 exclude_unencrypted; u8 promiscuous_mode; u8 short_retry_limit; u8 encryption_type; __le16 rts_threshold; - __le16 fragmentation_threshold; /* 256..2346 */ + __le16 fragmentation_threshold; /* 256..2346 */ u8 basic_rate_set[4]; - u8 auto_rate_fallback; /* 0,1 */ + u8 auto_rate_fallback; /* 0,1 */ u8 channel; u8 privacy_invoked; - u8 wep_default_key_id; /* 0..3 */ + u8 wep_default_key_id; /* 0..3 */ u8 current_ssid[32]; u8 wep_default_key_value[4][WEP_KEY_LEN]; u8 ssid_len; @@ -187,7 +187,7 @@ struct at76c503_card_config{ __le16 beacon_period; } __attribute__ ((packed)); -struct at76c503_command{ +struct at76c503_command { u8 cmd; u8 reserved; __le16 size; @@ -224,15 +224,15 @@ struct at76c503_tx_buffer { #define SCAN_TYPE_PASSIVE 1 struct at76c503_start_scan { - u8 bssid[ETH_ALEN]; - u8 essid[32]; - u8 scan_type; - u8 channel; + u8 bssid[ETH_ALEN]; + u8 essid[32]; + u8 scan_type; + u8 channel; __le16 probe_delay; __le16 min_channel_time; __le16 max_channel_time; - u8 essid_size; - u8 international_scan; + u8 essid_size; + u8 international_scan; } __attribute__ ((packed)); struct at76c503_start_bss { @@ -263,89 +263,89 @@ struct set_mib_buffer { } __attribute__ ((packed)); struct mib_local { - u16 reserved0; - u8 beacon_enable; - u8 txautorate_fallback; - u8 reserved1; - u8 ssid_size; - u8 promiscuous_mode; - u16 reserved2; - u8 preamble_type; - u16 reserved3; + u16 reserved0; + u8 beacon_enable; + u8 txautorate_fallback; + u8 reserved1; + u8 ssid_size; + u8 promiscuous_mode; + u16 reserved2; + u8 preamble_type; + u16 reserved3; } __attribute__ ((packed)); struct mib_mac_addr { u8 mac_addr[ETH_ALEN]; - u8 res[2]; /* ??? */ - u8 group_addr[4][ETH_ALEN]; - u8 group_addr_status[4]; + u8 res[2]; /* ??? */ + u8 group_addr[4][ETH_ALEN]; + u8 group_addr_status[4]; } __attribute__ ((packed)); struct mib_mac { - __le32 max_tx_msdu_lifetime; - __le32 max_rx_lifetime; - __le16 frag_threshold; - __le16 rts_threshold; - __le16 cwmin; - __le16 cwmax; - u8 short_retry_time; - u8 long_retry_time; - u8 scan_type; /* active or passive */ - u8 scan_channel; - __le16 probe_delay; /* delay before sending a ProbeReq in active scan, RO */ - __le16 min_channel_time; - __le16 max_channel_time; - __le16 listen_interval; - u8 desired_ssid[32]; - u8 desired_bssid[ETH_ALEN]; - u8 desired_bsstype; /* ad-hoc or infrastructure */ - u8 reserved2; + __le32 max_tx_msdu_lifetime; + __le32 max_rx_lifetime; + __le16 frag_threshold; + __le16 rts_threshold; + __le16 cwmin; + __le16 cwmax; + u8 short_retry_time; + u8 long_retry_time; + u8 scan_type; /* active or passive */ + u8 scan_channel; + __le16 probe_delay; /* delay before sending a ProbeReq in active scan, RO */ + __le16 min_channel_time; + __le16 max_channel_time; + __le16 listen_interval; + u8 desired_ssid[32]; + u8 desired_bssid[ETH_ALEN]; + u8 desired_bsstype; /* ad-hoc or infrastructure */ + u8 reserved2; } __attribute__ ((packed)); struct mib_mac_mgmt { __le16 beacon_period; __le16 CFP_max_duration; __le16 medium_occupancy_limit; - __le16 station_id; /* assoc id */ + __le16 station_id; /* assoc id */ __le16 ATIM_window; - u8 CFP_mode; - u8 privacy_option_implemented; - u8 DTIM_period; - u8 CFP_period; - u8 current_bssid[ETH_ALEN]; - u8 current_essid[32]; - u8 current_bss_type; - u8 power_mgmt_mode; + u8 CFP_mode; + u8 privacy_option_implemented; + u8 DTIM_period; + u8 CFP_period; + u8 current_bssid[ETH_ALEN]; + u8 current_essid[32]; + u8 current_bss_type; + u8 power_mgmt_mode; /* rfmd and 505 */ - u8 ibss_change; - u8 res; - u8 multi_domain_capability_implemented; - u8 multi_domain_capability_enabled; - u8 country_string[3]; - u8 reserved[3]; + u8 ibss_change; + u8 res; + u8 multi_domain_capability_implemented; + u8 multi_domain_capability_enabled; + u8 country_string[3]; + u8 reserved[3]; } __attribute__ ((packed)); struct mib_mac_wep { - u8 privacy_invoked; /* 0 disable encr., 1 enable encr */ - u8 wep_default_key_id; - u8 wep_key_mapping_len; - u8 exclude_unencrypted; - __le32 wep_icv_error_count; - __le32 wep_excluded_count; - u8 wep_default_keyvalue[WEP_KEYS][WEP_KEY_LEN]; - u8 encryption_level; /* 1 for 40bit, 2 for 104bit encryption */ + u8 privacy_invoked; /* 0 disable encr., 1 enable encr */ + u8 wep_default_key_id; + u8 wep_key_mapping_len; + u8 exclude_unencrypted; + __le32 wep_icv_error_count; + __le32 wep_excluded_count; + u8 wep_default_keyvalue[WEP_KEYS][WEP_KEY_LEN]; + u8 encryption_level; /* 1 for 40bit, 2 for 104bit encryption */ } __attribute__ ((packed)); struct mib_phy { __le32 ed_threshold; - + __le16 slot_time; __le16 sifs_time; __le16 preamble_length; __le16 plcp_header_length; __le16 mpdu_max_length; __le16 cca_mode_supported; - + u8 operation_rate_set[4]; u8 channel_id; u8 current_cca_mode; @@ -354,21 +354,22 @@ struct mib_phy { } __attribute__ ((packed)); struct mib_fw_version { - u8 major; - u8 minor; - u8 patch; - u8 build; + u8 major; + u8 minor; + u8 patch; + u8 build; } __attribute__ ((packed)); struct mib_mdomain { - u8 tx_powerlevel[14]; - u8 channel_list[14]; /* 0 for invalid channels */ + u8 tx_powerlevel[14]; + u8 channel_list[14]; /* 0 for invalid channels */ } __attribute__ ((packed)); -static u8 snapsig[] = {0xaa, 0xaa, 0x03}; +static u8 snapsig[] = { 0xaa, 0xaa, 0x03 }; + /* RFC 1042 encapsulates Ethernet frames in 802.2 SNAP (0xaa, 0xaa, 0x03) with * a SNAP OID of 0 (0x00, 0x00, 0x00) */ -static u8 rfc1042sig[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; +static u8 rfc1042sig[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; /* states in infrastructure mode */ enum infra_state { @@ -391,22 +392,22 @@ enum infra_state { #define KEVENT_NEW_BSS 2 #define KEVENT_SET_PROMISC 3 #define KEVENT_MGMT_TIMEOUT 4 -#define KEVENT_SCAN 5 +#define KEVENT_SCAN 5 #define KEVENT_JOIN 6 #define KEVENT_STARTIBSS 7 #define KEVENT_SUBMIT_RX 8 -#define KEVENT_RESTART 9 /* restart the device */ -#define KEVENT_ASSOC_DONE 10 /* execute the power save settings: - listen interval, pm mode, assoc id */ +#define KEVENT_RESTART 9 /* restart the device */ +#define KEVENT_ASSOC_DONE 10 /* execute the power save settings: + listen interval, pm mode, assoc id */ #define KEVENT_EXTERNAL_FW 11 #define KEVENT_INTERNAL_FW 12 #define KEVENT_RESET_DEVICE 13 /* a description of a regulatory domain and the allowed channels */ struct reg_domain { - u16 code; - char const *name; - u32 channel_map; /* if bit N is set, channel (N+1) is allowed */ + u16 code; + char const *name; + u32 channel_map; /* if bit N is set, channel (N+1) is allowed */ }; /* how long do we keep a (I)BSS in the bss_list in jiffies @@ -415,25 +416,25 @@ struct reg_domain { other channels than the one the device locks on get removed, too */ #define BSS_LIST_TIMEOUT (120*HZ) /* struct to store BSS info found during scan */ -#define BSS_LIST_MAX_RATE_LEN 32 /* 32 rates should be enough ... */ +#define BSS_LIST_MAX_RATE_LEN 32 /* 32 rates should be enough ... */ -struct bss_info{ +struct bss_info { struct list_head list; - u8 mac[ETH_ALEN]; /* real mac address, differs - for ad-hoc from bssid */ - u8 bssid[ETH_ALEN]; /* bssid */ - u8 ssid[IW_ESSID_MAX_SIZE+1]; /* ssid, +1 for trailing \0 - to make it printable */ - u8 ssid_len; /* length of ssid above */ + u8 mac[ETH_ALEN]; /* real mac address, differs + for ad-hoc from bssid */ + u8 bssid[ETH_ALEN]; /* bssid */ + u8 ssid[IW_ESSID_MAX_SIZE + 1]; /* ssid, +1 for trailing \0 + to make it printable */ + u8 ssid_len; /* length of ssid above */ u8 channel; - u16 capa; /* the capabilities of the BSS (in original endianess - - we only check IEEE802_11 bits in it) */ - u16 beacon_interval; /* the beacon interval in units of TU (1.024 ms) - (in CPU endianess - we must calc. values from it) */ - u8 rates[BSS_LIST_MAX_RATE_LEN]; /* supported rates (list of bytes: - (basic_rate ? 0x80 : 0) + rate/(500 Kbit/s); e.g. - x82,x84,x8b,x96 for basic rates 1,2,5.5,11 MBit/s) */ + u16 capa; /* the capabilities of the BSS (in original endianess - + we only check IEEE802_11 bits in it) */ + u16 beacon_interval; /* the beacon interval in units of TU (1.024 ms) + (in CPU endianess - we must calc. values from it) */ + u8 rates[BSS_LIST_MAX_RATE_LEN]; /* supported rates (list of bytes: + (basic_rate ? 0x80 : 0) + rate/(500 Kbit/s); e.g. + x82,x84,x8b,x96 for basic rates 1,2,5.5,11 MBit/s) */ u8 rates_len; /* quality of received beacon */ @@ -441,18 +442,18 @@ struct bss_info{ u8 link_qual; u8 noise_level; - unsigned long last_rx; /* time (jiffies) of last beacon received */ - u16 assoc_id; /* if this is dev->curr_bss this is the assoc id we got - in a successful AssocResponse */ + unsigned long last_rx; /* time (jiffies) of last beacon received */ + u16 assoc_id; /* if this is dev->curr_bss this is the assoc id we got + in a successful AssocResponse */ }; /* a rx data buffer to collect rx fragments */ struct rx_data_buf { - u8 sender[ETH_ALEN]; /* sender address */ - u16 seqnr; /* sequence number */ - u16 fragnr; /* last fragment received */ - unsigned long last_rx; /* jiffies of last rx */ - struct sk_buff *skb; /* == NULL if entry is free */ + u8 sender[ETH_ALEN]; /* sender address */ + u16 seqnr; /* sequence number */ + u16 fragnr; /* last fragment received */ + unsigned long last_rx; /* jiffies of last rx */ + struct sk_buff *skb; /* == NULL if entry is free */ }; #define NR_RX_DATA_BUF 8 @@ -460,88 +461,87 @@ struct rx_data_buf { #define NR_SUBMIT_RX_TRIES 8 struct at76c503 { - struct usb_device *udev; /* USB device pointer */ - struct net_device *netdev; /* net device pointer */ + struct usb_device *udev; /* USB device pointer */ + struct net_device *netdev; /* net device pointer */ struct net_device_stats stats; struct iw_statistics wstats; - struct usb_interface *interface; /* the interface for this device */ + struct usb_interface *interface; /* the interface for this device */ - struct sk_buff * rx_skb; /* skbuff for receiving packets */ - __u8 bulk_in_endpointAddr; /* the address of the bulk in endpoint */ - - unsigned char * bulk_out_buffer; /* the buffer to send data */ - int bulk_out_size; /* the size of the send buffer */ - struct urb * write_urb; /* the urb used to send data */ - struct urb * read_urb; - __u8 bulk_out_endpointAddr; /* the address of the bulk out endpoint */ + struct sk_buff *rx_skb; /* skbuff for receiving packets */ + __u8 bulk_in_endpointAddr; /* the address of the bulk in endpoint */ - int open_count; /* number of times this port has been opened */ - struct semaphore sem; /* locks this structure */ + unsigned char *bulk_out_buffer; /* the buffer to send data */ + int bulk_out_size; /* the size of the send buffer */ + struct urb *write_urb; /* the urb used to send data */ + struct urb *read_urb; + __u8 bulk_out_endpointAddr; /* the address of the bulk out endpoint */ + int open_count; /* number of times this port has been opened */ + struct semaphore sem; /* locks this structure */ unsigned long kevent_flags; struct work_struct kevent; - int nr_submit_rx_tries; /* number of tries to submit an rx urb left */ + int nr_submit_rx_tries; /* number of tries to submit an rx urb left */ struct tasklet_struct tasklet; - struct urb *rx_urb; /* tmp urb pointer for rx_tasklet */ + struct urb *rx_urb; /* tmp urb pointer for rx_tasklet */ unsigned char *ctrl_buffer; struct urb *ctrl_urb; u8 op_mode; - /* the WEP stuff */ - int wep_enabled; /* 1 if WEP is enabled */ - int wep_key_id; /* key id to be used */ - u8 wep_keys[WEP_KEYS][WEP_KEY_LEN]; /* the four WEP keys, - 5 or 13 bytes are used */ - u8 wep_keys_len[WEP_KEYS]; /* the length of the above keys */ + /* the WEP stuff */ + int wep_enabled; /* 1 if WEP is enabled */ + int wep_key_id; /* key id to be used */ + u8 wep_keys[WEP_KEYS][WEP_KEY_LEN]; /* the four WEP keys, + 5 or 13 bytes are used */ + u8 wep_keys_len[WEP_KEYS]; /* the length of the above keys */ int channel; int iw_mode; int curr_ap; u8 bssid[ETH_ALEN]; u8 essid[IW_ESSID_MAX_SIZE]; - char nickn[IW_ESSID_MAX_SIZE+1]; /* nickname, only used in the iwconfig i/f */ + char nickn[IW_ESSID_MAX_SIZE + 1]; /* nickname, only used in the iwconfig i/f */ int essid_size; int radio_on; int promisc; - int preamble_type; /* 0 - long preamble, 1 - short preamble */ - int auth_mode; /* authentication type: 0 open, 1 shared key */ - int txrate; /* 0,1,2,3 = 1,2,5.5,11 MBit, 4 is auto-fallback */ - int frag_threshold; /* threshold for fragmentation of tx packets */ - int rts_threshold; /* threshold for RTS mechanism */ + int preamble_type; /* 0 - long preamble, 1 - short preamble */ + int auth_mode; /* authentication type: 0 open, 1 shared key */ + int txrate; /* 0,1,2,3 = 1,2,5.5,11 MBit, 4 is auto-fallback */ + int frag_threshold; /* threshold for fragmentation of tx packets */ + int rts_threshold; /* threshold for RTS mechanism */ int short_retry_limit; - int scan_min_time; /* scan min channel time */ - int scan_max_time; /* scan max channel time */ - int scan_mode; /* SCAN_TYPE_ACTIVE, SCAN_TYPE_PASSIVE */ - int scan_runs; /* counts how many scans are started */ + int scan_min_time; /* scan min channel time */ + int scan_max_time; /* scan max channel time */ + int scan_mode; /* SCAN_TYPE_ACTIVE, SCAN_TYPE_PASSIVE */ + int scan_runs; /* counts how many scans are started */ /* the list we got from scanning */ - spinlock_t bss_list_spinlock; /* protects bss_list operations and setting - curr_bss and new_bss */ - struct list_head bss_list; /* the list of bss we received beacons from */ - struct timer_list bss_list_timer; /* a timer removing old entries from - the bss_list. It must acquire bss_list_spinlock - before and must not remove curr_bss nor - new_bss ! */ - struct bss_info *curr_bss; /* if istate == AUTH, ASSOC, REASSOC, JOIN or CONN - dev->bss[curr_bss] is the currently selected BSS - we operate on */ - struct bss_info *new_bss; /* if istate == REASSOC dev->new_bss - is the new bss we want to reassoc to */ - + spinlock_t bss_list_spinlock; /* protects bss_list operations and setting + curr_bss and new_bss */ + struct list_head bss_list; /* the list of bss we received beacons from */ + struct timer_list bss_list_timer; /* a timer removing old entries from + the bss_list. It must acquire bss_list_spinlock + before and must not remove curr_bss nor + new_bss ! */ + struct bss_info *curr_bss; /* if istate == AUTH, ASSOC, REASSOC, JOIN or CONN + dev->bss[curr_bss] is the currently selected BSS + we operate on */ + struct bss_info *new_bss; /* if istate == REASSOC dev->new_bss + is the new bss we want to reassoc to */ + u8 wanted_bssid[ETH_ALEN]; - int wanted_bssid_valid; /* != 0 if wanted_bssid is to be used */ - + int wanted_bssid_valid; /* != 0 if wanted_bssid is to be used */ + /* some data for infrastructure mode only */ - spinlock_t mgmt_spinlock; /* this spinlock protects access to - next_mgmt_bulk */ - - struct at76c503_tx_buffer *next_mgmt_bulk; /* pending management msg to - send via bulk out */ + spinlock_t mgmt_spinlock; /* this spinlock protects access to + next_mgmt_bulk */ + + struct at76c503_tx_buffer *next_mgmt_bulk; /* pending management msg to + send via bulk out */ enum infra_state istate; enum { SITE_SURVEY_IDLE, @@ -550,18 +550,18 @@ struct at76c503 { } site_survey_state; time_t last_survey; - struct timer_list restart_timer; /* the timer we use to delay the restart a bit */ + struct timer_list restart_timer; /* the timer we use to delay the restart a bit */ - struct timer_list mgmt_timer; /* the timer we use to repeat auth_req etc. */ - int retries; /* counts backwards while re-trying to send auth/assoc_req's */ - u16 assoc_id; /* the assoc_id for states JOINING, REASSOCIATING, CONNECTED */ - u8 pm_mode ; /* power management mode: ACTIVE, SAVE, SMART_SAVE */ - u32 pm_period_us; /* power manag. period (in us ?) - set by iwconfig */ - u32 pm_period_beacon; /* power manag. period (in beacon intervals - of the curr_bss) */ - u32 board_type; /* BOARDTYPE_* defined above */ + struct timer_list mgmt_timer; /* the timer we use to repeat auth_req etc. */ + int retries; /* counts backwards while re-trying to send auth/assoc_req's */ + u16 assoc_id; /* the assoc_id for states JOINING, REASSOCIATING, CONNECTED */ + u8 pm_mode; /* power management mode: ACTIVE, SAVE, SMART_SAVE */ + u32 pm_period_us; /* power manag. period (in us ?) - set by iwconfig */ + u32 pm_period_beacon; /* power manag. period (in beacon intervals + of the curr_bss) */ + u32 board_type; /* BOARDTYPE_* defined above */ - struct reg_domain const *domain; /* the description of the regulatory domain */ + struct reg_domain const *domain; /* the description of the regulatory domain */ /* iwspy support */ spinlock_t spy_spinlock; @@ -576,54 +576,53 @@ struct at76c503 { u8 pidvid[4]; u8 regulatory_domain; u8 cr15_values[14]; - u8 cr20_values[14]; - u8 cr21_values[14]; + u8 cr20_values[14]; + u8 cr21_values[14]; u8 cr31_values[14]; u8 cr39_values[14]; u8 cr58_values[14]; - u8 low_power_values[14]; - u8 normal_power_values[14]; + u8 low_power_values[14]; + u8 normal_power_values[14]; struct at76c503_card_config card_config; struct mib_fw_version fw_version; - int rx_data_fcs_len; /* length of the trailing FCS - (0 for fw <= 0.84.x, 4 otherwise) */ + int rx_data_fcs_len; /* length of the trailing FCS + (0 for fw <= 0.84.x, 4 otherwise) */ /* store rx fragments until complete */ struct rx_data_buf rx_data[NR_RX_DATA_BUF]; /* firmware downloading stuff */ - struct timer_list fw_dl_timer; /* timer used to wait after REMAP - until device is reset */ + struct timer_list fw_dl_timer; /* timer used to wait after REMAP + until device is reset */ int extfw_size; int intfw_size; /* these point into a buffer managed by at76c503-xxx.o, no need to dealloc */ - u8 *extfw; /* points to external firmware part, extfw_size bytes long */ - u8 *intfw; /* points to internal firmware part, intfw_size bytes long */ + u8 *extfw; /* points to external firmware part, extfw_size bytes long */ + u8 *intfw; /* points to internal firmware part, intfw_size bytes long */ unsigned int device_unplugged:1; unsigned int netdev_registered:1; - char obuf[2*256+1]; /* global debug output buffer to reduce stack usage */ - char obuf_s[3*32]; /* small global debug output buffer to reduce stack usage */ - struct set_mib_buffer mib_buf; /* global buffer for set_mib calls */ + char obuf[2 * 256 + 1]; /* global debug output buffer to reduce stack usage */ + char obuf_s[3 * 32]; /* small global debug output buffer to reduce stack usage */ + struct set_mib_buffer mib_buf; /* global buffer for set_mib calls */ /* new whiz-bang feature flags */ int international_roaming; - int monitor_prism_header; /* if iw_mode == IW_MODE_MONITOR, - use Prism header */ + int monitor_prism_header; /* if iw_mode == IW_MODE_MONITOR, + use Prism header */ int monitor_scan_min_time; int monitor_scan_max_time; - int beacon_period; /* period of mgmt beacons */ + int beacon_period; /* period of mgmt beacons */ int beacons_received; - unsigned long beacons_last_qual; /* last time we reset beacons_received = 0 */ + unsigned long beacons_last_qual; /* last time we reset beacons_received = 0 */ }; /* Quasi-monitor mode defs (copied from <kernel>/drivers/net/wireless/orinoco.h) */ /* message data item for INT, BOUNDEDINT, ENUMINT */ -struct p80211item_u32 -{ +struct p80211item_u32 { uint32_t did; uint16_t status; uint16_t len; @@ -647,21 +646,20 @@ struct p80211item_u32 #define DIDmsg_lnxind_wlansniffrm_istx 0x9041 #define DIDmsg_lnxind_wlansniffrm_frmlen 0xA041 -struct p80211msg -{ - uint32_t msgcode; - uint32_t msglen; - uint8_t devname[IFNAMSIZ]; - struct p80211item_u32 hosttime; - struct p80211item_u32 mactime; - struct p80211item_u32 channel; - struct p80211item_u32 rssi; - struct p80211item_u32 sq; - struct p80211item_u32 signal; - struct p80211item_u32 noise; - struct p80211item_u32 rate; - struct p80211item_u32 istx; - struct p80211item_u32 frmlen; +struct p80211msg { + uint32_t msgcode; + uint32_t msglen; + uint8_t devname[IFNAMSIZ]; + struct p80211item_u32 hosttime; + struct p80211item_u32 mactime; + struct p80211item_u32 channel; + struct p80211item_u32 rssi; + struct p80211item_u32 sq; + struct p80211item_u32 signal; + struct p80211item_u32 noise; + struct p80211item_u32 rate; + struct p80211item_u32 istx; + struct p80211item_u32 frmlen; } __attribute__ ((packed)); #define BEACON_MAX_DATA_LENGTH 1500 @@ -701,48 +699,48 @@ struct p80211msg /* The frequency of each channel in MHz */ static const long channel_frequency[] = { - 2412, 2417, 2422, 2427, 2432, 2437, 2442, - 2447, 2452, 2457, 2462, 2467, 2472, 2484 + 2412, 2417, 2422, 2427, 2432, 2437, 2442, + 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; #define NUM_CHANNELS ARRAY_SIZE(channel_frequency) /* the supported rates of this hardware, bit7 marks a basic rate */ -static const u8 hw_rates[4] = {0x82,0x84,0x0b,0x16}; +static const u8 hw_rates[4] = { 0x82, 0x84, 0x0b, 0x16 }; /* the max padding size for tx in bytes (see calc_padding) */ #define MAX_PADDING_SIZE 53 /* at76_debug bits */ -#define DBG_PROGRESS 0x00000001 /* progress of scan-join-(auth-assoc)-connected */ -#define DBG_BSS_TABLE 0x00000002 /* show the bss table after scans */ -#define DBG_IOCTL 0x00000004 /* ioctl calls / settings */ -#define DBG_KEVENT 0x00000008 /* kevents */ -#define DBG_TX_DATA 0x00000010 /* tx header */ -#define DBG_TX_DATA_CONTENT 0x00000020 /* tx content */ +#define DBG_PROGRESS 0x00000001 /* progress of scan-join-(auth-assoc)-connected */ +#define DBG_BSS_TABLE 0x00000002 /* show the bss table after scans */ +#define DBG_IOCTL 0x00000004 /* ioctl calls / settings */ +#define DBG_KEVENT 0x00000008 /* kevents */ +#define DBG_TX_DATA 0x00000010 /* tx header */ +#define DBG_TX_DATA_CONTENT 0x00000020 /* tx content */ #define DBG_TX_MGMT 0x00000040 -#define DBG_RX_DATA 0x00000080 /* rx data header */ -#define DBG_RX_DATA_CONTENT 0x00000100 /* rx data content */ -#define DBG_RX_MGMT 0x00000200 /* rx mgmt header except beacon and probe responses */ -#define DBG_RX_BEACON 0x00000400 /* rx beacon */ -#define DBG_RX_CTRL 0x00000800 /* rx control */ -#define DBG_RX_MGMT_CONTENT 0x00001000 /* rx mgmt content */ -#define DBG_RX_FRAGS 0x00002000 /* rx data fragment handling */ -#define DBG_DEVSTART 0x00004000 /* fw download, device start */ -#define DBG_URB 0x00008000 /* rx urb status, ... */ -#define DBG_RX_ATMEL_HDR 0x00010000 /* the Atmel specific header of each rx packet */ -#define DBG_PROC_ENTRY 0x00020000 /* procedure entries and exits */ -#define DBG_PM 0x00040000 /* power management settings */ -#define DBG_BSS_MATCH 0x00080000 /* show why a certain bss did not match */ -#define DBG_PARAMS 0x00100000 /* show the configured parameters */ -#define DBG_WAIT_COMPLETE 0x00200000 /* show the wait_completion progress */ -#define DBG_RX_FRAGS_SKB 0x00400000 /* show skb header for incoming rx fragments */ -#define DBG_BSS_TABLE_RM 0x00800000 /* inform on removal of old bss table entries */ -#define DBG_MONITOR_MODE 0x01000000 /* debugs from monitor mode */ -#define DBG_MIB 0x02000000 /* dump all MIBs in startup_device */ -#define DBG_MGMT_TIMER 0x04000000 /* dump mgmt_timer ops */ -#define DBG_WE_EVENTS 0x08000000 /* dump wireless events */ -#define DBG_FW 0x10000000 /* firmware download */ -#define DBG_DFU 0x20000000 /* device firmware upgrade */ +#define DBG_RX_DATA 0x00000080 /* rx data header */ +#define DBG_RX_DATA_CONTENT 0x00000100 /* rx data content */ +#define DBG_RX_MGMT 0x00000200 /* rx mgmt header except beacon and probe responses */ +#define DBG_RX_BEACON 0x00000400 /* rx beacon */ +#define DBG_RX_CTRL 0x00000800 /* rx control */ +#define DBG_RX_MGMT_CONTENT 0x00001000 /* rx mgmt content */ +#define DBG_RX_FRAGS 0x00002000 /* rx data fragment handling */ +#define DBG_DEVSTART 0x00004000 /* fw download, device start */ +#define DBG_URB 0x00008000 /* rx urb status, ... */ +#define DBG_RX_ATMEL_HDR 0x00010000 /* the Atmel specific header of each rx packet */ +#define DBG_PROC_ENTRY 0x00020000 /* procedure entries and exits */ +#define DBG_PM 0x00040000 /* power management settings */ +#define DBG_BSS_MATCH 0x00080000 /* show why a certain bss did not match */ +#define DBG_PARAMS 0x00100000 /* show the configured parameters */ +#define DBG_WAIT_COMPLETE 0x00200000 /* show the wait_completion progress */ +#define DBG_RX_FRAGS_SKB 0x00400000 /* show skb header for incoming rx fragments */ +#define DBG_BSS_TABLE_RM 0x00800000 /* inform on removal of old bss table entries */ +#define DBG_MONITOR_MODE 0x01000000 /* debugs from monitor mode */ +#define DBG_MIB 0x02000000 /* dump all MIBs in startup_device */ +#define DBG_MGMT_TIMER 0x04000000 /* dump mgmt_timer ops */ +#define DBG_WE_EVENTS 0x08000000 /* dump wireless events */ +#define DBG_FW 0x10000000 /* firmware download */ +#define DBG_DFU 0x20000000 /* device firmware upgrade */ #define DBG_DEFAULTS 0 @@ -764,4 +762,4 @@ static const u8 hw_rates[4] = {0x82,0x84,0x0b,0x16}; err("%d: assertion " #x " failed", __LINE__);\ } while (0) -#endif /* _AT76C503_H */ +#endif /* _AT76C503_H */ diff --git a/at76_usb_ids.h b/at76_usb_ids.h index a78803a..6bec5e5 100644 --- a/at76_usb_ids.h +++ b/at76_usb_ids.h @@ -17,25 +17,25 @@ #define VENDOR_ID_BELKIN 0x0d5c #define VENDOR_ID_BELKIN_2 0x050d #define VENDOR_ID_BENQ 0x04a5 -#define VENDOR_ID_BLITZ 0x07b8 +#define VENDOR_ID_BLITZ 0x07b8 #define VENDOR_ID_BT 0x069a #define VENDOR_ID_CNET 0x1371 #define VENDOR_ID_COMPAQ 0x049f #define VENDOR_ID_CONCEPTRONIC 0x0d8e #define VENDOR_ID_COREGA 0x07aa -#define VENDOR_ID_DICK_SMITH_ELECTR 0x1371 /* Dick Smith Electronics */ +#define VENDOR_ID_DICK_SMITH_ELECTR 0x1371 /* Dick Smith Electronics */ #define VENDOR_ID_DLINK 0x2001 #define VENDOR_ID_DYNALINK 0x069a -#define VENDOR_ID_GIGABYTE 0x1044 +#define VENDOR_ID_GIGABYTE 0x1044 #define VENDOR_ID_GIGASET 0x1690 #define VENDOR_ID_HP 0x03f0 #define VENDOR_ID_INTEL 0x8086 #define VENDOR_ID_IO_DATA 0x04bb #define VENDOR_ID_LINKSYS 0x077b -#define VENDOR_ID_LINKSYS_1915 0x1915 +#define VENDOR_ID_LINKSYS_1915 0x1915 #define VENDOR_ID_LINKSYS_OLD 0x066b #define VENDOR_ID_MSI 0x0db0 -#define VENDOR_ID_M4Y750 0x0cde /* Unknown Vendor ID */ +#define VENDOR_ID_M4Y750 0x0cde /* Unknown Vendor ID */ #define VENDOR_ID_NETGEAR 0x0864 #define VENDOR_ID_SAMSUNG 0x055d #define VENDOR_ID_SIEMENS 0x0681 @@ -45,59 +45,59 @@ #define VENDOR_ID_TEKRAM 0x0b3b #define VENDOR_ID_XTERASYS 0x12fd -#define PRODUCT_ID_ATMEL_503I 0x7603 /* Generic AT76C503/3861 device */ -#define PRODUCT_ID_LINKSYS_WUSB11_V21 0x2211 /* Linksys WUSB11 v2.1/v2.6 */ -#define PRODUCT_ID_NETGEAR_MA101A 0x4100 /* Netgear MA 101 Rev. A */ -#define PRODUCT_ID_TEKRAM_U300C 0x1612 /* Tekram U-300C / Allnet ALL0193 */ -#define PRODUCT_ID_HP_HN210W 0x011c /* HP HN210W PKW-J7801A */ -#define PRODUCT_ID_M4Y750 0x0001 /* Sitecom/Z-Com/Zyxel M4Y-750 */ -#define PRODUCT_ID_DYNALINK_WLL013_I 0x0320 /* Dynalink/Askey WLL013 (intersil) */ -#define PRODUCT_ID_SMC2662W_V1 0xa001 /* EZ connect 11Mpbs - Wireless USB Adapter SMC2662W (v1) */ -#define PRODUCT_ID_BENQ_AWL_300 0x9000 /* AWL-300 */ -#define PRODUCT_ID_ADDTRON_AWU120 0xff31 /* AWU-120, Compex WLU11 */ -#define PRODUCT_ID_INTEL_AP310 0x0200 /* AP310 AnyPoint II USB */ -#define PRODUCT_ID_CONCEPTRONIC_C11U 0x7100 /* also Dynalink L11U */ -#define PRODUCT_ID_WL_210 0x7110 /* Arescom WL-210, - FCC id 07J-GL2411USB */ -#define PRODUCT_ID_IO_DATA_WN_B11_USB 0x0919 /* IO-DATA WN-B11/USB */ -#define PRODUCT_ID_BT_VOYAGER_1010 0x0821 /* BT Voyager 1010 */ -#define PRODUCT_ID_ATMEL_503_I3863 0x7604 /* Generic AT76C503/3863 device */ -#define PRODUCT_ID_SAMSUNG_SWL2100U 0xa000 /* Samsung SWL-2100U */ -#define PRODUCT_ID_ATMEL_503R 0x7605 /* Generic AT76C503/RFMD device */ -#define PRODUCT_ID_W_BUDDIE_WN210 0x4102 /* AirVast W-Buddie WN210 */ -#define PRODUCT_ID_DYNALINK_WLL013_R 0x0321 /* Dynalink/Askey WLL013 (rfmd) */ -#define PRODUCT_ID_LINKSYS_WUSB11_V26 0x2219 /* Linksys WUSB11 v2.6 */ -#define PRODUCT_ID_NE_NWU11B 0x2227 /* Network Everywhere NWU11B */ -#define PRODUCT_ID_NETGEAR_MA101B 0x4102 /* Netgear MA 101 Rev. B */ -#define PRODUCT_ID_ACTIONTEC_802UAT1 0x7605 /* Actiontec 802UAT1, HWU01150-01UK */ -#define PRODUCT_ID_DLINK_DWL120 0x3200 /* DWL-120 rev. E */ -#define PRODUCT_ID_DSE_XH1153 0x5743 /* XH1153 802.11b USB adapter */ -#define PRODUCT_ID_WL_200U 0x0002 /* WL-200U */ -#define PRODUCT_ID_BENQ_AWL_400 0x9001 /* BenQ AWL-400 USB stick */ -#define PRODUCT_ID_3COM_3CRSHEW696 0x0a01 /* 3COM 3CRSHEW696 */ -#define PRODUCT_ID_SIEMENS_SANTIS_WLL013 0x001b /* Siemens Santis ADSL WLAN +#define PRODUCT_ID_ATMEL_503I 0x7603 /* Generic AT76C503/3861 device */ +#define PRODUCT_ID_LINKSYS_WUSB11_V21 0x2211 /* Linksys WUSB11 v2.1/v2.6 */ +#define PRODUCT_ID_NETGEAR_MA101A 0x4100 /* Netgear MA 101 Rev. A */ +#define PRODUCT_ID_TEKRAM_U300C 0x1612 /* Tekram U-300C / Allnet ALL0193 */ +#define PRODUCT_ID_HP_HN210W 0x011c /* HP HN210W PKW-J7801A */ +#define PRODUCT_ID_M4Y750 0x0001 /* Sitecom/Z-Com/Zyxel M4Y-750 */ +#define PRODUCT_ID_DYNALINK_WLL013_I 0x0320 /* Dynalink/Askey WLL013 (intersil) */ +#define PRODUCT_ID_SMC2662W_V1 0xa001 /* EZ connect 11Mpbs + Wireless USB Adapter SMC2662W (v1) */ +#define PRODUCT_ID_BENQ_AWL_300 0x9000 /* AWL-300 */ +#define PRODUCT_ID_ADDTRON_AWU120 0xff31 /* AWU-120, Compex WLU11 */ +#define PRODUCT_ID_INTEL_AP310 0x0200 /* AP310 AnyPoint II USB */ +#define PRODUCT_ID_CONCEPTRONIC_C11U 0x7100 /* also Dynalink L11U */ +#define PRODUCT_ID_WL_210 0x7110 /* Arescom WL-210, + FCC id 07J-GL2411USB */ +#define PRODUCT_ID_IO_DATA_WN_B11_USB 0x0919 /* IO-DATA WN-B11/USB */ +#define PRODUCT_ID_BT_VOYAGER_1010 0x0821 /* BT Voyager 1010 */ +#define PRODUCT_ID_ATMEL_503_I3863 0x7604 /* Generic AT76C503/3863 device */ +#define PRODUCT_ID_SAMSUNG_SWL2100U 0xa000 /* Samsung SWL-2100U */ +#define PRODUCT_ID_ATMEL_503R 0x7605 /* Generic AT76C503/RFMD device */ +#define PRODUCT_ID_W_BUDDIE_WN210 0x4102 /* AirVast W-Buddie WN210 */ +#define PRODUCT_ID_DYNALINK_WLL013_R 0x0321 /* Dynalink/Askey WLL013 (rfmd) */ +#define PRODUCT_ID_LINKSYS_WUSB11_V26 0x2219 /* Linksys WUSB11 v2.6 */ +#define PRODUCT_ID_NE_NWU11B 0x2227 /* Network Everywhere NWU11B */ +#define PRODUCT_ID_NETGEAR_MA101B 0x4102 /* Netgear MA 101 Rev. B */ +#define PRODUCT_ID_ACTIONTEC_802UAT1 0x7605 /* Actiontec 802UAT1, HWU01150-01UK */ +#define PRODUCT_ID_DLINK_DWL120 0x3200 /* DWL-120 rev. E */ +#define PRODUCT_ID_DSE_XH1153 0x5743 /* XH1153 802.11b USB adapter */ +#define PRODUCT_ID_WL_200U 0x0002 /* WL-200U */ +#define PRODUCT_ID_BENQ_AWL_400 0x9001 /* BenQ AWL-400 USB stick */ +#define PRODUCT_ID_3COM_3CRSHEW696 0x0a01 /* 3COM 3CRSHEW696 */ +#define PRODUCT_ID_SIEMENS_SANTIS_WLL013 0x001b /* Siemens Santis ADSL WLAN USB adapter WLL 013 */ -#define PRODUCT_ID_BELKIN_F5D6050_V2 0x0050 /* Belkin F5D6050, version 2 */ -#define PRODUCT_ID_BLITZ_NETWAVE_BWU613 0xb000 /* iBlitzz, BWU613 (not *B or *SB) */ -#define PRODUCT_ID_GIGABYTE_GN_WLBM101 0x8003 /* Gigabyte GN-WLBM101 */ -#define PRODUCT_ID_PLANEX_GW_US11S 0x3220 /* Planex GW-US11S */ -#define PRODUCT_ID_IPAQ_INT_WLAN 0x0032 /* internal WLAN adapter in h5[4,5]xx series iPAQs */ -#define PRODUCT_ID_BELKIN_F5D6050 0xa002 /* Belkin F5D6050 / SMC 2662W v2 / SMC 2662W-AR */ +#define PRODUCT_ID_BELKIN_F5D6050_V2 0x0050 /* Belkin F5D6050, version 2 */ +#define PRODUCT_ID_BLITZ_NETWAVE_BWU613 0xb000 /* iBlitzz, BWU613 (not *B or *SB) */ +#define PRODUCT_ID_GIGABYTE_GN_WLBM101 0x8003 /* Gigabyte GN-WLBM101 */ +#define PRODUCT_ID_PLANEX_GW_US11S 0x3220 /* Planex GW-US11S */ +#define PRODUCT_ID_IPAQ_INT_WLAN 0x0032 /* internal WLAN adapter in h5[4,5]xx series iPAQs */ +#define PRODUCT_ID_BELKIN_F5D6050 0xa002 /* Belkin F5D6050 / SMC 2662W v2 / SMC 2662W-AR */ #define PRODUCT_ID_SMC_2664W 0x3501 -#define PRODUCT_ID_ATMEL_505R 0x7606 /* Generic AT76C505/RFMD */ -#define PRODUCT_ID_ATMEL_505R2958 0x7613 /* Generic AT76C505/RFMD, OvisLink WL-1130USB */ -#define PRODUCT_ID_CNET_CNUSB611G 0x0013 /* CNet CNUSB 611G */ -#define PRODUCT_ID_FL_WL240U 0x0014 /* Fiberline WL-240U with CNet vendor id */ -#define PRODUCT_ID_LINKSYS_WUSB11V28 0x2233 /* Linksys WUSB11 v2.8 */ -#define PRODUCT_ID_XTERASYS_XN_2122B 0x1001 /* Xterasys XN-2122B, - IBlitzz BWU613B/BWU613SB */ -#define PRODUCT_ID_COREGA_USB_STICK_11_KK 0x7613 /* Corega WLAN USB Stick 11 (K.K.) */ +#define PRODUCT_ID_ATMEL_505R 0x7606 /* Generic AT76C505/RFMD */ +#define PRODUCT_ID_ATMEL_505R2958 0x7613 /* Generic AT76C505/RFMD, OvisLink WL-1130USB */ +#define PRODUCT_ID_CNET_CNUSB611G 0x0013 /* CNet CNUSB 611G */ +#define PRODUCT_ID_FL_WL240U 0x0014 /* Fiberline WL-240U with CNet vendor id */ +#define PRODUCT_ID_LINKSYS_WUSB11V28 0x2233 /* Linksys WUSB11 v2.8 */ +#define PRODUCT_ID_XTERASYS_XN_2122B 0x1001 /* Xterasys XN-2122B, + IBlitzz BWU613B/BWU613SB */ +#define PRODUCT_ID_COREGA_USB_STICK_11_KK 0x7613 /* Corega WLAN USB Stick 11 (K.K.) */ #define PRODUCT_ID_MSI_MS6978_WLAN_BOX_PC2PC 0x1020 -#define PRODUCT_ID_ATMEL_505A 0x7614 /* Generic AT76C505A device */ -#define PRODUCT_ID_ATMEL_505AS 0x7617 /* Generic AT76C505AS device */ +#define PRODUCT_ID_ATMEL_505A 0x7614 /* Generic AT76C505A device */ +#define PRODUCT_ID_ATMEL_505AS 0x7617 /* Generic AT76C505AS device */ #define PRODUCT_ID_GIGASET_11 0x0701 -#define PRODUCT_ID_ATMEL_505AMX 0x7615 /* Generic AT76C505AMX device */ +#define PRODUCT_ID_ATMEL_505AMX 0x7615 /* Generic AT76C505AMX device */ #define BOARDTYPE_503_INTERSIL_3861 1 #define BOARDTYPE_503_INTERSIL_3863 2 |