diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 58af7501c..7429b9681 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -56,6 +56,8 @@ #define DEBUG DEBUG_NONE #include "net/uip-debug.h" +#include "net/neighbor-info.h" + /************************************************************************/ extern rpl_of_t RPL_OF; static rpl_of_t * const objective_functions[] = {&RPL_OF}; @@ -92,6 +94,9 @@ static rpl_of_t * const objective_functions[] = {&RPL_OF}; #else #define RPL_DIO_INTERVAL_DOUBLINGS RPL_CONF_DIO_INTERVAL_DOUBLINGS #endif /* !RPL_CONF_DIO_INTERVAL_DOUBLINGS */ + +#define INITIAL_ETX ETX_DIVISOR * 5 + /************************************************************************/ /* Allocate parents from the same static MEMB chunk to reduce memory waste. */ MEMB(parent_memb, struct rpl_parent, RPL_MAX_PARENTS); @@ -277,7 +282,7 @@ rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr) memcpy(&p->addr, addr, sizeof(p->addr)); p->dag = dag; p->rank = dio->rank; - p->local_confidence = 0; + p->etx = INITIAL_ETX; p->dtsn = 0; list_add(dag->parents, p); @@ -423,7 +428,7 @@ join_dag(uip_ipaddr_t *from, rpl_dio_t *dio) } PRINTF("succeeded\n"); - p->local_confidence = 0; /* The lowest confidence for new parents. */ + p->etx = INITIAL_ETX; /* The lowest confidence for new parents. */ /* Determine the objective function by using the objective code point of the DIO. */ diff --git a/core/net/rpl/rpl-of-etx.c b/core/net/rpl/rpl-of-etx.c index 7c416b9e1..d6404b35b 100644 --- a/core/net/rpl/rpl-of-etx.c +++ b/core/net/rpl/rpl-of-etx.c @@ -118,10 +118,10 @@ calculate_rank(rpl_parent_t *p, rpl_rank_t base_rank) rank_increase = INITIAL_LINK_METRIC * DEFAULT_MIN_HOPRANKINC; } else { dag = (rpl_dag_t *)p->dag; - if(p->local_confidence == 0) { - p->local_confidence = INITIAL_LINK_METRIC * ETX_DIVISOR; + if(p->etx == 0) { + p->etx = INITIAL_LINK_METRIC * ETX_DIVISOR; } - rank_increase = (p->local_confidence * dag->min_hoprankinc) / ETX_DIVISOR; + rank_increase = (p->etx * dag->min_hoprankinc) / ETX_DIVISOR; if(base_rank == 0) { base_rank = p->rank; } diff --git a/core/net/rpl/rpl.c b/core/net/rpl/rpl.c index 5cd6f7b6d..4b05793f3 100644 --- a/core/net/rpl/rpl.c +++ b/core/net/rpl/rpl.c @@ -150,11 +150,11 @@ rpl_link_neighbor_callback(const rimeaddr_t *addr, int known, int etx) return; } - if(etx != parent->local_confidence) { + if(etx != parent->etx) { /* Trigger DAG rank recalculation. */ parent->updated = 1; } - parent->local_confidence = etx; + parent->etx = etx; if(dag->of->parent_state_callback != NULL) { dag->of->parent_state_callback(parent, known, etx); diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index 4c992bcb0..ed4277adc 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -207,7 +207,7 @@ struct rpl_parent { void *dag; uip_ipaddr_t addr; rpl_rank_t rank; - uint8_t local_confidence; + uint8_t etx; uint8_t dtsn; uint8_t updated; };