mirror of
https://github.com/espressif/esp-idf.git
synced 2026-06-08 14:16:35 +03:00
fix(ble_mesh): resolve miscellaneous logging issues
This commit is contained in:
@@ -158,7 +158,7 @@ int bt_mesh_adv_inst_init(enum bt_mesh_adv_inst_type inst_type, uint8_t inst_id)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (inst_id == BLE_MESH_ADV_INS_UNUSED) {
|
||||
if (inst_id == BLE_MESH_ADV_INST_UNUSED) {
|
||||
BT_ERR("UnusedAdvInstID");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -181,7 +181,7 @@ int bt_mesh_adv_inst_deinit(enum bt_mesh_adv_inst_type inst_type)
|
||||
|
||||
bt_le_ext_adv_stop(adv_insts[inst_type].id);
|
||||
|
||||
adv_insts[inst_type].id = BLE_MESH_ADV_INS_UNUSED;
|
||||
adv_insts[inst_type].id = BLE_MESH_ADV_INST_UNUSED;
|
||||
#if CONFIG_BLE_MESH_SUPPORT_MULTI_ADV
|
||||
adv_insts[inst_type].spt_mask = 0;
|
||||
#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)
|
||||
#endif /* CONFIG_BLE_MESH_LONG_PACKET_RELAY_ADV_BUF_COUNT */
|
||||
#endif /* CONFIG_BLE_MESH_LONG_PACKET */
|
||||
|
||||
struct bt_mesh_adv_type_manager *bt_mesh_adv_types_mgnt_get(enum bt_mesh_adv_type adv_type)
|
||||
struct bt_mesh_adv_type_manager *bt_mesh_adv_types_mgmt_get(enum bt_mesh_adv_type adv_type)
|
||||
{
|
||||
BT_DBG("AdvTypeMgmtGet, AdvType %u", adv_type);
|
||||
|
||||
@@ -668,21 +668,6 @@ uint16_t bt_mesh_get_stored_relay_count(void)
|
||||
return count;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE
|
||||
uint16_t bt_mesh_relay_adv_buf_count_get(void)
|
||||
{
|
||||
uint16_t relay_adv_count = 2 + CONFIG_BLE_MESH_RELAY_ADV_BUF_COUNT;
|
||||
|
||||
#if CONFIG_BLE_MESH_EXT_ADV && CONFIG_BLE_MESH_RELAY
|
||||
relay_adv_count += CONFIG_BLE_MESH_EXT_RELAY_ADV_BUF_COUNT;
|
||||
#endif
|
||||
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET && CONFIG_BLE_MESH_RELAY
|
||||
relay_adv_count += CONFIG_BLE_MESH_LONG_PACKET_RELAY_ADV_BUF_COUNT;
|
||||
#endif
|
||||
return relay_adv_count;
|
||||
}
|
||||
|
||||
void bt_mesh_relay_adv_init(void)
|
||||
{
|
||||
BT_DBG("RelayAdvInit");
|
||||
@@ -806,33 +791,6 @@ void bt_mesh_frnd_adv_deinit(void)
|
||||
}
|
||||
#endif /* CONFIG_BLE_MESH_FRIEND */
|
||||
|
||||
static ALWAYS_INLINE
|
||||
uint16_t bt_mesh_adv_buf_count_get(void)
|
||||
{
|
||||
uint16_t adv_count = 2 + CONFIG_BLE_MESH_ADV_BUF_COUNT;
|
||||
|
||||
#if CONFIG_BLE_MESH_EXT_ADV
|
||||
adv_count += CONFIG_BLE_MESH_EXT_ADV_BUF_COUNT;
|
||||
#if !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY
|
||||
adv_count += CONFIG_BLE_MESH_EXT_RELAY_ADV_BUF_COUNT;
|
||||
#endif /* !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY */
|
||||
#endif /* CONFIG_BLE_MESH_EXT_ADV */
|
||||
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET
|
||||
adv_count += CONFIG_BLE_MESH_LONG_PACKET_ADV_BUF_COUNT;
|
||||
#if !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY
|
||||
adv_count += CONFIG_BLE_MESH_LONG_PACKET_RELAY_ADV_BUF_COUNT;
|
||||
#endif /* !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY */
|
||||
#endif /* CONFIG_BLE_MESH_LONG_PACKET */
|
||||
|
||||
#if (CONFIG_BLE_MESH_SUPPORT_BLE_ADV && \
|
||||
!(CONFIG_BLE_MESH_USE_BLE_50 && CONFIG_BLE_MESH_SEPARATE_BLE_ADV_INSTANCE))
|
||||
adv_count += CONFIG_BLE_MESH_BLE_ADV_BUF_COUNT;
|
||||
#endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */
|
||||
|
||||
return adv_count;
|
||||
}
|
||||
|
||||
void bt_mesh_adv_task_init(void adv_thread(void *p))
|
||||
{
|
||||
BT_DBG("AdvTaskInit");
|
||||
@@ -861,7 +819,14 @@ void bt_mesh_adv_task_init(void adv_thread(void *p))
|
||||
#else /* CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL && (CONFIG_SPIRAM_CACHE_WORKAROUND || !CONFIG_IDF_TARGET_ESP32) && CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY */
|
||||
int ret = xTaskCreatePinnedToCore(adv_thread, BLE_MESH_ADV_TASK_NAME, BLE_MESH_ADV_TASK_STACK_SIZE, NULL,
|
||||
BLE_MESH_ADV_TASK_PRIO, &adv_task.handle, BLE_MESH_ADV_TASK_CORE);
|
||||
#if CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
|
||||
if (ret != pdTRUE) {
|
||||
BT_ERR("xTaskCreatePinnedToCore failed, ret %d", ret);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
assert(ret == pdTRUE);
|
||||
#endif /* CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE */
|
||||
#endif /* CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL && (CONFIG_SPIRAM_CACHE_WORKAROUND || !CONFIG_IDF_TARGET_ESP32) && CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY */
|
||||
}
|
||||
|
||||
|
||||
@@ -298,6 +298,21 @@ void bt_mesh_adv_inst_type_clear(enum bt_mesh_adv_inst_type inst_type,
|
||||
#endif /* CONFIG_BLE_MESH_SUPPORT_MULTI_ADV */
|
||||
|
||||
#if CONFIG_BLE_MESH_RELAY_ADV_BUF
|
||||
static ALWAYS_INLINE
|
||||
uint16_t bt_mesh_relay_adv_buf_count_get(void)
|
||||
{
|
||||
uint16_t relay_adv_count = 2 + CONFIG_BLE_MESH_RELAY_ADV_BUF_COUNT;
|
||||
|
||||
#if CONFIG_BLE_MESH_EXT_ADV && CONFIG_BLE_MESH_RELAY
|
||||
relay_adv_count += CONFIG_BLE_MESH_EXT_RELAY_ADV_BUF_COUNT;
|
||||
#endif
|
||||
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET && CONFIG_BLE_MESH_RELAY
|
||||
relay_adv_count += CONFIG_BLE_MESH_LONG_PACKET_RELAY_ADV_BUF_COUNT;
|
||||
#endif
|
||||
return relay_adv_count;
|
||||
}
|
||||
|
||||
void bt_mesh_relay_adv_init(void);
|
||||
|
||||
bool bt_mesh_ignore_relay_packet(uint32_t timestamp);
|
||||
@@ -325,6 +340,33 @@ void bt_mesh_frnd_adv_deinit(void);
|
||||
#endif /* CONFIG_BLE_MESH_DEINIT */
|
||||
#endif /* CONFIG_BLE_MESH_FRIEND */
|
||||
|
||||
static ALWAYS_INLINE
|
||||
uint16_t bt_mesh_adv_buf_count_get(void)
|
||||
{
|
||||
uint16_t adv_count = 2 + CONFIG_BLE_MESH_ADV_BUF_COUNT;
|
||||
|
||||
#if CONFIG_BLE_MESH_EXT_ADV
|
||||
adv_count += CONFIG_BLE_MESH_EXT_ADV_BUF_COUNT;
|
||||
#if !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY
|
||||
adv_count += CONFIG_BLE_MESH_EXT_RELAY_ADV_BUF_COUNT;
|
||||
#endif /* !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY */
|
||||
#endif /* CONFIG_BLE_MESH_EXT_ADV */
|
||||
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET
|
||||
adv_count += CONFIG_BLE_MESH_LONG_PACKET_ADV_BUF_COUNT;
|
||||
#if !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY
|
||||
adv_count += CONFIG_BLE_MESH_LONG_PACKET_RELAY_ADV_BUF_COUNT;
|
||||
#endif /* !CONFIG_BLE_MESH_RELAY_ADV_BUF && CONFIG_BLE_MESH_RELAY */
|
||||
#endif /* CONFIG_BLE_MESH_LONG_PACKET */
|
||||
|
||||
#if (CONFIG_BLE_MESH_SUPPORT_BLE_ADV && \
|
||||
!(CONFIG_BLE_MESH_USE_BLE_50 && CONFIG_BLE_MESH_SEPARATE_BLE_ADV_INSTANCE))
|
||||
adv_count += CONFIG_BLE_MESH_BLE_ADV_BUF_COUNT;
|
||||
#endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */
|
||||
|
||||
return adv_count;
|
||||
}
|
||||
|
||||
void bt_mesh_adv_task_init(void adv_thread(void *p));
|
||||
|
||||
void bt_mesh_adv_common_init(void);
|
||||
|
||||
@@ -142,7 +142,8 @@ static int adv_send(struct bt_mesh_adv_inst *inst, uint16_t *adv_duration)
|
||||
|
||||
err = bt_le_ext_adv_start(inst->id, ¶m, &ad, 1, NULL, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
#if CONFIG_BLE_MESH_SUPPORT_BLE_ADV
|
||||
case BLE_MESH_ADV_BLE:
|
||||
|
||||
@@ -813,7 +813,7 @@ int bt_mesh_friend_sub_rem(struct bt_mesh_net_rx *rx,
|
||||
|
||||
static void enqueue_buf(struct bt_mesh_friend *frnd, struct net_buf *buf)
|
||||
{
|
||||
BT_DBG("EnqueueBuf, Buf %p QueueSize %u", __func__, buf, frnd->queue_size);
|
||||
BT_DBG("EnqueueBuf, Buf %p QueueSize %u", buf, frnd->queue_size);
|
||||
|
||||
net_buf_slist_put(&frnd->queue, buf);
|
||||
frnd->queue_size++;
|
||||
@@ -823,7 +823,7 @@ static void enqueue_update(struct bt_mesh_friend *frnd, uint8_t md)
|
||||
{
|
||||
struct net_buf *buf = NULL;
|
||||
|
||||
BT_DBG("EnqueueUpdate, LPN 0x%04x MD %u", __func__, frnd->lpn, md);
|
||||
BT_DBG("EnqueueUpdate, LPN 0x%04x MD %u", frnd->lpn, md);
|
||||
|
||||
buf = encode_update(frnd, md);
|
||||
if (!buf) {
|
||||
|
||||
@@ -104,7 +104,7 @@ static bool check_dup(struct net_buf_simple *data)
|
||||
}
|
||||
}
|
||||
|
||||
BT_DBG("DupCacheAdd, CacheNext %ld", val, dup_cache_next);
|
||||
BT_DBG("DupCacheAdd, CacheNext %ld %d", val, dup_cache_next);
|
||||
|
||||
dup_cache[dup_cache_next++] = val;
|
||||
dup_cache_next %= ARRAY_SIZE(dup_cache);
|
||||
@@ -2013,7 +2013,7 @@ void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
|
||||
net_buf_simple_save(&buf, &state);
|
||||
|
||||
BT_DBG("NetRecv, Src 0x%04x Dst 0x%04x Rssi %d NetIf %u",
|
||||
rx->ctx.addr, rx->ctx.recv_dst, rx->ctx.recv_rssi, net_if);
|
||||
rx.ctx.addr, rx.ctx.recv_dst, rx.ctx.recv_rssi, net_if);
|
||||
|
||||
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | \
|
||||
BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_NET,
|
||||
|
||||
@@ -2812,7 +2812,7 @@ static void protocol_timeout(struct k_work *work)
|
||||
{
|
||||
struct bt_mesh_prov_link *link = work->user_data;
|
||||
|
||||
BT_WARN("Protocol timeout,LinkId:%08x", link->link_id);
|
||||
BT_WARN("Protocol timeout,RmtAddr:%s", bt_hex(link->addr.val, 6));
|
||||
|
||||
close_link(link, CLOSE_REASON_TIMEOUT);
|
||||
}
|
||||
|
||||
@@ -2005,11 +2005,14 @@ static struct seg_rx *seg_rx_alloc(struct bt_mesh_net_rx *net_rx,
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
for (size_t i = 0; i < ARRAY_SIZE(seg_rx); i++) {
|
||||
struct seg_rx *rx = &seg_rx[i];
|
||||
=======
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> 9fc4381f187 (fix(ble_mesh): resolve miscellaneous logging issues)
|
||||
/* By default, traditional seg_rx is used for allocation.
|
||||
* If the first segment received is the last segment of
|
||||
* 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,
|
||||
|
||||
for (size_t i = 0; i < rx_buf_size; i++) {
|
||||
struct seg_rx *rx = &seg_rx_buf[i];
|
||||
=======
|
||||
BT_DBG("SegRxAlloc, SegN %u", seg_n);
|
||||
|
||||
<<<<<<< HEAD
|
||||
for (size_t i = 0; i < ARRAY_SIZE(seg_rx); i++) {
|
||||
struct seg_rx *rx = &seg_rx[i];
|
||||
>>>>>>> 7652269a401 (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
|
||||
>>>>>>> bdcd87e62fa (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
|
||||
=======
|
||||
BT_DBG("SegRxAlloc, SegN %u", seg_n);
|
||||
>>>>>>> 9fc4381f187 (fix(ble_mesh): resolve miscellaneous logging issues)
|
||||
|
||||
if (rx->in_use) {
|
||||
continue;
|
||||
@@ -2253,27 +2258,29 @@ found_rx:
|
||||
/* Set the expected final buffer length */
|
||||
rx->buf.len = seg_n * seg_len(rx->ctl) + buf->len;
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
BT_DBG("Target len %u * %u + %u = %u", seg_n, seg_len(rx->ctl),
|
||||
=======
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> 9fc4381f187 (fix(ble_mesh): resolve miscellaneous logging issues)
|
||||
BT_DBG("Target len %u * %u + %u = %u", seg_n, seg_len(&si),
|
||||
>>>>>>> bdcd87e62fa (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
|
||||
buf->len, rx->buf.len);
|
||||
=======
|
||||
BT_DBG("Target len %u * %u + %u = %u",
|
||||
seg_n, seg_len(rx->ctl), buf->len, rx->buf.len);
|
||||
>>>>>>> 7652269a401 (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
|
||||
|
||||
/* This should not happen, since we have made sure the whole
|
||||
* SDU could be received while handling the first segment.
|
||||
* But if the peer device sends the segments of a segmented
|
||||
* message with different CTL, then the following could happen.
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
if (rx->buf.len > CONFIG_BLE_MESH_RX_SDU_MAX) {
|
||||
=======
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> 9fc4381f187 (fix(ble_mesh): resolve miscellaneous logging issues)
|
||||
if ((!rx->ext && rx->buf.len > CONFIG_BLE_MESH_RX_SDU_MAX)
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET
|
||||
|| (rx->ext && rx->buf.len > BLE_MESH_EXT_RX_SDU_MAX)
|
||||
@@ -2282,11 +2289,6 @@ found_rx:
|
||||
>>>>>>> bdcd87e62fa (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
|
||||
BT_ERR("Too large SDU len %u/%u", rx->buf.len,
|
||||
CONFIG_BLE_MESH_RX_SDU_MAX);
|
||||
=======
|
||||
if (rx->buf.len > CONFIG_BLE_MESH_RX_SDU_MAX) {
|
||||
BT_ERR("Too large SDU len %u/%u",
|
||||
rx->buf.len, CONFIG_BLE_MESH_RX_SDU_MAX);
|
||||
>>>>>>> 7652269a401 (feat(ble_mesh): Miscellaneous log enhancement for BLE Mesh)
|
||||
|
||||
send_ack(net_rx->sub, net_rx->ctx.recv_dst,
|
||||
net_rx->ctx.addr, net_rx->ctx.send_ttl,
|
||||
|
||||
Reference in New Issue
Block a user