Commit Graph

554 Commits

Author SHA1 Message Date
dependabot[bot]
9ff6bdb701 build(deps): bump env_logger from 0.9.1 to 0.9.3
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.9.1 to 0.9.3.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.9.1...v0.9.3)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-14 15:16:58 +05:30
Viresh Kumar
56b9ef46bb Add SAFETY comments
Add SAFETY comments to fix clippy warnings.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2022-11-09 13:05:04 +05:30
dependabot[bot]
8171b62284 build(deps): bump rust-vmm-ci from 5f36cc9 to 7af2e16
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `5f36cc9` to `7af2e16`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases)
- [Commits](5f36cc9604...7af2e16d91)

---
updated-dependencies:
- dependency-name: rust-vmm-ci
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-09 13:05:04 +05:30
dependabot[bot]
d53b870bc3 build(deps): bump regex-syntax from 0.6.27 to 0.6.28
Bumps [regex-syntax](https://github.com/rust-lang/regex) from 0.6.27 to 0.6.28.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/commits)

---
updated-dependencies:
- dependency-name: regex-syntax
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 12:03:09 +05:30
dependabot[bot]
73433be3b4 build(deps): bump regex from 1.6.0 to 1.7.0
Bumps [regex](https://github.com/rust-lang/regex) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.6.0...1.7.0)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 11:50:04 +05:30
dependabot[bot]
e1c8bf53c3 build(deps): bump libc from 0.2.135 to 0.2.137
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.135 to 0.2.137.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.135...0.2.137)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 11:37:35 +05:30
dependabot[bot]
f3a1e9892c build(deps): bump getrandom from 0.2.7 to 0.2.8
Bumps [getrandom](https://github.com/rust-random/getrandom) from 0.2.7 to 0.2.8.
- [Release notes](https://github.com/rust-random/getrandom/releases)
- [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/getrandom/compare/v0.2.7...v0.2.8)

---
updated-dependencies:
- dependency-name: getrandom
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-02 14:58:47 -06:00
dependabot[bot]
fd09e861c0 build(deps): bump syn from 1.0.102 to 1.0.103
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.102 to 1.0.103.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.102...1.0.103)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-02 14:28:47 -06:00
Stefano Garzarella
8e1fb7e985 rng: update License in source files and readme
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>
2022-10-27 11:19:40 -06:00
Stefano Garzarella
8ead248560 i2c: update License in source files and readme
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>
2022-10-27 11:19:40 -06:00
Stefano Garzarella
bd61beeed9 gpio: update License in source files and readme
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>
2022-10-27 11:19:40 -06:00
Stefano Garzarella
6c52f494a3 vsock: add license in the readme
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>
2022-10-27 11:19:40 -06:00
Stefano Garzarella
90cb1571d3 Add BSD-3-Clause license for the crates
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-27 11:19:40 -06:00
dependabot[bot]
494e6b4381 build(deps): bump futures from 0.3.24 to 0.3.25
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.24 to 0.3.25.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.24...0.3.25)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-27 20:34:43 +05:30
dependabot[bot]
e231b32549 build(deps): bump clap from 4.0.15 to 4.0.18
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.15 to 4.0.18.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.15...v4.0.18)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-27 12:48:53 +05:30
dependabot[bot]
0b0d0b3740 build(deps): bump clap from 4.0.14 to 4.0.15
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.14 to 4.0.15.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.14...v4.0.15)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-18 14:01:35 +05:30
dependabot[bot]
d3b4f8d595 build(deps): bump proc-macro2 from 1.0.46 to 1.0.47
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.46 to 1.0.47.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.46...1.0.47)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-18 13:42:00 +05:30
Stefano Garzarella
4f7ffd7d0b vsock: serialize tests as workaround
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>
2022-10-18 13:29:08 +05:30
Viresh Kumar
f509782ec6
Merge pull request #230 from vireshk/cleanups
Cleanups
2022-10-14 14:41:02 +05:30
Viresh Kumar
20819e5284 Run cargo update
Run cargo update to automatically upgrade dependencies.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2022-10-13 16:32:17 +05:30
Viresh Kumar
5005c96c3a vsock: Minor cleanups
Minor cleanups.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2022-10-13 16:28:11 +05:30
Viresh Kumar
5e83d0c93f Move all crates in crates directory
Based on what other rust-vmm workspaces do, move all crates to crates
directory.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2022-10-13 16:28:11 +05:30
Viresh Kumar
3b1c32244e
Merge pull request #231 from stefano-garzarella/codeowners
CODEOWNERS: add stefano-garzarella
2022-10-13 16:14:13 +05:30
Stefano Garzarella
d9e4262316 CODEOWNERS: add stefano-garzarella
Add myself to CODEOWNERS to help with reviews and maintaining
this workspace especially vhost-user-vsock.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-13 09:41:24 +02:00
Viresh Kumar
947dbe904d
Merge pull request #228 from vireshk/cleanups
Cleanups
2022-10-12 22:00:18 +05:30
Viresh Kumar
da3ad14d2c
Merge branch 'main' into cleanups 2022-10-12 20:56:53 +05:30
Viresh Kumar
1f77465d3b
Merge pull request #216 from stefano-garzarella/vsock-stefano
add vhost-user-vsock device emulation
2022-10-12 20:43:06 +05:30
Stefano Garzarella
e6a85ffd5e vsock: reorder use declarations
Following the other crates, reorder the use declaration in 3 groups:
    1. standard library
    2. external crates
    3. local crates

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 15:17:45 +02:00
Stefano Garzarella
a76f9ebe16 vsock: remove "vsock_" prefix where is redundant
In several places the "vsock_" prefix doesn't add much and makes
names longer, let's remove it where it's not needed.

Suggested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 15:17:45 +02:00
Stefano Garzarella
c452d1c2f9 vsock: move VsockArgs in main.rs
VsockArgs is used only by main.rs, so we can move its definition
there. Let's also move the test.

Suggested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 15:17:45 +02:00
Stefano Garzarella
f7f239e390 vsock: use pub(crate) for types used only by our binary
This is a binary crate and most of the types shouldn't be visible
out of this crate. Change also documentation with ///.

If we would like to export some types as part of a library in the
future, we will adjust the visibility accordingly.

Suggested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 15:17:45 +02:00
Stefano Garzarella
a6d157f5e5 vsock: add more tests and update coverage_score
Add several tests to get good coverage. Unfortunately,
it's a lot of new code and not easy to test everything.
We may add more mocks and tests in the future.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 15:17:45 +02:00
Stefano Garzarella
498c7490e1 vsock: fix VhostUserVsockBackend::get_config
VIRTIO spec defines `guest_cid` in LE byte order.
Let's introduce VirtioVsockConfig based on the virtio-spec 1.2.
For now it contains only `guest_cid`, but in the future it could
contain other fields.

Let's also handle correctly `offset` and `size`, returning an empty
Vec if they are not valid.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 15:17:45 +02:00
Stefano Garzarella
167206dea3 vsock: try to avoid panic as much as we can
Instead of panic, let's propagate errors or print warnings
where we can't.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 15:17:14 +02:00
Stefano Garzarella
1605f54fab vsock: send credit update only when needed
If we don't remove any bytes from the buffer, it's useless to
send a credit update since the credit hasn't changed.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 14:39:27 +02:00
Stefano Garzarella
5986155c8a vsock: don't panic if "connect PORT\n" is malformed
Instead of panic if the local peer doesn't send "connect PORT\n"
correctly, let's print an error, ignoring the command.

Print an error message also when allocating local port fails.

Reported-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 14:39:27 +02:00
Stefano Garzarella
d6775cd90d vsock: clean up comments and fix log messages
Remove old comments, useless code, and code commented.

Avoid println!() to print messages and replaced with dbg!(), info!(),
or error!().

Also init `env_logger` like other daemons in the main().

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 14:39:27 +02:00
Stefano Garzarella
8fa597e941 vsock: add SPDX-License-Identifier in each file
Harsha specified `license = "Apache-2.0 OR BSD-3-Clause"` in
vsock/Cargo.toml, so let's add a properly SPDX tag in the
vsock files.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 14:21:54 +02:00
Stefano Garzarella
df1073bf2e vsock: use VsockPacket from the virtio-vsock crate
Replace our VsockPacket with the new one implemented in the
virtio-vsock crate.

Based on Alex Bennée and Laura Loghin commit:
https://github.com/stsquad/vhost-device/commit/6752266608dd

  To achieve this the following changes where made:
    - deleted the internal packet.rs
    - convert the send_pkt/recv_pkt helpers to be BitmapSlice aware
    - update push from LocalTxBuf
    - tweak a few API calls due to minor diffs

Fixed tests and moved some helpers from the removed
vsock/src/packet.rs file.

Co-developed-by: Laura Loghin <lauralg@amazon.com>
Co-developed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 14:21:54 +02:00
Stefano Garzarella
896d346135 vsock: replace the deprecated App::from_yaml
clap::App::from_yaml() is deprecated since clap-3.0.0, let's
switch to clap::Parser.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 14:21:54 +02:00
Stefano Garzarella
a1daeec3bc vsock: update Cargo.toml dependencies
Update the dependencies aligning with the other crates
in this workspace.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 14:21:54 +02:00
Stefano Garzarella
69882e1dfc vsock: fix clippy warnings
clippy complains of some minor issues, probably because the
new version has been improved. Let's fix them.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 14:21:54 +02:00
Harshavardhan Unnibhavi
e20698695b vhost-user-vsock: virtio-vsock device emulation
This commit introduces a vhost-user-vsock device that enables
communicaton between an application running in the guest i.e
inside a VM and an application running on the host i.e outside
the VM. The device exposes unix sockets to which the VMM and
host-side applications connect to. Applications in the guest
communicate over VM sockets. Applicaitons on the host connect to
the unix socket i.e communicate over AF_UNIX sockets.

Signed-off-by: Harshavardhan Unnibhavi <harshanavkis@gmail.com>
[sgarzare: rebased, updated Cargo.lock, updated clap version to
 avoid build issues, and fixed clap issues with the new version]
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-10-12 14:21:54 +02:00
Viresh Kumar
127113c0e9
Merge branch 'main' into cleanups 2022-10-11 16:41:03 +05:30
Viresh Kumar
b9f8d4e88f
Merge pull request #225 from rust-vmm/dependabot/cargo/syn-1.0.102
build(deps): bump syn from 1.0.101 to 1.0.102
2022-10-11 16:40:40 +05:30
Viresh Kumar
a0b0d96578
Merge branch 'main' into dependabot/cargo/syn-1.0.102 2022-10-11 16:31:28 +05:30
Viresh Kumar
427c011ef4
Merge pull request #224 from rust-vmm/dependabot/cargo/clap-4.0.11
build(deps): bump clap from 4.0.9 to 4.0.11
2022-10-11 16:29:59 +05:30
Viresh Kumar
2f27f73e58 Use std::io::Result instead of defining new type
Directly use std::io::Result instead of redefining it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2022-10-11 16:09:20 +05:30
Viresh Kumar
d1ac89588c rng: Rename daemon to align with rest of the crate
Make daemon name follow what's used for i2c and gpio.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2022-10-11 15:42:45 +05:30
Viresh Kumar
57162428cb Remove unused types
Started getting warnings for unused definitions as soon as the types are
made private to the crate. Remove them now.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2022-10-11 15:39:56 +05:30