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

Linux usbfs zero-copy support #11

Open
martinling opened this issue Nov 8, 2023 · 0 comments
Open

Linux usbfs zero-copy support #11

martinling opened this issue Nov 8, 2023 · 0 comments
Labels
feature-request New feature or request

Comments

@martinling
Copy link
Contributor

martinling commented Nov 8, 2023

Since Linux 4.9, the usbfs subsystem includes a mechanism to support zero-copy transfers, by allowing userspace to mmap an open usbfs device to get a DMA-ready buffer. When such a buffer is used in a request, the kernel can arrange for the host controller to access it directly.

This feature is supported in libusb via the libusb_dev_mem_alloc and libusb_dev_mem_free functions.

It would be nice if nusb could use this feature, as it may make a significant performance difference especially at SuperSpeed, but there would be some API and safety implications.

In principle, you could add a method to Device which returns a RequestBuffer allocated this way with mmap, and put some metadata in the RequestBuffer struct to indicate that drop needs to call munmap. However, it would then no longer be safe to turn that RequestBuffer into a normal Vec and back.

tuna-f1sh pushed a commit to tuna-f1sh/nusb that referenced this issue Sep 26, 2024
fixup: Cargo.toml: change crate name
@kevinmehall kevinmehall added the feature-request New feature or request label Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants