> We have 2 products which can perform better with increased Bulk transfers
> Device No. 1:
> According to the hardware spec of on of our product
> Available Bulk Transfer Size are:
> - 188 * n bytes, where n = 1 ~ 256.
> Although we can drive that one with 15K as well when setting the HW
> register down to it.
> Device No. 2
> only creates jitter video with Bulk transfer sizes which are below
> 24064 bytes, no such chipfeature is available
> to decrease the bulk transfer size.
> http://sundtek.de/images/dtvjitter2.jpg
> with transfer size of 24064:
> http://sundtek.de/images/gooddata.jpg
> The patch takes the features of Device No. 1 into account allowing a
> maximum buffer of 48128 bytes.
> Those issues have been evaluated with MacOSX and a customized patched
> Linux version.
> Device No. 2 also corrupts on MacOSX with too small packet sizes,
> Windows and Mac are using 24064 bytes.
You are constantly mixing the packet size and the transfer size.
> Default Bulk Transfersize of device No. 1 is around 1-2k which leads
> to very high cpu usage, updating it to 15k lowers that one.
WBR, Sergei
* On 12.10.2011 04:17 PM, Greg KH wrote:
> As stated before, this patch is not acceptable. Please work to figure
> out the real reason for your device problems here, this is not the
> correct solution at all.
I've gone through this whole (and previous) thread, but couldn't find a
real argument why this is so wrong.
So far everybody has argued that it's 'wrong' and may break older user
code. The latter argument even is wrong, as drivers not requiring a
higher bulk transfer size just aren't affected.
This being said, I agree that allocating more memory than needed is
wasting memory and bad, if it can be avoided. On the other hand, we're
talking about very few devices here and not several ten of MB system
memory being wasted by all bulk transfers in total.
I basically see two cases:
- systems with a few MB of RAM. I highly doubt those use usbfs anyway
(usually other stuff like usb-storage)
- systems with 'enough' system memory. In this case the problem is
purely... let's call it 'academic'. You can discuss it lengthly in
theory, but won't even notice it in practice.
Best regards,
Mihai
That is your choice, not ours, as you are the one writing the closed
source code. Without usbmon dumps, showing that the problem really is
in the kernel code, we can't do anything for you here.
Best of luck,
here take your usbmon logs:
http://sundtek.de/support/working.log
http://sundtek.de/support/notworking.log (this is with your proposed
split up of 22k).
Isochronous already supports up to 190kb buffers which cause no
trouble anywhere.
Bulk is castrated to 15kb buffers and 50kb should be such a big issue
while applications
which do not request it are not affected at all.
I'm very angry that you do not really focus on what I write and just
try to write stories about
bogus things like my patch might break other applications while I
pointed out that this is not
possible with legacy applications which use this interface. It is not
even possible to read the
maximum buffer value from the kernelspace.
Your bogus message about 1Gig ram you can put it elsewhere, I checked
multiple windows drivers
in the past the buffer size varies between small and something around
50k usually.
I would fully like to avoid to patch this kernel to get those things
work because I don't want to
deal with people who just write around the actual issues.
Alsi the fact that bigger buffers are already being used plus the HW
specifications of our main device also points out to a certain
buffersize near 50k. But of course you are the smart knowitall without
the need of explanation why
those things can be affected by HW and some HW chips have options to
influence that buffer size.
I'm certainly angry,
Markus
And for those who are curious about the logfiles:
Not working one as proposed by Alan that the full buffer size should
be split into 2 requests:
ffff8800b38d9f00 1231540351 S Bi:2:013:1 -115 12288 <
ffff8800b38d96c0 1231540404 S Bi:2:013:1 -115 11776 <
ffff8800b38d9cc0 1231540440 S Bi:2:013:1 -115 12288 <
ffff880002ede600 1231540496 S Bi:2:013:1 -115 11776 <
ffff8800b38d9f00 1231545491 C Bi:2:013:1 0 12288 = 7a1a0840 1ca8353c
004b80ec 4de08401 2f0227f8 34005e7e 80181dfd 1a8f700a
ffff88007d51fb40 1231545875 S Bi:2:013:1 -115 12288 <
ffff8800b38d96c0 1231551861 C Bi:2:013:1 0 11776 = 5244e386 a7800000
010642ea 35bfbba5 373e738b cc035a73 c328a1ff 4da728ce
ffff880002ede0c0 1231556173 S Bi:2:013:1 -115 11776 <
ffff8800b38d9cc0 1231558618 C Bi:2:013:1 0 12288 = db91aae9 2d2532f3
2e37448a fb36c213 55dda2ad 243122b2 261edb06 875848ac
12288 = 7a1a0840 every Line with 12288 should start with 47 (MPEG-TS Sync byte)
The working one which allocate 7000 bytes more (oh really big memory
pressure now!) than this castrated USBFS interface allows.
ffff88003ac37240 992178919 S Bi:2:013:1 -115 24064 <
ffff88003ac37000 992178953 S Bi:2:013:1 -115 24064 <
ffff88003ac37c00 992178980 S Bi:2:013:1 -115 24064 <
ffff88003ac37e40 992179003 S Bi:2:013:1 -115 24064 <
ffff88003ac37240 992190198 C Bi:2:013:1 0 24064 = 471fff10 00000000
00000000 00000000 00000000 00000000 00000000 00000000
ffff88000601f480 992194368 S Bi:2:013:1 -115 24064 <
ffff88003ac37000 992203209 C Bi:2:013:1 0 24064 = 4701b114 43867ee6
40790660 e898681c 9b1c7dca 08980d43 73181369 9be1bc67
ffff880067e38a80 992204642 S Bi:2:013:1 -115 24064 <
ffff88003ac37c00 992216318 C Bi:2:013:1 0 24064 = 4740001c 0000b01d
0305d500 000000e0 104015e1 504016e1 60401be1 b04022e2
ffff880067e383c0 992219978 S Bi:2:013:1 -115 24064 <
ffff88003ac37e40 992229340 C Bi:2:013:1 0 24064 = 471fff10 00000000
00000000 00000000 00000000 00000000 00000000 00000000
everything starts nicely with 0x47
And now everyone again is clueless how this can happen.. surprise surprise..
Markus
On Thu, Oct 13, 2011 at 3:39 AM, Markus Rechberger
Is the transfer size a multiple of 188 bytes in both cases ? In the
working case, it looks so, but in the broken case ? Many DTV bridges
have fixed DMA apertures and not variable really much, even though the
device specifications do state that it might support different block
sizes, some modes could be broken. I guess most likely, you would have
handled this situation.
Other issues that could possibly happen (wrt your jitter) is a high
latency (in the particular case of failures) where the received data
have unusable relative timestamps wrt DTS and or PTS.
The only areas where you can have a corrupted stream as you mentioned
"jitter" is either lost frames or the above two cases. I don't know
what's the issue in your case, but might help to track down the issue
altogether.
Regards,
Manu
I am not so sure about that one but I guess that's it.
The 'black outs (0xff after the Sync byte)' are also related to the
demodulator (not perfect signal, it's still DVB-T) but
the alignment is just perfect
I also guess the misaligning problem could be related to the latency
and that the bridges have some
fixed or adjustable bulk transfer settings to work with that. In the
end the additional features
are done with software demodulation so there will be a certain minimal
system requirement anyway.
What would be against that theory would be that 2*that maximum
transfer size also results in a misaligned
video. Since I tried many other transfer sizes before I've been told
to use that one and I even thought the
device is broke but it just works that way... also with Windows and MacOSX.
As far as I can tell for user experience the device is okay with 24064 bytes.
TV has been running for several days now with no issues (I was also
testing the ts 'blackouts' where data
after the sync byte 0x47 is 0xff on weak signal, the TS sync byte
itself is still valid)
I have to do signal tests anyway next week in order to file some
specs, pattern generator and attenuator
are available for it (however that goes deeper into the functionality
and QA of those devices, also the
final device will have a tuner with better sensitivity onboard).
BR,
Markus
I guess you meant to imply "software decoding" of the MPEG stream I
would say, rather than "demodulation" of the Baseband signal.
> What would be against that theory would be that 2*that maximum
> transfer size also results in a misaligned
> video. Since I tried many other transfer sizes before I've been told
> to use that one and I even thought the
> device is broke but it just works that way... also with Windows and MacOSX.
> As far as I can tell for user experience the device is okay with 24064 bytes.
>
> TV has been running for several days now with no issues (I was also
> testing the ts 'blackouts' where data
> after the sync byte 0x47 is 0xff on weak signal, the TS sync byte
> itself is still valid)
I have had such an issue earlier (0x47 followed 0xff. ie 0x47 0x1f 0xf
0x00 0x00 0x00 and so on) with a stream from the demodulator on a PCIe
device, but eventually it turned out to be that, it was handling the
device DMA in the reverse order, the device having 8 DMA apertures of
which all 8 had to be used for stream transfer.
RING(W) : Buf:2 Tail: 2 Count:0 Size:16
RING(R): Buf:2 Head: 2 Count:! Size: 16
47 If ff 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Additionally, to be noted is that the ISO13818-1 specification allows
NULL padding of the TS by the channel modulator to achieve a CBR, from
VBR ES's. There exists an ETSI specification dealing with NULL padding
explicitly, don't remember the exact TR no.
After a search, EN 302755 v1.1.1 Section 5.1.5 deals with that, A
quick glance at least wrt to T2, I remember the same while I was
working with S2 as well.
All such issues mixed when together can be very nasty and painful,
making things difficult.
Regards,
Manu
yes the PID is 0x1fff which are null packets over there, so those ones are okay.
Main point is it works and it would even comply with certain HW specs (the other
device points out about 256*188 bulk transfer buffer sizes.
Now it would be the time for some people to open their eyes and get
that patch in.
The maximum transfer buffer size was derived from our other device which can
do the flexible setting. According to the specification it is no magic value.
And seriously increasing that current limitation for a few more bytes
while isochronous
already allows up to 190k is just a joke, we have been using that for
3 years now on
x86, ARM, MIPS without any problem. The biggest problem is usually
when the memory
runs out in general by writing a log file to ram via /tmp or /var/log.
But even then we have system logs where other drivers fail first (eg.
ethernet) and complain
about not enough memory.
BR,
Markus
Null Packets 0x1fff (471fff...)
http://en.wikipedia.org/wiki/MPEG_transport_stream#Null_packets
Some demonstration video:
(with 24064 bytes, which uses the additional buffers which are allowed
by the introduced patch):
Flawlessly video:
http://www.sundtek.de/support/00011.MTS
(Alan's proposed buffer size 11776/12288)
Jerky video:
http://www.sundtek.de/support/00012.MTS
both videos are around 30 seconds made with a camera, video is still uploading.
this is my last post to that topic I still have some little hope that
this patch will get in to fix that issue.
As proposed for academic research you can pick up a Stick in Berlin
once the new cut is ready from manufacturing,
Markus
Call me dumb, but it still defies my logic why there would be stream
corruption with a smaller buffer size, if the driver is handling the
stream correctly.
I can probably imagine that there could be a likely chance, user space
would have to poll more often in case with smaller buffers, while
making it larger you increase the latency of the stream; that being a
double edged blade.
> The maximum transfer buffer size was derived from our other device which can
> do the flexible setting. According to the specification it is no magic value.
So, with your single device, if you were to make changes to some
"magical constants"; and tomorrow if someone wants to have
modifications again, what would you do ? If that change is a must,
maybe it should be configurable in some way, rather than having
another fixed magical number.
you can see it in the logfile that the TS packets don't start as they should
0x47 is not the first value which is wrong and so on. And this is a
fact which everyone
can see by looking at the logfile.
At least every second transfer would have to start with 0x47, at the
point of logging the userspace
application does not have access to the USB buffer.
> I can probably imagine that there could be a likely chance, user space
> would have to poll more often in case with smaller buffers, while
> making it larger you increase the latency of the stream; that being a
> double edged blade.
>
>
>> The maximum transfer buffer size was derived from our other device which can
>> do the flexible setting. According to the specification it is no magic value.
>
>
> So, with your single device, if you were to make changes to some
> "magical constants"; and tomorrow if someone wants to have
> modifications again, what would you do ?
please do some investigation about the patch, if the value is
increased it does not
affect any previous application. That constant is not readable from
the kernel so applications
need to hardcode it. Small buffers are totally unrelated to that.
That is what I don't like here that some people are talking without
doing their homework and reviewing
what it is about.
> If that change is a must,
> maybe it should be configurable in some way, rather than having
> another fixed magical number.
>
Although I agree with that one.
BR,
Markus
> And for those who are curious about the logfiles:
> Not working one as proposed by Alan that the full buffer size should
> be split into 2 requests:
>
> ffff8800b38d9f00 1231540351 S Bi:2:013:1 -115 12288 <
> ffff8800b38d96c0 1231540404 S Bi:2:013:1 -115 11776 <
> ffff8800b38d9cc0 1231540440 S Bi:2:013:1 -115 12288 <
> ffff880002ede600 1231540496 S Bi:2:013:1 -115 11776 <
> ffff8800b38d9f00 1231545491 C Bi:2:013:1 0 12288 = 7a1a0840 1ca8353c
> 004b80ec 4de08401 2f0227f8 34005e7e 80181dfd 1a8f700a
> ffff88007d51fb40 1231545875 S Bi:2:013:1 -115 12288 <
> ffff8800b38d96c0 1231551861 C Bi:2:013:1 0 11776 = 5244e386 a7800000
> 010642ea 35bfbba5 373e738b cc035a73 c328a1ff 4da728ce
> ffff880002ede0c0 1231556173 S Bi:2:013:1 -115 11776 <
> ffff8800b38d9cc0 1231558618 C Bi:2:013:1 0 12288 = db91aae9 2d2532f3
> 2e37448a fb36c213 55dda2ad 243122b2 261edb06 875848ac
>
>
> 12288 = 7a1a0840 every Line with 12288 should start with 47 (MPEG-TS Sync byte)
>
> The working one which allocate 7000 bytes more (oh really big memory
> pressure now!) than this castrated USBFS interface allows.
Sarcasm won't help convince anybody to do anything.
> ffff88003ac37240 992178919 S Bi:2:013:1 -115 24064 <
> ffff88003ac37000 992178953 S Bi:2:013:1 -115 24064 <
> ffff88003ac37c00 992178980 S Bi:2:013:1 -115 24064 <
> ffff88003ac37e40 992179003 S Bi:2:013:1 -115 24064 <
> ffff88003ac37240 992190198 C Bi:2:013:1 0 24064 = 471fff10 00000000
> 00000000 00000000 00000000 00000000 00000000 00000000
> ffff88000601f480 992194368 S Bi:2:013:1 -115 24064 <
> ffff88003ac37000 992203209 C Bi:2:013:1 0 24064 = 4701b114 43867ee6
> 40790660 e898681c 9b1c7dca 08980d43 73181369 9be1bc67
> ffff880067e38a80 992204642 S Bi:2:013:1 -115 24064 <
> ffff88003ac37c00 992216318 C Bi:2:013:1 0 24064 = 4740001c 0000b01d
> 0305d500 000000e0 104015e1 504016e1 60401be1 b04022e2
> ffff880067e383c0 992219978 S Bi:2:013:1 -115 24064 <
> ffff88003ac37e40 992229340 C Bi:2:013:1 0 24064 = 471fff10 00000000
> 00000000 00000000 00000000 00000000 00000000 00000000
>
> everything starts nicely with 0x47
This is very interesting. There are only two things that could be
happening: Either the device sends different data during the two tests,
or there's a bug in the kernel.
Now, it is possible the device is sending bad data. The initial parts
of the two logs do not agree exactly; there are numerous small
differences in the control data sent by the device and by the program.
I don't know whether they are significant, but if they aren't, there's
no reason for the device to send different bulk data. The transfer
size certainly cannot account for it. Indeed, even if the transfer
size were only 512 bytes, the first data packet should still be the
same.
You said you don't want to spend any more time working on this problem.
But I'd still like to track it down. Is it possible for you to loan me
a device for testing? I've got a USB bus analyzer, which could help to
pin down what's going wrong.
Alan Stern
The same issues happen with MacOSX and AGAIN windows is also using the same
buffer size.
Currently there's only one sample available, the production should be
ready by the end of this month.
I can certainly give you one device for playing around as soon as it
is ready but for that
Before that I insist that this patch will go into the kernel (I know
that sounds ridiculous but so far I did everything
you requested me to do), I clearly pointed out that we even have hardware
specs which can influence the transfer buffer. The patch does not hurt
and makes the device work.
Now it turns out that this issue suddenly is interesting because
there's no idea why that can happen.
First priority is to get this device work, second priority is
everything else if Linux support is wanted.
BR,
Markus
>> This is very interesting. There are only two things that could be
>> happening: Either the device sends different data during the two tests,
>> or there's a bug in the kernel.
> Before that I insist that this patch will go into the kernel (I know
> that sounds ridiculous but so far I did everything
> you requested me to do), I clearly pointed out that we even have hardware
> specs which can influence the transfer buffer. The patch does not hurt
> and makes the device work.
That makes no sense. If there's a bug in the hardware we likely don't
want to make global changes to work around it--a more targeted fix may
be more appropriate.
If there is a bug in the kernel, why would we want a bandaid patch that
just happens to make it work rather than a true fix?
Chris
--
Chris Friesen
Software Developer
GENBAND
chris....@genband.com
www.genband.com
Did you read the part about that we have some hardware which can do
some settings
in hardware to affect the transfer buffer? Even that part is not clear
how it can affect the
transfer for the usb subsystem.
Why on earth should things be done differently than with all other
operating systems?
> If there is a bug in the kernel, why would we want a bandaid patch that just
> happens to make it work rather than a true fix?
>
In silicon? Are you going to tape out another one for it?
First priority is that the device can work and be sold, my last
priority is that requested academic research (as we are not
the design house for the particular IC), I'm willing
to support it if my request is fulfilled, the demo videos are online
and show that it works with increasing the maximum allowed buffersize.
And about the particular device the boundaries are just around 7000
bytes off and people are screaming about that? Sorry this is just like
in kindergarden here.
Markus
> Why on earth should things be done differently than with all other
> operating systems?
Linux does a lot of things differently than other operating systems. In
many cases it's because the other OS's do things wrong. One could just
as easily turn the question around and ask why on earth would your
hardware be different than all the other USB hardware?
>> If there is a bug in the kernel, why would we want a bandaid patch that just
>> happens to make it work rather than a true fix?
>
> In silicon? Are you going to tape out another one for it?
If there's a bug in the kernel, the true fix would be in the kernel.
> And about the particular device the boundaries are just around 7000
> bytes off and people are screaming about that? Sorry this is just like
> in kindergarden here.
Actually I think that you're the one throwing a tantrum and yelling that
it needs to be done your way or else. We generally don't change global
constants because one hardware device doesn't work.
Chris
--
Chris Friesen
Software Developer
GENBAND
chris....@genband.com
www.genband.com
For my part, I don't much mind raising the limit from 16 KB to 32 KB.
48 KB may be unnecessary, especially since one of the devices doesn't
even work when the transfer buffer is that large.
However it's just a work-around, not a real solution to the underlying
problem (whatever that problem turns out to be). Part of the reason
for keeping the limit low is that it shouldn't matter, since people
ought to be able to use a bunch of small transfers rather than one
large transfer. Apparently that justification doesn't work with these
webcams, although there's no known reason why it shouldn't.
But I'm not the person in charge of these decisions...
Alan Stern
fair enough I have 2 devices which don't work properly with bulk.
Device A works by adjusting a hardware register
Device B is documented in this thread.
Device A causes corruptions when the hardwareregister is set to a
buffersize > 16k.
There is certainly something on the physical usb layer which is unknown to the
(software) USB experts here.
The logfiles in the previous email shows up enough and is clear enough.
Why do you think is this documented in the hardware specs of one of our devices?
The chip which has those problems unfortunately doesn't have such registers.
AGAIN:
According to the hardware spec of on of our product
Available Bulk Transfer Size are:
- 188 * n bytes, where n = 1 ~ 256.
Markus
Well if the underlying solution is crap hardware with no work around its
a bit hard to avoid. A more conservative approach would be to put the
'constant' in sysfs where it belongs so it can be adjusted and special
cased.
Alan
> fair enough I have 2 devices which don't work properly with bulk.
> Device A works by adjusting a hardware register
> Device B is documented in this thread.
>
> Device A causes corruptions when the hardwareregister is set to a
> buffersize > 16k.
> There is certainly something on the physical usb layer which is unknown to the
> (software) USB experts here.
> The logfiles in the previous email shows up enough and is clear enough.
When you ran the test using the 12288/11776 sizes, did you change the
hardware register buffersize value? Or did you leave it set to the
same 24064 as in the other test?
Alan Stern
sorry for confusing you here, this device does not have such a register.
Device A has the hardware register, the buffer is currently set to
~16kb for it and it is okay, it does not
require the patch. By increasing the hw register to >16kb the transfer
is also damaged.
Device B unfortunately not and only accepts 24064 bytes, before
getting that constant I tried
several other smaller buffer sizes and it did not succeed (result is
just as indicated by the video and logfiles in the earlier
post). CPU usage is also okay 0.9% for the entire streaming application.
Markus
I tried that earlier already of course it fails. If I could pick a
smaller transfer size I would be happy since
the device would work with all 2.6.x kernels out of the box and I
wouldn't have to waste my time with it.
Unfortunately it requires the 24064 bytes.
The more flexible device A which is mentioned here confirms that there
can be some impact on the
bulk transfer size.
However to learn about this it's needed to look at the bottom line of
USB on the physical layer.
And I disagree with Alan Cox it's not about being a crappy device or
not, it's more like about something
that is not well understood here. Most people are familiar with
Software only here and not with the physical
USB bottom Layer, otherwise the fact that the devices can have an
impact on this wouldn't be such a surprise.
I didn't check this before the half of it is of course not a multiple
of 512 so the
logfile only shows up 11776 of course.
24064 is the smallest common multiple of 188 and 512.
BR,
however to not say that I'm unwilling to do that and that is the
reason for not accepting this patch
http://www.sundtek.de/support/notworking2.log
even if the value is exposed to sysfs, it still requires the static
value in the kernel. The current value
used in the patch is based on what is in the HW specs of device A
which has the flexible bulk transfer setting.
The inflexible device which uses 24064 bytes works with all other
Operating systems by using that value
and gives exactly the same results with other transfer sizes than that.
BR,
> The inflexible device which uses 24064 bytes works with all other
> Operating systems by using that value
> and gives exactly the same results with other transfer sizes than that.
-ENOPARSE. If it's inflexible, how did you get results for other transfer
sizes? And if other transfer sizes give exactly the same results, why can't you
just use those instead?
the particular device in question is inflexible yes.
> how did you get results for other transfer
> sizes?
other transfer sizes are related to another more flexible device, but that
device has some hardware register to modify the needed transfer buffer size.
> And if other transfer sizes give exactly the same results, why can't you
> just use those instead?
>
other transfer sizes for the device with the fixed transfer buffer
size give exactly the same result with OSX, meaning that it also
does not work on MacOSX with another size than 24064 bytes.
Final conclusion is still:
1. those people who used to deal with USB with linux in the past never
heard about such an option it seems, fact is that the stream corrupts
the logfiles show up damaged data before it arrives to the application
so on that side bugs in the application would be unrelated. As a
crosscheck I also posted a logfile with valid data.
2. the more flexible device even has hardware registers to modify the
bulk transfer size (maybe it's a timing related issue on the physical
usb bus).
3. if the more flexible device is set to buffers > 16k the data also corrupts
4. the fixed buffer size device does not accept any other values, even
twice that requested buffersize corrupts the data.
5. the patch does not hurt, since devices which request buffer sizes
below 16k will still be handled the same way as they were handled
during the last 10 years, it just allows applications to request
bigger buffers if needed.
6. BOTH of our devices (the flexible one device A, can work with
bigger buffers AND a bigger HW register configuration, device B which
is not so flexible also works flawlessly as seen in the video).
I'm repeating myself over and over here.
Conclusion:
The hardware on the Linux PC and the kernel on the Linux PC are
working correctly.
Your external USB device has an off-by-one error in its
hardware/embedded software and the hardware/embedded software
manufacturer is not prepared to fix it.
Workaround in software: Increase MAX from 16384 to 24064 or above.
My own feeling, throw away this faulty bit of hardware and use a different part.
The hardware is not compatible with USB standards.
Kind Regards
James
> Well if the underlying solution is crap hardware with no work around its
> a bit hard to avoid. A more conservative approach would be to put the
> 'constant' in sysfs where it belongs so it can be adjusted and special
> cased.
On Fri, 14 Oct 2011, Markus Rechberger wrote:
> even if the value is exposed to sysfs, it still requires the static
> value in the kernel. The current value
> used in the patch is based on what is in the HW specs of device A
> which has the flexible bulk transfer setting.
> The inflexible device which uses 24064 bytes works with all other
> Operating systems by using that value
> and gives exactly the same results with other transfer sizes than that.
When you think about it, what's the real reason for limiting transfer
sizes? Part of it has to do with avoiding large contiguous memory
allocations, of course, but that can't be the real reason. After all,
if a memory allocation fails, there's no damage done except to the
program submitting the transfer -- and then it's clearly the program's
own fault for submitting a transfer that's too large.
A little thought shows the only reason for having this sort of limit is
to avoid denial-of-service attacks caused by dedicating too much kernel
memory to URB transfer buffers. But limiting the size of individual
transfer buffers isn't the right way to do this! There's nothing to
prevent a program from submitting many, many transfers, each one under
the size limit but all together exhausting available memory.
No, a much better approach is to remove all limits on individual
transfer sizes and instead have a global limit on the total amount of
all usbfs buffers in use at any time. Maybe something like 16 MB; at
SuperSpeed, that's about about 30 ms worth of data.
Greg, what do you think?
Alan Stern
That sounds quite reasonable.
greg k-h
I agree with that one, and think this conclusion comes closest to the
real issue.
I can imagine that the chip fifo has some issues with that one.
However the device has been tested for a long time without turning to
corrupted data so
the only issue remaining is the buffer alignment.
Thanks for having a look at all that, I wish all requests would have
that kind of review, instead
of "I don't believe you, not acceptable, not right solution at all"
BR,
Markus
I don't really want to help Markus with his proprietary, binary-only
userspace driver crap, but I wonder why nobody seems to remember
how the USB protocol works on the wire? The transfer size is
never seen by the device, thus it cannot matter if two small URBs
or one large URB are queued. What matters is the packet size.
Apparently the device can only handle fixed size packets
of either 188 or 2*188 byte, thus it breaks with 12288 or 11776.
The endpoint's wMaxPacketSize might reflect this.
I guess a transfer size of e.g. 188*60=11280 would work.
See the first mail of this thread.
See also Sergei's comment in
http://lkml.org/lkml/2011/10/12/183
Johannes
> I don't really want to help Markus with his proprietary, binary-only
> userspace driver crap, but I wonder why nobody seems to remember
> how the USB protocol works on the wire?
I remember it perfectly well.
> The transfer size is
> never seen by the device, thus it cannot matter if two small URBs
> or one large URB are queued. What matters is the packet size.
That's what I have been saying. Markus's experience contradicts this,
however.
> Apparently the device can only handle fixed size packets
> of either 188 or 2*188 byte, thus it breaks with 12288 or 11776.
No. The device expects 512-byte packets because it uses a bulk
endpoint.
> The endpoint's wMaxPacketSize might reflect this.
For high-speed devices, a bulk endpoint's wMaxPacketSize must always be
512.
> I guess a transfer size of e.g. 188*60=11280 would work.
> See the first mail of this thread.
According to Markus, with this particular device nothing but 24064
works. The discussion is a little difficult to follow because he
talked about two different devices without always being clear about
which was which.
> See also Sergei's comment in
> http://lkml.org/lkml/2011/10/12/183
Alan Stern