From cf528b89580797050b8cf60fee6247f35531a675 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Thu, 6 Feb 2014 17:02:18 +0100 Subject: net: virtio-net and vmxnet3 use offloading API With this patch, virtio-net and vmxnet3 frontends make use of the qemu_peer_* API for backend offloadings manipulations, instead of calling TAP-specific functions directly. We also remove the existing checks which prevent those frontends from using offloadings with backends different from TAP (e.g. netmap). Signed-off-by: Vincenzo Maffione Signed-off-by: Stefan Hajnoczi --- hw/net/vhost_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw/net/vhost_net.c') diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 854997d9ba..c90b9ec9ab 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -106,7 +106,7 @@ struct vhost_net *vhost_net_init(NetClientState *backend, int devfd, goto fail; } net->nc = backend; - net->dev.backend_features = tap_has_vnet_hdr(backend) ? 0 : + net->dev.backend_features = backend->info->has_vnet_hdr(backend) ? 0 : (1 << VHOST_NET_F_VIRTIO_NET_HDR); net->backend = r; @@ -117,7 +117,7 @@ struct vhost_net *vhost_net_init(NetClientState *backend, int devfd, if (r < 0) { goto fail; } - if (!tap_has_vnet_hdr_len(backend, + if (!backend->info->has_vnet_hdr_len(backend, sizeof(struct virtio_net_hdr_mrg_rxbuf))) { net->dev.features &= ~(1 << VIRTIO_NET_F_MRG_RXBUF); } -- cgit 1.4.1 From e3e48565c1553f9ab4c34c2388287a013ef30deb Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Thu, 20 Feb 2014 12:14:08 +0100 Subject: vhost_net: use offload API instead of bypassing it There is no need to access backend->info->has_vnet_hdr() and friends anymore. Use the qemu_has_vnet_hdr() API instead. Signed-off-by: Stefan Hajnoczi --- hw/net/vhost_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hw/net/vhost_net.c') diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index c90b9ec9ab..a1de2f43a0 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -106,7 +106,7 @@ struct vhost_net *vhost_net_init(NetClientState *backend, int devfd, goto fail; } net->nc = backend; - net->dev.backend_features = backend->info->has_vnet_hdr(backend) ? 0 : + net->dev.backend_features = qemu_has_vnet_hdr(backend) ? 0 : (1 << VHOST_NET_F_VIRTIO_NET_HDR); net->backend = r; @@ -117,8 +117,8 @@ struct vhost_net *vhost_net_init(NetClientState *backend, int devfd, if (r < 0) { goto fail; } - if (!backend->info->has_vnet_hdr_len(backend, - sizeof(struct virtio_net_hdr_mrg_rxbuf))) { + if (!qemu_has_vnet_hdr_len(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) { -- cgit 1.4.1