On Fri, Sep 05, 2025 at 04:50:35PM +0300, Vladimir Sementsov-Ogievskiy wrote: > +static const VMStateDescription vmstate_tap = { > + .name = "virtio-net-device", > + .post_load = tap_post_load, > + .fields = (const VMStateField[]) { > + VMSTATE_FD(fd, TAPState), > + VMSTATE_BOOL(using_vnet_hdr, TAPState), > + VMSTATE_BOOL(has_ufo, TAPState), > + VMSTATE_BOOL(has_uso, TAPState), > + VMSTATE_BOOL(enabled, TAPState), > + VMSTATE_UINT32(host_vnet_hdr_len, TAPState), > + VMSTATE_END_OF_LIST() > + } > +}; > + > +int tap_save(NetClientState *nc, QEMUFile *f) > +{ > + TAPState *s = DO_UPCAST(TAPState, nc, nc); > + > + return vmstate_save_state(f, &vmstate_tap, s, 0); > +} > + > +int tap_load(NetClientState *nc, QEMUFile *f) > +{ > + TAPState *s = DO_UPCAST(TAPState, nc, nc); > + > + return vmstate_load_state(f, &vmstate_tap, s, 0); > +}
Instead of hard-coding vmstate_save_state() / vmstate_load_state(), could we make tap's VMSD to be a subsection of virtio-net's? Multifd already doesn't support qemufile, but only iochannels (which is the internal impl of qemufiles). We might at some point start to concurrently load devices with multifd, then anything with qemufile will be a no-go and need to be serialized as legacy code in the main channel, or rewritten. IMHO it'll be great if we can avoid adding new codes operating on qemufiles, and also avoid adding any new custom VMSD fields' put()/get() if ever possible. Thanks, -- Peter Xu