Commit 98657a36 authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Matthew Xie
Browse files

LE: Release transmit buffer credits

When an ACL link goes down, some controllers do not send a "number of
completed packets" update for the last ACL packets sent from the host to
the controller. This could result in incorrect L2CAP transmit window
calculations and no transmit credit to be available to send data to the
controller.
This patch restores transmit buffer creedits regardless of the
controller behaviour.
bug 9474159

Change-Id: I2540131034271a0269fa50698f370bceb7747e2d
parent ec7e2c8e
......@@ -136,6 +136,28 @@ void l2cu_release_lcb (tL2C_LCB *p_lcb)
btm_remove_sco_links(p_lcb->remote_bd_addr);
#endif
if (p_lcb->sent_not_acked > 0)
{
#if (BLE_INCLUDED == TRUE)
if (p_lcb->is_ble_link)
{
l2cb.controller_le_xmit_window += p_lcb->sent_not_acked;
if (l2cb.controller_le_xmit_window > l2cb.num_lm_ble_bufs)
{
l2cb.controller_le_xmit_window = l2cb.num_lm_ble_bufs;
}
}
else
#endif
{
l2cb.controller_xmit_window += p_lcb->sent_not_acked;
if (l2cb.controller_xmit_window > l2cb.num_lm_acl_bufs)
{
l2cb.controller_xmit_window = l2cb.num_lm_acl_bufs;
}
}
}
#if (BLE_INCLUDED == TRUE)
p_lcb->is_ble_link = FALSE;
l2cb.is_ble_connecting = FALSE;
......@@ -183,15 +205,6 @@ void l2cu_release_lcb (tL2C_LCB *p_lcb)
if (l2cb.num_links_active >= 1)
l2cb.num_links_active--;
if (p_lcb->sent_not_acked > 0)
{
l2cb.controller_xmit_window += p_lcb->sent_not_acked;
if (l2cb.controller_xmit_window > l2cb.num_lm_acl_bufs)
{
l2cb.controller_xmit_window = l2cb.num_lm_acl_bufs;
}
}
l2c_link_adjust_allocation();
/* Check for ping outstanding */
......
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