diff options
Diffstat (limited to 'src/net.rs')
-rw-r--r-- | src/net.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/net.rs b/src/net.rs new file mode 100644 index 0000000..06a5e47 --- /dev/null +++ b/src/net.rs @@ -0,0 +1,19 @@ +// Copyright (C) 2021 Alibaba Cloud Computing. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause + +//! Trait to control vhost-net backend drivers. + +use std::fs::File; + +use crate::backend::VhostBackend; +use crate::Result; + +/// Trait to control vhost-net backend drivers. +pub trait VhostNet: VhostBackend { + /// Set fd as VHOST_NET backend. + /// + /// # Arguments + /// * `queue_index` - Index of the virtqueue + /// * `fd` - The file descriptor which servers as the backend + fn set_backend(&self, queue_idx: usize, fd: Option<&File>) -> Result<()>; +} |