DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] raw/ifpga: fix pthread cannot join
@ 2022-01-19  5:54 Wei Huang
  2022-01-19 10:45 ` Xu, Rosen
  2022-01-20  2:35 ` [PATCH v2] " Wei Huang
  0 siblings, 2 replies; 8+ messages in thread
From: Wei Huang @ 2022-01-19  5:54 UTC (permalink / raw)
  To: dev, rosen.xu, qi.z.zhang; +Cc: stable, tianfei.zhang, ferruh.yigit

From: Tianfei Zhang <tianfei.zhang@intel.com>

When we want to close a thread, we should set a flag to
thread handler function.

Fixes: 9c006c45 ("raw/ifpga: scan PCIe BDF device tree")
Cc: stable@dpdk.org

Signed-off-by: Tianfei Zhang <tianfei.zhang@intel.com>
---
 drivers/raw/ifpga/ifpga_rawdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 8d9db58..9663b67 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -497,7 +497,7 @@ static int set_surprise_link_check_aer(
 	int gsd_enable, ret;
 #define MS 1000
 
-	while (1) {
+	while (ifpga_monitor_start) {
 		gsd_enable = 0;
 		for (i = 0; i < IFPGA_RAWDEV_NUM; i++) {
 			ifpga_rdev = &ifpga_rawdevices[i];
@@ -544,7 +544,9 @@ static int set_surprise_link_check_aer(
 {
 	int ret;
 
-	if (ifpga_monitor_start == 1) {
+	if (ifpga_monitor_start == 1 && ifpga_monitor_start_thread) {
+		ifpga_monitor_start = 0;
+
 		ret = pthread_cancel(ifpga_monitor_start_thread);
 		if (ret)
 			IFPGA_RAWDEV_PMD_ERR("Can't cancel the thread");
@@ -553,8 +555,6 @@ static int set_surprise_link_check_aer(
 		if (ret)
 			IFPGA_RAWDEV_PMD_ERR("Can't join the thread");
 
-		ifpga_monitor_start = 0;
-
 		return ret;
 	}
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-21  8:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19  5:54 [PATCH v1] raw/ifpga: fix pthread cannot join Wei Huang
2022-01-19 10:45 ` Xu, Rosen
2022-01-20  2:35 ` [PATCH v2] " Wei Huang
2022-01-20  5:58   ` [PATCH v3] " Wei Huang
2022-01-20  8:08     ` David Marchand
2022-01-20 15:46     ` Stephen Hemminger
2022-01-21  8:02       ` Zhang, Tianfei
2022-01-21  1:29     ` [PATCH v4] " Wei Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).