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

Commit 6ef82796 authored by Archie Pusaka's avatar Archie Pusaka
Browse files

Revert "L2cap fixed channel tx complete is unused"

This reverts commit 83fbde67.

The assumption in the original CL "L2cap tx completes immediately"
seems to be incorrect.

Bug: 314819704
Bug: 301168932
Test: m -j

Change-Id: I53e208936a9ecde6cad49de0f54baf939e49ce87
parent c590fea5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -735,6 +735,8 @@ typedef struct {
  tL2CA_FIXED_CONGESTION_STATUS_CB* pL2CA_FixedCong_Cb;

  uint16_t default_idle_tout;
  tL2CA_TX_COMPLETE_CB*
      pL2CA_FixedTxComplete_Cb; /* fixed channel tx complete callback */
} tL2CAP_FIXED_CHNL_REG;

/*******************************************************************************
+3 −0
Original line number Diff line number Diff line
@@ -673,6 +673,7 @@ typedef void(tL2C_FCR_MGMT_EVT_HDLR)(uint8_t, tL2C_CCB*);
typedef struct {
  uint16_t local_cid;
  uint16_t num_sdu;
  tL2CA_TX_COMPLETE_CB* cb;
} tL2C_TX_COMPLETE_CB_INFO;

/* The offset in a buffer that L2CAP will use when building commands.
@@ -742,6 +743,8 @@ void l2cu_set_acl_hci_header(BT_HDR* p_buf, tL2C_CCB* p_ccb);
void l2cu_check_channel_congestion(tL2C_CCB* p_ccb);
void l2cu_disconnect_chnl(tL2C_CCB* p_ccb);

void l2cu_tx_complete(tL2C_TX_COMPLETE_CB_INFO* p_cbi);

void l2cu_send_peer_ble_par_req(tL2C_LCB* p_lcb, uint16_t min_int,
                                uint16_t max_int, uint16_t latency,
                                uint16_t timeout);
+4 −0
Original line number Diff line number Diff line
@@ -1017,6 +1017,7 @@ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf,
  } else {
    l2c_link_send_to_lower_ble(p_lcb, p_buf);
  }
  if (p_cbi) l2cu_tx_complete(p_cbi);
}

void l2c_packets_completed(uint16_t handle, uint16_t num_sent) {
@@ -1243,6 +1244,8 @@ BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb,
  /* Highest priority are fixed channels */
  int xx;

  p_cbi->cb = NULL;

  for (xx = 0; xx < L2CAP_NUM_FIXED_CHNLS; xx++) {
    p_ccb = p_lcb->p_fixed_ccbs[xx];
    if (p_ccb == NULL) continue;
@@ -1276,6 +1279,7 @@ BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb,
        }

        /* Prepare callback info for TX completion */
        p_cbi->cb = l2cb.fixed_reg[xx].pL2CA_FixedTxComplete_Cb;
        p_cbi->local_cid = p_ccb->local_cid;
        p_cbi->num_sdu = 1;

+4 −0
Original line number Diff line number Diff line
@@ -3435,6 +3435,10 @@ tL2C_CCB* l2cu_find_ccb_by_cid(tL2C_LCB* p_lcb, uint16_t local_cid) {
  return (p_ccb);
}

void l2cu_tx_complete(tL2C_TX_COMPLETE_CB_INFO* p_cbi) {
  if (p_cbi->cb != NULL) p_cbi->cb(p_cbi->local_cid, p_cbi->num_sdu);
}

/******************************************************************************
 *
 * Function         l2cu_set_acl_hci_header
+12 −0
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@
#include "stack/include/l2c_api.h"
#include "types/raw_address.h"

static void smp_tx_complete_callback(uint16_t cid, uint16_t num_pkt);

static void smp_connect_callback(uint16_t channel, const RawAddress& bd_addr,
                                 bool connected, uint16_t reason,
                                 tBT_TRANSPORT transport);
@@ -61,6 +63,7 @@ void smp_l2cap_if_init(void) {

  fixed_reg.pL2CA_FixedConn_Cb = smp_connect_callback;
  fixed_reg.pL2CA_FixedData_Cb = smp_data_received;
  fixed_reg.pL2CA_FixedTxComplete_Cb = smp_tx_complete_callback;

  fixed_reg.pL2CA_FixedCong_Cb =
      NULL; /* do not handle congestion on this channel */
@@ -208,6 +211,15 @@ static void smp_data_received(uint16_t channel, const RawAddress& bd_addr,
  osi_free(p_buf);
}

/*******************************************************************************
 *
 * Function         smp_tx_complete_callback
 *
 * Description      SMP channel tx complete callback
 *
 ******************************************************************************/
static void smp_tx_complete_callback(uint16_t cid, uint16_t num_pkt) {}

/*******************************************************************************
 *
 * Function         smp_br_connect_callback