@@ -1663,10 +1663,6 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
1663
1663
activate_nud = true;
1664
1664
} else {
1665
1665
1666
- if (cur -> ws_info -> ns_probed_timer > 7 ) {
1667
- return false;//Accept 1 probe start / every seconds call
1668
- }
1669
-
1670
1666
ws_bootsrap_create_ll_address (ll_address , entry_ptr -> mac64 );
1671
1667
if (!rpl_control_probe_parent_candidate (cur , ll_address )) {
1672
1668
return false;
@@ -1704,12 +1700,6 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
1704
1700
}
1705
1701
1706
1702
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
- }
1713
1703
1714
1704
return true;
1715
1705
}
@@ -2145,16 +2135,26 @@ static void ws_rpl_prefix_callback(prefix_entry_t *prefix, void *handle, uint8_t
2145
2135
}
2146
2136
}
2147
2137
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 )
2149
2139
{
2140
+ //Already many candidates
2141
+ if (rpl_control_candidate_list_size (cur , instance ) > cur -> ws_info -> rpl_parent_candidate_max ) {
2142
+ return false;
2143
+ }
2150
2144
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 ) {
2153
2147
return false;
2154
2148
}
2155
2149
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 ) {
2158
2158
return false;
2159
2159
}
2160
2160
@@ -2163,25 +2163,54 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
2163
2163
return false;
2164
2164
}
2165
2165
2166
- uint8_t replacing [16 ];
2167
2166
uint8_t mac64 [10 ];
2168
- bool replace_ok = false;
2169
- bool create_ok = false;
2167
+ // bool replace_ok = false;
2168
+ // bool create_ok = false;
2170
2169
llc_neighbour_req_t neigh_buffer ;
2171
2170
2172
2171
//Discover neigh ready here for possible ETX validate
2173
2172
memcpy (mac64 , ll_parent_address + 8 , 8 );
2174
2173
mac64 [0 ] ^= 2 ;
2175
2174
2175
+
2176
2176
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 );
2177
2179
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
+ }
2178
2185
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
+ }
2183
2199
2200
+ uint16_t etx = 0 ;
2201
+ if (neigh_buffer .neighbor ) {
2202
+ etx = etx_local_etx_read (cur -> id , neigh_buffer .neighbor -> index );
2203
+ }
2184
2204
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
2185
2214
if (!rpl_control_find_worst_neighbor (cur , instance , replacing )) {
2186
2215
return false;
2187
2216
}
@@ -2200,7 +2229,7 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
2200
2229
etx = etx_local_etx_read (cur -> id , neigh_buffer .neighbor -> index );
2201
2230
}
2202
2231
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
2204
2233
if (!rpl_possible_better_candidate (cur , instance , replacing , candidate_rank , etx )) {
2205
2234
return false;
2206
2235
}
@@ -2216,16 +2245,15 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
2216
2245
create_ok = true;
2217
2246
goto neigh_create_ok ;
2218
2247
}
2248
+ #endif
2219
2249
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 );
2224
2250
if (!entry ) {
2251
+ //No Multicast Entry Available
2225
2252
return false;
2226
2253
}
2254
+
2227
2255
//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);
2229
2257
if (create_ok ) {
2230
2258
ws_neighbor_class_entry_t * ws_neigh = neigh_buffer .ws_neighbor ;
2231
2259
//Copy fhss temporary data
@@ -2236,13 +2264,15 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
2236
2264
}
2237
2265
ws_llc_free_multicast_temp_entry (cur , entry );
2238
2266
2267
+ #if 0
2239
2268
neigh_create_ok :
2240
2269
2241
2270
if (create_ok && replace_ok ) {
2242
2271
//Try remove here when accepted new better one possible
2243
2272
tr_debug ("Remove %s by %s" , trace_ipv6 (replacing ), trace_ipv6 (ll_parent_address ));
2244
2273
rpl_control_neighbor_delete_from_instance (cur , instance , replacing );
2245
2274
}
2275
+ #endif
2246
2276
return create_ok ;
2247
2277
}
2248
2278
@@ -2655,7 +2685,6 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
2655
2685
cur -> ws_info -> trickle_pc_running = false;
2656
2686
cur -> ws_info -> trickle_pas_running = false;
2657
2687
cur -> ws_info -> trickle_pcs_running = false;
2658
- cur -> ws_info -> ns_probed_timer = 0 ;
2659
2688
2660
2689
if (cur -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER ) {
2661
2690
tr_info ("Border router start network" );
@@ -2972,15 +3001,6 @@ void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t s
2972
3001
ws_bootstrap_event_discovery_start (cur );
2973
3002
}
2974
3003
}
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
- }
2984
3004
}
2985
3005
2986
3006
void ws_primary_parent_update (protocol_interface_info_entry_t * interface , mac_neighbor_table_entry_t * neighbor )
0 commit comments