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 8F056A04E7 for ; Wed, 4 Nov 2020 00:42:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 70593BE48; Wed, 4 Nov 2020 00:42:34 +0100 (CET) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by dpdk.org (Postfix) with ESMTP id AFC95BC60 for ; Wed, 4 Nov 2020 00:42:30 +0100 (CET) Received: by mail-pf1-f195.google.com with SMTP id z3so9353090pfz.6 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=d+6OeueU51UsbVRyRSmtF/DUHHkyP0+UmMhteEwlF9MNWgdZqRFP4XJfv8VnMg3Gh8 XrvNxtWa9hrjoIIPSa7tvzVvfIwQvErb8h0/z9h7nLgJsYPvloKREj1UzMIwHGVH/LVs qg+A1WQxQqnigfxhBRnozNCPx2YxBhPDUNT6NZeLqvQ1AynP9qW/lviJYMXRviu3spPi PV+P7fHQo6zAoBoUFDyscTxIIQO3hoyOb22grKfbHuP5wGcvquRdzgQ1g5UNTcnl/mK6 x2eH8SX0KZGGYUj5q12ZrzewLVqTUI/bqw3/TOLpbcdkbOTGtSkVkndyTqSvuyn6QQMS 6vvw== X-Gm-Message-State: AOAM532YjihxrH6DQGOSMjD5c4GGFddcxW8L0SvWpKbHZSB7U5j1brZC DQTf0ybpAyhT5itFfllQfdL20A== 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-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" 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.