Bumps the non-rust-vmm group with 7 updates in the / directory: | Package | From | To | | --- | --- | --- | | [clap](https://github.com/clap-rs/clap) | `4.5.20` | `4.5.21` | | [thiserror](https://github.com/dtolnay/thiserror) | `1.0.69` | `2.0.3` | | [libc](https://github.com/rust-lang/libc) | `0.2.162` | `0.2.164` | | [serde](https://github.com/serde-rs/serde) | `1.0.214` | `1.0.215` | | [cc](https://github.com/rust-lang/cc-rs) | `1.1.37` | `1.2.1` | | [clap_lex](https://github.com/clap-rs/clap) | `0.7.2` | `0.7.3` | | [regex-automata](https://github.com/rust-lang/regex) | `0.4.8` | `0.4.9` | Bumps the non-rust-vmm group with 4 updates in the /staging directory: [clap](https://github.com/clap-rs/clap), [libc](https://github.com/rust-lang/libc), [clap_lex](https://github.com/clap-rs/clap) and [regex-automata](https://github.com/rust-lang/regex). Updates `clap` from 4.5.20 to 4.5.21 - [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/clap_complete-v4.5.20...clap_complete-v4.5.21) Updates `thiserror` from 1.0.69 to 2.0.3 - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.69...2.0.3) Updates `libc` from 0.2.162 to 0.2.164 - [Release notes](https://github.com/rust-lang/libc/releases) - [Changelog](https://github.com/rust-lang/libc/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-lang/libc/compare/0.2.162...0.2.164) Updates `serde` from 1.0.214 to 1.0.215 - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.214...v1.0.215) Updates `cc` from 1.1.37 to 1.2.1 - [Release notes](https://github.com/rust-lang/cc-rs/releases) - [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.37...cc-v1.2.1) Updates `clap_builder` from 4.5.20 to 4.5.21 - [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.5.20...v4.5.21) Updates `clap_lex` from 0.7.2 to 0.7.3 - [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/clap_lex-v0.7.2...clap_lex-v0.7.3) Updates `regex-automata` from 0.4.8 to 0.4.9 - [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/regex-automata-0.4.9) Updates `serde_derive` from 1.0.214 to 1.0.215 - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.214...v1.0.215) Updates `clap` from 4.5.20 to 4.5.21 - [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/clap_complete-v4.5.20...clap_complete-v4.5.21) Updates `libc` from 0.2.162 to 0.2.164 - [Release notes](https://github.com/rust-lang/libc/releases) - [Changelog](https://github.com/rust-lang/libc/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-lang/libc/compare/0.2.162...0.2.164) Updates `clap_builder` from 4.5.20 to 4.5.21 - [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.5.20...v4.5.21) Updates `clap_lex` from 0.7.2 to 0.7.3 - [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/clap_lex-v0.7.2...clap_lex-v0.7.3) Updates `regex-automata` from 0.4.8 to 0.4.9 - [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/regex-automata-0.4.9) --- updated-dependencies: - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-patch dependency-group: non-rust-vmm - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-major dependency-group: non-rust-vmm - dependency-name: libc dependency-type: direct:production update-type: version-update:semver-patch dependency-group: non-rust-vmm - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch dependency-group: non-rust-vmm - dependency-name: cc dependency-type: indirect update-type: version-update:semver-minor dependency-group: non-rust-vmm - dependency-name: clap_builder dependency-type: indirect update-type: version-update:semver-patch dependency-group: non-rust-vmm - dependency-name: clap_lex dependency-type: indirect update-type: version-update:semver-patch dependency-group: non-rust-vmm - dependency-name: regex-automata dependency-type: indirect update-type: version-update:semver-patch dependency-group: non-rust-vmm - dependency-name: serde_derive dependency-type: indirect update-type: version-update:semver-patch dependency-group: non-rust-vmm - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-patch dependency-group: non-rust-vmm - dependency-name: libc dependency-type: direct:production update-type: version-update:semver-patch dependency-group: non-rust-vmm - dependency-name: clap_builder dependency-type: indirect update-type: version-update:semver-patch dependency-group: non-rust-vmm - dependency-name: clap_lex dependency-type: indirect update-type: version-update:semver-patch dependency-group: non-rust-vmm - dependency-name: regex-automata dependency-type: indirect update-type: version-update:semver-patch dependency-group: non-rust-vmm ... Signed-off-by: dependabot[bot] <support@github.com> |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| LICENSE-APACHE | ||
| LICENSE-BSD-3-Clause | ||
| README.md | ||
vhost-device-can - CAN emulation backend daemon
Description
This program is a vhost-user backend that emulates a VirtIO CAN device. The device's binary takes two (2) parameters: a socket, a 'can-devices' list. The socket is commonly used across all vhost-devices to communicate with the vhost-user frontend device. The 'can-devices' represents a list of CAN/FD devices appears in the host system which vhost-device-can will forward messages to and from the frontend side.
This program is tested with QEMU's vhost-user-device-pci device.
Examples' section below.
Synopsis
**vhost-device-can** [*OPTIONS*]
Options
.. program:: vhost-device-can
.. option:: -h, --help
Print help.
.. option:: -s, --socket-path=PATH
Location of vhost-user Unix domain sockets, this path will be suffixed with 0,1,2..socket_count-1.
.. option:: -c, --socket-count=INT
Number of guests (sockets) to attach to, default set to 1.
.. option:: -d, --can-devices='CAN/FD interfaces'
CAN/FD device list at the host OS in the format: <can-_X_0> [<can_in_X_1>] ... [<can_in_X_N-1>]
Note 1: Where N (the number of CAN/FD interfaces) is equal with the number provided via socket_count parameter.
Example: --can-devices "can0 can1 can2"
Features
This device is still work-in-progress (WIP) and on virtio-spec v1.4 is based on virtio-can Linux's driver and QEMU's device presented in the following RFC:
Vhost-device-can have be been tested in scenarios with multiple QEMU's VMs using host's CAN/FD devices.
Limitations
- The transmission of a CAN/FD frame to a host interface always is done synchronously. This means that regardless the negotiation or not of the feature VIRTIO_CAN_F_LATE_TX_ACK, the backend will always wait for the transmission of the frame and after will mark the transmission request as used.
- Does not check for undefined flags in CAN/FD frame when send and receive a CAN/FD frame from the frontend (QEMU device).
- The host's CAN/FD devices should be already in UP state before staring
the vhost-device-can (by using
ip link set can0 [up,down]).- The control messages does not actually change host's device state
- Current version of the device has been tested only with vcan device.
Examples
Dependencies
For testing the device the required dependencies are:
- Linux:
- Integrate virtio-can driver implemented by OpenSynergy:
- Set
CONFIG_VIRTIO_CAN=y
- QEMU
- Integrate virtio-can device implemented by OpenSynergy:
- Clone vhost-user-can QEMU device (optional):
- A new vhost-user-can device has been implemented in the following repo:
Test the device
The daemon should be started first:
host# vhost-device-can --socket-path=can.sock --can-devices="vcan0"
The QEMU invocation needs to create a chardev socket the device can use to communicate as well as share the guests memory over a memfd.
There are two option for running QEMU with vhost-device-can:
- Using
vhost-user-device-pciavailable upstream since QEMUv8.2.0:
host# qemu-system \
-m 4096 \
-numa node,memdev=mem \
-object memory-backend-memfd,id=mem,size=4G,share=on \
-chardev socket,id=can0,path=/tmp/can.sock \
-device vhost-user-device-pci,chardev=can0,virtio-id=36,num_vqs=3,config_size=16 \
...
- Using
vhost-user-can-pci:
host# qemu-system \
-m 4096 \
-numa node,memdev=mem \
-object memory-backend-memfd,id=mem,size=4G,share=on \
-chardev socket,path=/tmp/can.sock,id=can0 \
-device vhost-user-can-pci,chardev=can0,id=can \
...
Note: For testing this scenario the reader needs to clone the QEMU version from the following repo which implements
vhost-user-candevice:
Multi-Guest case
Run vhost-device-can as:
./vhost-device-can --socket-path /tmp/can.sock --socket-count 2 --can-devices "vcan0 vcan1"
This command will start the device and create two new sockets: /tmp/can.sock0 and /tmp/can.sock1.
From the other side we run two QEMU instances (VMs) with vhost-user-can:
host# qemu-system \
-m 4096 \
-numa node,memdev=mem \
-object memory-backend-memfd,id=mem,size=4G,share=on \
-chardev socket,path=<SOCKET_PATH>,id=can0 \
-device vhost-user-can-pci,chardev=can0,id=can \
...
In the first instance of QEMU SOCKET_PATH would be: /tmp/can.sock0, and will use can0 (host interface) as sender and receiver. The second QEMU VM would have: SOCKET_PATH = /tmp/can.sock1, and will use can1 as receiver and can2 as sender.
License
This project is licensed under either of
- Apache License, Version 2.0
- BSD-3-Clause License