• Home
  • Raw
  • Download

Lines Matching refs:p_ccb

89 static BOOLEAN process_reqseq (tL2C_CCB *p_ccb, UINT16 ctrl_word);
90 static void process_s_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word);
91 static void process_i_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word, BOOLEAN delay_ack…
92 static BOOLEAN retransmit_i_frames (tL2C_CCB *p_ccb, UINT8 tx_seq);
93 static void prepare_I_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, BOOLEAN is_retransmission);
94 static void process_stream_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf);
95 static BOOLEAN do_sar_reassembly (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word);
98 static BOOLEAN l2c_corrupt_the_fcr_packet (tL2C_CCB *p_ccb, BT_HDR *p_buf,
100 static BOOLEAN l2c_bypass_sframe_packet (tL2C_CCB *p_ccb);
104 static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, UINT8 num_bufs_acked);
175 void l2c_fcr_start_timer (tL2C_CCB *p_ccb) in l2c_fcr_start_timer() argument
180 if (p_ccb->fcrb.wait_ack) in l2c_fcr_start_timer()
182 tout = (UINT32)p_ccb->our_cfg.fcr.mon_tout; in l2c_fcr_start_timer()
186 tout = (UINT32)p_ccb->our_cfg.fcr.rtrans_tout; in l2c_fcr_start_timer()
193 if (p_ccb->fcrb.mon_retrans_timer.in_use == 0) in l2c_fcr_start_timer()
194 …btu_start_quick_timer (&p_ccb->fcrb.mon_retrans_timer, BTU_TTYPE_L2CAP_CHNL, tout*QUICK_TIMER_TICK… in l2c_fcr_start_timer()
206 void l2c_fcr_stop_timer (tL2C_CCB *p_ccb) in l2c_fcr_stop_timer() argument
208 if (p_ccb->fcrb.mon_retrans_timer.in_use) in l2c_fcr_stop_timer()
214 btu_stop_quick_timer (&p_ccb->fcrb.mon_retrans_timer); in l2c_fcr_stop_timer()
227 void l2c_fcr_cleanup (tL2C_CCB *p_ccb) in l2c_fcr_cleanup() argument
229 tL2C_FCRB *p_fcrb = &p_ccb->fcrb; in l2c_fcr_cleanup()
231 l2c_fcr_stop_timer (p_ccb); in l2c_fcr_cleanup()
246 btu_stop_quick_timer (&p_ccb->fcrb.mon_retrans_timer); in l2c_fcr_cleanup()
249 …if ( (p_ccb->local_cid >= L2CAP_BASE_APPL_CID) && (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE… in l2c_fcr_cleanup()
251 UINT32 dur = GKI_get_os_tick_count() - p_ccb->fcrb.connect_tick_count; in l2c_fcr_cleanup()
258 … "--- L2CAP ERTM Stats for CID: 0x%04x Duration: %08ums", p_ccb->local_cid, dur); in l2c_fcr_cleanup()
261p_ccb->fcrb.pkts_retransmitted, p_ccb->fcrb.xmit_window_closed, p_ccb->fcrb.retrans_touts, p_ccb->… in l2c_fcr_cleanup()
263 …es there is less than 2 packets in controller when flow controlled:%08u", p_ccb->fcrb.controller_i… in l2c_fcr_cleanup()
265 …"max_held_acks:%08u, in_cfg.fcr.tx_win_sz:%08u", p_ccb->fcrb.max_held_acks, p_ccb->peer_cfg.fcr.tx… in l2c_fcr_cleanup()
269 p_ccb->fcrb.ertm_pkt_counts[0], p_ccb->fcrb.ertm_byte_counts[0], in l2c_fcr_cleanup()
270 (dur >= 10 ? (p_ccb->fcrb.ertm_byte_counts[0] * 100) / (dur / 10) : 0), in l2c_fcr_cleanup()
271p_ccb->fcrb.s_frames_sent[0], p_ccb->fcrb.s_frames_sent[1], p_ccb->fcrb.s_frames_sent[2], p_ccb->f… in l2c_fcr_cleanup()
276 p_ccb->fcrb.ertm_pkt_counts[1], p_ccb->fcrb.ertm_byte_counts[1], in l2c_fcr_cleanup()
277 (dur >= 10 ? (p_ccb->fcrb.ertm_byte_counts[1] * 100) / (dur / 10) : 0), in l2c_fcr_cleanup()
278p_ccb->fcrb.s_frames_rcvd[0], p_ccb->fcrb.s_frames_rcvd[1], p_ccb->fcrb.s_frames_rcvd[2], p_ccb->f… in l2c_fcr_cleanup()
288 if (i == p_ccb->fcrb.ack_delay_avg_index ) in l2c_fcr_cleanup()
296 i, p_ccb->fcrb.throughput[i], in l2c_fcr_cleanup()
297p_ccb->fcrb.ack_delay_avg[i], p_ccb->fcrb.ack_delay_min[i], p_ccb->fcrb.ack_delay_max[i], in l2c_fcr_cleanup()
298p_ccb->fcrb.ack_q_count_avg[i], p_ccb->fcrb.ack_q_count_min[i], p_ccb->fcrb.ack_q_count_max[i] ); in l2c_fcr_cleanup()
302 throughput_avg += p_ccb->fcrb.throughput[i]; in l2c_fcr_cleanup()
303 ack_delay_avg += p_ccb->fcrb.ack_delay_avg[i]; in l2c_fcr_cleanup()
304 ack_q_count_avg += p_ccb->fcrb.ack_q_count_avg[i]; in l2c_fcr_cleanup()
387 BOOLEAN l2c_fcr_is_flow_controlled (tL2C_CCB *p_ccb) in l2c_fcr_is_flow_controlled() argument
389 if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) in l2c_fcr_is_flow_controlled()
392 if ( (p_ccb->fcrb.remote_busy == TRUE) in l2c_fcr_is_flow_controlled()
393 || (p_ccb->fcrb.waiting_for_ack_q.count >= p_ccb->peer_cfg.fcr.tx_win_sz) ) in l2c_fcr_is_flow_controlled()
396 if (p_ccb->xmit_hold_q.count != 0) in l2c_fcr_is_flow_controlled()
398 p_ccb->fcrb.xmit_window_closed++; in l2c_fcr_is_flow_controlled()
400 if ((p_ccb->p_lcb->sent_not_acked < 2)&&(l2cb.controller_xmit_window > 0)) in l2c_fcr_is_flow_controlled()
401 p_ccb->fcrb.controller_idle++; in l2c_fcr_is_flow_controlled()
421 static void prepare_I_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, BOOLEAN is_retransmission) in prepare_I_frame() argument
423 tL2C_FCRB *p_fcrb = &p_ccb->fcrb; in prepare_I_frame()
449 if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) in prepare_I_frame()
456 p_fcrb->last_ack_sent = p_ccb->fcrb.next_seq_expected; in prepare_I_frame()
458 if (p_ccb->fcrb.ack_timer.in_use) in prepare_I_frame()
459 btu_stop_quick_timer (&p_ccb->fcrb.ack_timer); in prepare_I_frame()
468 if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) in prepare_I_frame()
489 p_ccb->local_cid, p_buf->len, in prepare_I_frame()
498 p_ccb->local_cid, p_buf->len, in prepare_I_frame()
507 if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) in prepare_I_frame()
508 l2c_fcr_start_timer (p_ccb); in prepare_I_frame()
520 void l2c_fcr_send_S_frame (tL2C_CCB *p_ccb, UINT16 function_code, UINT16 pf_bit) in l2c_fcr_send_S_frame() argument
529 if (l2c_bypass_sframe_packet (p_ccb)) in l2c_fcr_send_S_frame()
533 if ((!p_ccb->in_use) || (p_ccb->chnl_state != CST_OPEN)) in l2c_fcr_send_S_frame()
537 p_ccb->fcrb.s_frames_sent[function_code]++; in l2c_fcr_send_S_frame()
542 p_ccb->fcrb.wait_ack = TRUE; in l2c_fcr_send_S_frame()
544 l2c_fcr_stop_timer (p_ccb); /* Restart the monitor timer */ in l2c_fcr_send_S_frame()
545 l2c_fcr_start_timer (p_ccb); in l2c_fcr_send_S_frame()
550 ctrl_word |= (p_ccb->fcrb.next_seq_expected << L2CAP_FCR_REQ_SEQ_BITS_SHIFT); in l2c_fcr_send_S_frame()
563 UINT16_TO_STREAM (p, p_ccb->remote_cid); in l2c_fcr_send_S_frame()
567 if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) in l2c_fcr_send_S_frame()
582 if (l2c_corrupt_the_fcr_packet (p_ccb, p_buf, FALSE, ctrl_word)) in l2c_fcr_send_S_frame()
587 l2cu_set_acl_hci_header (p_buf, p_ccb); in l2c_fcr_send_S_frame()
594 p_ccb->local_cid, ctrl_word, in l2c_fcr_send_S_frame()
604 p_ccb->local_cid, ctrl_word, in l2c_fcr_send_S_frame()
613 l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, p_buf); in l2c_fcr_send_S_frame()
615 p_ccb->fcrb.last_ack_sent = p_ccb->fcrb.next_seq_expected; in l2c_fcr_send_S_frame()
617 if (p_ccb->fcrb.ack_timer.in_use) in l2c_fcr_send_S_frame()
618 btu_stop_quick_timer (&p_ccb->fcrb.ack_timer); in l2c_fcr_send_S_frame()
623 p_ccb->local_cid, function_code); in l2c_fcr_send_S_frame()
638 void l2c_fcr_proc_pdu (tL2C_CCB *p_ccb, BT_HDR *p_buf) in l2c_fcr_proc_pdu() argument
646 min_pdu_len = (p_ccb->bypass_fcs == L2CAP_BYPASS_FCS) ? in l2c_fcr_proc_pdu()
651 …L2CAP_TRACE_WARNING2 ("Rx L2CAP PDU: CID: 0x%04x Len too short: %u", p_ccb->local_cid, p_buf->len… in l2c_fcr_proc_pdu()
656 if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_STREAM_MODE) in l2c_fcr_proc_pdu()
658 process_stream_frame (p_ccb, p_buf); in l2c_fcr_proc_pdu()
674 p_ccb->local_cid, p_buf->len, in l2c_fcr_proc_pdu()
683 p_ccb->local_cid, p_buf->len, in l2c_fcr_proc_pdu()
693 p_ccb->local_cid, p_buf->len, in l2c_fcr_proc_pdu()
701p_ccb->fcrb.next_tx_seq, p_ccb->fcrb.last_rx_ack, p_ccb->fcrb.next_seq_expected, in l2c_fcr_proc_pdu()
702p_ccb->fcrb.last_ack_sent, p_ccb->fcrb.waiting_for_ack_q.count, p_ccb->fcrb.num_tries); in l2c_fcr_proc_pdu()
711 if (l2c_corrupt_the_fcr_packet (p_ccb, p_buf, TRUE, ctrl_word)) in l2c_fcr_proc_pdu()
716 if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) in l2c_fcr_proc_pdu()
726 L2CAP_TRACE_WARNING1 ("Rx L2CAP PDU: CID: 0x%04x BAD FCS", p_ccb->local_cid); in l2c_fcr_proc_pdu()
741 if (p_ccb->fcrb.wait_ack) in l2c_fcr_proc_pdu()
748 if (p_ccb->fcrb.srej_sent) in l2c_fcr_proc_pdu()
749 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_SREJ, L2CAP_FCR_F_BIT); in l2c_fcr_proc_pdu()
750 else if (p_ccb->fcrb.local_busy) in l2c_fcr_proc_pdu()
751 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, L2CAP_FCR_F_BIT); in l2c_fcr_proc_pdu()
753 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_F_BIT); in l2c_fcr_proc_pdu()
759 …btu_start_quick_timer (&p_ccb->fcrb.mon_retrans_timer, BTU_TTYPE_L2CAP_CHNL, QUICK_TIMER_TICKS_PER… in l2c_fcr_proc_pdu()
765 p_ccb->fcrb.wait_ack = FALSE; in l2c_fcr_proc_pdu()
771 if (p_ccb->fcrb.waiting_for_ack_q.count == 0) in l2c_fcr_proc_pdu()
772 p_ccb->fcrb.num_tries = 0; in l2c_fcr_proc_pdu()
774 l2c_fcr_stop_timer (p_ccb); in l2c_fcr_proc_pdu()
783 if (!process_reqseq (p_ccb, ctrl_word)) in l2c_fcr_proc_pdu()
791 process_s_frame (p_ccb, p_buf, ctrl_word); in l2c_fcr_proc_pdu()
793 process_i_frame (p_ccb, p_buf, ctrl_word, FALSE); in l2c_fcr_proc_pdu()
796 if ( (!p_ccb->in_use) || (p_ccb->chnl_state != CST_OPEN) ) in l2c_fcr_proc_pdu()
800 …if ( (!p_ccb->fcrb.local_busy) && (!p_ccb->fcrb.srej_sent) && (p_ccb->fcrb.srej_rcv_hold_q.count >… in l2c_fcr_proc_pdu()
802 BUFFER_Q temp_q = p_ccb->fcrb.srej_rcv_hold_q; in l2c_fcr_proc_pdu()
804 GKI_init_q (&p_ccb->fcrb.srej_rcv_hold_q); in l2c_fcr_proc_pdu()
808 if (p_ccb->in_use && (p_ccb->chnl_state == CST_OPEN)) in l2c_fcr_proc_pdu()
816p_ccb->local_cid, (ctrl_word & L2CAP_FCR_TX_SEQ_BITS) >> L2CAP_FCR_TX_SEQ_BITS_SHIFT, in l2c_fcr_proc_pdu()
817 p_ccb->fcrb.next_seq_expected); in l2c_fcr_proc_pdu()
820 process_i_frame (p_ccb, p_buf, ctrl_word, TRUE); in l2c_fcr_proc_pdu()
826 if (p_ccb->fcrb.rej_after_srej) in l2c_fcr_proc_pdu()
828 p_ccb->fcrb.rej_after_srej = FALSE; in l2c_fcr_proc_pdu()
829 p_ccb->fcrb.rej_sent = TRUE; in l2c_fcr_proc_pdu()
831 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_REJ, 0); in l2c_fcr_proc_pdu()
836 if ( (!p_ccb->fcrb.local_busy) && (!p_ccb->fcrb.rej_sent) && (!p_ccb->fcrb.srej_sent) in l2c_fcr_proc_pdu()
837 && (p_ccb->fcrb.next_seq_expected != p_ccb->fcrb.last_ack_sent) ) in l2c_fcr_proc_pdu()
838 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, 0); in l2c_fcr_proc_pdu()
842p_ccb->local_cid, p_ccb->fcrb.local_busy, p_ccb->fcrb.rej_sent, p_ccb->fcrb.srej_sent, p_ccb->fcrb… in l2c_fcr_proc_pdu()
843 p_ccb->fcrb.last_ack_sent); in l2c_fcr_proc_pdu()
848 if ( (p_ccb->fcrb.retrans_q.count || p_ccb->xmit_hold_q.count) in l2c_fcr_proc_pdu()
849 && (p_ccb->fcrb.wait_ack == FALSE) in l2c_fcr_proc_pdu()
850 && (l2c_fcr_is_flow_controlled (p_ccb) == FALSE) ) in l2c_fcr_proc_pdu()
852 l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, NULL); in l2c_fcr_proc_pdu()
865 void l2c_fcr_proc_tout (tL2C_CCB *p_ccb) in l2c_fcr_proc_tout() argument
868 p_ccb->local_cid, p_ccb->fcrb.num_tries, p_ccb->peer_cfg.fcr.max_transmit, in l2c_fcr_proc_tout()
869 p_ccb->fcrb.wait_ack, p_ccb->fcrb.waiting_for_ack_q.count); in l2c_fcr_proc_tout()
872 p_ccb->fcrb.retrans_touts++; in l2c_fcr_proc_tout()
875 …if ( (p_ccb->peer_cfg.fcr.max_transmit != 0) && (++p_ccb->fcrb.num_tries > p_ccb->peer_cfg.fcr.max… in l2c_fcr_proc_tout()
877 l2cu_disconnect_chnl (p_ccb); in l2c_fcr_proc_tout()
881 if (!p_ccb->fcrb.srej_sent && !p_ccb->fcrb.rej_sent) in l2c_fcr_proc_tout()
883 if (p_ccb->fcrb.local_busy) in l2c_fcr_proc_tout()
884 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, L2CAP_FCR_P_BIT); in l2c_fcr_proc_tout()
886 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_P_BIT); in l2c_fcr_proc_tout()
901 void l2c_fcr_proc_ack_tout (tL2C_CCB *p_ccb) in l2c_fcr_proc_ack_tout() argument
903 …EBUG5 ("l2c_fcr_proc_ack_tout: CID: 0x%04x State: %u Wack:%u Rq:%d Acked:%d", p_ccb->local_cid, in l2c_fcr_proc_ack_tout()
904p_ccb->chnl_state, p_ccb->fcrb.wait_ack, p_ccb->fcrb.next_seq_expected, p_ccb->fcrb.last_ack_sent); in l2c_fcr_proc_ack_tout()
906 if ( (p_ccb->chnl_state == CST_OPEN) && (!p_ccb->fcrb.wait_ack) in l2c_fcr_proc_ack_tout()
907 && (p_ccb->fcrb.last_ack_sent != p_ccb->fcrb.next_seq_expected) ) in l2c_fcr_proc_ack_tout()
910 p_ccb->fcrb.xmit_ack_touts++; in l2c_fcr_proc_ack_tout()
912 if (p_ccb->fcrb.local_busy) in l2c_fcr_proc_ack_tout()
913 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, 0); in l2c_fcr_proc_ack_tout()
915 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, 0); in l2c_fcr_proc_ack_tout()
929 static BOOLEAN process_reqseq (tL2C_CCB *p_ccb, UINT16 ctrl_word) in process_reqseq() argument
931 tL2C_FCRB *p_fcrb = &p_ccb->fcrb; in process_reqseq()
943 l2c_fcr_start_timer (p_ccb); in process_reqseq()
960 l2cu_disconnect_chnl (p_ccb); in process_reqseq()
977 l2c_fcr_collect_ack_delay (p_ccb, num_bufs_acked); in process_reqseq()
991 if (!p_ccb->fcrb.wait_ack) in process_reqseq()
992 l2c_fcr_stop_timer (p_ccb); in process_reqseq()
995 if ( (p_ccb->p_rcb) && (p_ccb->p_rcb->api.pL2CA_TxComplete_Cb) && (full_sdus_xmitted) ) in process_reqseq()
998 if ( (p_fcrb->waiting_for_ack_q.count == 0) && (p_ccb->xmit_hold_q.count == 0) ) in process_reqseq()
1001 (*p_ccb->p_rcb->api.pL2CA_TxComplete_Cb)(p_ccb->local_cid, full_sdus_xmitted); in process_reqseq()
1007 l2c_fcr_start_timer (p_ccb); in process_reqseq()
1022 static void process_s_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word) in process_s_frame() argument
1024 tL2C_FCRB *p_fcrb = &p_ccb->fcrb; in process_s_frame()
1037 p_ccb->fcrb.s_frames_rcvd[s_frame_type]++; in process_s_frame()
1053 all_ok = retransmit_i_frames (p_ccb, L2C_FCR_RETX_ALL_PKTS); in process_s_frame()
1058 all_ok = retransmit_i_frames (p_ccb, L2C_FCR_RETX_ALL_PKTS); in process_s_frame()
1063 l2c_fcr_stop_timer (p_ccb); in process_s_frame()
1068 …all_ok = retransmit_i_frames (p_ccb, (UINT8)((ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ… in process_s_frame()
1078 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_SREJ, L2CAP_FCR_F_BIT); in process_s_frame()
1080 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, L2CAP_FCR_F_BIT); in process_s_frame()
1082 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_F_BIT); in process_s_frame()
1105 static void process_i_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word, BOOLEAN delay_ack) in process_i_frame() argument
1107 tL2C_FCRB *p_fcrb = &p_ccb->fcrb; in process_i_frame()
1113 if (!retransmit_i_frames (p_ccb, L2C_FCR_RETX_ALL_PKTS)) in process_i_frame()
1121 p_ccb->fcrb.ertm_pkt_counts[1]++; in process_i_frame()
1122 p_ccb->fcrb.ertm_byte_counts[1] += p_buf->len; in process_i_frame()
1132 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, 0); in process_i_frame()
1139 if (GKI_poolfreecount (p_ccb->ertm_info.user_rx_pool_id) == 0) in process_i_frame()
1142 p_ccb->local_cid, tx_seq, p_ccb->ertm_info.user_rx_pool_id, in process_i_frame()
1143 GKI_poolcount (p_ccb->ertm_info.user_rx_pool_id)); in process_i_frame()
1154 if (num_lost >= p_ccb->our_cfg.fcr.tx_win_sz) in process_i_frame()
1163p_ccb->local_cid, num_lost, tx_seq, p_fcrb->next_seq_expected, p_fcrb->rej_sent, p_fcrb->srej_sent… in process_i_frame()
1170 … if ( (tx_seq == next_srej) && (p_fcrb->srej_rcv_hold_q.count < p_ccb->our_cfg.fcr.tx_win_sz) ) in process_i_frame()
1173 if (p_ccb->ertm_info.fcr_rx_pool_id != HCI_ACL_POOL_ID) in process_i_frame()
1181 … p_buf2 = l2c_fcr_clone_buf (p_buf, p_buf->offset, p_buf->len, p_ccb->ertm_info.fcr_rx_pool_id); in process_i_frame()
1200p_ccb->local_cid, next_srej, p_fcrb->srej_rcv_hold_q.count, p_ccb->our_cfg.fcr.tx_win_sz); in process_i_frame()
1209p_ccb->local_cid, num_lost, tx_seq, p_fcrb->next_seq_expected, p_fcrb->srej_sent); in process_i_frame()
1217p_ccb->local_cid, tx_seq, p_fcrb->next_seq_expected, p_fcrb->rej_sent); in process_i_frame()
1224 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_REJ, 0); in process_i_frame()
1231p_ccb->local_cid, tx_seq, p_fcrb->srej_rcv_hold_q.count); in process_i_frame()
1236 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_SREJ, 0); in process_i_frame()
1238 btu_stop_quick_timer (&p_ccb->fcrb.ack_timer); in process_i_frame()
1252 if (!do_sar_reassembly (p_ccb, p_buf, ctrl_word)) in process_i_frame()
1254 L2CAP_TRACE_WARNING1 ("process_i_frame() CID: 0x%04x reassembly failed", p_ccb->local_cid); in process_i_frame()
1255 l2cu_disconnect_chnl (p_ccb); in process_i_frame()
1262 if ( (num_to_ack < p_ccb->fcrb.max_held_acks) && (!p_fcrb->local_busy) ) in process_i_frame()
1266 if ((num_to_ack != 0) && p_ccb->in_use && (p_ccb->chnl_state == CST_OPEN)) in process_i_frame()
1272 if (!p_ccb->fcrb.ack_timer.in_use) in process_i_frame()
1274 btu_start_quick_timer (&p_ccb->fcrb.ack_timer, BTU_TTYPE_L2CAP_FCR_ACK, in process_i_frame()
1278 else if ( ((p_ccb->xmit_hold_q.count == 0) || (l2c_fcr_is_flow_controlled (p_ccb))) in process_i_frame()
1279 && (p_ccb->fcrb.srej_rcv_hold_q.count == 0) ) in process_i_frame()
1282 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, 0); in process_i_frame()
1284 l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, 0); in process_i_frame()
1299 static void process_stream_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf) in process_stream_frame() argument
1307 if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) in process_stream_frame()
1317 L2CAP_TRACE_WARNING1 ("Rx L2CAP PDU: CID: 0x%04x BAD FCS", p_ccb->local_cid); in process_stream_frame()
1334 …2CAP PDU: CID: 0x%04x BAD S-frame in streaming mode ctrl_word: 0x%04x", p_ccb->local_cid, ctrl_w… in process_stream_frame()
1341 p_ccb->local_cid, p_buf->len, in process_stream_frame()
1352 if (tx_seq != p_ccb->fcrb.next_seq_expected) in process_stream_frame()
1355p_ccb->local_cid, p_ccb->fcrb.next_seq_expected, tx_seq, p_ccb->fcrb.p_rx_sdu); in process_stream_frame()
1358 if (p_ccb->fcrb.p_rx_sdu != NULL) in process_stream_frame()
1360 GKI_freebuf (p_ccb->fcrb.p_rx_sdu); in process_stream_frame()
1361 p_ccb->fcrb.p_rx_sdu = NULL; in process_stream_frame()
1365 p_ccb->fcrb.next_seq_expected = (tx_seq + 1) & L2CAP_FCR_SEQ_MODULO; in process_stream_frame()
1367 if (!do_sar_reassembly (p_ccb, p_buf, ctrl_word)) in process_stream_frame()
1370 if (p_ccb->fcrb.p_rx_sdu != NULL) in process_stream_frame()
1372 GKI_freebuf (p_ccb->fcrb.p_rx_sdu); in process_stream_frame()
1373 p_ccb->fcrb.p_rx_sdu = NULL; in process_stream_frame()
1388 static BOOLEAN do_sar_reassembly (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word) in do_sar_reassembly() argument
1390 tL2C_FCRB *p_fcrb = &p_ccb->fcrb; in do_sar_reassembly()
1433 if (p_fcrb->rx_sdu_len > p_ccb->max_rx_mtu) in do_sar_reassembly()
1438 … else if ((p_fcrb->p_rx_sdu = (BT_HDR *)GKI_getpoolbuf (p_ccb->ertm_info.user_rx_pool_id)) == NULL) in do_sar_reassembly()
1440 …L2CAP_TRACE_ERROR1 ("SAR - no buffer for SDU start user_rx_pool_id:%d", p_ccb->ertm_info.user_rx_p… in do_sar_reassembly()
1489 if (p_ccb->local_cid < L2CAP_BASE_APPL_CID && in do_sar_reassembly()
1490 … (p_ccb->local_cid >= L2CAP_FIRST_FIXED_CHNL && p_ccb->local_cid <= L2CAP_LAST_FIXED_CHNL)) in do_sar_reassembly()
1492 if (l2cb.fixed_reg[p_ccb->local_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb) in do_sar_reassembly()
1493 …(*l2cb.fixed_reg[p_ccb->local_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)(p_ccb->p_lcb->remo… in do_sar_reassembly()
1497 l2c_csm_execute (p_ccb, L2CEVT_L2CAP_DATA, p_buf); in do_sar_reassembly()
1513 static BOOLEAN retransmit_i_frames (tL2C_CCB *p_ccb, UINT8 tx_seq) in retransmit_i_frames() argument
1520 if ( (p_ccb->fcrb.waiting_for_ack_q.p_first) in retransmit_i_frames()
1521 && (p_ccb->peer_cfg.fcr.max_transmit != 0) in retransmit_i_frames()
1522 && (p_ccb->fcrb.num_tries >= p_ccb->peer_cfg.fcr.max_transmit) ) in retransmit_i_frames()
1525p_ccb->fcrb.last_rx_ack, p_ccb->local_cid, p_ccb->fcrb.num_tries, p_ccb->peer_cfg.fcr.max_transmit, in retransmit_i_frames()
1526 p_ccb->fcrb.waiting_for_ack_q.count); in retransmit_i_frames()
1528 l2cu_disconnect_chnl (p_ccb); in retransmit_i_frames()
1537 …for (p_buf = (BT_HDR *)p_ccb->fcrb.waiting_for_ack_q.p_first; p_buf; p_buf = (BT_HDR *)GKI_getnext… in retransmit_i_frames()
1554 …L2CAP_TRACE_ERROR2 ("retransmit_i_frames() UNKNOWN seq: %u q_count: %u", tx_seq, p_ccb->fcrb.wait… in retransmit_i_frames()
1562 p_buf = (BT_HDR *)p_ccb->p_lcb->link_xmit_data_q.p_first; in retransmit_i_frames()
1567 if ( (p_buf->layer_specific == 0) && (p_buf->event == p_ccb->local_cid) ) in retransmit_i_frames()
1572 GKI_remove_from_queue (&p_ccb->p_lcb->link_xmit_data_q, p_buf2); in retransmit_i_frames()
1580 while (p_ccb->fcrb.retrans_q.p_first) in retransmit_i_frames()
1581 GKI_freebuf (GKI_dequeue (&p_ccb->fcrb.retrans_q)); in retransmit_i_frames()
1583 p_buf = (BT_HDR *)p_ccb->fcrb.waiting_for_ack_q.p_first; in retransmit_i_frames()
1588 … p_buf2 = l2c_fcr_clone_buf (p_buf, p_buf->offset, p_buf->len, p_ccb->ertm_info.fcr_tx_pool_id); in retransmit_i_frames()
1594 GKI_enqueue (&p_ccb->fcrb.retrans_q, p_buf2); in retransmit_i_frames()
1603 l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, NULL); in retransmit_i_frames()
1605 if (p_ccb->fcrb.waiting_for_ack_q.count) in retransmit_i_frames()
1607 p_ccb->fcrb.num_tries++; in retransmit_i_frames()
1608 l2c_fcr_start_timer (p_ccb); in retransmit_i_frames()
1624 BT_HDR *l2c_fcr_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, UINT16 max_packet_length) in l2c_fcr_get_next_xmit_sdu_seg() argument
1632 UINT16 max_pdu = p_ccb->tx_mps /* Needed? - L2CAP_MAX_HEADER_FCS*/; in l2c_fcr_get_next_xmit_sdu_seg()
1636 if (p_ccb->fcrb.retrans_q.p_first) in l2c_fcr_get_next_xmit_sdu_seg()
1638 p_buf = (BT_HDR *)GKI_dequeue (&p_ccb->fcrb.retrans_q); in l2c_fcr_get_next_xmit_sdu_seg()
1641 prepare_I_frame (p_ccb, p_buf, TRUE); in l2c_fcr_get_next_xmit_sdu_seg()
1643 p_buf->event = p_ccb->local_cid; in l2c_fcr_get_next_xmit_sdu_seg()
1651 if (l2c_corrupt_the_fcr_packet (p_ccb, p_buf, FALSE, sdu_len)) in l2c_fcr_get_next_xmit_sdu_seg()
1656 p_ccb->fcrb.pkts_retransmitted++; in l2c_fcr_get_next_xmit_sdu_seg()
1657 p_ccb->fcrb.ertm_pkt_counts[0]++; in l2c_fcr_get_next_xmit_sdu_seg()
1658 p_ccb->fcrb.ertm_byte_counts[0] += (p_buf->len - 8); in l2c_fcr_get_next_xmit_sdu_seg()
1671 p_buf = (BT_HDR *)p_ccb->xmit_hold_q.p_first; in l2c_fcr_get_next_xmit_sdu_seg()
1687 max_pdu, p_ccb->ertm_info.fcr_tx_pool_id); in l2c_fcr_get_next_xmit_sdu_seg()
1691 p_buf->event = p_ccb->local_cid; in l2c_fcr_get_next_xmit_sdu_seg()
1692 p_xmit->event = p_ccb->local_cid; in l2c_fcr_get_next_xmit_sdu_seg()
1702 …L2CAP_TRACE_ERROR1 ("L2CAP - cannot get buffer, for segmentation, pool: %u", p_ccb->ertm_info.fcr_… in l2c_fcr_get_next_xmit_sdu_seg()
1708 p_xmit = (BT_HDR *)GKI_dequeue (&p_ccb->xmit_hold_q); in l2c_fcr_get_next_xmit_sdu_seg()
1713 p_xmit->event = p_ccb->local_cid; in l2c_fcr_get_next_xmit_sdu_seg()
1734 UINT16_TO_STREAM (p, p_ccb->remote_cid); in l2c_fcr_get_next_xmit_sdu_seg()
1755 prepare_I_frame (p_ccb, p_xmit, FALSE); in l2c_fcr_get_next_xmit_sdu_seg()
1757 if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) in l2c_fcr_get_next_xmit_sdu_seg()
1759 …BT_HDR *p_wack = l2c_fcr_clone_buf (p_xmit, HCI_DATA_PREAMBLE_SIZE, p_xmit->len, p_ccb->ertm_info.… in l2c_fcr_get_next_xmit_sdu_seg()
1764p_ccb->local_cid, p_ccb->ertm_info.fcr_tx_pool_id, GKI_poolfreecount(p_ccb->ertm_info.fcr_tx_pool… in l2c_fcr_get_next_xmit_sdu_seg()
1767 if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) in l2c_fcr_get_next_xmit_sdu_seg()
1771 GKI_enqueue (&p_ccb->fcrb.waiting_for_ack_q, p_xmit); in l2c_fcr_get_next_xmit_sdu_seg()
1782 if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) in l2c_fcr_get_next_xmit_sdu_seg()
1786 GKI_enqueue (&p_ccb->fcrb.waiting_for_ack_q, p_wack); in l2c_fcr_get_next_xmit_sdu_seg()
1796 if (l2c_corrupt_the_fcr_packet (p_ccb, p_xmit, FALSE, ctrl_word)) in l2c_fcr_get_next_xmit_sdu_seg()
1801 p_ccb->fcrb.ertm_pkt_counts[0]++; in l2c_fcr_get_next_xmit_sdu_seg()
1802 p_ccb->fcrb.ertm_byte_counts[0] += (p_xmit->len - 8); in l2c_fcr_get_next_xmit_sdu_seg()
1831 UINT8 l2c_fcr_chk_chan_modes (tL2C_CCB *p_ccb) in l2c_fcr_chk_chan_modes() argument
1834 if (!(p_ccb->p_lcb->peer_ext_fea & L2CAP_EXTFEA_ENH_RETRANS)) in l2c_fcr_chk_chan_modes()
1835 p_ccb->ertm_info.allowed_modes &= ~L2CAP_FCR_CHAN_OPT_ERTM; in l2c_fcr_chk_chan_modes()
1837 if (!(p_ccb->p_lcb->peer_ext_fea & L2CAP_EXTFEA_STREAM_MODE)) in l2c_fcr_chk_chan_modes()
1838 p_ccb->ertm_info.allowed_modes &= ~L2CAP_FCR_CHAN_OPT_STREAM; in l2c_fcr_chk_chan_modes()
1841 if (!p_ccb->ertm_info.allowed_modes) in l2c_fcr_chk_chan_modes()
1846 return (p_ccb->ertm_info.allowed_modes); in l2c_fcr_chk_chan_modes()
1859 BOOLEAN l2c_fcr_adj_our_req_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) in l2c_fcr_adj_our_req_options() argument
1863 if (p_fcr->mode != p_ccb->ertm_info.preferred_mode) in l2c_fcr_adj_our_req_options()
1866 p_ccb->ertm_info.preferred_mode, p_fcr->mode); in l2c_fcr_adj_our_req_options()
1869 p_fcr->mode = p_ccb->ertm_info.preferred_mode; in l2c_fcr_adj_our_req_options()
1873 if (p_ccb->ertm_info.allowed_modes == L2CAP_FCR_CHAN_OPT_BASIC) in l2c_fcr_adj_our_req_options()
1885 if (p_cfg->fcr_present && !(p_ccb->config_done & RECONFIG_FLAG)) in l2c_fcr_adj_our_req_options()
1888 if (!l2c_fcr_chk_chan_modes(p_ccb)) in l2c_fcr_adj_our_req_options()
1891 l2cu_disconnect_chnl (p_ccb); in l2c_fcr_adj_our_req_options()
1896 else if (p_ccb->ertm_info.allowed_modes == L2CAP_FCR_CHAN_OPT_BASIC) in l2c_fcr_adj_our_req_options()
1910 …if (p_fcr->mode == L2CAP_FCR_STREAM_MODE && !(p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_… in l2c_fcr_adj_our_req_options()
1917 …if (p_fcr->mode == L2CAP_FCR_ERTM_MODE && !(p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_ER… in l2c_fcr_adj_our_req_options()
1927 if ( (p_cfg->mtu_present) && (p_cfg->mtu > p_ccb->max_rx_mtu) ) in l2c_fcr_adj_our_req_options()
1929 … L2CAP_TRACE_WARNING2 ("L2CAP - MTU: %u larger than buf size: %u", p_cfg->mtu, p_ccb->max_rx_mtu); in l2c_fcr_adj_our_req_options()
1939 else if (p_fcr->mps > p_ccb->max_rx_mtu) in l2c_fcr_adj_our_req_options()
1941 … L2CAP_TRACE_WARNING2 ("L2CAP - MPS %u invalid MTU: %u", p_fcr->mps, p_ccb->max_rx_mtu); in l2c_fcr_adj_our_req_options()
1955 p_ccb->our_cfg.fcr = *p_fcr; in l2c_fcr_adj_our_req_options()
1959 p_ccb->our_cfg.fcr_present = FALSE; in l2c_fcr_adj_our_req_options()
1975 void l2c_fcr_adj_monitor_retran_timeout (tL2C_CCB *p_ccb) in l2c_fcr_adj_monitor_retran_timeout() argument
1978 if (p_ccb->out_cfg_fcr_present) in l2c_fcr_adj_monitor_retran_timeout()
1984 if ((p_ccb->our_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) in l2c_fcr_adj_monitor_retran_timeout()
1985 ||(p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE)) in l2c_fcr_adj_monitor_retran_timeout()
1988 p_ccb->our_cfg.fcr.mon_tout = L2CAP_MIN_MONITOR_TOUT; in l2c_fcr_adj_monitor_retran_timeout()
1989 p_ccb->our_cfg.fcr.rtrans_tout = L2CAP_MIN_RETRANS_TOUT; in l2c_fcr_adj_monitor_retran_timeout()
1993 p_ccb->our_cfg.fcr.mon_tout = 0; in l2c_fcr_adj_monitor_retran_timeout()
1994 p_ccb->our_cfg.fcr.rtrans_tout = 0; in l2c_fcr_adj_monitor_retran_timeout()
1998 p_ccb->our_cfg.fcr.mon_tout, p_ccb->our_cfg.fcr.rtrans_tout); in l2c_fcr_adj_monitor_retran_timeout()
2012 void l2c_fcr_adj_our_rsp_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) in l2c_fcr_adj_our_rsp_options() argument
2015 l2c_fcr_adj_monitor_retran_timeout(p_ccb); in l2c_fcr_adj_our_rsp_options()
2017 p_cfg->fcr_present = p_ccb->out_cfg_fcr_present; in l2c_fcr_adj_our_rsp_options()
2025 if (p_ccb->peer_cfg.fcr.tx_win_sz > p_ccb->our_cfg.fcr.tx_win_sz) in l2c_fcr_adj_our_rsp_options()
2027 …justing requested tx_win_sz from %i to %i", __FUNCTION__, p_ccb->peer_cfg.fcr.tx_win_sz, p_ccb->ou… in l2c_fcr_adj_our_rsp_options()
2028 p_ccb->peer_cfg.fcr.tx_win_sz = p_ccb->our_cfg.fcr.tx_win_sz; in l2c_fcr_adj_our_rsp_options()
2032 p_cfg->fcr.mode = p_ccb->peer_cfg.fcr.mode; in l2c_fcr_adj_our_rsp_options()
2033 p_cfg->fcr.tx_win_sz = p_ccb->peer_cfg.fcr.tx_win_sz; in l2c_fcr_adj_our_rsp_options()
2034 p_cfg->fcr.max_transmit = p_ccb->peer_cfg.fcr.max_transmit; in l2c_fcr_adj_our_rsp_options()
2035 p_cfg->fcr.mps = p_ccb->peer_cfg.fcr.mps; in l2c_fcr_adj_our_rsp_options()
2036 p_cfg->fcr.rtrans_tout = p_ccb->our_cfg.fcr.rtrans_tout; in l2c_fcr_adj_our_rsp_options()
2037 p_cfg->fcr.mon_tout = p_ccb->our_cfg.fcr.mon_tout; in l2c_fcr_adj_our_rsp_options()
2053 BOOLEAN l2c_fcr_renegotiate_chan(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) in l2c_fcr_renegotiate_chan() argument
2055 UINT8 peer_mode = p_ccb->our_cfg.fcr.mode; in l2c_fcr_renegotiate_chan()
2059 if (!p_cfg->fcr_present || (p_ccb->config_done & RECONFIG_FLAG)) in l2c_fcr_renegotiate_chan()
2067 if (p_ccb->our_cfg.fcr.mode != peer_mode) in l2c_fcr_renegotiate_chan()
2070 if ((--p_ccb->fcr_cfg_tries) == 0) in l2c_fcr_renegotiate_chan()
2079 switch (p_ccb->our_cfg.fcr.mode) in l2c_fcr_renegotiate_chan()
2084 …if ( (peer_mode == L2CAP_FCR_ERTM_MODE) && (p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_ER… in l2c_fcr_renegotiate_chan()
2087 p_ccb->our_cfg.fcr.mode = L2CAP_FCR_ERTM_MODE; in l2c_fcr_renegotiate_chan()
2095 if (p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_BASIC) in l2c_fcr_renegotiate_chan()
2099 p_ccb->our_cfg.fcr.mode = L2CAP_FCR_BASIC_MODE; in l2c_fcr_renegotiate_chan()
2111 p_ccb->our_cfg.fcr_present = TRUE; in l2c_fcr_renegotiate_chan()
2113 if (p_ccb->our_cfg.fcr.mode == L2CAP_FCR_BASIC_MODE) in l2c_fcr_renegotiate_chan()
2115 p_ccb->our_cfg.fcs_present = FALSE; in l2c_fcr_renegotiate_chan()
2116 p_ccb->our_cfg.ext_flow_spec_present = FALSE; in l2c_fcr_renegotiate_chan()
2126 l2cu_process_our_cfg_req (p_ccb, &p_ccb->our_cfg); in l2c_fcr_renegotiate_chan()
2127 l2cu_send_peer_config_req (p_ccb, &p_ccb->our_cfg); in l2c_fcr_renegotiate_chan()
2128 btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_L2CAP_CHNL, L2CAP_CHNL_CFG_TIMEOUT); in l2c_fcr_renegotiate_chan()
2135 if (p_ccb->our_cfg.fcr.mode != peer_mode) in l2c_fcr_renegotiate_chan()
2138 p_ccb->our_cfg.fcr.mode, peer_mode); in l2c_fcr_renegotiate_chan()
2139 l2cu_disconnect_chnl (p_ccb); in l2c_fcr_renegotiate_chan()
2157 UINT8 l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) in l2c_fcr_process_peer_cfg_req() argument
2162 p_ccb->p_lcb->w4_info_rsp = FALSE; /* Handles T61x SonyEricsson Bug in Info Request */ in l2c_fcr_process_peer_cfg_req()
2165 … p_cfg->fcr_present, p_cfg->fcr.mode, p_ccb->our_cfg.fcr.mode, p_ccb->ertm_info.preferred_mode, in l2c_fcr_process_peer_cfg_req()
2166 p_ccb->ertm_info.allowed_modes); in l2c_fcr_process_peer_cfg_req()
2172 if ( !(p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_BASIC) ) in l2c_fcr_process_peer_cfg_req()
2177 else if (p_cfg->fcr.mode != p_ccb->ertm_info.preferred_mode) in l2c_fcr_process_peer_cfg_req()
2185 || (p_ccb->ertm_info.preferred_mode == L2CAP_FCR_ERTM_MODE) ) in l2c_fcr_process_peer_cfg_req()
2187 p_cfg->fcr.mode = p_ccb->our_cfg.fcr.mode; in l2c_fcr_process_peer_cfg_req()
2188 p_cfg->fcr.tx_win_sz = p_ccb->our_cfg.fcr.tx_win_sz; in l2c_fcr_process_peer_cfg_req()
2189 p_cfg->fcr.max_transmit = p_ccb->our_cfg.fcr.max_transmit; in l2c_fcr_process_peer_cfg_req()
2194 else if (p_ccb->ertm_info.preferred_mode == L2CAP_FCR_BASIC_MODE) in l2c_fcr_process_peer_cfg_req()
2199p_ccb->our_cfg.fcr.rtrans_tout = p_ccb->our_cfg.fcr.mon_tout = p_ccb->our_cfg.fcr.mps = 0; in l2c_fcr_process_peer_cfg_req()
2206 || !(p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_ERTM) ) in l2c_fcr_process_peer_cfg_req()
2216 p_ccb->out_cfg_fcr_present = FALSE; in l2c_fcr_process_peer_cfg_req()
2224 p_ccb->peer_cfg.fcs = p_cfg->fcs; in l2c_fcr_process_peer_cfg_req()
2225 p_ccb->peer_cfg_bits |= L2CAP_CH_CFG_MASK_FCS; in l2c_fcr_process_peer_cfg_req()
2227 p_ccb->bypass_fcs |= L2CAP_CFG_FCS_PEER; in l2c_fcr_process_peer_cfg_req()
2230 … max_retrans_size = GKI_get_pool_bufsize (p_ccb->ertm_info.fcr_tx_pool_id) - sizeof(BT_HDR) in l2c_fcr_process_peer_cfg_req()
2234 if ( (p_cfg->fcr.mps == 0) || (p_cfg->fcr.mps > p_ccb->peer_cfg.mtu) ) in l2c_fcr_process_peer_cfg_req()
2236 p_cfg->fcr.mps = p_ccb->peer_cfg.mtu; in l2c_fcr_process_peer_cfg_req()
2237 p_ccb->out_cfg_fcr_present = TRUE; in l2c_fcr_process_peer_cfg_req()
2246 p_ccb->out_cfg_fcr_present = TRUE; in l2c_fcr_process_peer_cfg_req()
2252 p_ccb->out_cfg_fcr_present = TRUE; in l2c_fcr_process_peer_cfg_req()
2257 p_ccb->peer_cfg.fcr = p_cfg->fcr; in l2c_fcr_process_peer_cfg_req()
2260 p_ccb->peer_cfg_bits |= L2CAP_CH_CFG_MASK_FCR; in l2c_fcr_process_peer_cfg_req()
2265 if (p_ccb->peer_cfg_already_rejected) in l2c_fcr_process_peer_cfg_req()
2268 p_ccb->peer_cfg_already_rejected = TRUE; in l2c_fcr_process_peer_cfg_req()
2297 static BOOLEAN l2c_corrupt_the_fcr_packet (tL2C_CCB *p_ccb, BT_HDR *p_buf, in l2c_corrupt_the_fcr_packet() argument
2306 if (!p_ccb || !p_ccb->fcrb.test_cb.cfg.in_use) in l2c_corrupt_the_fcr_packet()
2315 p_cfg = &p_ccb->fcrb.test_cb.cfg; in l2c_corrupt_the_fcr_packet()
2338 p_ccb->fcrb.test_cb.cfg.in_use = FALSE; in l2c_corrupt_the_fcr_packet()
2383 if (!is_rx || p_ccb->bypass_fcs == L2CAP_BYPASS_FCS) in l2c_corrupt_the_fcr_packet()
2427 tL2C_CCB *p_ccb = NULL; in L2CA_SetupErtmTest() local
2441 p_ccb = p_temp_ccb; in L2CA_SetupErtmTest()
2448 p_ccb = l2cu_find_ccb_by_cid (NULL, cid); in L2CA_SetupErtmTest()
2450 if (!p_ccb || type == L2CAP_FCR_TTYPE_GET_CID) in L2CA_SetupErtmTest()
2459 p_test_cb = &p_ccb->fcrb.test_cb; in L2CA_SetupErtmTest()
2522 tL2C_CCB *p_ccb = l2cu_find_ccb_by_cid (NULL, cid); in L2CA_SendPolledSFrame() local
2524 if (p_ccb && (sup_type == L2CAP_FCR_SUP_RR || sup_type == L2CAP_FCR_SUP_RNR)) in L2CA_SendPolledSFrame()
2526 l2c_fcr_send_S_frame (p_ccb, sup_type, L2CAP_FCR_P_BIT); in L2CA_SendPolledSFrame()
2531 sup_type, (UINT32)p_ccb); in L2CA_SendPolledSFrame()
2545 static BOOLEAN l2c_bypass_sframe_packet (tL2C_CCB *p_ccb) in l2c_bypass_sframe_packet() argument
2547 if (p_ccb && p_ccb->fcrb.test_cb.cfm.in_use) in l2c_bypass_sframe_packet()
2549 if (p_ccb->fcrb.test_cb.cfm.skip_sframe_count > 0) in l2c_bypass_sframe_packet()
2552 p_ccb->fcrb.test_cb.cfm.skip_sframe_count); in l2c_bypass_sframe_packet()
2554 if (--p_ccb->fcrb.test_cb.cfm.skip_sframe_count == 0) in l2c_bypass_sframe_packet()
2555 p_ccb->fcrb.test_cb.cfm.in_use = FALSE; in l2c_bypass_sframe_packet()
2561 p_ccb->fcrb.test_cb.cfm.in_use = FALSE; in l2c_bypass_sframe_packet()
2584 tL2C_CCB *p_ccb = l2cu_find_ccb_by_cid (NULL, cid); in L2CA_BypassSFrame() local
2587 if (!p_ccb) in L2CA_BypassSFrame()
2589 L2CAP_TRACE_WARNING1 ("L2CA_BypassSFrame(ERROR): no p_ccb (0x%07x)", (UINT32)p_ccb); in L2CA_BypassSFrame()
2593 p_test_cb = &p_ccb->fcrb.test_cb.cfm; in L2CA_BypassSFrame()
2622 static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, UINT8 num_bufs_acked) in l2c_fcr_collect_ack_delay() argument
2631 index = p_ccb->fcrb.ack_delay_avg_index; in l2c_fcr_collect_ack_delay()
2634 p_ccb->fcrb.ack_q_count_avg[index] += p_ccb->fcrb.waiting_for_ack_q.count; in l2c_fcr_collect_ack_delay()
2636 if ( p_ccb->fcrb.waiting_for_ack_q.count > p_ccb->fcrb.ack_q_count_max[index] ) in l2c_fcr_collect_ack_delay()
2637 p_ccb->fcrb.ack_q_count_max[index] = p_ccb->fcrb.waiting_for_ack_q.count; in l2c_fcr_collect_ack_delay()
2639 if ( p_ccb->fcrb.waiting_for_ack_q.count < p_ccb->fcrb.ack_q_count_min[index] ) in l2c_fcr_collect_ack_delay()
2640 p_ccb->fcrb.ack_q_count_min[index] = p_ccb->fcrb.waiting_for_ack_q.count; in l2c_fcr_collect_ack_delay()
2643 p_buf = (BT_HDR *)(p_ccb->fcrb.waiting_for_ack_q.p_first); in l2c_fcr_collect_ack_delay()
2647 p_ccb->fcrb.throughput[index] += p_buf->len - 8; in l2c_fcr_collect_ack_delay()
2653 if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) in l2c_fcr_collect_ack_delay()
2661 p_ccb->fcrb.ack_delay_avg[index] += delay; in l2c_fcr_collect_ack_delay()
2662 if ( delay > p_ccb->fcrb.ack_delay_max[index] ) in l2c_fcr_collect_ack_delay()
2663 p_ccb->fcrb.ack_delay_max[index] = delay; in l2c_fcr_collect_ack_delay()
2664 if ( delay < p_ccb->fcrb.ack_delay_min[index] ) in l2c_fcr_collect_ack_delay()
2665 p_ccb->fcrb.ack_delay_min[index] = delay; in l2c_fcr_collect_ack_delay()
2671 p_ccb->fcrb.ack_delay_avg_count++; in l2c_fcr_collect_ack_delay()
2674 if (p_ccb->fcrb.ack_delay_avg_count > L2CAP_ERTM_STATS_AVG_NUM_SAMPLES) in l2c_fcr_collect_ack_delay()
2676 p_ccb->fcrb.ack_delay_avg_count = 0; in l2c_fcr_collect_ack_delay()
2678 p_ccb->fcrb.ack_q_count_avg[index] /= L2CAP_ERTM_STATS_AVG_NUM_SAMPLES; in l2c_fcr_collect_ack_delay()
2679 p_ccb->fcrb.ack_delay_avg[index] /= L2CAP_ERTM_STATS_AVG_NUM_SAMPLES; in l2c_fcr_collect_ack_delay()
2683 if (timestamp - p_ccb->fcrb.throughput_start > 0 ) in l2c_fcr_collect_ack_delay()
2684 p_ccb->fcrb.throughput[index] /= (timestamp - p_ccb->fcrb.throughput_start); in l2c_fcr_collect_ack_delay()
2686 p_ccb->fcrb.throughput_start = timestamp; in l2c_fcr_collect_ack_delay()
2689 index, p_ccb->fcrb.throughput[index], in l2c_fcr_collect_ack_delay()
2690p_ccb->fcrb.ack_delay_avg[index], p_ccb->fcrb.ack_delay_min[index], p_ccb->fcrb.ack_delay_max[inde… in l2c_fcr_collect_ack_delay()
2691p_ccb->fcrb.ack_q_count_avg[index], p_ccb->fcrb.ack_q_count_min[index], p_ccb->fcrb.ack_q_count_ma… in l2c_fcr_collect_ack_delay()
2696 p_ccb->fcrb.ack_delay_avg_index = index; in l2c_fcr_collect_ack_delay()
2698 p_ccb->fcrb.ack_q_count_max[index] = 0; in l2c_fcr_collect_ack_delay()
2699 p_ccb->fcrb.ack_q_count_min[index] = 0xFFFFFFFF; in l2c_fcr_collect_ack_delay()
2700 p_ccb->fcrb.ack_q_count_avg[index] = 0; in l2c_fcr_collect_ack_delay()
2703 p_ccb->fcrb.ack_delay_max[index] = 0; in l2c_fcr_collect_ack_delay()
2704 p_ccb->fcrb.ack_delay_min[index] = 0xFFFFFFFF; in l2c_fcr_collect_ack_delay()
2705 p_ccb->fcrb.ack_delay_avg[index] = 0; in l2c_fcr_collect_ack_delay()
2707 p_ccb->fcrb.throughput[index] = 0; in l2c_fcr_collect_ack_delay()