Re: [U-Boot] Is there file size limiation of tftp

2012-10-01 Thread Simon Glass
Hi,

On Sun, Aug 12, 2012 at 8:41 AM, Jerry Van Baren  wrote:
> On 08/11/2012 09:21 PM, J.Hwan Kim wrote:
>> Hi, everyone
>>
>> Is there any limit of file size for tftpboot?
>> I have a problem downloading the file of which file size is 65MB.
>> The procedure stops in the middle of downloading.
>>
>> Thanks in advnace.
>>
>> Best Regards,
>> J.Hwan Kim
>>
>> -
>>
>> # tftp 0xc000 192.168.100.10:system.img
>> smc911x: detected LAN9221 controller
>> smc911x: phy initialized
>> smc911x: MAC c3ea1460M (00405c260a5b)
>> TFTP from server 192.168.100.10; our IP address is 192.168.100.50
>> Filename 'system.img'.
>> Load address: 0xc000
>
> Probably what Mike said.  Note that 64MB is 0x4000 and your load
> address is 0xC000... add the two together and you get 0x1__
> which is a very suspicious number.
>
> Having said that, there are two places where TFTP implementations have
> problems.  The block number is a 16 bit unsigned integer.
>
> The easier (and less often problematic) one is where the block number
> goes from 0x7FFF to 0x8000.  If an implementation erroneously treats the
> block number as a *signed* integer, it will screw that up.
>
> The second size limit stumbling block is when the block number hits
> 0x, what is the next block number?  Some implementations just give
> up and limit the maximum file size to 64K-1 blocks[1].  If your block
> size is the default 512, that makes the maximum file size 32MB.  If your
> block size is 4K, it will make the maximum file size 256MB.

Yes. If it helps, I found a limit of about 95MB, which is something
like (the maximum tftp packet payload on Ethernet of about 1450) *
65535 or similar, caused by a buggy tftp server. When I switched to
tftpd-hpa my problems went away.

>
> RFC1350[2] is silent on the issue, probably because the authors never
> considered using TFTP with files bigger than 32MB.  TFTP does use block
> number 0 in a special way to ACK the write request and says "block
> numbers are consecutive and begin with one."  The simpler and more
> intuitive interpretation of 0x + 1 is to wrap to 0x.  The less
> intuitive one that honors 0 being special is to wrap to 0x0001.
>
> U-Boot wraps to 0, see net/tftp.c function update_block_number().  Your
> TFTP server needs to do the same.
>
> Best regards,
> gvb

Regards,
Simon


>
> Ref:
> [1] 
> [2] 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Is there file size limiation of tftp

2012-08-12 Thread Wolfgang Denk
Dear Jerry Van Baren,

In message <5027ceb1.1070...@gmail.com> you wrote:
> 
> Probably what Mike said.  Note that 64MB is 0x4000 and your load

No.  64 MiB is 0x0400; 0x4000 is 1024 MiB.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"He only drinks when he gets depressed." "Why does he get depressed?"
"Sometimes it's because he hasn't had a drink."
 - Terry Pratchett, _Men at Arms_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Is there file size limiation of tftp

2012-08-12 Thread Jerry Van Baren
On 08/11/2012 09:21 PM, J.Hwan Kim wrote:
> Hi, everyone
> 
> Is there any limit of file size for tftpboot?
> I have a problem downloading the file of which file size is 65MB.
> The procedure stops in the middle of downloading.
> 
> Thanks in advnace.
> 
> Best Regards,
> J.Hwan Kim
> 
> -
> 
> # tftp 0xc000 192.168.100.10:system.img
> smc911x: detected LAN9221 controller
> smc911x: phy initialized
> smc911x: MAC c3ea1460M (00405c260a5b)
> TFTP from server 192.168.100.10; our IP address is 192.168.100.50
> Filename 'system.img'.
> Load address: 0xc000

Probably what Mike said.  Note that 64MB is 0x4000 and your load
address is 0xC000... add the two together and you get 0x1__
which is a very suspicious number.

Having said that, there are two places where TFTP implementations have
problems.  The block number is a 16 bit unsigned integer.

The easier (and less often problematic) one is where the block number
goes from 0x7FFF to 0x8000.  If an implementation erroneously treats the
block number as a *signed* integer, it will screw that up.

The second size limit stumbling block is when the block number hits
0x, what is the next block number?  Some implementations just give
up and limit the maximum file size to 64K-1 blocks[1].  If your block
size is the default 512, that makes the maximum file size 32MB.  If your
block size is 4K, it will make the maximum file size 256MB.

RFC1350[2] is silent on the issue, probably because the authors never
considered using TFTP with files bigger than 32MB.  TFTP does use block
number 0 in a special way to ACK the write request and says "block
numbers are consecutive and begin with one."  The simpler and more
intuitive interpretation of 0x + 1 is to wrap to 0x.  The less
intuitive one that honors 0 being special is to wrap to 0x0001.

U-Boot wraps to 0, see net/tftp.c function update_block_number().  Your
TFTP server needs to do the same.

Best regards,
gvb

Ref:
[1] 
[2] 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Is there file size limiation of tftp

2012-08-11 Thread Mike Frysinger
On Saturday 11 August 2012 21:21:03 J.Hwan Kim wrote:
> Is there any limit of file size for tftpboot?

not really.  how much unused RAM do you have ?

> I have a problem downloading the file of which file size is 65MB.

did you overwrite u-boot or something ?
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Is there file size limiation of tftp

2012-08-11 Thread J.Hwan Kim
Hi, everyone

Is there any limit of file size for tftpboot?
I have a problem downloading the file of which file size is 65MB.
The procedure stops in the middle of downloading.

Thanks in advnace.

Best Regards,
J.Hwan Kim

-

# tftp 0xc000 192.168.100.10:system.img
smc911x: detected LAN9221 controller
smc911x: phy initialized
smc911x: MAC c3ea1460M (00405c260a5b)
TFTP from server 192.168.100.10; our IP address is 192.168.100.50
Filename 'system.img'.
Load address: 0xc000
Loading: T #
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#