@@ -663,33 +663,8 @@ uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr
663
663
ws_neighbor_class_entry_t * ws_neighbour = ws_neighbor_class_entry_get (& interface -> ws_info -> neighbor_storage , attribute_index );
664
664
etx_storage_t * etx_entry = etx_storage_entry_get (interface -> id , attribute_index );
665
665
666
- if (interface -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER ) {
667
- if (!ws_neighbour || !etx_entry ) {
668
- return 0xffff ;
669
- }
670
- } else {
671
-
672
- if (!ws_neighbour || !etx_entry || etx_entry -> etx_samples < 1 /*||
673
- !ws_neighbour->candidate_parent*/ ) {
674
- // if RSL value is not good enough candidate parent flag is removed and device not accepted as parent
675
- //tr_debug("ws_etx_read not valid params");
676
- return 0xffff ;
677
- }
678
-
679
- //If we are not following gbobal Broadcast synch
680
- if (!interface -> ws_info -> pan_information .use_parent_bs ) {
681
- //We must know both information's here
682
- if (!ws_neighbour -> broadcast_shedule_info_stored ||
683
- !ws_neighbour -> broadcast_timing_info_stored ) {
684
- return 0xffff ;
685
- }
686
- } else {
687
- if (!ws_neighbour -> broadcast_timing_info_stored ) {
688
- //Global shedule is stored already
689
- tr_debug ("ws_etx_read not valid NO BTI" );
690
- return 0xffff ;
691
- }
692
- }
666
+ if (!ws_neighbour || !etx_entry ) {
667
+ return 0xffff ;
693
668
}
694
669
695
670
etx = etx_local_etx_read (interface -> id , attribute_index );
@@ -1497,7 +1472,7 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
1497
1472
continue ;
1498
1473
}
1499
1474
1500
- if (cur -> nud_active || ws_neighbor -> accelerated_etx_probe || ws_neighbor -> negative_aro_send ) {
1475
+ if (cur -> nud_active || ws_neighbor -> negative_aro_send ) {
1501
1476
//If NUD process is active do not trig
1502
1477
continue ;
1503
1478
}
@@ -1657,34 +1632,28 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
1657
1632
}
1658
1633
}
1659
1634
nud_proces = activate_nud ;
1660
- } else if (etx_entry -> etx_samples < WS_NEIGBOR_ETX_SAMPLE_MAX ) {
1635
+ } else if (etx_entry -> etx_samples < WS_NEIGHBOR_ETX_SAMPLE_MAX ) {
1661
1636
//Take Random number for trig a prope.
1662
1637
//ETX Sample 0: random 1-8
1663
1638
//ETX Sample 1: random 2-16
1664
1639
//ETX Sample 2: random 4-32
1665
- if (etx_entry -> etx_samples == 0 && ws_neighbor -> accelerated_etx_probe ) {
1666
- //Accept quick Probe for init ETX
1667
- activate_nud = true;
1668
- } else {
1669
-
1670
- ws_bootsrap_create_ll_address (ll_address , entry_ptr -> mac64 );
1671
- if (!rpl_control_probe_parent_candidate (cur , ll_address )) {
1672
- return false;
1673
- }
1640
+ ws_bootsrap_create_ll_address (ll_address , entry_ptr -> mac64 );
1641
+ if (!rpl_control_probe_parent_candidate (cur , ll_address )) {
1642
+ return false;
1643
+ }
1674
1644
1675
1645
1676
- uint32_t probe_period = WS_PROBE_INIT_BASE_SECONDS << etx_entry -> etx_samples ;
1677
- uint32_t time_block = 1 << etx_entry -> etx_samples ;
1678
- if (time_from_start >= probe_period ) {
1679
- //tr_debug("Link Probe test %u Sample trig", etx_entry->etx_samples);
1646
+ uint32_t probe_period = WS_PROBE_INIT_BASE_SECONDS << etx_entry -> etx_samples ;
1647
+ uint32_t time_block = 1 << etx_entry -> etx_samples ;
1648
+ if (time_from_start >= probe_period ) {
1649
+ //tr_debug("Link Probe test %u Sample trig", etx_entry->etx_samples);
1650
+ activate_nud = true;
1651
+ } else if (time_from_start > time_block ) {
1652
+ uint16_t switch_prob = randLIB_get_random_in_range (0 , probe_period - 1 );
1653
+ //Take Random from time WS_NEIGHBOR_NUD_TIMEOUT - WS_NEIGHBOR_NUD_TIMEOUT*1.5
1654
+ if (switch_prob < 2 ) {
1655
+ //tr_debug("Link Probe test with jitter %"PRIu32", sample %u", time_from_start, etx_entry->etx_samples);
1680
1656
activate_nud = true;
1681
- } else if (time_from_start > time_block ) {
1682
- uint16_t switch_prob = randLIB_get_random_in_range (0 , probe_period - 1 );
1683
- //Take Random from time WS_NEIGHBOR_NUD_TIMEOUT - WS_NEIGHBOR_NUD_TIMEOUT*1.5
1684
- if (switch_prob < 2 ) {
1685
- //tr_debug("Link Probe test with jitter %"PRIu32", sample %u", time_from_start, etx_entry->etx_samples);
1686
- activate_nud = true;
1687
- }
1688
1657
}
1689
1658
}
1690
1659
}
@@ -1698,10 +1667,6 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
1698
1667
return false;
1699
1668
}
1700
1669
entry -> neighbor_info = entry_ptr ;
1701
- if (ws_neighbor -> accelerated_etx_probe ) {
1702
- ws_neighbor -> accelerated_etx_probe = false;
1703
- entry -> timer = 1 ;
1704
- }
1705
1670
1706
1671
entry -> nud_process = nud_proces ;
1707
1672
@@ -1737,12 +1702,13 @@ int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode)
1737
1702
if (!etx_storage_list_allocate (cur -> id , buffer .device_decription_table_size )) {
1738
1703
return -1 ;
1739
1704
}
1740
- if (!etx_cached_etx_parameter_set (WS_ETX_MIN_WAIT_TIME , WS_ETX_MIN_SAMPLE_COUNT )) {
1705
+ if (!etx_cached_etx_parameter_set (WS_ETX_MIN_WAIT_TIME , WS_ETX_MIN_SAMPLE_COUNT , WS_NEIGHBOR_FIRST_ETX_SAMPLE_MIN_COUNT )) {
1741
1706
etx_storage_list_allocate (cur -> id , 0 );
1742
1707
return -1 ;
1743
1708
}
1744
1709
1745
1710
etx_max_update_set (WS_ETX_MAX_UPDATE );
1711
+ etx_max_set (WS_ETX_MAX );
1746
1712
1747
1713
if (blacklist_init () != 0 ) {
1748
1714
tr_err ("MLE blacklist init failed." );
@@ -2597,10 +2563,7 @@ static uint16_t ws_bootstrap_routing_cost_calculate(protocol_interface_info_entr
2597
2563
if (etx == 0 ) {
2598
2564
etx = 0xffff ;
2599
2565
}
2600
- if (etx > 0x800 ) {
2601
- // Wi-SUN section 6.2.3.1.6.1 says ETX can only be maximum of 1024 (8*128) in RPL units, ie 8.0.
2602
- etx = 0x800 ;
2603
- }
2566
+ //Scale to 128 based ETX (local read retur 0x100 - 0xffff
2604
2567
etx = etx >> 1 ;
2605
2568
2606
2569
return ws_neighbor -> routing_cost + etx ;
@@ -3076,23 +3039,4 @@ void ws_secondary_parent_update(protocol_interface_info_entry_t *interface)
3076
3039
}
3077
3040
}
3078
3041
3079
- void ws_bootstrap_etx_accelerate (protocol_interface_info_entry_t * interface , mac_neighbor_table_entry_t * neigh )
3080
- {
3081
- ws_neighbor_class_entry_t * ws_neighbor = ws_neighbor_class_entry_get (& interface -> ws_info -> neighbor_storage , neigh -> index );
3082
- //Enable Faster ETX probing
3083
- ws_neighbor -> accelerated_etx_probe = true;
3084
- //Move Neighbor to first to for accelerate Process
3085
- mac_neighbor_table_t * table_class = mac_neighbor_info (interface );
3086
- ns_list_remove (& table_class -> neighbour_list , neigh );
3087
- ns_list_add_to_start (& table_class -> neighbour_list , neigh );
3088
- //Try to Generate Active NUD Immediately
3089
- if (!ws_neighbor_entry_nud_notify (neigh , interface )) {
3090
- return ;//Return if NUD active is full
3091
- }
3092
- table_class -> active_nud_process ++ ;
3093
- neigh -> nud_active = true;
3094
- //Push NS to send
3095
- ws_nud_active_timer (interface , 0 );
3096
- }
3097
-
3098
3042
#endif //HAVE_WS
0 commit comments