Lines Matching refs:vif
145 static bool __ath6kl_cfg80211_sscan_stop(struct ath6kl_vif *vif)
147 struct ath6kl *ar = vif->ar;
149 if (!test_and_clear_bit(SCHED_SCANNING, &vif->flags))
152 del_timer_sync(&vif->sched_scan_timer);
157 ath6kl_wmi_enable_sched_scan_cmd(ar->wmi, vif->fw_vif_idx, false);
162 static void ath6kl_cfg80211_sscan_disable(struct ath6kl_vif *vif)
164 struct ath6kl *ar = vif->ar;
167 stopped = __ath6kl_cfg80211_sscan_stop(vif);
175 static int ath6kl_set_wpa_version(struct ath6kl_vif *vif,
181 vif->auth_mode = NONE_AUTH;
183 vif->auth_mode = WPA2_AUTH;
185 vif->auth_mode = WPA_AUTH;
194 static int ath6kl_set_auth_type(struct ath6kl_vif *vif,
201 vif->dot11_auth_mode = OPEN_AUTH;
204 vif->dot11_auth_mode = SHARED_AUTH;
207 vif->dot11_auth_mode = LEAP_AUTH;
211 vif->dot11_auth_mode = OPEN_AUTH | SHARED_AUTH;
222 static int ath6kl_set_cipher(struct ath6kl_vif *vif, u32 cipher, bool ucast)
224 u8 *ar_cipher = ucast ? &vif->prwise_crypto : &vif->grp_crypto;
225 u8 *ar_cipher_len = ucast ? &vif->prwise_crypto_len :
226 &vif->grp_crypto_len;
265 static void ath6kl_set_key_mgmt(struct ath6kl_vif *vif, u32 key_mgmt)
270 if (vif->auth_mode == WPA_AUTH)
271 vif->auth_mode = WPA_PSK_AUTH;
272 else if (vif->auth_mode == WPA2_AUTH)
273 vif->auth_mode = WPA2_PSK_AUTH;
275 if (vif->auth_mode == WPA_AUTH)
276 vif->auth_mode = WPA_AUTH_CCKM;
277 else if (vif->auth_mode == WPA2_AUTH)
278 vif->auth_mode = WPA2_AUTH_CCKM;
280 vif->auth_mode = NONE_AUTH;
284 static bool ath6kl_cfg80211_ready(struct ath6kl_vif *vif)
286 struct ath6kl *ar = vif->ar;
293 if (!test_bit(WLAN_ENABLED, &vif->flags)) {
321 static int ath6kl_set_assoc_req_ies(struct ath6kl_vif *vif, const u8 *ies,
324 struct ath6kl *ar = vif->ar;
361 ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx,
429 static void ath6kl_cfg80211_sta_bmiss_enhance(struct ath6kl_vif *vif,
434 if (WARN_ON(!test_bit(WMI_READY, &vif->ar->flag)))
437 if (vif->nw_type != INFRA_NETWORK)
441 vif->ar->fw_capabilities))
447 err = ath6kl_wmi_sta_bmiss_enhance_cmd(vif->ar->wmi,
448 vif->fw_vif_idx, enable);
458 struct ath6kl_vif *vif = netdev_priv(dev);
463 ath6kl_cfg80211_sscan_disable(vif);
465 vif->sme_state = SME_CONNECTING;
467 if (!ath6kl_cfg80211_ready(vif))
507 status = ath6kl_set_assoc_req_ies(vif, sme->ie, sme->ie_len);
516 if (test_bit(CONNECTED, &vif->flags) &&
517 vif->ssid_len == sme->ssid_len &&
518 !memcmp(vif->ssid, sme->ssid, vif->ssid_len)) {
519 vif->reconnect_flag = true;
520 status = ath6kl_wmi_reconnect_cmd(ar->wmi, vif->fw_vif_idx,
521 vif->req_bssid,
522 vif->ch_hint);
530 } else if (vif->ssid_len == sme->ssid_len &&
531 !memcmp(vif->ssid, sme->ssid, vif->ssid_len)) {
532 ath6kl_disconnect(vif);
535 memset(vif->ssid, 0, sizeof(vif->ssid));
536 vif->ssid_len = sme->ssid_len;
537 memcpy(vif->ssid, sme->ssid, sme->ssid_len);
540 vif->ch_hint = sme->channel->center_freq;
542 memset(vif->req_bssid, 0, sizeof(vif->req_bssid));
544 memcpy(vif->req_bssid, sme->bssid, sizeof(vif->req_bssid));
546 ath6kl_set_wpa_version(vif, sme->crypto.wpa_versions);
548 status = ath6kl_set_auth_type(vif, sme->auth_type);
555 ath6kl_set_cipher(vif, sme->crypto.ciphers_pairwise[0], true);
557 ath6kl_set_cipher(vif, 0, true);
559 ath6kl_set_cipher(vif, sme->crypto.cipher_group, false);
562 ath6kl_set_key_mgmt(vif, sme->crypto.akm_suites[0]);
565 (vif->auth_mode == NONE_AUTH) &&
566 (vif->prwise_crypto == WEP_CRYPT)) {
576 key = &vif->keys[sme->key_idx];
579 key->cipher = vif->prwise_crypto;
580 vif->def_txkey_index = sme->key_idx;
582 ath6kl_wmi_addkey_cmd(ar->wmi, vif->fw_vif_idx, sme->key_idx,
583 vif->prwise_crypto,
592 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags);
593 if (ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx,
601 vif->nw_type = vif->next_mode;
604 ath6kl_cfg80211_sta_bmiss_enhance(vif, true);
606 if (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT)
614 vif->auth_mode, vif->dot11_auth_mode, vif->prwise_crypto,
615 vif->prwise_crypto_len, vif->grp_crypto,
616 vif->grp_crypto_len, vif->ch_hint);
618 vif->reconnect_flag = 0;
620 if (vif->nw_type == INFRA_NETWORK) {
621 interval = max_t(u16, vif->listen_intvl_t,
623 status = ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx,
633 status = ath6kl_wmi_connect_cmd(ar->wmi, vif->fw_vif_idx, vif->nw_type,
634 vif->dot11_auth_mode, vif->auth_mode,
635 vif->prwise_crypto,
636 vif->prwise_crypto_len,
637 vif->grp_crypto, vif->grp_crypto_len,
638 vif->ssid_len, vif->ssid,
639 vif->req_bssid, vif->ch_hint,
650 ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, 0, 0,
656 memset(vif->ssid, 0, sizeof(vif->ssid));
657 vif->ssid_len = 0;
666 ((vif->auth_mode == WPA_PSK_AUTH) ||
667 (vif->auth_mode == WPA2_PSK_AUTH))) {
668 mod_timer(&vif->disconnect_timer,
673 set_bit(CONNECT_PEND, &vif->flags);
679 ath6kl_add_bss_if_needed(struct ath6kl_vif *vif,
686 struct ath6kl *ar = vif->ar;
701 vif->ssid, vif->ssid_len,
712 ie = kmalloc(2 + vif->ssid_len + beacon_ie_len, GFP_KERNEL);
716 ie[1] = vif->ssid_len;
717 memcpy(ie + 2, vif->ssid, vif->ssid_len);
718 memcpy(ie + 2 + vif->ssid_len, beacon_ie, beacon_ie_len);
722 ie, 2 + vif->ssid_len + beacon_ie_len,
735 void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
743 struct ath6kl *ar = vif->ar;
763 vif->assoc_bss_beacon_int = beacon_intvl;
764 clear_bit(DTIM_PERIOD_AVAIL, &vif->flags);
767 if (vif->wdev.iftype != NL80211_IFTYPE_ADHOC) {
775 if (vif->wdev.iftype != NL80211_IFTYPE_STATION &&
776 vif->wdev.iftype != NL80211_IFTYPE_P2P_CLIENT) {
785 bss = ath6kl_add_bss_if_needed(vif, nw_type, bssid, chan,
795 cfg80211_ibss_joined(vif->ndev, bssid, chan, GFP_KERNEL);
800 if (vif->sme_state == SME_CONNECTING) {
802 vif->sme_state = SME_CONNECTED;
803 cfg80211_connect_result(vif->ndev, bssid,
808 } else if (vif->sme_state == SME_CONNECTED) {
817 cfg80211_roamed(vif->ndev, &roam_info, GFP_KERNEL);
825 struct ath6kl_vif *vif = netdev_priv(dev);
830 ath6kl_cfg80211_sscan_disable(vif);
832 if (!ath6kl_cfg80211_ready(vif))
845 vif->reconnect_flag = 0;
846 ath6kl_disconnect(vif);
847 memset(vif->ssid, 0, sizeof(vif->ssid));
848 vif->ssid_len = 0;
851 memset(vif->req_bssid, 0, sizeof(vif->req_bssid));
858 void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason,
862 struct ath6kl *ar = vif->ar;
864 if (vif->scan_req) {
869 cfg80211_scan_done(vif->scan_req, &info);
870 vif->scan_req = NULL;
873 if (vif->nw_type & ADHOC_NETWORK) {
874 if (vif->wdev.iftype != NL80211_IFTYPE_ADHOC)
880 if (vif->nw_type & INFRA_NETWORK) {
881 if (vif->wdev.iftype != NL80211_IFTYPE_STATION &&
882 vif->wdev.iftype != NL80211_IFTYPE_P2P_CLIENT) {
889 clear_bit(CONNECT_PEND, &vif->flags);
891 if (vif->sme_state == SME_CONNECTING) {
892 cfg80211_connect_result(vif->ndev,
897 } else if (vif->sme_state == SME_CONNECTED) {
898 cfg80211_disconnected(vif->ndev, proto_reason,
902 vif->sme_state = SME_DISCONNECTED;
913 ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx);
917 struct ath6kl_vif *vif,
979 ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i,
987 ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i,
997 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(request->wdev);
998 struct ath6kl *ar = ath6kl_priv(vif->ndev);
1004 if (!ath6kl_cfg80211_ready(vif))
1007 ath6kl_cfg80211_sscan_disable(vif);
1010 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags);
1011 ret = ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx,
1019 ret = ath6kl_set_probed_ssids(ar, vif, request->ssids,
1025 ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx,
1054 if (test_bit(CONNECTED, &vif->flags))
1057 vif->scan_req = request;
1059 ret = ath6kl_wmi_beginscan_cmd(ar->wmi, vif->fw_vif_idx,
1068 vif->scan_req = NULL;
1076 void ath6kl_cfg80211_scan_complete_event(struct ath6kl_vif *vif, bool aborted)
1078 struct ath6kl *ar = vif->ar;
1087 if (!vif->scan_req)
1093 if (vif->scan_req->n_ssids && vif->scan_req->ssids[0].ssid_len) {
1094 for (i = 0; i < vif->scan_req->n_ssids; i++) {
1095 ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx,
1102 cfg80211_scan_done(vif->scan_req, &info);
1103 vif->scan_req = NULL;
1106 void ath6kl_cfg80211_ch_switch_notify(struct ath6kl_vif *vif, int freq,
1113 vif->nw_type, freq, mode);
1116 ieee80211_get_channel(vif->ar->wiphy, freq),
1121 mutex_lock(&vif->wdev.mtx);
1122 cfg80211_ch_switch_notify(vif->ndev, &chandef);
1123 mutex_unlock(&vif->wdev.mtx);
1132 struct ath6kl_vif *vif = netdev_priv(ndev);
1138 if (!ath6kl_cfg80211_ready(vif))
1144 return ath6kl_wmi_add_krk_cmd(ar->wmi, vif->fw_vif_idx,
1155 key = &vif->keys[key_index];
1200 if (((vif->auth_mode == WPA_PSK_AUTH) ||
1201 (vif->auth_mode == WPA2_PSK_AUTH)) &&
1203 del_timer(&vif->disconnect_timer);
1210 if (vif->nw_type == AP_NETWORK && !pairwise &&
1218 if (!test_bit(CONNECTED, &vif->flags)) {
1229 if (vif->next_mode == AP_NETWORK && key_type == WEP_CRYPT &&
1230 !test_bit(CONNECTED, &vif->flags)) {
1238 vif->wep_key_list[key_index].key_len = key->key_len;
1239 memcpy(vif->wep_key_list[key_index].key, key->key,
1244 return ath6kl_wmi_addkey_cmd(ar->wmi, vif->fw_vif_idx, key_index,
1256 struct ath6kl_vif *vif = netdev_priv(ndev);
1260 if (!ath6kl_cfg80211_ready(vif))
1270 if (!vif->keys[key_index].key_len) {
1276 vif->keys[key_index].key_len = 0;
1278 return ath6kl_wmi_deletekey_cmd(ar->wmi, vif->fw_vif_idx, key_index);
1287 struct ath6kl_vif *vif = netdev_priv(ndev);
1293 if (!ath6kl_cfg80211_ready(vif))
1303 key = &vif->keys[key_index];
1322 struct ath6kl_vif *vif = netdev_priv(ndev);
1329 if (!ath6kl_cfg80211_ready(vif))
1339 if (!vif->keys[key_index].key_len) {
1345 vif->def_txkey_index = key_index;
1346 key = &vif->keys[vif->def_txkey_index];
1348 if (vif->prwise_crypto == WEP_CRYPT)
1351 key_type = vif->prwise_crypto;
1353 key_type = vif->grp_crypto;
1355 if (vif->next_mode == AP_NETWORK && !test_bit(CONNECTED, &vif->flags))
1358 return ath6kl_wmi_addkey_cmd(ar->wmi, vif->fw_vif_idx,
1359 vif->def_txkey_index,
1367 void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid,
1373 cfg80211_michael_mic_failure(vif->ndev, vif->bssid,
1382 struct ath6kl_vif *vif;
1388 vif = ath6kl_vif_first(ar);
1389 if (!vif)
1392 if (!ath6kl_cfg80211_ready(vif))
1412 struct ath6kl_vif *vif;
1418 vif = ath6kl_vif_first(ar);
1419 if (!vif)
1422 if (!ath6kl_cfg80211_ready(vif))
1437 ath6kl_wmi_set_tx_pwr_cmd(ar->wmi, vif->fw_vif_idx, dbm);
1447 struct ath6kl_vif *vif;
1449 vif = ath6kl_vif_first(ar);
1450 if (!vif)
1453 if (!ath6kl_cfg80211_ready(vif))
1456 if (test_bit(CONNECTED, &vif->flags)) {
1459 if (ath6kl_wmi_get_tx_pwr_cmd(ar->wmi, vif->fw_vif_idx) != 0) {
1483 struct ath6kl_vif *vif = netdev_priv(dev);
1488 if (!ath6kl_cfg80211_ready(vif))
1499 if (ath6kl_wmi_powermode_cmd(ar->wmi, vif->fw_vif_idx,
1519 ath6kl_err("Reached maximum number of supported vif\n");
1541 struct ath6kl_vif *vif = netdev_priv(wdev->netdev);
1544 list_del(&vif->list);
1547 ath6kl_cfg80211_vif_stop(vif, test_bit(WMI_READY, &ar->flag));
1550 ath6kl_cfg80211_vif_cleanup(vif);
1561 struct ath6kl_vif *vif = netdev_priv(ndev);
1572 vif->ar->fw_capabilities) &&
1575 if (vif->ar->vif_max == 1) {
1576 if (vif->fw_vif_idx != 0)
1582 for (i = vif->ar->max_norm_iface; i < vif->ar->vif_max; i++) {
1583 if (i == vif->fw_vif_idx)
1587 if (i == vif->ar->vif_max) {
1594 ath6kl_cfg80211_sta_bmiss_enhance(vif, false);
1600 vif->next_mode = INFRA_NETWORK;
1603 vif->next_mode = ADHOC_NETWORK;
1607 vif->next_mode = AP_NETWORK;
1614 vif->wdev.iftype = type;
1624 struct ath6kl_vif *vif = netdev_priv(dev);
1627 if (!ath6kl_cfg80211_ready(vif))
1630 vif->ssid_len = ibss_param->ssid_len;
1631 memcpy(vif->ssid, ibss_param->ssid, vif->ssid_len);
1634 vif->ch_hint = ibss_param->chandef.chan->center_freq;
1646 memset(vif->req_bssid, 0, sizeof(vif->req_bssid));
1648 memcpy(vif->req_bssid, ibss_param->bssid,
1649 sizeof(vif->req_bssid));
1651 ath6kl_set_wpa_version(vif, 0);
1653 status = ath6kl_set_auth_type(vif, NL80211_AUTHTYPE_OPEN_SYSTEM);
1658 ath6kl_set_cipher(vif, WLAN_CIPHER_SUITE_WEP40, true);
1659 ath6kl_set_cipher(vif, WLAN_CIPHER_SUITE_WEP40, false);
1661 ath6kl_set_cipher(vif, 0, true);
1662 ath6kl_set_cipher(vif, 0, false);
1665 vif->nw_type = vif->next_mode;
1672 vif->auth_mode, vif->dot11_auth_mode, vif->prwise_crypto,
1673 vif->prwise_crypto_len, vif->grp_crypto,
1674 vif->grp_crypto_len, vif->ch_hint);
1676 status = ath6kl_wmi_connect_cmd(ar->wmi, vif->fw_vif_idx, vif->nw_type,
1677 vif->dot11_auth_mode, vif->auth_mode,
1678 vif->prwise_crypto,
1679 vif->prwise_crypto_len,
1680 vif->grp_crypto, vif->grp_crypto_len,
1681 vif->ssid_len, vif->ssid,
1682 vif->req_bssid, vif->ch_hint,
1684 set_bit(CONNECT_PEND, &vif->flags);
1692 struct ath6kl_vif *vif = netdev_priv(dev);
1694 if (!ath6kl_cfg80211_ready(vif))
1697 ath6kl_disconnect(vif);
1698 memset(vif->ssid, 0, sizeof(vif->ssid));
1699 vif->ssid_len = 0;
1778 struct ath6kl_vif *vif = netdev_priv(dev);
1785 if (memcmp(mac, vif->bssid, ETH_ALEN) != 0)
1791 set_bit(STATS_UPDATE_PEND, &vif->flags);
1793 ret = ath6kl_wmi_get_stats_cmd(ar->wmi, vif->fw_vif_idx);
1802 &vif->flags),
1812 if (vif->target_stats.rx_byte) {
1813 sinfo->rx_bytes = vif->target_stats.rx_byte;
1815 sinfo->rx_packets = vif->target_stats.rx_pkt;
1819 if (vif->target_stats.tx_byte) {
1820 sinfo->tx_bytes = vif->target_stats.tx_byte;
1822 sinfo->tx_packets = vif->target_stats.tx_pkt;
1826 sinfo->signal = vif->target_stats.cs_rssi;
1829 rate = vif->target_stats.tx_ucast_rate;
1862 if (test_bit(CONNECTED, &vif->flags) &&
1863 test_bit(DTIM_PERIOD_AVAIL, &vif->flags) &&
1864 vif->nw_type == INFRA_NETWORK) {
1867 sinfo->bss_param.dtim_period = vif->assoc_bss_dtim_period;
1868 sinfo->bss_param.beacon_interval = vif->assoc_bss_beacon_int;
1878 struct ath6kl_vif *vif = netdev_priv(netdev);
1880 return ath6kl_wmi_setpmkid_cmd(ar->wmi, vif->fw_vif_idx, pmksa->bssid,
1888 struct ath6kl_vif *vif = netdev_priv(netdev);
1890 return ath6kl_wmi_setpmkid_cmd(ar->wmi, vif->fw_vif_idx, pmksa->bssid,
1897 struct ath6kl_vif *vif = netdev_priv(netdev);
1899 if (test_bit(CONNECTED, &vif->flags))
1900 return ath6kl_wmi_setpmkid_cmd(ar->wmi, vif->fw_vif_idx,
1901 vif->bssid, NULL, false);
1905 static int ath6kl_wow_usr(struct ath6kl *ar, struct ath6kl_vif *vif,
1934 vif->fw_vif_idx, WOW_LIST_ID,
1960 static int ath6kl_wow_ap(struct ath6kl *ar, struct ath6kl_vif *vif)
1994 vif->fw_vif_idx, WOW_LIST_ID,
2004 vif->fw_vif_idx, WOW_LIST_ID,
2017 vif->fw_vif_idx, WOW_LIST_ID,
2027 vif->fw_vif_idx, WOW_LIST_ID,
2038 static int ath6kl_wow_sta(struct ath6kl *ar, struct ath6kl_vif *vif)
2040 struct net_device *ndev = vif->ndev;
2050 vif->fw_vif_idx, WOW_LIST_ID,
2065 vif->fw_vif_idx, WOW_LIST_ID,
2077 static int is_hsleep_mode_procsed(struct ath6kl_vif *vif)
2079 return test_bit(HOST_SLEEP_MODE_CMD_PROCESSED, &vif->flags);
2087 static int ath6kl_cfg80211_host_sleep(struct ath6kl *ar, struct ath6kl_vif *vif)
2091 clear_bit(HOST_SLEEP_MODE_CMD_PROCESSED, &vif->flags);
2093 ret = ath6kl_wmi_set_host_sleep_mode_cmd(ar->wmi, vif->fw_vif_idx,
2099 is_hsleep_mode_procsed(vif),
2126 static int ath6kl_wow_suspend_vif(struct ath6kl_vif *vif,
2129 struct ath6kl *ar = vif->ar;
2137 if (!test_bit(NETDEV_MCAST_ALL_ON, &vif->flags) &&
2140 ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi,
2141 vif->fw_vif_idx, false);
2148 ath6kl_wmi_del_wow_pattern_cmd(ar->wmi, vif->fw_vif_idx,
2157 ret = ath6kl_wow_usr(ar, vif, wow, filter);
2158 else if (vif->nw_type == AP_NETWORK)
2159 ret = ath6kl_wow_ap(ar, vif);
2161 ret = ath6kl_wow_sta(ar, vif);
2166 netif_stop_queue(vif->ndev);
2168 if (vif->nw_type != AP_NETWORK) {
2169 ret = ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx,
2180 ret = ath6kl_wmi_bmisstime_cmd(ar->wmi, vif->fw_vif_idx,
2185 ret = ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx,
2193 in_dev = __in_dev_get_rtnl(vif->ndev);
2212 ret = ath6kl_wmi_set_ip_cmd(ar->wmi, vif->fw_vif_idx, ips[0], ips[1]);
2223 struct ath6kl_vif *first_vif, *vif;
2228 /* enter / leave wow suspend on first vif always */
2237 /* install filters for each connected vif */
2239 list_for_each_entry(vif, &ar->vif_list, list) {
2240 if (!test_bit(CONNECTED, &vif->flags) ||
2241 !ath6kl_cfg80211_ready(vif))
2245 ret = ath6kl_wow_suspend_vif(vif, wow, &filter);
2268 static int ath6kl_wow_resume_vif(struct ath6kl_vif *vif)
2270 struct ath6kl *ar = vif->ar;
2273 if (vif->nw_type != AP_NETWORK) {
2274 ret = ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx,
2279 ret = ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx,
2280 vif->listen_intvl_t, 0);
2284 ret = ath6kl_wmi_bmisstime_cmd(ar->wmi, vif->fw_vif_idx,
2285 vif->bmiss_time_t, 0);
2290 if (!test_bit(NETDEV_MCAST_ALL_OFF, &vif->flags) &&
2293 ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi,
2294 vif->fw_vif_idx, true);
2299 netif_wake_queue(vif->ndev);
2306 struct ath6kl_vif *vif;
2309 vif = ath6kl_vif_first(ar);
2310 if (WARN_ON(!vif) ||
2311 !ath6kl_cfg80211_ready(vif))
2316 ret = ath6kl_wmi_set_host_sleep_mode_cmd(ar->wmi, vif->fw_vif_idx,
2325 list_for_each_entry(vif, &ar->vif_list, list) {
2326 if (!test_bit(CONNECTED, &vif->flags) ||
2327 !ath6kl_cfg80211_ready(vif))
2329 ret = ath6kl_wow_resume_vif(vif);
2348 struct ath6kl_vif *vif;
2351 vif = ath6kl_vif_first(ar);
2352 if (!vif)
2370 ret = ath6kl_wmi_set_wow_mode_cmd(ar->wmi, vif->fw_vif_idx,
2379 ret = ath6kl_cfg80211_host_sleep(ar, vif);
2388 struct ath6kl_vif *vif;
2391 vif = ath6kl_vif_first(ar);
2393 if (!vif)
2403 ret = ath6kl_wmi_set_host_sleep_mode_cmd(ar->wmi, vif->fw_vif_idx,
2411 ret = ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx,
2423 struct ath6kl_vif *vif;
2486 list_for_each_entry(vif, &ar->vif_list, list)
2487 ath6kl_cfg80211_scan_complete_event(vif, true);
2596 static int ath6kl_set_htcap(struct ath6kl_vif *vif, enum nl80211_band band,
2599 struct ath6kl_htcap *htcap = &vif->htcap[band];
2613 return ath6kl_wmi_set_htcap_cmd(vif->ar->wmi, vif->fw_vif_idx,
2617 static int ath6kl_restore_htcap(struct ath6kl_vif *vif)
2619 struct wiphy *wiphy = vif->ar->wiphy;
2626 ret = ath6kl_set_htcap(vif, band,
2642 static int ath6kl_set_ap_probe_resp_ies(struct ath6kl_vif *vif,
2645 struct ath6kl *ar = vif->ar;
2672 ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx,
2678 static int ath6kl_set_ies(struct ath6kl_vif *vif,
2681 struct ath6kl *ar = vif->ar;
2685 res = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx,
2693 res = ath6kl_set_ap_probe_resp_ies(vif, info->proberesp_ies,
2699 res = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx,
2765 struct ath6kl_vif *vif = netdev_priv(dev);
2777 if (!ath6kl_cfg80211_ready(vif))
2780 if (vif->next_mode != AP_NETWORK)
2783 res = ath6kl_set_ies(vif, &info->beacon);
2787 ret = ath6kl_wmi_ap_set_beacon_intvl_cmd(ar->wmi, vif->fw_vif_idx,
2793 ret = ath6kl_wmi_ap_set_dtim_cmd(ar->wmi, vif->fw_vif_idx,
2809 memcpy(vif->ssid, info->ssid, info->ssid_len);
2810 vif->ssid_len = info->ssid_len;
2814 res = ath6kl_wmi_ap_hidden_ssid(ar->wmi, vif->fw_vif_idx, hidden);
2818 ret = ath6kl_set_auth_type(vif, info->auth_type);
2842 vif->auth_mode = p.auth_mode;
2863 ath6kl_set_cipher(vif, 0, true);
2865 ath6kl_set_cipher(vif, info->crypto.ciphers_pairwise[0], true);
2886 ath6kl_set_cipher(vif, info->crypto.cipher_group, false);
2889 vif->nw_type = vif->next_mode;
2891 p.ssid_len = vif->ssid_len;
2892 memcpy(p.ssid, vif->ssid, vif->ssid_len);
2893 p.dot11_auth_mode = vif->dot11_auth_mode;
2897 res = ath6kl_wmi_ap_set_apsd(ar->wmi, vif->fw_vif_idx, true);
2901 if (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) {
2919 res = ath6kl_wmi_set_inact_period(ar->wmi, vif->fw_vif_idx,
2925 if (ath6kl_set_htcap(vif, info->chandef.chan->band,
2939 res = ath6kl_wmi_set_ie_cmd(ar->wmi, vif->fw_vif_idx,
2943 vif->rsn_capab = rsn_capab;
2948 memcpy(&vif->profile, &p, sizeof(p));
2949 res = ath6kl_wmi_ap_profile_commit(ar->wmi, vif->fw_vif_idx, &p);
2959 struct ath6kl_vif *vif = netdev_priv(dev);
2961 if (!ath6kl_cfg80211_ready(vif))
2964 if (vif->next_mode != AP_NETWORK)
2967 return ath6kl_set_ies(vif, beacon);
2973 struct ath6kl_vif *vif = netdev_priv(dev);
2975 if (vif->nw_type != AP_NETWORK)
2977 if (!test_bit(CONNECTED, &vif->flags))
2980 ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx);
2981 clear_bit(CONNECTED, &vif->flags);
2982 netif_carrier_off(vif->ndev);
2985 return ath6kl_restore_htcap(vif);
2994 struct ath6kl_vif *vif = netdev_priv(dev);
2997 return ath6kl_wmi_ap_set_mlme(ar->wmi, vif->fw_vif_idx, WMI_AP_DEAUTH,
3006 struct ath6kl_vif *vif = netdev_priv(dev);
3009 if (vif->nw_type != AP_NETWORK)
3018 return ath6kl_wmi_ap_set_mlme(ar->wmi, vif->fw_vif_idx,
3020 return ath6kl_wmi_ap_set_mlme(ar->wmi, vif->fw_vif_idx,
3030 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev);
3031 struct ath6kl *ar = ath6kl_priv(vif->ndev);
3036 id = ++vif->last_roc_id;
3039 id = ++vif->last_roc_id;
3043 return ath6kl_wmi_remain_on_chnl_cmd(ar->wmi, vif->fw_vif_idx,
3051 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev);
3052 struct ath6kl *ar = ath6kl_priv(vif->ndev);
3054 if (cookie != vif->last_roc_id)
3056 vif->last_cancel_roc_id = cookie;
3058 return ath6kl_wmi_cancel_remain_on_chnl_cmd(ar->wmi, vif->fw_vif_idx);
3061 static int ath6kl_send_go_probe_resp(struct ath6kl_vif *vif,
3065 struct ath6kl *ar = vif->ar;
3092 ret = ath6kl_wmi_send_probe_response_cmd(ar->wmi, vif->fw_vif_idx, freq,
3098 static bool ath6kl_mgmt_powersave_ap(struct ath6kl_vif *vif,
3112 struct ath6kl *ar = vif->ar;
3118 conn = ath6kl_find_sta(vif, mgmt->da);
3150 ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx,
3186 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev);
3187 struct ath6kl *ar = ath6kl_priv(vif->ndev);
3200 freq = vif->ch_hint;
3209 if (vif->nw_type == AP_NETWORK && test_bit(CONNECTED, &vif->flags) &&
3217 return ath6kl_send_go_probe_resp(vif, buf, len, freq);
3220 id = vif->send_action_id++;
3226 id = vif->send_action_id++;
3232 if (vif->nw_type == AP_NETWORK) {
3233 queued = ath6kl_mgmt_powersave_ap(vif, id, freq, wait, buf, len,
3239 return ath6kl_wmi_send_mgmt_cmd(ar->wmi, vif->fw_vif_idx, id, freq,
3256 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev);
3263 vif->probe_req_report =
3272 struct ath6kl_vif *vif = netdev_priv(dev);
3288 if (vif->sme_state != SME_DISCONNECTED)
3291 ath6kl_cfg80211_scan_complete_event(vif, true);
3293 ret = ath6kl_set_probed_ssids(ar, vif, request->ssids,
3301 ret = ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx,
3306 ret = ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx,
3321 ret = ath6kl_wmi_set_rssi_filter_cmd(ar->wmi, vif->fw_vif_idx,
3332 ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx,
3334 vif->bg_scan_period, 0, 0, 0, 3, 0, 0, 0);
3337 ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx,
3346 ret = ath6kl_wmi_enable_sched_scan_cmd(ar->wmi, vif->fw_vif_idx, true);
3350 set_bit(SCHED_SCANNING, &vif->flags);
3358 struct ath6kl_vif *vif = netdev_priv(dev);
3361 stopped = __ath6kl_cfg80211_sscan_stop(vif);
3375 struct ath6kl_vif *vif = netdev_priv(dev);
3377 return ath6kl_wmi_set_bitrate_mask(ar->wmi, vif->fw_vif_idx,
3386 struct ath6kl_vif *vif = netdev_priv(dev);
3388 if (vif->nw_type != INFRA_NETWORK ||
3392 if (vif->sme_state != SME_CONNECTED)
3396 vif->txe_intvl = intvl;
3398 return ath6kl_wmi_set_txe_notify(ar->wmi, vif->fw_vif_idx,
3473 void ath6kl_cfg80211_stop(struct ath6kl_vif *vif)
3475 ath6kl_cfg80211_sscan_disable(vif);
3477 switch (vif->sme_state) {
3481 cfg80211_connect_result(vif->ndev, vif->bssid, NULL, 0,
3487 cfg80211_disconnected(vif->ndev, 0, NULL, 0, true, GFP_KERNEL);
3491 if (vif->ar->state != ATH6KL_STATE_RECOVERY &&
3492 (test_bit(CONNECTED, &vif->flags) ||
3493 test_bit(CONNECT_PEND, &vif->flags)))
3494 ath6kl_wmi_disconnect_cmd(vif->ar->wmi, vif->fw_vif_idx);
3496 vif->sme_state = SME_DISCONNECTED;
3497 clear_bit(CONNECTED, &vif->flags);
3498 clear_bit(CONNECT_PEND, &vif->flags);
3501 netif_stop_queue(vif->ndev);
3502 netif_carrier_off(vif->ndev);
3505 if (vif->ar->state != ATH6KL_STATE_RECOVERY &&
3506 ath6kl_wmi_scanparams_cmd(vif->ar->wmi, vif->fw_vif_idx, 0xFFFF,
3510 ath6kl_cfg80211_scan_complete_event(vif, true);
3515 struct ath6kl_vif *vif;
3517 vif = ath6kl_vif_first(ar);
3518 if (!vif && ar->state != ATH6KL_STATE_RECOVERY) {
3532 list_for_each_entry(vif, &ar->vif_list, list)
3533 ath6kl_cfg80211_stop(vif);
3580 static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif)
3582 vif->aggr_cntxt = aggr_init(vif);
3583 if (!vif->aggr_cntxt) {
3588 timer_setup(&vif->disconnect_timer, disconnect_timer_handler, 0);
3589 timer_setup(&vif->sched_scan_timer, ath6kl_wmi_sscan_timer, 0);
3591 set_bit(WMM_ENABLED, &vif->flags);
3592 spin_lock_init(&vif->if_lock);
3594 INIT_LIST_HEAD(&vif->mc_filter);
3599 void ath6kl_cfg80211_vif_stop(struct ath6kl_vif *vif, bool wmi_ready)
3604 netif_stop_queue(vif->ndev);
3606 clear_bit(WLAN_ENABLED, &vif->flags);
3609 discon_issued = test_bit(CONNECTED, &vif->flags) ||
3610 test_bit(CONNECT_PEND, &vif->flags);
3611 ath6kl_disconnect(vif);
3612 del_timer(&vif->disconnect_timer);
3615 ath6kl_disconnect_event(vif, DISCONNECT_CMD,
3616 (vif->nw_type & AP_NETWORK) ?
3617 bcast_mac : vif->bssid,
3621 if (vif->scan_req) {
3626 cfg80211_scan_done(vif->scan_req, &info);
3627 vif->scan_req = NULL;
3631 ath6kl_cfg80211_sta_bmiss_enhance(vif, false);
3634 void ath6kl_cfg80211_vif_cleanup(struct ath6kl_vif *vif)
3636 struct ath6kl *ar = vif->ar;
3639 aggr_module_destroy(vif->aggr_cntxt);
3641 ar->avail_idx_map |= BIT(vif->fw_vif_idx);
3643 if (vif->nw_type == ADHOC_NETWORK)
3646 list_for_each_entry_safe(mc_filter, tmp, &vif->mc_filter, list) {
3651 unregister_netdevice(vif->ndev);
3699 struct ath6kl_vif *vif = netdev_priv(dev);
3700 struct ath6kl *ar = vif->ar;
3706 ath6kl_read_tgt_stats(ar, vif);
3708 tgt_stats = &vif->target_stats;
3783 struct ath6kl_vif *vif;
3785 ndev = alloc_netdev(sizeof(*vif), name, name_assign_type, ether_setup);
3789 vif = netdev_priv(ndev);
3790 ndev->ieee80211_ptr = &vif->wdev;
3791 vif->wdev.wiphy = ar->wiphy;
3792 vif->ar = ar;
3793 vif->ndev = ndev;
3794 SET_NETDEV_DEV(ndev, wiphy_dev(vif->wdev.wiphy));
3795 vif->wdev.netdev = ndev;
3796 vif->wdev.iftype = type;
3797 vif->fw_vif_idx = fw_vif_idx;
3798 vif->nw_type = nw_type;
3799 vif->next_mode = nw_type;
3800 vif->listen_intvl_t = ATH6KL_DEFAULT_LISTEN_INTVAL;
3801 vif->bmiss_time_t = ATH6KL_DEFAULT_BMISS_TIME;
3802 vif->bg_scan_period = 0;
3803 vif->htcap[NL80211_BAND_2GHZ].ht_enable = true;
3804 vif->htcap[NL80211_BAND_5GHZ].ht_enable = true;
3817 ath6kl_init_control_info(vif);
3819 if (ath6kl_cfg80211_vif_init(vif))
3828 vif->sme_state = SME_DISCONNECTED;
3829 set_bit(WLAN_ENABLED, &vif->flags);
3836 list_add_tail(&vif->list, &ar->vif_list);
3839 return &vif->wdev;
3842 aggr_module_destroy(vif->aggr_cntxt);