From: Jason Wang <jasowang@redhat.com> To: mst@redhat.com, aliguori@us.ibm.com, stefanha@redhat.com, qemu-devel@nongnu.org Cc: rusty@rustcorp.com.au, kvm@vger.kernel.org, mprivozn@redhat.com, shiyer@redhat.com, krkumar2@in.ibm.com, jwhan@filewood.snu.ac.kr, Jason Wang <jasowang@redhat.com> Subject: [PATCH 11/12] virtio-net: migration support for multiqueue Date: Fri, 28 Dec 2012 18:32:03 +0800 [thread overview] Message-ID: <1356690724-37891-12-git-send-email-jasowang@redhat.com> (raw) In-Reply-To: <1356690724-37891-1-git-send-email-jasowang@redhat.com> This patch add migration support for multiqueue virtio-net. The version were bumped to 12. Signed-off-by: Jason Wang <jasowang@redhat.com> --- hw/virtio-net.c | 45 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 35 insertions(+), 10 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index aaeef1b..ca4b804 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -21,7 +21,7 @@ #include "virtio-net.h" #include "vhost_net.h" -#define VIRTIO_NET_VM_VERSION 11 +#define VIRTIO_NET_VM_VERSION 12 #define MAC_TABLE_ENTRIES 64 #define MAX_VLAN (1 << 12) /* Per 802.1Q definition */ @@ -1058,16 +1058,18 @@ static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue, int ctrl) static void virtio_net_save(QEMUFile *f, void *opaque) { + int i; VirtIONet *n = opaque; - VirtIONetQueue *q = &n->vqs[0]; - /* At this point, backend must be stopped, otherwise - * it might keep writing to memory. */ - assert(!q->vhost_started); + for (i = 0; i < n->max_queues; i++) { + /* At this point, backend must be stopped, otherwise + * it might keep writing to memory. */ + assert(!n->vqs[i].vhost_started); + } virtio_save(&n->vdev, f); qemu_put_buffer(f, n->mac, ETH_ALEN); - qemu_put_be32(f, q->tx_waiting); + qemu_put_be32(f, n->vqs[0].tx_waiting); qemu_put_be32(f, n->mergeable_rx_bufs); qemu_put_be16(f, n->status); qemu_put_byte(f, n->promisc); @@ -1083,13 +1085,17 @@ static void virtio_net_save(QEMUFile *f, void *opaque) qemu_put_byte(f, n->nouni); qemu_put_byte(f, n->nobcast); qemu_put_byte(f, n->has_ufo); + qemu_put_be16(f, n->max_queues); + qemu_put_be16(f, n->curr_queues); + for (i = 1; i < n->curr_queues; i++) { + qemu_put_be32(f, n->vqs[i].tx_waiting); + } } static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) { VirtIONet *n = opaque; - VirtIONetQueue *q = &n->vqs[0]; - int ret, i; + int ret, i, link_down; if (version_id < 2 || version_id > VIRTIO_NET_VM_VERSION) return -EINVAL; @@ -1100,7 +1106,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) } qemu_get_buffer(f, n->mac, ETH_ALEN); - q->tx_waiting = qemu_get_be32(f); + n->vqs[0].tx_waiting = qemu_get_be32(f); virtio_net_set_mrg_rx_bufs(n, qemu_get_be32(f)); @@ -1170,6 +1176,22 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) } } + if (version_id >= 12) { + if (n->max_queues != qemu_get_be16(f)) { + error_report("virtio-net: different max_queues "); + return -1; + } + + n->curr_queues = qemu_get_be16(f); + for (i = 1; i < n->curr_queues; i++) { + n->vqs[i].tx_waiting = qemu_get_be32(f); + } + } + + virtio_net_set_queues(n); + /* Must do this again, since we may have more than one active queues. */ + virtio_net_set_status(&n->vdev, n->status); + /* Find the first multicast entry in the saved MAC filter */ for (i = 0; i < n->mac_table.in_use; i++) { if (n->mac_table.macs[i * ETH_ALEN] & 1) { @@ -1180,7 +1202,10 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) /* nc.link_down can't be migrated, so infer link_down according * to link status bit in n->status */ - qemu_get_queue(n->nic)->link_down = (n->status & VIRTIO_NET_S_LINK_UP) == 0; + link_down = (n->status & VIRTIO_NET_S_LINK_UP) == 0; + for (i = 0; i < n->max_queues; i++) { + qemu_get_subqueue(n->nic, i)->link_down = link_down; + } return 0; } -- 1.7.1
WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com> To: mst@redhat.com, aliguori@us.ibm.com, stefanha@redhat.com, qemu-devel@nongnu.org Cc: krkumar2@in.ibm.com, kvm@vger.kernel.org, mprivozn@redhat.com, Jason Wang <jasowang@redhat.com>, rusty@rustcorp.com.au, jwhan@filewood.snu.ac.kr, shiyer@redhat.com Subject: [Qemu-devel] [PATCH 11/12] virtio-net: migration support for multiqueue Date: Fri, 28 Dec 2012 18:32:03 +0800 [thread overview] Message-ID: <1356690724-37891-12-git-send-email-jasowang@redhat.com> (raw) In-Reply-To: <1356690724-37891-1-git-send-email-jasowang@redhat.com> This patch add migration support for multiqueue virtio-net. The version were bumped to 12. Signed-off-by: Jason Wang <jasowang@redhat.com> --- hw/virtio-net.c | 45 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 35 insertions(+), 10 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index aaeef1b..ca4b804 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -21,7 +21,7 @@ #include "virtio-net.h" #include "vhost_net.h" -#define VIRTIO_NET_VM_VERSION 11 +#define VIRTIO_NET_VM_VERSION 12 #define MAC_TABLE_ENTRIES 64 #define MAX_VLAN (1 << 12) /* Per 802.1Q definition */ @@ -1058,16 +1058,18 @@ static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue, int ctrl) static void virtio_net_save(QEMUFile *f, void *opaque) { + int i; VirtIONet *n = opaque; - VirtIONetQueue *q = &n->vqs[0]; - /* At this point, backend must be stopped, otherwise - * it might keep writing to memory. */ - assert(!q->vhost_started); + for (i = 0; i < n->max_queues; i++) { + /* At this point, backend must be stopped, otherwise + * it might keep writing to memory. */ + assert(!n->vqs[i].vhost_started); + } virtio_save(&n->vdev, f); qemu_put_buffer(f, n->mac, ETH_ALEN); - qemu_put_be32(f, q->tx_waiting); + qemu_put_be32(f, n->vqs[0].tx_waiting); qemu_put_be32(f, n->mergeable_rx_bufs); qemu_put_be16(f, n->status); qemu_put_byte(f, n->promisc); @@ -1083,13 +1085,17 @@ static void virtio_net_save(QEMUFile *f, void *opaque) qemu_put_byte(f, n->nouni); qemu_put_byte(f, n->nobcast); qemu_put_byte(f, n->has_ufo); + qemu_put_be16(f, n->max_queues); + qemu_put_be16(f, n->curr_queues); + for (i = 1; i < n->curr_queues; i++) { + qemu_put_be32(f, n->vqs[i].tx_waiting); + } } static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) { VirtIONet *n = opaque; - VirtIONetQueue *q = &n->vqs[0]; - int ret, i; + int ret, i, link_down; if (version_id < 2 || version_id > VIRTIO_NET_VM_VERSION) return -EINVAL; @@ -1100,7 +1106,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) } qemu_get_buffer(f, n->mac, ETH_ALEN); - q->tx_waiting = qemu_get_be32(f); + n->vqs[0].tx_waiting = qemu_get_be32(f); virtio_net_set_mrg_rx_bufs(n, qemu_get_be32(f)); @@ -1170,6 +1176,22 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) } } + if (version_id >= 12) { + if (n->max_queues != qemu_get_be16(f)) { + error_report("virtio-net: different max_queues "); + return -1; + } + + n->curr_queues = qemu_get_be16(f); + for (i = 1; i < n->curr_queues; i++) { + n->vqs[i].tx_waiting = qemu_get_be32(f); + } + } + + virtio_net_set_queues(n); + /* Must do this again, since we may have more than one active queues. */ + virtio_net_set_status(&n->vdev, n->status); + /* Find the first multicast entry in the saved MAC filter */ for (i = 0; i < n->mac_table.in_use; i++) { if (n->mac_table.macs[i * ETH_ALEN] & 1) { @@ -1180,7 +1202,10 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) /* nc.link_down can't be migrated, so infer link_down according * to link status bit in n->status */ - qemu_get_queue(n->nic)->link_down = (n->status & VIRTIO_NET_S_LINK_UP) == 0; + link_down = (n->status & VIRTIO_NET_S_LINK_UP) == 0; + for (i = 0; i < n->max_queues; i++) { + qemu_get_subqueue(n->nic, i)->link_down = link_down; + } return 0; } -- 1.7.1
next prev parent reply other threads:[~2012-12-28 10:41 UTC|newest] Thread overview: 108+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-12-28 10:31 [PATCH 00/12] Multiqueue virtio-net Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 01/12] tap: multiqueue support Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2013-01-09 9:56 ` Stefan Hajnoczi 2013-01-09 9:56 ` [Qemu-devel] " Stefan Hajnoczi 2013-01-09 15:25 ` Jason Wang 2013-01-09 15:25 ` [Qemu-devel] " Jason Wang 2013-01-10 8:32 ` Stefan Hajnoczi 2013-01-10 8:32 ` [Qemu-devel] " Stefan Hajnoczi 2013-01-10 10:28 ` Stefan Hajnoczi 2013-01-10 10:28 ` [Qemu-devel] " Stefan Hajnoczi 2013-01-10 13:52 ` Jason Wang 2013-01-10 13:52 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 02/12] net: introduce qemu_get_queue() Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 03/12] net: introduce qemu_get_nic() Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 04/12] net: intorduce qemu_del_nic() Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 05/12] net: multiqueue support Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 18:06 ` Blue Swirl 2012-12-28 18:06 ` [Qemu-devel] " Blue Swirl 2012-12-28 10:31 ` [PATCH 06/12] vhost: " Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 07/12] virtio: introduce virtio_queue_del() Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2013-01-08 7:14 ` Michael S. Tsirkin 2013-01-08 7:14 ` [Qemu-devel] " Michael S. Tsirkin 2013-01-08 9:28 ` Jason Wang 2013-01-08 9:28 ` [Qemu-devel] " Jason Wang 2012-12-28 10:32 ` [PATCH 08/12] virtio: add a queue_index to VirtQueue Jason Wang 2012-12-28 10:32 ` [Qemu-devel] " Jason Wang 2012-12-28 10:32 ` [PATCH 09/12] virtio-net: separate virtqueue from VirtIONet Jason Wang 2012-12-28 10:32 ` [Qemu-devel] " Jason Wang 2012-12-28 10:32 ` [PATCH 10/12] virtio-net: multiqueue support Jason Wang 2012-12-28 10:32 ` [Qemu-devel] " Jason Wang 2012-12-28 17:52 ` Blue Swirl 2012-12-28 17:52 ` [Qemu-devel] " Blue Swirl 2013-01-04 5:12 ` Jason Wang 2013-01-04 5:12 ` [Qemu-devel] " Jason Wang 2013-01-04 20:41 ` Blue Swirl 2013-01-04 20:41 ` [Qemu-devel] " Blue Swirl 2013-01-08 9:07 ` Wanlong Gao 2013-01-08 9:07 ` Wanlong Gao 2013-01-08 9:29 ` Jason Wang 2013-01-08 9:29 ` [Qemu-devel] " Jason Wang 2013-01-08 9:32 ` Wanlong Gao 2013-01-08 9:32 ` Wanlong Gao 2013-01-08 9:49 ` Wanlong Gao 2013-01-08 9:49 ` Wanlong Gao 2013-01-08 9:51 ` Jason Wang 2013-01-08 9:51 ` [Qemu-devel] " Jason Wang 2013-01-08 10:00 ` Wanlong Gao 2013-01-08 10:14 ` Jason Wang 2013-01-08 10:14 ` [Qemu-devel] " Jason Wang 2013-01-08 11:24 ` Wanlong Gao 2013-01-09 3:11 ` Jason Wang 2013-01-09 8:23 ` Wanlong Gao 2013-01-09 9:30 ` Jason Wang 2013-01-09 9:30 ` [Qemu-devel] " Jason Wang 2013-01-09 10:01 ` Wanlong Gao 2013-01-09 10:01 ` Wanlong Gao 2013-01-09 15:26 ` Jason Wang 2013-01-10 6:43 ` Jason Wang 2013-01-10 6:49 ` Wanlong Gao 2013-01-10 6:49 ` Wanlong Gao 2013-01-10 7:16 ` Jason Wang 2013-01-10 7:16 ` [Qemu-devel] " Jason Wang 2013-01-10 9:06 ` Wanlong Gao 2013-01-10 9:06 ` [Qemu-devel] " Wanlong Gao 2013-01-10 9:40 ` Jason Wang 2012-12-28 10:32 ` Jason Wang [this message] 2012-12-28 10:32 ` [Qemu-devel] [PATCH 11/12] virtio-net: migration support for multiqueue Jason Wang 2013-01-08 7:10 ` Michael S. Tsirkin 2013-01-08 7:10 ` [Qemu-devel] " Michael S. Tsirkin 2013-01-08 9:27 ` Jason Wang 2013-01-08 9:27 ` [Qemu-devel] " Jason Wang 2012-12-28 10:32 ` [PATCH 12/12] virtio-net: compat multiqueue support Jason Wang 2012-12-28 10:32 ` [Qemu-devel] " Jason Wang 2013-01-09 14:29 ` [Qemu-devel] [PATCH 00/12] Multiqueue virtio-net Stefan Hajnoczi 2013-01-09 14:29 ` Stefan Hajnoczi 2013-01-09 15:32 ` Michael S. Tsirkin 2013-01-09 15:32 ` Michael S. Tsirkin 2013-01-09 15:33 ` Jason Wang 2013-01-09 15:33 ` [Qemu-devel] " Jason Wang 2013-01-10 8:44 ` Stefan Hajnoczi 2013-01-10 8:44 ` [Qemu-devel] " Stefan Hajnoczi 2013-01-10 9:34 ` Jason Wang 2013-01-10 9:34 ` Jason Wang 2013-01-10 11:49 ` Stefan Hajnoczi 2013-01-10 11:49 ` Stefan Hajnoczi 2013-01-10 14:15 ` Jason Wang 2013-01-10 14:15 ` [Qemu-devel] " Jason Wang 2013-01-14 19:44 ` Anthony Liguori 2013-01-14 19:44 ` [Qemu-devel] " Anthony Liguori 2013-01-15 10:12 ` Jason Wang 2013-01-15 10:12 ` [Qemu-devel] " Jason Wang 2013-01-16 15:09 ` Anthony Liguori 2013-01-16 15:09 ` [Qemu-devel] " Anthony Liguori 2013-01-16 15:19 ` Michael S. Tsirkin 2013-01-16 15:19 ` [Qemu-devel] " Michael S. Tsirkin 2013-01-16 16:14 ` Anthony Liguori 2013-01-16 16:14 ` [Qemu-devel] " Anthony Liguori 2013-01-16 16:48 ` Michael S. Tsirkin 2013-01-16 16:48 ` [Qemu-devel] " Michael S. Tsirkin 2013-01-17 10:31 ` Michael S. Tsirkin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1356690724-37891-12-git-send-email-jasowang@redhat.com \ --to=jasowang@redhat.com \ --cc=aliguori@us.ibm.com \ --cc=jwhan@filewood.snu.ac.kr \ --cc=krkumar2@in.ibm.com \ --cc=kvm@vger.kernel.org \ --cc=mprivozn@redhat.com \ --cc=mst@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=rusty@rustcorp.com.au \ --cc=shiyer@redhat.com \ --cc=stefanha@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.