Skip to content
Closed
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
24 changes: 24 additions & 0 deletions include/zephyr/bluetooth/mesh/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,30 @@ enum bt_mesh_feat_state bt_mesh_relay_get(void);
*/
uint8_t bt_mesh_relay_retransmit_get(void);

/** Bluetooth mesh network priority relay request callback
*
* Support for the priority relay feature must be enabled through the
* :kconfig:option:`CONFIG_BT_MESH_RELAY_PRIORITY` configuration option.
*
* @param ctx The Bluetooth mesh message context.
*
* @note A high priority message will preempt an oldest low priority message if the
* relay buffer :kconfig:option:`CONFIG_BT_MESH_RELAY_BUF_COUNT` is insufficient.
*
* @return The priority of the relay message. The higher the value, the higher
* the priority, and the faster the relay.
*/
typedef uint8_t (*bt_mesh_relay_prio_req_cb_t)(struct bt_mesh_msg_ctx *ctx);

/** @brief Register the priority relay callback function.
*
* Support for the priority relay feature must be enabled through the
* :kconfig:option:`CONFIG_BT_MESH_RELAY_PRIORITY` configuration option.
*
* @param cb The priority request callback function.
*/
void bt_mesh_relay_priority_cb_reg(bt_mesh_relay_prio_req_cb_t cb);

/** @brief Enable or disable the GATT Proxy feature.
*
* Support for the GATT Proxy feature must be enabled through the
Expand Down
16 changes: 16 additions & 0 deletions include/zephyr/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -2004,6 +2004,22 @@ __syscall void *k_queue_peek_head(struct k_queue *queue);
*/
__syscall void *k_queue_peek_tail(struct k_queue *queue);

/**
* @brief Provide the primitive to iterate on a queue
* Note: the loop is unsafe and thus curr should not be removed
*
* User _MUST_ add the loop statement curly braces enclosing its own code:
*
* K_QUEUE_FOR_EACH(l, n) {
* <user code>
* }
*
* @param queue Address of the queue.
* @param curr A node pointer to peek each node of the queue.
*/
#define K_QUEUE_FOR_EACH(queue, curr) \
SYS_SFLIST_FOR_EACH_NODE(&((queue)->data_q), curr)

/**
* @brief Statically define and initialize a queue.
*
Expand Down
2 changes: 2 additions & 0 deletions subsys/bluetooth/host/testing.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
#include <zephyr/kernel.h>
#include <stddef.h>

#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/testing.h>

#if defined(CONFIG_BT_MESH)
#include "mesh/adv.h"
#include "mesh/net.h"
#include "mesh/lpn.h"
#include "mesh/rpl.h"
Expand Down
13 changes: 13 additions & 0 deletions subsys/bluetooth/mesh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,19 @@ config BT_MESH_RELAY_BUF_COUNT
BT_MESH_RELAY_ADV_SETS allows the increase in the number of buffers
while maintaining the latency.

config BT_MESH_RELAY_PRIORITY
bool "Support for prioritized relay messages"
help
Prioritized relay messages will be sent before other lower priority
relay messages. This ensures that the higher priority messages are sent in time.
When considering the message latency, also consider the values of
BT_MESH_RELAY_RETRANSMIT_COUNT and BT_MESH_RELAY_RETRANSMIT_INTERVAL.
A higher number of BT_MESH_RELAY_ADV_SETS allows the increase in the number
of buffers while maintaining the latency.

Note: To enable this option, the application layer needs to register a callback
function to determine the priority of each relay message. If it is not registered,
the default priority is lowest (zero).
endif

config BT_MESH_BEACON_ENABLED
Expand Down
Loading