Skip to content

Commit

Permalink
Merge branch 'release_internal' into release_external
Browse files Browse the repository at this point in the history
* release_internal: (170 commits)
  Add missing function macros (ARMmbed#1897)
  implemented wisun routing cost calculation
  Fix warning found by PVS-studio (ARMmbed#1891)
  Additional time for distribution of dataset added (ARMmbed#1892)
  Reverted commit ARMmbed#1888 and fixed thread_bbr_dua_entry_find (ARMmbed#1893)
  BBR route for added with preference. Route info updated. (ARMmbed#1888)
  Fix issues found by coverity (ARMmbed#1889)
  Fixes for Wi-SUN bbr behaviour
  Adjust COAP callback return values (ARMmbed#1886)
  Fix for multicast ping forwarding before adding MPL header(ARMmbed#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 (ARMmbed#1882)
  FHSS unit tests: Fixed tr51 tests
  FHSS: fixed tr51 channel table size
  FHSS unit tests: Fixed tr51 tests
  ...
  • Loading branch information
Arto Kinnunen committed Nov 5, 2018
2 parents 2535a6c + acbf1ac commit 4453f82
Show file tree
Hide file tree
Showing 104 changed files with 2,666 additions and 942 deletions.
13 changes: 12 additions & 1 deletion nanostack/dhcp_service_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
typedef enum dhcp_instance_type
{
DHCP_INSTANCE_CLIENT,
DHCP_INSTANCE_SERVER
DHCP_INSTANCE_SERVER,
DHCP_INTANCE_RELAY_AGENT
} dhcp_instance_type_e;

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

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

/**
* \brief Enable DHCPv6 Relay Agent to server.
*
*
* \param instance The instance ID of the registered server.
* \param server_address global server IPv6 address
*/
void dhcp_service_relay_instance_enable(uint16_t instance, uint8_t *server_address);


/**
* \brief Deletes a server instance.
*
Expand Down
11 changes: 10 additions & 1 deletion nanostack/fhss_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ typedef bool fhss_data_tx_fail(const fhss_api_t *api, uint8_t handle, int frame_
* @param api FHSS instance.
* @param fhss_state FHSS state (FHSS states are defined by FHSS api).
* @param pan_id PAN id of the network FHSS synchronizes with.
* @return -1 when failed, otherwise current MAC channel.
*/
typedef void fhss_synch_state_set(const fhss_api_t *api, fhss_states fhss_state, uint16_t pan_id);
typedef int16_t fhss_synch_state_set(const fhss_api_t *api, fhss_states fhss_state, uint16_t pan_id);

/**
* @brief Read timestamp.
Expand Down Expand Up @@ -215,6 +216,13 @@ typedef int mac_read_mac_address(const fhss_api_t *fhss_api, uint8_t *mac_addres
*/
typedef uint32_t mac_read_datarate(const fhss_api_t *fhss_api);

/**
* @brief Read 32-bit timestamp.
* @param fhss_api FHSS instance.
* @return Timestamp.
*/
typedef uint32_t mac_read_timestamp(const fhss_api_t *fhss_api);

/**
* @brief Change channel.
* @param fhss_api FHSS instance.
Expand Down Expand Up @@ -287,6 +295,7 @@ struct fhss_callback {
mac_read_tx_queue_size *read_tx_queue_size; /**< Read MAC TX queue size. */
mac_read_mac_address *read_mac_address; /**< Read MAC address. */
mac_read_datarate *read_datarate; /**< Read PHY datarate. */
mac_read_timestamp *read_timestamp; /**< Read timestamp. */
mac_change_channel *change_channel; /**< Change channel. */
mac_send_fhss_frame *send_fhss_frame; /**< Send FHSS frame. */
mac_synch_lost_notification *synch_lost_notification; /**< Send notification when FHSS synchronization is lost. */
Expand Down
13 changes: 11 additions & 2 deletions nanostack/fhss_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ typedef int32_t fhss_vendor_defined_cf(const fhss_api_t *api, uint16_t slot, uin
*/
typedef struct fhss_ws_configuration
{
/** WS channel function. */
fhss_ws_channel_functions ws_channel_function;
/** WS unicast channel function. */
fhss_ws_channel_functions ws_uc_channel_function;

/** WS broadcast channel function. */
fhss_ws_channel_functions ws_bc_channel_function;

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

/** Unicast fixed channel */
uint8_t unicast_fixed_channel;

/** Broadcast fixed channel */
uint8_t broadcast_fixed_channel;

/** Channel mask. */
uint32_t channel_mask[8];

Expand Down
5 changes: 4 additions & 1 deletion nanostack/fhss_ws_extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ typedef struct unicast_timing_info {
unsigned unicast_channel_function:3; /**< Unicast schedule channel function */
uint8_t unicast_dwell_interval; /**< Unicast dwell interval */
uint16_t unicast_number_of_channels; /**< Unicast number of channels */
uint16_t fixed_channel; /**< Unicast fixed channel*/
uint_fast24_t ufsi; /**< Unicast fractional sequence interval */
uint32_t utt_rx_timestamp; /**< UTT-IE reception timestamp */
} unicast_timing_info_t;
Expand All @@ -47,6 +48,7 @@ typedef struct unicast_timing_info {
typedef struct broadcast_timing_info {
unsigned broadcast_channel_function:3; /**< Broadcast schedule channel function */
uint8_t broadcast_dwell_interval; /**< Broadcast dwell interval */
uint16_t fixed_channel; /**< Broadcast fixed channel*/
uint16_t broadcast_slot; /**< Broadcast slot number */
uint16_t broadcast_schedule_id; /**< Broadcast schedule identifier */
uint_fast24_t broadcast_interval_offset; /**< Broadcast interval offset */
Expand Down Expand Up @@ -78,9 +80,10 @@ typedef fhss_ws_neighbor_timing_info_t *fhss_get_neighbor_info(const fhss_api_t
* @param fhss_api FHSS instance.
* @param eui64 EUI-64 address of parent.
* @param bc_timing_info Pointer to parent broadcast timing/hopping schedule info.
* @param force_synch If false, synchronization is done only if minimum (internal) synchronization interval is exceed.
* @return 0 on success, -1 on fail.
*/
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);
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);

/**
* @brief Remove parent which was set by ns_fhss_ws_set_parent function.
Expand Down
3 changes: 2 additions & 1 deletion nanostack/mac_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ typedef void mcps_data_request_ext(const mac_api_t* api, const mcps_data_req_t *
* @brief mcps_purge_request MCPS_PURGE request call
* @param api API to handle the request
* @param data MCPS-PURGE.request specific values
* @return 0 in case of success, non-zero otherwise
*/
typedef void mcps_purge_request(const mac_api_t* api, const mcps_purge_t *data);
typedef uint8_t mcps_purge_request(const mac_api_t* api, const mcps_purge_t *data);

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

Expand Down
3 changes: 1 addition & 2 deletions nanostack/net_fhss.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ extern "C" {
extern fhss_api_t *ns_fhss_create(const fhss_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer, fhss_statistics_t *fhss_statistics);

/**
* @brief TODO: description.
* @brief Creates FHSS WS API instance which will be registered to software MAC.
* @param fhss_configuration Basic FHSS configuration.
* @param fhss_timer FHSS platform timer interface and configuration.
* @param fhss_statistics FHSS statistics storage.
* @return New FHSS instance if successful, NULL otherwise.
*/
extern fhss_api_t *ns_fhss_ws_create(const fhss_ws_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer);
Expand Down
15 changes: 15 additions & 0 deletions nanostack/thread_bbr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ int thread_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
*
*/
int thread_bbr_timeout_set(int8_t interface_id, uint32_t timeout_a, uint32_t timeout_b, uint32_t delay);

/**
* Set prefix to be used as combining multiple thread networks on backbone.
*
Expand All @@ -89,6 +90,20 @@ int thread_bbr_timeout_set(int8_t interface_id, uint32_t timeout_a, uint32_t tim
*/
int thread_bbr_prefix_set(int8_t interface_id, uint8_t *prefix);

/**
* Set sequence number to be used by bbr
*
* update sequence number value
*
* \param interface_id interface ID of the Thread network.
* \param sequence_number value that needs to be set on bbr
*
* \return 0 on success
* \return <0 in case of errors
*
*/
int thread_bbr_sequence_number_set(int8_t interface_id, uint8_t sequence_number);

/**
* Set the Thread validation interface destination address.
*
Expand Down
14 changes: 14 additions & 0 deletions nanostack/thread_commissioning_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ void *thread_commission_device_get_next(void *ptr, int8_t interface_id, bool *sh

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

/**
* \brief Attach native commissioner to destination address and port.
*
* \param interface_id Network interface ID.
* \param destination_address Destination address pointer.
* \param destination_port Commissioning port.
*
* \return 0 attach OK.
* \return < 0 fail.
*/
int thread_commissioning_attach(int8_t interface_id, uint8_t *destination_address, uint16_t destination_port);

#ifdef __cplusplus
}
#endif
Expand Down
3 changes: 2 additions & 1 deletion nanostack/thread_diagcop_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
#define DIAGCOP_TLV_SUPPLY_VOLTAGE 15 /**< Can not reset*/
#define DIAGCOP_TLV_CHILD_TABLE 16 /**< Can not reset*/
#define DIAGCOP_TLV_CHANNEL_PAGES 17 /**< Can not reset*/
#define DIAGCOP_TLV_TYPE_LIST 18 /**< List type*/
#define DIAGCOP_TLV_TYPE_LIST 18 /**< Cannot reset*/
#define DIAGCOP_TLV_MAX_CHILD_TIMEOUT 19 /**< Cannot reset*/

/**
* \brief Write array TLV.
Expand Down
72 changes: 72 additions & 0 deletions nanostack/ws_bbr_api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (c) 2017-2018, Arm Limited and affiliates.
* SPDX-License-Identifier: BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

/**
* \file ws_bbr_api.h
* \brief Wi-SUN backbone border router (BBR) application interface.
*
* This is Wi-SUN backbone Border router service.
* When started the module takes care of starting the
* components that enables default border router functionality in Wi-SUN network.
*
*/

#ifndef WS_BBR_API_H_
#define WS_BBR_API_H_

#include "ns_types.h"

/**
* Start backbone border router service.
*
* if backbone interface is enabled and allows routing.
* Enables ND proxy for address found from backbone
*
* \param interface_id Wi-SUN network interface id.
* \param backbone_interface_id backbone interface id.
*
* \return 0 on success
* \return <0 in case of errors
*
*/
int ws_bbr_start(int8_t interface_id, int8_t backbone_interface_id);

/**
* Stop backbone Border router.
*
* \param interface_id interface ID of the Wi-SUN network
*
* \return 0 on success
* \return <0 in case of errors
*
*/
void ws_bbr_stop(int8_t interface_id);


#endif /* WS_BBR_API_H_ */
15 changes: 13 additions & 2 deletions source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#include "6LoWPAN/Fragmentation/cipv6_fragmenter.h"
#include "Service_Libs/etx/etx.h"
#include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h"
#include "6LoWPAN/ws/ws_bootstrap.h"


#define TRACE_GROUP_LOWPAN "6lo"
Expand Down Expand Up @@ -473,7 +474,6 @@ void protocol_6lowpan_neighbor_priority_update(protocol_interface_info_entry_t *
}

#ifdef HAVE_RPL
#ifndef NO_MLE

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

if (entry) {

bool new_primary = false;
etx_storage_t *etx_entry = etx_storage_entry_get(interface_id, entry->index);
// If primary parent has changed clears priority from previous parent
if (entry->link_role != PRIORITY_PARENT_NEIGHBOUR) {
new_primary = true;
protocol_6lowpan_neighbor_priority_clear_all(interface_id, PRIORITY_1ST);
}
entry->link_role = PRIORITY_PARENT_NEIGHBOUR;
Expand All @@ -501,6 +504,10 @@ uint16_t protocol_6lowpan_neighbor_priority_set(int8_t interface_id, addrtype_t
if (etx_entry) {
protocol_stats_update(STATS_ETX_1ST_PARENT, etx_entry->etx >> 4);
}

if (new_primary) {
ws_primary_parent_update(cur, entry);
}
return 1;
} else {
return 0;
Expand All @@ -519,16 +526,21 @@ uint16_t protocol_6lowpan_neighbor_second_priority_set(int8_t interface_id, addr
mac_neighbor_table_entry_t * entry = mac_neighbor_table_address_discover(mac_neighbor_info(cur), addr_ptr + PAN_ID_LEN, addr_type);

if (entry) {
bool new_secondary = false;
etx_storage_t *etx_entry = etx_storage_entry_get(interface_id, entry->index);
// If secondary parent has changed clears priority from previous parent
if (entry->link_role != SECONDARY_PARENT_NEIGHBOUR) {
new_secondary = true;
protocol_6lowpan_neighbor_priority_clear_all(interface_id, PRIORITY_2ND);
}
entry->link_role = SECONDARY_PARENT_NEIGHBOUR;

if (etx_entry) {
protocol_stats_update(STATS_ETX_2ND_PARENT, etx_entry->etx >> 4);
}
if (new_secondary) {
ws_secondary_parent_update(cur);
}
return 1;
} else {
return 0;
Expand Down Expand Up @@ -557,7 +569,6 @@ void protocol_6lowpan_neighbor_priority_clear_all(int8_t interface_id, neighbor_
}
}

#endif
#endif

#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1786,7 +1786,7 @@ int8_t arm_6lowpan_bootstarp_bootstrap_set(int8_t interface_id, net_6lowpan_mode
*/
if (cur->lowpan_info & INTERFACE_NWK_ROUTER_DEVICE) {
//rpl_control_set_domain_on_interface(cur, protocol_6lowpan_rpl_domain, true);
//rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, cur);
//rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, NULL, cur);
}
#endif
cur->configure_flags |= INTERFACE_BOOTSTRAP_DEFINED;
Expand Down Expand Up @@ -2073,6 +2073,8 @@ static void protocol_6lowpan_bootstrap_rpl_callback(rpl_event_t event, void *han
tr_error("RPL Local repair fail-->interface to idle");
nwk_bootsrap_state_update(ARM_NWK_NWK_CONNECTION_DOWN, cur);
break;
default:
break;
}
}

Expand Down Expand Up @@ -2179,7 +2181,7 @@ void nwk_6lowpan_nd_address_registartion_ready(protocol_interface_info_entry_t *
// arm_nwk_6lowpan_rpl_dodag_poison from a previous connection may have left force_leaf set
rpl_control_force_leaf(protocol_6lowpan_rpl_domain, false);
rpl_control_set_domain_on_interface(cur, protocol_6lowpan_rpl_domain, true);
rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, cur);
rpl_control_set_callback(protocol_6lowpan_rpl_domain, protocol_6lowpan_bootstrap_rpl_callback, NULL, cur);
}
// Send unicast DIS to coordinator
nwk_bootstrap_icmp_rpl_dis_coord_msg_tx(cur);
Expand Down
3 changes: 2 additions & 1 deletion source/6LoWPAN/MAC/mpx_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ typedef void mpx_data_request(const mpx_api_t *api, const struct mcps_data_req_s
* @param api API to handle the request
* @param purge MCPS-purge request
* @param user_id MPX user ID
* @return 0 if purge requst was OK, non-zero otherwise
*
*/
typedef void mpx_data_purge_request(const mpx_api_t *api, struct mcps_purge_s *purge, uint16_t user_id);
typedef uint8_t mpx_data_purge_request(const mpx_api_t *api, struct mcps_purge_s *purge, uint16_t user_id);

/**
* @brief mpx_data_confirm MPX-DATA confirm is called as a response to MPX-DATA request
Expand Down
Loading

0 comments on commit 4453f82

Please sign in to comment.