Skip to content

Commit

Permalink
MAC neighbour remove and add trace simplify.
Browse files Browse the repository at this point in the history
Change-Id: I3162e511d72ed8d8830c9619bd0a11782dafaeef
  • Loading branch information
Juha Heiskanen committed May 29, 2019
1 parent 8bb4ab5 commit e8567d7
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ static void lowpan_neighbor_entry_remove_notify(mac_neighbor_table_entry_t *entr
protocol_6lowpan_release_short_link_address_from_neighcache(cur_interface, entry_ptr->mac16);
protocol_6lowpan_release_long_link_address_from_neighcache(cur_interface, entry_ptr->mac64);
}
mac_helper_devicetable_remove(cur_interface->mac_api, entry_ptr->index);
mac_helper_devicetable_remove(cur_interface->mac_api, entry_ptr->index, entry_ptr->mac64);
//Removes ETX neighbor
etx_neighbor_remove(cur_interface->id, entry_ptr->index);
//Remove MLE frame counter info
Expand Down
6 changes: 3 additions & 3 deletions source/6LoWPAN/MAC/mac_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ int8_t mac_helper_link_frame_counter_set(int8_t interface_id, uint32_t seq_ptr)
return 0;
}

void mac_helper_devicetable_remove(mac_api_t *mac_api, uint8_t attribute_index)
void mac_helper_devicetable_remove(mac_api_t *mac_api, uint8_t attribute_index, uint8_t *mac64)
{
if (!mac_api) {
return;
Expand All @@ -880,7 +880,7 @@ void mac_helper_devicetable_remove(mac_api_t *mac_api, uint8_t attribute_index)
set_req.attr_index = attribute_index;
set_req.value_pointer = (void *)&device_desc;
set_req.value_size = sizeof(mlme_device_descriptor_t);
tr_debug("unRegister Device");
tr_debug("Unregister Device %u, mac64: %s", attribute_index, trace_array(mac64, 8));
mac_api->mlme_req(mac_api, MLME_SET, &set_req);
}

Expand Down Expand Up @@ -910,7 +910,7 @@ void mac_helper_devicetable_set(const mlme_device_descriptor_t *device_desc, pro
set_req.attr_index = attribute_index;
set_req.value_pointer = (void *)device_desc;
set_req.value_size = sizeof(mlme_device_descriptor_t);
tr_debug("Register Device");
tr_debug("Register Device %u, mac16 %x mac64: %s, %"PRIu32, attribute_index, device_desc->ShortAddress, trace_array(device_desc->ExtAddress, 8), device_desc->FrameCounter);
cur->mac_api->mlme_req(cur->mac_api, MLME_SET, &set_req);
}

Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/MAC/mac_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ int8_t mac_helper_link_frame_counter_read(int8_t interface_id, uint32_t *seq_ptr

int8_t mac_helper_link_frame_counter_set(int8_t interface_id, uint32_t seq_ptr);

void mac_helper_devicetable_remove(struct mac_api_s *mac_api, uint8_t attribute_index);
void mac_helper_devicetable_remove(struct mac_api_s *mac_api, uint8_t attribute_index, uint8_t *mac64);

void mac_helper_device_description_write(struct protocol_interface_info_entry *cur, mlme_device_descriptor_t *device_desc, uint8_t *mac64, uint16_t mac16, uint32_t frame_counter, bool exempt);

Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/Thread/thread_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2015,7 +2015,7 @@ void thread_reset_neighbour_info(protocol_interface_info_entry_t *cur, mac_neigh
thread_routing_remove_link(cur, neighbour->mac16);
thread_router_bootstrap_reset_child_info(cur, neighbour);
protocol_6lowpan_release_long_link_address_from_neighcache(cur, neighbour->mac64);
mac_helper_devicetable_remove(cur->mac_api, neighbour->index);
mac_helper_devicetable_remove(cur->mac_api, neighbour->index, neighbour->mac64);
thread_neighbor_class_entry_remove(&cur->thread_info->neighbor_class, neighbour->index);
}

Expand Down
10 changes: 5 additions & 5 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ mac_neighbor_table_entry_t *ws_bootstrap_mac_neighbor_add(struct protocol_interf
return neighbor;
}

static void ws_bootstrap_neighbor_delete(struct protocol_interface_info_entry *interface, uint8_t attribute_index)
static void ws_bootstrap_neighbor_delete(struct protocol_interface_info_entry *interface, mac_neighbor_table_entry_t *entry_ptr)
{
mac_helper_devicetable_remove(interface->mac_api, attribute_index);
etx_neighbor_remove(interface->id, attribute_index);
ws_neighbor_class_entry_remove(&interface->ws_info->neighbor_storage, attribute_index);
mac_helper_devicetable_remove(interface->mac_api, entry_ptr->index, entry_ptr->mac64);
etx_neighbor_remove(interface->id, entry_ptr->index);
ws_neighbor_class_entry_remove(&interface->ws_info->neighbor_storage, entry_ptr->index);
}

static void ws_bootstrap_neighbor_list_clean(struct protocol_interface_info_entry *interface)
Expand Down Expand Up @@ -1394,7 +1394,7 @@ static void ws_neighbor_entry_remove_notify(mac_neighbor_table_entry_t *entry_pt
//NUD Process Clear Here
ws_nud_entry_remove(cur, entry_ptr);

ws_bootstrap_neighbor_delete(cur, entry_ptr->index);
ws_bootstrap_neighbor_delete(cur, entry_ptr);
}

static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr, void *user_data)
Expand Down
8 changes: 4 additions & 4 deletions source/MAC/IEEE802_15_4/mac_security_mib.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static void mac_sec_mib_key_device_description_remove_from_list(mlme_key_descrip
*prev = *cur;
} else if (cur->DeviceDescriptorHandle == device_descriptor_handle) {
removed_entry = true;
tr_debug("Remove user %u from key", device_descriptor_handle);
//tr_debug("Remove user %u from key", device_descriptor_handle);
}
prev = cur;
cur++;
Expand Down Expand Up @@ -244,10 +244,10 @@ int8_t mac_sec_mib_device_description_set(uint8_t atribute_index, mlme_device_de
if (memcmp(device_ptr->ExtAddress, device_descriptor->ExtAddress, 8)) {
//Remove last handles key user's
mac_sec_mib_device_description_remove(rf_mac_setup, atribute_index);
tr_debug("Over write %u, mac16 %x mac64: %s, %"PRIu32, atribute_index, device_ptr->ShortAddress, trace_array(device_ptr->ExtAddress, 8), device_ptr->FrameCounter);
//tr_debug("Over write %u, mac16 %x mac64: %s, %"PRIu32, atribute_index, device_ptr->ShortAddress, trace_array(device_ptr->ExtAddress, 8), device_ptr->FrameCounter);
}

tr_debug("Set %u, mac16 %x mac64: %s, %"PRIu32, atribute_index, device_descriptor->ShortAddress, trace_array(device_descriptor->ExtAddress, 8), device_descriptor->FrameCounter);
//tr_debug("Set %u, mac16 %x mac64: %s, %"PRIu32, atribute_index, device_descriptor->ShortAddress, trace_array(device_descriptor->ExtAddress, 8), device_descriptor->FrameCounter);

*device_ptr = *device_descriptor;
return 0;
Expand Down Expand Up @@ -485,7 +485,7 @@ void mac_sec_mib_device_description_blacklist(protocol_interface_rf_mac_setup_s
for (uint8_t i = 0; i < rf_mac_setup->key_description_table_size; i++) {
descriptor = mac_sec_mib_key_device_description_discover_from_list(&rf_mac_setup->key_description_table[i], device_handle);
if (descriptor) {
tr_debug("Black listed device %u lookup%s", device_handle, trace_array(rf_mac_setup->key_description_table[i].Key, 16));
tr_debug("Black listed device %u", device_handle);
descriptor->Blacklisted = true;
}

Expand Down
5 changes: 3 additions & 2 deletions test/nanostack/unittest/6lp_mac/mac_helper/test_mac_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,10 +839,11 @@ bool test_mac_helper_devicetable_remove()
{
mac_api_t api;
api.mlme_req = &mlme_req;
uint8_t mac64[8];

mac_helper_devicetable_remove(NULL, 0);
mac_helper_devicetable_remove(NULL, 0, mac64);

mac_helper_devicetable_remove(&api, 0);
mac_helper_devicetable_remove(&api, 0, mac64);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion test/nanostack/unittest/stub/mac_helper_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ int8_t mac_helper_security_pairwisekey_set(protocol_interface_info_entry_t *inte
return mac_helper_stub.int8_value;
}

void mac_helper_devicetable_remove(struct mac_api_s *mac_api, uint8_t attribute_index)
void mac_helper_devicetable_remove(struct mac_api_s *mac_api, uint8_t attribute_index, uint8_t *mac64)
{

}
Expand Down

0 comments on commit e8567d7

Please sign in to comment.