qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Yuri Benditovich <yuri.benditovich@daynix.com>
Cc: Yan Vugenfirer <yan@daynix.com>, Jason Wang <jasowang@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v4 6/6] virtio-net: add migration support for RSS and hash report
Date: Tue, 17 Mar 2020 02:33:03 -0400	[thread overview]
Message-ID: <20200317023032-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAOEp5OfLAU1oyj=75K6CFPSH_YXz+mZsbSLRZ=LEMRcTvUdetA@mail.gmail.com>

On Tue, Mar 17, 2020 at 07:48:55AM +0200, Yuri Benditovich wrote:
> 
> 
> On Tue, Mar 17, 2020 at 1:05 AM Michael S. Tsirkin <mst@redhat.com> wrote:
> 
>     On Mon, Mar 16, 2020 at 12:09:33PM +0200, Yuri Benditovich wrote:
>     > Save and restore RSS/hash report configuration.
>     >
>     > Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
>     > ---
>     >  hw/net/virtio-net.c | 26 ++++++++++++++++++++++++++
>     >  1 file changed, 26 insertions(+)
>     >
>     > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>     > index a0614ad4e6..f343762a0f 100644
>     > --- a/hw/net/virtio-net.c
>     > +++ b/hw/net/virtio-net.c
>     > @@ -2842,6 +2842,13 @@ static int virtio_net_post_load_device(void
>     *opaque, int version_id)
>     >          }
>     >      }
>     > 
>     > +    if (n->rss_data.enabled) {
>     > +        trace_virtio_net_rss_enable(n->rss_data.hash_types,
>     > +                                    n->rss_data.indirections_len,
>     > +                                    sizeof(n->rss_data.key));
>     > +    } else {
>     > +        trace_virtio_net_rss_disable();
>     > +    }
>     >      return 0;
>     >  }
>     > 
>     > @@ -3019,6 +3026,24 @@ static const VMStateDescription
>     vmstate_virtio_net_has_vnet = {
>     >      },
>     >  };
>     > 
>     > +static const VMStateDescription vmstate_rss = {
>     > +    .name      = "vmstate_rss",
>     > +    .fields = (VMStateField[]) {
>     > +        VMSTATE_BOOL(enabled, VirtioNetRssData),
>     > +        VMSTATE_BOOL(redirect, VirtioNetRssData),
>     > +        VMSTATE_BOOL(populate_hash, VirtioNetRssData),
>     > +        VMSTATE_UINT32(hash_types, VirtioNetRssData),
>     > +        VMSTATE_UINT32(indirections_len, VirtioNetRssData),
> 
> 
>     Why is this UINT32? Shouldn't it be UINT16?
> 
> 
> It is UINT32 in the _internal_ structure to use VMSTATE_VARRAY_UINT32_ALLOC.
> Otherwise I need to invent additional macro for the same operation with UINT16
> length.
>  

It's not internal - it's exposed as part of the migration stream format.
Adding VMSTATE_VARRAY_UINT16_ALLOC is as easy as:

-->

vmstate: add VMSTATE_VARRAY_UINT16_ALLOC

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

--

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 30667631bc..b0b89c6fe5 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -432,6 +432,16 @@ extern const VMStateInfo vmstate_info_qlist;
     .offset     = vmstate_offset_pointer(_state, _field, _type),     \
 }
 
+#define VMSTATE_VARRAY_UINT16_ALLOC(_field, _state, _field_num, _version, _info, _type) {\
+    .name       = (stringify(_field)),                               \
+    .version_id = (_version),                                        \
+    .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
+    .info       = &(_info),                                          \
+    .size       = sizeof(_type),                                     \
+    .flags      = VMS_VARRAY_UINT16|VMS_POINTER|VMS_ALLOC,           \
+    .offset     = vmstate_offset_pointer(_state, _field, _type),     \
+}
+
 #define VMSTATE_VARRAY_UINT16_UNSAFE(_field, _state, _field_num, _version, _info, _type) {\
     .name       = (stringify(_field)),                               \
     .version_id = (_version),                                        \



  reply	other threads:[~2020-03-17  6:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16 10:09 [PATCH v4 0/6] reference implementation of RSS and hash report Yuri Benditovich
2020-03-16 10:09 ` [PATCH v4 1/6] virtio-net: introduce RSS and hash report features Yuri Benditovich
2020-03-16 10:09 ` [PATCH v4 2/6] virtio-net: implement RSS configuration command Yuri Benditovich
2020-03-16 10:09 ` [PATCH v4 3/6] virtio-net: implement RX RSS processing Yuri Benditovich
2020-03-16 10:09 ` [PATCH v4 4/6] tap: allow extended virtio header with hash info Yuri Benditovich
2020-03-16 10:09 ` [PATCH v4 5/6] virtio-net: reference implementation of hash report Yuri Benditovich
2020-03-16 10:09 ` [PATCH v4 6/6] virtio-net: add migration support for RSS and " Yuri Benditovich
2020-03-16 23:05   ` Michael S. Tsirkin
2020-03-17  5:48     ` Yuri Benditovich
2020-03-17  6:33       ` Michael S. Tsirkin [this message]
2020-03-17  8:09         ` Yuri Benditovich
2020-03-16 12:57 ` [PATCH v4 0/6] reference implementation of " no-reply
2020-03-17  8:57 ` 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=20200317023032-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yan@daynix.com \
    --cc=yuri.benditovich@daynix.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).