aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorVasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>2011-10-25 10:04:01 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2011-11-11 05:58:47 -0500
commit59c98449b8af405aa6245ea9f640c5847f42d26e (patch)
tree4da0ceca0fbc1e332cd9f9116975b8765729572f /drivers/net
parent108438bc6ad16b3962aa5009123cd810d1c1f643 (diff)
ath6kl: Define interface specific states
Currently ar->flag maintains interface stats. Move interface specific states from ar->flag to vif->flags. Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c66
-rw-r--r--drivers/net/wireless/ath/ath6kl/core.h41
-rw-r--r--drivers/net/wireless/ath/ath6kl/init.c3
-rw-r--r--drivers/net/wireless/ath/ath6kl/main.c64
-rw-r--r--drivers/net/wireless/ath/ath6kl/txrx.c23
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.c12
6 files changed, 133 insertions, 76 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index b6b3112e57ef..4d56a3419c61 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -231,12 +231,14 @@ static void ath6kl_set_key_mgmt(struct ath6kl *ar, u32 key_mgmt)
231 231
232static bool ath6kl_cfg80211_ready(struct ath6kl *ar) 232static bool ath6kl_cfg80211_ready(struct ath6kl *ar)
233{ 233{
234 struct ath6kl_vif *vif = ar->vif;
235
234 if (!test_bit(WMI_READY, &ar->flag)) { 236 if (!test_bit(WMI_READY, &ar->flag)) {
235 ath6kl_err("wmi is not ready\n"); 237 ath6kl_err("wmi is not ready\n");
236 return false; 238 return false;
237 } 239 }
238 240
239 if (!test_bit(WLAN_ENABLED, &ar->flag)) { 241 if (!test_bit(WLAN_ENABLED, &vif->flags)) {
240 ath6kl_err("wlan disabled\n"); 242 ath6kl_err("wlan disabled\n");
241 return false; 243 return false;
242 } 244 }
@@ -295,6 +297,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
295 struct cfg80211_connect_params *sme) 297 struct cfg80211_connect_params *sme)
296{ 298{
297 struct ath6kl *ar = ath6kl_priv(dev); 299 struct ath6kl *ar = ath6kl_priv(dev);
300 struct ath6kl_vif *vif = netdev_priv(dev);
298 int status; 301 int status;
299 302
300 ar->sme_state = SME_CONNECTING; 303 ar->sme_state = SME_CONNECTING;
@@ -345,7 +348,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
345 return status; 348 return status;
346 } 349 }
347 350
348 if (test_bit(CONNECTED, &ar->flag) && 351 if (test_bit(CONNECTED, &vif->flags) &&
349 ar->ssid_len == sme->ssid_len && 352 ar->ssid_len == sme->ssid_len &&
350 !memcmp(ar->ssid, sme->ssid, ar->ssid_len)) { 353 !memcmp(ar->ssid, sme->ssid, ar->ssid_len)) {
351 ar->reconnect_flag = true; 354 ar->reconnect_flag = true;
@@ -420,7 +423,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
420 } 423 }
421 424
422 if (!ar->usr_bss_filter) { 425 if (!ar->usr_bss_filter) {
423 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &ar->flag); 426 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags);
424 if (ath6kl_wmi_bssfilter_cmd(ar->wmi, ALL_BSS_FILTER, 0) != 0) { 427 if (ath6kl_wmi_bssfilter_cmd(ar->wmi, ALL_BSS_FILTER, 0) != 0) {
425 ath6kl_err("couldn't set bss filtering\n"); 428 ath6kl_err("couldn't set bss filtering\n");
426 up(&ar->sem); 429 up(&ar->sem);
@@ -469,7 +472,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
469 } 472 }
470 473
471 ar->connect_ctrl_flags &= ~CONNECT_DO_WPA_OFFLOAD; 474 ar->connect_ctrl_flags &= ~CONNECT_DO_WPA_OFFLOAD;
472 set_bit(CONNECT_PEND, &ar->flag); 475 set_bit(CONNECT_PEND, &vif->flags);
473 476
474 return 0; 477 return 0;
475} 478}
@@ -529,6 +532,8 @@ void ath6kl_cfg80211_connect_event(struct ath6kl *ar, u16 channel,
529 u8 assoc_resp_len, u8 *assoc_info) 532 u8 assoc_resp_len, u8 *assoc_info)
530{ 533{
531 struct ieee80211_channel *chan; 534 struct ieee80211_channel *chan;
535 /* TODO: Findout vif */
536 struct ath6kl_vif *vif = ar->vif;
532 537
533 /* capinfo + listen interval */ 538 /* capinfo + listen interval */
534 u8 assoc_req_ie_offset = sizeof(u16) + sizeof(u16); 539 u8 assoc_req_ie_offset = sizeof(u16) + sizeof(u16);
@@ -548,7 +553,7 @@ void ath6kl_cfg80211_connect_event(struct ath6kl *ar, u16 channel,
548 * a Beacon frame from the AP is seen. 553 * a Beacon frame from the AP is seen.
549 */ 554 */
550 ar->assoc_bss_beacon_int = beacon_intvl; 555 ar->assoc_bss_beacon_int = beacon_intvl;
551 clear_bit(DTIM_PERIOD_AVAIL, &ar->flag); 556 clear_bit(DTIM_PERIOD_AVAIL, &vif->flags);
552 557
553 if (nw_type & ADHOC_NETWORK) { 558 if (nw_type & ADHOC_NETWORK) {
554 if (ar->wdev->iftype != NL80211_IFTYPE_ADHOC) { 559 if (ar->wdev->iftype != NL80211_IFTYPE_ADHOC) {
@@ -637,6 +642,9 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl *ar, u8 reason,
637 u8 *bssid, u8 assoc_resp_len, 642 u8 *bssid, u8 assoc_resp_len,
638 u8 *assoc_info, u16 proto_reason) 643 u8 *assoc_info, u16 proto_reason)
639{ 644{
645 /* TODO: Findout vif */
646 struct ath6kl_vif *vif = ar->vif;
647
640 if (ar->scan_req) { 648 if (ar->scan_req) {
641 cfg80211_scan_done(ar->scan_req, true); 649 cfg80211_scan_done(ar->scan_req, true);
642 ar->scan_req = NULL; 650 ar->scan_req = NULL;
@@ -676,7 +684,7 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl *ar, u8 reason,
676 return; 684 return;
677 } 685 }
678 686
679 clear_bit(CONNECT_PEND, &ar->flag); 687 clear_bit(CONNECT_PEND, &vif->flags);
680 688
681 if (ar->sme_state == SME_CONNECTING) { 689 if (ar->sme_state == SME_CONNECTING) {
682 cfg80211_connect_result(ar->net_dev, 690 cfg80211_connect_result(ar->net_dev,
@@ -696,6 +704,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
696 struct cfg80211_scan_request *request) 704 struct cfg80211_scan_request *request)
697{ 705{
698 struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(ndev); 706 struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(ndev);
707 struct ath6kl_vif *vif = netdev_priv(ndev);
699 s8 n_channels = 0; 708 s8 n_channels = 0;
700 u16 *channels = NULL; 709 u16 *channels = NULL;
701 int ret = 0; 710 int ret = 0;
@@ -705,10 +714,10 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
705 return -EIO; 714 return -EIO;
706 715
707 if (!ar->usr_bss_filter) { 716 if (!ar->usr_bss_filter) {
708 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &ar->flag); 717 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags);
709 ret = ath6kl_wmi_bssfilter_cmd( 718 ret = ath6kl_wmi_bssfilter_cmd(
710 ar->wmi, 719 ar->wmi,
711 (test_bit(CONNECTED, &ar->flag) ? 720 (test_bit(CONNECTED, &vif->flags) ?
712 ALL_BUT_BSS_FILTER : ALL_BSS_FILTER), 0); 721 ALL_BUT_BSS_FILTER : ALL_BSS_FILTER), 0);
713 if (ret) { 722 if (ret) {
714 ath6kl_err("couldn't set bss filtering\n"); 723 ath6kl_err("couldn't set bss filtering\n");
@@ -761,7 +770,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
761 channels[i] = request->channels[i]->center_freq; 770 channels[i] = request->channels[i]->center_freq;
762 } 771 }
763 772
764 if (test_bit(CONNECTED, &ar->flag)) 773 if (test_bit(CONNECTED, &vif->flags))
765 force_fg_scan = 1; 774 force_fg_scan = 1;
766 775
767 ret = ath6kl_wmi_startscan_cmd(ar->wmi, WMI_LONG_SCAN, force_fg_scan, 776 ret = ath6kl_wmi_startscan_cmd(ar->wmi, WMI_LONG_SCAN, force_fg_scan,
@@ -810,6 +819,7 @@ static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
810 struct key_params *params) 819 struct key_params *params)
811{ 820{
812 struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(ndev); 821 struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(ndev);
822 struct ath6kl_vif *vif = netdev_priv(ndev);
813 struct ath6kl_key *key = NULL; 823 struct ath6kl_key *key = NULL;
814 u8 key_usage; 824 u8 key_usage;
815 u8 key_type; 825 u8 key_type;
@@ -888,7 +898,7 @@ static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
888 ar->ap_mode_bkey.key_type = key_type; 898 ar->ap_mode_bkey.key_type = key_type;
889 ar->ap_mode_bkey.key_len = key->key_len; 899 ar->ap_mode_bkey.key_len = key->key_len;
890 memcpy(ar->ap_mode_bkey.key, key->key, key->key_len); 900 memcpy(ar->ap_mode_bkey.key, key->key, key->key_len);
891 if (!test_bit(CONNECTED, &ar->flag)) { 901 if (!test_bit(CONNECTED, &vif->flags)) {
892 ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "Delay initial group " 902 ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "Delay initial group "
893 "key configuration until AP mode has been " 903 "key configuration until AP mode has been "
894 "started\n"); 904 "started\n");
@@ -901,7 +911,7 @@ static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
901 } 911 }
902 912
903 if (ar->next_mode == AP_NETWORK && key_type == WEP_CRYPT && 913 if (ar->next_mode == AP_NETWORK && key_type == WEP_CRYPT &&
904 !test_bit(CONNECTED, &ar->flag)) { 914 !test_bit(CONNECTED, &vif->flags)) {
905 /* 915 /*
906 * Store the key locally so that it can be re-configured after 916 * Store the key locally so that it can be re-configured after
907 * the AP mode has properly started 917 * the AP mode has properly started
@@ -995,6 +1005,7 @@ static int ath6kl_cfg80211_set_default_key(struct wiphy *wiphy,
995 bool multicast) 1005 bool multicast)
996{ 1006{
997 struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(ndev); 1007 struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(ndev);
1008 struct ath6kl_vif *vif = netdev_priv(ndev);
998 struct ath6kl_key *key = NULL; 1009 struct ath6kl_key *key = NULL;
999 int status = 0; 1010 int status = 0;
1000 u8 key_usage; 1011 u8 key_usage;
@@ -1028,7 +1039,7 @@ static int ath6kl_cfg80211_set_default_key(struct wiphy *wiphy,
1028 if (multicast) 1039 if (multicast)
1029 key_type = ar->grp_crypto; 1040 key_type = ar->grp_crypto;
1030 1041
1031 if (ar->next_mode == AP_NETWORK && !test_bit(CONNECTED, &ar->flag)) 1042 if (ar->next_mode == AP_NETWORK && !test_bit(CONNECTED, &vif->flags))
1032 return 0; /* Delay until AP mode has been started */ 1043 return 0; /* Delay until AP mode has been started */
1033 1044
1034 status = ath6kl_wmi_addkey_cmd(ar->wmi, ar->def_txkey_index, 1045 status = ath6kl_wmi_addkey_cmd(ar->wmi, ar->def_txkey_index,
@@ -1113,11 +1124,12 @@ static int ath6kl_cfg80211_set_txpower(struct wiphy *wiphy,
1113static int ath6kl_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm) 1124static int ath6kl_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm)
1114{ 1125{
1115 struct ath6kl *ar = (struct ath6kl *)wiphy_priv(wiphy); 1126 struct ath6kl *ar = (struct ath6kl *)wiphy_priv(wiphy);
1127 struct ath6kl_vif *vif = ar->vif;
1116 1128
1117 if (!ath6kl_cfg80211_ready(ar)) 1129 if (!ath6kl_cfg80211_ready(ar))
1118 return -EIO; 1130 return -EIO;
1119 1131
1120 if (test_bit(CONNECTED, &ar->flag)) { 1132 if (test_bit(CONNECTED, &vif->flags)) {
1121 ar->tx_pwr = 0; 1133 ar->tx_pwr = 0;
1122 1134
1123 if (ath6kl_wmi_get_tx_pwr_cmd(ar->wmi) != 0) { 1135 if (ath6kl_wmi_get_tx_pwr_cmd(ar->wmi) != 0) {
@@ -1211,6 +1223,7 @@ static int ath6kl_cfg80211_join_ibss(struct wiphy *wiphy,
1211 struct cfg80211_ibss_params *ibss_param) 1223 struct cfg80211_ibss_params *ibss_param)
1212{ 1224{
1213 struct ath6kl *ar = ath6kl_priv(dev); 1225 struct ath6kl *ar = ath6kl_priv(dev);
1226 struct ath6kl_vif *vif = netdev_priv(dev);
1214 int status; 1227 int status;
1215 1228
1216 if (!ath6kl_cfg80211_ready(ar)) 1229 if (!ath6kl_cfg80211_ready(ar))
@@ -1269,7 +1282,7 @@ static int ath6kl_cfg80211_join_ibss(struct wiphy *wiphy,
1269 ar->ssid_len, ar->ssid, 1282 ar->ssid_len, ar->ssid,
1270 ar->req_bssid, ar->ch_hint, 1283 ar->req_bssid, ar->ch_hint,
1271 ar->connect_ctrl_flags); 1284 ar->connect_ctrl_flags);
1272 set_bit(CONNECT_PEND, &ar->flag); 1285 set_bit(CONNECT_PEND, &vif->flags);
1273 1286
1274 return 0; 1287 return 0;
1275} 1288}
@@ -1362,6 +1375,7 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev,
1362 u8 *mac, struct station_info *sinfo) 1375 u8 *mac, struct station_info *sinfo)
1363{ 1376{
1364 struct ath6kl *ar = ath6kl_priv(dev); 1377 struct ath6kl *ar = ath6kl_priv(dev);
1378 struct ath6kl_vif *vif = netdev_priv(dev);
1365 long left; 1379 long left;
1366 bool sgi; 1380 bool sgi;
1367 s32 rate; 1381 s32 rate;
@@ -1444,8 +1458,8 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev,
1444 1458
1445 sinfo->filled |= STATION_INFO_TX_BITRATE; 1459 sinfo->filled |= STATION_INFO_TX_BITRATE;
1446 1460
1447 if (test_bit(CONNECTED, &ar->flag) && 1461 if (test_bit(CONNECTED, &vif->flags) &&
1448 test_bit(DTIM_PERIOD_AVAIL, &ar->flag) && 1462 test_bit(DTIM_PERIOD_AVAIL, &vif->flags) &&
1449 ar->nw_type == INFRA_NETWORK) { 1463 ar->nw_type == INFRA_NETWORK) {
1450 sinfo->filled |= STATION_INFO_BSS_PARAM; 1464 sinfo->filled |= STATION_INFO_BSS_PARAM;
1451 sinfo->bss_param.flags = 0; 1465 sinfo->bss_param.flags = 0;
@@ -1475,7 +1489,9 @@ static int ath6kl_del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
1475static int ath6kl_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) 1489static int ath6kl_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
1476{ 1490{
1477 struct ath6kl *ar = ath6kl_priv(netdev); 1491 struct ath6kl *ar = ath6kl_priv(netdev);
1478 if (test_bit(CONNECTED, &ar->flag)) 1492 struct ath6kl_vif *vif = netdev_priv(netdev);
1493
1494 if (test_bit(CONNECTED, &vif->flags))
1479 return ath6kl_wmi_setpmkid_cmd(ar->wmi, ar->bssid, NULL, false); 1495 return ath6kl_wmi_setpmkid_cmd(ar->wmi, ar->bssid, NULL, false);
1480 return 0; 1496 return 0;
1481} 1497}
@@ -1711,14 +1727,15 @@ static int ath6kl_set_beacon(struct wiphy *wiphy, struct net_device *dev,
1711static int ath6kl_del_beacon(struct wiphy *wiphy, struct net_device *dev) 1727static int ath6kl_del_beacon(struct wiphy *wiphy, struct net_device *dev)
1712{ 1728{
1713 struct ath6kl *ar = ath6kl_priv(dev); 1729 struct ath6kl *ar = ath6kl_priv(dev);
1730 struct ath6kl_vif *vif = netdev_priv(dev);
1714 1731
1715 if (ar->nw_type != AP_NETWORK) 1732 if (ar->nw_type != AP_NETWORK)
1716 return -EOPNOTSUPP; 1733 return -EOPNOTSUPP;
1717 if (!test_bit(CONNECTED, &ar->flag)) 1734 if (!test_bit(CONNECTED, &vif->flags))
1718 return -ENOTCONN; 1735 return -ENOTCONN;
1719 1736
1720 ath6kl_wmi_disconnect_cmd(ar->wmi); 1737 ath6kl_wmi_disconnect_cmd(ar->wmi);
1721 clear_bit(CONNECTED, &ar->flag); 1738 clear_bit(CONNECTED, &vif->flags);
1722 1739
1723 return 0; 1740 return 0;
1724} 1741}
@@ -1814,12 +1831,13 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
1814 bool dont_wait_for_ack, u64 *cookie) 1831 bool dont_wait_for_ack, u64 *cookie)
1815{ 1832{
1816 struct ath6kl *ar = ath6kl_priv(dev); 1833 struct ath6kl *ar = ath6kl_priv(dev);
1834 struct ath6kl_vif *vif = netdev_priv(dev);
1817 u32 id; 1835 u32 id;
1818 const struct ieee80211_mgmt *mgmt; 1836 const struct ieee80211_mgmt *mgmt;
1819 1837
1820 mgmt = (const struct ieee80211_mgmt *) buf; 1838 mgmt = (const struct ieee80211_mgmt *) buf;
1821 if (buf + len >= mgmt->u.probe_resp.variable && 1839 if (buf + len >= mgmt->u.probe_resp.variable &&
1822 ar->nw_type == AP_NETWORK && test_bit(CONNECTED, &ar->flag) && 1840 ar->nw_type == AP_NETWORK && test_bit(CONNECTED, &vif->flags) &&
1823 ieee80211_is_probe_resp(mgmt->frame_control)) { 1841 ieee80211_is_probe_resp(mgmt->frame_control)) {
1824 /* 1842 /*
1825 * Send Probe Response frame in AP mode using a separate WMI 1843 * Send Probe Response frame in AP mode using a separate WMI
@@ -2039,9 +2057,9 @@ void ath6kl_deinit_if_data(struct ath6kl_vif *vif)
2039 2057
2040 ar->aggr_cntxt = NULL; 2058 ar->aggr_cntxt = NULL;
2041 2059
2042 if (test_bit(NETDEV_REGISTERED, &ar->flag)) { 2060 if (test_bit(NETDEV_REGISTERED, &vif->flags)) {
2043 unregister_netdev(vif->ndev); 2061 unregister_netdev(vif->ndev);
2044 clear_bit(NETDEV_REGISTERED, &ar->flag); 2062 clear_bit(NETDEV_REGISTERED, &vif->flags);
2045 } 2063 }
2046 2064
2047 free_netdev(vif->ndev); 2065 free_netdev(vif->ndev);
@@ -2081,9 +2099,9 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
2081 goto err; 2099 goto err;
2082 2100
2083 ar->sme_state = SME_DISCONNECTED; 2101 ar->sme_state = SME_DISCONNECTED;
2084 set_bit(WLAN_ENABLED, &ar->flag); 2102 set_bit(WLAN_ENABLED, &vif->flags);
2085 ar->wlan_pwr_state = WLAN_POWER_STATE_ON; 2103 ar->wlan_pwr_state = WLAN_POWER_STATE_ON;
2086 set_bit(NETDEV_REGISTERED, &ar->flag); 2104 set_bit(NETDEV_REGISTERED, &vif->flags);
2087 2105
2088 return ndev; 2106 return ndev;
2089 2107
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index 0c1dee07653d..477717199ca6 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -380,30 +380,37 @@ struct ath6kl_req_key {
380 u8 key_len; 380 u8 key_len;
381}; 381};
382 382
383/* vif flags info */
384enum ath6kl_vif_state {
385 CONNECTED,
386 CONNECT_PEND,
387 WMM_ENABLED,
388 NETQ_STOPPED,
389 DTIM_EXPIRED,
390 NETDEV_REGISTERED,
391 CLEAR_BSSFILTER_ON_BEACON,
392 DTIM_PERIOD_AVAIL,
393 WLAN_ENABLED,
394};
395
383struct ath6kl_vif { 396struct ath6kl_vif {
384 struct wireless_dev wdev; 397 struct wireless_dev wdev;
385 struct net_device *ndev; 398 struct net_device *ndev;
386 struct ath6kl *ar; 399 struct ath6kl *ar;
400 unsigned long flags;
387}; 401};
388 402
389/* Flag info */ 403/* Flag info */
390#define WMI_ENABLED 0 404enum ath6kl_dev_state {
391#define WMI_READY 1 405 WMI_ENABLED,
392#define CONNECTED 2 406 WMI_READY,
393#define STATS_UPDATE_PEND 3 407 WMI_CTRL_EP_FULL,
394#define CONNECT_PEND 4 408 TESTMODE,
395#define WMM_ENABLED 5 409 DESTROY_IN_PROGRESS,
396#define NETQ_STOPPED 6 410 SKIP_SCAN,
397#define WMI_CTRL_EP_FULL 7 411 STATS_UPDATE_PEND,
398#define DTIM_EXPIRED 8 412 ROAM_TBL_PEND,
399#define DESTROY_IN_PROGRESS 9 413};
400#define NETDEV_REGISTERED 10
401#define SKIP_SCAN 11
402#define WLAN_ENABLED 12
403#define TESTMODE 13
404#define CLEAR_BSSFILTER_ON_BEACON 14
405#define DTIM_PERIOD_AVAIL 15
406#define ROAM_TBL_PEND 16
407 414
408struct ath6kl { 415struct ath6kl {
409 struct device *dev; 416 struct device *dev;
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index f21224c2807f..365f7b96dafa 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1575,6 +1575,7 @@ err_wq:
1575void ath6kl_stop_txrx(struct ath6kl *ar) 1575void ath6kl_stop_txrx(struct ath6kl *ar)
1576{ 1576{
1577 struct net_device *ndev = ar->net_dev; 1577 struct net_device *ndev = ar->net_dev;
1578 struct ath6kl_vif *vif = ar->vif;
1578 1579
1579 if (!ndev) 1580 if (!ndev)
1580 return; 1581 return;
@@ -1589,7 +1590,7 @@ void ath6kl_stop_txrx(struct ath6kl *ar)
1589 if (ar->wlan_pwr_state != WLAN_POWER_STATE_CUT_PWR) 1590 if (ar->wlan_pwr_state != WLAN_POWER_STATE_CUT_PWR)
1590 ath6kl_stop_endpoint(ndev, false, true); 1591 ath6kl_stop_endpoint(ndev, false, true);
1591 1592
1592 clear_bit(WLAN_ENABLED, &ar->flag); 1593 clear_bit(WLAN_ENABLED, &vif->flags);
1593} 1594}
1594 1595
1595/* 1596/*
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c
index 4470f6ed0dbc..6a0eaea1ca84 100644
--- a/drivers/net/wireless/ath/ath6kl/main.c
+++ b/drivers/net/wireless/ath/ath6kl/main.c
@@ -429,6 +429,7 @@ void ath6kl_stop_endpoint(struct net_device *dev, bool keep_profile,
429 bool get_dbglogs) 429 bool get_dbglogs)
430{ 430{
431 struct ath6kl *ar = ath6kl_priv(dev); 431 struct ath6kl *ar = ath6kl_priv(dev);
432 struct ath6kl_vif *vif = netdev_priv(dev);
432 static u8 bcast_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 433 static u8 bcast_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
433 bool discon_issued; 434 bool discon_issued;
434 435
@@ -436,8 +437,8 @@ void ath6kl_stop_endpoint(struct net_device *dev, bool keep_profile,
436 437
437 /* disable the target and the interrupts associated with it */ 438 /* disable the target and the interrupts associated with it */
438 if (test_bit(WMI_READY, &ar->flag)) { 439 if (test_bit(WMI_READY, &ar->flag)) {
439 discon_issued = (test_bit(CONNECTED, &ar->flag) || 440 discon_issued = (test_bit(CONNECTED, &vif->flags) ||
440 test_bit(CONNECT_PEND, &ar->flag)); 441 test_bit(CONNECT_PEND, &vif->flags));
441 ath6kl_disconnect(ar); 442 ath6kl_disconnect(ar);
442 if (!keep_profile) 443 if (!keep_profile)
443 ath6kl_init_profile_info(ar); 444 ath6kl_init_profile_info(ar);
@@ -524,6 +525,8 @@ void ath6kl_connect_ap_mode_bss(struct ath6kl *ar, u16 channel)
524 struct ath6kl_req_key *ik; 525 struct ath6kl_req_key *ik;
525 int res; 526 int res;
526 u8 key_rsc[ATH6KL_KEY_SEQ_LEN]; 527 u8 key_rsc[ATH6KL_KEY_SEQ_LEN];
528 /* TODO: Pass vif instead of taking it from ar */
529 struct ath6kl_vif *vif = ar->vif;
527 530
528 ik = &ar->ap_mode_bkey; 531 ik = &ar->ap_mode_bkey;
529 532
@@ -555,7 +558,7 @@ void ath6kl_connect_ap_mode_bss(struct ath6kl *ar, u16 channel)
555 } 558 }
556 559
557 ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0); 560 ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0);
558 set_bit(CONNECTED, &ar->flag); 561 set_bit(CONNECTED, &vif->flags);
559 netif_carrier_on(ar->net_dev); 562 netif_carrier_on(ar->net_dev);
560} 563}
561 564
@@ -914,20 +917,26 @@ void disconnect_timer_handler(unsigned long ptr)
914 917
915void ath6kl_disconnect(struct ath6kl *ar) 918void ath6kl_disconnect(struct ath6kl *ar)
916{ 919{
917 if (test_bit(CONNECTED, &ar->flag) || 920 /* TODO: Pass vif instead of taking it from ar */
918 test_bit(CONNECT_PEND, &ar->flag)) { 921 struct ath6kl_vif *vif = ar->vif;
922
923 if (test_bit(CONNECTED, &vif->flags) ||
924 test_bit(CONNECT_PEND, &vif->flags)) {
919 ath6kl_wmi_disconnect_cmd(ar->wmi); 925 ath6kl_wmi_disconnect_cmd(ar->wmi);
920 /* 926 /*
921 * Disconnect command is issued, clear the connect pending 927 * Disconnect command is issued, clear the connect pending
922 * flag. The connected flag will be cleared in 928 * flag. The connected flag will be cleared in
923 * disconnect event notification. 929 * disconnect event notification.
924 */ 930 */
925 clear_bit(CONNECT_PEND, &ar->flag); 931 clear_bit(CONNECT_PEND, &vif->flags);
926 } 932 }
927} 933}
928 934
929void ath6kl_deep_sleep_enable(struct ath6kl *ar) 935void ath6kl_deep_sleep_enable(struct ath6kl *ar)
930{ 936{
937 /* TODO: Pass vif instead of taking it from ar */
938 struct ath6kl_vif *vif = ar->vif;
939
931 switch (ar->sme_state) { 940 switch (ar->sme_state) {
932 case SME_CONNECTING: 941 case SME_CONNECTING:
933 cfg80211_connect_result(ar->net_dev, ar->bssid, NULL, 0, 942 cfg80211_connect_result(ar->net_dev, ar->bssid, NULL, 0,
@@ -946,8 +955,8 @@ void ath6kl_deep_sleep_enable(struct ath6kl *ar)
946 break; 955 break;
947 } 956 }
948 957
949 if (test_bit(CONNECTED, &ar->flag) || 958 if (test_bit(CONNECTED, &vif->flags) ||
950 test_bit(CONNECT_PEND, &ar->flag)) 959 test_bit(CONNECT_PEND, &vif->flags))
951 ath6kl_wmi_disconnect_cmd(ar->wmi); 960 ath6kl_wmi_disconnect_cmd(ar->wmi);
952 961
953 ar->sme_state = SME_DISCONNECTED; 962 ar->sme_state = SME_DISCONNECTED;
@@ -1016,10 +1025,13 @@ void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver)
1016 1025
1017void ath6kl_scan_complete_evt(struct ath6kl *ar, int status) 1026void ath6kl_scan_complete_evt(struct ath6kl *ar, int status)
1018{ 1027{
1028 /* TODO: Pass vif instead of taking it from ar */
1029 struct ath6kl_vif *vif = ar->vif;
1030
1019 ath6kl_cfg80211_scan_complete_event(ar, status); 1031 ath6kl_cfg80211_scan_complete_event(ar, status);
1020 1032
1021 if (!ar->usr_bss_filter) { 1033 if (!ar->usr_bss_filter) {
1022 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &ar->flag); 1034 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags);
1023 ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0); 1035 ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0);
1024 } 1036 }
1025 1037
@@ -1032,6 +1044,9 @@ void ath6kl_connect_event(struct ath6kl *ar, u16 channel, u8 *bssid,
1032 u8 assoc_req_len, u8 assoc_resp_len, 1044 u8 assoc_req_len, u8 assoc_resp_len,
1033 u8 *assoc_info) 1045 u8 *assoc_info)
1034{ 1046{
1047 /* TODO: findout vif instead of taking it from ar */
1048 struct ath6kl_vif *vif = ar->vif;
1049
1035 ath6kl_cfg80211_connect_event(ar, channel, bssid, 1050 ath6kl_cfg80211_connect_event(ar, channel, bssid,
1036 listen_int, beacon_int, 1051 listen_int, beacon_int,
1037 net_type, beacon_ie_len, 1052 net_type, beacon_ie_len,
@@ -1049,8 +1064,8 @@ void ath6kl_connect_event(struct ath6kl *ar, u16 channel, u8 *bssid,
1049 1064
1050 /* Update connect & link status atomically */ 1065 /* Update connect & link status atomically */
1051 spin_lock_bh(&ar->lock); 1066 spin_lock_bh(&ar->lock);
1052 set_bit(CONNECTED, &ar->flag); 1067 set_bit(CONNECTED, &vif->flags);
1053 clear_bit(CONNECT_PEND, &ar->flag); 1068 clear_bit(CONNECT_PEND, &vif->flags);
1054 netif_carrier_on(ar->net_dev); 1069 netif_carrier_on(ar->net_dev);
1055 spin_unlock_bh(&ar->lock); 1070 spin_unlock_bh(&ar->lock);
1056 1071
@@ -1064,7 +1079,7 @@ void ath6kl_connect_event(struct ath6kl *ar, u16 channel, u8 *bssid,
1064 } 1079 }
1065 1080
1066 if (!ar->usr_bss_filter) { 1081 if (!ar->usr_bss_filter) {
1067 set_bit(CLEAR_BSSFILTER_ON_BEACON, &ar->flag); 1082 set_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags);
1068 ath6kl_wmi_bssfilter_cmd(ar->wmi, CURRENT_BSS_FILTER, 0); 1083 ath6kl_wmi_bssfilter_cmd(ar->wmi, CURRENT_BSS_FILTER, 0);
1069 } 1084 }
1070} 1085}
@@ -1292,6 +1307,8 @@ void ath6kl_dtimexpiry_event(struct ath6kl *ar)
1292{ 1307{
1293 bool mcastq_empty = false; 1308 bool mcastq_empty = false;
1294 struct sk_buff *skb; 1309 struct sk_buff *skb;
1310 /* TODO: Pass vif instead of taking it from ar */
1311 struct ath6kl_vif *vif = ar->vif;
1295 1312
1296 /* 1313 /*
1297 * If there are no associated STAs, ignore the DTIM expiry event. 1314 * If there are no associated STAs, ignore the DTIM expiry event.
@@ -1313,7 +1330,7 @@ void ath6kl_dtimexpiry_event(struct ath6kl *ar)
1313 return; 1330 return;
1314 1331
1315 /* set the STA flag to dtim_expired for the frame to go out */ 1332 /* set the STA flag to dtim_expired for the frame to go out */
1316 set_bit(DTIM_EXPIRED, &ar->flag); 1333 set_bit(DTIM_EXPIRED, &vif->flags);
1317 1334
1318 spin_lock_bh(&ar->mcastpsq_lock); 1335 spin_lock_bh(&ar->mcastpsq_lock);
1319 while ((skb = skb_dequeue(&ar->mcastpsq)) != NULL) { 1336 while ((skb = skb_dequeue(&ar->mcastpsq)) != NULL) {
@@ -1325,7 +1342,7 @@ void ath6kl_dtimexpiry_event(struct ath6kl *ar)
1325 } 1342 }
1326 spin_unlock_bh(&ar->mcastpsq_lock); 1343 spin_unlock_bh(&ar->mcastpsq_lock);
1327 1344
1328 clear_bit(DTIM_EXPIRED, &ar->flag); 1345 clear_bit(DTIM_EXPIRED, &vif->flags);
1329 1346
1330 /* clear the LSB of the BitMapCtl field of the TIM IE */ 1347 /* clear the LSB of the BitMapCtl field of the TIM IE */
1331 ath6kl_wmi_set_pvb_cmd(ar->wmi, MCAST_AID, 0); 1348 ath6kl_wmi_set_pvb_cmd(ar->wmi, MCAST_AID, 0);
@@ -1335,6 +1352,9 @@ void ath6kl_disconnect_event(struct ath6kl *ar, u8 reason, u8 *bssid,
1335 u8 assoc_resp_len, u8 *assoc_info, 1352 u8 assoc_resp_len, u8 *assoc_info,
1336 u16 prot_reason_status) 1353 u16 prot_reason_status)
1337{ 1354{
1355 /* TODO: Findout vif instead of taking it from ar */
1356 struct ath6kl_vif *vif = ar->vif;
1357
1338 if (ar->nw_type == AP_NETWORK) { 1358 if (ar->nw_type == AP_NETWORK) {
1339 if (!ath6kl_remove_sta(ar, bssid, prot_reason_status)) 1359 if (!ath6kl_remove_sta(ar, bssid, prot_reason_status))
1340 return; 1360 return;
@@ -1357,7 +1377,7 @@ void ath6kl_disconnect_event(struct ath6kl *ar, u8 reason, u8 *bssid,
1357 1377
1358 if (memcmp(ar->net_dev->dev_addr, bssid, ETH_ALEN) == 0) { 1378 if (memcmp(ar->net_dev->dev_addr, bssid, ETH_ALEN) == 0) {
1359 memset(ar->wep_key_list, 0, sizeof(ar->wep_key_list)); 1379 memset(ar->wep_key_list, 0, sizeof(ar->wep_key_list));
1360 clear_bit(CONNECTED, &ar->flag); 1380 clear_bit(CONNECTED, &vif->flags);
1361 } 1381 }
1362 return; 1382 return;
1363 } 1383 }
@@ -1382,19 +1402,19 @@ void ath6kl_disconnect_event(struct ath6kl *ar, u8 reason, u8 *bssid,
1382 if (!ar->usr_bss_filter && test_bit(WMI_READY, &ar->flag)) 1402 if (!ar->usr_bss_filter && test_bit(WMI_READY, &ar->flag))
1383 ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0); 1403 ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0);
1384 } else { 1404 } else {
1385 set_bit(CONNECT_PEND, &ar->flag); 1405 set_bit(CONNECT_PEND, &vif->flags);
1386 if (((reason == ASSOC_FAILED) && 1406 if (((reason == ASSOC_FAILED) &&
1387 (prot_reason_status == 0x11)) || 1407 (prot_reason_status == 0x11)) ||
1388 ((reason == ASSOC_FAILED) && (prot_reason_status == 0x0) 1408 ((reason == ASSOC_FAILED) && (prot_reason_status == 0x0)
1389 && (ar->reconnect_flag == 1))) { 1409 && (ar->reconnect_flag == 1))) {
1390 set_bit(CONNECTED, &ar->flag); 1410 set_bit(CONNECTED, &vif->flags);
1391 return; 1411 return;
1392 } 1412 }
1393 } 1413 }
1394 1414
1395 /* update connect & link status atomically */ 1415 /* update connect & link status atomically */
1396 spin_lock_bh(&ar->lock); 1416 spin_lock_bh(&ar->lock);
1397 clear_bit(CONNECTED, &ar->flag); 1417 clear_bit(CONNECTED, &vif->flags);
1398 netif_carrier_off(ar->net_dev); 1418 netif_carrier_off(ar->net_dev);
1399 spin_unlock_bh(&ar->lock); 1419 spin_unlock_bh(&ar->lock);
1400 1420
@@ -1414,12 +1434,13 @@ void ath6kl_disconnect_event(struct ath6kl *ar, u8 reason, u8 *bssid,
1414static int ath6kl_open(struct net_device *dev) 1434static int ath6kl_open(struct net_device *dev)
1415{ 1435{
1416 struct ath6kl *ar = ath6kl_priv(dev); 1436 struct ath6kl *ar = ath6kl_priv(dev);
1437 struct ath6kl_vif *vif = netdev_priv(dev);
1417 1438
1418 spin_lock_bh(&ar->lock); 1439 spin_lock_bh(&ar->lock);
1419 1440
1420 set_bit(WLAN_ENABLED, &ar->flag); 1441 set_bit(WLAN_ENABLED, &vif->flags);
1421 1442
1422 if (test_bit(CONNECTED, &ar->flag)) { 1443 if (test_bit(CONNECTED, &vif->flags)) {
1423 netif_carrier_on(dev); 1444 netif_carrier_on(dev);
1424 netif_wake_queue(dev); 1445 netif_wake_queue(dev);
1425 } else 1446 } else
@@ -1433,6 +1454,7 @@ static int ath6kl_open(struct net_device *dev)
1433static int ath6kl_close(struct net_device *dev) 1454static int ath6kl_close(struct net_device *dev)
1434{ 1455{
1435 struct ath6kl *ar = ath6kl_priv(dev); 1456 struct ath6kl *ar = ath6kl_priv(dev);
1457 struct ath6kl_vif *vif = netdev_priv(dev);
1436 1458
1437 netif_stop_queue(dev); 1459 netif_stop_queue(dev);
1438 1460
@@ -1443,7 +1465,7 @@ static int ath6kl_close(struct net_device *dev)
1443 0, 0, 0)) 1465 0, 0, 0))
1444 return -EIO; 1466 return -EIO;
1445 1467
1446 clear_bit(WLAN_ENABLED, &ar->flag); 1468 clear_bit(WLAN_ENABLED, &vif->flags);
1447 } 1469 }
1448 1470
1449 ath6kl_cfg80211_scan_complete_event(ar, -ECANCELED); 1471 ath6kl_cfg80211_scan_complete_event(ar, -ECANCELED);
diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c
index a9dff01c70a6..d1652bdb51d8 100644
--- a/drivers/net/wireless/ath/ath6kl/txrx.c
+++ b/drivers/net/wireless/ath/ath6kl/txrx.c
@@ -83,6 +83,8 @@ static bool ath6kl_powersave_ap(struct ath6kl *ar, struct sk_buff *skb,
83 struct ethhdr *datap = (struct ethhdr *) skb->data; 83 struct ethhdr *datap = (struct ethhdr *) skb->data;
84 struct ath6kl_sta *conn = NULL; 84 struct ath6kl_sta *conn = NULL;
85 bool ps_queued = false, is_psq_empty = false; 85 bool ps_queued = false, is_psq_empty = false;
86 /* TODO: Findout vif */
87 struct ath6kl_vif *vif = ar->vif;
86 88
87 if (is_multicast_ether_addr(datap->h_dest)) { 89 if (is_multicast_ether_addr(datap->h_dest)) {
88 u8 ctr = 0; 90 u8 ctr = 0;
@@ -100,7 +102,7 @@ static bool ath6kl_powersave_ap(struct ath6kl *ar, struct sk_buff *skb,
100 * If this transmit is not because of a Dtim Expiry 102 * If this transmit is not because of a Dtim Expiry
101 * q it. 103 * q it.
102 */ 104 */
103 if (!test_bit(DTIM_EXPIRED, &ar->flag)) { 105 if (!test_bit(DTIM_EXPIRED, &vif->flags)) {
104 bool is_mcastq_empty = false; 106 bool is_mcastq_empty = false;
105 107
106 spin_lock_bh(&ar->mcastpsq_lock); 108 spin_lock_bh(&ar->mcastpsq_lock);
@@ -235,6 +237,7 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
235 struct ath6kl *ar = ath6kl_priv(dev); 237 struct ath6kl *ar = ath6kl_priv(dev);
236 struct ath6kl_cookie *cookie = NULL; 238 struct ath6kl_cookie *cookie = NULL;
237 enum htc_endpoint_id eid = ENDPOINT_UNUSED; 239 enum htc_endpoint_id eid = ENDPOINT_UNUSED;
240 struct ath6kl_vif *vif = netdev_priv(dev);
238 u32 map_no = 0; 241 u32 map_no = 0;
239 u16 htc_tag = ATH6KL_DATA_PKT_TAG; 242 u16 htc_tag = ATH6KL_DATA_PKT_TAG;
240 u8 ac = 99 ; /* initialize to unmapped ac */ 243 u8 ac = 99 ; /* initialize to unmapped ac */
@@ -246,7 +249,7 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
246 skb, skb->data, skb->len); 249 skb, skb->data, skb->len);
247 250
248 /* If target is not associated */ 251 /* If target is not associated */
249 if (!test_bit(CONNECTED, &ar->flag)) { 252 if (!test_bit(CONNECTED, &vif->flags)) {
250 dev_kfree_skb(skb); 253 dev_kfree_skb(skb);
251 return 0; 254 return 0;
252 } 255 }
@@ -278,12 +281,12 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
278 } 281 }
279 282
280 if ((ar->nw_type == ADHOC_NETWORK) && 283 if ((ar->nw_type == ADHOC_NETWORK) &&
281 ar->ibss_ps_enable && test_bit(CONNECTED, &ar->flag)) 284 ar->ibss_ps_enable && test_bit(CONNECTED, &vif->flags))
282 chk_adhoc_ps_mapping = true; 285 chk_adhoc_ps_mapping = true;
283 else { 286 else {
284 /* get the stream mapping */ 287 /* get the stream mapping */
285 ret = ath6kl_wmi_implicit_create_pstream(ar->wmi, skb, 288 ret = ath6kl_wmi_implicit_create_pstream(ar->wmi, skb,
286 0, test_bit(WMM_ENABLED, &ar->flag), &ac); 289 0, test_bit(WMM_ENABLED, &vif->flags), &ac);
287 if (ret) 290 if (ret)
288 goto fail_tx; 291 goto fail_tx;
289 } 292 }
@@ -426,6 +429,8 @@ enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target,
426 struct htc_packet *packet) 429 struct htc_packet *packet)
427{ 430{
428 struct ath6kl *ar = target->dev->ar; 431 struct ath6kl *ar = target->dev->ar;
432 /* TODO: Findout vif properly */
433 struct ath6kl_vif *vif = ar->vif;
429 enum htc_endpoint_id endpoint = packet->endpoint; 434 enum htc_endpoint_id endpoint = packet->endpoint;
430 435
431 if (endpoint == ar->ctrl_ep) { 436 if (endpoint == ar->ctrl_ep) {
@@ -468,7 +473,7 @@ enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target,
468 473
469stop_net_queues: 474stop_net_queues:
470 spin_lock_bh(&ar->lock); 475 spin_lock_bh(&ar->lock);
471 set_bit(NETQ_STOPPED, &ar->flag); 476 set_bit(NETQ_STOPPED, &vif->flags);
472 spin_unlock_bh(&ar->lock); 477 spin_unlock_bh(&ar->lock);
473 netif_stop_queue(ar->net_dev); 478 netif_stop_queue(ar->net_dev);
474 479
@@ -524,6 +529,8 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue)
524 enum htc_endpoint_id eid; 529 enum htc_endpoint_id eid;
525 bool wake_event = false; 530 bool wake_event = false;
526 bool flushing = false; 531 bool flushing = false;
532 /* TODO: Findout vif */
533 struct ath6kl_vif *vif = ar->vif;
527 534
528 skb_queue_head_init(&skb_queue); 535 skb_queue_head_init(&skb_queue);
529 536
@@ -597,15 +604,15 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue)
597 604
598 ath6kl_free_cookie(ar, ath6kl_cookie); 605 ath6kl_free_cookie(ar, ath6kl_cookie);
599 606
600 if (test_bit(NETQ_STOPPED, &ar->flag)) 607 if (test_bit(NETQ_STOPPED, &vif->flags))
601 clear_bit(NETQ_STOPPED, &ar->flag); 608 clear_bit(NETQ_STOPPED, &vif->flags);
602 } 609 }
603 610
604 spin_unlock_bh(&ar->lock); 611 spin_unlock_bh(&ar->lock);
605 612
606 __skb_queue_purge(&skb_queue); 613 __skb_queue_purge(&skb_queue);
607 614
608 if (test_bit(CONNECTED, &ar->flag)) { 615 if (test_bit(CONNECTED, &vif->flags)) {
609 if (!flushing) 616 if (!flushing)
610 netif_wake_queue(ar->net_dev); 617 netif_wake_queue(ar->net_dev);
611 } 618 }
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index 7f4c2c2ab71b..a71d77311251 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -950,6 +950,8 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len)
950 struct ath6kl *ar = wmi->parent_dev; 950 struct ath6kl *ar = wmi->parent_dev;
951 struct ieee80211_mgmt *mgmt; 951 struct ieee80211_mgmt *mgmt;
952 struct cfg80211_bss *bss; 952 struct cfg80211_bss *bss;
953 /*TODO: Findout vif properly */
954 struct ath6kl_vif *vif = ar->vif;
953 955
954 if (len <= sizeof(struct wmi_bss_info_hdr2)) 956 if (len <= sizeof(struct wmi_bss_info_hdr2))
955 return -EINVAL; 957 return -EINVAL;
@@ -969,8 +971,8 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len)
969 return 0; /* Only update BSS table for now */ 971 return 0; /* Only update BSS table for now */
970 972
971 if (bih->frame_type == BEACON_FTYPE && 973 if (bih->frame_type == BEACON_FTYPE &&
972 test_bit(CLEAR_BSSFILTER_ON_BEACON, &ar->flag)) { 974 test_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags)) {
973 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &ar->flag); 975 clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags);
974 ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0); 976 ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0);
975 } 977 }
976 978
@@ -981,14 +983,14 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len)
981 if (len < 8 + 2 + 2) 983 if (len < 8 + 2 + 2)
982 return -EINVAL; 984 return -EINVAL;
983 985
984 if (bih->frame_type == BEACON_FTYPE && test_bit(CONNECTED, &ar->flag) && 986 if (bih->frame_type == BEACON_FTYPE && test_bit(CONNECTED, &vif->flags)
985 memcmp(bih->bssid, ar->bssid, ETH_ALEN) == 0) { 987 && memcmp(bih->bssid, ar->bssid, ETH_ALEN) == 0) {
986 const u8 *tim; 988 const u8 *tim;
987 tim = cfg80211_find_ie(WLAN_EID_TIM, buf + 8 + 2 + 2, 989 tim = cfg80211_find_ie(WLAN_EID_TIM, buf + 8 + 2 + 2,
988 len - 8 - 2 - 2); 990 len - 8 - 2 - 2);
989 if (tim && tim[1] >= 2) { 991 if (tim && tim[1] >= 2) {
990 ar->assoc_bss_dtim_period = tim[3]; 992 ar->assoc_bss_dtim_period = tim[3];
991 set_bit(DTIM_PERIOD_AVAIL, &ar->flag); 993 set_bit(DTIM_PERIOD_AVAIL, &vif->flags);
992 } 994 }
993 } 995 }
994 996