Skip to content

Commit b50abb0

Browse files
author
Juha Heiskanen
committed
RPL, FHSS and Wisun Update
Channel switch will be cancelled if active TX wait ACK. Wi-sun neighbor NUD callback will trig a init NS probe to new learned neighbor if ETX is uninitialized. Wi-sun NUD will be done to all neighbours Wi-sun disable auto probe at Neigh cache. Wi-sun BBR accept 2 path to root. RPL unicast DIS tx will be randomized. Change-Id: Ib563bf88d91842113ba1db45fff83bc3e2d35ca4
1 parent a40e012 commit b50abb0

File tree

12 files changed

+44
-15
lines changed

12 files changed

+44
-15
lines changed

source/6LoWPAN/ws/ws_bbr_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static void ws_bbr_rpl_root_activate(uint8_t *dodag_prefix, uint8_t *dodag_id)
5555
.lifetime_unit = 60,
5656
.objective_code_point = 1, // MRHOF algorithm used
5757
.authentication = 0,
58-
.path_control_size = 0,
58+
.path_control_size = 1,
5959
.dag_max_rank_increase = 2048,
6060
.min_hop_rank_increase = 128,
6161
// DIO configuration

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,9 @@ uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr
360360
}
361361
attribute_index = mac_neighbor->index;
362362
ws_neighbor_class_entry_t *ws_neighbour = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, attribute_index);
363+
etx_storage_t *etx_entry = etx_storage_entry_get(interface->id, attribute_index);
363364

364-
if (!ws_neighbour ||
365+
if (!ws_neighbour || !etx_entry || etx_entry->etx_samples < 1 ||
365366
!ws_neighbour->candidate_parent) {
366367
// if RSL value is not good enough candidate parent flag is removed and device not accepted as parent
367368
//tr_debug("ws_etx_read not valid parent");
@@ -397,6 +398,8 @@ static int8_t ws_bootstrap_up(protocol_interface_info_entry_t *cur)
397398
tr_error("fhss initialization failed");
398399
return -3;
399400
}
401+
402+
400403
// Save FHSS api
401404
cur->ws_info->fhss_api = ns_sw_mac_get_fhss_api(cur->mac_api);
402405

@@ -412,6 +415,8 @@ static int8_t ws_bootstrap_up(protocol_interface_info_entry_t *cur)
412415
cur->ipv6_neighbour_cache.use_eui64_as_slla_in_aro = true;
413416
/* Omit sending of NA if ARO SUCCESS */
414417
cur->ipv6_neighbour_cache.omit_aro_success = true;
418+
/* Disable NUD Probes */
419+
cur->ipv6_neighbour_cache.send_nud_probes = false;
415420

416421
ws_bootstrap_event_discovery_start(cur);
417422

@@ -714,7 +719,6 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
714719
ws_neighbor_class_neighbor_unicast_schedule_set(neighbor_info.ws_neighbor, ws_us);
715720
ws_neighbor_class_neighbor_broadcast_time_info_update(neighbor_info.ws_neighbor, &ws_bt_ie, data->timestamp);
716721
ws_neighbor_class_neighbor_broadcast_schedule_set(neighbor_info.ws_neighbor, &ws_bs_ie);
717-
neighbor_info.neighbor->trusted_device = true;
718722

719723
if (cur->ws_info->configuration_learned) {
720724
// received version is lower se we need to reset the trickle
@@ -972,24 +976,38 @@ static void ws_neighbor_entry_remove_notify(mac_neighbor_table_entry_t *entry_pt
972976
ws_bootstrap_neighbor_delete(cur,entry_ptr->index);
973977
}
974978

975-
976979
static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr, void *user_data)
977980
{
978981
uint32_t time_from_start = entry_ptr->link_lifetime - entry_ptr->lifetime;
979982
bool activate_nud = false;
980-
if ((entry_ptr->link_role == PRIORITY_PARENT_NEIGHBOUR || entry_ptr->link_role == SECONDARY_PARENT_NEIGHBOUR) && time_from_start > WS_NEIGHBOR_NUD_TIMEOUT) {
981-
if (entry_ptr->trusted_device) {
983+
protocol_interface_info_entry_t *cur = user_data;
984+
985+
ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&cur->ws_info->neighbor_storage, entry_ptr->index);
986+
etx_storage_t *etx_entry = etx_storage_entry_get(cur->id, entry_ptr->index);
987+
988+
if (!entry_ptr->trusted_device || !ws_neighbor || !etx_entry) {
989+
return false;
990+
}
991+
992+
if (time_from_start > WS_NEIGHBOR_NUD_TIMEOUT) {
993+
//Take Random from 1-1.5 time WS_NEIGHBOR_NUD_TIMEOUT
994+
uint32_t compare_random = randLIB_randomise_base(WS_NEIGHBOR_NUD_TIMEOUT, 0x8000, 0xC000);
995+
if (time_from_start > compare_random) {
996+
activate_nud = true;
997+
}
998+
} else if (etx_entry->etx_samples < 1) {
999+
uint32_t compare_random = randLIB_get_random_in_range(0, 8);
1000+
if (time_from_start > compare_random) {
1001+
tr_debug("Link Probe test %u with jitter", compare_random);
9821002
activate_nud = true;
9831003
}
984-
9851004
}
1005+
9861006
if (!activate_nud) {
9871007
return false;
9881008
}
9891009

9901010

991-
protocol_interface_info_entry_t *cur = user_data;
992-
9931011
uint8_t ll_target[16];
9941012
memcpy(ll_target, ADDR_LINK_LOCAL_PREFIX, 8);
9951013
memcpy(ll_target + 8, entry_ptr->mac64, 8);

source/6LoWPAN/ws/ws_common_defines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ typedef struct ws_bs_ie {
182182

183183
#define WS_FAN_VERSION_1_0 1
184184

185-
#define WS_NEIGHBOR_LINK_TIMEOUT 240
185+
#define WS_NEIGHBOR_LINK_TIMEOUT 2200
186186
#define WS_NEIGHBOR_NUD_TIMEOUT WS_NEIGHBOR_LINK_TIMEOUT / 2
187187

188188
/*

source/6LoWPAN/ws/ws_neighbor_class.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#ifdef HAVE_WS
2929

30-
#define RSL_UNITITIALIZED 0x7fff
30+
3131
#define TRACE_GROUP "wsne"
3232

3333

source/6LoWPAN/ws/ws_neighbor_class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "fhss_ws_extension.h"
2222
#include "6LoWPAN/ws/ws_common_defines.h"
2323

24+
#define RSL_UNITITIALIZED 0x7fff
25+
2426
typedef struct ws_neighbor_class_entry {
2527
fhss_ws_neighbor_timing_info_t fhss_data;
2628
uint16_t rsl_in; /*!< RSL EWMA heard from neighbour*/

source/MAC/IEEE802_15_4/mac_fhss_callbacks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ int mac_set_channel(const fhss_api_t *fhss_api, uint8_t channel_number)
8282
if (!mac_setup) {
8383
return -1;
8484
}
85-
if (mac_setup->mac_ack_tx_active || (mac_setup->active_pd_data_request && mac_setup->active_pd_data_request->asynch_request)) {
85+
if (mac_setup->mac_ack_tx_active || (mac_setup->active_pd_data_request && (mac_setup->active_pd_data_request->asynch_request || mac_setup->timer_mac_event == MAC_TIMER_ACK))) {
8686
return -1;
8787
}
8888
return mac_mlme_rf_channel_change(mac_setup, channel_number);

source/RPL/rpl_structures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ typedef struct rpl_dao_non_root
134134
uint32_t refresh_timer; /* Refresh timer (seconds) - 0xFFFFFFFF = infinite, 0 = not yet set */
135135
} rpl_dao_non_root_t;
136136

137+
137138
/* Descriptor for a RPL DAO target */
138139
struct rpl_dao_target
139140
{

source/RPL/rpl_upward.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,7 @@ void rpl_instance_slow_timer(rpl_instance_t *instance, uint16_t seconds)
15551555
}
15561556
}
15571557

1558+
15581559
void rpl_upward_dio_timer(rpl_instance_t *instance, uint16_t ticks)
15591560
{
15601561
rpl_dodag_version_t *dodag_version = instance->current_dodag_version;

source/Service_Libs/etx/etx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ void etx_transm_attempts_update(int8_t interface_id, uint8_t attempts, bool succ
8181
if (!entry) {
8282
return;
8383
}
84+
if (entry->etx_samples < 7) {
85+
entry->etx_samples++;
86+
}
8487

8588
accumulated_failures = entry->accumulated_failures;
8689

source/Service_Libs/etx/etx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ typedef struct etx_storage_s {
3838
unsigned accumulated_failures: 5;
3939
unsigned tmp_etx: 1;
4040
unsigned linkIdr: 4;
41+
unsigned etx_samples: 3;
4142
} etx_storage_t;
4243

4344
/**

source/Service_Libs/mac_neighbor_table/mac_neighbor_table.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ void mac_neighbor_table_neighbor_connected(mac_neighbor_table_t *table_class, ma
192192
void mac_neighbor_table_trusted_neighbor(mac_neighbor_table_t *table_class, mac_neighbor_table_entry_t *neighbor_entry, bool trusted_device)
193193
{
194194
(void)table_class;
195+
if (!neighbor_entry->trusted_device && trusted_device) {
196+
neighbor_entry->lifetime = neighbor_entry->link_lifetime;
197+
}
195198
neighbor_entry->trusted_device = trusted_device;
196199
}
197200

test/nanostack/unittest/service_libs/mac_neighbor_table/test_mac_neighbor_table.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,19 @@ bool test_mac_neighbor_table_use()
133133

134134
mac_neighbor_table_trusted_neighbor(entry, mac_entry3, true);
135135

136-
if (!mac_entry3->trusted_device) {
136+
if (!mac_entry3->trusted_device && mac_entry3->lifetime != 240) {
137137
return false;
138138
}
139139

140140
mac_neighbor_table_neighbor_timeout_update(entry, 31);
141141

142-
if (mac_entry3->lifetime != 199 || mac_entry2->lifetime != 199 || mac_entry1->lifetime != 199) {
142+
if (mac_entry3->lifetime != 209 || mac_entry2->lifetime != 199 || mac_entry1->lifetime != 199) {
143143
return false;
144144
}
145145

146146
mac_neighbor_table_neighbor_timeout_update(entry, 170);
147147

148-
if (mac_entry3->lifetime != 29 || mac_entry2->lifetime != 29 || mac_entry1->lifetime != 29) {
148+
if (mac_entry3->lifetime != 39 || mac_entry2->lifetime != 29 || mac_entry1->lifetime != 29) {
149149
return false;
150150
}
151151

0 commit comments

Comments
 (0)