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 B2503A0527 for ; Mon, 9 Nov 2020 19:45:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AB30B69A4; Mon, 9 Nov 2020 19:45:43 +0100 (CET) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by dpdk.org (Postfix) with ESMTP id C2DA569A4 for ; Mon, 9 Nov 2020 19:45:41 +0100 (CET) Received: by mail-wr1-f42.google.com with SMTP id b8so9883968wrn.0 for ; Mon, 09 Nov 2020 10:45:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qzvDzJ1XdoSQDc1dIPNERAmYZfqgzJen21PU035F4pY=; b=QRrQjSycCweD4R5ZoG/4o4ZtUSLXNYhqDL806LxljJZa13l8KtmxQZsb/FaLb/qbME hEy4nf+2sftPt/RJzJ6LvQ22RUwl0FgCYMa1bvQY+HacYSHqR6hFzndsPAeHhNFkL+lD jWEHr/4xnSutcBwWrMNx2Zd7Kb4nLWAstdp6WCFp8gw4oHGpf0FbxnqL4Ue4UCLBF6z0 o6Hz8R7muYmbI9s/R3jvKlbCITAZHlNy1uN/1qOE8U5ochURP00qolTm8CpEUjZwDpZ4 2LB9fW/YvrqZM9Xh08LyY769GIuooiIpo2TdMzPl1feiRQ6W09iFODkdZQ1+pI2ciGtI 62jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qzvDzJ1XdoSQDc1dIPNERAmYZfqgzJen21PU035F4pY=; b=B6oUBdKmc8nhOh6QbTi9/KpHb3dS08RLDscHlWf25AuGnZkitv9DDCj+QtB1mRQO7K N3GFY07z42pi/9eVzdgUwWkLmAxNp2WcCmBdISnpv9dTI7Pu7F/N17/VbhCN0dxZrX+g j7s6+vCgfMgglKZAABI4YRQL0PMIMo9YMp0kXUYL/UtsuxKrFenI7FS/7CLvJZCwIct5 EiZhVZTHkyr29c5o97nGM/d1R4UjNKSgoxXNctCUkS+zLj0GaC+YZauwd4Kgj9yL3BeQ evkB1KvEg+cKP8jNk+dH6Xo2IadDj2lZq5BXlcNWz1RjOSyX7D703qsC6HA8Fv8r6txs YFcQ== X-Gm-Message-State: AOAM532M60At/NelUFna5M0a+CFIuYaar2SeWAvnxwBdo7Uf9deNL994 H6ayBDda2u3nvqD1/Pl0Y9g= X-Google-Smtp-Source: ABdhPJwLRxBoQN04BvdIll5TOhFqLlEeRkJrvOHV9aTrE6GNgh7wmv9IpcuiztHlziiffNPw+uTOiQ== X-Received: by 2002:adf:fe82:: with SMTP id l2mr14835607wrr.406.1604947541522; Mon, 09 Nov 2020 10:45:41 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id x6sm295495wmc.48.2020.11.09.10.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 10:45:40 -0800 (PST) From: luca.boccassi@gmail.com To: Yunjian Wang Cc: Ajit Khaparde , Ferruh Yigit , dpdk stable Date: Mon, 9 Nov 2020 18:41:05 +0000 Message-Id: <20201109184111.3463090-77-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201109184111.3463090-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-207-luca.boccassi@gmail.com> <20201109184111.3463090-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'ethdev: fix data type for port id' has been queued to stable release 19.11.6 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 stable release 19.11.6 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/11/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/5c1c95c7ff54e8a7f073c31151d97fbc40151bf1 Thanks. Luca Boccassi --- >From 5c1c95c7ff54e8a7f073c31151d97fbc40151bf1 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 d74429a9e7..e7d786c5b4 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -408,7 +408,9 @@ is_allocated(const struct rte_eth_dev *ethdev) 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++) { if (rte_eth_devices[i].data != NULL && @@ -437,7 +439,7 @@ rte_eth_dev_allocated(const char *name) static uint16_t rte_eth_dev_find_free_port(void) { - unsigned i; + uint16_t i; for (i = 0; i < RTE_MAX_ETHPORTS; i++) { /* Using shared name field to find a free port. */ @@ -800,7 +802,7 @@ rte_eth_dev_get_name_by_port(uint16_t port_id, char *name) int 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"); @@ -3954,7 +3956,7 @@ 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++) TAILQ_INIT(&rte_eth_devices[i].link_intr_cbs); @@ -3967,7 +3969,7 @@ 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; if (!cb_fn) @@ -4030,7 +4032,7 @@ rte_eth_dev_callback_unregister(uint16_t port_id, int ret; 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; if (!cb_fn) @@ -5097,7 +5099,7 @@ static struct rte_eth_dev_switch { int 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.27.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-09 18:40:14.027482358 +0000 +++ 0077-ethdev-fix-data-type-for-port-id.patch 2020-11-09 18:40:11.227312776 +0000 @@ -1 +1 @@ -From 4bb02a6f5b7f11aafde1be7bfd08b6e81997b916 Mon Sep 17 00:00:00 2001 +From 5c1c95c7ff54e8a7f073c31151d97fbc40151bf1 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 d74429a9e7..e7d786c5b4 100644 @@ -31 +32 @@ -@@ -411,7 +411,9 @@ eth_dev_is_allocated(const struct rte_eth_dev *ethdev) +@@ -408,7 +408,9 @@ is_allocated(const struct rte_eth_dev *ethdev) @@ -33 +34 @@ - eth_dev_allocated(const char *name) + _rte_eth_dev_allocated(const char *name) @@ -42 +43 @@ -@@ -440,7 +442,7 @@ rte_eth_dev_allocated(const char *name) +@@ -437,7 +439,7 @@ rte_eth_dev_allocated(const char *name) @@ -44 +45 @@ - eth_dev_find_free_port(void) + rte_eth_dev_find_free_port(void) @@ -51 +52 @@ -@@ -816,7 +818,7 @@ rte_eth_dev_get_name_by_port(uint16_t port_id, char *name) +@@ -800,7 +802,7 @@ rte_eth_dev_get_name_by_port(uint16_t port_id, char *name) @@ -60 +61 @@ -@@ -4293,7 +4295,7 @@ rte_eth_mirror_rule_reset(uint16_t port_id, uint8_t rule_id) +@@ -3954,7 +3956,7 @@ rte_eth_mirror_rule_reset(uint16_t port_id, uint8_t rule_id) @@ -69 +70 @@ -@@ -4306,7 +4308,7 @@ rte_eth_dev_callback_register(uint16_t port_id, +@@ -3967,7 +3969,7 @@ rte_eth_dev_callback_register(uint16_t port_id, @@ -78 +79 @@ -@@ -4369,7 +4371,7 @@ rte_eth_dev_callback_unregister(uint16_t port_id, +@@ -4030,7 +4032,7 @@ rte_eth_dev_callback_unregister(uint16_t port_id, @@ -87 +88 @@ -@@ -5426,7 +5428,7 @@ static struct rte_eth_dev_switch { +@@ -5097,7 +5099,7 @@ static struct rte_eth_dev_switch {