net_util, virtio-devices, vhost_user_net: Relocate {Rx,Tx}Virtio

By moving the code for opening the two RX and TX queues into a shared
location we are starting to remove the requirement for the
vhost-user-net backend to depend on the virtio-devices crate which in of
itself depends on many other crates that are not necessary for the
backend to function.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2020-07-07 15:02:18 +01:00
parent 2efd307c4e
commit 48faf3abac
7 changed files with 208 additions and 190 deletions

View File

@@ -14,7 +14,7 @@ extern crate virtio_devices;
use libc::{self, EFD_NONBLOCK};
use log::*;
use net_util::{open_tap, MacAddr, OpenTapError, Tap};
use net_util::{open_tap, MacAddr, OpenTapError, RxVirtio, Tap, TxVirtio};
use option_parser::{OptionParser, OptionParserError};
use std::fmt;
use std::io::{self};
@@ -28,7 +28,6 @@ use vhost_rs::vhost_user::{Error as VhostUserError, Listener};
use vhost_user_backend::{VhostUserBackend, VhostUserDaemon, Vring, VringWorker};
use virtio_bindings::bindings::virtio_net::*;
use virtio_bindings::bindings::virtio_ring::VIRTIO_RING_F_EVENT_IDX;
use virtio_devices::net_util::{RxVirtio, TxVirtio};
use virtio_devices::{NetCounters, NetQueuePair};
use vm_memory::{GuestMemoryAtomic, GuestMemoryMmap};
use vmm_sys_util::eventfd::EventFd;