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

christian.ehrhardt at canonical.com christian.ehrhardt at canonical.com
Thu Jul 7 09:55:05 CEST 2022


Hi,

FYI, your patch has been queued to stable release 19.11.13

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/09/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/cpaelzer/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/cpaelzer/dpdk-stable-queue/commit/07d9cd4f91aca2e67fa3dd776b7d43ad933546b1

Thanks.

Christian Ehrhardt <christian.ehrhardt at canonical.com>

---
>From 07d9cd4f91aca2e67fa3dd776b7d43ad933546b1 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

[ 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 a496ee60cf..3fc405908d 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -24,6 +24,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 octeontx_vdev_init_params {
 	uint8_t	nr_port;
 };
@@ -336,7 +341,11 @@ octeontx_dev_close(struct rte_eth_dev *dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return;
 
-	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);
+	}
 
 	ret = octeontx_pko_channel_close(nic->base_ochan);
 	if (ret < 0) {
@@ -429,8 +438,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",
@@ -1059,6 +1066,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)
@@ -1287,6 +1295,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.37.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-07-07 09:54:14.051085649 +0200
+++ 0070-net-octeontx-fix-port-close.patch	2022-07-07 09:54:10.985824740 +0200
@@ -1 +1 @@
-From 39e07170331f869c581ce4d3cdc0360f7b6b444a Mon Sep 17 00:00:00 2001
+From 07d9cd4f91aca2e67fa3dd776b7d43ad933546b1 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 39e07170331f869c581ce4d3cdc0360f7b6b444a ]
+
@@ -12 +13,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
-index f5ea9de8ef..6469fd0a96 100644
+index a496ee60cf..3fc405908d 100644
@@ -23 +24 @@
-@@ -26,6 +26,11 @@
+@@ -24,6 +24,11 @@
@@ -32,4 +33,4 @@
- struct evdev_priv_data {
- 	OFFLOAD_FLAGS; /*Sequence should not be changed */
- } __rte_cache_aligned;
-@@ -491,7 +496,11 @@ octeontx_dev_close(struct rte_eth_dev *dev)
+ struct octeontx_vdev_init_params {
+ 	uint8_t	nr_port;
+ };
+@@ -336,7 +341,11 @@ octeontx_dev_close(struct rte_eth_dev *dev)
@@ -37 +38 @@
- 		return 0;
+ 		return;
@@ -46,3 +47,3 @@
- 	octeontx_dev_flow_ctrl_fini(dev);
- 
-@@ -671,8 +680,6 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
+ 	ret = octeontx_pko_channel_close(nic->base_ochan);
+ 	if (ret < 0) {
+@@ -429,8 +438,6 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
@@ -57 +58 @@
-@@ -1333,6 +1340,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
+@@ -1059,6 +1066,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
@@ -65 +66 @@
-@@ -1582,6 +1590,7 @@ octeontx_probe(struct rte_vdev_device *dev)
+@@ -1287,6 +1295,7 @@ octeontx_probe(struct rte_vdev_device *dev)


More information about the stable mailing list