summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Util.h
diff options
context:
space:
mode:
authorAnand Kumar <kumaranand@vmware.com>2018-06-22 10:09:25 -0700
committerAlin Gabriel Serdean <aserdean@ovn.org>2018-06-24 23:58:13 +0300
commit9d7c8de9fe557efa9c55bfe4fe8947785f252c3a (patch)
tree96db441872d357096206009ceef2446202d56172 /datapath-windows/ovsext/Util.h
parentde759da2dd5086cdb2f0fd49a5f3e50f965d4ad3 (diff)
downloadopenvswitch-9d7c8de9fe557efa9c55bfe4fe8947785f252c3a.tar.gz
datapath-windows: Use spinlock instead of RW lock for ct entry
This patch mainly changes a ndis RW lock for conntrack entry to a spinlock along with some minor refactor in conntrack. Using spinlock instead of RW lock as RW locks causes performance hits when acquired/released multiple times. - Use NdisInterlockedXX wrapper api's instead of InterlockedXX. - Update 'ctTotalRelatedEntries' using interlocked functions. - Move conntrack lock out of NAT module. Testing: Verified loading/unloading the driver with driver verified enabled. Ran TCP/UDP and ICMP traffic. Signed-off-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext/Util.h')
-rw-r--r--datapath-windows/ovsext/Util.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Util.h b/datapath-windows/ovsext/Util.h
index 6f02147b6..a9bccf36c 100644
--- a/datapath-windows/ovsext/Util.h
+++ b/datapath-windows/ovsext/Util.h
@@ -105,6 +105,24 @@ VOID OvsAppendList(PLIST_ENTRY dst, PLIST_ENTRY src);
#define BIT16(_x) ((UINT16)0x1 << (_x))
#define BIT32(_x) ((UINT32)0x1 << (_x))
+#define OVS_ACQUIRE_SPIN_LOCK(_pLock, _dispatchLevel) \
+{ \
+ if (_dispatchLevel) { \
+ NdisDprAcquireSpinLock(_pLock); \
+ } else { \
+ NdisAcquireSpinLock(_pLock); \
+ } \
+}
+
+#define OVS_RELEASE_SPIN_LOCK(_pLock, _dispatchLevel) \
+{ \
+ if (_dispatchLevel) { \
+ NdisDprReleaseSpinLock(_pLock); \
+ } else { \
+ NdisReleaseSpinLock(_pLock); \
+ } \
+}
+
BOOLEAN OvsCompareString(PVOID string1, PVOID string2);
/*