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 4995AA0521 for ; Tue, 3 Nov 2020 19:44:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1F3675946; Tue, 3 Nov 2020 19:44:29 +0100 (CET) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 1BDCC4C87; Tue, 3 Nov 2020 19:44:25 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 81E985C01A7; Tue, 3 Nov 2020 13:44:24 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 03 Nov 2020 13:44:24 -0500 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= Q0Qg2KmEcdVDAw4t5DBHCgtvv0bDE7/DbpNDuw7JvAw=; b=GU17FeXG0p6Ko4TD 7sH9RthmQFjh6BzXcBeHqQU8HOUYdMlz8bczuWmgvLJ9GS3YOFLyOK0mjXrZF8vI kmO8SYQZOA9i6F6NJXqviHGsrx34j4IX1hOAPWI/NHJ0w/aFTMUPgzeCTAe9SqKs EA5NxxyY0irSWduZtvUwxz6gEv4vh9IhktG/cjY1VH5sKfg6RS0YT84sfmlBIpCi CgWk7wN7vEKnLZ61/yNzeLwpB8Uq7Dph6ToReuPXVCB68Kpis3OM1ioX/qcza8vn 5QCPeUBKnoARunAZzRfcmQ908ZlCgAku1W0L02nyE9NgDFQ5yxhL+6vQRz0WzpYw 8fZsHw== 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=Q0Qg2KmEcdVDAw4t5DBHCgtvv0bDE7/DbpNDuw7Jv Aw=; b=ncFWxqYgkYVbp618FA1l+bZzMXBPbLprxkPQ53b1KgzAQ56Ixm6dVBORr zKhHIY9iLIL7aUcfcQKJ3CReZZtdd6pt2RwP/2hBfpSzRHBfAOX/w/yXipkjmraH GpG2LZXdkAHn8lJTtI+sSRToUjMSSHX6yz++rFYSEEEqWJtZJShLoLvpt8kaGoBQ ldxN7wVy3S7W+HDuldXqIp9B1XYpu+aLYuCvrcIlkHVrK0CeogZvuIb3W28wNlz3 GBis9HzX9s5tMr74rImzgOrZAIP5xY/bk3+M4OTFRsEEL1ixwVl4cXt0nY6b9seV DGaaG5ne/OEg/pVKfWFstBPtclkOQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedguddugecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdej ueeiiedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth 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 ED1B032800D0; Tue, 3 Nov 2020 13:44:22 -0500 (EST) From: Thomas Monjalon To: Yunjian Wang Cc: dev@dpdk.org, ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru, jerry.lilijun@huawei.com, xudingke@huawei.com, stable@dpdk.org Date: Tue, 03 Nov 2020 19:44:21 +0100 Message-ID: <16713936.kKKOxVssse@thomas> In-Reply-To: <1604308702-7744-1-git-send-email-wangyunjian@huawei.com> References: <1603806082-21484-1-git-send-email-wangyunjian@huawei.com> <1604308702-7744-1-git-send-email-wangyunjian@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v3] ethdev: fix data type for port id X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 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. I suggest rte_eth_find_next() or rte_eth_dev_allocate(). Or maybe rte_eth_dev_is_valid_port(). Please choose only one.