From 2c7d06f6f26f43eb81cb8de07a73cf01b35921ea Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 11 May 2011 16:24:12 -0300 Subject: [PATCH] tools/dirtpan/dirtpan.c (rx_pck): immediately ack all data packets We basically take care of the acking the 802.15.4 layer should do. --- tools/dirtpan/dirtpan.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tools/dirtpan/dirtpan.c b/tools/dirtpan/dirtpan.c index 9437efc..8809265 100644 --- a/tools/dirtpan/dirtpan.c +++ b/tools/dirtpan/dirtpan.c @@ -259,6 +259,8 @@ static void rx_pck(void *buf, int size) type = ctrl & PT_MASK; seq = !!(ctrl & SEQ); + if (type == pt_first || type == pt_next) + send_ack(seq); switch (state) { case s_tx: if (type != pt_ack) @@ -283,18 +285,14 @@ static void rx_pck(void *buf, int size) } if (type != pt_next) return; - if (seq == peer_seq) { - send_ack(seq); /* retransmission */ - return; - } + if (seq == peer_seq) + return; /* retransmission */ goto recv_more; case s_idle: if (type == pt_first) break; - if (type == pt_next) { - send_ack(seq); /* get rid of it */ + if (type == pt_next) return; - } return; default: abort(); @@ -310,7 +308,6 @@ static void rx_pck(void *buf, int size) recv_more: if (left < size-1) { - send_ack(seq); /* get rid of it */ state = s_idle; return; } @@ -318,7 +315,6 @@ recv_more: pos += size-1; left -= size-1; peer_seq = seq; - send_ack(seq); if (!left) { debug_ip("<-", packet, pos-(void *) packet);