File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
src/vmm/src/devices/virtio/net Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ use libc::{iovec, EAGAIN};
1414use log:: error;
1515use vmm_sys_util:: eventfd:: EventFd ;
1616
17+ use super :: NET_QUEUE_MAX_SIZE ;
1718use crate :: devices:: virtio:: device:: { DeviceState , IrqTrigger , IrqType , VirtioDevice } ;
1819use crate :: devices:: virtio:: gen:: virtio_blk:: VIRTIO_F_VERSION_1 ;
1920use crate :: devices:: virtio:: gen:: virtio_net:: {
@@ -104,7 +105,7 @@ pub struct RxBuffers {
104105 pub min_buffer_size : u32 ,
105106 // An [`IoVecBufferMut`] covering all the memory we have available for receiving network
106107 // frames.
107- pub iovec : IoVecBufferMut ,
108+ pub iovec : IoVecBufferMut < NET_QUEUE_MAX_SIZE > ,
108109 // A map of which part of the memory belongs to which `DescriptorChain` object
109110 pub parsed_descriptors : VecDeque < ParsedDescriptorChain > ,
110111 // Buffers that we have used and they are ready to be given back to the guest.
Original file line number Diff line number Diff line change 55
66use std:: io;
77
8- use crate :: devices :: virtio :: queue:: FIRECRACKER_MAX_QUEUE_SIZE ;
9-
8+ /// Maximum size of the queue for network device.
9+ pub const NET_QUEUE_MAX_SIZE : u16 = 512 ;
1010/// Maximum size of the frame buffers handled by this device.
1111pub const MAX_BUFFER_SIZE : usize = 65562 ;
1212/// The number of queues of the network device.
1313pub const NET_NUM_QUEUES : usize = 2 ;
14- pub const NET_QUEUE_SIZES : [ u16 ; NET_NUM_QUEUES ] = [ FIRECRACKER_MAX_QUEUE_SIZE ; NET_NUM_QUEUES ] ;
14+ pub const NET_QUEUE_SIZES : [ u16 ; NET_NUM_QUEUES ] = [ NET_QUEUE_MAX_SIZE ; NET_NUM_QUEUES ] ;
1515/// The index of the rx queue from Net device queues/queues_evts vector.
1616pub const RX_INDEX : usize = 0 ;
1717/// The index of the tx queue from Net device queues/queues_evts vector.
Original file line number Diff line number Diff line change @@ -10,10 +10,9 @@ use std::sync::{Arc, Mutex};
1010use serde:: { Deserialize , Serialize } ;
1111
1212use super :: device:: { Net , RxBuffers } ;
13- use super :: { TapError , NET_NUM_QUEUES , RX_INDEX } ;
13+ use super :: { TapError , NET_NUM_QUEUES , NET_QUEUE_MAX_SIZE , RX_INDEX } ;
1414use crate :: devices:: virtio:: device:: DeviceState ;
1515use crate :: devices:: virtio:: persist:: { PersistError as VirtioStateError , VirtioDeviceState } ;
16- use crate :: devices:: virtio:: queue:: FIRECRACKER_MAX_QUEUE_SIZE ;
1716use crate :: devices:: virtio:: TYPE_NET ;
1817use crate :: mmds:: data_store:: Mmds ;
1918use crate :: mmds:: ns:: MmdsNetworkStack ;
@@ -147,7 +146,7 @@ impl Persist<'_> for Net {
147146 & constructor_args. mem ,
148147 TYPE_NET ,
149148 NET_NUM_QUEUES ,
150- FIRECRACKER_MAX_QUEUE_SIZE ,
149+ NET_QUEUE_MAX_SIZE ,
151150 ) ?;
152151 net. irq_trigger . irq_status = Arc :: new ( AtomicU32 :: new ( state. virtio_state . interrupt_status ) ) ;
153152 net. avail_features = state. virtio_state . avail_features ;
You can’t perform that action at this time.
0 commit comments