usbip: vhci-hcd: Add USB3 SuperSpeed support

This patch adds a USB3 HCD to an existing USB2 HCD and provides
the support of SuperSpeed, in case the device can only be enumerated
with SuperSpeed.

The bulk of the added code in usb3_bos_desc and hub_control to support
SuperSpeed is borrowed from the commit 1cd8fd2887 ("usb: gadget:
dummy_hcd: add SuperSpeed support").

With this patch, each vhci will have VHCI_HC_PORTS HighSpeed ports
and VHCI_HC_PORTS SuperSpeed ports.

Suggested-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Signed-off-by: Yuyang Du <yuyang.du@intel.com>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Yuyang Du
2017-06-08 13:04:10 +08:00
committed by Greg Kroah-Hartman
parent 03cd00d538
commit 1c9de5bf42
6 changed files with 369 additions and 102 deletions

View File

@@ -52,9 +52,10 @@ static int parse_status(const char *value)
unsigned long socket;
char lbusid[SYSFS_BUS_ID_SIZE];
struct usbip_imported_device *idev;
char hub[3];
ret = sscanf(c, "%d %d %d %x %lx %31s\n",
&port, &status, &speed,
ret = sscanf(c, "%2s %d %d %d %x %lx %31s\n",
hub, &port, &status, &speed,
&devid, &socket, lbusid);
if (ret < 5) {
@@ -62,15 +63,19 @@ static int parse_status(const char *value)
BUG();
}
dbg("port %d status %d speed %d devid %x",
port, status, speed, devid);
dbg("hub %s port %d status %d speed %d devid %x",
hub, port, status, speed, devid);
dbg("socket %lx lbusid %s", socket, lbusid);
/* if a device is connected, look at it */
idev = &vhci_driver->idev[port];
memset(idev, 0, sizeof(*idev));
if (strncmp("hs", hub, 2) == 0)
idev->hub = HUB_SPEED_HIGH;
else /* strncmp("ss", hub, 2) == 0 */
idev->hub = HUB_SPEED_SUPER;
idev->port = port;
idev->status = status;
@@ -320,11 +325,15 @@ err:
}
int usbip_vhci_get_free_port(void)
int usbip_vhci_get_free_port(uint32_t speed)
{
for (int i = 0; i < vhci_driver->nports; i++) {
if (speed == USB_SPEED_SUPER &&
vhci_driver->idev[i].hub != HUB_SPEED_SUPER)
continue;
if (vhci_driver->idev[i].status == VDEV_ST_NULL)
return i;
return vhci_driver->idev[i].port;
}
return -1;