From 1469268d32ffc945b975a9ef248222ed9902f954 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 5 Jul 2017 19:48:42 +0200 Subject: [PATCH] Rework naming and configuration of sicslowpan compression levels --- arch/platform/cc2538dk/contiki-conf.h | 4 ---- arch/platform/cooja/contiki-conf.h | 1 - arch/platform/jn516x/contiki-conf.h | 4 ---- arch/platform/native/contiki-conf.h | 1 - arch/platform/nrf52dk/contiki-conf.h | 2 -- arch/platform/openmote-cc2538/contiki-conf.h | 4 ---- arch/platform/sky/contiki-conf.h | 7 ------- arch/platform/srf06-cc26xx/contiki-conf.h | 4 +--- arch/platform/zoul/contiki-conf.h | 4 ---- core/contiki-default-conf.h | 10 +-------- core/net/ipv6/sicslowpan.c | 22 ++++++++++---------- core/net/ipv6/sicslowpan.h | 8 +++---- doc/tutorial-raven.txt | 2 +- 13 files changed, 18 insertions(+), 55 deletions(-) diff --git a/arch/platform/cc2538dk/contiki-conf.h b/arch/platform/cc2538dk/contiki-conf.h index 7b44c0a1b..0ee6425dd 100644 --- a/arch/platform/cc2538dk/contiki-conf.h +++ b/arch/platform/cc2538dk/contiki-conf.h @@ -401,10 +401,6 @@ typedef uint32_t rtimer_clock_t; #define UIP_CONF_MAX_LISTENPORTS 8 /* 6lowpan */ -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 -#ifndef SICSLOWPAN_CONF_COMPRESSION_THRESHOLD -#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 63 -#endif #ifndef SICSLOWPAN_CONF_FRAG #define SICSLOWPAN_CONF_FRAG 1 #endif diff --git a/arch/platform/cooja/contiki-conf.h b/arch/platform/cooja/contiki-conf.h index 510a99f5e..4a14609a9 100644 --- a/arch/platform/cooja/contiki-conf.h +++ b/arch/platform/cooja/contiki-conf.h @@ -120,7 +120,6 @@ #define UIP_CONF_IPV6_CHECKS 1 #define UIP_CONF_IPV6_REASSEMBLY 0 -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 #ifndef SICSLOWPAN_CONF_FRAG #define SICSLOWPAN_CONF_FRAG 1 #define SICSLOWPAN_CONF_MAXAGE 8 diff --git a/arch/platform/jn516x/contiki-conf.h b/arch/platform/jn516x/contiki-conf.h index ed2dd7e4b..515a5b11a 100644 --- a/arch/platform/jn516x/contiki-conf.h +++ b/arch/platform/jn516x/contiki-conf.h @@ -126,10 +126,6 @@ #define UIP_CONF_BUFFER_SIZE 1280 #endif -#define SICSLOWPAN_CONF_COMPRESSION_IPV6 0 -#define SICSLOWPAN_CONF_COMPRESSION_HC1 1 -#define SICSLOWPAN_CONF_COMPRESSION_HC01 2 -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 #ifndef SICSLOWPAN_CONF_FRAG #define SICSLOWPAN_CONF_FRAG 1 #define SICSLOWPAN_CONF_MAXAGE 8 diff --git a/arch/platform/native/contiki-conf.h b/arch/platform/native/contiki-conf.h index 39e399eda..9468fa2d5 100644 --- a/arch/platform/native/contiki-conf.h +++ b/arch/platform/native/contiki-conf.h @@ -91,7 +91,6 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_ROUTER 1 -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 #ifndef SICSLOWPAN_CONF_FRAG #define SICSLOWPAN_CONF_FRAG 1 #define SICSLOWPAN_CONF_MAXAGE 8 diff --git a/arch/platform/nrf52dk/contiki-conf.h b/arch/platform/nrf52dk/contiki-conf.h index 87af93746..53a70c2a0 100644 --- a/arch/platform/nrf52dk/contiki-conf.h +++ b/arch/platform/nrf52dk/contiki-conf.h @@ -65,8 +65,6 @@ /* 6LoWPAN */ #define SICSLOWPAN_CONF_MAC_MAX_PAYLOAD 1280 -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 -#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 0 /**< Always compress IPv6 packets. */ #define SICSLOWPAN_CONF_FRAG 0 /**< We don't use 6LoWPAN fragmentation as IPSP takes care of that for us.*/ #define SICSLOWPAN_FRAMER_HDRLEN 0 /**< Use fixed header len rather than framer.length() function */ diff --git a/arch/platform/openmote-cc2538/contiki-conf.h b/arch/platform/openmote-cc2538/contiki-conf.h index 0da7cb290..f088661ac 100644 --- a/arch/platform/openmote-cc2538/contiki-conf.h +++ b/arch/platform/openmote-cc2538/contiki-conf.h @@ -458,10 +458,6 @@ typedef uint32_t rtimer_clock_t; #define UIP_CONF_MAX_LISTENPORTS 8 /* 6lowpan */ -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 -#ifndef SICSLOWPAN_CONF_COMPRESSION_THRESHOLD -#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 63 -#endif #ifndef SICSLOWPAN_CONF_FRAG #define SICSLOWPAN_CONF_FRAG 1 #endif diff --git a/arch/platform/sky/contiki-conf.h b/arch/platform/sky/contiki-conf.h index 956db50bc..5fdcdfa29 100644 --- a/arch/platform/sky/contiki-conf.h +++ b/arch/platform/sky/contiki-conf.h @@ -25,12 +25,6 @@ /* Network setup for IPv6 */ #define NETSTACK_CONF_NETWORK sicslowpan_driver -/* Specify a minimum packet size for 6lowpan compression to be - enabled. This is needed for ContikiMAC, which needs packets to be - larger than a specified size, if no ContikiMAC header should be - used. */ -#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 63 - #ifndef QUEUEBUF_CONF_NUM #define QUEUEBUF_CONF_NUM 8 #endif @@ -92,7 +86,6 @@ #define UIP_CONF_BUFFER_SIZE 240 #endif -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 #ifndef SICSLOWPAN_CONF_FRAG #define SICSLOWPAN_CONF_FRAG 1 #define SICSLOWPAN_CONF_MAXAGE 8 diff --git a/arch/platform/srf06-cc26xx/contiki-conf.h b/arch/platform/srf06-cc26xx/contiki-conf.h index 962ffc14c..91dd12238 100644 --- a/arch/platform/srf06-cc26xx/contiki-conf.h +++ b/arch/platform/srf06-cc26xx/contiki-conf.h @@ -109,9 +109,7 @@ #define NETSTACK_RADIO_MAX_PAYLOAD_LEN 125 -/* 6LoWPAN */ -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 -#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 63 +/* 6LoWPAN */ #define SICSLOWPAN_CONF_FRAG 1 #define SICSLOWPAN_CONF_MAXAGE 8 /** @} */ diff --git a/arch/platform/zoul/contiki-conf.h b/arch/platform/zoul/contiki-conf.h index c04b07fb8..23f784504 100644 --- a/arch/platform/zoul/contiki-conf.h +++ b/arch/platform/zoul/contiki-conf.h @@ -489,10 +489,6 @@ typedef uint32_t rtimer_clock_t; #define UIP_CONF_MAX_LISTENPORTS 8 /* 6lowpan */ -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 -#ifndef SICSLOWPAN_CONF_COMPRESSION_THRESHOLD -#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 63 -#endif #ifndef SICSLOWPAN_CONF_FRAG #define SICSLOWPAN_CONF_FRAG 1 #endif diff --git a/core/contiki-default-conf.h b/core/contiki-default-conf.h index 9da23ff61..839a0d64d 100644 --- a/core/contiki-default-conf.h +++ b/core/contiki-default-conf.h @@ -218,18 +218,10 @@ #define SICSLOWPAN_CONF_MAC_MAX_PAYLOAD (127 - 2) #endif /* SICSLOWPAN_CONF_MAC_MAX_PAYLOAD */ -/* SICSLOWPAN_CONF_COMPRESSION_THRESHOLD sets a lower threshold for - when packets should not be compressed. This is used by ContikiMAC, - which requires packets to be larger than a given minimum size. */ -#ifndef SICSLOWPAN_CONF_COMPRESSION_THRESHOLD -#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 0 -/* #define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 63 */ -#endif /* SICSLOWPAN_CONF_COMPRESSION_THRESHOLD */ - /* SICSLOWPAN_CONF_COMPRESSION specifies what 6lowpan compression mechanism to be used. 6lowpan hc06 is the default in Contiki. */ #ifndef SICSLOWPAN_CONF_COMPRESSION -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 +#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_IPHC #endif /* SICSLOWPAN_CONF_COMPRESSION */ #endif /* CONTIKI_DEFAULT_CONF_H */ diff --git a/core/net/ipv6/sicslowpan.c b/core/net/ipv6/sicslowpan.c index a7db44615..2a48951dc 100644 --- a/core/net/ipv6/sicslowpan.c +++ b/core/net/ipv6/sicslowpan.c @@ -86,7 +86,7 @@ #ifdef SICSLOWPAN_CONF_COMPRESSION #define SICSLOWPAN_COMPRESSION SICSLOWPAN_CONF_COMPRESSION #else /* SICSLOWPAN_CONF_COMPRESSION */ -#define SICSLOWPAN_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 +#define SICSLOWPAN_COMPRESSION SICSLOWPAN_COMPRESSION_IPHC #endif /* SICSLOWPAN_CONF_COMPRESSION */ #define GET16(ptr,index) (((uint16_t)((ptr)[index] << 8)) | ((ptr)[(index) + 1])) @@ -502,7 +502,7 @@ set_packet_attrs(void) -#if SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_HC06 +#if SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_IPHC /** \name variables specific to HC06 and more recent versions * @{ */ @@ -1344,9 +1344,9 @@ uncompress_hdr_iphc(uint8_t *buf, uint16_t ip_len) } } /** @} */ -#endif /* SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_HC06 */ +#endif /* SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_IPHC */ -#if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_PAGE1 +#if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_6LORH /*--------------------------------------------------------------------*/ /** * \brief Adds Paging dispatch byte @@ -1367,7 +1367,7 @@ add_6lorh_hdr(void) { /* 6LoRH is not implemented yet */ } -#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_PAGE1 */ +#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_6LORH */ /*--------------------------------------------------------------------*/ /** @@ -1534,17 +1534,17 @@ output(const uip_lladdr_t *localdest) #if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_IPV6 compress_hdr_ipv6(&dest); #endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_IPV6 */ -#if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_PAGE1 +#if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_6LORH /* Add 6LoRH headers before IPHC. Only needed on routed traffic (non link-local). */ if(!uip_is_addr_linklocal(&UIP_IP_BUF->destipaddr)) { add_paging_dispatch(1); add_6lorh_hdr(); } -#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_PAGE1 */ -#if SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_HC06 +#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_6LORH */ +#if SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_IPHC compress_hdr_iphc(&dest); -#endif /* SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_HC06 */ +#endif /* SICSLOWPAN_COMPRESSION >= SICSLOWPAN_COMPRESSION_IPHC */ LOG_INFO("output: header of len %d\n", packetbuf_hdr_len); /* Calculate NETSTACK_FRAMER's header length, that will be added in the NETSTACK_MAC. @@ -1954,7 +1954,7 @@ sicslowpan_init(void) tcpip_set_outputfunc(output); -#if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_HC06 +#if SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_IPHC /* Preinitialize any address contexts for better header compression * (Saves up to 13 bytes per 6lowpan packet) * The platform contiki-conf.h file can override this using e.g. @@ -1996,7 +1996,7 @@ sicslowpan_init(void) } #endif /* SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS > 1 */ -#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_HC06 */ +#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_IPHC */ } /*--------------------------------------------------------------------*/ int diff --git a/core/net/ipv6/sicslowpan.h b/core/net/ipv6/sicslowpan.h index 4f4a89177..11b861bd5 100644 --- a/core/net/ipv6/sicslowpan.h +++ b/core/net/ipv6/sicslowpan.h @@ -69,10 +69,10 @@ * @{ */ #define SICSLOWPAN_COMPRESSION_IPV6 0 /* No compression */ -/* No longer supported: #define SICSLOWPAN_CONF_COMPRESSION_HC1 1*/ -#define SICSLOWPAN_COMPRESSION_HC06 2 /* RFC 6282 */ -#define SICSLOWPAN_COMPRESSION_PAGE1 3 /* RFC 8025 for paging dispatch, - * draft-ietf-6lo-routin-dispatch-05 for 6LoRH */ +#define SICSLOWPAN_COMPRESSION_IPHC 1 /* RFC 6282 */ +#define SICSLOWPAN_COMPRESSION_6LORH 2 /* RFC 8025 for paging dispatch, + * draft-ietf-6lo-routin-dispatch-05 for 6LoRH. 6LoRH is not + * implemented yet -- only support for paging dispatch. */ /** @} */ /** diff --git a/doc/tutorial-raven.txt b/doc/tutorial-raven.txt index 1cc4bfe9d..1755da4ac 100644 --- a/doc/tutorial-raven.txt +++ b/doc/tutorial-raven.txt @@ -471,7 +471,7 @@ and replace the line
\endcode with \code -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 +#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_IPHC \endcode Recompile and load Contiki for both the RAVEN ATmega1284P and RZ USB