From 9a1f902881ab5d073ebd40601a1782d0d38861b4 Mon Sep 17 00:00:00 2001 From: joxe Date: Thu, 28 Oct 2010 20:39:06 +0000 Subject: [PATCH] made rank use full resolution when using OF-ETX --- core/net/rpl/rpl-icmp6.c | 6 +++--- core/net/rpl/rpl-of-etx.c | 7 ++++--- core/net/rpl/rpl-timers.c | 8 ++++++-- core/net/rpl/rpl.c | 4 ++-- core/net/rpl/rpl.h | 3 ++- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 19c335163..2acde41bb 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -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; } diff --git a/core/net/rpl/rpl-of-etx.c b/core/net/rpl/rpl-of-etx.c index a7ad47d5d..b522b21cc 100644 --- a/core/net/rpl/rpl-of-etx.c +++ b/core/net/rpl/rpl-of-etx.c @@ -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; } diff --git a/core/net/rpl/rpl-timers.c b/core/net/rpl/rpl-timers.c index 1963c910a..e710c5d9b 100644 --- a/core/net/rpl/rpl-timers.c +++ b/core/net/rpl/rpl-timers.c @@ -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 diff --git a/core/net/rpl/rpl.c b/core/net/rpl/rpl.c index 519bf9b0f..af1ee7732 100644 --- a/core/net/rpl/rpl.c +++ b/core/net/rpl/rpl.c @@ -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); diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index da3350822..c6adaf32e 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -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;