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

Ferruh Yigit ferruh.yigit at intel.com
Wed Nov 4 12:46:21 CET 2020


On 11/4/2020 3:26 AM, Ajit Khaparde wrote:
> On Tue, Nov 3, 2020 at 6:58 PM wangyunjian <wangyunjian at huawei.com> wrote:
>>
>> From: Yunjian Wang <wangyunjian at huawei.com>
>>
>> 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 at dpdk.org
>>
>> Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
> 
> Acked-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
> 

Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>



More information about the dev mailing list