Lines Matching refs:btpan_cb
68 btpan_cb_t btpan_cb; variable
104 btpan_cb.enabled); in btif_pan_init()
107 if (jni_initialized && !btpan_cb.enabled) { in btif_pan_init()
109 memset(&btpan_cb, 0, sizeof(btpan_cb)); in btif_pan_init()
110 btpan_cb.tap_fd = INVALID_FD; in btif_pan_init()
111 btpan_cb.flow = 1; in btif_pan_init()
113 btpan_cleanup_conn(&btpan_cb.conns[i]); in btif_pan_init()
115 btpan_cb.enabled = 1; in btif_pan_init()
129 if (btpan_cb.enabled) { in pan_disable()
130 btpan_cb.enabled = 0; in pan_disable()
132 if (btpan_cb.tap_fd != INVALID_FD) { in pan_disable()
133 btpan_tap_close(btpan_cb.tap_fd); in pan_disable()
134 btpan_cb.tap_fd = INVALID_FD; in pan_disable()
144 btpan_cleanup_conn(&btpan_cb.conns[i]); in btif_pan_cleanup()
153 stack_initialized, btpan_cb.enabled); in btpan_jni_init()
156 if (stack_initialized && !btpan_cb.enabled) btif_pan_init(); in btpan_jni_init()
349 if (btpan_cb.tap_fd == -1) return; in btpan_set_flow_control()
351 btpan_cb.flow = enable; in btpan_set_flow_control()
353 btsock_thread_add_fd(pan_pth, btpan_cb.tap_fd, 0, SOCK_THREAD_FD_RD, 0); in btpan_set_flow_control()
355 base::Bind(btu_exec_tap_fd_read, btpan_cb.tap_fd)); in btpan_set_flow_control()
427 if (btpan_cb.conns[i].handle == handle) return &btpan_cb.conns[i]; in btpan_find_conn_handle()
434 if (btpan_cb.conns[i].peer == addr) return &btpan_cb.conns[i]; in btpan_find_conn_addr()
452 btpan_cb.tap_fd, btpan_cb.open_count, conn->handle, p_data->open.handle, in btpan_open_conn()
455 btpan_cb.open_count++; in btpan_open_conn()
457 if (btpan_cb.tap_fd < 0) { in btpan_open_conn()
458 btpan_cb.tap_fd = btpan_tap_open(); in btpan_open_conn()
459 if (btpan_cb.tap_fd >= 0) create_tap_read_thread(btpan_cb.tap_fd); in btpan_open_conn()
462 if (btpan_cb.tap_fd >= 0) { in btpan_open_conn()
463 btpan_cb.flow = 1; in btpan_open_conn()
476 btpan_cb.open_count--; in btpan_close_conn()
478 if (btpan_cb.open_count == 0) { in btpan_close_conn()
480 if (btpan_cb.tap_fd != INVALID_FD) { in btpan_close_conn()
481 btpan_tap_close(btpan_cb.tap_fd); in btpan_close_conn()
482 btpan_cb.tap_fd = INVALID_FD; in btpan_close_conn()
501 BTIF_TRACE_DEBUG("conns[%d]:%d", i, btpan_cb.conns[i].handle); in btpan_new_conn()
502 if (btpan_cb.conns[i].handle == -1) { in btpan_new_conn()
506 btpan_cb.conns[i].handle = handle; in btpan_new_conn()
507 btpan_cb.conns[i].peer = addr; in btpan_new_conn()
508 btpan_cb.conns[i].local_role = local_role; in btpan_new_conn()
509 btpan_cb.conns[i].remote_role = remote_role; in btpan_new_conn()
510 return &btpan_cb.conns[i]; in btpan_new_conn()
539 uint16_t handle = btpan_cb.conns[i].handle; in forward_bnep()
541 (broadcast || btpan_cb.conns[i].eth_addr == eth_hdr->h_dest || in forward_bnep()
542 btpan_cb.conns[i].peer == eth_hdr->h_dest)) { in forward_bnep()
653 if (fd == INVALID_FD || fd != btpan_cb.tap_fd) return; in btu_exec_tap_fd_read()
658 for (int i = 0; i < PAN_BUF_MAX && btif_is_enabled() && btpan_cb.flow; i++) { in btu_exec_tap_fd_read()
670 if (!btpan_cb.congest_packet_size) { in btu_exec_tap_fd_read()
672 OSI_NO_INTR(ret = read(fd, btpan_cb.congest_packet, in btu_exec_tap_fd_read()
673 sizeof(btpan_cb.congest_packet))); in btu_exec_tap_fd_read()
689 btpan_cb.congest_packet_size = ret; in btu_exec_tap_fd_read()
694 memcpy(packet, btpan_cb.congest_packet, in btu_exec_tap_fd_read()
695 MIN(btpan_cb.congest_packet_size, buffer->len)); in btu_exec_tap_fd_read()
696 buffer->len = MIN(btpan_cb.congest_packet_size, buffer->len); in btu_exec_tap_fd_read()
710 btpan_cb.congest_packet_size = 0; in btu_exec_tap_fd_read()
714 btpan_cb.congest_packet_size = 0; in btu_exec_tap_fd_read()
728 if (btpan_cb.flow) { in btu_exec_tap_fd_read()
738 if (btpan_cb.conns[i].handle != -1) BTA_PanClose(btpan_cb.conns[i].handle); in btif_pan_close_all_conns()
744 CHECK(btpan_cb.tap_fd == INVALID_FD || btpan_cb.tap_fd == fd); in btpan_tap_fd_signaled()
746 if (btpan_cb.tap_fd != fd) { in btpan_tap_fd_signaled()
748 __func__, btpan_cb.tap_fd, fd); in btpan_tap_fd_signaled()
753 btpan_cb.tap_fd = INVALID_FD; in btpan_tap_fd_signaled()