Bluetooth: Optimize SREJ_QUEUE append
authorGustavo F. Padovan <padovan@profusion.mobi>
Sat, 1 May 2010 19:15:42 +0000 (16:15 -0300)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 10 May 2010 07:28:50 +0000 (09:28 +0200)
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: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/l2cap.c

index 042fd967e79c2352771ec6e18e042e05cdcfbfc3..187f46dd830981e9135e298fe0640c8f08a8affe 100644 (file)
@@ -3542,7 +3542,9 @@ expected:
        pi->expected_tx_seq = (pi->expected_tx_seq + 1) % 64;
 
        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;
        }