Skip to content

Commit 0aead93

Browse files
author
Juha Heiskanen
committed
Wi-sun Probe functionality revert operation
Removed Probe purge. Removed Neighbour Replacementation from wi-sun side. Added same Candidate accept rules than earlier. Change-Id: Ia6140d6dddf1c5dd19af720a96b145448aace0fa
1 parent 4ff02f9 commit 0aead93

File tree

7 files changed

+76
-42
lines changed

7 files changed

+76
-42
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 58 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,10 +1663,6 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
16631663
activate_nud = true;
16641664
} else {
16651665

1666-
if (cur->ws_info->ns_probed_timer > 7) {
1667-
return false;//Accept 1 probe start / every seconds call
1668-
}
1669-
16701666
ws_bootsrap_create_ll_address(ll_address, entry_ptr->mac64);
16711667
if (!rpl_control_probe_parent_candidate(cur, ll_address)) {
16721668
return false;
@@ -1704,12 +1700,6 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
17041700
}
17051701

17061702
entry->nud_process = nud_proces;
1707-
if (!nud_proces) {
1708-
cur->ws_info->ns_probed_timer += 8;
1709-
if (cur->ws_info->ns_probed_timer > 32) {
1710-
cur->ws_info->ns_probed_timer = 32;
1711-
}
1712-
}
17131703

17141704
return true;
17151705
}
@@ -2145,16 +2135,26 @@ static void ws_rpl_prefix_callback(prefix_entry_t *prefix, void *handle, uint8_t
21452135
}
21462136
}
21472137

2148-
static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle, struct rpl_instance *instance, uint16_t candidate_rank)
2138+
static bool ws_rpl_candidate_soft_filtering(protocol_interface_info_entry_t *cur, struct rpl_instance *instance)
21492139
{
2140+
//Already many candidates
2141+
if (rpl_control_candidate_list_size(cur, instance) > cur->ws_info->rpl_parent_candidate_max) {
2142+
return false;
2143+
}
21502144

2151-
protocol_interface_info_entry_t *cur = handle;
2152-
if (!cur->rpl_domain || cur->interface_mode != INTERFACE_UP) {
2145+
//Already enough selected candidates
2146+
if (rpl_control_selected_parent_count(cur, instance) >= cur->ws_info->rpl_selected_parent_max) {
21532147
return false;
21542148
}
21552149

2156-
if (cur->ws_info->ns_probed_timer > 8) {
2157-
//2 probe have been done so Try to avoid put more before accept new one's
2150+
return true;
2151+
}
2152+
2153+
static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle, struct rpl_instance *instance, uint16_t candidate_rank)
2154+
{
2155+
2156+
protocol_interface_info_entry_t *cur = handle;
2157+
if (!cur->rpl_domain || cur->interface_mode != INTERFACE_UP) {
21582158
return false;
21592159
}
21602160

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

2166-
uint8_t replacing[16];
21672166
uint8_t mac64[10];
2168-
bool replace_ok = false;
2169-
bool create_ok = false;
2167+
//bool replace_ok = false;
2168+
//bool create_ok = false;
21702169
llc_neighbour_req_t neigh_buffer;
21712170

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

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

2180+
if (!ws_rpl_candidate_soft_filtering(cur, instance)) {
2181+
if (!neigh_buffer.neighbor) {
2182+
//Do not accept any new in that Place
2183+
return false;
2184+
}
21782185

2179-
if (rpl_control_candidate_list_size(cur, instance) < cur->ws_info->rpl_parent_candidate_max) {
2180-
//Not reach max value yet accept then all go to create neigh table
2181-
goto neigh_create;
2182-
}
2186+
uint8_t replacing[16];
2187+
//Accept Know neighbour if it is enough good
2188+
if (!rpl_control_find_worst_neighbor(cur, instance, replacing)) {
2189+
return false;
2190+
}
2191+
// +2 Is for PAN ID space
2192+
memcpy(mac64 + 2, replacing + 8, 8);
2193+
mac64[2] ^= 2;
2194+
2195+
if (ws_etx_read(cur, ADDR_802_15_4_LONG, mac64) == 0xffff) {
2196+
//Not proped yet because ETX is 0xffff
2197+
return false;
2198+
}
21832199

2200+
uint16_t etx = 0;
2201+
if (neigh_buffer.neighbor) {
2202+
etx = etx_local_etx_read(cur->id, neigh_buffer.neighbor->index);
2203+
}
21842204

2205+
// Accept now only better one's when max candidates selected and max candidate list size is reached
2206+
return rpl_possible_better_candidate(cur, instance, replacing, candidate_rank, etx);
2207+
}
2208+
2209+
//Neighbour allready
2210+
if (neigh_buffer.neighbor) {
2211+
return true;
2212+
}
2213+
#if 0
21852214
if (!rpl_control_find_worst_neighbor(cur, instance, replacing)) {
21862215
return false;
21872216
}
@@ -2200,7 +2229,7 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
22002229
etx = etx_local_etx_read(cur->id, neigh_buffer.neighbor->index);
22012230
}
22022231

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

2220-
//Discover Multicast temporary entry for create neighbour table entry for new candidate
2221-
memcpy(mac64, ll_parent_address + 8, 8);
2222-
mac64[0] ^= 2;
2223-
ws_neighbor_temp_class_t *entry = ws_llc_get_multicast_temp_entry(cur, mac64);
22242250
if (!entry) {
2251+
//No Multicast Entry Available
22252252
return false;
22262253
}
2254+
22272255
//Create entry
2228-
create_ok = ws_bootstrap_neighbor_info_request(cur, mac64, &neigh_buffer, true);
2256+
bool create_ok = ws_bootstrap_neighbor_info_request(cur, entry->mac64, &neigh_buffer, true);
22292257
if (create_ok) {
22302258
ws_neighbor_class_entry_t *ws_neigh = neigh_buffer.ws_neighbor;
22312259
//Copy fhss temporary data
@@ -2236,13 +2264,15 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
22362264
}
22372265
ws_llc_free_multicast_temp_entry(cur, entry);
22382266

2267+
#if 0
22392268
neigh_create_ok:
22402269

22412270
if (create_ok && replace_ok) {
22422271
//Try remove here when accepted new better one possible
22432272
tr_debug("Remove %s by %s", trace_ipv6(replacing), trace_ipv6(ll_parent_address));
22442273
rpl_control_neighbor_delete_from_instance(cur, instance, replacing);
22452274
}
2275+
#endif
22462276
return create_ok;
22472277
}
22482278

@@ -2655,7 +2685,6 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
26552685
cur->ws_info->trickle_pc_running = false;
26562686
cur->ws_info->trickle_pas_running = false;
26572687
cur->ws_info->trickle_pcs_running = false;
2658-
cur->ws_info->ns_probed_timer = 0;
26592688

26602689
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
26612690
tr_info("Border router start network");
@@ -2972,15 +3001,6 @@ void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t s
29723001
ws_bootstrap_event_discovery_start(cur);
29733002
}
29743003
}
2975-
2976-
//Probe limiter timer
2977-
if (cur->ws_info->ns_probed_timer) {
2978-
if (cur->ws_info->ns_probed_timer > seconds) {
2979-
cur->ws_info->ns_probed_timer -= seconds;
2980-
} else {
2981-
cur->ws_info->ns_probed_timer = 0;
2982-
}
2983-
}
29843004
}
29853005

29863006
void ws_primary_parent_update(protocol_interface_info_entry_t *interface, mac_neighbor_table_entry_t *neighbor)

source/6LoWPAN/ws/ws_common.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ typedef struct ws_info_s {
9191
// default fhss parameters for this device
9292
uint8_t fhss_uc_dwell_interval;
9393
uint8_t fhss_bc_dwell_interval;
94-
//NS Probe lmiter
95-
uint32_t ns_probed_timer;
96-
9794
uint32_t fhss_bc_interval;
9895
uint8_t fhss_uc_channel_function;
9996
uint8_t fhss_bc_channel_function;

source/RPL/rpl_control.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,16 @@ uint16_t rpl_control_candidate_list_size(protocol_interface_info_entry_t *interf
257257

258258
}
259259

260+
uint16_t rpl_control_selected_parent_count(protocol_interface_info_entry_t *interface, rpl_instance_t *rpl_instance)
261+
{
262+
if (!interface->rpl_domain) {
263+
return 0;
264+
}
265+
266+
return rpl_instance_address_candidate_count(rpl_instance, true);
267+
268+
}
269+
260270

261271
bool rpl_control_probe_parent_candidate(protocol_interface_info_entry_t *interface, const uint8_t ll_addr[16])
262272
{

source/RPL/rpl_control.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ bool rpl_control_probe_parent_candidate(struct protocol_interface_info_entry *in
158158
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);
159159
uint16_t rpl_control_parent_candidate_list_size(struct protocol_interface_info_entry *interface, bool parent_list);
160160
uint16_t rpl_control_candidate_list_size(struct protocol_interface_info_entry *interface, struct rpl_instance *rpl_instance);
161+
uint16_t rpl_control_selected_parent_count(struct protocol_interface_info_entry *interface, struct rpl_instance *rpl_instance);
161162
void rpl_control_neighbor_delete(struct protocol_interface_info_entry *interface, const uint8_t ll_addr[16]);
162163
void rpl_control_neighbor_delete_from_instance(struct protocol_interface_info_entry *interface, struct rpl_instance *rpl_instance, const uint8_t ll_addr[16]);
163164
bool rpl_control_find_worst_neighbor(struct protocol_interface_info_entry *interface, struct rpl_instance *rpl_instance, uint8_t ll_addr[16]);

source/RPL/rpl_policy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ uint16_t rpl_policy_dio_parent_selection_delay(rpl_domain_t *domain)
238238
{
239239
(void)domain;
240240

241-
return 19; /* seconds */
241+
return 15; /* seconds */
242242
}
243243

244244
uint16_t rpl_policy_repair_initial_dis_delay(rpl_domain_t *domain)

source/RPL/rpl_upward.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ void rpl_instance_trigger_parent_selection(rpl_instance_t *instance, uint16_t de
356356
{
357357
if (instance->parent_selection_timer == 0 || instance->parent_selection_timer > delay) {
358358
instance->parent_selection_timer = randLIB_randomise_base(delay, 0x7333, 0x8CCD) /* +/- 10% */;
359+
tr_debug("Timed parent triggered %u", instance->parent_selection_timer);
359360
}
360361
}
361362

test/nanostack/unittest/stub/rpl_control_stub.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,8 @@ bool rpl_control_find_worst_neighbor(struct protocol_interface_info_entry *inter
278278
{
279279
return true;
280280
}
281+
282+
uint16_t rpl_control_selected_parent_count(protocol_interface_info_entry_t *interface, rpl_instance_t *rpl_instance)
283+
{
284+
return 0;
285+
}

0 commit comments

Comments
 (0)