[ovs-dev] [PATCH 13/15] datapath-windows: Add Core.h

Nithin Raju nithin at vmware.com
Sat Aug 16 07:09:58 UTC 2014


Sam,
I don't have a strong opinion here. I am fine if you want to change the utility functions in OvsUtil.c to allocate and free the memory. These are different implementations to do the same thing, and not significantly different. If you want to go ahead and make this change, pls. make it in OvsUtil.c and remove the code in let's come up with a series of patches where we define the new memory allocation functions, and change each of the callsites of OvsAllocateMemory() etc, to use the new functions.

Some comments in the meantime:

> +#define OVS_ALLOC(size) ExAllocatePoolWithTag(NonPagedPool, size, OVS_MEMORY_TAG)

We used NdisAllocateMemoryWithTagPriority() since OVS is an NDIS driver. I am not 100% sure if using ExAllocatePoolWithTag() is better or worse than NdisAllocateMemoryWithTagPriority().

> +
> +static __inline VOID* KZAlloc(SIZE_T size)
> +{
> +    VOID* p = OVS_ALLOC(size);
> +    if (!p)
> +    {
> +        return NULL;
> +    }
> +
> +    RtlZeroMemory(p, size);
> +    return p;
> +}

We an add an additional API like OvsAllocateMemory() which also zeros the memory.

thanks,
Nithin


More information about the dev mailing list