rpl-lite: less aggressive probing function: only probe non-fresh neighbors. Default period set to 90s"

This commit is contained in:
Simon Duquennoy 2017-06-29 16:08:06 +02:00
parent d19df3b59d
commit 2d0e86aa45
4 changed files with 25 additions and 19 deletions

View File

@ -270,7 +270,7 @@
#ifdef RPL_CONF_PROBING_INTERVAL
#define RPL_PROBING_INTERVAL RPL_CONF_PROBING_INTERVAL
#else
#define RPL_PROBING_INTERVAL (60 * CLOCK_SECOND)
#define RPL_PROBING_INTERVAL (90 * CLOCK_SECOND)
#endif
/*

View File

@ -380,33 +380,37 @@ get_probing_target(void)
return curr_instance.dag.preferred_parent;
}
/* With 50% probability: probe best non-fresh neighbor */
if(random_rand() % 2 == 0) {
/* Now consider probing other non-fresh neighbors. With 2/3 proabability,
pick the best non-fresh. Otherwise, pick the lest recently updated non-fresh. */
if(random_rand() % 3 != 0) {
/* Look for best non-fresh */
nbr = nbr_table_head(rpl_neighbors);
while(nbr != NULL) {
if(!rpl_neighbor_is_fresh(nbr)) {
/* p is in our dag and needs probing */
rpl_rank_t p_rank = rpl_neighbor_rank_via_nbr(nbr);
/* nbr needs probing */
rpl_rank_t nbr_rank = rpl_neighbor_rank_via_nbr(nbr);
if(probing_target == NULL
|| p_rank < probing_target_rank) {
|| nbr_rank < probing_target_rank) {
probing_target = nbr;
probing_target_rank = p_rank;
probing_target_rank = nbr_rank;
}
}
nbr = nbr_table_next(rpl_neighbors, nbr);
}
}
/* If we still do not have a probing target: pick the least recently updated neighbor */
if(probing_target == NULL) {
} else {
/* Look for least recently updated non-fresh */
nbr = nbr_table_head(rpl_neighbors);
while(nbr != NULL) {
const struct link_stats *stats =rpl_neighbor_get_link_stats(nbr);
if(stats != NULL) {
if(probing_target == NULL
|| clock_now - stats->last_tx_time > probing_target_age) {
probing_target = nbr;
probing_target_age = clock_now - stats->last_tx_time;
if(!rpl_neighbor_is_fresh(nbr)) {
/* nbr needs probing */
const struct link_stats *stats = rpl_neighbor_get_link_stats(nbr);
if(stats != NULL) {
if(probing_target == NULL
|| clock_now - stats->last_tx_time > probing_target_age) {
probing_target = nbr;
probing_target_age = clock_now - stats->last_tx_time;
}
}
}
nbr = nbr_table_next(rpl_neighbors, nbr);
@ -436,6 +440,8 @@ handle_probing_timer(void *ptr)
/* Send probe, e.g. unicast DIO or DIS */
RPL_PROBING_SEND_FUNC(target_ipaddr);
curr_instance.dag.urgent_probing_target = NULL;
} else {
LOG_INFO("no neighbor needs probing\n");
}
/* Schedule next probing */

View File

@ -204,7 +204,7 @@ GENERATE_MSG(1500000, "moving root back");&#xD;
&#xD;
lostMsgs = 0;&#xD;
&#xD;
TIMEOUT(6000000, if(lastMsg != -1 &amp;&amp; lastMsgHops == 1 &amp;&amp; lostMsgs &lt;= 2 &amp;&amp; num &gt; 20) { log.testOK(); } );&#xD;
TIMEOUT(10000000, if(lastMsg != -1 &amp;&amp; lastMsgHops == 1 &amp;&amp; lostMsgs &lt;= 2 &amp;&amp; num &gt; 20) { log.testOK(); } );&#xD;
&#xD;
lastMsg = -1;&#xD;
packets = "_________";&#xD;

View File

@ -204,7 +204,7 @@ GENERATE_MSG(1500000, "moving root back");&#xD;
&#xD;
lostMsgs = 0;&#xD;
&#xD;
TIMEOUT(6000000, if(lastMsg != -1 &amp;&amp; lastMsgHops == 1 &amp;&amp; lostMsgs &lt;= 2 &amp;&amp; num &gt; 20) { log.testOK(); } );&#xD;
TIMEOUT(10000000, if(lastMsg != -1 &amp;&amp; lastMsgHops == 1 &amp;&amp; lostMsgs &lt;= 2 &amp;&amp; num &gt; 20) { log.testOK(); } );&#xD;
&#xD;
lastMsg = -1;&#xD;
packets = "_________";&#xD;