Skip to content

Commit 941b9b4

Browse files
author
Arto Kinnunen
authored
Updates to stagger/latency (#2358)
Updates to stagger/latency Latency updates: -Change Thread latency to 2000 -Halve Wi-SUN latencies to 4000(small), 8000(med) and 16000(large) Stagger updates: -Use more accurate number of devices when calculating stagger -Initial stagger value is 20% of the max stagger -Allow more bandwidth for network formation by adjusting data rate -Fix possible max stagger value overflow -Do not use network mode automatic
1 parent c2abaaa commit 941b9b4

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

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

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
#define TRACE_GROUP_LOWPAN "6lo"
8484
#define TRACE_GROUP "6lo"
8585

86+
/* Data rate for application used in Stagger calculation */
87+
#define STAGGER_DATARATE_FOR_APPL(n) ((n)*25/100)
88+
8689
#ifdef HAVE_RPL
8790
rpl_domain_t *protocol_6lowpan_rpl_domain;
8891
/* Having to sidestep old rpl_dodag_t type for the moment */
@@ -800,7 +803,7 @@ bool protocol_6lowpan_latency_estimate_get(int8_t interface_id, uint32_t *latenc
800803
latency_estimate = 100;
801804
} else if (thread_info(cur_interface)) {
802805
// thread network
803-
latency_estimate = 1000;
806+
latency_estimate = 2000;
804807
} else if (ws_info(cur_interface)) {
805808
latency_estimate = ws_common_latency_estimate_get(cur_interface);
806809
} else {
@@ -820,14 +823,13 @@ bool protocol_6lowpan_stagger_estimate_get(int8_t interface_id, uint32_t data_am
820823
{
821824
size_t network_size;
822825
uint32_t datarate;
826+
uint32_t stagger_value;
823827
protocol_interface_info_entry_t *cur_interface = protocol_stack_interface_info_get_by_id(interface_id);
824828

825829
if (!cur_interface) {
826830
return false;
827831
}
828832

829-
*stagger_min = 1;
830-
831833
if (cur_interface->eth_mac_api) {
832834
// either PPP or Ethernet interface.
833835
network_size = 1;
@@ -849,16 +851,25 @@ bool protocol_6lowpan_stagger_estimate_get(int8_t interface_id, uint32_t data_am
849851
// If no data amount given, use 1kB
850852
data_amount = 1;
851853
}
852-
/**Example:
853-
* Maximum stagger value to send 1kB on 50 devices network using datarate 50000 kb/:
854-
* (1 * 1024 * 8 * 50) / (50000/4)) = ~ 32s
855-
*
856-
* devices: 50, datarate: 250kbps => stagger ~ 6s
857-
* devices: 1000, datarate: 50kbps => stagger ~ 655s
854+
855+
/*
856+
* Do not occupy whole bandwidth, leave space for network formation etc...
857+
*/
858+
datarate = STAGGER_DATARATE_FOR_APPL(datarate);
859+
stagger_value = 1 + ((data_amount * 1024 * 8 * network_size) / datarate);
860+
/**
861+
* Example:
862+
* Maximum stagger value to send 1kB to 100 device network using data rate of 50kbs:
863+
* 1 + (1 * 1024 * 8 * 100) / (50000*0.25) = 66s
858864
*/
859-
/* Do not occupy whole bandwidth, halve the theoretical datarate and reserve room for other channel usage */
860-
datarate = datarate / 4;
861-
*stagger_max = (uint16_t) * stagger_min + ((data_amount * 1024 * 8 * network_size) / datarate);
865+
866+
*stagger_min = stagger_value / 5; // Minimum stagger value is 1/5 of the max
867+
868+
if (stagger_value > 0xFFFF) {
869+
*stagger_max = 0xFFFF;
870+
} else {
871+
*stagger_max = (uint16_t)stagger_value;
872+
}
862873

863874
// Randomize stagger value
864875
*stagger_rand = randLIB_get_random_in_range(*stagger_min, *stagger_max);

source/6LoWPAN/ws/ws_common.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,11 @@ uint32_t ws_common_latency_estimate_get(protocol_interface_info_entry_t *cur)
388388

389389
if (network_size <= NETWORK_SIZE_SMALL) {
390390
// handles also NETWORK_SIZE_CERTIFICATE
391-
latency = 8000;
391+
latency = 4000;
392392
} else if (network_size <= NETWORK_SIZE_MEDIUM) {
393-
latency = 16000;
393+
latency = 8000;
394394
} else {
395-
latency = 32000;
395+
latency = 16000;
396396
}
397397

398398
return latency;
@@ -405,22 +405,11 @@ uint32_t ws_common_datarate_get(protocol_interface_info_entry_t *cur)
405405

406406
uint32_t ws_common_network_size_estimate_get(protocol_interface_info_entry_t *cur)
407407
{
408-
uint32_t network_size_estimate = 0;
409-
uint8_t network_size = cur->ws_info->cfg->gen.network_size;
410-
411-
if (network_size == NETWORK_SIZE_AUTOMATIC) {
412-
network_size = cur->ws_info->pan_information.pan_size / 100;
413-
}
408+
uint32_t network_size_estimate = 100;
414409

415-
if (network_size <= NETWORK_SIZE_SMALL) {
416-
// tens of devices (now 30), handles also NETWORK_SIZE_CERTIFICATE
417-
network_size_estimate = 30;
418-
} else if (network_size <= NETWORK_SIZE_MEDIUM) {
419-
// hundreds of devices (now 300)
420-
network_size_estimate = 300;
421-
} else {
422-
// huge amount of devices (now 1000)
423-
network_size_estimate = 1000;
410+
if ((cur->ws_info->cfg->gen.network_size != NETWORK_SIZE_AUTOMATIC) &&
411+
(cur->ws_info->cfg->gen.network_size != NETWORK_SIZE_CERTIFICATE)) {
412+
network_size_estimate = cur->ws_info->cfg->gen.network_size * 100;
424413
}
425414

426415
return network_size_estimate;

0 commit comments

Comments
 (0)