#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -516,24 +516,6 @@ irqreturn_t ath_isr(int irq, void *dev)
+@@ -19,7 +19,7 @@
+ #include "ath9k.h"
+ #include "btcoex.h"
+
+-static u8 parse_mpdudensity(u8 mpdudensity)
++u8 ath9k_parse_mpdudensity(u8 mpdudensity)
+ {
+ /*
+ * 802.11n D2.0 defined values for "Minimum MPDU Start Spacing":
+@@ -320,6 +320,7 @@ static void ath_node_attach(struct ath_s
+ struct ieee80211_vif *vif)
+ {
+ struct ath_node *an;
++ u8 density;
+ an = (struct ath_node *)sta->drv_priv;
+
+ #ifdef CONFIG_ATH9K_DEBUGFS
+@@ -334,7 +335,8 @@ static void ath_node_attach(struct ath_s
+ ath_tx_node_init(sc, an);
+ an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
+ sta->ht_cap.ampdu_factor);
+- an->mpdudensity = parse_mpdudensity(sta->ht_cap.ampdu_density);
++ density = ath9k_parse_mpdudensity(sta->ht_cap.ampdu_density);
++ an->mpdudensity = density;
+ }
+ }
+
+@@ -516,24 +518,6 @@ irqreturn_t ath_isr(int irq, void *dev)
ath9k_hw_set_interrupts(ah);
}
if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP))
if (status & ATH9K_INT_TIM_TIMER) {
if (ATH_DBG_WARN_ON_ONCE(sc->ps_idle))
-@@ -959,14 +941,10 @@ static void ath9k_calculate_summary_stat
+@@ -959,14 +943,10 @@ static void ath9k_calculate_summary_stat
/*
* Enable MIB interrupts when there are hardware phy counters.
*/
};
struct ath_buf_state {
+@@ -721,6 +722,7 @@ extern int ath9k_modparam_nohwcrypt;
+ extern int led_blink;
+ extern bool is_ath9k_unloaded;
+
++u8 ath9k_parse_mpdudensity(u8 mpdudensity);
+ irqreturn_t ath_isr(int irq, void *dev);
+ int ath9k_init_device(u16 devid, struct ath_softc *sc,
+ const struct ath_bus_ops *bus_ops);
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -938,6 +938,7 @@ static void ath_buf_set_rate(struct ath_
info->rates[i].Rate = rate->hw_value;
if (rate->hw_value_short) {
if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
-@@ -1776,10 +1766,22 @@ static void setup_frame_info(struct ieee
+@@ -1175,6 +1165,7 @@ int ath_tx_aggr_start(struct ath_softc *
+ {
+ struct ath_atx_tid *txtid;
+ struct ath_node *an;
++ u8 density;
+
+ an = (struct ath_node *)sta->drv_priv;
+ txtid = ATH_AN_2_TID(an, tid);
+@@ -1182,6 +1173,17 @@ int ath_tx_aggr_start(struct ath_softc *
+ if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE))
+ return -EAGAIN;
+
++ /* update ampdu factor/density, they may have changed. This may happen
++ * in HT IBSS when a beacon with HT-info is received after the station
++ * has already been added.
++ */
++ if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
++ an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
++ sta->ht_cap.ampdu_factor);
++ density = ath9k_parse_mpdudensity(sta->ht_cap.ampdu_density);
++ an->mpdudensity = density;
++ }
++
+ txtid->state |= AGGR_ADDBA_PROGRESS;
+ txtid->paused = true;
+ *ssn = txtid->seq_start = txtid->seq_next;
+@@ -1776,10 +1778,22 @@ static void setup_frame_info(struct ieee
struct ieee80211_sta *sta = tx_info->control.sta;
struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
keytype = ath9k_cmn_get_hw_crypto_keytype(skb);
if (sta)
-@@ -1794,6 +1796,9 @@ static void setup_frame_info(struct ieee
+@@ -1794,6 +1808,9 @@ static void setup_frame_info(struct ieee
fi->keyix = ATH9K_TXKEYIX_INVALID;
fi->keytype = keytype;
fi->framelen = framelen;
return err;
}
+--- a/drivers/net/wireless/ath/ath9k/link.c
++++ b/drivers/net/wireless/ath/ath9k/link.c
+@@ -407,6 +407,7 @@ void ath_ani_calibrate(unsigned long dat
+ longcal ? "long" : "", shortcal ? "short" : "",
+ aniflag ? "ani" : "", common->ani.caldone ? "true" : "false");
+
++ ath9k_debug_samp_bb_mac(sc);
+ ath9k_ps_restore(sc);
+
+ set_timer:
+@@ -415,7 +416,6 @@ set_timer:
+ * The interval must be the shortest necessary to satisfy ANI,
+ * short calibration and long calibration.
+ */
+- ath9k_debug_samp_bb_mac(sc);
+ cal_interval = ATH_LONG_CALINTERVAL;
+ if (sc->sc_ah->config.enable_ani)
+ cal_interval = min(cal_interval,
}
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -1122,7 +1122,7 @@ static void ath9k_disable_ps(struct ath_
+@@ -1124,7 +1124,7 @@ static void ath9k_disable_ps(struct ath_
ath_dbg(common, PS, "PowerSave disabled\n");
}
{
struct ath_softc *sc = hw->priv;
struct ath_hw *ah = sc->sc_ah;
-@@ -1173,9 +1173,11 @@ static int ath9k_config(struct ieee80211
+@@ -1175,9 +1175,11 @@ static int ath9k_config(struct ieee80211
if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) {
struct ieee80211_channel *curchan = hw->conf.channel;
if (ah->curchan)
old_pos = ah->curchan - &ah->channels[0];
-@@ -1218,7 +1220,23 @@ static int ath9k_config(struct ieee80211
+@@ -1220,7 +1222,23 @@ static int ath9k_config(struct ieee80211
memset(&sc->survey[pos], 0, sizeof(struct survey_info));
}
__skb_unlink(skb, &tid->buf_q);
list_add_tail(&bf->list, bf_q);
if (bf_prev)
-@@ -1728,6 +1739,8 @@ static void ath_tx_send_ampdu(struct ath
+@@ -1740,6 +1751,8 @@ static void ath_tx_send_ampdu(struct ath
/* Add sub-frame to BAW */
ath_tx_addto_baw(sc, tid, bf->bf_state.seqno);
/* Queue to h/w without aggregation */
TX_STAT_INC(txctl->txq->axq_qnum, a_queued_hw);
bf->bf_lastbf = bf;
-@@ -1878,22 +1891,11 @@ error:
+@@ -1890,22 +1903,11 @@ error:
/* FIXME: tx power */
static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb,
if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && tid) {
/*
-@@ -1925,6 +1927,7 @@ int ath_tx_start(struct ieee80211_hw *hw
+@@ -1937,6 +1939,7 @@ int ath_tx_start(struct ieee80211_hw *hw
struct ieee80211_vif *vif = info->control.vif;
struct ath_softc *sc = hw->priv;
struct ath_txq *txq = txctl->txq;
int padpos, padsize;
int frmlen = skb->len + FCS_LEN;
int q;
-@@ -1967,6 +1970,24 @@ int ath_tx_start(struct ieee80211_hw *hw
+@@ -1979,6 +1982,24 @@ int ath_tx_start(struct ieee80211_hw *hw
setup_frame_info(hw, skb, frmlen);
/*
* At this point, the vif, hw_key and sta pointers in the tx control
* info are no longer valid (overwritten by the ath_frame_info data.
-@@ -1981,7 +2002,7 @@ int ath_tx_start(struct ieee80211_hw *hw
+@@ -1993,7 +2014,7 @@ int ath_tx_start(struct ieee80211_hw *hw
txq->stopped = true;
}