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

Morten Brørup mb at smartsharesystems.com
Thu Oct 24 18:28:27 CEST 2024


> > > -	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.



More information about the dev mailing list