Skip to content

Commit 2201729

Browse files
LingaoMrlubos
authored andcommitted
[nrf fromtree] Bluetooth: Mesh: Add macro control whether adv main to...
relay Enable advertiser main to support relay messages, this maximizes theutilization efficiency of advertising sets, which is helpful for the sending of dense relays, but for Friend and LPN, it delays the sending of local messages a little, this may cause the time slot deviation between friend and lpn, and the power consumption of lpn will increase. Signed-off-by: Lingao Meng <[email protected]> (cherry picked from commit 7668bd3)
1 parent 0d3814c commit 2201729

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

subsys/bluetooth/mesh/Kconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,25 @@ config BT_MESH_RELAY_ADV_SETS
389389
Maximum of simultaneous relay message support. Requires controller support
390390
multiple advertising sets.
391391

392+
config BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET
393+
bool "Use the main advertising set to relay messages"
394+
depends on BT_MESH_RELAY_ADV_SETS > 0
395+
help
396+
When this option is enabled, there is a message that needs to be
397+
relayed, all relay advertising sets defined by
398+
CONFIG_BT_MESH_RELAY_ADV_SETS are busy with relaying messages
399+
and the main advertising set is not busy with sending local
400+
messages, the stack will use the main advertising set to relay
401+
the message. This maximizes the utilization efficiency of
402+
advertising sets, which is helpful for the sending of dense
403+
relays. With CONFIG_BT_MESH_RELAY_RETRANSMIT_COUNT value
404+
greater than zero, this can noticeably delay transmission of
405+
local messages. When Friend feature is enabled and the node is
406+
in a friendship, this option can delay transmission of local
407+
messages thus requiring bigger CONFIG_BT_MESH_FRIEND_RECV_WIN
408+
value. This in turn will result in increase of the power
409+
consumption of the Low Power node.
410+
392411
config BT_MESH_ADV_EXT_GATT_SEPARATE
393412
bool "Use a separate extended advertising set for GATT Server Advertising"
394413
depends on BT_MESH_GATT_SERVER

subsys/bluetooth/mesh/adv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,12 @@ struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout)
142142
K_POLL_MODE_NOTIFY_ONLY,
143143
&bt_mesh_adv_queue,
144144
0),
145+
#if defined(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET)
145146
K_POLL_EVENT_STATIC_INITIALIZER(K_POLL_TYPE_FIFO_DATA_AVAILABLE,
146147
K_POLL_MODE_NOTIFY_ONLY,
147148
&bt_mesh_relay_queue,
148149
0),
149-
150+
#endif /* CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET */
150151
};
151152

152153
err = k_poll(events, ARRAY_SIZE(events), timeout);

subsys/bluetooth/mesh/adv_ext.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,14 @@ static void send_pending_adv(struct k_work *work);
6565
static bool schedule_send(struct bt_mesh_ext_adv *adv);
6666

6767
static STRUCT_SECTION_ITERABLE(bt_mesh_ext_adv, adv_main) = {
68-
.tag = (BT_MESH_LOCAL_ADV |
68+
.tag = (
6969
#if !defined(CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE)
7070
BT_MESH_PROXY_ADV |
7171
#endif /* !CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE */
72-
BT_MESH_RELAY_ADV),
72+
#if defined(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET)
73+
BT_MESH_RELAY_ADV |
74+
#endif /* CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET */
75+
BT_MESH_LOCAL_ADV),
7376

7477
.work = Z_WORK_DELAYABLE_INITIALIZER(send_pending_adv),
7578
};
@@ -324,7 +327,9 @@ void bt_mesh_adv_buf_relay_ready(void)
324327
}
325328

326329
/* Attempt to use the main adv set for the sending of relay messages. */
327-
(void)schedule_send(&adv_main);
330+
if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET)) {
331+
(void)schedule_send(&adv_main);
332+
}
328333
}
329334

330335
void bt_mesh_adv_init(void)

0 commit comments

Comments
 (0)