Subject: Re: [PATCH net-next v2 3/3] eth: bnxt: support per-queue statistics

From: Jakub Kicinski <[email-masked]>
Date: Wed, 6 Mar 2024 06:56:02 -0800

On Wed, 28 Feb 2024 19:40:01 -0800 Michael Chan wrote:
> > +static void bnxt_get_queue_stats_tx(struct net_device *dev, int i,
> > +                                   struct netdev_queue_stats_tx *stats)
> > +{
> > +       struct bnxt *bp = netdev_priv(dev);
> > +       u64 *sw;
> > +
> > +       sw = bp->bnapi[i]->cp_ring.stats.sw_stats;  
> 
> Sorry I missed this earlier.  When we are in XDP mode, the first set
> of TX rings is generally hidden from the user.  The standard TX rings
> don't start from index 0.  They start from bp->tx_nr_rings_xdp.
> Should we adjust for that?

Hi Michael! Sorry for the delay, I was waiting for some related netlink
bits to get merged to simplify the core parts.

Not sure what the most idiomatic way would be to translate the indexes.

Do you prefer:

	bnapi = &bp->tx_ring[bp->tx_ring_map[i]].bnapi;
	sw = bnapi->cp_ring.stats.sw_stats;

or simply:

	sw = bp->bnapi[i - bp->tx_nr_rings_xdp]->cp_ring.stats.sw_stats;

or something else?