diff options
author | Karl Beldan <karl.beldan@rivierawaves.com> | 2014-10-20 09:46:00 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-10-20 15:39:35 -0400 |
commit | 8a0ee4fe1951af252b1ac7b5c6af4083bafc4c7e (patch) | |
tree | 6a16d656abbfc365e37e510c9dd7f1c950e1e9a7 /net/mac80211 | |
parent | d4d141cae804a430054f4138fa177229114f203a (diff) |
mac80211: minstrel_ht: macros adjustments for future VHT_GROUPs
No functional change.
Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
Cc: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/rc80211_minstrel_ht.c | 51 | ||||
-rw-r--r-- | net/mac80211/rc80211_minstrel_ht.h | 15 | ||||
-rw-r--r-- | net/mac80211/rc80211_minstrel_ht_debugfs.c | 10 |
3 files changed, 42 insertions, 34 deletions
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index ccec718c29f9..a48eb76440c6 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -34,12 +34,16 @@ | |||
34 | /* Transmit duration for the raw data part of an average sized packet */ | 34 | /* Transmit duration for the raw data part of an average sized packet */ |
35 | #define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) | 35 | #define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) |
36 | 36 | ||
37 | #define BW_20 0 | ||
38 | #define BW_40 1 | ||
39 | |||
37 | /* | 40 | /* |
38 | * Define group sort order: HT40 -> SGI -> #streams | 41 | * Define group sort order: HT40 -> SGI -> #streams |
39 | */ | 42 | */ |
40 | #define GROUP_IDX(_streams, _sgi, _ht40) \ | 43 | #define GROUP_IDX(_streams, _sgi, _ht40) \ |
44 | MINSTREL_HT_GROUP_0 + \ | ||
41 | MINSTREL_MAX_STREAMS * 2 * _ht40 + \ | 45 | MINSTREL_MAX_STREAMS * 2 * _ht40 + \ |
42 | MINSTREL_MAX_STREAMS * _sgi + \ | 46 | MINSTREL_MAX_STREAMS * _sgi + \ |
43 | _streams - 1 | 47 | _streams - 1 |
44 | 48 | ||
45 | /* MCS rate information for an MCS group */ | 49 | /* MCS rate information for an MCS group */ |
@@ -76,13 +80,13 @@ | |||
76 | CCK_ACK_DURATION(55, _short), \ | 80 | CCK_ACK_DURATION(55, _short), \ |
77 | CCK_ACK_DURATION(110, _short) | 81 | CCK_ACK_DURATION(110, _short) |
78 | 82 | ||
79 | #define CCK_GROUP \ | 83 | #define CCK_GROUP \ |
80 | [MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS] = { \ | 84 | [MINSTREL_CCK_GROUP] = { \ |
81 | .streams = 0, \ | 85 | .streams = 0, \ |
82 | .duration = { \ | 86 | .duration = { \ |
83 | CCK_DURATION_LIST(false), \ | 87 | CCK_DURATION_LIST(false), \ |
84 | CCK_DURATION_LIST(true) \ | 88 | CCK_DURATION_LIST(true) \ |
85 | } \ | 89 | } \ |
86 | } | 90 | } |
87 | 91 | ||
88 | /* | 92 | /* |
@@ -91,38 +95,36 @@ | |||
91 | * use. | 95 | * use. |
92 | * | 96 | * |
93 | * Sortorder has to be fixed for GROUP_IDX macro to be applicable: | 97 | * Sortorder has to be fixed for GROUP_IDX macro to be applicable: |
94 | * HT40 -> SGI -> #streams | 98 | * BW -> SGI -> #streams |
95 | */ | 99 | */ |
96 | const struct mcs_group minstrel_mcs_groups[] = { | 100 | const struct mcs_group minstrel_mcs_groups[] = { |
97 | MCS_GROUP(1, 0, 0), | 101 | MCS_GROUP(1, 0, BW_20), |
98 | MCS_GROUP(2, 0, 0), | 102 | MCS_GROUP(2, 0, BW_20), |
99 | #if MINSTREL_MAX_STREAMS >= 3 | 103 | #if MINSTREL_MAX_STREAMS >= 3 |
100 | MCS_GROUP(3, 0, 0), | 104 | MCS_GROUP(3, 0, BW_20), |
101 | #endif | 105 | #endif |
102 | 106 | ||
103 | MCS_GROUP(1, 1, 0), | 107 | MCS_GROUP(1, 1, BW_20), |
104 | MCS_GROUP(2, 1, 0), | 108 | MCS_GROUP(2, 1, BW_20), |
105 | #if MINSTREL_MAX_STREAMS >= 3 | 109 | #if MINSTREL_MAX_STREAMS >= 3 |
106 | MCS_GROUP(3, 1, 0), | 110 | MCS_GROUP(3, 1, BW_20), |
107 | #endif | 111 | #endif |
108 | 112 | ||
109 | MCS_GROUP(1, 0, 1), | 113 | MCS_GROUP(1, 0, BW_40), |
110 | MCS_GROUP(2, 0, 1), | 114 | MCS_GROUP(2, 0, BW_40), |
111 | #if MINSTREL_MAX_STREAMS >= 3 | 115 | #if MINSTREL_MAX_STREAMS >= 3 |
112 | MCS_GROUP(3, 0, 1), | 116 | MCS_GROUP(3, 0, BW_40), |
113 | #endif | 117 | #endif |
114 | 118 | ||
115 | MCS_GROUP(1, 1, 1), | 119 | MCS_GROUP(1, 1, BW_40), |
116 | MCS_GROUP(2, 1, 1), | 120 | MCS_GROUP(2, 1, BW_40), |
117 | #if MINSTREL_MAX_STREAMS >= 3 | 121 | #if MINSTREL_MAX_STREAMS >= 3 |
118 | MCS_GROUP(3, 1, 1), | 122 | MCS_GROUP(3, 1, BW_40), |
119 | #endif | 123 | #endif |
120 | 124 | ||
121 | /* must be last */ | ||
122 | CCK_GROUP | 125 | CCK_GROUP |
123 | }; | 126 | }; |
124 | 127 | ||
125 | #define MINSTREL_CCK_GROUP (ARRAY_SIZE(minstrel_mcs_groups) - 1) | ||
126 | 128 | ||
127 | static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; | 129 | static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; |
128 | 130 | ||
@@ -971,8 +973,7 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, | |||
971 | if (!sta->ht_cap.ht_supported) | 973 | if (!sta->ht_cap.ht_supported) |
972 | goto use_legacy; | 974 | goto use_legacy; |
973 | 975 | ||
974 | BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) != | 976 | BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) != MINSTREL_GROUPS_NB); |
975 | MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS + 1); | ||
976 | 977 | ||
977 | msp->is_ht = true; | 978 | msp->is_ht = true; |
978 | memset(mi, 0, sizeof(*mi)); | 979 | memset(mi, 0, sizeof(*mi)); |
diff --git a/net/mac80211/rc80211_minstrel_ht.h b/net/mac80211/rc80211_minstrel_ht.h index 8b54e894b197..e747ac668afe 100644 --- a/net/mac80211/rc80211_minstrel_ht.h +++ b/net/mac80211/rc80211_minstrel_ht.h | |||
@@ -13,8 +13,17 @@ | |||
13 | * The number of streams can be changed to 2 to reduce code | 13 | * The number of streams can be changed to 2 to reduce code |
14 | * size and memory footprint. | 14 | * size and memory footprint. |
15 | */ | 15 | */ |
16 | #define MINSTREL_MAX_STREAMS 3 | 16 | #define MINSTREL_MAX_STREAMS 3 |
17 | #define MINSTREL_STREAM_GROUPS 4 | 17 | #define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */ |
18 | |||
19 | #define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \ | ||
20 | MINSTREL_HT_STREAM_GROUPS) | ||
21 | #define MINSTREL_CCK_GROUPS_NB 1 | ||
22 | #define MINSTREL_GROUPS_NB (MINSTREL_HT_GROUPS_NB + \ | ||
23 | MINSTREL_CCK_GROUPS_NB) | ||
24 | |||
25 | #define MINSTREL_HT_GROUP_0 0 | ||
26 | #define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB) | ||
18 | 27 | ||
19 | #define MCS_GROUP_RATES 8 | 28 | #define MCS_GROUP_RATES 8 |
20 | 29 | ||
@@ -80,7 +89,7 @@ struct minstrel_ht_sta { | |||
80 | u8 cck_supported_short; | 89 | u8 cck_supported_short; |
81 | 90 | ||
82 | /* MCS rate group info and statistics */ | 91 | /* MCS rate group info and statistics */ |
83 | struct minstrel_mcs_group_data groups[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS + 1]; | 92 | struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB]; |
84 | }; | 93 | }; |
85 | 94 | ||
86 | struct minstrel_ht_sta_priv { | 95 | struct minstrel_ht_sta_priv { |
diff --git a/net/mac80211/rc80211_minstrel_ht_debugfs.c b/net/mac80211/rc80211_minstrel_ht_debugfs.c index d537bec93754..d2f53b867660 100644 --- a/net/mac80211/rc80211_minstrel_ht_debugfs.c +++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c | |||
@@ -18,7 +18,6 @@ | |||
18 | static char * | 18 | static char * |
19 | minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) | 19 | minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) |
20 | { | 20 | { |
21 | unsigned int max_mcs = MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS; | ||
22 | const struct mcs_group *mg; | 21 | const struct mcs_group *mg; |
23 | unsigned int j, tp, prob, eprob; | 22 | unsigned int j, tp, prob, eprob; |
24 | char htmode = '2'; | 23 | char htmode = '2'; |
@@ -41,7 +40,7 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) | |||
41 | if (!(mi->groups[i].supported & BIT(j))) | 40 | if (!(mi->groups[i].supported & BIT(j))) |
42 | continue; | 41 | continue; |
43 | 42 | ||
44 | if (i == max_mcs) | 43 | if (i == MINSTREL_CCK_GROUP) |
45 | p += sprintf(p, "CCK/%cP ", j < 4 ? 'L' : 'S'); | 44 | p += sprintf(p, "CCK/%cP ", j < 4 ? 'L' : 'S'); |
46 | else | 45 | else |
47 | p += sprintf(p, "HT%c0/%cGI ", htmode, gimode); | 46 | p += sprintf(p, "HT%c0/%cGI ", htmode, gimode); |
@@ -52,7 +51,7 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) | |||
52 | *(p++) = (idx == mi->max_tp_rate[3]) ? 'D' : ' '; | 51 | *(p++) = (idx == mi->max_tp_rate[3]) ? 'D' : ' '; |
53 | *(p++) = (idx == mi->max_prob_rate) ? 'P' : ' '; | 52 | *(p++) = (idx == mi->max_prob_rate) ? 'P' : ' '; |
54 | 53 | ||
55 | if (i == max_mcs) { | 54 | if (i == MINSTREL_CCK_GROUP) { |
56 | int r = bitrates[j % 4]; | 55 | int r = bitrates[j % 4]; |
57 | p += sprintf(p, " %2u.%1uM", r / 10, r % 10); | 56 | p += sprintf(p, " %2u.%1uM", r / 10, r % 10); |
58 | } else { | 57 | } else { |
@@ -85,7 +84,6 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file) | |||
85 | struct minstrel_ht_sta *mi = &msp->ht; | 84 | struct minstrel_ht_sta *mi = &msp->ht; |
86 | struct minstrel_debugfs_info *ms; | 85 | struct minstrel_debugfs_info *ms; |
87 | unsigned int i; | 86 | unsigned int i; |
88 | unsigned int max_mcs = MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS; | ||
89 | char *p; | 87 | char *p; |
90 | int ret; | 88 | int ret; |
91 | 89 | ||
@@ -106,8 +104,8 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file) | |||
106 | "ret *ok(*cum) ok( cum)\n"); | 104 | "ret *ok(*cum) ok( cum)\n"); |
107 | 105 | ||
108 | 106 | ||
109 | p = minstrel_ht_stats_dump(mi, max_mcs, p); | 107 | p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p); |
110 | for (i = 0; i < max_mcs; i++) | 108 | for (i = 0; i < MINSTREL_CCK_GROUP; i++) |
111 | p = minstrel_ht_stats_dump(mi, i, p); | 109 | p = minstrel_ht_stats_dump(mi, i, p); |
112 | 110 | ||
113 | p += sprintf(p, "\nTotal packet count:: ideal %d " | 111 | p += sprintf(p, "\nTotal packet count:: ideal %d " |