Skip to content

Commit

Permalink
datapath-windows: Support for allocating/releasing memory with tag
Browse files Browse the repository at this point in the history
Added functions for allocating and releasing memory with specified
tag.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: openvswitch/ovs-issues#56
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
  • Loading branch information
svinturis authored and blp committed Mar 26, 2015
1 parent 1d741d6 commit aa63bc9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions datapath-windows/ovsext/Util.c
Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions datapath-windows/ovsext/Util.h
Expand Up @@ -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) \
Expand Down

0 comments on commit aa63bc9

Please sign in to comment.