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 A1CC2A04DD for ; Wed, 18 Nov 2020 17:39:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 28EC058C4; Wed, 18 Nov 2020 17:38:37 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 3DCB6C936 for ; Wed, 18 Nov 2020 17:38:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605717512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tCjMcHMUhpic/P5RLvQO3t1Y3QRFmSRstwz4L8UCDxE=; b=KQpi6yxqO7CXYqhKqk+eJOaSYlNxVVccZLQ4z2fHkwORlzUKIsG8PnaCcj451sy2m5TL/u /CkwlUhqlSanCPGvdlWwzBsLtRFjMqVWNSg7rnyYup7LvwfMOVOgkz/E68n4xd3nqNJ69Q 3VoWHHjoujOWrVg1WX2ErUZyRGDSrHg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-51-igpI_oAWOayuVv_NCcinNw-1; Wed, 18 Nov 2020 11:38:30 -0500 X-MC-Unique: igpI_oAWOayuVv_NCcinNw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C33B110766D1; Wed, 18 Nov 2020 16:38:28 +0000 (UTC) Received: from rh.redhat.com (ovpn-113-249.ams2.redhat.com [10.36.113.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 896365C1D7; Wed, 18 Nov 2020 16:38:27 +0000 (UTC) From: Kevin Traynor To: Yunjian Wang Cc: Ajit Khaparde , Ferruh Yigit , dpdk stable Date: Wed, 18 Nov 2020 16:35:55 +0000 Message-Id: <20201118163558.1101823-69-ktraynor@redhat.com> In-Reply-To: <20201118163558.1101823-1-ktraynor@redhat.com> References: <20201118163558.1101823-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-stable] patch 'ethdev: fix data type for port id' has been queued to LTS release 18.11.11 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" Hi, FYI, your patch has been queued to LTS release 18.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/24/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/3c3390c6ee1cfcf284fce5110e8cd34d85c8e361 Thanks. Kevin. --- >From 3c3390c6ee1cfcf284fce5110e8cd34d85c8e361 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Wed, 4 Nov 2020 10:57:57 +0800 Subject: [PATCH] ethdev: fix data type for port id [ upstream commit 4bb02a6f5b7f11aafde1be7bfd08b6e81997b916 ] 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") Signed-off-by: Yunjian Wang Acked-by: Ajit Khaparde Reviewed-by: Ferruh Yigit --- lib/librte_ethdev/rte_ethdev.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 3f3f9505b2..d4a1d1e5d2 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -382,5 +382,7 @@ static struct rte_eth_dev * _rte_eth_dev_allocated(const char *name) { - unsigned i; + uint16_t i; + + RTE_BUILD_BUG_ON(RTE_MAX_ETHPORTS >= UINT16_MAX); for (i = 0; i < RTE_MAX_ETHPORTS; i++) { @@ -411,5 +413,5 @@ static uint16_t rte_eth_dev_find_free_port(void) { - unsigned i; + uint16_t i; for (i = 0; i < RTE_MAX_ETHPORTS; i++) { @@ -773,5 +775,5 @@ int rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id) { - uint32_t pid; + uint16_t pid; if (name == NULL) { @@ -3357,5 +3359,5 @@ rte_eth_mirror_rule_reset(uint16_t port_id, uint8_t rule_id) RTE_INIT(eth_dev_init_cb_lists) { - int i; + uint16_t i; for (i = 0; i < RTE_MAX_ETHPORTS; i++) @@ -3370,5 +3372,5 @@ rte_eth_dev_callback_register(uint16_t port_id, struct rte_eth_dev *dev; struct rte_eth_dev_callback *user_cb; - uint32_t next_port; /* size is 32-bit to prevent loop wrap-around */ + uint16_t next_port; uint16_t last_port; @@ -3433,5 +3435,5 @@ rte_eth_dev_callback_unregister(uint16_t port_id, struct rte_eth_dev *dev; struct rte_eth_dev_callback *cb, *next; - uint32_t next_port; /* size is 32-bit to prevent loop wrap-around */ + uint16_t next_port; uint16_t last_port; @@ -4374,5 +4376,5 @@ int __rte_experimental rte_eth_switch_domain_alloc(uint16_t *domain_id) { - unsigned int i; + uint16_t i; *domain_id = RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID; -- 2.26.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-18 16:33:39.226292857 +0000 +++ 0069-ethdev-fix-data-type-for-port-id.patch 2020-11-18 16:33:37.998215106 +0000 @@ -1 +1 @@ -From 4bb02a6f5b7f11aafde1be7bfd08b6e81997b916 Mon Sep 17 00:00:00 2001 +From 3c3390c6ee1cfcf284fce5110e8cd34d85c8e361 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4bb02a6f5b7f11aafde1be7bfd08b6e81997b916 ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index c5e3ba4218..17ddacc78d 100644 +index 3f3f9505b2..d4a1d1e5d2 100644 @@ -31,2 +32,2 @@ -@@ -412,5 +412,7 @@ static struct rte_eth_dev * - eth_dev_allocated(const char *name) +@@ -382,5 +382,7 @@ static struct rte_eth_dev * + _rte_eth_dev_allocated(const char *name) @@ -40,2 +41,2 @@ -@@ -441,5 +443,5 @@ static uint16_t - eth_dev_find_free_port(void) +@@ -411,5 +413,5 @@ static uint16_t + rte_eth_dev_find_free_port(void) @@ -47 +48 @@ -@@ -817,5 +819,5 @@ int +@@ -773,5 +775,5 @@ int @@ -54 +55 @@ -@@ -4294,5 +4296,5 @@ rte_eth_mirror_rule_reset(uint16_t port_id, uint8_t rule_id) +@@ -3357,5 +3359,5 @@ rte_eth_mirror_rule_reset(uint16_t port_id, uint8_t rule_id) @@ -61 +62 @@ -@@ -4307,5 +4309,5 @@ rte_eth_dev_callback_register(uint16_t port_id, +@@ -3370,5 +3372,5 @@ rte_eth_dev_callback_register(uint16_t port_id, @@ -68 +69 @@ -@@ -4370,5 +4372,5 @@ rte_eth_dev_callback_unregister(uint16_t port_id, +@@ -3433,5 +3435,5 @@ rte_eth_dev_callback_unregister(uint16_t port_id, @@ -75 +76 @@ -@@ -5427,5 +5429,5 @@ int +@@ -4374,5 +4376,5 @@ int __rte_experimental