Lines Matching refs:btpan_cb
93 btpan_cb_t btpan_cb; variable
129 btpan_cb.enabled); in btif_pan_init()
132 if (jni_initialized && !btpan_cb.enabled) { in btif_pan_init()
134 memset(&btpan_cb, 0, sizeof(btpan_cb)); in btif_pan_init()
135 btpan_cb.tap_fd = INVALID_FD; in btif_pan_init()
136 btpan_cb.flow = 1; in btif_pan_init()
138 btpan_cleanup_conn(&btpan_cb.conns[i]); in btif_pan_init()
140 btpan_cb.enabled = 1; in btif_pan_init()
146 if (btpan_cb.enabled) { in pan_disable()
147 btpan_cb.enabled = 0; in pan_disable()
149 if (btpan_cb.tap_fd != INVALID_FD) { in pan_disable()
150 btpan_tap_close(btpan_cb.tap_fd); in pan_disable()
151 btpan_cb.tap_fd = INVALID_FD; in pan_disable()
161 btpan_cleanup_conn(&btpan_cb.conns[i]); in btif_pan_cleanup()
170 stack_initialized, btpan_cb.enabled); in btpan_jni_init()
173 if (stack_initialized && !btpan_cb.enabled) btif_pan_init(); in btpan_jni_init()
367 if (btpan_cb.tap_fd == -1) return; in btpan_set_flow_control()
369 btpan_cb.flow = enable; in btpan_set_flow_control()
371 btsock_thread_add_fd(pan_pth, btpan_cb.tap_fd, 0, SOCK_THREAD_FD_RD, 0); in btpan_set_flow_control()
373 base::Bind(btu_exec_tap_fd_read, btpan_cb.tap_fd)); in btpan_set_flow_control()
446 if (btpan_cb.conns[i].handle == handle) return &btpan_cb.conns[i]; in btpan_find_conn_handle()
453 if (btpan_cb.conns[i].peer == addr) return &btpan_cb.conns[i]; in btpan_find_conn_addr()
471 btpan_cb.tap_fd, btpan_cb.open_count, conn->handle, p_data->open.handle, in btpan_open_conn()
474 btpan_cb.open_count++; in btpan_open_conn()
476 if (btpan_cb.tap_fd < 0) { in btpan_open_conn()
477 btpan_cb.tap_fd = btpan_tap_open(); in btpan_open_conn()
478 if (btpan_cb.tap_fd >= 0) create_tap_read_thread(btpan_cb.tap_fd); in btpan_open_conn()
481 if (btpan_cb.tap_fd >= 0) { in btpan_open_conn()
482 btpan_cb.flow = 1; in btpan_open_conn()
495 btpan_cb.open_count--; in btpan_close_conn()
497 if (btpan_cb.open_count == 0) { in btpan_close_conn()
499 if (btpan_cb.tap_fd != INVALID_FD) { in btpan_close_conn()
500 btpan_tap_close(btpan_cb.tap_fd); in btpan_close_conn()
501 btpan_cb.tap_fd = INVALID_FD; in btpan_close_conn()
520 BTIF_TRACE_DEBUG("conns[%d]:%d", i, btpan_cb.conns[i].handle); in btpan_new_conn()
521 if (btpan_cb.conns[i].handle == -1) { in btpan_new_conn()
525 btpan_cb.conns[i].handle = handle; in btpan_new_conn()
526 btpan_cb.conns[i].peer = addr; in btpan_new_conn()
527 btpan_cb.conns[i].local_role = local_role; in btpan_new_conn()
528 btpan_cb.conns[i].remote_role = remote_role; in btpan_new_conn()
529 return &btpan_cb.conns[i]; in btpan_new_conn()
558 uint16_t handle = btpan_cb.conns[i].handle; in forward_bnep()
560 (broadcast || btpan_cb.conns[i].eth_addr == eth_hdr->h_dest || in forward_bnep()
561 btpan_cb.conns[i].peer == eth_hdr->h_dest)) { in forward_bnep()
672 if (fd == INVALID_FD || fd != btpan_cb.tap_fd) return; in btu_exec_tap_fd_read()
677 for (int i = 0; i < PAN_BUF_MAX && btif_is_enabled() && btpan_cb.flow; i++) { in btu_exec_tap_fd_read()
689 if (!btpan_cb.congest_packet_size) { in btu_exec_tap_fd_read()
691 OSI_NO_INTR(ret = read(fd, btpan_cb.congest_packet, in btu_exec_tap_fd_read()
692 sizeof(btpan_cb.congest_packet))); in btu_exec_tap_fd_read()
708 btpan_cb.congest_packet_size = ret; in btu_exec_tap_fd_read()
713 memcpy(packet, btpan_cb.congest_packet, in btu_exec_tap_fd_read()
714 MIN(btpan_cb.congest_packet_size, buffer->len)); in btu_exec_tap_fd_read()
715 buffer->len = MIN(btpan_cb.congest_packet_size, buffer->len); in btu_exec_tap_fd_read()
729 btpan_cb.congest_packet_size = 0; in btu_exec_tap_fd_read()
733 btpan_cb.congest_packet_size = 0; in btu_exec_tap_fd_read()
747 if (btpan_cb.flow) { in btu_exec_tap_fd_read()
757 if (btpan_cb.conns[i].handle != -1) BTA_PanClose(btpan_cb.conns[i].handle); in btif_pan_close_all_conns()
763 CHECK(btpan_cb.tap_fd == INVALID_FD || btpan_cb.tap_fd == fd); in btpan_tap_fd_signaled()
765 if (btpan_cb.tap_fd != fd) { in btpan_tap_fd_signaled()
767 __func__, btpan_cb.tap_fd, fd); in btpan_tap_fd_signaled()
772 btpan_cb.tap_fd = INVALID_FD; in btpan_tap_fd_signaled()