Commit graph

11 commits

Author SHA1 Message Date
Sebastien Boeuf
bbc892ba45 lib: Allow the daemon to run as a client
In order to support vhost-user client mode, we introduce a new method
start_client() to VhostUserDaemon. It allows the daemon to connect to
the VMM side running as the server in this case.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-02-03 17:13:29 +08:00
Sebastien Boeuf
1c4ee49a89 Implement AsRawFd for VringEpollHandler
In order to let the consumer of the crate access directly the file
descriptor related to the VringEpollHandler, we implement the AsRawFd
trait.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-02-03 00:15:43 +08:00
Sergii Glushchenko
9517235567 Fix clippy warnings and adjust test coverage
Signed-off-by: Sergii Glushchenko <gsserge@amazon.com>
2022-01-24 12:54:10 +02:00
Liu Jiang
48070ccb7c Add test case to cover VhostUserHandler
Previous patch causes dramatic code coverage decrease, it actually
disclose some issue in the code coverage test. Then we add test case
to cover VhostUserHandler, it actually increases the code coverage.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-22 18:58:54 +08:00
Liu Jiang
4e16112122 Refine test case to increase code coverage
Try to increase code coverage by adding more test code. But it actually
causes dramatic decreases in code coverage:(

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-22 18:58:54 +08:00
Liu Jiang
6d5fccefc7 epoll: use epoll wrapper from vmm-sys-util
There's a wrapper for epoll from vmm-sys-util, so use the wrapper
instead of the epoll crate directly. It may help to ease dependency
management.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-10-15 21:55:35 +08:00
Liu Jiang
f2e38e294a vring: do not take &mut self for VringT
Backend::handle_event() takes an argument of `vrings: &[V]` with
`V: VringT`, so methods of VringT should not take `&mut self`.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-09-09 10:19:50 +02:00
Liu Jiang
e8beb233b5 epoll: refine the way to manage event id
Refine the way to manage epoll event id and simplify interfaces:
- Change VhostUserBackend::exit_event() to return Option<EventFd>
  instead of Option<(EventFd, u16)>.
- Delete VringEpollHandler::exit_event_id.
- Add VringEpollHandler::register_event/unregister_event for internal
  use.
- Make VringEpollHandler::register_listener/unregister_listener() for
  external users only, and 'data` range [0..backend.num_queues()] is
  reserved for queues and exit event.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-09-07 16:32:34 +08:00
Liu Jiang
6d04368c46 backend: set default type for VhostUserBackend
Use () as default type for trait VhostUserBackend and
VhostUserBackendMut.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-08-30 17:52:22 +08:00
Liu Jiang
ca2b434900 Implement Display for Error
Implement Display for Error, and minor documentation enhancement.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-08-30 17:52:21 +08:00
Ayaan Zaidi
4f31df77bd Add default coverage config for x86_64 2021-03-14 09:59:41 +05:30