@@ -95,6 +95,7 @@ static void ws_bootstrap_authentication_completed(protocol_interface_info_entry_
95
95
static void ws_bootstrap_pan_version_increment (protocol_interface_info_entry_t * cur );
96
96
static ws_nud_table_entry_t * ws_nud_entry_discover (protocol_interface_info_entry_t * cur , void * neighbor );
97
97
static void ws_nud_entry_remove (protocol_interface_info_entry_t * cur , mac_neighbor_table_entry_t * entry_ptr );
98
+ static bool ws_neighbor_entry_nud_notify (mac_neighbor_table_entry_t * entry_ptr , void * user_data );
98
99
99
100
typedef enum {
100
101
WS_PARENT_SOFT_SYNCH = 0 , /**< let FHSS make decision if synchronization is needed*/
@@ -322,6 +323,8 @@ void ws_nud_active_timer(protocol_interface_info_entry_t *cur, uint16_t ticks)
322
323
//Convert TICKS to real milliseconds
323
324
if (ticks > 0xffff / 100 ) {
324
325
ticks = 0xffff ;
326
+ } else if (ticks == 0 ) {
327
+ ticks = 1 ;
325
328
} else {
326
329
ticks *= 100 ;
327
330
}
@@ -1279,12 +1282,18 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
1279
1282
1280
1283
mac_neighbor_table_entry_t * neighbor_entry_ptr = NULL ;
1281
1284
ns_list_foreach_safe (mac_neighbor_table_entry_t , cur , & mac_neighbor_info (interface )-> neighbour_list ) {
1285
+ ws_neighbor_class_entry_t * ws_neighbor = ws_neighbor_class_entry_get (& interface -> ws_info -> neighbor_storage , cur -> index );
1282
1286
1283
1287
if (cur -> link_role == PRIORITY_PARENT_NEIGHBOUR ) {
1284
1288
//This is our primary parent we cannot delete
1285
1289
continue ;
1286
1290
}
1287
1291
1292
+ if (cur -> nud_active || ws_neighbor -> accelerated_etx_probe || ws_neighbor -> negative_aro_send ) {
1293
+ //If NUD process is active do not trig
1294
+ continue ;
1295
+ }
1296
+
1288
1297
if (neighbor_entry_ptr && neighbor_entry_ptr -> lifetime < cur -> lifetime ) {
1289
1298
// We have already shorter link entry found this cannot replace it
1290
1299
continue ;
@@ -1397,7 +1406,7 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
1397
1406
ws_neighbor_class_entry_t * ws_neighbor = ws_neighbor_class_entry_get (& cur -> ws_info -> neighbor_storage , entry_ptr -> index );
1398
1407
etx_storage_t * etx_entry = etx_storage_entry_get (cur -> id , entry_ptr -> index );
1399
1408
1400
- if (!entry_ptr -> trusted_device || !ws_neighbor || !etx_entry ) {
1409
+ if (!entry_ptr -> trusted_device || !ws_neighbor || !etx_entry || ws_neighbor -> negative_aro_send ) {
1401
1410
return false;
1402
1411
}
1403
1412
@@ -1417,17 +1426,22 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
1417
1426
//ETX Sample 0: random 1-8
1418
1427
//ETX Sample 1: random 2-16
1419
1428
//ETX Sample 2: random 4-32
1420
- uint32_t probe_period = WS_PROBE_INIT_BASE_SECONDS << etx_entry -> etx_samples ;
1421
- uint32_t time_block = 1 << etx_entry -> etx_samples ;
1422
- if (time_from_start >= probe_period ) {
1423
- //tr_debug("Link Probe test %u Sample trig", etx_entry->etx_samples);
1429
+ if (etx_entry -> etx_samples == 0 && ws_neighbor -> accelerated_etx_probe ) {
1430
+ //Accept quick Probe for init ETX
1424
1431
activate_nud = true;
1425
- } else if ( time_from_start > time_block ) {
1426
- uint16_t switch_prob = randLIB_get_random_in_range ( 0 , probe_period - 1 ) ;
1427
- //Take Random from time WS_NEIGHBOR_NUD_TIMEOUT - WS_NEIGHBOR_NUD_TIMEOUT*1.5
1428
- if (switch_prob < 2 ) {
1429
- //tr_debug("Link Probe test with jitter %"PRIu32", sample %u", time_from_start , etx_entry->etx_samples);
1432
+ } else {
1433
+ uint32_t probe_period = WS_PROBE_INIT_BASE_SECONDS << etx_entry -> etx_samples ;
1434
+ uint32_t time_block = 1 << etx_entry -> etx_samples ;
1435
+ if (time_from_start >= probe_period ) {
1436
+ //tr_debug("Link Probe test %u Sample trig" , etx_entry->etx_samples);
1430
1437
activate_nud = true;
1438
+ } else if (time_from_start > time_block ) {
1439
+ uint16_t switch_prob = randLIB_get_random_in_range (0 , probe_period - 1 );
1440
+ //Take Random from time WS_NEIGHBOR_NUD_TIMEOUT - WS_NEIGHBOR_NUD_TIMEOUT*1.5
1441
+ if (switch_prob < 2 ) {
1442
+ //tr_debug("Link Probe test with jitter %"PRIu32", sample %u", time_from_start, etx_entry->etx_samples);
1443
+ activate_nud = true;
1444
+ }
1431
1445
}
1432
1446
}
1433
1447
}
@@ -1441,6 +1455,10 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
1441
1455
return false;
1442
1456
}
1443
1457
entry -> neighbor_info = entry_ptr ;
1458
+ if (ws_neighbor -> accelerated_etx_probe ) {
1459
+ ws_neighbor -> accelerated_etx_probe = false;
1460
+ entry -> timer = 1 ;
1461
+ }
1444
1462
1445
1463
if (etx_entry -> etx_samples >= WS_NEIGBOR_ETX_SAMPLE_MAX ) {
1446
1464
entry -> nud_process = true;
@@ -2626,4 +2644,24 @@ void ws_secondary_parent_update(protocol_interface_info_entry_t *interface)
2626
2644
}
2627
2645
}
2628
2646
2647
+ void ws_bootstrap_etx_accelerate (protocol_interface_info_entry_t * interface , mac_neighbor_table_entry_t * neigh )
2648
+ {
2649
+ ws_neighbor_class_entry_t * ws_neighbor = ws_neighbor_class_entry_get (& interface -> ws_info -> neighbor_storage , neigh -> index );
2650
+ //Enable Faster ETX probing
2651
+ ws_neighbor -> accelerated_etx_probe = true;
2652
+ //Move Neighbor to first to for accelerate Process
2653
+ mac_neighbor_table_t * table_class = mac_neighbor_info (interface );
2654
+ ns_list_remove (& table_class -> neighbour_list , neigh );
2655
+ ns_list_add_to_start (& table_class -> neighbour_list , neigh );
2656
+ //Try to Generate Active NUD Immediately
2657
+ if (!ws_neighbor_entry_nud_notify (neigh , interface )) {
2658
+ return ;//Return if NUD active is full
2659
+ }
2660
+ table_class -> active_nud_process ++ ;
2661
+ neigh -> nud_active = true;
2662
+ //Push NS to send
2663
+ ws_nud_active_timer (interface , 0 );
2664
+
2665
+ }
2666
+
2629
2667
#endif //HAVE_WS
0 commit comments