diff options
Diffstat (limited to 'datapath-windows/ovsext/Util.c')
-rw-r--r-- | datapath-windows/ovsext/Util.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Util.c b/datapath-windows/ovsext/Util.c index 65dd1327a..14c4493b0 100644 --- a/datapath-windows/ovsext/Util.c +++ b/datapath-windows/ovsext/Util.c @@ -116,3 +116,19 @@ OvsCompareString(PVOID string1, PVOID string2) RtlInitString(&str2, string2); return RtlEqualString(&str1, &str2, FALSE); } + +VOID * +OvsAllocateMemoryPerCpu(size_t size, ULONG tag) +{ + VOID *ptr = NULL; + ULONG count = KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS); + + ASSERT(KeQueryActiveGroupCount() == 1); + + ptr = OvsAllocateMemoryWithTag(count * size, tag); + if (ptr) { + RtlZeroMemory(ptr, count * size); + } + + return ptr; +} |