Skip to content

Commit 2b889e9

Browse files
author
Mika Leppänen
committed
Added automatic test procedure triggering during bootstrap
Added auto test procedure that will trigger test procedures (PAS, EAPOL target selection, PCS, DIS, RPL parent selection) on node during bootstrap. This will speed up the network joining. When enabled sets the stagger value returned from mesh to small value (same as returned on small network size).
1 parent ed9eb05 commit 2b889e9

File tree

7 files changed

+146
-15
lines changed

7 files changed

+146
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Features
66
* Added support for triggering test procedures (e.g. for manually sending DIS, DIO, DAO, PAS, PS, PCS and PC).
7+
* Added automatic test procedure triggering during bootstrap (PAS, EAPOL target selection, PCS, DIS, RPL parent selection).
78

89
### Changes
910
*

nanostack/net_ws_test_ext.h

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,30 @@ extern "C" {
6767
*
6868
* Join state 5 (operational)
6969
*
70+
*
71+
* On automatic mode the PROC_PAS, PROC_EAPOL, PROC_PCS, PROC_DIS and PROC_RPL
72+
* will be triggered automatically by the node during the bootstrap.
73+
*
7074
*/
7175

7276
/**
7377
* @brief Test procedure triggers.
7478
*/
7579
typedef enum {
76-
PROC_DIS, /* trigger DODAG information object solicit (node) */
77-
PROC_DIO, /* trigger DODAG information object (BR, node) */
78-
PROC_DAO, /* trigger Destination advertisement object (node) */
80+
PROC_DIS, /* trigger DODAG information object solicit (node) */
81+
PROC_DIO, /* trigger DODAG information object (BR, node) */
82+
PROC_DAO, /* trigger Destination advertisement object (node) */
83+
84+
PROC_PAS, /* trigger PAN Advertisement Solicit (node) */
85+
PROC_PA, /* trigger PAN Advertisement (BR, node) */
86+
PROC_PCS, /* trigger PAN Configuration Solicit (node) */
87+
PROC_PC, /* trigger PAN Configuration (BR, node) */
7988

80-
PROC_PAS, /* trigger PAN Advertisement Solicit (node) */
81-
PROC_PA, /* trigger PAN Advertisement (BR, node) */
82-
PROC_PCS, /* trigger PAN Configuration Solicit (node) */
83-
PROC_PC, /* trigger PAN Configuration (BR, node) */
89+
PROC_EAPOL, /* trigger EAPOL target selection (initiates authentication, node) */
90+
PROC_RPL, /* trigger RPL parent selection (node) */
8491

85-
PROC_EAPOL, /* trigger EAPOL target selection (initiates authentication, node) */
86-
PROC_RPL, /* trigger RPL parent selection (node) */
92+
PROC_AUTO_ON, /* trigger bootstrap test procedures automatically */
93+
PROC_AUTO_OFF, /* disable automatic bootstrap test procedure triggering */
8794

8895
MSG_NONE
8996
} ws_test_proc_t;

source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ bool protocol_6lowpan_stagger_estimate_get(int8_t interface_id, uint32_t data_am
871871
}
872872

873873
// For small networks sets 10 seconds stagger
874-
if (network_size <= 100 && ws_info(cur_interface)) {
874+
if (ws_info(cur_interface) && (network_size <= 100 || ws_test_proc_auto_trg(cur_interface))) {
875875
stagger_value = 10;
876876
} else {
877877
stagger_value = 1 + ((data_amount * 1024 * 8 * network_size) / datarate);

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ static void ws_bootstrap_rpl_scan_start(protocol_interface_info_entry_t *cur);
128128
static uint16_t ws_randomize_fixed_channel(uint16_t configured_fixed_channel, uint8_t number_of_channels, uint32_t *channel_mask);
129129

130130
static void ws_bootstrap_test_procedure_trigger_exec(protocol_interface_info_entry_t *cur, ws_bootsrap_procedure_t procedure);
131+
static void ws_bootstrap_test_procedure_trigger_timer(protocol_interface_info_entry_t *cur, uint32_t seconds);
131132

132133
typedef enum {
133134
WS_PARENT_SOFT_SYNCH = 0, /**< let FHSS make decision if synchronization is needed*/
@@ -4181,6 +4182,7 @@ void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t s
41814182

41824183
ws_llc_timer_seconds(cur, seconds);
41834184

4185+
ws_bootstrap_test_procedure_trigger_timer(cur, seconds);
41844186
}
41854187

41864188
void ws_bootstrap_primary_parent_update(protocol_interface_info_entry_t *interface, mac_neighbor_table_entry_t *neighbor)
@@ -4389,8 +4391,23 @@ static void ws_bootstrap_packet_congestion_init(protocol_interface_info_entry_t
43894391

43904392
}
43914393

4394+
static bool auto_test_proc_trg_enabled = false;
4395+
43924396
int ws_bootstrap_test_procedure_trigger(protocol_interface_info_entry_t *cur, ws_bootsrap_procedure_t procedure)
43934397
{
4398+
switch (procedure) {
4399+
case PROCEDURE_AUTO_ON:
4400+
tr_info("Trigger bootstrap test procedures automatically");
4401+
auto_test_proc_trg_enabled = true;
4402+
return 0;
4403+
case PROCEDURE_AUTO_OFF:
4404+
tr_info("Disable automatic bootstrap test procedure triggering");
4405+
auto_test_proc_trg_enabled = false;
4406+
return 0;
4407+
default:
4408+
break;
4409+
}
4410+
43944411
if (!cur) {
43954412
return -1;
43964413
}
@@ -4450,8 +4467,12 @@ static void ws_bootstrap_test_procedure_trigger_exec(protocol_interface_info_ent
44504467
}
44514468
break;
44524469
case PROCEDURE_PAS:
4470+
case PROCEDURE_PAS_TRICKLE_INCON:
44534471
tr_info("trigger PAN advertisement Solicit");
4454-
ws_bootstrap_pan_advert_solicit(cur);
4472+
if (procedure != PROCEDURE_PAS_TRICKLE_INCON) {
4473+
tr_info("send PAN advertisement Solicit");
4474+
ws_bootstrap_pan_advert_solicit(cur);
4475+
}
44554476
if (cur->ws_info->trickle_pas_running) {
44564477
trickle_inconsistent_heard(&cur->ws_info->trickle_pan_advertisement_solicit, &cur->ws_info->trickle_params_pan_discovery);
44574478
}
@@ -4466,9 +4487,13 @@ static void ws_bootstrap_test_procedure_trigger_exec(protocol_interface_info_ent
44664487
}
44674488
break;
44684489
case PROCEDURE_PCS:
4490+
case PROCEDURE_PCS_TRICKLE_INCON:
44694491
if (cur->ws_info->trickle_pcs_running || ws_bootstrap_state_active(cur)) {
44704492
tr_info("trigger PAN configuration Solicit");
4471-
ws_bootstrap_pan_config_solicit(cur);
4493+
if (procedure != PROCEDURE_PCS_TRICKLE_INCON) {
4494+
tr_info("send PAN configuration Solicit");
4495+
ws_bootstrap_pan_config_solicit(cur);
4496+
}
44724497
if (cur->ws_info->trickle_pcs_running) {
44734498
trickle_inconsistent_heard(&cur->ws_info->trickle_pan_config_solicit, &cur->ws_info->trickle_params_pan_discovery);
44744499
}
@@ -4522,4 +4547,76 @@ static void ws_bootstrap_test_procedure_trigger_exec(protocol_interface_info_ent
45224547
}
45234548
}
45244549

4550+
static void ws_bootstrap_test_procedure_trigger_timer(protocol_interface_info_entry_t *cur, uint32_t seconds)
4551+
{
4552+
if (!auto_test_proc_trg_enabled) {
4553+
cur->ws_info->test_proc_trg.auto_trg_enabled = false;
4554+
return;
4555+
}
4556+
4557+
cur->ws_info->test_proc_trg.auto_trg_enabled = true;
4558+
4559+
if (cur->nwk_bootstrap_state == ER_ACTIVE_SCAN) {
4560+
if (cur->ws_info->trickle_pas_running) {
4561+
if (cur->ws_info->test_proc_trg.pas_trigger_timer > seconds) {
4562+
cur->ws_info->test_proc_trg.pas_trigger_timer -= seconds;
4563+
} else {
4564+
if (cur->ws_info->test_proc_trg.pas_trigger_count > 2) {
4565+
ws_bootstrap_test_procedure_trigger_exec(cur, PROCEDURE_PAS_TRICKLE_INCON);
4566+
} else {
4567+
cur->ws_info->test_proc_trg.pas_trigger_count++;
4568+
ws_bootstrap_test_procedure_trigger_exec(cur, PROCEDURE_PAS);
4569+
}
4570+
cur->ws_info->test_proc_trg.pas_trigger_timer = (cur->ws_info->trickle_params_pan_discovery.Imin / 10);
4571+
}
4572+
if (cur->ws_info->test_proc_trg.eapol_trigger_timer > seconds) {
4573+
cur->ws_info->test_proc_trg.eapol_trigger_timer -= seconds;
4574+
} else {
4575+
ws_bootstrap_test_procedure_trigger_exec(cur, PROCEDURE_EAPOL);
4576+
cur->ws_info->test_proc_trg.eapol_trigger_timer = (cur->ws_info->trickle_params_pan_discovery.Imin / 10) / 2;
4577+
}
4578+
}
4579+
} else if (cur->nwk_bootstrap_state == ER_SCAN) {
4580+
if (cur->ws_info->trickle_pcs_running) {
4581+
if (cur->ws_info->test_proc_trg.pcs_trigger_timer > seconds) {
4582+
cur->ws_info->test_proc_trg.pcs_trigger_timer -= seconds;
4583+
} else {
4584+
if (cur->ws_info->test_proc_trg.pcs_trigger_count > 2) {
4585+
ws_bootstrap_test_procedure_trigger_exec(cur, PROCEDURE_PCS_TRICKLE_INCON);
4586+
} else {
4587+
cur->ws_info->test_proc_trg.pcs_trigger_count++;
4588+
ws_bootstrap_test_procedure_trigger_exec(cur, PROCEDURE_PCS);
4589+
}
4590+
cur->ws_info->test_proc_trg.pcs_trigger_timer = (cur->ws_info->trickle_params_pan_discovery.Imin / 10);
4591+
}
4592+
}
4593+
} else if (cur->nwk_bootstrap_state == ER_RPL_SCAN) {
4594+
if (cur->ws_info->test_proc_trg.dis_trigger_timer > seconds) {
4595+
cur->ws_info->test_proc_trg.dis_trigger_timer -= seconds;
4596+
} else {
4597+
ws_bootstrap_test_procedure_trigger_exec(cur, PROCEDURE_DIS);
4598+
cur->ws_info->test_proc_trg.dis_trigger_timer_val *= 2;
4599+
if (cur->ws_info->test_proc_trg.dis_trigger_timer_val > (WS_RPL_DIS_INITIAL_TIMEOUT / 10) * 4) {
4600+
cur->ws_info->test_proc_trg.dis_trigger_timer_val = (WS_RPL_DIS_INITIAL_TIMEOUT / 10) * 4;
4601+
}
4602+
cur->ws_info->test_proc_trg.dis_trigger_timer = cur->ws_info->test_proc_trg.dis_trigger_timer_val;
4603+
}
4604+
if (cur->ws_info->test_proc_trg.rpl_trigger_timer > seconds) {
4605+
cur->ws_info->test_proc_trg.rpl_trigger_timer -= seconds;
4606+
} else {
4607+
ws_bootstrap_test_procedure_trigger_exec(cur, PROCEDURE_RPL);
4608+
cur->ws_info->test_proc_trg.rpl_trigger_timer_val *= 2;
4609+
if (cur->ws_info->test_proc_trg.rpl_trigger_timer_val > (WS_RPL_DIS_INITIAL_TIMEOUT / 10) * 2) {
4610+
cur->ws_info->test_proc_trg.rpl_trigger_timer_val = (WS_RPL_DIS_INITIAL_TIMEOUT / 10) * 2;
4611+
}
4612+
cur->ws_info->test_proc_trg.rpl_trigger_timer = cur->ws_info->test_proc_trg.rpl_trigger_timer_val;
4613+
}
4614+
} else {
4615+
cur->ws_info->test_proc_trg.dis_trigger_timer_val = (WS_RPL_DIS_INITIAL_TIMEOUT / 10) / 2;
4616+
cur->ws_info->test_proc_trg.rpl_trigger_timer_val = (WS_RPL_DIS_INITIAL_TIMEOUT / 10) / 2;
4617+
cur->ws_info->test_proc_trg.pas_trigger_count = 0;
4618+
cur->ws_info->test_proc_trg.pcs_trigger_count = 0;
4619+
}
4620+
}
4621+
45254622
#endif //HAVE_WS

source/6LoWPAN/ws/ws_bootstrap.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@ typedef enum {
4343
PROCEDURE_PC,
4444

4545
PROCEDURE_EAPOL,
46-
PROCEDURE_RPL
46+
PROCEDURE_RPL,
47+
PROCEDURE_AUTO_ON,
48+
PROCEDURE_AUTO_OFF,
49+
50+
/* Above must match to ws_test_proc_t */
51+
52+
PROCEDURE_PAS_TRICKLE_INCON,
53+
PROCEDURE_PCS_TRICKLE_INCON
54+
4755
} ws_bootsrap_procedure_t;
4856

4957
#ifdef HAVE_WS

source/6LoWPAN/ws/ws_common.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ typedef struct {
7979
uint16_t old_bsi;
8080
} ws_bsi_block_t;
8181

82+
typedef struct {
83+
uint16_t eapol_trigger_timer;
84+
uint16_t pas_trigger_timer;
85+
uint16_t pcs_trigger_timer;
86+
uint16_t dis_trigger_timer;
87+
uint16_t dis_trigger_timer_val;
88+
uint16_t rpl_trigger_timer;
89+
uint16_t rpl_trigger_timer_val;
90+
uint8_t pas_trigger_count;
91+
uint8_t pcs_trigger_count;
92+
bool auto_trg_enabled;
93+
} ws_test_proc_trg_t;
94+
8295
typedef NS_LIST_HEAD(ws_nud_table_entry_t, link) ws_nud_table_list_t;
8396

8497
typedef struct ws_info_s {
@@ -114,6 +127,7 @@ typedef struct ws_info_s {
114127
ws_nud_table_entry_t nud_table_entrys[ACTIVE_NUD_PROCESS_MAX];
115128
ws_nud_table_list_t active_nud_process;
116129
ws_nud_table_list_t free_nud_entries;
130+
ws_test_proc_trg_t test_proc_trg;
117131
struct ws_cfg_s *cfg; /**< Wi-SUN configuration */
118132
struct ws_pan_information_s pan_information;
119133
ws_hopping_schedule_t hopping_schdule;
@@ -187,8 +201,10 @@ uint8_t ws_common_temporary_entry_size(uint8_t mac_table_size);
187201
void ws_common_border_router_alive_update(protocol_interface_info_entry_t *interface);
188202

189203
#define ws_info(cur) ((cur)->ws_info)
204+
#define ws_test_proc_auto_trg(cur) ((cur)->ws_info->test_proc_trg.auto_trg_enabled == true)
190205
#else
191206
#define ws_info(cur) ((ws_info_t *) NULL)
207+
#define ws_test_proc_auto_trg(cur) (false)
192208
#define ws_common_seconds_timer(cur, seconds)
193209
#define ws_common_neighbor_update(cur, ll_address) ((void) 0)
194210
#define ws_common_black_list_neighbour(ll_address, nd_status) ((void) 0)

source/6LoWPAN/ws/ws_test_api.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ int ws_test_procedure_trigger(int8_t interface_id, ws_test_proc_t procedure, voi
183183
{
184184
(void) parameters;
185185

186-
protocol_interface_info_entry_t *cur;
186+
protocol_interface_info_entry_t *cur = NULL;;
187187

188188
if (interface_id > 0) {
189189
cur = protocol_stack_interface_info_get_by_id(interface_id);
@@ -193,7 +193,9 @@ int ws_test_procedure_trigger(int8_t interface_id, ws_test_proc_t procedure, voi
193193
} else {
194194
cur = protocol_stack_interface_info_get_wisun_mesh();
195195
if (!cur) {
196-
return -1;
196+
if (procedure != PROC_AUTO_ON && procedure != PROC_AUTO_OFF) {
197+
return -1;
198+
}
197199
}
198200
}
199201

0 commit comments

Comments
 (0)