Re: [PATCH net] veth: Fix RX stats for bpf_redirect_peer() traffic
From: Jakub Kicinski
Date: Tue Oct 31 2023 - 15:54:03 EST
On Mon, 30 Oct 2023 15:19:26 +0100 Daniel Borkmann wrote:
> > Since I didn't want to update host-veth's TX counters. If we
> > bpf_redirect_peer()ed a packet from NIC TC ingress to Pod-veth TC ingress,
> > I think it means we've bypassed host-veth TX?
>
> Yes. So the idea is to transition to tstats replace the location where
> we used to bump lstats with tstat's tx counter, and only the peer redirect
> would bump the rx counter.. then upon stats traversal we fold the latter into
> the rx stats which was populated by the opposite's tx counters. Makes sense.
>
> OT: does cadvisor run inside the Pod to collect the device stats? Just
> curious how it gathers them.
Somewhat related - where does netkit count stats?
> >> Definitely no new stats ndo resp indirect call in fast path.
> >
> > Yeah, I think I'll put a comment saying that all devices that support
> > BPF_F_PEER must use tstats (or must use lstats), then.
>
> sgtm.
Is comment good enough? Can we try to do something more robust?
Move the allocation of stats into the core at registration based
on some u8 assigned in the driver? (I haven't looked at the code TBH)