Do not force DIO reset on certain events where it is not needed.

This commit is contained in:
Nicolas Tsiftes 2011-11-16 09:49:22 +01:00
parent b405571e32
commit ea73f1d767
4 changed files with 19 additions and 18 deletions

View file

@ -561,7 +561,7 @@ rpl_select_dodag(rpl_instance_t * instance, rpl_parent_t *p)
}
if(best_dag == NULL) {
/* No parent found : the calling function handle this problem. */
/* No parent found: the calling function handle this problem. */
return NULL;
}
@ -569,7 +569,7 @@ rpl_select_dodag(rpl_instance_t * instance, rpl_parent_t *p)
/* Remove routes installed by DAOs. */
rpl_remove_routes(instance->current_dag);
PRINTF("RPL: New preferred DODAG : ");
PRINTF("RPL: New preferred DODAG: ");
PRINT6ADDR(&best_dag->dag_id);
PRINTF("\n");
@ -986,7 +986,7 @@ rpl_local_repair(rpl_instance_t *instance)
}
}
rpl_reset_dio_timer(instance,1);
rpl_reset_dio_timer(instance, 0);
RPL_STAT(rpl_stats.local_repairs++);
}
@ -1105,14 +1105,14 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
instance = rpl_get_instance(dio->instance_id);
if(instance == NULL) {
PRINTF("RPL : New instance detected : Joining...\n");
PRINTF("RPL: New instance detected: Joining...\n");
rpl_join_instance(from, dio);
return;
}
dag = rpl_get_dodag(dio->instance_id,&dio->dag_id);
if(dag == NULL) {
PRINTF("RPL : Adding new dodag to known instance.\n");
PRINTF("RPL: Adding new dodag to known instance.\n");
rpl_add_dodag(from,dio);
return;
}
@ -1122,7 +1122,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
PRINTF("RPL: Root received inconsistent DIO version number\n");
dag->version = dio->version;
RPL_LOLLIPOP_INCREMENT(dag->version);
rpl_reset_dio_timer(instance, 1);
rpl_reset_dio_timer(instance, 0);
} else {
global_repair(from, dag, dio);
}
@ -1132,7 +1132,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
/* Inconsistency detected - someone is still on old version */
PRINTF("RPL: old version received => inconsistency detected\n");
if(dag->joined) {
rpl_reset_dio_timer(instance, 1);
rpl_reset_dio_timer(instance, 0);
return;
}
}
@ -1140,7 +1140,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
if(dio->rank == INFINITE_RANK) {
if(dag->joined) {
rpl_reset_dio_timer(instance, 1);
rpl_reset_dio_timer(instance, 0);
}
} else if(dio->rank < ROOT_RANK(instance)) {
PRINTF("RPL: Ignoring DIO with too low rank: %u\n",
@ -1150,7 +1150,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
if(dag->rank == ROOT_RANK(instance)) {
if(dio->rank != INFINITE_RANK) {
instance->dio_counter++;
instance->dio_counter++;
}
return;
}
@ -1199,7 +1199,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
PRINTF("RPL current state: Prefered DODAG: ");
PRINT6ADDR(&instance->current_dag->dag_id);
PRINTF(", rank: %u, min_rank: %u, ",instance->current_dag->rank,instance->current_dag->min_rank);
PRINTF("p->rank : %u, p->mc.obj.etx : %u, p->link_metric : %u, instance->mc.obj.etx %u\n", p->rank, p->mc.obj.etx, p->link_metric,instance->mc.obj.etx);
PRINTF("p->rank: %u, p->mc.obj.etx: %u, p->link_metric: %u, instance->mc.obj.etx %u\n", p->rank, p->mc.obj.etx, p->link_metric,instance->mc.obj.etx);
/* We have allocated a candidate parent; process the DIO further. */

View file

@ -77,7 +77,7 @@ rpl_verify_header(int uip_ext_opt_offset)
instance = rpl_get_instance(UIP_EXT_HDR_OPT_RPL_BUF->instance);
if(instance == NULL) {
PRINTF("RPL: Unknown instance : %u\n",
PRINTF("RPL: Unknown instance: %u\n",
UIP_EXT_HDR_OPT_RPL_BUF->instance);
return 1;
}
@ -90,7 +90,7 @@ rpl_verify_header(int uip_ext_opt_offset)
if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_DOWN) {
PRINTF("RPL: Packet going down :\n");
if(UIP_EXT_HDR_OPT_RPL_BUF->senderrank > instance->current_dag->rank) {
PRINTF("RPL: Loop detected : Sender rank > our rank\n");
PRINTF("RPL: Loop detected: Sender rank > our rank\n");
if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) {
PRINTF("RPL: Loop detected !\n");
/* We should try to repair it, not implemented for the moment */
@ -103,7 +103,7 @@ rpl_verify_header(int uip_ext_opt_offset)
} else {
PRINTF("RPL: Packet going up :");
if(UIP_EXT_HDR_OPT_RPL_BUF->senderrank < instance->current_dag->rank) {
PRINTF("RPL: Rank error : Sender rank < our rank\n");
PRINTF("RPL: Rank error: Sender rank < our rank\n");
if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) {
PRINTF("RPL: Loop detected !\n");
/* We should try to repair it, not implemented for the moment */
@ -236,7 +236,7 @@ rpl_add_header(rpl_instance_t *instance, int down)
uip_ext_opt_offset = 2;
if(instance == NULL || !instance->used || !instance->current_dag->joined) {
PRINTF("Unable to add RPL hop-by-hop extension header : incorrect instance\n");
PRINTF("Unable to add RPL hop-by-hop extension header: incorrect instance\n");
return 0;
}

View file

@ -233,7 +233,7 @@ dio_input(void)
PRINTF("RPL: Incoming DIO DODAG ");
PRINT6ADDR(&dio.dag_id);
PRINTF(" preference : %u\n",dio.preference);
PRINTF(", preference: %u\n", dio.preference);
/* Check if there are any DIO suboptions. */
for(; i < buffer_length; i += len) {

View file

@ -178,7 +178,8 @@ void
rpl_reset_dio_timer(rpl_instance_t *instance, uint8_t force)
{
#if !RPL_LEAF_ONLY
/* only reset if not just reset or started */
/* Do not reset if we are already on the minimum interval,
unless forced to do so. */
if(force || instance->dio_intcurrent > instance->dio_intmin) {
instance->dio_counter = 0;
instance->dio_intcurrent = instance->dio_intmin;
@ -197,8 +198,8 @@ handle_dao_timer(void *ptr)
instance = (rpl_instance_t *)ptr;
if (!dio_send_ok && uip_ds6_get_link_local(ADDR_PREFERRED) == NULL) {
PRINTF("RPL: Postpone DAO transmission... \n");
if(!dio_send_ok && uip_ds6_get_link_local(ADDR_PREFERRED) == NULL) {
PRINTF("RPL: Postpone DAO transmission\n");
ctimer_set(&instance->dao_timer, CLOCK_SECOND, handle_dao_timer, instance);
return;
}