Lines Matching +full:- +full:39000
2 * Copyright (c) 2004-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2012 Qualcomm Atheros, Inc.
28 #include "hif-ops.h"
147 struct ath6kl *ar = vif->ar; in __ath6kl_cfg80211_sscan_stop()
149 if (!test_and_clear_bit(SCHED_SCANNING, &vif->flags)) in __ath6kl_cfg80211_sscan_stop()
152 del_timer_sync(&vif->sched_scan_timer); in __ath6kl_cfg80211_sscan_stop()
154 if (ar->state == ATH6KL_STATE_RECOVERY) in __ath6kl_cfg80211_sscan_stop()
157 ath6kl_wmi_enable_sched_scan_cmd(ar->wmi, vif->fw_vif_idx, false); in __ath6kl_cfg80211_sscan_stop()
164 struct ath6kl *ar = vif->ar; in ath6kl_cfg80211_sscan_disable()
172 cfg80211_sched_scan_stopped(ar->wiphy, 0); in ath6kl_cfg80211_sscan_disable()
181 vif->auth_mode = NONE_AUTH; in ath6kl_set_wpa_version()
183 vif->auth_mode = WPA2_AUTH; in ath6kl_set_wpa_version()
185 vif->auth_mode = WPA_AUTH; in ath6kl_set_wpa_version()
188 return -ENOTSUPP; in ath6kl_set_wpa_version()
201 vif->dot11_auth_mode = OPEN_AUTH; in ath6kl_set_auth_type()
204 vif->dot11_auth_mode = SHARED_AUTH; in ath6kl_set_auth_type()
207 vif->dot11_auth_mode = LEAP_AUTH; in ath6kl_set_auth_type()
211 vif->dot11_auth_mode = OPEN_AUTH | SHARED_AUTH; in ath6kl_set_auth_type()
216 return -ENOTSUPP; in ath6kl_set_auth_type()
224 u8 *ar_cipher = ucast ? &vif->prwise_crypto : &vif->grp_crypto; in ath6kl_set_cipher()
225 u8 *ar_cipher_len = ucast ? &vif->prwise_crypto_len : in ath6kl_set_cipher()
226 &vif->grp_crypto_len; in ath6kl_set_cipher()
259 return -ENOTSUPP; in ath6kl_set_cipher()
270 if (vif->auth_mode == WPA_AUTH) in ath6kl_set_key_mgmt()
271 vif->auth_mode = WPA_PSK_AUTH; in ath6kl_set_key_mgmt()
272 else if (vif->auth_mode == WPA2_AUTH) in ath6kl_set_key_mgmt()
273 vif->auth_mode = WPA2_PSK_AUTH; in ath6kl_set_key_mgmt()
275 if (vif->auth_mode == WPA_AUTH) in ath6kl_set_key_mgmt()
276 vif->auth_mode = WPA_AUTH_CCKM; in ath6kl_set_key_mgmt()
277 else if (vif->auth_mode == WPA2_AUTH) in ath6kl_set_key_mgmt()
278 vif->auth_mode = WPA2_AUTH_CCKM; in ath6kl_set_key_mgmt()
280 vif->auth_mode = NONE_AUTH; in ath6kl_set_key_mgmt()
286 struct ath6kl *ar = vif->ar; in ath6kl_cfg80211_ready()
288 if (!test_bit(WMI_READY, &ar->flag)) { in ath6kl_cfg80211_ready()
293 if (!test_bit(WLAN_ENABLED, &vif->flags)) { in ath6kl_cfg80211_ready()
324 struct ath6kl *ar = vif->ar; in ath6kl_set_assoc_req_ies()
334 ar->connect_ctrl_flags &= ~CONNECT_WPS_FLAG; in ath6kl_set_assoc_req_ies()
343 return -ENOMEM; in ath6kl_set_assoc_req_ies()
355 ar->connect_ctrl_flags |= CONNECT_WPS_FLAG; in ath6kl_set_assoc_req_ies()
361 ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_set_assoc_req_ies()
383 return -ENOTSUPP; in ath6kl_nliftype_to_drv_iftype()
397 if (ar->ibss_if_active || ((type == NL80211_IFTYPE_ADHOC) && in ath6kl_is_valid_iftype()
398 ar->num_vif)) in ath6kl_is_valid_iftype()
403 for (i = 0; i < ar->vif_max; i++) { in ath6kl_is_valid_iftype()
404 if ((ar->avail_idx_map) & BIT(i)) { in ath6kl_is_valid_iftype()
413 for (i = ar->max_norm_iface; i < ar->vif_max; i++) { in ath6kl_is_valid_iftype()
414 if ((ar->avail_idx_map) & BIT(i)) { in ath6kl_is_valid_iftype()
426 return ar->tx_pending[ath6kl_wmi_get_control_ep(ar->wmi)] == 0; in ath6kl_is_tx_pending()
434 if (WARN_ON(!test_bit(WMI_READY, &vif->ar->flag))) in ath6kl_cfg80211_sta_bmiss_enhance()
437 if (vif->nw_type != INFRA_NETWORK) in ath6kl_cfg80211_sta_bmiss_enhance()
441 vif->ar->fw_capabilities)) in ath6kl_cfg80211_sta_bmiss_enhance()
447 err = ath6kl_wmi_sta_bmiss_enhance_cmd(vif->ar->wmi, in ath6kl_cfg80211_sta_bmiss_enhance()
448 vif->fw_vif_idx, enable); in ath6kl_cfg80211_sta_bmiss_enhance()
460 u8 nw_subtype = (ar->p2p) ? SUBTYPE_P2PDEV : SUBTYPE_NONE; in ath6kl_cfg80211_connect()
465 vif->sme_state = SME_CONNECTING; in ath6kl_cfg80211_connect()
468 return -EIO; in ath6kl_cfg80211_connect()
470 if (test_bit(DESTROY_IN_PROGRESS, &ar->flag)) { in ath6kl_cfg80211_connect()
472 return -EBUSY; in ath6kl_cfg80211_connect()
475 if (test_bit(SKIP_SCAN, &ar->flag) && in ath6kl_cfg80211_connect()
476 ((sme->channel && sme->channel->center_freq == 0) || in ath6kl_cfg80211_connect()
477 (sme->bssid && is_zero_ether_addr(sme->bssid)))) { in ath6kl_cfg80211_connect()
479 return -EINVAL; in ath6kl_cfg80211_connect()
482 if (down_interruptible(&ar->sem)) { in ath6kl_cfg80211_connect()
484 return -ERESTARTSYS; in ath6kl_cfg80211_connect()
487 if (test_bit(DESTROY_IN_PROGRESS, &ar->flag)) { in ath6kl_cfg80211_connect()
489 up(&ar->sem); in ath6kl_cfg80211_connect()
490 return -EBUSY; in ath6kl_cfg80211_connect()
493 if (ar->tx_pending[ath6kl_wmi_get_control_ep(ar->wmi)]) { in ath6kl_cfg80211_connect()
497 wait_event_interruptible_timeout(ar->event_wq, in ath6kl_cfg80211_connect()
502 up(&ar->sem); in ath6kl_cfg80211_connect()
503 return -EINTR; in ath6kl_cfg80211_connect()
507 status = ath6kl_set_assoc_req_ies(vif, sme->ie, sme->ie_len); in ath6kl_cfg80211_connect()
509 up(&ar->sem); in ath6kl_cfg80211_connect()
513 if (sme->ie == NULL || sme->ie_len == 0) in ath6kl_cfg80211_connect()
514 ar->connect_ctrl_flags &= ~CONNECT_WPS_FLAG; in ath6kl_cfg80211_connect()
516 if (test_bit(CONNECTED, &vif->flags) && in ath6kl_cfg80211_connect()
517 vif->ssid_len == sme->ssid_len && in ath6kl_cfg80211_connect()
518 !memcmp(vif->ssid, sme->ssid, vif->ssid_len)) { in ath6kl_cfg80211_connect()
519 vif->reconnect_flag = true; in ath6kl_cfg80211_connect()
520 status = ath6kl_wmi_reconnect_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_connect()
521 vif->req_bssid, in ath6kl_cfg80211_connect()
522 vif->ch_hint); in ath6kl_cfg80211_connect()
524 up(&ar->sem); in ath6kl_cfg80211_connect()
527 return -EIO; in ath6kl_cfg80211_connect()
530 } else if (vif->ssid_len == sme->ssid_len && in ath6kl_cfg80211_connect()
531 !memcmp(vif->ssid, sme->ssid, vif->ssid_len)) { in ath6kl_cfg80211_connect()
535 memset(vif->ssid, 0, sizeof(vif->ssid)); in ath6kl_cfg80211_connect()
536 vif->ssid_len = sme->ssid_len; in ath6kl_cfg80211_connect()
537 memcpy(vif->ssid, sme->ssid, sme->ssid_len); in ath6kl_cfg80211_connect()
539 if (sme->channel) in ath6kl_cfg80211_connect()
540 vif->ch_hint = sme->channel->center_freq; in ath6kl_cfg80211_connect()
542 memset(vif->req_bssid, 0, sizeof(vif->req_bssid)); in ath6kl_cfg80211_connect()
543 if (sme->bssid && !is_broadcast_ether_addr(sme->bssid)) in ath6kl_cfg80211_connect()
544 memcpy(vif->req_bssid, sme->bssid, sizeof(vif->req_bssid)); in ath6kl_cfg80211_connect()
546 ath6kl_set_wpa_version(vif, sme->crypto.wpa_versions); in ath6kl_cfg80211_connect()
548 status = ath6kl_set_auth_type(vif, sme->auth_type); in ath6kl_cfg80211_connect()
550 up(&ar->sem); in ath6kl_cfg80211_connect()
554 if (sme->crypto.n_ciphers_pairwise) in ath6kl_cfg80211_connect()
555 ath6kl_set_cipher(vif, sme->crypto.ciphers_pairwise[0], true); in ath6kl_cfg80211_connect()
559 ath6kl_set_cipher(vif, sme->crypto.cipher_group, false); in ath6kl_cfg80211_connect()
561 if (sme->crypto.n_akm_suites) in ath6kl_cfg80211_connect()
562 ath6kl_set_key_mgmt(vif, sme->crypto.akm_suites[0]); in ath6kl_cfg80211_connect()
564 if ((sme->key_len) && in ath6kl_cfg80211_connect()
565 (vif->auth_mode == NONE_AUTH) && in ath6kl_cfg80211_connect()
566 (vif->prwise_crypto == WEP_CRYPT)) { in ath6kl_cfg80211_connect()
569 if (sme->key_idx > WMI_MAX_KEY_INDEX) { in ath6kl_cfg80211_connect()
571 sme->key_idx); in ath6kl_cfg80211_connect()
572 up(&ar->sem); in ath6kl_cfg80211_connect()
573 return -ENOENT; in ath6kl_cfg80211_connect()
576 key = &vif->keys[sme->key_idx]; in ath6kl_cfg80211_connect()
577 key->key_len = sme->key_len; in ath6kl_cfg80211_connect()
578 memcpy(key->key, sme->key, key->key_len); in ath6kl_cfg80211_connect()
579 key->cipher = vif->prwise_crypto; in ath6kl_cfg80211_connect()
580 vif->def_txkey_index = sme->key_idx; in ath6kl_cfg80211_connect()
582 ath6kl_wmi_addkey_cmd(ar->wmi, vif->fw_vif_idx, sme->key_idx, in ath6kl_cfg80211_connect()
583 vif->prwise_crypto, in ath6kl_cfg80211_connect()
585 key->key_len, in ath6kl_cfg80211_connect()
587 key->key, KEY_OP_INIT_VAL, NULL, in ath6kl_cfg80211_connect()
591 if (!ar->usr_bss_filter) { in ath6kl_cfg80211_connect()
592 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags); in ath6kl_cfg80211_connect()
593 if (ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_connect()
596 up(&ar->sem); in ath6kl_cfg80211_connect()
597 return -EIO; in ath6kl_cfg80211_connect()
601 vif->nw_type = vif->next_mode; in ath6kl_cfg80211_connect()
606 if (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) in ath6kl_cfg80211_connect()
614 vif->auth_mode, vif->dot11_auth_mode, vif->prwise_crypto, in ath6kl_cfg80211_connect()
615 vif->prwise_crypto_len, vif->grp_crypto, in ath6kl_cfg80211_connect()
616 vif->grp_crypto_len, vif->ch_hint); in ath6kl_cfg80211_connect()
618 vif->reconnect_flag = 0; in ath6kl_cfg80211_connect()
620 if (vif->nw_type == INFRA_NETWORK) { in ath6kl_cfg80211_connect()
621 interval = max_t(u16, vif->listen_intvl_t, in ath6kl_cfg80211_connect()
623 status = ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_connect()
628 up(&ar->sem); in ath6kl_cfg80211_connect()
633 status = ath6kl_wmi_connect_cmd(ar->wmi, vif->fw_vif_idx, vif->nw_type, in ath6kl_cfg80211_connect()
634 vif->dot11_auth_mode, vif->auth_mode, in ath6kl_cfg80211_connect()
635 vif->prwise_crypto, in ath6kl_cfg80211_connect()
636 vif->prwise_crypto_len, in ath6kl_cfg80211_connect()
637 vif->grp_crypto, vif->grp_crypto_len, in ath6kl_cfg80211_connect()
638 vif->ssid_len, vif->ssid, in ath6kl_cfg80211_connect()
639 vif->req_bssid, vif->ch_hint, in ath6kl_cfg80211_connect()
640 ar->connect_ctrl_flags, nw_subtype); in ath6kl_cfg80211_connect()
642 if (sme->bg_scan_period == 0) { in ath6kl_cfg80211_connect()
644 sme->bg_scan_period = 0xffff; in ath6kl_cfg80211_connect()
645 } else if (sme->bg_scan_period == -1) { in ath6kl_cfg80211_connect()
647 sme->bg_scan_period = DEFAULT_BG_SCAN_PERIOD; in ath6kl_cfg80211_connect()
650 ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, 0, 0, in ath6kl_cfg80211_connect()
651 sme->bg_scan_period, 0, 0, 0, 3, 0, 0, 0); in ath6kl_cfg80211_connect()
653 up(&ar->sem); in ath6kl_cfg80211_connect()
655 if (status == -EINVAL) { in ath6kl_cfg80211_connect()
656 memset(vif->ssid, 0, sizeof(vif->ssid)); in ath6kl_cfg80211_connect()
657 vif->ssid_len = 0; in ath6kl_cfg80211_connect()
659 return -ENOENT; in ath6kl_cfg80211_connect()
662 return -EIO; in ath6kl_cfg80211_connect()
665 if ((!(ar->connect_ctrl_flags & CONNECT_DO_WPA_OFFLOAD)) && in ath6kl_cfg80211_connect()
666 ((vif->auth_mode == WPA_PSK_AUTH) || in ath6kl_cfg80211_connect()
667 (vif->auth_mode == WPA2_PSK_AUTH))) { in ath6kl_cfg80211_connect()
668 mod_timer(&vif->disconnect_timer, in ath6kl_cfg80211_connect()
672 ar->connect_ctrl_flags &= ~CONNECT_DO_WPA_OFFLOAD; in ath6kl_cfg80211_connect()
673 set_bit(CONNECT_PEND, &vif->flags); in ath6kl_cfg80211_connect()
686 struct ath6kl *ar = vif->ar; in ath6kl_add_bss_if_needed()
700 bss = cfg80211_get_bss(ar->wiphy, chan, bssid, in ath6kl_add_bss_if_needed()
701 vif->ssid, vif->ssid_len, in ath6kl_add_bss_if_needed()
712 ie = kmalloc(2 + vif->ssid_len + beacon_ie_len, GFP_KERNEL); in ath6kl_add_bss_if_needed()
716 ie[1] = vif->ssid_len; in ath6kl_add_bss_if_needed()
717 memcpy(ie + 2, vif->ssid, vif->ssid_len); in ath6kl_add_bss_if_needed()
718 memcpy(ie + 2 + vif->ssid_len, beacon_ie, beacon_ie_len); in ath6kl_add_bss_if_needed()
719 bss = cfg80211_inform_bss(ar->wiphy, chan, in ath6kl_add_bss_if_needed()
722 ie, 2 + vif->ssid_len + beacon_ie_len, in ath6kl_add_bss_if_needed()
743 struct ath6kl *ar = vif->ar; in ath6kl_cfg80211_connect_event()
756 assoc_req_len -= assoc_req_ie_offset; in ath6kl_cfg80211_connect_event()
757 assoc_resp_len -= assoc_resp_ie_offset; in ath6kl_cfg80211_connect_event()
763 vif->assoc_bss_beacon_int = beacon_intvl; in ath6kl_cfg80211_connect_event()
764 clear_bit(DTIM_PERIOD_AVAIL, &vif->flags); in ath6kl_cfg80211_connect_event()
767 if (vif->wdev.iftype != NL80211_IFTYPE_ADHOC) { in ath6kl_cfg80211_connect_event()
775 if (vif->wdev.iftype != NL80211_IFTYPE_STATION && in ath6kl_cfg80211_connect_event()
776 vif->wdev.iftype != NL80211_IFTYPE_P2P_CLIENT) { in ath6kl_cfg80211_connect_event()
783 chan = ieee80211_get_channel(ar->wiphy, (int) channel); in ath6kl_cfg80211_connect_event()
793 ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "ad-hoc %s selected\n", in ath6kl_cfg80211_connect_event()
795 cfg80211_ibss_joined(vif->ndev, bssid, chan, GFP_KERNEL); in ath6kl_cfg80211_connect_event()
796 cfg80211_put_bss(ar->wiphy, bss); in ath6kl_cfg80211_connect_event()
800 if (vif->sme_state == SME_CONNECTING) { in ath6kl_cfg80211_connect_event()
802 vif->sme_state = SME_CONNECTED; in ath6kl_cfg80211_connect_event()
803 cfg80211_connect_result(vif->ndev, bssid, in ath6kl_cfg80211_connect_event()
807 cfg80211_put_bss(ar->wiphy, bss); in ath6kl_cfg80211_connect_event()
808 } else if (vif->sme_state == SME_CONNECTED) { in ath6kl_cfg80211_connect_event()
817 cfg80211_roamed(vif->ndev, &roam_info, GFP_KERNEL); in ath6kl_cfg80211_connect_event()
833 return -EIO; in ath6kl_cfg80211_disconnect()
835 if (test_bit(DESTROY_IN_PROGRESS, &ar->flag)) { in ath6kl_cfg80211_disconnect()
837 return -EBUSY; in ath6kl_cfg80211_disconnect()
840 if (down_interruptible(&ar->sem)) { in ath6kl_cfg80211_disconnect()
842 return -ERESTARTSYS; in ath6kl_cfg80211_disconnect()
845 vif->reconnect_flag = 0; in ath6kl_cfg80211_disconnect()
847 memset(vif->ssid, 0, sizeof(vif->ssid)); in ath6kl_cfg80211_disconnect()
848 vif->ssid_len = 0; in ath6kl_cfg80211_disconnect()
850 if (!test_bit(SKIP_SCAN, &ar->flag)) in ath6kl_cfg80211_disconnect()
851 memset(vif->req_bssid, 0, sizeof(vif->req_bssid)); in ath6kl_cfg80211_disconnect()
853 up(&ar->sem); in ath6kl_cfg80211_disconnect()
862 struct ath6kl *ar = vif->ar; in ath6kl_cfg80211_disconnect_event()
864 if (vif->scan_req) { in ath6kl_cfg80211_disconnect_event()
869 cfg80211_scan_done(vif->scan_req, &info); in ath6kl_cfg80211_disconnect_event()
870 vif->scan_req = NULL; in ath6kl_cfg80211_disconnect_event()
873 if (vif->nw_type & ADHOC_NETWORK) { in ath6kl_cfg80211_disconnect_event()
874 if (vif->wdev.iftype != NL80211_IFTYPE_ADHOC) in ath6kl_cfg80211_disconnect_event()
880 if (vif->nw_type & INFRA_NETWORK) { in ath6kl_cfg80211_disconnect_event()
881 if (vif->wdev.iftype != NL80211_IFTYPE_STATION && in ath6kl_cfg80211_disconnect_event()
882 vif->wdev.iftype != NL80211_IFTYPE_P2P_CLIENT) { in ath6kl_cfg80211_disconnect_event()
889 clear_bit(CONNECT_PEND, &vif->flags); in ath6kl_cfg80211_disconnect_event()
891 if (vif->sme_state == SME_CONNECTING) { in ath6kl_cfg80211_disconnect_event()
892 cfg80211_connect_result(vif->ndev, in ath6kl_cfg80211_disconnect_event()
897 } else if (vif->sme_state == SME_CONNECTED) { in ath6kl_cfg80211_disconnect_event()
898 cfg80211_disconnected(vif->ndev, proto_reason, in ath6kl_cfg80211_disconnect_event()
902 vif->sme_state = SME_DISCONNECTED; in ath6kl_cfg80211_disconnect_event()
906 * received with reason code other than 3 (DISCONNECT_CMD - disconnect in ath6kl_cfg80211_disconnect_event()
913 ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx); in ath6kl_cfg80211_disconnect_event()
929 return -EINVAL; in ath6kl_set_probed_ssids()
942 if (ar->wiphy->max_match_sets != 0 && n_match_ssid == 0) in ath6kl_set_probed_ssids()
979 ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i, in ath6kl_set_probed_ssids()
987 ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i, in ath6kl_set_probed_ssids()
997 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(request->wdev); in ath6kl_cfg80211_scan()
998 struct ath6kl *ar = ath6kl_priv(vif->ndev); in ath6kl_cfg80211_scan()
1005 return -EIO; in ath6kl_cfg80211_scan()
1009 if (!ar->usr_bss_filter) { in ath6kl_cfg80211_scan()
1010 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags); in ath6kl_cfg80211_scan()
1011 ret = ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_scan()
1019 ret = ath6kl_set_probed_ssids(ar, vif, request->ssids, in ath6kl_cfg80211_scan()
1020 request->n_ssids, NULL, 0); in ath6kl_cfg80211_scan()
1025 ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_scan()
1027 request->ie, request->ie_len); in ath6kl_cfg80211_scan()
1038 if (request->n_channels > 0 && in ath6kl_cfg80211_scan()
1039 request->n_channels <= WMI_MAX_CHANNELS) { in ath6kl_cfg80211_scan()
1042 n_channels = request->n_channels; in ath6kl_cfg80211_scan()
1051 channels[i] = request->channels[i]->center_freq; in ath6kl_cfg80211_scan()
1054 if (test_bit(CONNECTED, &vif->flags)) in ath6kl_cfg80211_scan()
1057 vif->scan_req = request; in ath6kl_cfg80211_scan()
1059 ret = ath6kl_wmi_beginscan_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_scan()
1064 request->no_cck, in ath6kl_cfg80211_scan()
1065 request->rates); in ath6kl_cfg80211_scan()
1068 vif->scan_req = NULL; in ath6kl_cfg80211_scan()
1078 struct ath6kl *ar = vif->ar; in ath6kl_cfg80211_scan_complete_event()
1087 if (!vif->scan_req) in ath6kl_cfg80211_scan_complete_event()
1093 if (vif->scan_req->n_ssids && vif->scan_req->ssids[0].ssid_len) { in ath6kl_cfg80211_scan_complete_event()
1094 for (i = 0; i < vif->scan_req->n_ssids; i++) { in ath6kl_cfg80211_scan_complete_event()
1095 ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_scan_complete_event()
1102 cfg80211_scan_done(vif->scan_req, &info); in ath6kl_cfg80211_scan_complete_event()
1103 vif->scan_req = NULL; in ath6kl_cfg80211_scan_complete_event()
1113 vif->nw_type, freq, mode); in ath6kl_cfg80211_ch_switch_notify()
1116 ieee80211_get_channel(vif->ar->wiphy, freq), in ath6kl_cfg80211_ch_switch_notify()
1121 mutex_lock(&vif->wdev.mtx); in ath6kl_cfg80211_ch_switch_notify()
1122 cfg80211_ch_switch_notify(vif->ndev, &chandef, 0, 0); in ath6kl_cfg80211_ch_switch_notify()
1123 mutex_unlock(&vif->wdev.mtx); in ath6kl_cfg80211_ch_switch_notify()
1139 return -EIO; in ath6kl_cfg80211_add_key()
1141 if (params->cipher == CCKM_KRK_CIPHER_SUITE) { in ath6kl_cfg80211_add_key()
1142 if (params->key_len != WMI_KRK_LEN) in ath6kl_cfg80211_add_key()
1143 return -EINVAL; in ath6kl_cfg80211_add_key()
1144 return ath6kl_wmi_add_krk_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_add_key()
1145 params->key); in ath6kl_cfg80211_add_key()
1152 return -ENOENT; in ath6kl_cfg80211_add_key()
1155 key = &vif->keys[key_index]; in ath6kl_cfg80211_add_key()
1163 seq_len = params->seq_len; in ath6kl_cfg80211_add_key()
1164 if (params->cipher == WLAN_CIPHER_SUITE_SMS4 && in ath6kl_cfg80211_add_key()
1169 if (params->key_len > WLAN_MAX_KEY_LEN || in ath6kl_cfg80211_add_key()
1170 seq_len > sizeof(key->seq)) in ath6kl_cfg80211_add_key()
1171 return -EINVAL; in ath6kl_cfg80211_add_key()
1173 key->key_len = params->key_len; in ath6kl_cfg80211_add_key()
1174 memcpy(key->key, params->key, key->key_len); in ath6kl_cfg80211_add_key()
1175 key->seq_len = seq_len; in ath6kl_cfg80211_add_key()
1176 memcpy(key->seq, params->seq, key->seq_len); in ath6kl_cfg80211_add_key()
1177 key->cipher = params->cipher; in ath6kl_cfg80211_add_key()
1179 switch (key->cipher) { in ath6kl_cfg80211_add_key()
1197 return -ENOTSUPP; in ath6kl_cfg80211_add_key()
1200 if (((vif->auth_mode == WPA_PSK_AUTH) || in ath6kl_cfg80211_add_key()
1201 (vif->auth_mode == WPA2_PSK_AUTH)) && in ath6kl_cfg80211_add_key()
1203 del_timer(&vif->disconnect_timer); in ath6kl_cfg80211_add_key()
1207 __func__, key_index, key->key_len, key_type, in ath6kl_cfg80211_add_key()
1208 key_usage, key->seq_len); in ath6kl_cfg80211_add_key()
1210 if (vif->nw_type == AP_NETWORK && !pairwise && in ath6kl_cfg80211_add_key()
1213 ar->ap_mode_bkey.valid = true; in ath6kl_cfg80211_add_key()
1214 ar->ap_mode_bkey.key_index = key_index; in ath6kl_cfg80211_add_key()
1215 ar->ap_mode_bkey.key_type = key_type; in ath6kl_cfg80211_add_key()
1216 ar->ap_mode_bkey.key_len = key->key_len; in ath6kl_cfg80211_add_key()
1217 memcpy(ar->ap_mode_bkey.key, key->key, key->key_len); in ath6kl_cfg80211_add_key()
1218 if (!test_bit(CONNECTED, &vif->flags)) { in ath6kl_cfg80211_add_key()
1229 if (vif->next_mode == AP_NETWORK && key_type == WEP_CRYPT && in ath6kl_cfg80211_add_key()
1230 !test_bit(CONNECTED, &vif->flags)) { in ath6kl_cfg80211_add_key()
1232 * Store the key locally so that it can be re-configured after in ath6kl_cfg80211_add_key()
1238 vif->wep_key_list[key_index].key_len = key->key_len; in ath6kl_cfg80211_add_key()
1239 memcpy(vif->wep_key_list[key_index].key, key->key, in ath6kl_cfg80211_add_key()
1240 key->key_len); in ath6kl_cfg80211_add_key()
1244 return ath6kl_wmi_addkey_cmd(ar->wmi, vif->fw_vif_idx, key_index, in ath6kl_cfg80211_add_key()
1245 key_type, key_usage, key->key_len, in ath6kl_cfg80211_add_key()
1246 key->seq, key->seq_len, key->key, in ath6kl_cfg80211_add_key()
1261 return -EIO; in ath6kl_cfg80211_del_key()
1267 return -ENOENT; in ath6kl_cfg80211_del_key()
1270 if (!vif->keys[key_index].key_len) { in ath6kl_cfg80211_del_key()
1276 vif->keys[key_index].key_len = 0; in ath6kl_cfg80211_del_key()
1278 return ath6kl_wmi_deletekey_cmd(ar->wmi, vif->fw_vif_idx, key_index); in ath6kl_cfg80211_del_key()
1294 return -EIO; in ath6kl_cfg80211_get_key()
1300 return -ENOENT; in ath6kl_cfg80211_get_key()
1303 key = &vif->keys[key_index]; in ath6kl_cfg80211_get_key()
1305 params.cipher = key->cipher; in ath6kl_cfg80211_get_key()
1306 params.key_len = key->key_len; in ath6kl_cfg80211_get_key()
1307 params.seq_len = key->seq_len; in ath6kl_cfg80211_get_key()
1308 params.seq = key->seq; in ath6kl_cfg80211_get_key()
1309 params.key = key->key; in ath6kl_cfg80211_get_key()
1313 return key->key_len ? 0 : -ENOENT; in ath6kl_cfg80211_get_key()
1330 return -EIO; in ath6kl_cfg80211_set_default_key()
1336 return -ENOENT; in ath6kl_cfg80211_set_default_key()
1339 if (!vif->keys[key_index].key_len) { in ath6kl_cfg80211_set_default_key()
1342 return -EINVAL; in ath6kl_cfg80211_set_default_key()
1345 vif->def_txkey_index = key_index; in ath6kl_cfg80211_set_default_key()
1346 key = &vif->keys[vif->def_txkey_index]; in ath6kl_cfg80211_set_default_key()
1348 if (vif->prwise_crypto == WEP_CRYPT) in ath6kl_cfg80211_set_default_key()
1351 key_type = vif->prwise_crypto; in ath6kl_cfg80211_set_default_key()
1353 key_type = vif->grp_crypto; in ath6kl_cfg80211_set_default_key()
1355 if (vif->next_mode == AP_NETWORK && !test_bit(CONNECTED, &vif->flags)) in ath6kl_cfg80211_set_default_key()
1358 return ath6kl_wmi_addkey_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_set_default_key()
1359 vif->def_txkey_index, in ath6kl_cfg80211_set_default_key()
1361 key->key_len, key->seq, key->seq_len, in ath6kl_cfg80211_set_default_key()
1362 key->key, in ath6kl_cfg80211_set_default_key()
1373 cfg80211_michael_mic_failure(vif->ndev, vif->bssid, in ath6kl_cfg80211_tkip_micerr_event()
1390 return -EIO; in ath6kl_cfg80211_set_wiphy_params()
1393 return -EIO; in ath6kl_cfg80211_set_wiphy_params()
1396 ret = ath6kl_wmi_set_rts_cmd(ar->wmi, wiphy->rts_threshold); in ath6kl_cfg80211_set_wiphy_params()
1399 return -EIO; in ath6kl_cfg80211_set_wiphy_params()
1420 return -EIO; in ath6kl_cfg80211_set_txpower()
1423 return -EIO; in ath6kl_cfg80211_set_txpower()
1429 ar->tx_pwr = dbm; in ath6kl_cfg80211_set_txpower()
1434 return -EOPNOTSUPP; in ath6kl_cfg80211_set_txpower()
1437 ath6kl_wmi_set_tx_pwr_cmd(ar->wmi, vif->fw_vif_idx, dbm); in ath6kl_cfg80211_set_txpower()
1451 return -EIO; in ath6kl_cfg80211_get_txpower()
1454 return -EIO; in ath6kl_cfg80211_get_txpower()
1456 if (test_bit(CONNECTED, &vif->flags)) { in ath6kl_cfg80211_get_txpower()
1457 ar->tx_pwr = 255; in ath6kl_cfg80211_get_txpower()
1459 if (ath6kl_wmi_get_tx_pwr_cmd(ar->wmi, vif->fw_vif_idx) != 0) { in ath6kl_cfg80211_get_txpower()
1461 return -EIO; in ath6kl_cfg80211_get_txpower()
1464 wait_event_interruptible_timeout(ar->event_wq, ar->tx_pwr != 255, in ath6kl_cfg80211_get_txpower()
1469 return -EINTR; in ath6kl_cfg80211_get_txpower()
1473 *dbm = ar->tx_pwr; in ath6kl_cfg80211_get_txpower()
1489 return -EIO; in ath6kl_cfg80211_set_power_mgmt()
1499 if (ath6kl_wmi_powermode_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_set_power_mgmt()
1502 return -EIO; in ath6kl_cfg80211_set_power_mgmt()
1518 if (ar->num_vif == ar->vif_max) { in ath6kl_cfg80211_add_iface()
1520 return ERR_PTR(-EINVAL); in ath6kl_cfg80211_add_iface()
1525 return ERR_PTR(-EINVAL); in ath6kl_cfg80211_add_iface()
1530 return ERR_PTR(-ENOMEM); in ath6kl_cfg80211_add_iface()
1532 ar->num_vif++; in ath6kl_cfg80211_add_iface()
1541 struct ath6kl_vif *vif = netdev_priv(wdev->netdev); in ath6kl_cfg80211_del_iface()
1543 spin_lock_bh(&ar->list_lock); in ath6kl_cfg80211_del_iface()
1544 list_del(&vif->list); in ath6kl_cfg80211_del_iface()
1545 spin_unlock_bh(&ar->list_lock); in ath6kl_cfg80211_del_iface()
1547 ath6kl_cfg80211_vif_stop(vif, test_bit(WMI_READY, &ar->flag)); in ath6kl_cfg80211_del_iface()
1569 * dynamically between non-p2p and p2p type interface. in ath6kl_cfg80211_change_iface()
1572 vif->ar->fw_capabilities) && in ath6kl_cfg80211_change_iface()
1575 if (vif->ar->vif_max == 1) { in ath6kl_cfg80211_change_iface()
1576 if (vif->fw_vif_idx != 0) in ath6kl_cfg80211_change_iface()
1577 return -EINVAL; in ath6kl_cfg80211_change_iface()
1582 for (i = vif->ar->max_norm_iface; i < vif->ar->vif_max; i++) { in ath6kl_cfg80211_change_iface()
1583 if (i == vif->fw_vif_idx) in ath6kl_cfg80211_change_iface()
1587 if (i == vif->ar->vif_max) { in ath6kl_cfg80211_change_iface()
1589 return -EINVAL; in ath6kl_cfg80211_change_iface()
1600 vif->next_mode = INFRA_NETWORK; in ath6kl_cfg80211_change_iface()
1603 vif->next_mode = ADHOC_NETWORK; in ath6kl_cfg80211_change_iface()
1607 vif->next_mode = AP_NETWORK; in ath6kl_cfg80211_change_iface()
1611 return -EOPNOTSUPP; in ath6kl_cfg80211_change_iface()
1614 vif->wdev.iftype = type; in ath6kl_cfg80211_change_iface()
1628 return -EIO; in ath6kl_cfg80211_join_ibss()
1630 vif->ssid_len = ibss_param->ssid_len; in ath6kl_cfg80211_join_ibss()
1631 memcpy(vif->ssid, ibss_param->ssid, vif->ssid_len); in ath6kl_cfg80211_join_ibss()
1633 if (ibss_param->chandef.chan) in ath6kl_cfg80211_join_ibss()
1634 vif->ch_hint = ibss_param->chandef.chan->center_freq; in ath6kl_cfg80211_join_ibss()
1636 if (ibss_param->channel_fixed) { in ath6kl_cfg80211_join_ibss()
1643 return -EOPNOTSUPP; in ath6kl_cfg80211_join_ibss()
1646 memset(vif->req_bssid, 0, sizeof(vif->req_bssid)); in ath6kl_cfg80211_join_ibss()
1647 if (ibss_param->bssid && !is_broadcast_ether_addr(ibss_param->bssid)) in ath6kl_cfg80211_join_ibss()
1648 memcpy(vif->req_bssid, ibss_param->bssid, in ath6kl_cfg80211_join_ibss()
1649 sizeof(vif->req_bssid)); in ath6kl_cfg80211_join_ibss()
1657 if (ibss_param->privacy) { in ath6kl_cfg80211_join_ibss()
1665 vif->nw_type = vif->next_mode; in ath6kl_cfg80211_join_ibss()
1672 vif->auth_mode, vif->dot11_auth_mode, vif->prwise_crypto, in ath6kl_cfg80211_join_ibss()
1673 vif->prwise_crypto_len, vif->grp_crypto, in ath6kl_cfg80211_join_ibss()
1674 vif->grp_crypto_len, vif->ch_hint); in ath6kl_cfg80211_join_ibss()
1676 status = ath6kl_wmi_connect_cmd(ar->wmi, vif->fw_vif_idx, vif->nw_type, in ath6kl_cfg80211_join_ibss()
1677 vif->dot11_auth_mode, vif->auth_mode, in ath6kl_cfg80211_join_ibss()
1678 vif->prwise_crypto, in ath6kl_cfg80211_join_ibss()
1679 vif->prwise_crypto_len, in ath6kl_cfg80211_join_ibss()
1680 vif->grp_crypto, vif->grp_crypto_len, in ath6kl_cfg80211_join_ibss()
1681 vif->ssid_len, vif->ssid, in ath6kl_cfg80211_join_ibss()
1682 vif->req_bssid, vif->ch_hint, in ath6kl_cfg80211_join_ibss()
1683 ar->connect_ctrl_flags, SUBTYPE_NONE); in ath6kl_cfg80211_join_ibss()
1684 set_bit(CONNECT_PEND, &vif->flags); in ath6kl_cfg80211_join_ibss()
1695 return -EIO; in ath6kl_cfg80211_leave_ibss()
1698 memset(vif->ssid, 0, sizeof(vif->ssid)); in ath6kl_cfg80211_leave_ibss()
1699 vif->ssid_len = 0; in ath6kl_cfg80211_leave_ibss()
1730 static const s32 ht20[] = { 6500, 13000, 19500, 26000, 39000, in is_rate_ht20()
1737 if (i == ARRAY_SIZE(ht20) - 1) in is_rate_ht20()
1760 if (i == ARRAY_SIZE(ht40) - 1) in is_rate_ht40()
1785 if (memcmp(mac, vif->bssid, ETH_ALEN) != 0) in ath6kl_get_station()
1786 return -ENOENT; in ath6kl_get_station()
1788 if (down_interruptible(&ar->sem)) in ath6kl_get_station()
1789 return -EBUSY; in ath6kl_get_station()
1791 set_bit(STATS_UPDATE_PEND, &vif->flags); in ath6kl_get_station()
1793 ret = ath6kl_wmi_get_stats_cmd(ar->wmi, vif->fw_vif_idx); in ath6kl_get_station()
1796 up(&ar->sem); in ath6kl_get_station()
1797 return -EIO; in ath6kl_get_station()
1800 left = wait_event_interruptible_timeout(ar->event_wq, in ath6kl_get_station()
1802 &vif->flags), in ath6kl_get_station()
1805 up(&ar->sem); in ath6kl_get_station()
1808 return -ETIMEDOUT; in ath6kl_get_station()
1812 if (vif->target_stats.rx_byte) { in ath6kl_get_station()
1813 sinfo->rx_bytes = vif->target_stats.rx_byte; in ath6kl_get_station()
1814 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64); in ath6kl_get_station()
1815 sinfo->rx_packets = vif->target_stats.rx_pkt; in ath6kl_get_station()
1816 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); in ath6kl_get_station()
1819 if (vif->target_stats.tx_byte) { in ath6kl_get_station()
1820 sinfo->tx_bytes = vif->target_stats.tx_byte; in ath6kl_get_station()
1821 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); in ath6kl_get_station()
1822 sinfo->tx_packets = vif->target_stats.tx_pkt; in ath6kl_get_station()
1823 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); in ath6kl_get_station()
1826 sinfo->signal = vif->target_stats.cs_rssi; in ath6kl_get_station()
1827 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in ath6kl_get_station()
1829 rate = vif->target_stats.tx_ucast_rate; in ath6kl_get_station()
1832 sinfo->txrate.legacy = rate / 100; in ath6kl_get_station()
1835 sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; in ath6kl_get_station()
1836 sinfo->txrate.mcs = mcs - 1; in ath6kl_get_station()
1838 sinfo->txrate.mcs = mcs; in ath6kl_get_station()
1841 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; in ath6kl_get_station()
1842 sinfo->txrate.bw = RATE_INFO_BW_20; in ath6kl_get_station()
1845 sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; in ath6kl_get_station()
1846 sinfo->txrate.mcs = mcs - 1; in ath6kl_get_station()
1848 sinfo->txrate.mcs = mcs; in ath6kl_get_station()
1851 sinfo->txrate.bw = RATE_INFO_BW_40; in ath6kl_get_station()
1852 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; in ath6kl_get_station()
1860 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath6kl_get_station()
1862 if (test_bit(CONNECTED, &vif->flags) && in ath6kl_get_station()
1863 test_bit(DTIM_PERIOD_AVAIL, &vif->flags) && in ath6kl_get_station()
1864 vif->nw_type == INFRA_NETWORK) { in ath6kl_get_station()
1865 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); in ath6kl_get_station()
1866 sinfo->bss_param.flags = 0; in ath6kl_get_station()
1867 sinfo->bss_param.dtim_period = vif->assoc_bss_dtim_period; in ath6kl_get_station()
1868 sinfo->bss_param.beacon_interval = vif->assoc_bss_beacon_int; in ath6kl_get_station()
1880 return ath6kl_wmi_setpmkid_cmd(ar->wmi, vif->fw_vif_idx, pmksa->bssid, in ath6kl_set_pmksa()
1881 pmksa->pmkid, true); in ath6kl_set_pmksa()
1890 return ath6kl_wmi_setpmkid_cmd(ar->wmi, vif->fw_vif_idx, pmksa->bssid, in ath6kl_del_pmksa()
1891 pmksa->pmkid, false); in ath6kl_del_pmksa()
1899 if (test_bit(CONNECTED, &vif->flags)) in ath6kl_flush_pmksa()
1900 return ath6kl_wmi_setpmkid_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_flush_pmksa()
1901 vif->bssid, NULL, false); in ath6kl_flush_pmksa()
1913 for (i = 0; i < wow->n_patterns; i++) { in ath6kl_wow_usr()
1923 for (pos = 0; pos < wow->patterns[i].pattern_len; pos++) { in ath6kl_wow_usr()
1924 if (wow->patterns[i].mask[pos / 8] & (0x1 << (pos % 8))) in ath6kl_wow_usr()
1933 ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, in ath6kl_wow_usr()
1934 vif->fw_vif_idx, WOW_LIST_ID, in ath6kl_wow_usr()
1935 wow->patterns[i].pattern_len, in ath6kl_wow_usr()
1937 wow->patterns[i].pattern, mask); in ath6kl_wow_usr()
1942 if (wow->disconnect) in ath6kl_wow_usr()
1945 if (wow->magic_pkt) in ath6kl_wow_usr()
1948 if (wow->gtk_rekey_failure) in ath6kl_wow_usr()
1951 if (wow->eap_identity_req) in ath6kl_wow_usr()
1954 if (wow->four_way_handshake) in ath6kl_wow_usr()
1992 /* Setup unicast IP, EAPOL-like and ARP pkt pattern */ in ath6kl_wow_ap()
1993 ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, in ath6kl_wow_ap()
1994 vif->fw_vif_idx, WOW_LIST_ID, in ath6kl_wow_ap()
2003 ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, in ath6kl_wow_ap()
2004 vif->fw_vif_idx, WOW_LIST_ID, in ath6kl_wow_ap()
2016 ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, in ath6kl_wow_ap()
2017 vif->fw_vif_idx, WOW_LIST_ID, in ath6kl_wow_ap()
2026 ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, in ath6kl_wow_ap()
2027 vif->fw_vif_idx, WOW_LIST_ID, in ath6kl_wow_ap()
2040 struct net_device *ndev = vif->ndev; in ath6kl_wow_sta()
2049 ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, in ath6kl_wow_sta()
2050 vif->fw_vif_idx, WOW_LIST_ID, in ath6kl_wow_sta()
2051 ETH_ALEN, 0, ndev->dev_addr, in ath6kl_wow_sta()
2062 if ((ndev->flags & IFF_ALLMULTI) || in ath6kl_wow_sta()
2063 (ndev->flags & IFF_MULTICAST && netdev_mc_count(ndev) > 0)) { in ath6kl_wow_sta()
2064 ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, in ath6kl_wow_sta()
2065 vif->fw_vif_idx, WOW_LIST_ID, in ath6kl_wow_sta()
2079 return test_bit(HOST_SLEEP_MODE_CMD_PROCESSED, &vif->flags); in is_hsleep_mode_procsed()
2084 return !ar->tx_pending[ar->ctrl_ep]; in is_ctrl_ep_empty()
2091 clear_bit(HOST_SLEEP_MODE_CMD_PROCESSED, &vif->flags); in ath6kl_cfg80211_host_sleep()
2093 ret = ath6kl_wmi_set_host_sleep_mode_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_host_sleep()
2098 left = wait_event_interruptible_timeout(ar->event_wq, in ath6kl_cfg80211_host_sleep()
2103 ret = -ETIMEDOUT; in ath6kl_cfg80211_host_sleep()
2110 if (ar->tx_pending[ar->ctrl_ep]) { in ath6kl_cfg80211_host_sleep()
2111 left = wait_event_interruptible_timeout(ar->event_wq, in ath6kl_cfg80211_host_sleep()
2116 ret = -ETIMEDOUT; in ath6kl_cfg80211_host_sleep()
2129 struct ath6kl *ar = vif->ar; in ath6kl_wow_suspend_vif()
2137 if (!test_bit(NETDEV_MCAST_ALL_ON, &vif->flags) && in ath6kl_wow_suspend_vif()
2139 ar->fw_capabilities)) { in ath6kl_wow_suspend_vif()
2140 ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi, in ath6kl_wow_suspend_vif()
2141 vif->fw_vif_idx, false); in ath6kl_wow_suspend_vif()
2148 ath6kl_wmi_del_wow_pattern_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_wow_suspend_vif()
2158 else if (vif->nw_type == AP_NETWORK) in ath6kl_wow_suspend_vif()
2166 netif_stop_queue(vif->ndev); in ath6kl_wow_suspend_vif()
2168 if (vif->nw_type != AP_NETWORK) { in ath6kl_wow_suspend_vif()
2169 ret = ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_wow_suspend_vif()
2180 ret = ath6kl_wmi_bmisstime_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_wow_suspend_vif()
2185 ret = ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_wow_suspend_vif()
2193 in_dev = __in_dev_get_rtnl(vif->ndev); in ath6kl_wow_suspend_vif()
2197 ifa = rtnl_dereference(in_dev->ifa_list); in ath6kl_wow_suspend_vif()
2202 ips[index] = ifa->ifa_local; in ath6kl_wow_suspend_vif()
2203 ifa = rtnl_dereference(ifa->ifa_next); in ath6kl_wow_suspend_vif()
2209 return -EINVAL; in ath6kl_wow_suspend_vif()
2212 ret = ath6kl_wmi_set_ip_cmd(ar->wmi, vif->fw_vif_idx, ips[0], ips[1]); in ath6kl_wow_suspend_vif()
2232 return -EIO; in ath6kl_wow_suspend()
2234 if (wow && (wow->n_patterns > WOW_MAX_FILTERS_PER_LIST)) in ath6kl_wow_suspend()
2235 return -EINVAL; in ath6kl_wow_suspend()
2238 spin_lock_bh(&ar->list_lock); in ath6kl_wow_suspend()
2239 list_for_each_entry(vif, &ar->vif_list, list) { in ath6kl_wow_suspend()
2240 if (!test_bit(CONNECTED, &vif->flags) || in ath6kl_wow_suspend()
2249 spin_unlock_bh(&ar->list_lock); in ath6kl_wow_suspend()
2252 return -ENOTCONN; in ath6kl_wow_suspend()
2256 ar->state = ATH6KL_STATE_SUSPENDING; in ath6kl_wow_suspend()
2258 ret = ath6kl_wmi_set_wow_mode_cmd(ar->wmi, first_vif->fw_vif_idx, in ath6kl_wow_suspend()
2270 struct ath6kl *ar = vif->ar; in ath6kl_wow_resume_vif()
2273 if (vif->nw_type != AP_NETWORK) { in ath6kl_wow_resume_vif()
2274 ret = ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_wow_resume_vif()
2279 ret = ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_wow_resume_vif()
2280 vif->listen_intvl_t, 0); in ath6kl_wow_resume_vif()
2284 ret = ath6kl_wmi_bmisstime_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_wow_resume_vif()
2285 vif->bmiss_time_t, 0); in ath6kl_wow_resume_vif()
2290 if (!test_bit(NETDEV_MCAST_ALL_OFF, &vif->flags) && in ath6kl_wow_resume_vif()
2292 ar->fw_capabilities)) { in ath6kl_wow_resume_vif()
2293 ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi, in ath6kl_wow_resume_vif()
2294 vif->fw_vif_idx, true); in ath6kl_wow_resume_vif()
2299 netif_wake_queue(vif->ndev); in ath6kl_wow_resume_vif()
2312 return -EIO; in ath6kl_wow_resume()
2314 ar->state = ATH6KL_STATE_RESUMING; in ath6kl_wow_resume()
2316 ret = ath6kl_wmi_set_host_sleep_mode_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_wow_resume()
2324 spin_lock_bh(&ar->list_lock); in ath6kl_wow_resume()
2325 list_for_each_entry(vif, &ar->vif_list, list) { in ath6kl_wow_resume()
2326 if (!test_bit(CONNECTED, &vif->flags) || in ath6kl_wow_resume()
2333 spin_unlock_bh(&ar->list_lock); in ath6kl_wow_resume()
2338 ar->state = ATH6KL_STATE_ON; in ath6kl_wow_resume()
2342 ar->state = ATH6KL_STATE_WOW; in ath6kl_wow_resume()
2353 return -EIO; in ath6kl_cfg80211_deepsleep_suspend()
2355 if (!test_bit(WMI_READY, &ar->flag)) { in ath6kl_cfg80211_deepsleep_suspend()
2357 return -EIO; in ath6kl_cfg80211_deepsleep_suspend()
2363 ar->wmi->saved_pwr_mode = ar->wmi->pwr_mode; in ath6kl_cfg80211_deepsleep_suspend()
2365 ret = ath6kl_wmi_powermode_cmd(ar->wmi, 0, REC_POWER); in ath6kl_cfg80211_deepsleep_suspend()
2370 ret = ath6kl_wmi_set_wow_mode_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_deepsleep_suspend()
2394 return -EIO; in ath6kl_cfg80211_deepsleep_resume()
2396 if (ar->wmi->pwr_mode != ar->wmi->saved_pwr_mode) { in ath6kl_cfg80211_deepsleep_resume()
2397 ret = ath6kl_wmi_powermode_cmd(ar->wmi, 0, in ath6kl_cfg80211_deepsleep_resume()
2398 ar->wmi->saved_pwr_mode); in ath6kl_cfg80211_deepsleep_resume()
2403 ret = ath6kl_wmi_set_host_sleep_mode_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_deepsleep_resume()
2408 ar->state = ATH6KL_STATE_ON; in ath6kl_cfg80211_deepsleep_resume()
2411 ret = ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_deepsleep_resume()
2435 prev_state = ar->state; in ath6kl_cfg80211_suspend()
2439 ar->state = prev_state; in ath6kl_cfg80211_suspend()
2443 ar->state = ATH6KL_STATE_WOW; in ath6kl_cfg80211_suspend()
2456 ar->state = ATH6KL_STATE_DEEPSLEEP; in ath6kl_cfg80211_suspend()
2464 if (ar->state == ATH6KL_STATE_OFF) { in ath6kl_cfg80211_suspend()
2478 ar->state = ATH6KL_STATE_CUTPOWER; in ath6kl_cfg80211_suspend()
2486 list_for_each_entry(vif, &ar->vif_list, list) in ath6kl_cfg80211_suspend()
2497 switch (ar->state) { in ath6kl_cfg80211_resume()
2582 if (ar->state == ATH6KL_STATE_SUSPENDING) in ath6kl_check_wow_status()
2585 if (ar->state == ATH6KL_STATE_WOW) in ath6kl_check_wow_status()
2599 struct ath6kl_htcap *htcap = &vif->htcap[band]; in ath6kl_set_htcap()
2601 if (htcap->ht_enable == ht_enable) in ath6kl_set_htcap()
2606 htcap->ht_enable = true; in ath6kl_set_htcap()
2607 htcap->cap_info = (band == NL80211_BAND_2GHZ) ? in ath6kl_set_htcap()
2609 htcap->ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K; in ath6kl_set_htcap()
2613 return ath6kl_wmi_set_htcap_cmd(vif->ar->wmi, vif->fw_vif_idx, in ath6kl_set_htcap()
2619 struct wiphy *wiphy = vif->ar->wiphy; in ath6kl_restore_htcap()
2623 if (!wiphy->bands[band]) in ath6kl_restore_htcap()
2627 wiphy->bands[band]->ht_cap.ht_supported); in ath6kl_restore_htcap()
2645 struct ath6kl *ar = vif->ar; in ath6kl_set_ap_probe_resp_ies()
2659 return -ENOMEM; in ath6kl_set_ap_probe_resp_ies()
2672 ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_set_ap_probe_resp_ies()
2681 struct ath6kl *ar = vif->ar; in ath6kl_set_ies()
2685 res = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_set_ies()
2687 info->beacon_ies, in ath6kl_set_ies()
2688 info->beacon_ies_len); in ath6kl_set_ies()
2693 res = ath6kl_set_ap_probe_resp_ies(vif, info->proberesp_ies, in ath6kl_set_ies()
2694 info->proberesp_ies_len); in ath6kl_set_ies()
2699 res = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_set_ies()
2701 info->assocresp_ies, in ath6kl_set_ies()
2702 info->assocresp_ies_len); in ath6kl_set_ies()
2716 if (!beacon->tail) in ath6kl_get_rsn_capab()
2717 return -EINVAL; in ath6kl_get_rsn_capab()
2719 rsn_ie = cfg80211_find_ie(WLAN_EID_RSN, beacon->tail, beacon->tail_len); in ath6kl_get_rsn_capab()
2721 return -EINVAL; in ath6kl_get_rsn_capab()
2729 return -EINVAL; in ath6kl_get_rsn_capab()
2731 rsn_ie_len -= 2; in ath6kl_get_rsn_capab()
2737 rsn_ie_len -= 4; in ath6kl_get_rsn_capab()
2744 rsn_ie_len -= (2 + cnt * 4); in ath6kl_get_rsn_capab()
2751 rsn_ie_len -= (2 + cnt * 4); in ath6kl_get_rsn_capab()
2778 return -EIO; in ath6kl_start_ap()
2780 if (vif->next_mode != AP_NETWORK) in ath6kl_start_ap()
2781 return -EOPNOTSUPP; in ath6kl_start_ap()
2783 res = ath6kl_set_ies(vif, &info->beacon); in ath6kl_start_ap()
2785 ar->ap_mode_bkey.valid = false; in ath6kl_start_ap()
2787 ret = ath6kl_wmi_ap_set_beacon_intvl_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_start_ap()
2788 info->beacon_interval); in ath6kl_start_ap()
2793 ret = ath6kl_wmi_ap_set_dtim_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_start_ap()
2794 info->dtim_period); in ath6kl_start_ap()
2800 if (info->beacon.head == NULL) in ath6kl_start_ap()
2801 return -EINVAL; in ath6kl_start_ap()
2802 mgmt = (struct ieee80211_mgmt *) info->beacon.head; in ath6kl_start_ap()
2803 ies = mgmt->u.beacon.variable; in ath6kl_start_ap()
2804 if (ies > info->beacon.head + info->beacon.head_len) in ath6kl_start_ap()
2805 return -EINVAL; in ath6kl_start_ap()
2807 if (info->ssid == NULL) in ath6kl_start_ap()
2808 return -EINVAL; in ath6kl_start_ap()
2809 memcpy(vif->ssid, info->ssid, info->ssid_len); in ath6kl_start_ap()
2810 vif->ssid_len = info->ssid_len; in ath6kl_start_ap()
2811 if (info->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) in ath6kl_start_ap()
2814 res = ath6kl_wmi_ap_hidden_ssid(ar->wmi, vif->fw_vif_idx, hidden); in ath6kl_start_ap()
2818 ret = ath6kl_set_auth_type(vif, info->auth_type); in ath6kl_start_ap()
2824 for (i = 0; i < info->crypto.n_akm_suites; i++) { in ath6kl_start_ap()
2825 switch (info->crypto.akm_suites[i]) { in ath6kl_start_ap()
2827 if (info->crypto.wpa_versions & NL80211_WPA_VERSION_1) in ath6kl_start_ap()
2829 if (info->crypto.wpa_versions & NL80211_WPA_VERSION_2) in ath6kl_start_ap()
2833 if (info->crypto.wpa_versions & NL80211_WPA_VERSION_1) in ath6kl_start_ap()
2835 if (info->crypto.wpa_versions & NL80211_WPA_VERSION_2) in ath6kl_start_ap()
2842 vif->auth_mode = p.auth_mode; in ath6kl_start_ap()
2844 for (i = 0; i < info->crypto.n_ciphers_pairwise; i++) { in ath6kl_start_ap()
2845 switch (info->crypto.ciphers_pairwise[i]) { in ath6kl_start_ap()
2864 } else if (info->crypto.n_ciphers_pairwise == 1) { in ath6kl_start_ap()
2865 ath6kl_set_cipher(vif, info->crypto.ciphers_pairwise[0], true); in ath6kl_start_ap()
2868 switch (info->crypto.cipher_group) { in ath6kl_start_ap()
2886 ath6kl_set_cipher(vif, info->crypto.cipher_group, false); in ath6kl_start_ap()
2889 vif->nw_type = vif->next_mode; in ath6kl_start_ap()
2891 p.ssid_len = vif->ssid_len; in ath6kl_start_ap()
2892 memcpy(p.ssid, vif->ssid, vif->ssid_len); in ath6kl_start_ap()
2893 p.dot11_auth_mode = vif->dot11_auth_mode; in ath6kl_start_ap()
2894 p.ch = cpu_to_le16(info->chandef.chan->center_freq); in ath6kl_start_ap()
2897 res = ath6kl_wmi_ap_set_apsd(ar->wmi, vif->fw_vif_idx, true); in ath6kl_start_ap()
2901 if (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) { in ath6kl_start_ap()
2911 if (info->inactivity_timeout) { in ath6kl_start_ap()
2912 inactivity_timeout = info->inactivity_timeout; in ath6kl_start_ap()
2915 ar->fw_capabilities)) in ath6kl_start_ap()
2919 res = ath6kl_wmi_set_inact_period(ar->wmi, vif->fw_vif_idx, in ath6kl_start_ap()
2925 if (ath6kl_set_htcap(vif, info->chandef.chan->band, in ath6kl_start_ap()
2926 cfg80211_get_chandef_type(&info->chandef) in ath6kl_start_ap()
2928 return -EIO; in ath6kl_start_ap()
2936 if (!ath6kl_get_rsn_capab(&info->beacon, (u8 *) &rsn_capab) && in ath6kl_start_ap()
2938 ar->fw_capabilities)) { in ath6kl_start_ap()
2939 res = ath6kl_wmi_set_ie_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_start_ap()
2943 vif->rsn_capab = rsn_capab; in ath6kl_start_ap()
2948 memcpy(&vif->profile, &p, sizeof(p)); in ath6kl_start_ap()
2949 res = ath6kl_wmi_ap_profile_commit(ar->wmi, vif->fw_vif_idx, &p); in ath6kl_start_ap()
2962 return -EIO; in ath6kl_change_beacon()
2964 if (vif->next_mode != AP_NETWORK) in ath6kl_change_beacon()
2965 return -EOPNOTSUPP; in ath6kl_change_beacon()
2976 if (vif->nw_type != AP_NETWORK) in ath6kl_stop_ap()
2977 return -EOPNOTSUPP; in ath6kl_stop_ap()
2978 if (!test_bit(CONNECTED, &vif->flags)) in ath6kl_stop_ap()
2979 return -ENOTCONN; in ath6kl_stop_ap()
2981 ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx); in ath6kl_stop_ap()
2982 clear_bit(CONNECTED, &vif->flags); in ath6kl_stop_ap()
2983 netif_carrier_off(vif->ndev); in ath6kl_stop_ap()
2996 const u8 *addr = params->mac ? params->mac : bcast_addr; in ath6kl_del_station()
2998 return ath6kl_wmi_ap_set_mlme(ar->wmi, vif->fw_vif_idx, WMI_AP_DEAUTH, in ath6kl_del_station()
3010 if (vif->nw_type != AP_NETWORK) in ath6kl_change_station()
3011 return -EOPNOTSUPP; in ath6kl_change_station()
3018 if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) in ath6kl_change_station()
3019 return ath6kl_wmi_ap_set_mlme(ar->wmi, vif->fw_vif_idx, in ath6kl_change_station()
3021 return ath6kl_wmi_ap_set_mlme(ar->wmi, vif->fw_vif_idx, in ath6kl_change_station()
3032 struct ath6kl *ar = ath6kl_priv(vif->ndev); in ath6kl_remain_on_channel()
3035 /* TODO: if already pending or ongoing remain-on-channel, in ath6kl_remain_on_channel()
3036 * return -EBUSY */ in ath6kl_remain_on_channel()
3037 id = ++vif->last_roc_id; in ath6kl_remain_on_channel()
3040 id = ++vif->last_roc_id; in ath6kl_remain_on_channel()
3044 return ath6kl_wmi_remain_on_chnl_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_remain_on_channel()
3045 chan->center_freq, duration); in ath6kl_remain_on_channel()
3053 struct ath6kl *ar = ath6kl_priv(vif->ndev); in ath6kl_cancel_remain_on_channel()
3055 if (cookie != vif->last_roc_id) in ath6kl_cancel_remain_on_channel()
3056 return -ENOENT; in ath6kl_cancel_remain_on_channel()
3057 vif->last_cancel_roc_id = cookie; in ath6kl_cancel_remain_on_channel()
3059 return ath6kl_wmi_cancel_remain_on_chnl_cmd(ar->wmi, vif->fw_vif_idx); in ath6kl_cancel_remain_on_channel()
3066 struct ath6kl *ar = vif->ar; in ath6kl_send_go_probe_resp()
3079 return -ENOMEM; in ath6kl_send_go_probe_resp()
3082 pos = mgmt->u.probe_resp.variable; in ath6kl_send_go_probe_resp()
3093 ret = ath6kl_wmi_send_probe_response_cmd(ar->wmi, vif->fw_vif_idx, freq, in ath6kl_send_go_probe_resp()
3094 mgmt->da, p2p, p2p_len); in ath6kl_send_go_probe_resp()
3113 struct ath6kl *ar = vif->ar; in ath6kl_mgmt_powersave_ap()
3116 if (is_multicast_ether_addr(mgmt->da)) in ath6kl_mgmt_powersave_ap()
3119 conn = ath6kl_find_sta(vif, mgmt->da); in ath6kl_mgmt_powersave_ap()
3123 if (conn->sta_flags & STA_PS_SLEEP) { in ath6kl_mgmt_powersave_ap()
3124 if (!(conn->sta_flags & STA_PS_POLLED)) { in ath6kl_mgmt_powersave_ap()
3131 INIT_LIST_HEAD(&mgmt_buf->list); in ath6kl_mgmt_powersave_ap()
3132 mgmt_buf->id = id; in ath6kl_mgmt_powersave_ap()
3133 mgmt_buf->freq = freq; in ath6kl_mgmt_powersave_ap()
3134 mgmt_buf->wait = wait; in ath6kl_mgmt_powersave_ap()
3135 mgmt_buf->len = len; in ath6kl_mgmt_powersave_ap()
3136 mgmt_buf->no_cck = no_cck; in ath6kl_mgmt_powersave_ap()
3137 memcpy(mgmt_buf->buf, buf, len); in ath6kl_mgmt_powersave_ap()
3138 spin_lock_bh(&conn->psq_lock); in ath6kl_mgmt_powersave_ap()
3139 is_psq_empty = skb_queue_empty(&conn->psq) && in ath6kl_mgmt_powersave_ap()
3140 (conn->mgmt_psq_len == 0); in ath6kl_mgmt_powersave_ap()
3141 list_add_tail(&mgmt_buf->list, &conn->mgmt_psq); in ath6kl_mgmt_powersave_ap()
3142 conn->mgmt_psq_len++; in ath6kl_mgmt_powersave_ap()
3143 spin_unlock_bh(&conn->psq_lock); in ath6kl_mgmt_powersave_ap()
3151 ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_mgmt_powersave_ap()
3152 conn->aid, 1); in ath6kl_mgmt_powersave_ap()
3160 spin_lock_bh(&conn->psq_lock); in ath6kl_mgmt_powersave_ap()
3161 if (!skb_queue_empty(&conn->psq) || (conn->mgmt_psq_len != 0)) in ath6kl_mgmt_powersave_ap()
3163 spin_unlock_bh(&conn->psq_lock); in ath6kl_mgmt_powersave_ap()
3169 /* Check if SSID length is greater than DIRECT- */
3176 if (buf + len >= &mgmt->u.probe_resp.variable[1] && in ath6kl_is_p2p_go_ssid()
3177 (mgmt->u.probe_resp.variable[1] > P2P_WILDCARD_SSID_LEN)) { in ath6kl_is_p2p_go_ssid()
3188 struct ath6kl *ar = ath6kl_priv(vif->ndev); in ath6kl_mgmt_tx()
3189 struct ieee80211_channel *chan = params->chan; in ath6kl_mgmt_tx()
3190 const u8 *buf = params->buf; in ath6kl_mgmt_tx()
3191 size_t len = params->len; in ath6kl_mgmt_tx()
3192 unsigned int wait = params->wait; in ath6kl_mgmt_tx()
3193 bool no_cck = params->no_cck; in ath6kl_mgmt_tx()
3201 freq = vif->ch_hint; in ath6kl_mgmt_tx()
3203 freq = chan->center_freq; in ath6kl_mgmt_tx()
3207 return -EINVAL; in ath6kl_mgmt_tx()
3210 if (vif->nw_type == AP_NETWORK && test_bit(CONNECTED, &vif->flags) && in ath6kl_mgmt_tx()
3211 ieee80211_is_probe_resp(mgmt->frame_control) && in ath6kl_mgmt_tx()
3221 id = vif->send_action_id++; in ath6kl_mgmt_tx()
3227 id = vif->send_action_id++; in ath6kl_mgmt_tx()
3233 if (vif->nw_type == AP_NETWORK) { in ath6kl_mgmt_tx()
3240 return ath6kl_wmi_send_mgmt_cmd(ar->wmi, vif->fw_vif_idx, id, freq, in ath6kl_mgmt_tx()
3248 *tx_ant = ar->hw.tx_ant; in ath6kl_get_antenna()
3249 *rx_ant = ar->hw.rx_ant; in ath6kl_get_antenna()
3264 vif->probe_req_report = in ath6kl_update_mgmt_frame_registrations()
3265 upd->interface_stypes & BIT(IEEE80211_STYPE_PROBE_REQ >> 4); in ath6kl_update_mgmt_frame_registrations()
3276 int n_match_sets = request->n_match_sets; in ath6kl_cfg80211_sscan_start()
3283 if (n_match_sets == 1 && !request->match_sets[0].ssid.ssid_len) in ath6kl_cfg80211_sscan_start()
3286 if (ar->state != ATH6KL_STATE_ON) in ath6kl_cfg80211_sscan_start()
3287 return -EIO; in ath6kl_cfg80211_sscan_start()
3289 if (vif->sme_state != SME_DISCONNECTED) in ath6kl_cfg80211_sscan_start()
3290 return -EBUSY; in ath6kl_cfg80211_sscan_start()
3294 ret = ath6kl_set_probed_ssids(ar, vif, request->ssids, in ath6kl_cfg80211_sscan_start()
3295 request->n_ssids, in ath6kl_cfg80211_sscan_start()
3296 request->match_sets, in ath6kl_cfg80211_sscan_start()
3302 ret = ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_sscan_start()
3307 ret = ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_sscan_start()
3314 ar->fw_capabilities)) { in ath6kl_cfg80211_sscan_start()
3315 if (request->min_rssi_thold <= NL80211_SCAN_RSSI_THOLD_OFF) in ath6kl_cfg80211_sscan_start()
3317 else if (request->min_rssi_thold < -127) in ath6kl_cfg80211_sscan_start()
3318 rssi_thold = -127; in ath6kl_cfg80211_sscan_start()
3320 rssi_thold = request->min_rssi_thold; in ath6kl_cfg80211_sscan_start()
3322 ret = ath6kl_wmi_set_rssi_filter_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_sscan_start()
3331 interval = max_t(u16, 1, request->scan_plans[0].interval); in ath6kl_cfg80211_sscan_start()
3333 ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_sscan_start()
3335 vif->bg_scan_period, 0, 0, 0, 3, 0, 0, 0); in ath6kl_cfg80211_sscan_start()
3338 ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_sscan_start()
3340 request->ie, request->ie_len); in ath6kl_cfg80211_sscan_start()
3347 ret = ath6kl_wmi_enable_sched_scan_cmd(ar->wmi, vif->fw_vif_idx, true); in ath6kl_cfg80211_sscan_start()
3351 set_bit(SCHED_SCANNING, &vif->flags); in ath6kl_cfg80211_sscan_start()
3365 return -EIO; in ath6kl_cfg80211_sscan_stop()
3379 return ath6kl_wmi_set_bitrate_mask(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_set_bitrate()
3390 if (vif->nw_type != INFRA_NETWORK || in ath6kl_cfg80211_set_txe_config()
3391 !test_bit(ATH6KL_FW_CAPABILITY_TX_ERR_NOTIFY, ar->fw_capabilities)) in ath6kl_cfg80211_set_txe_config()
3392 return -EOPNOTSUPP; in ath6kl_cfg80211_set_txe_config()
3394 if (vif->sme_state != SME_CONNECTED) in ath6kl_cfg80211_set_txe_config()
3395 return -ENOTCONN; in ath6kl_cfg80211_set_txe_config()
3398 vif->txe_intvl = intvl; in ath6kl_cfg80211_set_txe_config()
3400 return ath6kl_wmi_set_txe_notify(ar->wmi, vif->fw_vif_idx, in ath6kl_cfg80211_set_txe_config()
3479 switch (vif->sme_state) { in ath6kl_cfg80211_stop()
3483 cfg80211_connect_result(vif->ndev, vif->bssid, NULL, 0, in ath6kl_cfg80211_stop()
3489 cfg80211_disconnected(vif->ndev, 0, NULL, 0, true, GFP_KERNEL); in ath6kl_cfg80211_stop()
3493 if (vif->ar->state != ATH6KL_STATE_RECOVERY && in ath6kl_cfg80211_stop()
3494 (test_bit(CONNECTED, &vif->flags) || in ath6kl_cfg80211_stop()
3495 test_bit(CONNECT_PEND, &vif->flags))) in ath6kl_cfg80211_stop()
3496 ath6kl_wmi_disconnect_cmd(vif->ar->wmi, vif->fw_vif_idx); in ath6kl_cfg80211_stop()
3498 vif->sme_state = SME_DISCONNECTED; in ath6kl_cfg80211_stop()
3499 clear_bit(CONNECTED, &vif->flags); in ath6kl_cfg80211_stop()
3500 clear_bit(CONNECT_PEND, &vif->flags); in ath6kl_cfg80211_stop()
3503 netif_stop_queue(vif->ndev); in ath6kl_cfg80211_stop()
3504 netif_carrier_off(vif->ndev); in ath6kl_cfg80211_stop()
3507 if (vif->ar->state != ATH6KL_STATE_RECOVERY && in ath6kl_cfg80211_stop()
3508 ath6kl_wmi_scanparams_cmd(vif->ar->wmi, vif->fw_vif_idx, 0xFFFF, in ath6kl_cfg80211_stop()
3520 if (!vif && ar->state != ATH6KL_STATE_RECOVERY) { in ath6kl_cfg80211_stop_all()
3522 ar->wmi->saved_pwr_mode = ar->wmi->pwr_mode; in ath6kl_cfg80211_stop_all()
3524 if (ath6kl_wmi_powermode_cmd(ar->wmi, 0, REC_POWER) != 0) in ath6kl_cfg80211_stop_all()
3530 * FIXME: we should take ar->list_lock to protect changes in the in ath6kl_cfg80211_stop_all()
3534 list_for_each_entry(vif, &ar->vif_list, list) in ath6kl_cfg80211_stop_all()
3547 request->alpha2[0], request->alpha2[1], in ath6kl_cfg80211_reg_notify()
3548 request->intersect ? " intersect" : "", in ath6kl_cfg80211_reg_notify()
3549 request->processed ? " processed" : "", in ath6kl_cfg80211_reg_notify()
3550 request->initiator, request->user_reg_hint_type); in ath6kl_cfg80211_reg_notify()
3552 if (request->user_reg_hint_type != NL80211_USER_REG_HINT_CELL_BASE) in ath6kl_cfg80211_reg_notify()
3555 ret = ath6kl_wmi_set_regdomain_cmd(ar->wmi, request->alpha2); in ath6kl_cfg80211_reg_notify()
3568 if (wiphy->bands[i]) in ath6kl_cfg80211_reg_notify()
3569 rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1; in ath6kl_cfg80211_reg_notify()
3572 ret = ath6kl_wmi_beginscan_cmd(ar->wmi, 0, WMI_LONG_SCAN, false, in ath6kl_cfg80211_reg_notify()
3584 vif->aggr_cntxt = aggr_init(vif); in ath6kl_cfg80211_vif_init()
3585 if (!vif->aggr_cntxt) { in ath6kl_cfg80211_vif_init()
3587 return -ENOMEM; in ath6kl_cfg80211_vif_init()
3590 timer_setup(&vif->disconnect_timer, disconnect_timer_handler, 0); in ath6kl_cfg80211_vif_init()
3591 timer_setup(&vif->sched_scan_timer, ath6kl_wmi_sscan_timer, 0); in ath6kl_cfg80211_vif_init()
3593 set_bit(WMM_ENABLED, &vif->flags); in ath6kl_cfg80211_vif_init()
3594 spin_lock_init(&vif->if_lock); in ath6kl_cfg80211_vif_init()
3596 INIT_LIST_HEAD(&vif->mc_filter); in ath6kl_cfg80211_vif_init()
3606 netif_stop_queue(vif->ndev); in ath6kl_cfg80211_vif_stop()
3608 clear_bit(WLAN_ENABLED, &vif->flags); in ath6kl_cfg80211_vif_stop()
3611 discon_issued = test_bit(CONNECTED, &vif->flags) || in ath6kl_cfg80211_vif_stop()
3612 test_bit(CONNECT_PEND, &vif->flags); in ath6kl_cfg80211_vif_stop()
3614 del_timer(&vif->disconnect_timer); in ath6kl_cfg80211_vif_stop()
3618 (vif->nw_type & AP_NETWORK) ? in ath6kl_cfg80211_vif_stop()
3619 bcast_mac : vif->bssid, in ath6kl_cfg80211_vif_stop()
3623 if (vif->scan_req) { in ath6kl_cfg80211_vif_stop()
3628 cfg80211_scan_done(vif->scan_req, &info); in ath6kl_cfg80211_vif_stop()
3629 vif->scan_req = NULL; in ath6kl_cfg80211_vif_stop()
3638 struct ath6kl *ar = vif->ar; in ath6kl_cfg80211_vif_cleanup()
3641 aggr_module_destroy(vif->aggr_cntxt); in ath6kl_cfg80211_vif_cleanup()
3643 ar->avail_idx_map |= BIT(vif->fw_vif_idx); in ath6kl_cfg80211_vif_cleanup()
3645 if (vif->nw_type == ADHOC_NETWORK) in ath6kl_cfg80211_vif_cleanup()
3646 ar->ibss_if_active = false; in ath6kl_cfg80211_vif_cleanup()
3648 list_for_each_entry_safe(mc_filter, tmp, &vif->mc_filter, list) { in ath6kl_cfg80211_vif_cleanup()
3649 list_del(&mc_filter->list); in ath6kl_cfg80211_vif_cleanup()
3653 cfg80211_unregister_netdevice(vif->ndev); in ath6kl_cfg80211_vif_cleanup()
3655 ar->num_vif--; in ath6kl_cfg80211_vif_cleanup()
3693 return -EOPNOTSUPP; in ath6kl_get_sset_count()
3702 struct ath6kl *ar = vif->ar; in ath6kl_get_stats()
3710 tgt_stats = &vif->target_stats; in ath6kl_get_stats()
3712 data[i++] = tgt_stats->tx_ucast_pkt + tgt_stats->tx_bcast_pkt; in ath6kl_get_stats()
3713 data[i++] = tgt_stats->tx_ucast_byte + tgt_stats->tx_bcast_byte; in ath6kl_get_stats()
3714 data[i++] = tgt_stats->rx_ucast_pkt + tgt_stats->rx_bcast_pkt; in ath6kl_get_stats()
3715 data[i++] = tgt_stats->rx_ucast_byte + tgt_stats->rx_bcast_byte; in ath6kl_get_stats()
3717 data[i++] = tgt_stats->tx_ucast_pkt; in ath6kl_get_stats()
3718 data[i++] = tgt_stats->tx_bcast_pkt; in ath6kl_get_stats()
3719 data[i++] = tgt_stats->tx_ucast_byte; in ath6kl_get_stats()
3720 data[i++] = tgt_stats->tx_bcast_byte; in ath6kl_get_stats()
3721 data[i++] = tgt_stats->tx_rts_success_cnt; in ath6kl_get_stats()
3722 data[i++] = tgt_stats->tx_err; in ath6kl_get_stats()
3723 data[i++] = tgt_stats->tx_fail_cnt; in ath6kl_get_stats()
3724 data[i++] = tgt_stats->tx_retry_cnt; in ath6kl_get_stats()
3725 data[i++] = tgt_stats->tx_mult_retry_cnt; in ath6kl_get_stats()
3726 data[i++] = tgt_stats->tx_rts_fail_cnt; in ath6kl_get_stats()
3727 data[i++] = tgt_stats->tkip_cnter_measures_invoked; in ath6kl_get_stats()
3729 data[i++] = tgt_stats->rx_ucast_pkt; in ath6kl_get_stats()
3730 data[i++] = tgt_stats->rx_ucast_rate; in ath6kl_get_stats()
3731 data[i++] = tgt_stats->rx_bcast_pkt; in ath6kl_get_stats()
3732 data[i++] = tgt_stats->rx_ucast_byte; in ath6kl_get_stats()
3733 data[i++] = tgt_stats->rx_bcast_byte; in ath6kl_get_stats()
3734 data[i++] = tgt_stats->rx_frgment_pkt; in ath6kl_get_stats()
3735 data[i++] = tgt_stats->rx_err; in ath6kl_get_stats()
3736 data[i++] = tgt_stats->rx_crc_err; in ath6kl_get_stats()
3737 data[i++] = tgt_stats->rx_key_cache_miss; in ath6kl_get_stats()
3738 data[i++] = tgt_stats->rx_decrypt_err; in ath6kl_get_stats()
3739 data[i++] = tgt_stats->rx_dupl_frame; in ath6kl_get_stats()
3740 data[i++] = tgt_stats->tkip_local_mic_fail; in ath6kl_get_stats()
3741 data[i++] = tgt_stats->tkip_fmt_err; in ath6kl_get_stats()
3742 data[i++] = tgt_stats->ccmp_fmt_err; in ath6kl_get_stats()
3743 data[i++] = tgt_stats->ccmp_replays; in ath6kl_get_stats()
3745 data[i++] = tgt_stats->cs_bmiss_cnt; in ath6kl_get_stats()
3746 data[i++] = tgt_stats->cs_connect_cnt; in ath6kl_get_stats()
3747 data[i++] = tgt_stats->cs_discon_cnt; in ath6kl_get_stats()
3748 data[i++] = tgt_stats->cs_ave_beacon_rssi; in ath6kl_get_stats()
3749 data[i++] = tgt_stats->arp_received; in ath6kl_get_stats()
3750 data[i++] = tgt_stats->arp_matched; in ath6kl_get_stats()
3751 data[i++] = tgt_stats->arp_replied; in ath6kl_get_stats()
3793 ndev->ieee80211_ptr = &vif->wdev; in ath6kl_interface_add()
3794 vif->wdev.wiphy = ar->wiphy; in ath6kl_interface_add()
3795 vif->ar = ar; in ath6kl_interface_add()
3796 vif->ndev = ndev; in ath6kl_interface_add()
3797 SET_NETDEV_DEV(ndev, wiphy_dev(vif->wdev.wiphy)); in ath6kl_interface_add()
3798 vif->wdev.netdev = ndev; in ath6kl_interface_add()
3799 vif->wdev.iftype = type; in ath6kl_interface_add()
3800 vif->fw_vif_idx = fw_vif_idx; in ath6kl_interface_add()
3801 vif->nw_type = nw_type; in ath6kl_interface_add()
3802 vif->next_mode = nw_type; in ath6kl_interface_add()
3803 vif->listen_intvl_t = ATH6KL_DEFAULT_LISTEN_INTVAL; in ath6kl_interface_add()
3804 vif->bmiss_time_t = ATH6KL_DEFAULT_BMISS_TIME; in ath6kl_interface_add()
3805 vif->bg_scan_period = 0; in ath6kl_interface_add()
3806 vif->htcap[NL80211_BAND_2GHZ].ht_enable = true; in ath6kl_interface_add()
3807 vif->htcap[NL80211_BAND_5GHZ].ht_enable = true; in ath6kl_interface_add()
3809 ether_addr_copy(addr, ar->mac_addr); in ath6kl_interface_add()
3813 ar->fw_capabilities)) in ath6kl_interface_add()
3830 ar->avail_idx_map &= ~BIT(fw_vif_idx); in ath6kl_interface_add()
3831 vif->sme_state = SME_DISCONNECTED; in ath6kl_interface_add()
3832 set_bit(WLAN_ENABLED, &vif->flags); in ath6kl_interface_add()
3833 ar->wlan_pwr_state = WLAN_POWER_STATE_ON; in ath6kl_interface_add()
3836 ar->ibss_if_active = true; in ath6kl_interface_add()
3838 spin_lock_bh(&ar->list_lock); in ath6kl_interface_add()
3839 list_add_tail(&vif->list, &ar->vif_list); in ath6kl_interface_add()
3840 spin_unlock_bh(&ar->list_lock); in ath6kl_interface_add()
3842 return &vif->wdev; in ath6kl_interface_add()
3845 aggr_module_destroy(vif->aggr_cntxt); in ath6kl_interface_add()
3866 struct wiphy *wiphy = ar->wiphy; in ath6kl_cfg80211_init()
3870 wiphy->mgmt_stypes = ath6kl_mgmt_stypes; in ath6kl_cfg80211_init()
3872 wiphy->max_remain_on_channel_duration = 5000; in ath6kl_cfg80211_init()
3875 set_wiphy_dev(wiphy, ar->dev); in ath6kl_cfg80211_init()
3877 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | in ath6kl_cfg80211_init()
3880 if (ar->p2p) { in ath6kl_cfg80211_init()
3881 wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) | in ath6kl_cfg80211_init()
3886 test_bit(ATH6KL_FW_CAPABILITY_REGDOMAIN, ar->fw_capabilities)) { in ath6kl_cfg80211_init()
3887 wiphy->reg_notifier = ath6kl_cfg80211_reg_notify; in ath6kl_cfg80211_init()
3888 ar->wiphy->features |= NL80211_FEATURE_CELL_BASE_REG_HINTS; in ath6kl_cfg80211_init()
3892 wiphy->max_scan_ssids = MAX_PROBED_SSIDS; in ath6kl_cfg80211_init()
3896 ar->fw_capabilities)) in ath6kl_cfg80211_init()
3897 wiphy->max_match_sets = MAX_PROBED_SSIDS; in ath6kl_cfg80211_init()
3899 wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */ in ath6kl_cfg80211_init()
3900 switch (ar->hw.cap) { in ath6kl_cfg80211_init()
3922 return -EINVAL; in ath6kl_cfg80211_init()
3928 * 4-way handshake would fail. in ath6kl_cfg80211_init()
3932 ar->fw_capabilities))) { in ath6kl_cfg80211_init()
3939 ath6kl_err("Firmware lacks RSN-CAP-OVERRIDE, so HT (802.11n) is disabled."); in ath6kl_cfg80211_init()
3943 ar->fw_capabilities)) { in ath6kl_cfg80211_init()
3948 ar->hw.tx_ant = 0x3; /* mask, 2 antenna */ in ath6kl_cfg80211_init()
3949 ar->hw.rx_ant = 0x3; in ath6kl_cfg80211_init()
3953 ar->hw.tx_ant = 1; in ath6kl_cfg80211_init()
3954 ar->hw.rx_ant = 1; in ath6kl_cfg80211_init()
3957 wiphy->available_antennas_tx = ar->hw.tx_ant; in ath6kl_cfg80211_init()
3958 wiphy->available_antennas_rx = ar->hw.rx_ant; in ath6kl_cfg80211_init()
3961 wiphy->bands[NL80211_BAND_2GHZ] = &ath6kl_band_2ghz; in ath6kl_cfg80211_init()
3963 wiphy->bands[NL80211_BAND_5GHZ] = &ath6kl_band_5ghz; in ath6kl_cfg80211_init()
3965 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; in ath6kl_cfg80211_init()
3967 wiphy->cipher_suites = cipher_suites; in ath6kl_cfg80211_init()
3968 wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); in ath6kl_cfg80211_init()
3971 wiphy->wowlan = &ath6kl_wowlan_support; in ath6kl_cfg80211_init()
3974 wiphy->max_sched_scan_ssids = MAX_PROBED_SSIDS; in ath6kl_cfg80211_init()
3976 ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM | in ath6kl_cfg80211_init()
3981 if (test_bit(ATH6KL_FW_CAPABILITY_SCHED_SCAN_V2, ar->fw_capabilities)) in ath6kl_cfg80211_init()
3982 ar->wiphy->max_sched_scan_reqs = 1; in ath6kl_cfg80211_init()
3985 ar->fw_capabilities)) in ath6kl_cfg80211_init()
3986 ar->wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER; in ath6kl_cfg80211_init()
3988 ar->wiphy->probe_resp_offload = in ath6kl_cfg80211_init()
3999 ar->wiphy_registered = true; in ath6kl_cfg80211_init()
4006 wiphy_unregister(ar->wiphy); in ath6kl_cfg80211_cleanup()
4008 ar->wiphy_registered = false; in ath6kl_cfg80211_cleanup()
4025 ar->wiphy = wiphy; in ath6kl_cfg80211_create()
4036 kfree(ar->sta_list[i].aggr_conn); in ath6kl_cfg80211_destroy()
4038 wiphy_free(ar->wiphy); in ath6kl_cfg80211_destroy()