aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/l2cap_core.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 3b5238d1dfaa..a397ed7c4707 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2314,17 +2314,30 @@ static inline int l2cap_ertm_init(struct l2cap_chan *chan)
2314{ 2314{
2315 int err; 2315 int err;
2316 2316
2317 chan->next_tx_seq = 0;
2318 chan->expected_tx_seq = 0;
2317 chan->expected_ack_seq = 0; 2319 chan->expected_ack_seq = 0;
2318 chan->unacked_frames = 0; 2320 chan->unacked_frames = 0;
2319 chan->buffer_seq = 0; 2321 chan->buffer_seq = 0;
2320 chan->num_acked = 0; 2322 chan->num_acked = 0;
2321 chan->frames_sent = 0; 2323 chan->frames_sent = 0;
2324 chan->last_acked_seq = 0;
2325 chan->sdu = NULL;
2326 chan->sdu_last_frag = NULL;
2327 chan->sdu_len = 0;
2328
2329 if (chan->mode != L2CAP_MODE_ERTM)
2330 return 0;
2331
2332 chan->rx_state = L2CAP_RX_STATE_RECV;
2333 chan->tx_state = L2CAP_TX_STATE_XMIT;
2322 2334
2323 INIT_DELAYED_WORK(&chan->retrans_timer, l2cap_retrans_timeout); 2335 INIT_DELAYED_WORK(&chan->retrans_timer, l2cap_retrans_timeout);
2324 INIT_DELAYED_WORK(&chan->monitor_timer, l2cap_monitor_timeout); 2336 INIT_DELAYED_WORK(&chan->monitor_timer, l2cap_monitor_timeout);
2325 INIT_DELAYED_WORK(&chan->ack_timer, l2cap_ack_timeout); 2337 INIT_DELAYED_WORK(&chan->ack_timer, l2cap_ack_timeout);
2326 2338
2327 skb_queue_head_init(&chan->srej_q); 2339 skb_queue_head_init(&chan->srej_q);
2340 skb_queue_head_init(&chan->tx_q);
2328 2341
2329 INIT_LIST_HEAD(&chan->srej_l); 2342 INIT_LIST_HEAD(&chan->srej_l);
2330 err = l2cap_seq_list_init(&chan->srej_list, chan->tx_win); 2343 err = l2cap_seq_list_init(&chan->srej_list, chan->tx_win);
@@ -3192,10 +3205,8 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
3192 3205
3193 l2cap_state_change(chan, BT_CONNECTED); 3206 l2cap_state_change(chan, BT_CONNECTED);
3194 3207
3195 chan->next_tx_seq = 0; 3208 if (chan->mode == L2CAP_MODE_ERTM ||
3196 chan->expected_tx_seq = 0; 3209 chan->mode == L2CAP_MODE_STREAMING)
3197 skb_queue_head_init(&chan->tx_q);
3198 if (chan->mode == L2CAP_MODE_ERTM)
3199 err = l2cap_ertm_init(chan); 3210 err = l2cap_ertm_init(chan);
3200 3211
3201 if (err < 0) 3212 if (err < 0)
@@ -3327,10 +3338,8 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
3327 set_default_fcs(chan); 3338 set_default_fcs(chan);
3328 3339
3329 l2cap_state_change(chan, BT_CONNECTED); 3340 l2cap_state_change(chan, BT_CONNECTED);
3330 chan->next_tx_seq = 0; 3341 if (chan->mode == L2CAP_MODE_ERTM ||
3331 chan->expected_tx_seq = 0; 3342 chan->mode == L2CAP_MODE_STREAMING)
3332 skb_queue_head_init(&chan->tx_q);
3333 if (chan->mode == L2CAP_MODE_ERTM)
3334 err = l2cap_ertm_init(chan); 3343 err = l2cap_ertm_init(chan);
3335 3344
3336 if (err < 0) 3345 if (err < 0)