[BlueZ PATCH v5 6/7] monitor/analyze: Fix not dequeing TX packet properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

num_completed_packets_evt contain a count for how many packets have been
completed per handle.
---
 monitor/analyze.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/monitor/analyze.c b/monitor/analyze.c
index ddaaf6942035..c8192ffa7d2a 100644
--- a/monitor/analyze.c
+++ b/monitor/analyze.c
@@ -532,6 +532,7 @@ static void evt_num_completed_packets(struct hci_dev *dev, struct timeval *tv,
 		struct hci_conn *conn;
 		struct timeval res;
 		struct timeval *last_tx;
+		int j;
 
 		data += 4;
 		size -= 4;
@@ -542,15 +543,17 @@ static void evt_num_completed_packets(struct hci_dev *dev, struct timeval *tv,
 
 		conn->tx_num_comp += count;
 
-		last_tx = queue_pop_head(conn->tx_queue);
-		if (last_tx) {
-			timersub(tv, last_tx, &res);
+		for (j = 0; j < count; j++) {
+			last_tx = queue_pop_head(conn->tx_queue);
+			if (last_tx) {
+				timersub(tv, last_tx, &res);
 
-			packet_latency_add(&conn->tx_l, &res);
+				packet_latency_add(&conn->tx_l, &res);
 
-			plot_add(conn->plot, &res, count);
+				plot_add(conn->plot, &res, count);
 
-			free(last_tx);
+				free(last_tx);
+			}
 		}
 	}
 }
-- 
2.41.0




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux