Lines Matching refs:llcp_cb
100 if ((llcp_cb.lcb.inact_timer.in_use == false) && in llcp_link_start_inactivity_timer()
101 (llcp_cb.lcb.inact_timeout > 0)) { in llcp_link_start_inactivity_timer()
103 "Start inactivity_timer: %d ms", llcp_cb.lcb.inact_timeout); in llcp_link_start_inactivity_timer()
105 nfc_start_quick_timer(&llcp_cb.lcb.inact_timer, NFC_TTYPE_LLCP_LINK_INACT, in llcp_link_start_inactivity_timer()
106 ((uint32_t)llcp_cb.lcb.inact_timeout) * in llcp_link_start_inactivity_timer()
121 if (llcp_cb.lcb.inact_timer.in_use) { in llcp_link_stop_inactivity_timer()
124 nfc_stop_quick_timer(&llcp_cb.lcb.inact_timer); in llcp_link_stop_inactivity_timer()
138 if (llcp_cb.lcb.symm_state == LLCP_LINK_SYMM_LOCAL_XMIT_NEXT) { in llcp_link_start_link_timer()
141 &llcp_cb.lcb.timer, NFC_TTYPE_LLCP_LINK_MANAGER, in llcp_link_start_link_timer()
142 (((uint32_t)llcp_cb.lcb.symm_delay) * QUICK_TIMER_TICKS_PER_SEC) / in llcp_link_start_link_timer()
147 &llcp_cb.lcb.timer, NFC_TTYPE_LLCP_LINK_MANAGER, in llcp_link_start_link_timer()
148 ((uint32_t)llcp_cb.lcb.peer_lto) * QUICK_TIMER_TICKS_PER_SEC / 1000); in llcp_link_start_link_timer()
162 nfc_stop_quick_timer(&llcp_cb.lcb.timer); in llcp_link_stop_link_timer()
213 (*llcp_cb.lcb.p_link_cback)(LLCP_LINK_ACTIVATION_FAILED_EVT, in llcp_link_activate()
218 llcp_cb.lcb.link_state = LLCP_LINK_STATE_ACTIVATION_FAILED; in llcp_link_activate()
229 (llcp_link_rwt[p_config->waiting_time] > llcp_cb.lcb.peer_lto)) { in llcp_link_activate()
234 llcp_cb.lcb.peer_lto); in llcp_link_activate()
241 llcp_cb.lcb.peer_lto += LLCP_INTERNAL_TX_DELAY + LLCP_INTERNAL_RX_DELAY; in llcp_link_activate()
246 (*llcp_cb.lcb.p_link_cback)(LLCP_LINK_ACTIVATION_FAILED_EVT, in llcp_link_activate()
251 llcp_cb.lcb.link_state = LLCP_LINK_STATE_ACTIVATION_FAILED; in llcp_link_activate()
257 llcp_cb.lcb.received_first_packet = false; in llcp_link_activate()
258 llcp_cb.lcb.is_initiator = p_config->is_initiator; in llcp_link_activate()
261 llcp_cb.lcb.flags = 0x00; in llcp_link_activate()
265 if (llcp_cb.lcb.local_link_miu >= llcp_cb.lcb.peer_miu) in llcp_link_activate()
266 llcp_cb.lcb.effective_miu = llcp_cb.lcb.peer_miu; in llcp_link_activate()
268 llcp_cb.lcb.effective_miu = llcp_cb.lcb.local_link_miu; in llcp_link_activate()
274 if (llcp_cb.lcb.is_initiator) { in llcp_link_activate()
277 llcp_cb.lcb.inact_timeout = llcp_cb.lcb.inact_timeout_init; in llcp_link_activate()
278 llcp_cb.lcb.symm_state = LLCP_LINK_SYMM_LOCAL_XMIT_NEXT; in llcp_link_activate()
280 if (llcp_cb.lcb.delay_first_pdu_timeout > 0) { in llcp_link_activate()
282 nfc_start_quick_timer(&llcp_cb.lcb.timer, NFC_TTYPE_LLCP_DELAY_FIRST_PDU, in llcp_link_activate()
283 (((uint32_t)llcp_cb.lcb.delay_first_pdu_timeout) * in llcp_link_activate()
291 llcp_cb.lcb.inact_timeout = llcp_cb.lcb.inact_timeout_target; in llcp_link_activate()
292 llcp_cb.lcb.symm_state = LLCP_LINK_SYMM_REMOTE_XMIT_NEXT; in llcp_link_activate()
302 llcp_cb.lcb.link_state = LLCP_LINK_STATE_ACTIVATED; in llcp_link_activate()
305 (*llcp_cb.lcb.p_link_cback)(LLCP_LINK_ACTIVATION_COMPLETE_EVT, in llcp_link_activate()
333 llcp_cb.lcb.link_state = LLCP_LINK_STATE_DEACTIVATED; in llcp_deactivate_cleanup()
341 (*llcp_cb.lcb.p_link_cback)(LLCP_LINK_DEACTIVATED_EVT, reason); in llcp_deactivate_cleanup()
354 if (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATED) { in llcp_link_process_link_timeout()
355 if ((llcp_cb.lcb.symm_delay > 0) && in llcp_link_process_link_timeout()
356 (llcp_cb.lcb.symm_state == LLCP_LINK_SYMM_LOCAL_XMIT_NEXT)) { in llcp_link_process_link_timeout()
367 if (llcp_cb.num_data_link_connection == 0) { in llcp_link_process_link_timeout()
376 } else if (llcp_cb.lcb.link_state == LLCP_LINK_STATE_DEACTIVATING) { in llcp_link_process_link_timeout()
377 llcp_deactivate_cleanup(llcp_cb.lcb.link_deact_reason); in llcp_link_process_link_timeout()
400 while (llcp_cb.lcb.sig_xmit_q.p_first) in llcp_link_deactivate()
401 GKI_freebuf(GKI_dequeue(&llcp_cb.lcb.sig_xmit_q)); in llcp_link_deactivate()
418 llcp_cb.total_tx_ui_pdu = 0; in llcp_link_deactivate()
419 llcp_cb.total_rx_ui_pdu = 0; in llcp_link_deactivate()
423 if (llcp_cb.dlcb[idx].state != LLCP_DLC_STATE_IDLE) { in llcp_link_deactivate()
424 p_dlcb = &(llcp_cb.dlcb[idx]); in llcp_link_deactivate()
429 llcp_cb.total_tx_i_pdu = 0; in llcp_link_deactivate()
430 llcp_cb.total_rx_i_pdu = 0; in llcp_link_deactivate()
432 llcp_cb.overall_tx_congested = false; in llcp_link_deactivate()
433 llcp_cb.overall_rx_congested = false; in llcp_link_deactivate()
445 llcp_cb.lcb.is_initiator == false && in llcp_link_deactivate()
457 llcp_cb.lcb.link_state = LLCP_LINK_STATE_DEACTIVATING; in llcp_link_deactivate()
459 if (llcp_cb.lcb.sig_xmit_q.count == 0) { in llcp_link_deactivate()
462 nfc_start_quick_timer(&llcp_cb.lcb.timer, NFC_TTYPE_LLCP_LINK_MANAGER, in llcp_link_deactivate()
466 llcp_cb.lcb.link_deact_reason = reason; in llcp_link_deactivate()
469 (!llcp_cb.lcb.is_initiator)) { in llcp_link_deactivate()
476 (!(llcp_cb.lcb.flags & LLCP_LINK_FLAGS_RX_ANY_LLC_PDU))) { in llcp_link_deactivate()
505 llcp_cb.lcb.peer_miu = LLCP_DEFAULT_MIU; in llcp_link_parse_gen_bytes()
506 llcp_cb.lcb.peer_lto = LLCP_DEFAULT_LTO_IN_MS; in llcp_link_parse_gen_bytes()
529 peer_major_version = LLCP_GET_MAJOR_VERSION(llcp_cb.lcb.peer_version); in llcp_link_version_agreement()
530 peer_minor_version = LLCP_GET_MINOR_VERSION(llcp_cb.lcb.peer_version); in llcp_link_version_agreement()
540 llcp_cb.lcb.agreed_major_version = LLCP_VERSION_MAJOR; in llcp_link_version_agreement()
542 llcp_cb.lcb.agreed_minor_version = LLCP_VERSION_MINOR; in llcp_link_version_agreement()
544 llcp_cb.lcb.agreed_minor_version = peer_minor_version; in llcp_link_version_agreement()
548 llcp_cb.lcb.agreed_major_version = peer_major_version; in llcp_link_version_agreement()
549 llcp_cb.lcb.agreed_minor_version = peer_minor_version; in llcp_link_version_agreement()
552 llcp_cb.lcb.agreed_major_version = LLCP_VERSION_MAJOR; in llcp_link_version_agreement()
553 llcp_cb.lcb.agreed_minor_version = LLCP_VERSION_MINOR; in llcp_link_version_agreement()
559 peer_minor_version, llcp_cb.lcb.agreed_major_version, in llcp_link_version_agreement()
560 llcp_cb.lcb.agreed_minor_version); in llcp_link_version_agreement()
582 data.link_status.is_initiator = llcp_cb.lcb.is_initiator; in llcp_link_update_status()
610 if (llcp_cb.overall_tx_congested) { in llcp_link_check_congestion()
615 if (llcp_cb.total_tx_ui_pdu + llcp_cb.total_tx_i_pdu >= in llcp_link_check_congestion()
616 llcp_cb.max_num_tx_buff) { in llcp_link_check_congestion()
618 llcp_cb.overall_tx_congested = true; in llcp_link_check_congestion()
622 llcp_cb.total_tx_ui_pdu, llcp_cb.total_tx_i_pdu); in llcp_link_check_congestion()
654 if ((llcp_cb.dlcb[idx].state == LLCP_DLC_STATE_CONNECTED) && in llcp_link_check_congestion()
655 (llcp_cb.dlcb[idx].remote_busy == false) && in llcp_link_check_congestion()
656 (llcp_cb.dlcb[idx].is_tx_congested == false)) { in llcp_link_check_congestion()
657 llcp_cb.dlcb[idx].is_tx_congested = true; in llcp_link_check_congestion()
661 llcp_cb.dlcb[idx].local_sap, llcp_cb.dlcb[idx].remote_sap, in llcp_link_check_congestion()
662 llcp_cb.dlcb[idx].i_xmit_q.count); in llcp_link_check_congestion()
664 data.congest.local_sap = llcp_cb.dlcb[idx].local_sap; in llcp_link_check_congestion()
665 data.congest.remote_sap = llcp_cb.dlcb[idx].remote_sap; in llcp_link_check_congestion()
667 (*llcp_cb.dlcb[idx].p_app_cb->p_app_cback)(&data); in llcp_link_check_congestion()
689 if (llcp_cb.overall_tx_congested) { in llcp_link_check_uncongested()
690 if (llcp_cb.total_tx_ui_pdu + llcp_cb.total_tx_i_pdu <= in llcp_link_check_uncongested()
691 llcp_cb.max_num_tx_buff / 2) { in llcp_link_check_uncongested()
693 llcp_cb.overall_tx_congested = false; in llcp_link_check_uncongested()
697 llcp_cb.total_tx_ui_pdu, llcp_cb.total_tx_i_pdu); in llcp_link_check_uncongested()
708 if (llcp_cb.total_tx_ui_pdu < llcp_cb.max_num_ll_tx_buff) { in llcp_link_check_uncongested()
717 sap = llcp_cb.ll_tx_uncongest_ntf_start_sap; in llcp_link_check_uncongested()
727 (p_app_cb->ui_xmit_q.count <= llcp_cb.ll_tx_congest_end)) { in llcp_link_check_uncongested()
745 sap = (llcp_cb.ll_tx_uncongest_ntf_start_sap + 1) % LLCP_NUM_SAPS; in llcp_link_check_uncongested()
752 llcp_cb.ll_tx_uncongest_ntf_start_sap = sap; in llcp_link_check_uncongested()
766 idx = llcp_cb.dl_tx_uncongest_ntf_start_idx; in llcp_link_check_uncongested()
771 if ((llcp_cb.dlcb[idx].state == LLCP_DLC_STATE_CONNECTED) && in llcp_link_check_uncongested()
772 (llcp_cb.dlcb[idx].is_tx_congested) && in llcp_link_check_uncongested()
773 (llcp_cb.dlcb[idx].i_xmit_q.count <= llcp_cb.dlcb[idx].remote_rw / 2)) { in llcp_link_check_uncongested()
774 llcp_cb.dlcb[idx].is_tx_congested = false; in llcp_link_check_uncongested()
776 if (llcp_cb.dlcb[idx].remote_busy == false) { in llcp_link_check_uncongested()
779 llcp_cb.dlcb[idx].local_sap, llcp_cb.dlcb[idx].remote_sap, in llcp_link_check_uncongested()
780 llcp_cb.dlcb[idx].i_xmit_q.count); in llcp_link_check_uncongested()
782 data.congest.local_sap = llcp_cb.dlcb[idx].local_sap; in llcp_link_check_uncongested()
783 data.congest.remote_sap = llcp_cb.dlcb[idx].remote_sap; in llcp_link_check_uncongested()
785 (*llcp_cb.dlcb[idx].p_app_cb->p_app_cback)(&data); in llcp_link_check_uncongested()
793 idx = (llcp_cb.dl_tx_uncongest_ntf_start_idx + 1) % LLCP_MAX_DATA_LINK; in llcp_link_check_uncongested()
794 if (llcp_cb.dlcb[idx].state == LLCP_DLC_STATE_CONNECTED) { in llcp_link_check_uncongested()
795 llcp_cb.dl_tx_uncongest_ntf_start_idx = idx; in llcp_link_check_uncongested()
868 if (llcp_cb.lcb.is_sending_data) in llcp_link_check_send_data()
871 llcp_cb.lcb.is_sending_data = true; in llcp_link_check_send_data()
879 if (llcp_cb.lcb.symm_state == LLCP_LINK_SYMM_LOCAL_XMIT_NEXT || in llcp_link_check_send_data()
881 llcp_cb.lcb.link_state == LLCP_LINK_STATE_DEACTIVATING)) { in llcp_link_check_send_data()
912 if (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATED) { in llcp_link_check_send_data()
913 if (llcp_cb.lcb.symm_delay > 0) { in llcp_link_check_send_data()
916 llcp_cb.lcb.is_sending_data = false; in llcp_link_check_send_data()
922 if (llcp_cb.num_data_link_connection == 0) { in llcp_link_check_send_data()
927 llcp_cb.lcb.is_sending_data = false; in llcp_link_check_send_data()
932 if (llcp_cb.lcb.link_state == LLCP_LINK_STATE_DEACTIVATING) { in llcp_link_check_send_data()
934 nfc_start_quick_timer(&llcp_cb.lcb.timer, NFC_TTYPE_LLCP_LINK_MANAGER, in llcp_link_check_send_data()
942 llcp_cb.lcb.is_sending_data = false; in llcp_link_check_send_data()
1051 llcp_cb.total_rx_ui_pdu++; in llcp_link_proc_ui_pdu()
1055 if (p_app_cb->ui_rx_q.count > llcp_cb.ll_rx_congest_start) { in llcp_link_proc_ui_pdu()
1062 llcp_cb.total_rx_ui_pdu--; in llcp_link_proc_ui_pdu()
1268 if (llcp_cb.lcb.symm_state == LLCP_LINK_SYMM_REMOTE_XMIT_NEXT) { in llcp_link_proc_rx_data()
1271 if (llcp_cb.lcb.received_first_packet == false) { in llcp_link_proc_rx_data()
1272 llcp_cb.lcb.received_first_packet = true; in llcp_link_proc_rx_data()
1273 (*llcp_cb.lcb.p_link_cback)(LLCP_LINK_FIRST_PACKET_RECEIVED_EVT, in llcp_link_proc_rx_data()
1276 if ((llcp_cb.lcb.link_state == LLCP_LINK_STATE_DEACTIVATING) && in llcp_link_proc_rx_data()
1277 (llcp_cb.lcb.sig_xmit_q.count == 0)) { in llcp_link_proc_rx_data()
1313 if ((!frame_error) && (info_length > llcp_cb.lcb.local_link_miu)) { in llcp_link_proc_rx_data()
1316 llcp_cb.lcb.local_link_miu, info_length); in llcp_link_proc_rx_data()
1341 llcp_cb.lcb.symm_state = LLCP_LINK_SYMM_LOCAL_XMIT_NEXT; in llcp_link_proc_rx_data()
1370 if (llcp_cb.lcb.sig_xmit_q.p_first) { in llcp_link_get_next_pdu()
1372 p_msg = (NFC_HDR*)llcp_cb.lcb.sig_xmit_q.p_first; in llcp_link_get_next_pdu()
1376 p_msg = (NFC_HDR*)GKI_dequeue(&llcp_cb.lcb.sig_xmit_q); in llcp_link_get_next_pdu()
1382 if (!llcp_cb.lcb.ll_served) { in llcp_link_get_next_pdu()
1386 p_app_cb = llcp_util_get_app_cb(llcp_cb.lcb.ll_idx); in llcp_link_get_next_pdu()
1398 llcp_cb.lcb.ll_served = !llcp_cb.lcb.ll_served; in llcp_link_get_next_pdu()
1401 llcp_cb.total_tx_ui_pdu--; in llcp_link_get_next_pdu()
1405 llcp_cb.lcb.ll_idx = (llcp_cb.lcb.ll_idx + 1) % LLCP_NUM_SAPS; in llcp_link_get_next_pdu()
1411 llcp_cb.lcb.ll_idx = (llcp_cb.lcb.ll_idx + 1) % LLCP_NUM_SAPS; in llcp_link_get_next_pdu()
1416 llcp_cb.lcb.ll_served = !llcp_cb.lcb.ll_served; in llcp_link_get_next_pdu()
1421 if (llcp_cb.dlcb[llcp_cb.lcb.dl_idx].state != LLCP_DLC_STATE_IDLE) { in llcp_link_get_next_pdu()
1424 &llcp_cb.dlcb[llcp_cb.lcb.dl_idx]); in llcp_link_get_next_pdu()
1432 llcp_cb.lcb.dl_idx = in llcp_link_get_next_pdu()
1433 (llcp_cb.lcb.dl_idx + 1) % LLCP_MAX_DATA_LINK; in llcp_link_get_next_pdu()
1436 p_msg = llcp_dlc_get_next_pdu(&llcp_cb.dlcb[llcp_cb.lcb.dl_idx]); in llcp_link_get_next_pdu()
1440 llcp_cb.lcb.dl_idx = in llcp_link_get_next_pdu()
1441 (llcp_cb.lcb.dl_idx + 1) % LLCP_MAX_DATA_LINK; in llcp_link_get_next_pdu()
1445 llcp_cb.lcb.ll_served = !llcp_cb.lcb.ll_served; in llcp_link_get_next_pdu()
1451 llcp_cb.lcb.dl_idx = (llcp_cb.lcb.dl_idx + 1) % LLCP_MAX_DATA_LINK; in llcp_link_get_next_pdu()
1457 llcp_cb.lcb.ll_served = !llcp_cb.lcb.ll_served; in llcp_link_get_next_pdu()
1516 if (2 + p_msg->len + 2 + next_pdu_length <= llcp_cb.lcb.effective_miu) { in llcp_link_build_next_pdu()
1544 llcp_cb.lcb.effective_miu) { in llcp_link_build_next_pdu()
1581 llcp_cb.lcb.symm_state = LLCP_LINK_SYMM_REMOTE_XMIT_NEXT; in llcp_link_send_to_lower()
1597 if (llcp_cb.lcb.link_state == LLCP_LINK_STATE_DEACTIVATED) { in llcp_link_connection_cback()
1602 } else if (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATION_FAILED) { in llcp_link_connection_cback()
1610 llcp_cb.lcb.flags |= LLCP_LINK_FLAGS_RX_ANY_LLC_PDU; in llcp_link_connection_cback()
1617 if ((llcp_cb.lcb.link_state == LLCP_LINK_STATE_DEACTIVATING) && in llcp_link_connection_cback()
1618 (!llcp_cb.lcb.is_initiator)) { in llcp_link_connection_cback()
1622 } else if (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATION_FAILED) { in llcp_link_connection_cback()
1626 llcp_cb.lcb.link_state = LLCP_LINK_STATE_DEACTIVATED; in llcp_link_connection_cback()
1627 } else if (llcp_cb.lcb.link_state != LLCP_LINK_STATE_DEACTIVATED) { in llcp_link_connection_cback()
1633 if (llcp_cb.lcb.symm_state == LLCP_LINK_SYMM_REMOTE_XMIT_NEXT) { in llcp_link_connection_cback()