Skip to content

Nanostack release for mbedos 5 15 #11889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions features/nanostack/sal-stack-nanostack/nanostack/mlme.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ typedef enum {
macAutoRequestKeyIndex = 0x7b, /*<The index of the key used for automatic data*/
macDefaultKeySource = 0x7c, /*<Default key source*/
//NON standard extension
macDeviceDescriptionPanIDUpdate = 0xf7, /*<Thread pending link update case this will update device descrioton list pan-id to new one*/
macTXPower = 0xf8, /*<TX output power*/
macCCAThreshold = 0xf9, /*<CCA threshold*/
macMultiCSMAParameters = 0xfa, /*<Multi CSMA parameters*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ typedef struct nwk_stats_t {
/* ETX */
uint16_t etx_1st_parent; /**< Primary parent ETX. */
uint16_t etx_2nd_parent; /**< Secondary parent ETX. */

/* MAC */
uint16_t adapt_layer_tx_queue_size; /**< Adaptation layer direct TX queue size. */
uint16_t adapt_layer_tx_queue_peak; /**< Adaptation layer direct TX queue size peak. */
} nwk_stats_t;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ extern "C" {
#define NETWORK_SIZE_SMALL 0x01
#define NETWORK_SIZE_MEDIUM 0x08
#define NETWORK_SIZE_LARGE 0x10
#define NETWORK_SIZE_CERTIFICATE 0xFF


/** Temporary API change flag. this will be removed when new version of API is implemented on applications
Expand Down Expand Up @@ -246,9 +247,10 @@ int ws_management_fhss_timing_configure(
* Change the default configuration for Wi-SUN FHSS operation.
* if application defined is used the behaviour is undefined
*
*
* \param interface_id Network interface ID.
* \param channel_function Unicast channel function.
* \param fixed_channel Used channel when channel function is fixed channel. If 0xFFFF, randomly chosen channel is used.
* \param fixed_channel Used channel when channel function is fixed channel.
* \param dwell_interval Used dwell interval when channel function is TR51 or DH1.
*
* \return 0, Init OK.
Expand All @@ -266,9 +268,10 @@ int ws_management_fhss_unicast_channel_function_configure(
* Change the default configuration for Wi-SUN FHSS operation.
* if application defined is used the behaviour is undefined
*
*
* \param interface_id Network interface ID.
* \param channel_function Broadcast channel function.
* \param fixed_channel Used channel when channel function is fixed channel. If 0xFFFF, randomly chosen channel is used.
* \param fixed_channel Used channel when channel function is fixed channel.
* \param dwell_interval Broadcast channel dwell interval.
* \param broadcast_interval Broadcast interval.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,20 +834,41 @@ int8_t mac_helper_link_frame_counter_read(int8_t interface_id, uint32_t *seq_ptr
{
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);

if (!cur || !cur->mac_api || !seq_ptr) {
return -1;
}

return mac_helper_key_link_frame_counter_read(interface_id, seq_ptr, cur->mac_parameters->mac_default_key_attribute_id);
}

int8_t mac_helper_link_frame_counter_set(int8_t interface_id, uint32_t seq_ptr)
{
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);

if (!cur || !cur->mac_api) {
return -1;
}

return mac_helper_key_link_frame_counter_set(interface_id, seq_ptr, cur->mac_parameters->mac_default_key_attribute_id);
}

int8_t mac_helper_key_link_frame_counter_read(int8_t interface_id, uint32_t *seq_ptr, uint8_t descriptor)
{
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);

if (!cur || !cur->mac_api || !seq_ptr) {
return -1;
}
mlme_get_t get_req;
get_req.attr = macFrameCounter;
get_req.attr_index = cur->mac_parameters->mac_default_key_attribute_id;
get_req.attr_index = descriptor;
cur->mac_api->mlme_req(cur->mac_api, MLME_GET, &get_req);
*seq_ptr = cur->mac_parameters->security_frame_counter;

return 0;
}


int8_t mac_helper_link_frame_counter_set(int8_t interface_id, uint32_t seq_ptr)
int8_t mac_helper_key_link_frame_counter_set(int8_t interface_id, uint32_t seq_ptr, uint8_t descriptor)
{
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);

Expand All @@ -856,7 +877,7 @@ int8_t mac_helper_link_frame_counter_set(int8_t interface_id, uint32_t seq_ptr)
}
mlme_set_t set_req;
set_req.attr = macFrameCounter;
set_req.attr_index = cur->mac_parameters->mac_default_key_attribute_id;
set_req.attr_index = descriptor;
set_req.value_pointer = &seq_ptr;
set_req.value_size = 4;
cur->mac_api->mlme_req(cur->mac_api, MLME_SET, &set_req);
Expand Down Expand Up @@ -929,3 +950,20 @@ int8_t mac_helper_mac_mlme_max_retry_set(int8_t interface_id, uint8_t mac_retry_

return 0;
}


int8_t mac_helper_mac_device_description_pan_id_update(int8_t interface_id, uint16_t pan_id)
{
protocol_interface_info_entry_t *cur;
cur = protocol_stack_interface_info_get_by_id(interface_id);
if (!cur || !cur->mac_api) {
return -1;
}
mlme_set_t set_req;
set_req.attr = macDeviceDescriptionPanIDUpdate;
set_req.attr_index = 0;
set_req.value_pointer = &pan_id;
set_req.value_size = sizeof(pan_id);
cur->mac_api->mlme_req(cur->mac_api, MLME_SET, &set_req);
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,17 @@ 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);

int8_t mac_helper_key_link_frame_counter_read(int8_t interface_id, uint32_t *seq_ptr, uint8_t descriptor);

int8_t mac_helper_key_link_frame_counter_set(int8_t interface_id, uint32_t seq_ptr, uint8_t descriptor);

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);

void mac_helper_devicetable_set(const mlme_device_descriptor_t *device_dec, struct protocol_interface_info_entry *cur, uint8_t attribute_index, uint8_t keyID, bool force_set);
int8_t mac_helper_mac_mlme_max_retry_set(int8_t interface_id, uint8_t mac_retry_set);

int8_t mac_helper_mac_device_description_pan_id_update(int8_t interface_id, uint16_t pan_id);

#endif // MAC_HELPER_H
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,8 @@ int thread_link_configuration_activate(protocol_interface_info_entry_t *cur, lin
return -1;
}

mac_helper_mac_device_description_pan_id_update(cur->id, linkConfiguration->panId);

thread_configuration_thread_activate(cur, linkConfiguration);
thread_configuration_security_activate(cur, linkConfiguration);
thread_configuration_6lowpan_activate(cur);
Expand Down Expand Up @@ -899,7 +901,7 @@ void thread_interface_init(protocol_interface_info_entry_t *cur)
{
thread_discovery_reset(cur->id);
thread_routing_set_mesh_callbacks(cur);
dhcp_client_init(cur->id);
dhcp_client_init(cur->id, DHCPV6_DUID_HARDWARE_EUI64_TYPE);
dhcp_client_configure(cur->id, false, false, false);
thread_management_client_init(cur->id);
thread_bootstrap_address_registration_init();
Expand Down Expand Up @@ -2886,7 +2888,7 @@ void thread_bootstrap_network_prefixes_process(protocol_interface_info_entry_t *
thread_addr_write_mesh_local_16(addr, curBorderRouter->routerID, cur->thread_info);
/* Do not allow multiple DHCP solicits from one prefix => delete previous */
dhcp_client_global_address_delete(cur->id, NULL, curPrefix->servicesPrefix);
if (dhcp_client_get_global_address(cur->id, addr, curPrefix->servicesPrefix, cur->mac, DHCPV6_DUID_HARDWARE_EUI64_TYPE, thread_dhcp_client_gua_error_cb) == 0) {
if (dhcp_client_get_global_address(cur->id, addr, curPrefix->servicesPrefix, thread_dhcp_client_gua_error_cb) == 0) {
tr_debug("GP Address Requested");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ typedef struct {
fragmenter_tx_entry_t active_unicast_tx_buf; //Current active direct unicast tx process
fragmenter_tx_entry_t active_broadcast_tx_buf; //Current active direct broadcast tx process
buffer_list_t directTxQueue; //Waiting free tx process
uint16_t directTxQueue_size;
uint16_t indirect_big_packet_threshold;
uint16_t max_indirect_big_packets_total;
uint16_t max_indirect_small_packets_per_child;
Expand Down Expand Up @@ -216,6 +217,8 @@ static void lowpan_adaptation_tx_queue_write(fragmenter_interface_t *interface_p
} else {
ns_list_add_to_end(&interface_ptr->directTxQueue, buf);
}
interface_ptr->directTxQueue_size++;
protocol_stats_update(STATS_AL_TX_QUEUE_SIZE, interface_ptr->directTxQueue_size);
}

static buffer_t *lowpan_adaptation_tx_queue_read(fragmenter_interface_t *interface_ptr, protocol_interface_info_entry_t *cur)
Expand All @@ -231,6 +234,8 @@ static buffer_t *lowpan_adaptation_tx_queue_read(fragmenter_interface_t *interfa
} else if ((buf->link_specific.ieee802_15_4.requestAck && !interface_ptr->active_unicast_tx_buf.buf)
|| (!buf->link_specific.ieee802_15_4.requestAck && !interface_ptr->active_broadcast_tx_buf.buf)) {
ns_list_remove(&interface_ptr->directTxQueue, buf);
interface_ptr->directTxQueue_size--;
protocol_stats_update(STATS_AL_TX_QUEUE_SIZE, interface_ptr->directTxQueue_size);
return buf;
}
}
Expand Down
Loading