Commit 80909e04 authored by Mat Martineau's avatar Mat Martineau Committed by Johan Hedberg

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: default avatarMat Martineau <mathewm@codeaurora.org>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent 4239d16f
...@@ -1643,17 +1643,14 @@ static void l2cap_monitor_timeout(struct work_struct *work) ...@@ -1643,17 +1643,14 @@ static void l2cap_monitor_timeout(struct work_struct *work)
l2cap_chan_lock(chan); l2cap_chan_lock(chan);
if (chan->retry_count >= chan->remote_max_tx) { if (!chan->conn) {
l2cap_send_disconn_req(chan->conn, chan, ECONNABORTED);
l2cap_chan_unlock(chan); l2cap_chan_unlock(chan);
l2cap_chan_put(chan); l2cap_chan_put(chan);
return; return;
} }
chan->retry_count++; l2cap_tx(chan, 0, 0, L2CAP_EV_MONITOR_TO);
__set_monitor_timer(chan);
l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL);
l2cap_chan_unlock(chan); l2cap_chan_unlock(chan);
l2cap_chan_put(chan); l2cap_chan_put(chan);
} }
...@@ -1667,13 +1664,13 @@ static void l2cap_retrans_timeout(struct work_struct *work) ...@@ -1667,13 +1664,13 @@ static void l2cap_retrans_timeout(struct work_struct *work)
l2cap_chan_lock(chan); l2cap_chan_lock(chan);
chan->retry_count = 1; if (!chan->conn) {
__set_monitor_timer(chan); l2cap_chan_unlock(chan);
l2cap_chan_put(chan);
set_bit(CONN_WAIT_F, &chan->conn_state); return;
}
l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL);
l2cap_tx(chan, 0, 0, L2CAP_EV_RETRANS_TO);
l2cap_chan_unlock(chan); l2cap_chan_unlock(chan);
l2cap_chan_put(chan); l2cap_chan_put(chan);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment