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: usbip: add initial support for USBIP server #74141

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

jfischer-no
Copy link
Collaborator

@jfischer-no jfischer-no commented Jun 12, 2024

The server uses minimal host support to export a USB device to a remote
USBIP client. It supports control and bulk transfers, interrupt
transfers may also work, but this depends on the host controller used.
Only a single USB device can be exported yet.

@jfischer-no jfischer-no added area: USB Universal Serial Bus Experimental Experimental features not enabled by default labels Jun 12, 2024
@jfischer-no jfischer-no self-assigned this Jun 12, 2024
drivers/usb/uhc/uhc_virtual.c Outdated Show resolved Hide resolved
*
* SPDX-License-Identifier: Apache-2.0
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

This file is missing include guards.

@github-actions github-actions bot added the Stale label Aug 17, 2024
@jfischer-no jfischer-no removed the Stale label Aug 19, 2024
@zephyrproject-rtos zephyrproject-rtos deleted a comment from github-actions bot Aug 19, 2024
@github-actions github-actions bot added the Stale label Oct 19, 2024
@jfischer-no jfischer-no removed the Stale label Oct 21, 2024
@zephyrproject-rtos zephyrproject-rtos deleted a comment from github-actions bot Oct 21, 2024
@github-actions github-actions bot added the Stale label Dec 21, 2024
@github-actions github-actions bot closed this Jan 5, 2025
@jfischer-no jfischer-no reopened this Jan 6, 2025
@zephyrproject-rtos zephyrproject-rtos deleted a comment from github-actions bot Jan 6, 2025
@jfischer-no jfischer-no removed the Stale label Jan 6, 2025
@jfischer-no jfischer-no force-pushed the pr-uhc-usbip-initial branch 3 times, most recently from d123ee7 to 01328a1 Compare January 6, 2025 16:16
This allows us to use the testusb Linux kernel tool again. All tests
involving control and bulk transfers should pass. Additionally, add a
shell command that allows the user to manually enqueue bulk transfers.

Signed-off-by: Johann Fischer <[email protected]>
Lock the scheduler until the device is fully enabled, similar to
usbd_init();

Signed-off-by: Johann Fischer <[email protected]>
Do not necessarily call k_timer_init() in the uhc_bus_resume()
implementation. Restart SOF timer after bus reset and in
uhc_sof_enable() implementation.

Signed-off-by: Johann Fischer <[email protected]>
The parameter should not be a pointer to type usbh_udev_cb_t.

Signed-off-by: Johann Fischer <[email protected]>
Implement the dequeue function and remove the timeout parameter as it is
no longer necessary and can be handled in the upper layer. The dequeue
function is required for the USBIP implementation.

Signed-off-by: Johann Fischer <[email protected]>
With the current implementation, NACK claims all resources and prevents
scheduling multiple transfers within a frame. Place a number of
available transfers in a list at the beginning of a frame, and process
the transfers in a limited number of slots.

Signed-off-by: Johann Fischer <[email protected]>
This will allow the controller driver to access information about the
device in the future.

Signed-off-by: Johann Fischer <[email protected]>
Address parameter/argument is no longer needed because we have a pointer
to the USB device. The Attrib parameter has never been used and will be
replaced by the interval and start-frame parameters in the future.

Signed-off-by: Johann Fischer <[email protected]>
To determine bMaxPacketSize0, which is unknown after the reset.

Signed-off-by: Johann Fischer <[email protected]>
Update the SoF timer based on the bus speed of the connected device.

Signed-off-by: Johann Fischer <[email protected]>
Add interrupt and start frame parameters and schedule transaction at
specific frame. Implement for virtual driver only.

Signed-off-by: Johann Fischer <[email protected]>
Add an opaque pointer to store upper layer private data and initialize
it with the USB host context during controller initialization. Use the
pointer in event processing to get the correct context.

Signed-off-by: Johann Fischer <[email protected]>
The transfers require enpoint MPS for proper transaction handling,
assign it in the common place during transfer allsocation so that it can
be reused.
Some users, such as USBIP, may need to keep a reference to private data,
add a parameter for completion callback data.

Signed-off-by: Johann Fischer <[email protected]>
Handle them in separate contexts so that the request completion callback
cannot be blocked, such as when a device connection is detected and
requires configuration.

Signed-off-by: Johann Fischer <[email protected]>
Allow dynamic allocation of USB devices on connected event.
Add very basic USB device validation and configuration.

Signed-off-by: Johann Fischer <[email protected]>
The server uses minimal host support to export a USB device to a remote
USBIP client. It supports control and bulk transfers, interrupt
transfers may also work, but this depends on the host controller used.
Only a single USB device can be exported yet.

Signed-off-by: Johann Fischer <[email protected]>
Snippet that helps to build USB device samples with virtual device and
host controllers and USBIP support.

Signed-off-by: Johann Fischer <[email protected]>
Add initial USB/IP documentation for the new USB support.

Signed-off-by: Johann Fischer <[email protected]>
@jfischer-no jfischer-no added this to the v4.1.0 milestone Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus Experimental Experimental features not enabled by default
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants