All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Oleksandr Natalenko <oleksandr@natalenko.name>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-wireless@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Johannes Berg <johannes@sipsolutions.net>,
	Felix Fietkau <nbd@nbd.name>,
	Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Kalle Valo <kvalo@codeaurora.org>
Subject: Re: Divide error in minstrel_ht_get_tp_avg()
Date: Sat, 21 Aug 2021 14:19:00 +0200	[thread overview]
Message-ID: <20210821121900.GA32713@1wt.eu> (raw)
In-Reply-To: <2137329.lhgpPQ2jGW@natalenko.name>

On Sat, Aug 21, 2021 at 01:14:34PM +0200, Oleksandr Natalenko wrote:
> > > So, it seems `minstrel_ht_avg_ampdu_len()` can return 0, which is not
> > > really legitimate.
> > > 
> > > Looking at `minstrel_ht_avg_ampdu_len()`, I see the following:
> > > 
> > > ```
> > > 16:#define MINSTREL_SCALE  12
> > > ...
> > > 18:#define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE)
> > > ```
> > > 
> > > ```
> > > 
> > >  401 static unsigned int
> > >  402 minstrel_ht_avg_ampdu_len(struct minstrel_ht_sta *mi)
> > >  403 {
> > > 
> > > ...
> > > 
> > >  406     if (mi->avg_ampdu_len)
> > >  407         return MINSTREL_TRUNC(mi->avg_ampdu_len);
> > > 
> > > ```
> > > 
> > > So, likely, `mi->avg_ampdu_len` is non-zero, but it's too small, hence
> > > right bitshift makes it zero.
(...)
> I've also found out that this happens exactly at midnight, IOW, at 00:00:00. 
> Not every midnight, though.
> 
> Does it have something to do with timekeeping? This is strange, I wouldn't 
> expect kernel to act like that. Probably, some client sends malformed frame? 
> How to find out?

Well, in minstrel_ht_update_stats() at line 1006 avg_ampdu_len is
explicitly set to zero. And this seems to be called based on timing
criteria from minstrel_ht_tx_status() so this could confirm your
experience.  Thus there is some inconsistency there.

Willy

      reply	other threads:[~2021-08-21 12:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-29 16:57 Divide error in minstrel_ht_get_tp_avg() Oleksandr Natalenko
2021-06-07 14:52 ` Oleksandr Natalenko
2021-08-21 11:14   ` Oleksandr Natalenko
2021-08-21 12:19     ` Willy Tarreau [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=20210821121900.GA32713@1wt.eu \
    --to=w@1wt.eu \
    --cc=davem@davemloft.net \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi83@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=oleksandr@natalenko.name \
    --cc=ryder.lee@mediatek.com \
    /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.