[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/19] virtio-net: enable tap offload if guest suppo
From: |
Mark McLoughlin |
Subject: |
[Qemu-devel] [PATCH 16/19] virtio-net: enable tap offload if guest supports it |
Date: |
Thu, 22 Oct 2009 17:43:47 +0100 |
We query the guest's feature set to see if it supports offload and,
if so, we enable those features on the tap interface.
Signed-off-by: Mark McLoughlin <address@hidden>
---
hw/virtio-net.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index bb085ae..3fb10a2 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -152,6 +152,11 @@ static uint32_t virtio_net_get_features(VirtIODevice *vdev)
features |= (1 << VIRTIO_NET_F_HOST_TSO4);
features |= (1 << VIRTIO_NET_F_HOST_TSO6);
features |= (1 << VIRTIO_NET_F_HOST_ECN);
+
+ features |= (1 << VIRTIO_NET_F_GUEST_CSUM);
+ features |= (1 << VIRTIO_NET_F_GUEST_TSO4);
+ features |= (1 << VIRTIO_NET_F_GUEST_TSO6);
+ features |= (1 << VIRTIO_NET_F_GUEST_ECN);
}
return features;
@@ -177,6 +182,14 @@ static void virtio_net_set_features(VirtIODevice *vdev,
uint32_t features)
VirtIONet *n = to_virtio_net(vdev);
n->mergeable_rx_bufs = !!(features & (1 << VIRTIO_NET_F_MRG_RXBUF));
+
+ if (n->has_vnet_hdr) {
+ tap_set_offload(n->vc->peer,
+ (features >> VIRTIO_NET_F_GUEST_CSUM) & 1,
+ (features >> VIRTIO_NET_F_GUEST_TSO4) & 1,
+ (features >> VIRTIO_NET_F_GUEST_TSO6) & 1,
+ (features >> VIRTIO_NET_F_GUEST_ECN) & 1);
+ }
}
static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
@@ -702,6 +715,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int
version_id)
if (n->has_vnet_hdr) {
tap_using_vnet_hdr(n->vc->peer, 1);
+ tap_set_offload(n->vc->peer,
+ (n->vdev.features >> VIRTIO_NET_F_GUEST_CSUM) & 1,
+ (n->vdev.features >> VIRTIO_NET_F_GUEST_TSO4) & 1,
+ (n->vdev.features >> VIRTIO_NET_F_GUEST_TSO6) & 1,
+ (n->vdev.features >> VIRTIO_NET_F_GUEST_ECN) & 1);
}
}
--
1.6.2.5
- [Qemu-devel] [PATCH 02/19] net: import linux tap ioctl definitions, (continued)
- [Qemu-devel] [PATCH 02/19] net: import linux tap ioctl definitions, Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 03/19] net: make tap_receive() re-use tap_receive_iov() code, Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 08/19] net: add tap_has_vnet_hdr() and tap_using_vnet_hdr() APIs, Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 10/19] net: add an API for 'raw' packets, Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 05/19] net: refactor tap initialization, Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 14/19] virtio-net: add vnet_hdr support, Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 18/19] Enable UFO on virtio-net and tap devices, Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 09/19] net: add flags parameter to packet queue interface, Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 19/19] virtio-net: add tap_has_ufo flag to saved state, Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 17/19] Work around dhclient brokenness, Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 16/19] virtio-net: enable tap offload if guest supports it,
Mark McLoughlin <=
- [Qemu-devel] [PATCH 06/19] net: add a vnet_hdr=on|off parameter, Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 15/19] net: add tap_set_offload(), Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 12/19] net: use qemu_send_packet_raw() in qemu_announce_self(), Mark McLoughlin, 2009/10/22
- [Qemu-devel] [PATCH 11/19] net: add receive_raw parameter to qemu_new_vlan_client(), Mark McLoughlin, 2009/10/22
- Handling merge conflicts [was Re: [Qemu-devel] [PATCH 00/19 v2] Add virtio-net/tap support for partial csums and GSO], Mark McLoughlin, 2009/10/28