Lines Matching refs:vvs

204 	struct virtio_vsock_sock *vvs;  in virtio_transport_send_pkt_info()  local
225 vvs = vsk->trans; in virtio_transport_send_pkt_info()
228 pkt_len = virtio_transport_get_credit(vvs, pkt_len); in virtio_transport_send_pkt_info()
250 virtio_transport_inc_tx_pkt(vvs, skb); in virtio_transport_send_pkt_info()
270 virtio_transport_put_credit(vvs, rest_len); in virtio_transport_send_pkt_info()
279 static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs, in virtio_transport_inc_rx_pkt() argument
282 if (vvs->rx_bytes + len > vvs->buf_alloc) in virtio_transport_inc_rx_pkt()
285 vvs->rx_bytes += len; in virtio_transport_inc_rx_pkt()
289 static void virtio_transport_dec_rx_pkt(struct virtio_vsock_sock *vvs, in virtio_transport_dec_rx_pkt() argument
292 vvs->rx_bytes -= len; in virtio_transport_dec_rx_pkt()
293 vvs->fwd_cnt += len; in virtio_transport_dec_rx_pkt()
296 void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct sk_buff *skb) in virtio_transport_inc_tx_pkt() argument
300 spin_lock_bh(&vvs->rx_lock); in virtio_transport_inc_tx_pkt()
301 vvs->last_fwd_cnt = vvs->fwd_cnt; in virtio_transport_inc_tx_pkt()
302 hdr->fwd_cnt = cpu_to_le32(vvs->fwd_cnt); in virtio_transport_inc_tx_pkt()
303 hdr->buf_alloc = cpu_to_le32(vvs->buf_alloc); in virtio_transport_inc_tx_pkt()
304 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_inc_tx_pkt()
308 u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 credit) in virtio_transport_get_credit() argument
315 spin_lock_bh(&vvs->tx_lock); in virtio_transport_get_credit()
316 ret = vvs->peer_buf_alloc - (vvs->tx_cnt - vvs->peer_fwd_cnt); in virtio_transport_get_credit()
319 vvs->tx_cnt += ret; in virtio_transport_get_credit()
320 spin_unlock_bh(&vvs->tx_lock); in virtio_transport_get_credit()
326 void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit) in virtio_transport_put_credit() argument
331 spin_lock_bh(&vvs->tx_lock); in virtio_transport_put_credit()
332 vvs->tx_cnt -= credit; in virtio_transport_put_credit()
333 spin_unlock_bh(&vvs->tx_lock); in virtio_transport_put_credit()
352 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_stream_do_peek() local
357 spin_lock_bh(&vvs->rx_lock); in virtio_transport_stream_do_peek()
359 skb_queue_walk(&vvs->rx_queue, skb) { in virtio_transport_stream_do_peek()
366 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_stream_do_peek()
377 spin_lock_bh(&vvs->rx_lock); in virtio_transport_stream_do_peek()
383 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_stream_do_peek()
398 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_stream_do_dequeue() local
406 spin_lock_bh(&vvs->rx_lock); in virtio_transport_stream_do_dequeue()
408 if (WARN_ONCE(skb_queue_empty(&vvs->rx_queue) && vvs->rx_bytes, in virtio_transport_stream_do_dequeue()
410 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_stream_do_dequeue()
414 while (total < len && !skb_queue_empty(&vvs->rx_queue)) { in virtio_transport_stream_do_dequeue()
415 skb = skb_peek(&vvs->rx_queue); in virtio_transport_stream_do_dequeue()
424 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_stream_do_dequeue()
430 spin_lock_bh(&vvs->rx_lock); in virtio_transport_stream_do_dequeue()
438 virtio_transport_dec_rx_pkt(vvs, pkt_len); in virtio_transport_stream_do_dequeue()
439 __skb_unlink(skb, &vvs->rx_queue); in virtio_transport_stream_do_dequeue()
444 fwd_cnt_delta = vvs->fwd_cnt - vvs->last_fwd_cnt; in virtio_transport_stream_do_dequeue()
445 free_space = vvs->buf_alloc - fwd_cnt_delta; in virtio_transport_stream_do_dequeue()
446 low_rx_bytes = (vvs->rx_bytes < in virtio_transport_stream_do_dequeue()
449 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_stream_do_dequeue()
476 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_seqpacket_do_peek() local
480 spin_lock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_do_peek()
482 if (!vvs->msg_count) { in virtio_transport_seqpacket_do_peek()
483 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_do_peek()
490 skb_queue_walk(&vvs->rx_queue, skb) { in virtio_transport_seqpacket_do_peek()
501 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_do_peek()
510 spin_lock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_do_peek()
524 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_do_peek()
533 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_seqpacket_do_dequeue() local
539 spin_lock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_do_dequeue()
541 if (vvs->msg_count == 0) { in virtio_transport_seqpacket_do_dequeue()
542 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_do_dequeue()
550 skb = __skb_dequeue(&vvs->rx_queue); in virtio_transport_seqpacket_do_dequeue()
567 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_do_dequeue()
579 spin_lock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_do_dequeue()
588 vvs->msg_count--; in virtio_transport_seqpacket_do_dequeue()
594 virtio_transport_dec_rx_pkt(vvs, pkt_len); in virtio_transport_seqpacket_do_dequeue()
598 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_do_dequeue()
634 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_seqpacket_enqueue() local
636 spin_lock_bh(&vvs->tx_lock); in virtio_transport_seqpacket_enqueue()
638 if (len > vvs->peer_buf_alloc) { in virtio_transport_seqpacket_enqueue()
639 spin_unlock_bh(&vvs->tx_lock); in virtio_transport_seqpacket_enqueue()
643 spin_unlock_bh(&vvs->tx_lock); in virtio_transport_seqpacket_enqueue()
660 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_stream_has_data() local
663 spin_lock_bh(&vvs->rx_lock); in virtio_transport_stream_has_data()
664 bytes = vvs->rx_bytes; in virtio_transport_stream_has_data()
665 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_stream_has_data()
673 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_seqpacket_has_data() local
676 spin_lock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_has_data()
677 msg_count = vvs->msg_count; in virtio_transport_seqpacket_has_data()
678 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_seqpacket_has_data()
686 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_has_space() local
689 bytes = (s64)vvs->peer_buf_alloc - (vvs->tx_cnt - vvs->peer_fwd_cnt); in virtio_transport_has_space()
698 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_stream_has_space() local
701 spin_lock_bh(&vvs->tx_lock); in virtio_transport_stream_has_space()
703 spin_unlock_bh(&vvs->tx_lock); in virtio_transport_stream_has_space()
712 struct virtio_vsock_sock *vvs; in virtio_transport_do_socket_init() local
714 vvs = kzalloc(sizeof(*vvs), GFP_KERNEL); in virtio_transport_do_socket_init()
715 if (!vvs) in virtio_transport_do_socket_init()
718 vsk->trans = vvs; in virtio_transport_do_socket_init()
719 vvs->vsk = vsk; in virtio_transport_do_socket_init()
723 vvs->peer_buf_alloc = ptrans->peer_buf_alloc; in virtio_transport_do_socket_init()
729 vvs->buf_alloc = vsk->buffer_size; in virtio_transport_do_socket_init()
731 spin_lock_init(&vvs->rx_lock); in virtio_transport_do_socket_init()
732 spin_lock_init(&vvs->tx_lock); in virtio_transport_do_socket_init()
733 skb_queue_head_init(&vvs->rx_queue); in virtio_transport_do_socket_init()
742 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_notify_buffer_size() local
747 vvs->buf_alloc = *val; in virtio_transport_notify_buffer_size()
923 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_destruct() local
925 kfree(vvs); in virtio_transport_destruct()
981 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_remove_sock() local
986 __skb_queue_purge(&vvs->rx_queue); in virtio_transport_remove_sock()
1139 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_recv_enqueue() local
1147 spin_lock_bh(&vvs->rx_lock); in virtio_transport_recv_enqueue()
1149 can_enqueue = virtio_transport_inc_rx_pkt(vvs, len); in virtio_transport_recv_enqueue()
1156 vvs->msg_count++; in virtio_transport_recv_enqueue()
1162 if (len <= GOOD_COPY_LEN && !skb_queue_empty(&vvs->rx_queue)) { in virtio_transport_recv_enqueue()
1166 last_skb = skb_peek_tail(&vvs->rx_queue); in virtio_transport_recv_enqueue()
1185 __skb_queue_tail(&vvs->rx_queue, skb); in virtio_transport_recv_enqueue()
1188 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_recv_enqueue()
1276 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_space_update() local
1284 if (!vvs) in virtio_transport_space_update()
1288 spin_lock_bh(&vvs->tx_lock); in virtio_transport_space_update()
1289 vvs->peer_buf_alloc = le32_to_cpu(hdr->buf_alloc); in virtio_transport_space_update()
1290 vvs->peer_fwd_cnt = le32_to_cpu(hdr->fwd_cnt); in virtio_transport_space_update()
1292 spin_unlock_bh(&vvs->tx_lock); in virtio_transport_space_update()
1518 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_read_skb() local
1525 spin_lock_bh(&vvs->rx_lock); in virtio_transport_read_skb()
1529 skb = __skb_recv_datagram(sk, &vvs->rx_queue, MSG_DONTWAIT, &off, &err); in virtio_transport_read_skb()
1531 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_read_skb()
1537 vvs->msg_count--; in virtio_transport_read_skb()
1539 virtio_transport_dec_rx_pkt(vvs, le32_to_cpu(hdr->len)); in virtio_transport_read_skb()
1540 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_read_skb()
1550 struct virtio_vsock_sock *vvs = vsk->trans; in virtio_transport_notify_set_rcvlowat() local
1553 spin_lock_bh(&vvs->rx_lock); in virtio_transport_notify_set_rcvlowat()
1561 send_update = (vvs->rx_bytes < val) && in virtio_transport_notify_set_rcvlowat()
1562 (vvs->fwd_cnt != vvs->last_fwd_cnt); in virtio_transport_notify_set_rcvlowat()
1564 spin_unlock_bh(&vvs->rx_lock); in virtio_transport_notify_set_rcvlowat()