From 252caba0021550a4c1a121215b5510c4da4b48a6 Mon Sep 17 00:00:00 2001 From: weichinweng Date: Fri, 2 Aug 2019 16:43:09 +0800 Subject: [PATCH] Distribute ACL buffer only for not BLE device If LE ACL buffer is not zero from controller, will distribute ACL buffer only for not BLE device to avoid assigning wrong quota to each device. For BLE device, will be distribute BLE ACL buffer via l2cap ble layer. If LE ACL buffe is zero from controller, will keep existing logic. Bug: 136799551 Test: 1. Pair BLE and BREDR device, check whether Quota is correct. Change-Id: Idd7079e8da3390fa9f4e42b07774df8928f2bf20 --- stack/l2cap/l2c_link.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stack/l2cap/l2c_link.cc b/stack/l2cap/l2c_link.cc index 8e04c6e98..60e9fd8b9 100644 --- a/stack/l2cap/l2c_link.cc +++ b/stack/l2cap/l2c_link.cc @@ -675,6 +675,8 @@ void l2c_link_adjust_allocation(void) { uint16_t num_hipri_links = 0; uint16_t controller_xmit_quota = l2cb.num_lm_acl_bufs; uint16_t high_pri_link_quota = L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A; + bool is_share_buffer = + (l2cb.num_lm_ble_bufs == L2C_DEF_NUM_BLE_BUF_SHARED) ? true : false; /* If no links active, reset buffer quotas and controller buffers */ if (l2cb.num_links_active == 0) { @@ -685,7 +687,8 @@ void l2c_link_adjust_allocation(void) { /* First, count the links */ for (yy = 0, p_lcb = &l2cb.lcb_pool[0]; yy < MAX_L2CAP_LINKS; yy++, p_lcb++) { - if (p_lcb->in_use) { + if (p_lcb->in_use && + (is_share_buffer || p_lcb->transport != BT_TRANSPORT_LE)) { if (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH) num_hipri_links++; else @@ -732,7 +735,8 @@ void l2c_link_adjust_allocation(void) { /* Now, assign the quotas to each link */ for (yy = 0, p_lcb = &l2cb.lcb_pool[0]; yy < MAX_L2CAP_LINKS; yy++, p_lcb++) { - if (p_lcb->in_use) { + if (p_lcb->in_use && + (is_share_buffer || p_lcb->transport != BT_TRANSPORT_LE)) { if (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH) { p_lcb->link_xmit_quota = high_pri_link_quota; } else { -- 2.11.0