From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 30F34A04E7; Wed, 4 Nov 2020 02:57:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7515EBE48; Wed, 4 Nov 2020 02:57:57 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by dpdk.org (Postfix) with ESMTP id 4D4AFBE3D; Wed, 4 Nov 2020 02:57:54 +0100 (CET) Received: from DGGEMM406-HUB.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4CQqY94LxhzXjRc; Wed, 4 Nov 2020 09:57:49 +0800 (CST) Received: from DGGEMM513-MBX.china.huawei.com ([169.254.1.123]) by DGGEMM406-HUB.china.huawei.com ([10.3.20.214]) with mapi id 14.03.0487.000; Wed, 4 Nov 2020 09:57:44 +0800 From: wangyunjian To: Thomas Monjalon CC: "dev@dpdk.org" , "ferruh.yigit@intel.com" , "andrew.rybchenko@oktetlabs.ru" , "Lilijun (Jerry)" , xudingke , "stable@dpdk.org" , "stephen@networkplumber.org" Thread-Topic: [dpdk-stable] [dpdk-dev] [PATCH v3] ethdev: fix data type for port id Thread-Index: AQHWsPkg5MGbHYMk/Ee0LnoRSJY2nqm2OqCAgAD99pA= Date: Wed, 4 Nov 2020 01:57:44 +0000 Message-ID: <34EFBCA9F01B0748BEB6B629CE643AE60DAF1197@dggemm513-mbx.china.huawei.com> References: <1603806082-21484-1-git-send-email-wangyunjian@huawei.com> <1604308702-7744-1-git-send-email-wangyunjian@huawei.com> <16713936.kKKOxVssse@thomas> In-Reply-To: <16713936.kKKOxVssse@thomas> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.187.156] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v3] ethdev: fix data type for port id X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Thomas Monjalon [mailto:thomas@monjalon.net] > Sent: Wednesday, November 4, 2020 2:44 AM > To: wangyunjian > Cc: dev@dpdk.org; ferruh.yigit@intel.com; andrew.rybchenko@oktetlabs.ru; > Lilijun (Jerry) ; xudingke ; > stable@dpdk.org > Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v3] ethdev: fix data type fo= r port id >=20 > 02/11/2020 10:18, wangyunjian: > > From: Yunjian Wang > > > > 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 > > --- > > v3: > > fix code styles suggested by Thomas Monjalon and Andrew Rybchenko >=20 > I don't understand why you add the compile check in several place. > We should just find one good place for checking RTE_MAX_ETHPORTS at > compilation time. >=20 > I suggest rte_eth_find_next() or rte_eth_dev_allocate(). > Or maybe rte_eth_dev_is_valid_port(). >=20 > Please choose only one. >=20 OK, I will add the compile check in function rte_eth_dev_allocate(). Thanks Yunjian