Skip to content

virtio-net: switch to readv + implement MRG_RXBUF #4813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions resources/seccomp/aarch64-unknown-linux-musl.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"syscall": "writev",
"comment": "Used by the VirtIO net device to write to tap"
},
{
"syscall": "readv",
"comment": "Used by the VirtIO net device to read from tap"
},
{
"syscall": "fsync"
},
Expand Down
4 changes: 4 additions & 0 deletions resources/seccomp/x86_64-unknown-linux-musl.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"syscall": "writev",
"comment": "Used by the VirtIO net device to write to tap"
},
{
"syscall": "readv",
"comment": "Used by the VirtIO net device to read from tap"
},
{
"syscall": "fsync"
},
Expand Down
43 changes: 1 addition & 42 deletions src/vmm/benches/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,9 @@ use std::num::Wrapping;

use criterion::{criterion_group, criterion_main, Criterion};
use vm_memory::GuestAddress;
use vmm::devices::virtio::queue::{VIRTQ_DESC_F_NEXT, VIRTQ_DESC_F_WRITE};
use vmm::devices::virtio::test_utils::VirtQueue;
use vmm::devices::virtio::test_utils::{set_dtable_many_chains, set_dtable_one_chain, VirtQueue};
use vmm::test_utils::single_region_mem;

/// Create one chain with n descriptors
/// Descriptor buffers will leave at the offset of 2048 bytes
/// to leave some room for queue objects.
/// We don't really care about sizes of descriptors,
/// so pick 1024.
fn set_dtable_one_chain(rxq: &VirtQueue, n: usize) {
let desc_size = 1024;
for i in 0..n {
rxq.dtable[i].set(
(2048 + desc_size * i) as u64,
desc_size as u32,
VIRTQ_DESC_F_WRITE | VIRTQ_DESC_F_NEXT,
(i + 1) as u16,
);
}
rxq.dtable[n - 1].flags.set(VIRTQ_DESC_F_WRITE);
rxq.dtable[n - 1].next.set(0);
rxq.avail.ring[0].set(0);
rxq.avail.idx.set(n as u16);
}

/// Create n chains with 1 descriptors each
/// Descriptor buffers will leave at the offset of 2048 bytes
/// to leave some room for queue objects.
/// We don't really care about sizes of descriptors,
/// so pick 1024.
fn set_dtable_many_chains(rxq: &VirtQueue, n: usize) {
let desc_size = 1024;
for i in 0..n {
rxq.dtable[i].set(
(2048 + desc_size * i) as u64,
desc_size as u32,
VIRTQ_DESC_F_WRITE,
0,
);
rxq.avail.ring[i].set(i as u16);
}
rxq.avail.idx.set(n as u16);
}

pub fn queue_benchmark(c: &mut Criterion) {
let mem = single_region_mem(65562);
let rxq = VirtQueue::new(GuestAddress(0), &mem, 256);
Expand Down
Loading
Loading