[tools] build flex on the host, some pakcages need it in the newest version
[openwrt.git] / package / mac80211 / patches / 530-ath9k_paprd_thermal.patch
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
4 ath9k_ps_restore(sc);
5 }
6
7 +static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int chain)
8 +{
9 + struct ieee80211_hw *hw = sc->hw;
10 + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
11 + struct ath_tx_control txctl;
12 + int time_left;
13 +
14 + memset(&txctl, 0, sizeof(txctl));
15 + txctl.txq = sc->tx.txq_map[WME_AC_BE];
16 +
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;
24 +
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)
29 + return false;
30 +
31 + time_left = wait_for_completion_timeout(&sc->paprd_complete,
32 + msecs_to_jiffies(ATH_PAPRD_TIMEOUT));
33 + sc->paprd_pending = false;
34 +
35 + if (!time_left)
36 + ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CALIBRATE,
37 + "Timeout waiting for paprd training on TX chain %d\n",
38 + chain);
39 +
40 + return !!time_left;
41 +}
42 +
43 void ath_paprd_calibrate(struct work_struct *work)
44 {
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);
56 int ftype;
57 int chain_ok = 0;
58 int chain;
59 int len = 1800;
60 - int time_left;
61 - int i;
62
63 if (!caldata)
64 return;
65 @@ -347,8 +377,6 @@ void ath_paprd_calibrate(struct work_str
66 if (!skb)
67 return;
68
69 - tx_info = IEEE80211_SKB_CB(skb);
70 -
71 skb_put(skb, len);
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);
77
78 - memset(&txctl, 0, sizeof(txctl));
79 - txctl.txq = sc->tx.txq_map[WME_AC_BE];
80 -
81 ath9k_ps_wakeup(sc);
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
85 continue;
86
87 chain_ok = 0;
88 - memset(tx_info, 0, sizeof(*tx_info));
89 - tx_info->band = band;
90
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;
94 - }
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))
99 + goto fail_paprd;
100
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)
106 - break;
107
108 - time_left = wait_for_completion_timeout(&sc->paprd_complete,
109 - msecs_to_jiffies(ATH_PAPRD_TIMEOUT));
110 - sc->paprd_pending = false;
111 - if (!time_left) {
112 - ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE,
113 - "Timeout waiting for paprd training on TX chain %d\n",
114 - chain);
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))
118 goto fail_paprd;
119 - }
120
121 if (!ar9003_paprd_is_done(ah))
122 break;
This page took 0.044795 seconds and 5 git commands to generate.