On 11/6/23 10:28 PM, Jakub Kicinski wrote:
On Fri, 3 Nov 2023 23:27:43 +0100 Daniel Borkmann wrote:
Add dev->tstats traffic accounting to netkit. The latter contains per-CPU
RX and TX counters.
The dev's TX counters are bumped upon pass/unspec as well as redirect
verdicts, in other words, on everything except for drops.
The dev's RX counters are bumped upon successful __netif_rx(), as well
as from skb_do_redirect() (not part of this commit here).
Using dev->lstats with having just a single packets/bytes counter and
inferring one another's RX counters from the peer dev's lstats is not
possible given skb_do_redirect() can also bump the device's stats.
sorry for the delay in replying, I'll comment here instead of on:
https://lore.kernel.org/all/6d5cb0ef-fabc-7ca3-94b2-5b1925a6805f@xxxxxxxxxxxxx/
What I had in mind was to have the driver just set the type of stats.
That way it doesn't have to bother with error handling either
(allocation failure checking, making sure free happens in the right
spot etc. all happen in the core). Here's a completely untested diff:
Ah perfect, thanks! I'll take a look and integrate this into a v2 this
week if that's okay with you. And add sth to bail out if the ndo is in
place and NETDEV_PCPU_STAT_TSTAT not selected for the time being.
Thanks,
Daniel