Re: [RFC] raise the maximum number of usb-serial devices to 512

2013-06-04 Thread Tobias Winter
On 04.06.2013 04:49, Greg KH wrote:
> Tobias, can you test this patch out?  Note, I only compiled it, did not
> get the chance to actually run it, so it might not work at all.

Sure, I'll gladly give it a try. Seeing the comments on the code, I'm
just wondering if there might be a more recent version to run?

> But I'm not so sure anymore, so here's a patch to change to use the
> idr code, and should remove all minor number limitations (well 65k is
> the limit the tty core should be setting I think.)

That's a tough one to break :)

Tobias
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] Increase the number of USB to serial devices we can support at once

2013-06-06 Thread Tobias Winter
Hi Greg,

On 06/05/2013 07:54 PM, Greg KH wrote:
> Here are 3 patches that I've tested out on my system with only a small
> number of devices, but it seems to work, so why not let others try it
> out...

It compiles and runs without any errors. My current setup has 272 ftdi
devices connected:

rescue on 172.18.24.141:/dev$ uname -a
Linux bigrescue 3.10.0-rc3+ #1 SMP Thu Jun 6 12:21:06 CEST 2013 x86_64
GNU/Linux
rescue on 172.18.24.141:/dev$ dmesg | tail -n 15
[ 3361.898725] usb 3-1.4.4: usb_probe_device
[ 3361.898750] usb 3-1.4.4: configuration #1 chosen from 1 choice
[ 3361.901598] usb 3-1.4.4: adding 3-1.4.4:1.0 (config #1, interface 0)
[ 3361.906802] ftdi_sio 3-1.4.4:1.0: usb_probe_interface
[ 3361.906830] ftdi_sio 3-1.4.4:1.0: usb_probe_interface - got id
[ 3361.906875] ftdi_sio 3-1.4.4:1.0: FTDI USB Serial Device converter
detected
[ 3361.932490] usb 3-1.4.4: Detected FT232RL
[ 3361.952189] usb 3-1.4.4: Number of endpoints 2
[ 3361.972791] usb 3-1.4.4: Endpoint 1 MaxPacketSize 64
[ 3361.994656] usb 3-1.4.4: Endpoint 2 MaxPacketSize 64
[ 3362.016309] usb 3-1.4.4: Setting MaxPacketSize 64
[ 3362.039764] usb 3-1.4.4: FTDI USB Serial Device converter now
attached to ttyUSB271
[ 3362.075248] hub 3-1.2:1.0: state 7 ports 4 chg  evt 0010
[ 3362.075676] hub 3-1.3:1.0: state 7 ports 4 chg  evt 0010
[ 3362.076659] hub 3-1.4:1.0: state 7 ports 4 chg  evt 0010

Sadly I only have FTDI single port interfaces and am therefore unable to
test with other devices.

Thanks for the effort!

Tobias
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] Increase the number of USB to serial devices we can support at once

2013-06-06 Thread Tobias Winter
On 06.06.2013 17:21, Greg KH wrote:
> On Thu, Jun 06, 2013 at 11:01:12AM -0400, Dave Jones wrote:
>> On Wed, Jun 05, 2013 at 10:54:26AM -0700, Greg KH wrote:
>>  > These patches make the USB to serial core have the ability to support up
>>  > to 3000 devices at once now.  
>>
>> I'm curious how this works. What systems have 3000 usb ports ?
Surely no one thought that a system could have 255 devices of that sort
~15 years ago. Isn't the idea always to support more that what is possible?
>> Or are there some kind of multiplexer devices out there ?
>> (If so, I'd like a link, I could use one of those).
> 
> You don't need a multiplexer, you can have a bunch of different USB root
> hubs in PCI slots, with USB hubs plugged into them, and lots of
> multi-port USB devices connected to them.  Tobias has such a system with
> 272 single-port USB to serial devices connected, so it's not impossible
> to create.
Correct. Since you can only have 127 devices on a single USB root-hub,
the trick is to spread the devices over many root-hubs. Most mainboards
already come with 3-5 root-hubs on-board and you of course can expand
that via pci/pcie cards, but be warned, for reasons beyond my
imagination, the XHCI specification lets the root-hub vendor decice on
how many devices it can support, so you could end up having XHCI
root-hubs that support lets say 20 devices.

> In thinking about it some more, I'll change that number to 500 for now,
> as it's a static array within the tty layer, and then work on making
> that dynamic so we don't have any limitations other than the number of
> minor numbers for a single major.
I also thought about it and I'd say 512 devices is about as high as I
would go in any real-world application, otherwise the fallout of a
broken system is slowly getting to big, depending on what you do over
the serial ports. Also 512 is a nice number. ;)

Tobias

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/3] Increase the number of USB to serial devices we can support at once

2013-06-06 Thread Tobias Winter
Hey Greg,

I patched it two times to be safe, but I can't seem to get it to compile.

  CC  drivers/usb/serial/console.o
drivers/usb/serial/console.c: In function ‘usb_console_setup’:
drivers/usb/serial/console.c:111:2: error: implicit declaration of
function ‘usb_serial_get_by_index’ [-Werror=implicit-function-declaration]
drivers/usb/serial/console.c:111:9: warning: assignment makes pointer
from integer without a cast [enabled by default]
drivers/usb/serial/console.c:122:40: error: ‘struct usb_serial’ has no
member named ‘minor’
cc1: some warnings being treated as errors
make[4]: *** [drivers/usb/serial/console.o] Error 1
make[3]: *** [drivers/usb/serial] Error 2
make[2]: *** [drivers/usb] Error 2
make[1]: *** [drivers] Error 2
make[1]: Leaving directory `/root/usb.git'
make: *** [debian/stamp/build/kernel] Error 2

thanks

Tobias



signature.asc
Description: OpenPGP digital signature


Re: [PATCH v2 0/3] Increase the number of USB to serial devices we can support at once

2013-06-07 Thread Tobias Winter
On 06/07/2013 08:00 AM, Tobias Winter wrote:
>   CC  drivers/usb/serial/console.o
> drivers/usb/serial/console.c: In function ‘usb_console_setup’:
> drivers/usb/serial/console.c:111:2: error: implicit declaration of
> function ‘usb_serial_get_by_index’ [-Werror=implicit-function-declaration]
> drivers/usb/serial/console.c:111:9: warning: assignment makes pointer
> from integer without a cast [enabled by default]
> drivers/usb/serial/console.c:122:40: error: ‘struct usb_serial’ has no
> member named ‘minor’
> cc1: some warnings being treated as errors
> make[4]: *** [drivers/usb/serial/console.o] Error 1
> make[3]: *** [drivers/usb/serial] Error 2
> make[2]: *** [drivers/usb] Error 2
> make[1]: *** [drivers] Error 2
> make[1]: Leaving directory `/root/usb.git'
> make: *** [debian/stamp/build/kernel] Error 2

Despite that broken driver, I just gave it a try and the patchset works
as expected.

Thanks

Tobias
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/3] Increase the number of USB to serial devices we can support at once

2013-06-08 Thread Tobias Winter
On 06/07/2013 07:25 PM, Greg KH wrote:
> On Fri, Jun 07, 2013 at 11:55:59AM +0200, Tobias Winter wrote:
>> On 06/07/2013 08:00 AM, Tobias Winter wrote:
>>>   CC  drivers/usb/serial/console.o
>>> drivers/usb/serial/console.c: In function ‘usb_console_setup’:
>>> drivers/usb/serial/console.c:111:2: error: implicit declaration of
>>> function ‘usb_serial_get_by_index’ [-Werror=implicit-function-declaration]
>>> drivers/usb/serial/console.c:111:9: warning: assignment makes pointer
>>> from integer without a cast [enabled by default]
>>> drivers/usb/serial/console.c:122:40: error: ‘struct usb_serial’ has no
>>> member named ‘minor’
>>> cc1: some warnings being treated as errors
>>> make[4]: *** [drivers/usb/serial/console.o] Error 1
>>> make[3]: *** [drivers/usb/serial] Error 2
>>> make[2]: *** [drivers/usb] Error 2
>>> make[1]: *** [drivers] Error 2
>>> make[1]: Leaving directory `/root/usb.git'
>>> make: *** [debian/stamp/build/kernel] Error 2
>>
>> Despite that broken driver, I just gave it a try and the patchset works
>> as expected.
> 
> Thanks for testing, I forgot to update the console code, as no one sane
> every runs it :)
> 
> I'll go fix that up now...
I just retested it and it works as expected.

Thanks, Greg!

Tobias



signature.asc
Description: OpenPGP digital signature


[PATCH] Raise the maximum number of usb-serial devices to 256

2013-05-27 Thread Tobias Winter
Raise the maximum number of usb-serial devices to 256, which is the
actual limit supported by the codebase.

Signed-off-by: Jakob-Tobias Winter 
Tested-by: Jakob-Tobias Winter 

---
 include/linux/usb/serial.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 302ddf5..c0ce5ed 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -20,7 +20,7 @@
 #include 

 #define SERIAL_TTY_MAJOR   188 /* Nice legal number now */
-#define SERIAL_TTY_MINORS  254 /* loads of devices :) */
+#define SERIAL_TTY_MINORS  256 /* loads of devices :) */
 #define SERIAL_TTY_NO_MINOR255 /* No minor was assigned */

 /* The maximum number of ports one device can grab at once */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] raise the maximum number of usb-serial devices to 512

2013-05-27 Thread Tobias Winter
Hi,

I did a bit more fiddling with the usb-serial stack and got it to
support more than 256 devices. I tested it with up to 281 FTDI
singleport adapters. (After that i ran out of usb cables.. )

Signed-off-by: Jakob-Tobias Winter 
---
 include/linux/usb/serial.h |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 302ddf5..ab5e01b 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -20,7 +20,7 @@
 #include 

 #define SERIAL_TTY_MAJOR   188 /* Nice legal number now */
-#define SERIAL_TTY_MINORS  254 /* loads of devices :) */
+#define SERIAL_TTY_MINORS  512 /* loads of devices :) */
 #define SERIAL_TTY_NO_MINOR255 /* No minor was assigned */

 /* The maximum number of ports one device can grab at once */
@@ -80,7 +80,7 @@ struct usb_serial_port {
struct usb_serial   *serial;
struct tty_port port;
spinlock_t  lock;
-   unsigned char   number;
+   unsigned short  number;

unsigned char   *interrupt_in_buffer;
struct urb  *interrupt_in_urb;
@@ -159,7 +159,7 @@ struct usb_serial {
unsigned char   disconnected:1;
unsigned char   suspending:1;
unsigned char   attached:1;
-   unsigned char   minor;
+   unsigned short  minor;
unsigned char   num_ports;
unsigned char   num_port_pointers;
charnum_interrupt_in;
-- 
1.7.10.4


To avoid possible regressions, I also modified a few drivers:

Signed-off-by: Jakob-Tobias Winter 
---
 drivers/usb/serial/io_edgeport.c |2 +-
 drivers/usb/serial/mos7720.c |2 +-
 drivers/usb/serial/mos7840.c |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/serial/io_edgeport.c
b/drivers/usb/serial/io_edgeport.c
index 1477e85..eac8641 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2266,7 +2266,7 @@ static int send_cmd_write_baud_rate(struct
edgeport_port *edge_port,
int cmdLen = 0;
int divisor;
int status;
-   unsigned char number =
+   unsigned short number =
edge_port->port->number - edge_port->port->serial->minor;

if (edge_serial->is_epic &&
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index cc0e543..81cbc84 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1468,7 +1468,7 @@ static int send_cmd_write_baud_rate(struct
moschip_port *mos7720_port,
struct usb_serial *serial;
int divisor;
int status;
-   unsigned char number;
+   unsigned short number;

if (mos7720_port == NULL)
return -1;
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index a0d5ea5..2d62efb 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1718,7 +1718,7 @@ static int mos7840_send_cmd_write_baud_rate(struct
moschip_port *mos7840_port,
int divisor = 0;
int status;
__u16 Data;
-   unsigned char number;
+   unsigned short number;
__u16 clk_sel_val;
struct usb_serial_port *port;

-- 
1.7.10.4

But since I don't have those types of hardware, I can't test it. Also
I'm not sure if I took everything that can break into account as I don't
have any kernel coding experience.

To whom it may concern, here is the kern.log
http://linuxdingsda.de/~wintix/kern.log

and again the output of `lsusb | sort`, now with up to 127 devices on a
single USB root hub:

http://de.pastebin.ca/2383084

Thanks,

Tobias

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html