aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-net.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-12-24 17:37:01 +0200
committerMichael S. Tsirkin <mst@redhat.com>2013-01-07 19:42:23 +0200
commitf56a12475ff1b8aa61210d08522c3c8aaf0e2648 (patch)
tree04ebf83a43ca66048af15b44779578f39f360a8a /hw/virtio-net.c
parent24f4fe345c1b80bab1ee18573914123d8028a9e6 (diff)
vhost: backend masking support
Support backend guest notifier masking in vhost-net: create eventfd at device init, when masked, make vhost use that as eventfd instead of sending an interrupt. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio-net.c')
-rw-r--r--hw/virtio-net.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index b756d57b1a..3bb01b1037 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -1010,6 +1010,22 @@ static NetClientInfo net_virtio_info = {
.link_status_changed = virtio_net_set_link_status,
};
+static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
+{
+ VirtIONet *n = to_virtio_net(vdev);
+ assert(n->vhost_started);
+ return vhost_net_virtqueue_pending(tap_get_vhost_net(n->nic->nc.peer), idx);
+}
+
+static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
+ bool mask)
+{
+ VirtIONet *n = to_virtio_net(vdev);
+ assert(n->vhost_started);
+ vhost_net_virtqueue_mask(tap_get_vhost_net(n->nic->nc.peer),
+ vdev, idx, mask);
+}
+
VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf,
virtio_net_conf *net)
{
@@ -1026,6 +1042,8 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf,
n->vdev.bad_features = virtio_net_bad_features;
n->vdev.reset = virtio_net_reset;
n->vdev.set_status = virtio_net_set_status;
+ n->vdev.guest_notifier_mask = virtio_net_guest_notifier_mask;
+ n->vdev.guest_notifier_pending = virtio_net_guest_notifier_pending;
n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx);
if (net->tx && strcmp(net->tx, "timer") && strcmp(net->tx, "bh")) {