• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/vhost/

Lines Matching refs:vq

54 	 * Protected by tx vq lock. */
116 struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_TX];
124 .msg_iov = vq->iov,
130 struct socket *sock = rcu_dereference(vq->private_data);
136 mutex_lock(&vq->mutex);
138 mutex_unlock(&vq->mutex);
143 mutex_lock(&vq->mutex);
144 vhost_disable_notify(vq);
148 hdr_size = vq->vhost_hlen;
151 head = vhost_get_vq_desc(&net->dev, vq, vq->iov,
152 ARRAY_SIZE(vq->iov),
159 if (head == vq->num) {
166 if (unlikely(vhost_enable_notify(vq))) {
167 vhost_disable_notify(vq);
173 vq_err(vq, "Unexpected descriptor format for TX: "
178 s = move_iovec_hdr(vq->iov, vq->hdr, hdr_size, out);
180 len = iov_length(vq->iov, out);
183 vq_err(vq, "Unexpected header len for TX: "
185 iov_length(vq->hdr, s), hdr_size);
191 vhost_discard_vq_desc(vq, 1);
198 vhost_add_used_and_signal(&net->dev, vq, head, 0);
201 vhost_poll_queue(&vq->poll);
206 mutex_unlock(&vq->mutex);
224 * vq has read descriptors only.
225 * @vq - the relevant virtqueue
232 static int get_rx_bufs(struct vhost_virtqueue *vq,
250 d = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg,
251 ARRAY_SIZE(vq->iov) - seg, &out,
253 if (d == vq->num) {
258 vq_err(vq, "unexpected descriptor format for RX: "
268 heads[headcount].len = iov_length(vq->iov + seg, in);
279 vhost_discard_vq_desc(vq, headcount);
287 struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_RX];
296 .msg_iov = vq->iov,
308 struct socket *sock = rcu_dereference(vq->private_data);
313 mutex_lock(&vq->mutex);
314 vhost_disable_notify(vq);
315 hdr_size = vq->vhost_hlen;
318 vq->log : NULL;
321 head = vhost_get_vq_desc(&net->dev, vq, vq->iov,
322 ARRAY_SIZE(vq->iov),
329 if (head == vq->num) {
330 if (unlikely(vhost_enable_notify(vq))) {
333 vhost_disable_notify(vq);
342 vq_err(vq, "Unexpected descriptor format for RX: "
348 s = move_iovec_hdr(vq->iov, vq->hdr, hdr_size, in);
350 len = iov_length(vq->iov, in);
353 vq_err(vq, "Unexpected header len for RX: "
355 iov_length(vq->hdr, s), hdr_size);
362 vhost_discard_vq_desc(vq, 1);
369 vhost_discard_vq_desc(vq, 1);
373 err = memcpy_toiovec(vq->hdr, (unsigned char *)&hdr, hdr_size);
375 vq_err(vq, "Unable to write vnet_hdr at addr %p: %d\n",
376 vq->iov->iov_base, err);
380 vhost_add_used_and_signal(&net->dev, vq, head, len);
382 vhost_log_write(vq, vq_log, log, len);
385 vhost_poll_queue(&vq->poll);
390 mutex_unlock(&vq->mutex);
398 struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_RX];
406 .msg_iov = vq->iov,
419 struct socket *sock = rcu_dereference(vq->private_data);
424 mutex_lock(&vq->mutex);
425 vhost_disable_notify(vq);
426 vhost_hlen = vq->vhost_hlen;
427 sock_hlen = vq->sock_hlen;
430 vq->log : NULL;
435 headcount = get_rx_bufs(vq, vq->heads, vhost_len,
442 if (unlikely(vhost_enable_notify(vq))) {
445 vhost_disable_notify(vq);
455 move_iovec_hdr(vq->iov, vq->hdr, vhost_hlen, in);
459 copy_iovec_hdr(vq->iov, vq->hdr, sock_hlen, in);
469 vhost_discard_vq_desc(vq, headcount);
473 memcpy_toiovecend(vq->hdr, (unsigned char *)&hdr, 0,
475 vq_err(vq, "Unable to write vnet_hdr at addr %p\n",
476 vq->iov->iov_base);
481 memcpy_toiovecend(vq->hdr, (unsigned char *)&headcount,
484 vq_err(vq, "Failed num_buffers write");
485 vhost_discard_vq_desc(vq, headcount);
488 vhost_add_used_and_signal_n(&net->dev, vq, vq->heads,
491 vhost_log_write(vq, vq_log, log, vhost_len);
494 vhost_poll_queue(&vq->poll);
499 mutex_unlock(&vq->mutex);
513 struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
515 struct vhost_net *net = container_of(vq->dev, struct vhost_net, dev);
522 struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
524 struct vhost_net *net = container_of(vq->dev, struct vhost_net, dev);
571 struct vhost_virtqueue *vq)
573 if (!vq->private_data)
575 if (vq == n->vqs + VHOST_NET_VQ_TX) {
583 struct vhost_virtqueue *vq)
585 struct socket *sock = vq->private_data;
588 if (vq == n->vqs + VHOST_NET_VQ_TX) {
596 struct vhost_virtqueue *vq)
600 mutex_lock(&vq->mutex);
601 sock = vq->private_data;
602 vhost_net_disable_vq(n, vq);
603 rcu_assign_pointer(vq->private_data, NULL);
604 mutex_unlock(&vq->mutex);
712 struct vhost_virtqueue *vq;
724 vq = n->vqs + index;
725 mutex_lock(&vq->mutex);
728 if (!vhost_vq_access_ok(vq)) {
739 oldsock = vq->private_data;
741 vhost_net_disable_vq(n, vq);
742 rcu_assign_pointer(vq->private_data, sock);
743 vhost_net_enable_vq(n, vq);
746 mutex_unlock(&vq->mutex);
757 mutex_unlock(&vq->mutex);