Bluetooth: Mesh: Change local_queue from k_fifo to sys_slist_t

We never access the local network interface queue in a blocking
fashing, so it's unnecessary to have all the infrastructure that
k_fifo provides. Use the simpler sys_slist_t instead.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2017-11-12 20:16:38 +02:00 committed by Johan Hedberg
commit 514cebcfe8
2 changed files with 4 additions and 4 deletions

View file

@ -72,7 +72,7 @@ static u16_t msg_cache_next;
/* Singleton network context (the implementation only supports one) */
struct bt_mesh_net bt_mesh = {
.local_queue = _K_FIFO_INITIALIZER(bt_mesh.local_queue),
.local_queue = SYS_SLIST_STATIC_INIT(&bt_mesh.local_queue),
.sub = {
[0 ... (CONFIG_BT_MESH_SUBNET_COUNT - 1)] = {
.net_idx = BT_MESH_KEY_UNUSED,
@ -728,7 +728,7 @@ static void bt_mesh_net_local(struct k_work *work)
{
struct net_buf *buf;
while ((buf = net_buf_get(&bt_mesh.local_queue, K_NO_WAIT))) {
while ((buf = net_buf_slist_get(&bt_mesh.local_queue))) {
BT_DBG("len %u: %s", buf->len, bt_hex(buf->data, buf->len));
bt_mesh_net_recv(&buf->b, 0, BT_MESH_NET_IF_LOCAL);
net_buf_unref(buf);
@ -830,7 +830,7 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
/* Deliver to local network interface if necessary */
if (bt_mesh_fixed_group_match(tx->ctx->addr) ||
bt_mesh_elem_find(tx->ctx->addr)) {
net_buf_put(&bt_mesh.local_queue, net_buf_ref(buf));
net_buf_slist_put(&bt_mesh.local_queue, net_buf_ref(buf));
if (cb) {
cb(buf, 0, 0);
}

View file

@ -204,7 +204,7 @@ struct bt_mesh_net {
/* Local network interface */
struct k_work local_work;
struct k_fifo local_queue;
sys_slist_t local_queue;
#if defined(CONFIG_BT_MESH_FRIEND)
/* Friend state, unique for each LPN that we're Friends for */