Re: [PATCH net-next 1/2] eth: fbnic: add basic rtnl stats

Joe Damato
2024-08-08T08:34:49Z

On Wed, Aug 07, 2024 at 09:38:37AM -0700, Jakub Kicinski wrote:
> On Wed, 7 Aug 2024 16:43:47 +0100 Joe Damato wrote:
> > > +static void fbnic_aggregate_ring_rx_counters(struct fbnic_net *fbn,
> > > + struct fbnic_ring *rxr)
> > > +{
> > > + struct fbnic_queue_stats *stats = &rxr->stats;
> > > +
> > > + if (!(rxr->flags & FBNIC_RING_F_STATS))
> > > + return;
> > > +
> >
> > Nit: I noticed this check is in both aggregate functions and just
> > before where the functions are called below. I'm sure you have
> > better folks internally to review this than me, but: maybe the extra
> > flags check isn't necessary?
> >
> > Could be good if you are trying to be defensive, though.
>
> Perils of upstreaming code that live out of tree for too long :(
> These functions will also be called from the path which does runtime
> ring changes (prepare/swap) and there the caller has no such check.
>
> I'll drop it, and make a note to bring it back later.

I suppose you could drop it from the call sites and leave it in the
fbnic_aggregate_ring* functions? Sorry, didn't intend to cause you
to send a v2.

I think the extra checks are harmless, so if you want to leave them
that seems fine to me.

- Joe