Skip to content

Commit d5f5bee

Browse files
author
Arto Kinnunen
committed
Merge branch 'release_internal' into release_external
* release_internal: (65 commits) Fix unittest cleanup Adjust GC cleanup threshold and traces Remove ns_sw_mac_packet_ingress_rate_limit_by_mem (#2132) Copy ingress rate limiting API to ns_conf Fix compiler warnings Review corrections Update GC thresholds, init and traces Add unit tests for monitor Nanostack heap garbage collection Fix errors found by Coverity (#2131) MAC, RPL and ETX trace clean. Limit amount of incoming packet based on memory (#2128) Fixed unitest header size compare value for support brodacst shedule. Wi-sun LLC update WS PAN Config handler update Wi-sun PAN_VERSION lifetime and timeout update Fixed broken wi-sun neigbour black list filtering. Update Pan information data from all selected parent. Fixed Pan advertisment route cost comapre for consistent and incosistent SW MAC timestamp read update ...
2 parents 0345477 + 72b065b commit d5f5bee

File tree

95 files changed

+2400
-756
lines changed

Some content is hidden

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

95 files changed

+2400
-756
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ $(TESTDIRS):
6565

6666
$(CLEANTESTDIRS):
6767
@make -C $(@:clean-%=%) clean
68+
@rm -fr results
6869

6970
.PHONY: release
7071
release:

nanostack/fhss_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ typedef struct fhss_statistics {
183183

184184
/** FHSS synchronization lost counter. */
185185
uint32_t fhss_synch_lost;
186+
187+
/** FHSS TX to unknown neighbour counter. */
188+
uint32_t fhss_unknown_neighbor;
189+
190+
/** FHSS channel retry counter. */
191+
uint32_t fhss_channel_retry;
186192
} fhss_statistics_t;
187193

188194
/**

nanostack/net_fhss.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ extern int ns_fhss_ws_configuration_set(const fhss_api_t *fhss_api, const fhss_w
7676
*/
7777
extern int ns_fhss_delete(fhss_api_t *fhss_api);
7878

79+
/**
80+
* @brief Starts collecting FHSS statistics.
81+
* @param fhss_api FHSS instance.
82+
* @param fhss_statistics Pointer to stored statistics.
83+
* @return 0 on success, -1 on fail.
84+
*/
85+
extern int ns_fhss_statistics_start(const fhss_api_t *fhss_api, fhss_statistics_t *fhss_statistics);
86+
7987

8088
#ifdef __cplusplus
8189
}

nanostack/ns_conf.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (c) 2019, 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+
#ifndef _NS_CONF_H_
19+
#define _NS_CONF_H_
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
/**
26+
* \file ns_conf.h
27+
* \brief Nanostack configuration API.
28+
*/
29+
30+
/**
31+
* \brief Set threshold for memory garbage collection.
32+
*
33+
* Nanostack heap usage is monitored in regular intervals. If too much memory has been used then garbage collection (GC)
34+
* is triggered. GC has two adjustable thresholds: HIGH and CRITICAL. HIGH threshold is lower one and once exceeded
35+
* a GC will try to release memory that is used for caching. When CRITTICAL threshold is exceeded them GC will try to release
36+
* memory more aggressiveliy.
37+
*
38+
* Nanostack memory monitoring can only work if memory statistics are enabled in nsdynmemLIB.
39+
40+
*
41+
* \param percentage_high Percentage of total heap when garbage collection is first time triggered
42+
* \param percentage_critical Percentage of total heap when critical garbage collection is triggered
43+
*
44+
* \return 0 in success, negative value in case of error.
45+
*
46+
*/
47+
int ns_conf_gc_threshold_set(uint8_t percentage_high, uint8_t percentage_critical);
48+
49+
/**
50+
* \brief Limit amount of incoming packets if system does not have enough free memory.
51+
* Memory statistics must been initialized in nsdynmemLIB to get this feature working.
52+
*
53+
* \param free_heap_percentage Percentage of free heap that must be available when packet arrives to MAC layer.
54+
* \return 0 in case of success, <0 otherwise.
55+
*/
56+
int ns_conf_packet_ingress_rate_limit_by_mem(uint8_t free_heap_percentage);
57+
58+
#ifdef __cplusplus
59+
}
60+
#endif
61+
62+
#endif /* _NS_CONF_H_ */

nanostack/ns_file_system.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#ifndef _NS_FILE_SYSTEM_H_
1919
#define _NS_FILE_SYSTEM_H_
2020

21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
2125
/**
2226
* \file ns_file_system.h
2327
* \brief Nanostack file system API.
@@ -35,9 +39,7 @@
3539
* \return 0 in success, negative value in case of error.
3640
*
3741
*/
38-
#ifdef __cplusplus
39-
extern "C" {
40-
#endif
42+
4143
int ns_file_system_set_root_path(const char *root_path);
4244

4345
/**
@@ -47,6 +49,7 @@ int ns_file_system_set_root_path(const char *root_path);
4749
*
4850
*/
4951
char *ns_file_system_get_root_path(void);
52+
5053
#ifdef __cplusplus
5154
}
5255
#endif

nanostack/sw_mac.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016-2018, Arm Limited and affiliates.
2+
* Copyright (c) 2016-2019, Arm Limited and affiliates.
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -81,6 +81,13 @@ extern struct fhss_api *ns_sw_mac_get_fhss_api(struct mac_api_s *mac_api);
8181
*/
8282
extern int ns_sw_mac_statistics_start(struct mac_api_s *mac_api, struct mac_statistics_s *mac_statistics);
8383

84+
/**
85+
* @brief Read current timestamp.
86+
* @param mac_api MAC instance.
87+
* @return Current timestamp in us
88+
*/
89+
extern uint32_t ns_sw_mac_read_current_timestamp(struct mac_api_s *mac_api);
90+
8491
#ifdef __cplusplus
8592
}
8693
#endif

nanostack/ws_management_api.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ extern "C" {
7777

7878
#define NETWORK_SIZE_AUTOMATIC 0x00
7979
#define NETWORK_SIZE_SMALL 0x01
80+
#define NETWORK_SIZE_MEDIUM 0x08
8081
#define NETWORK_SIZE_LARGE 0x10
8182

8283

@@ -85,6 +86,16 @@ extern "C" {
8586
*/
8687
#define WS_MANAGEMENT_API_VER_2
8788

89+
/**
90+
* \brief Struct ws_statistics defines the Wi-SUN statistics storage structure.
91+
*/
92+
typedef struct ws_statistics {
93+
/** Asynch TX counter */
94+
uint32_t asynch_tx_count;
95+
/** Asynch RX counter */
96+
uint32_t asynch_rx_count;
97+
} ws_statistics_t;
98+
8899
/**
89100
* Initialize Wi-SUN stack.
90101
*
@@ -255,6 +266,30 @@ int ws_management_fhss_broadcast_channel_function_configure(
255266
uint8_t dwell_interval,
256267
uint32_t broadcast_interval);
257268

269+
/**
270+
* Start collecting Wi-SUN statistics.
271+
*
272+
* \param interface_id Network interface ID.
273+
* \param stats_ptr Pointer to stored statistics.
274+
*
275+
* \return 0 Success.
276+
* \return <0 Failure.
277+
*/
278+
int ws_statistics_start(
279+
int8_t interface_id,
280+
ws_statistics_t *stats_ptr);
281+
282+
/**
283+
* Stop collecting Wi-SUN statistics.
284+
*
285+
* \param interface_id Network interface ID.
286+
*
287+
* \return 0 Success.
288+
* \return <0 Failure.
289+
*/
290+
int ws_statistics_stop(
291+
int8_t interface_id);
292+
258293
#ifdef __cplusplus
259294
}
260295
#endif

source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ static void lowpan_neighbor_entry_remove_notify(mac_neighbor_table_entry_t *entr
16051605
protocol_6lowpan_release_short_link_address_from_neighcache(cur_interface, entry_ptr->mac16);
16061606
protocol_6lowpan_release_long_link_address_from_neighcache(cur_interface, entry_ptr->mac64);
16071607
}
1608-
mac_helper_devicetable_remove(cur_interface->mac_api, entry_ptr->index);
1608+
mac_helper_devicetable_remove(cur_interface->mac_api, entry_ptr->index, entry_ptr->mac64);
16091609
//Removes ETX neighbor
16101610
etx_neighbor_remove(cur_interface->id, entry_ptr->index);
16111611
//Remove MLE frame counter info

source/6LoWPAN/MAC/mac_helper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ int8_t mac_helper_link_frame_counter_set(int8_t interface_id, uint32_t seq_ptr)
866866
return 0;
867867
}
868868

869-
void mac_helper_devicetable_remove(mac_api_t *mac_api, uint8_t attribute_index)
869+
void mac_helper_devicetable_remove(mac_api_t *mac_api, uint8_t attribute_index, uint8_t *mac64)
870870
{
871871
if (!mac_api) {
872872
return;
@@ -880,7 +880,7 @@ void mac_helper_devicetable_remove(mac_api_t *mac_api, uint8_t attribute_index)
880880
set_req.attr_index = attribute_index;
881881
set_req.value_pointer = (void *)&device_desc;
882882
set_req.value_size = sizeof(mlme_device_descriptor_t);
883-
tr_debug("unRegister Device");
883+
tr_debug("Unregister Device %u, mac64: %s", attribute_index, trace_array(mac64, 8));
884884
mac_api->mlme_req(mac_api, MLME_SET, &set_req);
885885
}
886886

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

source/6LoWPAN/MAC/mac_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ int8_t mac_helper_link_frame_counter_read(int8_t interface_id, uint32_t *seq_ptr
115115

116116
int8_t mac_helper_link_frame_counter_set(int8_t interface_id, uint32_t seq_ptr);
117117

118-
void mac_helper_devicetable_remove(struct mac_api_s *mac_api, uint8_t attribute_index);
118+
void mac_helper_devicetable_remove(struct mac_api_s *mac_api, uint8_t attribute_index, uint8_t *mac64);
119119

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

source/6LoWPAN/ND/nd_router_object.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,8 +855,14 @@ static void nd_update_registration(protocol_interface_info_entry_t *cur_interfac
855855
*/
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

858-
if (entry && !entry->ffd_device) {
859-
rpl_control_publish_host_address(protocol_6lowpan_rpl_domain, neigh->ip_address, neigh->lifetime);
858+
if (entry) {
859+
if (ws_info(cur_interface)) {
860+
ws_common_etx_validate(cur_interface, entry);
861+
}
862+
863+
if (!entry->ffd_device) {
864+
rpl_control_publish_host_address(protocol_6lowpan_rpl_domain, neigh->ip_address, neigh->lifetime);
865+
}
860866
}
861867
protocol_6lowpan_neighbor_address_state_synch(cur_interface, aro->eui64, neigh->ip_address + 8);
862868

source/6LoWPAN/Thread/thread_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ void thread_reset_neighbour_info(protocol_interface_info_entry_t *cur, mac_neigh
20152015
thread_routing_remove_link(cur, neighbour->mac16);
20162016
thread_router_bootstrap_reset_child_info(cur, neighbour);
20172017
protocol_6lowpan_release_long_link_address_from_neighcache(cur, neighbour->mac64);
2018-
mac_helper_devicetable_remove(cur->mac_api, neighbour->index);
2018+
mac_helper_devicetable_remove(cur->mac_api, neighbour->index, neighbour->mac64);
20192019
thread_neighbor_class_entry_remove(&cur->thread_info->neighbor_class, neighbour->index);
20202020
}
20212021

0 commit comments

Comments
 (0)