Merge pull request #648 from cetic/pr-csma-fixes

High throughput fixes for csma and sixlowpan
This commit is contained in:
Nicolas Tsiftes 2014-10-21 12:17:03 +02:00
commit 6fb7dd238e
6 changed files with 91 additions and 41 deletions

View file

@ -1458,6 +1458,13 @@ output(const uip_lladdr_t *localdest)
* IPv6/HC1/HC06/HC_UDP dispatchs/headers.
* The following fragments contain only the fragn dispatch.
*/
int estimated_fragments = ((int)uip_len) / ((int)MAC_MAX_PAYLOAD - SICSLOWPAN_FRAGN_HDR_LEN) + 1;
int freebuf = queuebuf_numfree() - 1;
PRINTFO("uip_len: %d, fragments: %d, free bufs: %d\n", uip_len, estimated_fragments, freebuf);
if(freebuf < estimated_fragments) {
PRINTFO("Dropping packet, not enough free bufs\n");
return 0;
}
PRINTFO("Fragmentation sending packet len %d\n", uip_len);