summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Ganapathi Batta <ganeshg@broadcom.com>2013-04-16 11:57:07 -0700
committerMatthew Xie <mattx@google.com>2013-04-17 21:07:27 -0700
commitc9053e64bd3383ea971582b4395fab9d5d614503 (patch)
treee7108618c51753c857aa963896a111ed0545b2fc
parent74b826399b0ce0d13e8cea3e44c058495b3d6abc (diff)
downloadbluedroid-c9053e64bd3383ea971582b4395fab9d5d614503.tar.gz
Proper management of controller ACL buffers.
Reclaim all the unacknowledged controller ACL buffers associated with a L2CAP link when L2CAP control block is released. Bug:8589069 Change-Id: Icef1646041e73280a13dedc7a45564d032c59712
-rw-r--r--stack/l2cap/l2c_link.c22
-rw-r--r--stack/l2cap/l2c_utils.c9
2 files changed, 20 insertions, 11 deletions
diff --git a/stack/l2cap/l2c_link.c b/stack/l2cap/l2c_link.c
index 4bb2be7..1974bb2 100644
--- a/stack/l2cap/l2c_link.c
+++ b/stack/l2cap/l2c_link.c
@@ -1394,19 +1394,19 @@ void l2c_link_process_num_completed_pkts (UINT8 *p)
(*p_lcb->p_nocp_cb)(p_lcb->remote_bd_addr);
}
-#if (BLE_INCLUDED == TRUE)
- if (p_lcb && p_lcb->is_ble_link)
- l2cb.controller_le_xmit_window += num_sent;
- else
-#endif
- {
-
- /* Maintain the total window to the controller */
- l2cb.controller_xmit_window += num_sent;
- }
-
if (p_lcb)
{
+#if (BLE_INCLUDED == TRUE)
+ if (p_lcb->is_ble_link)
+ {
+ l2cb.controller_le_xmit_window += num_sent;
+ }
+ else
+#endif
+ {
+ /* Maintain the total window to the controller */
+ l2cb.controller_xmit_window += num_sent;
+ }
/* If doing round-robin, adjust communal counts */
if (p_lcb->link_xmit_quota == 0)
{
diff --git a/stack/l2cap/l2c_utils.c b/stack/l2cap/l2c_utils.c
index c684118..b911db2 100644
--- a/stack/l2cap/l2c_utils.c
+++ b/stack/l2cap/l2c_utils.c
@@ -183,6 +183,15 @@ 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 */