Skip to content

Commit 5a00a2b

Browse files
committed
fix(ble_mesh): resolve miscellaneous logging issues
1 parent d50eb66 commit 5a00a2b

File tree

7 files changed

+72
-62
lines changed

7 files changed

+72
-62
lines changed

components/bt/esp_ble_mesh/core/adv_common.c

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ int bt_mesh_adv_inst_init(enum bt_mesh_adv_inst_type inst_type, uint8_t inst_id)
158158
return -EINVAL;
159159
}
160160

161-
if (inst_id == BLE_MESH_ADV_INS_UNUSED) {
161+
if (inst_id == BLE_MESH_ADV_INST_UNUSED) {
162162
BT_ERR("UnusedAdvInstID");
163163
return -EINVAL;
164164
}
@@ -181,7 +181,7 @@ int bt_mesh_adv_inst_deinit(enum bt_mesh_adv_inst_type inst_type)
181181

182182
bt_le_ext_adv_stop(adv_insts[inst_type].id);
183183

184-
adv_insts[inst_type].id = BLE_MESH_ADV_INS_UNUSED;
184+
adv_insts[inst_type].id = BLE_MESH_ADV_INST_UNUSED;
185185
#if CONFIG_BLE_MESH_SUPPORT_MULTI_ADV
186186
adv_insts[inst_type].spt_mask = 0;
187187
#endif /* CONFIG_BLE_MESH_SUPPORT_MULTI_ADV */
@@ -243,7 +243,7 @@ struct bt_mesh_adv *ext_long_relay_adv_alloc(int id, enum bt_mesh_adv_type type)
243243
#endif /* CONFIG_BLE_MESH_LONG_PACKET_RELAY_ADV_BUF_COUNT */
244244
#endif /* CONFIG_BLE_MESH_LONG_PACKET */
245245

246-
struct bt_mesh_adv_type_manager *bt_mesh_adv_types_mgnt_get(enum bt_mesh_adv_type adv_type)
246+
struct bt_mesh_adv_type_manager *bt_mesh_adv_types_mgmt_get(enum bt_mesh_adv_type adv_type)
247247
{
248248
BT_DBG("AdvTypeMgmtGet, AdvType %u", adv_type);
249249

@@ -668,21 +668,6 @@ uint16_t bt_mesh_get_stored_relay_count(void)
668668
return count;
669669
}
670670

671-
static ALWAYS_INLINE
672-
uint16_t bt_mesh_relay_adv_buf_count_get(void)
673-
{
674-
uint16_t relay_adv_count = 2 + CONFIG_BLE_MESH_RELAY_ADV_BUF_COUNT;
675-
676-
#if CONFIG_BLE_MESH_EXT_ADV && CONFIG_BLE_MESH_RELAY
677-
relay_adv_count += CONFIG_BLE_MESH_EXT_RELAY_ADV_BUF_COUNT;
678-
#endif
679-
680-
#if CONFIG_BLE_MESH_LONG_PACKET && CONFIG_BLE_MESH_RELAY
681-
relay_adv_count += CONFIG_BLE_MESH_LONG_PACKET_RELAY_ADV_BUF_COUNT;
682-
#endif
683-
return relay_adv_count;
684-
}
685-
686671
void bt_mesh_relay_adv_init(void)
687672
{
688673
BT_DBG("RelayAdvInit");
@@ -806,33 +791,6 @@ void bt_mesh_frnd_adv_deinit(void)
806791
}
807792
#endif /* CONFIG_BLE_MESH_FRIEND */
808793

809-
static ALWAYS_INLINE
810-
uint16_t bt_mesh_adv_buf_count_get(void)
811-
{
812-
uint16_t adv_count = 2 + CONFIG_BLE_MESH_ADV_BUF_COUNT;
813-
814-
#if CONFIG_BLE_MESH_EXT_ADV
815-
adv_count += CONFIG_BLE_MESH_EXT_ADV_BUF_COUNT;
816-
#if !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY
817-
adv_count += CONFIG_BLE_MESH_EXT_RELAY_ADV_BUF_COUNT;
818-
#endif /* !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY */
819-
#endif /* CONFIG_BLE_MESH_EXT_ADV */
820-
821-
#if CONFIG_BLE_MESH_LONG_PACKET
822-
adv_count += CONFIG_BLE_MESH_LONG_PACKET_ADV_BUF_COUNT;
823-
#if !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY
824-
adv_count += CONFIG_BLE_MESH_LONG_PACKET_RELAY_ADV_BUF_COUNT;
825-
#endif /* !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY */
826-
#endif /* CONFIG_BLE_MESH_LONG_PACKET */
827-
828-
#if (CONFIG_BLE_MESH_SUPPORT_BLE_ADV && \
829-
!(CONFIG_BLE_MESH_USE_BLE_50 && CONFIG_BLE_MESH_SEPARATE_BLE_ADV_INSTANCE))
830-
adv_count += CONFIG_BLE_MESH_BLE_ADV_BUF_COUNT;
831-
#endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */
832-
833-
return adv_count;
834-
}
835-
836794
void bt_mesh_adv_task_init(void adv_thread(void *p))
837795
{
838796
BT_DBG("AdvTaskInit");
@@ -861,7 +819,14 @@ void bt_mesh_adv_task_init(void adv_thread(void *p))
861819
#else /* CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL && (CONFIG_SPIRAM_CACHE_WORKAROUND || !CONFIG_IDF_TARGET_ESP32) && CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY */
862820
int ret = xTaskCreatePinnedToCore(adv_thread, BLE_MESH_ADV_TASK_NAME, BLE_MESH_ADV_TASK_STACK_SIZE, NULL,
863821
BLE_MESH_ADV_TASK_PRIO, &adv_task.handle, BLE_MESH_ADV_TASK_CORE);
822+
#if CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
823+
if (ret != pdTRUE) {
824+
BT_ERR("xTaskCreatePinnedToCore failed, ret %d", ret);
825+
return;
826+
}
827+
#else
864828
assert(ret == pdTRUE);
829+
#endif /* CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE */
865830
#endif /* CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL && (CONFIG_SPIRAM_CACHE_WORKAROUND || !CONFIG_IDF_TARGET_ESP32) && CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY */
866831
}
867832

components/bt/esp_ble_mesh/core/adv_common.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,21 @@ void bt_mesh_adv_inst_type_clear(enum bt_mesh_adv_inst_type inst_type,
298298
#endif /* CONFIG_BLE_MESH_SUPPORT_MULTI_ADV */
299299

300300
#if CONFIG_BLE_MESH_RELAY_ADV_BUF
301+
static ALWAYS_INLINE
302+
uint16_t bt_mesh_relay_adv_buf_count_get(void)
303+
{
304+
uint16_t relay_adv_count = 2 + CONFIG_BLE_MESH_RELAY_ADV_BUF_COUNT;
305+
306+
#if CONFIG_BLE_MESH_EXT_ADV && CONFIG_BLE_MESH_RELAY
307+
relay_adv_count += CONFIG_BLE_MESH_EXT_RELAY_ADV_BUF_COUNT;
308+
#endif
309+
310+
#if CONFIG_BLE_MESH_LONG_PACKET && CONFIG_BLE_MESH_RELAY
311+
relay_adv_count += CONFIG_BLE_MESH_LONG_PACKET_RELAY_ADV_BUF_COUNT;
312+
#endif
313+
return relay_adv_count;
314+
}
315+
301316
void bt_mesh_relay_adv_init(void);
302317

303318
bool bt_mesh_ignore_relay_packet(uint32_t timestamp);
@@ -325,6 +340,33 @@ void bt_mesh_frnd_adv_deinit(void);
325340
#endif /* CONFIG_BLE_MESH_DEINIT */
326341
#endif /* CONFIG_BLE_MESH_FRIEND */
327342

343+
static ALWAYS_INLINE
344+
uint16_t bt_mesh_adv_buf_count_get(void)
345+
{
346+
uint16_t adv_count = 2 + CONFIG_BLE_MESH_ADV_BUF_COUNT;
347+
348+
#if CONFIG_BLE_MESH_EXT_ADV
349+
adv_count += CONFIG_BLE_MESH_EXT_ADV_BUF_COUNT;
350+
#if !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY
351+
adv_count += CONFIG_BLE_MESH_EXT_RELAY_ADV_BUF_COUNT;
352+
#endif /* !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY */
353+
#endif /* CONFIG_BLE_MESH_EXT_ADV */
354+
355+
#if CONFIG_BLE_MESH_LONG_PACKET
356+
adv_count += CONFIG_BLE_MESH_LONG_PACKET_ADV_BUF_COUNT;
357+
#if !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY
358+
adv_count += CONFIG_BLE_MESH_LONG_PACKET_RELAY_ADV_BUF_COUNT;
359+
#endif /* !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY */
360+
#endif /* CONFIG_BLE_MESH_LONG_PACKET */
361+
362+
#if (CONFIG_BLE_MESH_SUPPORT_BLE_ADV && \
363+
!(CONFIG_BLE_MESH_USE_BLE_50 && CONFIG_BLE_MESH_SEPARATE_BLE_ADV_INSTANCE))
364+
adv_count += CONFIG_BLE_MESH_BLE_ADV_BUF_COUNT;
365+
#endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */
366+
367+
return adv_count;
368+
}
369+
328370
void bt_mesh_adv_task_init(void adv_thread(void *p));
329371

330372
void bt_mesh_adv_common_init(void);

components/bt/esp_ble_mesh/core/ext_adv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ static int adv_send(struct bt_mesh_adv_inst *inst, uint16_t *adv_duration)
142142

143143
err = bt_le_ext_adv_start(inst->id, &param, &ad, 1, NULL, 0);
144144
}
145-
break;
145+
}
146+
break;
146147

147148
#if CONFIG_BLE_MESH_SUPPORT_BLE_ADV
148149
case BLE_MESH_ADV_BLE:

components/bt/esp_ble_mesh/core/friend.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ int bt_mesh_friend_sub_rem(struct bt_mesh_net_rx *rx,
813813

814814
static void enqueue_buf(struct bt_mesh_friend *frnd, struct net_buf *buf)
815815
{
816-
BT_DBG("EnqueueBuf, Buf %p QueueSize %u", __func__, buf, frnd->queue_size);
816+
BT_DBG("EnqueueBuf, Buf %p QueueSize %u", buf, frnd->queue_size);
817817

818818
net_buf_slist_put(&frnd->queue, buf);
819819
frnd->queue_size++;
@@ -823,7 +823,7 @@ static void enqueue_update(struct bt_mesh_friend *frnd, uint8_t md)
823823
{
824824
struct net_buf *buf = NULL;
825825

826-
BT_DBG("EnqueueUpdate, LPN 0x%04x MD %u", __func__, frnd->lpn, md);
826+
BT_DBG("EnqueueUpdate, LPN 0x%04x MD %u", frnd->lpn, md);
827827

828828
buf = encode_update(frnd, md);
829829
if (!buf) {

components/bt/esp_ble_mesh/core/net.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static bool check_dup(struct net_buf_simple *data)
104104
}
105105
}
106106

107-
BT_DBG("DupCacheAdd, CacheNext %ld", val, dup_cache_next);
107+
BT_DBG("DupCacheAdd, CacheNext %ld %d", val, dup_cache_next);
108108

109109
dup_cache[dup_cache_next++] = val;
110110
dup_cache_next %= ARRAY_SIZE(dup_cache);
@@ -2013,7 +2013,7 @@ void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
20132013
net_buf_simple_save(&buf, &state);
20142014

20152015
BT_DBG("NetRecv, Src 0x%04x Dst 0x%04x Rssi %d NetIf %u",
2016-
rx->ctx.addr, rx->ctx.recv_dst, rx->ctx.recv_rssi, net_if);
2016+
rx.ctx.addr, rx.ctx.recv_dst, rx.ctx.recv_rssi, net_if);
20172017

20182018
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | \
20192019
BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_NET,

components/bt/esp_ble_mesh/core/prov_pvnr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2812,7 +2812,7 @@ static void protocol_timeout(struct k_work *work)
28122812
{
28132813
struct bt_mesh_prov_link *link = work->user_data;
28142814

2815-
BT_WARN("Protocol timeout,LinkId:%08x", link->link_id);
2815+
BT_WARN("Protocol timeout,RmtAddr:%s", bt_hex(link->addr.val, 6));
28162816

28172817
close_link(link, CLOSE_REASON_TIMEOUT);
28182818
}

components/bt/esp_ble_mesh/core/transport.enh.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,11 +2005,14 @@ static struct seg_rx *seg_rx_alloc(struct bt_mesh_net_rx *net_rx,
20052005
{
20062006
int err = 0;
20072007

2008+
<<<<<<< HEAD
20082009
<<<<<<< HEAD
20092010
for (size_t i = 0; i < ARRAY_SIZE(seg_rx); i++) {
20102011
struct seg_rx *rx = &seg_rx[i];
20112012
=======
20122013
<<<<<<< HEAD
2014+
=======
2015+
>>>>>>> 9fc4381f187 (fix(ble_mesh): resolve miscellaneous logging issues)
20132016
/* By default, traditional seg_rx is used for allocation.
20142017
* If the first segment received is the last segment of
20152018
* the long packet, and its length is the length of the traditional packet,
@@ -2029,13 +2032,15 @@ static struct seg_rx *seg_rx_alloc(struct bt_mesh_net_rx *net_rx,
20292032

20302033
for (size_t i = 0; i < rx_buf_size; i++) {
20312034
struct seg_rx *rx = &seg_rx_buf[i];
2032-
=======
2033-
BT_DBG("SegRxAlloc, SegN %u", seg_n);
20342035

2036+
<<<<<<< HEAD
20352037
for (size_t i = 0; i < ARRAY_SIZE(seg_rx); i++) {
20362038
struct seg_rx *rx = &seg_rx[i];
20372039
>>>>>>> 7652269a401 (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
20382040
>>>>>>> bdcd87e62fa (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
2041+
=======
2042+
BT_DBG("SegRxAlloc, SegN %u", seg_n);
2043+
>>>>>>> 9fc4381f187 (fix(ble_mesh): resolve miscellaneous logging issues)
20392044

20402045
if (rx->in_use) {
20412046
continue;
@@ -2253,27 +2258,29 @@ static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx,
22532258
/* Set the expected final buffer length */
22542259
rx->buf.len = seg_n * seg_len(rx->ctl) + buf->len;
22552260

2261+
<<<<<<< HEAD
22562262
<<<<<<< HEAD
22572263
BT_DBG("Target len %u * %u + %u = %u", seg_n, seg_len(rx->ctl),
22582264
=======
22592265
<<<<<<< HEAD
2266+
=======
2267+
>>>>>>> 9fc4381f187 (fix(ble_mesh): resolve miscellaneous logging issues)
22602268
BT_DBG("Target len %u * %u + %u = %u", seg_n, seg_len(&si),
22612269
>>>>>>> bdcd87e62fa (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
22622270
buf->len, rx->buf.len);
2263-
=======
2264-
BT_DBG("Target len %u * %u + %u = %u",
2265-
seg_n, seg_len(rx->ctl), buf->len, rx->buf.len);
2266-
>>>>>>> 7652269a401 (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
22672271

22682272
/* This should not happen, since we have made sure the whole
22692273
* SDU could be received while handling the first segment.
22702274
* But if the peer device sends the segments of a segmented
22712275
* message with different CTL, then the following could happen.
22722276
*/
2277+
<<<<<<< HEAD
22732278
<<<<<<< HEAD
22742279
if (rx->buf.len > CONFIG_BLE_MESH_RX_SDU_MAX) {
22752280
=======
22762281
<<<<<<< HEAD
2282+
=======
2283+
>>>>>>> 9fc4381f187 (fix(ble_mesh): resolve miscellaneous logging issues)
22772284
if ((!rx->ext && rx->buf.len > CONFIG_BLE_MESH_RX_SDU_MAX)
22782285
#if CONFIG_BLE_MESH_LONG_PACKET
22792286
|| (rx->ext && rx->buf.len > BLE_MESH_EXT_RX_SDU_MAX)
@@ -2282,11 +2289,6 @@ static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx,
22822289
>>>>>>> bdcd87e62fa (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
22832290
BT_ERR("Too large SDU len %u/%u", rx->buf.len,
22842291
CONFIG_BLE_MESH_RX_SDU_MAX);
2285-
=======
2286-
if (rx->buf.len > CONFIG_BLE_MESH_RX_SDU_MAX) {
2287-
BT_ERR("Too large SDU len %u/%u",
2288-
rx->buf.len, CONFIG_BLE_MESH_RX_SDU_MAX);
2289-
>>>>>>> 7652269a401 (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
22902292

22912293
send_ack(net_rx->sub, net_rx->ctx.recv_dst,
22922294
net_rx->ctx.addr, net_rx->ctx.send_ttl,

0 commit comments

Comments
 (0)