Lines Matching full:net
4 //! Kernel-based vhost-net backend
16 use crate::net::*;
18 const VHOST_NET_PATH: &str = "/dev/vhost-net";
21 pub struct Net<AS: GuestAddressSpace> { struct
26 impl<AS: GuestAddressSpace> Net<AS> { impl
27 /// Open a handle to a new VHOST-NET instance.
29 Ok(Net { in new()
41 impl<AS: GuestAddressSpace> VhostNet for Net<AS> { implementation
48 // SAFETY: Safe because the vhost-net fd is valid and we check the return value in set_backend()
54 impl<AS: GuestAddressSpace> VhostKernBackend for Net<AS> { implementation
62 impl<AS: GuestAddressSpace> AsRawFd for Net<AS> { implementation
83 let net = Net::new(&m).unwrap(); in test_net_new_device() localVariable
85 assert!(net.as_raw_fd() >= 0); in test_net_new_device()
86 assert!(net.mem().find_region(GuestAddress(0x100)).is_some()); in test_net_new_device()
87 assert!(net.mem().find_region(GuestAddress(0x10_0000)).is_none()); in test_net_new_device()
94 let net = Net::new(&m).unwrap(); in test_net_is_valid() localVariable
105 assert!(net.is_valid(&config)); in test_net_is_valid()
108 assert!(!net.is_valid(&config)); in test_net_is_valid()
110 assert!(!net.is_valid(&config)); in test_net_is_valid()
112 assert!(!net.is_valid(&config)); in test_net_is_valid()
119 let net = Net::new(&m).unwrap(); in test_net_ioctls() localVariable
126 let features = net.get_features().unwrap(); in test_net_ioctls()
127 net.set_features(features).unwrap(); in test_net_ioctls()
129 net.set_owner().unwrap(); in test_net_ioctls()
131 net.set_mem_table(&[]).unwrap_err(); in test_net_ioctls()
140 net.set_mem_table(&[region]).unwrap(); in test_net_ioctls()
142 net.set_log_base( in test_net_ioctls()
151 net.set_log_base(0x4000, None).unwrap(); in test_net_ioctls()
154 net.set_log_fd(eventfd.as_raw_fd()).unwrap(); in test_net_ioctls()
156 net.set_vring_num(0, 32).unwrap(); in test_net_ioctls()
167 net.set_vring_addr(0, &config).unwrap(); in test_net_ioctls()
168 net.set_vring_base(0, 1).unwrap(); in test_net_ioctls()
169 net.set_vring_call(0, &eventfd).unwrap(); in test_net_ioctls()
170 net.set_vring_kick(0, &eventfd).unwrap(); in test_net_ioctls()
171 net.set_vring_err(0, &eventfd).unwrap(); in test_net_ioctls()
172 assert_eq!(net.get_vring_base(0).unwrap(), 1); in test_net_ioctls()
174 net.set_backend(0, Some(&backend)).unwrap_err(); in test_net_ioctls()
175 net.set_backend(0, None).unwrap(); in test_net_ioctls()