1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-16 21:11:54 +02:00

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.
This commit is contained in:
Werner Almesberger 2011-05-11 16:24:12 -03:00
parent 354789da8d
commit 2c7d06f6f2

View File

@ -259,6 +259,8 @@ static void rx_pck(void *buf, int size)
type = ctrl & PT_MASK; type = ctrl & PT_MASK;
seq = !!(ctrl & SEQ); seq = !!(ctrl & SEQ);
if (type == pt_first || type == pt_next)
send_ack(seq);
switch (state) { switch (state) {
case s_tx: case s_tx:
if (type != pt_ack) if (type != pt_ack)
@ -283,18 +285,14 @@ static void rx_pck(void *buf, int size)
} }
if (type != pt_next) if (type != pt_next)
return; return;
if (seq == peer_seq) { if (seq == peer_seq)
send_ack(seq); /* retransmission */ return; /* retransmission */
return;
}
goto recv_more; goto recv_more;
case s_idle: case s_idle:
if (type == pt_first) if (type == pt_first)
break; break;
if (type == pt_next) { if (type == pt_next)
send_ack(seq); /* get rid of it */
return; return;
}
return; return;
default: default:
abort(); abort();
@ -310,7 +308,6 @@ static void rx_pck(void *buf, int size)
recv_more: recv_more:
if (left < size-1) { if (left < size-1) {
send_ack(seq); /* get rid of it */
state = s_idle; state = s_idle;
return; return;
} }
@ -318,7 +315,6 @@ recv_more:
pos += size-1; pos += size-1;
left -= size-1; left -= size-1;
peer_seq = seq; peer_seq = seq;
send_ack(seq);
if (!left) { if (!left) {
debug_ip("<-", packet, pos-(void *) packet); debug_ip("<-", packet, pos-(void *) packet);