From 3a415c6bfb6469ee8ecadbb960bab2b381e95c42 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Fri, 11 Dec 2015 12:58:19 +0200 Subject: [PATCH] Bluetooth: Add unacked queue re-queueing Change-Id: I2a12e6db72046d5ebc78c932ab5054eadbb4308c Signed-off-by: Andrei Emeltchenko --- drivers/bluetooth/h5.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/h5.c b/drivers/bluetooth/h5.c index 2c80c336425..a92560e0291 100644 --- a/drivers/bluetooth/h5.c +++ b/drivers/bluetooth/h5.c @@ -365,7 +365,28 @@ static void retx_fiber(int arg1, int arg2) h5.retx_to = NULL; - /* TODO: Parse unacked queue and re-queue */ + if (unack_queue_len) { + struct nano_fifo tmp_queue; + struct net_buf *buf; + + nano_fifo_init(&tmp_queue); + + /* Queue to temperary queue */ + while ((buf = nano_fifo_get(&h5.tx_queue))) { + nano_fifo_put(&tmp_queue, buf); + }; + + /* Queue unack packets to the beginning of the queue */ + while ((buf = nano_fifo_get(&h5.unack_queue))) { + nano_fifo_put(&h5.tx_queue, buf); + unack_queue_len--; + } + + /* Queue saved packets from temp queue */ + while ((buf = nano_fifo_get(&tmp_queue))) { + nano_fifo_put(&h5.tx_queue, buf); + } + } } static void ack_fiber(int arg1, int arg2)