From 0028559860c70fe1c208d70e4c275a14ce2a3af0 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 17 Jun 2020 14:07:38 -0700 Subject: [PATCH] Bluetooth: ATT: Fix using of k_fifo_{put,get} These functions don't work with buffers that do have fragments, instead this replaces their usage with net_buf_{put,get}. Signed-off-by: Luiz Augusto von Dentz --- subsys/bluetooth/host/att.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 73f1e9bd7a9..74254e1cc93 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -445,7 +445,7 @@ static void bt_att_chan_send_rsp(struct bt_att_chan *chan, struct net_buf *buf, err = bt_att_chan_send(chan, buf, cb); if (err) { /* Responses need to be sent back using the same channel */ - k_fifo_put(&chan->tx_queue, buf); + net_buf_put(&chan->tx_queue, buf); } } @@ -2500,12 +2500,12 @@ static void att_reset(struct bt_att *att) #if CONFIG_BT_ATT_PREPARE_COUNT > 0 /* Discard queued buffers */ - while ((buf = k_fifo_get(&att->prep_queue, K_NO_WAIT))) { + while ((buf = net_buf_get(&att->prep_queue, K_NO_WAIT))) { net_buf_unref(buf); } #endif /* CONFIG_BT_ATT_PREPARE_COUNT > 0 */ - while ((buf = k_fifo_get(&att->tx_queue, K_NO_WAIT))) { + while ((buf = net_buf_get(&att->tx_queue, K_NO_WAIT))) { net_buf_unref(buf); } @@ -2539,7 +2539,7 @@ static void att_chan_detach(struct bt_att_chan *chan) } /* Release pending buffers */ - while ((buf = k_fifo_get(&chan->tx_queue, K_NO_WAIT))) { + while ((buf = net_buf_get(&chan->tx_queue, K_NO_WAIT))) { net_buf_unref(buf); } @@ -2970,7 +2970,7 @@ int bt_att_send(struct bt_conn *conn, struct net_buf *buf, bt_conn_tx_cb_t cb, if (ret < 0) { /* Queue buffer to be send later */ BT_DBG("Queueing buffer %p", buf); - k_fifo_put(&att->tx_queue, buf); + net_buf_put(&att->tx_queue, buf); } return 0;