[PATCH v2] app/testpmd: fix lcore ID restriction
Stephen Hemminger
stephen at networkplumber.org
Fri Jun 14 20:11:33 CEST 2024
On Fri, 14 Jun 2024 19:50:29 +0200
Morten Brørup <mb at smartsharesystems.com> wrote:
> > > ```
> > > ../../root/dpdk/app/test-pmd/config.c: In function
> > 'icmp_echo_config_setup':
> > > ../../root/dpdk/app/test-pmd/config.c:5159:30: error: comparison
> > between
> > > signed and unsigned integer expressions [-Werror=sign-compare]
> > > if ((nb_txq * nb_fwd_ports) < nb_fwd_lcores)
> >
> > That does look like a compiler bug. uint16 multiplied by uint16 should
> > be uint16.
>
> Not, C doesn't promote types like that. Arithmetic operations always promote smaller types to int or unsigned int. And since uint16 fits in int, uint16 is promoted to int (not unsigned int).
You are right. Long winded explanation here:
https://stackoverflow.com/questions/46073295/implicit-type-promotion-rules
More information about the dev
mailing list