From ccbfa388f69089989445d0959ca871745596fbe3 Mon Sep 17 00:00:00 2001 From: Laurent Deru Date: Thu, 16 Jan 2014 09:24:55 +0100 Subject: [PATCH] Add more RPL stats --- core/net/rpl/rpl-dag.c | 1 + core/net/rpl/rpl-ext-header.c | 2 ++ core/net/rpl/rpl-private.h | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 53ba956fa..eb92e2f10 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -332,6 +332,7 @@ rpl_repair_root(uint8_t instance_id) PRINTF("RPL: rpl_repair_root triggered but not root\n"); return 0; } + RPL_STAT(rpl_stats.root_repairs++); RPL_LOLLIPOP_INCREMENT(instance->current_dag->version); RPL_LOLLIPOP_INCREMENT(instance->dtsn_out); diff --git a/core/net/rpl/rpl-ext-header.c b/core/net/rpl/rpl-ext-header.c index 5bc03ce25..964caa96f 100644 --- a/core/net/rpl/rpl-ext-header.c +++ b/core/net/rpl/rpl-ext-header.c @@ -137,12 +137,14 @@ rpl_verify_header(int uip_ext_opt_offset) sender_rank, instance->current_dag->rank, sender_closer); if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) { + RPL_STAT(rpl_stats.loop_errors++); PRINTF("RPL: Rank error signalled in RPL option!\n"); /* Packet must be dropped and dio trickle timer reset, see RFC6550 - 11.2.2.2 */ rpl_reset_dio_timer(instance); return 1; } PRINTF("RPL: Single error tolerated\n"); + RPL_STAT(rpl_stats.loop_warnings++); UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_RANK_ERR; return 0; } diff --git a/core/net/rpl/rpl-private.h b/core/net/rpl/rpl-private.h index 7b26c3730..a9ca3f375 100644 --- a/core/net/rpl/rpl-private.h +++ b/core/net/rpl/rpl-private.h @@ -242,6 +242,10 @@ struct rpl_stats { uint16_t malformed_msgs; uint16_t resets; uint16_t parent_switch; + uint16_t forward_errors; + uint16_t loop_errors; + uint16_t loop_warnings; + uint16_t root_repairs; }; typedef struct rpl_stats rpl_stats_t;