Lines Matching +full:mic +full:- +full:pos

2  * Copyright (c) 2004-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2012 Qualcomm Atheros, Inc.
21 #include "hif-ops.h"
28 struct ath6kl *ar = vif->ar; in ath6kl_find_sta()
35 max_conn = (vif->nw_type == AP_NETWORK) ? AP_MAX_NUM_STA : 0; in ath6kl_find_sta()
38 if (memcmp(node_addr, ar->sta_list[i].mac, ETH_ALEN) == 0) { in ath6kl_find_sta()
39 conn = &ar->sta_list[i]; in ath6kl_find_sta()
53 if (ar->sta_list[ctr].aid == aid) { in ath6kl_find_sta_by_aid()
54 conn = &ar->sta_list[ctr]; in ath6kl_find_sta_by_aid()
65 struct ath6kl *ar = vif->ar; in ath6kl_add_new_sta()
69 free_slot = aid - 1; in ath6kl_add_new_sta()
71 sta = &ar->sta_list[free_slot]; in ath6kl_add_new_sta()
72 memcpy(sta->mac, mac, ETH_ALEN); in ath6kl_add_new_sta()
74 memcpy(sta->wpa_ie, wpaie, ielen); in ath6kl_add_new_sta()
75 sta->aid = aid; in ath6kl_add_new_sta()
76 sta->keymgmt = keymgmt; in ath6kl_add_new_sta()
77 sta->ucipher = ucipher; in ath6kl_add_new_sta()
78 sta->auth = auth; in ath6kl_add_new_sta()
79 sta->apsd_info = apsd_info; in ath6kl_add_new_sta()
81 ar->sta_list_index = ar->sta_list_index | (1 << free_slot); in ath6kl_add_new_sta()
82 ar->ap_stats.sta[free_slot].aid = cpu_to_le32(aid); in ath6kl_add_new_sta()
83 aggr_conn_init(vif, vif->aggr_cntxt, sta->aggr_conn); in ath6kl_add_new_sta()
88 struct ath6kl_sta *sta = &ar->sta_list[i]; in ath6kl_sta_cleanup()
92 spin_lock_bh(&sta->psq_lock); in ath6kl_sta_cleanup()
93 skb_queue_purge(&sta->psq); in ath6kl_sta_cleanup()
94 skb_queue_purge(&sta->apsdq); in ath6kl_sta_cleanup()
96 if (sta->mgmt_psq_len != 0) { in ath6kl_sta_cleanup()
97 list_for_each_entry_safe(entry, tmp, &sta->mgmt_psq, list) { in ath6kl_sta_cleanup()
100 INIT_LIST_HEAD(&sta->mgmt_psq); in ath6kl_sta_cleanup()
101 sta->mgmt_psq_len = 0; in ath6kl_sta_cleanup()
104 spin_unlock_bh(&sta->psq_lock); in ath6kl_sta_cleanup()
106 memset(&ar->ap_stats.sta[sta->aid - 1], 0, in ath6kl_sta_cleanup()
108 eth_zero_addr(sta->mac); in ath6kl_sta_cleanup()
109 memset(sta->wpa_ie, 0, ATH6KL_MAX_IE); in ath6kl_sta_cleanup()
110 sta->aid = 0; in ath6kl_sta_cleanup()
111 sta->sta_flags = 0; in ath6kl_sta_cleanup()
113 ar->sta_list_index = ar->sta_list_index & ~(1 << i); in ath6kl_sta_cleanup()
114 aggr_reset_state(sta->aggr_conn); in ath6kl_sta_cleanup()
128 if (!is_zero_ether_addr(ar->sta_list[i].mac)) { in ath6kl_remove_sta()
135 if (memcmp(ar->sta_list[i].mac, mac, ETH_ALEN) == 0) { in ath6kl_remove_sta()
138 mac, ar->sta_list[i].aid, reason); in ath6kl_remove_sta()
152 return ar->ac2ep_map[ac]; in ath6kl_ac2_endpoint_id()
159 cookie = ar->cookie_list; in ath6kl_alloc_cookie()
161 ar->cookie_list = cookie->arc_list_next; in ath6kl_alloc_cookie()
162 ar->cookie_count--; in ath6kl_alloc_cookie()
172 ar->cookie_list = NULL; in ath6kl_cookie_init()
173 ar->cookie_count = 0; in ath6kl_cookie_init()
175 memset(ar->cookie_mem, 0, sizeof(ar->cookie_mem)); in ath6kl_cookie_init()
178 ath6kl_free_cookie(ar, &ar->cookie_mem[i]); in ath6kl_cookie_init()
183 ar->cookie_list = NULL; in ath6kl_cookie_cleanup()
184 ar->cookie_count = 0; in ath6kl_cookie_cleanup()
194 cookie->arc_list_next = ar->cookie_list; in ath6kl_free_cookie()
195 ar->cookie_list = cookie; in ath6kl_free_cookie()
196 ar->cookie_count++; in ath6kl_free_cookie()
242 return -EINVAL; in ath6kl_diag_read()
260 return -EINVAL; in ath6kl_diag_write()
281 return -ENOMEM; in ath6kl_read_fwlogs()
283 address = TARG_VTOP(ar->target_type, in ath6kl_read_fwlogs()
294 ret = -EINVAL; in ath6kl_read_fwlogs()
298 address = TARG_VTOP(ar->target_type, debug_hdr_addr); in ath6kl_read_fwlogs()
303 address = TARG_VTOP(ar->target_type, in ath6kl_read_fwlogs()
313 address = TARG_VTOP(ar->target_type, in ath6kl_read_fwlogs()
329 address = TARG_VTOP(ar->target_type, in ath6kl_read_fwlogs()
336 loop--; in ath6kl_read_fwlogs()
339 ret = -ETIMEDOUT; in ath6kl_read_fwlogs()
356 if (vif->wep_key_list[index].key_len) { in ath6kl_install_static_wep_keys()
358 if (index == vif->def_txkey_index) in ath6kl_install_static_wep_keys()
361 ath6kl_wmi_addkey_cmd(vif->ar->wmi, vif->fw_vif_idx, in ath6kl_install_static_wep_keys()
365 vif->wep_key_list[index].key_len, in ath6kl_install_static_wep_keys()
367 vif->wep_key_list[index].key, in ath6kl_install_static_wep_keys()
376 struct ath6kl *ar = vif->ar; in ath6kl_connect_ap_mode_bss()
381 ik = &ar->ap_mode_bkey; in ath6kl_connect_ap_mode_bss()
385 switch (vif->auth_mode) { in ath6kl_connect_ap_mode_bss()
387 if (vif->prwise_crypto == WEP_CRYPT) in ath6kl_connect_ap_mode_bss()
389 if (!ik->valid || ik->key_type != WAPI_CRYPT) in ath6kl_connect_ap_mode_bss()
396 if (!ik->valid) in ath6kl_connect_ap_mode_bss()
403 ar->wmi, vif->fw_vif_idx, ik->key_index, ik->key_type, in ath6kl_connect_ap_mode_bss()
404 GROUP_USAGE, ik->key_len, key_rsc, ATH6KL_KEY_SEQ_LEN, in ath6kl_connect_ap_mode_bss()
405 ik->key, in ath6kl_connect_ap_mode_bss()
414 if (ar->last_ch != channel) in ath6kl_connect_ap_mode_bss()
418 ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, NONE_BSS_FILTER, 0); in ath6kl_connect_ap_mode_bss()
419 set_bit(CONNECTED, &vif->flags); in ath6kl_connect_ap_mode_bss()
420 netif_carrier_on(vif->ndev); in ath6kl_connect_ap_mode_bss()
427 u8 *ies = NULL, *wpa_ie = NULL, *pos; in ath6kl_connect_ap_mode_sta() local
439 if (ieee80211_is_assoc_req(mgmt->frame_control) && in ath6kl_connect_ap_mode_sta()
441 sizeof(mgmt->u.assoc_req)) { in ath6kl_connect_ap_mode_sta()
442 ies = mgmt->u.assoc_req.variable; in ath6kl_connect_ap_mode_sta()
443 ies_len = assoc_info + assoc_req_len - ies; in ath6kl_connect_ap_mode_sta()
444 } else if (ieee80211_is_reassoc_req(mgmt->frame_control) && in ath6kl_connect_ap_mode_sta()
446 + sizeof(mgmt->u.reassoc_req)) { in ath6kl_connect_ap_mode_sta()
447 ies = mgmt->u.reassoc_req.variable; in ath6kl_connect_ap_mode_sta()
448 ies_len = assoc_info + assoc_req_len - ies; in ath6kl_connect_ap_mode_sta()
452 pos = ies; in ath6kl_connect_ap_mode_sta()
453 while (pos && pos + 1 < ies + ies_len) { in ath6kl_connect_ap_mode_sta()
454 if (pos + 2 + pos[1] > ies + ies_len) in ath6kl_connect_ap_mode_sta()
456 if (pos[0] == WLAN_EID_RSN) in ath6kl_connect_ap_mode_sta()
457 wpa_ie = pos; /* RSN IE */ in ath6kl_connect_ap_mode_sta()
458 else if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && in ath6kl_connect_ap_mode_sta()
459 pos[1] >= 4 && in ath6kl_connect_ap_mode_sta()
460 pos[2] == 0x00 && pos[3] == 0x50 && pos[4] == 0xf2) { in ath6kl_connect_ap_mode_sta()
461 if (pos[5] == 0x01) in ath6kl_connect_ap_mode_sta()
462 wpa_ie = pos; /* WPA IE */ in ath6kl_connect_ap_mode_sta()
463 else if (pos[5] == 0x04) { in ath6kl_connect_ap_mode_sta()
464 wpa_ie = pos; /* WPS IE */ in ath6kl_connect_ap_mode_sta()
467 } else if (pos[0] == 0x44 && wpa_ie == NULL) { in ath6kl_connect_ap_mode_sta()
469 * Note: WAPI Parameter Set IE re-uses Element ID that in ath6kl_connect_ap_mode_sta()
477 wpa_ie = pos; /* WAPI IE */ in ath6kl_connect_ap_mode_sta()
480 pos += 2 + pos[1]; in ath6kl_connect_ap_mode_sta()
494 sinfo->assoc_req_ies = ies; in ath6kl_connect_ap_mode_sta()
495 sinfo->assoc_req_ies_len = ies_len; in ath6kl_connect_ap_mode_sta()
497 cfg80211_new_sta(vif->ndev, mac_addr, sinfo, GFP_KERNEL); in ath6kl_connect_ap_mode_sta()
499 netif_wake_queue(vif->ndev); in ath6kl_connect_ap_mode_sta()
514 if (test_bit(CONNECTED, &vif->flags) || in ath6kl_disconnect()
515 test_bit(CONNECT_PEND, &vif->flags)) { in ath6kl_disconnect()
516 ath6kl_wmi_disconnect_cmd(vif->ar->wmi, vif->fw_vif_idx); in ath6kl_disconnect()
522 clear_bit(CONNECT_PEND, &vif->flags); in ath6kl_disconnect()
533 memcpy(ar->mac_addr, datap, ETH_ALEN); in ath6kl_ready_event()
537 ar->mac_addr, sw_ver, abi_ver, cap); in ath6kl_ready_event()
539 ar->version.wlan_ver = sw_ver; in ath6kl_ready_event()
540 ar->version.abi_ver = abi_ver; in ath6kl_ready_event()
541 ar->hw.cap = cap; in ath6kl_ready_event()
543 if (strlen(ar->wiphy->fw_version) == 0) { in ath6kl_ready_event()
544 snprintf(ar->wiphy->fw_version, in ath6kl_ready_event()
545 sizeof(ar->wiphy->fw_version), in ath6kl_ready_event()
547 (ar->version.wlan_ver & 0xf0000000) >> 28, in ath6kl_ready_event()
548 (ar->version.wlan_ver & 0x0f000000) >> 24, in ath6kl_ready_event()
549 (ar->version.wlan_ver & 0x00ff0000) >> 16, in ath6kl_ready_event()
550 (ar->version.wlan_ver & 0x0000ffff)); in ath6kl_ready_event()
554 set_bit(WMI_READY, &ar->flag); in ath6kl_ready_event()
555 wake_up(&ar->event_wq); in ath6kl_ready_event()
560 struct ath6kl *ar = vif->ar; in ath6kl_scan_complete_evt()
568 if (!ar->usr_bss_filter) { in ath6kl_scan_complete_evt()
569 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags); in ath6kl_scan_complete_evt()
570 ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_scan_complete_evt()
579 struct ath6kl *ar = vif->ar; in ath6kl_commit_ch_switch()
581 vif->profile.ch = cpu_to_le16(channel); in ath6kl_commit_ch_switch()
583 switch (vif->nw_type) { in ath6kl_commit_ch_switch()
589 if (vif->rsn_capab && in ath6kl_commit_ch_switch()
591 ar->fw_capabilities)) in ath6kl_commit_ch_switch()
592 ath6kl_wmi_set_ie_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_commit_ch_switch()
594 (const u8 *) &vif->rsn_capab, in ath6kl_commit_ch_switch()
595 sizeof(vif->rsn_capab)); in ath6kl_commit_ch_switch()
597 return ath6kl_wmi_ap_profile_commit(ar->wmi, vif->fw_vif_idx, in ath6kl_commit_ch_switch()
598 &vif->profile); in ath6kl_commit_ch_switch()
600 ath6kl_err("won't switch channels nw_type=%d\n", vif->nw_type); in ath6kl_commit_ch_switch()
601 return -ENOTSUPP; in ath6kl_commit_ch_switch()
610 if (!ar->want_ch_switch) in ath6kl_check_ch_switch()
613 spin_lock_bh(&ar->list_lock); in ath6kl_check_ch_switch()
614 list_for_each_entry(vif, &ar->vif_list, list) { in ath6kl_check_ch_switch()
615 if (ar->want_ch_switch & (1 << vif->fw_vif_idx)) in ath6kl_check_ch_switch()
619 ar->want_ch_switch &= ~(1 << vif->fw_vif_idx); in ath6kl_check_ch_switch()
623 vif->nw_type, res); in ath6kl_check_ch_switch()
625 spin_unlock_bh(&ar->list_lock); in ath6kl_check_ch_switch()
634 struct ath6kl *ar = vif->ar; in ath6kl_connect_event()
642 memcpy(vif->bssid, bssid, sizeof(vif->bssid)); in ath6kl_connect_event()
643 vif->bss_ch = channel; in ath6kl_connect_event()
645 if (vif->nw_type == INFRA_NETWORK) { in ath6kl_connect_event()
646 ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_connect_event()
647 vif->listen_intvl_t, 0); in ath6kl_connect_event()
651 netif_wake_queue(vif->ndev); in ath6kl_connect_event()
654 spin_lock_bh(&vif->if_lock); in ath6kl_connect_event()
655 set_bit(CONNECTED, &vif->flags); in ath6kl_connect_event()
656 clear_bit(CONNECT_PEND, &vif->flags); in ath6kl_connect_event()
657 netif_carrier_on(vif->ndev); in ath6kl_connect_event()
658 spin_unlock_bh(&vif->if_lock); in ath6kl_connect_event()
660 aggr_reset_state(vif->aggr_cntxt->aggr_conn); in ath6kl_connect_event()
661 vif->reconnect_flag = 0; in ath6kl_connect_event()
663 if ((vif->nw_type == ADHOC_NETWORK) && ar->ibss_ps_enable) { in ath6kl_connect_event()
664 memset(ar->node_map, 0, sizeof(ar->node_map)); in ath6kl_connect_event()
665 ar->node_num = 0; in ath6kl_connect_event()
666 ar->next_ep_id = ENDPOINT_2; in ath6kl_connect_event()
669 if (!ar->usr_bss_filter) { in ath6kl_connect_event()
670 set_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags); in ath6kl_connect_event()
671 ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_connect_event()
679 struct ath6kl *ar = vif->ar; in ath6kl_tkip_micerr_event()
684 * MIC error. Use this aid to get MAC & send it to hostapd. in ath6kl_tkip_micerr_event()
686 if (vif->nw_type == AP_NETWORK) { in ath6kl_tkip_micerr_event()
692 "ap tkip mic error received from aid=%d\n", keyid); in ath6kl_tkip_micerr_event()
695 cfg80211_michael_mic_failure(vif->ndev, sta->mac, in ath6kl_tkip_micerr_event()
707 struct ath6kl *ar = vif->ar; in ath6kl_update_target_stats()
708 struct target_stats *stats = &vif->target_stats; in ath6kl_update_target_stats()
718 stats->tx_pkt += le32_to_cpu(tgt_stats->stats.tx.pkt); in ath6kl_update_target_stats()
719 stats->tx_byte += le32_to_cpu(tgt_stats->stats.tx.byte); in ath6kl_update_target_stats()
720 stats->tx_ucast_pkt += le32_to_cpu(tgt_stats->stats.tx.ucast_pkt); in ath6kl_update_target_stats()
721 stats->tx_ucast_byte += le32_to_cpu(tgt_stats->stats.tx.ucast_byte); in ath6kl_update_target_stats()
722 stats->tx_mcast_pkt += le32_to_cpu(tgt_stats->stats.tx.mcast_pkt); in ath6kl_update_target_stats()
723 stats->tx_mcast_byte += le32_to_cpu(tgt_stats->stats.tx.mcast_byte); in ath6kl_update_target_stats()
724 stats->tx_bcast_pkt += le32_to_cpu(tgt_stats->stats.tx.bcast_pkt); in ath6kl_update_target_stats()
725 stats->tx_bcast_byte += le32_to_cpu(tgt_stats->stats.tx.bcast_byte); in ath6kl_update_target_stats()
726 stats->tx_rts_success_cnt += in ath6kl_update_target_stats()
727 le32_to_cpu(tgt_stats->stats.tx.rts_success_cnt); in ath6kl_update_target_stats()
730 stats->tx_pkt_per_ac[ac] += in ath6kl_update_target_stats()
731 le32_to_cpu(tgt_stats->stats.tx.pkt_per_ac[ac]); in ath6kl_update_target_stats()
733 stats->tx_err += le32_to_cpu(tgt_stats->stats.tx.err); in ath6kl_update_target_stats()
734 stats->tx_fail_cnt += le32_to_cpu(tgt_stats->stats.tx.fail_cnt); in ath6kl_update_target_stats()
735 stats->tx_retry_cnt += le32_to_cpu(tgt_stats->stats.tx.retry_cnt); in ath6kl_update_target_stats()
736 stats->tx_mult_retry_cnt += in ath6kl_update_target_stats()
737 le32_to_cpu(tgt_stats->stats.tx.mult_retry_cnt); in ath6kl_update_target_stats()
738 stats->tx_rts_fail_cnt += in ath6kl_update_target_stats()
739 le32_to_cpu(tgt_stats->stats.tx.rts_fail_cnt); in ath6kl_update_target_stats()
741 rate = a_sle32_to_cpu(tgt_stats->stats.tx.ucast_rate); in ath6kl_update_target_stats()
742 stats->tx_ucast_rate = ath6kl_wmi_get_rate(ar->wmi, rate); in ath6kl_update_target_stats()
744 stats->rx_pkt += le32_to_cpu(tgt_stats->stats.rx.pkt); in ath6kl_update_target_stats()
745 stats->rx_byte += le32_to_cpu(tgt_stats->stats.rx.byte); in ath6kl_update_target_stats()
746 stats->rx_ucast_pkt += le32_to_cpu(tgt_stats->stats.rx.ucast_pkt); in ath6kl_update_target_stats()
747 stats->rx_ucast_byte += le32_to_cpu(tgt_stats->stats.rx.ucast_byte); in ath6kl_update_target_stats()
748 stats->rx_mcast_pkt += le32_to_cpu(tgt_stats->stats.rx.mcast_pkt); in ath6kl_update_target_stats()
749 stats->rx_mcast_byte += le32_to_cpu(tgt_stats->stats.rx.mcast_byte); in ath6kl_update_target_stats()
750 stats->rx_bcast_pkt += le32_to_cpu(tgt_stats->stats.rx.bcast_pkt); in ath6kl_update_target_stats()
751 stats->rx_bcast_byte += le32_to_cpu(tgt_stats->stats.rx.bcast_byte); in ath6kl_update_target_stats()
752 stats->rx_frgment_pkt += le32_to_cpu(tgt_stats->stats.rx.frgment_pkt); in ath6kl_update_target_stats()
753 stats->rx_err += le32_to_cpu(tgt_stats->stats.rx.err); in ath6kl_update_target_stats()
754 stats->rx_crc_err += le32_to_cpu(tgt_stats->stats.rx.crc_err); in ath6kl_update_target_stats()
755 stats->rx_key_cache_miss += in ath6kl_update_target_stats()
756 le32_to_cpu(tgt_stats->stats.rx.key_cache_miss); in ath6kl_update_target_stats()
757 stats->rx_decrypt_err += le32_to_cpu(tgt_stats->stats.rx.decrypt_err); in ath6kl_update_target_stats()
758 stats->rx_dupl_frame += le32_to_cpu(tgt_stats->stats.rx.dupl_frame); in ath6kl_update_target_stats()
760 rate = a_sle32_to_cpu(tgt_stats->stats.rx.ucast_rate); in ath6kl_update_target_stats()
761 stats->rx_ucast_rate = ath6kl_wmi_get_rate(ar->wmi, rate); in ath6kl_update_target_stats()
763 ccmp_stats = &tgt_stats->stats.tkip_ccmp_stats; in ath6kl_update_target_stats()
765 stats->tkip_local_mic_fail += in ath6kl_update_target_stats()
766 le32_to_cpu(ccmp_stats->tkip_local_mic_fail); in ath6kl_update_target_stats()
767 stats->tkip_cnter_measures_invoked += in ath6kl_update_target_stats()
768 le32_to_cpu(ccmp_stats->tkip_cnter_measures_invoked); in ath6kl_update_target_stats()
769 stats->tkip_fmt_err += le32_to_cpu(ccmp_stats->tkip_fmt_err); in ath6kl_update_target_stats()
771 stats->ccmp_fmt_err += le32_to_cpu(ccmp_stats->ccmp_fmt_err); in ath6kl_update_target_stats()
772 stats->ccmp_replays += le32_to_cpu(ccmp_stats->ccmp_replays); in ath6kl_update_target_stats()
774 stats->pwr_save_fail_cnt += in ath6kl_update_target_stats()
775 le32_to_cpu(tgt_stats->pm_stats.pwr_save_failure_cnt); in ath6kl_update_target_stats()
776 stats->noise_floor_calib = in ath6kl_update_target_stats()
777 a_sle32_to_cpu(tgt_stats->noise_floor_calib); in ath6kl_update_target_stats()
779 stats->cs_bmiss_cnt += in ath6kl_update_target_stats()
780 le32_to_cpu(tgt_stats->cserv_stats.cs_bmiss_cnt); in ath6kl_update_target_stats()
781 stats->cs_low_rssi_cnt += in ath6kl_update_target_stats()
782 le32_to_cpu(tgt_stats->cserv_stats.cs_low_rssi_cnt); in ath6kl_update_target_stats()
783 stats->cs_connect_cnt += in ath6kl_update_target_stats()
784 le16_to_cpu(tgt_stats->cserv_stats.cs_connect_cnt); in ath6kl_update_target_stats()
785 stats->cs_discon_cnt += in ath6kl_update_target_stats()
786 le16_to_cpu(tgt_stats->cserv_stats.cs_discon_cnt); in ath6kl_update_target_stats()
788 stats->cs_ave_beacon_rssi = in ath6kl_update_target_stats()
789 a_sle16_to_cpu(tgt_stats->cserv_stats.cs_ave_beacon_rssi); in ath6kl_update_target_stats()
791 stats->cs_last_roam_msec = in ath6kl_update_target_stats()
792 tgt_stats->cserv_stats.cs_last_roam_msec; in ath6kl_update_target_stats()
793 stats->cs_snr = tgt_stats->cserv_stats.cs_snr; in ath6kl_update_target_stats()
794 stats->cs_rssi = a_sle16_to_cpu(tgt_stats->cserv_stats.cs_rssi); in ath6kl_update_target_stats()
796 stats->lq_val = le32_to_cpu(tgt_stats->lq_val); in ath6kl_update_target_stats()
798 stats->wow_pkt_dropped += in ath6kl_update_target_stats()
799 le32_to_cpu(tgt_stats->wow_stats.wow_pkt_dropped); in ath6kl_update_target_stats()
800 stats->wow_host_pkt_wakeups += in ath6kl_update_target_stats()
801 tgt_stats->wow_stats.wow_host_pkt_wakeups; in ath6kl_update_target_stats()
802 stats->wow_host_evt_wakeups += in ath6kl_update_target_stats()
803 tgt_stats->wow_stats.wow_host_evt_wakeups; in ath6kl_update_target_stats()
804 stats->wow_evt_discarded += in ath6kl_update_target_stats()
805 le16_to_cpu(tgt_stats->wow_stats.wow_evt_discarded); in ath6kl_update_target_stats()
807 stats->arp_received = le32_to_cpu(tgt_stats->arp_stats.arp_received); in ath6kl_update_target_stats()
808 stats->arp_replied = le32_to_cpu(tgt_stats->arp_stats.arp_replied); in ath6kl_update_target_stats()
809 stats->arp_matched = le32_to_cpu(tgt_stats->arp_stats.arp_matched); in ath6kl_update_target_stats()
811 if (test_bit(STATS_UPDATE_PEND, &vif->flags)) { in ath6kl_update_target_stats()
812 clear_bit(STATS_UPDATE_PEND, &vif->flags); in ath6kl_update_target_stats()
813 wake_up(&ar->event_wq); in ath6kl_update_target_stats()
825 struct ath6kl *ar = vif->ar; in ath6kl_tgt_stats_event()
826 struct wmi_ap_mode_stat *ap = &ar->ap_stats; in ath6kl_tgt_stats_event()
830 if (vif->nw_type == AP_NETWORK) { in ath6kl_tgt_stats_event()
835 st_ap = &ap->sta[ac]; in ath6kl_tgt_stats_event()
836 st_p = &p->sta[ac]; in ath6kl_tgt_stats_event()
838 ath6kl_add_le32(&st_ap->tx_bytes, st_p->tx_bytes); in ath6kl_tgt_stats_event()
839 ath6kl_add_le32(&st_ap->tx_pkts, st_p->tx_pkts); in ath6kl_tgt_stats_event()
840 ath6kl_add_le32(&st_ap->tx_error, st_p->tx_error); in ath6kl_tgt_stats_event()
841 ath6kl_add_le32(&st_ap->tx_discard, st_p->tx_discard); in ath6kl_tgt_stats_event()
842 ath6kl_add_le32(&st_ap->rx_bytes, st_p->rx_bytes); in ath6kl_tgt_stats_event()
843 ath6kl_add_le32(&st_ap->rx_pkts, st_p->rx_pkts); in ath6kl_tgt_stats_event()
844 ath6kl_add_le32(&st_ap->rx_error, st_p->rx_error); in ath6kl_tgt_stats_event()
845 ath6kl_add_le32(&st_ap->rx_discard, st_p->rx_discard); in ath6kl_tgt_stats_event()
857 wake_up(&ar->event_wq); in ath6kl_wakeup_event()
864 ar->tx_pwr = tx_pwr; in ath6kl_txpwr_rx_evt()
865 wake_up(&ar->event_wq); in ath6kl_txpwr_rx_evt()
873 struct ath6kl *ar = vif->ar; in ath6kl_pspoll_event()
884 spin_lock_bh(&conn->psq_lock); in ath6kl_pspoll_event()
885 psq_empty = skb_queue_empty(&conn->psq) && (conn->mgmt_psq_len == 0); in ath6kl_pspoll_event()
886 spin_unlock_bh(&conn->psq_lock); in ath6kl_pspoll_event()
892 spin_lock_bh(&conn->psq_lock); in ath6kl_pspoll_event()
893 if (conn->mgmt_psq_len > 0) { in ath6kl_pspoll_event()
894 mgmt_buf = list_first_entry(&conn->mgmt_psq, in ath6kl_pspoll_event()
896 list_del(&mgmt_buf->list); in ath6kl_pspoll_event()
897 conn->mgmt_psq_len--; in ath6kl_pspoll_event()
898 spin_unlock_bh(&conn->psq_lock); in ath6kl_pspoll_event()
900 conn->sta_flags |= STA_PS_POLLED; in ath6kl_pspoll_event()
901 ath6kl_wmi_send_mgmt_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_pspoll_event()
902 mgmt_buf->id, mgmt_buf->freq, in ath6kl_pspoll_event()
903 mgmt_buf->wait, mgmt_buf->buf, in ath6kl_pspoll_event()
904 mgmt_buf->len, mgmt_buf->no_cck); in ath6kl_pspoll_event()
905 conn->sta_flags &= ~STA_PS_POLLED; in ath6kl_pspoll_event()
908 skb = skb_dequeue(&conn->psq); in ath6kl_pspoll_event()
909 spin_unlock_bh(&conn->psq_lock); in ath6kl_pspoll_event()
911 conn->sta_flags |= STA_PS_POLLED; in ath6kl_pspoll_event()
912 ath6kl_data_tx(skb, vif->ndev); in ath6kl_pspoll_event()
913 conn->sta_flags &= ~STA_PS_POLLED; in ath6kl_pspoll_event()
916 spin_lock_bh(&conn->psq_lock); in ath6kl_pspoll_event()
917 psq_empty = skb_queue_empty(&conn->psq) && (conn->mgmt_psq_len == 0); in ath6kl_pspoll_event()
918 spin_unlock_bh(&conn->psq_lock); in ath6kl_pspoll_event()
921 ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx, conn->aid, 0); in ath6kl_pspoll_event()
928 struct ath6kl *ar = vif->ar; in ath6kl_dtimexpiry_event()
939 if (!ar->sta_list_index) in ath6kl_dtimexpiry_event()
942 spin_lock_bh(&ar->mcastpsq_lock); in ath6kl_dtimexpiry_event()
943 mcastq_empty = skb_queue_empty(&ar->mcastpsq); in ath6kl_dtimexpiry_event()
944 spin_unlock_bh(&ar->mcastpsq_lock); in ath6kl_dtimexpiry_event()
950 set_bit(DTIM_EXPIRED, &vif->flags); in ath6kl_dtimexpiry_event()
952 spin_lock_bh(&ar->mcastpsq_lock); in ath6kl_dtimexpiry_event()
953 while ((skb = skb_dequeue(&ar->mcastpsq)) != NULL) { in ath6kl_dtimexpiry_event()
954 spin_unlock_bh(&ar->mcastpsq_lock); in ath6kl_dtimexpiry_event()
956 ath6kl_data_tx(skb, vif->ndev); in ath6kl_dtimexpiry_event()
958 spin_lock_bh(&ar->mcastpsq_lock); in ath6kl_dtimexpiry_event()
960 spin_unlock_bh(&ar->mcastpsq_lock); in ath6kl_dtimexpiry_event()
962 clear_bit(DTIM_EXPIRED, &vif->flags); in ath6kl_dtimexpiry_event()
965 ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx, MCAST_AID, 0); in ath6kl_dtimexpiry_event()
972 struct ath6kl *ar = vif->ar; in ath6kl_disconnect_event()
974 if (vif->nw_type == AP_NETWORK) { in ath6kl_disconnect_event()
978 ar->want_ch_switch |= 1 << vif->fw_vif_idx; in ath6kl_disconnect_event()
980 ar->last_ch = le16_to_cpu(vif->profile.ch); in ath6kl_disconnect_event()
985 cfg80211_conn_failed(vif->ndev, bssid, in ath6kl_disconnect_event()
992 cfg80211_conn_failed(vif->ndev, bssid, in ath6kl_disconnect_event()
1001 if (ar->sta_list_index == 0) { in ath6kl_disconnect_event()
1002 spin_lock_bh(&ar->mcastpsq_lock); in ath6kl_disconnect_event()
1003 skb_queue_purge(&ar->mcastpsq); in ath6kl_disconnect_event()
1004 spin_unlock_bh(&ar->mcastpsq_lock); in ath6kl_disconnect_event()
1007 if (test_bit(WMI_READY, &ar->flag)) in ath6kl_disconnect_event()
1008 ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_disconnect_event()
1014 cfg80211_del_sta(vif->ndev, bssid, GFP_KERNEL); in ath6kl_disconnect_event()
1017 if (memcmp(vif->ndev->dev_addr, bssid, ETH_ALEN) == 0) { in ath6kl_disconnect_event()
1018 memset(vif->wep_key_list, 0, sizeof(vif->wep_key_list)); in ath6kl_disconnect_event()
1019 clear_bit(CONNECTED, &vif->flags); in ath6kl_disconnect_event()
1028 aggr_reset_state(vif->aggr_cntxt->aggr_conn); in ath6kl_disconnect_event()
1030 del_timer(&vif->disconnect_timer); in ath6kl_disconnect_event()
1040 if (!ar->usr_bss_filter && test_bit(WMI_READY, &ar->flag)) in ath6kl_disconnect_event()
1041 ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_disconnect_event()
1044 set_bit(CONNECT_PEND, &vif->flags); in ath6kl_disconnect_event()
1048 (vif->reconnect_flag == 1))) { in ath6kl_disconnect_event()
1049 set_bit(CONNECTED, &vif->flags); in ath6kl_disconnect_event()
1055 ath6kl_check_ch_switch(ar, ar->last_ch); in ath6kl_disconnect_event()
1058 spin_lock_bh(&vif->if_lock); in ath6kl_disconnect_event()
1059 clear_bit(CONNECTED, &vif->flags); in ath6kl_disconnect_event()
1060 netif_carrier_off(vif->ndev); in ath6kl_disconnect_event()
1061 spin_unlock_bh(&vif->if_lock); in ath6kl_disconnect_event()
1063 if ((reason != CSERV_DISCONNECT) || (vif->reconnect_flag != 1)) in ath6kl_disconnect_event()
1064 vif->reconnect_flag = 0; in ath6kl_disconnect_event()
1067 ar->user_key_ctrl = 0; in ath6kl_disconnect_event()
1069 netif_stop_queue(vif->ndev); in ath6kl_disconnect_event()
1070 memset(vif->bssid, 0, sizeof(vif->bssid)); in ath6kl_disconnect_event()
1071 vif->bss_ch = 0; in ath6kl_disconnect_event()
1080 spin_lock_bh(&ar->list_lock); in ath6kl_vif_first()
1081 if (list_empty(&ar->vif_list)) { in ath6kl_vif_first()
1082 spin_unlock_bh(&ar->list_lock); in ath6kl_vif_first()
1086 vif = list_first_entry(&ar->vif_list, struct ath6kl_vif, list); in ath6kl_vif_first()
1088 spin_unlock_bh(&ar->list_lock); in ath6kl_vif_first()
1097 set_bit(WLAN_ENABLED, &vif->flags); in ath6kl_open()
1099 if (test_bit(CONNECTED, &vif->flags)) { in ath6kl_open()
1117 clear_bit(WLAN_ENABLED, &vif->flags); in ath6kl_close()
1126 struct ath6kl *ar = vif->ar; in ath6kl_set_features()
1130 (ar->rx_meta_ver != WMI_META_VERSION_2)) { in ath6kl_set_features()
1131 ar->rx_meta_ver = WMI_META_VERSION_2; in ath6kl_set_features()
1132 err = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi, in ath6kl_set_features()
1133 vif->fw_vif_idx, in ath6kl_set_features()
1134 ar->rx_meta_ver, 0, 0); in ath6kl_set_features()
1136 dev->features = features & ~NETIF_F_RXCSUM; in ath6kl_set_features()
1140 (ar->rx_meta_ver == WMI_META_VERSION_2)) { in ath6kl_set_features()
1141 ar->rx_meta_ver = 0; in ath6kl_set_features()
1142 err = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi, in ath6kl_set_features()
1143 vif->fw_vif_idx, in ath6kl_set_features()
1144 ar->rx_meta_ver, 0, 0); in ath6kl_set_features()
1146 dev->features = features | NETIF_F_RXCSUM; in ath6kl_set_features()
1165 if (!test_bit(WMI_READY, &vif->ar->flag) || in ath6kl_set_multicast_list()
1166 !test_bit(WLAN_ENABLED, &vif->flags)) in ath6kl_set_multicast_list()
1169 /* Enable multicast-all filter. */ in ath6kl_set_multicast_list()
1170 mc_all_on = !!(ndev->flags & IFF_PROMISC) || in ath6kl_set_multicast_list()
1171 !!(ndev->flags & IFF_ALLMULTI) || in ath6kl_set_multicast_list()
1175 set_bit(NETDEV_MCAST_ALL_ON, &vif->flags); in ath6kl_set_multicast_list()
1177 clear_bit(NETDEV_MCAST_ALL_ON, &vif->flags); in ath6kl_set_multicast_list()
1180 vif->ar->fw_capabilities)) { in ath6kl_set_multicast_list()
1181 mc_all_on = mc_all_on || (vif->ar->state == ATH6KL_STATE_ON); in ath6kl_set_multicast_list()
1184 if (!(ndev->flags & IFF_MULTICAST)) { in ath6kl_set_multicast_list()
1186 set_bit(NETDEV_MCAST_ALL_OFF, &vif->flags); in ath6kl_set_multicast_list()
1188 clear_bit(NETDEV_MCAST_ALL_OFF, &vif->flags); in ath6kl_set_multicast_list()
1191 /* Enable/disable "multicast-all" filter*/ in ath6kl_set_multicast_list()
1192 ath6kl_dbg(ATH6KL_DBG_TRC, "%s multicast-all filter\n", in ath6kl_set_multicast_list()
1195 ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi, vif->fw_vif_idx, in ath6kl_set_multicast_list()
1198 ath6kl_warn("Failed to %s multicast-all receive\n", in ath6kl_set_multicast_list()
1203 if (test_bit(NETDEV_MCAST_ALL_ON, &vif->flags)) in ath6kl_set_multicast_list()
1207 list_for_each_entry_safe(mc_filter, tmp, &vif->mc_filter, list) { in ath6kl_set_multicast_list()
1210 if (memcmp(ha->addr, mc_filter->hw_addr, in ath6kl_set_multicast_list()
1224 mc_filter->hw_addr); in ath6kl_set_multicast_list()
1225 ret = ath6kl_wmi_add_del_mcast_filter_cmd(vif->ar->wmi, in ath6kl_set_multicast_list()
1226 vif->fw_vif_idx, mc_filter->hw_addr, in ath6kl_set_multicast_list()
1230 mc_filter->hw_addr); in ath6kl_set_multicast_list()
1234 list_del(&mc_filter->list); in ath6kl_set_multicast_list()
1243 list_for_each_entry(mc_filter, &vif->mc_filter, list) { in ath6kl_set_multicast_list()
1244 if (memcmp(ha->addr, mc_filter->hw_addr, in ath6kl_set_multicast_list()
1259 memcpy(mc_filter->hw_addr, ha->addr, in ath6kl_set_multicast_list()
1264 mc_filter->hw_addr); in ath6kl_set_multicast_list()
1265 ret = ath6kl_wmi_add_del_mcast_filter_cmd(vif->ar->wmi, in ath6kl_set_multicast_list()
1266 vif->fw_vif_idx, mc_filter->hw_addr, in ath6kl_set_multicast_list()
1270 mc_filter->hw_addr); in ath6kl_set_multicast_list()
1275 list_add_tail(&mc_filter->list, &mc_filter_new); in ath6kl_set_multicast_list()
1280 list_splice_tail(&mc_filter_new, &vif->mc_filter); in ath6kl_set_multicast_list()
1295 dev->netdev_ops = &ath6kl_netdev_ops; in init_netdev()
1296 dev->needs_free_netdev = true; in init_netdev()
1297 dev->watchdog_timeo = ATH6KL_TX_TIMEOUT; in init_netdev()
1299 dev->needed_headroom = ETH_HLEN; in init_netdev()
1300 dev->needed_headroom += roundup(sizeof(struct ath6kl_llc_snap_hdr) + in init_netdev()
1307 ar->fw_capabilities)) in init_netdev()
1308 dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM; in init_netdev()