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 ADF59A04B5; Tue, 27 Oct 2020 09:47:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 44EAC2BD5; Tue, 27 Oct 2020 09:47:55 +0100 (CET) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by dpdk.org (Postfix) with ESMTP id 60B032B9D for ; Tue, 27 Oct 2020 09:47:53 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 09119CAE; Tue, 27 Oct 2020 04:47:50 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 04:47:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= HMdHBgpQnVH573RSvxpD4+jiEtrggQS1HKZDzylN4Tg=; b=gKaKahFQ/va0vuDp SlIOc2COo5oj9fnOR+pNYsbh4Xr8qOHvBszp4mbN4q/YGiDwbzGPNLaJxfgY1yy6 7LrY+9L0LElLI39SvivNasK3aDqEoDhp3Don/yfGx1KCme8FaGjJoLLWnHqk36+T DfxABJcoYSoOB7sCPYIirIUIlWKYGEU1J8yCHngRJfToA2kHw8e21FnPe6NywHVt a5ak3ySk4Lx3ssb9hA/vxTAL5+eBeiy7dff9xdrgNspXBqEQTeaMJwQUFjLa+PCK ps9/H31gzE5Qfg4sb5jrHy5R03pwQXqFeg4Tnd2UgqqYzb4SYiC7fqDHeH2aZHYw +XMXbA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=HMdHBgpQnVH573RSvxpD4+jiEtrggQS1HKZDzylN4 Tg=; b=byC3wCyJfbBY/i1yjSexwEBXWWDBlzeX6xLMxg+Fjm5PlyqvuTQF9uFDf gqqlj7rnEkit4pOHCzLYdec1CBDxLvvIy9zjoMI+3Bu7AnAKQ8lboSAbWnrVUa+y SZwRNWuneD2etvKBpl4crgvRSUyIcg0oI/ySc8BqSmKB5osydbXQSV2hdDISXVW3 5ivNbl4Q3gI6QFwqH5ICSi4nlOKnaCtrrrCKfB8YxdZdzPxEPQ4NxvyQ7JVDXZdz gkxyj9MLfsrHbsWt/c8h1FD8EcvMc1HTT1sViU3nlzQNuAt/+xptgYBSA+hzmPls fYfQX+s4bBiKCxomGM7T9wBqC3sfg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeekgdduvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 10047306467E; Tue, 27 Oct 2020 04:47:48 -0400 (EDT) From: Thomas Monjalon To: Andrew Rybchenko , wangyunjian Cc: "dev@dpdk.org" , "ferruh.yigit@intel.com" , "Lilijun (Jerry)" , xudingke , "matan@nvidia.com" Date: Tue, 27 Oct 2020 09:47:46 +0100 Message-ID: <2875306.mtlTzNjAsc@thomas> In-Reply-To: <34EFBCA9F01B0748BEB6B629CE643AE60DAD8144@DGGEMM533-MBX.china.huawei.com> References: <3765724.HKehNzLIeC@thomas> <34EFBCA9F01B0748BEB6B629CE643AE60DAD8144@DGGEMM533-MBX.china.huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] 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" 27/10/2020 03:46, wangyunjian: > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > 26/10/2020 13:33, Andrew Rybchenko: > > > On 10/26/20 3:29 PM, Thomas Monjalon wrote: > > > > 26/10/2020 13:24, wangyunjian: > > > >> From: Yunjian Wang > > > >> > > > >> 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. > > > > > > Ah, it is too tricky. May be it is better to ensure that > > > RTE_MAX_ETHPORTS is less or equal to UINT16_MAX? > > > > Yes could be another option. > > > > Add a check on RTE_MAX_ETHPORT in rte_eal_init()? Could be a compilation check done with RTE_BUILD_BUG_ON.