Re: [PATCH v2 1/2] wifi: cfg80211/mac80211: Add support to rx retry stats

Johannes Berg
2024-03-28T17:54:22Z

On Thu, 2024-03-28 at 22:49 +0530, Hari Chandrakanthan wrote:
> On 3/27/2024 8:37 PM, Johannes Berg wrote:
> > On Wed, 2024-03-27 at 08:02 -0700, Jeff Johnson wrote:
> > > > I'm also imagining that we change the API from cfg80211 to the drivers
> > > > to get the *link* STA information, and do the summing up and/or "best"
> > > > selection there in cfg80211 itself. However, I am prepared to accept the
> > > > possibility that we may do _both_ in the API, if not all drivers can
> > > > even do all of the statistics per link. We should probably still have
> > > > the link STAs in the statistics in nl80211, but then they may not be
> > > > populated?
> > > First remember that there are a lot of statistics, and each driver is free to
> > > return as many or as few as they support, indicating the ones they are
> > > returning using the "filled" bitmap.
> > Yes, I'd think we want to use the same data structure for both, though
> > setting something in *both* links and *mld* would (should) be an error.
> The statistics can be populated by driver or mac80211.(say tx retries,
> tx packets etc)

Right.

> So we should also change the existing stats update in mac80211 on link
> STA basis instead of deflink?

Absolutely, we need to do that, it's been on my list forever, since the
early MLO work... I'm a bit torn between not wanting you to have to do
all that work (even if we know that we'll have to do it) and on the
other hand not wanting to make it worse with more statistics now ...
There's no good middle ground here though now.

> > Good point, when they're really removed we'd want to probably keep that
> > value as a bias for the MLD-level stats?
>
> ok. Then the statistics value in MLD STA would be bias + summed up value
> of currently alive links?

I guess? But I'm not sure where we'd actually _keep_ the bias values.
Maybe give up on that idea that cfg80211 could sum it all up, and just
require the underlying driver (or mac80211) to report both per-link and
total stats, where available? That way, mac80211 could keep the bias
somewhere and just add it to the total before reporting _that_.

> On the same line , ethtool stats(*interface level stats*) in
> mac80211(ieee80211_get_stats())
> computes the stats by summing up the current STA statistics.
> Here stations can come and go and the ethtool stats may not reflect the
> total packets transmitted or received by the interface.
> It just reflects the summed up value of current alive stations.

Yeah ... I know Ben loves it, but personally I kind of think of ethtool
as a dead legacy interface for this respect, it just doesn't have the
ability to reflect the required structures/hierarchy/etc. well since
it's just a flat list. Sure you can structure the names in some way, but
it's iffy at best. I'd just ignore that for now. If we have better
statistics to nl80211, we can always make ethtool support on top of
that, perhaps even moving it to cfg80211, if we even need more support
there. I'm not hugely in favour, but if it stays contained somewhere and
consumes existing APIs I'm OK with it.

> Since these two problems are similar (ethtool stats and MLD stats
> calculation),
> would like to understand what type of value would be more useful to user?
>

What do you mean by that?

johannes