All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH 1/6] mac80211: minstrel_ht: use bitfields to encode rate indexes
Date: Tue, 26 Jan 2021 03:25:06 +0800	[thread overview]
Message-ID: <202101260334.6Idj0Wup-lkp@intel.com> (raw)
In-Reply-To: <20210124122812.49929-1-nbd@nbd.name>

[-- Attachment #1: Type: text/plain, Size: 14710 bytes --]

Hi Felix,

I love your patch! Perhaps something to improve:

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on next-20210125]
[cannot apply to mac80211/master v5.11-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Felix-Fietkau/mac80211-minstrel_ht-use-bitfields-to-encode-rate-indexes/20210125-210635
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: x86_64-randconfig-a015-20210125 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 12d0753aca22896fda2cf76781b0ee0524d55065)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/8a2d01887013f71806262345f71766d6518e3552
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Felix-Fietkau/mac80211-minstrel_ht-use-bitfields-to-encode-rate-indexes/20210125-210635
        git checkout 8a2d01887013f71806262345f71766d6518e3552
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> net/mac80211/rc80211_minstrel_ht.c:862:11: warning: variable 'group' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           else if (mi->supported[MINSTREL_OFDM_GROUP])
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/mac80211/rc80211_minstrel_ht.c:865:18: note: uninitialized use occurs here
           index = MI_RATE(group, 0);
                           ^~~~~
   net/mac80211/rc80211_minstrel_ht.h:66:34: note: expanded from macro 'MI_RATE'
           (FIELD_PREP(MI_RATE_GROUP_MASK, _group) |       \
                                           ^~~~~~
   include/linux/bitfield.h:95:20: note: expanded from macro 'FIELD_PREP'
                   ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask);   \
                                    ^~~~
   net/mac80211/rc80211_minstrel_ht.c:862:7: note: remove the 'if' if its condition is always true
           else if (mi->supported[MINSTREL_OFDM_GROUP])
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/mac80211/rc80211_minstrel_ht.c:825:11: note: initialize the variable 'group' to silence this warning
           int group, i, j, cur_prob;
                    ^
                     = 0
   1 warning generated.


vim +862 net/mac80211/rc80211_minstrel_ht.c

cbda98c710d273b Felix Fietkau 2021-01-15  809  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  810  /*
ec8aa669b8393b6 Felix Fietkau 2010-05-13  811   * Update rate statistics and select new primary rates
ec8aa669b8393b6 Felix Fietkau 2010-05-13  812   *
ec8aa669b8393b6 Felix Fietkau 2010-05-13  813   * Rules for rate selection:
ec8aa669b8393b6 Felix Fietkau 2010-05-13  814   *  - max_prob_rate must use only one stream, as a tradeoff between delivery
ec8aa669b8393b6 Felix Fietkau 2010-05-13  815   *    probability and throughput during strong fluctuations
5935839ad735837 Thomas Huehn  2014-09-09  816   *  - as long as the max prob rate has a probability of more than 75%, pick
ec8aa669b8393b6 Felix Fietkau 2010-05-13  817   *    higher throughput rates, even if the probablity is a bit lower
ec8aa669b8393b6 Felix Fietkau 2010-05-13  818   */
ec8aa669b8393b6 Felix Fietkau 2010-05-13  819  static void
48cb39522a9d4d4 Felix Fietkau 2019-08-20  820  minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
48cb39522a9d4d4 Felix Fietkau 2019-08-20  821  			 bool sample)
ec8aa669b8393b6 Felix Fietkau 2010-05-13  822  {
ec8aa669b8393b6 Felix Fietkau 2010-05-13  823  	struct minstrel_mcs_group_data *mg;
9134073bc693633 Thomas Huehn  2015-03-24  824  	struct minstrel_rate_stats *mrs;
50e55a8ea76fb59 Thomas Huehn  2015-03-24  825  	int group, i, j, cur_prob;
d4d141cae804a43 Karl Beldan   2014-10-20  826  	u16 tmp_mcs_tp_rate[MAX_THR_RATES], tmp_group_tp_rate[MAX_THR_RATES];
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  827  	u16 tmp_legacy_tp_rate[MAX_THR_RATES], tmp_max_prob_rate;
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  828  	u16 index;
a7844a53846017c Felix Fietkau 2021-01-15  829  	bool ht_supported = mi->sta->ht_cap.ht_supported;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  830  
48cb39522a9d4d4 Felix Fietkau 2019-08-20  831  	mi->sample_mode = MINSTREL_SAMPLE_IDLE;
48cb39522a9d4d4 Felix Fietkau 2019-08-20  832  
48cb39522a9d4d4 Felix Fietkau 2019-08-20  833  	if (sample) {
48cb39522a9d4d4 Felix Fietkau 2019-08-20  834  		mi->total_packets_cur = mi->total_packets -
48cb39522a9d4d4 Felix Fietkau 2019-08-20  835  					mi->total_packets_last;
48cb39522a9d4d4 Felix Fietkau 2019-08-20  836  		mi->total_packets_last = mi->total_packets;
48cb39522a9d4d4 Felix Fietkau 2019-08-20  837  	}
48cb39522a9d4d4 Felix Fietkau 2019-08-20  838  	if (!mp->sample_switch)
48cb39522a9d4d4 Felix Fietkau 2019-08-20  839  		sample = false;
48cb39522a9d4d4 Felix Fietkau 2019-08-20  840  	if (mi->total_packets_cur < SAMPLE_SWITCH_THR && mp->sample_switch != 1)
48cb39522a9d4d4 Felix Fietkau 2019-08-20  841  	    sample = false;
48cb39522a9d4d4 Felix Fietkau 2019-08-20  842  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  843  	if (mi->ampdu_packets > 0) {
77f7ffdc335de85 Felix Fietkau 2019-01-16  844  		if (!ieee80211_hw_check(mp->hw, TX_STATUS_NO_AMPDU_LEN))
ec8aa669b8393b6 Felix Fietkau 2010-05-13  845  			mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len,
77f7ffdc335de85 Felix Fietkau 2019-01-16  846  				MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets),
77f7ffdc335de85 Felix Fietkau 2019-01-16  847  					      EWMA_LEVEL);
77f7ffdc335de85 Felix Fietkau 2019-01-16  848  		else
77f7ffdc335de85 Felix Fietkau 2019-01-16  849  			mi->avg_ampdu_len = 0;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  850  		mi->ampdu_len = 0;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  851  		mi->ampdu_packets = 0;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  852  	}
ec8aa669b8393b6 Felix Fietkau 2010-05-13  853  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  854  	mi->sample_slow = 0;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  855  	mi->sample_count = 0;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  856  
21f7981b4bd9048 Felix Fietkau 2019-08-20  857  	memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate));
a7844a53846017c Felix Fietkau 2021-01-15  858  	memset(tmp_legacy_tp_rate, 0, sizeof(tmp_legacy_tp_rate));
8a2d01887013f71 Felix Fietkau 2021-01-24  859  
21f7981b4bd9048 Felix Fietkau 2019-08-20  860  	if (mi->supported[MINSTREL_CCK_GROUP])
8a2d01887013f71 Felix Fietkau 2021-01-24  861  		group = MINSTREL_CCK_GROUP;
a7844a53846017c Felix Fietkau 2021-01-15 @862  	else if (mi->supported[MINSTREL_OFDM_GROUP])
8a2d01887013f71 Felix Fietkau 2021-01-24  863  		group = MINSTREL_OFDM_GROUP;
8a2d01887013f71 Felix Fietkau 2021-01-24  864  
8a2d01887013f71 Felix Fietkau 2021-01-24  865  	index = MI_RATE(group, 0);
a7844a53846017c Felix Fietkau 2021-01-15  866  	for (j = 0; j < ARRAY_SIZE(tmp_legacy_tp_rate); j++)
8a2d01887013f71 Felix Fietkau 2021-01-24  867  		tmp_legacy_tp_rate[j] = index;
21f7981b4bd9048 Felix Fietkau 2019-08-20  868  
21f7981b4bd9048 Felix Fietkau 2019-08-20  869  	if (mi->supported[MINSTREL_VHT_GROUP_0])
8a2d01887013f71 Felix Fietkau 2021-01-24  870  		group = MINSTREL_VHT_GROUP_0;
a7844a53846017c Felix Fietkau 2021-01-15  871  	else if (ht_supported)
8a2d01887013f71 Felix Fietkau 2021-01-24  872  		group = MINSTREL_HT_GROUP_0;
a7844a53846017c Felix Fietkau 2021-01-15  873  	else if (mi->supported[MINSTREL_CCK_GROUP])
8a2d01887013f71 Felix Fietkau 2021-01-24  874  		group = MINSTREL_CCK_GROUP;
a7844a53846017c Felix Fietkau 2021-01-15  875  	else
8a2d01887013f71 Felix Fietkau 2021-01-24  876  		group = MINSTREL_OFDM_GROUP;
21f7981b4bd9048 Felix Fietkau 2019-08-20  877  
8a2d01887013f71 Felix Fietkau 2021-01-24  878  	index = MI_RATE(group, 0);
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  879  	tmp_max_prob_rate = index;
21f7981b4bd9048 Felix Fietkau 2019-08-20  880  	for (j = 0; j < ARRAY_SIZE(tmp_mcs_tp_rate); j++)
21f7981b4bd9048 Felix Fietkau 2019-08-20  881  		tmp_mcs_tp_rate[j] = index;
c2eb5b0f342c9b1 Karl Beldan   2013-04-18  882  
5935839ad735837 Thomas Huehn  2014-09-09  883  	/* Find best rate sets within all MCS groups*/
5935839ad735837 Thomas Huehn  2014-09-09  884  	for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
a7844a53846017c Felix Fietkau 2021-01-15  885  		u16 *tp_rate = tmp_mcs_tp_rate;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  886  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  887  		mg = &mi->groups[group];
41d085835d3d225 Felix Fietkau 2016-12-14  888  		if (!mi->supported[group])
ec8aa669b8393b6 Felix Fietkau 2010-05-13  889  			continue;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  890  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  891  		mi->sample_count++;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  892  
5935839ad735837 Thomas Huehn  2014-09-09  893  		/* (re)Initialize group rate indexes */
5935839ad735837 Thomas Huehn  2014-09-09  894  		for(j = 0; j < MAX_THR_RATES; j++)
8a2d01887013f71 Felix Fietkau 2021-01-24  895  			tmp_group_tp_rate[j] = MI_RATE(group, 0);
5935839ad735837 Thomas Huehn  2014-09-09  896  
a7844a53846017c Felix Fietkau 2021-01-15  897  		if (group == MINSTREL_CCK_GROUP && ht_supported)
a7844a53846017c Felix Fietkau 2021-01-15  898  			tp_rate = tmp_legacy_tp_rate;
a7844a53846017c Felix Fietkau 2021-01-15  899  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  900  		for (i = 0; i < MCS_GROUP_RATES; i++) {
41d085835d3d225 Felix Fietkau 2016-12-14  901  			if (!(mi->supported[group] & BIT(i)))
ec8aa669b8393b6 Felix Fietkau 2010-05-13  902  				continue;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  903  
8a2d01887013f71 Felix Fietkau 2021-01-24  904  			index = MI_RATE(group, i);
351df099721e02e Karl Beldan   2013-11-13  905  
9134073bc693633 Thomas Huehn  2015-03-24  906  			mrs = &mg->rates[i];
9134073bc693633 Thomas Huehn  2015-03-24  907  			mrs->retry_updated = false;
cbda98c710d273b Felix Fietkau 2021-01-15  908  			minstrel_ht_calc_rate_stats(mp, mrs);
5f63afe0288d955 Felix Fietkau 2019-10-08  909  			cur_prob = mrs->prob_avg;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  910  
50e55a8ea76fb59 Thomas Huehn  2015-03-24  911  			if (minstrel_ht_get_tp_avg(mi, group, i, cur_prob) == 0)
ec8aa669b8393b6 Felix Fietkau 2010-05-13  912  				continue;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  913  
5935839ad735837 Thomas Huehn  2014-09-09  914  			/* Find max throughput rate set */
a7844a53846017c Felix Fietkau 2021-01-15  915  			minstrel_ht_sort_best_tp_rates(mi, index, tp_rate);
ec8aa669b8393b6 Felix Fietkau 2010-05-13  916  
5935839ad735837 Thomas Huehn  2014-09-09  917  			/* Find max throughput rate set within a group */
5935839ad735837 Thomas Huehn  2014-09-09  918  			minstrel_ht_sort_best_tp_rates(mi, index,
5935839ad735837 Thomas Huehn  2014-09-09  919  						       tmp_group_tp_rate);
ec8aa669b8393b6 Felix Fietkau 2010-05-13  920  		}
ec8aa669b8393b6 Felix Fietkau 2010-05-13  921  
5935839ad735837 Thomas Huehn  2014-09-09  922  		memcpy(mg->max_group_tp_rate, tmp_group_tp_rate,
5935839ad735837 Thomas Huehn  2014-09-09  923  		       sizeof(mg->max_group_tp_rate));
ec8aa669b8393b6 Felix Fietkau 2010-05-13  924  	}
ec8aa669b8393b6 Felix Fietkau 2010-05-13  925  
5935839ad735837 Thomas Huehn  2014-09-09  926  	/* Assign new rate set per sta */
a7844a53846017c Felix Fietkau 2021-01-15  927  	minstrel_ht_assign_best_tp_rates(mi, tmp_mcs_tp_rate,
a7844a53846017c Felix Fietkau 2021-01-15  928  					 tmp_legacy_tp_rate);
5935839ad735837 Thomas Huehn  2014-09-09  929  	memcpy(mi->max_tp_rate, tmp_mcs_tp_rate, sizeof(mi->max_tp_rate));
ec8aa669b8393b6 Felix Fietkau 2010-05-13  930  
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  931  	for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  932  		if (!mi->supported[group])
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  933  			continue;
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  934  
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  935  		mg = &mi->groups[group];
8a2d01887013f71 Felix Fietkau 2021-01-24  936  		mg->max_group_prob_rate = MI_RATE(group, 0);
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  937  
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  938  		for (i = 0; i < MCS_GROUP_RATES; i++) {
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  939  			if (!(mi->supported[group] & BIT(i)))
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  940  				continue;
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  941  
8a2d01887013f71 Felix Fietkau 2021-01-24  942  			index = MI_RATE(group, i);
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  943  
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  944  			/* Find max probability rate per group and global */
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  945  			minstrel_ht_set_best_prob_rate(mi, &tmp_max_prob_rate,
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  946  						       index);
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  947  		}
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  948  	}
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  949  
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  950  	mi->max_prob_rate = tmp_max_prob_rate;
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  951  
5935839ad735837 Thomas Huehn  2014-09-09  952  	/* Try to increase robustness of max_prob_rate*/
5935839ad735837 Thomas Huehn  2014-09-09  953  	minstrel_ht_prob_rate_reduce_streams(mi);
a299c6d591f8f6a Felix Fietkau 2013-03-02  954  
eeafcb0c80c81d6 Felix Fietkau 2021-01-15  955  	/* try to sample half of all available rates during each interval */
eeafcb0c80c81d6 Felix Fietkau 2021-01-15  956  	mi->sample_count *= 4;
a299c6d591f8f6a Felix Fietkau 2013-03-02  957  
48cb39522a9d4d4 Felix Fietkau 2019-08-20  958  	if (sample)
48cb39522a9d4d4 Felix Fietkau 2019-08-20  959  		minstrel_ht_rate_sample_switch(mp, mi);
48cb39522a9d4d4 Felix Fietkau 2019-08-20  960  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35873 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Felix Fietkau <nbd@nbd.name>, linux-wireless@vger.kernel.org
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
	johannes@sipsolutions.net
Subject: Re: [PATCH 1/6] mac80211: minstrel_ht: use bitfields to encode rate indexes
Date: Tue, 26 Jan 2021 03:25:06 +0800	[thread overview]
Message-ID: <202101260334.6Idj0Wup-lkp@intel.com> (raw)
In-Reply-To: <20210124122812.49929-1-nbd@nbd.name>

[-- Attachment #1: Type: text/plain, Size: 14496 bytes --]

Hi Felix,

I love your patch! Perhaps something to improve:

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on next-20210125]
[cannot apply to mac80211/master v5.11-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Felix-Fietkau/mac80211-minstrel_ht-use-bitfields-to-encode-rate-indexes/20210125-210635
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: x86_64-randconfig-a015-20210125 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 12d0753aca22896fda2cf76781b0ee0524d55065)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/8a2d01887013f71806262345f71766d6518e3552
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Felix-Fietkau/mac80211-minstrel_ht-use-bitfields-to-encode-rate-indexes/20210125-210635
        git checkout 8a2d01887013f71806262345f71766d6518e3552
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> net/mac80211/rc80211_minstrel_ht.c:862:11: warning: variable 'group' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           else if (mi->supported[MINSTREL_OFDM_GROUP])
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/mac80211/rc80211_minstrel_ht.c:865:18: note: uninitialized use occurs here
           index = MI_RATE(group, 0);
                           ^~~~~
   net/mac80211/rc80211_minstrel_ht.h:66:34: note: expanded from macro 'MI_RATE'
           (FIELD_PREP(MI_RATE_GROUP_MASK, _group) |       \
                                           ^~~~~~
   include/linux/bitfield.h:95:20: note: expanded from macro 'FIELD_PREP'
                   ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask);   \
                                    ^~~~
   net/mac80211/rc80211_minstrel_ht.c:862:7: note: remove the 'if' if its condition is always true
           else if (mi->supported[MINSTREL_OFDM_GROUP])
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/mac80211/rc80211_minstrel_ht.c:825:11: note: initialize the variable 'group' to silence this warning
           int group, i, j, cur_prob;
                    ^
                     = 0
   1 warning generated.


vim +862 net/mac80211/rc80211_minstrel_ht.c

cbda98c710d273b Felix Fietkau 2021-01-15  809  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  810  /*
ec8aa669b8393b6 Felix Fietkau 2010-05-13  811   * Update rate statistics and select new primary rates
ec8aa669b8393b6 Felix Fietkau 2010-05-13  812   *
ec8aa669b8393b6 Felix Fietkau 2010-05-13  813   * Rules for rate selection:
ec8aa669b8393b6 Felix Fietkau 2010-05-13  814   *  - max_prob_rate must use only one stream, as a tradeoff between delivery
ec8aa669b8393b6 Felix Fietkau 2010-05-13  815   *    probability and throughput during strong fluctuations
5935839ad735837 Thomas Huehn  2014-09-09  816   *  - as long as the max prob rate has a probability of more than 75%, pick
ec8aa669b8393b6 Felix Fietkau 2010-05-13  817   *    higher throughput rates, even if the probablity is a bit lower
ec8aa669b8393b6 Felix Fietkau 2010-05-13  818   */
ec8aa669b8393b6 Felix Fietkau 2010-05-13  819  static void
48cb39522a9d4d4 Felix Fietkau 2019-08-20  820  minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
48cb39522a9d4d4 Felix Fietkau 2019-08-20  821  			 bool sample)
ec8aa669b8393b6 Felix Fietkau 2010-05-13  822  {
ec8aa669b8393b6 Felix Fietkau 2010-05-13  823  	struct minstrel_mcs_group_data *mg;
9134073bc693633 Thomas Huehn  2015-03-24  824  	struct minstrel_rate_stats *mrs;
50e55a8ea76fb59 Thomas Huehn  2015-03-24  825  	int group, i, j, cur_prob;
d4d141cae804a43 Karl Beldan   2014-10-20  826  	u16 tmp_mcs_tp_rate[MAX_THR_RATES], tmp_group_tp_rate[MAX_THR_RATES];
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  827  	u16 tmp_legacy_tp_rate[MAX_THR_RATES], tmp_max_prob_rate;
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  828  	u16 index;
a7844a53846017c Felix Fietkau 2021-01-15  829  	bool ht_supported = mi->sta->ht_cap.ht_supported;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  830  
48cb39522a9d4d4 Felix Fietkau 2019-08-20  831  	mi->sample_mode = MINSTREL_SAMPLE_IDLE;
48cb39522a9d4d4 Felix Fietkau 2019-08-20  832  
48cb39522a9d4d4 Felix Fietkau 2019-08-20  833  	if (sample) {
48cb39522a9d4d4 Felix Fietkau 2019-08-20  834  		mi->total_packets_cur = mi->total_packets -
48cb39522a9d4d4 Felix Fietkau 2019-08-20  835  					mi->total_packets_last;
48cb39522a9d4d4 Felix Fietkau 2019-08-20  836  		mi->total_packets_last = mi->total_packets;
48cb39522a9d4d4 Felix Fietkau 2019-08-20  837  	}
48cb39522a9d4d4 Felix Fietkau 2019-08-20  838  	if (!mp->sample_switch)
48cb39522a9d4d4 Felix Fietkau 2019-08-20  839  		sample = false;
48cb39522a9d4d4 Felix Fietkau 2019-08-20  840  	if (mi->total_packets_cur < SAMPLE_SWITCH_THR && mp->sample_switch != 1)
48cb39522a9d4d4 Felix Fietkau 2019-08-20  841  	    sample = false;
48cb39522a9d4d4 Felix Fietkau 2019-08-20  842  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  843  	if (mi->ampdu_packets > 0) {
77f7ffdc335de85 Felix Fietkau 2019-01-16  844  		if (!ieee80211_hw_check(mp->hw, TX_STATUS_NO_AMPDU_LEN))
ec8aa669b8393b6 Felix Fietkau 2010-05-13  845  			mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len,
77f7ffdc335de85 Felix Fietkau 2019-01-16  846  				MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets),
77f7ffdc335de85 Felix Fietkau 2019-01-16  847  					      EWMA_LEVEL);
77f7ffdc335de85 Felix Fietkau 2019-01-16  848  		else
77f7ffdc335de85 Felix Fietkau 2019-01-16  849  			mi->avg_ampdu_len = 0;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  850  		mi->ampdu_len = 0;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  851  		mi->ampdu_packets = 0;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  852  	}
ec8aa669b8393b6 Felix Fietkau 2010-05-13  853  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  854  	mi->sample_slow = 0;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  855  	mi->sample_count = 0;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  856  
21f7981b4bd9048 Felix Fietkau 2019-08-20  857  	memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate));
a7844a53846017c Felix Fietkau 2021-01-15  858  	memset(tmp_legacy_tp_rate, 0, sizeof(tmp_legacy_tp_rate));
8a2d01887013f71 Felix Fietkau 2021-01-24  859  
21f7981b4bd9048 Felix Fietkau 2019-08-20  860  	if (mi->supported[MINSTREL_CCK_GROUP])
8a2d01887013f71 Felix Fietkau 2021-01-24  861  		group = MINSTREL_CCK_GROUP;
a7844a53846017c Felix Fietkau 2021-01-15 @862  	else if (mi->supported[MINSTREL_OFDM_GROUP])
8a2d01887013f71 Felix Fietkau 2021-01-24  863  		group = MINSTREL_OFDM_GROUP;
8a2d01887013f71 Felix Fietkau 2021-01-24  864  
8a2d01887013f71 Felix Fietkau 2021-01-24  865  	index = MI_RATE(group, 0);
a7844a53846017c Felix Fietkau 2021-01-15  866  	for (j = 0; j < ARRAY_SIZE(tmp_legacy_tp_rate); j++)
8a2d01887013f71 Felix Fietkau 2021-01-24  867  		tmp_legacy_tp_rate[j] = index;
21f7981b4bd9048 Felix Fietkau 2019-08-20  868  
21f7981b4bd9048 Felix Fietkau 2019-08-20  869  	if (mi->supported[MINSTREL_VHT_GROUP_0])
8a2d01887013f71 Felix Fietkau 2021-01-24  870  		group = MINSTREL_VHT_GROUP_0;
a7844a53846017c Felix Fietkau 2021-01-15  871  	else if (ht_supported)
8a2d01887013f71 Felix Fietkau 2021-01-24  872  		group = MINSTREL_HT_GROUP_0;
a7844a53846017c Felix Fietkau 2021-01-15  873  	else if (mi->supported[MINSTREL_CCK_GROUP])
8a2d01887013f71 Felix Fietkau 2021-01-24  874  		group = MINSTREL_CCK_GROUP;
a7844a53846017c Felix Fietkau 2021-01-15  875  	else
8a2d01887013f71 Felix Fietkau 2021-01-24  876  		group = MINSTREL_OFDM_GROUP;
21f7981b4bd9048 Felix Fietkau 2019-08-20  877  
8a2d01887013f71 Felix Fietkau 2021-01-24  878  	index = MI_RATE(group, 0);
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  879  	tmp_max_prob_rate = index;
21f7981b4bd9048 Felix Fietkau 2019-08-20  880  	for (j = 0; j < ARRAY_SIZE(tmp_mcs_tp_rate); j++)
21f7981b4bd9048 Felix Fietkau 2019-08-20  881  		tmp_mcs_tp_rate[j] = index;
c2eb5b0f342c9b1 Karl Beldan   2013-04-18  882  
5935839ad735837 Thomas Huehn  2014-09-09  883  	/* Find best rate sets within all MCS groups*/
5935839ad735837 Thomas Huehn  2014-09-09  884  	for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
a7844a53846017c Felix Fietkau 2021-01-15  885  		u16 *tp_rate = tmp_mcs_tp_rate;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  886  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  887  		mg = &mi->groups[group];
41d085835d3d225 Felix Fietkau 2016-12-14  888  		if (!mi->supported[group])
ec8aa669b8393b6 Felix Fietkau 2010-05-13  889  			continue;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  890  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  891  		mi->sample_count++;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  892  
5935839ad735837 Thomas Huehn  2014-09-09  893  		/* (re)Initialize group rate indexes */
5935839ad735837 Thomas Huehn  2014-09-09  894  		for(j = 0; j < MAX_THR_RATES; j++)
8a2d01887013f71 Felix Fietkau 2021-01-24  895  			tmp_group_tp_rate[j] = MI_RATE(group, 0);
5935839ad735837 Thomas Huehn  2014-09-09  896  
a7844a53846017c Felix Fietkau 2021-01-15  897  		if (group == MINSTREL_CCK_GROUP && ht_supported)
a7844a53846017c Felix Fietkau 2021-01-15  898  			tp_rate = tmp_legacy_tp_rate;
a7844a53846017c Felix Fietkau 2021-01-15  899  
ec8aa669b8393b6 Felix Fietkau 2010-05-13  900  		for (i = 0; i < MCS_GROUP_RATES; i++) {
41d085835d3d225 Felix Fietkau 2016-12-14  901  			if (!(mi->supported[group] & BIT(i)))
ec8aa669b8393b6 Felix Fietkau 2010-05-13  902  				continue;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  903  
8a2d01887013f71 Felix Fietkau 2021-01-24  904  			index = MI_RATE(group, i);
351df099721e02e Karl Beldan   2013-11-13  905  
9134073bc693633 Thomas Huehn  2015-03-24  906  			mrs = &mg->rates[i];
9134073bc693633 Thomas Huehn  2015-03-24  907  			mrs->retry_updated = false;
cbda98c710d273b Felix Fietkau 2021-01-15  908  			minstrel_ht_calc_rate_stats(mp, mrs);
5f63afe0288d955 Felix Fietkau 2019-10-08  909  			cur_prob = mrs->prob_avg;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  910  
50e55a8ea76fb59 Thomas Huehn  2015-03-24  911  			if (minstrel_ht_get_tp_avg(mi, group, i, cur_prob) == 0)
ec8aa669b8393b6 Felix Fietkau 2010-05-13  912  				continue;
ec8aa669b8393b6 Felix Fietkau 2010-05-13  913  
5935839ad735837 Thomas Huehn  2014-09-09  914  			/* Find max throughput rate set */
a7844a53846017c Felix Fietkau 2021-01-15  915  			minstrel_ht_sort_best_tp_rates(mi, index, tp_rate);
ec8aa669b8393b6 Felix Fietkau 2010-05-13  916  
5935839ad735837 Thomas Huehn  2014-09-09  917  			/* Find max throughput rate set within a group */
5935839ad735837 Thomas Huehn  2014-09-09  918  			minstrel_ht_sort_best_tp_rates(mi, index,
5935839ad735837 Thomas Huehn  2014-09-09  919  						       tmp_group_tp_rate);
ec8aa669b8393b6 Felix Fietkau 2010-05-13  920  		}
ec8aa669b8393b6 Felix Fietkau 2010-05-13  921  
5935839ad735837 Thomas Huehn  2014-09-09  922  		memcpy(mg->max_group_tp_rate, tmp_group_tp_rate,
5935839ad735837 Thomas Huehn  2014-09-09  923  		       sizeof(mg->max_group_tp_rate));
ec8aa669b8393b6 Felix Fietkau 2010-05-13  924  	}
ec8aa669b8393b6 Felix Fietkau 2010-05-13  925  
5935839ad735837 Thomas Huehn  2014-09-09  926  	/* Assign new rate set per sta */
a7844a53846017c Felix Fietkau 2021-01-15  927  	minstrel_ht_assign_best_tp_rates(mi, tmp_mcs_tp_rate,
a7844a53846017c Felix Fietkau 2021-01-15  928  					 tmp_legacy_tp_rate);
5935839ad735837 Thomas Huehn  2014-09-09  929  	memcpy(mi->max_tp_rate, tmp_mcs_tp_rate, sizeof(mi->max_tp_rate));
ec8aa669b8393b6 Felix Fietkau 2010-05-13  930  
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  931  	for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  932  		if (!mi->supported[group])
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  933  			continue;
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  934  
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  935  		mg = &mi->groups[group];
8a2d01887013f71 Felix Fietkau 2021-01-24  936  		mg->max_group_prob_rate = MI_RATE(group, 0);
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  937  
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  938  		for (i = 0; i < MCS_GROUP_RATES; i++) {
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  939  			if (!(mi->supported[group] & BIT(i)))
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  940  				continue;
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  941  
8a2d01887013f71 Felix Fietkau 2021-01-24  942  			index = MI_RATE(group, i);
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  943  
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  944  			/* Find max probability rate per group and global */
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  945  			minstrel_ht_set_best_prob_rate(mi, &tmp_max_prob_rate,
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  946  						       index);
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  947  		}
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  948  	}
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  949  
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  950  	mi->max_prob_rate = tmp_max_prob_rate;
a7fca4e4037f7e3 Felix Fietkau 2021-01-15  951  
5935839ad735837 Thomas Huehn  2014-09-09  952  	/* Try to increase robustness of max_prob_rate*/
5935839ad735837 Thomas Huehn  2014-09-09  953  	minstrel_ht_prob_rate_reduce_streams(mi);
a299c6d591f8f6a Felix Fietkau 2013-03-02  954  
eeafcb0c80c81d6 Felix Fietkau 2021-01-15  955  	/* try to sample half of all available rates during each interval */
eeafcb0c80c81d6 Felix Fietkau 2021-01-15  956  	mi->sample_count *= 4;
a299c6d591f8f6a Felix Fietkau 2013-03-02  957  
48cb39522a9d4d4 Felix Fietkau 2019-08-20  958  	if (sample)
48cb39522a9d4d4 Felix Fietkau 2019-08-20  959  		minstrel_ht_rate_sample_switch(mp, mi);
48cb39522a9d4d4 Felix Fietkau 2019-08-20  960  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35873 bytes --]

  parent reply	other threads:[~2021-01-25 19:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-24 12:28 [PATCH 1/6] mac80211: minstrel_ht: use bitfields to encode rate indexes Felix Fietkau
2021-01-24 12:28 ` [PATCH 2/6] mac80211: minstrel_ht: update total packets counter in tx status path Felix Fietkau
2021-01-24 12:28 ` [PATCH 3/6] mac80211: minstrel_ht: reduce the need to sample slower rates Felix Fietkau
2021-01-24 12:28 ` [PATCH 4/6] mac80211: minstrel_ht: significantly redesign the rate probing strategy Felix Fietkau
2021-01-25 11:56   ` Toke Høiland-Jørgensen
2021-01-25 20:46     ` Felix Fietkau
2021-01-25 21:21       ` Toke Høiland-Jørgensen
2021-01-25 21:27         ` Felix Fietkau
2021-01-24 12:28 ` [PATCH 5/6] mac80211: minstrel_ht: show sampling rates in debugfs Felix Fietkau
2021-01-24 12:28 ` [PATCH 6/6] mac80211: minstrel_ht: remove sample rate switching code for constrained devices Felix Fietkau
2021-01-25 19:25 ` kernel test robot [this message]
2021-01-25 19:25   ` [PATCH 1/6] mac80211: minstrel_ht: use bitfields to encode rate indexes kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202101260334.6Idj0Wup-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.