It's possible to receive an incoming UDS connection before the VMM has
contacted us to initialize the vrings.
In this case, close the incoming connection so the client is aware of we
aren't yet ready, and to avoid having a lingering incomplete connection
around.
Signed-off-by: Sergio Lopez <slp@redhat.com>
It's possible to receive backend events before the VMM contacts us to
activate the vrings. Trying to call process_tx in this state will
trigger a NoMemoryConfigured error which will end crashing the worker
thread.
As NoMemoryConfigured is a transitory error, deal with it gracefully
printing a warning but continuing the normal execution.
Signed-off-by: Sergio Lopez <slp@redhat.com>
This commit aims to allow the vhost-user-vsock to
support local yaml configuration.
It introduces a new parameter '--config <CONFIG>' to allow user
to input a yaml configuration during startup and
uses config-rs to parse it.
Note that the configuration is currently made
conflicted to the original input parameters.
It introduces a new error -- ConfigParse inside the
crates/vsock/src/vhu_vsock.rs to support runtime error handling
and the new test_vsock_config_from_file() test.
It includes a new README.md with a parameter specification
and a config example in the Usage section.
It also introduces serde_deserialize(yaml) for VsockParam to let
config-rs directly pack the field specified in the array into the
VsockParam as suggested in config-rs. The serde crate is added to
crates/vsock/Cargo.toml correspondingly.
This commit also changes the original #[clap] into #[arg]
as suggested in clap-v4.
Signed-off-by: Yiyang Wu <toolmanp@outlook.com>
That buffer is used to store bytes coming from the guest before
sending them to the Unix domain socket. Some use cases might want
to increase or decrease this space, so it would be best to make it
user-customizable. Users can use "--tx-buffer-size=" to configure
TX buffer.
Fixes: #319
Signed-off-by: uran0sH <huangwenyuu@outlook.com>
Implement VhostUserBackend instead of VhostUserBackendMut for
VhostUserVsockBackend. VhostUserBackendMut trait is supposed to be used
for structures without interior mutability. But VhostUserVsockBackend
already uses Mutex to protect its threads, so it can implement the trait
with interior mutability (i.e. VhostUserBackend).
Signed-off-by: Priyansh Rathi <techiepriyansh@gmail.com>
The virtio-queue crate doesn't allow invalid queue state since commit
d951283a8e88 ("don't allow processing descriptors for invalid q").
Initialize the queues properly to fix testing failures.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Rather incongruously the common VIRTIO feature flags where part of the
net binding. Now that the new binding are out we can update them to
something generic.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
The upstream version doesn't compile the .c files locally and depends on
the package to be locally compiled and installed in advance.
It also doesn't provide pre-generated bindings, and requires bindgen
support.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This is what we need eventually, while parsing the requests, lets store
the correct type instead of creating the same everytime.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
The 0.2.1 version of virtio-vsock crate contains a fix [1] needed to
properly work with the virtio-vsock driver provided by Linux v6.3 and
later (originally the new driver was supposed to be in v6.2, but it
was postponed).
The fix was just a quick workaround, but in the future more work will
be needed in the virtio-vsock crate to not have a Linux-only specific
implementation of VsockPacket, as described in this issue [2].
[1] https://github.com/rust-vmm/vm-virtio/pull/207
[2] https://github.com/rust-vmm/vm-virtio/issues/216
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
As pointed out in https://gitlab.com/qemu-project/qemu/-/issues/1337
`-numa` is not supported by all machine types, so let's update the
example using the `memory-backend` machine property.
Since we are modifying the QEMU example, let's provide only the
QEMU's vhost-user-vsock required options in the "Usage" section.
In addition we also probide a working example.
Let's also remove a spurious rust section at the bottom of the file
that does not add any useful information.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
The I2C device names, /dev/i2c-N, can change from one boot to another of
the host machine and so aren't stable enough to be used for bus
selection.
Instead start accepting I2C master's name as parameter and parse based
on that.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
The path "/dev/i2c-N" is valid only for Linux userspace and must be
handled within PhysDevice's implementation.
Move it.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This is required to fix the errors with individual pull requests with
these crates.
Also update other dependencies with general `cargo update`.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cargo.toml defines `license = "Apache-2.0 OR BSD-3-Clause"`,
so let's update the SPDX in source files and add a section
in the readme about the license.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Cargo.toml defines `license = "Apache-2.0 OR BSD-3-Clause"`,
so let's update the SPDX in source files and add a section
in the readme about the license.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Cargo.toml defines `license = "Apache-2.0 OR BSD-3-Clause"`,
so let's update the SPDX in source files and add a section
in the readme about the license.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
We forgot to update the License section in the readme
template. So, let's specify that vsock crate is licensed
under Apache 2.0 OR BSD-3-Clause.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
As pointed out in the issue #232, vsock tests fail randomly.
From an initial analysis, it appears that using `--test-threads=1`
never happens, but using a value greater than 1, the tests fails
after a while and almost always with the creation of UDS,
or EpollFD, or on epoll_ctl.
There should be something wrong with FDs when there are multiple
threads running tests (not sure if related to O_CLOEXEC).
This is just a workaround, we will revert this commit when we
identify the root cause.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>