Skip to content

Commit

Permalink
Wi-sun Border router and NUD process updates
Browse files Browse the repository at this point in the history
Define RPL version number update time to 5 hours

NUD time update to support multiplse 100ms ticks.

Some minor code clean.

Change-Id: I8659ce1eab7dafe5f812a825602701dfa62ce762
  • Loading branch information
Juha Heiskanen committed Sep 19, 2018
1 parent 60e1545 commit a2b8491
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
6 changes: 3 additions & 3 deletions source/6LoWPAN/ws/ws_bbr_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ void ws_bbr_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds
// We update the RPL version in same time to allow nodes to reselect parent
// As configuration is made so that devices cant move downward in dodag this allows it
// TODO think the correct rate for this
if (cur->ws_info->pan_information.pan_version % 3 == 0) {
// Third the rate of configuration version change at default 12 minutes
//rpl_control_increment_dodag_version(protocol_6lowpan_rpl_root_dodag);
if ( cur->ws_info->pan_information.pan_version && cur->ws_info->pan_information.pan_version % RPL_VERSION_LIFETIME / PAN_VERSION_LIFETIME == 0) {
// Third the rate of configuration version change at default 5 hours
rpl_control_increment_dodag_version(protocol_6lowpan_rpl_root_dodag);
}
}

Expand Down
15 changes: 10 additions & 5 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static bool ws_nud_message_build(protocol_interface_info_entry_t *cur, mac_neigh
memcpy(ll_target, ADDR_LINK_LOCAL_PREFIX, 8);
memcpy(ll_target + 8, neighbor->mac64, 8);
ll_target[8] ^= 2;
tr_debug("NUD generate NS %u", neighbor->index);
tr_info("NUD generate NS %u", neighbor->index);
buffer_t * buffer = icmpv6_build_ns(cur, ll_target, NULL, true, false, NULL);
if (buffer) {
protocol_push(buffer);
Expand All @@ -253,11 +253,17 @@ static bool ws_nud_message_build(protocol_interface_info_entry_t *cur, mac_neigh
return false;
}

void ws_nud_active_timer(protocol_interface_info_entry_t *cur, uint16_t time_in_ms)
void ws_nud_active_timer(protocol_interface_info_entry_t *cur, uint16_t ticks)
{
//Convert TICKS to real milliseconds
if (ticks > 0xffff / 100) {
ticks = 0xffff;
} else {
ticks *= 100;
}

ns_list_foreach_safe(ws_nud_table_entry_t, entry, &cur->ws_info->active_nud_process) {
if (entry->timer <= time_in_ms) {
if (entry->timer <= ticks) {
//TX Process or timeout
if (entry->wait_response) {
//Timeout for NUD or Probe
Expand Down Expand Up @@ -293,7 +299,7 @@ void ws_nud_active_timer(protocol_interface_info_entry_t *cur, uint16_t time_in_
}
}
} else {
entry->timer -= time_in_ms;
entry->timer -= ticks;
}
}
}
Expand Down Expand Up @@ -1878,7 +1884,6 @@ void ws_bootstrap_network_scan_process(protocol_interface_info_entry_t *cur)
return;
}

//ws_bootstrap_primary_parent_set(cur, &neighbor_info);
ws_bootstrap_network_information_learn(cur);
ws_bootstrap_fhss_activate(cur);
ws_bootstrap_event_authentication_start(cur);
Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/ws/ws_bootstrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void ws_primary_parent_update(protocol_interface_info_entry_t *interface, mac_ne

void ws_nud_entry_remove_active(protocol_interface_info_entry_t *cur, void *neighbor);

void ws_nud_active_timer(protocol_interface_info_entry_t *cur, uint16_t time_in_ms);
void ws_nud_active_timer(protocol_interface_info_entry_t *cur, uint16_t ticks);

#else

Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/ws/ws_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void ws_common_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seco
void ws_common_fast_timer(protocol_interface_info_entry_t *cur, uint16_t ticks)
{
ws_bootstrap_trickle_timer(cur, ticks);
ws_nud_active_timer(cur, 100);
ws_nud_active_timer(cur, ticks);
}


Expand Down
2 changes: 2 additions & 0 deletions source/6LoWPAN/ws/ws_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

#define PAN_VERSION_LIFETIME 240

#define RPL_VERSION_LIFETIME 5*3600

/* Border router connection lost timeout
*
* Interval within which a node expects to detect a change in PAN Version
Expand Down

0 comments on commit a2b8491

Please sign in to comment.