Skip to content

Commit

Permalink
WS PAN config message handler update
Browse files Browse the repository at this point in the history
Update synch info only for configured parent after configuration is learned.

Change-Id: I27adeca5103bd7fb80f558e49d50d7625d50f900
  • Loading branch information
Juha Heiskanen committed Oct 23, 2018
1 parent ab1260a commit a156355
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ static int8_t ws_fhss_enable(protocol_interface_info_entry_t *cur)
/* Sets the parent and broadcast schedule we are following
*
*/
static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry *cur, llc_neighbour_req_t *neighbor_info)
static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry *cur, llc_neighbour_req_t *neighbor_info, bool force_synch)
{

fhss_ws_configuration_t fhss_configuration;
Expand Down Expand Up @@ -498,7 +498,7 @@ static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry
ns_fhss_ws_configuration_set(cur->ws_info->fhss_api, &fhss_configuration);

// We have broadcast schedule set up set the broadcast parent schedule
ns_fhss_ws_set_parent(cur->ws_info->fhss_api, neighbor_info->neighbor->mac64, &neighbor_info->ws_neighbor->fhss_data.bc_timing_info, true);
ns_fhss_ws_set_parent(cur->ws_info->fhss_api, neighbor_info->neighbor->mac64, &neighbor_info->ws_neighbor->fhss_data.bc_timing_info, force_synch);

// Update LLC to follow updated fhss settings
ws_bootstrap_llc_hopping_update(cur,&fhss_configuration);
Expand Down Expand Up @@ -930,16 +930,18 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
return;
}

//Update synch to primary parent allways to update broadcast shedule and timing
if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) {
// RPL priority parent configuration we must update FHSS data
ws_bootstrap_primary_parent_set(cur, &neighbor_info);
}
if (cur->ws_info->configuration_learned ) {
bool old_version = cur->ws_info->pan_information.pan_version == pan_version;
if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) {
// RPL priority parent configuration we must update FHSS data
//Update synch to primary parent allways to update broadcast shedule and timing
ws_bootstrap_primary_parent_set(cur, &neighbor_info, !old_version);
}

if (cur->ws_info->configuration_learned &&
cur->ws_info->pan_information.pan_version == pan_version) {
// No new information
return;
if (old_version) {
// No new information
return;
}
}

/*
Expand All @@ -958,13 +960,10 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
// return to state machine after 1-2 s
cur->bootsrap_state_machine_cnt = randLIB_get_random_in_range(10 ,20);
// enable frequency hopping for unicast channel and start listening first neighbour
ws_bootstrap_primary_parent_set(cur, &neighbor_info);
ws_bootstrap_primary_parent_set(cur, &neighbor_info, true);
// set neighbor as priority parent clear if there is others
protocol_6lowpan_neighbor_priority_clear_all(cur->id, PRIORITY_1ST);
neighbor_info.neighbor->link_role = PRIORITY_PARENT_NEIGHBOUR;
} else if (neighbor_info.neighbor->link_role != PRIORITY_PARENT_NEIGHBOUR) {
//This cuold affect serious problem if BC parameters are changed
ws_bootstrap_primary_parent_set(cur, &neighbor_info);
}
}

Expand Down Expand Up @@ -2138,7 +2137,7 @@ void ws_primary_parent_update(protocol_interface_info_entry_t *interface, mac_ne
llc_neighbour_req_t neighbor_info;
neighbor_info.neighbor = neighbor;
neighbor_info.ws_neighbor = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, neighbor->index);
ws_bootstrap_primary_parent_set(interface, &neighbor_info);
ws_bootstrap_primary_parent_set(interface, &neighbor_info, true);

ws_secondary_parent_update(interface);
}
Expand Down

0 comments on commit a156355

Please sign in to comment.