Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions doc/connectivity/bluetooth/api/mesh/brg_cfg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,16 @@ protection to ensure network security. Key considerations to take into account a
Relay buffer considerations
===========================

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

However, if the :kconfig:option:`CONFIG_BT_MESH_RELAY` feature is disabled, the messages will be
allocated from the advertising buffer instead. In this case, increase the
:kconfig:option:`CONFIG_BT_MESH_ADV_BUF_COUNT` option to allow for sufficient buffer space.
When :kconfig:option:`CONFIG_BT_MESH_ADV_EXT` is enabled, messages will be transmitted using the
relay advertising sets. The number of advertising sets are configurable using the
:kconfig:option:`CONFIG_BT_MESH_RELAY_ADV_SETS` Kconfig option.

Both the relay buffer pool and advertising sets can be used even if the relay feature
:kconfig:option:`CONFIG_BT_MESH_RELAY` is disabled.

Replay protection and Bridging Table
====================================
Expand Down
11 changes: 9 additions & 2 deletions subsys/bluetooth/mesh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,13 @@ config BT_MESH_RELAY_ADV_SETS
int "Maximum of simultaneous relay message support"
default 0
range 0 BT_EXT_ADV_MAX_ADV_SET
depends on BT_MESH_RELAY
depends on BT_MESH_RELAY || BT_MESH_BRG_CFG_SRV
help
Maximum of simultaneous relay message support. Requires controller support
multiple advertising sets.

Note that: The Subnet Bridge feature uses the relay 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
Expand Down Expand Up @@ -471,8 +473,11 @@ config BT_MESH_RELAY_RETRANSMIT_INTERVAL
messages, in milliseconds. Can be changed through runtime
configuration.

endif # BT_MESH_RELAY

config BT_MESH_RELAY_BUF_COUNT
int "Number of advertising buffers for relayed messages"
depends on BT_MESH_RELAY || BT_MESH_BRG_CFG_SRV
default 32
range 1 256
help
Expand All @@ -486,7 +491,9 @@ config BT_MESH_RELAY_BUF_COUNT
BT_MESH_RELAY_ADV_SETS allows the increase in the number of buffers
while maintaining the latency.

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

endmenu # Network layer

Expand Down
12 changes: 6 additions & 6 deletions subsys/bluetooth/mesh/adv.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@

struct k_mem_slab *slab = &local_adv_pool;

#if defined(CONFIG_BT_MESH_RELAY)
#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV))
if (adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) {
slab = &relay_adv_pool;
}
Expand All @@ -156,7 +156,7 @@
enum bt_mesh_adv_tag tag,
uint8_t xmit, k_timeout_t timeout)
{
#if defined(CONFIG_BT_MESH_RELAY)
#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV))
if (tag == BT_MESH_ADV_TAG_RELAY) {
return adv_create_from_pool(&relay_adv_pool,
type, tag, xmit, timeout);
Expand Down Expand Up @@ -202,10 +202,10 @@
K_POLL_MODE_NOTIFY_ONLY,
&bt_mesh_adv_queue,
0),
#if defined(CONFIG_BT_MESH_RELAY) && \
#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV)) && \
(defined(CONFIG_BT_MESH_ADV_LEGACY) || \
defined(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET) || \
!(CONFIG_BT_MESH_RELAY_ADV_SETS))

Check notice on line 208 in subsys/bluetooth/mesh/adv.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/mesh/adv.c:208 -#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV)) && \ - (defined(CONFIG_BT_MESH_ADV_LEGACY) || \ - defined(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET) || \ +#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV)) && \ + (defined(CONFIG_BT_MESH_ADV_LEGACY) || \ + 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,
Expand All @@ -228,7 +228,7 @@
return k_fifo_get(&bt_mesh_friend_queue, timeout);
}

if (IS_ENABLED(CONFIG_BT_MESH_RELAY) &&
if ((IS_ENABLED(CONFIG_BT_MESH_RELAY) || IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV)) &&
!(tags & BT_MESH_ADV_TAG_BIT_LOCAL)) {
return k_fifo_get(&bt_mesh_relay_queue, timeout);
}
Expand All @@ -242,7 +242,7 @@

k_fifo_cancel_wait(&bt_mesh_adv_queue);

if (IS_ENABLED(CONFIG_BT_MESH_RELAY)) {
if ((IS_ENABLED(CONFIG_BT_MESH_RELAY) || IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV))) {
k_fifo_cancel_wait(&bt_mesh_relay_queue);
}

Expand Down Expand Up @@ -276,9 +276,9 @@
return;
}

if ((IS_ENABLED(CONFIG_BT_MESH_RELAY) &&
if (((IS_ENABLED(CONFIG_BT_MESH_RELAY) || IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV)) &&
adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) ||
(IS_ENABLED(CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS) &&

Check notice on line 281 in subsys/bluetooth/mesh/adv.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/mesh/adv.c:281 - adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) || + adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) ||
adv->ctx.tag == BT_MESH_ADV_TAG_PROV)) {
k_fifo_put(&bt_mesh_relay_queue, bt_mesh_adv_ref(adv));
bt_mesh_adv_relay_ready();
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/mesh/adv_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@
#if CONFIG_BT_MESH_RELAY_ADV_SETS
[1 ... CONFIG_BT_MESH_RELAY_ADV_SETS] = {
.tags = (
#if defined(CONFIG_BT_MESH_RELAY)
#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV))
BT_MESH_ADV_TAG_BIT_RELAY |
#endif /* CONFIG_BT_MESH_RELAY */
#endif /* CONFIG_BT_MESH_RELAY || CONFIG_BT_MESH_BRG_CFG_SRV */
#if defined(CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS)
BT_MESH_ADV_TAG_BIT_PROV |
#endif /* CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS */
0),
.work = Z_WORK_INITIALIZER(send_pending_adv),
},
#endif /* CONFIG_BT_MESH_RELAY_ADV_SETS */

Check notice on line 120 in subsys/bluetooth/mesh/adv_ext.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/mesh/adv_ext.c:120 - [0] = { - .tags = ( + [0] = + { + .tags = ( #if !defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) - BT_MESH_ADV_TAG_BIT_FRIEND | + BT_MESH_ADV_TAG_BIT_FRIEND | #endif #if !defined(CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE) - BT_MESH_ADV_TAG_BIT_PROXY | + BT_MESH_ADV_TAG_BIT_PROXY | #endif /* !CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE */ #if defined(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET) - BT_MESH_ADV_TAG_BIT_RELAY | + BT_MESH_ADV_TAG_BIT_RELAY | #endif /* CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET */ #if defined(CONFIG_BT_MESH_PB_ADV) - BT_MESH_ADV_TAG_BIT_PROV | + BT_MESH_ADV_TAG_BIT_PROV | #endif /* CONFIG_BT_MESH_PB_ADV */ - BT_MESH_ADV_TAG_BIT_LOCAL - ), - .work = Z_WORK_INITIALIZER(send_pending_adv), - }, + BT_MESH_ADV_TAG_BIT_LOCAL), + .work = Z_WORK_INITIALIZER(send_pending_adv), + }, #if CONFIG_BT_MESH_RELAY_ADV_SETS - [1 ... CONFIG_BT_MESH_RELAY_ADV_SETS] = { - .tags = ( + [1 ... CONFIG_BT_MESH_RELAY_ADV_SETS] = + { + .tags = ( #if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV)) - BT_MESH_ADV_TAG_BIT_RELAY | + BT_MESH_ADV_TAG_BIT_RELAY | #endif /* CONFIG_BT_MESH_RELAY || CONFIG_BT_MESH_BRG_CFG_SRV */ #if defined(CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS) - BT_MESH_ADV_TAG_BIT_PROV | + BT_MESH_ADV_TAG_BIT_PROV | #endif /* CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS */ - 0), - .work = Z_WORK_INITIALIZER(send_pending_adv), - }, + 0), + .work = Z_WORK_INITIALIZER(send_pending_adv), + },
#if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE)
{
.tags = BT_MESH_ADV_TAG_BIT_FRIEND,
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/mesh/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf, struct bt_mesh_net_rx
* Anything else (like GATT to adv, or locally originated packets)
* use the Network Transmit state.
*/
if (rx->net_if == BT_MESH_NET_IF_ADV && !rx->friend_cred) {
if (rx->net_if == BT_MESH_NET_IF_ADV && !rx->friend_cred && !bridge) {
transmit = bt_mesh_relay_retransmit_get();
} else {
transmit = bt_mesh_net_transmit_get();
Expand Down
Loading