|
From: | Avi Kivity |
Subject: | Re: [Qemu-devel] [PATCH 0/13] Add generic packet buffering API |
Date: | Tue, 19 May 2009 14:56:57 +0300 |
User-agent: | Thunderbird 2.0.0.21 (X11/20090320) |
Mark McLoughlin wrote:
It will need adjustments to the device models; for example we'll need virtqueue_pop_commit() after we're certain the tap had enough room for our packet and virtqueue_pop_cancel() (to unmap the buffers) if we don't.Yep, it's possible with virtio. However, you can't unpop the buffer from a tap file descriptor or socket. The alternative in those cases is to implement buffering for each, or to always check the receiving side has buffers available before popping. I choose this option because checking in advance for each packet seems expensive - i.e. a syscall for tap/socket or a trawl through the ring for virtio.
For virtio (or the other emulated devices) the check is pretty cheap; furthermore you only need to do it when something changes (notification or a pop).
So, with the disadvantage of an asymmetrical API, we have: transmit(): conditional pop tap->receive() commit pop / cancel pop receive(): tap->send() if (no more room) tap->stop() receive_notify(): if (more room) tap->start() -- error compiling committee.c: too many arguments to function
[Prev in Thread] | Current Thread | [Next in Thread] |