• Home
  • Raw
  • Download

Lines Matching refs:p_ccb

142   tL2C_CCB* p_ccb;  in l2cu_release_lcb()  local
178 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; in l2cu_release_lcb()
179 p_ccb = p_lcb->ccb_queue.p_first_ccb) { in l2cu_release_lcb()
180 l2cu_release_ccb(p_ccb); in l2cu_release_lcb()
426 void l2cu_send_peer_connect_req(tL2C_CCB* p_ccb) { in l2cu_send_peer_connect_req() argument
431 p_ccb->p_lcb->id++; in l2cu_send_peer_connect_req()
432 l2cu_adj_id(p_ccb->p_lcb, L2CAP_ADJ_ID); in l2cu_send_peer_connect_req()
434 p_ccb->local_id = p_ccb->p_lcb->id; in l2cu_send_peer_connect_req()
436 p_buf = l2cu_build_header(p_ccb->p_lcb, L2CAP_CONN_REQ_LEN, in l2cu_send_peer_connect_req()
437 L2CAP_CMD_CONN_REQ, p_ccb->local_id); in l2cu_send_peer_connect_req()
446 UINT16_TO_STREAM(p, p_ccb->p_rcb->real_psm); in l2cu_send_peer_connect_req()
447 UINT16_TO_STREAM(p, p_ccb->local_cid); in l2cu_send_peer_connect_req()
449 l2c_link_check_send_pkts(p_ccb->p_lcb, NULL, p_buf); in l2cu_send_peer_connect_req()
462 void l2cu_send_peer_connect_rsp(tL2C_CCB* p_ccb, uint16_t result, in l2cu_send_peer_connect_rsp() argument
469 if (p_ccb->flags & CCB_FLAG_SENT_PENDING) in l2cu_send_peer_connect_rsp()
472 p_ccb->flags |= CCB_FLAG_SENT_PENDING; in l2cu_send_peer_connect_rsp()
475 p_buf = l2cu_build_header(p_ccb->p_lcb, L2CAP_CONN_RSP_LEN, in l2cu_send_peer_connect_rsp()
476 L2CAP_CMD_CONN_RSP, p_ccb->remote_id); in l2cu_send_peer_connect_rsp()
485 UINT16_TO_STREAM(p, p_ccb->local_cid); in l2cu_send_peer_connect_rsp()
486 UINT16_TO_STREAM(p, p_ccb->remote_cid); in l2cu_send_peer_connect_rsp()
490 l2c_link_check_send_pkts(p_ccb->p_lcb, NULL, p_buf); in l2cu_send_peer_connect_rsp()
537 void l2cu_send_peer_config_req(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) { in l2cu_send_peer_config_req() argument
543 p_ccb->p_lcb->id++; in l2cu_send_peer_config_req()
544 l2cu_adj_id(p_ccb->p_lcb, L2CAP_ADJ_ID); in l2cu_send_peer_config_req()
546 p_ccb->local_id = p_ccb->p_lcb->id; in l2cu_send_peer_config_req()
561 p_buf = l2cu_build_header(p_ccb->p_lcb, in l2cu_send_peer_config_req()
563 L2CAP_CMD_CONFIG_REQ, p_ccb->local_id); in l2cu_send_peer_config_req()
572 UINT16_TO_STREAM(p, p_ccb->remote_cid); in l2cu_send_peer_config_req()
625 l2c_link_check_send_pkts(p_ccb->p_lcb, NULL, p_buf); in l2cu_send_peer_config_req()
638 void l2cu_send_peer_config_rsp(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) { in l2cu_send_peer_config_rsp() argument
655 p_buf = l2cu_build_header(p_ccb->p_lcb, in l2cu_send_peer_config_rsp()
657 L2CAP_CMD_CONFIG_RSP, p_ccb->remote_id); in l2cu_send_peer_config_rsp()
666 UINT16_TO_STREAM(p, p_ccb->remote_cid); in l2cu_send_peer_config_rsp()
699 UINT16_TO_STREAM(p, p_ccb->our_cfg.fcr.rtrans_tout); in l2cu_send_peer_config_rsp()
700 UINT16_TO_STREAM(p, p_ccb->our_cfg.fcr.mon_tout); in l2cu_send_peer_config_rsp()
715 l2c_link_check_send_pkts(p_ccb->p_lcb, NULL, p_buf); in l2cu_send_peer_config_rsp()
728 void l2cu_send_peer_config_rej(tL2C_CCB* p_ccb, uint8_t* p_data, in l2cu_send_peer_config_rej() argument
753 UINT16_TO_STREAM(p, (p_ccb->p_lcb->handle | (L2CAP_PKT_START_NON_FLUSHABLE in l2cu_send_peer_config_rej()
759 p, (p_ccb->p_lcb->handle | (L2CAP_PKT_START << L2CAP_PKT_TYPE_SHIFT))); in l2cu_send_peer_config_rej()
772 UINT8_TO_STREAM(p, p_ccb->remote_id); in l2cu_send_peer_config_rej()
776 UINT16_TO_STREAM(p, p_ccb->remote_cid); in l2cu_send_peer_config_rej()
832 l2c_link_check_send_pkts(p_ccb->p_lcb, NULL, p_buf); in l2cu_send_peer_config_rej()
845 void l2cu_send_peer_disc_req(tL2C_CCB* p_ccb) { in l2cu_send_peer_disc_req() argument
849 if ((!p_ccb) || (p_ccb->p_lcb == NULL)) { in l2cu_send_peer_disc_req()
855 p_ccb->p_lcb->id++; in l2cu_send_peer_disc_req()
856 l2cu_adj_id(p_ccb->p_lcb, L2CAP_ADJ_ID); in l2cu_send_peer_disc_req()
858 p_ccb->local_id = p_ccb->p_lcb->id; in l2cu_send_peer_disc_req()
860 p_buf = l2cu_build_header(p_ccb->p_lcb, L2CAP_DISC_REQ_LEN, in l2cu_send_peer_disc_req()
861 L2CAP_CMD_DISC_REQ, p_ccb->local_id); in l2cu_send_peer_disc_req()
870 UINT16_TO_STREAM(p, p_ccb->remote_cid); in l2cu_send_peer_disc_req()
871 UINT16_TO_STREAM(p, p_ccb->local_cid); in l2cu_send_peer_disc_req()
876 if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_BASIC_MODE) { in l2cu_send_peer_disc_req()
877 while ((p_buf2 = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->xmit_hold_q)) != in l2cu_send_peer_disc_req()
879 l2cu_set_acl_hci_header(p_buf2, p_ccb); in l2cu_send_peer_disc_req()
880 l2c_link_check_send_pkts(p_ccb->p_lcb, p_ccb, p_buf2); in l2cu_send_peer_disc_req()
884 l2c_link_check_send_pkts(p_ccb->p_lcb, NULL, p_buf); in l2cu_send_peer_disc_req()
1173 void l2cu_enqueue_ccb(tL2C_CCB* p_ccb) { in l2cu_enqueue_ccb() argument
1179 if (p_ccb->p_lcb != NULL) p_q = &p_ccb->p_lcb->ccb_queue; in l2cu_enqueue_ccb()
1181 if ((!p_ccb->in_use) || (p_q == NULL)) { in l2cu_enqueue_ccb()
1183 p_ccb->local_cid, p_ccb->in_use, p_ccb->p_lcb); in l2cu_enqueue_ccb()
1188 p_ccb->local_cid, p_ccb->ccb_priority); in l2cu_enqueue_ccb()
1192 p_q->p_first_ccb = p_q->p_last_ccb = p_ccb; in l2cu_enqueue_ccb()
1193 p_ccb->p_next_ccb = p_ccb->p_prev_ccb = NULL; in l2cu_enqueue_ccb()
1200 if (p_ccb->ccb_priority < p_ccb1->ccb_priority) { in l2cu_enqueue_ccb()
1203 p_q->p_first_ccb = p_ccb; in l2cu_enqueue_ccb()
1205 p_ccb1->p_prev_ccb->p_next_ccb = p_ccb; in l2cu_enqueue_ccb()
1207 p_ccb->p_next_ccb = p_ccb1; in l2cu_enqueue_ccb()
1208 p_ccb->p_prev_ccb = p_ccb1->p_prev_ccb; in l2cu_enqueue_ccb()
1209 p_ccb1->p_prev_ccb = p_ccb; in l2cu_enqueue_ccb()
1219 p_q->p_last_ccb->p_next_ccb = p_ccb; in l2cu_enqueue_ccb()
1221 p_ccb->p_next_ccb = NULL; in l2cu_enqueue_ccb()
1222 p_ccb->p_prev_ccb = p_q->p_last_ccb; in l2cu_enqueue_ccb()
1223 p_q->p_last_ccb = p_ccb; in l2cu_enqueue_ccb()
1229 if (p_ccb->p_lcb != NULL) { in l2cu_enqueue_ccb()
1231 if (p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb == 0) { in l2cu_enqueue_ccb()
1233 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb = p_ccb; in l2cu_enqueue_ccb()
1235 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb = p_ccb; in l2cu_enqueue_ccb()
1237 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].quota = in l2cu_enqueue_ccb()
1238 L2CAP_GET_PRIORITY_QUOTA(p_ccb->ccb_priority); in l2cu_enqueue_ccb()
1241 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb++; in l2cu_enqueue_ccb()
1255 void l2cu_dequeue_ccb(tL2C_CCB* p_ccb) { in l2cu_dequeue_ccb() argument
1258 L2CAP_TRACE_DEBUG("l2cu_dequeue_ccb CID: 0x%04x", p_ccb->local_cid); in l2cu_dequeue_ccb()
1262 if (p_ccb->p_lcb != NULL) p_q = &p_ccb->p_lcb->ccb_queue; in l2cu_dequeue_ccb()
1264 if ((!p_ccb->in_use) || (p_q == NULL) || (p_q->p_first_ccb == NULL)) { in l2cu_dequeue_ccb()
1268 p_ccb->local_cid, p_ccb->in_use, p_ccb->p_lcb, p_q, in l2cu_dequeue_ccb()
1275 if (p_ccb->p_lcb != NULL) { in l2cu_dequeue_ccb()
1277 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb--; in l2cu_dequeue_ccb()
1280 if (p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb == 0) { in l2cu_dequeue_ccb()
1281 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb = NULL; in l2cu_dequeue_ccb()
1282 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb = NULL; in l2cu_dequeue_ccb()
1285 if (p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb == p_ccb) { in l2cu_dequeue_ccb()
1286 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb = in l2cu_dequeue_ccb()
1287 p_ccb->p_next_ccb; in l2cu_dequeue_ccb()
1290 if (p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb == p_ccb) { in l2cu_dequeue_ccb()
1292 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb = in l2cu_dequeue_ccb()
1293 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb; in l2cu_dequeue_ccb()
1299 if (p_ccb == p_q->p_first_ccb) { in l2cu_dequeue_ccb()
1301 p_q->p_first_ccb = p_ccb->p_next_ccb; in l2cu_dequeue_ccb()
1307 } else if (p_ccb == p_q->p_last_ccb) { in l2cu_dequeue_ccb()
1309 p_q->p_last_ccb = p_ccb->p_prev_ccb; in l2cu_dequeue_ccb()
1313 p_ccb->p_prev_ccb->p_next_ccb = p_ccb->p_next_ccb; in l2cu_dequeue_ccb()
1314 p_ccb->p_next_ccb->p_prev_ccb = p_ccb->p_prev_ccb; in l2cu_dequeue_ccb()
1317 p_ccb->p_next_ccb = p_ccb->p_prev_ccb = NULL; in l2cu_dequeue_ccb()
1329 void l2cu_change_pri_ccb(tL2C_CCB* p_ccb, tL2CAP_CHNL_PRIORITY priority) { in l2cu_change_pri_ccb() argument
1330 if (p_ccb->ccb_priority != priority) { in l2cu_change_pri_ccb()
1332 if ((p_ccb->p_next_ccb != NULL) || (p_ccb->p_prev_ccb != NULL)) { in l2cu_change_pri_ccb()
1336 l2cu_dequeue_ccb(p_ccb); in l2cu_change_pri_ccb()
1338 p_ccb->ccb_priority = priority; in l2cu_change_pri_ccb()
1339 l2cu_enqueue_ccb(p_ccb); in l2cu_change_pri_ccb()
1345 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb = 0; in l2cu_change_pri_ccb()
1346 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb = NULL; in l2cu_change_pri_ccb()
1347 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb = NULL; in l2cu_change_pri_ccb()
1349 p_ccb->ccb_priority = priority; in l2cu_change_pri_ccb()
1351 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_first_ccb = p_ccb; in l2cu_change_pri_ccb()
1352 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].p_serve_ccb = p_ccb; in l2cu_change_pri_ccb()
1353 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].quota = in l2cu_change_pri_ccb()
1354 L2CAP_GET_PRIORITY_QUOTA(p_ccb->ccb_priority); in l2cu_change_pri_ccb()
1355 p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].num_ccb = 1; in l2cu_change_pri_ccb()
1373 tL2C_CCB* p_ccb; in l2cu_allocate_ccb() local
1382 p_ccb = l2cb.p_free_ccb_first; in l2cu_allocate_ccb()
1383 l2cb.p_free_ccb_first = p_ccb->p_next_ccb; in l2cu_allocate_ccb()
1387 p_ccb = &l2cb.ccb_pool[cid - L2CAP_BASE_APPL_CID]; in l2cu_allocate_ccb()
1389 if (p_ccb == l2cb.p_free_ccb_first) in l2cu_allocate_ccb()
1390 l2cb.p_free_ccb_first = p_ccb->p_next_ccb; in l2cu_allocate_ccb()
1394 if (p_prev->p_next_ccb == p_ccb) { in l2cu_allocate_ccb()
1395 p_prev->p_next_ccb = p_ccb->p_next_ccb; in l2cu_allocate_ccb()
1397 if (p_ccb == l2cb.p_free_ccb_last) l2cb.p_free_ccb_last = p_prev; in l2cu_allocate_ccb()
1412 p_ccb->p_next_ccb = p_ccb->p_prev_ccb = NULL; in l2cu_allocate_ccb()
1414 p_ccb->in_use = true; in l2cu_allocate_ccb()
1417 p_ccb->local_cid = L2CAP_BASE_APPL_CID + (uint16_t)(p_ccb - l2cb.ccb_pool); in l2cu_allocate_ccb()
1419 p_ccb->p_lcb = p_lcb; in l2cu_allocate_ccb()
1420 p_ccb->p_rcb = NULL; in l2cu_allocate_ccb()
1421 p_ccb->should_free_rcb = false; in l2cu_allocate_ccb()
1424 p_ccb->ccb_priority = L2CAP_CHNL_PRIORITY_LOW; in l2cu_allocate_ccb()
1426 if (p_lcb) l2cu_enqueue_ccb(p_ccb); in l2cu_allocate_ccb()
1429 p_ccb->peer_cfg_bits = 0; in l2cu_allocate_ccb()
1432 memset(&p_ccb->our_cfg, 0, sizeof(tL2CAP_CFG_INFO)); in l2cu_allocate_ccb()
1433 memset(&p_ccb->peer_cfg, 0, sizeof(tL2CAP_CFG_INFO)); in l2cu_allocate_ccb()
1436 p_ccb->our_cfg.flush_to = p_ccb->peer_cfg.flush_to = L2CAP_DEFAULT_FLUSH_TO; in l2cu_allocate_ccb()
1437 p_ccb->our_cfg.mtu = p_ccb->peer_cfg.mtu = L2CAP_DEFAULT_MTU; in l2cu_allocate_ccb()
1438 p_ccb->our_cfg.qos.service_type = p_ccb->peer_cfg.qos.service_type = in l2cu_allocate_ccb()
1440 p_ccb->our_cfg.qos.token_rate = p_ccb->peer_cfg.qos.token_rate = in l2cu_allocate_ccb()
1442 p_ccb->our_cfg.qos.token_bucket_size = p_ccb->peer_cfg.qos.token_bucket_size = in l2cu_allocate_ccb()
1444 p_ccb->our_cfg.qos.peak_bandwidth = p_ccb->peer_cfg.qos.peak_bandwidth = in l2cu_allocate_ccb()
1446 p_ccb->our_cfg.qos.latency = p_ccb->peer_cfg.qos.latency = in l2cu_allocate_ccb()
1448 p_ccb->our_cfg.qos.delay_variation = p_ccb->peer_cfg.qos.delay_variation = in l2cu_allocate_ccb()
1451 p_ccb->bypass_fcs = 0; in l2cu_allocate_ccb()
1452 memset(&p_ccb->ertm_info, 0, sizeof(tL2CAP_ERTM_INFO)); in l2cu_allocate_ccb()
1453 p_ccb->peer_cfg_already_rejected = false; in l2cu_allocate_ccb()
1454 p_ccb->fcr_cfg_tries = L2CAP_MAX_FCR_CFG_TRIES; in l2cu_allocate_ccb()
1456 alarm_free(p_ccb->fcrb.ack_timer); in l2cu_allocate_ccb()
1457 p_ccb->fcrb.ack_timer = alarm_new("l2c_fcrb.ack_timer"); in l2cu_allocate_ccb()
1463 alarm_free(p_ccb->fcrb.mon_retrans_timer); in l2cu_allocate_ccb()
1464 p_ccb->fcrb.mon_retrans_timer = alarm_new("l2c_fcrb.mon_retrans_timer"); in l2cu_allocate_ccb()
1466 p_ccb->ertm_info.preferred_mode = in l2cu_allocate_ccb()
1468 p_ccb->ertm_info.allowed_modes = in l2cu_allocate_ccb()
1470 p_ccb->ertm_info.fcr_rx_buf_size = L2CAP_FCR_RX_BUF_SIZE; in l2cu_allocate_ccb()
1471 p_ccb->ertm_info.fcr_tx_buf_size = L2CAP_FCR_TX_BUF_SIZE; in l2cu_allocate_ccb()
1472 p_ccb->ertm_info.user_rx_buf_size = L2CAP_USER_RX_BUF_SIZE; in l2cu_allocate_ccb()
1473 p_ccb->ertm_info.user_tx_buf_size = L2CAP_USER_TX_BUF_SIZE; in l2cu_allocate_ccb()
1474 p_ccb->max_rx_mtu = L2CAP_MTU_SIZE; in l2cu_allocate_ccb()
1475 p_ccb->tx_mps = L2CAP_FCR_TX_BUF_SIZE - 32; in l2cu_allocate_ccb()
1477 p_ccb->xmit_hold_q = fixed_queue_new(SIZE_MAX); in l2cu_allocate_ccb()
1478 p_ccb->fcrb.srej_rcv_hold_q = fixed_queue_new(SIZE_MAX); in l2cu_allocate_ccb()
1479 p_ccb->fcrb.retrans_q = fixed_queue_new(SIZE_MAX); in l2cu_allocate_ccb()
1480 p_ccb->fcrb.waiting_for_ack_q = fixed_queue_new(SIZE_MAX); in l2cu_allocate_ccb()
1482 p_ccb->cong_sent = false; in l2cu_allocate_ccb()
1483 p_ccb->buff_quota = 2; /* This gets set after config */ in l2cu_allocate_ccb()
1487 p_ccb->config_done = 0; in l2cu_allocate_ccb()
1490 p_ccb->config_done); in l2cu_allocate_ccb()
1493 p_ccb->chnl_state = CST_CLOSED; in l2cu_allocate_ccb()
1494 p_ccb->flags = 0; in l2cu_allocate_ccb()
1495 p_ccb->tx_data_rate = L2CAP_CHNL_DATA_RATE_LOW; in l2cu_allocate_ccb()
1496 p_ccb->rx_data_rate = L2CAP_CHNL_DATA_RATE_LOW; in l2cu_allocate_ccb()
1499 p_ccb->is_flushable = false; in l2cu_allocate_ccb()
1502 alarm_free(p_ccb->l2c_ccb_timer); in l2cu_allocate_ccb()
1503 p_ccb->l2c_ccb_timer = alarm_new("l2c.l2c_ccb_timer"); in l2cu_allocate_ccb()
1507 return (p_ccb); in l2cu_allocate_ccb()
1563 void l2cu_release_ccb(tL2C_CCB* p_ccb) { in l2cu_release_ccb() argument
1564 tL2C_LCB* p_lcb = p_ccb->p_lcb; in l2cu_release_ccb()
1565 tL2C_RCB* p_rcb = p_ccb->p_rcb; in l2cu_release_ccb()
1568 p_ccb->local_cid, p_ccb->in_use); in l2cu_release_ccb()
1571 if (!p_ccb->in_use) return; in l2cu_release_ccb()
1574 p_lcb->handle, p_ccb->local_cid, p_ccb->remote_cid); in l2cu_release_ccb()
1580 if (p_ccb->should_free_rcb) { in l2cu_release_ccb()
1582 p_ccb->p_rcb = NULL; in l2cu_release_ccb()
1583 p_ccb->should_free_rcb = false; in l2cu_release_ccb()
1589 alarm_free(p_ccb->l2c_ccb_timer); in l2cu_release_ccb()
1590 p_ccb->l2c_ccb_timer = NULL; in l2cu_release_ccb()
1592 fixed_queue_free(p_ccb->xmit_hold_q, osi_free); in l2cu_release_ccb()
1593 p_ccb->xmit_hold_q = NULL; in l2cu_release_ccb()
1595 l2c_fcr_cleanup(p_ccb); in l2cu_release_ccb()
1598 if ((p_lcb) && ((p_ccb->local_cid >= L2CAP_BASE_APPL_CID))) { in l2cu_release_ccb()
1599 l2cu_dequeue_ccb(p_ccb); in l2cu_release_ccb()
1602 p_ccb->p_lcb = NULL; in l2cu_release_ccb()
1607 l2cb.p_free_ccb_first = p_ccb; in l2cu_release_ccb()
1608 l2cb.p_free_ccb_last = p_ccb; in l2cu_release_ccb()
1609 p_ccb->p_next_ccb = NULL; in l2cu_release_ccb()
1610 p_ccb->p_prev_ccb = NULL; in l2cu_release_ccb()
1612 p_ccb->p_next_ccb = NULL; in l2cu_release_ccb()
1613 p_ccb->p_prev_ccb = l2cb.p_free_ccb_last; in l2cu_release_ccb()
1614 l2cb.p_free_ccb_last->p_next_ccb = p_ccb; in l2cu_release_ccb()
1615 l2cb.p_free_ccb_last = p_ccb; in l2cu_release_ccb()
1619 p_ccb->in_use = false; in l2cu_release_ccb()
1628 p_ccb->local_cid == L2CAP_SMP_CID) in l2cu_release_ccb()
1639 p_ccb->local_cid == L2CAP_ATT_CID) { in l2cu_release_ccb()
1659 tL2C_CCB* p_ccb; in l2cu_find_ccb_by_remote_cid() local
1665 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_ccb->p_next_ccb) in l2cu_find_ccb_by_remote_cid()
1666 if ((p_ccb->in_use) && (p_ccb->remote_cid == remote_cid)) return (p_ccb); in l2cu_find_ccb_by_remote_cid()
1763 void l2cu_disconnect_chnl(tL2C_CCB* p_ccb) { in l2cu_disconnect_chnl() argument
1764 uint16_t local_cid = p_ccb->local_cid; in l2cu_disconnect_chnl()
1768 p_ccb->p_rcb->api.pL2CA_DisconnectInd_Cb; in l2cu_disconnect_chnl()
1772 l2cu_send_peer_disc_req(p_ccb); in l2cu_disconnect_chnl()
1774 l2cu_release_ccb(p_ccb); in l2cu_disconnect_chnl()
1848 uint8_t l2cu_process_peer_cfg_req(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) { in l2cu_process_peer_cfg_req() argument
1867 p_ccb->peer_cfg.mtu = p_cfg->mtu; in l2cu_process_peer_cfg_req()
1868 p_ccb->peer_cfg.mtu_present = true; in l2cu_process_peer_cfg_req()
1869 p_ccb->peer_cfg_bits |= L2CAP_CH_CFG_MASK_MTU; in l2cu_process_peer_cfg_req()
1877 else if (p_ccb->peer_cfg.mtu_present) { in l2cu_process_peer_cfg_req()
1879 p_cfg->mtu = p_ccb->peer_cfg.mtu; in l2cu_process_peer_cfg_req()
1889 p_ccb->peer_cfg.flush_to_present = true; in l2cu_process_peer_cfg_req()
1890 p_ccb->peer_cfg.flush_to = p_cfg->flush_to; in l2cu_process_peer_cfg_req()
1891 p_ccb->peer_cfg_bits |= L2CAP_CH_CFG_MASK_FLUSH_TO; in l2cu_process_peer_cfg_req()
1895 else if (p_ccb->peer_cfg.flush_to_present) { in l2cu_process_peer_cfg_req()
1897 p_cfg->flush_to = p_ccb->peer_cfg.flush_to; in l2cu_process_peer_cfg_req()
1906 p_ccb->peer_cfg.qos = p_cfg->qos; in l2cu_process_peer_cfg_req()
1907 p_ccb->peer_cfg.qos_present = true; in l2cu_process_peer_cfg_req()
1908 p_ccb->peer_cfg_bits |= L2CAP_CH_CFG_MASK_QOS; in l2cu_process_peer_cfg_req()
1916 else if (p_ccb->peer_cfg.qos_present) { in l2cu_process_peer_cfg_req()
1918 p_cfg->qos = p_ccb->peer_cfg.qos; in l2cu_process_peer_cfg_req()
1921 fcr_status = l2c_fcr_process_peer_cfg_req(p_ccb, p_cfg); in l2cu_process_peer_cfg_req()
1934 l2cu_adjust_out_mps(p_ccb); in l2cu_process_peer_cfg_req()
1959 void l2cu_process_peer_cfg_rsp(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) { in l2cu_process_peer_cfg_rsp() argument
1962 if ((p_cfg->qos_present) && (p_ccb->our_cfg.qos_present)) in l2cu_process_peer_cfg_rsp()
1963 p_ccb->our_cfg.qos = p_cfg->qos; in l2cu_process_peer_cfg_rsp()
1968 p_ccb->peer_cfg.fcr.rtrans_tout = p_cfg->fcr.rtrans_tout; in l2cu_process_peer_cfg_rsp()
1969 p_ccb->peer_cfg.fcr.mon_tout = p_cfg->fcr.mon_tout; in l2cu_process_peer_cfg_rsp()
1974 if (p_cfg->fcr.tx_win_sz < p_ccb->our_cfg.fcr.tx_win_sz) in l2cu_process_peer_cfg_rsp()
1975 p_ccb->fcrb.max_held_acks = p_cfg->fcr.tx_win_sz / 3; in l2cu_process_peer_cfg_rsp()
1977 p_ccb->fcrb.max_held_acks = p_ccb->our_cfg.fcr.tx_win_sz / 3; in l2cu_process_peer_cfg_rsp()
1982 p_cfg->fcr.tx_win_sz, p_ccb->our_cfg.fcr.tx_win_sz, in l2cu_process_peer_cfg_rsp()
1983 p_ccb->fcrb.max_held_acks); in l2cu_process_peer_cfg_rsp()
1998 void l2cu_process_our_cfg_req(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) { in l2cu_process_our_cfg_req() argument
2004 p_ccb->our_cfg.qos_present = true; in l2cu_process_our_cfg_req()
2005 p_ccb->our_cfg.qos = p_cfg->qos; in l2cu_process_our_cfg_req()
2025 p_ccb->fcrb.max_held_acks = p_cfg->fcr.tx_win_sz / 3; in l2cu_process_our_cfg_req()
2028 if (p_ccb->p_lcb->peer_ext_fea & L2CAP_EXTFEA_NO_CRC) { in l2cu_process_our_cfg_req()
2031 p_ccb->bypass_fcs |= L2CAP_CFG_FCS_OUR; in l2cu_process_our_cfg_req()
2038 p_ccb->our_cfg.fcr.mode = p_cfg->fcr.mode; in l2cu_process_our_cfg_req()
2039 p_ccb->our_cfg.fcr_present = p_cfg->fcr_present; in l2cu_process_our_cfg_req()
2052 p_ccb->our_cfg.flush_to = p_cfg->flush_to; in l2cu_process_our_cfg_req()
2053 p_lcb = p_ccb->p_lcb; in l2cu_process_our_cfg_req()
2080 void l2cu_process_our_cfg_rsp(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) { in l2cu_process_our_cfg_rsp() argument
2083 if ((p_cfg->qos_present) && (p_ccb->peer_cfg.qos_present)) in l2cu_process_our_cfg_rsp()
2084 p_ccb->peer_cfg.qos = p_cfg->qos; in l2cu_process_our_cfg_rsp()
2088 l2c_fcr_adj_our_rsp_options(p_ccb, p_cfg); in l2cu_process_our_cfg_rsp()
2311 tL2C_CCB* p_ccb; in l2cu_lcb_disconnecting() local
2327 p_ccb = p_lcb->ccb_queue.p_first_ccb; in l2cu_lcb_disconnecting()
2329 if ((p_ccb->in_use) && in l2cu_lcb_disconnecting()
2330 ((p_ccb->chnl_state == CST_W4_L2CAP_DISCONNECT_RSP) || in l2cu_lcb_disconnecting()
2331 (p_ccb->chnl_state == CST_W4_L2CA_DISCONNECT_RSP))) { in l2cu_lcb_disconnecting()
2427 tL2C_CCB* p_ccb; in l2cu_resubmit_pending_sec_req() local
2440 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_next_ccb) { in l2cu_resubmit_pending_sec_req()
2441 p_next_ccb = p_ccb->p_next_ccb; in l2cu_resubmit_pending_sec_req()
2442 l2c_csm_execute(p_ccb, L2CEVT_SEC_RE_SEND_CMD, NULL); in l2cu_resubmit_pending_sec_req()
2453 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_next_ccb) { in l2cu_resubmit_pending_sec_req()
2454 p_next_ccb = p_ccb->p_next_ccb; in l2cu_resubmit_pending_sec_req()
2455 l2c_csm_execute(p_ccb, L2CEVT_SEC_RE_SEND_CMD, NULL); in l2cu_resubmit_pending_sec_req()
2485 void l2cu_adjust_out_mps(tL2C_CCB* p_ccb) { in l2cu_adjust_out_mps() argument
2489 packet_size = btm_get_max_packet_size(p_ccb->p_lcb->remote_bd_addr); in l2cu_adjust_out_mps()
2496 packet_size, p_ccb->peer_cfg.fcr.mps); in l2cu_adjust_out_mps()
2497 p_ccb->tx_mps = p_ccb->peer_cfg.fcr.mps; in l2cu_adjust_out_mps()
2513 if (p_ccb->peer_cfg.fcr.mps >= packet_size) in l2cu_adjust_out_mps()
2514 p_ccb->tx_mps = p_ccb->peer_cfg.fcr.mps / packet_size * packet_size; in l2cu_adjust_out_mps()
2516 p_ccb->tx_mps = p_ccb->peer_cfg.fcr.mps; in l2cu_adjust_out_mps()
2521 p_ccb->tx_mps, p_ccb->peer_cfg.fcr.mps, packet_size); in l2cu_adjust_out_mps()
2537 tL2C_CCB* p_ccb; in l2cu_initialize_fixed_ccb() local
2540 p_ccb = p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]; in l2cu_initialize_fixed_ccb()
2541 if ((p_ccb != NULL) && p_ccb->in_use) { in l2cu_initialize_fixed_ccb()
2549 p_ccb = l2cu_allocate_ccb(NULL, 0); in l2cu_initialize_fixed_ccb()
2550 if (p_ccb == NULL) return (false); in l2cu_initialize_fixed_ccb()
2555 p_ccb->local_cid = fixed_cid; in l2cu_initialize_fixed_ccb()
2556 p_ccb->remote_cid = fixed_cid; in l2cu_initialize_fixed_ccb()
2558 p_ccb->is_flushable = false; in l2cu_initialize_fixed_ccb()
2562 p_ccb->our_cfg.fcr = p_ccb->peer_cfg.fcr = *p_fcr; in l2cu_initialize_fixed_ccb()
2564 p_ccb->ertm_info.fcr_rx_buf_size = L2CAP_FCR_RX_BUF_SIZE; in l2cu_initialize_fixed_ccb()
2565 p_ccb->ertm_info.fcr_tx_buf_size = L2CAP_FCR_TX_BUF_SIZE; in l2cu_initialize_fixed_ccb()
2566 p_ccb->ertm_info.user_rx_buf_size = L2CAP_USER_RX_BUF_SIZE; in l2cu_initialize_fixed_ccb()
2567 p_ccb->ertm_info.user_tx_buf_size = L2CAP_USER_TX_BUF_SIZE; in l2cu_initialize_fixed_ccb()
2569 p_ccb->fcrb.max_held_acks = p_fcr->tx_win_sz / 3; in l2cu_initialize_fixed_ccb()
2573 p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL] = p_ccb; in l2cu_initialize_fixed_ccb()
2574 p_ccb->p_lcb = p_lcb; in l2cu_initialize_fixed_ccb()
2577 if (p_lcb->link_state == LST_CONNECTED) p_ccb->chnl_state = CST_OPEN; in l2cu_initialize_fixed_ccb()
2580 p_ccb->fixed_chnl_idle_tout = in l2cu_initialize_fixed_ccb()
2830 void l2cu_send_peer_ble_credit_based_conn_req(tL2C_CCB* p_ccb) { in l2cu_send_peer_ble_credit_based_conn_req() argument
2838 if (!p_ccb) return; in l2cu_send_peer_ble_credit_based_conn_req()
2839 p_lcb = p_ccb->p_lcb; in l2cu_send_peer_ble_credit_based_conn_req()
2842 p_ccb->p_lcb->id++; in l2cu_send_peer_ble_credit_based_conn_req()
2843 l2cu_adj_id(p_ccb->p_lcb, L2CAP_ADJ_ID); in l2cu_send_peer_ble_credit_based_conn_req()
2845 p_ccb->local_id = p_ccb->p_lcb->id; in l2cu_send_peer_ble_credit_based_conn_req()
2857 mtu = p_ccb->local_conn_cfg.mtu; in l2cu_send_peer_ble_credit_based_conn_req()
2858 mps = p_ccb->local_conn_cfg.mps; in l2cu_send_peer_ble_credit_based_conn_req()
2859 initial_credit = p_ccb->local_conn_cfg.credits; in l2cu_send_peer_ble_credit_based_conn_req()
2864 p_ccb->p_rcb->real_psm, p_ccb->local_cid, mtu, mps, initial_credit); in l2cu_send_peer_ble_credit_based_conn_req()
2866 UINT16_TO_STREAM(p, p_ccb->p_rcb->real_psm); in l2cu_send_peer_ble_credit_based_conn_req()
2867 UINT16_TO_STREAM(p, p_ccb->local_cid); in l2cu_send_peer_ble_credit_based_conn_req()
2921 void l2cu_send_peer_ble_credit_based_conn_res(tL2C_CCB* p_ccb, in l2cu_send_peer_ble_credit_based_conn_res() argument
2928 l2cu_build_header(p_ccb->p_lcb, L2CAP_CMD_BLE_CREDIT_BASED_CONN_RES_LEN, in l2cu_send_peer_ble_credit_based_conn_res()
2929 L2CAP_CMD_BLE_CREDIT_BASED_CONN_RES, p_ccb->remote_id); in l2cu_send_peer_ble_credit_based_conn_res()
2938 UINT16_TO_STREAM(p, p_ccb->local_cid); /* Local CID */ in l2cu_send_peer_ble_credit_based_conn_res()
2939 UINT16_TO_STREAM(p, p_ccb->local_conn_cfg.mtu); /* MTU */ in l2cu_send_peer_ble_credit_based_conn_res()
2940 UINT16_TO_STREAM(p, p_ccb->local_conn_cfg.mps); /* MPS */ in l2cu_send_peer_ble_credit_based_conn_res()
2941 UINT16_TO_STREAM(p, p_ccb->local_conn_cfg.credits); /* initial credit */ in l2cu_send_peer_ble_credit_based_conn_res()
2944 l2c_link_check_send_pkts(p_ccb->p_lcb, NULL, p_buf); in l2cu_send_peer_ble_credit_based_conn_res()
2957 void l2cu_send_peer_ble_flow_control_credit(tL2C_CCB* p_ccb, in l2cu_send_peer_ble_flow_control_credit() argument
2963 if (!p_ccb) return; in l2cu_send_peer_ble_flow_control_credit()
2964 p_lcb = p_ccb->p_lcb; in l2cu_send_peer_ble_flow_control_credit()
2967 p_ccb->p_lcb->id++; in l2cu_send_peer_ble_flow_control_credit()
2968 l2cu_adj_id(p_ccb->p_lcb, L2CAP_ADJ_ID); in l2cu_send_peer_ble_flow_control_credit()
2970 p_ccb->local_id = p_ccb->p_lcb->id; in l2cu_send_peer_ble_flow_control_credit()
2982 UINT16_TO_STREAM(p, p_ccb->local_cid); in l2cu_send_peer_ble_flow_control_credit()
2998 void l2cu_send_peer_ble_credit_based_disconn_req(tL2C_CCB* p_ccb) { in l2cu_send_peer_ble_credit_based_disconn_req() argument
3004 if (!p_ccb) return; in l2cu_send_peer_ble_credit_based_disconn_req()
3005 p_lcb = p_ccb->p_lcb; in l2cu_send_peer_ble_credit_based_disconn_req()
3008 p_ccb->p_lcb->id++; in l2cu_send_peer_ble_credit_based_disconn_req()
3009 l2cu_adj_id(p_ccb->p_lcb, L2CAP_ADJ_ID); in l2cu_send_peer_ble_credit_based_disconn_req()
3011 p_ccb->local_id = p_ccb->p_lcb->id; in l2cu_send_peer_ble_credit_based_disconn_req()
3023 UINT16_TO_STREAM(p, p_ccb->remote_cid); in l2cu_send_peer_ble_credit_based_disconn_req()
3024 UINT16_TO_STREAM(p, p_ccb->local_cid); in l2cu_send_peer_ble_credit_based_disconn_req()
3069 tL2C_CCB* p_ccb = NULL; in l2cu_find_ccb_by_cid() local
3076 p_ccb = l2cb.ccb_pool + local_cid; in l2cu_find_ccb_by_cid()
3079 if (!p_ccb->in_use) { in l2cu_find_ccb_by_cid()
3080 p_ccb = NULL; in l2cu_find_ccb_by_cid()
3083 else if (p_lcb && p_lcb != p_ccb->p_lcb) { in l2cu_find_ccb_by_cid()
3084 p_ccb = NULL; in l2cu_find_ccb_by_cid()
3087 return (p_ccb); in l2cu_find_ccb_by_cid()
3104 tL2C_CCB* p_ccb; in l2cu_get_next_channel_in_rr() local
3115 p_ccb = p_lcb->rr_serv[p_lcb->rr_pri].p_serve_ccb; in l2cu_get_next_channel_in_rr()
3117 if (!p_ccb) { in l2cu_get_next_channel_in_rr()
3123 p_ccb->ccb_priority, p_ccb->local_cid, in l2cu_get_next_channel_in_rr()
3124 fixed_queue_length(p_ccb->xmit_hold_q)); in l2cu_get_next_channel_in_rr()
3128 if ((p_ccb->p_next_ccb == NULL) || in l2cu_get_next_channel_in_rr()
3129 (p_ccb->p_next_ccb->ccb_priority != p_ccb->ccb_priority)) { in l2cu_get_next_channel_in_rr()
3135 p_lcb->rr_serv[p_lcb->rr_pri].p_serve_ccb = p_ccb->p_next_ccb; in l2cu_get_next_channel_in_rr()
3138 if (p_ccb->chnl_state != CST_OPEN) continue; in l2cu_get_next_channel_in_rr()
3140 if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE) { in l2cu_get_next_channel_in_rr()
3142 if (fixed_queue_is_empty(p_ccb->xmit_hold_q)) continue; in l2cu_get_next_channel_in_rr()
3146 if (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_BASIC_MODE) { in l2cu_get_next_channel_in_rr()
3147 if (p_ccb->fcrb.wait_ack || p_ccb->fcrb.remote_busy) continue; in l2cu_get_next_channel_in_rr()
3149 if (fixed_queue_is_empty(p_ccb->fcrb.retrans_q)) { in l2cu_get_next_channel_in_rr()
3150 if (fixed_queue_is_empty(p_ccb->xmit_hold_q)) continue; in l2cu_get_next_channel_in_rr()
3153 if ((p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) && in l2cu_get_next_channel_in_rr()
3154 (l2c_fcr_is_flow_controlled(p_ccb))) in l2cu_get_next_channel_in_rr()
3158 if (fixed_queue_is_empty(p_ccb->xmit_hold_q)) continue; in l2cu_get_next_channel_in_rr()
3163 p_serve_ccb = p_ccb; in l2cu_get_next_channel_in_rr()
3202 tL2C_CCB* p_ccb; in l2cu_get_next_channel() local
3206 for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_ccb->p_next_ccb) { in l2cu_get_next_channel()
3207 if (p_ccb->chnl_state != CST_OPEN) continue; in l2cu_get_next_channel()
3209 if (p_ccb->fcrb.wait_ack || p_ccb->fcrb.remote_busy) continue; in l2cu_get_next_channel()
3211 if (!fixed_queue_is_empty(p_ccb->fcrb.retrans_q)) return p_ccb; in l2cu_get_next_channel()
3213 if (fixed_queue_is_empty(p_ccb->xmit_hold_q)) continue; in l2cu_get_next_channel()
3216 if ((p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) && in l2cu_get_next_channel()
3217 (l2c_fcr_is_flow_controlled(p_ccb))) in l2cu_get_next_channel()
3221 return p_ccb; in l2cu_get_next_channel()
3244 tL2C_CCB* p_ccb; in l2cu_get_next_buffer_to_send() local
3254 p_ccb = p_lcb->p_fixed_ccbs[xx]; in l2cu_get_next_buffer_to_send()
3255 if (p_ccb == NULL) continue; in l2cu_get_next_buffer_to_send()
3258 if (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_BASIC_MODE) { in l2cu_get_next_buffer_to_send()
3259 if (p_ccb->fcrb.wait_ack || p_ccb->fcrb.remote_busy) continue; in l2cu_get_next_buffer_to_send()
3262 if (fixed_queue_is_empty(p_ccb->fcrb.retrans_q)) { in l2cu_get_next_buffer_to_send()
3263 if (fixed_queue_is_empty(p_ccb->xmit_hold_q)) continue; in l2cu_get_next_buffer_to_send()
3266 if ((p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) && in l2cu_get_next_buffer_to_send()
3267 (l2c_fcr_is_flow_controlled(p_ccb))) in l2cu_get_next_buffer_to_send()
3271 p_buf = l2c_fcr_get_next_xmit_sdu_seg(p_ccb, 0); in l2cu_get_next_buffer_to_send()
3273 l2cu_check_channel_congestion(p_ccb); in l2cu_get_next_buffer_to_send()
3274 l2cu_set_acl_hci_header(p_buf, p_ccb); in l2cu_get_next_buffer_to_send()
3278 if (!fixed_queue_is_empty(p_ccb->xmit_hold_q)) { in l2cu_get_next_buffer_to_send()
3279 p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->xmit_hold_q); in l2cu_get_next_buffer_to_send()
3287 p_cbi->local_cid = p_ccb->local_cid; in l2cu_get_next_buffer_to_send()
3290 l2cu_check_channel_congestion(p_ccb); in l2cu_get_next_buffer_to_send()
3291 l2cu_set_acl_hci_header(p_buf, p_ccb); in l2cu_get_next_buffer_to_send()
3300 p_ccb = l2cu_get_next_channel_in_rr(p_lcb); in l2cu_get_next_buffer_to_send()
3302 p_ccb = l2cu_get_next_channel(p_lcb); in l2cu_get_next_buffer_to_send()
3306 if (p_ccb == NULL) return (NULL); in l2cu_get_next_buffer_to_send()
3308 if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE) { in l2cu_get_next_buffer_to_send()
3310 if (p_ccb->peer_conn_cfg.credits == 0) { in l2cu_get_next_buffer_to_send()
3316 p_buf = l2c_lcc_get_next_xmit_sdu_seg(p_ccb, &last_piece_of_sdu); in l2cu_get_next_buffer_to_send()
3317 p_ccb->peer_conn_cfg.credits--; in l2cu_get_next_buffer_to_send()
3325 if (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_BASIC_MODE) { in l2cu_get_next_buffer_to_send()
3326 p_buf = l2c_fcr_get_next_xmit_sdu_seg(p_ccb, 0); in l2cu_get_next_buffer_to_send()
3329 p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->xmit_hold_q); in l2cu_get_next_buffer_to_send()
3337 if (p_ccb->p_rcb && p_ccb->p_rcb->api.pL2CA_TxComplete_Cb && in l2cu_get_next_buffer_to_send()
3338 (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_ERTM_MODE)) in l2cu_get_next_buffer_to_send()
3339 (*p_ccb->p_rcb->api.pL2CA_TxComplete_Cb)(p_ccb->local_cid, 1); in l2cu_get_next_buffer_to_send()
3341 l2cu_check_channel_congestion(p_ccb); in l2cu_get_next_buffer_to_send()
3343 l2cu_set_acl_hci_header(p_buf, p_ccb); in l2cu_get_next_buffer_to_send()
3357 void l2cu_set_acl_hci_header(BT_HDR* p_buf, tL2C_CCB* p_ccb) { in l2cu_set_acl_hci_header() argument
3364 if (p_ccb->p_lcb->transport == BT_TRANSPORT_LE) { in l2cu_set_acl_hci_header()
3365 UINT16_TO_STREAM(p, p_ccb->p_lcb->handle | (L2CAP_PKT_START_NON_FLUSHABLE in l2cu_set_acl_hci_header()
3380 (p_ccb->is_flushable)) || in l2cu_set_acl_hci_header()
3384 p, p_ccb->p_lcb->handle | (L2CAP_PKT_START << L2CAP_PKT_TYPE_SHIFT)); in l2cu_set_acl_hci_header()
3386 UINT16_TO_STREAM(p, p_ccb->p_lcb->handle | l2cb.non_flushable_pbf); in l2cu_set_acl_hci_header()
3390 p, p_ccb->p_lcb->handle | (L2CAP_PKT_START << L2CAP_PKT_TYPE_SHIFT)); in l2cu_set_acl_hci_header()
3406 static void send_congestion_status_to_all_clients(tL2C_CCB* p_ccb, in send_congestion_status_to_all_clients() argument
3408 p_ccb->cong_sent = status; in send_congestion_status_to_all_clients()
3410 if (p_ccb->p_rcb && p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb) { in send_congestion_status_to_all_clients()
3414 status, p_ccb->local_cid, fixed_queue_length(p_ccb->xmit_hold_q), in send_congestion_status_to_all_clients()
3415 p_ccb->buff_quota); in send_congestion_status_to_all_clients()
3420 (*p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb)(p_ccb->local_cid, status); in send_congestion_status_to_all_clients()
3427 if (p_ccb->p_lcb->p_fixed_ccbs[xx] == p_ccb) { in send_congestion_status_to_all_clients()
3429 (*l2cb.fixed_reg[xx].pL2CA_FixedCong_Cb)(p_ccb->p_lcb->remote_bd_addr, in send_congestion_status_to_all_clients()
3439 void l2cu_check_channel_congestion(tL2C_CCB* p_ccb) { in l2cu_check_channel_congestion() argument
3442 if (p_ccb->buff_quota == 0) return; in l2cu_check_channel_congestion()
3444 size_t q_count = fixed_queue_length(p_ccb->xmit_hold_q); in l2cu_check_channel_congestion()
3446 if (p_ccb->cong_sent) { in l2cu_check_channel_congestion()
3448 if (q_count <= (p_ccb->buff_quota / 2)) in l2cu_check_channel_congestion()
3449 send_congestion_status_to_all_clients(p_ccb, false); in l2cu_check_channel_congestion()
3452 if (q_count > p_ccb->buff_quota) in l2cu_check_channel_congestion()
3453 send_congestion_status_to_all_clients(p_ccb, true); in l2cu_check_channel_congestion()
3467 bool l2cu_is_ccb_active(tL2C_CCB* p_ccb) { return (p_ccb && p_ccb->in_use); } in l2cu_is_ccb_active() argument