Loading system/stack/l2cap/l2c_int.h +0 −4 Original line number Diff line number Diff line Loading @@ -620,9 +620,6 @@ typedef struct { uint16_t num_lm_acl_bufs; /* # of ACL buffers on controller */ uint16_t idle_timeout; /* Idle timeout */ list_t* rcv_pending_q; /* Recv pending queue */ alarm_t* receive_hold_timer; /* Timer entry for rcv hold */ tL2C_LCB* p_cur_hcit_lcb; /* Current HCI Transport buffer */ uint16_t num_used_lcbs; /* Number of active link control blocks */ Loading Loading @@ -706,7 +703,6 @@ extern void l2c_ccb_timer_timeout(void* data); extern void l2c_lcb_timer_timeout(void* data); extern void l2c_fcrb_ack_timer_timeout(void* data); extern uint8_t l2c_data_write(uint16_t cid, BT_HDR* p_data, uint16_t flag); extern void l2c_process_held_packets(bool timed_out); extern tL2C_LCB* l2cu_allocate_lcb(const RawAddress& p_bd_addr, bool is_bonding, tBT_TRANSPORT transport); Loading system/stack/l2cap/l2c_link.cc +0 −3 Original line number Diff line number Diff line Loading @@ -197,9 +197,6 @@ void l2c_link_hci_conn_comp(tHCI_STATUS status, uint16_t handle, if (l2cu_start_post_bond_timer(handle)) return; } /* Update the timeouts in the hold queue */ l2c_process_held_packets(false); alarm_cancel(p_lcb->l2c_lcb_timer); /* For all channels, send the event through their FSMs */ Loading system/stack/l2cap/l2c_main.cc +3 −93 Original line number Diff line number Diff line Loading @@ -91,48 +91,11 @@ void l2c_rcv_acl_data(BT_HDR* p_msg) { /* Find the LCB based on the handle */ tL2C_LCB* p_lcb = l2cu_find_lcb_by_handle(handle); if (!p_lcb) { /* There is a slight possibility (specifically with USB) that we get an */ /* L2CAP connection request before we get the HCI connection complete. */ /* So for these types of messages, hold them for up to 2 seconds. */ if (l2cap_len == 0) { L2CAP_TRACE_WARNING("received empty L2CAP packet"); LOG_ERROR("L2CAP - rcvd ACL for unknown handle:%d ls:%d cid:%d", handle, p_msg->layer_specific, rcv_cid); osi_free(p_msg); return; } uint8_t cmd_code; STREAM_TO_UINT8(cmd_code, p); if ((p_msg->layer_specific != 0) || (rcv_cid != L2CAP_SIGNALLING_CID) || (cmd_code != L2CAP_CMD_INFO_REQ && cmd_code != L2CAP_CMD_CONN_REQ)) { bool qcom_debug_log = (handle == 3804 && ((rcv_cid & 0xff) == 0xff) && p_msg->layer_specific == 0); if (!qcom_debug_log) { L2CAP_TRACE_ERROR( "L2CAP - rcvd ACL for unknown handle:%d ls:%d cid:%d opcode:%d cur " "count:%d", handle, p_msg->layer_specific, rcv_cid, cmd_code, list_length(l2cb.rcv_pending_q)); } osi_free(p_msg); return; } L2CAP_TRACE_WARNING( "L2CAP - holding ACL for unknown handle:%d ls:%d cid:%d opcode:%d cur " "count:%d", handle, p_msg->layer_specific, rcv_cid, cmd_code, list_length(l2cb.rcv_pending_q)); p_msg->layer_specific = 2; list_append(l2cb.rcv_pending_q, p_msg); if (list_length(l2cb.rcv_pending_q) == 1) { alarm_set_on_mloop(l2cb.receive_hold_timer, BT_1SEC_TIMEOUT_MS, l2c_receive_hold_timer_timeout, NULL); } return; } /* Update the buffer header */ p_msg->offset += 4; Loading Loading @@ -844,46 +807,6 @@ static void process_l2cap_cmd(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) { } } /******************************************************************************* * * Function l2c_process_held_packets * * Description This function processes any L2CAP packets that arrived * before the HCI connection complete arrived. It is a work * around for badly behaved controllers. * * Returns void * ******************************************************************************/ void l2c_process_held_packets(bool timed_out) { if (list_is_empty(l2cb.rcv_pending_q)) return; if (!timed_out) { alarm_cancel(l2cb.receive_hold_timer); L2CAP_TRACE_WARNING("L2CAP HOLD CONTINUE"); } else { L2CAP_TRACE_WARNING("L2CAP HOLD TIMEOUT"); } for (const list_node_t* node = list_begin(l2cb.rcv_pending_q); node != list_end(l2cb.rcv_pending_q);) { BT_HDR* p_buf = static_cast<BT_HDR*>(list_node(node)); node = list_next(node); if (!timed_out || (!p_buf->layer_specific) || (--p_buf->layer_specific == 0)) { list_remove(l2cb.rcv_pending_q, p_buf); p_buf->layer_specific = 0xFFFF; l2c_rcv_acl_data(p_buf); } } /* If anyone still in the queue, restart the timeout */ if (!list_is_empty(l2cb.rcv_pending_q)) { alarm_set_on_mloop(l2cb.receive_hold_timer, BT_1SEC_TIMEOUT_MS, l2c_receive_hold_timer_timeout, NULL); } } /******************************************************************************* * * Function l2c_init Loading Loading @@ -937,11 +860,6 @@ void l2c_init(void) { l2cb.l2c_ble_fixed_chnls_mask = L2CAP_FIXED_CHNL_ATT_BIT | L2CAP_FIXED_CHNL_BLE_SIG_BIT | L2CAP_FIXED_CHNL_SMP_BIT; l2cb.rcv_pending_q = list_new(NULL); CHECK(l2cb.rcv_pending_q != NULL); l2cb.receive_hold_timer = alarm_new("l2c.receive_hold_timer"); } void l2c_free(void) { Loading @@ -949,14 +867,6 @@ void l2c_free(void) { // L2CAP cleanup should be handled by GD stack manager return; } list_free(l2cb.rcv_pending_q); l2cb.rcv_pending_q = NULL; } void l2c_receive_hold_timer_timeout(UNUSED_ATTR void* data) { /* Update the timeouts in the hold queue */ l2c_process_held_packets(true); } void l2c_ccb_timer_timeout(void* data) { Loading system/test/mock/mock_stack_l2cap_main.cc +0 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ void l2c_fcrb_ack_timer_timeout(void* data) { inc_func_call_count(__func__); } void l2c_free(void) { inc_func_call_count(__func__); } void l2c_init(void) { inc_func_call_count(__func__); } void l2c_lcb_timer_timeout(void* data) { inc_func_call_count(__func__); } void l2c_process_held_packets(bool timed_out) { inc_func_call_count(__func__); } void l2c_rcv_acl_data(BT_HDR* p_msg) { inc_func_call_count(__func__); } void l2c_receive_hold_timer_timeout(UNUSED_ATTR void* data) { inc_func_call_count(__func__); Loading Loading
system/stack/l2cap/l2c_int.h +0 −4 Original line number Diff line number Diff line Loading @@ -620,9 +620,6 @@ typedef struct { uint16_t num_lm_acl_bufs; /* # of ACL buffers on controller */ uint16_t idle_timeout; /* Idle timeout */ list_t* rcv_pending_q; /* Recv pending queue */ alarm_t* receive_hold_timer; /* Timer entry for rcv hold */ tL2C_LCB* p_cur_hcit_lcb; /* Current HCI Transport buffer */ uint16_t num_used_lcbs; /* Number of active link control blocks */ Loading Loading @@ -706,7 +703,6 @@ extern void l2c_ccb_timer_timeout(void* data); extern void l2c_lcb_timer_timeout(void* data); extern void l2c_fcrb_ack_timer_timeout(void* data); extern uint8_t l2c_data_write(uint16_t cid, BT_HDR* p_data, uint16_t flag); extern void l2c_process_held_packets(bool timed_out); extern tL2C_LCB* l2cu_allocate_lcb(const RawAddress& p_bd_addr, bool is_bonding, tBT_TRANSPORT transport); Loading
system/stack/l2cap/l2c_link.cc +0 −3 Original line number Diff line number Diff line Loading @@ -197,9 +197,6 @@ void l2c_link_hci_conn_comp(tHCI_STATUS status, uint16_t handle, if (l2cu_start_post_bond_timer(handle)) return; } /* Update the timeouts in the hold queue */ l2c_process_held_packets(false); alarm_cancel(p_lcb->l2c_lcb_timer); /* For all channels, send the event through their FSMs */ Loading
system/stack/l2cap/l2c_main.cc +3 −93 Original line number Diff line number Diff line Loading @@ -91,48 +91,11 @@ void l2c_rcv_acl_data(BT_HDR* p_msg) { /* Find the LCB based on the handle */ tL2C_LCB* p_lcb = l2cu_find_lcb_by_handle(handle); if (!p_lcb) { /* There is a slight possibility (specifically with USB) that we get an */ /* L2CAP connection request before we get the HCI connection complete. */ /* So for these types of messages, hold them for up to 2 seconds. */ if (l2cap_len == 0) { L2CAP_TRACE_WARNING("received empty L2CAP packet"); LOG_ERROR("L2CAP - rcvd ACL for unknown handle:%d ls:%d cid:%d", handle, p_msg->layer_specific, rcv_cid); osi_free(p_msg); return; } uint8_t cmd_code; STREAM_TO_UINT8(cmd_code, p); if ((p_msg->layer_specific != 0) || (rcv_cid != L2CAP_SIGNALLING_CID) || (cmd_code != L2CAP_CMD_INFO_REQ && cmd_code != L2CAP_CMD_CONN_REQ)) { bool qcom_debug_log = (handle == 3804 && ((rcv_cid & 0xff) == 0xff) && p_msg->layer_specific == 0); if (!qcom_debug_log) { L2CAP_TRACE_ERROR( "L2CAP - rcvd ACL for unknown handle:%d ls:%d cid:%d opcode:%d cur " "count:%d", handle, p_msg->layer_specific, rcv_cid, cmd_code, list_length(l2cb.rcv_pending_q)); } osi_free(p_msg); return; } L2CAP_TRACE_WARNING( "L2CAP - holding ACL for unknown handle:%d ls:%d cid:%d opcode:%d cur " "count:%d", handle, p_msg->layer_specific, rcv_cid, cmd_code, list_length(l2cb.rcv_pending_q)); p_msg->layer_specific = 2; list_append(l2cb.rcv_pending_q, p_msg); if (list_length(l2cb.rcv_pending_q) == 1) { alarm_set_on_mloop(l2cb.receive_hold_timer, BT_1SEC_TIMEOUT_MS, l2c_receive_hold_timer_timeout, NULL); } return; } /* Update the buffer header */ p_msg->offset += 4; Loading Loading @@ -844,46 +807,6 @@ static void process_l2cap_cmd(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) { } } /******************************************************************************* * * Function l2c_process_held_packets * * Description This function processes any L2CAP packets that arrived * before the HCI connection complete arrived. It is a work * around for badly behaved controllers. * * Returns void * ******************************************************************************/ void l2c_process_held_packets(bool timed_out) { if (list_is_empty(l2cb.rcv_pending_q)) return; if (!timed_out) { alarm_cancel(l2cb.receive_hold_timer); L2CAP_TRACE_WARNING("L2CAP HOLD CONTINUE"); } else { L2CAP_TRACE_WARNING("L2CAP HOLD TIMEOUT"); } for (const list_node_t* node = list_begin(l2cb.rcv_pending_q); node != list_end(l2cb.rcv_pending_q);) { BT_HDR* p_buf = static_cast<BT_HDR*>(list_node(node)); node = list_next(node); if (!timed_out || (!p_buf->layer_specific) || (--p_buf->layer_specific == 0)) { list_remove(l2cb.rcv_pending_q, p_buf); p_buf->layer_specific = 0xFFFF; l2c_rcv_acl_data(p_buf); } } /* If anyone still in the queue, restart the timeout */ if (!list_is_empty(l2cb.rcv_pending_q)) { alarm_set_on_mloop(l2cb.receive_hold_timer, BT_1SEC_TIMEOUT_MS, l2c_receive_hold_timer_timeout, NULL); } } /******************************************************************************* * * Function l2c_init Loading Loading @@ -937,11 +860,6 @@ void l2c_init(void) { l2cb.l2c_ble_fixed_chnls_mask = L2CAP_FIXED_CHNL_ATT_BIT | L2CAP_FIXED_CHNL_BLE_SIG_BIT | L2CAP_FIXED_CHNL_SMP_BIT; l2cb.rcv_pending_q = list_new(NULL); CHECK(l2cb.rcv_pending_q != NULL); l2cb.receive_hold_timer = alarm_new("l2c.receive_hold_timer"); } void l2c_free(void) { Loading @@ -949,14 +867,6 @@ void l2c_free(void) { // L2CAP cleanup should be handled by GD stack manager return; } list_free(l2cb.rcv_pending_q); l2cb.rcv_pending_q = NULL; } void l2c_receive_hold_timer_timeout(UNUSED_ATTR void* data) { /* Update the timeouts in the hold queue */ l2c_process_held_packets(true); } void l2c_ccb_timer_timeout(void* data) { Loading
system/test/mock/mock_stack_l2cap_main.cc +0 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ void l2c_fcrb_ack_timer_timeout(void* data) { inc_func_call_count(__func__); } void l2c_free(void) { inc_func_call_count(__func__); } void l2c_init(void) { inc_func_call_count(__func__); } void l2c_lcb_timer_timeout(void* data) { inc_func_call_count(__func__); } void l2c_process_held_packets(bool timed_out) { inc_func_call_count(__func__); } void l2c_rcv_acl_data(BT_HDR* p_msg) { inc_func_call_count(__func__); } void l2c_receive_hold_timer_timeout(UNUSED_ATTR void* data) { inc_func_call_count(__func__); Loading