Skip to content

Commit

Permalink
Wi-sun Probe functionality revert operation
Browse files Browse the repository at this point in the history
Removed Probe purge.

Removed Neighbour Replacementation from wi-sun side.

Added same Candidate accept rules than earlier.

Change-Id: Ia6140d6dddf1c5dd19af720a96b145448aace0fa
  • Loading branch information
Juha Heiskanen committed Dec 5, 2019
1 parent 4ff02f9 commit 0aead93
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 42 deletions.
96 changes: 58 additions & 38 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1663,10 +1663,6 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
activate_nud = true;
} else {

if (cur->ws_info->ns_probed_timer > 7) {
return false;//Accept 1 probe start / every seconds call
}

ws_bootsrap_create_ll_address(ll_address, entry_ptr->mac64);
if (!rpl_control_probe_parent_candidate(cur, ll_address)) {
return false;
Expand Down Expand Up @@ -1704,12 +1700,6 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
}

entry->nud_process = nud_proces;
if (!nud_proces) {
cur->ws_info->ns_probed_timer += 8;
if (cur->ws_info->ns_probed_timer > 32) {
cur->ws_info->ns_probed_timer = 32;
}
}

return true;
}
Expand Down Expand Up @@ -2145,16 +2135,26 @@ static void ws_rpl_prefix_callback(prefix_entry_t *prefix, void *handle, uint8_t
}
}

static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle, struct rpl_instance *instance, uint16_t candidate_rank)
static bool ws_rpl_candidate_soft_filtering(protocol_interface_info_entry_t *cur, struct rpl_instance *instance)
{
//Already many candidates
if (rpl_control_candidate_list_size(cur, instance) > cur->ws_info->rpl_parent_candidate_max) {
return false;
}

protocol_interface_info_entry_t *cur = handle;
if (!cur->rpl_domain || cur->interface_mode != INTERFACE_UP) {
//Already enough selected candidates
if (rpl_control_selected_parent_count(cur, instance) >= cur->ws_info->rpl_selected_parent_max) {
return false;
}

if (cur->ws_info->ns_probed_timer > 8) {
//2 probe have been done so Try to avoid put more before accept new one's
return true;
}

static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle, struct rpl_instance *instance, uint16_t candidate_rank)
{

protocol_interface_info_entry_t *cur = handle;
if (!cur->rpl_domain || cur->interface_mode != INTERFACE_UP) {
return false;
}

Expand All @@ -2163,25 +2163,54 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
return false;
}

uint8_t replacing[16];
uint8_t mac64[10];
bool replace_ok = false;
bool create_ok = false;
//bool replace_ok = false;
//bool create_ok = false;
llc_neighbour_req_t neigh_buffer;

//Discover neigh ready here for possible ETX validate
memcpy(mac64, ll_parent_address + 8, 8);
mac64[0] ^= 2;


ws_bootstrap_neighbor_info_request(cur, mac64, &neigh_buffer, false);
//Discover Multicast temporary entry for create neighbour table entry for new candidate
ws_neighbor_temp_class_t *entry = ws_llc_get_multicast_temp_entry(cur, mac64);

if (!ws_rpl_candidate_soft_filtering(cur, instance)) {
if (!neigh_buffer.neighbor) {
//Do not accept any new in that Place
return false;
}

if (rpl_control_candidate_list_size(cur, instance) < cur->ws_info->rpl_parent_candidate_max) {
//Not reach max value yet accept then all go to create neigh table
goto neigh_create;
}
uint8_t replacing[16];
//Accept Know neighbour if it is enough good
if (!rpl_control_find_worst_neighbor(cur, instance, replacing)) {
return false;
}
// +2 Is for PAN ID space
memcpy(mac64 + 2, replacing + 8, 8);
mac64[2] ^= 2;

if (ws_etx_read(cur, ADDR_802_15_4_LONG, mac64) == 0xffff) {
//Not proped yet because ETX is 0xffff
return false;
}

uint16_t etx = 0;
if (neigh_buffer.neighbor) {
etx = etx_local_etx_read(cur->id, neigh_buffer.neighbor->index);
}

// Accept now only better one's when max candidates selected and max candidate list size is reached
return rpl_possible_better_candidate(cur, instance, replacing, candidate_rank, etx);
}

//Neighbour allready
if (neigh_buffer.neighbor) {
return true;
}
#if 0
if (!rpl_control_find_worst_neighbor(cur, instance, replacing)) {
return false;
}
Expand All @@ -2200,7 +2229,7 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
etx = etx_local_etx_read(cur->id, neigh_buffer.neighbor->index);
}

// Accept now only better one's when max candidates slected and max candidate list size is reached
// Accept now only better one's when max candidates selected and max candidate list size is reached
if (!rpl_possible_better_candidate(cur, instance, replacing, candidate_rank, etx)) {
return false;
}
Expand All @@ -2216,16 +2245,15 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
create_ok = true;
goto neigh_create_ok;
}
#endif

//Discover Multicast temporary entry for create neighbour table entry for new candidate
memcpy(mac64, ll_parent_address + 8, 8);
mac64[0] ^= 2;
ws_neighbor_temp_class_t *entry = ws_llc_get_multicast_temp_entry(cur, mac64);
if (!entry) {
//No Multicast Entry Available
return false;
}

//Create entry
create_ok = ws_bootstrap_neighbor_info_request(cur, mac64, &neigh_buffer, true);
bool create_ok = ws_bootstrap_neighbor_info_request(cur, entry->mac64, &neigh_buffer, true);
if (create_ok) {
ws_neighbor_class_entry_t *ws_neigh = neigh_buffer.ws_neighbor;
//Copy fhss temporary data
Expand All @@ -2236,13 +2264,15 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
}
ws_llc_free_multicast_temp_entry(cur, entry);

#if 0
neigh_create_ok:

if (create_ok && replace_ok) {
//Try remove here when accepted new better one possible
tr_debug("Remove %s by %s", trace_ipv6(replacing), trace_ipv6(ll_parent_address));
rpl_control_neighbor_delete_from_instance(cur, instance, replacing);
}
#endif
return create_ok;
}

Expand Down Expand Up @@ -2655,7 +2685,6 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
cur->ws_info->trickle_pc_running = false;
cur->ws_info->trickle_pas_running = false;
cur->ws_info->trickle_pcs_running = false;
cur->ws_info->ns_probed_timer = 0;

if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
tr_info("Border router start network");
Expand Down Expand Up @@ -2972,15 +3001,6 @@ void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t s
ws_bootstrap_event_discovery_start(cur);
}
}

//Probe limiter timer
if (cur->ws_info->ns_probed_timer) {
if (cur->ws_info->ns_probed_timer > seconds) {
cur->ws_info->ns_probed_timer -= seconds;
} else {
cur->ws_info->ns_probed_timer = 0;
}
}
}

void ws_primary_parent_update(protocol_interface_info_entry_t *interface, mac_neighbor_table_entry_t *neighbor)
Expand Down
3 changes: 0 additions & 3 deletions source/6LoWPAN/ws/ws_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ typedef struct ws_info_s {
// default fhss parameters for this device
uint8_t fhss_uc_dwell_interval;
uint8_t fhss_bc_dwell_interval;
//NS Probe lmiter
uint32_t ns_probed_timer;

uint32_t fhss_bc_interval;
uint8_t fhss_uc_channel_function;
uint8_t fhss_bc_channel_function;
Expand Down
10 changes: 10 additions & 0 deletions source/RPL/rpl_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,16 @@ uint16_t rpl_control_candidate_list_size(protocol_interface_info_entry_t *interf

}

uint16_t rpl_control_selected_parent_count(protocol_interface_info_entry_t *interface, rpl_instance_t *rpl_instance)
{
if (!interface->rpl_domain) {
return 0;
}

return rpl_instance_address_candidate_count(rpl_instance, true);

}


bool rpl_control_probe_parent_candidate(protocol_interface_info_entry_t *interface, const uint8_t ll_addr[16])
{
Expand Down
1 change: 1 addition & 0 deletions source/RPL/rpl_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ bool rpl_control_probe_parent_candidate(struct protocol_interface_info_entry *in
bool rpl_possible_better_candidate(struct protocol_interface_info_entry *interface, struct rpl_instance *rpl_instance, const uint8_t ll_addr[16], uint16_t candidate_rank, uint16_t etx);
uint16_t rpl_control_parent_candidate_list_size(struct protocol_interface_info_entry *interface, bool parent_list);
uint16_t rpl_control_candidate_list_size(struct protocol_interface_info_entry *interface, struct rpl_instance *rpl_instance);
uint16_t rpl_control_selected_parent_count(struct protocol_interface_info_entry *interface, struct rpl_instance *rpl_instance);
void rpl_control_neighbor_delete(struct protocol_interface_info_entry *interface, const uint8_t ll_addr[16]);
void rpl_control_neighbor_delete_from_instance(struct protocol_interface_info_entry *interface, struct rpl_instance *rpl_instance, const uint8_t ll_addr[16]);
bool rpl_control_find_worst_neighbor(struct protocol_interface_info_entry *interface, struct rpl_instance *rpl_instance, uint8_t ll_addr[16]);
Expand Down
2 changes: 1 addition & 1 deletion source/RPL/rpl_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ uint16_t rpl_policy_dio_parent_selection_delay(rpl_domain_t *domain)
{
(void)domain;

return 19; /* seconds */
return 15; /* seconds */
}

uint16_t rpl_policy_repair_initial_dis_delay(rpl_domain_t *domain)
Expand Down
1 change: 1 addition & 0 deletions source/RPL/rpl_upward.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ void rpl_instance_trigger_parent_selection(rpl_instance_t *instance, uint16_t de
{
if (instance->parent_selection_timer == 0 || instance->parent_selection_timer > delay) {
instance->parent_selection_timer = randLIB_randomise_base(delay, 0x7333, 0x8CCD) /* +/- 10% */;
tr_debug("Timed parent triggered %u", instance->parent_selection_timer);
}
}

Expand Down
5 changes: 5 additions & 0 deletions test/nanostack/unittest/stub/rpl_control_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,8 @@ bool rpl_control_find_worst_neighbor(struct protocol_interface_info_entry *inter
{
return true;
}

uint16_t rpl_control_selected_parent_count(protocol_interface_info_entry_t *interface, rpl_instance_t *rpl_instance)
{
return 0;
}

0 comments on commit 0aead93

Please sign in to comment.