Lines Matching refs:this
188 static inline void wl3501_switch_page(struct wl3501_card *this, u8 page) in wl3501_switch_page() argument
190 wl3501_outb(page, this->base_addr + WL3501_NIC_BSS); in wl3501_switch_page()
199 static int wl3501_get_flash_mac_addr(struct wl3501_card *this) in wl3501_get_flash_mac_addr() argument
201 int base_addr = this->base_addr; in wl3501_get_flash_mac_addr()
210 this->mac_addr[0] = inb(base_addr + WL3501_NIC_IODPA); in wl3501_get_flash_mac_addr()
212 this->mac_addr[1] = inb(base_addr + WL3501_NIC_IODPA); in wl3501_get_flash_mac_addr()
214 this->mac_addr[2] = inb(base_addr + WL3501_NIC_IODPA); in wl3501_get_flash_mac_addr()
216 this->mac_addr[3] = inb(base_addr + WL3501_NIC_IODPA); in wl3501_get_flash_mac_addr()
218 this->mac_addr[4] = inb(base_addr + WL3501_NIC_IODPA); in wl3501_get_flash_mac_addr()
220 this->mac_addr[5] = inb(base_addr + WL3501_NIC_IODPA); in wl3501_get_flash_mac_addr()
222 this->reg_domain = inb(base_addr + WL3501_NIC_IODPA); in wl3501_get_flash_mac_addr()
228 this->version[0] = inb(base_addr + WL3501_NIC_IODPA); in wl3501_get_flash_mac_addr()
230 this->version[1] = inb(base_addr + WL3501_NIC_IODPA); in wl3501_get_flash_mac_addr()
232 wl3501_switch_page(this, WL3501_BSS_SPAGE0); in wl3501_get_flash_mac_addr()
235 return this->mac_addr[0] == 0x00 && this->mac_addr[1] == 0x60; in wl3501_get_flash_mac_addr()
247 static void wl3501_set_to_wla(struct wl3501_card *this, u16 dest, void *src, in wl3501_set_to_wla() argument
251 wl3501_switch_page(this, (dest & 0x8000) ? WL3501_BSS_SPAGE1 : in wl3501_set_to_wla()
254 wl3501_outb(dest & 0xff, this->base_addr + WL3501_NIC_LMAL); in wl3501_set_to_wla()
255 wl3501_outb(((dest >> 8) & 0x7f), this->base_addr + WL3501_NIC_LMAH); in wl3501_set_to_wla()
258 wl3501_outsb(this->base_addr + WL3501_NIC_IODPA, src, size); in wl3501_set_to_wla()
270 static void wl3501_get_from_wla(struct wl3501_card *this, u16 src, void *dest, in wl3501_get_from_wla() argument
274 wl3501_switch_page(this, (src & 0x8000) ? WL3501_BSS_SPAGE1 : in wl3501_get_from_wla()
277 wl3501_outb(src & 0xff, this->base_addr + WL3501_NIC_LMAL); in wl3501_get_from_wla()
278 wl3501_outb((src >> 8) & 0x7f, this->base_addr + WL3501_NIC_LMAH); in wl3501_get_from_wla()
281 insb(this->base_addr + WL3501_NIC_IODPA, dest, size); in wl3501_get_from_wla()
296 static u16 wl3501_get_tx_buffer(struct wl3501_card *this, u16 len) in wl3501_get_tx_buffer() argument
302 if (full_len > this->tx_buffer_cnt * 254) in wl3501_get_tx_buffer()
304 ret = this->tx_buffer_head; in wl3501_get_tx_buffer()
310 wl3501_get_from_wla(this, this->tx_buffer_head, &next, in wl3501_get_tx_buffer()
313 wl3501_set_to_wla(this, this->tx_buffer_head, &zero, in wl3501_get_tx_buffer()
315 this->tx_buffer_head = next; in wl3501_get_tx_buffer()
319 this->tx_buffer_head = ret; in wl3501_get_tx_buffer()
324 this->tx_buffer_cnt -= blk_cnt; in wl3501_get_tx_buffer()
332 static void wl3501_free_tx_buffer(struct wl3501_card *this, u16 ptr) in wl3501_free_tx_buffer() argument
335 if (!this->tx_buffer_head) in wl3501_free_tx_buffer()
336 this->tx_buffer_head = ptr; in wl3501_free_tx_buffer()
338 wl3501_set_to_wla(this, this->tx_buffer_tail, in wl3501_free_tx_buffer()
343 this->tx_buffer_cnt++; in wl3501_free_tx_buffer()
344 wl3501_get_from_wla(this, ptr, &next, sizeof(next)); in wl3501_free_tx_buffer()
345 this->tx_buffer_tail = ptr; in wl3501_free_tx_buffer()
350 static int wl3501_esbq_req_test(struct wl3501_card *this) in wl3501_esbq_req_test() argument
354 wl3501_get_from_wla(this, this->esbq_req_head + 3, &tmp, sizeof(tmp)); in wl3501_esbq_req_test()
358 static void wl3501_esbq_req(struct wl3501_card *this, u16 *ptr) in wl3501_esbq_req() argument
362 wl3501_set_to_wla(this, this->esbq_req_head, ptr, 2); in wl3501_esbq_req()
363 wl3501_set_to_wla(this, this->esbq_req_head + 2, &tmp, sizeof(tmp)); in wl3501_esbq_req()
364 this->esbq_req_head += 4; in wl3501_esbq_req()
365 if (this->esbq_req_head >= this->esbq_req_end) in wl3501_esbq_req()
366 this->esbq_req_head = this->esbq_req_start; in wl3501_esbq_req()
369 static int wl3501_esbq_exec(struct wl3501_card *this, void *sig, int sig_size) in wl3501_esbq_exec() argument
373 if (wl3501_esbq_req_test(this)) { in wl3501_esbq_exec()
374 u16 ptr = wl3501_get_tx_buffer(this, sig_size); in wl3501_esbq_exec()
376 wl3501_set_to_wla(this, ptr, sig, sig_size); in wl3501_esbq_exec()
377 wl3501_esbq_req(this, &ptr); in wl3501_esbq_exec()
384 static int wl3501_request_mib(struct wl3501_card *this, u8 index, void *bf) in wl3501_request_mib() argument
393 spin_lock_irqsave(&this->lock, flags); in wl3501_request_mib()
394 if (wl3501_esbq_req_test(this)) { in wl3501_request_mib()
395 u16 ptr = wl3501_get_tx_buffer(this, sizeof(sig)); in wl3501_request_mib()
397 wl3501_set_to_wla(this, ptr, &sig, sizeof(sig)); in wl3501_request_mib()
398 wl3501_esbq_req(this, &ptr); in wl3501_request_mib()
399 this->sig_get_confirm.mib_status = 255; in wl3501_request_mib()
403 spin_unlock_irqrestore(&this->lock, flags); in wl3501_request_mib()
408 static int wl3501_get_mib_value(struct wl3501_card *this, u8 index, in wl3501_get_mib_value() argument
413 rc = wl3501_request_mib(this, index, bf); in wl3501_get_mib_value()
417 rc = wait_event_interruptible(this->wait, in wl3501_get_mib_value()
418 this->sig_get_confirm.mib_status != 255); in wl3501_get_mib_value()
422 memcpy(bf, this->sig_get_confirm.mib_value, size); in wl3501_get_mib_value()
426 static int wl3501_pwr_mgmt(struct wl3501_card *this, int suspend) in wl3501_pwr_mgmt() argument
437 spin_lock_irqsave(&this->lock, flags); in wl3501_pwr_mgmt()
438 if (wl3501_esbq_req_test(this)) { in wl3501_pwr_mgmt()
439 u16 ptr = wl3501_get_tx_buffer(this, sizeof(sig)); in wl3501_pwr_mgmt()
441 wl3501_set_to_wla(this, ptr, &sig, sizeof(sig)); in wl3501_pwr_mgmt()
442 wl3501_esbq_req(this, &ptr); in wl3501_pwr_mgmt()
443 this->sig_pwr_mgmt_confirm.status = 255; in wl3501_pwr_mgmt()
444 spin_unlock_irqrestore(&this->lock, flags); in wl3501_pwr_mgmt()
445 rc = wait_event_interruptible(this->wait, in wl3501_pwr_mgmt()
446 this->sig_pwr_mgmt_confirm.status != 255); in wl3501_pwr_mgmt()
449 this->sig_pwr_mgmt_confirm.status); in wl3501_pwr_mgmt()
453 spin_unlock_irqrestore(&this->lock, flags); in wl3501_pwr_mgmt()
468 static int wl3501_send_pkt(struct wl3501_card *this, u8 *data, u16 len) in wl3501_send_pkt() argument
478 if (wl3501_esbq_req_test(this)) { in wl3501_send_pkt()
479 sig_bf = wl3501_get_tx_buffer(this, sizeof(sig)); in wl3501_send_pkt()
483 bf = wl3501_get_tx_buffer(this, len + 26 + 24); in wl3501_send_pkt()
486 wl3501_free_tx_buffer(this, sig_bf); in wl3501_send_pkt()
499 wl3501_set_to_wla(this, bf + 2 + in wl3501_send_pkt()
510 wl3501_set_to_wla(this, in wl3501_send_pkt()
514 wl3501_get_from_wla(this, bf, &next, sizeof(next)); in wl3501_send_pkt()
527 wl3501_set_to_wla(this, bf + 2 + in wl3501_send_pkt()
531 wl3501_get_from_wla(this, bf, &next, sizeof(next)); in wl3501_send_pkt()
542 wl3501_set_to_wla(this, bf + 2, pdata, tmplen); in wl3501_send_pkt()
544 wl3501_get_from_wla(this, bf, &next, sizeof(next)); in wl3501_send_pkt()
547 wl3501_set_to_wla(this, sig_bf, &sig, sizeof(sig)); in wl3501_send_pkt()
548 wl3501_esbq_req(this, &sig_bf); in wl3501_send_pkt()
554 static int wl3501_mgmt_resync(struct wl3501_card *this) in wl3501_mgmt_resync() argument
560 return wl3501_esbq_exec(this, &sig, sizeof(sig)); in wl3501_mgmt_resync()
563 static inline int wl3501_fw_bss_type(struct wl3501_card *this) in wl3501_fw_bss_type() argument
565 return this->net_type == IW_MODE_INFRA ? WL3501_NET_TYPE_INFRA : in wl3501_fw_bss_type()
569 static inline int wl3501_fw_cap_info(struct wl3501_card *this) in wl3501_fw_cap_info() argument
571 return this->net_type == IW_MODE_INFRA ? WL3501_MGMT_CAPABILITY_ESS : in wl3501_fw_cap_info()
575 static int wl3501_mgmt_scan(struct wl3501_card *this, u16 chan_time) in wl3501_mgmt_scan() argument
583 .bss_type = wl3501_fw_bss_type(this), in wl3501_mgmt_scan()
586 this->bss_cnt = this->join_sta_bss = 0; in wl3501_mgmt_scan()
587 return wl3501_esbq_exec(this, &sig, sizeof(sig)); in wl3501_mgmt_scan()
590 static int wl3501_mgmt_join(struct wl3501_card *this, u16 stas) in wl3501_mgmt_join() argument
600 .chan = this->chan, in wl3501_mgmt_join()
604 memcpy(&sig.req, &this->bss_set[stas].req, sizeof(sig.req)); in wl3501_mgmt_join()
605 return wl3501_esbq_exec(this, &sig, sizeof(sig)); in wl3501_mgmt_join()
608 static int wl3501_mgmt_start(struct wl3501_card *this) in wl3501_mgmt_start() argument
619 .chan = this->chan, in wl3501_mgmt_start()
652 .bss_type = wl3501_fw_bss_type(this), in wl3501_mgmt_start()
653 .cap_info = wl3501_fw_cap_info(this), in wl3501_mgmt_start()
656 iw_copy_mgmt_info_element(&sig.ssid.el, &this->essid.el); in wl3501_mgmt_start()
657 iw_copy_mgmt_info_element(&this->keep_essid.el, &this->essid.el); in wl3501_mgmt_start()
658 return wl3501_esbq_exec(this, &sig, sizeof(sig)); in wl3501_mgmt_start()
661 static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr) in wl3501_mgmt_scan_confirm() argument
668 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); in wl3501_mgmt_scan_confirm()
671 if ((this->net_type == IW_MODE_INFRA && in wl3501_mgmt_scan_confirm()
673 (this->net_type == IW_MODE_ADHOC && in wl3501_mgmt_scan_confirm()
675 this->net_type == IW_MODE_AUTO) { in wl3501_mgmt_scan_confirm()
676 if (!this->essid.el.len) in wl3501_mgmt_scan_confirm()
678 else if (this->essid.el.len == 3 && in wl3501_mgmt_scan_confirm()
679 !memcmp(this->essid.essid, "ANY", 3)) in wl3501_mgmt_scan_confirm()
681 else if (this->essid.el.len != sig.req.ssid.el.len) in wl3501_mgmt_scan_confirm()
683 else if (memcmp(this->essid.essid, sig.req.ssid.essid, in wl3501_mgmt_scan_confirm()
684 this->essid.el.len)) in wl3501_mgmt_scan_confirm()
689 for (i = 0; i < this->bss_cnt; i++) { in wl3501_mgmt_scan_confirm()
690 if (ether_addr_equal_unaligned(this->bss_set[i].req.bssid, in wl3501_mgmt_scan_confirm()
698 memcpy(&this->bss_set[i].req, in wl3501_mgmt_scan_confirm()
700 this->bss_cnt++; in wl3501_mgmt_scan_confirm()
701 this->rssi = sig.rssi; in wl3501_mgmt_scan_confirm()
702 this->bss_set[i].rssi = sig.rssi; in wl3501_mgmt_scan_confirm()
707 this->join_sta_bss = 0; in wl3501_mgmt_scan_confirm()
708 for (i = this->join_sta_bss; i < this->bss_cnt; i++) in wl3501_mgmt_scan_confirm()
709 if (!wl3501_mgmt_join(this, i)) in wl3501_mgmt_scan_confirm()
711 this->join_sta_bss = i; in wl3501_mgmt_scan_confirm()
712 if (this->join_sta_bss == this->bss_cnt) { in wl3501_mgmt_scan_confirm()
713 if (this->net_type == IW_MODE_INFRA) in wl3501_mgmt_scan_confirm()
714 wl3501_mgmt_scan(this, 100); in wl3501_mgmt_scan_confirm()
716 this->adhoc_times++; in wl3501_mgmt_scan_confirm()
717 if (this->adhoc_times > WL3501_MAX_ADHOC_TRIES) in wl3501_mgmt_scan_confirm()
718 wl3501_mgmt_start(this); in wl3501_mgmt_scan_confirm()
720 wl3501_mgmt_scan(this, 100); in wl3501_mgmt_scan_confirm()
733 static int wl3501_block_interrupt(struct wl3501_card *this) in wl3501_block_interrupt() argument
735 u8 old = inb(this->base_addr + WL3501_NIC_GCR); in wl3501_block_interrupt()
739 wl3501_outb(new, this->base_addr + WL3501_NIC_GCR); in wl3501_block_interrupt()
750 static int wl3501_unblock_interrupt(struct wl3501_card *this) in wl3501_unblock_interrupt() argument
752 u8 old = inb(this->base_addr + WL3501_NIC_GCR); in wl3501_unblock_interrupt()
756 wl3501_outb(new, this->base_addr + WL3501_NIC_GCR); in wl3501_unblock_interrupt()
769 static u16 wl3501_receive(struct wl3501_card *this, u8 *bf, u16 size) in wl3501_receive() argument
775 wl3501_get_from_wla(this, this->start_seg + 2, in wl3501_receive()
778 wl3501_get_from_wla(this, in wl3501_receive()
779 this->start_seg + in wl3501_receive()
786 wl3501_get_from_wla(this, in wl3501_receive()
787 this->start_seg + in wl3501_receive()
794 wl3501_get_from_wla(this, next_addr + 5, data, in wl3501_receive()
798 wl3501_get_from_wla(this, next_addr + 2, &next_addr1, in wl3501_receive()
802 wl3501_get_from_wla(this, next_addr + 5, data, size); in wl3501_receive()
809 static void wl3501_esbq_req_free(struct wl3501_card *this) in wl3501_esbq_req_free() argument
814 if (this->esbq_req_head == this->esbq_req_tail) in wl3501_esbq_req_free()
816 wl3501_get_from_wla(this, this->esbq_req_tail + 3, &tmp, sizeof(tmp)); in wl3501_esbq_req_free()
819 wl3501_get_from_wla(this, this->esbq_req_tail, &addr, sizeof(addr)); in wl3501_esbq_req_free()
820 wl3501_free_tx_buffer(this, addr); in wl3501_esbq_req_free()
821 this->esbq_req_tail += 4; in wl3501_esbq_req_free()
822 if (this->esbq_req_tail >= this->esbq_req_end) in wl3501_esbq_req_free()
823 this->esbq_req_tail = this->esbq_req_start; in wl3501_esbq_req_free()
828 static int wl3501_esbq_confirm(struct wl3501_card *this) in wl3501_esbq_confirm() argument
832 wl3501_get_from_wla(this, this->esbq_confirm + 3, &tmp, sizeof(tmp)); in wl3501_esbq_confirm()
838 struct wl3501_card *this = netdev_priv(dev); in wl3501_online() local
841 dev->name, this->bssid); in wl3501_online()
845 static void wl3501_esbq_confirm_done(struct wl3501_card *this) in wl3501_esbq_confirm_done() argument
849 wl3501_set_to_wla(this, this->esbq_confirm + 3, &tmp, sizeof(tmp)); in wl3501_esbq_confirm_done()
850 this->esbq_confirm += 4; in wl3501_esbq_confirm_done()
851 if (this->esbq_confirm >= this->esbq_confirm_end) in wl3501_esbq_confirm_done()
852 this->esbq_confirm = this->esbq_confirm_start; in wl3501_esbq_confirm_done()
855 static int wl3501_mgmt_auth(struct wl3501_card *this) in wl3501_mgmt_auth() argument
864 memcpy(sig.mac_addr, this->bssid, ETH_ALEN); in wl3501_mgmt_auth()
865 return wl3501_esbq_exec(this, &sig, sizeof(sig)); in wl3501_mgmt_auth()
868 static int wl3501_mgmt_association(struct wl3501_card *this) in wl3501_mgmt_association() argument
874 .cap_info = this->cap_info, in wl3501_mgmt_association()
878 memcpy(sig.mac_addr, this->bssid, ETH_ALEN); in wl3501_mgmt_association()
879 return wl3501_esbq_exec(this, &sig, sizeof(sig)); in wl3501_mgmt_association()
884 struct wl3501_card *this = netdev_priv(dev); in wl3501_mgmt_join_confirm() local
888 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); in wl3501_mgmt_join_confirm()
890 if (this->net_type == IW_MODE_INFRA) { in wl3501_mgmt_join_confirm()
891 if (this->join_sta_bss < this->bss_cnt) { in wl3501_mgmt_join_confirm()
892 const int i = this->join_sta_bss; in wl3501_mgmt_join_confirm()
893 memcpy(this->bssid, in wl3501_mgmt_join_confirm()
894 this->bss_set[i].req.bssid, ETH_ALEN); in wl3501_mgmt_join_confirm()
895 this->chan = this->bss_set[i].req.ds_pset.chan; in wl3501_mgmt_join_confirm()
896 iw_copy_mgmt_info_element(&this->keep_essid.el, in wl3501_mgmt_join_confirm()
897 &this->bss_set[i].req.ssid.el); in wl3501_mgmt_join_confirm()
898 wl3501_mgmt_auth(this); in wl3501_mgmt_join_confirm()
901 const int i = this->join_sta_bss; in wl3501_mgmt_join_confirm()
903 memcpy(&this->bssid, &this->bss_set[i].req.bssid, ETH_ALEN); in wl3501_mgmt_join_confirm()
904 this->chan = this->bss_set[i].req.ds_pset.chan; in wl3501_mgmt_join_confirm()
905 iw_copy_mgmt_info_element(&this->keep_essid.el, in wl3501_mgmt_join_confirm()
906 &this->bss_set[i].req.ssid.el); in wl3501_mgmt_join_confirm()
911 this->join_sta_bss++; in wl3501_mgmt_join_confirm()
912 for (i = this->join_sta_bss; i < this->bss_cnt; i++) in wl3501_mgmt_join_confirm()
913 if (!wl3501_mgmt_join(this, i)) in wl3501_mgmt_join_confirm()
915 this->join_sta_bss = i; in wl3501_mgmt_join_confirm()
916 if (this->join_sta_bss == this->bss_cnt) { in wl3501_mgmt_join_confirm()
917 if (this->net_type == IW_MODE_INFRA) in wl3501_mgmt_join_confirm()
918 wl3501_mgmt_scan(this, 100); in wl3501_mgmt_join_confirm()
920 this->adhoc_times++; in wl3501_mgmt_join_confirm()
921 if (this->adhoc_times > WL3501_MAX_ADHOC_TRIES) in wl3501_mgmt_join_confirm()
922 wl3501_mgmt_start(this); in wl3501_mgmt_join_confirm()
924 wl3501_mgmt_scan(this, 100); in wl3501_mgmt_join_confirm()
931 struct wl3501_card *this) in wl3501_alarm_interrupt() argument
933 if (this->net_type == IW_MODE_INFRA) { in wl3501_alarm_interrupt()
936 wl3501_mgmt_resync(this); in wl3501_alarm_interrupt()
941 struct wl3501_card *this, in wl3501_md_confirm_interrupt() argument
947 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); in wl3501_md_confirm_interrupt()
948 wl3501_free_tx_buffer(this, sig.data); in wl3501_md_confirm_interrupt()
954 struct wl3501_card *this, u16 addr) in wl3501_md_ind_interrupt() argument
961 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); in wl3501_md_ind_interrupt()
962 this->start_seg = sig.data; in wl3501_md_ind_interrupt()
963 wl3501_get_from_wla(this, in wl3501_md_ind_interrupt()
966 this->rssi = rssi <= 63 ? (rssi * 100) / 64 : 255; in wl3501_md_ind_interrupt()
968 wl3501_get_from_wla(this, in wl3501_md_ind_interrupt()
990 wl3501_receive(this, skb->data, pkt_len); in wl3501_md_ind_interrupt()
999 static inline void wl3501_get_confirm_interrupt(struct wl3501_card *this, in wl3501_get_confirm_interrupt() argument
1003 wl3501_get_from_wla(this, addr, &this->sig_get_confirm, in wl3501_get_confirm_interrupt()
1004 sizeof(this->sig_get_confirm)); in wl3501_get_confirm_interrupt()
1005 wake_up(&this->wait); in wl3501_get_confirm_interrupt()
1009 struct wl3501_card *this, in wl3501_start_confirm_interrupt() argument
1015 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); in wl3501_start_confirm_interrupt()
1023 struct wl3501_card *this = netdev_priv(dev); in wl3501_assoc_confirm_interrupt() local
1027 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); in wl3501_assoc_confirm_interrupt()
1033 static inline void wl3501_auth_confirm_interrupt(struct wl3501_card *this, in wl3501_auth_confirm_interrupt() argument
1039 wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); in wl3501_auth_confirm_interrupt()
1042 wl3501_mgmt_association(this); in wl3501_auth_confirm_interrupt()
1044 wl3501_mgmt_resync(this); in wl3501_auth_confirm_interrupt()
1052 struct wl3501_card *this = netdev_priv(dev); in wl3501_rx_interrupt() local
1057 if (!wl3501_esbq_confirm(this)) in wl3501_rx_interrupt()
1059 wl3501_get_from_wla(this, this->esbq_confirm, &addr, sizeof(addr)); in wl3501_rx_interrupt()
1060 wl3501_get_from_wla(this, addr + 2, &sig_id, sizeof(sig_id)); in wl3501_rx_interrupt()
1066 wl3501_alarm_interrupt(dev, this); in wl3501_rx_interrupt()
1069 wl3501_md_confirm_interrupt(dev, this, addr); in wl3501_rx_interrupt()
1072 wl3501_md_ind_interrupt(dev, this, addr); in wl3501_rx_interrupt()
1075 wl3501_get_confirm_interrupt(this, addr, in wl3501_rx_interrupt()
1076 &this->sig_get_confirm, in wl3501_rx_interrupt()
1077 sizeof(this->sig_get_confirm)); in wl3501_rx_interrupt()
1080 wl3501_get_confirm_interrupt(this, addr, in wl3501_rx_interrupt()
1081 &this->sig_pwr_mgmt_confirm, in wl3501_rx_interrupt()
1082 sizeof(this->sig_pwr_mgmt_confirm)); in wl3501_rx_interrupt()
1085 wl3501_start_confirm_interrupt(dev, this, addr); in wl3501_rx_interrupt()
1088 wl3501_mgmt_scan_confirm(this, addr); in wl3501_rx_interrupt()
1097 wl3501_auth_confirm_interrupt(this, addr); in wl3501_rx_interrupt()
1100 wl3501_mgmt_resync(this); /* FIXME: should be resync_confirm */ in wl3501_rx_interrupt()
1103 wl3501_esbq_confirm_done(this); in wl3501_rx_interrupt()
1107 wl3501_esbq_req_free(this); in wl3501_rx_interrupt()
1112 static inline void wl3501_ack_interrupt(struct wl3501_card *this) in wl3501_ack_interrupt() argument
1114 wl3501_outb(WL3501_GCR_ECINT, this->base_addr + WL3501_NIC_GCR); in wl3501_ack_interrupt()
1132 struct wl3501_card *this; in wl3501_interrupt() local
1134 this = netdev_priv(dev); in wl3501_interrupt()
1135 spin_lock(&this->lock); in wl3501_interrupt()
1136 wl3501_ack_interrupt(this); in wl3501_interrupt()
1137 wl3501_block_interrupt(this); in wl3501_interrupt()
1139 wl3501_unblock_interrupt(this); in wl3501_interrupt()
1140 spin_unlock(&this->lock); in wl3501_interrupt()
1145 static int wl3501_reset_board(struct wl3501_card *this) in wl3501_reset_board() argument
1151 wl3501_outb_p(WL3501_GCR_CORESET, this->base_addr + WL3501_NIC_GCR); in wl3501_reset_board()
1152 wl3501_outb_p(0, this->base_addr + WL3501_NIC_GCR); in wl3501_reset_board()
1153 wl3501_outb_p(WL3501_GCR_CORESET, this->base_addr + WL3501_NIC_GCR); in wl3501_reset_board()
1156 wl3501_set_to_wla(this, 0x480, &tmp, sizeof(tmp)); in wl3501_reset_board()
1159 wl3501_outb_p(0, this->base_addr + WL3501_NIC_GCR); in wl3501_reset_board()
1163 wl3501_unblock_interrupt(this); /* acme: was commented */ in wl3501_reset_board()
1167 wl3501_get_from_wla(this, 0x480, &tmp, sizeof(tmp)); in wl3501_reset_board()
1172 wl3501_set_to_wla(this, 0x480, &tmp, sizeof(tmp)); in wl3501_reset_board()
1183 static int wl3501_init_firmware(struct wl3501_card *this) in wl3501_init_firmware() argument
1186 int rc = wl3501_reset_board(this); in wl3501_init_firmware()
1190 this->card_name[0] = '\0'; in wl3501_init_firmware()
1191 wl3501_get_from_wla(this, 0x1a00, in wl3501_init_firmware()
1192 this->card_name, sizeof(this->card_name)); in wl3501_init_firmware()
1193 this->card_name[sizeof(this->card_name) - 1] = '\0'; in wl3501_init_firmware()
1194 this->firmware_date[0] = '\0'; in wl3501_init_firmware()
1195 wl3501_get_from_wla(this, 0x1a40, in wl3501_init_firmware()
1196 this->firmware_date, sizeof(this->firmware_date)); in wl3501_init_firmware()
1197 this->firmware_date[sizeof(this->firmware_date) - 1] = '\0'; in wl3501_init_firmware()
1199 wl3501_switch_page(this, WL3501_BSS_SPAGE0); in wl3501_init_firmware()
1201 wl3501_get_from_wla(this, 0x482, &this->esbq_req_start, 2); in wl3501_init_firmware()
1202 wl3501_get_from_wla(this, 0x486, &this->esbq_req_end, 2); in wl3501_init_firmware()
1203 wl3501_get_from_wla(this, 0x488, &this->esbq_confirm_start, 2); in wl3501_init_firmware()
1204 wl3501_get_from_wla(this, 0x48c, &this->esbq_confirm_end, 2); in wl3501_init_firmware()
1205 wl3501_get_from_wla(this, 0x48e, &this->tx_buffer_head, 2); in wl3501_init_firmware()
1206 wl3501_get_from_wla(this, 0x492, &this->tx_buffer_size, 2); in wl3501_init_firmware()
1207 this->esbq_req_tail = this->esbq_req_head = this->esbq_req_start; in wl3501_init_firmware()
1208 this->esbq_req_end += this->esbq_req_start; in wl3501_init_firmware()
1209 this->esbq_confirm = this->esbq_confirm_start; in wl3501_init_firmware()
1210 this->esbq_confirm_end += this->esbq_confirm_start; in wl3501_init_firmware()
1212 this->tx_buffer_cnt = 1; in wl3501_init_firmware()
1213 ptr = this->tx_buffer_head; in wl3501_init_firmware()
1215 while ((next - this->tx_buffer_head) < this->tx_buffer_size) { in wl3501_init_firmware()
1216 this->tx_buffer_cnt++; in wl3501_init_firmware()
1217 wl3501_set_to_wla(this, ptr, &next, sizeof(next)); in wl3501_init_firmware()
1223 wl3501_set_to_wla(this, ptr, &next, sizeof(next)); in wl3501_init_firmware()
1224 this->tx_buffer_tail = ptr; in wl3501_init_firmware()
1234 struct wl3501_card *this = netdev_priv(dev); in wl3501_close() local
1237 link = this->p_dev; in wl3501_close()
1239 spin_lock_irqsave(&this->lock, flags); in wl3501_close()
1244 wl3501_ack_interrupt(this); in wl3501_close()
1247 wl3501_block_interrupt(this); in wl3501_close()
1250 spin_unlock_irqrestore(&this->lock, flags); in wl3501_close()
1264 struct wl3501_card *this = netdev_priv(dev); in wl3501_reset() local
1268 spin_lock_irqsave(&this->lock, flags); in wl3501_reset()
1269 wl3501_block_interrupt(this); in wl3501_reset()
1271 if (wl3501_init_firmware(this)) { in wl3501_reset()
1283 this->adhoc_times = 0; in wl3501_reset()
1284 wl3501_ack_interrupt(this); in wl3501_reset()
1285 wl3501_unblock_interrupt(this); in wl3501_reset()
1286 wl3501_mgmt_scan(this, 100); in wl3501_reset()
1290 spin_unlock_irqrestore(&this->lock, flags); in wl3501_reset()
1319 struct wl3501_card *this = netdev_priv(dev); in wl3501_hard_start_xmit() local
1322 spin_lock_irqsave(&this->lock, flags); in wl3501_hard_start_xmit()
1323 enabled = wl3501_block_interrupt(this); in wl3501_hard_start_xmit()
1324 rc = wl3501_send_pkt(this, skb->data, skb->len); in wl3501_hard_start_xmit()
1326 wl3501_unblock_interrupt(this); in wl3501_hard_start_xmit()
1335 if (this->tx_buffer_cnt < 2) in wl3501_hard_start_xmit()
1338 spin_unlock_irqrestore(&this->lock, flags); in wl3501_hard_start_xmit()
1345 struct wl3501_card *this = netdev_priv(dev); in wl3501_open() local
1348 link = this->p_dev; in wl3501_open()
1350 spin_lock_irqsave(&this->lock, flags); in wl3501_open()
1358 if (wl3501_init_firmware(this)) in wl3501_open()
1361 this->adhoc_times = 0; in wl3501_open()
1363 wl3501_ack_interrupt(this); in wl3501_open()
1366 wl3501_unblock_interrupt(this); in wl3501_open()
1367 wl3501_mgmt_scan(this, 100); in wl3501_open()
1372 dev->name, this->card_name, in wl3501_open()
1373 dev->name, this->firmware_date); in wl3501_open()
1375 spin_unlock_irqrestore(&this->lock, flags); in wl3501_open()
1384 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_wireless_stats() local
1385 struct iw_statistics *wstats = &this->wstats; in wl3501_get_wireless_stats()
1390 if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_ICV_ERROR_COUNT, in wl3501_get_wireless_stats()
1393 if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_UNDECRYPTABLE_COUNT, in wl3501_get_wireless_stats()
1396 if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_EXCLUDED_COUNT, in wl3501_get_wireless_stats()
1399 if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_RETRY_COUNT, in wl3501_get_wireless_stats()
1402 if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_FAILED_COUNT, in wl3501_get_wireless_stats()
1405 if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_RTS_FAILURE_COUNT, in wl3501_get_wireless_stats()
1408 if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_ACK_FAILURE_COUNT, in wl3501_get_wireless_stats()
1411 if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_FRAME_DUPLICATE_COUNT, in wl3501_get_wireless_stats()
1453 struct wl3501_card *this = netdev_priv(dev); in wl3501_set_freq() local
1457 if (iw_valid_channel(this->reg_domain, channel)) { in wl3501_set_freq()
1458 this->chan = channel; in wl3501_set_freq()
1467 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_freq() local
1470 ieee80211_channel_to_frequency(this->chan, NL80211_BAND_2GHZ); in wl3501_get_freq()
1483 struct wl3501_card *this = netdev_priv(dev); in wl3501_set_mode() local
1485 this->net_type = wrqu->mode; in wl3501_set_mode()
1494 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_mode() local
1496 wrqu->mode = this->net_type; in wl3501_get_mode()
1503 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_sens() local
1505 wrqu->sens.value = this->rssi; in wl3501_get_sens()
1534 struct wl3501_card *this = netdev_priv(dev); in wl3501_set_wap() local
1543 memcpy(this->bssid, wrqu->ap_addr.sa_data, ETH_ALEN); in wl3501_set_wap()
1553 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_wap() local
1556 memcpy(wrqu->ap_addr.sa_data, this->bssid, ETH_ALEN); in wl3501_get_wap()
1572 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_scan() local
1577 for (i = 0; i < this->bss_cnt; ++i) { in wl3501_get_scan()
1580 memcpy(iwe.u.ap_addr.sa_data, this->bss_set[i].req.bssid, ETH_ALEN); in wl3501_get_scan()
1586 iwe.u.data.length = this->bss_set[i].req.ssid.el.len; in wl3501_get_scan()
1590 this->bss_set[i].req.ssid.essid); in wl3501_get_scan()
1592 iwe.u.mode = this->bss_set[i].req.bss_type; in wl3501_get_scan()
1597 iwe.u.freq.m = this->bss_set[i].req.ds_pset.chan; in wl3501_get_scan()
1603 if (this->bss_set[i].req.cap_info & WL3501_MGMT_CAPABILITY_PRIVACY) in wl3501_get_scan()
1622 struct wl3501_card *this = netdev_priv(dev); in wl3501_set_essid() local
1626 &this->essid.el, in wl3501_set_essid()
1630 &this->essid.el, "ANY", 3); in wl3501_set_essid()
1639 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_essid() local
1642 spin_lock_irqsave(&this->lock, flags); in wl3501_get_essid()
1644 wrqu->essid.length = this->essid.el.len; in wl3501_get_essid()
1645 memcpy(extra, this->essid.essid, this->essid.el.len); in wl3501_get_essid()
1646 spin_unlock_irqrestore(&this->lock, flags); in wl3501_get_essid()
1653 struct wl3501_card *this = netdev_priv(dev); in wl3501_set_nick() local
1655 if (wrqu->data.length > sizeof(this->nick)) in wl3501_set_nick()
1657 strlcpy(this->nick, extra, wrqu->data.length); in wl3501_set_nick()
1664 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_nick() local
1666 strlcpy(extra, this->nick, 32); in wl3501_get_nick()
1689 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_rts_threshold() local
1690 int rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_RTS_THRESHOLD, in wl3501_get_rts_threshold()
1705 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_frag_threshold() local
1706 int rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_FRAG_THRESHOLD, in wl3501_get_frag_threshold()
1721 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_txpow() local
1722 int rc = wl3501_get_mib_value(this, in wl3501_get_txpow()
1743 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_retry() local
1744 int rc = wl3501_get_mib_value(this, in wl3501_get_retry()
1753 rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_SHORT_RETRY_LIMIT, in wl3501_get_retry()
1770 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_encode() local
1771 int rc = wl3501_get_mib_value(this, in wl3501_get_encode()
1780 rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_EXCLUDE_UNENCRYPTED, in wl3501_get_encode()
1786 rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_KEY_MAPPINGS_LEN, in wl3501_get_encode()
1790 rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_KEY_MAPPINGS, in wl3501_get_encode()
1807 struct wl3501_card *this = netdev_priv(dev); in wl3501_get_power() local
1808 int rc = wl3501_get_mib_value(this, in wl3501_get_power()
1866 struct wl3501_card *this; in wl3501_probe() local
1884 this = netdev_priv(dev); in wl3501_probe()
1885 this->wireless_data.spy_data = &this->spy_data; in wl3501_probe()
1886 this->p_dev = p_dev; in wl3501_probe()
1887 dev->wireless_data = &this->wireless_data; in wl3501_probe()
1901 struct wl3501_card *this; in wl3501_config() local
1939 this = netdev_priv(dev); in wl3501_config()
1941 this->base_addr = dev->base_addr; in wl3501_config()
1943 if (!wl3501_get_flash_mac_addr(this)) { in wl3501_config()
1951 dev->dev_addr[i] = ((char *)&this->mac_addr)[i]; in wl3501_config()
1956 dev->name, this->base_addr, (int)dev->irq, in wl3501_config()
1961 this->net_type = IW_MODE_INFRA; in wl3501_config()
1962 this->bss_cnt = 0; in wl3501_config()
1963 this->join_sta_bss = 0; in wl3501_config()
1964 this->adhoc_times = 0; in wl3501_config()
1965 iw_set_mgmt_info_element(IW_MGMT_INFO_ELEMENT_SSID, &this->essid.el, in wl3501_config()
1967 this->card_name[0] = '\0'; in wl3501_config()
1968 this->firmware_date[0] = '\0'; in wl3501_config()
1969 this->rssi = 255; in wl3501_config()
1970 this->chan = iw_default_channel(this->reg_domain); in wl3501_config()
1971 strlcpy(this->nick, "Planet WL3501", sizeof(this->nick)); in wl3501_config()
1972 spin_lock_init(&this->lock); in wl3501_config()
1973 init_waitqueue_head(&this->wait); in wl3501_config()