@@ -26,7 +26,7 @@ use std::sync::Arc;
2626use logger:: { debug, error, warn, IncMetric , METRICS } ;
2727use utils:: byte_order;
2828use utils:: eventfd:: EventFd ;
29- use vm_memory:: { Bytes , GuestMemoryMmap } ;
29+ use vm_memory:: { GuestMemoryMmap } ;
3030
3131use super :: super :: super :: Error as DeviceError ;
3232use super :: super :: {
@@ -41,8 +41,6 @@ pub(crate) const RXQ_INDEX: usize = 0;
4141pub ( crate ) const TXQ_INDEX : usize = 1 ;
4242pub ( crate ) const EVQ_INDEX : usize = 2 ;
4343
44- pub ( crate ) const VIRTIO_VSOCK_EVENT_TRANSPORT_RESET : u32 = 0 ;
45-
4644/// The virtio features supported by our vsock device:
4745/// - VIRTIO_F_VERSION_1: the device conforms to at least version 1.0 of the VirtIO spec.
4846/// - VIRTIO_F_IN_ORDER: the device returns used buffers in the same order that the driver makes
@@ -228,35 +226,6 @@ where
228226
229227 have_used
230228 }
231-
232- // Send TRANSPORT_RESET_EVENT to driver. According to specs, the driver shuts down established
233- // connections and the guest_cid configuration field is fetched again. Existing listen sockets remain
234- // but their CID is updated to reflect the current guest_cid.
235- pub fn send_transport_reset_event ( & mut self ) -> result:: Result < ( ) , DeviceError > {
236- let mem = match self . device_state {
237- DeviceState :: Activated ( ref mem) => mem,
238- // This should never happen, it's been already validated in the caller function.
239- DeviceState :: Inactive => unreachable ! ( ) ,
240- } ;
241-
242- let head = self . queues [ EVQ_INDEX ] . pop ( mem) . ok_or_else ( || {
243- METRICS . vsock . ev_queue_event_fails . inc ( ) ;
244- DeviceError :: VsockError ( VsockError :: EmptyQueue )
245- } ) ?;
246-
247- mem. write_obj :: < u32 > ( VIRTIO_VSOCK_EVENT_TRANSPORT_RESET , head. addr )
248- . unwrap_or_else ( |e| error ! ( "Failed to write virtio vsock reset event: {:?}" , e) ) ;
249-
250- self . queues [ EVQ_INDEX ]
251- . add_used ( mem, head. index , head. len )
252- . unwrap_or_else ( |e| {
253- error ! ( "Failed to add used descriptor {}: {}" , head. index, e) ;
254- } ) ;
255-
256- self . signal_used_queue ( ) ?;
257-
258- Ok ( ( ) )
259- }
260229}
261230
262231impl < B > VirtioDevice for Vsock < B >
0 commit comments