Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: Mesh: Enhance Provision speed over PB-ADV bearer #62331

Merged
merged 5 commits into from
Oct 20, 2023
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
3 changes: 0 additions & 3 deletions cmake/linker_script/common/common-ram.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ if(CONFIG_UVB)
zephyr_iterable_section(NAME uvb_node GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4)
endif()

if(CONFIG_BT_MESH_ADV_EXT)
zephyr_iterable_section(NAME bt_mesh_ext_adv GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4)
endif()

if(CONFIG_LOG)
zephyr_iterable_section(NAME log_mpsc_pbuf GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4)
Expand Down
4 changes: 0 additions & 4 deletions include/zephyr/linker/common-ram.ld
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
#endif
#endif /* NETWORKING */

#if defined(CONFIG_BT_MESH)
ITERABLE_SECTION_RAM(bt_mesh_ext_adv, 4)
#endif

#if defined(CONFIG_GEN_SW_ISR_TABLE) && defined(CONFIG_DYNAMIC_INTERRUPTS)
SECTION_DATA_PROLOGUE(sw_isr_table,,)
{
Expand Down
32 changes: 32 additions & 0 deletions subsys/bluetooth/mesh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,38 @@ config BT_MESH_UNPROV_BEACON_INT

if BT_MESH_PB_ADV

config BT_MESH_PB_ADV_USE_RELAY_SETS
bool "Use relay advertising sets to send provisioning PDUs"
depends on BT_MESH_RELAY_ADV_SETS > 0
help
Use relay advertising sets to send provisioning PDUs

config BT_MESH_PB_ADV_TRANS_PDU_RETRANSMIT_COUNT
int "Link Open and Transaction PDU retransmit count"
default 7 if BT_MESH_PB_ADV_USE_RELAY_SETS
default 0
range 0 7
help
Controls the number of retransmissions of original Link Open and Transaction PDU,
in addition to the first transmission.

config BT_MESH_PB_ADV_TRANS_ACK_RETRANSMIT_COUNT
int "Link Ack and Transaction Ack retransmit count"
default 2
range 0 7
help
Controls the number of retransmissions of original Link Ack and Transaction Acknowledgment PDU,
in addition to the first transmission.

config BT_MESH_PB_ADV_LINK_CLOSE_RETRANSMIT_COUNT
int "Link Close retransmit count"
default 7 if BT_MESH_PB_ADV_USE_RELAY_SETS
alxelax marked this conversation as resolved.
Show resolved Hide resolved
default 2
range 0 7
help
Controls the number of retransmissions of original Link Close,
in addition to the first transmission.

config BT_MESH_PB_ADV_RETRANS_TIMEOUT
int "Timeout value of retransmit provisioning PDUs"
default 500
Expand Down
21 changes: 12 additions & 9 deletions subsys/bluetooth/mesh/adv.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ struct net_buf *bt_mesh_adv_create(enum bt_mesh_adv_type type,
uint8_t xmit, k_timeout_t timeout)
{
#if defined(CONFIG_BT_MESH_RELAY)
if (tag & BT_MESH_RELAY_ADV) {
if (tag == BT_MESH_ADV_TAG_RELAY) {
return bt_mesh_adv_create_from_pool(&relay_buf_pool,
adv_relay_pool, type,
tag, xmit, timeout);
}
#endif

#if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE)
if (tag & BT_MESH_FRIEND_ADV) {
if (tag == BT_MESH_ADV_TAG_FRIEND) {
return bt_mesh_adv_create_from_pool(&friend_buf_pool,
adv_friend_pool, type,
tag, xmit, timeout);
Expand Down Expand Up @@ -202,14 +202,15 @@ struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout)
return process_events(events, ARRAY_SIZE(events));
}

struct net_buf *bt_mesh_adv_buf_get_by_tag(uint8_t tag, k_timeout_t timeout)
struct net_buf *bt_mesh_adv_buf_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_timeout_t timeout)
{
if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && tag & BT_MESH_FRIEND_ADV) {
if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) &&
tags & BT_MESH_ADV_TAG_BIT_FRIEND) {
return net_buf_get(&bt_mesh_friend_queue, timeout);
}

#if CONFIG_BT_MESH_RELAY_ADV_SETS
alxelax marked this conversation as resolved.
Show resolved Hide resolved
if (tag & BT_MESH_RELAY_ADV) {
if (!(tags & BT_MESH_ADV_TAG_BIT_LOCAL)) {
return net_buf_get(&bt_mesh_relay_queue, timeout);
}
#endif
Expand All @@ -222,9 +223,9 @@ struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout)
return net_buf_get(&bt_mesh_adv_queue, timeout);
}

struct net_buf *bt_mesh_adv_buf_get_by_tag(uint8_t tag, k_timeout_t timeout)
struct net_buf *bt_mesh_adv_buf_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_timeout_t timeout)
{
ARG_UNUSED(tag);
ARG_UNUSED(tags);

return bt_mesh_adv_buf_get(timeout);
}
Expand Down Expand Up @@ -260,14 +261,16 @@ void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb,
}

if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) &&
BT_MESH_ADV(buf)->tag == BT_MESH_FRIEND_ADV) {
BT_MESH_ADV(buf)->tag == BT_MESH_ADV_TAG_FRIEND) {
net_buf_put(&bt_mesh_friend_queue, net_buf_ref(buf));
bt_mesh_adv_buf_friend_ready();
return;
}

#if CONFIG_BT_MESH_RELAY_ADV_SETS
if (BT_MESH_ADV(buf)->tag == BT_MESH_RELAY_ADV) {
if (BT_MESH_ADV(buf)->tag == BT_MESH_ADV_TAG_RELAY ||
(IS_ENABLED(CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS) &&
BT_MESH_ADV(buf)->tag == BT_MESH_ADV_TAG_PROV)) {
net_buf_put(&bt_mesh_relay_queue, net_buf_ref(buf));
bt_mesh_adv_buf_relay_ready();
return;
Expand Down
21 changes: 16 additions & 5 deletions subsys/bluetooth/mesh/adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,19 @@ enum bt_mesh_adv_type {
};

enum bt_mesh_adv_tag {
BT_MESH_LOCAL_ADV = BIT(0),
BT_MESH_RELAY_ADV = BIT(1),
BT_MESH_PROXY_ADV = BIT(2),
BT_MESH_FRIEND_ADV = BIT(3),
BT_MESH_ADV_TAG_LOCAL,
BT_MESH_ADV_TAG_RELAY,
BT_MESH_ADV_TAG_PROXY,
BT_MESH_ADV_TAG_FRIEND,
BT_MESH_ADV_TAG_PROV,
};

enum bt_mesh_adv_tag_bit {
BT_MESH_ADV_TAG_BIT_LOCAL = BIT(BT_MESH_ADV_TAG_LOCAL),
BT_MESH_ADV_TAG_BIT_RELAY = BIT(BT_MESH_ADV_TAG_RELAY),
BT_MESH_ADV_TAG_BIT_PROXY = BIT(BT_MESH_ADV_TAG_PROXY),
BT_MESH_ADV_TAG_BIT_FRIEND = BIT(BT_MESH_ADV_TAG_FRIEND),
BT_MESH_ADV_TAG_BIT_PROV = BIT(BT_MESH_ADV_TAG_PROV),
};

struct bt_mesh_adv {
Expand Down Expand Up @@ -57,7 +66,7 @@ void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb,

struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout);

struct net_buf *bt_mesh_adv_buf_get_by_tag(uint8_t tag, k_timeout_t timeout);
struct net_buf *bt_mesh_adv_buf_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_timeout_t timeout);

void bt_mesh_adv_gatt_update(void);

Expand All @@ -75,6 +84,8 @@ void bt_mesh_adv_buf_local_ready(void);

void bt_mesh_adv_buf_relay_ready(void);

void bt_mesh_adv_buf_terminate(const struct net_buf *buf);

void bt_mesh_adv_buf_friend_ready(void);

int bt_mesh_adv_gatt_send(void);
Expand Down
Loading
Loading