Skip to content

Commit bb42fad

Browse files
author
Juha Heiskanen
committed
Added Network size setup for certificate test
This setup will select Small network setup but set Dag max rank increase to 0 and min hop rank increase to 128. Change-Id: I8b47bf5eb4dc84b05fe75cfd6238fe31ff5dc15a
1 parent 9a7849b commit bb42fad

File tree

6 files changed

+36
-17
lines changed

6 files changed

+36
-17
lines changed

nanostack/ws_management_api.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ extern "C" {
7979
#define NETWORK_SIZE_SMALL 0x01
8080
#define NETWORK_SIZE_MEDIUM 0x08
8181
#define NETWORK_SIZE_LARGE 0x10
82+
#define NETWORK_SIZE_CERTIFICATE 0xFF
8283

8384

8485
/** Temporary API change flag. this will be removed when new version of API is implemented on applications

source/6LoWPAN/ws/ws_bbr_api.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,33 +72,40 @@ static rpl_dodag_conf_t rpl_conf = {
7272
.default_lifetime = 120,
7373
.lifetime_unit = 60,
7474
.objective_code_point = 1, // MRHOF algorithm used
75-
.authentication = 0,
75+
.authentication = false,
7676
.path_control_size = 7,
77-
.dag_max_rank_increase = 2048,
78-
.min_hop_rank_increase = 196,
77+
.dag_max_rank_increase = WS_RPL_MAX_HOP_RANK_INCREASE,
78+
.min_hop_rank_increase = WS_RPL_MIN_HOP_RANK_INCREASE,
7979
// DIO configuration
8080
.dio_interval_min = WS_RPL_DIO_IMIN,
8181
.dio_interval_doublings = WS_RPL_DIO_DOUBLING,
8282
.dio_redundancy_constant = WS_RPL_DIO_REDUNDANCY
8383
};
8484

85-
void ws_bbr_rpl_config(uint8_t imin, uint8_t doubling, uint8_t redundancy)
85+
void ws_bbr_rpl_config(uint8_t imin, uint8_t doubling, uint8_t redundancy, uint16_t dag_max_rank_increase, uint16_t min_hop_rank_increase)
8686
{
8787
if (imin == 0 || doubling == 0) {
8888
// use default values
8989
imin = WS_RPL_DIO_IMIN;
9090
doubling = WS_RPL_DIO_DOUBLING;
9191
redundancy = WS_RPL_DIO_REDUNDANCY;
9292
}
93+
9394
if (rpl_conf.dio_interval_min == imin &&
9495
rpl_conf.dio_interval_doublings == doubling &&
95-
rpl_conf.dio_redundancy_constant == redundancy) {
96+
rpl_conf.dio_redundancy_constant == redundancy &&
97+
rpl_conf.dag_max_rank_increase == dag_max_rank_increase &&
98+
rpl_conf.min_hop_rank_increase == min_hop_rank_increase) {
9699
// Same values no update needed
97100
return;
98101
}
102+
99103
rpl_conf.dio_interval_min = imin;
100104
rpl_conf.dio_interval_doublings = doubling;
101105
rpl_conf.dio_redundancy_constant = redundancy;
106+
rpl_conf.dag_max_rank_increase = dag_max_rank_increase;
107+
rpl_conf.min_hop_rank_increase = min_hop_rank_increase;
108+
102109
if (protocol_6lowpan_rpl_root_dodag) {
103110
rpl_control_update_dodag_config(protocol_6lowpan_rpl_root_dodag, &rpl_conf);
104111
rpl_control_increment_dodag_version(protocol_6lowpan_rpl_root_dodag);

source/6LoWPAN/ws/ws_bbr_api_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void ws_bbr_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds
2727

2828
uint16_t ws_bbr_pan_size(protocol_interface_info_entry_t *cur);
2929

30-
void ws_bbr_rpl_config(uint8_t imin, uint8_t doubling, uint8_t redundancy);
30+
void ws_bbr_rpl_config(uint8_t imin, uint8_t doubling, uint8_t redundancy, uint16_t dag_max_rank_increase, uint16_t min_hop_rank_increase);
3131

3232
bool ws_bbr_ready_to_start(protocol_interface_info_entry_t *cur);
3333

@@ -36,7 +36,7 @@ bool ws_bbr_ready_to_start(protocol_interface_info_entry_t *cur);
3636

3737
#define ws_bbr_seconds_timer( cur, seconds)
3838
#define ws_bbr_pan_size(cur) 0
39-
#define ws_bbr_rpl_config( imin, doubling, redundancy)
39+
#define ws_bbr_rpl_config( imin, doubling, redundancy, dag_max_rank_increase, min_hop_rank_increase)
4040
#define ws_bbr_ready_to_start(cur) true
4141

4242
#endif //HAVE_WS_BORDER_ROUTER

source/6LoWPAN/ws/ws_common.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,11 @@ void ws_common_network_size_configure(protocol_interface_info_entry_t *cur, uint
329329
// doublings:3 (128s)
330330
// redundancy; 0 Disabled
331331
if (cur->ws_info->network_size_config == NETWORK_SIZE_AUTOMATIC) {
332-
ws_bbr_rpl_config(14, 3, 0);
332+
ws_bbr_rpl_config(14, 3, 0, WS_RPL_MAX_HOP_RANK_INCREASE, WS_RPL_MIN_HOP_RANK_INCREASE);
333+
} else if (cur->ws_info->network_size_config == NETWORK_SIZE_CERTIFICATE) {
334+
ws_bbr_rpl_config(0, 0, 0, WS_CERTIFICATE_RPL_MAX_HOP_RANK_INCREASE, WS_CERTIFICATE_RPL_MIN_HOP_RANK_INCREASE);
333335
} else {
334-
ws_bbr_rpl_config(0, 0, 0);
336+
ws_bbr_rpl_config(0, 0, 0, WS_RPL_MAX_HOP_RANK_INCREASE, WS_RPL_MIN_HOP_RANK_INCREASE);
335337
}
336338
ws_pae_controller_timing_adjust(1); // Fast and reactive network
337339
} else if (network_size < 300) {
@@ -341,7 +343,7 @@ void ws_common_network_size_configure(protocol_interface_info_entry_t *cur, uint
341343
// imin: 15 (32s)
342344
// doublings:5 (960s)
343345
// redundancy; 10
344-
ws_bbr_rpl_config(15, 5, 10);
346+
ws_bbr_rpl_config(15, 5, 10, WS_RPL_MAX_HOP_RANK_INCREASE, WS_RPL_MIN_HOP_RANK_INCREASE);
345347
ws_pae_controller_timing_adjust(9); // medium limited network
346348
} else {
347349
// Configure the Wi-SUN discovery trickle parameters
@@ -350,7 +352,7 @@ void ws_common_network_size_configure(protocol_interface_info_entry_t *cur, uint
350352
// imin: 19 (524s, 9 min)
351353
// doublings:1 (1048s, 17 min)
352354
// redundancy; 10 May need some tuning still
353-
ws_bbr_rpl_config(19, 1, 10);
355+
ws_bbr_rpl_config(19, 1, 10, WS_RPL_MAX_HOP_RANK_INCREASE, WS_RPL_MIN_HOP_RANK_INCREASE);
354356
ws_pae_controller_timing_adjust(24); // Very slow and high latency network
355357
}
356358
return;
@@ -456,7 +458,7 @@ void ws_common_etx_validate(protocol_interface_info_entry_t *interface, mac_neig
456458
uint32_t ws_common_version_lifetime_get(uint8_t config)
457459
{
458460
uint32_t lifetime;
459-
if (config == NETWORK_SIZE_SMALL) {
461+
if (config == NETWORK_SIZE_SMALL || config == NETWORK_SIZE_CERTIFICATE) {
460462
lifetime = PAN_VERSION_SMALL_NETWORK_LIFETIME;
461463
} else if (config == NETWORK_SIZE_MEDIUM) {
462464
lifetime = PAN_VERSION_MEDIUM_NETWORK_LIFETIME;
@@ -471,7 +473,7 @@ uint32_t ws_common_version_lifetime_get(uint8_t config)
471473
uint32_t ws_common_version_timeout_get(uint8_t config)
472474
{
473475
uint32_t lifetime;
474-
if (config == NETWORK_SIZE_SMALL) {
476+
if (config == NETWORK_SIZE_SMALL || config == NETWORK_SIZE_CERTIFICATE) {
475477
lifetime = PAN_VERSION_SMALL_NETWORK_TIMEOUT;
476478
} else if (config == NETWORK_SIZE_MEDIUM) {
477479
lifetime = PAN_VERSION_MEDIUM_NETWORK_TIMEOUT;

source/6LoWPAN/ws/ws_config.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
#define WS_RPL_DIO_DOUBLING 2
3232
#define WS_RPL_DIO_REDUNDANCY 0
3333

34+
#define WS_RPL_MIN_HOP_RANK_INCREASE 196
35+
#define WS_RPL_MAX_HOP_RANK_INCREASE 2048
36+
37+
#define WS_CERTIFICATE_RPL_MIN_HOP_RANK_INCREASE 128
38+
#define WS_CERTIFICATE_RPL_MAX_HOP_RANK_INCREASE 0
3439

3540
/* Border router version change interval
3641
*

source/6LoWPAN/ws/ws_management_api.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,21 @@ int ws_management_network_size_set(
136136
if (!cur || !ws_info(cur)) {
137137
return -1;
138138
}
139-
if (network_size > NETWORK_SIZE_LARGE) {
140-
return -2;
141-
}
139+
//Store old setup if new is not accepted
140+
uint8_t old_setup = ws_info(cur)->network_size_config;
142141
ws_info(cur)->network_size_config = network_size;
143142

144143
if (network_size == NETWORK_SIZE_LARGE) {
145144
ws_common_network_size_configure(cur, 5000);
146145
} else if (network_size == NETWORK_SIZE_MEDIUM) {
147146
ws_common_network_size_configure(cur, 200);
148-
} else {
147+
} else if (network_size == NETWORK_SIZE_SMALL) {
149148
ws_common_network_size_configure(cur, 10);
149+
} else if (network_size == NETWORK_SIZE_CERTIFICATE) {
150+
ws_common_network_size_configure(cur, 0);
151+
} else {
152+
ws_info(cur)->network_size_config = old_setup;
153+
return -2;
150154
}
151155
return 0;
152156
}

0 commit comments

Comments
 (0)