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

Lines Matching refs:vq

130 	struct virtqueue *vq;
165 void (*service)(struct virtqueue *vq);
207 #define lg_last_avail(vq) ((vq)->last_avail_idx)
592 * function returns the next descriptor in the chain, or vq->vring.num if we're
619 static void trigger_irq(struct virtqueue *vq)
621 unsigned long buf[] = { LHREQ_IRQ, vq->config.irq };
624 if (!vq->pending_used)
626 vq->pending_used = 0;
629 if (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT) {
631 if (!vq->dev->irq_on_empty
632 || lg_last_avail(vq) != vq->vring.avail->idx)
638 err(1, "Triggering irq %i", vq->config.irq);
649 static unsigned wait_for_vq_desc(struct virtqueue *vq,
655 u16 last_avail = lg_last_avail(vq);
658 while (last_avail == vq->vring.avail->idx) {
665 trigger_irq(vq);
668 vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
675 if (last_avail != vq->vring.avail->idx) {
676 vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
681 if (read(vq->eventfd, &event, sizeof(event)) != sizeof(event))
685 vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
689 if ((u16)(vq->vring.avail->idx - last_avail) > vq->vring.num)
691 last_avail, vq->vring.avail->idx);
697 head = vq->vring.avail->ring[last_avail % vq->vring.num];
698 lg_last_avail(vq)++;
701 if (head >= vq->vring.num)
707 max = vq->vring.num;
708 desc = vq->vring.desc;
755 static void add_used(struct virtqueue *vq, unsigned int head, int len)
763 used = &vq->vring.used->ring[vq->vring.used->idx % vq->vring.num];
768 vq->vring.used->idx++;
769 vq->pending_used++;
773 static void add_used_and_trigger(struct virtqueue *vq, unsigned head, int len)
775 add_used(vq, head, len);
776 trigger_irq(vq);
792 static void console_input(struct virtqueue *vq)
796 struct console_abort *abort = vq->dev->priv;
797 struct iovec iov[vq->vring.num];
800 head = wait_for_vq_desc(vq, iov, &out_num, &in_num);
818 add_used_and_trigger(vq, head, len);
847 static void console_output(struct virtqueue *vq)
850 struct iovec iov[vq->vring.num];
853 head = wait_for_vq_desc(vq, iov, &out, &in);
869 add_used(vq, head, 0);
882 static void net_output(struct virtqueue *vq)
884 struct net_info *net_info = vq->dev->priv;
886 struct iovec iov[vq->vring.num];
889 head = wait_for_vq_desc(vq, iov, &out, &in);
903 add_used(vq, head, 0);
926 static void net_input(struct virtqueue *vq)
930 struct iovec iov[vq->vring.num];
931 struct net_info *net_info = vq->dev->priv;
937 head = wait_for_vq_desc(vq, iov, &out, &in);
945 if (vq->pending_used && will_block(net_info->tunfd))
946 trigger_irq(vq);
960 add_used(vq, head, len);
967 struct virtqueue *vq = _vq;
970 vq->service(vq);
985 struct virtqueue *vq;
996 for (vq = dev->vq; vq; vq = vq->next) {
997 if (vq->thread != (pid_t)-1) {
998 kill(vq->thread, SIGTERM);
999 waitpid(vq->thread, NULL, 0);
1000 vq->thread = (pid_t)-1;
1002 memset(vq->vring.desc, 0,
1003 vring_size(vq->config.num, LGUEST_VRING_ALIGN));
1004 lg_last_avail(vq) = 0;
1015 static void create_thread(struct virtqueue *vq)
1023 vq->config.pfn*getpagesize(), 0 };
1026 vq->eventfd = eventfd(0, 0);
1027 if (vq->eventfd < 0)
1029 args[2] = vq->eventfd;
1033 * does an LHCALL_NOTIFY for this vq.
1042 vq->thread = clone(do_thread, stack + 32768, CLONE_VM | SIGCHLD, vq);
1043 if (vq->thread == (pid_t)-1)
1047 close(vq->eventfd);
1062 struct virtqueue *vq;
1074 for (vq = dev->vq; vq; vq = vq->next) {
1075 if (vq->service)
1076 create_thread(vq);
1119 struct virtqueue *vq;
1141 for (vq = i->vq; vq; vq = vq->next) {
1142 if (addr != vq->config.pfn*getpagesize())
1218 struct virtqueue **i, *vq = malloc(sizeof(*vq));
1227 vq->next = NULL;
1228 vq->last_avail_idx = 0;
1229 vq->dev = dev;
1235 vq->service = service;
1236 vq->thread = (pid_t)-1;
1239 vq->config.num = num_descs;
1240 vq->config.irq = devices.next_irq++;
1241 vq->config.pfn = to_guest_phys(p) / getpagesize();
1244 vring_init(&vq->vring, num_descs, p, LGUEST_VRING_ALIGN);
1253 memcpy(device_config(dev), &vq->config, sizeof(vq->config));
1260 * Add to tail of list, so dev->vq is first vq, dev->vq->next is
1263 for (i = &dev->vq; *i; i = &(*i)->next);
1264 *i = vq;
1317 dev->vq = NULL;
1609 static void blk_request(struct virtqueue *vq)
1611 struct vblk_info *vblk = vq->dev->priv;
1616 struct iovec iov[vq->vring.num];
1623 head = wait_for_vq_desc(vq, iov, &out_num, &in_num);
1716 add_used(vq, head, wlen);
1771 static void rng_input(struct virtqueue *vq)
1775 struct rng_info *rng_info = vq->dev->priv;
1776 struct iovec iov[vq->vring.num];
1779 head = wait_for_vq_desc(vq, iov, &out_num, &in_num);
1796 add_used(vq, head, totlen);