patch 'net/octeontx: fix port close' has been queued to stable release 20.11.6

Xueming Li xuemingl at nvidia.com
Wed Jul 20 10:20:57 CEST 2022


Hi,

FYI, your patch has been queued to stable release 20.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 07/22/22. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/ac50182289fb01dbd0206fa6aa15099755ce60d6

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From ac50182289fb01dbd0206fa6aa15099755ce60d6 Mon Sep 17 00:00:00 2001
From: Harman Kalra <hkalra at marvell.com>
Date: Tue, 24 May 2022 14:12:26 +0530
Subject: [PATCH] net/octeontx: fix port close
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 39e07170331f869c581ce4d3cdc0360f7b6b444a ]

Segmentation fault has been observed while closing the ethernet
port. Reason for the segfault is, eth port close also shuts down
event device while other ethernet port is still using the event
device.

Fixes: da6c687471a3 ("net/octeontx: add start and stop support")

Signed-off-by: Harman Kalra <hkalra at marvell.com>
---
 drivers/net/octeontx/octeontx_ethdev.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index d531a21c95..cf01155c82 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -25,6 +25,11 @@
 #include "octeontx_rxtx.h"
 #include "octeontx_logs.h"
 
+/* Useful in stopping/closing event device if no of
+ * eth ports are using it.
+ */
+uint16_t evdev_refcnt;
+
 struct evdev_priv_data {
 	OFFLOAD_FLAGS; /*Sequence should not be changed */
 } __rte_cache_aligned;
@@ -490,7 +495,11 @@ octeontx_dev_close(struct rte_eth_dev *dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	rte_event_dev_close(nic->evdev);
+	/* Stopping/closing event device once all eth ports are closed. */
+	if (__atomic_sub_fetch(&evdev_refcnt, 1, __ATOMIC_ACQUIRE) == 0) {
+		rte_event_dev_stop(nic->evdev);
+		rte_event_dev_close(nic->evdev);
+	}
 
 	octeontx_dev_flow_ctrl_fini(dev);
 
@@ -681,8 +690,6 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	rte_event_dev_stop(nic->evdev);
-
 	ret = octeontx_port_stop(nic);
 	if (ret < 0) {
 		octeontx_log_err("failed to req stop port %d res=%d",
@@ -1346,6 +1353,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
 	nic->pko_vfid = pko_vfid;
 	nic->port_id = port;
 	nic->evdev = evdev;
+	__atomic_add_fetch(&evdev_refcnt, 1, __ATOMIC_ACQUIRE);
 
 	res = octeontx_port_open(nic);
 	if (res < 0)
@@ -1595,6 +1603,7 @@ octeontx_probe(struct rte_vdev_device *dev)
 		}
 	}
 
+	__atomic_store_n(&evdev_refcnt, 0, __ATOMIC_RELEASE);
 	/*
 	 * Do 1:1 links for ports & queues. All queues would be mapped to
 	 * one port. If there are more ports than queues, then some ports
-- 
2.35.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-07-20 15:01:00.111785026 +0800
+++ 0028-net-octeontx-fix-port-close.patch	2022-07-20 15:00:58.714333824 +0800
@@ -1 +1 @@
-From 39e07170331f869c581ce4d3cdc0360f7b6b444a Mon Sep 17 00:00:00 2001
+From ac50182289fb01dbd0206fa6aa15099755ce60d6 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 39e07170331f869c581ce4d3cdc0360f7b6b444a ]
@@ -12 +14,0 @@
-Cc: stable at dpdk.org
@@ -20 +22 @@
-index f5ea9de8ef..6469fd0a96 100644
+index d531a21c95..cf01155c82 100644
@@ -23 +25 @@
-@@ -26,6 +26,11 @@
+@@ -25,6 +25,11 @@
@@ -35 +37 @@
-@@ -491,7 +496,11 @@ octeontx_dev_close(struct rte_eth_dev *dev)
+@@ -490,7 +495,11 @@ octeontx_dev_close(struct rte_eth_dev *dev)
@@ -48 +50 @@
-@@ -671,8 +680,6 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
+@@ -681,8 +690,6 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
@@ -57 +59 @@
-@@ -1333,6 +1340,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
+@@ -1346,6 +1353,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
@@ -65 +67 @@
-@@ -1582,6 +1590,7 @@ octeontx_probe(struct rte_vdev_device *dev)
+@@ -1595,6 +1603,7 @@ octeontx_probe(struct rte_vdev_device *dev)


More information about the stable mailing list