Search code examples
routeswirelesscontiki

How does RPL calculate ETX among nodes without data packets (UDP/TCP) at the beginning?


I am wondering how RPL calculates ETX link metric at the initialization stage for nodes without data packets. Thanks.


Solution

  • RPL looks at the neighbor statistics module. There are multiple options how the module might

    1. If you provide a custom definion of the LINK_STATS_CONF_INIT_ETX(stats) macro, it will be used to initialize ETX.
    2. Otherwise (ETX_INIT * ETX_DIVISOR) is used as the default value. ETX_INIT is defined to be 2 by default. ETX_DIVISOR is just a Contiki-specific scaling factor to avoid floating-point arithmetic.

    Nodes often receive packets from neighbors before they transmit packets. In that case, RSSI estimate is known, but ETX is not known. To initialize an initial estimate of ETX from RSSI, add this line to project-conf.h:

    #define LINK_STATS_CONF_INIT_ETX(stats) guess_etx_from_rssi(stats) 
    

    In this way, nodes with strong signal will be preferred for routing in absence of other information. Look at net/link-stats.c for the details.