aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_core.c
diff options
context:
space:
mode:
authorMat Martineau <mathewm@codeaurora.org>2012-05-17 23:53:40 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-04 23:34:03 -0400
commit61aa4f5b9f43b21668aec51da2df3e9ed5f4226d (patch)
treebc0a489cee38fad2be02c8a95b480e666088b9a4 /net/bluetooth/l2cap_core.c
parent0a0aba42b8daba55e4d2bdfc3c8ca7d7d827b723 (diff)
Bluetooth: Use the transmit state machine for busy state changes
This lets the transmit state machine handle local busy state changes, since different actions are taken in the different transmit states. Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/l2cap_core.c')
-rw-r--r--net/bluetooth/l2cap_core.c45
1 files changed, 6 insertions, 39 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index f4d4eafb805d..8436806835e0 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4318,48 +4318,15 @@ static int l2cap_reassemble_sdu(struct l2cap_chan *chan, struct sk_buff *skb,
4318 return err; 4318 return err;
4319} 4319}
4320 4320
4321static void l2cap_ertm_enter_local_busy(struct l2cap_chan *chan) 4321void l2cap_chan_busy(struct l2cap_chan *chan, int busy)
4322{
4323 BT_DBG("chan %p, Enter local busy", chan);
4324
4325 set_bit(CONN_LOCAL_BUSY, &chan->conn_state);
4326 l2cap_seq_list_clear(&chan->srej_list);
4327
4328 __set_ack_timer(chan);
4329}
4330
4331static void l2cap_ertm_exit_local_busy(struct l2cap_chan *chan)
4332{ 4322{
4333 u32 control; 4323 u8 event;
4334
4335 if (!test_bit(CONN_RNR_SENT, &chan->conn_state))
4336 goto done;
4337
4338 control = __set_reqseq(chan, chan->buffer_seq);
4339 control |= __set_ctrl_poll(chan);
4340 control |= __set_ctrl_super(chan, L2CAP_SUPER_RR);
4341 chan->retry_count = 1;
4342
4343 __clear_retrans_timer(chan);
4344 __set_monitor_timer(chan);
4345
4346 set_bit(CONN_WAIT_F, &chan->conn_state);
4347
4348done:
4349 clear_bit(CONN_LOCAL_BUSY, &chan->conn_state);
4350 clear_bit(CONN_RNR_SENT, &chan->conn_state);
4351 4324
4352 BT_DBG("chan %p, Exit local busy", chan); 4325 if (chan->mode != L2CAP_MODE_ERTM)
4353} 4326 return;
4354 4327
4355void l2cap_chan_busy(struct l2cap_chan *chan, int busy) 4328 event = busy ? L2CAP_EV_LOCAL_BUSY_DETECTED : L2CAP_EV_LOCAL_BUSY_CLEAR;
4356{ 4329 l2cap_tx(chan, 0, 0, event);
4357 if (chan->mode == L2CAP_MODE_ERTM) {
4358 if (busy)
4359 l2cap_ertm_enter_local_busy(chan);
4360 else
4361 l2cap_ertm_exit_local_busy(chan);
4362 }
4363} 4330}
4364 4331
4365static u8 l2cap_classify_txseq(struct l2cap_chan *chan, u16 txseq) 4332static u8 l2cap_classify_txseq(struct l2cap_chan *chan, u16 txseq)