From eb589684593f56d3643ff1f4761493d00e8f6491 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Mon, 13 Sep 2010 13:39:05 +0000 Subject: [PATCH] Added a timer to each phase structure that keeps track of for how long a particular receiver has not ACKed packets. After some time (currently 16 seconds), the sender will begin sending full strobe periods again. --- core/net/mac/phase.c | 11 ++++++++--- core/net/mac/phase.h | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/net/mac/phase.c b/core/net/mac/phase.c index e97e7eb02..0cedd8cd2 100644 --- a/core/net/mac/phase.c +++ b/core/net/mac/phase.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: phase.c,v 1.14 2010/06/15 19:22:25 adamdunkels Exp $ + * $Id: phase.c,v 1.15 2010/09/13 13:39:05 adamdunkels Exp $ */ /** @@ -57,7 +57,9 @@ struct phase_queueitem { #define PHASE_DEFER_THRESHOLD 1 #define PHASE_QUEUESIZE 8 -#define MAX_NOACKS 3 +#define MAX_NOACKS 16 + +#define MAX_NOACKS_TIME CLOCK_SECOND * 16 MEMB(queued_packets_memb, struct phase_queueitem, PHASE_QUEUESIZE); @@ -114,7 +116,10 @@ phase_update(const struct phase_list *list, if(mac_status == MAC_TX_NOACK) { PRINTF("phase noacks %d to %d.%d\n", e->noacks, neighbor->u8[0], neighbor->u8[1]); e->noacks++; - if(e->noacks >= MAX_NOACKS) { + if(e->noacks == 1) { + timer_set(&e->noacks_timer, MAX_NOACKS_TIME); + } + if(e->noacks >= MAX_NOACKS || timer_expired(&e->noacks_timer)) { list_remove(*list->list, e); memb_free(list->memb, e); return; diff --git a/core/net/mac/phase.h b/core/net/mac/phase.h index 26591cc58..ce11cebfc 100644 --- a/core/net/mac/phase.h +++ b/core/net/mac/phase.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: phase.h,v 1.4 2010/04/03 13:28:30 adamdunkels Exp $ + * $Id: phase.h,v 1.5 2010/09/13 13:39:05 adamdunkels Exp $ */ /** @@ -42,6 +42,7 @@ #define PHASE_H #include "net/rime/rimeaddr.h" +#include "sys/timer.h" #include "sys/rtimer.h" #include "lib/list.h" #include "lib/memb.h" @@ -52,6 +53,7 @@ struct phase { rimeaddr_t neighbor; rtimer_clock_t time; uint8_t noacks; + struct timer noacks_timer; }; struct phase_list {