From aa1191d8f0866e993c0e78a4b47fc573b1bd6d31 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 17 May 2017 15:09:19 +0200 Subject: [PATCH] Remove RDC layer --- apps/shell/shell-sky.c | 2 +- core/contiki-default-conf.h | 7 --- core/net/ipv6/sicslowpan.c | 2 +- core/net/mac/csma.c | 12 +++-- core/net/mac/mac.h | 2 +- core/net/mac/nullmac.c | 2 +- core/net/mac/nullrdc.c | 48 ++----------------- core/net/mac/nullrdc.h | 23 ++++++++- core/net/mac/tsch/tsch-queue.c | 1 - core/net/mac/tsch/tsch.c | 8 +--- core/net/netstack.c | 1 - core/net/netstack.h | 10 ---- drivers/cpu/arm/aducrf101/dev/radio.c | 2 +- drivers/cpu/cc2538/dev/cc2538-rf.c | 2 +- drivers/cpu/cc26xx-cc13xx/rf-core/rf-core.c | 2 +- drivers/cpu/native/net/linuxradio-drv.c | 2 +- drivers/cpu/nrf52832/ble/ble-mac.c | 2 +- drivers/dev/cc1200/cc1200.c | 2 +- drivers/dev/cc2420/cc2420.c | 2 +- drivers/dev/cc2520/cc2520.c | 2 +- drivers/platform/cc2538dk/contiki-main.c | 2 - .../cooja-ip64/contiki-cooja-ip64-main.c | 4 +- drivers/platform/cooja/contiki-cooja-main.c | 4 +- drivers/platform/cooja/dev/cooja-radio.c | 2 +- drivers/platform/jn516x/contiki-jn516x-main.c | 2 +- drivers/platform/jn516x/dev/micromac-radio.c | 2 +- drivers/platform/native/contiki-main.c | 2 +- .../platform/openmote-cc2538/contiki-main.c | 2 - drivers/platform/sky/contiki-sky-main.c | 11 ++--- drivers/platform/srf06-cc26xx/contiki-main.c | 3 -- .../platform/wismote/contiki-wismote-main.c | 12 ++--- drivers/platform/z1/contiki-z1-main.c | 10 ++-- drivers/platform/zoul/contiki-main.c | 2 - examples/ipso-objects/example-server.c | 4 -- examples/ipv6/multicast/root.c | 2 - .../native-border-router/border-router-mac.c | 18 ++----- .../ipv6/native-border-router/border-router.c | 4 -- .../ipv6/native-border-router/project-conf.h | 4 +- examples/ipv6/native-border-router/slip-dev.c | 2 +- .../ipv6/rpl-border-router/border-router.c | 14 +----- examples/ipv6/rpl-tsch/project-conf.h | 2 - examples/ipv6/rpl-udp/udp-server.c | 4 -- examples/ipv6/slip-radio/slip-radio.c | 1 - .../very-sleepy-demo/very-sleepy-demo.c | 2 +- .../jn516x/rpl/common-conf.h | 2 - .../jn516x/rpl/tools/rpl-tools.c | 1 - .../jn516x/tsch/common-conf.h | 4 -- .../jn516x/tsch/tools/rpl-tools.c | 1 - .../zoul/orion/ip64-router/ip64-router.c | 5 +- .../zolertia/zoul/zoul-demo.c | 3 -- examples/sensniff/netstack.c | 2 +- examples/sensniff/project-conf.h | 4 +- examples/sensniff/sensniff-mac.c | 22 ++------- .../code-flush-nbr-queue/project-conf.h | 3 -- .../13-ieee802154/code/project-tsch-conf.h | 2 - 55 files changed, 83 insertions(+), 215 deletions(-) diff --git a/apps/shell/shell-sky.c b/apps/shell/shell-sky.c index 23d03d9f3..0b2ede036 100644 --- a/apps/shell/shell-sky.c +++ b/apps/shell/shell-sky.c @@ -94,7 +94,7 @@ do_rssi(void) static int sample; int channel; - NETSTACK_MAC.off(0); + NETSTACK_MAC.off(); cc2420_on(); for(channel = 11; channel <= 26; ++channel) { diff --git a/core/contiki-default-conf.h b/core/contiki-default-conf.h index 10afd95f8..1d1f43b41 100644 --- a/core/contiki-default-conf.h +++ b/core/contiki-default-conf.h @@ -54,13 +54,6 @@ /* #define NETSTACK_CONF_FRAMER framer_802154 */ #endif /* NETSTACK_CONF_FRAMER */ -/* NETSTACK_CONF_RDC specifies the Radio Duty Cycling (RDC) layer. The - nullrdc_driver never turns the radio off and is compatible with all - radios, but consumes a lot of power. */ -#ifndef NETSTACK_CONF_RDC -#define NETSTACK_CONF_RDC nullrdc_driver -#endif /* NETSTACK_CONF_RDC */ - /* NETSTACK_CONF_MAC specifies the Medium Access Control (MAC) layer. The nullmac_driver does not provide any MAC functionality. The csma_driver is the default CSMA MAC layer, but diff --git a/core/net/ipv6/sicslowpan.c b/core/net/ipv6/sicslowpan.c index f532892a5..9dcf185c6 100644 --- a/core/net/ipv6/sicslowpan.c +++ b/core/net/ipv6/sicslowpan.c @@ -1321,7 +1321,7 @@ output(const uip_lladdr_t *localdest) } PRINTFO("sicslowpan output: header of len %d\n", packetbuf_hdr_len); - /* Calculate NETSTACK_FRAMER's header length, that will be added in the NETSTACK_RDC. + /* Calculate NETSTACK_FRAMER's header length, that will be added in the NETSTACK_MAC. * We calculate it here only to make a better decision of whether the outgoing packet * needs to be fragmented or not. */ #ifndef SICSLOWPAN_USE_FIXED_HDRLEN diff --git a/core/net/mac/csma.c b/core/net/mac/csma.c index df5bed51c..57e33081d 100644 --- a/core/net/mac/csma.c +++ b/core/net/mac/csma.c @@ -38,6 +38,7 @@ */ #include "net/mac/csma.h" +#include "net/mac/nullrdc.h" #include "net/packetbuf.h" #include "net/queuebuf.h" @@ -164,7 +165,7 @@ transmit_packet_list(void *ptr) PRINTF("csma: preparing number %d %p, queue len %d\n", n->transmissions, q, list_length(n->queued_packet_list)); /* Send packets in the neighbor's list */ - NETSTACK_RDC.send_list(packet_sent, n, q); + nullrdc_send_list(packet_sent, n, q); } } } @@ -441,19 +442,19 @@ send_packet(mac_callback_t sent, void *ptr) static void input_packet(void) { - NETSTACK_NETWORK.input(); + nullrdc_packet_input(); } /*---------------------------------------------------------------------------*/ static int on(void) { - return NETSTACK_RDC.on(); + return NETSTACK_RADIO.on(); } /*---------------------------------------------------------------------------*/ static int -off(int keep_radio_on) +off(void) { - return NETSTACK_RDC.off(keep_radio_on); + return NETSTACK_RADIO.off(); } /*---------------------------------------------------------------------------*/ static void @@ -462,6 +463,7 @@ init(void) memb_init(&packet_memb); memb_init(&metadata_memb); memb_init(&neighbor_memb); + on(); } /*---------------------------------------------------------------------------*/ const struct mac_driver csma_driver = { diff --git a/core/net/mac/mac.h b/core/net/mac/mac.h index a405b5ee1..61c0fa0f2 100644 --- a/core/net/mac/mac.h +++ b/core/net/mac/mac.h @@ -67,7 +67,7 @@ struct mac_driver { int (* on)(void); /** Turn the MAC layer off. */ - int (* off)(int keep_radio_on); + int (* off)(void); }; /* Generic MAC return values. */ diff --git a/core/net/mac/nullmac.c b/core/net/mac/nullmac.c index bf0b5cb16..9af54b2d8 100644 --- a/core/net/mac/nullmac.c +++ b/core/net/mac/nullmac.c @@ -62,7 +62,7 @@ on(void) } /*---------------------------------------------------------------------------*/ static int -off(int keep_radio_on) +off(void) { return 0; } diff --git a/core/net/mac/nullrdc.c b/core/net/mac/nullrdc.c index d17067d99..1b412d3bf 100644 --- a/core/net/mac/nullrdc.c +++ b/core/net/mac/nullrdc.c @@ -233,14 +233,8 @@ send_one_packet(mac_callback_t sent, void *ptr) return last_sent_ok; } /*---------------------------------------------------------------------------*/ -static void -send_packet(mac_callback_t sent, void *ptr) -{ - send_one_packet(sent, ptr); -} -/*---------------------------------------------------------------------------*/ -static void -send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list) +void +nullrdc_send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list) { while(buf_list != NULL) { /* We backup the next pointer, as it may be nullified by @@ -261,8 +255,8 @@ send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list) } } /*---------------------------------------------------------------------------*/ -static void -packet_input(void) +void +nullrdc_packet_input(void) { #if NULLRDC_SEND_802154_ACK int original_datalen; @@ -321,40 +315,8 @@ packet_input(void) } #endif /* NULLRDC_SEND_ACK */ if(!duplicate) { - NETSTACK_MAC.input(); + NETSTACK_NETWORK.input(); } } } /*---------------------------------------------------------------------------*/ -static int -on(void) -{ - return NETSTACK_RADIO.on(); -} -/*---------------------------------------------------------------------------*/ -static int -off(int keep_radio_on) -{ - if(keep_radio_on) { - return NETSTACK_RADIO.on(); - } else { - return NETSTACK_RADIO.off(); - } -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ - on(); -} -/*---------------------------------------------------------------------------*/ -const struct rdc_driver nullrdc_driver = { - "nullrdc", - init, - send_packet, - send_list, - packet_input, - on, - off -}; -/*---------------------------------------------------------------------------*/ diff --git a/core/net/mac/nullrdc.h b/core/net/mac/nullrdc.h index 48ac1c0f0..2cfbadd48 100644 --- a/core/net/mac/nullrdc.h +++ b/core/net/mac/nullrdc.h @@ -41,8 +41,27 @@ #ifndef NULLRDC_H_ #define NULLRDC_H_ -#include "net/mac/rdc.h" +#include "contiki-conf.h" +#include "net/mac/mac.h" -extern const struct rdc_driver nullrdc_driver; +#ifdef RDC_CONF_WITH_DUPLICATE_DETECTION +#define RDC_WITH_DUPLICATE_DETECTION RDC_CONF_WITH_DUPLICATE_DETECTION +#else /* RDC_CONF_WITH_DUPLICATE_DETECTION */ +/* As frames can be spoofed, the RDC layer should not discard a + frame because it has seen its sequence number already. Replay + protection should be implemented at the LLSEC layer where the + authenticity of frames is verified. */ +#define RDC_WITH_DUPLICATE_DETECTION !LLSEC802154_ENABLED +#endif /* RDC_CONF_WITH_DUPLICATE_DETECTION */ + +/* List of packets to be sent by RDC layer */ +struct rdc_buf_list { + struct rdc_buf_list *next; + struct queuebuf *buf; + void *ptr; +}; + +void nullrdc_send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list); +void nullrdc_packet_input(void); #endif /* NULLRDC_H_ */ diff --git a/core/net/mac/tsch/tsch-queue.c b/core/net/mac/tsch/tsch-queue.c index 41f319b1c..5a4eeae0c 100644 --- a/core/net/mac/tsch/tsch-queue.c +++ b/core/net/mac/tsch/tsch-queue.c @@ -47,7 +47,6 @@ #include "lib/memb.h" #include "lib/random.h" #include "net/queuebuf.h" -#include "net/mac/rdc.h" #include "net/mac/tsch/tsch.h" #include "net/mac/tsch/tsch-private.h" #include "net/mac/tsch/tsch-queue.h" diff --git a/core/net/mac/tsch/tsch.c b/core/net/mac/tsch/tsch.c index 2863b2a54..6628ff75f 100644 --- a/core/net/mac/tsch/tsch.c +++ b/core/net/mac/tsch/tsch.c @@ -1001,13 +1001,9 @@ turn_on(void) } /*---------------------------------------------------------------------------*/ static int -turn_off(int keep_radio_on) +turn_off(void) { - if(keep_radio_on) { - NETSTACK_RADIO.on(); - } else { - NETSTACK_RADIO.off(); - } + NETSTACK_RADIO.off(); return 1; } /*---------------------------------------------------------------------------*/ diff --git a/core/net/netstack.c b/core/net/netstack.c index 35e7f2c48..1efd85570 100644 --- a/core/net/netstack.c +++ b/core/net/netstack.c @@ -43,7 +43,6 @@ void netstack_init(void) { NETSTACK_RADIO.init(); - NETSTACK_RDC.init(); NETSTACK_MAC.init(); NETSTACK_NETWORK.init(); } diff --git a/core/net/netstack.h b/core/net/netstack.h index 79fcfd5a9..a65fccd4a 100644 --- a/core/net/netstack.h +++ b/core/net/netstack.h @@ -59,14 +59,6 @@ #endif /* NETSTACK_CONF_MAC */ #endif /* NETSTACK_MAC */ -#ifndef NETSTACK_RDC -#ifdef NETSTACK_CONF_RDC -#define NETSTACK_RDC NETSTACK_CONF_RDC -#else /* NETSTACK_CONF_RDC */ -#define NETSTACK_RDC nullrdc_driver -#endif /* NETSTACK_CONF_RDC */ -#endif /* NETSTACK_RDC */ - #ifndef NETSTACK_RADIO #ifdef NETSTACK_CONF_RADIO #define NETSTACK_RADIO NETSTACK_CONF_RADIO @@ -84,7 +76,6 @@ #endif /* NETSTACK_FRAMER */ #include "net/mac/mac.h" -#include "net/mac/rdc.h" #include "net/mac/framer/framer.h" #include "dev/radio.h" @@ -102,7 +93,6 @@ struct network_driver { }; extern const struct network_driver NETSTACK_NETWORK; -extern const struct rdc_driver NETSTACK_RDC; extern const struct mac_driver NETSTACK_MAC; extern const struct radio_driver NETSTACK_RADIO; extern const struct framer NETSTACK_FRAMER; diff --git a/drivers/cpu/arm/aducrf101/dev/radio.c b/drivers/cpu/arm/aducrf101/dev/radio.c index 49cc5c124..608e57614 100644 --- a/drivers/cpu/arm/aducrf101/dev/radio.c +++ b/drivers/cpu/arm/aducrf101/dev/radio.c @@ -363,7 +363,7 @@ PROCESS_THREAD(aducrf101_rf_process, ev, data) if(len > 0) { packetbuf_set_datalen(len); - NETSTACK_RDC.input(); + NETSTACK_MAC.input(); } } diff --git a/drivers/cpu/cc2538/dev/cc2538-rf.c b/drivers/cpu/cc2538/dev/cc2538-rf.c index f3a2efc13..de6cdbbf8 100644 --- a/drivers/cpu/cc2538/dev/cc2538-rf.c +++ b/drivers/cpu/cc2538/dev/cc2538-rf.c @@ -1032,7 +1032,7 @@ PROCESS_THREAD(cc2538_rf_process, ev, data) if(len > 0) { packetbuf_set_datalen(len); - NETSTACK_RDC.input(); + NETSTACK_MAC.input(); } } diff --git a/drivers/cpu/cc26xx-cc13xx/rf-core/rf-core.c b/drivers/cpu/cc26xx-cc13xx/rf-core/rf-core.c index 506a4dc58..eefab9e7d 100644 --- a/drivers/cpu/cc26xx-cc13xx/rf-core/rf-core.c +++ b/drivers/cpu/cc26xx-cc13xx/rf-core/rf-core.c @@ -552,7 +552,7 @@ PROCESS_THREAD(rf_core_process, ev, data) if(len > 0) { packetbuf_set_datalen(len); - NETSTACK_RDC.input(); + NETSTACK_MAC.input(); } } while(len > 0); } diff --git a/drivers/cpu/native/net/linuxradio-drv.c b/drivers/cpu/native/net/linuxradio-drv.c index a2be32940..a6a4e50ca 100644 --- a/drivers/cpu/native/net/linuxradio-drv.c +++ b/drivers/cpu/native/net/linuxradio-drv.c @@ -149,7 +149,7 @@ handle_fd(fd_set *rset, fd_set *wset) buflen = bytes; memcpy(packetbuf_dataptr(), sockbuf, bytes); packetbuf_set_datalen(bytes); - NETSTACK_RDC.input(); + NETSTACK_MAC.input(); } } diff --git a/drivers/cpu/nrf52832/ble/ble-mac.c b/drivers/cpu/nrf52832/ble/ble-mac.c index 9ef90e8b3..17bccdcc6 100644 --- a/drivers/cpu/nrf52832/ble/ble-mac.c +++ b/drivers/cpu/nrf52832/ble/ble-mac.c @@ -342,7 +342,7 @@ on(void) } /*---------------------------------------------------------------------------*/ static int -off(int keep_radio_on) +off(void) { return 1; } diff --git a/drivers/dev/cc1200/cc1200.c b/drivers/dev/cc1200/cc1200.c index 760eacccd..365735e2c 100644 --- a/drivers/dev/cc1200/cc1200.c +++ b/drivers/dev/cc1200/cc1200.c @@ -638,7 +638,7 @@ pollhandler(void) if(len > 0) { packetbuf_set_datalen(len); - NETSTACK_RDC.input(); + NETSTACK_MAC.input(); } } diff --git a/drivers/dev/cc2420/cc2420.c b/drivers/dev/cc2420/cc2420.c index 07e5a3f8d..7380a0bcf 100644 --- a/drivers/dev/cc2420/cc2420.c +++ b/drivers/dev/cc2420/cc2420.c @@ -912,7 +912,7 @@ PROCESS_THREAD(cc2420_process, ev, data) packetbuf_set_datalen(len); - NETSTACK_RDC.input(); + NETSTACK_MAC.input(); } PROCESS_END(); diff --git a/drivers/dev/cc2520/cc2520.c b/drivers/dev/cc2520/cc2520.c index 72f2a2af8..a9b8db3fc 100644 --- a/drivers/dev/cc2520/cc2520.c +++ b/drivers/dev/cc2520/cc2520.c @@ -660,7 +660,7 @@ PROCESS_THREAD(cc2520_process, ev, data) len = cc2520_read(packetbuf_dataptr(), PACKETBUF_SIZE); packetbuf_set_datalen(len); - NETSTACK_RDC.input(); + NETSTACK_MAC.input(); /* flushrx(); */ } diff --git a/drivers/platform/cc2538dk/contiki-main.c b/drivers/platform/cc2538dk/contiki-main.c index 119c2b336..e7f623f56 100644 --- a/drivers/platform/cc2538dk/contiki-main.c +++ b/drivers/platform/cc2538dk/contiki-main.c @@ -193,8 +193,6 @@ main(void) PRINTF("%s\n", NETSTACK_NETWORK.name); PRINTF(" MAC: "); PRINTF("%s\n", NETSTACK_MAC.name); - PRINTF(" RDC: "); - PRINTF("%s\n", NETSTACK_RDC.name); /* Initialise the H/W RNG engine. */ random_init(0); diff --git a/drivers/platform/cooja-ip64/contiki-cooja-ip64-main.c b/drivers/platform/cooja-ip64/contiki-cooja-ip64-main.c index 797642211..fa77851b6 100644 --- a/drivers/platform/cooja-ip64/contiki-cooja-ip64-main.c +++ b/drivers/platform/cooja-ip64/contiki-cooja-ip64-main.c @@ -189,8 +189,8 @@ contiki_init(void) /* Initialize communication stack */ netstack_init(); - printf("%s/%s/%s\n", - NETSTACK_NETWORK.name, NETSTACK_MAC.name, NETSTACK_RDC.name); + printf("%s/%s\n", + NETSTACK_NETWORK.name, NETSTACK_MAC.name); /* IPv6 CONFIGURATION */ diff --git a/drivers/platform/cooja/contiki-cooja-main.c b/drivers/platform/cooja/contiki-cooja-main.c index 0117f6840..d74bbccb3 100644 --- a/drivers/platform/cooja/contiki-cooja-main.c +++ b/drivers/platform/cooja/contiki-cooja-main.c @@ -240,8 +240,8 @@ contiki_init() /* Initialize communication stack */ netstack_init(); - printf("%s/%s/%s\n", - NETSTACK_NETWORK.name, NETSTACK_MAC.name, NETSTACK_RDC.name); + printf("%s/%s\n", + NETSTACK_NETWORK.name, NETSTACK_MAC.name); #if NETSTACK_CONF_WITH_IPV4 /* IPv4 CONFIGURATION */ diff --git a/drivers/platform/cooja/dev/cooja-radio.c b/drivers/platform/cooja/dev/cooja-radio.c index a007170cc..5f56b06b4 100644 --- a/drivers/platform/cooja/dev/cooja-radio.c +++ b/drivers/platform/cooja/dev/cooja-radio.c @@ -289,7 +289,7 @@ PROCESS_THREAD(cooja_radio_process, ev, data) len = radio_read(packetbuf_dataptr(), PACKETBUF_SIZE); if(len > 0) { packetbuf_set_datalen(len); - NETSTACK_RDC.input(); + NETSTACK_MAC.input(); } } diff --git a/drivers/platform/jn516x/contiki-jn516x-main.c b/drivers/platform/jn516x/contiki-jn516x-main.c index 3aaf12452..d61eac750 100644 --- a/drivers/platform/jn516x/contiki-jn516x-main.c +++ b/drivers/platform/jn516x/contiki-jn516x-main.c @@ -366,7 +366,7 @@ main(void) queuebuf_init(); #endif /* NETSTACK_CONF_WITH_IPV6 */ - PRINTF("%s %s\n",NETSTACK_MAC.name, NETSTACK_RDC.name); + PRINTF("%s\n",NETSTACK_MAC.name); #ifndef UIP_FALLBACK_INTERFACE uart0_set_input(serial_line_input_byte); diff --git a/drivers/platform/jn516x/dev/micromac-radio.c b/drivers/platform/jn516x/dev/micromac-radio.c index ed5c5881e..6678ed4ec 100644 --- a/drivers/platform/jn516x/dev/micromac-radio.c +++ b/drivers/platform/jn516x/dev/micromac-radio.c @@ -884,7 +884,7 @@ PROCESS_THREAD(micromac_radio_process, ev, data) /* is packet valid? */ if(len > 0) { packetbuf_set_datalen(len); - NETSTACK_RDC.input(); + NETSTACK_MAC.input(); } /* Remove packet from ringbuf */ ringbufindex_get(&input_ringbuf); diff --git a/drivers/platform/native/contiki-main.c b/drivers/platform/native/contiki-main.c index 9ec3390a0..1911584df 100644 --- a/drivers/platform/native/contiki-main.c +++ b/drivers/platform/native/contiki-main.c @@ -205,7 +205,7 @@ main(int argc, char **argv) set_rime_addr(); netstack_init(); - printf("MAC %s RDC %s NETWORK %s\n", NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name); + printf("MAC %s NETWORK %s\n", NETSTACK_MAC.name, NETSTACK_NETWORK.name); #if NETSTACK_CONF_WITH_IPV6 queuebuf_init(); diff --git a/drivers/platform/openmote-cc2538/contiki-main.c b/drivers/platform/openmote-cc2538/contiki-main.c index 28c6248f7..8dbdff8b9 100644 --- a/drivers/platform/openmote-cc2538/contiki-main.c +++ b/drivers/platform/openmote-cc2538/contiki-main.c @@ -206,8 +206,6 @@ main(void) PRINTF("%s\n", NETSTACK_NETWORK.name); PRINTF("MAC: "); PRINTF("%s\n", NETSTACK_MAC.name); - PRINTF("RDC: "); - PRINTF("%s\n", NETSTACK_RDC.name); #if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr)); diff --git a/drivers/platform/sky/contiki-sky-main.c b/drivers/platform/sky/contiki-sky-main.c index 890a2c13d..b01cba96f 100644 --- a/drivers/platform/sky/contiki-sky-main.c +++ b/drivers/platform/sky/contiki-sky-main.c @@ -298,12 +298,11 @@ main(int argc, char **argv) /* Setup X-MAC for 802.15.4 */ queuebuf_init(); - NETSTACK_RDC.init(); NETSTACK_MAC.init(); NETSTACK_NETWORK.init(); - PRINTF("%s %s, radio channel %u, CCA threshold %i\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, + PRINTF("%s, radio channel %u, CCA threshold %i\n", + NETSTACK_MAC.name, CC2420_CONF_CHANNEL, CC2420_CONF_CCA_THRESH); @@ -339,13 +338,11 @@ main(int argc, char **argv) } #else /* NETSTACK_CONF_WITH_IPV6 */ - NETSTACK_RDC.init(); NETSTACK_MAC.init(); NETSTACK_NETWORK.init(); - PRINTF("%s %s, radio channel %u\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, - CC2420_CONF_CHANNEL); + PRINTF("%s, radio channel %u\n", + NETSTACK_MAC.name CC2420_CONF_CHANNEL); #endif /* NETSTACK_CONF_WITH_IPV6 */ #if !NETSTACK_CONF_WITH_IPV4 && !NETSTACK_CONF_WITH_IPV6 diff --git a/drivers/platform/srf06-cc26xx/contiki-main.c b/drivers/platform/srf06-cc26xx/contiki-main.c index ee972db74..f399d1b9f 100644 --- a/drivers/platform/srf06-cc26xx/contiki-main.c +++ b/drivers/platform/srf06-cc26xx/contiki-main.c @@ -211,9 +211,6 @@ main(void) printf("%s\n", NETSTACK_NETWORK.name); printf(" MAC: "); printf("%s\n", NETSTACK_MAC.name); - printf(" RDC: "); - printf("%s", NETSTACK_RDC.name); - printf("\n"); netstack_init(); diff --git a/drivers/platform/wismote/contiki-wismote-main.c b/drivers/platform/wismote/contiki-wismote-main.c index 254b23630..1da0e471f 100644 --- a/drivers/platform/wismote/contiki-wismote-main.c +++ b/drivers/platform/wismote/contiki-wismote-main.c @@ -296,13 +296,11 @@ main(int argc, char **argv) /* Setup X-MAC for 802.15.4 */ queuebuf_init(); - NETSTACK_RDC.init(); NETSTACK_MAC.init(); NETSTACK_NETWORK.init(); - printf("%s %s, radio channel %u\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, - RF_CHANNEL); + printf("%s, radio channel %u\n", + NETSTACK_MAC.name RF_CHANNEL); process_start(&tcpip_process, NULL); @@ -335,13 +333,11 @@ main(int argc, char **argv) #else /* NETSTACK_CONF_WITH_IPV6 */ - NETSTACK_RDC.init(); NETSTACK_MAC.init(); NETSTACK_NETWORK.init(); - printf("%s %s, radio channel %u\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, - RF_CHANNEL); + printf("%s, radio channel %u\n", + NETSTACK_MAC.name, RF_CHANNEL); #endif /* NETSTACK_CONF_WITH_IPV6 */ #if !NETSTACK_CONF_WITH_IPV4 && !NETSTACK_CONF_WITH_IPV6 diff --git a/drivers/platform/z1/contiki-z1-main.c b/drivers/platform/z1/contiki-z1-main.c index adbc99fad..b7367913c 100644 --- a/drivers/platform/z1/contiki-z1-main.c +++ b/drivers/platform/z1/contiki-z1-main.c @@ -315,13 +315,11 @@ main(int argc, char **argv) /* Setup X-MAC for 802.15.4 */ queuebuf_init(); - NETSTACK_RDC.init(); NETSTACK_MAC.init(); NETSTACK_NETWORK.init(); - printf("%s %s, radio channel %u\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, - CC2420_CONF_CHANNEL); + printf("%s, radio channel %u\n", + NETSTACK_MAC.name, CC2420_CONF_CHANNEL); process_start(&tcpip_process, NULL); @@ -354,13 +352,11 @@ main(int argc, char **argv) #else /* NETSTACK_CONF_WITH_IPV6 */ - NETSTACK_RDC.init(); NETSTACK_MAC.init NETSTACK_NETWORK.init(); printf("%s %s, radio channel %u\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, - CC2420_CONF_CHANNEL); + NETSTACK_MAC.name, CC2420_CONF_CHANNEL); #endif /* NETSTACK_CONF_WITH_IPV6 */ #if !NETSTACK_CONF_WITH_IPV4 && !NETSTACK_CONF_WITH_IPV6 diff --git a/drivers/platform/zoul/contiki-main.c b/drivers/platform/zoul/contiki-main.c index 75cc13d66..2df3270eb 100644 --- a/drivers/platform/zoul/contiki-main.c +++ b/drivers/platform/zoul/contiki-main.c @@ -271,8 +271,6 @@ main(void) PRINTF("%s\n", NETSTACK_NETWORK.name); PRINTF(" MAC: "); PRINTF("%s\n", NETSTACK_MAC.name); - PRINTF(" RDC: "); - PRINTF("%s\n", NETSTACK_RDC.name); #if NETSTACK_CONF_WITH_IPV6 memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr)); diff --git a/examples/ipso-objects/example-server.c b/examples/ipso-objects/example-server.c index 605e3295a..f70d30648 100644 --- a/examples/ipso-objects/example-server.c +++ b/examples/ipso-objects/example-server.c @@ -289,10 +289,6 @@ PROCESS_THREAD(router_process, ev, data) setup_network(); - /* The data sink runs with a 100% duty cycle in order to ensure high - packet reception rates. */ - NETSTACK_MAC.off(1); - while(1) { etimer_set(&timer, CLOCK_SECOND * 5); PROCESS_YIELD(); diff --git a/examples/ipv6/multicast/root.c b/examples/ipv6/multicast/root.c index f10e140d2..58e040e34 100644 --- a/examples/ipv6/multicast/root.c +++ b/examples/ipv6/multicast/root.c @@ -147,8 +147,6 @@ PROCESS_THREAD(rpl_root_process, ev, data) PRINTF("Multicast Engine: '%s'\n", UIP_MCAST6.name); - NETSTACK_MAC.off(1); - set_own_addresses(); prepare_mcast(); diff --git a/examples/ipv6/native-border-router/border-router-mac.c b/examples/ipv6/native-border-router/border-router-mac.c index 56301c7b1..bfb20ce58 100644 --- a/examples/ipv6/native-border-router/border-router-mac.c +++ b/examples/ipv6/native-border-router/border-router-mac.c @@ -140,21 +140,12 @@ send_packet(mac_callback_t sent, void *ptr) } /*---------------------------------------------------------------------------*/ static void -send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list) -{ - if(buf_list != NULL) { - queuebuf_to_packetbuf(buf_list->buf); - send_packet(sent, ptr); - } -} -/*---------------------------------------------------------------------------*/ -static void packet_input(void) { if(NETSTACK_FRAMER.parse() < 0) { PRINTF("br-rdc: failed to parse %u\n", packetbuf_datalen()); } else { - NETSTACK_MAC.input(); + NETSTACK_NETWORK.input(); } } /*---------------------------------------------------------------------------*/ @@ -165,7 +156,7 @@ on(void) } /*---------------------------------------------------------------------------*/ static int -off(int keep_radio_on) +off() { return 1; } @@ -176,11 +167,10 @@ init(void) callback_pos = 0; } /*---------------------------------------------------------------------------*/ -const struct rdc_driver border_router_rdc_driver = { - "br-rdc", +const struct mac_driver border_router_mac_driver = { + "br-mac", init, send_packet, - send_list, packet_input, on, off diff --git a/examples/ipv6/native-border-router/border-router.c b/examples/ipv6/native-border-router/border-router.c index 63674db50..eac582903 100644 --- a/examples/ipv6/native-border-router/border-router.c +++ b/examples/ipv6/native-border-router/border-router.c @@ -346,10 +346,6 @@ PROCESS_THREAD(border_router_process, ev, data) print_local_addresses(); #endif - /* The border router runs with a 100% duty cycle in order to ensure high - packet reception rates. */ - NETSTACK_MAC.off(1); - while(1) { etimer_set(&et, CLOCK_SECOND * 2); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); diff --git a/examples/ipv6/native-border-router/project-conf.h b/examples/ipv6/native-border-router/project-conf.h index 4ef217fcb..04c59e33c 100644 --- a/examples/ipv6/native-border-router/project-conf.h +++ b/examples/ipv6/native-border-router/project-conf.h @@ -51,8 +51,8 @@ #define CMD_CONF_OUTPUT border_router_cmd_output -#undef NETSTACK_CONF_RDC -#define NETSTACK_CONF_RDC border_router_rdc_driver +#undef NETSTACK_CONF_MAC +#define NETSTACK_CONF_MAC border_router_mac_driver /* used by wpcap (see /cpu/native/net/wpcap-drv.c) */ #define SELECT_CALLBACK 1 diff --git a/examples/ipv6/native-border-router/slip-dev.c b/examples/ipv6/native-border-router/slip-dev.c index 8aabbe528..b5d3b171b 100644 --- a/examples/ipv6/native-border-router/slip-dev.c +++ b/examples/ipv6/native-border-router/slip-dev.c @@ -166,7 +166,7 @@ slip_packet_input(unsigned char *data, int len) if(slip_config_verbose > 0) { printf("Packet input over SLIP: %d\n", len); } - NETSTACK_RDC.input(); + NETSTACK_MAC.input(); } /*---------------------------------------------------------------------------*/ /* diff --git a/examples/ipv6/rpl-border-router/border-router.c b/examples/ipv6/rpl-border-router/border-router.c index 90b1fdf23..63673a574 100644 --- a/examples/ipv6/rpl-border-router/border-router.c +++ b/examples/ipv6/rpl-border-router/border-router.c @@ -409,20 +409,13 @@ PROCESS_THREAD(border_router_process, ev, data) * Prevent that by turning the radio off until we are initialized as a DAG root. */ prefix_set = 0; - NETSTACK_MAC.off(0); + NETSTACK_MAC.off(); PROCESS_PAUSE(); SENSORS_ACTIVATE(button_sensor); PRINTF("RPL-Border router started\n"); -#if 0 - /* The border router runs with a 100% duty cycle in order to ensure high - packet reception rates. - Note if the MAC RDC is not turned off now, aggressive power management of the - cpu will interfere with establishing the SLIP connection */ - NETSTACK_MAC.off(1); -#endif /* Request prefix until it has been received */ while(!prefix_set) { @@ -431,11 +424,6 @@ PROCESS_THREAD(border_router_process, ev, data) PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); } - /* Now turn the radio on, but disable radio duty cycling. - * Since we are the DAG root, reception delays would constrain mesh throughbut. - */ - NETSTACK_MAC.off(1); - #if DEBUG || 1 print_local_addresses(); #endif diff --git a/examples/ipv6/rpl-tsch/project-conf.h b/examples/ipv6/rpl-tsch/project-conf.h index cceb17984..9431fd527 100644 --- a/examples/ipv6/rpl-tsch/project-conf.h +++ b/examples/ipv6/rpl-tsch/project-conf.h @@ -63,8 +63,6 @@ /* Netstack layers */ #undef NETSTACK_CONF_MAC #define NETSTACK_CONF_MAC tschmac_driver -#undef NETSTACK_CONF_RDC -#define NETSTACK_CONF_RDC nordc_driver /* IEEE802.15.4 frame version */ #undef FRAME802154_CONF_VERSION diff --git a/examples/ipv6/rpl-udp/udp-server.c b/examples/ipv6/rpl-udp/udp-server.c index 56c5072ec..6608ce7b8 100644 --- a/examples/ipv6/rpl-udp/udp-server.c +++ b/examples/ipv6/rpl-udp/udp-server.c @@ -151,10 +151,6 @@ PROCESS_THREAD(udp_server_process, ev, data) print_local_addresses(); - /* The data sink runs with a 100% duty cycle in order to ensure high - packet reception rates. */ - NETSTACK_MAC.off(1); - server_conn = udp_new(NULL, UIP_HTONS(UDP_CLIENT_PORT), NULL); if(server_conn == NULL) { PRINTF("No UDP connection available, exiting the process!\n"); diff --git a/examples/ipv6/slip-radio/slip-radio.c b/examples/ipv6/slip-radio/slip-radio.c index 6f56591e7..083bfa739 100644 --- a/examples/ipv6/slip-radio/slip-radio.c +++ b/examples/ipv6/slip-radio/slip-radio.c @@ -217,7 +217,6 @@ PROCESS_THREAD(slip_radio_process, ev, data) PROCESS_BEGIN(); init(); - NETSTACK_RDC.off(1); #ifdef SLIP_RADIO_CONF_SENSORS SLIP_RADIO_CONF_SENSORS.init(); #endif diff --git a/examples/platform-specific/cc26xx/very-sleepy-demo/very-sleepy-demo.c b/examples/platform-specific/cc26xx/very-sleepy-demo/very-sleepy-demo.c index 5719e11ce..cc0f4d00a 100644 --- a/examples/platform-specific/cc26xx/very-sleepy-demo/very-sleepy-demo.c +++ b/examples/platform-specific/cc26xx/very-sleepy-demo/very-sleepy-demo.c @@ -407,7 +407,7 @@ PROCESS_THREAD(very_sleepy_demo_process, ev, data) if(mac_keep_on == MAC_CAN_BE_TURNED_OFF && state == STATE_VERY_SLEEPY) { leds_off(LEDS_GREEN); - NETSTACK_MAC.off(0); + NETSTACK_MAC.off(); } else { leds_on(LEDS_GREEN); NETSTACK_MAC.on(); diff --git a/examples/platform-specific/jn516x/rpl/common-conf.h b/examples/platform-specific/jn516x/rpl/common-conf.h index 3e077fcb0..b93bdaf98 100644 --- a/examples/platform-specific/jn516x/rpl/common-conf.h +++ b/examples/platform-specific/jn516x/rpl/common-conf.h @@ -40,7 +40,6 @@ #define MAC_CONFIG MAC_CONFIG_TSCH #undef NETSTACK_CONF_MAC -#undef NETSTACK_CONF_RDC #undef NETSTACK_CONF_FRAMER #if MAC_CONFIG == MAC_CONFIG_NULLRDC @@ -58,7 +57,6 @@ #endif /* WITH_SECURITY */ #define NETSTACK_CONF_MAC tschmac_driver -#define NETSTACK_CONF_RDC nordc_driver /* IEEE802.15.4 frame version */ #undef FRAME802154_CONF_VERSION diff --git a/examples/platform-specific/jn516x/rpl/tools/rpl-tools.c b/examples/platform-specific/jn516x/rpl/tools/rpl-tools.c index dff045ab6..eadbffc9d 100644 --- a/examples/platform-specific/jn516x/rpl/tools/rpl-tools.c +++ b/examples/platform-specific/jn516x/rpl/tools/rpl-tools.c @@ -116,7 +116,6 @@ rpl_tools_init(uip_ipaddr_t *br_prefix) uip_ipaddr_t global_ipaddr; if(br_prefix) { /* We are root */ - NETSTACK_RDC.off(1); memcpy(&global_ipaddr, br_prefix, 16); uip_ds6_set_addr_iid(&global_ipaddr, &uip_lladdr); uip_ds6_addr_add(&global_ipaddr, 0, ADDR_AUTOCONF); diff --git a/examples/platform-specific/jn516x/tsch/common-conf.h b/examples/platform-specific/jn516x/tsch/common-conf.h index 8d3778148..e85b3387c 100644 --- a/examples/platform-specific/jn516x/tsch/common-conf.h +++ b/examples/platform-specific/jn516x/tsch/common-conf.h @@ -150,10 +150,6 @@ #undef NETSTACK_CONF_MAC #define NETSTACK_CONF_MAC tschmac_driver -/* Contiki netstack: RDC */ -#undef NETSTACK_CONF_RDC -#define NETSTACK_CONF_RDC nordc_driver - #else /* No TSCH, use Csma with ACK (default MAC) */ #undef MICROMAC_CONF_CHANNEL diff --git a/examples/platform-specific/jn516x/tsch/tools/rpl-tools.c b/examples/platform-specific/jn516x/tsch/tools/rpl-tools.c index b61c693c2..c3c0c458f 100644 --- a/examples/platform-specific/jn516x/tsch/tools/rpl-tools.c +++ b/examples/platform-specific/jn516x/tsch/tools/rpl-tools.c @@ -115,7 +115,6 @@ rpl_tools_init(uip_ipaddr_t *br_prefix) #endif if(br_prefix) { /* We are root */ /* If an RDC layer is used, turn it off (i.e. keep the radio on at the root). */ - NETSTACK_RDC.off(1); memcpy(&global_ipaddr, br_prefix, 16); uip_ds6_set_addr_iid(&global_ipaddr, &uip_lladdr); uip_ds6_addr_add(&global_ipaddr, 0, ADDR_AUTOCONF); diff --git a/examples/platform-specific/zolertia/zoul/orion/ip64-router/ip64-router.c b/examples/platform-specific/zolertia/zoul/orion/ip64-router/ip64-router.c index b69e4d80c..dc30e6d26 100644 --- a/examples/platform-specific/zolertia/zoul/orion/ip64-router/ip64-router.c +++ b/examples/platform-specific/zolertia/zoul/orion/ip64-router/ip64-router.c @@ -271,7 +271,7 @@ PROCESS_THREAD(router_node_process, ev, data) static struct etimer et; /* Turn radio off while initialazing */ - NETSTACK_MAC.off(0); + NETSTACK_MAC.off(); /* Initialize the IP64 module so we'll start translating packets */ ip64_init(); @@ -307,9 +307,6 @@ PROCESS_THREAD(router_node_process, ev, data) leds_off(LEDS_DHCP); - /* Turn the radio on and create the network */ - NETSTACK_MAC.off(1); - /* Set us up as a RPL root node. */ rpl_dag_root_init_dag(); diff --git a/examples/platform-specific/zolertia/zoul/zoul-demo.c b/examples/platform-specific/zolertia/zoul/zoul-demo.c index d2a10647e..8db518d5d 100644 --- a/examples/platform-specific/zolertia/zoul/zoul-demo.c +++ b/examples/platform-specific/zolertia/zoul/zoul-demo.c @@ -125,9 +125,6 @@ PROCESS_THREAD(zoul_demo_process, ev, data) counter = 0; - /* Disable the radio duty cycle and keep the radio on */ - NETSTACK_MAC.off(1); - broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx); /* Configure the user button */ diff --git a/examples/sensniff/netstack.c b/examples/sensniff/netstack.c index 14068ce77..ad85056df 100644 --- a/examples/sensniff/netstack.c +++ b/examples/sensniff/netstack.c @@ -33,6 +33,6 @@ void netstack_init(void) { NETSTACK_RADIO.init(); - NETSTACK_RDC.init(); + NETSTACK_MAC.init(); } /*---------------------------------------------------------------------------*/ diff --git a/examples/sensniff/project-conf.h b/examples/sensniff/project-conf.h index 4d703fc43..5e013d2bd 100644 --- a/examples/sensniff/project-conf.h +++ b/examples/sensniff/project-conf.h @@ -32,8 +32,8 @@ #ifndef PROJECT_CONF_H_ #define PROJECT_CONF_H_ /*---------------------------------------------------------------------------*/ -#undef NETSTACK_CONF_RDC -#define NETSTACK_CONF_RDC sensniff_rdc_driver +#undef NETSTACK_CONF_MAC +#define NETSTACK_CONF_MAC sensniff_mac_driver /*---------------------------------------------------------------------------*/ /* Include platform-specific header */ #include "target-conf.h" diff --git a/examples/sensniff/sensniff-mac.c b/examples/sensniff/sensniff-mac.c index 3a5eef428..aa78897b6 100644 --- a/examples/sensniff/sensniff-mac.c +++ b/examples/sensniff/sensniff-mac.c @@ -36,7 +36,6 @@ */ /*---------------------------------------------------------------------------*/ #include "net/mac/mac.h" -#include "net/mac/rdc.h" #include "net/netstack.h" #include "sensniff.h" /*---------------------------------------------------------------------------*/ @@ -46,11 +45,6 @@ send(mac_callback_t sent, void *ptr) } /*---------------------------------------------------------------------------*/ static void -send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *list) -{ -} -/*---------------------------------------------------------------------------*/ -static void input(void) { sensniff_output_frame(); @@ -60,17 +54,11 @@ static int on(void) { NETSTACK_RADIO.on(); - return 1; + return 0; } /*---------------------------------------------------------------------------*/ static int -off(int keep_radio_on) -{ - return keep_radio_on; -} -/*---------------------------------------------------------------------------*/ -static unsigned short -cca(void) +off(void) { return 0; } @@ -81,14 +69,12 @@ init(void) on(); } /*---------------------------------------------------------------------------*/ -const struct rdc_driver sensniff_rdc_driver = { +const struct mac_driver sensniff_mac_driver = { "sensniff-rdc", init, send, - send_list, input, on, - off, - cca, + off }; /*---------------------------------------------------------------------------*/ diff --git a/regression-tests/13-ieee802154/code-flush-nbr-queue/project-conf.h b/regression-tests/13-ieee802154/code-flush-nbr-queue/project-conf.h index 0e2ed64b5..fc234c4ca 100644 --- a/regression-tests/13-ieee802154/code-flush-nbr-queue/project-conf.h +++ b/regression-tests/13-ieee802154/code-flush-nbr-queue/project-conf.h @@ -47,9 +47,6 @@ #undef NETSTACK_CONF_MAC #define NETSTACK_CONF_MAC tschmac_driver -#undef NETSTACK_CONF_RDC -#define NETSTACK_CONF_RDC nordc_driver - #undef FRAME802154_CONF_VERSION #define FRAME802154_CONF_VERSION FRAME802154_IEEE802154E_2012 diff --git a/regression-tests/13-ieee802154/code/project-tsch-conf.h b/regression-tests/13-ieee802154/code/project-tsch-conf.h index 32e7b3a7c..ae994d6ca 100644 --- a/regression-tests/13-ieee802154/code/project-tsch-conf.h +++ b/regression-tests/13-ieee802154/code/project-tsch-conf.h @@ -37,8 +37,6 @@ #undef NETSTACK_CONF_MAC #define NETSTACK_CONF_MAC tschmac_driver -#undef NETSTACK_CONF_RDC -#define NETSTACK_CONF_RDC nordc_driver #if WITH_SECURITY_ON #define TEST_CONFIG_TYPE SECURITY_ON