Merge pull request #102 from cetic/rpl-conf-init-link-metric
Makes RPL Initial Link Metric configurable
This commit is contained in:
commit
ea92365cd4
|
@ -154,4 +154,13 @@
|
||||||
#define RPL_DIO_REDUNDANCY 10
|
#define RPL_DIO_REDUNDANCY 10
|
||||||
#endif
|
#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 */
|
#endif /* RPL_CONF_H */
|
||||||
|
|
|
@ -505,7 +505,7 @@ rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr)
|
||||||
p->dag = dag;
|
p->dag = dag;
|
||||||
p->rank = dio->rank;
|
p->rank = dio->rank;
|
||||||
p->dtsn = dio->dtsn;
|
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));
|
memcpy(&p->mc, &dio->mc, sizeof(p->mc));
|
||||||
list_add(dag->parents, p);
|
list_add(dag->parents, p);
|
||||||
return p;
|
return p;
|
||||||
|
|
|
@ -112,7 +112,7 @@ calculate_rank(rpl_parent_t *p, rpl_rank_t base_rank)
|
||||||
if(base_rank == 0) {
|
if(base_rank == 0) {
|
||||||
return INFINITE_RANK;
|
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 {
|
} else {
|
||||||
/* multiply first, then scale down to avoid truncation effects */
|
/* multiply first, then scale down to avoid truncation effects */
|
||||||
rank_increase = NEIGHBOR_INFO_FIX2ETX(p->link_metric * p->dag->instance->min_hoprankinc);
|
rank_increase = NEIGHBOR_INFO_FIX2ETX(p->link_metric * p->dag->instance->min_hoprankinc);
|
||||||
|
|
|
@ -139,8 +139,6 @@
|
||||||
|
|
||||||
#define INFINITE_RANK 0xffff
|
#define INFINITE_RANK 0xffff
|
||||||
|
|
||||||
#define INITIAL_LINK_METRIC NEIGHBOR_INFO_ETX2FIX(5)
|
|
||||||
|
|
||||||
/* Represents 2^n ms. */
|
/* Represents 2^n ms. */
|
||||||
/* Default value according to the specification is 3 which
|
/* Default value according to the specification is 3 which
|
||||||
means 8 milliseconds, but that is an unreasonable value if
|
means 8 milliseconds, but that is an unreasonable value if
|
||||||
|
|
Loading…
Reference in a new issue