Skip to content

Commit a31d1b5

Browse files
committed
Bluetooth: Mesh: Use relay bufs/pool for brg_cfg
Adds support for using relay buffers and advertising set for the subnet bridge feature, even if the relay feature is disabled. Signed-off-by: Håvard Reierstad <[email protected]>
1 parent 2efc859 commit a31d1b5

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

doc/connectivity/bluetooth/api/mesh/brg_cfg.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,16 @@ protection to ensure network security. Key considerations to take into account a
113113
Relay buffer considerations
114114
===========================
115115

116-
When a message is relayed between subnets by a Subnet Bridge, it is allocated from the relay buffer.
117-
To ensure that messages can be retransmitted to all subnetworks,
118-
the :kconfig:option:`CONFIG_BT_MESH_RELAY_BUF_COUNT` option should be increased accordingly.
116+
When a message is relayed between subnets by a Subnet Bridge, it is allocated from the relay buffer
117+
pool. The number of relay buffers are configurable using the
118+
:kconfig:option:`CONFIG_BT_MESH_RELAY_BUF_COUNT` Kconfig option.
119119

120-
However, if the :kconfig:option:`CONFIG_BT_MESH_RELAY` feature is disabled, the messages will be
121-
allocated from the advertising buffer instead. In this case, increase the
122-
:kconfig:option:`CONFIG_BT_MESH_ADV_BUF_COUNT` option to allow for sufficient buffer space.
120+
When :kconfig:option:`CONFIG_BT_MESH_ADV_EXT` is enabled, messages will be transmitted using the
121+
relay advertising sets. The number of advertising sets are configurable using the
122+
:kconfig:option:`CONFIG_BT_MESH_RELAY_ADV_SETS` Kconfig option.
123+
124+
Both the relay buffer pool and advertising sets can be used even if the relay feature
125+
:kconfig:option:`CONFIG_BT_MESH_RELAY` is disabled.
123126

124127
Replay protection and Bridging Table
125128
====================================

subsys/bluetooth/mesh/Kconfig

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,13 @@ config BT_MESH_RELAY_ADV_SETS
165165
int "Maximum of simultaneous relay message support"
166166
default 0
167167
range 0 BT_EXT_ADV_MAX_ADV_SET
168-
depends on BT_MESH_RELAY
168+
depends on BT_MESH_RELAY || BT_MESH_BRG_CFG_SRV
169169
help
170170
Maximum of simultaneous relay message support. Requires controller support
171171
multiple advertising sets.
172172

173+
Note that: The Subnet Bridge feature uses the relay advertising sets.
174+
173175
config BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET
174176
bool "Use the main advertising set to relay messages"
175177
depends on BT_MESH_RELAY_ADV_SETS > 0
@@ -471,8 +473,11 @@ config BT_MESH_RELAY_RETRANSMIT_INTERVAL
471473
messages, in milliseconds. Can be changed through runtime
472474
configuration.
473475

476+
endif # BT_MESH_RELAY
477+
474478
config BT_MESH_RELAY_BUF_COUNT
475479
int "Number of advertising buffers for relayed messages"
480+
depends on BT_MESH_RELAY || BT_MESH_BRG_CFG_SRV
476481
default 32
477482
range 1 256
478483
help
@@ -486,7 +491,9 @@ config BT_MESH_RELAY_BUF_COUNT
486491
BT_MESH_RELAY_ADV_SETS allows the increase in the number of buffers
487492
while maintaining the latency.
488493

489-
endif # BT_MESH_RELAY
494+
Note that: The Subnet Bridge feature uses the relay advertising buffers. If both the Relay
495+
feature and the Subnet Bridge feature is enabled, the added load should be taken into
496+
account.
490497

491498
endmenu # Network layer
492499

subsys/bluetooth/mesh/adv.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void bt_mesh_adv_unref(struct bt_mesh_adv *adv)
137137

138138
struct k_mem_slab *slab = &local_adv_pool;
139139

140-
#if defined(CONFIG_BT_MESH_RELAY)
140+
#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV))
141141
if (adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) {
142142
slab = &relay_adv_pool;
143143
}
@@ -156,7 +156,7 @@ struct bt_mesh_adv *bt_mesh_adv_create(enum bt_mesh_adv_type type,
156156
enum bt_mesh_adv_tag tag,
157157
uint8_t xmit, k_timeout_t timeout)
158158
{
159-
#if defined(CONFIG_BT_MESH_RELAY)
159+
#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV))
160160
if (tag == BT_MESH_ADV_TAG_RELAY) {
161161
return adv_create_from_pool(&relay_adv_pool,
162162
type, tag, xmit, timeout);
@@ -202,7 +202,7 @@ struct bt_mesh_adv *bt_mesh_adv_get(k_timeout_t timeout)
202202
K_POLL_MODE_NOTIFY_ONLY,
203203
&bt_mesh_adv_queue,
204204
0),
205-
#if defined(CONFIG_BT_MESH_RELAY) && \
205+
#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV)) && \
206206
(defined(CONFIG_BT_MESH_ADV_LEGACY) || \
207207
defined(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET) || \
208208
!(CONFIG_BT_MESH_RELAY_ADV_SETS))
@@ -228,7 +228,7 @@ struct bt_mesh_adv *bt_mesh_adv_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_time
228228
return k_fifo_get(&bt_mesh_friend_queue, timeout);
229229
}
230230

231-
if (IS_ENABLED(CONFIG_BT_MESH_RELAY) &&
231+
if ((IS_ENABLED(CONFIG_BT_MESH_RELAY) || IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV)) &&
232232
!(tags & BT_MESH_ADV_TAG_BIT_LOCAL)) {
233233
return k_fifo_get(&bt_mesh_relay_queue, timeout);
234234
}
@@ -242,7 +242,7 @@ void bt_mesh_adv_get_cancel(void)
242242

243243
k_fifo_cancel_wait(&bt_mesh_adv_queue);
244244

245-
if (IS_ENABLED(CONFIG_BT_MESH_RELAY)) {
245+
if ((IS_ENABLED(CONFIG_BT_MESH_RELAY) || IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV))) {
246246
k_fifo_cancel_wait(&bt_mesh_relay_queue);
247247
}
248248

@@ -276,7 +276,7 @@ void bt_mesh_adv_send(struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb,
276276
return;
277277
}
278278

279-
if ((IS_ENABLED(CONFIG_BT_MESH_RELAY) &&
279+
if (((IS_ENABLED(CONFIG_BT_MESH_RELAY) || IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV)) &&
280280
adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) ||
281281
(IS_ENABLED(CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS) &&
282282
adv->ctx.tag == BT_MESH_ADV_TAG_PROV)) {

subsys/bluetooth/mesh/adv_ext.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ static struct bt_mesh_ext_adv advs[] = {
108108
#if CONFIG_BT_MESH_RELAY_ADV_SETS
109109
[1 ... CONFIG_BT_MESH_RELAY_ADV_SETS] = {
110110
.tags = (
111-
#if defined(CONFIG_BT_MESH_RELAY)
111+
#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV))
112112
BT_MESH_ADV_TAG_BIT_RELAY |
113-
#endif /* CONFIG_BT_MESH_RELAY */
113+
#endif /* CONFIG_BT_MESH_RELAY || CONFIG_BT_MESH_BRG_CFG_SRV */
114114
#if defined(CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS)
115115
BT_MESH_ADV_TAG_BIT_PROV |
116116
#endif /* CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS */

0 commit comments

Comments
 (0)