[ovs-dev] [PATCH v2 01/11] datapath-windows: Support for allocating/releasing memory with tag

Sorin Vinturis svinturis at cloudbasesolutions.com
Thu Mar 26 19:59:36 UTC 2015


Added functions for allocating and releasing memory with specified
tag.

Signed-off-by: Sorin Vinturis <svinturis at cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/56
Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue at vmware.com>
---
 datapath-windows/ovsext/Util.c | 15 +++++++++++++++
 datapath-windows/ovsext/Util.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/datapath-windows/ovsext/Util.c b/datapath-windows/ovsext/Util.c
index 2dfba8e..65dd132 100644
--- a/datapath-windows/ovsext/Util.c
+++ b/datapath-windows/ovsext/Util.c
@@ -24,6 +24,21 @@
 
 extern NDIS_HANDLE gOvsExtDriverHandle;
 
+VOID*
+OvsAllocateMemoryWithTag(size_t size, ULONG tag)
+{
+    OVS_VERIFY_IRQL_LE(DISPATCH_LEVEL);
+    return NdisAllocateMemoryWithTagPriority(gOvsExtDriverHandle,
+        (UINT32)size, tag, NormalPoolPriority);
+}
+
+VOID
+OvsFreeMemoryWithTag(VOID *ptr, ULONG tag)
+{
+    ASSERT(ptr);
+    NdisFreeMemoryWithTagPriority(gOvsExtDriverHandle, ptr, tag);
+}
+
 VOID *
 OvsAllocateMemory(size_t size)
 {
diff --git a/datapath-windows/ovsext/Util.h b/datapath-windows/ovsext/Util.h
index e752209..0303f46 100644
--- a/datapath-windows/ovsext/Util.h
+++ b/datapath-windows/ovsext/Util.h
@@ -25,8 +25,10 @@
 #define OVS_OTHER_POOL_TAG              'MSVO'
 
 VOID *OvsAllocateMemory(size_t size);
+VOID *OvsAllocateMemoryWithTag(size_t size, ULONG tag);
 VOID *OvsAllocateAlignedMemory(size_t size, UINT16 align);
 VOID OvsFreeMemory(VOID *ptr);
+VOID OvsFreeMemoryWithTag(VOID *ptr, ULONG tag);
 VOID OvsFreeAlignedMemory(VOID *ptr);
 
 #define LIST_FORALL(_headPtr, _itemPtr) \
-- 
1.9.0.msysgit.0



More information about the dev mailing list