mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
6LowPAN: check tx result, if fail then do not send subsequent
fragments. Serves to save energy and also as collision avoidance.
This commit is contained in:
parent
436cbec844
commit
f9d5d71fde
@ -211,6 +211,11 @@ static uint8_t rime_payload_len;
|
||||
* is used this includes the UDP header in addition to the IP header).
|
||||
*/
|
||||
static uint8_t uncomp_hdr_len;
|
||||
|
||||
/**
|
||||
* the result of the last transmitted fragment
|
||||
*/
|
||||
static int last_tx_status;
|
||||
/** @} */
|
||||
|
||||
#if SICSLOWPAN_CONF_FRAG
|
||||
@ -1308,6 +1313,7 @@ packet_sent(void *ptr, int status, int transmissions)
|
||||
if(callback != NULL) {
|
||||
callback->output_callback(status);
|
||||
}
|
||||
last_tx_status = status;
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
/**
|
||||
@ -1465,6 +1471,14 @@ output(uip_lladdr_t *localdest)
|
||||
queuebuf_free(q);
|
||||
q = NULL;
|
||||
|
||||
/* Check tx result. */
|
||||
if((last_tx_status == MAC_TX_COLLISION) ||
|
||||
(last_tx_status == MAC_TX_ERR) ||
|
||||
(last_tx_status == MAC_TX_ERR_FATAL)) {
|
||||
PRINTFO("error in fragment tx, dropping subsequent fragments.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* set processed_ip_out_len to what we already sent from the IP payload*/
|
||||
processed_ip_out_len = rime_payload_len + uncomp_hdr_len;
|
||||
|
||||
@ -1503,8 +1517,15 @@ output(uip_lladdr_t *localdest)
|
||||
queuebuf_free(q);
|
||||
q = NULL;
|
||||
processed_ip_out_len += rime_payload_len;
|
||||
|
||||
/* Check tx result. */
|
||||
if((last_tx_status == MAC_TX_COLLISION) ||
|
||||
(last_tx_status == MAC_TX_ERR) ||
|
||||
(last_tx_status == MAC_TX_ERR_FATAL)) {
|
||||
PRINTFO("error in fragment tx, dropping subsequent fragments.\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#else /* SICSLOWPAN_CONF_FRAG */
|
||||
PRINTFO("sicslowpan output: Packet too large to be sent without fragmentation support; dropping packet\n");
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user