Merge branch 'feature/trel' into 'master'

br: support Thread Radio Encapsulation Link (TREL)

See merge request espressif/esp-idf!15106
This commit is contained in:
Guo Jia Cheng 2021-10-22 03:31:41 +00:00
commit c1d3b295e8
7 changed files with 55 additions and 42 deletions

View File

@ -92,6 +92,13 @@ menu "OpenThread"
help help
Select this option to enable border router features in OpenThread. Select this option to enable border router features in OpenThread.
config OPENTHREAD_TREL
bool "Enable Thread Radio Encapsulation Link"
depends on OPENTHREAD_BORDER_ROUTER
default n
help
Select this option to enable sending 15.4 frames through the backbone interface.
config OPENTHREAD_ESP_LIB_FROM_INTERNAL_SRC config OPENTHREAD_ESP_LIB_FROM_INTERNAL_SRC
bool "Build esp_openthread libraries from source" bool "Build esp_openthread libraries from source"
depends on OPENTHREAD_ENABLED depends on OPENTHREAD_ENABLED

View File

@ -1,16 +1,8 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD /*
// * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// 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
#pragma once #pragma once
@ -23,14 +15,22 @@
extern "C" { extern "C" {
#endif #endif
/**
* @brief Sets the backbone interface used for border routing.
*
* @note This function must be called before esp_openthread_init
*
* @param[in] backbone_netif The backbone network interface (WiFi or ethernet)
*
*/
void esp_openthread_set_backbone_netif(esp_netif_t *backbone_netif);
/** /**
* @brief Initializes the border router features of OpenThread. * @brief Initializes the border router features of OpenThread.
* *
* @note Calling this function will make the device behave as an OpenThread * @note Calling this function will make the device behave as an OpenThread
* border router. Kconfig option CONFIG_OPENTHREAD_BORDER_ROUTER is required. * border router. Kconfig option CONFIG_OPENTHREAD_BORDER_ROUTER is required.
* *
* @param[in] backbone_netif The backbone network interface (WiFi or ethernet)
*
* @return * @return
* - ESP_OK on success * - ESP_OK on success
* - ESP_ERR_NOT_SUPPORTED if feature not supported * - ESP_ERR_NOT_SUPPORTED if feature not supported
@ -38,7 +38,7 @@ extern "C" {
* - ESP_FIAL on other failures * - ESP_FIAL on other failures
* *
*/ */
esp_err_t esp_openthread_border_router_init(esp_netif_t *backbone_netif); esp_err_t esp_openthread_border_router_init(void);
/** /**
* @brief Deinitializes the border router features of OpenThread. * @brief Deinitializes the border router features of OpenThread.

View File

@ -1,16 +1,8 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD /*
// * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// 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
#pragma once #pragma once
@ -28,14 +20,17 @@ extern "C" {
* *
*/ */
typedef enum { typedef enum {
OPENTHREAD_EVENT_START, /*!< OpenThread stack start */ OPENTHREAD_EVENT_START, /*!< OpenThread stack start */
OPENTHREAD_EVENT_STOP, /*!< OpenThread stack stop */ OPENTHREAD_EVENT_STOP, /*!< OpenThread stack stop */
OPENTHREAD_EVENT_IF_UP, /*!< OpenThread network interface up */ OPENTHREAD_EVENT_IF_UP, /*!< OpenThread network interface up */
OPENTHREAD_EVENT_IF_DOWN, /*!< OpenThread network interface down */ OPENTHREAD_EVENT_IF_DOWN, /*!< OpenThread network interface down */
OPENTHREAD_EVENT_GOT_IP6, /*!< OpenThread stack added IPv6 address */ OPENTHREAD_EVENT_GOT_IP6, /*!< OpenThread stack added IPv6 address */
OPENTHREAD_EVENT_LOST_IP6, /*!< OpenThread stack removed IPv6 address */ OPENTHREAD_EVENT_LOST_IP6, /*!< OpenThread stack removed IPv6 address */
OPENTHREAD_EVENT_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined IPv6 multicast group */ OPENTHREAD_EVENT_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined IPv6 multicast group */
OPENTHREAD_EVENT_MULTICAST_GROUP_LEAVE, /*!< OpenThread stack left IPv6 multicast group */ OPENTHREAD_EVENT_MULTICAST_GROUP_LEAVE, /*!< OpenThread stack left IPv6 multicast group */
OPENTHREAD_EVENT_TREL_ADD_IP6, /*!< OpenThread stack added TREL IPv6 address */
OPENTHREAD_EVENT_TREL_REMOVE_IP6, /*!< OpenThread stack removed TREL IPv6 address */
OPENTHREAD_EVENT_TREL_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined TREL IPv6 multicast group */
} esp_openthread_event_t; } esp_openthread_event_t;
/** /**

View File

@ -194,6 +194,16 @@
#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 1 #define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 1
#endif #endif
/**
* @def OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
*
* Set to 1 to enable support for Thread Radio Encapsulation Link (TREL).
*
*/
#ifndef OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
#define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE CONFIG_OPENTHREAD_TREL
#endif
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER #endif // CONFIG_OPENTHREAD_BORDER_ROUTER
/** /**

View File

@ -161,13 +161,14 @@ static void ot_task_worker(void *aContext)
assert(openthread_netif != NULL); assert(openthread_netif != NULL);
// Initialize the OpenThread stack // Initialize the OpenThread stack
esp_openthread_set_backbone_netif(get_example_netif());
ESP_ERROR_CHECK(esp_openthread_init(&config)); ESP_ERROR_CHECK(esp_openthread_init(&config));
// Initialize border routing features // Initialize border routing features
ESP_ERROR_CHECK(esp_netif_attach(openthread_netif, esp_openthread_netif_glue_init(&config)));
ESP_ERROR_CHECK(esp_openthread_border_router_init(get_example_netif()));
esp_openthread_lock_acquire(portMAX_DELAY); esp_openthread_lock_acquire(portMAX_DELAY);
ESP_ERROR_CHECK(esp_netif_attach(openthread_netif, esp_openthread_netif_glue_init(&config)));
ESP_ERROR_CHECK(esp_openthread_border_router_init());
(void)otLoggingSetLevel(CONFIG_LOG_DEFAULT_LEVEL); (void)otLoggingSetLevel(CONFIG_LOG_DEFAULT_LEVEL);
esp_openthread_cli_init(); esp_openthread_cli_init();
create_config_network(esp_openthread_get_instance()); create_config_network(esp_openthread_get_instance());

View File

@ -31,6 +31,7 @@ CONFIG_MBEDTLS_ECJPAKE_C=y
# #
CONFIG_OPENTHREAD_ENABLED=y CONFIG_OPENTHREAD_ENABLED=y
CONFIG_OPENTHREAD_BORDER_ROUTER=y CONFIG_OPENTHREAD_BORDER_ROUTER=y
CONFIG_OPENTHREAD_TREL=y
# end of OpenThread # end of OpenThread
# #
@ -48,6 +49,7 @@ CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y
# mDNS # mDNS
# #
CONFIG_MDNS_STRICT_MODE=y CONFIG_MDNS_STRICT_MODE=y
CONFIG_MDNS_MULTIPLE_INSTANCE=y
# end of mDNS # end of mDNS
# #

View File

@ -2052,10 +2052,8 @@ components/openssl/platform/ssl_pm.c
components/openssl/platform/ssl_port.c components/openssl/platform/ssl_port.c
components/openssl/test/test_openssl.c components/openssl/test/test_openssl.c
components/openthread/include/esp_openthread.h components/openthread/include/esp_openthread.h
components/openthread/include/esp_openthread_border_router.h
components/openthread/include/esp_openthread_lock.h components/openthread/include/esp_openthread_lock.h
components/openthread/include/esp_openthread_netif_glue.h components/openthread/include/esp_openthread_netif_glue.h
components/openthread/include/esp_openthread_types.h
components/partition_table/check_sizes.py components/partition_table/check_sizes.py
components/partition_table/gen_empty_partition.py components/partition_table/gen_empty_partition.py
components/partition_table/gen_esp32part.py components/partition_table/gen_esp32part.py