diff --git a/drivers/cc110x/cc110x-netdev.c b/drivers/cc110x/cc110x-netdev.c index 99f3b58dacd1408304b6947aa0a86fc20b1b4e4d..241fcdfae5b01ec73a612b350916377544092a05 100644 --- a/drivers/cc110x/cc110x-netdev.c +++ b/drivers/cc110x/cc110x-netdev.c @@ -111,7 +111,7 @@ static int _get(netdev_t *dev, netopt_t opt, void *value, size_t value_len) return sizeof(uint8_t); case NETOPT_MAX_PACKET_SIZE: assert(value_len > 0); - *((uint16_t *)value) = CC110X_PACKET_LENGTH; + *((uint16_t *)value) = CC110X_PACKET_LENGTH - CC110X_L2_HDR_SIZE; return sizeof(uint16_t); case NETOPT_IPV6_IID: return _get_iid(dev, value, value_len); diff --git a/drivers/cc110x/cc110x-rxtx.c b/drivers/cc110x/cc110x-rxtx.c index a717e8e1bb3e61b4ed81ed96d0bd686d7fc81e07..04cc8df5c461ce351acb485e1e5c5ae74b9388ee 100644 --- a/drivers/cc110x/cc110x-rxtx.c +++ b/drivers/cc110x/cc110x-rxtx.c @@ -147,7 +147,7 @@ static void _rx_read_data(cc110x_t *dev, void(*callback)(void*), void*arg) LOG_DEBUG("cc110x: received packet from=%u to=%u payload len=%u\n", (unsigned)pkt_buf->packet.phy_src, (unsigned)pkt_buf->packet.address, - pkt_buf->packet.length - 3); + pkt_buf->packet.length - CC110X_L2_HDR_SIZE); /* let someone know that we've got a packet */ callback(arg); @@ -157,7 +157,8 @@ static void _rx_read_data(cc110x_t *dev, void(*callback)(void*), void*arg) DEBUG("%s:%s:%u crc-error\n", RIOT_FILE_RELATIVE, __func__, __LINE__); dev->cc110x_statistic.packets_in_crc_fail++; #if defined(MODULE_OD) && ENABLE_DEBUG - od_hex_dump(pkt_buf->packet.data, pkt_buf->packet.length - 3, + od_hex_dump(pkt_buf->packet.data, + pkt_buf->packet.length - CC110X_L2_HDR_SIZE, OD_WIDTH_DEFAULT); #endif _rx_abort(dev); @@ -273,7 +274,8 @@ void cc110x_isr_handler(cc110x_t *dev, void(*callback)(void*), void*arg) int cc110x_send(cc110x_t *dev, cc110x_pkt_t *packet) { DEBUG("cc110x: snd pkt to %u payload_length=%u\n", - (unsigned)packet->address, (unsigned)packet->length-3); + (unsigned)packet->address, + (unsigned)packet->length - CC110X_L2_HDR_SIZE); unsigned size; switch (dev->radio_state) { diff --git a/drivers/cc110x/include/cc110x-internal.h b/drivers/cc110x/include/cc110x-internal.h index 0875be83e1ff39abaeb4922c56100db0ffdd157b..1c5cc5ba6a00cd1c2bbb44f39ed80b16182ba90e 100644 --- a/drivers/cc110x/include/cc110x-internal.h +++ b/drivers/cc110x/include/cc110x-internal.h @@ -45,6 +45,7 @@ extern "C" { #define MAX_CHANNR (24) /**< Maximum channel number */ #define CC110X_PACKET_LENGTH (0xFF) /**< max packet length = 255b */ +#define CC110X_L2_HDR_SIZE (3) /**< Layer 2 header size */ #define CC110X_SYNC_WORD_TX_TIME (90000) /**< loop count (max. timeout ~15ms) to wait for sync word to be transmitted (GDO2 from low to diff --git a/sys/net/gnrc/netif/gnrc_netif_device_type.c b/sys/net/gnrc/netif/gnrc_netif_device_type.c index 11aea5b11defeb6957e8fbda304b2c5fe7749994..1ad0176d8c69277c68d1ff161bd066aa53e8ecb8 100644 --- a/sys/net/gnrc/netif/gnrc_netif_device_type.c +++ b/sys/net/gnrc/netif/gnrc_netif_device_type.c @@ -140,9 +140,10 @@ void gnrc_netif_ipv6_init_mtu(gnrc_netif_t *netif) switch (netif->device_type) { #if defined(MODULE_NETDEV_IEEE802154) || defined(MODULE_NRFMIN) || \ defined(MODULE_XBEE) || defined(MODULE_ESP_NOW) || \ - defined(MODULE_GNRC_SIXLOENC) + defined(MODULE_GNRC_SIXLOENC) || defined(MODULE_CC110X) case NETDEV_TYPE_IEEE802154: case NETDEV_TYPE_NRFMIN: + case NETDEV_TYPE_CC110X: #ifdef MODULE_GNRC_SIXLOWPAN_IPHC netif->flags |= GNRC_NETIF_FLAGS_6LO_HC; #endif