From 2e8898277a9156927e2f282262e392061f39bc7f Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Mon, 7 Jun 2010 12:12:08 -0300
Subject: [PATCH 4/6] vhost-net: check PUBLISH_USED in backend

RH-Author: Michael S. Tsirkin <mst@redhat.com>
Message-id: <20100607121208.GA11090@redhat.com>
Patchwork-id: 9739
O-Subject: [RHEL6.0 PATCH] vhost-net: check PUBLISH_USED in backend
Bugzilla: 600203
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>

We must disable PUBLISH_USED feature unless backend supports it,
otherwise we get an error when we try to ack it in vhost.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Upstream status: not applicable
Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=2498465
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=600203

---
 hw/vhost_net.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/vhost_net.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index a2ff80b..7714176 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -51,6 +51,9 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
     if (!(net->dev.features & (1 << VIRTIO_RING_F_INDIRECT_DESC))) {
         features &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
     }
+    if (!(net->dev.features & (1 << VIRTIO_RING_F_PUBLISH_USED))) {
+        features &= ~(1 << VIRTIO_RING_F_PUBLISH_USED);
+    }
     features &= ~(1 << VIRTIO_NET_F_MRG_RXBUF);
 
     return features;
-- 
1.7.0.3

