diff options
| -rw-r--r-- | include/net/bluetooth/l2cap.h | 15 | ||||
| -rw-r--r-- | net/bluetooth/l2cap_core.c | 44 |
2 files changed, 31 insertions, 28 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 7aaf7f78ddb1..c284be027d9f 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
| @@ -441,12 +441,15 @@ struct l2cap_pinfo { | |||
| 441 | 441 | ||
| 442 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) | 442 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) |
| 443 | #define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) | 443 | #define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) |
| 444 | #define __mod_retrans_timer() mod_timer(&chan->retrans_timer, \ | 444 | #define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ |
| 445 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); | 445 | L2CAP_DEFAULT_RETRANS_TO); |
| 446 | #define __mod_monitor_timer() mod_timer(&chan->monitor_timer, \ | 446 | #define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer) |
| 447 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); | 447 | #define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \ |
| 448 | #define __mod_ack_timer() mod_timer(&chan->ack_timer, \ | 448 | L2CAP_DEFAULT_MONITOR_TO); |
| 449 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); | 449 | #define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer) |
| 450 | #define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ | ||
| 451 | L2CAP_DEFAULT_ACK_TO); | ||
| 452 | #define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) | ||
| 450 | 453 | ||
| 451 | static inline int l2cap_tx_window_full(struct l2cap_chan *ch) | 454 | static inline int l2cap_tx_window_full(struct l2cap_chan *ch) |
| 452 | { | 455 | { |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 5076976960eb..3b31a1f1f020 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
| @@ -389,9 +389,9 @@ static void l2cap_chan_del(struct l2cap_chan *chan, int err) | |||
| 389 | if (chan->mode == L2CAP_MODE_ERTM) { | 389 | if (chan->mode == L2CAP_MODE_ERTM) { |
| 390 | struct srej_list *l, *tmp; | 390 | struct srej_list *l, *tmp; |
| 391 | 391 | ||
| 392 | del_timer(&chan->retrans_timer); | 392 | __clear_retrans_timer(chan); |
| 393 | del_timer(&chan->monitor_timer); | 393 | __clear_monitor_timer(chan); |
| 394 | del_timer(&chan->ack_timer); | 394 | __clear_ack_timer(chan); |
| 395 | 395 | ||
| 396 | skb_queue_purge(&chan->srej_q); | 396 | skb_queue_purge(&chan->srej_q); |
| 397 | skb_queue_purge(&chan->busy_q); | 397 | skb_queue_purge(&chan->busy_q); |
| @@ -697,9 +697,9 @@ static void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *c | |||
| 697 | sk = chan->sk; | 697 | sk = chan->sk; |
| 698 | 698 | ||
| 699 | if (chan->mode == L2CAP_MODE_ERTM) { | 699 | if (chan->mode == L2CAP_MODE_ERTM) { |
| 700 | del_timer(&chan->retrans_timer); | 700 | __clear_retrans_timer(chan); |
| 701 | del_timer(&chan->monitor_timer); | 701 | __clear_monitor_timer(chan); |
| 702 | del_timer(&chan->ack_timer); | 702 | __clear_ack_timer(chan); |
| 703 | } | 703 | } |
| 704 | 704 | ||
| 705 | req.dcid = cpu_to_le16(chan->dcid); | 705 | req.dcid = cpu_to_le16(chan->dcid); |
| @@ -1177,7 +1177,7 @@ static void l2cap_monitor_timeout(unsigned long arg) | |||
| 1177 | } | 1177 | } |
| 1178 | 1178 | ||
| 1179 | chan->retry_count++; | 1179 | chan->retry_count++; |
| 1180 | __mod_monitor_timer(); | 1180 | __set_monitor_timer(chan); |
| 1181 | 1181 | ||
| 1182 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); | 1182 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); |
| 1183 | bh_unlock_sock(sk); | 1183 | bh_unlock_sock(sk); |
| @@ -1192,7 +1192,7 @@ static void l2cap_retrans_timeout(unsigned long arg) | |||
| 1192 | 1192 | ||
| 1193 | bh_lock_sock(sk); | 1193 | bh_lock_sock(sk); |
| 1194 | chan->retry_count = 1; | 1194 | chan->retry_count = 1; |
| 1195 | __mod_monitor_timer(); | 1195 | __set_monitor_timer(chan); |
| 1196 | 1196 | ||
| 1197 | chan->conn_state |= L2CAP_CONN_WAIT_F; | 1197 | chan->conn_state |= L2CAP_CONN_WAIT_F; |
| 1198 | 1198 | ||
| @@ -1216,7 +1216,7 @@ static void l2cap_drop_acked_frames(struct l2cap_chan *chan) | |||
| 1216 | } | 1216 | } |
| 1217 | 1217 | ||
| 1218 | if (!chan->unacked_frames) | 1218 | if (!chan->unacked_frames) |
| 1219 | del_timer(&chan->retrans_timer); | 1219 | __clear_retrans_timer(chan); |
| 1220 | } | 1220 | } |
| 1221 | 1221 | ||
| 1222 | void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb) | 1222 | void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb) |
| @@ -1343,7 +1343,7 @@ int l2cap_ertm_send(struct l2cap_chan *chan) | |||
| 1343 | 1343 | ||
| 1344 | l2cap_do_send(chan, tx_skb); | 1344 | l2cap_do_send(chan, tx_skb); |
| 1345 | 1345 | ||
| 1346 | __mod_retrans_timer(); | 1346 | __set_retrans_timer(chan); |
| 1347 | 1347 | ||
| 1348 | bt_cb(skb)->tx_seq = chan->next_tx_seq; | 1348 | bt_cb(skb)->tx_seq = chan->next_tx_seq; |
| 1349 | chan->next_tx_seq = (chan->next_tx_seq + 1) % 64; | 1349 | chan->next_tx_seq = (chan->next_tx_seq + 1) % 64; |
| @@ -3260,8 +3260,8 @@ static int l2cap_try_push_rx_skb(struct l2cap_chan *chan) | |||
| 3260 | l2cap_send_sframe(chan, control); | 3260 | l2cap_send_sframe(chan, control); |
| 3261 | chan->retry_count = 1; | 3261 | chan->retry_count = 1; |
| 3262 | 3262 | ||
| 3263 | del_timer(&chan->retrans_timer); | 3263 | __clear_retrans_timer(chan); |
| 3264 | __mod_monitor_timer(); | 3264 | __set_monitor_timer(chan); |
| 3265 | 3265 | ||
| 3266 | chan->conn_state |= L2CAP_CONN_WAIT_F; | 3266 | chan->conn_state |= L2CAP_CONN_WAIT_F; |
| 3267 | 3267 | ||
| @@ -3352,7 +3352,7 @@ static int l2cap_push_rx_skb(struct l2cap_chan *chan, struct sk_buff *skb, u16 c | |||
| 3352 | 3352 | ||
| 3353 | chan->conn_state |= L2CAP_CONN_RNR_SENT; | 3353 | chan->conn_state |= L2CAP_CONN_RNR_SENT; |
| 3354 | 3354 | ||
| 3355 | del_timer(&chan->ack_timer); | 3355 | __clear_ack_timer(chan); |
| 3356 | 3356 | ||
| 3357 | queue_work(_busy_wq, &chan->busy_work); | 3357 | queue_work(_busy_wq, &chan->busy_work); |
| 3358 | 3358 | ||
| @@ -3521,9 +3521,9 @@ static inline int l2cap_data_channel_iframe(struct l2cap_chan *chan, u16 rx_cont | |||
| 3521 | 3521 | ||
| 3522 | if (L2CAP_CTRL_FINAL & rx_control && | 3522 | if (L2CAP_CTRL_FINAL & rx_control && |
| 3523 | chan->conn_state & L2CAP_CONN_WAIT_F) { | 3523 | chan->conn_state & L2CAP_CONN_WAIT_F) { |
| 3524 | del_timer(&chan->monitor_timer); | 3524 | __clear_monitor_timer(chan); |
| 3525 | if (chan->unacked_frames > 0) | 3525 | if (chan->unacked_frames > 0) |
| 3526 | __mod_retrans_timer(); | 3526 | __set_retrans_timer(chan); |
| 3527 | chan->conn_state &= ~L2CAP_CONN_WAIT_F; | 3527 | chan->conn_state &= ~L2CAP_CONN_WAIT_F; |
| 3528 | } | 3528 | } |
| 3529 | 3529 | ||
| @@ -3604,7 +3604,7 @@ static inline int l2cap_data_channel_iframe(struct l2cap_chan *chan, u16 rx_cont | |||
| 3604 | 3604 | ||
| 3605 | l2cap_send_srejframe(chan, tx_seq); | 3605 | l2cap_send_srejframe(chan, tx_seq); |
| 3606 | 3606 | ||
| 3607 | del_timer(&chan->ack_timer); | 3607 | __clear_ack_timer(chan); |
| 3608 | } | 3608 | } |
| 3609 | return 0; | 3609 | return 0; |
| 3610 | 3610 | ||
| @@ -3629,7 +3629,7 @@ expected: | |||
| 3629 | l2cap_retransmit_frames(chan); | 3629 | l2cap_retransmit_frames(chan); |
| 3630 | } | 3630 | } |
| 3631 | 3631 | ||
| 3632 | __mod_ack_timer(); | 3632 | __set_ack_timer(chan); |
| 3633 | 3633 | ||
| 3634 | chan->num_acked = (chan->num_acked + 1) % num_to_ack; | 3634 | chan->num_acked = (chan->num_acked + 1) % num_to_ack; |
| 3635 | if (chan->num_acked == num_to_ack - 1) | 3635 | if (chan->num_acked == num_to_ack - 1) |
| @@ -3655,7 +3655,7 @@ static inline void l2cap_data_channel_rrframe(struct l2cap_chan *chan, u16 rx_co | |||
| 3655 | if (chan->conn_state & L2CAP_CONN_SREJ_SENT) { | 3655 | if (chan->conn_state & L2CAP_CONN_SREJ_SENT) { |
| 3656 | if ((chan->conn_state & L2CAP_CONN_REMOTE_BUSY) && | 3656 | if ((chan->conn_state & L2CAP_CONN_REMOTE_BUSY) && |
| 3657 | (chan->unacked_frames > 0)) | 3657 | (chan->unacked_frames > 0)) |
| 3658 | __mod_retrans_timer(); | 3658 | __set_retrans_timer(chan); |
| 3659 | 3659 | ||
| 3660 | chan->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; | 3660 | chan->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; |
| 3661 | l2cap_send_srejtail(chan); | 3661 | l2cap_send_srejtail(chan); |
| @@ -3674,7 +3674,7 @@ static inline void l2cap_data_channel_rrframe(struct l2cap_chan *chan, u16 rx_co | |||
| 3674 | } else { | 3674 | } else { |
| 3675 | if ((chan->conn_state & L2CAP_CONN_REMOTE_BUSY) && | 3675 | if ((chan->conn_state & L2CAP_CONN_REMOTE_BUSY) && |
| 3676 | (chan->unacked_frames > 0)) | 3676 | (chan->unacked_frames > 0)) |
| 3677 | __mod_retrans_timer(); | 3677 | __set_retrans_timer(chan); |
| 3678 | 3678 | ||
| 3679 | chan->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; | 3679 | chan->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; |
| 3680 | if (chan->conn_state & L2CAP_CONN_SREJ_SENT) | 3680 | if (chan->conn_state & L2CAP_CONN_SREJ_SENT) |
| @@ -3757,7 +3757,7 @@ static inline void l2cap_data_channel_rnrframe(struct l2cap_chan *chan, u16 rx_c | |||
| 3757 | chan->conn_state |= L2CAP_CONN_SEND_FBIT; | 3757 | chan->conn_state |= L2CAP_CONN_SEND_FBIT; |
| 3758 | 3758 | ||
| 3759 | if (!(chan->conn_state & L2CAP_CONN_SREJ_SENT)) { | 3759 | if (!(chan->conn_state & L2CAP_CONN_SREJ_SENT)) { |
| 3760 | del_timer(&chan->retrans_timer); | 3760 | __clear_retrans_timer(chan); |
| 3761 | if (rx_control & L2CAP_CTRL_POLL) | 3761 | if (rx_control & L2CAP_CTRL_POLL) |
| 3762 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_FINAL); | 3762 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_FINAL); |
| 3763 | return; | 3763 | return; |
| @@ -3775,9 +3775,9 @@ static inline int l2cap_data_channel_sframe(struct l2cap_chan *chan, u16 rx_cont | |||
| 3775 | 3775 | ||
| 3776 | if (L2CAP_CTRL_FINAL & rx_control && | 3776 | if (L2CAP_CTRL_FINAL & rx_control && |
| 3777 | chan->conn_state & L2CAP_CONN_WAIT_F) { | 3777 | chan->conn_state & L2CAP_CONN_WAIT_F) { |
| 3778 | del_timer(&chan->monitor_timer); | 3778 | __clear_monitor_timer(chan); |
| 3779 | if (chan->unacked_frames > 0) | 3779 | if (chan->unacked_frames > 0) |
| 3780 | __mod_retrans_timer(); | 3780 | __set_retrans_timer(chan); |
| 3781 | chan->conn_state &= ~L2CAP_CONN_WAIT_F; | 3781 | chan->conn_state &= ~L2CAP_CONN_WAIT_F; |
| 3782 | } | 3782 | } |
| 3783 | 3783 | ||
