mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 10:03:50 +01:00
gnrc/ipv6: 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:
parent
1992f57765
commit
b0168f5fdd
@ -138,10 +138,15 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default message queue size to use for the IPv6 thread.
|
* @brief Default message queue size to use for the IPv6 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_IPV6_MSG_QUEUE_SIZE
|
#ifndef CONFIG_GNRC_IPV6_MSG_QUEUE_SIZE_EXP
|
||||||
#define CONFIG_GNRC_IPV6_MSG_QUEUE_SIZE (8U)
|
#define CONFIG_GNRC_IPV6_MSG_QUEUE_SIZE_EXP (3U)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DOXYGEN
|
#ifdef DOXYGEN
|
||||||
@ -164,6 +169,13 @@ extern "C" {
|
|||||||
#endif /* DOXYGEN */
|
#endif /* DOXYGEN */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Message queue size to use for the IPv6 thread.
|
||||||
|
*/
|
||||||
|
#ifndef GNRC_IPV6_MSG_QUEUE_SIZE
|
||||||
|
#define GNRC_IPV6_MSG_QUEUE_SIZE (1 << CONFIG_GNRC_IPV6_MSG_QUEUE_SIZE_EXP)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The PID to the IPv6 thread.
|
* @brief The PID to the IPv6 thread.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -14,9 +14,13 @@ menuconfig KCONFIG_MODULE_GNRC_IPV6
|
|||||||
|
|
||||||
if KCONFIG_MODULE_GNRC_IPV6
|
if KCONFIG_MODULE_GNRC_IPV6
|
||||||
|
|
||||||
config GNRC_IPV6_MSG_QUEUE_SIZE
|
config GNRC_IPV6_MSG_QUEUE_SIZE_EXP
|
||||||
int "Default message queue size to use for the IPv6 thread"
|
int "Exponent for the message queue size used for the IPv6 thread (as 2^n)"
|
||||||
default 8
|
default 3
|
||||||
|
help
|
||||||
|
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.
|
||||||
|
|
||||||
endif # KCONFIG_MODULE_GNRC_IPV6
|
endif # KCONFIG_MODULE_GNRC_IPV6
|
||||||
|
|
||||||
|
|||||||
@ -173,12 +173,12 @@ static void _dispatch_next_header(gnrc_pktsnip_t *pkt, unsigned nh,
|
|||||||
|
|
||||||
static void *_event_loop(void *args)
|
static void *_event_loop(void *args)
|
||||||
{
|
{
|
||||||
msg_t msg, reply, msg_q[CONFIG_GNRC_IPV6_MSG_QUEUE_SIZE];
|
msg_t msg, reply, msg_q[GNRC_IPV6_MSG_QUEUE_SIZE];
|
||||||
gnrc_netreg_entry_t me_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
gnrc_netreg_entry_t me_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
sched_active_pid);
|
sched_active_pid);
|
||||||
|
|
||||||
(void)args;
|
(void)args;
|
||||||
msg_init_queue(msg_q, CONFIG_GNRC_IPV6_MSG_QUEUE_SIZE);
|
msg_init_queue(msg_q, GNRC_IPV6_MSG_QUEUE_SIZE);
|
||||||
|
|
||||||
/* initialize fragmentation data-structures */
|
/* initialize fragmentation data-structures */
|
||||||
#ifdef MODULE_GNRC_IPV6_EXT_FRAG
|
#ifdef MODULE_GNRC_IPV6_EXT_FRAG
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user