[PATCH] net/ixgbe: fix per-queue stats for less queues

Bruce Richardson bruce.richardson at intel.com
Thu Oct 24 18:46:25 CEST 2024


On Thu, Oct 24, 2024 at 06:28:27PM +0200, Morten Brørup wrote:
> > > > -	for (i = 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) {
> > > > +	for (i = 0; i < RTE_MIN(IXGBE_QUEUE_STAT_COUNTERS,
> > > > +
> > > > 	(typeof(IXGBE_QUEUE_STAT_COUNTERS))RTE_ETHDEV_QUEUE_STAT_CNTRS);
> > > > i++) {
> > 
> > The big cast using "typeof" is awkward-looking but is probably the best
> > way
> > to do this!
> 
> Yes. It fixes a signed/unsigned comparison warning.
> 
> RTE_ETHDEV_QUEUE_STAT_CNTRS is int, "i" is unsigned, and IXGBE_QUEUE_STAT_COUNTERS is size_t.
> 
> Not easy choosing a good common type without adding an explanation. The typeof() seemed like an acceptable compromise.
> 

If I may suggest it, "typeof(i)" is shorter :-)


More information about the dev mailing list