Skip to content

Commit a126cb7

Browse files
author
Juha Heiskanen
committed
ETX sampling rule update
Min sampling rule is now compared to MAC radio attempts not a MAC-Data-request attempts. In link failure case will respond now faster and not need so many etx propes in 1 minute. Change-Id: Ieb1108aa19672021258eedd16484532751c82d46
1 parent d5cf8d5 commit a126cb7

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

source/Service_Libs/etx/etx.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ typedef struct {
6464
uint32_t max_etx_update;
6565
uint32_t max_etx;
6666
uint16_t hysteresis; // 12 bit fraction
67+
uint16_t init_etx_sample_count;
6768
uint8_t accum_threshold;
6869
uint8_t etx_min_sampling_time;
6970
uint8_t ext_storage_list_size;
70-
uint8_t min_sample_count;
71-
uint8_t init_etx_sample_count;
71+
uint8_t min_attempts_count;
7272
bool cache_sample_requested;
7373
int8_t interface_id;
7474
} ext_info_t;
@@ -81,7 +81,7 @@ static ext_info_t etx_info = {
8181
.etx_storage_list = NULL,
8282
.etx_cache_storage_list = NULL,
8383
.ext_storage_list_size = 0,
84-
.min_sample_count = 0,
84+
.min_attempts_count = 0,
8585
.max_etx_update = 0,
8686
.max_etx = 0xffff,
8787
.init_etx_sample_count = 1,
@@ -146,7 +146,6 @@ static void etx_cache_entry_init(uint8_t attribute_index)
146146
storage->attempts_count = 0;
147147
storage->etx_timer = etx_info.etx_min_sampling_time;
148148
storage->received_acks = 0;
149-
storage->sample_count = 0;
150149
}
151150

152151
static bool etx_update_possible(etx_sample_storage_t *storage, etx_storage_t *entry, uint16_t time_update)
@@ -161,9 +160,9 @@ static bool etx_update_possible(etx_sample_storage_t *storage, etx_storage_t *en
161160

162161
if (entry->etx_samples > etx_info.init_etx_sample_count) {
163162
//Slower ETX update phase
164-
if (storage->sample_count >= etx_info.min_sample_count) {
163+
if (storage->attempts_count >= etx_info.min_attempts_count) {
165164

166-
if (storage->etx_timer == 0 || storage->sample_count == 0xff) {
165+
if (storage->etx_timer == 0 || storage->attempts_count == 0xffff || storage->received_acks == 0xff) {
167166
//Got least min sample in requested time or max possible sample
168167
return true;
169168
}
@@ -187,7 +186,6 @@ static etx_sample_storage_t *etx_cache_sample_update(uint8_t attribute_index, ui
187186
if (ack_rx) {
188187
storage->received_acks++;
189188
}
190-
storage->sample_count++;
191189
return storage;
192190

193191
}
@@ -223,10 +221,6 @@ void etx_transm_attempts_update(int8_t interface_id, uint8_t attempts, bool succ
223221
etx_sample_storage_t *storage = etx_cache_sample_update(attribute_index, attempts, success);
224222
entry->accumulated_failures = 0;
225223

226-
if (!success && entry->etx_samples < etx_info.init_etx_sample_count) {
227-
storage->sample_count = etx_info.init_etx_sample_count; //Force stop probing if any init fail totally
228-
}
229-
230224
if (!etx_update_possible(storage, entry, 0)) {
231225
return;
232226
}
@@ -613,14 +607,14 @@ bool etx_storage_list_allocate(int8_t interface_id, uint8_t etx_storage_size)
613607

614608
}
615609

616-
bool etx_cached_etx_parameter_set(uint8_t min_wait_time, uint8_t etx_min_sample_count, uint8_t init_etx_sample_count)
610+
bool etx_cached_etx_parameter_set(uint8_t min_wait_time, uint8_t etx_min_attempts_count, uint8_t init_etx_sample_count)
617611
{
618612
//No ini ETX allocation done yet
619613
if (etx_info.ext_storage_list_size == 0) {
620614
return false;
621615
}
622616

623-
if (min_wait_time || etx_min_sample_count) {
617+
if (min_wait_time || etx_min_attempts_count) {
624618
if (init_etx_sample_count == 0) {
625619
return false;
626620
}
@@ -647,7 +641,7 @@ bool etx_cached_etx_parameter_set(uint8_t min_wait_time, uint8_t etx_min_sample_
647641
etx_info.etx_cache_storage_list = NULL;
648642
}
649643

650-
etx_info.min_sample_count = etx_min_sample_count;
644+
etx_info.min_attempts_count = etx_min_attempts_count;
651645
etx_info.etx_min_sampling_time = min_wait_time;
652646
etx_info.init_etx_sample_count = init_etx_sample_count;
653647

source/Service_Libs/etx/etx.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ typedef struct etx_sample_storage_s {
6464
uint16_t attempts_count; /*!< TX attempt count */
6565
uint8_t etx_timer; /*!< Count down from configured value 0 means that ETX Update is possible done again*/
6666
uint8_t received_acks; /*!< Received ACK's */
67-
uint8_t sample_count; /*!< Finished TX count */
6867
} etx_sample_storage_t;
6968

7069
/**
@@ -266,14 +265,14 @@ void etx_cache_timer(int8_t interface_id, uint16_t seconds_update);
266265
* ETX update will happen when min wait time is reached and also reached min etx sample count.
267266
*
268267
* \param min_wait_time how many seconds must wait before do new ETX
269-
* \param etx_min_sample_count define how many completed TX process must be done for new ETX. Min accepted value is 4.
268+
* \param etx_min_attempts_count define how many TX attempts process must be done for new ETX. Min accepted value is 4.
270269
* \param init_etx_sample_count How Many sample is need to init etx calculate
271270
*
272271
* \return true Enable is OK
273272
* \return false Memory allocation fail
274273
*
275274
*/
276-
bool etx_cached_etx_parameter_set(uint8_t min_wait_time, uint8_t etx_min_sample_count, uint8_t init_etx_sample_count);
275+
bool etx_cached_etx_parameter_set(uint8_t min_wait_time, uint8_t etx_min_attempts_count, uint8_t init_etx_sample_count);
277276

278277

279278
/**

test/nanostack/unittest/stub/etx_stub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void etx_cache_timer(int8_t interface_id, uint16_t seconds_update)
8787

8888
}
8989

90-
bool etx_cached_etx_parameter_set(uint8_t min_wait_time, uint8_t etx_min_sample_count, uint8_t init_etx_sample_count)
90+
bool etx_cached_etx_parameter_set(uint8_t min_wait_time, uint8_t etx_min_attempts_count, uint8_t init_etx_sample_count)
9191
{
9292
return true;
9393
}

0 commit comments

Comments
 (0)