Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 131fa6fb authored by weichinweng's avatar weichinweng
Browse files

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
Merged-In: Idd7079e8da3390fa9f4e42b07774df8928f2bf20
parent 9e83b7ac
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -675,6 +675,8 @@ void l2c_link_adjust_allocation(void) {
  uint16_t num_hipri_links = 0;
  uint16_t num_hipri_links = 0;
  uint16_t controller_xmit_quota = l2cb.num_lm_acl_bufs;
  uint16_t controller_xmit_quota = l2cb.num_lm_acl_bufs;
  uint16_t high_pri_link_quota = L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A;
  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 no links active, reset buffer quotas and controller buffers */
  if (l2cb.num_links_active == 0) {
  if (l2cb.num_links_active == 0) {
@@ -685,7 +687,8 @@ void l2c_link_adjust_allocation(void) {


  /* First, count the links */
  /* First, count the links */
  for (yy = 0, p_lcb = &l2cb.lcb_pool[0]; yy < MAX_L2CAP_LINKS; yy++, p_lcb++) {
  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)
      if (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH)
        num_hipri_links++;
        num_hipri_links++;
      else
      else
@@ -732,7 +735,8 @@ void l2c_link_adjust_allocation(void) {


  /* Now, assign the quotas to each link */
  /* Now, assign the quotas to each link */
  for (yy = 0, p_lcb = &l2cb.lcb_pool[0]; yy < MAX_L2CAP_LINKS; yy++, p_lcb++) {
  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) {
      if (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH) {
        p_lcb->link_xmit_quota = high_pri_link_quota;
        p_lcb->link_xmit_quota = high_pri_link_quota;
      } else {
      } else {