Re: [PATCH v3] virtio-net: Fix VLAN filter table reset timing
From: Lei Yang <hidden>
Date: 2025-08-07 01:21:38
Also in:
qemu-devel
Tested pass this patch with virtio-net regression tests, everything works well. Tested-by: Lei Yang <redacted> On Sat, Aug 2, 2025 at 5:43 PM Akihiko Odaki [off-list ref] wrote:
On 2025/08/02 16:26, Michael Tokarev wrote:quoted
On 27.07.2025 09:22, Akihiko Odaki wrote: ...quoted
@@ -3942,6 +3943,7 @@ static voidvirtio_net_device_realize(DeviceState *dev, Error **errp) n->mac_table.macs = g_malloc0(MAC_TABLE_ENTRIES * ETH_ALEN); n->vlans = g_malloc0(MAX_VLAN >> 3); + memset(n->vlans, 0xff, MAX_VLAN >> 3);A nitpick: we don't need to init this memory with 0 before initing it with 0xff. But looking at this, why can't we embed n->vlans directly into this structure, something like the attached patch?VMState also needs a change: VMSTATE_BUFFER_POINTER_UNSAFE() should be replaced with plain VMSTATE_BUFFER(). Actually this is the only user of VMSTATE_BUFFER_POINTER_UNSAFE(). I appreciate if you submit the patch with this VMState change and patch message.quoted
This, and maybe a few other fields like it?There is another candidate: n->mac_table.macs But it is not straightforward to embed this array because it uses VMSTATE_VBUFFER_MULTIPLY(). Regards, Akihiko Odaki