@@ -663,33 +663,8 @@ uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr
663663 ws_neighbor_class_entry_t * ws_neighbour = ws_neighbor_class_entry_get (& interface -> ws_info -> neighbor_storage , attribute_index );
664664 etx_storage_t * etx_entry = etx_storage_entry_get (interface -> id , attribute_index );
665665
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 ;
693668 }
694669
695670 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
14971472 continue ;
14981473 }
14991474
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 ) {
15011476 //If NUD process is active do not trig
15021477 continue ;
15031478 }
@@ -1657,34 +1632,28 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
16571632 }
16581633 }
16591634 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 ) {
16611636 //Take Random number for trig a prope.
16621637 //ETX Sample 0: random 1-8
16631638 //ETX Sample 1: random 2-16
16641639 //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+ }
16741644
16751645
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);
16801656 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- }
16881657 }
16891658 }
16901659 }
@@ -1698,10 +1667,6 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
16981667 return false;
16991668 }
17001669 entry -> neighbor_info = entry_ptr ;
1701- if (ws_neighbor -> accelerated_etx_probe ) {
1702- ws_neighbor -> accelerated_etx_probe = false;
1703- entry -> timer = 1 ;
1704- }
17051670
17061671 entry -> nud_process = nud_proces ;
17071672
@@ -1737,12 +1702,13 @@ int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode)
17371702 if (!etx_storage_list_allocate (cur -> id , buffer .device_decription_table_size )) {
17381703 return -1 ;
17391704 }
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 )) {
17411706 etx_storage_list_allocate (cur -> id , 0 );
17421707 return -1 ;
17431708 }
17441709
17451710 etx_max_update_set (WS_ETX_MAX_UPDATE );
1711+ etx_max_set (WS_ETX_MAX );
17461712
17471713 if (blacklist_init () != 0 ) {
17481714 tr_err ("MLE blacklist init failed." );
@@ -2597,10 +2563,7 @@ static uint16_t ws_bootstrap_routing_cost_calculate(protocol_interface_info_entr
25972563 if (etx == 0 ) {
25982564 etx = 0xffff ;
25992565 }
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
26042567 etx = etx >> 1 ;
26052568
26062569 return ws_neighbor -> routing_cost + etx ;
@@ -3076,23 +3039,4 @@ void ws_secondary_parent_update(protocol_interface_info_entry_t *interface)
30763039 }
30773040}
30783041
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-
30983042#endif //HAVE_WS
0 commit comments