Bug#891036: The problem is related to the number of ports created in vhci_hcd.0

2018-02-22 Thread wzabo...@elektron.elka.pw.edu.pl
In fact I don't understand how the vhci_hcd is supposed to work.

The constants are defined as follows:
https://elixir.bootlin.com/linux/v4.15.4/source/drivers/usb/usbip/vhci.h#L75

/* Number of supported ports. Value has an upperbound of USB_MAXCHILDREN */
#ifdef CONFIG_USBIP_VHCI_HC_PORTS
#define VHCI_HC_PORTS CONFIG_USBIP_VHCI_HC_PORTS
#else
#define VHCI_HC_PORTS 8
#endif

/* Each VHCI has 2 hubs (USB2 and USB3), each has VHCI_HC_PORTS ports */
#define VHCI_PORTS    (VHCI_HC_PORTS*2)

#ifdef CONFIG_USBIP_VHCI_NR_HCS
#define VHCI_NR_HCS CONFIG_USBIP_VHCI_NR_HCS
#else
#define VHCI_NR_HCS 1
#endif

#define MAX_STATUS_NAME 16

Then in the line
https://elixir.bootlin.com/linux/v4.15.4/source/drivers/usb/usbip/vhci_hcd.c#L46
we can see:

int vhci_num_controllers = VHCI_NR_HCS;

But, when I have unpacked the sources of the Debian kernel:

("apt source usbip" downloads and unpacks the kernel sources)

In the debian/config/config I can see:

CONFIG_USBIP_CORE=m
CONFIG_USBIP_VHCI_HCD=m
CONFIG_USBIP_VHCI_HC_PORTS=15
CONFIG_USBIP_VHCI_NR_HCS=8
CONFIG_USBIP_HOST=m

So the number of created controllers is equal to 8, and for each
controller there are 30 ports created (2 * 15)

That results in 240 ports, that is above the MAXNPORT number defined in

https://elixir.bootlin.com/linux/v4.15.4/source/tools/usb/usbip/libsrc/vhci_driver.h#L16
#define MAXNPORT 128

To obtain the working configuration it is necessary either to increase
the MAXNPORT to 240 or even to 256 or to decrease the
CONFIG_USBIP_VHCI_NR_HCS to 4


-- 
Wojciech M Zabolotny, PhD
Institute of Electronic Systems
Faculty of Electronics and Information Technology
Warsaw University of Technology



Bug#891036: The problem is related to the number of ports created in vhci_hcd.0

2018-02-22 Thread wzabo...@elektron.elka.pw.edu.pl
On the system where I have installed the 4.15.xxx kernel and usbip from
Debian/sid, I get the following results from "usbip --debug port":

[...]
usbip: debug: names.c:428:[parse] line 18068 subclass fe:02 IRDA Bridge
usbip: debug: names.c:428:[parse] line 18069 subclass fe:03 Test and
Measurement
usbip: debug: names.c:461:[parse] line 18070 protocol fe:03:01 TMC
usbip: debug: names.c:461:[parse] line 18071 protocol fe:03:02 USB488
usbip: debug: names.c:374:[parse] line 18072 class ff Vendor Specific Class
usbip: debug: names.c:428:[parse] line 18073 subclass ff:ff Vendor
Specific Subclass
usbip: debug: names.c:461:[parse] line 18074 protocol ff:ff:ff Vendor
Specific Protocol
libusbip: debug: vhci_driver.c:264:[usbip_vhci_driver_open] available
ports: 240
libusbip: error: port number exceeds 128
usbip: error: open vhci_driver
usbip: error: list imported devices

The line where the condition is checked is
https://elixir.bootlin.com/linux/v4.15.4/source/tools/usb/usbip/libsrc/vhci_driver.c#L263

vhci_driver
->nports = 
get_nports ();
dbg ("available
ports: %d", vhci_driver
->nports);

if (vhci_driver
->nports <= 0) {
err("no available ports");
goto err;
} else if (vhci_driver
->nports > MAXNPORT 
) {
err("port number exceeds %d", MAXNPORT 
);
goto err;
}

Maybe the viable workaround would be just to increase the MAXNPORT number?

-- 

Wojciech M Zabolotny, PhD
Institute of Electronic Systems
Faculty of Electronics and Information Technology
Warsaw University of Technology



Bug#891036: The problem is related to the number of ports created in vhci_hcd.0

2018-02-22 Thread Wojtek Zabolotny

When I load the vhci-hcd driver in version 4.14, and then run "usbip --debug 
port", I get:

[...]
usbip: debug: names.c:428:[parse] line 18067 subclass fe:01 Device Firmware 
Update
usbip: debug: names.c:428:[parse] line 18068 subclass fe:02 IRDA Bridge
usbip: debug: names.c:428:[parse] line 18069 subclass fe:03 Test and Measurement
usbip: debug: names.c:461:[parse] line 18070 protocol fe:03:01 TMC
usbip: debug: names.c:461:[parse] line 18071 protocol fe:03:02 USB488
usbip: debug: names.c:374:[parse] line 18072 class ff Vendor Specific Class
usbip: debug: names.c:428:[parse] line 18073 subclass ff:ff Vendor Specific 
Subclass
usbip: debug: names.c:461:[parse] line 18074 protocol ff:ff:ff Vendor Specific 
Protocol
libusbip: debug: vhci_driver.c:264:[usbip_vhci_driver_open] available ports: 496
libusbip: error: port number exceeds 128
usbip: error: open vhci_driver
usbip: error: list imported devices

When i check /sys/devices/platform/vhci_hcd.0/nports it indeed contains 496 .
In other /sys/devices/platform/vhci_hcd.* directories there is no nports 
attribute at all.

--
Wojciech M Zabolotny, PhD
Institute of Electronic Systems
Faculty of Electronics and Information Technology
Warsaw University of Technology