moved ETX storage variable from RPL to ds6-nbr

This commit is contained in:
Joakim Eriksson 2014-10-20 16:15:20 +02:00
parent 72679a819b
commit 5be43c6f8d
5 changed files with 69 additions and 20 deletions

View file

@ -126,26 +126,34 @@ static rpl_parent_t *
best_parent(rpl_parent_t *p1, rpl_parent_t *p2)
{
rpl_rank_t r1, r2;
rpl_dag_t *dag;
rpl_dag_t *dag;
uip_ds6_nbr_t *nbr1, *nbr2;
nbr1 = rpl_get_nbr(p1);
nbr2 = rpl_get_nbr(p2);
dag = (rpl_dag_t *)p1->dag; /* Both parents must be in the same DAG. */
if(nbr1 == NULL || nbr2 == NULL) {
return dag->preferred_parent;
}
PRINTF("RPL: Comparing parent ");
PRINT6ADDR(rpl_get_parent_ipaddr(p1));
PRINTF(" (confidence %d, rank %d) with parent ",
p1->link_metric, p1->rank);
nbr1->link_metric, p1->rank);
PRINT6ADDR(rpl_get_parent_ipaddr(p2));
PRINTF(" (confidence %d, rank %d)\n",
p2->link_metric, p2->rank);
nbr2->link_metric, p2->rank);
r1 = DAG_RANK(p1->rank, p1->dag->instance) * RPL_MIN_HOPRANKINC +
p1->link_metric;
nbr1->link_metric;
r2 = DAG_RANK(p2->rank, p1->dag->instance) * RPL_MIN_HOPRANKINC +
p2->link_metric;
nbr2->link_metric;
/* Compare two parents by looking both and their rank and at the ETX
for that parent. We choose the parent that has the most
favourable combination. */
dag = (rpl_dag_t *)p1->dag; /* Both parents must be in the same DAG. */
if(r1 < r2 + MIN_DIFFERENCE &&
r1 > r2 - MIN_DIFFERENCE) {
return dag->preferred_parent;