Skip to content

Commit 161421b

Browse files
author
Juha Heiskanen
committed
Wi-sun PAN_VERSION lifetime and timeout update
Lifetime and timeout will be now dynamic and based on network size. Small network setup: PAN_TIMEOUT 32 min version lifetime 4 min. Medium network setup: PAN_TIMEOUT 64 min version lifetime 15 min. Large network setup: PAN_TIMEOUT 90 min version lifetime 30 min. Change-Id: I58ae12d4dc5d4d5804ac4fabadb6f2cfcf8dc034
1 parent 43083ed commit 161421b

File tree

5 files changed

+47
-6
lines changed

5 files changed

+47
-6
lines changed

source/6LoWPAN/ws/ws_bbr_api.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ void ws_bbr_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds
467467
} else {
468468
// Border router has timed out
469469
tr_debug("Border router version number update");
470-
cur->ws_info->pan_version_timer = PAN_VERSION_LIFETIME;
470+
cur->ws_info->pan_version_timer = ws_common_version_lifetime_get(cur->ws_info->network_size_config);
471471
cur->ws_info->pan_information.pan_version++;
472472
// Inconsistent for border router to make information distribute faster
473473
ws_bootstrap_configuration_trickle_reset(cur);
@@ -478,7 +478,7 @@ void ws_bbr_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds
478478
// We update the RPL version in same time to allow nodes to reselect parent
479479
// As configuration is made so that devices cant move downward in dodag this allows it
480480
// Version number update is only done if DoDAG MAX Rank Increase parameter is 0
481-
if (rpl_conf.dag_max_rank_increase == 0 && cur->ws_info->pan_information.pan_version && cur->ws_info->pan_information.pan_version % RPL_VERSION_LIFETIME / PAN_VERSION_LIFETIME == 0) {
481+
if (rpl_conf.dag_max_rank_increase == 0 && cur->ws_info->pan_information.pan_version && cur->ws_info->pan_information.pan_version % RPL_VERSION_LIFETIME / cur->ws_info->pan_version_timer == 0) {
482482
// Third the rate of configuration version change at default 5 hours
483483
rpl_control_increment_dodag_version(protocol_6lowpan_rpl_root_dodag);
484484
}
@@ -619,3 +619,4 @@ int ws_bbr_node_access_revoke_start(int8_t interface_id)
619619
return -1;
620620
#endif
621621
}
622+

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
11261126
tr_info("Updated PAN configuration own:%d, heard:%d", cur->ws_info->pan_information.pan_version, pan_version);
11271127

11281128
// restart PAN version timer
1129-
cur->ws_info->pan_version_timeout_timer = PAN_VERSION_TIMEOUT;
1129+
cur->ws_info->pan_version_timeout_timer = ws_common_version_timeout_get(cur->ws_info->network_size_config);
11301130
cur->ws_info->pan_information.pan_version = pan_version;
11311131

11321132
ws_pae_controller_gtk_hash_update(cur, gtkhash_ptr);
@@ -2412,7 +2412,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
24122412

24132413
uint8_t *gtkhash = ws_pae_controller_gtk_hash_ptr_get(cur);
24142414
ws_llc_set_gtkhash(cur, gtkhash);
2415-
cur->ws_info->pan_version_timer = PAN_VERSION_LIFETIME;
2415+
cur->ws_info->pan_version_timer = ws_common_version_lifetime_get(cur->ws_info->network_size_config);
24162416

24172417
// Set default parameters for FHSS when starting a discovery
24182418
ws_fhss_border_router_configure(cur);

source/6LoWPAN/ws/ws_common.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,35 @@ void ws_common_etx_validate(protocol_interface_info_entry_t *interface, mac_neig
422422
ws_bootstrap_etx_accelerate(interface, neigh);
423423
}
424424

425+
uint32_t ws_common_version_lifetime_get(uint8_t config)
426+
{
427+
uint32_t lifetime;
428+
if (config == NETWORK_SIZE_SMALL) {
429+
lifetime = PAN_VERSION_SMALL_NETWORK_LIFETIME;
430+
} else if (config == NETWORK_SIZE_MEDIUM) {
431+
lifetime = PAN_VERSION_MEDIUM_NETWORK_LIFETIME;
432+
} else {
433+
lifetime = PAN_VERSION_LARGE_NETWORK_LIFETIME;
434+
}
435+
436+
return lifetime;
437+
438+
}
439+
440+
uint32_t ws_common_version_timeout_get(uint8_t config)
441+
{
442+
uint32_t lifetime;
443+
if (config == NETWORK_SIZE_SMALL) {
444+
lifetime = PAN_VERSION_SMALL_NETWORK_TIMEOUT;
445+
} else if (config == NETWORK_SIZE_MEDIUM) {
446+
lifetime = PAN_VERSION_MEDIUM_NETWORK_TIMEOUT;
447+
} else {
448+
lifetime = PAN_VERSION_LARGE_NETWORK_TIMEOUT;
449+
}
450+
451+
return lifetime;
452+
}
453+
425454

426455
#endif // HAVE_WS
427456

source/6LoWPAN/ws/ws_common.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ void ws_common_etx_validate(protocol_interface_info_entry_t *interface, mac_neig
126126

127127
bool ws_common_negative_aro_mark(protocol_interface_info_entry_t *interface, const uint8_t *eui64);
128128

129+
130+
uint32_t ws_common_version_lifetime_get(uint8_t config);
131+
132+
uint32_t ws_common_version_timeout_get(uint8_t config);
133+
129134
#define ws_info(cur) ((cur)->ws_info)
130135
#else
131136
#define ws_info(cur) ((ws_info_t *) NULL)

source/6LoWPAN/ws/ws_config.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
* Minimum interval at which a Border Router shall increment its PAN Version value.
3838
*/
3939

40-
#define PAN_VERSION_LIFETIME 240
40+
#define PAN_VERSION_SMALL_NETWORK_LIFETIME 4*60
41+
#define PAN_VERSION_MEDIUM_NETWORK_LIFETIME 15*60
42+
#define PAN_VERSION_LARGE_NETWORK_LIFETIME 30*60 //30min
4143

4244
#define RPL_VERSION_LIFETIME 5*3600
4345

@@ -50,7 +52,11 @@
5052
*
5153
*/
5254

53-
#define PAN_VERSION_TIMEOUT 1920
55+
#define PAN_VERSION_SMALL_NETWORK_TIMEOUT 32*60
56+
57+
#define PAN_VERSION_MEDIUM_NETWORK_TIMEOUT 64*60
58+
59+
#define PAN_VERSION_LARGE_NETWORK_TIMEOUT 90*60
5460

5561
/* Routing Cost Weighting factor
5662
*/

0 commit comments

Comments
 (0)