Commit 8a0ee4fe authored by Karl Beldan's avatar Karl Beldan Committed by Johannes Berg

mac80211: minstrel_ht: macros adjustments for future VHT_GROUPs

No functional change.
Signed-off-by: default avatarKarl Beldan <karl.beldan@rivierawaves.com>
Cc: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent d4d141ca
...@@ -34,10 +34,14 @@ ...@@ -34,10 +34,14 @@
/* Transmit duration for the raw data part of an average sized packet */ /* Transmit duration for the raw data part of an average sized packet */
#define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) #define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps)))
#define BW_20 0
#define BW_40 1
/* /*
* Define group sort order: HT40 -> SGI -> #streams * Define group sort order: HT40 -> SGI -> #streams
*/ */
#define GROUP_IDX(_streams, _sgi, _ht40) \ #define GROUP_IDX(_streams, _sgi, _ht40) \
MINSTREL_HT_GROUP_0 + \
MINSTREL_MAX_STREAMS * 2 * _ht40 + \ MINSTREL_MAX_STREAMS * 2 * _ht40 + \
MINSTREL_MAX_STREAMS * _sgi + \ MINSTREL_MAX_STREAMS * _sgi + \
_streams - 1 _streams - 1
...@@ -77,7 +81,7 @@ ...@@ -77,7 +81,7 @@
CCK_ACK_DURATION(110, _short) CCK_ACK_DURATION(110, _short)
#define CCK_GROUP \ #define CCK_GROUP \
[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS] = { \ [MINSTREL_CCK_GROUP] = { \
.streams = 0, \ .streams = 0, \
.duration = { \ .duration = { \
CCK_DURATION_LIST(false), \ CCK_DURATION_LIST(false), \
...@@ -91,38 +95,36 @@ ...@@ -91,38 +95,36 @@
* use. * use.
* *
* Sortorder has to be fixed for GROUP_IDX macro to be applicable: * Sortorder has to be fixed for GROUP_IDX macro to be applicable:
* HT40 -> SGI -> #streams * BW -> SGI -> #streams
*/ */
const struct mcs_group minstrel_mcs_groups[] = { const struct mcs_group minstrel_mcs_groups[] = {
MCS_GROUP(1, 0, 0), MCS_GROUP(1, 0, BW_20),
MCS_GROUP(2, 0, 0), MCS_GROUP(2, 0, BW_20),
#if MINSTREL_MAX_STREAMS >= 3 #if MINSTREL_MAX_STREAMS >= 3
MCS_GROUP(3, 0, 0), MCS_GROUP(3, 0, BW_20),
#endif #endif
MCS_GROUP(1, 1, 0), MCS_GROUP(1, 1, BW_20),
MCS_GROUP(2, 1, 0), MCS_GROUP(2, 1, BW_20),
#if MINSTREL_MAX_STREAMS >= 3 #if MINSTREL_MAX_STREAMS >= 3
MCS_GROUP(3, 1, 0), MCS_GROUP(3, 1, BW_20),
#endif #endif
MCS_GROUP(1, 0, 1), MCS_GROUP(1, 0, BW_40),
MCS_GROUP(2, 0, 1), MCS_GROUP(2, 0, BW_40),
#if MINSTREL_MAX_STREAMS >= 3 #if MINSTREL_MAX_STREAMS >= 3
MCS_GROUP(3, 0, 1), MCS_GROUP(3, 0, BW_40),
#endif #endif
MCS_GROUP(1, 1, 1), MCS_GROUP(1, 1, BW_40),
MCS_GROUP(2, 1, 1), MCS_GROUP(2, 1, BW_40),
#if MINSTREL_MAX_STREAMS >= 3 #if MINSTREL_MAX_STREAMS >= 3
MCS_GROUP(3, 1, 1), MCS_GROUP(3, 1, BW_40),
#endif #endif
/* must be last */
CCK_GROUP CCK_GROUP
}; };
#define MINSTREL_CCK_GROUP (ARRAY_SIZE(minstrel_mcs_groups) - 1)
static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly;
...@@ -971,8 +973,7 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, ...@@ -971,8 +973,7 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
if (!sta->ht_cap.ht_supported) if (!sta->ht_cap.ht_supported)
goto use_legacy; goto use_legacy;
BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) != BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) != MINSTREL_GROUPS_NB);
MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS + 1);
msp->is_ht = true; msp->is_ht = true;
memset(mi, 0, sizeof(*mi)); memset(mi, 0, sizeof(*mi));
......
...@@ -14,7 +14,16 @@ ...@@ -14,7 +14,16 @@
* size and memory footprint. * size and memory footprint.
*/ */
#define MINSTREL_MAX_STREAMS 3 #define MINSTREL_MAX_STREAMS 3
#define MINSTREL_STREAM_GROUPS 4 #define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */
#define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \
MINSTREL_HT_STREAM_GROUPS)
#define MINSTREL_CCK_GROUPS_NB 1
#define MINSTREL_GROUPS_NB (MINSTREL_HT_GROUPS_NB + \
MINSTREL_CCK_GROUPS_NB)
#define MINSTREL_HT_GROUP_0 0
#define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB)
#define MCS_GROUP_RATES 8 #define MCS_GROUP_RATES 8
...@@ -80,7 +89,7 @@ struct minstrel_ht_sta { ...@@ -80,7 +89,7 @@ struct minstrel_ht_sta {
u8 cck_supported_short; u8 cck_supported_short;
/* MCS rate group info and statistics */ /* MCS rate group info and statistics */
struct minstrel_mcs_group_data groups[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS + 1]; struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB];
}; };
struct minstrel_ht_sta_priv { struct minstrel_ht_sta_priv {
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
static char * static char *
minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
{ {
unsigned int max_mcs = MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS;
const struct mcs_group *mg; const struct mcs_group *mg;
unsigned int j, tp, prob, eprob; unsigned int j, tp, prob, eprob;
char htmode = '2'; char htmode = '2';
...@@ -41,7 +40,7 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) ...@@ -41,7 +40,7 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
if (!(mi->groups[i].supported & BIT(j))) if (!(mi->groups[i].supported & BIT(j)))
continue; continue;
if (i == max_mcs) if (i == MINSTREL_CCK_GROUP)
p += sprintf(p, "CCK/%cP ", j < 4 ? 'L' : 'S'); p += sprintf(p, "CCK/%cP ", j < 4 ? 'L' : 'S');
else else
p += sprintf(p, "HT%c0/%cGI ", htmode, gimode); 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,7 +51,7 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
*(p++) = (idx == mi->max_tp_rate[3]) ? 'D' : ' '; *(p++) = (idx == mi->max_tp_rate[3]) ? 'D' : ' ';
*(p++) = (idx == mi->max_prob_rate) ? 'P' : ' '; *(p++) = (idx == mi->max_prob_rate) ? 'P' : ' ';
if (i == max_mcs) { if (i == MINSTREL_CCK_GROUP) {
int r = bitrates[j % 4]; int r = bitrates[j % 4];
p += sprintf(p, " %2u.%1uM", r / 10, r % 10); p += sprintf(p, " %2u.%1uM", r / 10, r % 10);
} else { } else {
...@@ -85,7 +84,6 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file) ...@@ -85,7 +84,6 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file)
struct minstrel_ht_sta *mi = &msp->ht; struct minstrel_ht_sta *mi = &msp->ht;
struct minstrel_debugfs_info *ms; struct minstrel_debugfs_info *ms;
unsigned int i; unsigned int i;
unsigned int max_mcs = MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS;
char *p; char *p;
int ret; int ret;
...@@ -106,8 +104,8 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file) ...@@ -106,8 +104,8 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file)
"ret *ok(*cum) ok( cum)\n"); "ret *ok(*cum) ok( cum)\n");
p = minstrel_ht_stats_dump(mi, max_mcs, p); p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p);
for (i = 0; i < max_mcs; i++) for (i = 0; i < MINSTREL_CCK_GROUP; i++)
p = minstrel_ht_stats_dump(mi, i, p); p = minstrel_ht_stats_dump(mi, i, p);
p += sprintf(p, "\nTotal packet count:: ideal %d " p += sprintf(p, "\nTotal packet count:: ideal %d "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment