[PATCH 4/4] config: make USB_MAXBUS configurable and adjust VHCI_NR_HCS top limit
From: Salvador Fandino
Date: Tue Jan 30 2018 - 03:44:34 EST
From: Salvador FandiÃo <salva@xxxxxxxxxx>
The maximum number of USB host controllers supported by the kernel had
a hard-coded limit of 64. In some scenarios that limit may be not
enough. For instance, in my particular case, I have systems with
thousands of containers running and would like to provide a VHCI
(USBIP host controller) device to every one of them but can't because
of this limit.
This patch adds a new configuration entry for USB_MAXBUS and also
increases the top limit for USBIP_VHCI_NR_HCS (number of VHCI
controllers) accordingly.
Signed-off-by: Salvador FandiÃo <salva@xxxxxxxxxx>
---
drivers/usb/Kconfig | 9 +++++++++
drivers/usb/core/hcd.c | 2 +-
drivers/usb/usbip/Kconfig | 5 ++++-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index f699abab1787..78b3e2805d8f 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -72,6 +72,15 @@ config USB
To compile this driver as a module, choose M here: the
module will be called usbcore.
+config USB_MAXBUS
+ int "Maximum number of USB host controllers"
+ range 1 4096
+ default 64
+ ---help---
+ This defines the number of USB host controllers that would be
+ available, both physical and virtual (for instance, those
+ used by USB/IP).
+
config USB_PCI
bool "PCI based USB host interface"
depends on PCI
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index fc32391a34d5..e1589e950b86 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -83,7 +83,7 @@ DEFINE_IDR (usb_bus_idr);
EXPORT_SYMBOL_GPL (usb_bus_idr);
/* used when allocating bus numbers */
-#define USB_MAXBUS 64
+#define USB_MAXBUS CONFIG_USB_MAXBUS
/* used when updating list of hcds */
DEFINE_MUTEX(usb_bus_idr_lock); /* exported only for usbfs */
diff --git a/drivers/usb/usbip/Kconfig b/drivers/usb/usbip/Kconfig
index eeefa29f8aa2..cb87bec9dbbb 100644
--- a/drivers/usb/usbip/Kconfig
+++ b/drivers/usb/usbip/Kconfig
@@ -37,7 +37,7 @@ config USBIP_VHCI_HC_PORTS
config USBIP_VHCI_NR_HCS
int "Number of USB/IP virtual host controllers"
- range 1 128
+ range 1 2048
default 1
depends on USBIP_VHCI_HCD
---help---
@@ -46,6 +46,9 @@ config USBIP_VHCI_NR_HCS
virtual host controllers as if adding physical host
controllers.
+ Note that the number of host controllers is also limited by
+ USB_MAXBUS.
+
config USBIP_HOST
tristate "Host driver"
depends on USBIP_CORE && USB
--
2.14.1