Lines Matching refs:p_buf
89 static void process_s_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf, uint16_t ctrl_word);
90 static void process_i_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf, uint16_t ctrl_word,
93 static void prepare_I_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf,
95 static void process_stream_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf);
96 static bool do_sar_reassembly(tL2C_CCB* p_ccb, BT_HDR* p_buf,
134 static uint16_t l2c_fcr_tx_get_fcs(BT_HDR* p_buf) { in l2c_fcr_tx_get_fcs() argument
135 uint8_t* p = ((uint8_t*)(p_buf + 1)) + p_buf->offset; in l2c_fcr_tx_get_fcs()
137 return (l2c_fcr_updcrc(L2CAP_FCR_INIT_CRC, p, p_buf->len)); in l2c_fcr_tx_get_fcs()
149 static uint16_t l2c_fcr_rx_get_fcs(BT_HDR* p_buf) { in l2c_fcr_rx_get_fcs() argument
150 uint8_t* p = ((uint8_t*)(p_buf + 1)) + p_buf->offset; in l2c_fcr_rx_get_fcs()
156 l2c_fcr_updcrc(L2CAP_FCR_INIT_CRC, p, p_buf->len + L2CAP_PKT_OVERHEAD)); in l2c_fcr_rx_get_fcs()
341 BT_HDR* l2c_fcr_clone_buf(BT_HDR* p_buf, uint16_t new_offset, in l2c_fcr_clone_buf() argument
343 CHECK(p_buf != NULL); in l2c_fcr_clone_buf()
361 ((uint8_t*)(p_buf + 1)) + p_buf->offset, no_of_bytes); in l2c_fcr_clone_buf()
408 static void prepare_I_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf, in prepare_I_frame() argument
411 CHECK(p_buf != NULL); in prepare_I_frame()
422 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset + L2CAP_PKT_OVERHEAD; in prepare_I_frame()
428 ctrl_word = p_buf->layer_specific & L2CAP_FCR_SEG_BITS; /* SAR bits */ in prepare_I_frame()
447 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset + L2CAP_PKT_OVERHEAD; in prepare_I_frame()
454 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset; in prepare_I_frame()
455 UINT16_TO_STREAM(p, p_buf->len + L2CAP_FCS_LEN - L2CAP_PKT_OVERHEAD); in prepare_I_frame()
458 fcs = l2c_fcr_tx_get_fcs(p_buf); in prepare_I_frame()
465 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset + p_buf->len; in prepare_I_frame()
469 p_buf->len += L2CAP_FCS_LEN; in prepare_I_frame()
476 p_ccb->local_cid, p_buf->len, in prepare_I_frame()
485 p_ccb->local_cid, p_buf->len, in prepare_I_frame()
531 BT_HDR* p_buf = (BT_HDR*)osi_malloc(L2CAP_CMD_BUF_SIZE); in l2c_fcr_send_S_frame() local
532 p_buf->offset = HCI_DATA_PREAMBLE_SIZE; in l2c_fcr_send_S_frame()
533 p_buf->len = L2CAP_PKT_OVERHEAD + L2CAP_FCR_OVERHEAD; in l2c_fcr_send_S_frame()
536 p = (uint8_t*)(p_buf + 1) + p_buf->offset; in l2c_fcr_send_S_frame()
545 fcs = l2c_fcr_tx_get_fcs(p_buf); in l2c_fcr_send_S_frame()
548 p_buf->len += L2CAP_FCS_LEN; in l2c_fcr_send_S_frame()
556 p_buf->layer_specific = L2CAP_NON_FLUSHABLE_PKT; in l2c_fcr_send_S_frame()
557 l2cu_set_acl_hci_header(p_buf, p_ccb); in l2c_fcr_send_S_frame()
569 L2CAP_TRACE_WARNING(" Buf Len: %u", p_buf->len); in l2c_fcr_send_S_frame()
579 L2CAP_TRACE_EVENT(" Buf Len: %u", p_buf->len); in l2c_fcr_send_S_frame()
582 l2c_link_check_send_pkts(p_ccb->p_lcb, NULL, p_buf); in l2c_fcr_send_S_frame()
600 void l2c_fcr_proc_pdu(tL2C_CCB* p_ccb, BT_HDR* p_buf) { in l2c_fcr_proc_pdu() argument
602 CHECK(p_buf != NULL); in l2c_fcr_proc_pdu()
613 if (p_buf->len < min_pdu_len) { in l2c_fcr_proc_pdu()
615 p_ccb->local_cid, p_buf->len); in l2c_fcr_proc_pdu()
616 osi_free(p_buf); in l2c_fcr_proc_pdu()
621 process_stream_frame(p_ccb, p_buf); in l2c_fcr_proc_pdu()
626 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset; in l2c_fcr_proc_pdu()
636 p_ccb->local_cid, p_buf->len, in l2c_fcr_proc_pdu()
645 p_ccb->local_cid, p_buf->len, in l2c_fcr_proc_pdu()
655 p_ccb->local_cid, p_buf->len, in l2c_fcr_proc_pdu()
671 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset + p_buf->len - L2CAP_FCS_LEN; in l2c_fcr_proc_pdu()
675 p_buf->len -= L2CAP_FCS_LEN; in l2c_fcr_proc_pdu()
677 if (l2c_fcr_rx_get_fcs(p_buf) != fcs) { in l2c_fcr_proc_pdu()
680 osi_free(p_buf); in l2c_fcr_proc_pdu()
686 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset; in l2c_fcr_proc_pdu()
690 p_buf->len -= L2CAP_FCR_OVERHEAD; in l2c_fcr_proc_pdu()
691 p_buf->offset += L2CAP_FCR_OVERHEAD; in l2c_fcr_proc_pdu()
715 osi_free(p_buf); in l2c_fcr_proc_pdu()
735 osi_free(p_buf); in l2c_fcr_proc_pdu()
741 process_s_frame(p_ccb, p_buf, ctrl_word); in l2c_fcr_proc_pdu()
743 process_i_frame(p_ccb, p_buf, ctrl_word, false); in l2c_fcr_proc_pdu()
756 while ((p_buf = (BT_HDR*)fixed_queue_try_dequeue(temp_q)) != NULL) { in l2c_fcr_proc_pdu()
759 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset - L2CAP_FCR_OVERHEAD; in l2c_fcr_proc_pdu()
772 process_i_frame(p_ccb, p_buf, ctrl_word, true); in l2c_fcr_proc_pdu()
774 osi_free(p_buf); in l2c_fcr_proc_pdu()
817 void l2c_lcc_proc_pdu(tL2C_CCB* p_ccb, BT_HDR* p_buf) { in l2c_lcc_proc_pdu() argument
819 CHECK(p_buf != NULL); in l2c_lcc_proc_pdu()
820 uint8_t* p = (uint8_t*)(p_buf + 1) + p_buf->offset; in l2c_lcc_proc_pdu()
825 if (p_buf->len > p_ccb->local_conn_cfg.mps) { in l2c_lcc_proc_pdu()
827 osi_free(p_buf); in l2c_lcc_proc_pdu()
832 if (p_buf->len < sizeof(sdu_length)) { in l2c_lcc_proc_pdu()
834 __func__, p_buf->len); in l2c_lcc_proc_pdu()
837 osi_free(p_buf); in l2c_lcc_proc_pdu()
845 osi_free(p_buf); in l2c_lcc_proc_pdu()
849 p_buf->len -= sizeof(sdu_length); in l2c_lcc_proc_pdu()
850 p_buf->offset += sizeof(sdu_length); in l2c_lcc_proc_pdu()
852 if (sdu_length < p_buf->len) { in l2c_lcc_proc_pdu()
856 osi_free(p_buf); in l2c_lcc_proc_pdu()
862 osi_free(p_buf); in l2c_lcc_proc_pdu()
874 if (p_buf->len > (p_ccb->ble_sdu_length - p_data->len)) { in l2c_lcc_proc_pdu()
879 osi_free(p_buf); in l2c_lcc_proc_pdu()
892 (uint8_t*)(p_buf + 1) + p_buf->offset, p_buf->len); in l2c_lcc_proc_pdu()
893 p_data->len += p_buf->len; in l2c_lcc_proc_pdu()
904 osi_free(p_buf); in l2c_lcc_proc_pdu()
1067 static void process_s_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf, in process_s_frame() argument
1070 CHECK(p_buf != NULL); in process_s_frame()
1078 if (p_buf->len != 0) { in process_s_frame()
1079 L2CAP_TRACE_WARNING("Incorrect S-frame Length (%d)", p_buf->len); in process_s_frame()
1136 osi_free(p_buf); in process_s_frame()
1148 static void process_i_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf, uint16_t ctrl_word, in process_i_frame() argument
1151 CHECK(p_buf != NULL); in process_i_frame()
1160 osi_free(p_buf); in process_i_frame()
1167 p_ccb->fcrb.ertm_byte_counts[1] += p_buf->len; in process_i_frame()
1184 osi_free(p_buf); in process_i_frame()
1210 p_buf->offset -= L2CAP_FCR_OVERHEAD; in process_i_frame()
1211 p_buf->len += L2CAP_FCR_OVERHEAD; in process_i_frame()
1213 p_buf2 = l2c_fcr_clone_buf(p_buf, p_buf->offset, p_buf->len); in process_i_frame()
1216 osi_free(p_buf); in process_i_frame()
1217 p_buf = p_buf2; in process_i_frame()
1219 p_buf->offset += L2CAP_FCR_OVERHEAD; in process_i_frame()
1220 p_buf->len -= L2CAP_FCR_OVERHEAD; in process_i_frame()
1227 p_buf->layer_specific = tx_seq; in process_i_frame()
1228 fixed_queue_enqueue(p_fcrb->srej_rcv_hold_q, p_buf); in process_i_frame()
1238 osi_free(p_buf); in process_i_frame()
1248 osi_free(p_buf); in process_i_frame()
1257 osi_free(p_buf); in process_i_frame()
1268 p_buf->layer_specific = tx_seq; in process_i_frame()
1269 fixed_queue_enqueue(p_fcrb->srej_rcv_hold_q, p_buf); in process_i_frame()
1289 if (!do_sar_reassembly(p_ccb, p_buf, ctrl_word)) { in process_i_frame()
1330 static void process_stream_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf) { in process_stream_frame() argument
1332 CHECK(p_buf != NULL); in process_stream_frame()
1341 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset + p_buf->len - L2CAP_FCS_LEN; in process_stream_frame()
1345 p_buf->len -= L2CAP_FCS_LEN; in process_stream_frame()
1347 if (l2c_fcr_rx_get_fcs(p_buf) != fcs) { in process_stream_frame()
1350 osi_free(p_buf); in process_stream_frame()
1356 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset; in process_stream_frame()
1360 p_buf->len -= L2CAP_FCR_OVERHEAD; in process_stream_frame()
1361 p_buf->offset += L2CAP_FCR_OVERHEAD; in process_stream_frame()
1369 osi_free(p_buf); in process_stream_frame()
1376 p_ccb->local_cid, p_buf->len, in process_stream_frame()
1399 if (!do_sar_reassembly(p_ccb, p_buf, ctrl_word)) { in process_stream_frame()
1414 static bool do_sar_reassembly(tL2C_CCB* p_ccb, BT_HDR* p_buf, in do_sar_reassembly() argument
1417 CHECK(p_buf != NULL); in do_sar_reassembly()
1436 (p_buf->len < L2CAP_SDU_LEN_OVERHEAD)) { in do_sar_reassembly()
1437 L2CAP_TRACE_WARNING("SAR start packet too short: %u", p_buf->len); in do_sar_reassembly()
1448 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset; in do_sar_reassembly()
1454 p_buf->offset += 2; in do_sar_reassembly()
1455 p_buf->len -= 2; in do_sar_reassembly()
1470 if ((p_fcrb->p_rx_sdu->len + p_buf->len) > p_fcrb->rx_sdu_len) { in do_sar_reassembly()
1473 p_fcrb->p_rx_sdu->len, p_buf->len, p_fcrb->rx_sdu_len); in do_sar_reassembly()
1476 ((p_fcrb->p_rx_sdu->len + p_buf->len) != p_fcrb->rx_sdu_len)) { in do_sar_reassembly()
1478 p_fcrb->p_rx_sdu->len, p_buf->len, in do_sar_reassembly()
1484 p, p_buf->len); in do_sar_reassembly()
1486 p_fcrb->p_rx_sdu->len += p_buf->len; in do_sar_reassembly()
1488 osi_free(p_buf); in do_sar_reassembly()
1489 p_buf = NULL; in do_sar_reassembly()
1492 p_buf = p_fcrb->p_rx_sdu; in do_sar_reassembly()
1500 osi_free(p_buf); in do_sar_reassembly()
1501 } else if (p_buf != NULL) { in do_sar_reassembly()
1510 p_ccb->p_lcb->remote_bd_addr, p_buf); in do_sar_reassembly()
1513 l2c_csm_execute(p_ccb, L2CEVT_L2CAP_DATA, p_buf); in do_sar_reassembly()
1531 BT_HDR* p_buf = NULL; in retransmit_i_frames() local
1563 p_buf = (BT_HDR*)list_node(node_ack); in retransmit_i_frames()
1565 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset + L2CAP_PKT_OVERHEAD; in retransmit_i_frames()
1580 if (!p_buf) { in retransmit_i_frames()
1610 p_buf = (BT_HDR*)list_node(node_ack); in retransmit_i_frames()
1613 BT_HDR* p_buf2 = l2c_fcr_clone_buf(p_buf, p_buf->offset, p_buf->len); in retransmit_i_frames()
1615 p_buf2->layer_specific = p_buf->layer_specific; in retransmit_i_frames()
1651 BT_HDR *p_buf, *p_xmit; in l2c_fcr_get_next_xmit_sdu_seg() local
1657 p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->fcrb.retrans_q); in l2c_fcr_get_next_xmit_sdu_seg()
1658 if (p_buf != NULL) { in l2c_fcr_get_next_xmit_sdu_seg()
1661 prepare_I_frame(p_ccb, p_buf, true); in l2c_fcr_get_next_xmit_sdu_seg()
1663 p_buf->event = p_ccb->local_cid; in l2c_fcr_get_next_xmit_sdu_seg()
1668 p_ccb->fcrb.ertm_byte_counts[0] += (p_buf->len - 8); in l2c_fcr_get_next_xmit_sdu_seg()
1670 return (p_buf); in l2c_fcr_get_next_xmit_sdu_seg()
1680 p_buf = (BT_HDR*)fixed_queue_try_peek_first(p_ccb->xmit_hold_q); in l2c_fcr_get_next_xmit_sdu_seg()
1683 if (p_buf->len > max_pdu) { in l2c_fcr_get_next_xmit_sdu_seg()
1686 if (p_buf->event == 0) { in l2c_fcr_get_next_xmit_sdu_seg()
1688 sdu_len = p_buf->len; in l2c_fcr_get_next_xmit_sdu_seg()
1693 p_xmit = l2c_fcr_clone_buf(p_buf, L2CAP_MIN_OFFSET + L2CAP_SDU_LEN_OFFSET, in l2c_fcr_get_next_xmit_sdu_seg()
1697 p_buf->event = p_ccb->local_cid; in l2c_fcr_get_next_xmit_sdu_seg()
1700 p_buf->len -= max_pdu; in l2c_fcr_get_next_xmit_sdu_seg()
1701 p_buf->offset += max_pdu; in l2c_fcr_get_next_xmit_sdu_seg()
1704 p_xmit->layer_specific = p_buf->layer_specific; in l2c_fcr_get_next_xmit_sdu_seg()
1809 BT_HDR* p_buf = (BT_HDR*)fixed_queue_try_peek_first(p_ccb->xmit_hold_q); in l2c_lcc_get_next_xmit_sdu_seg() local
1810 bool first_pdu = (p_buf->event == 0) ? true : false; in l2c_lcc_get_next_xmit_sdu_seg()
1813 p_buf->len, in l2c_lcc_get_next_xmit_sdu_seg()
1815 bool last_pdu = (no_of_bytes_to_send == p_buf->len); in l2c_lcc_get_next_xmit_sdu_seg()
1819 l2c_fcr_clone_buf(p_buf, first_pdu ? L2CAP_LCC_OFFSET : L2CAP_MIN_OFFSET, in l2c_lcc_get_next_xmit_sdu_seg()
1822 p_buf->event = p_ccb->local_cid; in l2c_lcc_get_next_xmit_sdu_seg()
1828 UINT16_TO_STREAM(p, p_buf->len); in l2c_lcc_get_next_xmit_sdu_seg()
1832 p_buf->len -= no_of_bytes_to_send; in l2c_lcc_get_next_xmit_sdu_seg()
1833 p_buf->offset += no_of_bytes_to_send; in l2c_lcc_get_next_xmit_sdu_seg()
1836 p_xmit->layer_specific = p_buf->layer_specific; in l2c_lcc_get_next_xmit_sdu_seg()
1841 p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->xmit_hold_q); in l2c_lcc_get_next_xmit_sdu_seg()
1842 osi_free(p_buf); in l2c_lcc_get_next_xmit_sdu_seg()
2334 BT_HDR* p_buf; in l2c_fcr_collect_ack_delay() local
2364 p_buf = list_node(node); in l2c_fcr_collect_ack_delay()
2366 p_ccb->fcrb.throughput[index] += p_buf->len - 8; in l2c_fcr_collect_ack_delay()
2370 p = ((uint8_t*)(p_buf + 1)) + p_buf->offset + p_buf->len; in l2c_fcr_collect_ack_delay()