Skip to content

Commit 02fce65

Browse files
author
Juha Heiskanen
committed
Parent select and pan config handler update
We will check that we have know minimal BC timing info for select parent. If own BC shedules is possible we must know shedule before check parent. Pan config is now update primary parent even version number is same. Pan config new version also synch FHSS temporary to latest sended Pan config. Change-Id: I57172319a7d20eadb405bdc78087c03e9ee219f0
1 parent a2ef56a commit 02fce65

File tree

3 files changed

+55
-19
lines changed

3 files changed

+55
-19
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -451,28 +451,30 @@ static int8_t ws_fhss_enable(protocol_interface_info_entry_t *cur)
451451
*/
452452
static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry *cur, llc_neighbour_req_t *neighbor_info)
453453
{
454-
if (neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_dwell_interval == 0 ||
455-
neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_interval == 0) {
456-
tr_debug("Parent synch fail by missing BT information");
454+
455+
fhss_ws_configuration_t fhss_configuration;
456+
if (!neighbor_info->ws_neighbor->broadcast_timing_info_stored) {
457+
tr_error("No BC timing info for set new parent");
457458
return;
458459
}
459460

460-
461-
fhss_ws_configuration_t fhss_configuration;
462461
memcpy(&fhss_configuration, ns_fhss_ws_configuration_get(cur->ws_info->fhss_api), sizeof(fhss_ws_configuration_t));
463462

464463
ws_fhss_set_defaults(cur, &fhss_configuration);
465464

466465
// Learning broadcast network configuration
467-
fhss_configuration.ws_bc_channel_function = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_channel_function;
468-
if (fhss_configuration.ws_bc_channel_function == WS_FIXED_CHANNEL) {
469-
cur->ws_info->hopping_schdule.bc_fixed_channel = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.fixed_channel;
466+
if (neighbor_info->ws_neighbor->broadcast_shedule_info_stored) {
467+
fhss_configuration.ws_bc_channel_function = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_channel_function;
468+
if (fhss_configuration.ws_bc_channel_function == WS_FIXED_CHANNEL) {
469+
cur->ws_info->hopping_schdule.bc_fixed_channel = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.fixed_channel;
470+
}
471+
fhss_configuration.bsi = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_schedule_id;
472+
fhss_configuration.fhss_bc_dwell_interval = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_dwell_interval;
473+
fhss_configuration.fhss_broadcast_interval = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_interval;
474+
fhss_configuration.broadcast_fixed_channel = cur->ws_info->fhss_bc_fixed_channel;
475+
470476
}
471-
fhss_configuration.bsi = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_schedule_id;
472-
fhss_configuration.fhss_bc_dwell_interval = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_dwell_interval;
473-
fhss_configuration.fhss_broadcast_interval = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_interval;
474477
fhss_configuration.unicast_fixed_channel = cur->ws_info->fhss_uc_fixed_channel;
475-
fhss_configuration.broadcast_fixed_channel = cur->ws_info->fhss_bc_fixed_channel;
476478
ns_fhss_ws_configuration_set(cur->ws_info->fhss_api, &fhss_configuration);
477479

478480
// We have broadcast schedule set up set the broadcast parent schedule
@@ -506,11 +508,32 @@ uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr
506508
ws_neighbor_class_entry_t *ws_neighbour = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, attribute_index);
507509
etx_storage_t *etx_entry = etx_storage_entry_get(interface->id, attribute_index);
508510

509-
if (!ws_neighbour || !etx_entry || etx_entry->etx_samples < 1 ||
510-
!ws_neighbour->candidate_parent) {
511-
// if RSL value is not good enough candidate parent flag is removed and device not accepted as parent
512-
//tr_debug("ws_etx_read not valid parent");
513-
return 0xffff;
511+
if (interface->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
512+
if (!ws_neighbour || !etx_entry) {
513+
return 0xffff;
514+
}
515+
} else {
516+
517+
if (!ws_neighbour || !etx_entry || etx_entry->etx_samples < 1 ||
518+
!ws_neighbour->candidate_parent) {
519+
// if RSL value is not good enough candidate parent flag is removed and device not accepted as parent
520+
//tr_debug("ws_etx_read not valid parent");
521+
return 0xffff;
522+
}
523+
524+
//If we are not following gbobal Broadcast synch
525+
if (!interface->ws_info->pan_information.use_parent_bs) {
526+
//We must know both information's here
527+
if (!ws_neighbour->broadcast_shedule_info_stored ||
528+
!ws_neighbour->broadcast_timing_info_stored) {
529+
return 0xffff;
530+
}
531+
} else {
532+
if (!ws_neighbour->broadcast_timing_info_stored) {
533+
//Global shedule is stored already
534+
return 0xffff;
535+
}
536+
}
514537
}
515538

516539
etx = etx_local_etx_read(interface->id,attribute_index);
@@ -875,12 +898,21 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
875898
return;
876899
}
877900
}
901+
902+
878903
}
879904

880905
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
881906
//Border router does not learn network information
882907
return;
883908
}
909+
910+
//Update synch to primary parent allways to update broadcast shedule and timing
911+
if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) {
912+
// RPL priority parent configuration we must update FHSS data
913+
ws_bootstrap_primary_parent_set(cur, &neighbor_info);
914+
}
915+
884916
if (cur->ws_info->configuration_learned &&
885917
cur->ws_info->pan_information.pan_version == pan_version) {
886918
// No new information
@@ -907,8 +939,8 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
907939
// set neighbor as priority parent clear if there is others
908940
protocol_6lowpan_neighbor_priority_clear_all(cur->id, PRIORITY_1ST);
909941
neighbor_info.neighbor->link_role = PRIORITY_PARENT_NEIGHBOUR;
910-
} else if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) {
911-
// RPL priority parent configuration we must update FHSS data
942+
} else if (neighbor_info.neighbor->link_role != PRIORITY_PARENT_NEIGHBOUR) {
943+
//This cuold affect serious problem if BC parameters are changed
912944
ws_bootstrap_primary_parent_set(cur, &neighbor_info);
913945
}
914946
}

source/6LoWPAN/ws/ws_neighbor_class.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ void ws_neighbor_class_neighbor_unicast_schedule_set(ws_neighbor_class_entry_t *
104104

105105
void ws_neighbor_class_neighbor_broadcast_time_info_update(ws_neighbor_class_entry_t *ws_neighbor, ws_bt_ie_t *ws_bt_ie, uint32_t timestamp)
106106
{
107+
ws_neighbor->broadcast_timing_info_stored = true;
107108
ws_neighbor->fhss_data.bc_timing_info.bt_rx_timestamp = timestamp;
108109
ws_neighbor->fhss_data.bc_timing_info.broadcast_slot = ws_bt_ie->broadcast_slot_number;
109110
ws_neighbor->fhss_data.bc_timing_info.broadcast_interval_offset = ws_bt_ie->broadcast_interval_offset;
@@ -112,6 +113,7 @@ void ws_neighbor_class_neighbor_broadcast_time_info_update(ws_neighbor_class_ent
112113

113114
void ws_neighbor_class_neighbor_broadcast_schedule_set(ws_neighbor_class_entry_t *ws_neighbor, ws_bs_ie_t *ws_bs_ie)
114115
{
116+
ws_neighbor->broadcast_shedule_info_stored = true;
115117
ws_neighbor->fhss_data.bc_timing_info.broadcast_channel_function = ws_bs_ie->channel_function;
116118
if (ws_bs_ie->channel_function == WS_FIXED_CHANNEL) {
117119
ws_neighbor->fhss_data.bc_timing_info.fixed_channel = ws_bs_ie->function.zero.fixed_channel;

source/6LoWPAN/ws/ws_neighbor_class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ typedef struct ws_neighbor_class_entry {
2828
uint16_t rsl_in; /*!< RSL EWMA heard from neighbour*/
2929
uint16_t rsl_out; /*!< RSL EWMA heard by neighbour*/
3030
bool candidate_parent:1;
31+
bool broadcast_timing_info_stored:1;
32+
bool broadcast_shedule_info_stored:1;
3133
} ws_neighbor_class_entry_t;
3234

3335
/**

0 commit comments

Comments
 (0)