Skip to content

Commit 496074a

Browse files
author
Juha Heiskanen
committed
RPL parent select update:
Added Unicast DIO trigger if not received configured time RPL policy support to config fixed point for missing IMax period 1.0 fixed point is 0x0100 Change-Id: I15105ee82e72358ef981d2799e029ecd867ec337
1 parent 32e22d3 commit 496074a

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

source/RPL/rpl_policy.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
static bool rpl_policy_parent_confirmation_req = false;
3838
static int8_t rpl_policy_dao_retry_count_conf = 0;
3939
static int16_t rpl_policy_dao_initial_timeout_conf = 20; // Default is 2 seconds 100ms ticks
40+
static uint16_t rpl_policy_dio_validity_period_hysteresis = 0x0180; //Fixed Point 1.5
4041

4142
/* TODO - application API to control when to join new instances / DODAGs
4243
*
@@ -210,6 +211,20 @@ uint16_t rpl_policy_etx_hysteresis(rpl_domain_t *domain)
210211
return 0x0080; /* 8.8 fixed-point, so 0.5 */
211212
}
212213

214+
uint16_t rpl_policy_dio_validity_period(rpl_domain_t *domain)
215+
{
216+
(void)domain;
217+
218+
return rpl_policy_dio_validity_period_hysteresis; /* Fixed Point */
219+
}
220+
221+
void rpl_policy_set_dio_validity_period(rpl_domain_t *domain, uint16_t fixed_point)
222+
{
223+
(void)domain;
224+
225+
rpl_policy_dio_validity_period_hysteresis = fixed_point; /* Fixed Point */
226+
}
227+
213228
uint16_t rpl_policy_etx_change_parent_selection_delay(rpl_domain_t *domain)
214229
{
215230
(void)domain;

source/RPL/rpl_policy.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ uint16_t rpl_policy_modify_downward_cost_to_root_neighbour(rpl_domain_t *domain,
3737

3838
uint16_t rpl_policy_parent_selection_period(rpl_domain_t *domain);
3939
uint16_t rpl_policy_etx_hysteresis(rpl_domain_t *domain);
40+
//Return Fixed point multiple which base 1.0 is 0x0100
41+
uint16_t rpl_policy_dio_validity_period(rpl_domain_t *domain);
42+
//Fixed point must 1.0 is 0x0100
43+
void rpl_policy_set_dio_validity_period(rpl_domain_t *domain, uint16_t fixed_point);
4044
uint16_t rpl_policy_etx_change_parent_selection_delay(rpl_domain_t *domain);
4145
uint16_t rpl_policy_dio_parent_selection_delay(rpl_domain_t *domain);
4246

source/RPL/rpl_upward.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,11 @@ static void trace_info_print(const char *fmt, ...)
13551355
va_end(ap);
13561356
}
13571357

1358+
static uint32_t rpl_dio_imax_time_calculate(uint16_t Imax, uint16_t fixed_point)
1359+
{
1360+
return (((uint32_t)Imax * fixed_point) / 0x0100);
1361+
}
1362+
13581363

13591364
void rpl_instance_run_parent_selection(rpl_instance_t *instance)
13601365
{
@@ -1438,6 +1443,15 @@ void rpl_instance_run_parent_selection(rpl_instance_t *instance)
14381443
if (preferred_parent) {
14391444
// Always stop repair if we find a parent
14401445
rpl_instance_set_local_repair(instance, false);
1446+
//Validate time from last DIO
1447+
1448+
uint32_t time_between_parent = protocol_core_monotonic_time - preferred_parent->dio_timestamp;
1449+
uint32_t accepted_time = rpl_dio_imax_time_calculate(instance->current_dodag_version->dodag->dio_timer_params.Imax, rpl_policy_dio_validity_period(instance->domain));
1450+
1451+
if (accepted_time < time_between_parent) {
1452+
rpl_control_transmit_dis(instance->domain, NULL, RPL_SOLINFO_PRED_INSTANCEID, instance->id, NULL, 0, preferred_parent->ll_address);
1453+
}
1454+
14411455
} else if (original_preferred) {
14421456
// Only start repair if we just lost a parent
14431457
rpl_instance_set_local_repair(instance, true);
@@ -1921,7 +1935,7 @@ bool rpl_upward_accept_prefix_update(const rpl_dodag_t *dodag_info, const rpl_ne
19211935
//Calculate Time between from last dio from parent and this neighbour
19221936
//neighbour dio_timestamp >= pref_parent's, because it's a newly-received message
19231937
uint32_t time_between_parent = neighbour->dio_timestamp - pref_parent->dio_timestamp;
1924-
uint32_t accepted_time = (uint32_t)dodag_info->dio_timer_params.Imax * 2;
1938+
uint32_t accepted_time = rpl_dio_imax_time_calculate(dodag_info->dio_timer_params.Imax, 0x0200);
19251939
//Accept prefix Update If Time from last DIO is more than 2 x Max
19261940
if (accepted_time < time_between_parent) {
19271941
return true;

test/nanostack/unittest/stub/rpl_policy_stub.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ uint16_t rpl_policy_etx_hysteresis(rpl_domain_t *domain)
8383
return 0;
8484
}
8585

86+
uint16_t rpl_policy_dio_validity_period(rpl_domain_t *domain)
87+
{
88+
return 0x0180;
89+
}
90+
91+
void rpl_policy_set_dio_validity_period(rpl_domain_t *domain, uint16_t fixed_point)
92+
{
93+
94+
}
95+
8696
uint16_t rpl_policy_etx_change_parent_selection_delay(rpl_domain_t *domain)
8797
{
8898
return 0;

0 commit comments

Comments
 (0)