Makes RPL Initial Link Metric configurable

This commit is contained in:
Sébastien Dawans 2013-02-01 08:59:31 +01:00
parent bfc1e816de
commit 95ab192e88
4 changed files with 11 additions and 4 deletions

View file

@ -154,4 +154,13 @@
#define RPL_DIO_REDUNDANCY 10
#endif
/*
* Initial metric attributed to a link when the ETX is unknown
*/
#ifndef RPL_CONF_INIT_LINK_METRIC
#define RPL_INIT_LINK_METRIC NEIGHBOR_INFO_ETX2FIX(5)
#else
#define RPL_INIT_LINK_METRIC NEIGHBOR_INFO_ETX2FIX(RPL_CONF_INIT_LINK_METRIC)
#endif
#endif /* RPL_CONF_H */

View file

@ -505,7 +505,7 @@ rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr)
p->dag = dag;
p->rank = dio->rank;
p->dtsn = dio->dtsn;
p->link_metric = INITIAL_LINK_METRIC;
p->link_metric = RPL_INIT_LINK_METRIC;
memcpy(&p->mc, &dio->mc, sizeof(p->mc));
list_add(dag->parents, p);
return p;

View file

@ -112,7 +112,7 @@ calculate_rank(rpl_parent_t *p, rpl_rank_t base_rank)
if(base_rank == 0) {
return INFINITE_RANK;
}
rank_increase = NEIGHBOR_INFO_FIX2ETX(INITIAL_LINK_METRIC) * RPL_MIN_HOPRANKINC;
rank_increase = NEIGHBOR_INFO_FIX2ETX(RPL_INIT_LINK_METRIC) * RPL_MIN_HOPRANKINC;
} else {
/* multiply first, then scale down to avoid truncation effects */
rank_increase = NEIGHBOR_INFO_FIX2ETX(p->link_metric * p->dag->instance->min_hoprankinc);

View file

@ -139,8 +139,6 @@
#define INFINITE_RANK 0xffff
#define INITIAL_LINK_METRIC NEIGHBOR_INFO_ETX2FIX(5)
/* Represents 2^n ms. */
/* Default value according to the specification is 3 which
means 8 milliseconds, but that is an unreasonable value if