Skip to content

Commit

Permalink
Dynamic parent selection delay based on trickle i_min.
Browse files Browse the repository at this point in the history
Parent select delay min is 15 seconds or dynamic based on i_min. Bigger value is selected.

Change-Id: Ieb53162a6232c329ce48f2bfb99eb9dd149e1034
  • Loading branch information
Juha Heiskanen committed Oct 2, 2018
1 parent 5836b50 commit c1c5926
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/RPL/rpl_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ static buffer_t *rpl_control_dio_handler(protocol_interface_info_entry_t *cur, r
rpl_instance_consistent_rx(instance);
}

rpl_instance_neighbours_changed(instance);
rpl_instance_neighbours_changed(instance, dodag);

return buffer_free(buf);

Expand Down
14 changes: 11 additions & 3 deletions source/RPL/rpl_upward.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ void rpl_delete_neighbour(rpl_instance_t *instance, rpl_neighbour_t *neighbour)
}
if (neighbour->dodag_parent) {
rpl_instance_remove_system_routes_through_parent(instance, neighbour);
rpl_instance_neighbours_changed(instance);
rpl_instance_neighbours_changed(instance, NULL);
}

rpl_free(neighbour, sizeof *neighbour);
Expand Down Expand Up @@ -1171,10 +1171,18 @@ bool rpl_instance_purge(rpl_instance_t *instance)
return false;
}

void rpl_instance_neighbours_changed(rpl_instance_t *instance)
void rpl_instance_neighbours_changed(rpl_instance_t *instance, const rpl_dodag_t *dodag)
{
instance->neighbours_changed = true;
rpl_instance_trigger_parent_selection(instance, rpl_policy_dio_parent_selection_delay(instance->domain));
uint16_t delay = rpl_policy_dio_parent_selection_delay(instance->domain);
if (dodag) {
//Convert imin 100ms tick to seconds
uint16_t i_min_delay = dodag->dio_timer_params.Imin / 10;
if (i_min_delay > delay) {
delay = i_min_delay;
}
}
rpl_instance_trigger_parent_selection(instance, delay);
}

static void rpl_instance_remove_parents(rpl_instance_t *instance)
Expand Down
2 changes: 1 addition & 1 deletion source/RPL/rpl_upward.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void rpl_neighbour_update_dodag_version(rpl_neighbour_t *neighbour, rpl_dodag_ve
bool rpl_neighbour_update_dtsn(rpl_neighbour_t *neighbour, uint8_t dtsn);
rpl_instance_t *rpl_neighbour_instance(const rpl_neighbour_t *neighbour);

void rpl_instance_neighbours_changed(rpl_instance_t *instance);
void rpl_instance_neighbours_changed(rpl_instance_t *instance, const rpl_dodag_t *dodag);
void rpl_instance_run_parent_selection(rpl_instance_t *instance);

void rpl_upward_print_instance(rpl_instance_t *instance, route_print_fn_t *print_fn);
Expand Down
2 changes: 1 addition & 1 deletion test/nanostack/unittest/stub/rpl_upward_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ bool rpl_instance_purge(rpl_instance_t *instance)
return false;
}

void rpl_instance_neighbours_changed(rpl_instance_t *instance)
void rpl_instance_neighbours_changed(rpl_instance_t *instance, const rpl_dodag_t *dodag)
{
}

Expand Down

0 comments on commit c1c5926

Please sign in to comment.