DPDK patches and discussions
 help / color / mirror / Atom feed
From: Serhii Iliushyk <sil-plv@napatech.com>
To: dev@dpdk.org
Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com,
	stephen@networkplumber.org
Subject: [PATCH v2 31/34] net/ntnic: remove shutdown thread
Date: Wed,  5 Feb 2025 11:45:40 +0100	[thread overview]
Message-ID: <20250205104548.1533554-32-sil-plv@napatech.com> (raw)
In-Reply-To: <20250205104548.1533554-1-sil-plv@napatech.com>

Remove the shutdown thread and SIGINT handling on the level of PMD

Signed-off-by: Serhii Iliushyk <sil-plv@napatech.com>
---
 drivers/net/ntnic/ntnic_ethdev.c | 63 ++++----------------------------
 1 file changed, 7 insertions(+), 56 deletions(-)

diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c
index 9000264804..e65be67c44 100644
--- a/drivers/net/ntnic/ntnic_ethdev.c
+++ b/drivers/net/ntnic/ntnic_ethdev.c
@@ -76,10 +76,6 @@ const rte_thread_attr_t thread_attr = { .priority = RTE_THREAD_PRIORITY_NORMAL }
 
 uint64_t rte_tsc_freq;
 
-static void (*previous_handler)(int sig);
-static rte_thread_t shutdown_tid;
-
-int kill_pmd;
 
 #define ETH_DEV_NTNIC_HELP_ARG "help"
 #define ETH_DEV_NTHW_RXQUEUES_ARG "rxqs"
@@ -480,9 +476,6 @@ static uint16_t eth_dev_rx_scg(void *queue, struct rte_mbuf **bufs, uint16_t nb_
 
 	struct nthw_received_packets hw_recv[MAX_RX_PACKETS];
 
-	if (kill_pmd)
-		return 0;
-
 	if (unlikely(nb_pkts == 0))
 		return 0;
 
@@ -693,9 +686,6 @@ static uint16_t eth_dev_tx_scg(void *queue, struct rte_mbuf **bufs, uint16_t nb_
 	int pkts_sent = 0;
 	uint16_t nb_segs_arr[MAX_TX_PACKETS];
 
-	if (kill_pmd)
-		return 0;
-
 	if (nb_pkts > MAX_TX_PACKETS)
 		nb_pkts = MAX_TX_PACKETS;
 
@@ -2490,51 +2480,6 @@ nthw_pci_dev_deinit(struct rte_eth_dev *eth_dev __rte_unused)
 	return 0;
 }
 
-static void signal_handler_func_int(int sig)
-{
-	if (sig != SIGINT) {
-		signal(sig, previous_handler);
-		raise(sig);
-		return;
-	}
-
-	kill_pmd = 1;
-}
-
-THREAD_FUNC shutdown_thread(void *arg __rte_unused)
-{
-	while (!kill_pmd)
-		nt_os_wait_usec(100 * 1000);
-
-	NT_LOG_DBGX(DBG, NTNIC, "Shutting down because of ctrl+C");
-
-	signal(SIGINT, previous_handler);
-	raise(SIGINT);
-
-	return THREAD_RETURN;
-}
-
-static int init_shutdown(void)
-{
-	NT_LOG(DBG, NTNIC, "Starting shutdown handler");
-	kill_pmd = 0;
-	previous_handler = signal(SIGINT, signal_handler_func_int);
-	int ret = THREAD_CREATE(&shutdown_tid, shutdown_thread, NULL);
-	if (ret != 0) {
-		NT_LOG(ERR, NTNIC, "Failed to create shutdown thread, error code: %d", ret);
-		return -1;
-	}
-	/*
-	 * 1 time calculation of 1 sec stat update rtc cycles to prevent stat poll
-	 * flooding by OVS from multiple virtual port threads - no need to be precise
-	 */
-	uint64_t now_rtc = rte_get_tsc_cycles();
-	nt_os_wait_usec(10 * 1000);
-	rte_tsc_freq = 100 * (rte_get_tsc_cycles() - now_rtc);
-
-	return 0;
-}
-
 static int
 nthw_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	struct rte_pci_device *pci_dev)
@@ -2577,7 +2522,13 @@ nthw_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 	ret = nthw_pci_dev_init(pci_dev);
 
-	init_shutdown();
+	/*
+	 * 1 time calculation of 1 sec stat update rtc cycles to prevent stat poll
+	 * flooding by OVS from multiple virtual port threads - no need to be precise
+	 */
+	uint64_t now_rtc = rte_get_tsc_cycles();
+	nt_os_wait_usec(10 * 1000);
+	rte_tsc_freq = 100 * (rte_get_tsc_cycles() - now_rtc);
 
 	NT_LOG_DBGX(DBG, NTNIC, "leave: ret=%d", ret);
 	return ret;
-- 
2.45.0


  parent reply	other threads:[~2025-02-05 10:49 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 17:07 [PATCH v1 00/31] net/ntnic: bugfixes and refactoring Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 01/31] net/ntnic: fix index verification Serhii Iliushyk
2025-02-05 10:45   ` [PATCH v2 00/34] net/ntnic: bugfixes and refactoring Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 01/34] net/ntnic: fix index verification Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 02/34] net/ntnic: add thread check return code Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 03/34] net/ntnic: add return code handling Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 04/34] net/ntnic: add array index verification Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 05/34] net/ntnic: fix realloc memory leak Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 06/34] net/ntnic: fix array index verification Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 07/34] net/ntnic: add var definition transparently Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 08/34] net/ntnic: add proper var freed Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 09/34] net/ntnic: remove unused code Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 10/34] net/ntnic: fix potentially overflow Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 11/34] net/ntnic: add null checking Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 12/34] net/ntnic: fix overflow issue Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 13/34] net/ntnic: fix untrusted loop bound Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 14/34] net/ntnic: add null checking Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 15/34] net/ntnic: move " Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 16/34] net/ntnic: fix var size Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 17/34] net/ntnic: fix var overflow Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 18/34] net/ntnic: remove unused code Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 19/34] net/ntnic: remove convert error func Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 20/34] net/ntnic: fix array verification Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 21/34] net/ntnic: fix memory leak Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 22/34] net/ntnic: remove extra address-of operator Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 23/34] net/ntnic: remove extra check for null Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 24/34] net/ntnic: remove unused code Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 25/34] net/ntnic: refactor RSS implementation Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 26/34] net/ntnic: fix age timeout recalculation into fpga unit Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 27/34] net/ntnic: rework age event generation Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 28/34] net/ntnic: fix group print Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 29/34] net/ntnic: extend module mapping Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 30/34] net/ntnic: refactoring of the FPGA initialization Serhii Iliushyk
2025-02-05 10:45     ` Serhii Iliushyk [this message]
2025-02-05 10:45     ` [PATCH v2 32/34] net/ntnic: add checks for action modify Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 33/34] net/ntnic: add IFR DROP counter Serhii Iliushyk
2025-02-05 10:45     ` [PATCH v2 34/34] net/ntnic: remove tag EXPERIMENTAL Serhii Iliushyk
2025-02-05 16:51     ` [PATCH v2 00/34] net/ntnic: bugfixes and refactoring Stephen Hemminger
2025-01-21 17:07 ` [PATCH v1 02/31] net/ntnic: add thread check return code Serhii Iliushyk
2025-01-21 18:24   ` Stephen Hemminger
2025-01-28 18:54   ` Stephen Hemminger
2025-01-21 17:07 ` [PATCH v1 03/31] net/ntnic: add return code handling Serhii Iliushyk
2025-01-21 18:30   ` Stephen Hemminger
2025-01-21 17:07 ` [PATCH v1 04/31] net/ntnic: add array index verification Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 05/31] net/ntnic: fix realloc memory leak Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 06/31] net/ntnic: fix array index verification Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 07/31] net/ntnic: add var definition transparently Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 08/31] net/ntnic: add proper var freed Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 09/31] net/ntnic: remove deadcode Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 10/31] net/ntnic: fix potentially overflow Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 11/31] net/ntnic: add null checking Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 12/31] net/ntnic: fix overflow issue Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 13/31] net/ntnic: fix untrusted loop bound Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 14/31] net/ntnic: add null checking Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 15/31] net/ntnic: move " Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 16/31] net/ntnic: fix var size Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 17/31] net/ntnic: fix var overflow Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 18/31] net/ntnic: remove dead code Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 19/31] net/ntnic: remove convert error func Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 20/31] net/ntnic: fix array verification Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 21/31] net/ntnic: fix memory leak Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 22/31] net/ntnic: remove extra address-of operator Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 23/31] net/ntnic: remove extra check for null Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 24/31] net/ntnic: remove unused code Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 25/31] net/ntnic: refactor RSS implementation Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 26/31] net/ntnic: fix age timeout recalculation into fpga unit Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 27/31] net/ntnic: rework age event generation Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 28/31] net/ntnic: fix group print Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 29/31] net/ntnic: extend module mapping Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 30/31] net/ntnic: refactoring of the FPGA initialization Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 31/31] net/ntnic: remove tag EXPERIMENTAL Serhii Iliushyk
2025-01-28 18:51 ` [PATCH v1 00/31] net/ntnic: bugfixes and refactoring Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250205104548.1533554-32-sil-plv@napatech.com \
    --to=sil-plv@napatech.com \
    --cc=ckm@napatech.com \
    --cc=dev@dpdk.org \
    --cc=mko-plv@napatech.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).