public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Pablo MARTIN-GOMEZ <pmartin-gomez@freebox.fr>
To: Felix Fietkau <nbd@nbd.name>, linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net
Subject: Re: [PATCH 1/4] wifi: mac80211: factor out part of ieee80211_calc_expected_tx_airtime
Date: Wed, 25 Mar 2026 14:05:27 +0100	[thread overview]
Message-ID: <4a4aba13-7813-4a18-8faa-2d9a847f94ea@freebox.fr> (raw)
In-Reply-To: <9b4e633e-133e-4ec2-959f-1fb25e706ede@nbd.name>

On 25/03/2026 12:41, Felix Fietkau wrote:
> On 25.03.26 12:21, Pablo MARTIN-GOMEZ wrote:
>> On 25/03/2026 04:58, Felix Fietkau wrote:
>>> On 23.03.26 17:00, Pablo MARTIN-GOMEZ wrote:
>>>> Hello,
>>>>
[...]
>> My bad, I didn't understand that `len` was the byte size of a MPDU.
>>
>> So I was wrong on where I put the overhead, but (a priori) not on the
>> rest of the calculation *if* my understanding of the units is correct.
>> If 1f38b8c564b8 is correct and so `duration` is in ns and `overhead` is
>> in µs, then your code is correct, but the commit message is wrong
>> because `ieee80211_rate_expected_tx_airtime` is returning a value in ns.
>>
>> My snippet fixed if `duration` is in 1024 µs:
>> ```c
>>       duration = ieee80211_get_rate_duration(hw, &stat, &overhead);  /*
>> duration of an average MPDU in 1024 µs */
>>       duration *= 1024;  /* duration in µs */
>>       duration /= AVG_PKT_SIZE;  /* duration in µs for a byte */
>>       duration *= len;  /* duration in µs for the actual MPDU */
>>       duration += (overhead >> agg_shift);  /* duration in µs for an
>> approximate PPDU aka airtime */
>>       duration /= 1024;  /* airtime duration in 1024 µs*/
>>
>>       return duration;
>> ```
>> [`ieee80211_calc_expected_tx_airtime` has to be fixed too]
>>
>> The current patch:
>> ```c
>>     duration·=·ieee80211_get_rate_duration(hw,·&stat,·&overhead);  /*
>> duration of an average MPDU in ns */
>>     duration·*=·len;
>>     duration·/=·AVG_PKT_SIZE;  /* duration in ns for the actual MPDU */
>>     duration·+=·(overhead·*·1024·>>·agg_shift);  /* adding the
>> overhead in
>> µs to a duration in ns to get PPDU duration: overhead [µs] == overhead *
>> 1024 [ns] */
>>     return·duration;  /* airtime duration in ns */
>> ```
> 
> The formatting of your snippets is really weird. Are you using some kind
> of LLM?
That's handcrafted markdown, but then I have a MUA plugin that line
wraps everything, including code. I need to fix that, sorry about that.
> 
> There is definitely an issue in the commit message, which I will fix in
> v2. It says the unit is 1024 us, when in fact it should say that the
> unit is 1/1024 us (approximately ns). Maybe that's what got you
> confused. Either way, your 'fixed' snippet seems wrong to me and the
> code should be fine as-is.
Ok then, with 1/1024 µs, the code looks fine. Now, I need to re-analyze
`airtime.c` to understand why `ieee80211_get_rate_duration` returns 1 /
1024 µs instead of 1024 µs like I though it was returning.
> 
> - Felix
> 
> 

Pablo MG


      reply	other threads:[~2026-03-25 13:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 10:19 [PATCH 1/4] wifi: mac80211: factor out part of ieee80211_calc_expected_tx_airtime Felix Fietkau
2026-03-23 10:19 ` [PATCH 2/4] wifi: mac80211: estimate expected throughput if not provided by driver/rc Felix Fietkau
2026-03-23 10:35   ` Johannes Berg
2026-03-23 10:19 ` [PATCH 3/4] wifi: mac80211: add AQL support for broadcast packets Felix Fietkau
2026-03-23 10:38   ` Johannes Berg
2026-03-23 10:19 ` [PATCH 4/4] wifi: mac80211: add ieee80211_txq_aql_pending() Felix Fietkau
2026-03-23 10:39   ` Johannes Berg
2026-03-23 10:43     ` Felix Fietkau
2026-03-23 10:55   ` Johannes Berg
2026-03-23 16:00 ` [PATCH 1/4] wifi: mac80211: factor out part of ieee80211_calc_expected_tx_airtime Pablo MARTIN-GOMEZ
2026-03-25  3:58   ` Felix Fietkau
2026-03-25 11:21     ` Pablo MARTIN-GOMEZ
2026-03-25 11:41       ` Felix Fietkau
2026-03-25 13:05         ` Pablo MARTIN-GOMEZ [this message]

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=4a4aba13-7813-4a18-8faa-2d9a847f94ea@freebox.fr \
    --to=pmartin-gomez@freebox.fr \
    --cc=johannes@sipsolutions.net \
    --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