ath9k: enable 3-stream and MCS16-23 support
[openwrt/staging/chunkeey.git] / package / mac80211 / patches / 563-ath9k_bits_per_symbol.patch
1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -34,7 +34,7 @@
4
5 #define OFDM_SIFS_TIME 16
6
7 -static u32 bits_per_symbol[][2] = {
8 +static u16 bits_per_symbol[][2] = {
9 /* 20MHz 40MHz */
10 { 26, 54 }, /* 0: BPSK */
11 { 52, 108 }, /* 1: QPSK 1/2 */
12 @@ -44,14 +44,6 @@ static u32 bits_per_symbol[][2] = {
13 { 208, 432 }, /* 5: 64-QAM 2/3 */
14 { 234, 486 }, /* 6: 64-QAM 3/4 */
15 { 260, 540 }, /* 7: 64-QAM 5/6 */
16 - { 52, 108 }, /* 8: BPSK */
17 - { 104, 216 }, /* 9: QPSK 1/2 */
18 - { 156, 324 }, /* 10: QPSK 3/4 */
19 - { 208, 432 }, /* 11: 16-QAM 1/2 */
20 - { 312, 648 }, /* 12: 16-QAM 3/4 */
21 - { 416, 864 }, /* 13: 64-QAM 2/3 */
22 - { 468, 972 }, /* 14: 64-QAM 3/4 */
23 - { 520, 1080 }, /* 15: 64-QAM 5/6 */
24 };
25
26 #define IS_HT_RATE(_rate) ((_rate) & 0x80)
27 @@ -601,7 +593,7 @@ static int ath_compute_num_delims(struct
28 u32 nsymbits, nsymbols;
29 u16 minlen;
30 u8 flags, rix;
31 - int width, half_gi, ndelim, mindelim;
32 + int width, streams, half_gi, ndelim, mindelim;
33
34 /* Select standard number of delimiters based on frame length alone */
35 ndelim = ATH_AGGR_GET_NDELIM(frmlen);
36 @@ -641,7 +633,8 @@ static int ath_compute_num_delims(struct
37 if (nsymbols == 0)
38 nsymbols = 1;
39
40 - nsymbits = bits_per_symbol[rix][width];
41 + streams = HT_RC_2_STREAMS(rix);
42 + nsymbits = bits_per_symbol[rix % 8][width] * streams;
43 minlen = (nsymbols * nsymbits) / BITS_PER_BYTE;
44
45 if (frmlen < minlen) {
46 @@ -1533,8 +1526,9 @@ static u32 ath_pkt_duration(struct ath_s
47 pktlen = bf_isaggr(bf) ? bf->bf_al : bf->bf_frmlen;
48
49 /* find number of symbols: PLCP + data */
50 + streams = HT_RC_2_STREAMS(rix);
51 nbits = (pktlen << 3) + OFDM_PLCP_BITS;
52 - nsymbits = bits_per_symbol[rix][width];
53 + nsymbits = bits_per_symbol[rix % 8][width] * streams;
54 nsymbols = (nbits + nsymbits - 1) / nsymbits;
55
56 if (!half_gi)
57 @@ -1543,7 +1537,6 @@ static u32 ath_pkt_duration(struct ath_s
58 duration = SYMBOL_TIME_HALFGI(nsymbols);
59
60 /* addup duration for legacy/ht training and signal fields */
61 - streams = HT_RC_2_STREAMS(rix);
62 duration += L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams);
63
64 return duration;