Commit 3b1a9f3f authored by Gustavo F. Padovan's avatar Gustavo F. Padovan Committed by Marcel Holtmann

Bluetooth: Optimize SREJ_QUEUE append

When the I-frame received is the expected, i.e., its tx_seq is equal to
expected_tx_seq and we are under a SREJ, we can just add it to the tail
of the list. Doing that we change the complexity from O(n) to O(1).
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: default avatarJoão Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 812e737e
...@@ -3542,7 +3542,9 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str ...@@ -3542,7 +3542,9 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
pi->expected_tx_seq = (pi->expected_tx_seq + 1) % 64; pi->expected_tx_seq = (pi->expected_tx_seq + 1) % 64;
if (pi->conn_state & L2CAP_CONN_SREJ_SENT) { if (pi->conn_state & L2CAP_CONN_SREJ_SENT) {
l2cap_add_to_srej_queue(sk, skb, tx_seq, sar); bt_cb(skb)->tx_seq = tx_seq;
bt_cb(skb)->sar = sar;
__skb_queue_tail(SREJ_QUEUE(sk), skb);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment