From b20943ad437c0ee8891c768c4eda41792565bfea Mon Sep 17 00:00:00 2001 From: chenyudong Date: Mon, 25 May 2020 21:58:32 +0800 Subject: [PATCH 1/2] mesh: backport some bugfixes 1. If the root is specified (FIXED-ROOT) by set type or set parent, change ie.mesh_type to MESH_ROOT before connect to router. 2. Release esp_mesh_recv_toDS when the root becomes non-root. 3. esp_mesh_set_type now supports MESH_IDLE and MESH_STA. 4. Fix ie.rc_rssi is not updated during scan and vote. 5. Fix ie.mesh_type do not match ie.layer caused by parent switch. 6. Fix during root switch, the original root doesn't disconnect from the router after it receives the switch request from the new voted root. (root switch happens by invoking esp_mesh_waive_root). 7. Fix the routing announce timer is not stopped immediately in a new root if the new root is transformed from non-root. 8. Choose the candidate with less ie.assoc when doing parent switch. --- components/esp_common/src/esp_err_to_name.c | 9 +++++++++ components/esp_wifi/include/esp_mesh.h | 10 +++++++++- components/esp_wifi/lib | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/components/esp_common/src/esp_err_to_name.c b/components/esp_common/src/esp_err_to_name.c index 918ea2ad3e..808f369716 100644 --- a/components/esp_common/src/esp_err_to_name.c +++ b/components/esp_common/src/esp_err_to_name.c @@ -460,6 +460,15 @@ static const esp_err_msg_t esp_err_msg_table[] = { # endif # ifdef ESP_ERR_MESH_VOTING ERR_TBL_IT(ESP_ERR_MESH_VOTING), /* 16406 0x4016 */ +# endif +# ifdef ESP_ERR_MESH_XMIT + ERR_TBL_IT(ESP_ERR_MESH_XMIT), /* 16407 0x4017 */ +# endif +# ifdef ESP_ERR_MESH_QUEUE_READ + ERR_TBL_IT(ESP_ERR_MESH_QUEUE_READ), /* 16408 0x4018 */ +# endif +# ifdef ESP_ERR_MESH_RECV_RELEASE + ERR_TBL_IT(ESP_ERR_MESH_RECV_RELEASE), /* 16410 0x401a */ # endif // components/esp_netif/include/esp_netif_types.h # ifdef ESP_ERR_ESP_NETIF_BASE diff --git a/components/esp_wifi/include/esp_mesh.h b/components/esp_wifi/include/esp_mesh.h index 3b11883c4c..4359b60b14 100644 --- a/components/esp_wifi/include/esp_mesh.h +++ b/components/esp_wifi/include/esp_mesh.h @@ -125,6 +125,10 @@ extern "C" { #define ESP_ERR_MESH_DISCARD_DUPLICATE (ESP_ERR_MESH_BASE + 20) /**< discard the packet due to the duplicate sequence number */ #define ESP_ERR_MESH_DISCARD (ESP_ERR_MESH_BASE + 21) /**< discard the packet */ #define ESP_ERR_MESH_VOTING (ESP_ERR_MESH_BASE + 22) /**< vote in progress */ +#define ESP_ERR_MESH_XMIT (ESP_ERR_MESH_BASE + 23) /**< XMIT */ +#define ESP_ERR_MESH_QUEUE_READ (ESP_ERR_MESH_BASE + 24) /**< error in reading queue */ +#define ESP_ERR_MESH_RECV_RELEASE (ESP_ERR_MESH_BASE + 26) /**< release esp_mesh_recv_toDS */ + /** * @brief Flags bitmap for esp_mesh_send() and esp_mesh_recv() @@ -205,6 +209,7 @@ typedef enum { MESH_ROOT, /**< the only sink of the mesh network. Has the ability to access external IP network */ MESH_NODE, /**< intermediate device. Has the ability to forward packets over the mesh network */ MESH_LEAF, /**< has no forwarding ability */ + MESH_STA, /**< connect to router with a standlone Wi-Fi station mode, no network expansion capability */ } mesh_type_t; /** @@ -713,6 +718,7 @@ esp_err_t esp_mesh_recv(mesh_addr_t *from, mesh_data_t *data, int timeout_ms, * - ESP_ERR_MESH_NOT_START * - ESP_ERR_MESH_TIMEOUT * - ESP_ERR_MESH_DISCARD + * - ESP_ERR_MESH_RECV_RELEASE */ esp_err_t esp_mesh_recv_toDS(mesh_addr_t *from, mesh_addr_t *to, mesh_data_t *data, int timeout_ms, int *flag, mesh_opt_t opt[], @@ -808,8 +814,10 @@ esp_err_t esp_mesh_get_id(mesh_addr_t *id); /** * @brief Designate device type over the mesh network + * - MESH_IDLE: designates a device as a self-organized node for a mesh network * - MESH_ROOT: designates the root node for a mesh network - * - MESH_LEAF: designates a device as a standalone Wi-Fi station + * - MESH_LEAF: designates a device as a standalone Wi-Fi station that connects to a parent + * - MESH_STA: designates a device as a standalone Wi-Fi station that connects to a router * * @param[in] type device type * diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index a17182e903..862af443be 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit a17182e903a9e161a98930648eb6ff78019708ab +Subproject commit 862af443be31ab1ce56508933b8899b464ef5039 From 907e206dff41a7ce8687f96dca179a0857e607fa Mon Sep 17 00:00:00 2001 From: chenyudong Date: Wed, 29 Apr 2020 11:35:15 +0800 Subject: [PATCH 2/2] mesh/ci: fix MESH_EST_0216 --- components/idf_test/integration_test/TC_IT_MESH_EST.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/idf_test/integration_test/TC_IT_MESH_EST.yml b/components/idf_test/integration_test/TC_IT_MESH_EST.yml index 8e8d08bde5..e18deca4a4 100644 --- a/components/idf_test/integration_test/TC_IT_MESH_EST.yml +++ b/components/idf_test/integration_test/TC_IT_MESH_EST.yml @@ -1043,7 +1043,7 @@ test cases: - - P SSC[1-] C +MESHSET:MLAYER,OK - - MSSC SSC[1-] mesh -T - - P SSC[1-] C +MESH:START,OK - - - DELAY 60 + - - DELAY - - '' - - VALUE - - R PC_COM L OK