summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_core.c
diff options
context:
space:
mode:
authorMat Martineau2012-05-18 05:53:50 +0200
committerJohan Hedberg2012-06-05 05:34:04 +0200
commit80909e04de4dbbe76a220ccd5f9b32d8d5a8c22c (patch)
treea1a287e9d6250a028e950a0b78f85b2533e29185 /net/bluetooth/l2cap_core.c
parentBluetooth: Check rules when setting retransmit or monitor timers (diff)
downloadkernel-qcow2-linux-80909e04de4dbbe76a220ccd5f9b32d8d5a8c22c.tar.gz
kernel-qcow2-linux-80909e04de4dbbe76a220ccd5f9b32d8d5a8c22c.tar.xz
kernel-qcow2-linux-80909e04de4dbbe76a220ccd5f9b32d8d5a8c22c.zip
Bluetooth: Use the ERTM transmit state machine from timeout handlers
Different states have different actions for retransmit and monitor timeouts, so remove the logic for those actions from the timer handlers. 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.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 38e9a0ea4f48..3c5ae0e4c569 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1643,17 +1643,14 @@ static void l2cap_monitor_timeout(struct work_struct *work)
l2cap_chan_lock(chan);
- if (chan->retry_count >= chan->remote_max_tx) {
- l2cap_send_disconn_req(chan->conn, chan, ECONNABORTED);
+ if (!chan->conn) {
l2cap_chan_unlock(chan);
l2cap_chan_put(chan);
return;
}
- chan->retry_count++;
- __set_monitor_timer(chan);
+ l2cap_tx(chan, 0, 0, L2CAP_EV_MONITOR_TO);
- l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL);
l2cap_chan_unlock(chan);
l2cap_chan_put(chan);
}
@@ -1667,13 +1664,13 @@ static void l2cap_retrans_timeout(struct work_struct *work)
l2cap_chan_lock(chan);
- chan->retry_count = 1;
- __set_monitor_timer(chan);
-
- set_bit(CONN_WAIT_F, &chan->conn_state);
-
- l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL);
+ if (!chan->conn) {
+ l2cap_chan_unlock(chan);
+ l2cap_chan_put(chan);
+ return;
+ }
+ l2cap_tx(chan, 0, 0, L2CAP_EV_RETRANS_TO);
l2cap_chan_unlock(chan);
l2cap_chan_put(chan);
}