Loading system/stack/l2cap/l2c_link.cc +12 −74 Original line number Diff line number Diff line Loading @@ -1053,45 +1053,15 @@ void l2c_OnHciModeChangeSendPendingPackets(RawAddress remote) { * ******************************************************************************/ static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) { const uint16_t acl_data_size_classic = controller_get_interface()->get_acl_data_size_classic(); const uint16_t link_xmit_quota = p_lcb->link_xmit_quota; const bool is_bdr_and_fits_in_buffer = true; if (is_bdr_and_fits_in_buffer) { if (link_xmit_quota == 0) { l2cb.round_robin_unacked++; } p_lcb->sent_not_acked++; p_buf->layer_specific = 0; l2cb.controller_xmit_window--; } else { uint16_t num_segs = (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_data_size_classic - 1) / acl_data_size_classic; /* If doing round-robin, then only 1 segment each time */ if (p_lcb->link_xmit_quota == 0) { num_segs = 1; p_lcb->partial_segment_being_sent = true; } else { /* Multi-segment packet. Make sure it can fit */ if (num_segs > l2cb.controller_xmit_window) { num_segs = l2cb.controller_xmit_window; p_lcb->partial_segment_being_sent = true; } if (num_segs > (p_lcb->link_xmit_quota - p_lcb->sent_not_acked)) { num_segs = (p_lcb->link_xmit_quota - p_lcb->sent_not_acked); p_lcb->partial_segment_being_sent = true; } } p_lcb->sent_not_acked += num_segs; p_buf->layer_specific = num_segs; l2cb.controller_xmit_window -= num_segs; if (p_lcb->link_xmit_quota == 0) l2cb.round_robin_unacked += num_segs; } acl_send_data_packet_br_edr(p_lcb->remote_bd_addr, p_buf); LOG_DEBUG("TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d", l2cb.controller_xmit_window, p_lcb->Handle(), Loading @@ -1100,47 +1070,15 @@ static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) { } static void l2c_link_send_to_lower_ble(tL2C_LCB* p_lcb, BT_HDR* p_buf) { const uint16_t acl_packet_size_ble = controller_get_interface()->get_acl_packet_size_ble(); const uint16_t acl_data_size_ble = controller_get_interface()->get_acl_data_size_ble(); const uint16_t link_xmit_quota = p_lcb->link_xmit_quota; const bool is_ble_and_fits_in_buffer = (p_buf->len <= acl_packet_size_ble); if (is_ble_and_fits_in_buffer) { if (link_xmit_quota == 0) { l2cb.ble_round_robin_unacked++; } p_lcb->sent_not_acked++; p_buf->layer_specific = 0; l2cb.controller_le_xmit_window--; } else { uint16_t num_segs = (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_data_size_ble - 1) / acl_data_size_ble; /* If doing round-robin, then only 1 segment each time */ if (p_lcb->link_xmit_quota == 0) { num_segs = 1; p_lcb->partial_segment_being_sent = true; } else { /* Multi-segment packet. Make sure it can fit */ if (num_segs > l2cb.controller_le_xmit_window) { num_segs = l2cb.controller_le_xmit_window; p_lcb->partial_segment_being_sent = true; } if (num_segs > (p_lcb->link_xmit_quota - p_lcb->sent_not_acked)) { num_segs = (p_lcb->link_xmit_quota - p_lcb->sent_not_acked); p_lcb->partial_segment_being_sent = true; } } p_lcb->sent_not_acked += num_segs; p_buf->layer_specific = num_segs; l2cb.controller_le_xmit_window -= num_segs; if (p_lcb->link_xmit_quota == 0) l2cb.ble_round_robin_unacked += num_segs; } acl_send_data_packet_ble(p_lcb->remote_bd_addr, p_buf); LOG_DEBUG("TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d", l2cb.controller_le_xmit_window, p_lcb->Handle(), Loading Loading
system/stack/l2cap/l2c_link.cc +12 −74 Original line number Diff line number Diff line Loading @@ -1053,45 +1053,15 @@ void l2c_OnHciModeChangeSendPendingPackets(RawAddress remote) { * ******************************************************************************/ static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) { const uint16_t acl_data_size_classic = controller_get_interface()->get_acl_data_size_classic(); const uint16_t link_xmit_quota = p_lcb->link_xmit_quota; const bool is_bdr_and_fits_in_buffer = true; if (is_bdr_and_fits_in_buffer) { if (link_xmit_quota == 0) { l2cb.round_robin_unacked++; } p_lcb->sent_not_acked++; p_buf->layer_specific = 0; l2cb.controller_xmit_window--; } else { uint16_t num_segs = (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_data_size_classic - 1) / acl_data_size_classic; /* If doing round-robin, then only 1 segment each time */ if (p_lcb->link_xmit_quota == 0) { num_segs = 1; p_lcb->partial_segment_being_sent = true; } else { /* Multi-segment packet. Make sure it can fit */ if (num_segs > l2cb.controller_xmit_window) { num_segs = l2cb.controller_xmit_window; p_lcb->partial_segment_being_sent = true; } if (num_segs > (p_lcb->link_xmit_quota - p_lcb->sent_not_acked)) { num_segs = (p_lcb->link_xmit_quota - p_lcb->sent_not_acked); p_lcb->partial_segment_being_sent = true; } } p_lcb->sent_not_acked += num_segs; p_buf->layer_specific = num_segs; l2cb.controller_xmit_window -= num_segs; if (p_lcb->link_xmit_quota == 0) l2cb.round_robin_unacked += num_segs; } acl_send_data_packet_br_edr(p_lcb->remote_bd_addr, p_buf); LOG_DEBUG("TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d", l2cb.controller_xmit_window, p_lcb->Handle(), Loading @@ -1100,47 +1070,15 @@ static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) { } static void l2c_link_send_to_lower_ble(tL2C_LCB* p_lcb, BT_HDR* p_buf) { const uint16_t acl_packet_size_ble = controller_get_interface()->get_acl_packet_size_ble(); const uint16_t acl_data_size_ble = controller_get_interface()->get_acl_data_size_ble(); const uint16_t link_xmit_quota = p_lcb->link_xmit_quota; const bool is_ble_and_fits_in_buffer = (p_buf->len <= acl_packet_size_ble); if (is_ble_and_fits_in_buffer) { if (link_xmit_quota == 0) { l2cb.ble_round_robin_unacked++; } p_lcb->sent_not_acked++; p_buf->layer_specific = 0; l2cb.controller_le_xmit_window--; } else { uint16_t num_segs = (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_data_size_ble - 1) / acl_data_size_ble; /* If doing round-robin, then only 1 segment each time */ if (p_lcb->link_xmit_quota == 0) { num_segs = 1; p_lcb->partial_segment_being_sent = true; } else { /* Multi-segment packet. Make sure it can fit */ if (num_segs > l2cb.controller_le_xmit_window) { num_segs = l2cb.controller_le_xmit_window; p_lcb->partial_segment_being_sent = true; } if (num_segs > (p_lcb->link_xmit_quota - p_lcb->sent_not_acked)) { num_segs = (p_lcb->link_xmit_quota - p_lcb->sent_not_acked); p_lcb->partial_segment_being_sent = true; } } p_lcb->sent_not_acked += num_segs; p_buf->layer_specific = num_segs; l2cb.controller_le_xmit_window -= num_segs; if (p_lcb->link_xmit_quota == 0) l2cb.ble_round_robin_unacked += num_segs; } acl_send_data_packet_ble(p_lcb->remote_bd_addr, p_buf); LOG_DEBUG("TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d", l2cb.controller_le_xmit_window, p_lcb->Handle(), Loading