Skip to contentSkip to conversation

Bluetooth: Fix l2cap_tx_window_full

PATCH Superseded Luiz Augusto von Dentz 1 participant 1 message Feb 8, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Fix l2cap_tx_window_full

From: Luiz Augusto von Dentz <[email protected]>

l2cap_tx_window_full is not checking the window limit properly, first it computes based on sequence numbers which doesn't take into account the ReqSeq and always assume 64 not the real window size.

To fix this now it just checks if the number of unacked frames is >= of tx window which is much simpler.

---
 include/net/bluetooth/l2cap.h |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)
include/net/bluetooth/l2cap.h +1 -8
index 42fdbb8..3778c0c 100644
@@ -661,14 +661,7 @@ static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq)
 
 static inline int l2cap_tx_window_full(struct l2cap_chan *ch)
 {
-	int sub;
-
-	sub = (ch->next_tx_seq - ch->expected_ack_seq) % 64;
-
-	if (sub < 0)
-		sub += 64;
-
-	return sub == ch->remote_tx_win;
+	return ch->unacked_frames >= ch->remote_tx_win;
 }
 
 static inline __u16 __get_reqseq(struct l2cap_chan *chan, __u32 ctrl)
Signature · 1 line
1.7.7.6