Skip to content

Commit 72b26a7

Browse files
author
Mika Tervonen
committed
Created extra large network setup for Wi-SUN
Created support for larger than 2500 device networks BBR version updated in 8 hours interval Added new latency step for networks larger than 1500 nodes
1 parent 38dd4a6 commit 72b26a7

File tree

8 files changed

+193
-24
lines changed

8 files changed

+193
-24
lines changed

nanostack/ws_management_api.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,16 @@ extern "C" {
7575
#define CHANNEL_SPACING_100 0x03 // 100 khz
7676
#define CHANNEL_SPACING_250 0x04 // 250 khz
7777

78-
#define NETWORK_SIZE_CERTIFICATE 0x00
79-
#define NETWORK_SIZE_SMALL 0x01
80-
#define NETWORK_SIZE_MEDIUM 0x08
81-
#define NETWORK_SIZE_LARGE 0x10
78+
/*
79+
* Network Size definitions are device amount in hundreds of devices.
80+
* These definitions are meant to give some estimates of sizes. Any value can be given as parameter
81+
*/
82+
83+
#define NETWORK_SIZE_CERTIFICATE 0x00 // Network configuration used in Wi-SUN certification
84+
#define NETWORK_SIZE_SMALL 0x01 // Small networks
85+
#define NETWORK_SIZE_MEDIUM 0x08 // 100 - 800 device networks are medium sized
86+
#define NETWORK_SIZE_LARGE 0x0F // 800 - 1500 device networks are large
87+
#define NETWORK_SIZE_XLARGE 0x19 // 2500+ devices
8288
#define NETWORK_SIZE_AUTOMATIC 0xFF
8389

8490
/** Temporary API change flag. this will be removed when new version of API is implemented on applications
@@ -229,9 +235,9 @@ int ws_management_regulatory_domain_validate(
229235
*
230236
* timing parameters follows the specification example from Wi-SUN specification
231237
*
232-
* Default value: medium
233-
* small network size: hundreds of devices
234-
* Large network size: thousands of devices
238+
* Default value: medium 100 - 800 device
239+
* small network size: less than 100 devices
240+
* Large network size: 800 - 1500 devices
235241
* automatic: when discovering the network network size is learned
236242
* from advertisements and timings adjusted accordingly
237243
*

source/6LoWPAN/ws/ws_bbr_api.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ static void ws_bbr_rpl_version_timer_start(protocol_interface_info_entry_t *cur,
9999
cur->ws_info->rpl_version_timer = RPL_VERSION_LIFETIME_RESTART_SMALL;
100100
} else if (cur->ws_info->cfg->gen.network_size <= NETWORK_SIZE_MEDIUM) {
101101
cur->ws_info->rpl_version_timer = RPL_VERSION_LIFETIME_RESTART_MEDIUM;
102-
} else {
102+
} else if (cur->ws_info->cfg->gen.network_size <= NETWORK_SIZE_LARGE) {
103103
cur->ws_info->rpl_version_timer = RPL_VERSION_LIFETIME_RESTART_LARGE;
104+
} else {
105+
cur->ws_info->rpl_version_timer = RPL_VERSION_LIFETIME_RESTART_EXTRA_LARGE;
104106
}
105107
}
106108
}

source/6LoWPAN/ws/ws_cfg_settings.c

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ static int8_t ws_cfg_to_get(ws_cfgs_t **cfg, ws_cfgs_t *new_cfg, ws_cfg_validate
8282
static void ws_cfg_network_size_config_set_small(ws_cfg_nw_size_t *cfg);
8383
static void ws_cfg_network_size_config_set_medium(ws_cfg_nw_size_t *cfg);
8484
static void ws_cfg_network_size_config_set_large(ws_cfg_nw_size_t *cfg);
85+
static void ws_cfg_network_size_config_set_xlarge(ws_cfg_nw_size_t *cfg);
8586
static void ws_cfg_network_size_config_set_certificate(ws_cfg_nw_size_t *cfg);
8687
static int8_t ws_cfg_network_size_default_set(ws_gen_cfg_t *cfg);
8788
static int8_t ws_cfg_gen_default_set(ws_gen_cfg_t *cfg);
@@ -261,8 +262,10 @@ int8_t ws_cfg_network_size_set(protocol_interface_info_entry_t *cur, ws_gen_cfg_
261262
set_function = ws_cfg_network_size_config_set_small;
262263
} else if (cfg->network_size <= NETWORK_SIZE_MEDIUM) {
263264
set_function = ws_cfg_network_size_config_set_medium;
264-
} else {
265+
} else if (cfg->network_size <= NETWORK_SIZE_LARGE) {
265266
set_function = ws_cfg_network_size_config_set_large;
267+
} else {
268+
set_function = ws_cfg_network_size_config_set_xlarge;
266269
}
267270

268271
// Overrides the values on the new configuration
@@ -334,9 +337,12 @@ int8_t ws_cfg_network_size_configure(protocol_interface_info_entry_t *cur, uint1
334337
} else if (network_size < 800) {
335338
// Medium
336339
ws_cfg_network_size_config_set_medium(&new_nw_size_cfg);
340+
} else if (network_size < 1500) {
341+
// Medium
342+
ws_cfg_network_size_config_set_large(&new_nw_size_cfg);
337343
} else {
338344
// Large
339-
ws_cfg_network_size_config_set_large(&new_nw_size_cfg);
345+
ws_cfg_network_size_config_set_xlarge(&new_nw_size_cfg);
340346
}
341347

342348
ws_cfg_gen_set(cur, NULL, &new_nw_size_cfg.gen, &flags);
@@ -449,18 +455,46 @@ static void ws_cfg_network_size_config_set_large(ws_cfg_nw_size_t *cfg)
449455

450456
cfg->sec_prot.sec_max_ongoing_authentication = MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_LARGE;
451457

452-
if (cfg->gen.network_size > NETWORK_SIZE_LARGE && cfg->gen.network_size != NETWORK_SIZE_AUTOMATIC) {
453-
// If more than 1600 devices uses extra large initial trickle timer
454-
cfg->sec_prot.initial_key_retry_delay = NONE_INITIAL_KEY_RETRY_TIMER;
455-
cfg->sec_prot.initial_key_imin = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS;
456-
cfg->sec_prot.initial_key_imax = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS;
457-
cfg->sec_prot.initial_key_retry_cnt = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_COUNT;
458-
} else {
459-
cfg->sec_prot.initial_key_retry_delay = NONE_INITIAL_KEY_RETRY_TIMER;
460-
cfg->sec_prot.initial_key_imin = LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS;
461-
cfg->sec_prot.initial_key_imax = LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS;
462-
cfg->sec_prot.initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT;
463-
}
458+
cfg->sec_prot.initial_key_retry_delay = NONE_INITIAL_KEY_RETRY_TIMER;
459+
cfg->sec_prot.initial_key_imin = LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS;
460+
cfg->sec_prot.initial_key_imax = LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS;
461+
cfg->sec_prot.initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT;
462+
}
463+
464+
static void ws_cfg_network_size_config_set_xlarge(ws_cfg_nw_size_t *cfg)
465+
{
466+
// Configure the Wi-SUN parent configuration
467+
cfg->gen.rpl_parent_candidate_max = WS_RPL_PARENT_CANDIDATE_MAX;
468+
cfg->gen.rpl_selected_parent_max = WS_RPL_SELECTED_PARENT_MAX;
469+
470+
// Configure the Wi-SUN timing trickle parameters
471+
cfg->timing.disc_trickle_imin = TRICKLE_IMIN_60_SECS << 2; // 240 seconds
472+
cfg->timing.disc_trickle_imax = 1920; // 1920 seconds; 32 minutes
473+
cfg->timing.disc_trickle_k = 1;
474+
cfg->timing.pan_timeout = PAN_VERSION_XLARGE_NETWORK_TIMEOUT;
475+
cfg->timing.temp_link_min_timeout = WS_NEIGHBOR_TEMPORARY_LINK_MIN_TIMEOUT_LARGE;
476+
cfg->timing.temp_eapol_min_timeout = WS_EAPOL_TEMPORARY_ENTRY_LARGE_TIMEOUT;
477+
478+
// RPL configuration
479+
cfg->bbr.dio_interval_min = WS_RPL_DIO_IMIN_XLARGE; // 18; 262s, 4.5min
480+
cfg->bbr.dio_interval_doublings = WS_RPL_DIO_DOUBLING_XLARGE; // 4; 2048s, 34min
481+
cfg->bbr.dio_redundancy_constant = WS_RPL_DIO_REDUNDANCY_XLARGE; // 10
482+
cfg->bbr.dag_max_rank_increase = WS_RPL_MAX_HOP_RANK_INCREASE;
483+
cfg->bbr.min_hop_rank_increase = WS_RPL_MIN_HOP_RANK_INCREASE;
484+
cfg->bbr.dhcp_address_lifetime = WS_DHCP_ADDRESS_LIFETIME_LARGE;
485+
486+
// EAPOL configuration
487+
cfg->sec_prot.sec_prot_trickle_imin = SEC_PROT_LARGE_IMIN;
488+
cfg->sec_prot.sec_prot_trickle_imax = SEC_PROT_LARGE_IMAX;
489+
cfg->sec_prot.sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS;
490+
cfg->sec_prot.sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_LARGE;
491+
492+
cfg->sec_prot.sec_max_ongoing_authentication = MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_LARGE;
493+
494+
cfg->sec_prot.initial_key_retry_delay = NONE_INITIAL_KEY_RETRY_TIMER;
495+
cfg->sec_prot.initial_key_imin = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS;
496+
cfg->sec_prot.initial_key_imax = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS;
497+
cfg->sec_prot.initial_key_retry_cnt = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_COUNT;
464498
}
465499

466500
static void ws_cfg_network_size_config_set_certificate(ws_cfg_nw_size_t *cfg)

source/6LoWPAN/ws/ws_common.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,10 @@ uint32_t ws_common_latency_estimate_get(protocol_interface_info_entry_t *cur)
435435
latency = 4000;
436436
} else if (network_size <= NETWORK_SIZE_MEDIUM) {
437437
latency = 8000;
438-
} else {
438+
} else if (network_size <= NETWORK_SIZE_LARGE) {
439439
latency = 16000;
440+
} else {
441+
latency = 24000;
440442
}
441443

442444
return latency;

source/6LoWPAN/ws/ws_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
#define WS_RPL_DIO_DOUBLING_LARGE 3
4040
#define WS_RPL_DIO_REDUNDANCY_LARGE 10 // May need some tuning still
4141

42+
#define WS_RPL_DIO_IMIN_XLARGE 18
43+
#define WS_RPL_DIO_DOUBLING_XLARGE 4
44+
#define WS_RPL_DIO_REDUNDANCY_XLARGE 10 // May need some tuning still
45+
4246
#define WS_RPL_DIO_IMIN_AUTOMATIC 14
4347
#define WS_RPL_DIO_DOUBLING_AUTOMATIC 3
4448
#define WS_RPL_DIO_REDUNDANCY_AUTOMATIC 0
@@ -88,6 +92,8 @@
8892

8993
#define PAN_VERSION_LARGE_NETWORK_TIMEOUT 90*60
9094

95+
#define PAN_VERSION_XLARGE_NETWORK_TIMEOUT 120*60
96+
9197
/* Routing Cost Weighting factor
9298
*/
9399
#define PRC_WEIGHT_FACTOR 256

test/nanostack/unittest/6LoWPAN/ws_cfg_settings/test_ws_cfg_settings.c

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static const ws_cfg_t ws_cfg_defaults_small = {
184184

185185
// large network size
186186
static const ws_cfg_t ws_cfg_defaults_large = {
187-
.gen.network_size = 0x10, // network size affects
187+
.gen.network_size = 0x0f, // network size affects
188188
.gen.network_name = 0,
189189
.gen.network_pan_id = 65535,
190190
.gen.rpl_parent_candidate_max = 5, // network size affects
@@ -251,6 +251,75 @@ static const ws_cfg_t ws_cfg_defaults_large = {
251251
.sec_prot.initial_key_retry_cnt = 2, // network size affects
252252
};
253253

254+
// large network size
255+
static const ws_cfg_t ws_cfg_defaults_xlarge = {
256+
.gen.network_size = 0x19, // network size affects
257+
.gen.network_name = 0,
258+
.gen.network_pan_id = 65535,
259+
.gen.rpl_parent_candidate_max = 5, // network size affects
260+
.gen.rpl_selected_parent_max = 2, // network size affects
261+
262+
.phy.regulatory_domain = 3,
263+
.phy.operating_class = 2,
264+
.phy.operating_mode = 3,
265+
266+
.timing.disc_trickle_imin = 240, // network size affects
267+
.timing.disc_trickle_imax = 1920, // network size affects
268+
.timing.disc_trickle_k = 1, // network size affects
269+
.timing.pan_timeout = 120 * 60, // network size affects
270+
.timing.temp_link_min_timeout = 520, // network size affects
271+
.timing.temp_eapol_min_timeout = 750,
272+
273+
.bbr.dio_interval_min = 18, // network size affects
274+
.bbr.dio_interval_doublings = 4, // network size affects
275+
.bbr.dio_redundancy_constant = 10, // network size affects
276+
.bbr.dag_max_rank_increase = 2048, // network size affects
277+
.bbr.min_hop_rank_increase = 196, // network size affects
278+
.bbr.dhcp_address_lifetime = 24 * 3600,
279+
280+
.fhss.fhss_uc_dwell_interval = 255,
281+
.fhss.fhss_bc_dwell_interval = 255,
282+
.fhss.fhss_bc_interval = 1020,
283+
.fhss.fhss_uc_channel_function = 2,
284+
.fhss.fhss_bc_channel_function = 2,
285+
.fhss.fhss_uc_fixed_channel = 65535,
286+
.fhss.fhss_bc_fixed_channel = 65535,
287+
.fhss.fhss_channel_mask[0] = 0xffffffff,
288+
.fhss.fhss_channel_mask[1] = 0xffffffff,
289+
.fhss.fhss_channel_mask[2] = 0xffffffff,
290+
.fhss.fhss_channel_mask[3] = 0xffffffff,
291+
.fhss.fhss_channel_mask[4] = 0xffffffff,
292+
.fhss.fhss_channel_mask[5] = 0xffffffff,
293+
.fhss.fhss_channel_mask[6] = 0xffffffff,
294+
.fhss.fhss_channel_mask[7] = 0xffffffff,
295+
296+
.mpl.mpl_trickle_imin = 10,
297+
.mpl.mpl_trickle_imax = 80,
298+
.mpl.mpl_trickle_k = 8,
299+
.mpl.mpl_trickle_timer_exp = 3,
300+
.mpl.seed_set_entry_lifetime = 7680,
301+
302+
.sec_timer.gtk_expire_offset = 43200,
303+
.sec_timer.pmk_lifetime = 172800,
304+
.sec_timer.ptk_lifetime = 86400,
305+
.sec_timer.gtk_new_act_time = 720,
306+
.sec_timer.revocat_lifetime_reduct = 30,
307+
.sec_timer.gtk_request_imin = 4,
308+
.sec_timer.gtk_request_imax = 64,
309+
.sec_timer.gtk_max_mismatch = 64,
310+
.sec_timer.gtk_new_install_req = 80,
311+
312+
.sec_prot.sec_prot_retry_timeout = 750, // network size affects
313+
.sec_prot.sec_prot_trickle_imin = 60, // network size affects
314+
.sec_prot.sec_prot_trickle_imax = 240, // network size affects
315+
.sec_prot.sec_prot_trickle_timer_exp = 2, // network size affects
316+
.sec_prot.sec_max_ongoing_authentication = 50, // network size affects
317+
.sec_prot.initial_key_retry_delay = 0, // network size affects
318+
.sec_prot.initial_key_imin = 600, // network size affects
319+
.sec_prot.initial_key_imax = 1200, // network size affects
320+
.sec_prot.initial_key_retry_cnt = 4, // network size affects
321+
};
322+
254323
// certification network size
255324
static const ws_cfg_t ws_cfg_defaults_certification = {
256325
.gen.network_size = 0x00, // network size affects
@@ -441,6 +510,12 @@ bool test_ws_cfg_network_size_set_3()
441510
}
442511

443512
if (memcmp(&ws_cfg_defaults_large, &new_cfg, sizeof(ws_cfg_t)) != 0) {
513+
/*uint8_t *d1, *d2;
514+
d1 = &ws_cfg_defaults_large;
515+
d2 = &new_cfg;
516+
for (int n = 0; n < sizeof(ws_cfg_t); n++) {
517+
printf(" %u = %u %s\n", d1[n], d2[n], d1[n] != d2[n] ? "FAIL" : "");
518+
}*/
444519
return false;
445520
}
446521

@@ -524,6 +599,44 @@ bool test_ws_cfg_network_size_set_6()
524599
return true;
525600
}
526601

602+
bool test_ws_cfg_network_size_set_7()
603+
{
604+
if (ws_cfg_settings_init() < 0) {
605+
return false;
606+
}
607+
608+
ws_gen_cfg_t cfg;
609+
if (ws_cfg_network_size_get(&cfg, NULL) < 0) {
610+
return false;
611+
}
612+
613+
cfg.network_size = NETWORK_SIZE_XLARGE;
614+
615+
// Sets large settings
616+
if (ws_cfg_network_size_set(NULL, NULL, &cfg, 0) < 0) {
617+
return false;
618+
}
619+
620+
// Gets modified settings and verifies
621+
ws_cfg_t new_cfg;
622+
if (ws_cfg_settings_get(NULL, &new_cfg) < 0) {
623+
return false;
624+
}
625+
626+
if (memcmp(&ws_cfg_defaults_xlarge, &new_cfg, sizeof(ws_cfg_t)) != 0) {
627+
/*uint8_t *d1, *d2;
628+
d1 = &ws_cfg_defaults_xlarge;
629+
d2 = &new_cfg;
630+
for(int n = 0; n < sizeof(ws_cfg_t); n++) {
631+
printf(" %u = %u %s\n",d1[n], d2[n], d1[n] != d2[n]?"FAIL":"");
632+
}*/
633+
634+
return false;
635+
}
636+
637+
return true;
638+
}
639+
527640
bool test_ws_cfg_network_size_functions_1()
528641
{
529642
if (ws_cfg_settings_init() < 0) {

test/nanostack/unittest/6LoWPAN/ws_cfg_settings/test_ws_cfg_settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ bool test_ws_cfg_network_size_set_2();
3232
bool test_ws_cfg_network_size_set_3();
3333
bool test_ws_cfg_network_size_set_4();
3434
bool test_ws_cfg_network_size_set_5();
35+
bool test_ws_cfg_network_size_set_7();
3536

3637
bool test_ws_cfg_network_size_functions_1();
3738
bool test_ws_cfg_network_size_functions_2();

test/nanostack/unittest/6LoWPAN/ws_cfg_settings/ws_cfg_settings_test.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ TEST(ws_cfg_settings, test_ws_cfg_network_size_set_5)
6363
CHECK(test_ws_cfg_network_size_set_5());
6464
}
6565

66+
TEST(ws_cfg_settings, test_ws_cfg_network_size_set_7)
67+
{
68+
CHECK(test_ws_cfg_network_size_set_7());
69+
}
70+
6671
TEST(ws_cfg_settings, test_ws_cfg_network_size_functions_1)
6772
{
6873
CHECK(test_ws_cfg_network_size_functions_1());

0 commit comments

Comments
 (0)