diff options
author | Sorin Vinturis <svinturis@cloudbasesolutions.com> | 2016-03-25 14:49:26 +0000 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-03-25 08:24:31 -0700 |
commit | a0045b428f1e6c20fd8a31dec22d7f16ffef86f3 (patch) | |
tree | a96cba076e75a86d4a652dee3aa6612011dcdd59 /datapath-windows/ovsext/Util.c | |
parent | e59a59bddcbef2597cd0279a772eb18edd748b50 (diff) | |
download | openvswitch-a0045b428f1e6c20fd8a31dec22d7f16ffef86f3.tar.gz |
datapath-windows: Percpu allocation support function
Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
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; +} |