From: Martin V. <mva...@ca...> - 2004-06-10 20:25:46
|
Hi I'm a new Linux guy that have to develop tool of test for USB Device. The LibUSB is very useful .. thank's a lot! Let's go directly to my question. From the libusb 0.1.8, I found in the linux.c that the maximum size of data to transfer is presently to 4KB. /* Linux usbdevfs has a limit of one page size per read/write. 4096 is */ /* the most portable maximum we can do for now */ #define MAX_READ_WRITE 4096 QUESTION : This seems to slow down a lot the transfer rate . Is there already a fixed or a solution to speed up this? Thank you very much. Martin |
From: Peter S. <stu...@cd...> - 2004-06-14 17:15:46
|
On Thu, Jun 10, 2004 at 04:25:37PM -0400, Martin Vaillancourt wrote: > #define MAX_READ_WRITE 4096 > > QUESTION : This seems to slow down a lot the transfer rate . Is > there already a fixed or a solution to speed up this? I believe you should just use larger buffers in your application and libusb and/or the kernel will handle it all well. My guess is that 4KB is just the size libusb uses to communicate with the kernel, but if libusb knows you want to transfer more, it will do so efficiently. Please correct me if I'm wrong. :) //Peter |
From: Johannes E. <joh...@er...> - 2004-06-14 18:08:48
|
On Sat, Jun 12, 2004, Peter Stuge <stu...@cd...> wrote: > On Thu, Jun 10, 2004 at 04:25:37PM -0400, Martin Vaillancourt wrote: > > #define MAX_READ_WRITE 4096 > > > > QUESTION : This seems to slow down a lot the transfer rate . Is > > there already a fixed or a solution to speed up this? > > I believe you should just use larger buffers in your application > and libusb and/or the kernel will handle it all well. > > My guess is that 4KB is just the size libusb uses to communicate > with the kernel, but if libusb knows you want to transfer more, > it will do so efficiently. Please correct me if I'm wrong. :) It will handle any size transfer, but it won't be efficient. Some people have had problems with 4KB transfer sizes and getting the maximum amount of bandwidth out of USB 2.0 devices. One thing we can do in libusb is submit using URBs instead of using the bulk call. That is the difference between 16k buffers and 4k buffers, so we should be able to get a 4x improvement in performance that way. But ultimately, we'll need to make some modifications to the Linux kernel to handle bigger buffers. I'll implement the libusb change ASAP. JE |
From: Martin V. <mva...@ca...> - 2004-06-14 19:15:14
|
Hi, Effectively, it handles any size transfer, but it is not efficient :( So the kernel is really part of the problem. I have built the linux 2.4.18 -rmk6, but I don't see anything about the size limitation of 4KB of the file system. Question#1: Do you know what to change exactly into the kernel? Do you think that I should jump with a kernel that handle usb2.0. (My platform is usb1.1 presently). Question#2: (if the #1 is not possible ...) You also tell me to use the URBs instead of the bulk call? I'm not pretty certain to understand exactly. (English limitation and/or usb expertise limitation). I do not see any URBs function? I was assuming the the usb_bulk_read or usb_bulk_write commands were handling this? Here what I'm doing exactly to write data, maybe that you will be able to tell me what to change :) Step1- I'm building the CBW Bloc Command of 31Bytes. (Command Op 2Ah to write data) Step2-I'm using usb_bulk_write() to send the CBW. Step3-I'm using the usb_bulk_write() to send also my data( 512Bytes, upto 1MB). It's here that the limitation of 4KB slow down my test. (I'm testing Flash device) Step4-I'm reading the CSW with usb_bulk_read(); NB:To readback the data write on my UnitUnderTest, I'm using the command op 28h). Those commands are working, but it should be much faster!(I run comparison transfer rate test under window2000 and windows XP). I'm waiting respond from you to know if it will be possible for me to fix this issue soon or if I will have to wait a few weeks (months) Thank you very much! Martin -----Original Message----- From: lib...@li... [mailto:lib...@li...] On Behalf Of Johannes Erdfelt Sent: Monday, June 14, 2004 2:09 PM To: lib...@li... Subject: Re: [Libusb-devel] MAX_READ_WRITE On Sat, Jun 12, 2004, Peter Stuge <stu...@cd...> wrote: > On Thu, Jun 10, 2004 at 04:25:37PM -0400, Martin Vaillancourt wrote: > > #define MAX_READ_WRITE 4096 > > > > QUESTION : This seems to slow down a lot the transfer rate . Is > > there already a fixed or a solution to speed up this? > > I believe you should just use larger buffers in your application > and libusb and/or the kernel will handle it all well. > > My guess is that 4KB is just the size libusb uses to communicate > with the kernel, but if libusb knows you want to transfer more, > it will do so efficiently. Please correct me if I'm wrong. :) It will handle any size transfer, but it won't be efficient. Some people have had problems with 4KB transfer sizes and getting the maximum amount of bandwidth out of USB 2.0 devices. One thing we can do in libusb is submit using URBs instead of using the bulk call. That is the difference between 16k buffers and 4k buffers, so we should be able to get a 4x improvement in performance that way. But ultimately, we'll need to make some modifications to the Linux kernel to handle bigger buffers. I'll implement the libusb change ASAP. JE ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Libusb-devel mailing list Lib...@li... https://lists.sourceforge.net/lists/listinfo/libusb-devel |
From: Johannes E. <joh...@er...> - 2004-06-14 20:00:04
|
The change to an URB interface was something that should be done in libusb, not in the application. I've changed usb_bulk_write and usb_bulk_read to use the URB interface in CVS. Can you check out the CVS code and see if you get an increase in performance? I haven't checked recently, but sourceforge did have a delay updating the anonymous CVS repositories, so make sure you have revision 1.58 of linux.c. JE On Mon, Jun 14, 2004, Martin Vaillancourt <mva...@ca...> wrote: > Effectively, it handles any size transfer, but it is not efficient :( > > So the kernel is really part of the problem. > I have built the linux 2.4.18 -rmk6, but I don't see anything about the > size limitation of 4KB of the file system. > Question#1: > Do you know what to change exactly into the kernel? > Do you think that I should jump with a kernel that handle > usb2.0. (My platform is usb1.1 presently). > > Question#2: (if the #1 is not possible ...) > You also tell me to use the URBs instead of the bulk call? > I'm not pretty certain to understand exactly. (English limitation and/or > usb expertise limitation). I do not see any URBs function? I was > assuming the the usb_bulk_read or usb_bulk_write commands were handling > this? > Here what I'm doing exactly to write data, maybe that you will be able > to tell me what to change :) > > Step1- I'm building the CBW Bloc Command of 31Bytes. (Command Op 2Ah to > write data) > Step2-I'm using usb_bulk_write() to send the CBW. > Step3-I'm using the usb_bulk_write() to send also my data( 512Bytes, > upto 1MB). It's here that the limitation of 4KB slow down my test. (I'm > testing Flash device) > Step4-I'm reading the CSW with usb_bulk_read(); > > NB:To readback the data write on my UnitUnderTest, I'm using the command > op 28h). > > Those commands are working, but it should be much faster!(I run > comparison transfer rate test under window2000 and windows XP). I'm > waiting respond from you to know if it will be possible for me to fix > this issue soon or if I will have to wait a few weeks (months) > > Thank you very much! > Martin > > > > > -----Original Message----- > From: lib...@li... > [mailto:lib...@li...] On Behalf Of Johannes > Erdfelt > Sent: Monday, June 14, 2004 2:09 PM > To: lib...@li... > Subject: Re: [Libusb-devel] MAX_READ_WRITE > > On Sat, Jun 12, 2004, Peter Stuge <stu...@cd...> wrote: > > On Thu, Jun 10, 2004 at 04:25:37PM -0400, Martin Vaillancourt wrote: > > > #define MAX_READ_WRITE 4096 > > > > > > QUESTION : This seems to slow down a lot the transfer rate . Is > > > there already a fixed or a solution to speed up this? > > > > I believe you should just use larger buffers in your application > > and libusb and/or the kernel will handle it all well. > > > > My guess is that 4KB is just the size libusb uses to communicate > > with the kernel, but if libusb knows you want to transfer more, > > it will do so efficiently. Please correct me if I'm wrong. :) > > It will handle any size transfer, but it won't be efficient. > > Some people have had problems with 4KB transfer sizes and getting the > maximum amount of bandwidth out of USB 2.0 devices. > > One thing we can do in libusb is submit using URBs instead of using the > bulk call. That is the difference between 16k buffers and 4k buffers, so > we should be able to get a 4x improvement in performance that way. > > But ultimately, we'll need to make some modifications to the Linux > kernel to handle bigger buffers. > > I'll implement the libusb change ASAP. > > JE > > > > ------------------------------------------------------- > This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference > Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer > Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA > REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND > _______________________________________________ > Libusb-devel mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libusb-devel > > > > ------------------------------------------------------- > This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference > Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer > Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA > REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND > _______________________________________________ > Libusb-devel mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libusb-devel > |
From: Martin V. <mva...@ca...> - 2004-06-14 21:51:00
|
Hi, 1-I do not have CVS now. If it is possible to Zip Libusb files and send it by email, I will appreciate! 2-I need to understand :) I run a Cypress Evaluation board CY3663 with the linux 2.4.18. I compile a small application of test which I add the libusb files. I named it USBTEST. It comes from the HWTEST Cypress application. That is the reason why I call it my application and not the kernel. So for me the application and the Libusb are together. Now, I don't really understand the limitation of 4KB? Is it coming from: a-The linux kernel 2.4.18? (Do I need to update to a recent one?) b-The Libusb files revision 0.1.8? c-The Host Controller on my evaluation board? d-A combinason of a,b,c; I try to solve this and understand the issue because for us it is a huge issue to be so slow. I cannot see why under a Linux platform is slower than a Windows one? Thank you very much for your fast response, I really appreciate it! Martin -----Original Message----- From: Johannes Erdfelt [mailto:joh...@er...] Sent: Monday, June 14, 2004 4:00 PM To: Martin Vaillancourt Cc: lib...@li... Subject: Re: [Libusb-devel] MAX_READ_WRITE The change to an URB interface was something that should be done in libusb, not in the application. I've changed usb_bulk_write and usb_bulk_read to use the URB interface in CVS. Can you check out the CVS code and see if you get an increase in performance? I haven't checked recently, but sourceforge did have a delay updating the anonymous CVS repositories, so make sure you have revision 1.58 of linux.c. JE On Mon, Jun 14, 2004, Martin Vaillancourt <mva...@ca...> wrote: > Effectively, it handles any size transfer, but it is not efficient :( > > So the kernel is really part of the problem. > I have built the linux 2.4.18 -rmk6, but I don't see anything about the > size limitation of 4KB of the file system. > Question#1: > Do you know what to change exactly into the kernel? > Do you think that I should jump with a kernel that handle > usb2.0. (My platform is usb1.1 presently). > > Question#2: (if the #1 is not possible ...) > You also tell me to use the URBs instead of the bulk call? > I'm not pretty certain to understand exactly. (English limitation and/or > usb expertise limitation). I do not see any URBs function? I was > assuming the the usb_bulk_read or usb_bulk_write commands were handling > this? > Here what I'm doing exactly to write data, maybe that you will be able > to tell me what to change :) > > Step1- I'm building the CBW Bloc Command of 31Bytes. (Command Op 2Ah to > write data) > Step2-I'm using usb_bulk_write() to send the CBW. > Step3-I'm using the usb_bulk_write() to send also my data( 512Bytes, > upto 1MB). It's here that the limitation of 4KB slow down my test. (I'm > testing Flash device) > Step4-I'm reading the CSW with usb_bulk_read(); > > NB:To readback the data write on my UnitUnderTest, I'm using the command > op 28h). > > Those commands are working, but it should be much faster!(I run > comparison transfer rate test under window2000 and windows XP). I'm > waiting respond from you to know if it will be possible for me to fix > this issue soon or if I will have to wait a few weeks (months) > > Thank you very much! > Martin > > > > > -----Original Message----- > From: lib...@li... > [mailto:lib...@li...] On Behalf Of Johannes > Erdfelt > Sent: Monday, June 14, 2004 2:09 PM > To: lib...@li... > Subject: Re: [Libusb-devel] MAX_READ_WRITE > > On Sat, Jun 12, 2004, Peter Stuge <stu...@cd...> wrote: > > On Thu, Jun 10, 2004 at 04:25:37PM -0400, Martin Vaillancourt wrote: > > > #define MAX_READ_WRITE 4096 > > > > > > QUESTION : This seems to slow down a lot the transfer rate . Is > > > there already a fixed or a solution to speed up this? > > > > I believe you should just use larger buffers in your application > > and libusb and/or the kernel will handle it all well. > > > > My guess is that 4KB is just the size libusb uses to communicate > > with the kernel, but if libusb knows you want to transfer more, > > it will do so efficiently. Please correct me if I'm wrong. :) > > It will handle any size transfer, but it won't be efficient. > > Some people have had problems with 4KB transfer sizes and getting the > maximum amount of bandwidth out of USB 2.0 devices. > > One thing we can do in libusb is submit using URBs instead of using the > bulk call. That is the difference between 16k buffers and 4k buffers, so > we should be able to get a 4x improvement in performance that way. > > But ultimately, we'll need to make some modifications to the Linux > kernel to handle bigger buffers. > > I'll implement the libusb change ASAP. > > JE > > > > ------------------------------------------------------- > This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference > Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer > Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA > REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND > _______________________________________________ > Libusb-devel mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libusb-devel > > > > ------------------------------------------------------- > This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference > Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer > Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA > REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND > _______________________________________________ > Libusb-devel mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libusb-devel > |
From: Martin V. <mva...@ca...> - 2004-06-14 18:26:19
|
Hi, Thank to give me response on my case! I tried to increase the value of the #Define MAX_READ_WRITE to 32KBytes. My buffer of data was set to 32Kbytes+1; Unfortunately, the bulk transfer was failed. I do NOT See other buffer in the libusb to increase? My interrogation is about the comment in the libusb that say:" /* Linux usbdevfs has a limit of one page size per read/write. 4096 is */ /* the most portable maximum we can do for now */ " So it is talking about the USB Device File System. My understanding is that the problem is coming from the Linux Kernel? I don't remember anysetting during the kernel build about that :( Any Idea if about what I can do in this usbdevfs to increase the 4KB? Thank you, Martin -----Original Message----- From: lib...@li... [mailto:lib...@li...] On Behalf Of Peter Stuge Sent: Friday, June 11, 2004 9:16 PM To: lib...@li... Subject: Re: [Libusb-devel] MAX_READ_WRITE On Thu, Jun 10, 2004 at 04:25:37PM -0400, Martin Vaillancourt wrote: > #define MAX_READ_WRITE 4096 > > QUESTION : This seems to slow down a lot the transfer rate . Is > there already a fixed or a solution to speed up this? I believe you should just use larger buffers in your application and libusb and/or the kernel will handle it all well. My guess is that 4KB is just the size libusb uses to communicate with the kernel, but if libusb knows you want to transfer more, it will do so efficiently. Please correct me if I'm wrong. :) //Peter ------------------------------------------------------- This SF.Net email is sponsored by the new InstallShield X. >From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 _______________________________________________ Libusb-devel mailing list Lib...@li... https://lists.sourceforge.net/lists/listinfo/libusb-devel |
From: Thomas J. <tho...@in...> - 2004-06-14 19:02:36
|
> So it is talking about the USB Device File System. My understanding is > that the problem is coming from the Linux Kernel? I don't remember > anysetting during the kernel build about that :( > Any Idea if about what I can do in this usbdevfs to increase the 4KB? 4kb is the internal page size of the kernel. I guess usbdevfs is limited to 4kb so they didn't have to mess around with page boundaries. Should give enough performance for USB 1.1., but not for 2.0. Thomas |