Skip to content

Commit 076fee8

Browse files
llyespressif-bot
authored andcommitted
ble_mesh: stack: Rename mesh adv queue and relay queue
1 parent f5fcee1 commit 076fee8

File tree

1 file changed

+84
-90
lines changed
  • components/bt/esp_ble_mesh/mesh_core

1 file changed

+84
-90
lines changed

components/bt/esp_ble_mesh/mesh_core/adv.c

Lines changed: 84 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,19 @@
2727
#include "mesh_bearer_adapt.h"
2828

2929
/* Convert from ms to 0.625ms units */
30-
#define ADV_SCAN_UNIT(_ms) ((_ms) * 8 / 5)
30+
#define ADV_SCAN_UNIT(_ms) ((_ms) * 8 / 5)
3131
/* Convert from 0.625ms units to interval(ms) */
32-
#define ADV_SCAN_INT(val) ((val) * 5 / 8)
32+
#define ADV_SCAN_INT(val) ((val) * 5 / 8)
3333

3434
/* Window and Interval are equal for continuous scanning */
35-
#define MESH_SCAN_INTERVAL 0x20
36-
#define MESH_SCAN_WINDOW 0x20
35+
#define MESH_SCAN_INTERVAL 0x20
36+
#define MESH_SCAN_WINDOW 0x20
3737

3838
/* Pre-5.0 controllers enforce a minimum interval of 100ms
3939
* whereas 5.0+ controllers can go down to 20ms.
4040
*/
41-
#define ADV_INT_DEFAULT_MS 100
42-
#define ADV_INT_FAST_MS 20
43-
44-
#if defined(CONFIG_BT_HOST_CRYPTO)
45-
#define ADV_STACK_SIZE 1024
46-
#else
47-
#define ADV_STACK_SIZE 768
48-
#endif
41+
#define ADV_INT_DEFAULT_MS 100
42+
#define ADV_INT_FAST_MS 20
4943

5044
static const bt_mesh_addr_t *dev_addr;
5145

@@ -62,19 +56,19 @@ NET_BUF_POOL_DEFINE(adv_buf_pool, CONFIG_BLE_MESH_ADV_BUF_COUNT,
6256
static struct bt_mesh_adv adv_pool[CONFIG_BLE_MESH_ADV_BUF_COUNT];
6357

6458
struct bt_mesh_queue {
65-
QueueHandle_t queue;
59+
QueueHandle_t handle;
6660
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC
6761
StaticQueue_t *buffer;
6862
u8_t *storage;
6963
#endif
7064
};
7165

72-
static struct bt_mesh_queue xBleMeshQueue;
73-
/* We reserve one queue for bt_mesh_adv_update() */
66+
static struct bt_mesh_queue adv_queue;
67+
/* We reserve one queue item for bt_mesh_adv_update() */
7468
#if CONFIG_BLE_MESH_SUPPORT_BLE_ADV
75-
#define BLE_MESH_QUEUE_SIZE (CONFIG_BLE_MESH_ADV_BUF_COUNT + CONFIG_BLE_MESH_BLE_ADV_BUF_COUNT + 1)
69+
#define BLE_MESH_ADV_QUEUE_SIZE (CONFIG_BLE_MESH_ADV_BUF_COUNT + CONFIG_BLE_MESH_BLE_ADV_BUF_COUNT + 1)
7670
#else
77-
#define BLE_MESH_QUEUE_SIZE (CONFIG_BLE_MESH_ADV_BUF_COUNT + 1)
71+
#define BLE_MESH_ADV_QUEUE_SIZE (CONFIG_BLE_MESH_ADV_BUF_COUNT + 1)
7872
#endif
7973

8074
#if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF)
@@ -83,11 +77,11 @@ NET_BUF_POOL_DEFINE(relay_adv_buf_pool, CONFIG_BLE_MESH_RELAY_ADV_BUF_COUNT,
8377

8478
static struct bt_mesh_adv relay_adv_pool[CONFIG_BLE_MESH_RELAY_ADV_BUF_COUNT];
8579

86-
static struct bt_mesh_queue xBleMeshRelayQueue;
80+
static struct bt_mesh_queue relay_queue;
8781
#define BLE_MESH_RELAY_QUEUE_SIZE CONFIG_BLE_MESH_RELAY_ADV_BUF_COUNT
8882

89-
static QueueSetHandle_t xBleMeshQueueSet;
90-
#define BLE_MESH_QUEUE_SET_SIZE (BLE_MESH_QUEUE_SIZE + BLE_MESH_RELAY_QUEUE_SIZE)
83+
static QueueSetHandle_t mesh_queue_set;
84+
#define BLE_MESH_QUEUE_SET_SIZE (BLE_MESH_ADV_QUEUE_SIZE + BLE_MESH_RELAY_QUEUE_SIZE)
9185

9286
#define BLE_MESH_RELAY_TIME_INTERVAL K_SECONDS(6)
9387
#define BLE_MESH_MAX_TIME_INTERVAL 0xFFFFFFFF
@@ -260,54 +254,54 @@ static void adv_thread(void *p)
260254
#if !defined(CONFIG_BLE_MESH_RELAY_ADV_BUF)
261255
#if (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || \
262256
CONFIG_BLE_MESH_GATT_PROXY_SERVER
263-
xQueueReceive(xBleMeshQueue.queue, &msg, K_NO_WAIT);
257+
xQueueReceive(adv_queue.handle, &msg, K_NO_WAIT);
264258
while (!(*buf)) {
265259
s32_t timeout;
266260
BT_DBG("Mesh Proxy Advertising start");
267261
timeout = bt_mesh_proxy_adv_start();
268262
BT_DBG("Mesh Proxy Advertising up to %d ms", timeout);
269-
xQueueReceive(xBleMeshQueue.queue, &msg, timeout);
263+
xQueueReceive(adv_queue.handle, &msg, timeout);
270264
BT_DBG("Mesh Proxy Advertising stop");
271265
bt_mesh_proxy_adv_stop();
272266
}
273267
#else
274-
xQueueReceive(xBleMeshQueue.queue, &msg, portMAX_DELAY);
268+
xQueueReceive(adv_queue.handle, &msg, portMAX_DELAY);
275269
#endif /* (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || CONFIG_BLE_MESH_GATT_PROXY_SERVER */
276270
#else /* !defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) */
277271
#if (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || \
278272
CONFIG_BLE_MESH_GATT_PROXY_SERVER
279-
handle = xQueueSelectFromSet(xBleMeshQueueSet, K_NO_WAIT);
273+
handle = xQueueSelectFromSet(mesh_queue_set, K_NO_WAIT);
280274
if (handle) {
281-
if (uxQueueMessagesWaiting(xBleMeshQueue.queue)) {
282-
xQueueReceive(xBleMeshQueue.queue, &msg, K_NO_WAIT);
283-
} else if (uxQueueMessagesWaiting(xBleMeshRelayQueue.queue)) {
284-
xQueueReceive(xBleMeshRelayQueue.queue, &msg, K_NO_WAIT);
275+
if (uxQueueMessagesWaiting(adv_queue.handle)) {
276+
xQueueReceive(adv_queue.handle, &msg, K_NO_WAIT);
277+
} else if (uxQueueMessagesWaiting(relay_queue.handle)) {
278+
xQueueReceive(relay_queue.handle, &msg, K_NO_WAIT);
285279
}
286280
} else {
287281
while (!(*buf)) {
288282
s32_t timeout = 0;
289283
BT_DBG("Mesh Proxy Advertising start");
290284
timeout = bt_mesh_proxy_adv_start();
291285
BT_DBG("Mesh Proxy Advertising up to %d ms", timeout);
292-
handle = xQueueSelectFromSet(xBleMeshQueueSet, timeout);
286+
handle = xQueueSelectFromSet(mesh_queue_set, timeout);
293287
BT_DBG("Mesh Proxy Advertising stop");
294288
bt_mesh_proxy_adv_stop();
295289
if (handle) {
296-
if (uxQueueMessagesWaiting(xBleMeshQueue.queue)) {
297-
xQueueReceive(xBleMeshQueue.queue, &msg, K_NO_WAIT);
298-
} else if (uxQueueMessagesWaiting(xBleMeshRelayQueue.queue)) {
299-
xQueueReceive(xBleMeshRelayQueue.queue, &msg, K_NO_WAIT);
290+
if (uxQueueMessagesWaiting(adv_queue.handle)) {
291+
xQueueReceive(adv_queue.handle, &msg, K_NO_WAIT);
292+
} else if (uxQueueMessagesWaiting(relay_queue.handle)) {
293+
xQueueReceive(relay_queue.handle, &msg, K_NO_WAIT);
300294
}
301295
}
302296
}
303297
}
304298
#else
305-
handle = xQueueSelectFromSet(xBleMeshQueueSet, portMAX_DELAY);
299+
handle = xQueueSelectFromSet(mesh_queue_set, portMAX_DELAY);
306300
if (handle) {
307-
if (uxQueueMessagesWaiting(xBleMeshQueue.queue)) {
308-
xQueueReceive(xBleMeshQueue.queue, &msg, K_NO_WAIT);
309-
} else if (uxQueueMessagesWaiting(xBleMeshRelayQueue.queue)) {
310-
xQueueReceive(xBleMeshRelayQueue.queue, &msg, K_NO_WAIT);
301+
if (uxQueueMessagesWaiting(adv_queue.handle)) {
302+
xQueueReceive(adv_queue.handle, &msg, K_NO_WAIT);
303+
} else if (uxQueueMessagesWaiting(relay_queue.handle)) {
304+
xQueueReceive(relay_queue.handle, &msg, K_NO_WAIT);
311305
}
312306
}
313307
#endif /* (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || CONFIG_BLE_MESH_GATT_PROXY_SERVER */
@@ -448,18 +442,18 @@ static void bt_mesh_task_post(bt_mesh_msg_t *msg, uint32_t timeout, bool front)
448442
{
449443
BT_DBG("%s", __func__);
450444

451-
if (xBleMeshQueue.queue == NULL) {
445+
if (adv_queue.handle == NULL) {
452446
BT_ERR("%s, Invalid queue", __func__);
453447
return;
454448
}
455449

456450
if (front) {
457-
if (xQueueSendToFront(xBleMeshQueue.queue, msg, timeout) != pdTRUE) {
451+
if (xQueueSendToFront(adv_queue.handle, msg, timeout) != pdTRUE) {
458452
BT_ERR("%s, Failed to send item to queue front", __func__);
459453
bt_mesh_unref_buf(msg);
460454
}
461455
} else {
462-
if (xQueueSend(xBleMeshQueue.queue, msg, timeout) != pdTRUE) {
456+
if (xQueueSend(adv_queue.handle, msg, timeout) != pdTRUE) {
463457
BT_ERR("%s, Failed to send item to queue back", __func__);
464458
bt_mesh_unref_buf(msg);
465459
}
@@ -532,32 +526,32 @@ static void ble_mesh_relay_task_post(bt_mesh_msg_t *msg, uint32_t timeout)
532526

533527
BT_DBG("%s", __func__);
534528

535-
if (xBleMeshRelayQueue.queue == NULL) {
529+
if (relay_queue.handle == NULL) {
536530
BT_ERR("%s, Invalid relay queue", __func__);
537531
return;
538532
}
539533

540-
if (xQueueSend(xBleMeshRelayQueue.queue, msg, timeout) == pdTRUE) {
534+
if (xQueueSend(relay_queue.handle, msg, timeout) == pdTRUE) {
541535
return;
542536
}
543537

544538
/**
545539
* If failed to send packet to the relay queue(queue is full), we will
546540
* remove the oldest packet in the queue and put the new one into it.
547541
*/
548-
handle = xQueueSelectFromSet(xBleMeshQueueSet, K_NO_WAIT);
549-
if (handle && uxQueueMessagesWaiting(xBleMeshRelayQueue.queue)) {
542+
handle = xQueueSelectFromSet(mesh_queue_set, K_NO_WAIT);
543+
if (handle && uxQueueMessagesWaiting(relay_queue.handle)) {
550544
BT_INFO("%s, Full queue, remove the oldest relay packet", __func__);
551545
/* Remove the oldest relay packet from queue */
552-
if (xQueueReceive(xBleMeshRelayQueue.queue, &old_msg, K_NO_WAIT) != pdTRUE) {
546+
if (xQueueReceive(relay_queue.handle, &old_msg, K_NO_WAIT) != pdTRUE) {
553547
BT_ERR("%s, Failed to remove item from queue", __func__);
554548
bt_mesh_unref_buf(msg);
555549
return;
556550
}
557551
/* Unref buf used for the oldest relay packet */
558552
bt_mesh_unref_buf(&old_msg);
559553
/* Send the latest relay packet to queue */
560-
if (xQueueSend(xBleMeshRelayQueue.queue, msg, K_NO_WAIT) != pdTRUE) {
554+
if (xQueueSend(relay_queue.handle, msg, K_NO_WAIT) != pdTRUE) {
561555
BT_ERR("%s, Failed to send item to relay queue", __func__);
562556
bt_mesh_unref_buf(msg);
563557
return;
@@ -586,13 +580,13 @@ void bt_mesh_relay_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *c
586580
msg.src = src;
587581
msg.dst = dst;
588582
msg.timestamp = k_uptime_get_32();
589-
/* Use K_NO_WAIT here, if xBleMeshRelayQueue is full return immediately */
583+
/* Use K_NO_WAIT here, if relay_queue is full return immediately */
590584
ble_mesh_relay_task_post(&msg, K_NO_WAIT);
591585
}
592586

593587
u16_t bt_mesh_get_stored_relay_count(void)
594588
{
595-
return (u16_t)uxQueueMessagesWaiting(xBleMeshRelayQueue.queue);
589+
return (u16_t)uxQueueMessagesWaiting(relay_queue.handle);
596590
}
597591
#endif /* #if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) */
598592

@@ -798,50 +792,50 @@ static void bt_mesh_scan_cb(const bt_mesh_addr_t *addr, s8_t rssi,
798792
void bt_mesh_adv_init(void)
799793
{
800794
#if !CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC
801-
xBleMeshQueue.queue = xQueueCreate(BLE_MESH_QUEUE_SIZE, sizeof(bt_mesh_msg_t));
802-
__ASSERT(xBleMeshQueue.queue, "Failed to create queue");
795+
adv_queue.handle = xQueueCreate(BLE_MESH_ADV_QUEUE_SIZE, sizeof(bt_mesh_msg_t));
796+
__ASSERT(adv_queue.handle, "Failed to create queue");
803797
#else /* !CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC */
804798
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL
805-
xBleMeshQueue.buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
799+
adv_queue.buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
806800
#elif CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_IRAM_8BIT
807-
xBleMeshQueue.buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
801+
adv_queue.buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
808802
#endif
809-
__ASSERT(xBleMeshQueue.buffer, "Failed to create queue buffer");
803+
__ASSERT(adv_queue.buffer, "Failed to create queue buffer");
810804
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL
811-
xBleMeshQueue.storage = heap_caps_calloc_prefer(1, (BLE_MESH_QUEUE_SIZE * sizeof(bt_mesh_msg_t)), 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
805+
adv_queue.storage = heap_caps_calloc_prefer(1, (BLE_MESH_ADV_QUEUE_SIZE * sizeof(bt_mesh_msg_t)), 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
812806
#elif CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_IRAM_8BIT
813-
xBleMeshQueue.storage = heap_caps_calloc_prefer(1, (BLE_MESH_QUEUE_SIZE * sizeof(bt_mesh_msg_t)), 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
807+
adv_queue.storage = heap_caps_calloc_prefer(1, (BLE_MESH_ADV_QUEUE_SIZE * sizeof(bt_mesh_msg_t)), 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
814808
#endif
815-
__ASSERT(xBleMeshQueue.storage, "Failed to create queue storage");
816-
xBleMeshQueue.queue = xQueueCreateStatic(BLE_MESH_QUEUE_SIZE, sizeof(bt_mesh_msg_t), (uint8_t*)xBleMeshQueue.storage, xBleMeshQueue.buffer);
817-
__ASSERT(xBleMeshQueue.queue, "Failed to create static queue");
809+
__ASSERT(adv_queue.storage, "Failed to create queue storage");
810+
adv_queue.handle = xQueueCreateStatic(BLE_MESH_ADV_QUEUE_SIZE, sizeof(bt_mesh_msg_t), (uint8_t*)adv_queue.storage, adv_queue.buffer);
811+
__ASSERT(adv_queue.handle, "Failed to create static queue");
818812
#endif /* !CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC */
819813

820814
#if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF)
821815
#if !CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC
822-
xBleMeshRelayQueue.queue = xQueueCreate(BLE_MESH_RELAY_QUEUE_SIZE, sizeof(bt_mesh_msg_t));
823-
__ASSERT(xBleMeshRelayQueue.queue, "Failed to create relay queue");
816+
relay_queue.handle = xQueueCreate(BLE_MESH_RELAY_QUEUE_SIZE, sizeof(bt_mesh_msg_t));
817+
__ASSERT(relay_queue.handle, "Failed to create relay queue");
824818
#else /* !CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC */
825819
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL
826-
xBleMeshRelayQueue.buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
820+
relay_queue.buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
827821
#elif CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_IRAM_8BIT
828-
xBleMeshRelayQueue.buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
822+
relay_queue.buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
829823
#endif
830-
__ASSERT(xBleMeshRelayQueue.buffer, "Failed to create relay queue buffer");
824+
__ASSERT(relay_queue.buffer, "Failed to create relay queue buffer");
831825
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL
832-
xBleMeshRelayQueue.storage = heap_caps_calloc_prefer(1, (BLE_MESH_RELAY_QUEUE_SIZE * sizeof(bt_mesh_msg_t)), 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
826+
relay_queue.storage = heap_caps_calloc_prefer(1, (BLE_MESH_RELAY_QUEUE_SIZE * sizeof(bt_mesh_msg_t)), 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
833827
#elif CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_IRAM_8BIT
834-
xBleMeshRelayQueue.storage = heap_caps_calloc_prefer(1, (BLE_MESH_RELAY_QUEUE_SIZE * sizeof(bt_mesh_msg_t)), 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
828+
relay_queue.storage = heap_caps_calloc_prefer(1, (BLE_MESH_RELAY_QUEUE_SIZE * sizeof(bt_mesh_msg_t)), 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
835829
#endif
836-
__ASSERT(xBleMeshRelayQueue.storage, "Failed to create relay queue storage");
837-
xBleMeshRelayQueue.queue = xQueueCreateStatic(BLE_MESH_RELAY_QUEUE_SIZE, sizeof(bt_mesh_msg_t), (uint8_t*)xBleMeshRelayQueue.storage, xBleMeshRelayQueue.buffer);
838-
__ASSERT(xBleMeshRelayQueue.queue, "Failed to create static relay queue");
830+
__ASSERT(relay_queue.storage, "Failed to create relay queue storage");
831+
relay_queue.handle = xQueueCreateStatic(BLE_MESH_RELAY_QUEUE_SIZE, sizeof(bt_mesh_msg_t), (uint8_t*)relay_queue.storage, relay_queue.buffer);
832+
__ASSERT(relay_queue.handle, "Failed to create static relay queue");
839833
#endif /* !CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC */
840834

841-
xBleMeshQueueSet = xQueueCreateSet(BLE_MESH_QUEUE_SET_SIZE);
842-
__ASSERT(xBleMeshQueueSet, "Failed to create queue set");
843-
xQueueAddToSet(xBleMeshQueue.queue, xBleMeshQueueSet);
844-
xQueueAddToSet(xBleMeshRelayQueue.queue, xBleMeshQueueSet);
835+
mesh_queue_set = xQueueCreateSet(BLE_MESH_QUEUE_SET_SIZE);
836+
__ASSERT(mesh_queue_set, "Failed to create queue set");
837+
xQueueAddToSet(adv_queue.handle, mesh_queue_set);
838+
xQueueAddToSet(relay_queue.handle, mesh_queue_set);
845839
#endif /* defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) */
846840

847841
#if (CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL && \
@@ -863,7 +857,7 @@ void bt_mesh_adv_init(void)
863857

864858
void bt_mesh_adv_deinit(void)
865859
{
866-
if (xBleMeshQueue.queue == NULL) {
860+
if (adv_queue.handle == NULL) {
867861
return;
868862
}
869863

@@ -879,32 +873,32 @@ void bt_mesh_adv_deinit(void)
879873
#endif
880874

881875
#if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF)
882-
xQueueRemoveFromSet(xBleMeshQueue.queue, xBleMeshQueueSet);
883-
xQueueRemoveFromSet(xBleMeshRelayQueue.queue, xBleMeshQueueSet);
876+
xQueueRemoveFromSet(adv_queue.handle, mesh_queue_set);
877+
xQueueRemoveFromSet(relay_queue.handle, mesh_queue_set);
884878

885-
vQueueDelete(xBleMeshRelayQueue.queue);
886-
xBleMeshRelayQueue.queue = NULL;
879+
vQueueDelete(relay_queue.handle);
880+
relay_queue.handle = NULL;
887881
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC
888-
heap_caps_free(xBleMeshRelayQueue.buffer);
889-
xBleMeshRelayQueue.buffer = NULL;
890-
heap_caps_free(xBleMeshRelayQueue.storage);
891-
xBleMeshRelayQueue.storage = NULL;
882+
heap_caps_free(relay_queue.buffer);
883+
relay_queue.buffer = NULL;
884+
heap_caps_free(relay_queue.storage);
885+
relay_queue.storage = NULL;
892886
#endif
893887

894888
bt_mesh_unref_buf_from_pool(&relay_adv_buf_pool);
895889
memset(relay_adv_pool, 0, sizeof(relay_adv_pool));
896890

897-
vQueueDelete(xBleMeshQueueSet);
898-
xBleMeshQueueSet = NULL;
891+
vQueueDelete(mesh_queue_set);
892+
mesh_queue_set = NULL;
899893
#endif /* defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) */
900894

901-
vQueueDelete(xBleMeshQueue.queue);
902-
xBleMeshQueue.queue = NULL;
895+
vQueueDelete(adv_queue.handle);
896+
adv_queue.handle = NULL;
903897
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC
904-
heap_caps_free(xBleMeshQueue.buffer);
905-
xBleMeshQueue.buffer = NULL;
906-
heap_caps_free(xBleMeshQueue.storage);
907-
xBleMeshQueue.storage = NULL;
898+
heap_caps_free(adv_queue.buffer);
899+
adv_queue.buffer = NULL;
900+
heap_caps_free(adv_queue.storage);
901+
adv_queue.storage = NULL;
908902
#endif
909903

910904
bt_mesh_unref_buf_from_pool(&adv_buf_pool);

0 commit comments

Comments
 (0)