DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Christian Koue Muf <ckm@napatech.com>,
	Serhii Iliushyk <sil-plv@napatech.com>
Subject: [RFC 2/3] net/ntnic: rename hwlock
Date: Fri, 26 Sep 2025 09:24:47 -0700	[thread overview]
Message-ID: <20250926162534.401577-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20250926162534.401577-1-stephen@networkplumber.org>

All global variables in driver should use common prefix.
Rename hwlock to ntnic_hwlock.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/ntnic/include/stream_binary_flow_api.h |  2 +-
 drivers/net/ntnic/ntnic_ethdev.c                   | 14 +++++++-------
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c      |  8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ntnic/include/stream_binary_flow_api.h b/drivers/net/ntnic/include/stream_binary_flow_api.h
index 4ce1561033..b89f19d399 100644
--- a/drivers/net/ntnic/include/stream_binary_flow_api.h
+++ b/drivers/net/ntnic/include/stream_binary_flow_api.h
@@ -47,7 +47,7 @@
 #define RAW_ENCAP_DECAP_ELEMS_MAX 16
 
 extern uint64_t rte_tsc_freq;
-extern rte_spinlock_t hwlock;
+extern rte_spinlock_t ntnic_hwlock;
 
 /*
  * Flow eth dev profile determines how the FPGA module resources are
diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c
index 67908e3807..9c9c91deca 100644
--- a/drivers/net/ntnic/ntnic_ethdev.c
+++ b/drivers/net/ntnic/ntnic_ethdev.c
@@ -92,7 +92,7 @@ static const struct rte_pci_id nthw_pci_id_map[] = {
 
 static const struct sg_ops_s *sg_ops;
 
-rte_spinlock_t hwlock = RTE_SPINLOCK_INITIALIZER;
+rte_spinlock_t ntnic_hwlock = RTE_SPINLOCK_INITIALIZER;
 
 /*
  * Store and get adapter info
@@ -124,9 +124,9 @@ store_pdrv(struct drv_s *p_drv)
 			PCIIDENT_TO_FUNCNR(p_drv->ntdrv.pciident));
 	}
 
-	rte_spinlock_lock(&hwlock);
+	rte_spinlock_lock(&ntnic_hwlock);
 	_g_p_drv[p_drv->adapter_no] = p_drv;
-	rte_spinlock_unlock(&hwlock);
+	rte_spinlock_unlock(&ntnic_hwlock);
 }
 
 static void clear_pdrv(struct drv_s *p_drv)
@@ -134,9 +134,9 @@ static void clear_pdrv(struct drv_s *p_drv)
 	if (p_drv->adapter_no >= NUM_ADAPTER_MAX)
 		return;
 
-	rte_spinlock_lock(&hwlock);
+	rte_spinlock_lock(&ntnic_hwlock);
 	_g_p_drv[p_drv->adapter_no] = NULL;
-	rte_spinlock_unlock(&hwlock);
+	rte_spinlock_unlock(&ntnic_hwlock);
 }
 
 static struct drv_s *
@@ -144,7 +144,7 @@ get_pdrv_from_pci(struct rte_pci_addr addr)
 {
 	int i;
 	struct drv_s *p_drv = NULL;
-	rte_spinlock_lock(&hwlock);
+	rte_spinlock_lock(&ntnic_hwlock);
 
 	for (i = 0; i < NUM_ADAPTER_MAX; i++) {
 		if (_g_p_drv[i]) {
@@ -156,7 +156,7 @@ get_pdrv_from_pci(struct rte_pci_addr addr)
 		}
 	}
 
-	rte_spinlock_unlock(&hwlock);
+	rte_spinlock_unlock(&ntnic_hwlock);
 	return p_drv;
 }
 
diff --git a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c
index 813ac04481..b68838461d 100644
--- a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c
+++ b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c
@@ -1187,7 +1187,7 @@ static int poll_statistics(struct pmd_internals *internals)
 
 	RTE_ASSERT(rte_tsc_freq > 0);
 
-	rte_spinlock_lock(&hwlock);
+	rte_spinlock_lock(&ntnic_hwlock);
 
 	uint64_t now_rtc = rte_get_tsc_cycles();
 
@@ -1196,7 +1196,7 @@ static int poll_statistics(struct pmd_internals *internals)
 	 * if more than a second since last stat read, do a new one
 	 */
 	if ((now_rtc - internals->last_stat_rtc) < rte_tsc_freq) {
-		rte_spinlock_unlock(&hwlock);
+		rte_spinlock_unlock(&ntnic_hwlock);
 		return 0;
 	}
 
@@ -1242,7 +1242,7 @@ static int poll_statistics(struct pmd_internals *internals)
 
 	/* Globally only once a second */
 	if ((now_rtc - last_stat_rtc) < rte_tsc_freq) {
-		rte_spinlock_unlock(&hwlock);
+		rte_spinlock_unlock(&ntnic_hwlock);
 		rte_spinlock_unlock(&p_nt_drv->stat_lck);
 		return 0;
 	}
@@ -1279,7 +1279,7 @@ static int poll_statistics(struct pmd_internals *internals)
 		}
 	}
 
-	rte_spinlock_unlock(&hwlock);
+	rte_spinlock_unlock(&ntnic_hwlock);
 	rte_spinlock_unlock(&p_nt_drv->stat_lck);
 
 	return 0;
-- 
2.47.3


  parent reply	other threads:[~2025-09-26 16:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26 16:24 [RFC 0/3] net/ntnic: prefix global symbols Stephen Hemminger
2025-09-26 16:24 ` [RFC 1/3] net/ntnic: rename nt_log_ types Stephen Hemminger
2025-09-26 16:24 ` Stephen Hemminger [this message]
2025-09-26 16:24 ` [RFC 3/3] net/ntnic: make flow_lock local 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=20250926162534.401577-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=ckm@napatech.com \
    --cc=dev@dpdk.org \
    --cc=sil-plv@napatech.com \
    /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).