On 12/20/2016 12:32 PM, Wei Wang wrote:
Hi Marc-André, thanks for the comments.
On 12/20/2016 12:43 AM, Marc-André Lureau wrote:
Another question, what are vpnet->rqs used for?
This should be redundant, I will remove it.
I think I should explain more about this: the rqs field is redundant in
the vpnet structure. But the rq is needed for the datapath.
The vhost-pci driver works like this (taking the single queue case as an
example):
It has three queues, mirrored tq, mirrored rq (shared from virtio-net,
buffers inside them are memory from the master guest) and the rq
(buffers inside it are memory allocated by the slave guest itself). The
packets grabbed from the mirrored rq, are copied to the buf got from the
slave's own rq, and then delivered to the slave network stack. We need
the rq because:
1) the buffers from the mirrored rq are from the master guest, so the
slave network stack, by default, will free the skb buf that was not
allocated;
2) the buffer fetched from the mirrored rq "avail" needs be returned to
"used", it causes a problem if the buffer has been freed by the master
and re-assigned to other code to use while it hasn't been handled by
slave side network stack?
3) Interrupt support: we will need the rq interrupt, so that virtio-net
can notify vhost-pci-net to grab packets.
Best,
Wei