Lines Matching refs:p_lcb
56 static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf);
57 static BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb);
68 tL2C_LCB* p_lcb; in l2c_link_hci_conn_req() local
74 p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_BR_EDR); in l2c_link_hci_conn_req()
77 if (!p_lcb) { in l2c_link_hci_conn_req()
78 p_lcb = l2cu_allocate_lcb(bd_addr, false, BT_TRANSPORT_BR_EDR); in l2c_link_hci_conn_req()
79 if (!p_lcb) { in l2c_link_hci_conn_req()
90 if (p_lcb_cur == p_lcb) continue; in l2c_link_hci_conn_req()
94 p_lcb->SetLinkRoleAsCentral(); in l2c_link_hci_conn_req()
101 p_lcb->SetLinkRoleAsPeripheral(); in l2c_link_hci_conn_req()
103 p_lcb->SetLinkRoleAsCentral(); in l2c_link_hci_conn_req()
107 acl_accept_connection_request(bd_addr, p_lcb->LinkRole()); in l2c_link_hci_conn_req()
109 p_lcb->link_state = LST_CONNECTING; in l2c_link_hci_conn_req()
112 alarm_set_on_mloop(p_lcb->l2c_lcb_timer, L2CAP_LINK_CONNECT_TIMEOUT_MS, in l2c_link_hci_conn_req()
113 l2c_lcb_timer_timeout, p_lcb); in l2c_link_hci_conn_req()
119 if ((p_lcb->link_state == LST_CONNECTING) || in l2c_link_hci_conn_req()
120 (p_lcb->link_state == LST_CONNECT_HOLDING)) { in l2c_link_hci_conn_req()
122 p_lcb->SetLinkRoleAsPeripheral(); in l2c_link_hci_conn_req()
124 p_lcb->SetLinkRoleAsCentral(); in l2c_link_hci_conn_req()
126 acl_accept_connection_request(bd_addr, p_lcb->LinkRole()); in l2c_link_hci_conn_req()
128 p_lcb->link_state = LST_CONNECTING; in l2c_link_hci_conn_req()
129 } else if (p_lcb->link_state == LST_DISCONNECTING) { in l2c_link_hci_conn_req()
133 p_lcb->link_state); in l2c_link_hci_conn_req()
144 tL2C_LCB* p_lcb; in l2c_link_hci_conn_comp() local
152 p_lcb = l2cu_find_lcb_by_bd_addr(ci.bd_addr, BT_TRANSPORT_BR_EDR); in l2c_link_hci_conn_comp()
155 if (p_lcb == nullptr) { in l2c_link_hci_conn_comp()
156 p_lcb = l2cu_allocate_lcb(ci.bd_addr, false, BT_TRANSPORT_BR_EDR); in l2c_link_hci_conn_comp()
157 if (p_lcb == nullptr) { in l2c_link_hci_conn_comp()
162 link_state_text(p_lcb->link_state).c_str()); in l2c_link_hci_conn_comp()
163 p_lcb->link_state = LST_CONNECTING; in l2c_link_hci_conn_comp()
166 if ((p_lcb->link_state == LST_CONNECTED) && in l2c_link_hci_conn_comp()
170 } else if (p_lcb->link_state != LST_CONNECTING) { in l2c_link_hci_conn_comp()
174 link_state_text(p_lcb->link_state).c_str(), in l2c_link_hci_conn_comp()
175 hci_error_code_text(status).c_str(), p_lcb->Handle()); in l2c_link_hci_conn_comp()
178 l2c_link_hci_disc_comp(p_lcb->Handle(), status); in l2c_link_hci_conn_comp()
184 l2cu_set_lcb_handle(*p_lcb, handle); in l2c_link_hci_conn_comp()
188 p_lcb->link_state = LST_CONNECTED; in l2c_link_hci_conn_comp()
191 l2cu_send_peer_info_req(p_lcb, L2CAP_EXTENDED_FEATURES_INFO_TYPE); in l2c_link_hci_conn_comp()
193 if (p_lcb->IsBonding()) { in l2c_link_hci_conn_comp()
194 LOG_DEBUG("Link is dedicated bonding handle:0x%04x", p_lcb->Handle()); in l2c_link_hci_conn_comp()
201 alarm_cancel(p_lcb->l2c_lcb_timer); in l2c_link_hci_conn_comp()
204 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; in l2c_link_hci_conn_comp()
209 if (!p_lcb->ccb_queue.p_first_ccb) { in l2c_link_hci_conn_comp()
211 alarm_set_on_mloop(p_lcb->l2c_lcb_timer, timeout_ms, in l2c_link_hci_conn_comp()
212 l2c_lcb_timer_timeout, p_lcb); in l2c_link_hci_conn_comp()
221 p_lcb->link_state = LST_CONNECT_HOLDING; in l2c_link_hci_conn_comp()
222 p_lcb->InvalidateHandle(); in l2c_link_hci_conn_comp()
225 p_lcb->link_state = LST_DISCONNECTING; in l2c_link_hci_conn_comp()
229 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb;) { in l2c_link_hci_conn_comp()
237 LOG_INFO("Disconnecting link handle:0x%04x status:%s", p_lcb->Handle(), in l2c_link_hci_conn_comp()
239 p_lcb->SetDisconnectReason(status); in l2c_link_hci_conn_comp()
241 if (p_lcb->ccb_queue.p_first_ccb == NULL) in l2c_link_hci_conn_comp()
242 l2cu_release_lcb(p_lcb); in l2c_link_hci_conn_comp()
248 p_lcb->link_state = LST_CONNECTING; in l2c_link_hci_conn_comp()
250 l2cu_create_conn_br_edr(p_lcb); in l2c_link_hci_conn_comp()
276 tL2C_LCB* p_lcb; in l2c_link_sec_comp2() local
292 p_lcb = l2cu_find_lcb_by_bd_addr(p_bda, transport); in l2c_link_sec_comp2()
295 if (!p_lcb) { in l2c_link_sec_comp2()
301 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_next_ccb) { in l2c_link_sec_comp2()
342 tL2C_LCB* p_lcb = l2cu_find_lcb_by_handle(handle); in l2c_link_hci_disc_comp() local
348 if (!p_lcb) { in l2c_link_hci_disc_comp()
351 p_lcb->SetDisconnectReason(reason); in l2c_link_hci_disc_comp()
354 p_lcb->link_state = LST_DISCONNECTING; in l2c_link_hci_disc_comp()
357 if (p_lcb->transport == BT_TRANSPORT_LE) in l2c_link_hci_disc_comp()
358 btm_ble_decrement_link_topology_mask(p_lcb->LinkRole()); in l2c_link_hci_disc_comp()
361 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb;) { in l2c_link_hci_disc_comp()
370 if (p_ccb != p_lcb->p_pending_ccb) { in l2c_link_hci_disc_comp()
376 if (p_lcb->transport == BT_TRANSPORT_BR_EDR) in l2c_link_hci_disc_comp()
378 btm_sco_acl_removed(&p_lcb->remote_bd_addr); in l2c_link_hci_disc_comp()
385 if (p_lcb->ccb_queue.p_first_ccb != NULL || p_lcb->p_pending_ccb) { in l2c_link_hci_disc_comp()
388 while (!list_is_empty(p_lcb->link_xmit_data_q)) { in l2c_link_hci_disc_comp()
390 static_cast<BT_HDR*>(list_front(p_lcb->link_xmit_data_q)); in l2c_link_hci_disc_comp()
391 list_remove(p_lcb->link_xmit_data_q, p_buf); in l2c_link_hci_disc_comp()
396 if (p_lcb->transport == BT_TRANSPORT_LE) { in l2c_link_hci_disc_comp()
404 if (p_lcb->p_fixed_ccbs[xx] && in l2c_link_hci_disc_comp()
405 p_lcb->p_fixed_ccbs[xx] != p_lcb->p_pending_ccb) { in l2c_link_hci_disc_comp()
407 xx + L2CAP_FIRST_FIXED_CHNL, p_lcb->remote_bd_addr, false, in l2c_link_hci_disc_comp()
408 p_lcb->DisconnectReason(), p_lcb->transport); in l2c_link_hci_disc_comp()
409 if (p_lcb->p_fixed_ccbs[xx] == NULL) { in l2c_link_hci_disc_comp()
415 xx, p_lcb->remote_bd_addr.ToString().c_str(), p_lcb, in l2c_link_hci_disc_comp()
416 p_lcb->in_use, p_lcb->link_state, p_lcb->Handle(), in l2c_link_hci_disc_comp()
417 p_lcb->LinkRole(), p_lcb->IsBonding(), in l2c_link_hci_disc_comp()
418 p_lcb->DisconnectReason(), p_lcb->transport); in l2c_link_hci_disc_comp()
420 CHECK(p_lcb->p_fixed_ccbs[xx] != NULL); in l2c_link_hci_disc_comp()
421 l2cu_release_ccb(p_lcb->p_fixed_ccbs[xx]); in l2c_link_hci_disc_comp()
423 p_lcb->p_fixed_ccbs[xx] = NULL; in l2c_link_hci_disc_comp()
427 if (p_lcb->transport == BT_TRANSPORT_LE) { in l2c_link_hci_disc_comp()
428 if (l2cu_create_conn_le(p_lcb)) in l2c_link_hci_disc_comp()
431 l2cu_create_conn_br_edr(p_lcb); in l2c_link_hci_disc_comp()
436 p_lcb->p_pending_ccb = NULL; in l2c_link_hci_disc_comp()
439 if (lcb_is_free) l2cu_release_lcb(p_lcb); in l2c_link_hci_disc_comp()
444 ((p_lcb = l2cu_find_lcb_by_state(LST_CONNECT_HOLDING)) != NULL)) { in l2c_link_hci_disc_comp()
446 l2cu_create_conn_br_edr(p_lcb); in l2c_link_hci_disc_comp()
461 void l2c_link_timeout(tL2C_LCB* p_lcb) { in l2c_link_timeout() argument
466 link_state_text(p_lcb->link_state).c_str(), in l2c_link_timeout()
467 logbool(p_lcb->IsBonding()).c_str()); in l2c_link_timeout()
471 if ((p_lcb->link_state == LST_CONNECTING_WAIT_SWITCH) || in l2c_link_timeout()
472 (p_lcb->link_state == LST_CONNECTING) || in l2c_link_timeout()
473 (p_lcb->link_state == LST_CONNECT_HOLDING) || in l2c_link_timeout()
474 (p_lcb->link_state == LST_DISCONNECTING)) { in l2c_link_timeout()
475 p_lcb->p_pending_ccb = NULL; in l2c_link_timeout()
479 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb;) { in l2c_link_timeout()
488 l2cu_release_lcb(p_lcb); in l2c_link_timeout()
492 if (p_lcb->link_state == LST_CONNECTED) { in l2c_link_timeout()
494 if (!p_lcb->ccb_queue.p_first_ccb) { in l2c_link_timeout()
499 rc = btm_sec_disconnect(p_lcb->Handle(), HCI_ERR_PEER_USER); in l2c_link_timeout()
506 p_lcb->link_state = LST_DISCONNECTING; in l2c_link_timeout()
509 l2cu_process_fixed_disc_cback(p_lcb); in l2c_link_timeout()
512 p_lcb->link_state = LST_DISCONNECTING; in l2c_link_timeout()
517 } else if (p_lcb->IsBonding()) { in l2c_link_timeout()
518 acl_disconnect_from_handle(p_lcb->Handle(), HCI_ERR_PEER_USER); in l2c_link_timeout()
519 l2cu_process_fixed_disc_cback(p_lcb); in l2c_link_timeout()
520 p_lcb->link_state = LST_DISCONNECTING; in l2c_link_timeout()
528 alarm_set_on_mloop(p_lcb->l2c_lcb_timer, timeout_ms, in l2c_link_timeout()
529 l2c_lcb_timer_timeout, p_lcb); in l2c_link_timeout()
533 l2c_link_check_send_pkts(p_lcb, 0, NULL); in l2c_link_timeout()
548 tL2C_LCB* p_lcb = (tL2C_LCB*)data; in l2c_info_resp_timer_timeout() local
554 if (p_lcb->w4_info_rsp) { in l2c_info_resp_timer_timeout()
556 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; in l2c_info_resp_timer_timeout()
560 alarm_set_on_mloop(p_lcb->info_resp_timer, in l2c_info_resp_timer_timeout()
562 l2c_info_resp_timer_timeout, p_lcb); in l2c_info_resp_timer_timeout()
567 p_lcb->w4_info_rsp = false; in l2c_info_resp_timer_timeout()
570 if ((p_lcb->link_state != LST_DISCONNECTED) && in l2c_info_resp_timer_timeout()
571 (p_lcb->link_state != LST_DISCONNECTING)) { in l2c_info_resp_timer_timeout()
573 if (p_lcb->ccb_queue.p_first_ccb) { in l2c_info_resp_timer_timeout()
575 ci.bd_addr = p_lcb->remote_bd_addr; in l2c_info_resp_timer_timeout()
577 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; in l2c_info_resp_timer_timeout()
603 tL2C_LCB* p_lcb; in l2c_link_adjust_allocation() local
620 for (yy = 0, p_lcb = &l2cb.lcb_pool[0]; yy < MAX_L2CAP_LINKS; yy++, p_lcb++) { in l2c_link_adjust_allocation()
621 if (p_lcb->in_use && in l2c_link_adjust_allocation()
622 (is_share_buffer || p_lcb->transport != BT_TRANSPORT_LE)) { in l2c_link_adjust_allocation()
623 if (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH) in l2c_link_adjust_allocation()
668 for (yy = 0, p_lcb = &l2cb.lcb_pool[0]; yy < MAX_L2CAP_LINKS; yy++, p_lcb++) { in l2c_link_adjust_allocation()
669 if (p_lcb->in_use && in l2c_link_adjust_allocation()
670 (is_share_buffer || p_lcb->transport != BT_TRANSPORT_LE)) { in l2c_link_adjust_allocation()
671 if (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH) { in l2c_link_adjust_allocation()
672 p_lcb->link_xmit_quota = high_pri_link_quota; in l2c_link_adjust_allocation()
679 if ((p_lcb->link_xmit_quota > 0) && (qq == 0)) in l2c_link_adjust_allocation()
680 l2cb.round_robin_unacked += p_lcb->sent_not_acked; in l2c_link_adjust_allocation()
682 p_lcb->link_xmit_quota = qq; in l2c_link_adjust_allocation()
684 p_lcb->link_xmit_quota++; in l2c_link_adjust_allocation()
691 p_lcb->acl_priority, p_lcb->link_xmit_quota); in l2c_link_adjust_allocation()
694 p_lcb->sent_not_acked, l2cb.round_robin_unacked); in l2c_link_adjust_allocation()
699 if ((p_lcb->link_state == LST_CONNECTED) && in l2c_link_adjust_allocation()
700 (!list_is_empty(p_lcb->link_xmit_data_q)) && in l2c_link_adjust_allocation()
701 (p_lcb->sent_not_acked < p_lcb->link_xmit_quota)) { in l2c_link_adjust_allocation()
702 alarm_set_on_mloop(p_lcb->l2c_lcb_timer, in l2c_link_adjust_allocation()
704 l2c_lcb_timer_timeout, p_lcb); in l2c_link_adjust_allocation()
772 tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(*bd_addr, BT_TRANSPORT_BR_EDR); in l2c_link_role_changed() local
773 if (p_lcb) { in l2c_link_role_changed()
775 p_lcb->SetLinkRoleAsCentral(); in l2c_link_role_changed()
777 p_lcb->SetLinkRoleAsPeripheral(); in l2c_link_role_changed()
782 l2cu_set_acl_priority(*bd_addr, p_lcb->acl_priority, true); in l2c_link_role_changed()
787 tL2C_LCB* p_lcb = &l2cb.lcb_pool[0]; in l2c_link_role_changed() local
788 for (uint8_t xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++) { in l2c_link_role_changed()
789 if ((p_lcb->in_use) && (p_lcb->link_state == LST_CONNECTING_WAIT_SWITCH)) { in l2c_link_role_changed()
790 l2cu_create_conn_after_switch(p_lcb); in l2c_link_role_changed()
809 tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_BR_EDR); in l2c_pin_code_request() local
811 if ((p_lcb) && (!p_lcb->ccb_queue.p_first_ccb)) { in l2c_pin_code_request()
812 alarm_set_on_mloop(p_lcb->l2c_lcb_timer, L2CAP_LINK_CONNECT_EXT_TIMEOUT_MS, in l2c_pin_code_request()
813 l2c_lcb_timer_timeout, p_lcb); in l2c_pin_code_request()
827 static bool l2c_link_check_power_mode(tL2C_LCB* p_lcb) { in l2c_link_check_power_mode() argument
833 if (list_is_empty(p_lcb->link_xmit_data_q)) { in l2c_link_check_power_mode()
834 for (tL2C_CCB* p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; in l2c_link_check_power_mode()
846 if (need_to_active && !p_lcb->is_transport_ble()) { in l2c_link_check_power_mode()
849 if (BTM_ReadPowerMode(p_lcb->remote_bd_addr, &mode)) { in l2c_link_check_power_mode()
851 LOG_DEBUG("LCB(0x%x) is in PM pending state", p_lcb->Handle()); in l2c_link_check_power_mode()
870 void l2c_link_check_send_pkts(tL2C_LCB* p_lcb, uint16_t local_cid, in l2c_link_check_send_pkts() argument
882 list_append(p_lcb->link_xmit_data_q, p_buf); in l2c_link_check_send_pkts()
884 if (p_lcb->link_xmit_quota == 0) { in l2c_link_check_send_pkts()
885 if (p_lcb->transport == BT_TRANSPORT_LE) in l2c_link_check_send_pkts()
904 if ((p_lcb == NULL) || (p_lcb->link_xmit_quota == 0)) { in l2c_link_check_send_pkts()
906 if (p_lcb == NULL) { in l2c_link_check_send_pkts()
907 p_lcb = l2cb.lcb_pool; in l2c_link_check_send_pkts()
909 p_lcb++; in l2c_link_check_send_pkts()
913 for (int xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++) { in l2c_link_check_send_pkts()
915 if (p_lcb == &l2cb.lcb_pool[MAX_L2CAP_LINKS]) p_lcb = &l2cb.lcb_pool[0]; in l2c_link_check_send_pkts()
920 (p_lcb->transport == BT_TRANSPORT_BR_EDR)) || in l2c_link_check_send_pkts()
921 (p_lcb->transport == BT_TRANSPORT_LE && in l2c_link_check_send_pkts()
928 if ((!p_lcb->in_use) || (p_lcb->partial_segment_being_sent) || in l2c_link_check_send_pkts()
929 (p_lcb->link_state != LST_CONNECTED) || in l2c_link_check_send_pkts()
930 (p_lcb->link_xmit_quota != 0) || (l2c_link_check_power_mode(p_lcb))) { in l2c_link_check_send_pkts()
936 if (!list_is_empty(p_lcb->link_xmit_data_q)) { in l2c_link_check_send_pkts()
938 p_buf = (BT_HDR*)list_front(p_lcb->link_xmit_data_q); in l2c_link_check_send_pkts()
939 list_remove(p_lcb->link_xmit_data_q, p_buf); in l2c_link_check_send_pkts()
940 l2c_link_send_to_lower(p_lcb, p_buf); in l2c_link_check_send_pkts()
949 p_buf = l2cu_get_next_buffer_to_send(p_lcb); in l2c_link_check_send_pkts()
952 l2c_link_send_to_lower(p_lcb, p_buf); in l2c_link_check_send_pkts()
960 (p_lcb->transport == BT_TRANSPORT_BR_EDR)) in l2c_link_check_send_pkts()
965 (p_lcb->transport == BT_TRANSPORT_LE)) in l2c_link_check_send_pkts()
970 if ((p_lcb->partial_segment_being_sent) || in l2c_link_check_send_pkts()
971 (p_lcb->link_state != LST_CONNECTED) || in l2c_link_check_send_pkts()
972 (l2c_link_check_power_mode(p_lcb))) { in l2c_link_check_send_pkts()
979 p_lcb->transport, l2cb.controller_xmit_window, in l2c_link_check_send_pkts()
980 l2cb.controller_le_xmit_window, p_lcb->sent_not_acked, in l2c_link_check_send_pkts()
981 p_lcb->link_xmit_quota); in l2c_link_check_send_pkts()
985 (p_lcb->transport == BT_TRANSPORT_BR_EDR)) || in l2c_link_check_send_pkts()
987 (p_lcb->transport == BT_TRANSPORT_LE))) && in l2c_link_check_send_pkts()
988 (p_lcb->sent_not_acked < p_lcb->link_xmit_quota)) { in l2c_link_check_send_pkts()
989 if (list_is_empty(p_lcb->link_xmit_data_q)) { in l2c_link_check_send_pkts()
994 p_buf = (BT_HDR*)list_front(p_lcb->link_xmit_data_q); in l2c_link_check_send_pkts()
995 list_remove(p_lcb->link_xmit_data_q, p_buf); in l2c_link_check_send_pkts()
996 l2c_link_send_to_lower(p_lcb, p_buf); in l2c_link_check_send_pkts()
1003 (p_lcb->transport == BT_TRANSPORT_BR_EDR)) || in l2c_link_check_send_pkts()
1005 (p_lcb->transport == BT_TRANSPORT_LE))) && in l2c_link_check_send_pkts()
1006 (p_lcb->sent_not_acked < p_lcb->link_xmit_quota)) { in l2c_link_check_send_pkts()
1007 p_buf = l2cu_get_next_buffer_to_send(p_lcb); in l2c_link_check_send_pkts()
1013 l2c_link_send_to_lower(p_lcb, p_buf); in l2c_link_check_send_pkts()
1020 if ((!list_is_empty(p_lcb->link_xmit_data_q)) && in l2c_link_check_send_pkts()
1021 (p_lcb->sent_not_acked < p_lcb->link_xmit_quota)) { in l2c_link_check_send_pkts()
1022 alarm_set_on_mloop(p_lcb->l2c_lcb_timer, in l2c_link_check_send_pkts()
1024 l2c_lcb_timer_timeout, p_lcb); in l2c_link_check_send_pkts()
1030 tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(remote, BT_TRANSPORT_BR_EDR); in l2c_OnHciModeChangeSendPendingPackets() local
1031 if (p_lcb != NULL) { in l2c_OnHciModeChangeSendPendingPackets()
1036 l2c_link_check_send_pkts(p_lcb, 0, NULL); in l2c_OnHciModeChangeSendPendingPackets()
1047 static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) { in l2c_link_send_to_lower_br_edr() argument
1050 const uint16_t link_xmit_quota = p_lcb->link_xmit_quota; in l2c_link_send_to_lower_br_edr()
1060 p_lcb->sent_not_acked++; in l2c_link_send_to_lower_br_edr()
1069 if (p_lcb->link_xmit_quota == 0) { in l2c_link_send_to_lower_br_edr()
1071 p_lcb->partial_segment_being_sent = true; in l2c_link_send_to_lower_br_edr()
1076 p_lcb->partial_segment_being_sent = true; in l2c_link_send_to_lower_br_edr()
1079 if (num_segs > (p_lcb->link_xmit_quota - p_lcb->sent_not_acked)) { in l2c_link_send_to_lower_br_edr()
1080 num_segs = (p_lcb->link_xmit_quota - p_lcb->sent_not_acked); in l2c_link_send_to_lower_br_edr()
1081 p_lcb->partial_segment_being_sent = true; in l2c_link_send_to_lower_br_edr()
1085 p_lcb->sent_not_acked += num_segs; in l2c_link_send_to_lower_br_edr()
1088 if (p_lcb->link_xmit_quota == 0) l2cb.round_robin_unacked += num_segs; in l2c_link_send_to_lower_br_edr()
1090 acl_send_data_packet_br_edr(p_lcb->remote_bd_addr, p_buf); in l2c_link_send_to_lower_br_edr()
1092 l2cb.controller_xmit_window, p_lcb->Handle(), in l2c_link_send_to_lower_br_edr()
1093 p_lcb->link_xmit_quota, p_lcb->sent_not_acked, in l2c_link_send_to_lower_br_edr()
1097 static void l2c_link_send_to_lower_ble(tL2C_LCB* p_lcb, BT_HDR* p_buf) { in l2c_link_send_to_lower_ble() argument
1100 const uint16_t link_xmit_quota = p_lcb->link_xmit_quota; in l2c_link_send_to_lower_ble()
1107 p_lcb->sent_not_acked++; in l2c_link_send_to_lower_ble()
1116 if (p_lcb->link_xmit_quota == 0) { in l2c_link_send_to_lower_ble()
1118 p_lcb->partial_segment_being_sent = true; in l2c_link_send_to_lower_ble()
1123 p_lcb->partial_segment_being_sent = true; in l2c_link_send_to_lower_ble()
1126 if (num_segs > (p_lcb->link_xmit_quota - p_lcb->sent_not_acked)) { in l2c_link_send_to_lower_ble()
1127 num_segs = (p_lcb->link_xmit_quota - p_lcb->sent_not_acked); in l2c_link_send_to_lower_ble()
1128 p_lcb->partial_segment_being_sent = true; in l2c_link_send_to_lower_ble()
1132 p_lcb->sent_not_acked += num_segs; in l2c_link_send_to_lower_ble()
1135 if (p_lcb->link_xmit_quota == 0) l2cb.ble_round_robin_unacked += num_segs; in l2c_link_send_to_lower_ble()
1137 acl_send_data_packet_ble(p_lcb->remote_bd_addr, p_buf); in l2c_link_send_to_lower_ble()
1139 l2cb.controller_le_xmit_window, p_lcb->Handle(), in l2c_link_send_to_lower_ble()
1140 p_lcb->link_xmit_quota, p_lcb->sent_not_acked, in l2c_link_send_to_lower_ble()
1144 static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf) { in l2c_link_send_to_lower() argument
1145 if (p_lcb->transport == BT_TRANSPORT_BR_EDR) { in l2c_link_send_to_lower()
1146 l2c_link_send_to_lower_br_edr(p_lcb, p_buf); in l2c_link_send_to_lower()
1148 l2c_link_send_to_lower_ble(p_lcb, p_buf); in l2c_link_send_to_lower()
1170 tL2C_LCB* p_lcb; in l2c_link_process_num_completed_pkts() local
1189 p_lcb = l2cu_find_lcb_by_handle(handle); in l2c_link_process_num_completed_pkts()
1191 if (p_lcb) { in l2c_link_process_num_completed_pkts()
1192 if (p_lcb && (p_lcb->transport == BT_TRANSPORT_LE)) in l2c_link_process_num_completed_pkts()
1199 if (p_lcb->link_xmit_quota == 0) { in l2c_link_process_num_completed_pkts()
1200 if (p_lcb->transport == BT_TRANSPORT_LE) { in l2c_link_process_num_completed_pkts()
1216 if (p_lcb->sent_not_acked > num_sent) in l2c_link_process_num_completed_pkts()
1217 p_lcb->sent_not_acked -= num_sent; in l2c_link_process_num_completed_pkts()
1219 p_lcb->sent_not_acked = 0; in l2c_link_process_num_completed_pkts()
1221 l2c_link_check_send_pkts(p_lcb, 0, NULL); in l2c_link_process_num_completed_pkts()
1224 if ((p_lcb->acl_priority == L2CAP_PRIORITY_HIGH) && in l2c_link_process_num_completed_pkts()
1229 if ((p_lcb->transport == BT_TRANSPORT_LE) && in l2c_link_process_num_completed_pkts()
1230 (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH) && in l2c_link_process_num_completed_pkts()
1237 if (p_lcb) { in l2c_link_process_num_completed_pkts()
1238 if (p_lcb->transport == BT_TRANSPORT_LE) { in l2c_link_process_num_completed_pkts()
1240 l2cb.controller_le_xmit_window, p_lcb->Handle(), in l2c_link_process_num_completed_pkts()
1241 p_lcb->sent_not_acked, l2cb.ble_check_round_robin, in l2c_link_process_num_completed_pkts()
1245 l2cb.controller_xmit_window, p_lcb->Handle(), in l2c_link_process_num_completed_pkts()
1246 p_lcb->sent_not_acked, l2cb.check_round_robin, in l2c_link_process_num_completed_pkts()
1259 tL2C_LCB* p_lcb = l2cu_find_lcb_by_handle(handle); in l2c_packets_completed() local
1260 if (p_lcb == nullptr) { in l2c_packets_completed()
1264 p_lcb->update_outstanding_packets(num_sent); in l2c_packets_completed()
1266 switch (p_lcb->transport) { in l2c_packets_completed()
1269 if (p_lcb->is_round_robin_scheduling()) in l2c_packets_completed()
1274 if (p_lcb->is_round_robin_scheduling()) in l2c_packets_completed()
1278 LOG_ERROR("Unknown transport received:%u", p_lcb->transport); in l2c_packets_completed()
1282 l2c_link_check_send_pkts(p_lcb, 0, NULL); in l2c_packets_completed()
1284 if (p_lcb->is_high_priority()) { in l2c_packets_completed()
1285 switch (p_lcb->transport) { in l2c_packets_completed()
1322 tL2C_LCB* p_lcb = l2cu_find_lcb_by_handle(handle); in l2c_link_segments_xmitted() local
1323 if (p_lcb == nullptr) { in l2c_link_segments_xmitted()
1330 if (p_lcb->link_state != LST_CONNECTED) { in l2c_link_segments_xmitted()
1339 list_prepend(p_lcb->link_xmit_data_q, p_msg); in l2c_link_segments_xmitted()
1341 p_lcb->partial_segment_being_sent = false; in l2c_link_segments_xmitted()
1343 l2c_link_check_send_pkts(p_lcb, 0, NULL); in l2c_link_segments_xmitted()
1352 tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_BR_EDR); in l2cu_ConnectAclForSecurity() local
1353 if (p_lcb && (p_lcb->link_state == LST_CONNECTED || in l2cu_ConnectAclForSecurity()
1354 p_lcb->link_state == LST_CONNECTING)) { in l2cu_ConnectAclForSecurity()
1360 if (!p_lcb && in l2cu_ConnectAclForSecurity()
1361 (p_lcb = l2cu_allocate_lcb(bd_addr, true, BT_TRANSPORT_BR_EDR)) == NULL) { in l2cu_ConnectAclForSecurity()
1366 l2cu_create_conn_br_edr(p_lcb); in l2cu_ConnectAclForSecurity()
1386 tL2C_CCB* l2cu_get_next_channel_in_rr(tL2C_LCB* p_lcb) { in l2cu_get_next_channel_in_rr() argument
1396 for (j = 0; (j < p_lcb->rr_serv[p_lcb->rr_pri].num_ccb) && (!p_serve_ccb); in l2cu_get_next_channel_in_rr()
1399 p_ccb = p_lcb->rr_serv[p_lcb->rr_pri].p_serve_ccb; in l2cu_get_next_channel_in_rr()
1402 LOG_ERROR("p_serve_ccb is NULL, rr_pri=%d", p_lcb->rr_pri); in l2cu_get_next_channel_in_rr()
1414 p_lcb->rr_serv[p_lcb->rr_pri].p_serve_ccb = in l2cu_get_next_channel_in_rr()
1415 p_lcb->rr_serv[p_lcb->rr_pri].p_first_ccb; in l2cu_get_next_channel_in_rr()
1418 p_lcb->rr_serv[p_lcb->rr_pri].p_serve_ccb = p_ccb->p_next_ccb; in l2cu_get_next_channel_in_rr()
1423 if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE) { in l2cu_get_next_channel_in_rr()
1448 p_lcb->rr_serv[p_lcb->rr_pri].quota--; in l2cu_get_next_channel_in_rr()
1453 if ((p_lcb->rr_serv[p_lcb->rr_pri].quota == 0) || (!p_serve_ccb)) { in l2cu_get_next_channel_in_rr()
1455 p_lcb->rr_pri = (p_lcb->rr_pri + 1) % L2CAP_NUM_CHNL_PRIORITY; in l2cu_get_next_channel_in_rr()
1457 p_lcb->rr_serv[p_lcb->rr_pri].quota = in l2cu_get_next_channel_in_rr()
1458 L2CAP_GET_PRIORITY_QUOTA(p_lcb->rr_pri); in l2cu_get_next_channel_in_rr()
1465 p_lcb->rr_serv[p_serve_ccb->ccb_priority].quota, in l2cu_get_next_channel_in_rr()
1482 BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb) { in l2cu_get_next_buffer_to_send() argument
1490 p_ccb = p_lcb->p_fixed_ccbs[xx]; in l2cu_get_next_buffer_to_send()
1529 p_ccb = l2cu_get_next_channel_in_rr(p_lcb); in l2cu_get_next_buffer_to_send()
1534 if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE) { in l2cu_get_next_buffer_to_send()