aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h14
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_beacon.c19
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c56
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_txrx.c26
4 files changed, 74 insertions, 41 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index 4e19e14e8c11..eecb42b24bc5 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -335,11 +335,10 @@ void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv *priv);
335#define OP_SCANNING BIT(1) 335#define OP_SCANNING BIT(1)
336#define OP_LED_ASSOCIATED BIT(2) 336#define OP_LED_ASSOCIATED BIT(2)
337#define OP_LED_ON BIT(3) 337#define OP_LED_ON BIT(3)
338#define OP_ASSOCIATED BIT(4) 338#define OP_ENABLE_BEACON BIT(4)
339#define OP_ENABLE_BEACON BIT(5) 339#define OP_LED_DEINIT BIT(5)
340#define OP_LED_DEINIT BIT(6) 340#define OP_BT_PRIORITY_DETECTED BIT(6)
341#define OP_BT_PRIORITY_DETECTED BIT(7) 341#define OP_BT_SCAN BIT(7)
342#define OP_BT_SCAN BIT(8)
343 342
344struct ath9k_htc_priv { 343struct ath9k_htc_priv {
345 struct device *dev; 344 struct device *dev;
@@ -370,6 +369,8 @@ struct ath9k_htc_priv {
370 u16 nstations; 369 u16 nstations;
371 u16 seq_no; 370 u16 seq_no;
372 u32 bmiss_cnt; 371 u32 bmiss_cnt;
372 bool rearm_ani;
373 bool reconfig_beacon;
373 374
374 struct ath9k_hw_cal_data caldata; 375 struct ath9k_hw_cal_data caldata;
375 376
@@ -429,6 +430,7 @@ void ath9k_htc_reset(struct ath9k_htc_priv *priv);
429void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv); 430void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv);
430void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv, 431void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
431 struct ieee80211_vif *vif); 432 struct ieee80211_vif *vif);
433void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv);
432void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending); 434void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending);
433 435
434void ath9k_htc_rxep(void *priv, struct sk_buff *skb, 436void ath9k_htc_rxep(void *priv, struct sk_buff *skb,
@@ -441,7 +443,7 @@ void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb,
441int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv); 443int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv);
442void ath9k_htc_station_work(struct work_struct *work); 444void ath9k_htc_station_work(struct work_struct *work);
443void ath9k_htc_aggr_work(struct work_struct *work); 445void ath9k_htc_aggr_work(struct work_struct *work);
444void ath9k_ani_work(struct work_struct *work);; 446void ath9k_ani_work(struct work_struct *work);
445void ath_start_ani(struct ath9k_htc_priv *priv); 447void ath_start_ani(struct ath9k_htc_priv *priv);
446 448
447int ath9k_tx_init(struct ath9k_htc_priv *priv); 449int ath9k_tx_init(struct ath9k_htc_priv *priv);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index 87cc65a78a3f..133f628dc086 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -283,3 +283,22 @@ void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
283 return; 283 return;
284 } 284 }
285} 285}
286
287void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv)
288{
289 struct ath_common *common = ath9k_hw_common(priv->ah);
290 struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;
291
292 switch (priv->ah->opmode) {
293 case NL80211_IFTYPE_STATION:
294 ath9k_htc_beacon_config_sta(priv, cur_conf);
295 break;
296 case NL80211_IFTYPE_ADHOC:
297 ath9k_htc_beacon_config_adhoc(priv, cur_conf);
298 break;
299 default:
300 ath_dbg(common, ATH_DBG_CONFIG,
301 "Unsupported beaconing mode\n");
302 return;
303 }
304}
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index dbde491f3d9c..5ef076978181 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -105,6 +105,34 @@ void ath9k_ps_work(struct work_struct *work)
105 ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP); 105 ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP);
106} 106}
107 107
108static void ath9k_htc_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
109{
110 struct ath9k_htc_priv *priv = data;
111 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
112
113 if (bss_conf->assoc) {
114 priv->rearm_ani = true;
115 priv->reconfig_beacon = true;
116 }
117}
118
119static void ath9k_htc_vif_reconfig(struct ath9k_htc_priv *priv)
120{
121 priv->rearm_ani = false;
122 priv->reconfig_beacon = false;
123
124 ieee80211_iterate_active_interfaces_atomic(priv->hw,
125 ath9k_htc_vif_iter, priv);
126 if (priv->rearm_ani)
127 ath_start_ani(priv);
128
129 if (priv->reconfig_beacon) {
130 ath9k_htc_ps_wakeup(priv);
131 ath9k_htc_beacon_reconfig(priv);
132 ath9k_htc_ps_restore(priv);
133 }
134}
135
108void ath9k_htc_reset(struct ath9k_htc_priv *priv) 136void ath9k_htc_reset(struct ath9k_htc_priv *priv)
109{ 137{
110 struct ath_hw *ah = priv->ah; 138 struct ath_hw *ah = priv->ah;
@@ -119,9 +147,7 @@ void ath9k_htc_reset(struct ath9k_htc_priv *priv)
119 mutex_lock(&priv->mutex); 147 mutex_lock(&priv->mutex);
120 ath9k_htc_ps_wakeup(priv); 148 ath9k_htc_ps_wakeup(priv);
121 149
122 if (priv->op_flags & OP_ASSOCIATED) 150 cancel_delayed_work_sync(&priv->ath9k_ani_work);
123 cancel_delayed_work_sync(&priv->ath9k_ani_work);
124
125 ieee80211_stop_queues(priv->hw); 151 ieee80211_stop_queues(priv->hw);
126 htc_stop(priv->htc); 152 htc_stop(priv->htc);
127 WMI_CMD(WMI_DISABLE_INTR_CMDID); 153 WMI_CMD(WMI_DISABLE_INTR_CMDID);
@@ -148,12 +174,7 @@ void ath9k_htc_reset(struct ath9k_htc_priv *priv)
148 174
149 WMI_CMD(WMI_ENABLE_INTR_CMDID); 175 WMI_CMD(WMI_ENABLE_INTR_CMDID);
150 htc_start(priv->htc); 176 htc_start(priv->htc);
151 177 ath9k_htc_vif_reconfig(priv);
152 if (priv->op_flags & OP_ASSOCIATED) {
153 ath9k_htc_beacon_config(priv, priv->vif);
154 ath_start_ani(priv);
155 }
156
157 ieee80211_wake_queues(priv->hw); 178 ieee80211_wake_queues(priv->hw);
158 179
159 ath9k_htc_ps_restore(priv); 180 ath9k_htc_ps_restore(priv);
@@ -1491,13 +1512,10 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
1491 ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n", 1512 ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n",
1492 bss_conf->assoc); 1513 bss_conf->assoc);
1493 1514
1494 if (bss_conf->assoc) { 1515 if (bss_conf->assoc)
1495 priv->op_flags |= OP_ASSOCIATED;
1496 ath_start_ani(priv); 1516 ath_start_ani(priv);
1497 } else { 1517 else
1498 priv->op_flags &= ~OP_ASSOCIATED;
1499 cancel_delayed_work_sync(&priv->ath9k_ani_work); 1518 cancel_delayed_work_sync(&priv->ath9k_ani_work);
1500 }
1501 } 1519 }
1502 1520
1503 if (changed & BSS_CHANGED_BSSID) { 1521 if (changed & BSS_CHANGED_BSSID) {
@@ -1622,8 +1640,7 @@ static void ath9k_htc_sw_scan_start(struct ieee80211_hw *hw)
1622 priv->op_flags |= OP_SCANNING; 1640 priv->op_flags |= OP_SCANNING;
1623 spin_unlock_bh(&priv->beacon_lock); 1641 spin_unlock_bh(&priv->beacon_lock);
1624 cancel_work_sync(&priv->ps_work); 1642 cancel_work_sync(&priv->ps_work);
1625 if (priv->op_flags & OP_ASSOCIATED) 1643 cancel_delayed_work_sync(&priv->ath9k_ani_work);
1626 cancel_delayed_work_sync(&priv->ath9k_ani_work);
1627 mutex_unlock(&priv->mutex); 1644 mutex_unlock(&priv->mutex);
1628} 1645}
1629 1646
@@ -1632,14 +1649,11 @@ static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw)
1632 struct ath9k_htc_priv *priv = hw->priv; 1649 struct ath9k_htc_priv *priv = hw->priv;
1633 1650
1634 mutex_lock(&priv->mutex); 1651 mutex_lock(&priv->mutex);
1635 ath9k_htc_ps_wakeup(priv);
1636 spin_lock_bh(&priv->beacon_lock); 1652 spin_lock_bh(&priv->beacon_lock);
1637 priv->op_flags &= ~OP_SCANNING; 1653 priv->op_flags &= ~OP_SCANNING;
1638 spin_unlock_bh(&priv->beacon_lock); 1654 spin_unlock_bh(&priv->beacon_lock);
1639 if (priv->op_flags & OP_ASSOCIATED) { 1655 ath9k_htc_ps_wakeup(priv);
1640 ath9k_htc_beacon_config(priv, priv->vif); 1656 ath9k_htc_vif_reconfig(priv);
1641 ath_start_ani(priv);
1642 }
1643 ath9k_htc_ps_restore(priv); 1657 ath9k_htc_ps_restore(priv);
1644 mutex_unlock(&priv->mutex); 1658 mutex_unlock(&priv->mutex);
1645} 1659}
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 884deebf8e01..6ddcf939aff5 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -591,24 +591,22 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
591 ath9k_process_rate(hw, rx_status, rxbuf->rxstatus.rs_rate, 591 ath9k_process_rate(hw, rx_status, rxbuf->rxstatus.rs_rate,
592 rxbuf->rxstatus.rs_flags); 592 rxbuf->rxstatus.rs_flags);
593 593
594 if (priv->op_flags & OP_ASSOCIATED) { 594 if (rxbuf->rxstatus.rs_rssi != ATH9K_RSSI_BAD &&
595 if (rxbuf->rxstatus.rs_rssi != ATH9K_RSSI_BAD && 595 !rxbuf->rxstatus.rs_moreaggr)
596 !rxbuf->rxstatus.rs_moreaggr) 596 ATH_RSSI_LPF(priv->rx.last_rssi,
597 ATH_RSSI_LPF(priv->rx.last_rssi, 597 rxbuf->rxstatus.rs_rssi);
598 rxbuf->rxstatus.rs_rssi);
599 598
600 last_rssi = priv->rx.last_rssi; 599 last_rssi = priv->rx.last_rssi;
601 600
602 if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) 601 if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
603 rxbuf->rxstatus.rs_rssi = ATH_EP_RND(last_rssi, 602 rxbuf->rxstatus.rs_rssi = ATH_EP_RND(last_rssi,
604 ATH_RSSI_EP_MULTIPLIER); 603 ATH_RSSI_EP_MULTIPLIER);
605 604
606 if (rxbuf->rxstatus.rs_rssi < 0) 605 if (rxbuf->rxstatus.rs_rssi < 0)
607 rxbuf->rxstatus.rs_rssi = 0; 606 rxbuf->rxstatus.rs_rssi = 0;
608 607
609 if (ieee80211_is_beacon(fc)) 608 if (ieee80211_is_beacon(fc))
610 priv->ah->stats.avgbrssi = rxbuf->rxstatus.rs_rssi; 609 priv->ah->stats.avgbrssi = rxbuf->rxstatus.rs_rssi;
611 }
612 610
613 rx_status->mactime = be64_to_cpu(rxbuf->rxstatus.rs_tstamp); 611 rx_status->mactime = be64_to_cpu(rxbuf->rxstatus.rs_tstamp);
614 rx_status->band = hw->conf.channel->band; 612 rx_status->band = hw->conf.channel->band;