1 // Copyright (C) 2021 Alibaba Cloud Computing. All rights reserved. 2 // SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause 3 4 //! Trait to control vhost-net backend drivers. 5 6 use std::fs::File; 7 8 use crate::backend::VhostBackend; 9 use crate::Result; 10 11 /// Trait to control vhost-net backend drivers. 12 pub trait VhostNet: VhostBackend { 13 /// Set fd as VHOST_NET backend. 14 /// 15 /// # Arguments 16 /// * `queue_index` - Index of the virtqueue 17 /// * `fd` - The file descriptor which servers as the backend set_backend(&self, queue_idx: usize, fd: Option<&File>) -> Result<()>18 fn set_backend(&self, queue_idx: usize, fd: Option<&File>) -> Result<()>; 19 } 20