Skip to content
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

Nanostack release for Mbed OS 6 #12481

Merged
merged 7 commits into from
Feb 25, 2020
Merged
Changes from 2 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
3 changes: 2 additions & 1 deletion features/nanostack/sal-stack-nanostack/nanostack/fhss_api.h
Original file line number Diff line number Diff line change
@@ -122,9 +122,10 @@ typedef void fhss_data_tx_done(const fhss_api_t *api, bool waiting_ack, bool tx_
* @param api FHSS instance.
* @param handle Handle of the data request.
* @param frame_type Frame type of packet (Frames types are defined by FHSS api).
* @param channel Channel wanted to black list temporarily.
* @return true if frame has to be queued for retransmission, false otherwise.
*/
typedef bool fhss_data_tx_fail(const fhss_api_t *api, uint8_t handle, int frame_type);
typedef bool fhss_data_tx_fail(const fhss_api_t *api, uint8_t handle, int frame_type, uint8_t channel);

/**
* @brief Change synchronization state.
46 changes: 46 additions & 0 deletions features/nanostack/sal-stack-nanostack/nanostack/fhss_test_api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2020, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* \file fhss_test_api.h
* \brief
*/

#ifndef FHSS_TEST_API_H
#define FHSS_TEST_API_H


#ifdef __cplusplus
extern "C" {
#endif

/**
* \brief Set optimal packet length
*
* \param fhss_api FHSS instance.
* \param packet_length Optimal packet length
*
* \return 0 Success
* \return -1 Failure
*/
int8_t fhss_set_optimal_packet_length(const fhss_api_t *fhss_api, uint16_t packet_length);

#ifdef __cplusplus
}
#endif

#endif // FHSS_TEST_API_H
Original file line number Diff line number Diff line change
@@ -161,7 +161,8 @@ typedef enum {
CHANNEL_PAGE_5 = 5, ///< Page 5
CHANNEL_PAGE_6 = 6, ///< Page 6
CHANNEL_PAGE_9 = 9, ///< Page 9
CHANNEL_PAGE_10 = 10 ///< Page 10
CHANNEL_PAGE_10 = 10, ///< Page 10
CHANNEL_PAGE_UNDEFINED ///< Undefined
} channel_page_e;

/** Modulation index */
@@ -192,6 +193,10 @@ typedef struct phy_rf_statistics_s {
uint32_t crc_fails; ///< CRC failures
uint32_t tx_timeouts; ///< transmission timeouts
uint32_t rx_timeouts; ///< reception timeouts
uint64_t tx_active_time; ///< transmission active time
uint64_t rx_active_time; ///< reception active time
uint32_t tx_bytes; ///< transmitted bytes
uint32_t rx_bytes; ///< received bytes
} phy_rf_statistics_s;

/** Virtual data request */
7 changes: 7 additions & 0 deletions features/nanostack/sal-stack-nanostack/nanostack/sw_mac.h
Original file line number Diff line number Diff line change
@@ -67,6 +67,13 @@ extern int8_t ns_sw_mac_virtual_client_unregister(struct mac_api_s *api);
*/
extern int ns_sw_mac_fhss_register(struct mac_api_s *mac_api, struct fhss_api *fhss_api);

/**
* @brief Unregister FHSS API instance from given software MAC instance.
* @param mac_api MAC instance.
* @return 0 on success, -1 on fail.
*/
extern int ns_sw_mac_fhss_unregister(struct mac_api_s *mac_api);

/**
* @brief Request registered FHSS API instance from software MAC instance.
* @param mac_api MAC instance.
12 changes: 4 additions & 8 deletions features/nanostack/sal-stack-nanostack/nanostack/ws_bbr_api.h
Original file line number Diff line number Diff line change
@@ -48,14 +48,10 @@ int ws_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
/**
* Border router configuration options
*/
#define BBR_ULA_C 0x0001 /**< Static ULA prefix created automatically */
#define BBR_GUA_ROUTE 0x0002 /**< More specific route is added for GUA prefix */
#define BBR_BB_WAIT 0x0004 /**< Wait backbone availability before starting Wi-SUN network */

/*Deprecated configuration values */
#define BBR_GUA_C 0x0000 /**< Routable prefix is learned from the backbone */
#define BBR_GUA_SLAAC 0x0000 /**< Use SLAAC addressing in routable prefix */
#define BBR_GUA_WAIT 0x0000 /**< Wait backbone availability before startingRPL dodag */
#define BBR_ULA_C 0x0001 /**< Static ULA prefix created automatically */
#define BBR_GUA_ROUTE 0x0002 /**< More specific route is added for GUA prefix */
#define BBR_BB_WAIT 0x0004 /**< Wait backbone availability before starting Wi-SUN network */
#define BBR_DEFAULT_ROUTE 0x0008 /**< Add default route parameter to DIO */

/**
* Configure border router features.
Original file line number Diff line number Diff line change
@@ -1379,6 +1379,8 @@ static int8_t arm_6lowpan_bootstrap_down(protocol_interface_info_entry_t *cur)
}
cur->if_lowpan_security_params->mle_security_frame_counter = mle_service_security_get_frame_counter(cur->id);
mle_service_interface_receiver_handler_update(cur->id, mle_6lowpan_message_handler);
// Reset MAC for safe upper layer memory free
protocol_mac_reset(cur);
return nwk_6lowpan_down(cur);
}
#ifdef HAVE_6LOWPAN_ND
@@ -1593,7 +1595,7 @@ static void lowpan_neighbor_entry_remove_notify(mac_neighbor_table_entry_t *entr
{

protocol_interface_info_entry_t *cur_interface = user_data;
lowpan_adaptation_remove_free_indirect_table(cur_interface, entry_ptr);
lowpan_adaptation_neigh_remove_free_tx_tables(cur_interface, entry_ptr);
// Sleepy host
if (cur_interface->lowpan_info & INTERFACE_NWK_CONF_MAC_RX_OFF_IDLE) {
mac_data_poll_protocol_poll_mode_decrement(cur_interface);
Original file line number Diff line number Diff line change
@@ -72,6 +72,15 @@
#include "6LoWPAN/Fragmentation/cipv6_fragmenter.h"
#include "libNET/src/net_load_balance_internal.h"

void protocol_mac_reset(protocol_interface_info_entry_t *cur)
{
if (cur->mac_api) {
mlme_reset_t reset;
reset.SetDefaultPIB = true;
cur->mac_api->mlme_req(cur->mac_api, MLME_RESET, &reset);
}
}



static int8_t set_6lowpan_nwk_down(protocol_interface_info_entry_t *cur)
@@ -96,15 +105,11 @@ static int8_t set_6lowpan_nwk_down(protocol_interface_info_entry_t *cur)
}

if (cur->interface_mode == INTERFACE_UP) {
if (cur->mac_api) {
mlme_reset_t reset;
reset.SetDefaultPIB = true;
cur->mac_parameters->pan_id = 0xffff;
cur->mac_parameters->SecurityEnabled = false;
cur->mac_parameters->security_frame_counter = 0;
cur->mac_parameters->mac_security_level = 0;
cur->mac_api->mlme_req(cur->mac_api, MLME_RESET, &reset);
}
cur->mac_parameters->pan_id = 0xffff;
cur->mac_parameters->SecurityEnabled = false;
cur->mac_parameters->security_frame_counter = 0;
cur->mac_parameters->mac_security_level = 0;
protocol_mac_reset(cur);
cur->interface_mode = INTERFACE_IDLE;
net_load_balance_internal_state_activate(cur, false);
}
Original file line number Diff line number Diff line change
@@ -31,5 +31,7 @@ extern int8_t nwk_6lowpan_up(struct protocol_interface_info_entry *cur);
*/
extern int8_t nwk_6lowpan_down(struct protocol_interface_info_entry *cur);

extern void protocol_mac_reset(struct protocol_interface_info_entry *cur);


#endif /* PROTOCOL_6LOWPAN_INTERFACE_H_ */
Original file line number Diff line number Diff line change
@@ -887,6 +887,7 @@ int8_t mac_helper_key_link_frame_counter_set(int8_t interface_id, uint32_t seq_p

void mac_helper_devicetable_remove(mac_api_t *mac_api, uint8_t attribute_index, uint8_t *mac64)
{
(void) mac64;
if (!mac_api) {
return;
}
Original file line number Diff line number Diff line change
@@ -120,6 +120,7 @@ void mcps_data_indication_handler(const mac_api_t *api, const mcps_data_ind_t *d
void mcps_purge_confirm_handler(const mac_api_t *api, mcps_purge_conf_t *data)
{
(void)api;
(void)data;
tr_info("MCPS Data Purge confirm status %u, for handle %u", data->status, data->msduHandle);
}

Original file line number Diff line number Diff line change
@@ -856,9 +856,6 @@ static void nd_update_registration(protocol_interface_info_entry_t *cur_interfac
mac_neighbor_table_entry_t *entry = mac_neighbor_table_address_discover(mac_neighbor_info(cur_interface), ipv6_neighbour_eui64(&cur_interface->ipv6_neighbour_cache, neigh), ADDR_802_15_4_LONG);

if (entry) {
if (ws_info(cur_interface)) {
ws_common_etx_validate(cur_interface, entry);
}

if (!entry->ffd_device) {
rpl_control_publish_host_address(protocol_6lowpan_rpl_domain, neigh->ip_address, neigh->lifetime);
@@ -931,11 +928,13 @@ bool nd_ns_aro_handler(protocol_interface_info_entry_t *cur_interface, const uin
}

/* TODO - check hard upper limit on registrations? */
if (ws_info(cur_interface) &&
!ws_common_allow_child_registration(cur_interface, aro_out->eui64)) {
aro_out->present = true;
aro_out->status = ARO_FULL;
return true;
if (ws_info(cur_interface)) {

aro_out->status = ws_common_allow_child_registration(cur_interface, aro_out->eui64);
if (aro_out->status != ARO_SUCCESS) {
aro_out->present = true;
return true;
}
}

/* We need to have entry in the Neighbour Cache */
@@ -1757,6 +1756,8 @@ void nd_6lowpan_set_radv_params(protocol_interface_info_entry_t *cur_interface)
cur_interface->adv_retrans_timer = nd_params.ra_retrans_timer;
cur_interface->max_initial_rtr_adv_interval = nd_params.ra_interval_min;
cur_interface->max_initial_rtr_advertisements = nd_params.ra_transmits;
#else
(void) cur_interface;
#endif
}
#endif // HAVE_6LOWPAN_ND
Original file line number Diff line number Diff line change
@@ -137,7 +137,7 @@ static void thread_bootstrap_pbbr_update_done(struct protocol_interface_info_ent
static void thread_neighbor_remove(mac_neighbor_table_entry_t *entry_ptr, void *user_data)
{
protocol_interface_info_entry_t *cur = user_data;
lowpan_adaptation_remove_free_indirect_table(cur, entry_ptr);
lowpan_adaptation_neigh_remove_free_tx_tables(cur, entry_ptr);

thread_reset_neighbour_info(cur, entry_ptr);
//Removes ETX neighbor
Original file line number Diff line number Diff line change
@@ -240,6 +240,8 @@ int8_t thread_bootstrap_down(protocol_interface_info_entry_t *cur)
tr_debug("SET thread Idle");
//stop polling
mac_data_poll_disable(cur);
// Reset MAC for safe upper layer memory free
protocol_mac_reset(cur);
//Clean mle table
thread_neighbor_list_clean(cur);
// store frame counters
Original file line number Diff line number Diff line change
@@ -699,7 +699,7 @@ int thread_dhcpv6_server_set_anonymous_addressing(int8_t interface_id, uint8_t *
return -1;
}

return DHCPv6_server_service_set_address_autonous_flag(interface_id, prefix_ptr, anonymous);
return DHCPv6_server_service_set_address_autonous_flag(interface_id, prefix_ptr, anonymous, false);
#else
(void) interface_id;
(void) prefix_ptr;
Original file line number Diff line number Diff line change
@@ -285,7 +285,7 @@ static void thread_update_mle_entry(protocol_interface_info_entry_t *cur, mle_me
if (short_address != entry_temp->mac16) {
if (thread_router_addr_from_addr(entry_temp->mac16) == cur->thread_info->routerShortAddress) {
thread_dynamic_storage_child_info_clear(cur->id, entry_temp);
protocol_6lowpan_release_short_link_address_from_neighcache(cur, entry_temp->mac16);

}
entry_temp->mac16 = short_address;
/* throw MLME_GET request, short address is changed automatically in get request callback */
Original file line number Diff line number Diff line change
@@ -64,6 +64,7 @@
#include "Common_Protocols/icmpv6_radv.h"
#include "MLE/mle.h"
#include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h"
#include "6LoWPAN/lowpan_adaptation_interface.h"
#include "6LoWPAN/MAC/mac_helper.h"

#define TRACE_GROUP "tsyn"
@@ -192,15 +193,29 @@ void thread_dynamic_storage_child_info_store(protocol_interface_info_entry_t *cu

void thread_dynamic_storage_child_info_clear(int8_t interface_id, struct mac_neighbor_table_entry *child)
{
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);
if (!cur) {
return;
}
thread_sync_child_info_t *child_info = thread_dynamic_storage_child_info_find(interface_id, child);


if (child_info) {
// Clear child information
memset(child_info, 0, sizeof(thread_sync_child_info_t));
tr_debug("Dynamic storage: cleared child; mac16=%04x", child->mac16);
return;
}
return;
uint8_t temp_address[2];
common_write_16_bit(child->mac16, temp_address);
//Release Old short address entries
lowpan_adaptation_free_messages_from_queues_by_address(cur, temp_address, ADDR_802_15_4_SHORT);
/* As we are losing a link to a child address, we can assume that if we have an IP neighbour cache
* mapping to that address, it is no longer valid. We must have been their parent, and they must be
* finding a new parent, and hence a new 16-bit address. (Losing a link to a router address would not
* invalidate our IP->16-bit mapping.)
*/
protocol_6lowpan_release_short_link_address_from_neighcache(cur, child->mac16);

}

static thread_sync_child_info_t *thread_dynamic_storage_child_info_find(int8_t interface_id, mac_neighbor_table_entry_t *child)
Original file line number Diff line number Diff line change
@@ -969,13 +969,6 @@ int thread_router_bootstrap_reset_child_info(protocol_interface_info_entry_t *cu
tr_debug("Child free %x", child->mac16);
thread_dynamic_storage_child_info_clear(cur->id, child);

/* As we are losing a link to a child address, we can assume that if we have an IP neighbour cache
* mapping to that address, it is no longer valid. We must have been their parent, and they must be
* finding a new parent, and hence a new 16-bit address. (Losing a link to a router address would not
* invalidate our IP->16-bit mapping.)
*/
protocol_6lowpan_release_short_link_address_from_neighcache(cur, child->mac16);

// If Child's RLOC16 appears in the Network Data send the RLOC16 to the Leader
if (thread_network_data_services_registered(&cur->thread_info->networkDataStorage, child->mac16)) {
tr_debug("Remove references to Child's RLOC16 from the Network Data");
@@ -1824,7 +1817,6 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
// Was this previously our child? If yes, update.
if ((entry_temp->mac16 & THREAD_CHILD_MASK) && thread_router_addr_from_addr(entry_temp->mac16) == cur->thread_info->routerShortAddress) {
thread_dynamic_storage_child_info_clear(cur->id, entry_temp);
protocol_6lowpan_release_short_link_address_from_neighcache(cur, entry_temp->mac16);
}
update_mac_mib = true;
entry_temp->mac16 = shortAddress; // short address refreshed
Original file line number Diff line number Diff line change
@@ -643,11 +643,10 @@ int thread_test_version_set(int8_t interface_id, uint8_t version)

int thread_test_pbbr_response_override_set(int8_t interface_id, uint8_t dua_status, uint8_t dua_count, uint8_t ba_failure_count)
{
#ifdef HAVE_THREAD
#if defined(HAVE_THREAD) && defined(HAVE_THREAD_V2) && defined(HAVE_THREAD_BORDER_ROUTER)
(void)interface_id;
thread_bbr_commercial_status_override_set(dua_status, dua_count, ba_failure_count);
return 0;

#else
(void)interface_id;
(void)dua_status;
Loading