Lines Matching refs:vsk
60 static bool vmci_check_transport(struct vsock_sock *vsk);
286 struct vsock_sock *vsk; in vmci_transport_send_control_pkt() local
288 vsk = vsock_sk(sk); in vmci_transport_send_control_pkt()
290 if (!vsock_addr_bound(&vsk->local_addr)) in vmci_transport_send_control_pkt()
293 if (!vsock_addr_bound(&vsk->remote_addr)) in vmci_transport_send_control_pkt()
296 return vmci_transport_alloc_send_control_pkt(&vsk->local_addr, in vmci_transport_send_control_pkt()
297 &vsk->remote_addr, in vmci_transport_send_control_pkt()
319 struct vsock_sock *vsk; in vmci_transport_send_reset() local
324 vsk = vsock_sk(sk); in vmci_transport_send_reset()
326 if (!vsock_addr_bound(&vsk->local_addr)) in vmci_transport_send_reset()
329 if (vsock_addr_bound(&vsk->remote_addr)) { in vmci_transport_send_reset()
330 dst_ptr = &vsk->remote_addr; in vmci_transport_send_reset()
336 return vmci_transport_alloc_send_control_pkt(&vsk->local_addr, dst_ptr, in vmci_transport_send_reset()
450 static int vmci_transport_shutdown(struct vsock_sock *vsk, int mode) in vmci_transport_shutdown() argument
453 &vsk->sk, in vmci_transport_shutdown()
616 struct vsock_sock *vsk; in vmci_transport_recv_dgram_cb() local
629 vsk = vsock_sk(sk); in vmci_transport_recv_dgram_cb()
630 if (!vmci_transport_allow_dgram(vsk, dg->src.context)) in vmci_transport_recv_dgram_cb()
677 struct vsock_sock *vsk; in vmci_transport_recv_stream_cb() local
746 vsk = vsock_sk(sk); in vmci_transport_recv_stream_cb()
747 if (!vmci_transport_allow_dgram(vsk, pkt->dg.src.context)) { in vmci_transport_recv_stream_cb()
761 vsk->local_addr.svm_cid = dst.svm_cid; in vmci_transport_recv_stream_cb()
764 vmci_trans(vsk)->notify_ops->handle_notify_pkt( in vmci_transport_recv_stream_cb()
805 struct vsock_sock *vsk; in vmci_transport_handle_detach() local
807 vsk = vsock_sk(sk); in vmci_transport_handle_detach()
808 if (!vmci_handle_is_invalid(vmci_trans(vsk)->qp_handle)) { in vmci_transport_handle_detach()
814 vsk->peer_shutdown = SHUTDOWN_MASK; in vmci_transport_handle_detach()
823 if (vsk->local_addr.svm_cid == VMADDR_CID_HOST || in vmci_transport_handle_detach()
824 vsock_stream_has_data(vsk) <= 0) { in vmci_transport_handle_detach()
1282 struct vsock_sock *vsk; in vmci_transport_recv_connecting_client() local
1286 vsk = vsock_sk(sk); in vmci_transport_recv_connecting_client()
1292 vmci_trans(vsk)->qp_handle)) { in vmci_transport_recv_connecting_client()
1305 vsock_insert_connected(vsk); in vmci_transport_recv_connecting_client()
1312 || pkt->dg.src.context != vsk->remote_addr.svm_cid in vmci_transport_recv_connecting_client()
1313 || pkt->src_port != vsk->remote_addr.svm_port in vmci_transport_recv_connecting_client()
1314 || !vmci_handle_is_invalid(vmci_trans(vsk)->qp_handle) in vmci_transport_recv_connecting_client()
1315 || vmci_trans(vsk)->qpair in vmci_transport_recv_connecting_client()
1316 || vmci_trans(vsk)->produce_size != 0 in vmci_transport_recv_connecting_client()
1317 || vmci_trans(vsk)->consume_size != 0 in vmci_transport_recv_connecting_client()
1318 || vmci_trans(vsk)->detach_sub_id != VMCI_INVALID_ID) { in vmci_transport_recv_connecting_client()
1350 if (vsk->ignore_connecting_rst) { in vmci_transport_recv_connecting_client()
1351 vsk->ignore_connecting_rst = false; in vmci_transport_recv_connecting_client()
1382 struct vsock_sock *vsk; in vmci_transport_recv_connecting_client_negotiate() local
1392 vsk = vsock_sk(sk); in vmci_transport_recv_connecting_client_negotiate()
1399 vsk->sent_request = false; in vmci_transport_recv_connecting_client_negotiate()
1400 vsk->ignore_connecting_rst = false; in vmci_transport_recv_connecting_client_negotiate()
1403 if (pkt->u.size < vsk->buffer_min_size || in vmci_transport_recv_connecting_client_negotiate()
1404 pkt->u.size > vsk->buffer_max_size) { in vmci_transport_recv_connecting_client_negotiate()
1411 if (vsk->local_addr.svm_cid == VMADDR_CID_ANY) in vmci_transport_recv_connecting_client_negotiate()
1412 vsk->local_addr.svm_cid = pkt->dg.dst.context; in vmci_transport_recv_connecting_client_negotiate()
1446 vmci_trans(vsk), &detach_sub_id); in vmci_transport_recv_connecting_client_negotiate()
1454 is_local = vsk->remote_addr.svm_cid == vsk->local_addr.svm_cid; in vmci_transport_recv_connecting_client_negotiate()
1461 vsk->remote_addr.svm_cid, in vmci_transport_recv_connecting_client_negotiate()
1464 vsk, in vmci_transport_recv_connecting_client_negotiate()
1465 vsk-> in vmci_transport_recv_connecting_client_negotiate()
1476 vmci_trans(vsk)->qp_handle = handle; in vmci_transport_recv_connecting_client_negotiate()
1477 vmci_trans(vsk)->qpair = qpair; in vmci_transport_recv_connecting_client_negotiate()
1479 vmci_trans(vsk)->produce_size = vmci_trans(vsk)->consume_size = in vmci_transport_recv_connecting_client_negotiate()
1482 vmci_trans(vsk)->detach_sub_id = detach_sub_id; in vmci_transport_recv_connecting_client_negotiate()
1484 vmci_trans(vsk)->notify_ops->process_negotiate(sk); in vmci_transport_recv_connecting_client_negotiate()
1503 struct vsock_sock *vsk = vsock_sk(sk); in vmci_transport_recv_connecting_client_invalid() local
1505 if (vsk->sent_request) { in vmci_transport_recv_connecting_client_invalid()
1506 vsk->sent_request = false; in vmci_transport_recv_connecting_client_invalid()
1507 vsk->ignore_connecting_rst = true; in vmci_transport_recv_connecting_client_invalid()
1509 err = vmci_transport_send_conn_request(sk, vsk->buffer_size); in vmci_transport_recv_connecting_client_invalid()
1523 struct vsock_sock *vsk; in vmci_transport_recv_connected() local
1537 vsk = vsock_sk(sk); in vmci_transport_recv_connected()
1539 vsk->peer_shutdown |= pkt->u.mode; in vmci_transport_recv_connected()
1545 vsk = vsock_sk(sk); in vmci_transport_recv_connected()
1556 vsk->peer_shutdown = SHUTDOWN_MASK; in vmci_transport_recv_connected()
1557 if (vsock_stream_has_data(vsk) <= 0) in vmci_transport_recv_connected()
1564 vsk = vsock_sk(sk); in vmci_transport_recv_connected()
1565 vmci_trans(vsk)->notify_ops->handle_notify_pkt( in vmci_transport_recv_connected()
1577 static int vmci_transport_socket_init(struct vsock_sock *vsk, in vmci_transport_socket_init() argument
1580 vsk->trans = kmalloc(sizeof(struct vmci_transport), GFP_KERNEL); in vmci_transport_socket_init()
1581 if (!vsk->trans) in vmci_transport_socket_init()
1584 vmci_trans(vsk)->dg_handle = VMCI_INVALID_HANDLE; in vmci_transport_socket_init()
1585 vmci_trans(vsk)->qp_handle = VMCI_INVALID_HANDLE; in vmci_transport_socket_init()
1586 vmci_trans(vsk)->qpair = NULL; in vmci_transport_socket_init()
1587 vmci_trans(vsk)->produce_size = vmci_trans(vsk)->consume_size = 0; in vmci_transport_socket_init()
1588 vmci_trans(vsk)->detach_sub_id = VMCI_INVALID_ID; in vmci_transport_socket_init()
1589 vmci_trans(vsk)->notify_ops = NULL; in vmci_transport_socket_init()
1590 INIT_LIST_HEAD(&vmci_trans(vsk)->elem); in vmci_transport_socket_init()
1591 vmci_trans(vsk)->sk = &vsk->sk; in vmci_transport_socket_init()
1592 spin_lock_init(&vmci_trans(vsk)->lock); in vmci_transport_socket_init()
1631 static void vmci_transport_destruct(struct vsock_sock *vsk) in vmci_transport_destruct() argument
1634 if (!vmci_trans(vsk)) in vmci_transport_destruct()
1640 spin_lock_bh(&vmci_trans(vsk)->lock); in vmci_transport_destruct()
1641 vmci_trans(vsk)->sk = NULL; in vmci_transport_destruct()
1642 spin_unlock_bh(&vmci_trans(vsk)->lock); in vmci_transport_destruct()
1644 if (vmci_trans(vsk)->notify_ops) in vmci_transport_destruct()
1645 vmci_trans(vsk)->notify_ops->socket_destruct(vsk); in vmci_transport_destruct()
1648 list_add(&vmci_trans(vsk)->elem, &vmci_transport_cleanup_list); in vmci_transport_destruct()
1652 vsk->trans = NULL; in vmci_transport_destruct()
1655 static void vmci_transport_release(struct vsock_sock *vsk) in vmci_transport_release() argument
1657 vsock_remove_sock(vsk); in vmci_transport_release()
1659 if (!vmci_handle_is_invalid(vmci_trans(vsk)->dg_handle)) { in vmci_transport_release()
1660 vmci_datagram_destroy_handle(vmci_trans(vsk)->dg_handle); in vmci_transport_release()
1661 vmci_trans(vsk)->dg_handle = VMCI_INVALID_HANDLE; in vmci_transport_release()
1665 static int vmci_transport_dgram_bind(struct vsock_sock *vsk, in vmci_transport_dgram_bind() argument
1686 &vsk->sk, in vmci_transport_dgram_bind()
1687 &vmci_trans(vsk)->dg_handle); in vmci_transport_dgram_bind()
1690 vsock_addr_init(&vsk->local_addr, addr->svm_cid, in vmci_transport_dgram_bind()
1691 vmci_trans(vsk)->dg_handle.resource); in vmci_transport_dgram_bind()
1697 struct vsock_sock *vsk, in vmci_transport_dgram_enqueue() argument
1708 if (!vmci_transport_allow_dgram(vsk, remote_addr->svm_cid)) in vmci_transport_dgram_enqueue()
1724 dg->src = vmci_make_handle(vsk->local_addr.svm_cid, in vmci_transport_dgram_enqueue()
1725 vsk->local_addr.svm_port); in vmci_transport_dgram_enqueue()
1736 static int vmci_transport_dgram_dequeue(struct vsock_sock *vsk, in vmci_transport_dgram_dequeue() argument
1753 skb = skb_recv_datagram(&vsk->sk, flags, noblock, &err); in vmci_transport_dgram_dequeue()
1788 skb_free_datagram(&vsk->sk, skb); in vmci_transport_dgram_dequeue()
1804 static int vmci_transport_connect(struct vsock_sock *vsk) in vmci_transport_connect() argument
1808 struct sock *sk = &vsk->sk; in vmci_transport_connect()
1812 err = vmci_transport_send_conn_request(sk, vsk->buffer_size); in vmci_transport_connect()
1820 err = vmci_transport_send_conn_request2(sk, vsk->buffer_size, in vmci_transport_connect()
1827 vsk->sent_request = true; in vmci_transport_connect()
1834 struct vsock_sock *vsk, in vmci_transport_stream_dequeue() argument
1840 return vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0); in vmci_transport_stream_dequeue()
1842 return vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0); in vmci_transport_stream_dequeue()
1846 struct vsock_sock *vsk, in vmci_transport_stream_enqueue() argument
1850 return vmci_qpair_enquev(vmci_trans(vsk)->qpair, msg, len, 0); in vmci_transport_stream_enqueue()
1853 static s64 vmci_transport_stream_has_data(struct vsock_sock *vsk) in vmci_transport_stream_has_data() argument
1855 return vmci_qpair_consume_buf_ready(vmci_trans(vsk)->qpair); in vmci_transport_stream_has_data()
1858 static s64 vmci_transport_stream_has_space(struct vsock_sock *vsk) in vmci_transport_stream_has_space() argument
1860 return vmci_qpair_produce_free_space(vmci_trans(vsk)->qpair); in vmci_transport_stream_has_space()
1863 static u64 vmci_transport_stream_rcvhiwat(struct vsock_sock *vsk) in vmci_transport_stream_rcvhiwat() argument
1865 return vmci_trans(vsk)->consume_size; in vmci_transport_stream_rcvhiwat()
1868 static bool vmci_transport_stream_is_active(struct vsock_sock *vsk) in vmci_transport_stream_is_active() argument
1870 return !vmci_handle_is_invalid(vmci_trans(vsk)->qp_handle); in vmci_transport_stream_is_active()
1874 struct vsock_sock *vsk, in vmci_transport_notify_poll_in() argument
1878 return vmci_trans(vsk)->notify_ops->poll_in( in vmci_transport_notify_poll_in()
1879 &vsk->sk, target, data_ready_now); in vmci_transport_notify_poll_in()
1883 struct vsock_sock *vsk, in vmci_transport_notify_poll_out() argument
1887 return vmci_trans(vsk)->notify_ops->poll_out( in vmci_transport_notify_poll_out()
1888 &vsk->sk, target, space_available_now); in vmci_transport_notify_poll_out()
1892 struct vsock_sock *vsk, in vmci_transport_notify_recv_init() argument
1896 return vmci_trans(vsk)->notify_ops->recv_init( in vmci_transport_notify_recv_init()
1897 &vsk->sk, target, in vmci_transport_notify_recv_init()
1902 struct vsock_sock *vsk, in vmci_transport_notify_recv_pre_block() argument
1906 return vmci_trans(vsk)->notify_ops->recv_pre_block( in vmci_transport_notify_recv_pre_block()
1907 &vsk->sk, target, in vmci_transport_notify_recv_pre_block()
1912 struct vsock_sock *vsk, in vmci_transport_notify_recv_pre_dequeue() argument
1916 return vmci_trans(vsk)->notify_ops->recv_pre_dequeue( in vmci_transport_notify_recv_pre_dequeue()
1917 &vsk->sk, target, in vmci_transport_notify_recv_pre_dequeue()
1922 struct vsock_sock *vsk, in vmci_transport_notify_recv_post_dequeue() argument
1928 return vmci_trans(vsk)->notify_ops->recv_post_dequeue( in vmci_transport_notify_recv_post_dequeue()
1929 &vsk->sk, target, copied, data_read, in vmci_transport_notify_recv_post_dequeue()
1934 struct vsock_sock *vsk, in vmci_transport_notify_send_init() argument
1937 return vmci_trans(vsk)->notify_ops->send_init( in vmci_transport_notify_send_init()
1938 &vsk->sk, in vmci_transport_notify_send_init()
1943 struct vsock_sock *vsk, in vmci_transport_notify_send_pre_block() argument
1946 return vmci_trans(vsk)->notify_ops->send_pre_block( in vmci_transport_notify_send_pre_block()
1947 &vsk->sk, in vmci_transport_notify_send_pre_block()
1952 struct vsock_sock *vsk, in vmci_transport_notify_send_pre_enqueue() argument
1955 return vmci_trans(vsk)->notify_ops->send_pre_enqueue( in vmci_transport_notify_send_pre_enqueue()
1956 &vsk->sk, in vmci_transport_notify_send_pre_enqueue()
1961 struct vsock_sock *vsk, in vmci_transport_notify_send_post_enqueue() argument
1965 return vmci_trans(vsk)->notify_ops->send_post_enqueue( in vmci_transport_notify_send_post_enqueue()
1966 &vsk->sk, written, in vmci_transport_notify_send_post_enqueue()
1989 struct vsock_sock *vsk = vsock_sk(sk); in vmci_transport_proto_to_notify_struct() local
1996 vmci_trans(vsk)->notify_ops = &vmci_transport_notify_pkt_ops; in vmci_transport_proto_to_notify_struct()
2002 vmci_trans(vsk)->notify_ops = in vmci_transport_proto_to_notify_struct()
2011 vmci_trans(vsk)->notify_ops->socket_init(sk); in vmci_transport_proto_to_notify_struct()
2059 static bool vmci_check_transport(struct vsock_sock *vsk) in vmci_check_transport() argument
2061 return vsk->transport == &vmci_transport; in vmci_check_transport()