1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc/udp: Configure queue size with exponent

This changes the configuration macro to be the exponent of 2^n, as the
message queue size needs to be always power of 2.
This commit is contained in:
Leandro Lanzieri 2020-05-15 10:26:37 +02:00
parent 3dc7865c4e
commit 4998b90395
No known key found for this signature in database
GPG Key ID: 13559905E2EBEAA5

View File

@ -33,10 +33,19 @@ extern "C" {
#endif #endif
/** /**
* @brief Default message queue size for the UDP thread * @defgroup net_gnrc_udp_conf GNRC UDP compile configurations
* @ingroup net_gnrc_conf
* @{
*/ */
#ifndef GNRC_UDP_MSG_QUEUE_SIZE /**
#define GNRC_UDP_MSG_QUEUE_SIZE (8U) * @brief Default message queue size for the UDP thread (as exponent of 2^n).
*
* As the queue size ALWAYS needs to be power of two, this option
* represents the exponent of 2^n, which will be used as the size of
* the queue.
*/
#ifndef CONFIG_GNRC_UDP_MSG_QUEUE_SIZE_EXP
#define CONFIG_GNRC_UDP_MSG_QUEUE_SIZE_EXP (3U)
#endif #endif
/** /**
@ -52,6 +61,14 @@ extern "C" {
#ifndef GNRC_UDP_STACK_SIZE #ifndef GNRC_UDP_STACK_SIZE
#define GNRC_UDP_STACK_SIZE (THREAD_STACKSIZE_DEFAULT) #define GNRC_UDP_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
#endif #endif
/** @} */
/**
* @brief Message queue size to use for the UDP thread.
*/
#ifndef GNRC_UDP_MSG_QUEUE_SIZE
#define GNRC_UDP_MSG_QUEUE_SIZE (1 << CONFIG_GNRC_UDP_MSG_QUEUE_SIZE_EXP)
#endif
/** /**
* @brief Calculate the checksum for the given packet * @brief Calculate the checksum for the given packet