Re: usbip port number limits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>On 11/29/2017 07:25 PM, Yuyang Du wrote:
>> Hi Shuah,
>> 
>> On Tue, Nov 28, 2017 at 05:09:18PM -0700, Shuah Khan wrote:
>>> On 11/28/2017 11:32 AM, Shuah Khan wrote:
>>>> On 11/26/2017 06:33 PM, Yuyang Du wrote:
>>>>> Hi Juan,
>>>>>
>>>>> On Fri, Nov 24, 2017 at 12:42:22PM +0100, Juan Zea wrote:
>>>>>>    The patch doesn't apply cleanly with the patch command, but given it is that simple I've changed it myself (I'm telling you just in case we're missing something).
>>>>>>
>>>>>>    The fingerprint reader, usb stick and wacom tablet work :)
>>>>>  
>>>>> Good to hear that.
>>>>>
>>>>>> I've also checked the same patch can be applied to kernel master and it works. So... is that the solution?
>>>>>
>>>>> I'll post a patch later, but before that, Hi, Shuah, does it work
>>>>> for you, on your test notebook?
>>>>>
>>>>
>>>> I am going to test this today and if it is fixes the problem on
>>>> my system.
>>>>
>>>
>>> Hi Yuyang,
>>>
>>> I tried the patch on 4.15-rc1 and looks good to me. Please send a
>>> proper patch to fix this. It need to go into 4.14 stable for sure.
>>  
>> Thank you so much.
>> 
>>> There are no more 4.13 stable releases at this time. So let's get
>>> this into 4.15 first and them go from there.
>>  
>> Sounds good.
>> 
>>> I am working on a patch for the other issue Juan reported that prevents
>>> finding a free-port when the first port is usb3. You don't have to worry
>>> about that.
>> 
>> Great you take care of it.
>> 
>> Hi Juan,
>> 
>> Maybe you close the bug: https://bugzilla.kernel.org/show_bug.cgi?id=197867
>> 
>
>We have to wait for the fixes to get into the release for the bug to be closed.
>I wasn't sure if you will be able get the patch out soon, I worked on the driver
>patch as well with you as the Suggested-by: haven't sent it yet waiting to see
>if you can get this done. I can either send this out or wait for you get a patch
>out. Ether way is fine with me.

Hi everyone,

   Everything seems right :) Thank you for solving the problems. Now that the bugs are done with, I'd like to propose the following patch to the usbip tool.
As per my original mail to this list, the first problem I was facing was incrementing the number of devices that can be connected to a host. Using your patches,
the next problem I faced are limitations in the original design, which doesn't take into account anyone trying to connect so many devices :). With this patch, I solve
two limitations:
- vhci_driver counts number of ports with uint8_t , which limits to 255. 
- MAXNPORT at tools -> Given the number of controllers that can be connected (63), and max number of ports per controller (31), I get up to 1953 ports, so 128 is too limiting.

With this patch, I get to those 1953 ports, and in my tests, I could connect up to 930 devices to one host. My test machines just couldn't start more kvm machines to test bigger numbers, 
but the vhci host was stable and could make use of those devices.


diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c
index 3d8189b..011d8f6 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -330,7 +330,7 @@ int usbip_vhci_get_free_port(void)
 	return -1;
 }
 
-int usbip_vhci_attach_device2(uint8_t port, int sockfd, uint32_t devid,
+int usbip_vhci_attach_device2(int port, int sockfd, uint32_t devid,
 		uint32_t speed) {
 	char buff[200]; /* what size should be ? */
 	char attach_attr_path[SYSFS_PATH_MAX];
@@ -364,7 +364,7 @@ static unsigned long get_devid(uint8_t busnum, uint8_t devnum)
 }
 
 /* will be removed */
-int usbip_vhci_attach_device(uint8_t port, int sockfd, uint8_t busnum,
+int usbip_vhci_attach_device(int port, int sockfd, uint8_t busnum,
 		uint8_t devnum, uint32_t speed)
 {
 	int devid = get_devid(busnum, devnum);
@@ -372,7 +372,7 @@ int usbip_vhci_attach_device(uint8_t port, int sockfd, uint8_t busnum,
 	return usbip_vhci_attach_device2(port, sockfd, devid, speed);
 }
 
-int usbip_vhci_detach_device(uint8_t port)
+int usbip_vhci_detach_device(int port)
 {
 	char detach_attr_path[SYSFS_PATH_MAX];
 	char attr_detach[] = "detach";
diff --git a/tools/usb/usbip/libsrc/vhci_driver.h b/tools/usb/usbip/libsrc/vhci_driver.h
index dfe19c1..96fa738 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.h
+++ b/tools/usb/usbip/libsrc/vhci_driver.h
@@ -12,10 +12,10 @@
 
 #define USBIP_VHCI_BUS_TYPE "platform"
 #define USBIP_VHCI_DEVICE_NAME "vhci_hcd.0"
-#define MAXNPORT 128
+#define MAXNPORT 2000
 
 struct usbip_imported_device {
-	uint8_t port;
+	int port;
 	uint32_t status;
 
 	uint32_t devid;
@@ -47,14 +47,14 @@ int  usbip_vhci_refresh_device_list(void);
 
 
 int usbip_vhci_get_free_port(void);
-int usbip_vhci_attach_device2(uint8_t port, int sockfd, uint32_t devid,
+int usbip_vhci_attach_device2(int port, int sockfd, uint32_t devid,
 		uint32_t speed);
 
 /* will be removed */
-int usbip_vhci_attach_device(uint8_t port, int sockfd, uint8_t busnum,
+int usbip_vhci_attach_device(int port, int sockfd, uint8_t busnum,
 		uint8_t devnum, uint32_t speed);
 
-int usbip_vhci_detach_device(uint8_t port);
+int usbip_vhci_detach_device(int port);
 
 int usbip_vhci_imported_device_dump(struct usbip_imported_device *idev);
 
diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
index 9db9d21..a272e0c 100644
--- a/tools/usb/usbip/src/usbip_detach.c
+++ b/tools/usb/usbip/src/usbip_detach.c
@@ -44,7 +44,7 @@ void usbip_detach_usage(void)
 static int detach_port(char *port)
 {
 	int ret;
-	uint8_t portnum;
+	int portnum;
 	char path[PATH_MAX+1];
 
 	unsigned int port_len = strlen(port);


Regards,
Juan


Juan Antonio Zea Herranz 
Proyectos y consultoría | Qindel Group 
E: juan.zea@xxxxxxxxxx 
T: +34 91 766 24 21 
M: +34 637 74 63 09 
W: qindel.com 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux