package/button-hotplug: handle KEY_RESTART and KEY_WPS_BUTTON codes as well
[openwrt.git] / package / mac80211 / patches / 561-ath9k_streams_init.patch
1 --- a/drivers/net/wireless/ath/ath9k/init.c
2 +++ b/drivers/net/wireless/ath/ath9k/init.c
3 @@ -176,6 +176,18 @@ static const struct ath_ops ath9k_common
4 .write = ath9k_iowrite32,
5 };
6
7 +static int count_streams(unsigned int chainmask, int max)
8 +{
9 + int streams = 0;
10 +
11 + do {
12 + if (++streams == max)
13 + break;
14 + } while ((chainmask = chainmask & (chainmask - 1)));
15 +
16 + return streams;
17 +}
18 +
19 /**************************/
20 /* Initialization */
21 /**************************/
22 @@ -183,8 +195,10 @@ static const struct ath_ops ath9k_common
23 static void setup_ht_cap(struct ath_softc *sc,
24 struct ieee80211_sta_ht_cap *ht_info)
25 {
26 - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
27 + struct ath_hw *ah = sc->sc_ah;
28 + struct ath_common *common = ath9k_hw_common(ah);
29 u8 tx_streams, rx_streams;
30 + int i, max_streams;
31
32 ht_info->ht_supported = true;
33 ht_info->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
34 @@ -198,25 +212,28 @@ static void setup_ht_cap(struct ath_soft
35 ht_info->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
36 ht_info->ampdu_density = IEEE80211_HT_MPDU_DENSITY_8;
37
38 + if (AR_SREV_9300_20_OR_LATER(ah))
39 + max_streams = 3;
40 + else
41 + max_streams = 2;
42 +
43 /* set up supported mcs set */
44 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
45 - tx_streams = !(common->tx_chainmask & (common->tx_chainmask - 1)) ?
46 - 1 : 2;
47 - rx_streams = !(common->rx_chainmask & (common->rx_chainmask - 1)) ?
48 - 1 : 2;
49 + tx_streams = count_streams(common->tx_chainmask, max_streams);
50 + rx_streams = count_streams(common->rx_chainmask, max_streams);
51 +
52 + ath_print(common, ATH_DBG_CONFIG,
53 + "TX streams %d, RX streams: %d\n",
54 + tx_streams, rx_streams);
55
56 if (tx_streams != rx_streams) {
57 - ath_print(common, ATH_DBG_CONFIG,
58 - "TX streams %d, RX streams: %d\n",
59 - tx_streams, rx_streams);
60 ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF;
61 ht_info->mcs.tx_params |= ((tx_streams - 1) <<
62 IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
63 }
64
65 - ht_info->mcs.rx_mask[0] = 0xff;
66 - if (rx_streams >= 2)
67 - ht_info->mcs.rx_mask[1] = 0xff;
68 + for (i = 0; i < rx_streams; i++)
69 + ht_info->mcs.rx_mask[i] = 0xff;
70
71 ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED;
72 }
This page took 0.049143 seconds and 5 git commands to generate.