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};
14
14
use log:: error;
15
15
use vmm_sys_util:: eventfd:: EventFd ;
16
16
17
+ use super :: NET_QUEUE_MAX_SIZE ;
17
18
use crate :: devices:: virtio:: device:: { DeviceState , IrqTrigger , IrqType , VirtioDevice } ;
18
19
use crate :: devices:: virtio:: gen:: virtio_blk:: VIRTIO_F_VERSION_1 ;
19
20
use crate :: devices:: virtio:: gen:: virtio_net:: {
@@ -104,7 +105,7 @@ pub struct RxBuffers {
104
105
pub min_buffer_size : u32 ,
105
106
// An [`IoVecBufferMut`] covering all the memory we have available for receiving network
106
107
// frames.
107
- pub iovec : IoVecBufferMut ,
108
+ pub iovec : IoVecBufferMut < NET_QUEUE_MAX_SIZE > ,
108
109
// A map of which part of the memory belongs to which `DescriptorChain` object
109
110
pub parsed_descriptors : VecDeque < ParsedDescriptorChain > ,
110
111
// 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 5
5
6
6
use std:: io;
7
7
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 ;
10
10
/// Maximum size of the frame buffers handled by this device.
11
11
pub const MAX_BUFFER_SIZE : usize = 65562 ;
12
12
/// The number of queues of the network device.
13
13
pub 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 ] ;
15
15
/// The index of the rx queue from Net device queues/queues_evts vector.
16
16
pub const RX_INDEX : usize = 0 ;
17
17
/// 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};
10
10
use serde:: { Deserialize , Serialize } ;
11
11
12
12
use 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 } ;
14
14
use crate :: devices:: virtio:: device:: DeviceState ;
15
15
use crate :: devices:: virtio:: persist:: { PersistError as VirtioStateError , VirtioDeviceState } ;
16
- use crate :: devices:: virtio:: queue:: FIRECRACKER_MAX_QUEUE_SIZE ;
17
16
use crate :: devices:: virtio:: TYPE_NET ;
18
17
use crate :: mmds:: data_store:: Mmds ;
19
18
use crate :: mmds:: ns:: MmdsNetworkStack ;
@@ -147,7 +146,7 @@ impl Persist<'_> for Net {
147
146
& constructor_args. mem ,
148
147
TYPE_NET ,
149
148
NET_NUM_QUEUES ,
150
- FIRECRACKER_MAX_QUEUE_SIZE ,
149
+ NET_QUEUE_MAX_SIZE ,
151
150
) ?;
152
151
net. irq_trigger . irq_status = Arc :: new ( AtomicU32 :: new ( state. virtio_state . interrupt_status ) ) ;
153
152
net. avail_features = state. virtio_state . avail_features ;
You can’t perform that action at this time.
0 commit comments