diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 374dd435345..693a3474804 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -389,6 +389,25 @@ config BT_MESH_RELAY_ADV_SETS Maximum of simultaneous relay message support. Requires controller support multiple advertising sets. +config BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET + bool "Use the main advertising set to relay messages" + depends on BT_MESH_RELAY_ADV_SETS > 0 + help + When this option is enabled, there is a message that needs to be + relayed, all relay advertising sets defined by + CONFIG_BT_MESH_RELAY_ADV_SETS are busy with relaying messages + and the main advertising set is not busy with sending local + messages, the stack will use the main advertising set to relay + the message. This maximizes the utilization efficiency of + advertising sets, which is helpful for the sending of dense + relays. With CONFIG_BT_MESH_RELAY_RETRANSMIT_COUNT value + greater than zero, this can noticeably delay transmission of + local messages. When Friend feature is enabled and the node is + in a friendship, this option can delay transmission of local + messages thus requiring bigger CONFIG_BT_MESH_FRIEND_RECV_WIN + value. This in turn will result in increase of the power + consumption of the Low Power node. + config BT_MESH_ADV_EXT_GATT_SEPARATE bool "Use a separate extended advertising set for GATT Server Advertising" depends on BT_MESH_GATT_SERVER diff --git a/subsys/bluetooth/mesh/adv.c b/subsys/bluetooth/mesh/adv.c index 16dd22bb61a..d3d0add80f0 100644 --- a/subsys/bluetooth/mesh/adv.c +++ b/subsys/bluetooth/mesh/adv.c @@ -142,11 +142,12 @@ struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout) K_POLL_MODE_NOTIFY_ONLY, &bt_mesh_adv_queue, 0), +#if defined(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET) K_POLL_EVENT_STATIC_INITIALIZER(K_POLL_TYPE_FIFO_DATA_AVAILABLE, K_POLL_MODE_NOTIFY_ONLY, &bt_mesh_relay_queue, 0), - +#endif /* CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET */ }; err = k_poll(events, ARRAY_SIZE(events), timeout); diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 30d143e6c48..effebff941d 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -65,11 +65,14 @@ static void send_pending_adv(struct k_work *work); static bool schedule_send(struct bt_mesh_ext_adv *adv); static STRUCT_SECTION_ITERABLE(bt_mesh_ext_adv, adv_main) = { - .tag = (BT_MESH_LOCAL_ADV | + .tag = ( #if !defined(CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE) BT_MESH_PROXY_ADV | #endif /* !CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE */ - BT_MESH_RELAY_ADV), +#if defined(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET) + BT_MESH_RELAY_ADV | +#endif /* CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET */ + BT_MESH_LOCAL_ADV), .work = Z_WORK_DELAYABLE_INITIALIZER(send_pending_adv), }; @@ -324,7 +327,9 @@ void bt_mesh_adv_buf_relay_ready(void) } /* Attempt to use the main adv set for the sending of relay messages. */ - (void)schedule_send(&adv_main); + if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET)) { + (void)schedule_send(&adv_main); + } } void bt_mesh_adv_init(void)