[U-Boot] Request For Comments: wget and TCP listener

Duncan Hare DuncanCHare at yahoo.com
Sun Oct 1 21:01:37 UTC 2017


This code is written. and has changes to the following files:

I sent an "atomic patch", and it got stuck in moderation because it is 
350k+, that is too big.

My rules to myself were:

All interfaces, function calls, to be preserved. However, This results 
in an ugly "re-purposing" of variables in the packet-in calls to wget, 
because wget needs sequence numbers and state.

Advice and suggestions welcome for the best implementation.

Following is a phased approach to get from here to there, one patch per 
numbered step:

1. tcp headers, and constants. This could be split into a net.h and a 
new tcp.h, or be added to net.h

module: include net.h

There are  many lines of code for TCP header structures, and readily 
inspected

2. cmd.net,  cmd/Kcongif, net/Kconfig and net/Makefile (I don't know if 
net/Makefile will be built automagically at some point.)

Small changes in a number of places.

3. net.c interfaces, include/net.h procedure call definitions, and ping.c.

Body of code. tcp  could be a separate module, tcp.c. Or in the net.c 
source code file.

As an aside at some point I'd suggest deleting the ip fragmentation 
reassembly code and
second checksum calculating routine in net.c.

3a) IP fragment reassembly does not provide any mechanism to retrieve 
"lost packets",
and should never be use where a complete data stream is necessary.
Kernels require a complete data stream, movies do not.

3b) 2 pieces of code to perform the same task, checksum, seems redundant.

4. tpc.c either as a new module, tcp.c, or included in net/net.c, 
400-500 lines of code.

5. wget.c and wget.h as a new command, 300+ lines of code.

 From 1 to 3 would be "it's not broken" regression testing, and 
relatively low risk.

4 & 5 would be the new function testing, and would have to include a 
significant amount of stress testing,
  because I'm anal retentive and it's too much new code not to have bugs.

Here's the cover letter, for background:

wget and enough TCP stack for fast netboot

September 29, 2017

Boot with udp is relatively slow on a local net, and very slow over a WAN.
TCP is a very effective protocol for fast file, or stream, transfers.
http (used by wget) is a very efficient protocol, there is one message to
retrieve the file, and acks from u-boot to server TCP thereafter.

The code was built & tested on a raspberry pi, LAN and WAN with
the Jan 2017 version of u-boot. This code is an update for the current
master, September 2017 version of u-boot, and cleaned up to pass
clearpatch standards, but not tested.


This is a limited TCP implementation for the wget command only.
And all the code newly written, without viewing any copyrighted source.

Complied binary size: When using wget, tftp and nfs can be omitted
from the build. This has not been measured. When not using wget, the TCP
code is eliminated from the build.

All interfaces, function calls, in use are preserved. This results in an 
ugly
"re-purposing" of variables in the packet-in calls to wget. This requires
advice on the best implementation.

Kconfig is used in ./cmd and ./net to control wget and tcp respectively.
Makefile in ./net appears to have to be configured by hand.

Duncan


.


More information about the U-Boot mailing list