Skip to content

Commit cbb4acf

Browse files
author
Juha Heiskanen
committed
Accept do faster ETX caclculation after last ETX probe or unicast traffic.
Added definition for define how many accelerated ETX update will be done before start follow cached value. Change-Id: I59ba142ff0ee3a8b46566c7d4a2b7b98abe692b0
1 parent 202e579 commit cbb4acf

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

source/Service_Libs/etx/etx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static bool etx_update_possible(etx_sample_storage_t *storage, etx_storage_t *en
131131
}
132132
}
133133

134-
if (entry->etx_samples == 7) {
134+
if (entry->etx_samples > ETX_ACCELERATED_SAMPLE_COUNT) {
135135
//Slower ETX update phase
136136
if (storage->sample_count < etx_info.min_sample_count || storage->etx_timer) {
137137
if (storage->sample_count < 0xff) {
@@ -140,7 +140,7 @@ static bool etx_update_possible(etx_sample_storage_t *storage, etx_storage_t *en
140140
}
141141
} else {
142142
//Accelerated ETX at for new neighbor
143-
if (storage->sample_count < 3) {
143+
if (storage->sample_count < ETX_ACCELERATED_INTERVAL) {
144144
return false;
145145
}
146146
}

source/Service_Libs/etx/etx.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,25 @@
3131
Range for value can be from 1 to 11 */
3232
#define ETX_MOVING_AVERAGE_FRACTION 3 // n >> 3, 1/8
3333

34+
/* ETX cache configuration definitions */
35+
36+
/* Amount of accelerated ETX samples
37+
* After this value is received the ETX calculation starts to follow the
38+
* slower ETX cache configuration values.
39+
*
40+
* Maximum value is 7
41+
*/
42+
#define ETX_ACCELERATED_SAMPLE_COUNT 3
43+
44+
/* Amount of samples before updating the ETX value when in accelerated mode.
45+
*
46+
* if set to 1 every sample updates an ETX value. if set to 2 every second
47+
* ETX sample updates the ETX value.
48+
*
49+
* This value should be smaller than ETX_ACCELERATED_SAMPLE_COUNT
50+
*/
51+
#define ETX_ACCELERATED_INTERVAL 2
52+
3453
typedef struct etx_storage_s {
3554
uint16_t etx; /*!< 12 bits fraction */
3655
uint16_t stored_diff_etx; /*!< 12 bits fraction */

0 commit comments

Comments
 (0)