Skip to content

Commit 85e85ee

Browse files
author
Arto Kinnunen
committed
Merge commit 'e7914df2fc0d604e27f5c26c935d05181f6be72d'
* commit 'e7914df2fc0d604e27f5c26c935d05181f6be72d': Squashed 'features/nanostack/sal-stack-nanostack/' changes from 9b3e144..fb7413b
2 parents 3badc79 + e7914df commit 85e85ee

File tree

94 files changed

+2315
-818
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2315
-818
lines changed

features/nanostack/sal-stack-nanostack/nanostack/fhss_api.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ typedef void fhss_data_tx_done(const fhss_api_t *api, bool waiting_ack, bool tx_
122122
* @param api FHSS instance.
123123
* @param handle Handle of the data request.
124124
* @param frame_type Frame type of packet (Frames types are defined by FHSS api).
125+
* @param channel Channel wanted to black list temporarily.
125126
* @return true if frame has to be queued for retransmission, false otherwise.
126127
*/
127-
typedef bool fhss_data_tx_fail(const fhss_api_t *api, uint8_t handle, int frame_type);
128+
typedef bool fhss_data_tx_fail(const fhss_api_t *api, uint8_t handle, int frame_type, uint8_t channel);
128129

129130
/**
130131
* @brief Change synchronization state.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2020, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/**
19+
* \file fhss_test_api.h
20+
* \brief
21+
*/
22+
23+
#ifndef FHSS_TEST_API_H
24+
#define FHSS_TEST_API_H
25+
26+
27+
#ifdef __cplusplus
28+
extern "C" {
29+
#endif
30+
31+
/**
32+
* \brief Set optimal packet length
33+
*
34+
* \param fhss_api FHSS instance.
35+
* \param packet_length Optimal packet length
36+
*
37+
* \return 0 Success
38+
* \return -1 Failure
39+
*/
40+
int8_t fhss_set_optimal_packet_length(const fhss_api_t *fhss_api, uint16_t packet_length);
41+
42+
#ifdef __cplusplus
43+
}
44+
#endif
45+
46+
#endif // FHSS_TEST_API_H

features/nanostack/sal-stack-nanostack/nanostack/platform/arm_hal_phy.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ typedef enum {
161161
CHANNEL_PAGE_5 = 5, ///< Page 5
162162
CHANNEL_PAGE_6 = 6, ///< Page 6
163163
CHANNEL_PAGE_9 = 9, ///< Page 9
164-
CHANNEL_PAGE_10 = 10 ///< Page 10
164+
CHANNEL_PAGE_10 = 10, ///< Page 10
165+
CHANNEL_PAGE_UNDEFINED ///< Undefined
165166
} channel_page_e;
166167

167168
/** Modulation index */
@@ -192,6 +193,10 @@ typedef struct phy_rf_statistics_s {
192193
uint32_t crc_fails; ///< CRC failures
193194
uint32_t tx_timeouts; ///< transmission timeouts
194195
uint32_t rx_timeouts; ///< reception timeouts
196+
uint64_t tx_active_time; ///< transmission active time
197+
uint64_t rx_active_time; ///< reception active time
198+
uint32_t tx_bytes; ///< transmitted bytes
199+
uint32_t rx_bytes; ///< received bytes
195200
} phy_rf_statistics_s;
196201

197202
/** Virtual data request */

features/nanostack/sal-stack-nanostack/nanostack/sw_mac.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ extern int8_t ns_sw_mac_virtual_client_unregister(struct mac_api_s *api);
6767
*/
6868
extern int ns_sw_mac_fhss_register(struct mac_api_s *mac_api, struct fhss_api *fhss_api);
6969

70+
/**
71+
* @brief Unregister FHSS API instance from given software MAC instance.
72+
* @param mac_api MAC instance.
73+
* @return 0 on success, -1 on fail.
74+
*/
75+
extern int ns_sw_mac_fhss_unregister(struct mac_api_s *mac_api);
76+
7077
/**
7178
* @brief Request registered FHSS API instance from software MAC instance.
7279
* @param mac_api MAC instance.

features/nanostack/sal-stack-nanostack/nanostack/ws_bbr_api.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,10 @@ int ws_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
4848
/**
4949
* Border router configuration options
5050
*/
51-
#define BBR_ULA_C 0x0001 /**< Static ULA prefix created automatically */
52-
#define BBR_GUA_ROUTE 0x0002 /**< More specific route is added for GUA prefix */
53-
#define BBR_BB_WAIT 0x0004 /**< Wait backbone availability before starting Wi-SUN network */
54-
55-
/*Deprecated configuration values */
56-
#define BBR_GUA_C 0x0000 /**< Routable prefix is learned from the backbone */
57-
#define BBR_GUA_SLAAC 0x0000 /**< Use SLAAC addressing in routable prefix */
58-
#define BBR_GUA_WAIT 0x0000 /**< Wait backbone availability before startingRPL dodag */
51+
#define BBR_ULA_C 0x0001 /**< Static ULA prefix created automatically */
52+
#define BBR_GUA_ROUTE 0x0002 /**< More specific route is added for GUA prefix */
53+
#define BBR_BB_WAIT 0x0004 /**< Wait backbone availability before starting Wi-SUN network */
54+
#define BBR_DEFAULT_ROUTE 0x0008 /**< Add default route parameter to DIO */
5955

6056
/**
6157
* Configure border router features.

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,8 @@ static int8_t arm_6lowpan_bootstrap_down(protocol_interface_info_entry_t *cur)
13791379
}
13801380
cur->if_lowpan_security_params->mle_security_frame_counter = mle_service_security_get_frame_counter(cur->id);
13811381
mle_service_interface_receiver_handler_update(cur->id, mle_6lowpan_message_handler);
1382+
// Reset MAC for safe upper layer memory free
1383+
protocol_mac_reset(cur);
13821384
return nwk_6lowpan_down(cur);
13831385
}
13841386
#ifdef HAVE_6LOWPAN_ND
@@ -1593,7 +1595,7 @@ static void lowpan_neighbor_entry_remove_notify(mac_neighbor_table_entry_t *entr
15931595
{
15941596

15951597
protocol_interface_info_entry_t *cur_interface = user_data;
1596-
lowpan_adaptation_remove_free_indirect_table(cur_interface, entry_ptr);
1598+
lowpan_adaptation_neigh_remove_free_tx_tables(cur_interface, entry_ptr);
15971599
// Sleepy host
15981600
if (cur_interface->lowpan_info & INTERFACE_NWK_CONF_MAC_RX_OFF_IDLE) {
15991601
mac_data_poll_protocol_poll_mode_decrement(cur_interface);

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_interface.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@
7272
#include "6LoWPAN/Fragmentation/cipv6_fragmenter.h"
7373
#include "libNET/src/net_load_balance_internal.h"
7474

75+
void protocol_mac_reset(protocol_interface_info_entry_t *cur)
76+
{
77+
if (cur->mac_api) {
78+
mlme_reset_t reset;
79+
reset.SetDefaultPIB = true;
80+
cur->mac_api->mlme_req(cur->mac_api, MLME_RESET, &reset);
81+
}
82+
}
83+
7584

7685

7786
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)
96105
}
97106

98107
if (cur->interface_mode == INTERFACE_UP) {
99-
if (cur->mac_api) {
100-
mlme_reset_t reset;
101-
reset.SetDefaultPIB = true;
102-
cur->mac_parameters->pan_id = 0xffff;
103-
cur->mac_parameters->SecurityEnabled = false;
104-
cur->mac_parameters->security_frame_counter = 0;
105-
cur->mac_parameters->mac_security_level = 0;
106-
cur->mac_api->mlme_req(cur->mac_api, MLME_RESET, &reset);
107-
}
108+
cur->mac_parameters->pan_id = 0xffff;
109+
cur->mac_parameters->SecurityEnabled = false;
110+
cur->mac_parameters->security_frame_counter = 0;
111+
cur->mac_parameters->mac_security_level = 0;
112+
protocol_mac_reset(cur);
108113
cur->interface_mode = INTERFACE_IDLE;
109114
net_load_balance_internal_state_activate(cur, false);
110115
}

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan_interface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ extern int8_t nwk_6lowpan_up(struct protocol_interface_info_entry *cur);
3131
*/
3232
extern int8_t nwk_6lowpan_down(struct protocol_interface_info_entry *cur);
3333

34+
extern void protocol_mac_reset(struct protocol_interface_info_entry *cur);
35+
3436

3537
#endif /* PROTOCOL_6LOWPAN_INTERFACE_H_ */

features/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_helper.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,7 @@ int8_t mac_helper_key_link_frame_counter_set(int8_t interface_id, uint32_t seq_p
887887

888888
void mac_helper_devicetable_remove(mac_api_t *mac_api, uint8_t attribute_index, uint8_t *mac64)
889889
{
890+
(void) mac64;
890891
if (!mac_api) {
891892
return;
892893
}

features/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_response_handler.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ void mcps_data_indication_handler(const mac_api_t *api, const mcps_data_ind_t *d
120120
void mcps_purge_confirm_handler(const mac_api_t *api, mcps_purge_conf_t *data)
121121
{
122122
(void)api;
123+
(void)data;
123124
tr_info("MCPS Data Purge confirm status %u, for handle %u", data->status, data->msduHandle);
124125
}
125126

features/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_router_object.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -856,9 +856,6 @@ static void nd_update_registration(protocol_interface_info_entry_t *cur_interfac
856856
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);
857857

858858
if (entry) {
859-
if (ws_info(cur_interface)) {
860-
ws_common_etx_validate(cur_interface, entry);
861-
}
862859

863860
if (!entry->ffd_device) {
864861
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
931928
}
932929

933930
/* TODO - check hard upper limit on registrations? */
934-
if (ws_info(cur_interface) &&
935-
!ws_common_allow_child_registration(cur_interface, aro_out->eui64)) {
936-
aro_out->present = true;
937-
aro_out->status = ARO_FULL;
938-
return true;
931+
if (ws_info(cur_interface)) {
932+
933+
aro_out->status = ws_common_allow_child_registration(cur_interface, aro_out->eui64);
934+
if (aro_out->status != ARO_SUCCESS) {
935+
aro_out->present = true;
936+
return true;
937+
}
939938
}
940939

941940
/* 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)
17571756
cur_interface->adv_retrans_timer = nd_params.ra_retrans_timer;
17581757
cur_interface->max_initial_rtr_adv_interval = nd_params.ra_interval_min;
17591758
cur_interface->max_initial_rtr_advertisements = nd_params.ra_transmits;
1759+
#else
1760+
(void) cur_interface;
17601761
#endif
17611762
}
17621763
#endif // HAVE_6LOWPAN_ND

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static void thread_bootstrap_pbbr_update_done(struct protocol_interface_info_ent
137137
static void thread_neighbor_remove(mac_neighbor_table_entry_t *entry_ptr, void *user_data)
138138
{
139139
protocol_interface_info_entry_t *cur = user_data;
140-
lowpan_adaptation_remove_free_indirect_table(cur, entry_ptr);
140+
lowpan_adaptation_neigh_remove_free_tx_tables(cur, entry_ptr);
141141

142142
thread_reset_neighbour_info(cur, entry_ptr);
143143
//Removes ETX neighbor

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ int8_t thread_bootstrap_down(protocol_interface_info_entry_t *cur)
240240
tr_debug("SET thread Idle");
241241
//stop polling
242242
mac_data_poll_disable(cur);
243+
// Reset MAC for safe upper layer memory free
244+
protocol_mac_reset(cur);
243245
//Clean mle table
244246
thread_neighbor_list_clean(cur);
245247
// store frame counters

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_if.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ int thread_dhcpv6_server_set_anonymous_addressing(int8_t interface_id, uint8_t *
699699
return -1;
700700
}
701701

702-
return DHCPv6_server_service_set_address_autonous_flag(interface_id, prefix_ptr, anonymous);
702+
return DHCPv6_server_service_set_address_autonous_flag(interface_id, prefix_ptr, anonymous, false);
703703
#else
704704
(void) interface_id;
705705
(void) prefix_ptr;

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mle_message_handler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static void thread_update_mle_entry(protocol_interface_info_entry_t *cur, mle_me
285285
if (short_address != entry_temp->mac16) {
286286
if (thread_router_addr_from_addr(entry_temp->mac16) == cur->thread_info->routerShortAddress) {
287287
thread_dynamic_storage_child_info_clear(cur->id, entry_temp);
288-
protocol_6lowpan_release_short_link_address_from_neighcache(cur, entry_temp->mac16);
288+
289289
}
290290
entry_temp->mac16 = short_address;
291291
/* throw MLME_GET request, short address is changed automatically in get request callback */

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_synch.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#include "Common_Protocols/icmpv6_radv.h"
6565
#include "MLE/mle.h"
6666
#include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h"
67+
#include "6LoWPAN/lowpan_adaptation_interface.h"
6768
#include "6LoWPAN/MAC/mac_helper.h"
6869

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

193194
void thread_dynamic_storage_child_info_clear(int8_t interface_id, struct mac_neighbor_table_entry *child)
194195
{
196+
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);
197+
if (!cur) {
198+
return;
199+
}
195200
thread_sync_child_info_t *child_info = thread_dynamic_storage_child_info_find(interface_id, child);
196201

202+
197203
if (child_info) {
198204
// Clear child information
199205
memset(child_info, 0, sizeof(thread_sync_child_info_t));
200206
tr_debug("Dynamic storage: cleared child; mac16=%04x", child->mac16);
201-
return;
202207
}
203-
return;
208+
uint8_t temp_address[2];
209+
common_write_16_bit(child->mac16, temp_address);
210+
//Release Old short address entries
211+
lowpan_adaptation_free_messages_from_queues_by_address(cur, temp_address, ADDR_802_15_4_SHORT);
212+
/* As we are losing a link to a child address, we can assume that if we have an IP neighbour cache
213+
* mapping to that address, it is no longer valid. We must have been their parent, and they must be
214+
* finding a new parent, and hence a new 16-bit address. (Losing a link to a router address would not
215+
* invalidate our IP->16-bit mapping.)
216+
*/
217+
protocol_6lowpan_release_short_link_address_from_neighcache(cur, child->mac16);
218+
204219
}
205220

206221
static thread_sync_child_info_t *thread_dynamic_storage_child_info_find(int8_t interface_id, mac_neighbor_table_entry_t *child)

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_router_bootstrap.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -969,13 +969,6 @@ int thread_router_bootstrap_reset_child_info(protocol_interface_info_entry_t *cu
969969
tr_debug("Child free %x", child->mac16);
970970
thread_dynamic_storage_child_info_clear(cur->id, child);
971971

972-
/* As we are losing a link to a child address, we can assume that if we have an IP neighbour cache
973-
* mapping to that address, it is no longer valid. We must have been their parent, and they must be
974-
* finding a new parent, and hence a new 16-bit address. (Losing a link to a router address would not
975-
* invalidate our IP->16-bit mapping.)
976-
*/
977-
protocol_6lowpan_release_short_link_address_from_neighcache(cur, child->mac16);
978-
979972
// If Child's RLOC16 appears in the Network Data send the RLOC16 to the Leader
980973
if (thread_network_data_services_registered(&cur->thread_info->networkDataStorage, child->mac16)) {
981974
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 *
18241817
// Was this previously our child? If yes, update.
18251818
if ((entry_temp->mac16 & THREAD_CHILD_MASK) && thread_router_addr_from_addr(entry_temp->mac16) == cur->thread_info->routerShortAddress) {
18261819
thread_dynamic_storage_child_info_clear(cur->id, entry_temp);
1827-
protocol_6lowpan_release_short_link_address_from_neighcache(cur, entry_temp->mac16);
18281820
}
18291821
update_mac_mib = true;
18301822
entry_temp->mac16 = shortAddress; // short address refreshed

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_test_api.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,11 +643,10 @@ int thread_test_version_set(int8_t interface_id, uint8_t version)
643643

644644
int thread_test_pbbr_response_override_set(int8_t interface_id, uint8_t dua_status, uint8_t dua_count, uint8_t ba_failure_count)
645645
{
646-
#ifdef HAVE_THREAD
646+
#if defined(HAVE_THREAD) && defined(HAVE_THREAD_V2) && defined(HAVE_THREAD_BORDER_ROUTER)
647647
(void)interface_id;
648648
thread_bbr_commercial_status_override_set(dua_status, dua_count, ba_failure_count);
649649
return 0;
650-
651650
#else
652651
(void)interface_id;
653652
(void)dua_status;

0 commit comments

Comments
 (0)