File tree Expand file tree Collapse file tree 3 files changed +70
-0
lines changed
src/vmm/src/devices/virtio Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 799799 "syscall" : " sigaltstack" ,
800800 "comment" : " sigaltstack is used by Rust stdlib to remove alternative signal stack during thread teardown."
801801 },
802+ {
803+ "syscall" : " fcntl"
804+ },
805+ {
806+ "syscall" : " ftruncate"
807+ },
802808 {
803809 "syscall" : " futex" ,
804810 "comment" : " Used for synchronization (during thread teardown when joining multiple vcpu threads at once)" ,
890896 }
891897 ]
892898 },
899+ {
900+ "syscall" : " memfd_create"
901+ },
902+ {
903+ "syscall" : " mmap" ,
904+ "comment" : " Used to recreate TX/RX queues in VirtIO net device" ,
905+ "args" : [
906+ {
907+ "index" : 3 ,
908+ "type" : " dword" ,
909+ "op" : " eq" ,
910+ "val" : 34 ,
911+ "comment" : " libc::MAP_ANONYMOUS|libc::MAP_PRIVATE"
912+ },
913+ {
914+ "index" : 2 ,
915+ "type" : " dword" ,
916+ "op" : " eq" ,
917+ "val" : 0 ,
918+ "comment" : " libc::PROT_NONE"
919+ }
920+ ]
921+ },
922+ {
923+ "syscall" : " mmap" ,
924+ "comment" : " Used to recreate TX/RX queues in VirtIO net device" ,
925+ "args" : [
926+ {
927+ "index" : 4 ,
928+ "type" : " dword" ,
929+ "op" : " eq" ,
930+ "val" : 5 ,
931+ "comment" : " file descriptor"
932+ },
933+ {
934+ "index" : 3 ,
935+ "type" : " dword" ,
936+ "op" : " eq" ,
937+ "val" : 17 ,
938+ "comment" : " libc::MAP_SHARED|libc::MAP_FIXED"
939+ },
940+ {
941+ "index" : 2 ,
942+ "type" : " dword" ,
943+ "op" : " eq" ,
944+ "val" : 3 ,
945+ "comment" : " libc::PROT_READ|libc::PROT_WRITE"
946+ }
947+ ]
948+ },
893949 {
894950 "syscall" : " mmap" ,
895951 "comment" : " Used for reading the timezone in LocalTime::now()" ,
Original file line number Diff line number Diff line change @@ -79,6 +79,8 @@ pub enum ActivateError {
7979// Errors triggered when resetting a VirtioDevice.
8080#[ derive( Debug , thiserror:: Error , displaydoc:: Display ) ]
8181pub enum ResetError {
82+ /// Error when creating RX buffers
83+ RxBuffer ,
8284 /// Reset is not implemented for the device.
8385 NotImplemented ,
8486}
Original file line number Diff line number Diff line change @@ -1036,6 +1036,18 @@ impl VirtioDevice for Net {
10361036 self . rx_frame_buf = [ 0u8 ; MAX_BUFFER_SIZE ] ;
10371037 self . acked_features = 0 ;
10381038 self . metrics . device_resets . inc ( ) ;
1039+ let mut queues = Vec :: new ( ) ;
1040+ for size in NET_QUEUE_SIZES {
1041+ queues. push ( Queue :: new ( size) ) ;
1042+ }
1043+ self . tx_buffer = Default :: default ( ) ;
1044+ self . rx_buffer = match RxBuffers :: new ( ) {
1045+ Ok ( rx_buffer) => rx_buffer,
1046+ Err ( err) => {
1047+ error ! ( "Failed to reset RX buffers: {:?}" , err) ;
1048+ return Err ( ResetError :: RxBuffer ) ;
1049+ }
1050+ } ;
10391051 Ok ( ( ) )
10401052 }
10411053}
You can’t perform that action at this time.
0 commit comments