aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMat Martineau <mathewm@codeaurora.org>2012-05-17 23:53:50 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-04 23:34:04 -0400
commit80909e04de4dbbe76a220ccd5f9b32d8d5a8c22c (patch)
treea1a287e9d6250a028e950a0b78f85b2533e29185
parent4239d16f360ce4c8a1798508dd171ebce93985ba (diff)
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>
-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)
1643 1643
1644 l2cap_chan_lock(chan); 1644 l2cap_chan_lock(chan);
1645 1645
1646 if (chan->retry_count >= chan->remote_max_tx) { 1646 if (!chan->conn) {
1647 l2cap_send_disconn_req(chan->conn, chan, ECONNABORTED);
1648 l2cap_chan_unlock(chan); 1647 l2cap_chan_unlock(chan);
1649 l2cap_chan_put(chan); 1648 l2cap_chan_put(chan);
1650 return; 1649 return;
1651 } 1650 }
1652 1651
1653 chan->retry_count++; 1652 l2cap_tx(chan, 0, 0, L2CAP_EV_MONITOR_TO);
1654 __set_monitor_timer(chan);
1655 1653
1656 l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL);
1657 l2cap_chan_unlock(chan); 1654 l2cap_chan_unlock(chan);
1658 l2cap_chan_put(chan); 1655 l2cap_chan_put(chan);
1659} 1656}
@@ -1667,13 +1664,13 @@ static void l2cap_retrans_timeout(struct work_struct *work)
1667 1664
1668 l2cap_chan_lock(chan); 1665 l2cap_chan_lock(chan);
1669 1666
1670 chan->retry_count = 1; 1667 if (!chan->conn) {
1671 __set_monitor_timer(chan); 1668 l2cap_chan_unlock(chan);
1672 1669 l2cap_chan_put(chan);
1673 set_bit(CONN_WAIT_F, &chan->conn_state); 1670 return;
1674 1671 }
1675 l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL);
1676 1672
1673 l2cap_tx(chan, 0, 0, L2CAP_EV_RETRANS_TO);
1677 l2cap_chan_unlock(chan); 1674 l2cap_chan_unlock(chan);
1678 l2cap_chan_put(chan); 1675 l2cap_chan_put(chan);
1679} 1676}