Skip to content

feat: increase vhci-hcd capacity to 128 USB/IP devices (16 ports × 4 controllers)#2024

Open
yaroslavborbat wants to merge 1 commit intofeat/dra-usbipfrom
feat/build-usb-modules
Open

feat: increase vhci-hcd capacity to 128 USB/IP devices (16 ports × 4 controllers)#2024
yaroslavborbat wants to merge 1 commit intofeat/dra-usbipfrom
feat/build-usb-modules

Conversation

@yaroslavborbat
Copy link
Member

@yaroslavborbat yaroslavborbat commented Feb 25, 2026

Description

This PR updates the init container logic for DRA to dynamically build and load patched USB/IP kernel modules (usbip-core, usbip-host, vhci-hcd) at startup with increased scalability limits.


The Problem

The vhci-hcd driver:

  • Creates two virtual USB hubs per controller (USB 2.0 and USB 3.0)
  • Defaults to 8 ports per hub
  • Uses 1 virtual host controller by default

This limits the total number of simultaneously attached remote USB devices to:

1 controller × 2 hubs × 8 ports = 16 devices

This becomes a bottleneck for high-density USB/IP workloads.

Additionally, the maximum number of ports per hub is constrained by the kernel constant USB_MAXCHILDREN, which is defined as 31 in the Linux USB specification headers. This means the number of ports per hub cannot exceed 31, regardless of vhci-hcd configuration.


The Solution

We patch the vhci-hcd driver to:

  • Increase the number of ports per hub from 8 to 16
  • Increase the number of virtual host controllers from 1 to 4
  • Remove dependency on CONFIG_USBIP_VHCI_HC_PORTS
  • Remove dependency on CONFIG_USBIP_VHCI_NR_HCS
  • Hardcode the new values at compile time

New total capacity:

4 controllers × 2 hubs × 16 ports = 128 devices per node

The selected value (16 ports per hub) remains safely below the kernel-enforced maximum of 31 ports.

This provides significantly higher USB device density while preserving kernel constraints.


How It Works

  • At DRA startup, the init container dynamically builds the patched modules for the host kernel version (supports 5.x and 6.x kernels)
  • If the build succeeds — the custom modules are loaded with the new limits (4 controllers, 16 ports per hub)
  • If the build fails — the system falls back to the default host modules (1 controller, 8 ports per hub)

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: vm
type: feature
summary: Increase `vhci-hcd` capacity to 16 ports per hub and 4 controllers (up to 128 USB/IP devices per node).

@yaroslavborbat yaroslavborbat force-pushed the feat/dra-usbip branch 2 times, most recently from e07b964 to 2ab816f Compare February 25, 2026 16:29
@yaroslavborbat yaroslavborbat added this to the v1.6.0 milestone Feb 25, 2026
@yaroslavborbat yaroslavborbat changed the title feat: build usb modules feat: increase vhci-hcd port limit to 32 for 64 USB/IP devices Feb 25, 2026
@yaroslavborbat yaroslavborbat force-pushed the feat/build-usb-modules branch 2 times, most recently from 08b99af to 2b35d29 Compare February 25, 2026 19:59
@yaroslavborbat yaroslavborbat changed the title feat: increase vhci-hcd port limit to 32 for 64 USB/IP devices feat: increase vhci-hcd capacity to 128 USB/IP devices (16 ports × 4 controllers) Feb 25, 2026
@yaroslavborbat yaroslavborbat marked this pull request as ready for review February 25, 2026 20:28
Signed-off-by: Yaroslav Borbat <yaroslav.borbat@flant.com>
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.

1 participant