From d68af249eca7ce293916867f4fd2cbd02bad6c19 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Wed, 3 Feb 2010 01:17:32 +0000 Subject: [PATCH] Added a MAC layer return value that informs the caller that a packet did not receive a MAC layer acknowledgement --- core/net/mac/cxmac.c | 8 ++++++-- core/net/mac/mac.h | 5 ++++- core/net/mac/xmac.c | 8 ++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/core/net/mac/cxmac.c b/core/net/mac/cxmac.c index 281614ddd..cf098dab6 100644 --- a/core/net/mac/cxmac.c +++ b/core/net/mac/cxmac.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: cxmac.c,v 1.7 2010/02/02 23:28:58 adamdunkels Exp $ + * $Id: cxmac.c,v 1.8 2010/02/03 01:17:32 adamdunkels Exp $ */ /** @@ -738,7 +738,11 @@ send_packet(void) LEDS_OFF(LEDS_BLUE); if(collisions == 0) { - return MAC_TX_OK; + if(!is_broadcast && !got_strobe_ack) { + return MAC_TX_NOACK; + } else { + return MAC_TX_OK; + } } else { someone_is_sending++; return MAC_TX_COLLISION; diff --git a/core/net/mac/mac.h b/core/net/mac/mac.h index 43527bd4f..d0d8409b3 100644 --- a/core/net/mac/mac.h +++ b/core/net/mac/mac.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: mac.h,v 1.9 2010/02/02 23:28:58 adamdunkels Exp $ + * $Id: mac.h,v 1.10 2010/02/03 01:17:32 adamdunkels Exp $ */ /** @@ -80,6 +80,9 @@ enum { collision. */ MAC_TX_COLLISION, + /**< The MAC layer did not get an acknowledgement for the packet. */ + MAC_TX_NOACK, + /**< The MAC layer transmission could not be performed because of an error. The upper layer may try again later. */ MAC_TX_ERR, diff --git a/core/net/mac/xmac.c b/core/net/mac/xmac.c index eb9374a62..a6b2eb4a1 100644 --- a/core/net/mac/xmac.c +++ b/core/net/mac/xmac.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: xmac.c,v 1.51 2010/02/02 23:28:58 adamdunkels Exp $ + * $Id: xmac.c,v 1.52 2010/02/03 01:17:32 adamdunkels Exp $ */ /** @@ -676,7 +676,11 @@ send_packet(void) LEDS_OFF(LEDS_BLUE); if(collisions == 0) { - return MAC_TX_OK; + if(!is_broadcast && !got_strobe_ack) { + return MAC_TX_NOACK; + } else { + return MAC_TX_OK; + } } else { someone_is_sending++; return MAC_TX_COLLISION;