[RFC 5/6] intel/ipn3ke: avoid use of pthread_cancel

Stephen Hemminger stephen at networkplumber.org
Wed Sep 24 18:51:12 CEST 2025


Can use the existing reference count (scan_num) to control
the thread without using pthread_cancel.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/intel/ipn3ke/ipn3ke_representor.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/intel/ipn3ke/ipn3ke_representor.c b/drivers/net/intel/ipn3ke/ipn3ke_representor.c
index feb57420c3..4e831c6924 100644
--- a/drivers/net/intel/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/intel/ipn3ke/ipn3ke_representor.c
@@ -26,7 +26,7 @@
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"
 
-static int ipn3ke_rpst_scan_num;
+static volatile int ipn3ke_rpst_scan_num;
 static rte_thread_t ipn3ke_rpst_scan_thread;
 
 /** Double linked list of representor port. */
@@ -2578,7 +2578,7 @@ ipn3ke_rpst_scan_handle_request(__rte_unused void *param)
 #define MS 1000
 #define SCAN_NUM 32
 
-	for (;;) {
+	while (ipn3ke_rpst_scan_num > 0) {
 		num = 0;
 		TAILQ_FOREACH(rpst, &ipn3ke_rpst_list, next) {
 			if (rpst->i40e_pf_eth &&
@@ -2612,10 +2612,6 @@ ipn3ke_rpst_scan_check(void)
 			return -1;
 		}
 	} else if (ipn3ke_rpst_scan_num == 0) {
-		ret = pthread_cancel((pthread_t)ipn3ke_rpst_scan_thread.opaque_id);
-		if (ret)
-			IPN3KE_AFU_PMD_ERR("Can't cancel the thread");
-
 		ret = rte_thread_join(ipn3ke_rpst_scan_thread, NULL);
 		if (ret)
 			IPN3KE_AFU_PMD_ERR("Can't join the thread");
-- 
2.47.3



More information about the dev mailing list