Skip to content

Commit fed5d1c

Browse files
author
Mika
committed
Created different MPL configuration based on network size
Removed automatic function calls from Bootstrap as it is not working expectedly Added support for MPL parameter configuration based on network size - small,medium,large,xlarge configurations created Border router has different configuration than nodes to ensure multicast start
1 parent 7ad7e81 commit fed5d1c

File tree

4 files changed

+188
-82
lines changed

4 files changed

+188
-82
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,12 +1492,6 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
14921492
ws_bootsrap_create_ll_address(ll_address, neighbor_info.neighbor->mac64);
14931493

14941494
if (rpl_control_is_dodag_parent(cur, ll_address)) {
1495-
// automatic network size adjustment learned
1496-
if (cur->ws_info->cfg->gen.network_size == NETWORK_SIZE_AUTOMATIC &&
1497-
cur->ws_info->pan_information.pan_size != pan_information.pan_size) {
1498-
ws_cfg_network_size_configure(cur, pan_information.pan_size);
1499-
}
1500-
15011495
cur->ws_info->pan_information.pan_size = pan_information.pan_size;
15021496
cur->ws_info->pan_information.routing_cost = pan_information.routing_cost;
15031497
cur->ws_info->pan_information.rpl_routing_method = pan_information.rpl_routing_method;

source/6LoWPAN/ws/ws_cfg_settings.c

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ typedef struct ws_cfg_nw_size_s {
5353
ws_timing_cfg_t timing; /**< Timing configuration */
5454
ws_bbr_cfg_t bbr; /**< RPL configuration */
5555
ws_sec_prot_cfg_t sec_prot; /**< Security protocols configuration */
56+
ws_mpl_cfg_t mpl; /**< Multicast timing configuration*/
5657
} ws_cfg_nw_size_t;
5758

5859
static uint32_t ws_test_temporary_entry_lifetime = 0;
@@ -136,6 +137,8 @@ static int8_t ws_cfg_to_get(ws_cfgs_t **cfg, ws_cfgs_t *new_cfg, ws_cfg_validate
136137
*cfg = (ws_cfgs_t *) &nw_size_external_cfg->bbr;
137138
} else if (ws_cfg_ptr == (ws_cfgs_t *) &ws_cfg.sec_prot) {
138139
*cfg = (ws_cfgs_t *) &nw_size_external_cfg->sec_prot;
140+
} else if (ws_cfg_ptr == (ws_cfgs_t *) &ws_cfg.mpl) {
141+
*cfg = (ws_cfgs_t *) &nw_size_external_cfg->mpl;
139142
} else {
140143
*cfg = ws_cfg_ptr;
141144
}
@@ -251,6 +254,7 @@ int8_t ws_cfg_network_size_set(protocol_interface_info_entry_t *cur, ws_gen_cfg_
251254
ws_cfg_timing_get(&nw_size_cfg.timing, NULL);
252255
ws_cfg_bbr_get(&nw_size_cfg.bbr, NULL);
253256
ws_cfg_sec_prot_get(&nw_size_cfg.sec_prot, NULL);
257+
ws_cfg_mpl_get(&nw_size_cfg.mpl, NULL);
254258

255259
ws_cfg_network_size_config_set_size set_function = NULL;
256260

@@ -300,12 +304,15 @@ int8_t ws_cfg_network_size_set(protocol_interface_info_entry_t *cur, ws_gen_cfg_
300304
old_network_size == NETWORK_SIZE_AUTOMATIC) {
301305
ws_cfg_sec_prot_set(cur, &ws_cfg.sec_prot, &nw_size_cfg.sec_prot, &set_flags);
302306
}
307+
if (ws_cfg_mpl_validate(&ws_cfg.mpl, &nw_size_cfg.mpl) == CFG_SETTINGS_CHANGED ||
308+
old_network_size == NETWORK_SIZE_AUTOMATIC) {
309+
ws_cfg_mpl_set(cur, &ws_cfg.mpl, &nw_size_cfg.mpl, &set_flags);
310+
}
303311

304312
// If is in an automatic network size mode, updates automatic configuration
305313
if (cfg->network_size == NETWORK_SIZE_AUTOMATIC && cur) {
306314
ws_cfg_network_size_configure(cur, cur->ws_info->pan_information.pan_size);
307315
}
308-
309316
return CFG_SETTINGS_OK;
310317
}
311318

@@ -319,6 +326,7 @@ int8_t ws_cfg_network_size_configure(protocol_interface_info_entry_t *cur, uint1
319326
ws_cfg_timing_get(&new_nw_size_cfg.timing, &flags);
320327
ws_cfg_bbr_get(&new_nw_size_cfg.bbr, &flags);
321328
ws_cfg_sec_prot_get(&new_nw_size_cfg.sec_prot, &flags);
329+
ws_cfg_mpl_get(&new_nw_size_cfg.mpl, &flags);
322330

323331
if (!nw_size_external_cfg) {
324332
nw_size_external_cfg = ns_dyn_mem_alloc(sizeof(ws_cfg_nw_size_t));
@@ -347,10 +355,12 @@ int8_t ws_cfg_network_size_configure(protocol_interface_info_entry_t *cur, uint1
347355
ws_cfg_timing_set(cur, NULL, &new_nw_size_cfg.timing, &flags);
348356
ws_cfg_bbr_set(cur, NULL, &new_nw_size_cfg.bbr, &flags);
349357
ws_cfg_sec_prot_set(cur, NULL, &new_nw_size_cfg.sec_prot, &flags);
358+
ws_cfg_mpl_set(cur, &ws_cfg.mpl, &new_nw_size_cfg.mpl, &flags);
350359

351360
return CFG_SETTINGS_OK;
352361
}
353362

363+
354364
static void ws_cfg_network_size_config_set_small(ws_cfg_nw_size_t *cfg)
355365
{
356366
// Configure the Wi-SUN parent configuration
@@ -385,6 +395,14 @@ static void ws_cfg_network_size_config_set_small(ws_cfg_nw_size_t *cfg)
385395
cfg->sec_prot.initial_key_imin = SMALL_NW_INITIAL_KEY_TRICKLE_IMIN_SECS;
386396
cfg->sec_prot.initial_key_imax = SMALL_NW_INITIAL_KEY_TRICKLE_IMAX_SECS;
387397
cfg->sec_prot.initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT;
398+
399+
// Multicast timing configuration
400+
cfg->mpl.mpl_trickle_imin = MPL_SMALL_IMIN;
401+
cfg->mpl.mpl_trickle_imax = MPL_SMALL_IMAX;
402+
cfg->mpl.mpl_trickle_k = MPL_SMALL_K;
403+
cfg->mpl.mpl_trickle_timer_exp = MPL_SMALL_EXPIRATIONS;
404+
cfg->mpl.seed_set_entry_lifetime = MPL_SMALL_SEED_LIFETIME;
405+
388406
}
389407

390408
static void ws_cfg_network_size_config_set_medium(ws_cfg_nw_size_t *cfg)
@@ -421,6 +439,13 @@ static void ws_cfg_network_size_config_set_medium(ws_cfg_nw_size_t *cfg)
421439
cfg->sec_prot.initial_key_imin = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMIN_SECS;
422440
cfg->sec_prot.initial_key_imax = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMAX_SECS;
423441
cfg->sec_prot.initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT;
442+
443+
// Multicast timing configuration
444+
cfg->mpl.mpl_trickle_imin = MPL_MEDIUM_IMIN;
445+
cfg->mpl.mpl_trickle_imax = MPL_MEDIUM_IMAX;
446+
cfg->mpl.mpl_trickle_k = MPL_MEDIUM_K;
447+
cfg->mpl.mpl_trickle_timer_exp = MPL_MEDIUM_EXPIRATIONS;
448+
cfg->mpl.seed_set_entry_lifetime = MPL_MEDIUM_SEED_LIFETIME;
424449
}
425450

426451
static void ws_cfg_network_size_config_set_large(ws_cfg_nw_size_t *cfg)
@@ -457,6 +482,14 @@ static void ws_cfg_network_size_config_set_large(ws_cfg_nw_size_t *cfg)
457482
cfg->sec_prot.initial_key_imin = LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS;
458483
cfg->sec_prot.initial_key_imax = LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS;
459484
cfg->sec_prot.initial_key_retry_cnt = LARGE_NW_INITIAL_KEY_RETRY_COUNT;
485+
486+
// Multicast timing configuration
487+
cfg->mpl.mpl_trickle_imin = MPL_LARGE_IMIN;
488+
cfg->mpl.mpl_trickle_imax = MPL_LARGE_IMAX;
489+
cfg->mpl.mpl_trickle_k = MPL_LARGE_K;
490+
cfg->mpl.mpl_trickle_timer_exp = MPL_LARGE_EXPIRATIONS;
491+
cfg->mpl.seed_set_entry_lifetime = MPL_LARGE_SEED_LIFETIME;
492+
460493
}
461494

462495
static void ws_cfg_network_size_config_set_xlarge(ws_cfg_nw_size_t *cfg)
@@ -493,6 +526,13 @@ static void ws_cfg_network_size_config_set_xlarge(ws_cfg_nw_size_t *cfg)
493526
cfg->sec_prot.initial_key_imin = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS;
494527
cfg->sec_prot.initial_key_imax = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS;
495528
cfg->sec_prot.initial_key_retry_cnt = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_COUNT;
529+
530+
// Multicast timing configuration
531+
cfg->mpl.mpl_trickle_imin = MPL_XLARGE_IMIN;
532+
cfg->mpl.mpl_trickle_imax = MPL_XLARGE_IMAX;
533+
cfg->mpl.mpl_trickle_k = MPL_XLARGE_K;
534+
cfg->mpl.mpl_trickle_timer_exp = MPL_XLARGE_EXPIRATIONS;
535+
cfg->mpl.seed_set_entry_lifetime = MPL_XLARGE_SEED_LIFETIME;
496536
}
497537

498538
static void ws_cfg_network_size_config_set_certificate(ws_cfg_nw_size_t *cfg)
@@ -529,6 +569,13 @@ static void ws_cfg_network_size_config_set_certificate(ws_cfg_nw_size_t *cfg)
529569
cfg->sec_prot.initial_key_imin = SMALL_NW_INITIAL_KEY_TRICKLE_IMIN_SECS;
530570
cfg->sec_prot.initial_key_imax = SMALL_NW_INITIAL_KEY_TRICKLE_IMAX_SECS;
531571
cfg->sec_prot.initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT;
572+
573+
// Multicast timing configuration for certification uses the LARGE values as it is the one mentioned ins specification
574+
cfg->mpl.mpl_trickle_imin = MPL_XLARGE_IMIN;
575+
cfg->mpl.mpl_trickle_imax = MPL_XLARGE_IMAX;
576+
cfg->mpl.mpl_trickle_k = MPL_XLARGE_K;
577+
cfg->mpl.mpl_trickle_timer_exp = MPL_XLARGE_EXPIRATIONS;
578+
cfg->mpl.seed_set_entry_lifetime = MPL_XLARGE_SEED_LIFETIME;
532579
}
533580

534581
static int8_t ws_cfg_gen_default_set(ws_gen_cfg_t *cfg)
@@ -832,11 +879,11 @@ int8_t ws_cfg_bbr_set(protocol_interface_info_entry_t *cur, ws_bbr_cfg_t *cfg, w
832879
static int8_t ws_cfg_mpl_default_set(ws_mpl_cfg_t *cfg)
833880
{
834881
// MPL configuration
835-
cfg->mpl_trickle_imin = DATA_MESSAGE_IMIN;
836-
cfg->mpl_trickle_imax = DATA_MESSAGE_IMAX;
837-
cfg->mpl_trickle_k = DATA_MESSAGE_K;
838-
cfg->mpl_trickle_timer_exp = DATA_MESSAGE_TIMER_EXPIRATIONS;
839-
cfg->seed_set_entry_lifetime = MPL_SEED_SET_ENTRY_TIMEOUT;
882+
cfg->mpl_trickle_imin = MPL_MEDIUM_IMIN;
883+
cfg->mpl_trickle_imax = MPL_MEDIUM_IMAX;
884+
cfg->mpl_trickle_k = MPL_MEDIUM_K;
885+
cfg->mpl_trickle_timer_exp = MPL_MEDIUM_EXPIRATIONS;
886+
cfg->seed_set_entry_lifetime = MPL_MEDIUM_SEED_LIFETIME;
840887

841888
return CFG_SETTINGS_OK;
842889
}
@@ -869,6 +916,21 @@ int8_t ws_cfg_mpl_validate(ws_mpl_cfg_t *cfg, ws_mpl_cfg_t *new_cfg)
869916
int8_t ws_cfg_mpl_set(protocol_interface_info_entry_t *cur, ws_mpl_cfg_t *cfg, ws_mpl_cfg_t *new_cfg, uint8_t *flags)
870917
{
871918
uint8_t cfg_flags;
919+
920+
// In Wi-SUN Border router will have modified settings to improve reliability
921+
if (cur && cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
922+
// Border router sends multiple packets to ensure start of sequence
923+
if (new_cfg->mpl_trickle_timer_exp < MPL_BORDER_ROUTER_MIN_EXPIRATIONS) {
924+
new_cfg->mpl_trickle_timer_exp = MPL_BORDER_ROUTER_MIN_EXPIRATIONS;
925+
// Lifetime is calculated using the original IMAX
926+
new_cfg->seed_set_entry_lifetime = new_cfg->mpl_trickle_imax * new_cfg->mpl_trickle_timer_exp * MPL_SAFE_HOP_COUNT;
927+
}
928+
// Border router should have shorter IMAX to speed startup
929+
if (new_cfg->mpl_trickle_imax > MPL_BORDER_ROUTER_MAXIMUM_IMAX) {
930+
new_cfg->mpl_trickle_imax = MPL_BORDER_ROUTER_MAXIMUM_IMAX;
931+
}
932+
}
933+
872934
int8_t ret = ws_cfg_to_get((ws_cfgs_t **) &cfg, (ws_cfgs_t *) new_cfg, (ws_cfg_validate) ws_cfg_mpl_validate, (ws_cfgs_t *) &ws_cfg.mpl, &cfg_flags, flags);
873935
if (ret != CFG_SETTINGS_CHANGED) {
874936
return ret;
@@ -1205,6 +1267,7 @@ int8_t ws_cfg_settings_get(protocol_interface_info_entry_t *cur, ws_cfg_t *cfg)
12051267
ws_cfg_timing_get(&cfg->timing, NULL);
12061268
ws_cfg_bbr_get(&cfg->bbr, NULL);
12071269
ws_cfg_sec_prot_get(&cfg->sec_prot, NULL);
1270+
ws_cfg_mpl_get(&cfg->mpl, NULL);
12081271

12091272
return CFG_SETTINGS_OK;
12101273
}

source/6LoWPAN/ws/ws_config.h

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,37 @@ extern uint8_t DEVICE_MIN_SENS;
130130

131131

132132
/* Multicast MPL data message parameters
133-
* IMIN = 10 seconds, IMAX = 3 doublings
134133
*/
135-
136-
#define DATA_MESSAGE_IMIN 10
137-
#define DATA_MESSAGE_TIMER_EXPIRATIONS 3
138-
#define DATA_MESSAGE_IMAX 80
139-
#define DATA_MESSAGE_K 8
140-
#define MPL_SEED_SET_ENTRY_TIMEOUT (DATA_MESSAGE_IMAX * 24 * 4) // 10 seconds per hop making this 240 seconds
134+
#define MPL_SAFE_HOP_COUNT 6
135+
136+
/*Border router override to optimize the multicast startup*/
137+
#define MPL_BORDER_ROUTER_MIN_EXPIRATIONS 2
138+
#define MPL_BORDER_ROUTER_MAXIMUM_IMAX 40
139+
140+
/*Small network size*/
141+
#define MPL_SMALL_IMIN 1
142+
#define MPL_SMALL_IMAX 10
143+
#define MPL_SMALL_EXPIRATIONS 1
144+
#define MPL_SMALL_K 8
145+
#define MPL_SMALL_SEED_LIFETIME (MPL_SMALL_IMAX * MPL_SAFE_HOP_COUNT * (MPL_SMALL_EXPIRATIONS + 1)) // time that packet should get to safe distance
146+
/*Medium network size*/
147+
#define MPL_MEDIUM_IMIN 5
148+
#define MPL_MEDIUM_IMAX 20
149+
#define MPL_MEDIUM_EXPIRATIONS 2
150+
#define MPL_MEDIUM_K 8
151+
#define MPL_MEDIUM_SEED_LIFETIME (MPL_MEDIUM_IMAX * MPL_SAFE_HOP_COUNT * (MPL_MEDIUM_EXPIRATIONS + 1)) // time that packet should get to safe distance
152+
/*Large network size*/
153+
#define MPL_LARGE_IMIN 5
154+
#define MPL_LARGE_IMAX 40
155+
#define MPL_LARGE_EXPIRATIONS 2
156+
#define MPL_LARGE_K 8
157+
#define MPL_LARGE_SEED_LIFETIME (MPL_LARGE_IMAX * MPL_SAFE_HOP_COUNT * (MPL_LARGE_EXPIRATIONS + 1)) // time that packet should get to safe distance
158+
/*xtra large network size*/
159+
#define MPL_XLARGE_IMIN 10
160+
#define MPL_XLARGE_IMAX 80
161+
#define MPL_XLARGE_EXPIRATIONS 2
162+
#define MPL_XLARGE_K 8
163+
#define MPL_XLARGE_SEED_LIFETIME (MPL_XLARGE_IMAX * MPL_SAFE_HOP_COUNT * (MPL_XLARGE_EXPIRATIONS + 1)) // time that packet should get to safe distance
141164

142165
/* DHCP client timeout configuration values
143166
*

0 commit comments

Comments
 (0)