Skip to content

Commit

Permalink
gnrc_netif_pktq: send schedule msg directly if dequeue timer is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
jia200x committed Aug 16, 2021
1 parent c1d28d6 commit e9a2f18
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sys/net/gnrc/netif/pktq/gnrc_netif_pktq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand All @@ -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 */
}
Expand Down

0 comments on commit e9a2f18

Please sign in to comment.