From e9a2f186bac1ba6952f87b9b8aeb8509af5429b4 Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Mon, 16 Aug 2021 11:02:05 +0200 Subject: [PATCH] gnrc_netif_pktq: send schedule msg directly if dequeue timer is zero --- sys/net/gnrc/netif/pktq/gnrc_netif_pktq.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/net/gnrc/netif/pktq/gnrc_netif_pktq.c b/sys/net/gnrc/netif/pktq/gnrc_netif_pktq.c index 11a9a3b23e..6a1a5a7aed 100644 --- a/sys/net/gnrc/netif/pktq/gnrc_netif_pktq.c +++ b/sys/net/gnrc/netif/pktq/gnrc_netif_pktq.c @@ -20,6 +20,9 @@ #include "net/gnrc/netif/internal.h" #include "net/gnrc/netif/pktq.h" +#define ENABLE_DEBUG 0 +#include "debug.h" + static gnrc_pktqueue_t _pool[CONFIG_GNRC_NETIF_PKTQ_POOL_SIZE]; static gnrc_pktqueue_t *_get_free_entry(void) @@ -61,7 +64,7 @@ int gnrc_netif_pktq_put(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) void gnrc_netif_pktq_sched_get(gnrc_netif_t *netif) { -#if CONFIG_GNRC_NETIF_PKTQ_TIMER_US >= 0 +#if CONFIG_GNRC_NETIF_PKTQ_TIMER_US > 0 assert(netif != NULL); netif->send_queue.dequeue_msg.type = GNRC_NETIF_PKTQ_DEQUEUE_MSG; /* Prevent timer from firing while we add this. @@ -75,7 +78,13 @@ void gnrc_netif_pktq_sched_get(gnrc_netif_t *netif) CONFIG_GNRC_NETIF_PKTQ_TIMER_US, &netif->send_queue.dequeue_msg, netif->pid); irq_restore(state); -#else /* CONFIG_GNRC_NETIF_PKTQ_TIMER_US >= 0 */ +#elif CONFIG_GNRC_NETIF_PKTQ_TIMER_US == 0 + assert(netif != NULL); + netif->send_queue.dequeue_msg.type = GNRC_NETIF_PKTQ_DEQUEUE_MSG; + if (msg_send(&netif->send_queue.dequeue_msg, netif->pid) < 0) { + DEBUG("gnrc_netif_pktq: couldn't schedule packet (msg queue is full)\n"); + } +#else (void)netif; #endif /* CONFIG_GNRC_NETIF_PKTQ_TIMER_US >= 0 */ }