1 --- a/drivers/net/wireless/ath/ath9k/main.c
2 +++ b/drivers/net/wireless/ath/ath9k/main.c
3 @@ -320,6 +320,42 @@ static void ath_paprd_activate(struct at
7 +static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int chain)
9 + struct ieee80211_hw *hw = sc->hw;
10 + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
11 + struct ath_tx_control txctl;
14 + memset(&txctl, 0, sizeof(txctl));
15 + txctl.txq = sc->tx.txq_map[WME_AC_BE];
17 + memset(tx_info, 0, sizeof(*tx_info));
18 + tx_info->band = hw->conf.channel->band;
19 + tx_info->flags |= IEEE80211_TX_CTL_NO_ACK;
20 + tx_info->control.rates[0].idx = 0;
21 + tx_info->control.rates[0].count = 1;
22 + tx_info->control.rates[0].flags = IEEE80211_TX_RC_MCS;
23 + tx_info->control.rates[1].idx = -1;
25 + init_completion(&sc->paprd_complete);
26 + sc->paprd_pending = true;
27 + txctl.paprd = BIT(chain);
28 + if (ath_tx_start(hw, skb, &txctl) != 0)
31 + time_left = wait_for_completion_timeout(&sc->paprd_complete,
32 + msecs_to_jiffies(ATH_PAPRD_TIMEOUT));
33 + sc->paprd_pending = false;
36 + ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CALIBRATE,
37 + "Timeout waiting for paprd training on TX chain %d\n",
43 void ath_paprd_calibrate(struct work_struct *work)
45 struct ath_softc *sc = container_of(work, struct ath_softc, paprd_work);
46 @@ -327,18 +363,12 @@ void ath_paprd_calibrate(struct work_str
47 struct ath_hw *ah = sc->sc_ah;
48 struct ieee80211_hdr *hdr;
49 struct sk_buff *skb = NULL;
50 - struct ieee80211_tx_info *tx_info;
51 - int band = hw->conf.channel->band;
52 - struct ieee80211_supported_band *sband = &sc->sbands[band];
53 - struct ath_tx_control txctl;
54 struct ath9k_hw_cal_data *caldata = ah->caldata;
55 struct ath_common *common = ath9k_hw_common(ah);
65 @@ -347,8 +377,6 @@ void ath_paprd_calibrate(struct work_str
69 - tx_info = IEEE80211_SKB_CB(skb);
72 memset(skb->data, 0, len);
73 hdr = (struct ieee80211_hdr *)skb->data;
74 @@ -359,9 +387,6 @@ void ath_paprd_calibrate(struct work_str
75 memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN);
76 memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN);
78 - memset(&txctl, 0, sizeof(txctl));
79 - txctl.txq = sc->tx.txq_map[WME_AC_BE];
82 ar9003_paprd_init_table(ah);
83 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
84 @@ -369,30 +394,19 @@ void ath_paprd_calibrate(struct work_str
88 - memset(tx_info, 0, sizeof(*tx_info));
89 - tx_info->band = band;
91 - for (i = 0; i < 4; i++) {
92 - tx_info->control.rates[i].idx = sband->n_bitrates - 1;
93 - tx_info->control.rates[i].count = 6;
95 + ath_dbg(common, ATH_DBG_CALIBRATE,
96 + "Sending PAPRD frame for thermal measurement "
97 + "on chain %d\n", chain);
98 + if (!ath_paprd_send_frame(sc, skb, chain))
101 - init_completion(&sc->paprd_complete);
102 - sc->paprd_pending = true;
103 ar9003_paprd_setup_gain_table(ah, chain);
104 - txctl.paprd = BIT(chain);
105 - if (ath_tx_start(hw, skb, &txctl) != 0)
108 - time_left = wait_for_completion_timeout(&sc->paprd_complete,
109 - msecs_to_jiffies(ATH_PAPRD_TIMEOUT));
110 - sc->paprd_pending = false;
112 - ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE,
113 - "Timeout waiting for paprd training on TX chain %d\n",
115 + ath_dbg(common, ATH_DBG_CALIBRATE,
116 + "Sending PAPRD training frame on chain %d\n", chain);
117 + if (!ath_paprd_send_frame(sc, skb, chain))
121 if (!ar9003_paprd_is_done(ah))