linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Felix Fietkau <nbd@nbd.name>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 05/15] mt76: track rx airtime for airtime fairness and survey
Date: Fri, 27 Sep 2019 11:04:21 +0200	[thread overview]
Message-ID: <87pnjmyusq.fsf@toke.dk> (raw)
In-Reply-To: <6af9b976-48e8-64c2-dffe-b3eaa03b9c73@nbd.name>

Felix Fietkau <nbd@nbd.name> writes:

> On 2019-09-27 10:35, Toke Høiland-Jørgensen wrote:
>> Felix Fietkau <nbd@nbd.name> 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.

I see. Neat :)

There's still a regular division in the legacy rate calc further up,
though, right? But I guess that doesn't happen so often?

-Toke


  reply	other threads:[~2019-09-27  9:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26 17:47 [PATCH 01/15] mt76: mt7603: remove q_rx field from struct mt7603_dev Felix Fietkau
2019-09-26 17:47 ` [PATCH 02/15] mt76: report rx a-mpdu subframe status Felix Fietkau
2019-09-26 17:47 ` [PATCH 03/15] mt76: rename mt76_driver_ops txwi_flags to drv_flags and include tx aligned4 Felix Fietkau
2019-09-26 17:47 ` [PATCH 04/15] mt76: store current channel survey_state in struct mt76_dev Felix Fietkau
2019-09-26 17:47 ` [PATCH 05/15] mt76: track rx airtime for airtime fairness and survey Felix Fietkau
2019-09-27  8:35   ` Toke Høiland-Jørgensen
2019-09-27  8:46     ` Felix Fietkau
2019-09-27  9:04       ` Toke Høiland-Jørgensen [this message]
2019-09-26 17:47 ` [PATCH 06/15] mt76: mt7603: track tx " Felix Fietkau
2019-09-26 17:47 ` [PATCH 07/15] mt76: mt7603: switch to a different counter for survey busy time Felix Fietkau
2019-09-26 17:47 ` [PATCH 08/15] mt76: unify channel survey update code Felix Fietkau
2019-09-26 17:47 ` [PATCH 09/15] mt76: mt76x02: move MT_CH_TIME_CFG init to mt76x02_mac_cc_reset Felix Fietkau
2019-09-26 17:47 ` [PATCH 10/15] mt76: mt76x02: track approximate tx airtime for airtime fairness and survey Felix Fietkau
2019-09-27  7:45   ` Toke Høiland-Jørgensen
2019-09-27  8:11     ` Felix Fietkau
2019-09-27  8:37       ` Toke Høiland-Jørgensen
2019-09-27  8:47         ` Felix Fietkau
2019-09-27  9:07           ` Toke Høiland-Jørgensen
2019-09-27  9:17             ` Felix Fietkau
2019-09-28 10:31               ` Toke Høiland-Jørgensen
2019-09-26 17:47 ` [PATCH 11/15] mt76: mt7615: report tx_time, bss_rx and busy time to mac80211 Felix Fietkau
2019-09-26 17:47 ` [PATCH 12/15] mt76: mt7615: fix survey channel busy time Felix Fietkau
2019-09-26 17:47 ` [PATCH 13/15] mt76: mt7615: introduce mt7615_mac_wtbl_update routine Felix Fietkau
2019-09-26 17:47 ` [PATCH 14/15] mt76: mt7615: track tx/rx airtime for airtime fairness Felix Fietkau
2019-09-26 17:47 ` [PATCH 15/15] mt76: enable " Felix Fietkau
2019-09-27  7:46   ` Toke Høiland-Jørgensen

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=87pnjmyusq.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).