From 8782bf8b3e7a68ae77d0102951252f8b795fe4b8 Mon Sep 17 00:00:00 2001 From: Yakun Xu Date: Fri, 2 Aug 2019 01:32:05 +0800 Subject: [PATCH] [config] set message buffer size based on CPU word length (#4049) Message buffers store pointers which have different sizes on different system. Setting message buffer size according to the CPU word length so that message buffer size will be doubled on 64bit system compared to that on 32bit system. As a result, the first message always have some bytes left for small packets. --- src/core/config/openthread-core-default-config.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/config/openthread-core-default-config.h b/src/core/config/openthread-core-default-config.h index 950b54d07..23fc0c390 100644 --- a/src/core/config/openthread-core-default-config.h +++ b/src/core/config/openthread-core-default-config.h @@ -170,9 +170,15 @@ * * The size of a message buffer in bytes. * + * Message buffers store pointers which have different sizes on different + * system. Setting message buffer size according to the CPU word length + * so that message buffer size will be doubled on 64bit system compared + * to that on 32bit system. As a result, the first message always have some + * bytes left for small packets. + * */ #ifndef OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE -#define OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE 128 +#define OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE (sizeof(void *) * 32) #endif /**