Skip to content
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

[RFC] Net device proposal #33

Closed
wants to merge 6 commits into from
Closed

Conversation

alexandruag
Copy link
Collaborator

This is similar to #32 (and adds on top of it) for net devices. There's a hardcoded net device that tries to open the vmtap35 iface, until things get integrated with the user interface. The tap backend implementation is the one from Firecracker, and we should add one in rust-vmm as well.

Use [patch] sections in the workspace Cargo.toml file to redirect
dependencies to custom repos/branches that are not upstream yet. Also
switched to abort on panic for both debug and release builds. Enabled
lto and codegen-unit = 1 for release builds (and they take longer now).

Signed-off-by: Alexandru Agache <[email protected]>
The virtio device implementations are going to be added to a local
devices crate, so renaming the module with the same name within vmm
to serial (because there's only a serial device there for the time
being). Going foward, we should move the serial console to the devices
crate as well.

Signed-off-by: Alexandru Agache <[email protected]>
Signed-off-by: Alexandru Agache <[email protected]>
Applied some changes to the vmm to support the creation of block
devices. There's not cmdline support to configure them yet so
there's one hardcoded block device for demo purposes for now. It
will always attempt to open a file named 'disk.ext4` from the
current working directory when running the VMM.

Signed-off-by: Alexandru Agache <[email protected]>
Signed-off-by: Alexandru Agache <[email protected]>
Ok(count as u32)
}

pub fn process_txq(&mut self) -> result::Result<(), Error> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wandering if the TX can be done in a async fashion for performance reasons. Something like:

  • do an async write on the tap without copying the packets from vm memory to the vmm;
  • on the write completion notification mark the descriptor as used and signal the used queue.
    Since this is tap device you shouldn't care of scatter gather.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's def helpful to skip as many copies as possible. We need to add some more support in various places to make that work safely & properly, but it's something we clearly want to do. If by async you also mean somehow submitting the requests to write/read data for each frame without waiting for them to complete in-between, then things become more nuanced. Overall, I imagine that doesn't provide a clear positive impact in this case, but would be interesting to explore at some point.

@andreeaflorescu andreeaflorescu mentioned this pull request Nov 24, 2020
2 tasks
// found in the THIRD-PARTY file.

// The following are manually copied from crosvm/firecracker. In the latter, they can be found as
// part of the `net_gen` local crate. We should figure out how to proceed going forward (i.e.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the best thing to do would be to regenerate these with bindgen and document steps to generate them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is going to be a part of the plan around adding tap support as a reusable component. For now these have been brought over here to enable the network implementation, and we'll stop using them locally as soon as that's possible.

let queues = vec![Queue::new(args.mem.clone(), QUEUE_MAX_SIZE); 2];
// TODO: We'll need a minimal config space to support setting an explicit MAC addr
// on the guest interface at least. We use an empty one for now.
let config_space = Vec::new();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this reserve capacity for the MAC?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not required until we actually add the support and advertise that feature.

Copy link
Collaborator Author

@alexandruag alexandruag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comments! Will close this in favor of #49.

// found in the THIRD-PARTY file.

// The following are manually copied from crosvm/firecracker. In the latter, they can be found as
// part of the `net_gen` local crate. We should figure out how to proceed going forward (i.e.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is going to be a part of the plan around adding tap support as a reusable component. For now these have been brought over here to enable the network implementation, and we'll stop using them locally as soon as that's possible.

let queues = vec![Queue::new(args.mem.clone(), QUEUE_MAX_SIZE); 2];
// TODO: We'll need a minimal config space to support setting an explicit MAC addr
// on the guest interface at least. We use an empty one for now.
let config_space = Vec::new();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not required until we actually add the support and advertise that feature.

Ok(count as u32)
}

pub fn process_txq(&mut self) -> result::Result<(), Error> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's def helpful to skip as many copies as possible. We need to add some more support in various places to make that work safely & properly, but it's something we clearly want to do. If by async you also mean somehow submitting the requests to write/read data for each frame without waiting for them to complete in-between, then things become more nuanced. Overall, I imagine that doesn't provide a clear positive impact in this case, but would be interesting to explore at some point.

@alexandruag
Copy link
Collaborator Author

Closing after the creation of #49.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants