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 <menglingao@xiaomi.com>
This commit is contained in:
parent
a5ebad1e23
commit
7668bd3b7c
3 changed files with 29 additions and 4 deletions
|
@ -389,6 +389,25 @@ config BT_MESH_RELAY_ADV_SETS
|
||||||
Maximum of simultaneous relay message support. Requires controller support
|
Maximum of simultaneous relay message support. Requires controller support
|
||||||
multiple advertising sets.
|
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
|
config BT_MESH_ADV_EXT_GATT_SEPARATE
|
||||||
bool "Use a separate extended advertising set for GATT Server Advertising"
|
bool "Use a separate extended advertising set for GATT Server Advertising"
|
||||||
depends on BT_MESH_GATT_SERVER
|
depends on BT_MESH_GATT_SERVER
|
||||||
|
|
|
@ -142,11 +142,12 @@ struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout)
|
||||||
K_POLL_MODE_NOTIFY_ONLY,
|
K_POLL_MODE_NOTIFY_ONLY,
|
||||||
&bt_mesh_adv_queue,
|
&bt_mesh_adv_queue,
|
||||||
0),
|
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_EVENT_STATIC_INITIALIZER(K_POLL_TYPE_FIFO_DATA_AVAILABLE,
|
||||||
K_POLL_MODE_NOTIFY_ONLY,
|
K_POLL_MODE_NOTIFY_ONLY,
|
||||||
&bt_mesh_relay_queue,
|
&bt_mesh_relay_queue,
|
||||||
0),
|
0),
|
||||||
|
#endif /* CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET */
|
||||||
};
|
};
|
||||||
|
|
||||||
err = k_poll(events, ARRAY_SIZE(events), timeout);
|
err = k_poll(events, ARRAY_SIZE(events), timeout);
|
||||||
|
|
|
@ -65,11 +65,14 @@ static void send_pending_adv(struct k_work *work);
|
||||||
static bool schedule_send(struct bt_mesh_ext_adv *adv);
|
static bool schedule_send(struct bt_mesh_ext_adv *adv);
|
||||||
|
|
||||||
static STRUCT_SECTION_ITERABLE(bt_mesh_ext_adv, adv_main) = {
|
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)
|
#if !defined(CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE)
|
||||||
BT_MESH_PROXY_ADV |
|
BT_MESH_PROXY_ADV |
|
||||||
#endif /* !CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE */
|
#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),
|
.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. */
|
/* 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)
|
void bt_mesh_adv_init(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue