cregit-Linux how code gets into the kernel

Release 4.11 net/mac80211/rc80211_minstrel_ht.c

Directory: net/mac80211
/*
 * Copyright (C) 2010-2013 Felix Fietkau <nbd@openwrt.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#include <linux/netdevice.h>
#include <linux/types.h>
#include <linux/skbuff.h>
#include <linux/debugfs.h>
#include <linux/random.h>
#include <linux/moduleparam.h>
#include <linux/ieee80211.h>
#include <net/mac80211.h>
#include "rate.h"
#include "sta_info.h"
#include "rc80211_minstrel.h"
#include "rc80211_minstrel_ht.h"


#define AVG_AMPDU_SIZE	16

#define AVG_PKT_SIZE	1200

/* Number of bits for an average sized packet */

#define MCS_NBITS ((AVG_PKT_SIZE * AVG_AMPDU_SIZE) << 3)

/* Number of symbols for a packet with (bps) bits per symbol */

#define MCS_NSYMS(bps) DIV_ROUND_UP(MCS_NBITS, (bps))

/* Transmission time (nanoseconds) for a packet containing (syms) symbols */

#define MCS_SYMBOL_TIME(sgi, syms)					\
	(sgi ?                                                          \
          ((syms) * 18000 + 4000) / 5 :	/* syms * 3.6 us */		\
          ((syms) * 1000) << 2		/* syms * 4 us */		\
        )

/* 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))) / AVG_AMPDU_SIZE)


#define BW_20			0

#define BW_40			1

#define BW_80			2

/*
 * Define group sort order: HT40 -> SGI -> #streams
 */

#define GROUP_IDX(_streams, _sgi, _ht40)	\
	MINSTREL_HT_GROUP_0 +                   \
        MINSTREL_MAX_STREAMS * 2 * _ht40 +      \
        MINSTREL_MAX_STREAMS * _sgi +   \
        _streams - 1

/* MCS rate information for an MCS group */

#define MCS_GROUP(_streams, _sgi, _ht40)				\
	[GROUP_IDX(_streams, _sgi, _ht40)] = {                          \
        .streams = _streams,                                            \
        .flags =                                                        \
                IEEE80211_TX_RC_MCS |                                   \
                (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) |                 \
                (_ht40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0),             \
        .duration = {                                                   \
                MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26),          \
                MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52),         \
                MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78),         \
                MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104),        \
                MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156),        \
                MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208),        \
                MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234),        \
                MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260)         \
        }                                                               \
}


#define VHT_GROUP_IDX(_streams, _sgi, _bw)				\
	(MINSTREL_VHT_GROUP_0 +                                         \
         MINSTREL_MAX_STREAMS * 2 * (_bw) +                             \
         MINSTREL_MAX_STREAMS * (_sgi) +                                \
         (_streams) - 1)


#define BW2VBPS(_bw, r3, r2, r1)					\
	(_bw == BW_80 ? r3 : _bw == BW_40 ? r2 : r1)


#define VHT_GROUP(_streams, _sgi, _bw)					\
	[VHT_GROUP_IDX(_streams, _sgi, _bw)] = {                        \
        .streams = _streams,                                            \
        .flags =                                                        \
                IEEE80211_TX_RC_VHT_MCS |                               \
                (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) |                 \
                (_bw == BW_80 ? IEEE80211_TX_RC_80_MHZ_WIDTH :          \
                 _bw == BW_40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0),      \
        .duration = {                                                   \
                MCS_DURATION(_streams, _sgi,                            \
                             BW2VBPS(_bw,  117,  54,  26)),             \
                MCS_DURATION(_streams, _sgi,                            \
                             BW2VBPS(_bw,  234, 108,  52)),             \
                MCS_DURATION(_streams, _sgi,                            \
                             BW2VBPS(_bw,  351, 162,  78)),             \
                MCS_DURATION(_streams, _sgi,                            \
                             BW2VBPS(_bw,  468, 216, 104)),             \
                MCS_DURATION(_streams, _sgi,                            \
                             BW2VBPS(_bw,  702, 324, 156)),             \
                MCS_DURATION(_streams, _sgi,                            \
                             BW2VBPS(_bw,  936, 432, 208)),             \
                MCS_DURATION(_streams, _sgi,                            \
                             BW2VBPS(_bw, 1053, 486, 234)),             \
                MCS_DURATION(_streams, _sgi,                            \
                             BW2VBPS(_bw, 1170, 540, 260)),             \
                MCS_DURATION(_streams, _sgi,                            \
                             BW2VBPS(_bw, 1404, 648, 312)),             \
                MCS_DURATION(_streams, _sgi,                            \
                             BW2VBPS(_bw, 1560, 720, 346))              \
        }                                                               \
}


#define CCK_DURATION(_bitrate, _short, _len)		\
	(1000 * (10 /* SIFS */ +                       \
         (_short ? 72 + 24 : 144 + 48) +                \
         (8 * (_len + 4) * 10) / (_bitrate)))


#define CCK_ACK_DURATION(_bitrate, _short)			\
	(CCK_DURATION((_bitrate > 10 ? 20 : 10), false, 60) +   \
         CCK_DURATION(_bitrate, _short, AVG_PKT_SIZE))


#define CCK_DURATION_LIST(_short)			\
	CCK_ACK_DURATION(10, _short),                   \
        CCK_ACK_DURATION(20, _short),                   \
        CCK_ACK_DURATION(55, _short),                   \
        CCK_ACK_DURATION(110, _short)


#define CCK_GROUP					\
	[MINSTREL_CCK_GROUP] = {                        \
                .streams = 0,                           \
                .flags = 0,                             \
                .duration = {                           \
                        CCK_DURATION_LIST(false),       \
                        CCK_DURATION_LIST(true)         \
                }                                       \
        }

#ifdef CONFIG_MAC80211_RC_MINSTREL_VHT

static bool minstrel_vht_only = true;
module_param(minstrel_vht_only, bool, 0644);
MODULE_PARM_DESC(minstrel_vht_only,
		 "Use only VHT rates when VHT is supported by sta.");
#endif

/*
 * To enable sufficiently targeted rate sampling, MCS rates are divided into
 * groups, based on the number of streams and flags (HT40, SGI) that they
 * use.
 *
 * Sortorder has to be fixed for GROUP_IDX macro to be applicable:
 * BW -> SGI -> #streams
 */

const struct mcs_group minstrel_mcs_groups[] = {
	MCS_GROUP(1, 0, BW_20),
	MCS_GROUP(2, 0, BW_20),
	MCS_GROUP(3, 0, BW_20),

	MCS_GROUP(1, 1, BW_20),
	MCS_GROUP(2, 1, BW_20),
	MCS_GROUP(3, 1, BW_20),

	MCS_GROUP(1, 0, BW_40),
	MCS_GROUP(2, 0, BW_40),
	MCS_GROUP(3, 0, BW_40),

	MCS_GROUP(1, 1, BW_40),
	MCS_GROUP(2, 1, BW_40),
	MCS_GROUP(3, 1, BW_40),

	CCK_GROUP,

#ifdef CONFIG_MAC80211_RC_MINSTREL_VHT
	VHT_GROUP(1, 0, BW_20),
	VHT_GROUP(2, 0, BW_20),
	VHT_GROUP(3, 0, BW_20),

	VHT_GROUP(1, 1, BW_20),
	VHT_GROUP(2, 1, BW_20),
	VHT_GROUP(3, 1, BW_20),

	VHT_GROUP(1, 0, BW_40),
	VHT_GROUP(2, 0, BW_40),
	VHT_GROUP(3, 0, BW_40),

	VHT_GROUP(1, 1, BW_40),
	VHT_GROUP(2, 1, BW_40),
	VHT_GROUP(3, 1, BW_40),

	VHT_GROUP(1, 0, BW_80),
	VHT_GROUP(2, 0, BW_80),
	VHT_GROUP(3, 0, BW_80),

	VHT_GROUP(1, 1, BW_80),
	VHT_GROUP(2, 1, BW_80),
	VHT_GROUP(3, 1, BW_80),
#endif
};


static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly;

static void
minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi);

/*
 * Some VHT MCSes are invalid (when Ndbps / Nes is not an integer)
 * e.g for MCS9@20MHzx1Nss: Ndbps=8x52*(5/6) Nes=1
 *
 * Returns the valid mcs map for struct minstrel_mcs_group_data.supported
 */

static u16 minstrel_get_valid_vht_rates(int bw, int nss, __le16 mcs_map) { u16 mask = 0; if (bw == BW_20) { if (nss != 3 && nss != 6) mask = BIT(9); } else if (bw == BW_80) { if (nss == 3 || nss == 7) mask = BIT(6); else if (nss == 6) mask = BIT(9); } else { WARN_ON(bw != BW_40); } switch ((le16_to_cpu(mcs_map) >> (2 * (nss - 1))) & 3) { case IEEE80211_VHT_MCS_SUPPORT_0_7: mask |= 0x300; break; case IEEE80211_VHT_MCS_SUPPORT_0_8: mask |= 0x200; break; case IEEE80211_VHT_MCS_SUPPORT_0_9: break; default: mask = 0x3ff; } return 0x3ff & ~mask; }

Contributors

PersonTokensPropCommitsCommitProp
Karl Beldan149100.00%1100.00%
Total149100.00%1100.00%

/* * Look up an MCS group index based on mac80211 rate information */
static int minstrel_ht_get_group_idx(struct ieee80211_tx_rate *rate) { return GROUP_IDX((rate->idx / 8) + 1, !!(rate->flags & IEEE80211_TX_RC_SHORT_GI), !!(rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)); }

Contributors

PersonTokensPropCommitsCommitProp
Felix Fietkau2555.56%125.00%
Helmut Schaa1431.11%125.00%
Karl Beldan613.33%250.00%
Total45100.00%4100.00%


static int minstrel_vht_get_group_idx(struct ieee80211_tx_rate *rate) { return VHT_GROUP_IDX(ieee80211_rate_get_vht_nss(rate), !!(rate->flags & IEEE80211_TX_RC_SHORT_GI), !!(rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) + 2*!!(rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)); }

Contributors

PersonTokensPropCommitsCommitProp
Karl Beldan4892.31%150.00%
Felix Fietkau47.69%150.00%
Total52100.00%2100.00%


static struct minstrel_rate_stats * minstrel_ht_get_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, struct ieee80211_tx_rate *rate) { int group, idx; if (rate->flags & IEEE80211_TX_RC_MCS) { group = minstrel_ht_get_group_idx(rate); idx = rate->idx % 8; } else if (rate->flags & IEEE80211_TX_RC_VHT_MCS) { group = minstrel_vht_get_group_idx(rate); idx = ieee80211_rate_get_vht_mcs(rate); } else { group = MINSTREL_CCK_GROUP; for (idx = 0; idx < ARRAY_SIZE(mp->cck_rates); idx++) if (rate->idx == mp->cck_rates[idx]) break; /* short preamble */ if (!(mi->supported[group] & BIT(idx))) idx += 4; } return &mi->groups[group].rates[idx]; }

Contributors

PersonTokensPropCommitsCommitProp
Felix Fietkau12783.01%360.00%
Karl Beldan2616.99%240.00%
Total153100.00%5100.00%


static inline struct minstrel_rate_stats * minstrel_get_ratestats(struct minstrel_ht_sta *mi, int index) { return &mi->groups[index / MCS_GROUP_RATES].rates[index % MCS_GROUP_RATES]; }

Contributors

PersonTokensPropCommitsCommitProp
Felix Fietkau35100.00%2100.00%
Total35100.00%2100.00%

/* * Return current throughput based on the average A-MPDU length, taking into * account the expected number of retransmissions and their expected length */
int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, int prob_ewma) { unsigned int nsecs = 0; /* do not account throughput if sucess prob is below 10% */ if (prob_ewma < MINSTREL_FRAC(10, 100)) return 0; if (group != MINSTREL_CCK_GROUP) nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); nsecs += minstrel_mcs_groups[group].duration[rate]; /* * For the throughput calculation, limit the probability value to 90% to * account for collision related packet error rate fluctuation * (prob is scaled - see MINSTREL_FRAC above) */ if (prob_ewma > MINSTREL_FRAC(90, 100)) return MINSTREL_TRUNC(100000 * ((MINSTREL_FRAC(90, 100) * 1000) / nsecs)); else return MINSTREL_TRUNC(100000 * ((prob_ewma * 1000) / nsecs)); }

Contributors

PersonTokensPropCommitsCommitProp
Felix Fietkau7258.54%457.14%
Thomas Huehn5141.46%342.86%
Total123100.00%7100.00%

/* * Find & sort topmost throughput rates * * If multiple rates provide equal throughput the sorting is based on their * current success probability. Higher success probability is preferred among * MCS groups, CCK rates do not provide aggregation and are therefore at last. */
static void minstrel_ht_sort_best_tp_rates(struct minstrel_ht_sta *mi, u16 index, u16 *tp_list) { int cur_group, cur_idx, cur_tp_avg, cur_prob; int tmp_group, tmp_idx, tmp_tp_avg, tmp_prob; int j = MAX_THR_RATES; cur_group = index / MCS_GROUP_RATES; cur_idx = index % MCS_GROUP_RATES; cur_prob = mi->groups[cur_group].rates[cur_idx].prob_ewma; cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx, cur_prob); do { tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; tmp_tp_avg = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); if (cur_tp_avg < tmp_tp_avg || (cur_tp_avg == tmp_tp_avg && cur_prob <= tmp_prob)) break; j--; } while (j > 0); if (j < MAX_THR_RATES - 1) { memmove(&tp_list[j + 1], &tp_list[j], (sizeof(*tp_list) * (MAX_THR_RATES - (j + 1)))); } if (j < MAX_THR_RATES) tp_list[j] = index; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Huehn16273.30%444.44%
Felix Fietkau4922.17%222.22%
Karl Beldan104.52%333.33%
Total221100.00%9100.00%

/* * Find and set the topmost probability rate per sta and per group */
static void minstrel_ht_set_best_prob_rate(struct minstrel_ht_sta *mi, u16 index) { struct minstrel_mcs_group_data *mg; struct minstrel_rate_stats *mrs; int tmp_group, tmp_idx, tmp_tp_avg, tmp_prob; int max_tp_group, cur_tp_avg, cur_group, cur_idx; int max_gpr_group, max_gpr_idx; int max_gpr_tp_avg, max_gpr_prob; cur_group = index / MCS_GROUP_RATES; cur_idx = index % MCS_GROUP_RATES; mg = &mi->groups[index / MCS_GROUP_RATES]; mrs = &mg->rates[index % MCS_GROUP_RATES]; tmp_group = mi->max_prob_rate / MCS_GROUP_RATES; tmp_idx = mi->max_prob_rate % MCS_GROUP_RATES; tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; tmp_tp_avg = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); /* if max_tp_rate[0] is from MCS_GROUP max_prob_rate get selected from * MCS_GROUP as well as CCK_GROUP rates do not allow aggregation */ max_tp_group = mi->max_tp_rate[0] / MCS_GROUP_RATES; if((index / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) && (max_tp_group != MINSTREL_CCK_GROUP)) return; max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES; max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma; if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) { cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx, mrs->prob_ewma); if (cur_tp_avg > tmp_tp_avg) mi->max_prob_rate = index; max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group, max_gpr_idx, max_gpr_prob); if (cur_tp_avg > max_gpr_tp_avg) mg->max_group_prob_rate = index; } else { if (mrs->prob_ewma > tmp_prob) mi->max_prob_rate = index; if (mrs->prob_ewma > max_gpr_prob) mg->max_group_prob_rate = index; } }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Huehn20670.55%444.44%
Felix Fietkau3511.99%111.11%
Konstantin Khlebnikov3311.30%111.11%
Karl Beldan175.82%222.22%
Lei Ming10.34%111.11%
Total292100.00%9100.00%

/* * Assign new rate set per sta and use CCK rates only if the fastest * rate (max_tp_rate[0]) is from CCK group. This prohibits such sorted * rate sets where MCS and CCK rates are mixed, because CCK rates can * not use aggregation. */
static void minstrel_ht_assign_best_tp_rates(struct minstrel_ht_sta *mi, u16 tmp_mcs_tp_rate[MAX_THR_RATES], u16 tmp_cck_tp_rate[MAX_THR_RATES]) { unsigned int tmp_group, tmp_idx, tmp_cck_tp, tmp_mcs_tp, tmp_prob; int i; tmp_group = tmp_cck_tp_rate[0] / MCS_GROUP_RATES; tmp_idx = tmp_cck_tp_rate[0] % MCS_GROUP_RATES; tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; tmp_cck_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); tmp_group = tmp_mcs_tp_rate[0] / MCS_GROUP_RATES; tmp_idx = tmp_mcs_tp_rate[0] % MCS_GROUP_RATES; tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; tmp_mcs_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); if (tmp_cck_tp > tmp_mcs_tp) { for(i = 0; i < MAX_THR_RATES; i++) { minstrel_ht_sort_best_tp_rates(mi, tmp_cck_tp_rate[i], tmp_mcs_tp_rate); } } }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Huehn15492.22%360.00%
Felix Fietkau116.59%120.00%
Karl Beldan21.20%120.00%
Total167100.00%5100.00%

/* * Try to increase robustness of max_prob rate by decrease number of * streams if possible. */
static inline void minstrel_ht_prob_rate_reduce_streams(struct minstrel_ht_sta *mi) { struct minstrel_mcs_group_data *mg; int tmp_max_streams, group, tmp_idx, tmp_prob; int tmp_tp = 0; tmp_max_streams = minstrel_mcs_groups[mi->max_tp_rate[0] / MCS_GROUP_RATES].streams; for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { mg = &mi->groups[group]; if (!mi->supported[group] || group == MINSTREL_CCK_GROUP) continue; tmp_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; tmp_prob = mi->groups[group].rates[tmp_idx].prob_ewma; if (tmp_tp < minstrel_ht_get_tp_avg(mi, group, tmp_idx, tmp_prob) && (minstrel_mcs_groups[group].streams < tmp_max_streams)) { mi->max_prob_rate = mg->max_group_prob_rate; tmp_tp = minstrel_ht_get_tp_avg(mi, group, tmp_idx, tmp_prob); } } }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Huehn10463.80%350.00%
Felix Fietkau5936.20%350.00%
Total163100.00%6100.00%

/* * Update rate statistics and select new primary rates * * Rules for rate selection: * - max_prob_rate must use only one stream, as a tradeoff between delivery * probability and throughput during strong fluctuations * - as long as the max prob rate has a probability of more than 75%, pick * higher throughput rates, even if the probablity is a bit lower */
static void minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) { struct minstrel_mcs_group_data *mg; struct minstrel_rate_stats *mrs; int group, i, j, cur_prob; u16 tmp_mcs_tp_rate[MAX_THR_RATES], tmp_group_tp_rate[MAX_THR_RATES]; u16 tmp_cck_tp_rate[MAX_THR_RATES], index; if (mi->ampdu_packets > 0) { mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets), EWMA_LEVEL); mi->ampdu_len = 0; mi->ampdu_packets = 0; } mi->sample_slow = 0; mi->sample_count = 0; /* Initialize global rate indexes */ for(j = 0; j < MAX_THR_RATES; j++){ tmp_mcs_tp_rate[j] = 0; tmp_cck_tp_rate[j] = 0; } /* Find best rate sets within all MCS groups*/ for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { mg = &mi->groups[group]; if (!mi->supported[group]) continue; mi->sample_count++; /* (re)Initialize group rate indexes */ for(j = 0; j < MAX_THR_RATES; j++) tmp_group_tp_rate[j] = group; for (i = 0; i < MCS_GROUP_RATES; i++) { if (!(mi->supported[group] & BIT(i))) continue; index = MCS_GROUP_RATES * group + i; mrs = &mg->rates[i]; mrs->retry_updated = false; minstrel_calc_rate_stats(mrs); cur_prob = mrs->prob_ewma; if (minstrel_ht_get_tp_avg(mi, group, i, cur_prob) == 0) continue; /* Find max throughput rate set */ if (group != MINSTREL_CCK_GROUP) { minstrel_ht_sort_best_tp_rates(mi, index, tmp_mcs_tp_rate); } else if (group == MINSTREL_CCK_GROUP) { minstrel_ht_sort_best_tp_rates(mi, index, tmp_cck_tp_rate); } /* Find max throughput rate set within a group */ minstrel_ht_sort_best_tp_rates(mi, index, tmp_group_tp_rate); /* Find max probability rate per group and global */ minstrel_ht_set_best_prob_rate(mi, index); } memcpy(mg->max_group_tp_rate, tmp_group_tp_rate, sizeof(mg->max_group_tp_rate)); } /* Assign new rate set per sta */ minstrel_ht_assign_best_tp_rates(mi, tmp_mcs_tp_rate, tmp_cck_tp_rate); memcpy(mi->max_tp_rate, tmp_mcs_tp_rate, sizeof(mi->max_tp_rate)); /* Try to increase robustness of max_prob_rate*/ minstrel_ht_prob_rate_reduce_streams(mi); /* try to sample all available rates during each interval */ mi->sample_count *= 8; #ifdef CONFIG_MAC80211_DEBUGFS /* use fixed index if set */ if (mp->fixed_rate_idx != -1) { for (i = 0; i < 4; i++) mi->max_tp_rate[i] = mp->fixed_rate_idx; mi->max_prob_rate = mp->fixed_rate_idx; } #endif /* Reset update timer */ mi->last_stats_update = jiffies; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Huehn34274.84%538.46%
Felix Fietkau7416.19%430.77%
Lorenzo Bianconi378.10%215.38%
Lei Ming20.44%17.69%
Karl Beldan20.44%17.69%
Total457100.00%13100.00%


static bool minstrel_ht_txstat_valid(struct minstrel_priv *mp, struct ieee80211_tx_rate *rate) { if (rate->idx < 0) return false; if (!rate->count) return false; if (rate->flags & IEEE80211_TX_RC_MCS || rate->flags & IEEE80211_TX_RC_VHT_MCS) return true; return rate->idx == mp->cck_rates[0] || rate->idx == mp->cck_rates[1] || rate->idx == mp->cck_rates[2] || rate->idx == mp->cck_rates[3]; }

Contributors

PersonTokensPropCommitsCommitProp
Felix Fietkau8888.89%250.00%
Karl Beldan66.06%125.00%
Helmut Schaa55.05%125.00%
Total99100.00%4100.00%


static void minstrel_set_next_sample_idx(struct minstrel_ht_sta *mi) { struct minstrel_mcs_group_data *mg; for (;;) { mi->sample_group++; mi->sample_group %= ARRAY_SIZE(minstrel_mcs_groups); mg = &mi->groups[mi->sample_group]; if (!mi->supported[mi->sample_group]) continue; if (++mg->index >= MCS_GROUP_RATES) { mg->index = 0; if (++mg->column >= ARRAY_SIZE(sample_table)) mg->column = 0; } break; } }

Contributors

PersonTokensPropCommitsCommitProp
Felix Fietkau9798.98%266.67%
Thomas Huehn11.02%133.33%
Total98100.00%3100.00%


static void minstrel_downgrade_rate(struct minstrel_ht_sta *mi, u16 *idx, bool primary) { int group, orig_group; orig_group = group = *idx / MCS_GROUP_RATES; while (group > 0) { group--; if (!mi->supported[group]) continue; if (minstrel_mcs_groups[group].streams > minstrel_mcs_groups[orig_group].streams) continue; if (primary) *idx = mi->groups[group].max_group_tp_rate[0]; else *idx = mi->groups[group].max_group_tp_rate[1]; break; } }

Contributors

PersonTokensPropCommitsCommitProp
Felix Fietkau9891.59%250.00%
Thomas Huehn87.48%125.00%
Karl Beldan10.93%125.00%
Total107100.00%4100.00%


static void minstrel_aggr_check(struct ieee80211_sta *pubsta, struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; struct sta_info *sta = container_of(pubsta, struct sta_info, sta); u16 tid; if (skb_get_queue_mapping(skb) == IEEE80211_AC_VO) return; if (unlikely(!ieee80211_is_data_qos(hdr->frame_control))) return; if (unlikely(skb->protocol == cpu_to_be16(ETH_P_PAE))) return; tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; if (likely(sta->ampdu_mlme.tid_tx[tid])) return; ieee80211_start_tx_ba_session(pubsta, tid, 0); }

Contributors

PersonTokensPropCommitsCommitProp
Felix Fietkau11292.56%350.00%
Johannes Berg86.61%233.33%
Sujith Manoharan10.83%116.67%
Total121100.00%6100.00%


static void minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband, struct ieee80211_sta *sta, void *priv_sta, struct ieee80211_tx_info *info) { struct minstrel_ht_sta_priv *msp = priv_sta; struct minstrel_ht_sta *mi = &msp->ht; struct ieee80211_tx_rate *ar = info->status.rates; struct minstrel_rate_stats *rate