made rank use full resolution when using OF-ETX

This commit is contained in:
joxe 2010-10-28 20:39:06 +00:00
parent 9194b3ac69
commit 9a1f902881
5 changed files with 17 additions and 11 deletions

View file

@ -32,7 +32,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: rpl-icmp6.c,v 1.25 2010/10/27 00:46:40 nvt-se Exp $
* $Id: rpl-icmp6.c,v 1.26 2010/10/28 20:39:06 joxe Exp $
*/
/**
* \file
@ -497,9 +497,9 @@ dao_input(void)
if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) {
/* Check if this is a DAO forwarding loop. */
p = rpl_find_parent(dag, &dao_sender_addr);
if(p != NULL && p->rank < dag->rank) {
if(p != NULL && DAG_RANK(p->rank, dag) < DAG_RANK(dag->rank, dag)) {
printf("RPL: Loop detected when receiving a unicast DAO from a node with a lower rank! (%u < %u)\n",
DAG_RANK(p->rank, dag), DAG_RANK(dag->rank, dag));
DAG_RANK(p->rank, dag), DAG_RANK(dag->rank, dag));
rpl_local_repair(dag);
return;
}

View file

@ -32,7 +32,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: rpl-of-etx.c,v 1.6 2010/09/15 13:22:23 nvt-se Exp $
* $Id: rpl-of-etx.c,v 1.7 2010/10/28 20:39:06 joxe Exp $
*/
/**
* \file
@ -42,6 +42,7 @@
*/
#include "net/rpl/rpl.h"
#include "net/neighbor-info.h"
#define DEBUG DEBUG_ANNOTATE
#include "net/uip-debug.h"
@ -106,9 +107,9 @@ calculate_rank(rpl_parent_t *p, rpl_rank_t base_rank)
} else {
dag = (rpl_dag_t *)p->dag;
if(p->local_confidence == 0) {
p->local_confidence = LINK_ETX_GUESS;
p->local_confidence = LINK_ETX_GUESS * ETX_DIVISOR;
}
rank_increase = p->local_confidence * dag->min_hoprankinc;
rank_increase = (p->local_confidence * dag->min_hoprankinc) / ETX_DIVISOR;
if(base_rank == 0) {
base_rank = p->rank;
}

View file

@ -32,7 +32,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: rpl-timers.c,v 1.11 2010/09/15 13:22:23 nvt-se Exp $
* $Id: rpl-timers.c,v 1.12 2010/10/28 20:39:06 joxe Exp $
*/
/**
* \file
@ -102,8 +102,9 @@ new_dio_interval(rpl_dag_t *dag)
/* keep some stats */
dag->dio_totint++;
dag->dio_totrecv += dag->dio_counter;
ANNOTATE("#A rank=%u(%u),stats=%d %d %d %d,color=%s\n",
ANNOTATE("#A rank=%u.%u(%u),stats=%d %d %d %d,color=%s\n",
DAG_RANK(dag->rank, dag),
(10 * (dag->rank % dag->min_hoprankinc)) / dag->min_hoprankinc,
dag->version,
dag->dio_totint, dag->dio_totsend,
dag->dio_totrecv,dag->dio_intcurrent,
@ -178,6 +179,9 @@ rpl_reset_dio_timer(rpl_dag_t *dag, uint8_t force)
dag->dio_intcurrent = dag->dio_intmin;
new_dio_interval(dag);
}
#if RPL_CONF_STATS
rpl_stats.resets++;
#endif
}
/************************************************************************/
static void

View file

@ -32,7 +32,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: rpl.c,v 1.11 2010/10/27 00:46:40 nvt-se Exp $
* $Id: rpl.c,v 1.12 2010/10/28 20:39:06 joxe Exp $
*/
/**
* \file
@ -128,7 +128,7 @@ rpl_link_neighbor_callback(const rimeaddr_t *addr, int known, int etx)
rpl_dag_t *dag;
rpl_parent_t *parent;
etx = FIX2ETX(etx);
/* etx = FIX2ETX(etx); */
uip_ip6addr(&ipaddr, 0xfe80, 0, 0, 0, 0, 0, 0, 0);
uip_ds6_set_addr_iid(&ipaddr, (uip_lladdr_t *)addr);

View file

@ -30,7 +30,7 @@
*
* Author: Joakim Eriksson, Nicolas Tsiftes
*
* $Id: rpl.h,v 1.22 2010/10/27 00:46:40 nvt-se Exp $
* $Id: rpl.h,v 1.23 2010/10/28 20:39:06 joxe Exp $
*/
#ifndef RPL_H
@ -248,6 +248,7 @@ struct rpl_stats {
uint16_t local_repairs;
uint16_t global_repairs;
uint16_t malformed_msgs;
uint16_t resets;
};
typedef struct rpl_stats rpl_stats_t;