mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
gnrc/sixlowpan: 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
05962fe3ef
commit
375cad38df
@ -43,10 +43,14 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default message queue size to use for the 6LoWPAN thread.
|
||||
* @brief Default message queue size to use for the 6LoWPAN 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_SIXLOWPAN_MSG_QUEUE_SIZE
|
||||
#define CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE (8U)
|
||||
#ifndef CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE_EXP
|
||||
#define CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE_EXP (3U)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -307,6 +311,13 @@ extern "C" {
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Message queue size to use for the 6LoWPAN thread.
|
||||
*/
|
||||
#ifndef GNRC_SIXLOWPAN_MSG_QUEUE_SIZE
|
||||
#define GNRC_SIXLOWPAN_MSG_QUEUE_SIZE (1 << CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE_EXP)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -16,8 +16,12 @@ if KCONFIG_MODULE_GNRC_SIXLOWPAN
|
||||
rsource "frag/Kconfig"
|
||||
rsource "nd/Kconfig"
|
||||
|
||||
config GNRC_SIXLOWPAN_MSG_QUEUE_SIZE
|
||||
int "Message queue size for the 6LoWPAN thread"
|
||||
default 8
|
||||
config GNRC_SIXLOWPAN_MSG_QUEUE_SIZE_EXP
|
||||
int "Exponent for the message queue size for the 6LoWPAN thread (as 2^n)"
|
||||
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_SIXLOWPAN
|
||||
|
@ -308,12 +308,12 @@ static void _send(gnrc_pktsnip_t *pkt)
|
||||
|
||||
static void *_event_loop(void *args)
|
||||
{
|
||||
msg_t msg, reply, msg_q[CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE];
|
||||
msg_t msg, reply, msg_q[GNRC_SIXLOWPAN_MSG_QUEUE_SIZE];
|
||||
gnrc_netreg_entry_t me_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||
sched_active_pid);
|
||||
|
||||
(void)args;
|
||||
msg_init_queue(msg_q, CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE);
|
||||
msg_init_queue(msg_q, GNRC_SIXLOWPAN_MSG_QUEUE_SIZE);
|
||||
|
||||
/* register interest in all 6LoWPAN packets */
|
||||
gnrc_netreg_register(GNRC_NETTYPE_SIXLOWPAN, &me_reg);
|
||||
|
Loading…
Reference in New Issue
Block a user