ethdev: fix data type for port id
authorYunjian Wang <wangyunjian@huawei.com>
Wed, 4 Nov 2020 02:57:57 +0000 (10:57 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 4 Nov 2020 13:48:45 +0000 (14:48 +0100)
commit4bb02a6f5b7f11aafde1be7bfd08b6e81997b916
tree07b0d522dddf5fdf549dd9078f6b11171abdced7
parent6fda724378df596db5f4ca0cdc0cf8ca32ef7537
ethdev: fix data type for port id

The ethdev port id is 16 bits now. This patch fixes the data type
of the variable for 'pid', which changing from uint32_t to uint16_t.

RTE_MAX_ETHPORTS is the maximum number of ports, which customized by
the user. To avoid 16-bit unsigned integer overflow, the valid value
of RTE_MAX_ETHPORTS should be set from 0 to UINT16_MAX, and it is
safer to cut one more port from space.

So we use RTE_BUILD_BUG_ON() to ensure that RTE_MAX_ETHPORTS is less
to UINT16_MAX.

Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
lib/librte_ethdev/rte_ethdev.c