Skip to content

Commit 4453f82

Browse files
author
Arto Kinnunen
committed
Merge branch 'release_internal' into release_external
* release_internal: (170 commits) Add missing function macros (#1897) implemented wisun routing cost calculation Fix warning found by PVS-studio (#1891) Additional time for distribution of dataset added (#1892) Reverted commit #1888 and fixed thread_bbr_dua_entry_find (#1893) BBR route for added with preference. Route info updated. (#1888) Fix issues found by coverity (#1889) Fixes for Wi-SUN bbr behaviour Adjust COAP callback return values (#1886) Fix for multicast ping forwarding before adding MPL header(#1883) FHSS: fixed missing us convert FHSS: Traces in set parent FHSS: Time unit defines added FHSS: changed traces to use timestamp from MAC FHSS: use divider function in ufsi calculation FHSS: function to check if remaining slots is negative Address registration fix (#1882) FHSS unit tests: Fixed tr51 tests FHSS: fixed tr51 channel table size FHSS unit tests: Fixed tr51 tests ...
2 parents 2535a6c + acbf1ac commit 4453f82

File tree

104 files changed

+2666
-942
lines changed

Some content is hidden

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

104 files changed

+2666
-942
lines changed

nanostack/dhcp_service_api.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
typedef enum dhcp_instance_type
7070
{
7171
DHCP_INSTANCE_CLIENT,
72-
DHCP_INSTANCE_SERVER
72+
DHCP_INSTANCE_SERVER,
73+
DHCP_INTANCE_RELAY_AGENT
7374
} dhcp_instance_type_e;
7475

7576
/**
@@ -124,6 +125,16 @@ typedef int (dhcp_service_receive_resp_cb)(uint16_t instance_id, void *ptr, uint
124125

125126
uint16_t dhcp_service_init(int8_t interface_id, dhcp_instance_type_e instance_type, dhcp_service_receive_req_cb *receive_req_cb);
126127

128+
/**
129+
* \brief Enable DHCPv6 Relay Agent to server.
130+
*
131+
*
132+
* \param instance The instance ID of the registered server.
133+
* \param server_address global server IPv6 address
134+
*/
135+
void dhcp_service_relay_instance_enable(uint16_t instance, uint8_t *server_address);
136+
137+
127138
/**
128139
* \brief Deletes a server instance.
129140
*

nanostack/fhss_api.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ typedef bool fhss_data_tx_fail(const fhss_api_t *api, uint8_t handle, int frame_
132132
* @param api FHSS instance.
133133
* @param fhss_state FHSS state (FHSS states are defined by FHSS api).
134134
* @param pan_id PAN id of the network FHSS synchronizes with.
135+
* @return -1 when failed, otherwise current MAC channel.
135136
*/
136-
typedef void fhss_synch_state_set(const fhss_api_t *api, fhss_states fhss_state, uint16_t pan_id);
137+
typedef int16_t fhss_synch_state_set(const fhss_api_t *api, fhss_states fhss_state, uint16_t pan_id);
137138

138139
/**
139140
* @brief Read timestamp.
@@ -215,6 +216,13 @@ typedef int mac_read_mac_address(const fhss_api_t *fhss_api, uint8_t *mac_addres
215216
*/
216217
typedef uint32_t mac_read_datarate(const fhss_api_t *fhss_api);
217218

219+
/**
220+
* @brief Read 32-bit timestamp.
221+
* @param fhss_api FHSS instance.
222+
* @return Timestamp.
223+
*/
224+
typedef uint32_t mac_read_timestamp(const fhss_api_t *fhss_api);
225+
218226
/**
219227
* @brief Change channel.
220228
* @param fhss_api FHSS instance.
@@ -287,6 +295,7 @@ struct fhss_callback {
287295
mac_read_tx_queue_size *read_tx_queue_size; /**< Read MAC TX queue size. */
288296
mac_read_mac_address *read_mac_address; /**< Read MAC address. */
289297
mac_read_datarate *read_datarate; /**< Read PHY datarate. */
298+
mac_read_timestamp *read_timestamp; /**< Read timestamp. */
290299
mac_change_channel *change_channel; /**< Change channel. */
291300
mac_send_fhss_frame *send_fhss_frame; /**< Send FHSS frame. */
292301
mac_synch_lost_notification *synch_lost_notification; /**< Send notification when FHSS synchronization is lost. */

nanostack/fhss_config.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,11 @@ typedef int32_t fhss_vendor_defined_cf(const fhss_api_t *api, uint16_t slot, uin
9696
*/
9797
typedef struct fhss_ws_configuration
9898
{
99-
/** WS channel function. */
100-
fhss_ws_channel_functions ws_channel_function;
99+
/** WS unicast channel function. */
100+
fhss_ws_channel_functions ws_uc_channel_function;
101+
102+
/** WS broadcast channel function. */
103+
fhss_ws_channel_functions ws_bc_channel_function;
101104

102105
/** Broadcast schedule identifier. */
103106
uint16_t bsi;
@@ -111,6 +114,12 @@ typedef struct fhss_ws_configuration
111114
/** Broadcast dwell interval. Range: 15-250 milliseconds. */
112115
uint8_t fhss_bc_dwell_interval;
113116

117+
/** Unicast fixed channel */
118+
uint8_t unicast_fixed_channel;
119+
120+
/** Broadcast fixed channel */
121+
uint8_t broadcast_fixed_channel;
122+
114123
/** Channel mask. */
115124
uint32_t channel_mask[8];
116125

nanostack/fhss_ws_extension.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ typedef struct unicast_timing_info {
3737
unsigned unicast_channel_function:3; /**< Unicast schedule channel function */
3838
uint8_t unicast_dwell_interval; /**< Unicast dwell interval */
3939
uint16_t unicast_number_of_channels; /**< Unicast number of channels */
40+
uint16_t fixed_channel; /**< Unicast fixed channel*/
4041
uint_fast24_t ufsi; /**< Unicast fractional sequence interval */
4142
uint32_t utt_rx_timestamp; /**< UTT-IE reception timestamp */
4243
} unicast_timing_info_t;
@@ -47,6 +48,7 @@ typedef struct unicast_timing_info {
4748
typedef struct broadcast_timing_info {
4849
unsigned broadcast_channel_function:3; /**< Broadcast schedule channel function */
4950
uint8_t broadcast_dwell_interval; /**< Broadcast dwell interval */
51+
uint16_t fixed_channel; /**< Broadcast fixed channel*/
5052
uint16_t broadcast_slot; /**< Broadcast slot number */
5153
uint16_t broadcast_schedule_id; /**< Broadcast schedule identifier */
5254
uint_fast24_t broadcast_interval_offset; /**< Broadcast interval offset */
@@ -78,9 +80,10 @@ typedef fhss_ws_neighbor_timing_info_t *fhss_get_neighbor_info(const fhss_api_t
7880
* @param fhss_api FHSS instance.
7981
* @param eui64 EUI-64 address of parent.
8082
* @param bc_timing_info Pointer to parent broadcast timing/hopping schedule info.
83+
* @param force_synch If false, synchronization is done only if minimum (internal) synchronization interval is exceed.
8184
* @return 0 on success, -1 on fail.
8285
*/
83-
extern int ns_fhss_ws_set_parent(const fhss_api_t *fhss_api, const uint8_t eui64[8], const broadcast_timing_info_t *bc_timing_info);
86+
extern int ns_fhss_ws_set_parent(const fhss_api_t *fhss_api, const uint8_t eui64[8], const broadcast_timing_info_t *bc_timing_info, const bool force_synch);
8487

8588
/**
8689
* @brief Remove parent which was set by ns_fhss_ws_set_parent function.

nanostack/mac_api.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ typedef void mcps_data_request_ext(const mac_api_t* api, const mcps_data_req_t *
137137
* @brief mcps_purge_request MCPS_PURGE request call
138138
* @param api API to handle the request
139139
* @param data MCPS-PURGE.request specific values
140+
* @return 0 in case of success, non-zero otherwise
140141
*/
141-
typedef void mcps_purge_request(const mac_api_t* api, const mcps_purge_t *data);
142+
typedef uint8_t mcps_purge_request(const mac_api_t* api, const mcps_purge_t *data);
142143

143144
//Upper layer specific callback functions (will also be set by Upper layer after mac_api_t has been created and given to it)
144145

nanostack/net_fhss.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ extern "C" {
3939
extern fhss_api_t *ns_fhss_create(const fhss_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer, fhss_statistics_t *fhss_statistics);
4040

4141
/**
42-
* @brief TODO: description.
42+
* @brief Creates FHSS WS API instance which will be registered to software MAC.
4343
* @param fhss_configuration Basic FHSS configuration.
4444
* @param fhss_timer FHSS platform timer interface and configuration.
45-
* @param fhss_statistics FHSS statistics storage.
4645
* @return New FHSS instance if successful, NULL otherwise.
4746
*/
4847
extern fhss_api_t *ns_fhss_ws_create(const fhss_ws_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer);

nanostack/thread_bbr_api.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ int thread_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
7575
*
7676
*/
7777
int thread_bbr_timeout_set(int8_t interface_id, uint32_t timeout_a, uint32_t timeout_b, uint32_t delay);
78+
7879
/**
7980
* Set prefix to be used as combining multiple thread networks on backbone.
8081
*
@@ -89,6 +90,20 @@ int thread_bbr_timeout_set(int8_t interface_id, uint32_t timeout_a, uint32_t tim
8990
*/
9091
int thread_bbr_prefix_set(int8_t interface_id, uint8_t *prefix);
9192

93+
/**
94+
* Set sequence number to be used by bbr
95+
*
96+
* update sequence number value
97+
*
98+
* \param interface_id interface ID of the Thread network.
99+
* \param sequence_number value that needs to be set on bbr
100+
*
101+
* \return 0 on success
102+
* \return <0 in case of errors
103+
*
104+
*/
105+
int thread_bbr_sequence_number_set(int8_t interface_id, uint8_t sequence_number);
106+
92107
/**
93108
* Set the Thread validation interface destination address.
94109
*

nanostack/thread_commissioning_api.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,10 @@ void *thread_commission_device_get_next(void *ptr, int8_t interface_id, bool *sh
189189

190190
typedef struct thread_commissioning_link_configuration {
191191
uint8_t name[16]; /**< Name of the Thread network. utf8 string nul terminated if shorter than 16. */
192+
uint8_t destination_address[16]; /**<Border router destination address*/
192193
uint8_t extented_pan_id[8]; /**< Extended PAN ID. */
193194
uint16_t panId; /**< Network ID. */
195+
uint16_t destination_port; /**<destination port for commissioning*/
194196
uint8_t Protocol_id; /**< Current protocol ID. */
195197
uint8_t version; /**< Current protocol version. */
196198
uint8_t rfChannel; /**< Current RF channel. */
@@ -271,6 +273,18 @@ int thread_commissioning_native_commissioner_get_connection_info(int8_t interfac
271273
*/
272274
int8_t thread_commissioning_get_management_id(int8_t interface_id);
273275

276+
/**
277+
* \brief Attach native commissioner to destination address and port.
278+
*
279+
* \param interface_id Network interface ID.
280+
* \param destination_address Destination address pointer.
281+
* \param destination_port Commissioning port.
282+
*
283+
* \return 0 attach OK.
284+
* \return < 0 fail.
285+
*/
286+
int thread_commissioning_attach(int8_t interface_id, uint8_t *destination_address, uint16_t destination_port);
287+
274288
#ifdef __cplusplus
275289
}
276290
#endif

nanostack/thread_diagcop_lib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
#define DIAGCOP_TLV_SUPPLY_VOLTAGE 15 /**< Can not reset*/
5656
#define DIAGCOP_TLV_CHILD_TABLE 16 /**< Can not reset*/
5757
#define DIAGCOP_TLV_CHANNEL_PAGES 17 /**< Can not reset*/
58-
#define DIAGCOP_TLV_TYPE_LIST 18 /**< List type*/
58+
#define DIAGCOP_TLV_TYPE_LIST 18 /**< Cannot reset*/
59+
#define DIAGCOP_TLV_MAX_CHILD_TIMEOUT 19 /**< Cannot reset*/
5960

6061
/**
6162
* \brief Write array TLV.

nanostack/ws_bbr_api.h

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright (c) 2017-2018, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright
9+
* notice, this list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright
11+
* notice, this list of conditions and the following disclaimer in the
12+
* documentation and/or other materials provided with the distribution.
13+
* 3. Neither the name of the copyright holder nor the
14+
* names of its contributors may be used to endorse or promote products
15+
* derived from this software without specific prior written permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27+
* POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
/**
31+
* \file ws_bbr_api.h
32+
* \brief Wi-SUN backbone border router (BBR) application interface.
33+
*
34+
* This is Wi-SUN backbone Border router service.
35+
* When started the module takes care of starting the
36+
* components that enables default border router functionality in Wi-SUN network.
37+
*
38+
*/
39+
40+
#ifndef WS_BBR_API_H_
41+
#define WS_BBR_API_H_
42+
43+
#include "ns_types.h"
44+
45+
/**
46+
* Start backbone border router service.
47+
*
48+
* if backbone interface is enabled and allows routing.
49+
* Enables ND proxy for address found from backbone
50+
*
51+
* \param interface_id Wi-SUN network interface id.
52+
* \param backbone_interface_id backbone interface id.
53+
*
54+
* \return 0 on success
55+
* \return <0 in case of errors
56+
*
57+
*/
58+
int ws_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
59+
60+
/**
61+
* Stop backbone Border router.
62+
*
63+
* \param interface_id interface ID of the Wi-SUN network
64+
*
65+
* \return 0 on success
66+
* \return <0 in case of errors
67+
*
68+
*/
69+
void ws_bbr_stop(int8_t interface_id);
70+
71+
72+
#endif /* WS_BBR_API_H_ */

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include "6LoWPAN/Fragmentation/cipv6_fragmenter.h"
7575
#include "Service_Libs/etx/etx.h"
7676
#include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h"
77+
#include "6LoWPAN/ws/ws_bootstrap.h"
7778

7879

7980
#define TRACE_GROUP_LOWPAN "6lo"
@@ -473,7 +474,6 @@ void protocol_6lowpan_neighbor_priority_update(protocol_interface_info_entry_t *
473474
}
474475

475476
#ifdef HAVE_RPL
476-
#ifndef NO_MLE
477477

478478
uint16_t protocol_6lowpan_neighbor_priority_set(int8_t interface_id, addrtype_t addr_type, const uint8_t *addr_ptr)
479479
{
@@ -486,9 +486,12 @@ uint16_t protocol_6lowpan_neighbor_priority_set(int8_t interface_id, addrtype_t
486486
mac_neighbor_table_entry_t * entry = mac_neighbor_table_address_discover(mac_neighbor_info(cur), addr_ptr + PAN_ID_LEN, addr_type);
487487

488488
if (entry) {
489+
490+
bool new_primary = false;
489491
etx_storage_t *etx_entry = etx_storage_entry_get(interface_id, entry->index);
490492
// If primary parent has changed clears priority from previous parent
491493
if (entry->link_role != PRIORITY_PARENT_NEIGHBOUR) {
494+
new_primary = true;
492495
protocol_6lowpan_neighbor_priority_clear_all(interface_id, PRIORITY_1ST);
493496
}
494497
entry->link_role = PRIORITY_PARENT_NEIGHBOUR;
@@ -501,6 +504,10 @@ uint16_t protocol_6lowpan_neighbor_priority_set(int8_t interface_id, addrtype_t
501504
if (etx_entry) {
502505
protocol_stats_update(STATS_ETX_1ST_PARENT, etx_entry->etx >> 4);
503506
}
507+
508+
if (new_primary) {
509+
ws_primary_parent_update(cur, entry);
510+
}
504511
return 1;
505512
} else {
506513
return 0;
@@ -519,16 +526,21 @@ uint16_t protocol_6lowpan_neighbor_second_priority_set(int8_t interface_id, addr
519526
mac_neighbor_table_entry_t * entry = mac_neighbor_table_address_discover(mac_neighbor_info(cur), addr_ptr + PAN_ID_LEN, addr_type);
520527

521528
if (entry) {
529+
bool new_secondary = false;
522530
etx_storage_t *etx_entry = etx_storage_entry_get(interface_id, entry->index);
523531
// If secondary parent has changed clears priority from previous parent
524532
if (entry->link_role != SECONDARY_PARENT_NEIGHBOUR) {
533+
new_secondary = true;
525534
protocol_6lowpan_neighbor_priority_clear_all(interface_id, PRIORITY_2ND);
526535
}
527536
entry->link_role = SECONDARY_PARENT_NEIGHBOUR;
528537

529538
if (etx_entry) {
530539
protocol_stats_update(STATS_ETX_2ND_PARENT, etx_entry->etx >> 4);
531540
}
541+
if (new_secondary) {
542+
ws_secondary_parent_update(cur);
543+
}
532544
return 1;
533545
} else {
534546
return 0;
@@ -557,7 +569,6 @@ void protocol_6lowpan_neighbor_priority_clear_all(int8_t interface_id, neighbor_
557569
}
558570
}
559571

560-
#endif
561572
#endif
562573

563574
#endif

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,7 @@ int8_t arm_6lowpan_bootstarp_bootstrap_set(int8_t interface_id, net_6lowpan_mode
17861786
*/
17871787
if (cur->lowpan_info & INTERFACE_NWK_ROUTER_DEVICE) {
17881788
//rpl_control_set_domain_on_interface(cur, protocol_6lowpan_rpl_domain, true);
1789-
//rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, cur);
1789+
//rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, NULL, cur);
17901790
}
17911791
#endif
17921792
cur->configure_flags |= INTERFACE_BOOTSTRAP_DEFINED;
@@ -2073,6 +2073,8 @@ static void protocol_6lowpan_bootstrap_rpl_callback(rpl_event_t event, void *han
20732073
tr_error("RPL Local repair fail-->interface to idle");
20742074
nwk_bootsrap_state_update(ARM_NWK_NWK_CONNECTION_DOWN, cur);
20752075
break;
2076+
default:
2077+
break;
20762078
}
20772079
}
20782080

@@ -2179,7 +2181,7 @@ void nwk_6lowpan_nd_address_registartion_ready(protocol_interface_info_entry_t *
21792181
// arm_nwk_6lowpan_rpl_dodag_poison from a previous connection may have left force_leaf set
21802182
rpl_control_force_leaf(protocol_6lowpan_rpl_domain, false);
21812183
rpl_control_set_domain_on_interface(cur, protocol_6lowpan_rpl_domain, true);
2182-
rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, cur);
2184+
rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, NULL, cur);
21832185
}
21842186
// Send unicast DIS to coordinator
21852187
nwk_bootstrap_icmp_rpl_dis_coord_msg_tx(cur);

source/6LoWPAN/MAC/mpx_api.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ typedef void mpx_data_request(const mpx_api_t *api, const struct mcps_data_req_s
3939
* @param api API to handle the request
4040
* @param purge MCPS-purge request
4141
* @param user_id MPX user ID
42+
* @return 0 if purge requst was OK, non-zero otherwise
4243
*
4344
*/
44-
typedef void mpx_data_purge_request(const mpx_api_t *api, struct mcps_purge_s *purge, uint16_t user_id);
45+
typedef uint8_t mpx_data_purge_request(const mpx_api_t *api, struct mcps_purge_s *purge, uint16_t user_id);
4546

4647
/**
4748
* @brief mpx_data_confirm MPX-DATA confirm is called as a response to MPX-DATA request

0 commit comments

Comments
 (0)