Skip to content

Defragment IP packets

Alessandro Rubini u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3net: defragment IP packetsnet/net.c+167 -50 replies
1/3net: defragment IP packets+0 -03 replies
1/3net: defragment IP packets+0 -01 reply
1/3net: defragment IP packets+0 -01 reply
1/3net: defragment IP packets+0 -00 replies
1/3net: defragment IP packets+0 -01 reply
2/3tftp: get the tftp block size from config file and from the environmentnet/tftp.c+11 -20 replies
3/3arm nomadik: select defrag and 4k tftp block sizeinclude/configs/nhk8815.h+3 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [U-Boot] [PATCH 0/3] Defragment IP packets

This patch-set implements the defragment code. PAtch 3 is just for me, to enable it. It may also be a good thing to have, so people can look for actual users and find one. If needed, I'll add another patch for documentation.

I've done as RFC815 says although an unlikely insane fragment is not handled (see code and patch comment).

Robin's suggestions have been include by two:
- ports are not checked (tftp code doesn't check either), only ID
- the ckeck is done in an inline function, not in the main function:
I agree call/ret is worse than if, but there is no call here. (I split the function in two to make it clear, but it's most likely not even needed).

Ben asked:

1. Configurable block size (via a well-named CONFIG). Choose a good default value.

Done. The default is as before, as our polling ether may discard pacjets if the burst is too fast. Mine receives only 4-5 fragments, so 8192 is not viable for me (4k works quite good). I suspect some may just cache 1 packet, so even two fragments won't work for them, thus the unchanged default.

2. Handle out-of-order fragments, and some test results showing that it works.

This the end of a transfer with 4096 block size:

frag 1480 - 1480
frag 0 - 1480
frag 2960 - 1148
---- done, len 4108
frag 2960 - 1148
frag 0 - 1480
frag 1480 - 1480
---- done, len 4108
frag 1480 - 1480
frag 0 - 1480
frag 2960 - 1148
---- done, len 4108
frag 0 - 1480
frag 1480 - 664
---- done, len 2144

The image, written over zeroed memory, crc'd and booted correctly. Then I removed the prints.

3. Make the feature configurable

CONFIG_IP_DEFRAG

4. Test with a TFTP server that doesn't have blksize feature enabled

Done. Actually, my code is not called in this case.

/alessandro

Alessandro Rubini (3):
net: defragment IP packets
tftp: get the tftp block size from config file and from the environment arm nomadik: select defrag and 4k tftp block size

 include/configs/nhk8815.h |    3 +
 net/net.c                 |  172 +++++++++++++++++++++++++++++++++++++++++++--
 net/tftp.c                |   13 +++-
 3 files changed, 181 insertions(+), 7 deletions(-)