diff --git a/os/net/mac/csma/csma.h b/os/net/mac/csma/csma.h index dd5688666..88396db0b 100644 --- a/os/net/mac/csma/csma.h +++ b/os/net/mac/csma/csma.h @@ -69,7 +69,7 @@ #ifdef CSMA_MAC_CONF_LEN #define CSMA_MAC_LEN CSMA_MAC_CONF_LEN #else -#define CSMA_MAC_LEN 127 +#define CSMA_MAC_LEN 127 - 2 #endif /* just a default - with LLSEC, etc */ diff --git a/os/net/mac/tsch/tsch-const.h b/os/net/mac/tsch/tsch-const.h index edc989378..f78b9883d 100644 --- a/os/net/mac/tsch/tsch-const.h +++ b/os/net/mac/tsch/tsch-const.h @@ -66,8 +66,8 @@ /* 1 channel, sequence length 1 */ #define TSCH_HOPPING_SEQUENCE_1_1 (uint8_t[]){ 20 } -/* Max TSCH packet lenght */ -#define TSCH_PACKET_MAX_LEN MIN(127, PACKETBUF_SIZE) +/* Max TSCH packet lenght - last bytes are CRC in default 802.15.4 packets */ +#define TSCH_PACKET_MAX_LEN MIN(127 - 2, PACKETBUF_SIZE) /* The jitter to remove in ticks. * This should be the sum of measurement errors on Tx and Rx nodes. diff --git a/os/net/mac/tsch/tsch.c b/os/net/mac/tsch/tsch.c index 719a09b9f..8c79c299c 100644 --- a/os/net/mac/tsch/tsch.c +++ b/os/net/mac/tsch/tsch.c @@ -62,9 +62,6 @@ #include "net/mac/tsch/sixtop/sixtop.h" #endif -/* Needed to estimate the MAC lenght */ -#define TSCH_MAC_MAX_LEN 127 - #if FRAME802154_VERSION < FRAME802154_IEEE802154_2015 #error TSCH: FRAME802154_VERSION must be at least FRAME802154_IEEE802154_2015 #endif @@ -1135,7 +1132,7 @@ static int max_payload(void) { /* Setup security... before. */ - return TSCH_MAC_MAX_LEN - NETSTACK_FRAMER.length(); + return TSCH_PACKET_MAX_LEN - NETSTACK_FRAMER.length(); } /*---------------------------------------------------------------------------*/ const struct mac_driver tschmac_driver = {