[dpdk-dev] [PATCH] ethdev: fix data type for port id

Thomas Monjalon thomas at monjalon.net
Mon Oct 26 13:29:24 CET 2020


26/10/2020 13:24, wangyunjian:
> From: Yunjian Wang <wangyunjian at huawei.com>
> 
> The ethdev port id should be 16 bits now. This patch fixes the data
> type of the variable for 'pid', changing from uint32_t to uint16_t.
> 
> Fixes: 5b7ba31148a8 ("ethdev: add port ownership")

It was 32-bit on purpose, to avoid overflow in this loop:
	for (pid = 0; pid < RTE_MAX_ETHPORTS; pid++)

It is now replaced by RTE_ETH_FOREACH_VALID_DEV,
but I wonder whether we still have this theoritical overflow risk.
If yes, we should change more variables to 32-bit.





More information about the dev mailing list