Message ID | 20200320115751.19446-8-yuri.benditovich@daynix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | reference implementation of RSS and hash report | expand |
ping On Fri, Mar 20, 2020 at 1:58 PM Yuri Benditovich < yuri.benditovich@daynix.com> wrote: > Save and restore RSS/hash report configuration. > > Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> > --- > hw/net/virtio-net.c | 37 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 37 insertions(+) > > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index a0614ad4e6..7de7587abd 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,32 @@ static const VMStateDescription > vmstate_virtio_net_has_vnet = { > }, > }; > > +static bool virtio_net_rss_needed(void *opaque) > +{ > + return VIRTIO_NET(opaque)->rss_data.enabled; > +} > + > +static const VMStateDescription vmstate_virtio_net_rss = { > + .name = "virtio-net-device/rss", > + .version_id = 1, > + .minimum_version_id = 1, > + .needed = virtio_net_rss_needed, > + .fields = (VMStateField[]) { > + VMSTATE_BOOL(rss_data.enabled, VirtIONet), > + VMSTATE_BOOL(rss_data.redirect, VirtIONet), > + VMSTATE_BOOL(rss_data.populate_hash, VirtIONet), > + VMSTATE_UINT32(rss_data.hash_types, VirtIONet), > + VMSTATE_UINT16(rss_data.indirections_len, VirtIONet), > + VMSTATE_UINT16(rss_data.default_queue, VirtIONet), > + VMSTATE_UINT8_ARRAY(rss_data.key, VirtIONet, > + VIRTIO_NET_RSS_MAX_KEY_SIZE), > + VMSTATE_VARRAY_UINT16_ALLOC(rss_data.indirections_table, > VirtIONet, > + rss_data.indirections_len, 0, > + vmstate_info_uint16, uint16_t), > + VMSTATE_END_OF_LIST() > + }, > +}; > + > static const VMStateDescription vmstate_virtio_net_device = { > .name = "virtio-net-device", > .version_id = VIRTIO_NET_VM_VERSION, > @@ -3069,6 +3102,10 @@ static const VMStateDescription > vmstate_virtio_net_device = { > has_ctrl_guest_offloads), > VMSTATE_END_OF_LIST() > }, > + .subsections = (const VMStateDescription * []) { > + &vmstate_virtio_net_rss, > + NULL > + } > }; > > static NetClientInfo net_virtio_info = { > -- > 2.17.1 > >
Yuri Benditovich <yuri.benditovich@daynix.com> wrote: > Save and restore RSS/hash report configuration. > > Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> Reviewed-by: Juan Quintela <quintela@redhat.com> sorry, hadn't seen it. vmstate parts are right.
Code looks OK but patchew testing shows failures. If they are false positives pls reply to that mail. On Thu, Mar 26, 2020 at 02:34:39PM +0200, Yuri Benditovich wrote: > ping > > On Fri, Mar 20, 2020 at 1:58 PM Yuri Benditovich <yuri.benditovich@daynix.com> > wrote: > > Save and restore RSS/hash report configuration. > > Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> > --- > hw/net/virtio-net.c | 37 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 37 insertions(+) > > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index a0614ad4e6..7de7587abd 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,32 @@ static const VMStateDescription > vmstate_virtio_net_has_vnet = { > }, > }; > > +static bool virtio_net_rss_needed(void *opaque) > +{ > + return VIRTIO_NET(opaque)->rss_data.enabled; > +} > + > +static const VMStateDescription vmstate_virtio_net_rss = { > + .name = "virtio-net-device/rss", > + .version_id = 1, > + .minimum_version_id = 1, > + .needed = virtio_net_rss_needed, > + .fields = (VMStateField[]) { > + VMSTATE_BOOL(rss_data.enabled, VirtIONet), > + VMSTATE_BOOL(rss_data.redirect, VirtIONet), > + VMSTATE_BOOL(rss_data.populate_hash, VirtIONet), > + VMSTATE_UINT32(rss_data.hash_types, VirtIONet), > + VMSTATE_UINT16(rss_data.indirections_len, VirtIONet), > + VMSTATE_UINT16(rss_data.default_queue, VirtIONet), > + VMSTATE_UINT8_ARRAY(rss_data.key, VirtIONet, > + VIRTIO_NET_RSS_MAX_KEY_SIZE), > + VMSTATE_VARRAY_UINT16_ALLOC(rss_data.indirections_table, > VirtIONet, > + rss_data.indirections_len, 0, > + vmstate_info_uint16, uint16_t), > + VMSTATE_END_OF_LIST() > + }, > +}; > + > static const VMStateDescription vmstate_virtio_net_device = { > .name = "virtio-net-device", > .version_id = VIRTIO_NET_VM_VERSION, > @@ -3069,6 +3102,10 @@ static const VMStateDescription > vmstate_virtio_net_device = { > has_ctrl_guest_offloads), > VMSTATE_END_OF_LIST() > }, > + .subsections = (const VMStateDescription * []) { > + &vmstate_virtio_net_rss, > + NULL > + } > }; > > static NetClientInfo net_virtio_info = { > -- > 2.17.1 > >
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index a0614ad4e6..7de7587abd 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,32 @@ static const VMStateDescription vmstate_virtio_net_has_vnet = { }, }; +static bool virtio_net_rss_needed(void *opaque) +{ + return VIRTIO_NET(opaque)->rss_data.enabled; +} + +static const VMStateDescription vmstate_virtio_net_rss = { + .name = "virtio-net-device/rss", + .version_id = 1, + .minimum_version_id = 1, + .needed = virtio_net_rss_needed, + .fields = (VMStateField[]) { + VMSTATE_BOOL(rss_data.enabled, VirtIONet), + VMSTATE_BOOL(rss_data.redirect, VirtIONet), + VMSTATE_BOOL(rss_data.populate_hash, VirtIONet), + VMSTATE_UINT32(rss_data.hash_types, VirtIONet), + VMSTATE_UINT16(rss_data.indirections_len, VirtIONet), + VMSTATE_UINT16(rss_data.default_queue, VirtIONet), + VMSTATE_UINT8_ARRAY(rss_data.key, VirtIONet, + VIRTIO_NET_RSS_MAX_KEY_SIZE), + VMSTATE_VARRAY_UINT16_ALLOC(rss_data.indirections_table, VirtIONet, + rss_data.indirections_len, 0, + vmstate_info_uint16, uint16_t), + VMSTATE_END_OF_LIST() + }, +}; + static const VMStateDescription vmstate_virtio_net_device = { .name = "virtio-net-device", .version_id = VIRTIO_NET_VM_VERSION, @@ -3069,6 +3102,10 @@ static const VMStateDescription vmstate_virtio_net_device = { has_ctrl_guest_offloads), VMSTATE_END_OF_LIST() }, + .subsections = (const VMStateDescription * []) { + &vmstate_virtio_net_rss, + NULL + } }; static NetClientInfo net_virtio_info = {
Save and restore RSS/hash report configuration. Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> --- hw/net/virtio-net.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)