Fine tuning of link stats and RPL OFs

This commit is contained in:
Simon Duquennoy 2016-02-04 22:43:34 +01:00
parent 0d7e1e8be4
commit 6349019384
3 changed files with 18 additions and 28 deletions

View File

@ -55,13 +55,13 @@
/* EWMA (exponential moving average) used to maintain statistics over time */
#define EWMA_SCALE 100
#define EWMA_ALPHA 10
#define EWMA_ALPHA 15
#define EWMA_BOOTSTRAP_ALPHA 30
/* ETX fixed point divisor. 128 is the value used by RPL (RFC 6551 and RFC 6719) */
#define ETX_DIVISOR LINK_STATS_ETX_DIVISOR
/* Number of Tx used to update the ETX EWMA in case of no-ACK */
#define ETX_NOACK_PENALTY 16
#define ETX_NOACK_PENALTY 10
/* Initial ETX value */
#define ETX_INIT 2

View File

@ -71,8 +71,8 @@
#endif /* RPL_MRHOF_CONF_SQUARED_ETX */
/* Configuration parameters of RFC6719. Reject parents that have a higher
* link metric than the following. We use the default values from the RFC. */
#define MAX_LINK_METRIC 512 /* Eq ETX of 4 */
* link metric than the following. The default value is 512 but we use 1024. */
#define MAX_LINK_METRIC 1024 /* Eq ETX of 8 */
/* Reject parents that have a higher path cost than the following. */
#define MAX_PATH_COST 32768 /* Eq path ETX of 256 */
/* Hysteresis of MRHOF: the rank must differ more than PARENT_SWITCH_THRESHOLD_DIV
@ -187,19 +187,14 @@ best_parent(rpl_parent_t *p1, rpl_parent_t *p2)
int p1_is_acceptable;
int p2_is_acceptable;
if(p1 == NULL || p2 == NULL) {
/* Return non-null parent if any */
return p1 == NULL ? p2 : p1;
}
p1_is_acceptable = p1 != NULL && parent_is_acceptable(p1);
p2_is_acceptable = p2 != NULL && parent_is_acceptable(p2);
p1_is_acceptable = parent_is_acceptable(p1);
p2_is_acceptable = parent_is_acceptable(p2);
/* Is only one parent is acceptable, select it. If both are acceptable, or
* both non-acceptable, proceed to traditional parent comparison. This is a
* slight departure from the standard but allows to keep connectivity even
* all neighbors appear to have a bad link. */
if(p1_is_acceptable != p2_is_acceptable) {
return p1_is_acceptable ? p1 : p2;
if(!p1_is_acceptable) {
return p2_is_acceptable ? p2 : NULL;
}
if(!p2_is_acceptable) {
return p1_is_acceptable ? p1 : NULL;
}
dag = p1->dag; /* Both parents are in the same DAG. */

View File

@ -145,19 +145,14 @@ best_parent(rpl_parent_t *p1, rpl_parent_t *p2)
int p1_is_acceptable;
int p2_is_acceptable;
if(p1 == NULL || p2 == NULL) {
/* Return non-null parent if any */
return p1 == NULL ? p2 : p1;
}
p1_is_acceptable = p1 != NULL && parent_is_acceptable(p1);
p2_is_acceptable = p2 != NULL && parent_is_acceptable(p2);
p1_is_acceptable = parent_is_acceptable(p1);
p2_is_acceptable = parent_is_acceptable(p2);
/* Is only one parent is acceptable, select it. If both are acceptable, or
* both non-acceptable, proceed to traditional parent comparison. This is a
* slight departure from the standard but allows to keep connectivity even
* all neighbors appear to have a bad link. */
if(p1_is_acceptable != p2_is_acceptable) {
return p1_is_acceptable ? p1 : p2;
if(!p1_is_acceptable) {
return p2_is_acceptable ? p2 : NULL;
}
if(!p2_is_acceptable) {
return p1_is_acceptable ? p1 : NULL;
}
dag = p1->dag; /* Both parents are in the same DAG. */