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

Commit 10726fd4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "l2cap: Allow user to request less channels than 5"

parents 792d7f32 7dd756a0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -326,6 +326,7 @@ struct eatt_impl {
        .mtu = eatt_dev->rx_mtu_,
        .mps = eatt_dev->rx_mps_,
        .credits = L2CAP_LE_CREDIT_DEFAULT,
        .number_of_channels = L2CAP_CREDIT_BASED_MAX_CIDS,
    };

    /* Warning! CIDs in Android are unique across the ACL connections */
+4 −0
Original line number Diff line number Diff line
@@ -181,6 +181,9 @@ constexpr uint16_t L2CAP_LE_CREDIT_THRESHOLD = 0x0040;
static_assert(L2CAP_LE_CREDIT_THRESHOLD < L2CAP_LE_CREDIT_DEFAULT,
              "Threshold must be smaller than default credits");

// Max number of CIDs in the L2CAP CREDIT BASED CONNECTION REQUEST
constexpr uint16_t L2CAP_CREDIT_BASED_MAX_CIDS = 5;

/* Define a structure to hold the configuration parameter for LE L2CAP
 * connection oriented channels.
 */
@@ -189,6 +192,7 @@ struct tL2CAP_LE_CFG_INFO {
  uint16_t mtu = 100;
  uint16_t mps = 100;
  uint16_t credits = L2CAP_LE_CREDIT_DEFAULT;
  uint8_t number_of_channels = L2CAP_CREDIT_BASED_MAX_CIDS;
};

/*********************************
+7 −1
Original line number Diff line number Diff line
@@ -782,7 +782,13 @@ std::vector<uint16_t> L2CA_ConnectCreditBasedReq(uint16_t psm,

  tL2C_CCB* p_ccb_primary;

  for (int i = 0; i < 5; i++) {
  /* Make sure user set proper value for number of cids */
  if (p_cfg->number_of_channels > L2CAP_CREDIT_BASED_MAX_CIDS ||
      p_cfg->number_of_channels == 0) {
    p_cfg->number_of_channels = L2CAP_CREDIT_BASED_MAX_CIDS;
  }

  for (int i = 0; i < p_cfg->number_of_channels; i++) {
    /* Allocate a channel control block */
    tL2C_CCB* p_ccb = l2cu_allocate_ccb(p_lcb, 0);
    if (p_ccb == NULL) {
+0 −2
Original line number Diff line number Diff line
@@ -397,8 +397,6 @@ typedef struct {
#define L2CAP_GET_PRIORITY_QUOTA(pri) \
  ((L2CAP_NUM_CHNL_PRIORITY - (pri)) * L2CAP_CHNL_PRIORITY_WEIGHT)

#define L2CAP_CREDIT_BASED_MAX_CIDS 5

/* CCBs within the same LCB are served in round robin with priority It will make
 * sure that low priority channel (for example, HF signaling on RFCOMM) can be
 * sent to the headset even if higher priority channel (for example, AV media