OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: May a device use buffers after putting them into the used ring?


Hey all,

I am using qemu-system-arm with "-device virtio-net-device" to emulate a nic (mmio, legacy). I have noticed that a receive queue uses the same buffer multiple times, although it has been added to the used ring (and not been added to the available ring again). Is it allowed to do that?

This is the first buffer (index 0) in the descriptor table:
(gdb) x/16x 0x46008000
0x46008000:ÂÂÂÂ 0x00000000ÂÂÂÂÂ 0x00000000ÂÂÂÂÂ 0xffff0000 0xffffffff
0x46008010:ÂÂÂÂ 0x000a5552ÂÂÂÂÂ 0x06080202ÂÂÂÂÂ 0x00080100 0x01000406
0x46008020:ÂÂÂÂ 0x000a5552ÂÂÂÂÂ 0x000a0202ÂÂÂÂÂ 0x00000202 0x00000000
0x46008030:ÂÂÂÂ 0x0f02000aÂÂÂÂÂ 0x00000000ÂÂÂÂÂ 0x00000000 0x00000000
As you can see it contains a legacy virtio_net_hdr and an ethernet frame with an arp packet.

After receiving two such arp packets the used ring looks like this:
(gdb) x/8x 0x46005000
0x46005000:ÂÂÂÂ 0x00020001ÂÂÂÂÂ 0x00000000ÂÂÂÂÂ 0x00000034 0x00000000
0x46005010:ÂÂÂÂ 0x00000034ÂÂÂÂÂ 0x00000000ÂÂÂÂÂ 0x00000000 0x00000000

The used index is 2, and both entries use the first buffer in the descriptor table (0). The virtio 1.1 spec says in section 2.6.8 ("The Virtqueue Used Ring"): "The used ring is where the device returns buffers once it is done with them". I'd expect that any buffer that appears in the used ring will not be touched by the device (unless the driver puts it into an available ring again).

Is my interpretation of the phrasing wrong, or is the device misbehaving?

Kind regards,
Benni



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]