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

usb: investigate if Network Buffer can be used in USB device stack and USB drivers #19713

Closed
jfischer-no opened this issue Oct 9, 2019 · 4 comments · Fixed by #38679
Closed
Assignees
Labels
area: API Changes to public APIs area: USB Universal Serial Bus RFC Request For Comments: want input from the community

Comments

@jfischer-no
Copy link
Collaborator

Investigate if net_buf can be used in USB device stack and USB drivers.

Reason: The memory should be used more efficiently and secure. Unnecessary copying should be avoided. Support for multiple device instances should be considered.

There are many locale buffers in different places. Mostly these are only needed for temporary storage, whereby the content is often copied by the driver to another buffer again.

Worse is the situation with the standard, class and vendor request buffer. It is only used for the request over Control Pipe and also passed class drivers like hid and dfu. The buffer is usually not or little used during normal function. There is no verification that it is not written beyond the bounds of the buffer.

Classes already uses net_buf only:

... will be continued ...

@jfischer-no jfischer-no added area: USB Universal Serial Bus RFC Request For Comments: want input from the community area: API Changes to public APIs labels Oct 9, 2019
@finikorg
Copy link
Collaborator

If usb_transfer() functions could use buffers Ethernet over USB code can be easily transformed.

@jli157
Copy link
Contributor

jli157 commented Jun 30, 2021

@jfischer-no Any updates for this issue?

@jfischer-no
Copy link
Collaborator Author

@jfischer-no Any updates for this issue?

It is part of new USB device controller driver API, RFC PR will be opened soon.

@carlescufi
Copy link
Member

Fixed in the new USB stack, use CONFIG_USB_DEVICE_STACK_NEXT to enable it.

USB Device rework automation moved this from In Progress to Done Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: USB Universal Serial Bus RFC Request For Comments: want input from the community
Projects
Development

Successfully merging a pull request may close this issue.

5 participants