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 A99CDA04B5; Tue, 27 Oct 2020 15:29:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D22DC592C; Tue, 27 Oct 2020 15:29:37 +0100 (CET) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by dpdk.org (Postfix) with ESMTP id 23D7B558E; Tue, 27 Oct 2020 15:29:35 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id ACCDA132F; Tue, 27 Oct 2020 10:29:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 10:29:33 -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= pb8PUnF6mNJ4aBy3XnclzKSc6fBShvyG031jVsL9alk=; b=E0arFytM5JgWhbQh X2rqIIldzLbT7yyOlAvtAPo4a8yz7FngJU7zkLV1D6V6xmxS9EGOxrdHLsDorGky m5eKmTYvQPmprUsmGATrfBL6XMwhvM42IqzyOPbi9a87t78aE87rt8UXYQTKSEFG FRNQFuR0L724Ms8zj81VONmpvpS7hK96Iag8ullPmCIavWd7G6LJhyWL1w+tm008 MyObcD7oTlhI1HfPcZysQlg44EEV0p7ALhsHhGqnTICzzXcGHncdXbW/WuLhzohf FqFOe1HAlVP6OsHSKA/udkPujfuAhZ9vwvuYVHXQGzv7LD2H14cPLs55X74C1oLI 8sMr1g== 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=pb8PUnF6mNJ4aBy3XnclzKSc6fBShvyG031jVsL9a lk=; b=WgY3/VMCUGRQ/im6+SeDFGfLPoujHbAirq+MBu9lZawaJkcjgjdiC3AhS 8zrNzuvrUOhEiTI/HEPKDc3G069J6kGgQiJtSyjLQmByJA/Cno9gPAJGtoI+MqB4 j1YPxE1IqjxBFRzRS8HzUkVEP8W+dqGhsaH9worqlgCHu7BWXAikPprf0rc1jly7 9QQEFj8a/3ZSOq8qaxuiElyYCfEm9lNhk/9qlJ4BuyDOoy3qZ3H4vtx7TPEQq6u+ kajrjY4etBVzf5Gk39OTqnjxw8QZqnoRoqq6AdGrVPppfO2eR3aqNMzAezvuWZ5W fmqcM7CUM4yFqbmFSa5g0KJCUbiIg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgdeigecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdejueei iedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 9F02A3280063; Tue, 27 Oct 2020 10:29:30 -0400 (EDT) From: Thomas Monjalon To: wangyunjian Cc: dev@dpdk.org, ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru, jerry.lilijun@huawei.com, xudingke@huawei.com, Yunjian Wang , stable@dpdk.org Date: Tue, 27 Oct 2020 15:29:29 +0100 Message-ID: <3015812.jyVNu9Cn7i@thomas> In-Reply-To: <1603806082-21484-1-git-send-email-wangyunjian@huawei.com> References: <1603806082-21484-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-dev] [PATCH v2] 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 14:41, 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. > > We also need use RTE_BUILD_BUG_ON() to ensure that RTE_MAX_ETHPORTS > is less or equal to UINT16_MAX. Actually the need is to check that we have room for an increment after RTE_MAX_ETHPORTS, meaning RTE_MAX_ETHPORTS < UINT16_MAX. > Fixes: 5b7ba31148a8 ("ethdev: add port ownership") > Cc: stable@dpdk.org > > Signed-off-by: Yunjian Wang > --- > v2: > add RTE_BUILD_BUG_ON() check for RTE_MAX_ETHPORTS validity > --- > rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id) > { > - uint32_t pid; > + uint16_t pid; > > if (name == NULL) { > RTE_ETHDEV_LOG(ERR, "Null pointer is specified\n"); > @@ -4292,6 +4292,8 @@ RTE_INIT(eth_dev_init_cb_lists) > { > int i; > > + RTE_BUILD_BUG_ON(RTE_MAX_ETHPORTS > UINT16_MAX); As explained above, should check >= This check is global for ethdev. Please could you move it somewhere else?