summaryrefslogtreecommitdiff
path: root/datapath-windows
diff options
context:
space:
mode:
authorAnand Kumar via dev <ovs-dev@openvswitch.org>2019-03-20 16:54:30 -0700
committerAlin Gabriel Serdean <aserdean@ovn.org>2019-04-03 17:13:55 +0300
commitc4f8dc7a9c5c1802f6b185b2440f9245a719f73b (patch)
treef685b6ca185c2128c051692f0f0cfa726b5e699f /datapath-windows
parenta76ef11deac07a7ce555655dcd23323073074bf5 (diff)
downloadopenvswitch-c4f8dc7a9c5c1802f6b185b2440f9245a719f73b.tar.gz
datapath-windows: Address memory allocation issues for OVS_BUFFER_CONTEXT
With current implementation, when nbl pool is allocated, context size is specified as 64 bytes, while the OVS_BUFFER_CONTEXT size is only 32 bytes. Since context size is never changed, additional memory is not required. This patch makes it simpler to allocate memory for OVS_BUFFER_CONTEXT so that it is always aligned to MEMORY_ALLOCATION_ALIGNMENT. This is acheived by updating "value" field in the context structure, so that number of elements in array is always a multiple of MEMORY_ALLOCATION_ALIGNMENT. Also change the DEFAULT_CONTEXT_SIZE to accomodate OVS_BUFFER_CONTEXT size. Signed-off-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Diffstat (limited to 'datapath-windows')
-rw-r--r--datapath-windows/ovsext/BufferMgmt.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/datapath-windows/ovsext/BufferMgmt.h b/datapath-windows/ovsext/BufferMgmt.h
index dcf310a27..2a74988b8 100644
--- a/datapath-windows/ovsext/BufferMgmt.h
+++ b/datapath-windows/ovsext/BufferMgmt.h
@@ -20,11 +20,8 @@
#define MEM_ALIGN MEMORY_ALLOCATION_ALIGNMENT
#define MEM_ALIGN_SIZE(_x) ((MEM_ALIGN - 1 + (_x))/MEM_ALIGN * MEM_ALIGN)
#define OVS_CTX_MAGIC 0xabcd
-
-#define OVS_DEFAULT_NBL_CONTEXT_SIZE MEM_ALIGN_SIZE(64)
-#define OVS_DEFAULT_NBL_CONTEXT_FILL \
- (OVS_DEFAULT_NBL_CONTEXT_SIZE - sizeof (OVS_BUFFER_CONTEXT))
-
+#define OVS_DEFAULT_NBL_CONTEXT_SIZE sizeof(OVS_BUFFER_CONTEXT)
+#define OVS_DEFAULT_NBL_CONTEXT_FILL 0
#define OVS_DEFAULT_DATA_SIZE 256
#define OVS_DEFAULT_HEADROOM_SIZE 128
#define OVS_FIX_NBL_DATA_SIZE (OVS_DEFAULT_DATA_SIZE + OVS_DEFAULT_HEADROOM_SIZE)
@@ -49,7 +46,7 @@ enum {
};
typedef union _OVS_BUFFER_CONTEXT {
- struct {
+ struct dummy {
UINT16 magic;
UINT16 flags;
UINT32 srcPortNo;
@@ -61,7 +58,7 @@ typedef union _OVS_BUFFER_CONTEXT {
UINT16 mru;
};
- UINT64 value[MEM_ALIGN_SIZE(32) >> 3];
+ CHAR value[MEM_ALIGN_SIZE(sizeof(struct dummy))];
} OVS_BUFFER_CONTEXT, *POVS_BUFFER_CONTEXT;
typedef struct _OVS_NBL_POOL {