Skip to content

Commit b9d1409

Browse files
author
Juha Heiskanen
committed
Wi-sun config message consustent filter
Wi-sun config asych message may RX multile time with fhss system. When new pan version heared we reset trickle. RX same message at following channels suppress new version advertisment. This PR add 10 seconds filter period for fix a problem. Change-Id: Ic1f3131496698ebc0e1f2d551e6dfa494b3e1337
1 parent dcebff9 commit b9d1409

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@ void ws_bootstrap_configuration_reset(protocol_interface_info_entry_t *cur)
823823
cur->ws_info->trickle_pa_running = false;
824824
cur->ws_info->trickle_pcs_running = false;
825825
cur->ws_info->trickle_pc_running = false;
826+
cur->ws_info->trickle_pc_consistency_block_period = 0;
826827

827828
//cur->mac_security_key_usage_update_cb = ws_management_mac_security_key_update_cb;
828829
return;
@@ -1248,8 +1249,12 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
12481249
if (cur->ws_info->configuration_learned) {
12491250
tr_info("PAN Config analyse own:%d, heard:%d", cur->ws_info->pan_information.pan_version, pan_version);
12501251
if (cur->ws_info->pan_information.pan_version == pan_version) {
1251-
// Same version heard so it is consistent
1252-
trickle_consistent_heard(&cur->ws_info->trickle_pan_config);
1252+
//Check if Trgigle have been resetted in short time skip this then
1253+
if (cur->ws_info->trickle_pc_consistency_block_period == 0) {
1254+
// Same version heard so it is consistent
1255+
trickle_consistent_heard(&cur->ws_info->trickle_pan_config);
1256+
}
1257+
12531258
if (neighbour_pointer_valid && neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) {
12541259
ws_bootstrap_primary_parent_set(cur, &neighbor_info, WS_PARENT_SOFT_SYNCH);
12551260
}
@@ -1265,6 +1270,7 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
12651270
// older version heard ignoring the message
12661271
return;
12671272
}
1273+
cur->ws_info->trickle_pc_consistency_block_period = WS_CONFIG_CONSISTENT_FILTER_PERIOD;
12681274
}
12691275
}
12701276

@@ -2315,6 +2321,7 @@ static void ws_bootstrap_advertise_start(protocol_interface_info_entry_t *cur)
23152321
cur->ws_info->trickle_pa_running = true;
23162322
trickle_start(&cur->ws_info->trickle_pan_advertisement, &cur->ws_info->trickle_params_pan_discovery);
23172323
cur->ws_info->trickle_pc_running = true;
2324+
cur->ws_info->trickle_pc_consistency_block_period = 0;
23182325
trickle_start(&cur->ws_info->trickle_pan_config, &cur->ws_info->trickle_params_pan_discovery);
23192326
}
23202327

@@ -2712,6 +2719,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
27122719
cur->ws_info->trickle_pc_running = false;
27132720
cur->ws_info->trickle_pas_running = false;
27142721
cur->ws_info->trickle_pcs_running = false;
2722+
cur->ws_info->trickle_pc_consistency_block_period = 0;
27152723

27162724
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
27172725
tr_info("Border router start network");
@@ -2779,6 +2787,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
27792787
cur->ws_info->trickle_pc_running = false;
27802788
cur->ws_info->trickle_pas_running = false;
27812789
cur->ws_info->trickle_pcs_running = false;
2790+
cur->ws_info->trickle_pc_consistency_block_period = 0;
27822791

27832792
// Build list of possible neighbours and learn first broadcast schedule
27842793

@@ -2791,6 +2800,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
27912800
cur->ws_info->trickle_pc_running = false;
27922801
cur->ws_info->trickle_pas_running = false;
27932802
cur->ws_info->trickle_pcs_running = false;
2803+
cur->ws_info->trickle_pc_consistency_block_period = 0;
27942804
// Activate RPL
27952805
// Activate IPv6 stack
27962806
ws_bootstrap_ip_stack_activate(cur);
@@ -2810,6 +2820,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
28102820
cur->ws_info->trickle_pc_running = false;
28112821
cur->ws_info->trickle_pas_running = false;
28122822
cur->ws_info->trickle_pcs_running = false;
2823+
cur->ws_info->trickle_pc_consistency_block_period = 0;
28132824

28142825
// Indicate PAE controller that bootstrap is ready
28152826
ws_pae_controller_bootstrap_done(cur);
@@ -2969,6 +2980,7 @@ void ws_bootstrap_state_machine(protocol_interface_info_entry_t *cur)
29692980
cur->ws_info->trickle_pc_running = false;
29702981
cur->ws_info->trickle_pas_running = false;
29712982
cur->ws_info->trickle_pcs_running = false;
2983+
cur->ws_info->trickle_pc_consistency_block_period = 0;
29722984
ws_fhss_configure(cur, false);
29732985
ws_bootstrap_start_authentication(cur);
29742986
break;
@@ -3029,11 +3041,21 @@ void ws_bootstrap_trickle_timer(protocol_interface_info_entry_t *cur, uint16_t t
30293041
tr_info("Send PAN advertisement");
30303042
ws_bootstrap_pan_advert(cur);
30313043
}
3032-
if (cur->ws_info->trickle_pc_running &&
3033-
trickle_timer(&cur->ws_info->trickle_pan_config, &cur->ws_info->trickle_params_pan_discovery, ticks)) {
3034-
// send PAN Configuration
3035-
tr_info("Send PAN configuration");
3036-
ws_bootstrap_pan_config(cur);
3044+
if (cur->ws_info->trickle_pc_running) {
3045+
3046+
if (cur->ws_info->trickle_pc_consistency_block_period) {
3047+
if (ticks >= cur->ws_info->trickle_pc_consistency_block_period) {
3048+
cur->ws_info->trickle_pc_consistency_block_period = 0;
3049+
} else {
3050+
cur->ws_info->trickle_pc_consistency_block_period -= ticks;
3051+
}
3052+
}
3053+
3054+
if (trickle_timer(&cur->ws_info->trickle_pan_config, &cur->ws_info->trickle_params_pan_discovery, ticks)) {
3055+
// send PAN Configuration
3056+
tr_info("Send PAN configuration");
3057+
ws_bootstrap_pan_config(cur);
3058+
}
30373059
}
30383060
}
30393061

source/6LoWPAN/ws/ws_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ typedef struct ws_info_s {
9797
bool trickle_pa_running: 1;
9898
bool trickle_pcs_running: 1;
9999
bool trickle_pc_running: 1;
100+
uint16_t trickle_pc_consistency_block_period;
100101
ws_pending_key_index_t pending_key_index_info;
101102
// default fhss parameters for this device
102103
uint8_t fhss_uc_dwell_interval;

source/6LoWPAN/ws/ws_common_defines.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ typedef struct ws_bs_ie {
249249
*/
250250
#define WS_TACK_MAX_MS 5
251251

252+
/*
253+
* Config new version consistent filter period in 100ms periods
254+
*/
255+
#define WS_CONFIG_CONSISTENT_FILTER_PERIOD 100
256+
252257
// With FHSS we need to check CCA twice on TX channel
253258
#define WS_NUMBER_OF_CSMA_PERIODS 2
254259
// Interval between two CCA checks

0 commit comments

Comments
 (0)