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>
This commit is contained in:

committed by
Marcel Holtmann

parent
30afb5b2aa
commit
e90bac061b
@@ -139,6 +139,7 @@ struct bt_skb_cb {
|
||||
__u8 pkt_type;
|
||||
__u8 incoming;
|
||||
__u8 tx_seq;
|
||||
__u8 retries;
|
||||
};
|
||||
#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
|
||||
|
||||
|
@@ -31,9 +31,9 @@
|
||||
#define L2CAP_DEFAULT_FLUSH_TO 0xffff
|
||||
#define L2CAP_DEFAULT_TX_WINDOW 63
|
||||
#define L2CAP_DEFAULT_NUM_TO_ACK (L2CAP_DEFAULT_TX_WINDOW/5)
|
||||
#define L2CAP_DEFAULT_MAX_RECEIVE 1
|
||||
#define L2CAP_DEFAULT_RETRANS_TO 300 /* 300 milliseconds */
|
||||
#define L2CAP_DEFAULT_MONITOR_TO 1000 /* 1 second */
|
||||
#define L2CAP_DEFAULT_MAX_TX 3
|
||||
#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */
|
||||
#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
|
||||
#define L2CAP_DEFAULT_MAX_PDU_SIZE 672
|
||||
|
||||
#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
|
||||
@@ -318,6 +318,7 @@ struct l2cap_pinfo {
|
||||
__u8 req_seq;
|
||||
__u8 expected_tx_seq;
|
||||
__u8 unacked_frames;
|
||||
__u8 retry_count;
|
||||
__u8 num_to_ack;
|
||||
__u16 sdu_len;
|
||||
__u16 partial_sdu_len;
|
||||
@@ -333,6 +334,8 @@ struct l2cap_pinfo {
|
||||
|
||||
__le16 sport;
|
||||
|
||||
struct timer_list retrans_timer;
|
||||
struct timer_list monitor_timer;
|
||||
struct sk_buff_head tx_queue;
|
||||
struct l2cap_conn *conn;
|
||||
struct sock *next_c;
|
||||
@@ -352,6 +355,12 @@ struct l2cap_pinfo {
|
||||
|
||||
#define L2CAP_CONN_SAR_SDU 0x01
|
||||
#define L2CAP_CONN_UNDER_REJ 0x02
|
||||
#define L2CAP_CONN_WAIT_F 0x04
|
||||
|
||||
#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \
|
||||
jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
|
||||
#define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \
|
||||
jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
|
||||
|
||||
static inline int l2cap_tx_window_full(struct sock *sk)
|
||||
{
|
||||
|
Reference in New Issue
Block a user