[dpdk-stable] patch 'ethdev: fix data type for port id' has been queued to LTS release 18.11.11

Kevin Traynor ktraynor at redhat.com
Wed Nov 18 17:35:55 CET 2020


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 <wangyunjian at huawei.com>
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 <wangyunjian at huawei.com>
Acked-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 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 at 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



More information about the stable mailing list