@@ -35,7 +35,7 @@ use crate::drivers::virtio::transport::pci::{ComCfg, IsrStatus, NotifCfg};
3535use crate :: drivers:: virtio:: virtqueue:: packed:: PackedVq ;
3636use crate :: drivers:: virtio:: virtqueue:: split:: SplitVq ;
3737use crate :: drivers:: virtio:: virtqueue:: {
38- AvailBufferToken , BufferElem , BufferType , UsedBufferToken , VirtQueue , Virtq , VqIndex , VqSize ,
38+ AvailBufferToken , BufferElem , BufferType , UsedBufferToken , VirtQueue , Virtq ,
3939} ;
4040use crate :: drivers:: { Driver , InterruptLine } ;
4141use crate :: mm:: device_alloc:: DeviceAlloc ;
@@ -110,7 +110,7 @@ impl RxQueues {
110110 ///
111111 /// Queues are all populated according to Virtio specification v1.1. - 5.1.6.3.1
112112 fn add ( & mut self , mut vq : VirtQueue ) {
113- let num_bufs: u16 = u16 :: from ( vq. size ( ) ) / constants:: BUFF_PER_PACKET ;
113+ let num_bufs = vq. size ( ) / constants:: BUFF_PER_PACKET ;
114114 fill_queue ( & mut vq, num_bufs, self . buf_size ) ;
115115 self . vqs . push ( vq) ;
116116 }
@@ -836,8 +836,8 @@ impl VirtioNetDriver<Uninit> {
836836 PackedVq :: new (
837837 & mut self . com_cfg ,
838838 & self . notif_cfg ,
839- VqSize :: from ( VIRTIO_MAX_QUEUE_SIZE ) ,
840- VqIndex :: from ( self . num_vqs ) ,
839+ VIRTIO_MAX_QUEUE_SIZE ,
840+ self . num_vqs ,
841841 self . dev_cfg . features . into ( ) ,
842842 )
843843 . unwrap ( ) ,
@@ -847,8 +847,8 @@ impl VirtioNetDriver<Uninit> {
847847 SplitVq :: new (
848848 & mut self . com_cfg ,
849849 & self . notif_cfg ,
850- VqSize :: from ( VIRTIO_MAX_QUEUE_SIZE ) ,
851- VqIndex :: from ( self . num_vqs ) ,
850+ VIRTIO_MAX_QUEUE_SIZE ,
851+ self . num_vqs ,
852852 self . dev_cfg . features . into ( ) ,
853853 )
854854 . unwrap ( ) ,
@@ -896,7 +896,7 @@ impl VirtioNetDriver<Uninit> {
896896 self . num_vqs = 2 ;
897897 }
898898
899- // The loop is running from 0 to num_vqs and the indexes are provided to the VqIndex::from function in this way
899+ // The loop is running from 0 to num_vqs and the indexes are provided in this way
900900 // in order to allow the indexes of the queues to be in a form of:
901901 //
902902 // index i for receive queue
@@ -912,8 +912,8 @@ impl VirtioNetDriver<Uninit> {
912912 let mut vq = PackedVq :: new (
913913 & mut self . com_cfg ,
914914 & self . notif_cfg ,
915- VqSize :: from ( VIRTIO_MAX_QUEUE_SIZE ) ,
916- VqIndex :: from ( 2 * i) ,
915+ VIRTIO_MAX_QUEUE_SIZE ,
916+ 2 * i,
917917 self . dev_cfg . features . into ( ) ,
918918 )
919919 . unwrap ( ) ;
@@ -925,22 +925,22 @@ impl VirtioNetDriver<Uninit> {
925925 let mut vq = PackedVq :: new (
926926 & mut self . com_cfg ,
927927 & self . notif_cfg ,
928- VqSize :: from ( VIRTIO_MAX_QUEUE_SIZE ) ,
929- VqIndex :: from ( 2 * i + 1 ) ,
928+ VIRTIO_MAX_QUEUE_SIZE ,
929+ 2 * i + 1 ,
930930 self . dev_cfg . features . into ( ) ,
931931 )
932932 . unwrap ( ) ;
933933 // Interrupt for communicating that a sent packet left, is not needed
934934 vq. disable_notifs ( ) ;
935935
936- inner. send_capacity += u32:: from ( u16 :: from ( vq. size ( ) ) ) ;
936+ inner. send_capacity += u32:: from ( vq. size ( ) ) ;
937937 inner. send_vqs . add ( VirtQueue :: Packed ( vq) ) ;
938938 } else {
939939 let mut vq = SplitVq :: new (
940940 & mut self . com_cfg ,
941941 & self . notif_cfg ,
942- VqSize :: from ( VIRTIO_MAX_QUEUE_SIZE ) ,
943- VqIndex :: from ( 2 * i) ,
942+ VIRTIO_MAX_QUEUE_SIZE ,
943+ 2 * i,
944944 self . dev_cfg . features . into ( ) ,
945945 )
946946 . unwrap ( ) ;
@@ -952,14 +952,14 @@ impl VirtioNetDriver<Uninit> {
952952 let mut vq = SplitVq :: new (
953953 & mut self . com_cfg ,
954954 & self . notif_cfg ,
955- VqSize :: from ( VIRTIO_MAX_QUEUE_SIZE ) ,
956- VqIndex :: from ( 2 * i + 1 ) ,
955+ VIRTIO_MAX_QUEUE_SIZE ,
956+ 2 * i + 1 ,
957957 self . dev_cfg . features . into ( ) ,
958958 )
959959 . unwrap ( ) ;
960960 // Interrupt for communicating that a sent packet left, is not needed
961961 vq. disable_notifs ( ) ;
962- inner. send_capacity += u32:: from ( u16 :: from ( vq. size ( ) ) ) ;
962+ inner. send_capacity += u32:: from ( vq. size ( ) ) ;
963963 inner. send_vqs . add ( VirtQueue :: Split ( vq) ) ;
964964 }
965965 }
0 commit comments