Search Linux Wireless

Re: [PATCH 05/15] mt76: track rx airtime for airtime fairness and survey

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2019-09-27 10:35, Toke Høiland-Jørgensen wrote:
> Felix Fietkau <nbd@xxxxxxxx> writes:
>> +	switch (status->encoding) {
>> +	case RX_ENC_LEGACY:
>> +		if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ))
>> +			return 0;
>> +
>> +		sband = dev->hw->wiphy->bands[status->band];
>> +		if (!sband || status->rate_idx > sband->n_bitrates)
>> +			return 0;
>> +
>> +		rate = &sband->bitrates[status->rate_idx];
>> +
>> +		return mt76_calc_legacy_rate_duration(rate, sp, len);
>> +	case RX_ENC_VHT:
>> +		streams = status->nss;
>> +		idx = status->rate_idx;
>> +		group = VHT_GROUP_IDX(streams, sgi, bw);
>> +		break;
>> +	case RX_ENC_HT:
>> +		streams = ((status->rate_idx >> 3) & 3) + 1;
>> +		idx = status->rate_idx & 7;
>> +		group = HT_GROUP_IDX(streams, sgi, bw);
>> +		break;
>> +	default:
>> +		WARN_ON_ONCE(1);
>> +		return 0;
>> +	}
>> +
>> +	if (WARN_ON_ONCE(streams > 4))
>> +		return 0;
>> +
>> +	duration = airtime_mcs_groups[group].duration[idx];
>> +	duration <<= airtime_mcs_groups[group].shift;
>> +	duration *= len;
>> +	duration /= AVG_PKT_SIZE;
>> +	duration /= 1024;
> 
> On an earlier patch of mine you expressed concern over divisions in the
> fast path. Does this mean this is no longer a concern? Or is the
> compiler doing fancy things with the constant division here? :)
I made the constants power-of-2, so that the compiler can turn them into
bit shifts. I verified the disassembly: no divisions left in the code.

- Felix



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux