contikicontiki-ng

Radio payload limitation for Cooja mote of Contiki-ng


Consider an RPL network as shown in below. In this network node 1 is the root of the DODAG. Node 2 is the sender and sends unicast UDP packets toward receiver nodes (nodes 3-18). The DODAG is working in the non-storing mode and I am using Cooja mote of Contiki-NG to perform this simulation.

The problem is that the packets can only be reach to nodes that are placed up to 12 hops away (node 13 in this example). When the sender wants to send a packet for node 16 for example, we got the following warning by 6lowpan and the packet is dropped at the root: "Not enough packetbuf space to compress header (112 bytes, 92 left). Aborting." (line #706 sicslowpan.c) I investigated the problem and found that the root creates the source routing header correctly and the header is added to the packet without any problem. However, the problem comes from the MAC layer and radio interface. The packet is larger than MAX_PAYLOAD_LEN of radio driver. So the radio driver cannot handle the packet. The Contiki-ng has the nullradio driver by itself, but I think the radio driver and its parameters is defined by the platform. I need to mitigate this limitation. Is it possible to modify the parameters in Cooja mote source code? If yes how I can do that?

A simple RPL network; node 1 is the root, node 2 is the sender, node 3-18 are receivers


Solution

  • There are at least two, potentially three buffer size bottlenecks that determine the max size of a packet that can be send and processed with Contiki-NG network stack; three

    1. The size of the radio's packet buffer. This is normally determined by the hardware of the radio, and normally can be read by asking for RADIO_CONST_MAX_PAYLOAD_LEN parameter of the NETSTACK_RADIO driver.

    2. The size of the packet buffer. This is by default 125 bytes - small enough to fit in the payload of a standard IEEE 802.15.4 packet (for which the max PHY layer payload is 127 bytes) when a 2 byte FCS is added. The packetbuf size can be changed by the defining a different value of PACKETBUF_CONF_SIZE.

    3. If you use IPv6, then also the size of the uIP buffer. This is defined as UIP_CONF_BUFFER_SIZE and is by default quite large (1280 bytes) to be compatible with the IPv6 MTU defined by the relevant RFCs. However, some platforms set it a smaller value to save memory.

    If you use simulated Cooja nodes, then the radio packet's buffer can be changed in software, by defining a different COOJA_RADIO_CONF_BUFSIZE value in the project-conf.h or in the Makefile. The default value is 125 bytes (so that when 2 byte FCS is added, the size is the max PHY layer payload of an IEEE 802.15.4 radio).

    To solve your problem on Cooja you can try adding in project-conf.h:

    #define COOJA_RADIO_CONF_BUFSIZE 1000
    #define PACKETBUF_CONF_SIZE 1000