Skip to content

Commit

Permalink
Removed threadNeighbour flag from mle_table_entry_t.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Heiskanen authored and juhhei01 committed Jun 8, 2018
1 parent e142eec commit 49ccb9d
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 32 deletions.
2 changes: 1 addition & 1 deletion source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ int8_t protocol_6lowpan_neighbor_address_state_synch(protocol_interface_info_ent
#ifndef NO_MLE
mle_neigh_table_entry_t *mle_entry = 0;
mle_entry = mle_class_get_by_link_address(cur->id, eui64, ADDR_802_15_4_LONG);
if (mle_entry && !mle_entry->threadNeighbor) {
if (mle_entry) {
if (memcmp(iid, ADDR_SHORT_ADR_SUFFIC, 6) == 0) {
iid += 6;
//Set Short Address to MLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1140,8 +1140,6 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml

//Response state set now timeout know positive state
mle_service_set_msg_response_true(responseId);

entry_temp->threadNeighbor = false;
entry_temp->handshakeReady = 1;

mac_data_poll_protocol_poll_mode_decrement(cur);
Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/Thread/thread_diagnostic.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static uint8_t *thread_diagnostic_child_table_tlv_build(uint8_t *data_ptr, proto
*data_ptr++ = (3 * child_count); // Length

ns_list_foreach(mle_neigh_table_entry_t, cur_entry, mle_table) {
if (cur_entry->threadNeighbor && thread_router_addr_from_addr(cur_entry->short_adr) == mac_helper_mac16_address_get(cur)){
if (thread_router_addr_from_addr(cur_entry->short_adr) == mac_helper_mac16_address_get(cur)){
/* |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3| */
/* |Timeout |Rsv| Child ID | Mode | */
calculated_timeout = thread_log2_aprx((cur_entry->timeout_rx-1)*MLE_TIMER_TICKS_SECONDS) + 4;
Expand Down
4 changes: 0 additions & 4 deletions source/6LoWPAN/Thread/thread_host_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ static bool thread_parent_discover_timeout_cb(int8_t interface_id, uint16_t msgI
if (entry_temp == NULL) {
return false;
}
entry_temp->threadNeighbor = true;
entry_temp->short_adr = parent->shortAddress;
entry_temp->priorityFlag = true;

Expand Down Expand Up @@ -335,7 +334,6 @@ static int thread_end_device_synch_response_validate(protocol_interface_info_ent
/*
*/
entry_temp->threadNeighbor = true;
entry_temp->short_adr = srcAddress;
entry_temp->handshakeReady = 1;
entry_temp->priorityFlag = true; // Make this our parent
Expand Down Expand Up @@ -841,7 +839,6 @@ static void thread_mle_child_request_receive_cb(int8_t interface_id, mle_message

entry_temp->handshakeReady = 1;
entry_temp->priorityFlag = true;
entry_temp->threadNeighbor = true;

mac_helper_coordinator_address_set(cur, ADDR_802_15_4_SHORT, shortAddress);
mle_entry_timeout_update(entry_temp, thread_info(cur)->host_link_timeout);
Expand Down Expand Up @@ -956,7 +953,6 @@ void thread_endevice_synch_start(protocol_interface_info_entry_t *cur)
if (entry_temp) {
entry_temp->short_adr = cur->thread_info->thread_endnode_parent->shortAddress;
entry_temp->handshakeReady = 1;
entry_temp->threadNeighbor = true;

// In case we don't get response to sync; use temporary timeout here,
// Child ID Response handler will set correct value later
Expand Down
1 change: 0 additions & 1 deletion source/6LoWPAN/Thread/thread_mle_message_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ static void thread_parse_accept(protocol_interface_info_entry_t *cur, mle_messag
mleFrameCounter = llFrameCounter;
}

entry_temp->threadNeighbor = true;
entry_temp->short_adr = shortAddress;
mle_service_frame_counter_table_add(cur->id, entry_temp->attribute_index, mleFrameCounter);
// Set full data as REED needs full data and SED will not make links
Expand Down
1 change: 0 additions & 1 deletion source/6LoWPAN/Thread/thread_network_synch.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ void thread_dynamic_storage_build_mle_table(int8_t interface_id)
entry->short_adr = storeEntry->networ_dynamic_data_parameters.children[i].short_addr;
mle_service_frame_counter_table_add(interface_id, entry->attribute_index, storeEntry->networ_dynamic_data_parameters.children[i].mle_frame_counter);
entry->mode = storeEntry->networ_dynamic_data_parameters.children[i].mode;
entry->threadNeighbor = true;

protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);

Expand Down
30 changes: 11 additions & 19 deletions source/6LoWPAN/Thread/thread_router_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,8 @@ static void mle_multicast_push_to_sleep_child(protocol_interface_info_entry_t *c
return;
}
ns_list_foreach(mle_neigh_table_entry_t, cur_entry, mle_neigh_list) {
if (cur_entry->threadNeighbor) {
if (!(cur_entry->mode & MLE_RX_ON_IDLE)) {
clone_multicast_to_unicast(cur, cur_entry, buf);
}
if (!(cur_entry->mode & MLE_RX_ON_IDLE)) {
clone_multicast_to_unicast(cur, cur_entry, buf);
}
}
}
Expand All @@ -261,7 +259,7 @@ static void thread_registered_mcast_forward_to_child(protocol_interface_info_ent

ns_list_foreach(thread_mcast_child_t, child, &addr->children) {
mle_neigh_table_entry_t *mle_entry = mle_class_get_by_link_address(cur->id, child->mac64, ADDR_802_15_4_LONG);
if (mle_entry && mle_entry->threadNeighbor && !(mle_entry->mode & MLE_RX_ON_IDLE)) {
if (!(mle_entry->mode & MLE_RX_ON_IDLE)) {
clone_multicast_to_unicast(cur, mle_entry, buffer);
}
}
Expand Down Expand Up @@ -361,7 +359,6 @@ static void thread_router_synch_receive_cb(int8_t interface_id, mle_message_t *m

//Free Response
mle_service_msg_free(messageId);
entry_temp->threadNeighbor = true;
entry_temp->short_adr = shortAddress;

//when allocating neighbour entry, use MLE Frame counter if present to validate further advertisements from the neighbour
Expand Down Expand Up @@ -1328,7 +1325,6 @@ void thread_router_bootstrap_child_id_handler(protocol_interface_info_entry_t *c

mle_entry_timeout_update(entry_temp, req->timeout);
entry_temp->mode = req->mode;
entry_temp->threadNeighbor = true;
entry_temp->handshakeReady = 1;
mle_service_frame_counter_table_add(cur->id, entry_temp->attribute_index, req->mleFrameCounter);

Expand Down Expand Up @@ -1864,7 +1860,6 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
thread_management_key_synch_req(cur->id, common_read_32_bit(security_headers->Keysource));
}

entry_temp->threadNeighbor = true;
entry_temp->short_adr = shortAddress;
mlme_device_descriptor_t device_desc;
mac_helper_device_description_write(cur, &device_desc, entry_temp->mac64, entry_temp->short_adr,llFrameCounter, false);
Expand Down Expand Up @@ -2469,7 +2464,6 @@ void thread_router_bootstrap_timer(protocol_interface_info_entry_t *cur, uint32_
void thread_router_bootstrap_advertiment_analyze(protocol_interface_info_entry_t *cur, uint8_t *src_address, mle_neigh_table_entry_t *entry_temp, uint16_t shortAddress)
{
if (entry_temp) {
entry_temp->threadNeighbor = true;

if (entry_temp->timeout_rx == 0 || thread_is_router_addr(shortAddress)) {
entry_temp->timeout_rx = THREAD_DEFAULT_LINK_LIFETIME / MLE_TIMER_TICKS_SECONDS;
Expand Down Expand Up @@ -2669,16 +2663,14 @@ static void thread_router_bootstrap_network_data_push_to_sleep_child(protocol_in
mle_neigh_table_list_t *mle_table = mle_class_active_list_get(cur->id);
memcpy(childLinkLocalAddress, ADDR_LINK_LOCAL_PREFIX, 8);
ns_list_foreach(mle_neigh_table_entry_t, cur_entry, mle_table) {
if (cur_entry->threadNeighbor) {
if (!(cur_entry->mode & MLE_RX_ON_IDLE)) {
memcpy(&childLinkLocalAddress[8], cur_entry->mac64, 8);
childLinkLocalAddress[8] ^= 2;
if (cur_entry->mode & MLE_THREAD_REQ_FULL_DATA_SET) {
thread_router_bootstrap_network_data_propagation(cur, childLinkLocalAddress, true);
} else {
if (stableDataUpdate) {
thread_router_bootstrap_network_data_propagation(cur, childLinkLocalAddress, false);
}
if (!(cur_entry->mode & MLE_RX_ON_IDLE)) {
memcpy(&childLinkLocalAddress[8], cur_entry->mac64, 8);
childLinkLocalAddress[8] ^= 2;
if (cur_entry->mode & MLE_THREAD_REQ_FULL_DATA_SET) {
thread_router_bootstrap_network_data_propagation(cur, childLinkLocalAddress, true);
} else {
if (stableDataUpdate) {
thread_router_bootstrap_network_data_propagation(cur, childLinkLocalAddress, false);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/6LoWPAN/Thread/thread_test_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ int8_t thread_test_child_info_get(int8_t interface_id, uint8_t index, uint16_t *
}

ns_list_foreach(mle_neigh_table_entry_t, cur_entry, mle_table) {
if (cur_entry->threadNeighbor && thread_router_addr_from_addr(cur_entry->short_adr) == thread_router_addr_from_addr(mac16)) {
if (thread_router_addr_from_addr(cur_entry->short_adr) == thread_router_addr_from_addr(mac16)) {
if (n == index) {
*short_addr = cur_entry->short_adr;
memcpy(mac64,cur_entry->mac64, 8);
Expand Down Expand Up @@ -1162,7 +1162,7 @@ int8_t thread_test_neighbour_info_get(int8_t interface_id, uint8_t index, uint16
}

ns_list_foreach(mle_neigh_table_entry_t, cur_entry, mle_table) {
if (cur_entry->threadNeighbor && thread_router_addr_from_addr(cur_entry->short_adr) != thread_router_addr_from_addr(mac16)) {
if (thread_router_addr_from_addr(cur_entry->short_adr) != thread_router_addr_from_addr(mac16)) {
if (n == index) {
*short_addr = cur_entry->short_adr;
memcpy(mac64,cur_entry->mac64, 8);
Expand Down
1 change: 0 additions & 1 deletion source/MLE/mle.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ typedef struct mle_neigh_table_entry_t {
unsigned priority_child_flag: 1; /* Is using our node as preferred parent */
unsigned second_priority_flag: 1; /* Is secondary parent */
unsigned thread_commission: 1;
unsigned threadNeighbor: 1;
unsigned priorityFlag: 1;
unsigned handshakeReady: 1;
unsigned medium_ttl_challenge: 1;
Expand Down

0 comments on commit 49ccb9d

Please sign in to comment.