48 #define INITIAL_LINK_ESTIMATE 16
50 #define COLLECT_LINK_ESTIMATE_ALPHA ((3 * (COLLECT_LINK_ESTIMATE_UNIT)) / 8)
52 #define MAX_ESTIMATES 255
57 #define PRINTF(...) printf(__VA_ARGS__)
66 le->num_estimates = 0;
67 le->etx_accumulator = COLLECT_LINK_ESTIMATE_UNIT;
78 if(le->num_estimates == 0) {
79 le->etx_accumulator = tx * COLLECT_LINK_ESTIMATE_UNIT;
82 if(le->num_estimates < MAX_ESTIMATES) {
86 le->etx_accumulator = (((uint32_t)tx * COLLECT_LINK_ESTIMATE_UNIT) *
87 COLLECT_LINK_ESTIMATE_ALPHA +
88 le->etx_accumulator * (COLLECT_LINK_ESTIMATE_UNIT -
89 COLLECT_LINK_ESTIMATE_ALPHA)) /
90 COLLECT_LINK_ESTIMATE_UNIT;
111 if(le->num_estimates == 0) {
112 return INITIAL_LINK_ESTIMATE * COLLECT_LINK_ESTIMATE_UNIT;
115 return le->etx_accumulator;
122 return le->num_estimates;