We need the vhost-user protocol crate to be more generic to allow
communication with a configurable amount of virtqueues.
This is a workaround for the virtio-fs backend. According to the
vhost-user specification, the master should issue get_queue_num()
to get the maximum number of queues supported by the slave. With
current virtio-fs implementations, it needs multiple virtques, but
it doesn't support the get_queue_num() request and not set the MQ
feature bit too. So this is a workaround to hard-code the max_queue_num
on the master side.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Not all slave requests are implemented, only the subset of messages
used by virtio-fs.
The SlaveReqHandler struct creates the slave-master socketpair, and
handles all incoming / outgoing message validation and handler
routing. SlaveReqHandler::new accepts a struct that implements
VhostUserSlaveReqHandler, overriding the default handlers for
relevant slave requests. SlaveReqHandler::new also returns a
UnixStream that must be sent to the slave via
Master::set_slave_request_fd.
As both Master and Slave requests share the same wire-format,
it could be easy to mix up the two when handling requests,
so this commit introduces PhantomData markers to Endpoints
and VhostUserMsgHeader that specify if they operate on
MasterReqs or SlaveReqs.
Lastly, some library internals, notably the Listener and Endpoint
structs, have been marked as pub(crate). This necessitates a small
refactor of how Slaves are constructed, introducing a SlaveListener
struct which returns a valid Slave when the socket accepts a
connection.
Signed-off-by: Daniel Prilik <danielprilik@gmail.com>
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Daniel Prilik <daniel@prilik.com>
Implement unix domain socket based communication channel for vhost-user,
which could pass file decriptors between processes.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Daniel Prilik <daniel@prilik.com>
Only basic messages are defined, and the vhost-user spec is also under
development. So feel free to add needed messages.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Signed-off-by: Daniel Prilik <daniel@prilik.com>
Implement vhost_kern::Vsock to control the in-kernel vhost-vsock driver.
The implementation is derived from the crosvm project.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
The auto-generated vhost binding is small, it would be better
to include it into the vhost crate instead of building another
dedicated crate for it.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
These interfaces are derived from the firecracker and crosvm projects.
They may be extended when enable support of vhost-user protocol.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
The PullAssigner bot [1] will pick 2 github handles from the gate
keepers list [2] and assign them for reviewing any new PR.
The bot goes uses a round robin algorithm to select handles from the
list.
What happens when the CODEOWNERS file gets populated with real
owners? Following the PR review and approval process [3], the
PullAssigner bot will either pick only one or zero reviewers from the
gate keepers list, if the CODEOWNERS file points to exactly one or more
than one actual ownwer, respectively.
[1] https://pullpanda.com/assigner
[2] https://github.com/rust-vmm/community/blob/master/GATEKEEPERS.md
[3] https://github.com/rust-vmm/community#pr-review-and-approval
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>