Commit 803020c6 authored by Gustavo F. Padovan's avatar Gustavo F. Padovan Committed by Marcel Holtmann

Bluetooth: Change acknowledgement to use the value of txWindow

Now that we can set the txWindow we need to change the acknowledgement
procedure to ack after each (pi->txWindow/6 + 1). The plus 1 is to avoid
the zero value.
It also renames pi->num_to_ack to a better name: pi->num_acked.
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 14b5aa71
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#define L2CAP_DEFAULT_MIN_MTU 48 #define L2CAP_DEFAULT_MIN_MTU 48
#define L2CAP_DEFAULT_FLUSH_TO 0xffff #define L2CAP_DEFAULT_FLUSH_TO 0xffff
#define L2CAP_DEFAULT_TX_WINDOW 63 #define L2CAP_DEFAULT_TX_WINDOW 63
#define L2CAP_DEFAULT_NUM_TO_ACK (L2CAP_DEFAULT_TX_WINDOW/5)
#define L2CAP_DEFAULT_MAX_TX 3 #define L2CAP_DEFAULT_MAX_TX 3
#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */ #define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */
#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ #define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
...@@ -333,7 +332,7 @@ struct l2cap_pinfo { ...@@ -333,7 +332,7 @@ struct l2cap_pinfo {
__u8 frames_sent; __u8 frames_sent;
__u8 unacked_frames; __u8 unacked_frames;
__u8 retry_count; __u8 retry_count;
__u8 num_to_ack; __u8 num_acked;
__u16 sdu_len; __u16 sdu_len;
__u16 partial_sdu_len; __u16 partial_sdu_len;
struct sk_buff *sdu; struct sk_buff *sdu;
......
...@@ -2254,7 +2254,7 @@ static inline void l2cap_ertm_init(struct sock *sk) ...@@ -2254,7 +2254,7 @@ static inline void l2cap_ertm_init(struct sock *sk)
l2cap_pi(sk)->expected_ack_seq = 0; l2cap_pi(sk)->expected_ack_seq = 0;
l2cap_pi(sk)->unacked_frames = 0; l2cap_pi(sk)->unacked_frames = 0;
l2cap_pi(sk)->buffer_seq = 0; l2cap_pi(sk)->buffer_seq = 0;
l2cap_pi(sk)->num_to_ack = 0; l2cap_pi(sk)->num_acked = 0;
l2cap_pi(sk)->frames_sent = 0; l2cap_pi(sk)->frames_sent = 0;
setup_timer(&l2cap_pi(sk)->retrans_timer, setup_timer(&l2cap_pi(sk)->retrans_timer,
...@@ -3466,6 +3466,7 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str ...@@ -3466,6 +3466,7 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
u8 tx_seq = __get_txseq(rx_control); u8 tx_seq = __get_txseq(rx_control);
u8 req_seq = __get_reqseq(rx_control); u8 req_seq = __get_reqseq(rx_control);
u8 sar = rx_control >> L2CAP_CTRL_SAR_SHIFT; u8 sar = rx_control >> L2CAP_CTRL_SAR_SHIFT;
int num_to_ack = (pi->tx_win/6) + 1;
int err = 0; int err = 0;
BT_DBG("sk %p rx_control 0x%4.4x len %d", sk, rx_control, skb->len); BT_DBG("sk %p rx_control 0x%4.4x len %d", sk, rx_control, skb->len);
...@@ -3553,8 +3554,8 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str ...@@ -3553,8 +3554,8 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
__mod_ack_timer(); __mod_ack_timer();
pi->num_to_ack = (pi->num_to_ack + 1) % L2CAP_DEFAULT_NUM_TO_ACK; pi->num_acked = (pi->num_acked + 1) % num_to_ack;
if (pi->num_to_ack == L2CAP_DEFAULT_NUM_TO_ACK - 1) if (pi->num_acked == num_to_ack - 1)
l2cap_send_ack(pi); l2cap_send_ack(pi);
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