patch 'raw/ifpga: unregister interrupt on close' has been queued to stable release 20.11.6

Xueming Li xuemingl at nvidia.com
Tue Jun 21 10:02:51 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 06/23/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/30c0b36a019c910f9f7d2c5b13b044aa40d8de8d

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 30c0b36a019c910f9f7d2c5b13b044aa40d8de8d Mon Sep 17 00:00:00 2001
From: Wei Huang <wei.huang at intel.com>
Date: Tue, 7 Jun 2022 05:07:22 -0400
Subject: [PATCH] raw/ifpga: unregister interrupt on close
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 2545683564aa15f36392be2b4ceead454064135b ]

There is an API rte_pmd_ifpga_cleanup provided by ifpga driver to
free the software resource used by ifpga card. The function call
of rte_pmd_ifpga_cleanup is list below.
rte_pmd_ifpga_cleanup()
  ifpga_rawdev_cleanup()
     rte_rawdev_pmd_release()
       rte_rawdev_close()
         ifpga_rawdev_close()

The interrupts are unregistered in ifpga_rawdev_destroy instead of
ifpga_rawdev_close function, so rte_pmd_ifpga_cleanup cannot free
interrupt resource as expected.

To fix such issue, interrupt unregistration is moved from
ifpga_rawdev_destroy to ifpga_rawdev_close function. The change of
function call of ifpga_rawdev_destroy is as below.
ifpga_rawdev_destroy()
  ifpga_unregister_msix_irq()  // removed
  rte_rawdev_pmd_release()
    rte_rawdev_close()
      ifpga_rawdev_close()

Fixes: e0a1aafe2af9 ("raw/ifpga: introduce IRQ functions")

Signed-off-by: Wei Huang <wei.huang at intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang at intel.com>
Reviewed-by: Rosen Xu <rosen.xu at intel.com>
---
 drivers/raw/ifpga/ifpga_rawdev.c | 33 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index cc6223cb28..2d7f1af51d 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -78,6 +78,7 @@ static int set_surprise_link_check_aer(
 static int ifpga_pci_find_next_ext_capability(unsigned int fd,
 					      int start, uint32_t cap);
 static int ifpga_pci_find_ext_capability(unsigned int fd, uint32_t cap);
+static void fme_interrupt_handler(void *param);
 
 struct ifpga_rawdev *
 ifpga_rawdev_get(const struct rte_rawdev *rawdev)
@@ -736,18 +737,30 @@ ifpga_rawdev_stop(struct rte_rawdev *dev)
 static int
 ifpga_rawdev_close(struct rte_rawdev *dev)
 {
+	struct ifpga_rawdev *ifpga_rdev = NULL;
 	struct opae_adapter *adapter;
+	struct opae_manager *mgr;
+	int ret = 0;
 
 	if (dev) {
-		ifpga_monitor_stop_func(ifpga_rawdev_get(dev));
+		ifpga_rdev = ifpga_rawdev_get(dev); 
+		if (ifpga_rdev)
+			ifpga_monitor_stop_func(ifpga_rdev);
 		adapter = ifpga_rawdev_get_priv(dev);
 		if (adapter) {
+			mgr = opae_adapter_get_mgr(adapter);
+			if (ifpga_rdev && mgr) {
+				if (ifpga_unregister_msix_irq(ifpga_rdev,
+					IFPGA_FME_IRQ, 0,
+					fme_interrupt_handler, mgr) < 0)
+					ret = -EINVAL;
+			}
 			opae_adapter_destroy(adapter);
 			opae_adapter_data_free(adapter->data);
 		}
 	}
 
-	return dev ? 0:1;
+	return ret;
 }
 
 static int
@@ -1599,9 +1612,6 @@ ifpga_rawdev_destroy(struct rte_pci_device *pci_dev)
 	int ret;
 	struct rte_rawdev *rawdev;
 	char name[RTE_RAWDEV_NAME_MAX_LEN];
-	struct opae_adapter *adapter;
-	struct opae_manager *mgr;
-	struct ifpga_rawdev *dev;
 
 	if (!pci_dev) {
 		IFPGA_RAWDEV_PMD_ERR("Invalid pci_dev of the device!");
@@ -1621,19 +1631,6 @@ ifpga_rawdev_destroy(struct rte_pci_device *pci_dev)
 		IFPGA_RAWDEV_PMD_ERR("Invalid device name (%s)", name);
 		return -EINVAL;
 	}
-	dev = ifpga_rawdev_get(rawdev);
-
-	adapter = ifpga_rawdev_get_priv(rawdev);
-	if (!adapter)
-		return -ENODEV;
-
-	mgr = opae_adapter_get_mgr(adapter);
-	if (!mgr)
-		return -ENODEV;
-
-	if (ifpga_unregister_msix_irq(dev, IFPGA_FME_IRQ, 0,
-				fme_interrupt_handler, mgr) < 0)
-		return -EINVAL;
 
 	/* rte_rawdev_close is called by pmd_release */
 	ret = rte_rawdev_pmd_release(rawdev);
-- 
2.35.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-21 15:37:53.904207763 +0800
+++ 0105-raw-ifpga-unregister-interrupt-on-close.patch	2022-06-21 15:37:49.221118569 +0800
@@ -1 +1 @@
-From 2545683564aa15f36392be2b4ceead454064135b Mon Sep 17 00:00:00 2001
+From 30c0b36a019c910f9f7d2c5b13b044aa40d8de8d Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 2545683564aa15f36392be2b4ceead454064135b ]
@@ -29 +31,0 @@
-Cc: stable at dpdk.org
@@ -35,2 +37,2 @@
- drivers/raw/ifpga/ifpga_rawdev.c | 29 +++++++++++------------------
- 1 file changed, 11 insertions(+), 18 deletions(-)
+ drivers/raw/ifpga/ifpga_rawdev.c | 33 +++++++++++++++-----------------
+ 1 file changed, 15 insertions(+), 18 deletions(-)
@@ -39 +41 @@
-index fe3fc43abe..94df56c90c 100644
+index cc6223cb28..2d7f1af51d 100644
@@ -50 +52,3 @@
-@@ -740,8 +741,9 @@ ifpga_rawdev_close(struct rte_rawdev *dev)
+@@ -736,18 +737,30 @@ ifpga_rawdev_stop(struct rte_rawdev *dev)
+ static int
+ ifpga_rawdev_close(struct rte_rawdev *dev)
@@ -52 +56 @@
- 	struct ifpga_rawdev *ifpga_rdev = NULL;
++	struct ifpga_rawdev *ifpga_rdev = NULL;
@@ -55,3 +59 @@
- 	char *vdev_name = NULL;
--	int i = 0;
-+	int i, ret = 0;
++	int ret = 0;
@@ -60,3 +62,4 @@
- 		ifpga_rdev = ifpga_rawdev_get(dev);
-@@ -756,12 +758,19 @@ ifpga_rawdev_close(struct rte_rawdev *dev)
- 		}
+-		ifpga_monitor_stop_func(ifpga_rawdev_get(dev));
++		ifpga_rdev = ifpga_rawdev_get(dev); 
++		if (ifpga_rdev)
++			ifpga_monitor_stop_func(ifpga_rdev);
@@ -82 +85 @@
-@@ -1629,9 +1638,6 @@ ifpga_rawdev_destroy(struct rte_pci_device *pci_dev)
+@@ -1599,9 +1612,6 @@ ifpga_rawdev_destroy(struct rte_pci_device *pci_dev)
@@ -92 +95 @@
-@@ -1651,19 +1657,6 @@ ifpga_rawdev_destroy(struct rte_pci_device *pci_dev)
+@@ -1621,19 +1631,6 @@ ifpga_rawdev_destroy(struct rte_pci_device *pci_dev)


More information about the stable mailing list