Skip to contentSkip to conversation

vhost-user: fix VIRTIO_NET_F_MRG_RXBUF negotiation

PATCH New [email protected] 1 participant 1 message Sep 11, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost-user: fix VIRTIO_NET_F_MRG_RXBUF negotiation

From: Damjan Marion <[email protected]>

Header length check should happen only if backend is kernel. For user backend there is no reason to reset this bit.

vhost-user code does not define .has_vnet_hdr_len so VIRTIO_NET_F_MRG_RXBUF cannot be negotiated even if both sides support it.

---
 hw/net/vhost_net.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/net/vhost_net.c +4 -4
index f87c798..9d1172a 100644
@@ -162,11 +162,11 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
     if (r < 0) {
         goto fail;
     }
-    if (!qemu_has_vnet_hdr_len(options->net_backend,
-                               sizeof(struct virtio_net_hdr_mrg_rxbuf))) {
-        net->dev.features &= ~(1 << VIRTIO_NET_F_MRG_RXBUF);
-    }
     if (backend_kernel) {
+        if (!qemu_has_vnet_hdr_len(options->net_backend,
+                               sizeof(struct virtio_net_hdr_mrg_rxbuf))) {
+            net->dev.features &= ~(1 << VIRTIO_NET_F_MRG_RXBUF);
+        }
         if (~net->dev.features & net->dev.backend_features) {
             fprintf(stderr, "vhost lacks feature mask %" PRIu64
                    " for backend\n",
Signature · 1 line
1.9.1