diff options
author | Gustavo F. Padovan <gustavo@las.ic.unicamp.br> | 2009-08-20 21:26:00 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-08-22 17:56:15 -0400 |
commit | e90bac061b17cd81bd0df30606c64f4543bf5ca0 (patch) | |
tree | 3529111fa5ba07bdd8ed9627d10d623f77416ace /include/net/bluetooth | |
parent | 30afb5b2aa83adf4f69e5090d48e1bb04b64c58a (diff) |
Bluetooth: Add support for Retransmission and Monitor Timers
L2CAP uses retransmission and monitor timers to inquiry the other side
about unacked I-frames. After sending each I-frame we (re)start the
retransmission timer. If it expires, we start a monitor timer that send a
S-frame with P bit set and wait for S-frame with F bit set. If monitor
timer expires, try again, at a maximum of L2CAP_DEFAULT_MAX_TX.
Signed-off-by: Gustavo F. Padovan <gustavo@las.ic.unicamp.br>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net/bluetooth')
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 1 | ||||
-rw-r--r-- | include/net/bluetooth/l2cap.h | 15 |
2 files changed, 13 insertions, 3 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 65a5cf868fd6..b8b9a8479525 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -139,6 +139,7 @@ struct bt_skb_cb { | |||
139 | __u8 pkt_type; | 139 | __u8 pkt_type; |
140 | __u8 incoming; | 140 | __u8 incoming; |
141 | __u8 tx_seq; | 141 | __u8 tx_seq; |
142 | __u8 retries; | ||
142 | }; | 143 | }; |
143 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) | 144 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) |
144 | 145 | ||
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index a1d8ec468ef3..2cf7003cb1b6 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -31,9 +31,9 @@ | |||
31 | #define L2CAP_DEFAULT_FLUSH_TO 0xffff | 31 | #define L2CAP_DEFAULT_FLUSH_TO 0xffff |
32 | #define L2CAP_DEFAULT_TX_WINDOW 63 | 32 | #define L2CAP_DEFAULT_TX_WINDOW 63 |
33 | #define L2CAP_DEFAULT_NUM_TO_ACK (L2CAP_DEFAULT_TX_WINDOW/5) | 33 | #define L2CAP_DEFAULT_NUM_TO_ACK (L2CAP_DEFAULT_TX_WINDOW/5) |
34 | #define L2CAP_DEFAULT_MAX_RECEIVE 1 | 34 | #define L2CAP_DEFAULT_MAX_TX 3 |
35 | #define L2CAP_DEFAULT_RETRANS_TO 300 /* 300 milliseconds */ | 35 | #define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */ |
36 | #define L2CAP_DEFAULT_MONITOR_TO 1000 /* 1 second */ | 36 | #define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ |
37 | #define L2CAP_DEFAULT_MAX_PDU_SIZE 672 | 37 | #define L2CAP_DEFAULT_MAX_PDU_SIZE 672 |
38 | 38 | ||
39 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | 39 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ |
@@ -318,6 +318,7 @@ struct l2cap_pinfo { | |||
318 | __u8 req_seq; | 318 | __u8 req_seq; |
319 | __u8 expected_tx_seq; | 319 | __u8 expected_tx_seq; |
320 | __u8 unacked_frames; | 320 | __u8 unacked_frames; |
321 | __u8 retry_count; | ||
321 | __u8 num_to_ack; | 322 | __u8 num_to_ack; |
322 | __u16 sdu_len; | 323 | __u16 sdu_len; |
323 | __u16 partial_sdu_len; | 324 | __u16 partial_sdu_len; |
@@ -333,6 +334,8 @@ struct l2cap_pinfo { | |||
333 | 334 | ||
334 | __le16 sport; | 335 | __le16 sport; |
335 | 336 | ||
337 | struct timer_list retrans_timer; | ||
338 | struct timer_list monitor_timer; | ||
336 | struct sk_buff_head tx_queue; | 339 | struct sk_buff_head tx_queue; |
337 | struct l2cap_conn *conn; | 340 | struct l2cap_conn *conn; |
338 | struct sock *next_c; | 341 | struct sock *next_c; |
@@ -352,6 +355,12 @@ struct l2cap_pinfo { | |||
352 | 355 | ||
353 | #define L2CAP_CONN_SAR_SDU 0x01 | 356 | #define L2CAP_CONN_SAR_SDU 0x01 |
354 | #define L2CAP_CONN_UNDER_REJ 0x02 | 357 | #define L2CAP_CONN_UNDER_REJ 0x02 |
358 | #define L2CAP_CONN_WAIT_F 0x04 | ||
359 | |||
360 | #define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ | ||
361 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); | ||
362 | #define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \ | ||
363 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); | ||
355 | 364 | ||
356 | static inline int l2cap_tx_window_full(struct sock *sk) | 365 | static inline int l2cap_tx_window_full(struct sock *sk) |
357 | { | 366 | { |