Lines Matching refs:vq

91 			    struct vhost_virtqueue *vq)
98 mutex_lock(&vq->mutex);
100 if (!vhost_vq_get_backend(vq))
103 if (!vq_meta_prefetch(vq))
107 vhost_disable_notify(&vsock->dev, vq);
123 vhost_enable_notify(&vsock->dev, vq);
127 head = vhost_get_vq_desc(vq, vq->iov, ARRAY_SIZE(vq->iov),
134 if (head == vq->num) {
139 if (unlikely(vhost_enable_notify(&vsock->dev, vq))) {
140 vhost_disable_notify(&vsock->dev, vq);
148 vq_err(vq, "Expected 0 output buffers, got %u\n", out);
152 iov_len = iov_length(&vq->iov[out], in);
155 vq_err(vq, "Buffer len [%zu] too small\n", iov_len);
159 iov_iter_init(&iov_iter, ITER_DEST, &vq->iov[out], in, iov_len);
198 vq_err(vq, "Faulted on copying pkt hdr\n");
207 vq_err(vq, "Faulted on copying pkt buf\n");
216 vhost_add_used(vq, head, sizeof(*hdr) + payload_len);
249 } while(likely(!vhost_exceeds_weight(vq, ++pkts, total_len)));
251 vhost_signal(&vsock->dev, vq);
254 mutex_unlock(&vq->mutex);
262 struct vhost_virtqueue *vq;
266 vq = &vsock->vqs[VSOCK_VQ_RX];
268 vhost_transport_do_send_pkt(vsock, vq);
330 vhost_vsock_alloc_skb(struct vhost_virtqueue *vq,
341 vq_err(vq, "Expected 0 input buffers, got %u\n", in);
345 len = iov_length(vq->iov, out);
352 iov_iter_init(&iov_iter, ITER_SOURCE, vq->iov, out, len);
357 vq_err(vq, "Expected %zu bytes for pkt->hdr, got %zu bytes\n",
380 vq_err(vq, "Expected %zu byte payload, got %zu bytes\n",
392 struct vhost_virtqueue *vq = &vsock->vqs[VSOCK_VQ_TX];
398 return val < vq->num;
478 struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
480 struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock,
487 mutex_lock(&vq->mutex);
489 if (!vhost_vq_get_backend(vq))
492 if (!vq_meta_prefetch(vq))
495 vhost_disable_notify(&vsock->dev, vq);
507 head = vhost_get_vq_desc(vq, vq->iov, ARRAY_SIZE(vq->iov),
512 if (head == vq->num) {
513 if (unlikely(vhost_enable_notify(&vsock->dev, vq))) {
514 vhost_disable_notify(&vsock->dev, vq);
520 skb = vhost_vsock_alloc_skb(vq, out, in);
522 vq_err(vq, "Faulted on pkt\n");
541 vhost_add_used(vq, head, 0);
543 } while(likely(!vhost_exceeds_weight(vq, ++pkts, total_len)));
547 vhost_signal(&vsock->dev, vq);
550 mutex_unlock(&vq->mutex);
555 struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
557 struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock,
560 vhost_transport_do_send_pkt(vsock, vq);
565 struct vhost_virtqueue *vq;
576 vq = &vsock->vqs[i];
578 mutex_lock(&vq->mutex);
580 if (!vhost_vq_access_ok(vq)) {
585 if (!vhost_vq_get_backend(vq)) {
586 vhost_vq_set_backend(vq, vsock);
587 ret = vhost_vq_init_access(vq);
592 mutex_unlock(&vq->mutex);
604 vhost_vq_set_backend(vq, NULL);
605 mutex_unlock(&vq->mutex);
608 vq = &vsock->vqs[i];
610 mutex_lock(&vq->mutex);
611 vhost_vq_set_backend(vq, NULL);
612 mutex_unlock(&vq->mutex);
633 struct vhost_virtqueue *vq = &vsock->vqs[i];
635 mutex_lock(&vq->mutex);
636 vhost_vq_set_backend(vq, NULL);
637 mutex_unlock(&vq->mutex);
796 struct vhost_virtqueue *vq;
817 vq = &vsock->vqs[i];
818 mutex_lock(&vq->mutex);
819 vq->acked_features = features;
820 mutex_unlock(&vq->mutex);