From aa63bc9de230f688692831ee9719a0b9b5eddc6b Mon Sep 17 00:00:00 2001 From: Sorin Vinturis Date: Thu, 26 Mar 2015 19:59:36 +0000 Subject: [PATCH] datapath-windows: Support for allocating/releasing memory with tag Added functions for allocating and releasing memory with specified tag. Signed-off-by: Sorin Vinturis Reported-by: Alin Gabriel Serdean Reported-at: https://github.com/openvswitch/ovs-issues/issues/56 Acked-by: Alin Gabriel Serdean Acked-by: Eitan Eliahu Signed-off-by: Ben Pfaff --- 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 2dfba8e3a..65dd1327a 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 e75220931..0303f46e6 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) \ -- 2.20.1