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
|
#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
|
#ifndef CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE_EXP
|
||||||
#define CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE (8U)
|
#define CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE_EXP (3U)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -307,6 +311,13 @@ extern "C" {
|
|||||||
#endif
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -16,8 +16,12 @@ if KCONFIG_MODULE_GNRC_SIXLOWPAN
|
|||||||
rsource "frag/Kconfig"
|
rsource "frag/Kconfig"
|
||||||
rsource "nd/Kconfig"
|
rsource "nd/Kconfig"
|
||||||
|
|
||||||
config GNRC_SIXLOWPAN_MSG_QUEUE_SIZE
|
config GNRC_SIXLOWPAN_MSG_QUEUE_SIZE_EXP
|
||||||
int "Message queue size for the 6LoWPAN thread"
|
int "Exponent for the message queue size for the 6LoWPAN 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_SIXLOWPAN
|
endif # KCONFIG_MODULE_GNRC_SIXLOWPAN
|
||||||
|
|||||||
@ -308,12 +308,12 @@ static void _send(gnrc_pktsnip_t *pkt)
|
|||||||
|
|
||||||
static void *_event_loop(void *args)
|
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,
|
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_SIXLOWPAN_MSG_QUEUE_SIZE);
|
msg_init_queue(msg_q, GNRC_SIXLOWPAN_MSG_QUEUE_SIZE);
|
||||||
|
|
||||||
/* register interest in all 6LoWPAN packets */
|
/* register interest in all 6LoWPAN packets */
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_SIXLOWPAN, &me_reg);
|
gnrc_netreg_register(GNRC_NETTYPE_SIXLOWPAN, &me_reg);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user