Re: [PATCH net-next v1 2/3] net: dsa: ar9331: add support for pause stats
From: Jakub Kicinski
Date: Mon Jun 27 2022 - 23:10:22 EST
On Mon, 27 Jun 2022 23:02:38 +0300 Vladimir Oltean wrote:
> > > Yes, it will be interesting to know how to proceed with it.
> >
> > I'm curious as well, AFAIK most drivers do not count pause to ifc stats.
>
> How do you know? Just because they manually bump stats->tx_bytes and
> stats->tx_packets during ndo_start_xmit?
>
> That would be a good assumption, but what if a network driver populates
> struct rtnl_link_stats64 entirely based on counters reported by hardware,
> including {rx,tx}_{packets,bytes}?
Yeah, a lot of drivers use SW stats. What matters is where the packets
get counted, even if device does the counting it may be in/before or
after the MAC. Modern NICs generally don't use MAC-level stats for the
interface because of virtualization.
> Personally I can't really find a reason why not count pause frames if
> you can. And in the same note, why go to the extra lengths of hiding
> them as Oleksij does. For example, the ocelot/felix switches do count
> PAUSE frames as packets/bytes, both on rx and tx.
Yeah, the corrections are always iffy. I understand the doubts, and we
can probably leave things "under-specified" until someone with a strong
preference comes along. But I hope that the virt example makes it clear
that neither of the choices is better (SR-IOV NICs would have to start
adding the pause if we declare rtnl stats as inclusive).
I can see advantages to both counting (they are packets) and not
counting those frames (Linux doesn't see them, they get "invented"
by HW).
Stats are hard.