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 61637A04E7; Wed, 4 Nov 2020 00:42:34 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB9C1BC62; Wed, 4 Nov 2020 00:42:32 +0100 (CET) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id B862BBC60 for ; Wed, 4 Nov 2020 00:42:30 +0100 (CET) Received: by mail-pg1-f196.google.com with SMTP id t14so14986606pgg.1 for ; Tue, 03 Nov 2020 15:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6dzQuYvIXW1upRiFeTV0b1IqX4iJuafK7V1PObWPDFQ=; b=OzGmZ9wVYwv9BLWPuVjQrILqu7+i5XVFYQaOwm0bKBE8ufvwVWBb18ZOo5TmysxFIZ qUZp1JWiVqsEgdM7wroD7GL7FN2njI44/lGeHfwAU8aDALMAq0l+uMOyjE+W99Mk6Hx+ dCY5v+erQ2Yl0irnWkdXn0r9UgzAsa3evMo/hgoWzaIlMtdIeTpfg8skYp6jwS2lv0A3 tLUBTfJGPnKNTfPyhLW6qqPyXzJ3dYKdLH9/SAXsXUYgSZJ6DkyiuNmiA8uP7e39ZFMp J8mmzFEav7Kgz4cdTH4cOYLGeJKVXXj3n5eOvASgWhE+1J1NyrFNg2VzrkD8/E4R3fm/ OygA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6dzQuYvIXW1upRiFeTV0b1IqX4iJuafK7V1PObWPDFQ=; b=lJJSCz+Uev9z4O7WYugqYFa/vWcie+s1X87fk/RKf+MQ09yvkNgIfimNconAeQgKJE Ts/aLKDXk5XYAJqqyo/CApmFgNmfdwWpUx4XcOGpHiSEz6mua/48cS1x1JObB/jPoqLD kG+ebQy8OpW4VwfT7cTWfPCeBhNLTEr1tfLVS2QOWg+0X3qwxFrO7s7u8nUvTTH5eayi o/p2TCNZRTxOnu35RV2taJbZ2DgXnOgvx0IqZ+7MSllZKCLaU6OEEAdd12cFyUTaG1eh f8YGJvtFCeSTG1tMy1/C5uAZAilrtF86xCSYqHr7r4IviWcQvazO5oEYUOmsgz7ZjeDa 0eKA== X-Gm-Message-State: AOAM530MAEQoPl83sIjeUKU9lcpRwr+iGD+hMsqzjAok0zdKBNzB4f4p MmhVzftrGSOGqNVHucHZkhSE6Q== X-Google-Smtp-Source: ABdhPJzyvlF0h51A2Z1nC9E14RQCgibBn2KZsrTaIFuoDIFCM+5FN1/JKCAblyKNud2rad9XUWvSeQ== X-Received: by 2002:a17:90a:a505:: with SMTP id a5mr1609259pjq.76.1604446948731; Tue, 03 Nov 2020 15:42:28 -0800 (PST) Received: from hermes.local (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id h4sm94167pgc.13.2020.11.03.15.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 15:42:28 -0800 (PST) Date: Tue, 3 Nov 2020 15:42:19 -0800 From: Stephen Hemminger To: Thomas Monjalon Cc: Yunjian Wang , dev@dpdk.org, ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru, jerry.lilijun@huawei.com, xudingke@huawei.com, stable@dpdk.org Message-ID: <20201103154219.18566856@hermes.local> In-Reply-To: <16713936.kKKOxVssse@thomas> References: <1603806082-21484-1-git-send-email-wangyunjian@huawei.com> <1604308702-7744-1-git-send-email-wangyunjian@huawei.com> <16713936.kKKOxVssse@thomas> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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" On Tue, 03 Nov 2020 19:44:21 +0100 Thomas Monjalon wrote: > 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. > > That was my reaction, check once. It doesn't even need to be inside a function, it can be anywhere.