Re: [PATCH v20 1/4] net: Add TCP protocol
Thank you all for taking this over the finish line. I Duncan Hare 714 931 7952DRE# 01350926 On Monday, November 28, 2022 at 11:52:23 AM PST, Tom Rini wrote: On Tue, Nov 08, 2022 at 02:17:28PM +0800, Ying-Chun Liu (PaulLiu) wrote: > From: "Ying-Chun Liu (PaulLiu)" > > Currently file transfers are done using tftp or NFS both > over udp. This requires a request to be sent from client > (u-boot) to the boot server. > > The current standard is TCP with selective acknowledgment. > > Signed-off-by: Duncan Hare > Signed-off-by: Duncan Hare > Signed-off-by: Ying-Chun Liu (PaulLiu) > Reviewed-by: Simon Glass > Cc: Christian Gmeiner > Cc: Joe Hershberger > Cc: Michal Simek > Cc: Ramon Fried > Reviewed-by: Ramon Fried Applied to u-boot/master, thanks! -- Tom
Re: [PATCH v17 1/2] net: Add TCP protocol
I used a server on Linux for testing. Sent from Yahoo Mail on Android On Tue, Oct 18, 2022 at 9:59, Simon Glass wrote: Hi PaulLiu, On Mon, 17 Oct 2022 at 01:03, PaulLiu wrote: > > Hi Simon, > > I think it is a bit hard for me to test it right now. It seems that we need > to setup a fake HTTP server? > It can be easily done by some python scripts but I'm not sure how to start. > Is there some example on testing the network commands? Like tftp or nfs? See test/dm/eth.c for some examples. It is better if you can have the test contained, rather than requiring starting up a separate server. E.g. you can write a small test in C which sends an http request, handles the reply and then checks that the data is received. At present sandbox supports storing one packet, but that could be extended if not enough. Regards, Simon > > Yours, > Paul > > > On Tue, Jul 12, 2022 at 7:00 PM Simon Glass wrote: >> >> Hi Ying-Chun, >> >> On Fri, 8 Jul 2022 at 12:02, Ying-Chun Liu (PaulLiu) >> wrote: >> > >> > From: "Ying-Chun Liu (PaulLiu)" >> > >> > Currently file transfers are done using tftp or NFS both >> > over udp. This requires a request to be sent from client >> > (u-boot) to the boot server. >> > >> > The current standard is TCP with selective acknowledgment. >> > >> > Signed-off-by: Duncan Hare >> > Signed-off-by: Duncan Hare >> > Signed-off-by: Ying-Chun Liu (PaulLiu) >> > Cc: Christian Gmeiner >> > Cc: Joe Hershberger >> > Cc: Michal Simek >> > Cc: Ramon Fried >> > --- >> > v1-v12: Made by Duncan, didn't tracked. >> > v13: Fix some issues which is reviewed by Christian >> > v14: Add options to enable/disable SACK. >> > v15: Fix various syntax errors reviewed by Michal. >> > Remove magic numbers. Use kernel-doc format. >> > v16: Add more kernel-doc. Fix more double spaces. >> > --- >> > include/net.h | 36 ++- >> > include/net/tcp.h | 312 >> > net/Kconfig | 16 ++ >> > net/Makefile | 1 + >> > net/net.c | 30 ++ >> > net/tcp.c | 720 ++ >> > 6 files changed, 1106 insertions(+), 9 deletions(-) >> > create mode 100644 include/net/tcp.h >> > create mode 100644 net/tcp.c >> >> This looks good to me. >> >> Reviewed-by: Simon Glass >> >> Can we get a test for this? Perhaps a fake Ethernet driver in sandbox >> / drivers/net?
Raspberry PI 4 and U-boot
Is there U-Boot with Ethernet available in U-Boot for the Raspberry PI 4? If not is u-boot without Ethernet available for the Raspberry Pi 4, and and interface spec available for the and Pi 4 Ethernet driver? I have read that the Ethernet driver for the Pi 4 is different from the PI 3. Thanks Duncan Hare 714 931 7952
Re: [U-Boot] [PATCH v12 1/3] Consolidating UDP header functions.
>On Sun, Jun 24, 2018 at 5:40 PM, wrote:. >From: Duncan Hare > >> To make it possible to add TCP versions of the same, while reusing >> IP portions. This patch should not change any behavior. >> >> All references to TCP removed >> Used most recent version of u-boot June 22 13, 2918 >> Series to fix patman errors over Licensing declaration >> END >> >> Series-notes >See how it didn't work? It's still in this patch log instead of below >"---". Missing colon. Why so opposed to a dry run? You are having such >trouble using the patman tool properly, it seems so much time is spent >saying the same things over and over. > >I have tested this patch and it breaks UDP functionality. I have fixed >the regression. I have also fixed formatting issues that I've asked >you to fix and you have not. >With your permission I will pull in the fixed version of this patch. >Or if you prefer, I can send it to the list. >-Joe >> TCP with Selective Acknowledgment (SACK) is currently the protocol >> with highest speed transfers, for fast multi-hop networks. >> END >> >Joe With your permission I will pull in the fixed version of this patch.Or if you prefer, I can send it to the list. You have my permission. I have the disadvantage that in Patman I do not know what is correct behavior,so when I run a dry run, I do not know if what I'm seeing is right or wrong. Thanks Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Make menuconfig error - Status
Thanks to all. My problem was I'd installed bison++, not bison. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Make menuconfig error - Status
duncan@debian:~/archive$ git clone git://git.denx.de/u-boot.git Cloning into 'u-boot'... remote: Counting objects: 559898, done. remote: Compressing objects: 100% (97298/97298), done. Receiving objects: 100% (559898/559898), 113.79 MiB | 294.00 KiB/s, done. remote: Total 559898 (delta 462692), reused 551394 (delta 454519) Resolving deltas: 100% (462692/462692), done. duncan@debian:~/archive$ cd u-boot duncan@debian:~/archive/u-boot$ make menuconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/mconf.o YACC scripts/kconfig/zconf.tab.c scripts/kconfig/zconf.y:44 parser name defined to default :"parse" "scripts/kconfig/zconf.y", line 97: junk after `%%' in definition section Segmentation fault scripts/Makefile.lib:228: recipe for target 'scripts/kconfig/zconf.tab.c' failed make[1]: *** [scripts/kconfig/zconf.tab.c] Error 139 Makefile:492: recipe for target 'menuconfig' failed make: *** [menuconfig] Error 2 Where are we on this? Is there a fix? Thanks Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Fw: Make Menuconfig Error
>From: Karsten Merker >To: Duncan Hare >Cc: U-Boot Mailing List >Sent: Wednesday, June 20, 2018 2:16 PM >Subject: Re: Make Menuconfig Error > >On Wed, Jun 20, 2018 at 12:33:45AM +, Duncan Hare wrote: > >> Makefile:491: recipe for target 'menuconfig' failed >> make: *** [menuconfig] Error 2 >> root@debian:/home/duncan/archive/u-boot#>>>>The problem is the same on >> Raspbian and Debian. Client Raspbian mounts the repository through NFS. >> Debian is the server. >> >>This test was run on the server.> >I'm sorry but I cannot reproduce your problem. I don't have >access to a Raspbian/stable installation, but I have run the same >steps on a Debian/stable for armhf (which should be close enough >as Raspbian/stable is largely an armv6 build of the Debian/stable >package sources) and on a Debian/stable amd64 system. In both >cases everything builds without problems: > therefore tend to believe that something in your local >repository checkout is broken. Please run a "git reset --hard >master; git pull; git status; git log| head -1; make distclean; >make menuconfig" and provide the resulting output. I deleted the git archive and cloned again. git clone git://git.denx.de/u-boot.git duncan@debian:~/archive$ git clone git://git.denx.de/u-boot.git Cloning into 'u-boot'... remote: Counting objects: 559784, done. remote: Compressing objects: 100% (97184/97184), done. remote: Total 559784 (delta 462603), reused 551414 (delta 454519) Receiving objects: 100% (559784/559784), 113.77 MiB | 32.00 KiB/s, done. Resolving deltas: 100% (462603/462603), done. duncan@debian:~/archive$ cd u-boot duncan@debian:~/archive/u-boot$ make clean duncan@debian:~/archive/u-boot$ make menuconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/mconf.o YACC scripts/kconfig/zconf.tab.c scripts/kconfig/zconf.y:44 parser name defined to default :"parse" "scripts/kconfig/zconf.y", line 97: junk after `%%' in definition section Segmentation fault scripts/Makefile.lib:228: recipe for target 'scripts/kconfig/zconf.tab.c' failed make[1]: *** [scripts/kconfig/zconf.tab.c] Error 139 Makefile:491: recipe for target 'menuconfig' failed make: *** [menuconfig] Error 2 duncan@debian:~/archive/u-boot$ Now the set of git commands you providedduncan@debian:~/archive/u-boot$ git reset --hard HEAD is now at a5742efa20 Prepare v2018.07-rc2 duncan@debian:~/archive/u-boot$ git reset --hard master HEAD is now at a5742efa20 Prepare v2018.07-rc2 duncan@debian:~/archive/u-boot$ git pull Already up-to-date. duncan@debian:~/archive/u-boot$ git status On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working tree clean duncan@debian:~/archive/u-boot$ git log | head -1 commit a5742efa20384a27d51ee6c43d02c2025536c65d duncan@debian:~/archive/u-boot$ make distclean CLEAN scripts/basic duncan@debian:~/archive/u-boot$ make menuconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/mconf.o YACC scripts/kconfig/zconf.tab.c scripts/kconfig/zconf.y:44 parser name defined to default :"parse" "scripts/kconfig/zconf.y", line 97: junk after `%%' in definition section Segmentation fault scripts/Makefile.lib:228: recipe for target 'scripts/kconfig/zconf.tab.c' failed make[1]: *** [scripts/kconfig/zconf.tab.c] Error 139 Makefile:491: recipe for target 'menuconfig' failed make: *** [menuconfig] Error 2 duncan@debian:~/archive/u-boot$ this looks questionable:scripts/kconfig/zconf.y:44 parser name defined to default :"parse" "scripts/kconfig/zconf.y", line 97: junk after `%%' in definition section Debian version duncan@debian:~/archive/u-boot$ cat /etc/debian_version 9.4 Should I redo the debian image? ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Make Menuconfig Error
Karsten Thanks for your lasts response. My apologies, I forget my yahoo email does not quite understand RFC email standards. Here's when I'm at with this version of u-boot. root@debian:/home/duncan/archive/u-boot# make clean root@debian:/home/duncan/archive/u-boot# make menuconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/mconf.o YACC scripts/kconfig/zconf.tab.c scripts/kconfig/zconf.y:44 parser name defined to default :"parse" "scripts/kconfig/zconf.y", line 97: junk after `%%' in definition section Segmentation fault scripts/Makefile.lib:228: recipe for target 'scripts/kconfig/zconf.tab.c' failed make[1]: *** [scripts/kconfig/zconf.tab.c] Error 139 Makefile:491: recipe for target 'menuconfig' failed make: *** [menuconfig] Error 2 root@debian:/home/duncan/archive/u-boot# Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Fw: make config Error
From: Karsten Merker To: Duncan Hare Cc: U-Boot Mailing List Sent: Monday, June 18, 2018 11:43 AM Subject: Re: [U-Boot] Fw: make config Error > > In this repository. It might exist elsewhere. > > I generally use raspbian to compile u-boot for the raspberry > pi, and Debian as a file server. This looks very much like either something in the repository setup on your Raspberry Pi is broken or the package mirror you use has problems. According to http://archive.raspbian.org/raspbian/dists/stable/main/binary-armhf/Packages.xz Raspbian/stable definitely has both flex as well as bison in the main repository: Please refresh your local package information with "sudo apt-get update" and retry installing flex and bison. If that doesn't work, please provide your repository configuration, i.e. the contents of /etc/apt/sources.list and /etc/apt/sources.list.d/*, perhaps we can spot the source of your problem there. Good catch. Raspbian and Debian now fail in identical ways.Thanks Regards, Karsten Werbung sowie der Markt- oder Meinungsforschung. Which is: root@debian:/home/duncan/archive/u-boot# make clean root@debian:/home/duncan/archive/u-boot# make menuconfig... duncan@debian:~/archive/u-boot$ make menuconfig HOSTCC scripts/basic/fixdep scripts/basic/fixdep.c:481:1: fatal error: opening dependency file scripts/basic/.fixdep.d: Permission denied } ^ compilation terminated. scripts/Makefile.host:97: recipe for target 'scripts/basic/fixdep' failed make[1]: *** [scripts/basic/fixdep] Error 1 Makefile:410: recipe for target 'scripts_basic' failed make: *** [scripts_basic] Error 2 duncan@debian:~/archive/u-boot$ ^C duncan@debian:~/archive/u-boot$ There is no .fixdep.d file in pi@raspberrypi:~/server/archive/u-boot/scripts/basic $ ls -al total 44 drwxr-xr-x 2 root root 4096 Jun 15 13:17 . drwxr-xr-x 6 root root 4096 Jun 15 08:39 .. -rwxr-xr-x 1 root root 13992 Jun 15 13:14 fixdep -rw-r--r-- 1 root root 12264 Jun 15 08:39 fixdep.c -rw-r--r-- 1 root root 7 Jun 15 08:39 .gitignore -rw-r--r-- 1 root root 706 Jun 15 08:39 Makefile What content and what permissions does u-boot/scripts/basic/fixdep.d require? Duncan har...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Fw: make config Error
From: Joe Hershberger To: Duncan Hare Cc: Simon Glass ; Joe Hershberger ; u-boot Sent: Friday, June 15, 2018 12:54 PM Subject: Re: [U-Boot] make config Error On Fri, Jun 15, 2018 at 10:56 AM, wrote: > installed bison++ I just "sudo apt-get install flex bison" and it worked great. > > Cloned most recent u-boot 2018.06.14 > ___ Not so much for me: Debian, with flex ncurses5-dev and bison++ root@debian:/home/duncan/archive/u-boot# make clean root@debian:/home/duncan/archive/u-boot# make menuconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/mconf.o YACC scripts/kconfig/zconf.tab.c scripts/kconfig/zconf.y:44 parser name defined to default :"parse" <---? "scripts/kconfig/zconf.y", line 97: junk after `%%' in definition section Segmentation fault scripts/Makefile.lib:228: recipe for target 'scripts/kconfig/zconf.tab.c' failed make[1]: *** [scripts/kconfig/zconf.tab.c] Error 139 Makefile:491: recipe for target 'menuconfig' failed make: *** [menuconfig] Error 2 root@debian:/home/duncan/archive/u-boot# ^C root@debian:/home/duncan/archive/u-boot# Raspbian no flex :-( pi@raspberrypi:~/server/archive/u-boot $ sudo apt install flex Reading package lists... Done Building dependency tree Reading state information... Done Package flex is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'flex' has no installation candidate In this repository. It might exist elsewhere. I generally use raspbian to compile u-boot for the raspberry pi, and Debian as a file server. The 06.15.2018 version works. Instead of installing bits and pieces of the toolchain, how about reverting to the previous version? Is there link to updated documentation for pre-regs? Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Fw: Changing the App to fix a driver problem?
Subject: Re: [U-Boot] [PATCH 2/2] net: ping,arp: Fix cache alignment issues Message-ID: <099414db-a264-a3ac-8aae-fb8aa0d96...@denx.de> Content-Type: text/plain; charset=utf-8; format=flowed On 28.05.2018 08:33, Baruch Siach wrote: > From: Jon Nettleton > > Both ping_receive and arp_receive would transmit a received packet > back out using its original point. This causes problems with > certain network cards that add a custom header to the packet. > Specifically the mvneta driver for the Armada series boards has > a 2 byte Marvell header that is bypassed and passed along to > the system, but that 2 byte offset now causes a misalignment if > it is attempted to be sent back out. > > Rather than changing the driver to memcpy all the received packets > to cache aligned buffers we instead change the two offending > network commands to copy the packet into a cache aligned net_tx_packet > before sending it back out. > > This fixes occasional messages like: > > CACHE: Misaligned operation at range [3fc01082, 3fc010c2] > ___ This is not a good idea. I believe it should be implemented in the driver. Putting it in in the app code leads to confusionas to its purpose. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] SPDX header on .h files
What's the correct format for this header? Patman is complaining about the SPDX header. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Patman - How to send patched with errors
Hi Simon I have forgotten how to override the on errors do not sent patchesoption. tools/patman/patman -c3 -? What's the "?" Thanks Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] arm: Raspberry Pi Compile warnings
Hi Simon Is this is problem? arch/arm/dts/bcm2835-rpi-a-plus.dtb: Warning (phys_property): Missing property '#phy-cells' in node /phy or bad phandle (referred from /soc/usb@7e98:phys[0]) repeated about 6 - 8 times make[2]:'arch/arm/dts/bcm2837-rpi-3-b.dtb' is up to date. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] net: [PATCH v10 3/3] Adding wget
From: Simon Glass <s...@chromium.org> To: Duncan Hare <d...@synoia.com> Cc: "joe.hershber...@ni.com" <joe.hershber...@ni.com>; U-Boot Mailing List <u-boot@lists.denx.de> Sent: Sunday, May 13, 2018 3:00 PM Subject: Re: net: [U-Boot] [PATCH v10 3/3] Adding wget >>>> >>>>Please setup a test that can run in an environment without the >>>>Internet. That is critical for unit tests. >>>> >>>>Hand tests for Internet usage and the environmental effects are great, >>>>but that can't be what we include in the auto tests for repeat-ability >>>>reasons. Simon is asking for a separate type of test. >>> >>> Is the test environment another patch in the series or an addition to the >>> wget patch? >I suggest a separate patch. >>Regards,>>Simon Separate patch, patch 4 of the series or a completely new patch? Conceptual approach: apt-get install nginx (in debian) I'll provide a config file pointing to test kernel a a specified file location. Test kernel will be numbered lines of printable characters. Printable, not binary, easy to expand in a spreadsheet. Can the u-boot print command print sections of memory? That is print $loadaddr $length? That will work for small test kernels, or I tested by using tftp to download a kernel, then used a modified wget to download a seconf time and verify thedownloads were identical. compare $loadaddr1 $loadaddr2 $length Is that a preferred approach? Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] net: [PATCH v10 3/3] Adding wget
>> >>Please setup a test that can run in an environment without the >>Internet. That is critical for unit tests. >> >>Hand tests for Internet usage and the environmental effects are great, >>but that can't be what we include in the auto tests for repeat-ability >>reasons. Simon is asking for a separate type of test. Is the test environment another patch in the series or an addition to the wget patch? Thanks Duncan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v10 3/3] Adding wget
From: Simon Glass <s...@chromium.org> To: Duncan Hare <d...@synoia.com> Cc: Wolfgang Denk <w...@denx.de>; U-Boot Mailing List <u-boot@lists.denx.de>; Joe Hershberger <joe.hershber...@ni.com> Sent: Wednesday, April 25, 2018 4:44 PM Subject: Re: [PATCH v10 3/3] Adding wget Hi Duncan, On 25 April 2018 at 08:33, Duncan Hare <d...@synoia.com> wrote: >> From: Simon Glass <s...@chromium.org> >> To: Duncan Hare <d...@synoia.com> >> Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Joe Hershberger >> <joe.hershber...@ni.com> >> Sent: Tuesday, April 24, 2018 10:01 PM >> Subject: Re: [PATCH v10 3/3] Adding wget >> >> Hi Duncan, >> >>> On 22 April 2018 at 21:22, Duncan Hare <d...@synoia.com> wrote: >>> >>>>The server can be tested with the wget command which >>>> can be installed on linux. >>>> I doubt that loop-back like this will produce the scrambling of packet >>>> order >>>> which is a feature of push down stacks for packet queues >>>> in the internet. >>>> >>>> Hence my comment in a different thread about buffering on the pi. Few of >>>> the >>>> socs appear to use net_pkt_buf buffers for net traffic. >>>> >>>> If there are too many transmission errors the sending tcp drops the >>>> connection. My solution to this is to halve the size of >>>> CONFIG_SYS_RX_ETH_BUFFER until transmission works. >>>> >>> > >>>> Possibly CONFIG_SYS_RX_ETH_BUFFER could come under Kconfig. >>> >>>Just to be clear, I was wondering about having an automated test. Manual >>>> tests are not very useful since people won't do them. See 'make tests' for >>>> all the test that we >currently >run. I'm pretty sure you could standard up >>>> a little server, run your wget, then shut it down, all within a pytest >>>> test. >> >> >>>>Regards, >>>>Simon >> >> Hi Wolfgang. Simon >> >> Can we put a test 4 Mbyte kernel on the u-boot website for an automated test >> for other users of TCP & Wget in u-boot? >> >> Then I can produce a standard u-boot script for testing. >How about the test just creates a little (4KB) file. We don't want the >tests to access a real network, if possible, just use localhost. >Regards, >Simon 4k is 4 packets. I believe most kernels are larger. I was think of a static server set up with a known dns name. Thta's what I've got. Do the test setup once. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v10 3/3] Adding wget
From: Simon Glass <s...@chromium.org> To: Duncan Hare <d...@synoia.com> Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Joe Hershberger <joe.hershber...@ni.com> Sent: Tuesday, April 24, 2018 10:01 PM Subject: Re: [PATCH v10 3/3] Adding wget Hi Duncan, On 22 April 2018 at 21:22, Duncan Hare <d...@synoia.com> wrote: > >>The server can be tested with the wget command which >> can be installed on linux. >> I doubt that loop-back like this will produce the scrambling of packet order >> which is a feature of push down stacks for packet queues >> in the internet. >> >> Hence my comment in a different thread about buffering on the pi. Few of the >> socs appear to use net_pkt_buf buffers for net traffic. >> >> If there are too many transmission errors the sending tcp drops the >> connection. My solution to this is to halve the size of >> CONFIG_SYS_RX_ETH_BUFFER until transmission works. >> > >> Possibly CONFIG_SYS_RX_ETH_BUFFER could come under Kconfig. > >>Just to be clear, I was wondering about having an automated test. Manual >>tests are not very useful since people won't do them. See 'make tests' for >>all the test that we >currently >run. I'm pretty sure you could standard up a >>little server, run your wget, then shut it down, all within a pytest test. >>Regards, >>Simon Hi Wolfgang. Simon Can we put a test 4 Mbyte kernel on the u-boot website for an automated test for other users of TCP & Wget in u-boot? Then I can produce a standard u-boot script for testing. RegardsDuncan Hare ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v10 3/3] Adding wget
>From: Simon Glass <s...@chromium.org> >To: Duncan Hare <d...@synoia.com> >Sent: Sunday, April 22, 2018 1:10 PM >Subject: Re: [PATCH v10 3/3] Adding wget > >Hi Duncan, >On 17 April 2018 at 15:58, Duncan Hare <d...@synoia.com> wrote: >> From: Simon Glass <s...@chromium.org> >> It has been through patman, and the only errors flagged a packed structures, >> necessary for packed headers. >It should be possible in the Python test to enable an http server on localhost >with a few lines of code, and then connect to it in the test? Yes server at port 80. The server can be tested with the wget command which can be installed on linux.I doubt that loop-back like this will produce the scrambling of packet order which is a feature of push down stacks for packet queuesin the internet. The pi is easy to overrun when testing on a low latency network, because the TCP send window size is defined by the number ofnet_rx_buffers, which is controlled the CONFIG_SYS_RX_ETH_BUFFER in include.net.h, which sets PKTBUFSRX at the beginning of include/net.h, which in-turn defines a buffer pool in net/net.c, array named net_pkt_buf. Hence my comment in a different thread about buffering on the pi. Few of the socs appear to use net_pkt_buf buffers for net traffic. If there are too many transmission errors the sending tcp drops the connection. My solution to this is to halve the size of CONFIG_SYS_RX_ETH_BUFFER until transmission works. If I was thinking about a buffer pool for in the drivers, I'd implement it in net/net.c. Interface "getbuffer," returns a pointer, and increments an index to the next net_rx_buffer with no protection for overrun. Overrun is managed by ack numbers in TCPand timeout in UDP. Possibly CONFIG_SYS_RX_ETH_BUFFER could come under Kconfig. >Regards, >Simon RegardsDuncan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Network Packet Buffers: raspberrypi: variable uchar *net_rx_packets[PKTBUFSRX] in net/net.c
From: Simon Glass <s...@chromium.org> To: Duncan Hare <d...@synoia.com> Cc: Joe Hershberger <joe.hershber...@ni.com>; U-Boot Mailing List <u-boot@lists.denx.de> Sent: Sunday, April 22, 2018 1:15 PM Subject: Re: Network Packet Buffers: raspberrypi: variable uchar *net_rx_packets[PKTBUFSRX] in net/net.c Hi Duncan, >On 17 April 2018 at 12:59, Duncan Hare <d...@synoia.com> wrote: >> Simon >> >> Is it possible to modify the network driver for the raspberry pi to use >> the buffer pool defined in net.c? >> >> It appears to have a single buffer, defined in the driver. >> >> In addition the buffer pool should be defined in memory outside the >> u-boot image. With the current definition is the buffer pool a >> part of the u-boot image? >Are you referring to the USB driver? If so, which one? Normally the buffers >are in BSS if they are not allocated with malloc(). So the buffers are not in >the U-Boot image in flash, >but do take up space in RAM at run-time after >relocation. Do not recall the filename of the driver. >Regards, >Simon Hi Simon Ethernet driver. But it might also be the usb driver . I don't know the detail at that level of the raspberry soc. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v10 3/3] Adding wget
Hi Duncan, On 14 April 2018 at 17:43, <d...@synoia.com> wrote: >> From: Duncan Hare <duncanch...@yahoo.com> >> > Why http and wget: >> END Why END? Don't know. will delete. > > Signed-off-by: Duncan Hare <duncanch...@yahoo.com> > --- > > Changes in v10: None There is no change log here. Has nothing changed since v1? changed c to C for cover meno tag. This code looks OK to me, but please can you run it through patman? I see what look like some style errors. Has passed patman. Only error messages are for packed structures. How can we create a test for this? Can we add something to test_net.py ? Do not see why not. It's only an app and has no hardware dependencies. One needs a web server and test file, and code the verify the integrity of the test file in local memory.I used a file with line numbers and a pattern repeated on every "line". Make it easy to findinvalid offsets mis ordered packets. We use nginx as the web server. We used wbox for a while, but then mvbed to nginx. We could not get Apacheconfigured. For internet test we use a Ubuntu image & nginx on the Amazon cloud. The internet path to Amazon does a nice job of scrambling the order of packets. Regards, Duncan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Network Packet Buffers: raspberrypi: variable uchar *net_rx_packets[PKTBUFSRX] in net/net.c
Simon Is it possible to modify the network driver for the raspberry pi to use the buffer pool defined in net.c? It appears to have a single buffer, defined in the driver. In addition the buffer pool should be defined in memory outside the u-boot image. With the current definition is the buffer pool a part of the u-boot image? Thanks Duncan Hare ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 03/11] net: Move net command options to the cmd menu
From: Joe Hershberger <joe.hershber...@ni.com> To: u-boot@lists.denx.de Cc: Heinrich <schuchardt.xypron.deb...@gmx.de>; Michal Simek <michal.si...@xilinx.com>; Simon Glass <s...@chromium.org>; Duncan Hare <d...@synoia.com>; Chris Packham <judge.pack...@gmail.com>; Tom Rini <tr...@konsulko.com>; Maxime Ripard <maxime.rip...@bootlin.com>; Joe Hershberger <joe.hershber...@ni.com> Sent: Friday, April 13, 2018 1:28 PM Subject: [PATCH v2 03/11] net: Move net command options to the cmd menu Options that controlled the tftp and bootp commands depended on their commands, but lived in the net menu. Move them so they are in a consistent location. Signed-off-by: Joe Hershberger <joe.hershber...@ni.com> Reviewed-by: Chris Packham <judge.pack...@gmail.com>Reviewed-by: Duncan Hare <d...@synoia.com> config CMD_NFS bool "nfs" default y help Acquire a network IP address using the link-local protocol Should Help text be "Transfer file with NFS Protocol" ? ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 3/9] net: Move the DHCP command below the BOOTP command
From: Joe Hershberger <joe.hershber...@ni.com> To: u-boot@lists.denx.de Cc: Heinrich <schuchardt.xypron.deb...@gmx.de>; Michal Simek <michal.si...@xilinx.com>; Simon Glass <s...@chromium.org>; Duncan Hare <d...@synoia.com>; Tom Rini <tr...@konsulko.com>; Maxime Ripard <maxime.rip...@bootlin.com>; Joe Hershberger <joe.hershber...@ni.com> Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 3/9] net: Move the DHCP command below the BOOTP command Move DHCP to directly follow BOOTP so that Kconfig can show the dependency as a hierarchy. Signed-off-by: Joe Hershberger <joe.hershber...@ni.com> --- cmd/Kconfig | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index d714f73..7ef9501 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1024,6 +1024,12 @@ config CMD_BOOTP help bootp - boot image via network using BOOTP/TFTP protocol +config CMD_DHCP + bool "dhcp" + depends on CMD_BOOTP + help + Boot image via network using DHCP/TFTP protocol + config BOOTP_BOOTPATH bool "Enable BOOTP BOOTPATH" depends on CMD_BOOTP @@ -1097,12 +1103,6 @@ config CMD_RARP help Boot image via network using RARP/TFTP protocol -config CMD_DHCP - bool "dhcp" - depends on CMD_BOOTP - help - Boot image via network using DHCP/TFTP protocol - config CMD_PXE bool "pxe" select MENU -- 1.7.11.5 Reviewed by: Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 5/9] net: Add the BOOTP_DNS2 option to Kconfig
From: Joe Hershberger <joe.hershber...@ni.com> To: u-boot@lists.denx.de Cc: Heinrich <schuchardt.xypron.deb...@gmx.de>; Michal Simek <michal.si...@xilinx.com>; Simon Glass <s...@chromium.org>; Duncan Hare <d...@synoia.com>; Tom Rini <tr...@konsulko.com>; Maxime Ripard <maxime.rip...@bootlin.com>; Joe Hershberger <joe.hershber...@ni.com> Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 5/9] net: Add the BOOTP_DNS2 option to Kconfig Commit 3b3ea2c56ec4bc5 ("Kconfig: cmd: Make networking command dependent on NET") removed the help documentation from the README but didn't add it back to Kconfig. Signed-off-by: Joe Hershberger <joe.hershber...@ni.com> --- cmd/Kconfig | 11 +++ 1 file changed, 11 insertions(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index 76fd111..db75759 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1045,6 +1045,17 @@ config BOOTP_DNS returned, you must set BOOTP_DNS2 to store that second server IP also. +config BOOTP_DNS2 + bool "Store 'dnsip2' from BOOTP/DHCP server" + depends on BOOTP_DNS + help + If a DHCP client requests the DNS server IP from a DHCP server, + it is possible that more than one DNS serverip is offered to the + client. If CONFIG_BOOTP_DNS2 is enabled, the secondary DNS + server IP will be stored in the additional environment + variable "dnsip2". The first DNS serverip is always + stored in the variable "dnsip", when BOOTP_DNS is defined. + config BOOTP_GATEWAY bool "Request & store 'gatewayip' from BOOTP/DHCP server" depends on CMD_BOOTP -- 1.7.11.5Joe Good. Thanks. Reviewed by: Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 6/9] net: Improve BOOTP PXE config option
From: Joe Hershberger <joe.hershber...@ni.com> To: u-boot@lists.denx.de Cc: Heinrich <schuchardt.xypron.deb...@gmx.de>; Michal Simek <michal.si...@xilinx.com>; Simon Glass <s...@chromium.org>; Duncan Hare <d...@synoia.com>; Tom Rini <tr...@konsulko.com>; Maxime Ripard <maxime.rip...@bootlin.com>; Joe Hershberger <joe.hershber...@ni.com> Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 6/9] net: Improve BOOTP PXE config option Improve the documentation and correct the listed dependencies. Signed-off-by: Joe Hershberger <joe.hershber...@ni.com> --- cmd/Kconfig | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index db75759..cc059c4 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1071,12 +1071,14 @@ config BOOTP_SUBNETMASK depends on CMD_BOOTP config BOOTP_PXE - bool "Enable BOOTP PXE" - depends on CMD_BOOTP + bool "Send PXE client arch to BOOTP/DHCP server" + depends on CMD_BOOTP && CMD_PXE + help + Supported for ARM, ARM64, and x86 for now. config BOOTP_PXE_CLIENTARCH hex - depends on CMD_BOOTP + depends on BOOTP_PXE default 0x16 if ARM64 default 0x15 if ARM default 0 if X86 -- 1.7.11.5 Reviewed by: Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 7/9] net: Make the BOOTP options default
From: Joe Hershberger <joe.hershber...@ni.com> To: u-boot@lists.denx.de Cc: Heinrich <schuchardt.xypron.deb...@gmx.de>; Michal Simek <michal.si...@xilinx.com>; Simon Glass <s...@chromium.org>; Duncan Hare <d...@synoia.com>; Tom Rini <tr...@konsulko.com>; Maxime Ripard <maxime.rip...@bootlin.com>; Joe Hershberger <joe.hershber...@ni.com> Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 7/9] net: Make the BOOTP options default The BOOTP options used to be and should still be default for all boards with CMD_NET enabled. One should not be forced to use DISTRO_DEFAULTS to get them. Signed-off-by: Joe Hershberger <joe.hershber...@ni.com> --- Kconfig | 6 -- cmd/Kconfig | 6 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Kconfig b/Kconfig index 6670913..17e6212 100644 --- a/Kconfig +++ b/Kconfig @@ -79,12 +79,6 @@ config DISTRO_DEFAULTS select CMD_PING if NET select CMD_PART if PARTITIONS select HUSH_PARSER - select BOOTP_BOOTPATH if NET && CMD_NET - select BOOTP_DNS if NET && CMD_NET - select BOOTP_GATEWAY if NET && CMD_NET - select BOOTP_HOSTNAME if NET && CMD_NET - select BOOTP_PXE if NET && CMD_NET - select BOOTP_SUBNETMASK if NET && CMD_NET select CMDLINE_EDITING select AUTO_COMPLETE select SYS_LONGHELP diff --git a/cmd/Kconfig b/cmd/Kconfig index cc059c4..6eff18f 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1032,6 +1032,7 @@ config CMD_DHCP config BOOTP_BOOTPATH bool "Request & store 'rootpath' from BOOTP/DHCP server" + default y depends on CMD_BOOTP help Even though the config is called BOOTP_BOOTPATH, it stores the @@ -1039,6 +1040,7 @@ config BOOTP_BOOTPATH config BOOTP_DNS bool "Request & store 'dnsip' from BOOTP/DHCP server" + default y depends on CMD_BOOTP help The primary DNS server is stored as 'dnsip'. If two servers are @@ -1058,20 +1060,24 @@ config BOOTP_DNS2 config BOOTP_GATEWAY bool "Request & store 'gatewayip' from BOOTP/DHCP server" + default y depends on CMD_BOOTP config BOOTP_HOSTNAME bool "Request & store 'hostname' from BOOTP/DHCP server" + default y depends on CMD_BOOTP help The name may or may not be qualified with the local domain name. config BOOTP_SUBNETMASK bool "Request & store 'netmask' from BOOTP/DHCP server" + default y depends on CMD_BOOTP config BOOTP_PXE bool "Send PXE client arch to BOOTP/DHCP server" + default y depends on CMD_BOOTP && CMD_PXE help Supported for ARM, ARM64, and x86 for now. -- 1.7.11.5 Reviewed by: Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 8/9] net: Make core net code depend on NET instead of CMD_NET
From: Joe Hershberger <joe.hershber...@ni.com> To: u-boot@lists.denx.de Cc: Heinrich <schuchardt.xypron.deb...@gmx.de>; Michal Simek <michal.si...@xilinx.com>; Simon Glass <s...@chromium.org>; Duncan Hare <d...@synoia.com>; Tom Rini <tr...@konsulko.com>; Maxime Ripard <maxime.rip...@bootlin.com>; Joe Hershberger <joe.hershber...@ni.com> Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 8/9] net: Make core net code depend on NET instead of CMD_NET No commands are necessary to have a network stack. Signed-off-by: Joe Hershberger <joe.hershber...@ni.com> --- net/Makefile | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/Makefile b/net/Makefile index ed102ec..95e9f63 100644 --- a/net/Makefile +++ b/net/Makefile @@ -8,18 +8,18 @@ #ccflags-y += -DDEBUG obj-y += checksum.o -obj-$(CONFIG_CMD_NET) += arp.o +obj-$(CONFIG_NET) += arp.o obj-$(CONFIG_CMD_BOOTP) += bootp.o obj-$(CONFIG_CMD_CDP) += cdp.o obj-$(CONFIG_CMD_DNS) += dns.o ifdef CONFIG_DM_ETH -obj-$(CONFIG_CMD_NET) += eth-uclass.o +obj-$(CONFIG_NET) += eth-uclass.o else -obj-$(CONFIG_CMD_NET) += eth_legacy.o +obj-$(CONFIG_NET) += eth_legacy.o endif -obj-$(CONFIG_CMD_NET) += eth_common.o +obj-$(CONFIG_NET) += eth_common.o obj-$(CONFIG_CMD_LINK_LOCAL) += link_local.o -obj-$(CONFIG_CMD_NET) += net.o +obj-$(CONFIG_NET) += net.o obj-$(CONFIG_CMD_NFS) += nfs.o obj-$(CONFIG_CMD_PING) += ping.o obj-$(CONFIG_CMD_RARP) += rarp.o -- 1.7.11.5 Reviewed by Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 9/9] Revert "Kconfig: cmd: Make networking command dependent on NET"
From: Joe Hershberger <joe.hershber...@ni.com> To: u-boot@lists.denx.de Cc: Heinrich <schuchardt.xypron.deb...@gmx.de>; Michal Simek <michal.si...@xilinx.com>; Simon Glass <s...@chromium.org>; Duncan Hare <d...@synoia.com>; Tom Rini <tr...@konsulko.com>; Maxime Ripard <maxime.rip...@bootlin.com>; Joe Hershberger <joe.hershber...@ni.com> Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 9/9] Revert "Kconfig: cmd: Make networking command dependent on NET" This reverts the parts of commit 3b3ea2c56ec4bc5588281fd103c744e608f8b25c where it changed the EFI dependency on NET. Signed-off-by: Joe Hershberger <joe.hershber...@ni.com> --- Kconfig | 2 +- cmd/bootefi.c | 4 ++-- lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_device_path.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Kconfig b/Kconfig index 17e6212..89f685b 100644 --- a/Kconfig +++ b/Kconfig @@ -70,7 +70,7 @@ config DISTRO_DEFAULTS select CMD_BOOTZ if ARM && !ARM64 select CMD_BOOTI if ARM64 select CMD_DHCP if NET && CMD_NET - select CMD_PXE if NET && CMD_NET + select CMD_PXE if NET select CMD_EXT2 select CMD_EXT4 select CMD_FAT diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 6546272..7b1c09f 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -42,7 +42,7 @@ static void efi_init_obj_list(void) #if defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO) efi_gop_register(); #endif -#ifdef CONFIG_CMD_NET +#ifdef CONFIG_NET efi_net_register(); #endif #ifdef CONFIG_GENERATE_SMBIOS_TABLE @@ -450,7 +450,7 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path) bootefi_device_path = efi_dp_from_part(desc, part); } else { -#ifdef CONFIG_CMD_NET +#ifdef CONFIG_NET bootefi_device_path = efi_dp_from_eth(); #endif } diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 2a87d9e..2722265 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -21,5 +21,5 @@ obj-y += efi_file.o efi_variable.o efi_bootmgr.o efi_watchdog.o obj-$(CONFIG_LCD) += efi_gop.o obj-$(CONFIG_DM_VIDEO) += efi_gop.o obj-$(CONFIG_PARTITIONS) += efi_disk.o -obj-$(CONFIG_CMD_NET) += efi_net.o +obj-$(CONFIG_NET) += efi_net.o obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += efi_smbios.o diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 3c735e6..ecc4eda 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -746,7 +746,7 @@ struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part, return start; } -#ifdef CONFIG_CMD_NET +#ifdef CONFIG_NET struct efi_device_path *efi_dp_from_eth(void) { struct efi_device_path_mac_addr *ndp; -- 1.7.11.5 Reviewed by Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/9] net: Make CMD_NET a menuconfig
From: Joe Hershberger <joe.hershber...@ni.com> To: u-boot@lists.denx.de Cc: Heinrich <schuchardt.xypron.deb...@gmx.de>; Michal Simek <michal.si...@xilinx.com>; Simon Glass <s...@chromium.org>; Duncan Hare <d...@synoia.com>; Tom Rini <tr...@konsulko.com>; Maxime Ripard <maxime.rip...@bootlin.com>; Joe Hershberger <joe.hershber...@ni.com> Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 1/9] net: Make CMD_NET a menuconfig Previously, CMD_NET was an alias for 2 commands (bootp and tftpboot) and they we not able to be disabled. Separate out those 2 commands and move CMD_NET up to the menu level, which more accurately represents the code. Signed-off-by: Joe Hershberger <joe.hershber...@ni.com> --- cmd/Kconfig | 25 + cmd/net.c | 4 net/Kconfig | 19 +-- net/Makefile | 4 ++-- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 136836d..f2a12ce 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1010,25 +1010,35 @@ config CMD_SETEXPR endmenu -menu "Network commands" - if NET -config CMD_NET - bool "bootp, tftpboot" +menuconfig CMD_NET + bool "Network commands" + default y + +if CMD_NET + +config CMD_BOOTP + bool "bootp" default y help - Network commands. bootp - boot image via network using BOOTP/TFTP protocol + +config CMD_TFTPBOOT + bool "tftpboot" + default y + help tftpboot - boot image via network using TFTP protocol config CMD_TFTPPUT bool "tftp put" + depends on CMD_TFTPBOOT help TFTP put command, for uploading files to a server config CMD_TFTPSRV bool "tftpsrv" + depends on CMD_TFTPBOOT help Act as a TFTP server and boot the first received file @@ -1039,13 +1049,12 @@ config CMD_RARP config CMD_DHCP bool "dhcp" - depends on CMD_NET + depends on CMD_BOOTP help Boot image via network using DHCP/TFTP protocol config CMD_PXE bool "pxe" - depends on CMD_NET select MENU help Boot image via network using PXE protocol @@ -1096,7 +1105,7 @@ config CMD_ETHSW endif -endmenu +endif menu "Misc commands" diff --git a/cmd/net.c b/cmd/net.c index d7c776a..67888d4 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -14,6 +14,7 @@ static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []); +#ifdef CONFIG_CMD_BOOTP static int do_bootp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return netboot_common(BOOTP, cmdtp, argc, argv); @@ -24,7 +25,9 @@ U_BOOT_CMD( "boot image via network using BOOTP/TFTP protocol", "[loadAddress] [[hostIPaddr:]bootfilename]" ); +#endif +#ifdef CONFIG_CMD_TFTPBOOT int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int ret; @@ -40,6 +43,7 @@ U_BOOT_CMD( "boot image via network using TFTP protocol", "[loadAddress] [[hostIPaddr:]bootfilename]" ); +#endif #ifdef CONFIG_CMD_TFTPPUT static int do_tftpput(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) diff --git a/net/Kconfig b/net/Kconfig index 143c441..d421a34 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -24,7 +24,7 @@ config NETCONSOLE config NET_TFTP_VARS bool "Control TFTP timeout and count through environment" - depends on CMD_NET + depends on CMD_TFTPBOOT default y help If set, allows controlling the TFTP timeout through the @@ -35,39 +35,38 @@ config NET_TFTP_VARS config BOOTP_BOOTPATH bool "Enable BOOTP BOOTPATH" - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_DNS bool "Enable bootp DNS" - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_GATEWAY bool "Enable BOOTP gateway" - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_HOSTNAME bool "Enable BOOTP hostname" - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_PXE bool "Enable BOOTP PXE" - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_SUBNETMASK bool "Enable BOOTP subnetmask" - depends on CMD_NET - depends on CMD_NET + depends on CMD_BOOTP config BOOTP_PXE_CLIENTARCH hex - depends on CMD_NET + depends on CMD_BOOTP default 0x16 if ARM64 default 0x15 if ARM default 0 if X86 config BOOTP_VCI_STRING string - depends on CMD_NET + depends on CMD_BOOTP default "U-Boot.armv7" if CPU_V7 || CPU_V7M default "U-Boot.armv8" if ARM64 default "U-Boot.arm" if ARM diff --git a/net/Makefile b/net/Makefile index ae54eee..ed102ec 100644 --- a/net/Makefile +++ b/net/Makefile @@ -9,7 +9,7 @@ obj-y += checksum.o obj-$(CONFIG_
Re: [U-Boot] [PATCH 0/9] net: Clean up the menus and dependencies among commands and options
From: Joe Hershberger <joe.hershber...@ni.com> To: u-boot@lists.denx.de Cc: Heinrich <schuchardt.xypron.deb...@gmx.de>; Michal Simek <michal.si...@xilinx.com>; Simon Glass <s...@chromium.org>; Duncan Hare <d...@synoia.com>; Tom Rini <tr...@konsulko.com>; Maxime Ripard <maxime.rip...@bootlin.com>; Joe Hershberger <joe.hershber...@ni.com> Sent: Wednesday, March 28, 2018 1:53 PM Subject: [PATCH 0/9] net: Clean up the menus and dependencies among commands and options There have been a few issues persisting in the net menus and a recent change that went in (Kconfig: cmd: Make networking command dependent on NET) caused a few new issues. Clean up these things and further move to separate CMD_NET from NET along appropriate boundaries. Joe Hershberger (9): net: Make CMD_NET a menuconfig net: Move net command options to the cmd menu net: Move the DHCP command below the BOOTP command net: Improve menu options and help for BOOTP options net: Add the BOOTP_DNS2 option to Kconfig net: Improve BOOTP PXE config option net: Make the BOOTP options default net: Make core net code depend on NET instead of CMD_NET Revert "Kconfig: cmd: Make networking command dependent on NET" Kconfig | 8 +-- cmd/Kconfig | 113 ++- cmd/bootefi.c | 4 +- cmd/net.c | 4 ++ lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_device_path.c | 2 +- net/Kconfig | 51 -- net/Makefile | 14 ++--- 8 files changed, 116 insertions(+), 82 deletions(-) -- 1.7.11.5 Reviewed by Duncan Hare, d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Fw: dhcp command not populating dnsip environment variable
Begin forwarded message: Date: Mon, 19 Mar 2018 14:57:59 -0700 From: Duncan Hare <d...@synoia.com> To: Duncan Hare <d...@synoia.com> Subject: Re: [U-Boot] dhcp command not populating dnsip environment variable > >On Sun, Mar 18, 2018 at 3:01 PM, Duncan Hare <d...@synoia.com> wrote: > > Cause: u-boot/Kconfig DISTRO_DEFAULTS missing variables in Kconfig > > files > > > > BOOTP_BOOTPATH > > BOOTP_DNS > > BOOTP_GATEWAY > > BOOTP_HOSTNAME > > BOOTP_SUBNETMASK > >BOOTP_PXE > It seems like we should imply them. That means we always get good > defaults but can still disable them if desired. All of the above defined in net/KConfig? net/Kconfig adds config BOOTP_BOOTPATH config BOOTP_DNS config BOOTP_GATEWAY config BOOTP_HOSTNAME config BOOTP_SUBNETMASK config BOOTP_PXE and in the distro_defaults change the select verb to imply? Or imply them all under the cmd/net.c BOOTP command? ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v8 1/3] Adding TCP and wget into u-boot
On Mon, 19 Mar 2018 09:53:24 + Calvin Johnsonwrote: > > > > > void net_set_udp_header(uchar *pkt, struct in_addr dest, int > > > > dport, > > > > - int sport, int len); > > > > - > > > > + int sport, int len); > > > > > Why do you need this change in the set_udp_header? > > > > This is a shim to bridge between the original udp to ip procedure > > call and the extra parameters in the enhanced ip procedure call to > > the ip layer for TCP. > > > > The original udp call is unchanged, because I did not want a > > change to a procedure call to ripple through many applications. > > For now, I'm okay with the change you made to net_set_ip_header. > > - int sport, int len); > - > + int sport, int len); > I'm concerned about above 3 line change. Here, you are decreasing > indent and removing an empty line. This change may not be required. yes, I don't remember this, but its probably driven by patman messages. These are both issues which can generated patman error messages. Duncan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v8 1/3] Adding TCP and wget into u-boot
On Sat, 17 Mar 2018 16:36:14 + Calvin Johnsonwrote: > It would be good to have this cosmetic change into a separate patch. Ok. But at this stage I'm at the "Forgive me Lord for I know not what I do" > IMO, better place for this definition and associated explanation > would be above the comment describing PKTBUFSRX, i.e after > immediately after below line. #define DEBUG_INT_STATE 0 /* > Internal network state changes */ Done > > #define IPPROTO_ICMP1 /* Internet Control Message > > Protocol*/ #define IPPROTO_UDP 17 /* User > > Datagram Protocol */ +#define IPPROTO_TCP > > 6 /* Transmission Control Protocol*/ > > Better to sort IPPROTO in ascending order But, but protocol alphabetical order is so much prettier!! (Done in numerical order). > > /* Set IP header */ > > -void net_set_ip_header(uchar *pkt, struct in_addr dest, struct > > in_addr source); +void net_set_ip_header(uchar *pkt, struct in_addr > > dest, struct in_addr source, > > + u16 pkt_len, u8 prot); > > void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, > > - int sport, int len); > > - > > + int sport, int len); > Why do you need this change in the set_udp_header? This is a shim to bridge between the original udp to ip procedure call and the extra parameters in the enhanced ip procedure call to the ip layer for TCP. The original udp call is unchanged, because I did not want a change to a procedure call to ripple through many applications. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] dhcp command not populating dnsip environment variable
Cause: u-boot/Kconfig DISTRO_DEFAULTS missing variables in Kconfig files u-boot/ config DISTRO_DEFAULTS contains these directives: select HUSH_PARSER select BOOTP_BOOTPATH if NET && CMD_NET select BOOTP_DNS if NET && CMD_NET select BOOTP_GATEWAY if NET && CMD_NET select BOOTP_HOSTNAME if NET && CMD_NET select BOOTP_PXE if NET && CMD_NET select BOOTP_SUBNETMASK if NET && CMD_NET select CMDLINE_EDITING select AUTO_COMPLETE select SYS_LONGHELP However net/Kconfig has no references to: BOOTP_BOOTPATH BOOTP_DNS BOOTP_GATEWAY BOOTP_HOSTNAME BOOTP_PXE BOOTP_SUBNETMASK and possibly common/Kconfig no reference to HUSH_PARSER CMDLINE_EDITING AUTO_COMPLETE SYS_LONGHELP Synptom: Causing the lack of option returned on a dhcp request. Solutions: Three possible solutions to net/Kconfig omissions 1. Add them to Kconfig and select then cmd/Kconfig 2. As they are bootp/dhcp options, always include them ny removing the preprocessor (ifdef) selections. The code fragments they require are small, as is the space for the options returned. 3.Configure them when NET and BOOTP or DHCP commands are selected. It appears they are subordinate to NET features and not stand alone config options. I recommend (2). I'm from the simple is good school. This level of granularity of configuration of the bootp/dchp options appears unnecessary. Further action There needs to be a compile time warning when a select clause in Kconfig references a directive which does not exist in any included Kconfig file. Mysteries which require days to find the config variable or days to resolve are not user friendly. Any Kconfig define which requires more than a second level menu option needs close scrutiny. As much as possible a third or higher level configuration define should be controlled by a "select" by lower level Kconfig selection. For documentation there needs to be an autogenerated Kconfig tree, of the complete tree and with highlighted currently selected items. An example of this is the systemd "systemctl list dependencies" command. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] dhcp command not populating dnsip environment variable
On Thu, Mar 15, 2018 at 3:25 PM, Duncan Hare <d...@synoia.com> wrote: > In the latest version of u-boot, the dhcp command appears not to > populate the environment variable dnsip. This used to be the behaviour. ___ The bootp.c code was changed with the addition of Kconfig control of Bootp.c (of which dhcp is a part).There does not appear to be the cond in net/ Kconfig to manage the Bootp config in menuconfig. The change log at the top of bootp.c has no note to indicate the module was changed. Adding the note would appears to be the proper process. How many other source code modules have been changed without a change note?Finding this has taken two or three days. I can find no entries in .config nor in menuconfig to configure the bootp options. Would you like me to prepare a patch for net/Kconfig? Duncan Hare ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] dhcp command not populating dnsip environment variable
From: Joe Hershberger <joe.hershber...@ni.com> To: Duncan Hare <d...@synoia.com> Cc: u-boot <u-boot@lists.denx.de>; Joe Hershberger <joe.hershber...@ni.com> Sent: Thursday, March 15, 2018 1:29 PM Subject: Re: [U-Boot] dhcp command not populating dnsip environment variable On Thu, Mar 15, 2018 at 3:25 PM, Duncan Hare <d...@synoia.com> wrote: > In the latest version of u-boot, the dhcp command appears not to > populate the environment variable dnsip. This used to be the behaviour. Is it possible that your DHCP server isn't sending it? It seems like the code isn't changed. > > The dns command works, if dnsip is populated manually. > > Is the a Kconfig variable controlling this? Or is there a new > environment variable? > > Thanks > > Duncan Hare > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot Joe Thanks, you gave me an idea. I fired up wireshark See attached. Old release: Before Kconfig work options requested (many) including DNS server address After: No options I see no where in u-boot to set DHCP options. Kconfig is a good idea. HOWEVER, the previous defaults should be selected as the base set. Choosing The NULL set is a very unfriendly choice. What do we do to resolve this? Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] dhcp command not populating dnsip environment variable
In the latest version of u-boot, the dhcp command appears not to populate the environment variable dnsip. This used to be the behaviour. The dns command works, if dnsip is populated manually. Is the a Kconfig variable controlling this? Or is there a new environment variable? Thanks Duncan Hare ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Bootcmd, Autorun and Hush Shell
Tom Can you help with this? 1. In the latest version of u-boot bootcmd , now under Kconfig, does not appear to be run automatically on startup. Is there a configuration parameter for this? 2. The hush shell now does not print the value of a variable for editing, to et one edit the variable value either left arrow, or backspace. Is the edit function now changed? Thanks Duncan Hare ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] U-boot Hush Environment
In the past the Hush shell would print a variable when edited, and on could back arrow (move position) or backspace (delete characters). Currently is does not print the command on edit, and if one hits carriage return the variable is deleted. Is this an enhancement, or do I have the configuration incorrect? How can I make it do what was the default behavior? If it is an enhancement, It's not very user friendly. It makes IBM's VM/370 edit command look positively useful. Thanks Duncan Hare (d...@synoia.com) ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] usb command missing?
In the latest git download the usb command appears turned off. I checked make menuconfig and usb appears turned on. I compared the .config file with my previous, older .config command and all the usb defines appeared to be the same. Please help me understand how I can get this command working. u-boot reports the usb command is unknown. Thanks Duncan Hare ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] TCP Patch Set
On Mon, 12 Feb 2018 13:35:11 -0600 Joe Hershbergerwrote: > >> >> > >> >> > I need to determine if it > >> >> > uses CONFIG_SYS_RX_ETH_BUFFER" from net.h and the > >> >> > "net_rx_packets" buffer pool defined in net/net.c > >> >> > > >> > > >> > Two solutions: > >> > > >> > Option 1. > >> > > >> > >> I think option 1 is the way to go. > >> > >> Thanks, > >> -Joe > > > > Joe > > > > The overruns were caused by printing error messages. The print > > process is (very) slow compared with packet and computer speeds, and > > causes overruns. > > > > I turned off all the error messages in tcp.c and the overruns also > > stopped. > > > > Duncan --- Joe I'm now at the state where I'm satisfied the selective acknowledgment implementation is working well, having re-written the code. I've transferred 20 4 Mbyte kernels from cloud to desktop without a failure. How to proceed? Issue the patch set again? Or just the TCP module? Then what's the next step? Regards Duncan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] TCP & Overrrun
On Sun, 11 Feb 2018 00:39:05 + (UTC) Duncan Hare <d...@synoia.com> wrote: > Duncan Hare > > 714 931 7952 > > > - Forwarded Message - > From: Joe Hershberger <joe.hershber...@ni.com> > To: Duncan Hare <d...@synoia.com> > Cc: Joe Hershberger <joe.hershber...@ni.com>; u-boot > <u-boot@lists.denx.de> Sent: Friday, February 9, 2018 1:11 PM > Subject: Re: [U-Boot] TCP & Overrrun > > On Thu, Feb 8, 2018 at 8:41 PM, Duncan Hare <d...@synoia.com> wrote: > > On Thu, 8 Feb 2018 22:15:44 + (UTC) > > Duncan Hare <d...@synoia.com> wrote: > > > >> Duncan Hare > >> > >> 714 931 7952 > >> > >> > >> - Forwarded Message - > >> From: Joe Hershberger <joe.hershber...@ni.com> > >> To: Duncan Hare <d...@synoia.com> > >> Cc: u-boot <u-boot@lists.denx.de>; Joe Hershberger > >> <joe.hershber...@ni.com> Sent: Thursday, February 8, 2018 11:40 AM > >> Subject: Re: [U-Boot] TCP & Overrrun > >> > >> Hi Duncan, > >> > >> On Wed, Feb 7, 2018 at 8:40 PM, Duncan Hare <d...@synoia.com> > >> wrote: > >> > I'm gettin overrun on the raspberry pi. > >> > > >> > Which ethernet drived does it use? > >> > >> You didn't specify which one you are talking about, but here's how > >> to find out... > >> > >> Assuming rpi3, find the config first... > >> > >> configs/rpi_3_defconfig says: > >> CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" > >> arch/arm/dts/bcm2837-rpi-3-b.dts says: #include > >> "bcm283x-rpi-smsc9514.dtsi" arch/arm/dts/bcm283x-rpi-smsc9514.dtsi > >> says: ethernet: usbether@1 { > >> compatible = "usb424,ec00"; grep -rn ec00 drivers/ says: > >> drivers/usb/eth/smsc95xx.c > >> > >> Cheers, > >> -Joe > >> > >> > I need to determine if it > >> > uses CONFIG_SYS_RX_ETH_BUFFER" from net.h and the > >> > "net_rx_packets" buffer pool defined in net/net.c > >> > > >> > grep suggests it is not using net_rx_packets. > >> > > >> > Thanks > >> > > >> > Duncan Hare > >> > ___ > >> > U-Boot mailing list > >> > U-Boot@lists.denx.de > >> > https://lists.denx.de/listinfo/u-boot > > ___ > > Joe > > > > Two solutions: > > > > Option 1. > > > > I think option 1 is the way to go. > > Thanks, > -Joe Joe The overruns were caused by printing error messages. The print process is (very) slow compared with packet and computer speeds, and causes overruns. I turned off all the error messages in tcp.c and the overruns also stopped. Makes debugging harder. Duncan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] TCP & Overrrun
On Thu, 8 Feb 2018 22:15:44 + (UTC) Duncan Hare <d...@synoia.com> wrote: > Duncan Hare > > 714 931 7952 > > > - Forwarded Message - > From: Joe Hershberger <joe.hershber...@ni.com> > To: Duncan Hare <d...@synoia.com> > Cc: u-boot <u-boot@lists.denx.de>; Joe Hershberger > <joe.hershber...@ni.com> Sent: Thursday, February 8, 2018 11:40 AM > Subject: Re: [U-Boot] TCP & Overrrun > > Hi Duncan, > > On Wed, Feb 7, 2018 at 8:40 PM, Duncan Hare <d...@synoia.com> wrote: > > I'm gettin overrun on the raspberry pi. > > > > Which ethernet drived does it use? > > You didn't specify which one you are talking about, but here's how to > find out... > > Assuming rpi3, find the config first... > > configs/rpi_3_defconfig says: > CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" > arch/arm/dts/bcm2837-rpi-3-b.dts says: #include > "bcm283x-rpi-smsc9514.dtsi" arch/arm/dts/bcm283x-rpi-smsc9514.dtsi > says: ethernet: usbether@1 { > compatible = "usb424,ec00"; grep -rn ec00 drivers/ says: > drivers/usb/eth/smsc95xx.c > > Cheers, > -Joe > > > I need to determine if it > > uses CONFIG_SYS_RX_ETH_BUFFER" from net.h and the "net_rx_packets" > > buffer pool defined in net/net.c > > > > grep suggests it is not using net_rx_packets. > > > > Thanks > > > > Duncan Hare > > ___ > > U-Boot mailing list > > U-Boot@lists.denx.de > > https://lists.denx.de/listinfo/u-boot ___ Joe Two solutions: Option 1. drivers/usb/eth/smsc95xx.c pulls packet in from the device, single rx buffer, and runs the packet rx code in net.c. Assumption is packets are polled for, thus single rx buffer is acceptable. net_rx_packets exists, and can be use, if looking for rx packet call is called frequently though system. This would work for all existing drivers. net.c fills net_rx_packets and calls a routine to process packets, and and the tcp system system polls via smsc95xx_recv through the interface structure at places in the code to process fill net_rx_packets as a packet queue. A TCP window limits the number of packets in process. Option 2. The driver is changed to set an interrupt and the interrupt preempts the packet processing, as interrupts do. But, this requires driver changes to use TCP. And good hardware documentation. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] TCP & Overrrun
I'm gettin overrun on the raspberry pi. Which ethernet drived does it use? I need to determine if it uses CONFIG_SYS_RX_ETH_BUFFER" from net.h and the "net_rx_packets" buffer pool defined in net/net.c grep suggests it is not using net_rx_packets. Here's a list of a grep of the u-boot source directory rch/mips/mach-au1x00/au1x00_eth.c arch/powerpc/cpu/mpc85xx/ether_fcc.c net/net.c drivers/usb/gadget/ether.c drivers/net/ep93xx_eth.c drivers/net/cs8900.c drivers/net/ftgmac100.c drivers/net/ks8851_mll.c drivers/net/dc2114x.c drivers/net/dm9000x.c drivers/net/xilinx_ll_temac_fifo.c drivers/net/ax88180.c drivers/net/tsec.c drivers/net/mcffec.c drivers/net/dnet.c drivers/net/ftmac100.c drivers/net/xilinx_ll_temac_sdma.c drivers/net/sandbox-raw.c drivers/net/cpsw.c drivers/net/sandbox.c drivers/net/smc911x.c drivers/net/lan91c96.c drivers/net/uli526x.c drivers/net/tsi108_eth.c drivers/net/mpc8xx_fec.c drivers/net/at91_emac.c drivers/net/ethoc.c drivers/net/fsl_mcdmafec.c drivers/net/bcm-sf2-eth.c drivers/net/enc28j60.c drivers/net/smc9.c drivers/net/macb.c drivers/net/pic32_eth.c Thanks Duncan Hare ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Where is the edge between a loader and (microkernel) OS
I'm looking at u-boot source code, and see a huge amount of hardware drivers, used only for the loader. On the other side, modern Linux kernels eat a more than half of RAM on cheap embedded modules like HLK-R04. Linux kernels have got fat. I believe it would be easier to remove modules, and avoid the large task of coding. What u-boot does not have Memory managementVirtual MemoryMultitaskingApplication are compiled and linked into the u-boot binary. I'd first put the linux kernels on a diet. Lit all the modules, describe each one's use, and then decide on include/exclude each kernel module. Tedious? yes. Coding? No. Testing? Yes but less than new code. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Subject: [PATCH 2/3] TCP and wget implementation. Patch V5, 2 of 3.
This is the TCP and Kconfig files for introducing TCP and wget into u-boot. All the code is new, and not copied from any source. Makefile in the net directory is modified by hand. It appears not to be generated by Kconfig. Signed-off-by: Duncan Hare <duncanch...@yahoo.com> --- net/Makefile | 3 +- net/tcp.c| 689 +++ net/tcp.h| 214 +++ 3 files changed, 905 insertions(+), 1 deletion(-) create mode 100644 net/tcp.c create mode 100644 net/tcp.h diff --git a/net/Makefile b/net/Makefile index ae54eee5af..f83df5b728 100644 --- a/net/Makefile +++ b/net/Makefile @@ -25,7 +25,8 @@ obj-$(CONFIG_CMD_PING) += ping.o obj-$(CONFIG_CMD_RARP) += rarp.o obj-$(CONFIG_CMD_SNTP) += sntp.o obj-$(CONFIG_CMD_NET) += tftp.o - +obj-$(CONFIG_TCP) += tcp.o +obj-$(CONFIG_CMD_WGET) += wget.o # Disable this warning as it is triggered by: # sprintf(buf, index ? "foo%d" : "foo", index) # and this is intentional usage. diff --git a/net/tcp.c b/net/tcp.c new file mode 100644 index 00..2ea6459c0b --- /dev/null +++ b/net/tcp.c @@ -0,0 +1,689 @@ +/* + * Copyright 2017 Duncan Hare, all rights reserved. + */ + +/* + * General Desription: + * + * TCP support for the wget command, for fast file downloading. + * + * HTTP/TCP Receiver: + * + * Prequeisites: - own ethernet address + * - own IP address + * - Server IP address + * - HTP client + * - Bootfile path & name + * We want:- Load the Boot file + * Next Step HTTPS? + */ +#include +#include +#include +#include +#include +#include +#include "tcp.h" +#include "wget.h" + +/* TCP sliding window control */ +/* used by us to request re-TX */ + +static struct tcp_sack_v tcp_lost; + +/* TCP option timestamp */ +static u32 loc_timestamp; +static u32 rmt_timestamp; + +/* Search for TCP_SACK and review the + * comments before the code section + */ + +#define TCP_SACK u8 +TCP_SACK tcp_edge; + +/* TCP connection state */ +static enum TCP_STATE tcp_state; + +/* + * An incoming TCP packet handler for the TCP protocol. + * There is also a dymanic function pointer for TCP based commads to + * receive incoming traffic after the TCP protocol code has done its work. + */ + +/* Current TCP RX packet handler */ +static rxhand_tcp *tcp_packet_handler; + +enum TCP_STATE tcp_get_tcp_state(void) +{ + return tcp_state; +} + +void tcp_set_tcp_state(enum TCP_STATE new_state) +{ + tcp_state = new_state; +} + +void tcp_print_buffer(uchar raw[], int pkt_len, int payload_len, + int hdr_len, bool hide) +{ + int i; + + for (i = pkt_len - payload_len; i < pkt_len; i++) { + if (i <= hdr_len) + printf("%02X", raw[i]); + else if ((raw[i] > 0x19) && (raw[i] < 0x7f)) + putc(raw[i]); + else if (hide == 0) + putc(raw[i]); + else + printf("%02X", raw[i]); + } + printf("%s", "\n"); +} + +int tcp_find_in_buffer(uchar raw[], int payload_len, uchar field[], + int field_len) +{ + int i, j; + + for (i = 0; i < payload_len; i++) { + if (raw[i] == field[0]) { + for (j = 1; j < field_len; j++) { + if (raw[i + j] != field[j]) + break; + if (j == field_len) + return i; + } + } + } + return 0; +} + +static void dummy_handler(uchar *pkt, unsigned int dport, + struct in_addr sip, unsigned int sport, + unsigned int len) +{ +} + +void tcp_set_tcp_handler(rxhand_tcp *f) +{ + debug_cond(DEBUG_INT_STATE, "--- net_loop TCP handler set (%p)\n", f); + if (!f) + tcp_packet_handler = dummy_handler; + else + tcp_packet_handler = f; +} + +u16 tcp_set_pseudo_header(uchar *pkt, struct in_addr src, struct in_addr dest, + int tcp_len, int pkt_len) +{ + union tcp_build_pkt *b = (union tcp_build_pkt *)pkt; + int checksum_len; + + /* +* Pseudo header +* +* Zero the byte after the last byte so that the header checksum +* will always work. +*/ + + pkt[pkt_len] = 0x00; + + net_copy_ip((void *)>ph.p_src, ); + net_copy_ip((void *)>ph.p_dst, ); + b->ph.rsvd = 0x00; + b->ph.p = IPPROTO_TCP; + b->ph.len = htons(tcp_len); + checksum_len= tcp_len + PSEUDO_HDR_SIZE; + + debug_cond(DEBUG_DEV_PKT, +
Re: [U-Boot] [PATCH] TCP and wget implementation. Ptch V5 1 of 3
> The patch is trying to put everything into net.c. This is a mess and > not where we should head to. Not at all. I tried that and it was correctly rejected. The TCP functions are in tcp.c, and the wget functions in wget.c There is no socket. There is no socket analogue. There is no widespread correct re-ordering of packets, because in a kernel download the relative address of each block is derived for the tcp sequence number, and the kernel image in memory itself is in the correct order, as defined by tcp sequence number. > > We should have have one driver per protocol. > > The IP driver should enumerate all drivers protocols like TCP and UDP > that want to listen to it using a Linux list. This way we get rid of > all those needless #ifdef CONFIGs. Using the list the IP driver will > hand out packets to the respective higher protocol driver. The choice was to make minimal changes to the current net.c, in consultation with other in the u-boot realm. > > A separate driver shall implement the TCP protocol and provide methods > to open a socket, to read and write to the socket and to close the > socket. > "shall"? Please do not use the imperative, unless you are approaching me with money. > Next we want a driver for the HTTP protocol. It should have function > to open a connection, to send a request, to receive a response, and to > close the connection. If this driver is requested to open a connection > it shall call the TCP driver to open a socket. It will then receive > all packets from the relevant IP address on the relevant port until it > closes the socket. > The http protocol is very simple, and consists of a TCP connection and a header, both for request and response. > The wget command should be in a separate file. It will call the > appropriate functions of the HTTP driver to open a connection, post > the request, receive the response, and finally close the connection. It is and it does. It also include the http headers, because of their simplicity. > > The work should start with refactoring the existing coding into > separate drivers for the existing protocols. When that is completed > you can start adding TCP relevant code. Will you pay for that work? > Please, do not send single patches but complete patch series. I do the best I can with my limited knowledge of the tools. I have sent a series. My understand of both git and patman is limited. > > Best regards > > Heinrich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] TCP and wget implementation. Ptch V5 1 of 3
Date: Sun, 28 Jan 2018 11:25:51 -0800 This is the interface and Kconfig files for introducing TCP and wget into u-boot. Interfaces are in net.c and net.h, ping is modified to the new ip send interface, and UDP and TCP have shim procedures call map the protocol interface to the ip interface. The UDP interface is unchanged, and the existing UDP programs need no changes. All the code is new, and not copied from any source. Makefile in the net directory is modified by hand. It appears not to be generated by Kconfig. The rationale behind this change is that UDP file transfers elapsed time is twice the sum of network latency x number of pcckets, and TCP file transfer times are about 4x network latency plus data transit time. In tests this reduces kernel trnasfer time from about 15 to 20 seconds with tftp on a raspberry pi to about 0.4 seconds with wget. The raspberry pi as a sink for the kernel runs at about 10 Mbits/sec. It is not clear if all drivers use net_rx_packets as input buffers. Some driivers do. Some drivers also always start circular buffers use at buffer[0]. It would be better if circlar buffer pools were used in a truly circular manner at all times. Signed-off-by: Duncan Hare <duncanch...@yahoo.com> --- include/net.h | 32 ++ net/Kconfig | 5 +++ net/net.c | 102 +++--- net/ping.c| 9 ++ 4 files changed, 115 insertions(+), 33 deletions(-) diff --git a/include/net.h b/include/net.h index 455b48f6c7..d231987e6e 100644 --- a/include/net.h +++ b/include/net.h @@ -15,17 +15,26 @@ #include #include /* for nton* / ntoh* stuff */ -#define DEBUG_LL_STATE 0 /* Link local state machine changes */ -#define DEBUG_DEV_PKT 0/* Packets or info directed to the device */ -#define DEBUG_NET_PKT 0/* Packets on info on the network at large */ +#define DEBUG_LL_STATE 0 /* Link local state machine changes */ +#define DEBUG_DEV_PKT 0 /* Packets or info directed to the device */ +#define DEBUG_NET_PKT 0 /* Packets on info on the network at large */ #define DEBUG_INT_STATE 0 /* Internal network state changes */ /* * The number of receive packet buffers, and the required packet buffer * alignment in memory. * + * The nuber of buffers for TCP is used to calculate a static TCP window + * size, becuse TCP window size is a promise to the sending TCP to be able + * to buffer up to the window size of data. + * When the sending TCP has a window size of outstanding unacknowledged + * data, the sending TCP will stop sending. */ +#if defined(CONFIG_TCP) +#define CONFIG_SYS_RX_ETH_BUFFER 50/* For TCP */ +#endif + #ifdef CONFIG_SYS_RX_ETH_BUFFER # define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER #else @@ -354,6 +363,8 @@ struct vlan_ethernet_hdr { #define IPPROTO_ICMP1 /* Internet Control Message Protocol*/ #define IPPROTO_UDP17 /* User Datagram Protocol */ +#define IPPROTO_TCP 6 /* Transmission Control Protocol*/ + /* * Internet Protocol (IP) header. @@ -538,7 +549,7 @@ extern int net_restart_wrap; /* Tried all network devices */ enum proto_t { BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP, - TFTPSRV, TFTPPUT, LINKLOCAL + TFTPSRV, TFTPPUT, LINKLOCAL, WGET }; extern charnet_boot_file_name[1024];/* Boot File name */ @@ -596,10 +607,10 @@ int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot); int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot); /* Set IP header */ -void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source); +void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source, + u16 pkt_len, u8 prot); void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, - int sport, int len); - + int sport, int len); /** * compute_ip_checksum() - Compute IP checksum * @@ -670,9 +681,16 @@ static inline void net_send_packet(uchar *pkt, int len) * @param sport Source UDP port * @param payload_len Length of data after the UDP header */ +int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport, + int payload_len, int proto, u8 action, u32 tcp_seq_num, + u32 tcp_ack_num); + int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport, int payload_len); +int net_send_tcp_packet(int payload_len, int dport, int sport, u8 action, + u32 tcp_seq_num, u32 tcp_ack_num); + /* Processes a received packet */ void net_process_received_packet(uchar *in_packet, int len); diff --git a/net/Kconfig b/net/Kconfig index 414c5497c7..625ad291bb 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -45,4
Re: [U-Boot] [PATCH 1/1] efi_loader: add a README.iscsi describing booting via iSCSI
From: Heinrich Schuchardt <xypron.deb...@gmx.de> To: Duncan Hare <d...@synoia.com>; Alexander Graf <ag...@suse.de> Subject: Re: [U-Boot] [PATCH 1/1] efi_loader: add a README.iscsi describing booting via iSCSI On 01/25/2018 08:39 PM, Duncan Hare wrote: >>> - Forwarded Message - >>> From: Alexander Graf <ag...@suse.de> >>> To: Heinrich Schuchardt <xypron.g...@gmx.de> >> >>>> The appended README explains how U-Boot and iPXE can be used >>>> to boot a diskless system from an iSCSI SAN. >>>> >> We are implementing a limited TCP and a wget (http 1.0) app.>> It is almost >> ready for an test release. Selective Acknowledgment (SACK) >> is under test as a final piece of the TCP stack. In which git can I find the code? >> >> We have noticed that omitting the http 1.0 declaration in >> downloading the kernel from an nginx web server that we remove the >> overhead of an http header completely. >> > RFC 1945 - Hypertext Transfer Protocol -- HTTP/1.0 > You should not program to please another accommodating software but > according to a standard. I agree. The comment was a FYI. > The key to TCP performance is supporting multiple packets in flight. And we do. That's set in include/net.h in the buffer definitions.With single packet-at-a time one might as well stick with udp. I've worked on network communication protocols since 1973.c programming, not so much. git, I'm a newb. HeinrichIt is not yet pushed to git.I need to fix the bugs in SACK before taking that step. I had hoped this week but I was delayed by flu. It adheres to http 1.0. It is a minimal implementation. It is relatively fast. It drives a Raspberry Pi at 10 M bits/sec, the limitation being the raspberry pi processor speed. I can send you a tarball, together with the changes to tftp.c for testing that a downloaded image is correct. Regards Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] efi_loader: add a README.iscsi describing booting via iSCSI
> - Forwarded Message - > From: Alexander Graf> To: Heinrich Schuchardt > > The appended README explains how U-Boot and iPXE can be used > > to boot a diskless system from an iSCSI SAN. > > > > The maintainer for README.efi and README.iscsi is set. > > > > Signed-off-by: Heinrich Schuchardt > > --- > +U-Boot has only a reduced set of supported network protocols. A > major gap is > > major gap is +the lack of a TCP stack. > > This is only semi-true. There is work in progress to get TCP support > into U-Boot. The protocols on top however are still missing and using > iPXE here is definitely a very reasonable approach. We are implementeinga limited TCP and a wget (http 1.0) app. It is almost ready for an test release. Selective Acknowledgment (SACK) is under test as a final piece of the TCP stack. We have noticed that omitting the http 1.0 declaration in downloading the kernel from an nginx web server that we remove the overhead of an http header completely. > > > + > > +For booting a diskless computer this leaves us with BOOTP or DHCP > > to get the +address of a boot script. TFTP can be used to load the > > boot script and the +operating system kernel and initial file > > system (initrd). We use DHCP or DNS. DHCP assumes one has control of the DHCP server and are generally inside the firewall, and is complex to adminsited is there are many (branch office) DHCP servers. With MS 2012 R2 server configuring DHCP options is complex. > > +These protocols are insecure. The client cannot validate the > > authenticity +of the contacted servers. And the server cannot > > verify the identity of the +client. Yes and no. We (optionally) use the burnt in MAC address or serial number to identify a client machine, and can prevent boot if it is not authorized by denying the download of the *nix kernel. If inside the firewall and using DHCP security is probably completly under the control of the enterprise admins. We use locally administered DNS servers to control address resolution under DNS. > > iPXE is the > > "swiss army knife" of +network booting. It supports both HTTPS and > > iSCSI. It has a script engine for +fine grained control of the boot > > process and can provide a command shell. + (1)u-boot (+ missing functions)->iPXE->grub->kernel (appears complex) or (2)u-boot (+ missing functions)->kernel? > > +protocol. Now iPXE can call the simple file protocol to load Grub. I seem to be missing the point. We use U-boot to load and run the kernel with tcp+http 1.0. https would be a nice enhancement, as would an encrypted connection for the *nix kernel to access the image, but complete security requires more. If you are going to do this we need to discuss accessing the *nix image over a secure protocol. AFAIK the *nix kernel does not use secure protocols with network *nix images. In the netboot process we'd address the performance limitations of NFS, especially during boot, with either lookahead caching at the client or use HTTPS for image access, both of which are outside u-boot's scope. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] TCP and wget implementation v5.1
Hi Duncan, On Wed, Jan 10, 2018 at 8:18 PM, Duncan Hare <d...@synoia.com> wrote: > Date: Wed, 10 Jan 2018 17:54:07 -0800 > Subject: [PATCH] git_msg_1 > > TCP and wget implementation. Sounds like this should be the title of the series cover letter. I thought we agreed that this should be sent as a series. That means using patman to send all 3 matches to the list as once. Next step is to get sendmail setup and resend as a series using patman. > And I do wish I could get git send-mail configureg > with yahoo. https://help.yahoo.com/kb/SLN4724.html > > Signed-off-by: Duncan Hare <d...@synoia.com> > Ok, our definition of series differed. I was not thinking concurrent. Will send next week. Duncan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] TCP and wget implementation v5.1
Date: Wed, 10 Jan 2018 17:54:07 -0800 Subject: [PATCH] git_msg_1 TCP and wget implementation. This is the interface and Kconfig files for introducing TCP and wget into u-boot. Interfaces are in net.c and net.h, ping.c is modified to the new ip send interface, and UDP and TCP have shim procedures call map the protocol interface to the ip interface. The UDP interface is unchanged, and the existing UDP programs need no changes. All the code is new, and not copied from any source. This code should compile. Next step? git push? And I do wish I could get git send-mail configureg with yahoo. Signed-off-by: Duncan Hare <d...@synoia.com> From: Duncan Hare <d...@synoia.com> Date: Wed, 10 Jan 2018 17:54:07 -0800 Subject: [PATCH] git_msg_1 Signed-off-by: Duncan Hare <d...@synoia.com> --- include/net.h | 32 ++ net/Kconfig | 5 +++ net/net.c | 102 +++--- net/ping.c| 9 ++ 4 files changed, 115 insertions(+), 33 deletions(-) diff --git a/include/net.h b/include/net.h index 455b48f6c7..d231987e6e 100644 --- a/include/net.h +++ b/include/net.h @@ -15,17 +15,26 @@ #include #include /* for nton* / ntoh* stuff */ -#define DEBUG_LL_STATE 0 /* Link local state machine changes */ -#define DEBUG_DEV_PKT 0/* Packets or info directed to the device */ -#define DEBUG_NET_PKT 0/* Packets on info on the network at large */ +#define DEBUG_LL_STATE 0 /* Link local state machine changes */ +#define DEBUG_DEV_PKT 0 /* Packets or info directed to the device */ +#define DEBUG_NET_PKT 0 /* Packets on info on the network at large */ #define DEBUG_INT_STATE 0 /* Internal network state changes */ /* * The number of receive packet buffers, and the required packet buffer * alignment in memory. * + * The nuber of buffers for TCP is used to calculate a static TCP window + * size, becuse TCP window size is a promise to the sending TCP to be able + * to buffer up to the window size of data. + * When the sending TCP has a window size of outstanding unacknowledged + * data, the sending TCP will stop sending. */ +#if defined(CONFIG_TCP) +#define CONFIG_SYS_RX_ETH_BUFFER 50/* For TCP */ +#endif + #ifdef CONFIG_SYS_RX_ETH_BUFFER # define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER #else @@ -354,6 +363,8 @@ struct vlan_ethernet_hdr { #define IPPROTO_ICMP1 /* Internet Control Message Protocol*/ #define IPPROTO_UDP17 /* User Datagram Protocol */ +#define IPPROTO_TCP 6 /* Transmission Control Protocol*/ + /* * Internet Protocol (IP) header. @@ -538,7 +549,7 @@ extern int net_restart_wrap; /* Tried all network devices */ enum proto_t { BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP, - TFTPSRV, TFTPPUT, LINKLOCAL + TFTPSRV, TFTPPUT, LINKLOCAL, WGET }; extern charnet_boot_file_name[1024];/* Boot File name */ @@ -596,10 +607,10 @@ int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot); int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot); /* Set IP header */ -void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source); +void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source, + u16 pkt_len, u8 prot); void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, - int sport, int len); - + int sport, int len); /** * compute_ip_checksum() - Compute IP checksum * @@ -670,9 +681,16 @@ static inline void net_send_packet(uchar *pkt, int len) * @param sport Source UDP port * @param payload_len Length of data after the UDP header */ +int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport, + int payload_len, int proto, u8 action, u32 tcp_seq_num, + u32 tcp_ack_num); + int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport, int payload_len); +int net_send_tcp_packet(int payload_len, int dport, int sport, u8 action, + u32 tcp_seq_num, u32 tcp_ack_num); + /* Processes a received packet */ void net_process_received_packet(uchar *in_packet, int len); diff --git a/net/Kconfig b/net/Kconfig index 414c5497c7..625ad291bb 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -45,4 +45,9 @@ config BOOTP_VCI_STRING default "U-Boot.arm" if ARM default "U-Boot" +config TCP + bool "Include Subset TCP stack for wget" + help + TCP protocol support for wget. + endif # if NET diff --git a/net/net.c b/net/net.c index 4259c9e321..79255c11eb 100644 --- a/net/net.c +++ b/net/net.c @@ -107,6 +107,12 @@ #if defined(CONFIG_CMD_SNTP) #include "sntp.h"
Re: [U-Boot] [PATCH] TCP and wget implementation v4
> > > > A note on this TCP implementation. In TCP the transmitting TCP > > guarantees delivery of a stream, and the receiving TCP guarantees > > ordered of delivery of the stream. In this implementation The > > kernel memory buffer and the TCP sequence number is used to order > > the stream. for the application, and the application is the kernel > > itself. wget is not considered the application, and does receive > > packets "out of order." > > It seems like it would be possible to just store off a packet that is > ahead of its neighbor and not call any upper handler until the needed > packet arrives. Then all upper layers wouldn't need to know about the > reordering. There is, for u-boot a large number of buffers used on RX, in order to have a long work queue of kernel data. CONFIG_SYS_RX_ETH_BUFFER 50 The TCP transmit window is approximately 25 such packets, so overruns are eliminated. There are about 3300 kernel data packets in this test kernel, so missing a few, 3 to 5, has little impact on elapsed time, and they remain in the input buffer pool ahead of the HTTP header, The only critical order for this implementation is the TCP header. Without processing the TCP header we do not know the stream address of the first byte of kernel data. It is easy when we know this to map TCP stream address to kernel data offset. > > > > Advice on the reset buffer approach are invited. It requires an > > interface between the wget application to reset the buffer index. > > Between wget and what? The TCP implementation? It seems like something > that should be abstracted from wget. wget receives packets without intermediate ordering. Ordering data is a function of wget placing the kernel data at the correct offset, based of TCP stream location, at the correct memory address. wget is the agent which correctly orders data. There is no socket analogue, the abstraction, and a socket's linked list buffer reordering, which is the generally recognized reordering point for TCP data. Correct ordering is a primary task of this wget implementation, becuse the destination is a kernel image, and this choice very greatly simplifies the TCP stack, while reducing code complexity, and limits code size. Reordering would require a new piece of code similar to the fragment assemble piece of code in net.h, and that's an amazing, but complex, piece of code. My objective was to produce something as simple as possible. The TCP stack delivers packets in the order they come off the wire. Wget puts them in the correct order based on TCP sequence number to build the kernel image, and the TCP sequence number/ack protocol ensures complete delivery of a stream. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] TCP and wget implementation v4
> >>>selects the LIB_RAND feature since it is required. > > > > Thanks: will be in u-boot/cmd/Kconfig > > > >>Are we lookin at a series of patches, or a concurrent set? > > > > At this time a series of three, but I'd take advice on the preferred > > procedure. > > Remember that the goal is to be atomic. > > You should be able to build and use U-Boot after each patch. > > Also, any changes to existing code that is not changing behavior but > simply making way for new functionality should be done separately. > Thanks > -Joe A note on this TCP implementation. In TCP the transmitting TCP guarantees delivery of a stream, and the receiving TCP guarantees ordered of delivery of the stream. In this implementation The kernel memory buffer and the TCP sequence number is used to order the stream. for the application, and the application is the kernel itself. wget is not considered the application, and does receive packets "out of order." This places a constraint on the incoming data stream. All (disordered) packets received before the HTTP header are ignored, which means the sending TCP will re-transmit them. This forced re-transmission could be avoided with a change to reprocess the incoming packet stream back to the first packet received, directly following processing the TCP header. This behavior was detected and failed downloads fixed in tests downloading Linux kernels from the cloud. Advice on the reset buffer approach are invited. It requires an interface between the wget application to reset the buffer index. Joe Thanks, Good advice, based on that the order of 3 patches is: (1) Prepares the interfaces, no new behavior, CONFIG-TCP is introduced. net/Kconfig net/net.c net/ping.c include/net.h (2) Introduces TCP net/tcp.c net/tcp.h net/Makefile (3) Introduces wget, CONFIG-WGET introduced cmd/Kconfig cmd/net.c net/wget.c net/wget.h ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] TCP and wget implementation v3
>>selects the LIB_RAND feature since it is required. Thanks: will be in u-boot/cmd/Kconfig >Are we lookin at a series of patches, or a concurrent set? At this time a series of three, but I'd take advice on the preferred procedure. (1) cmd/Kconfig cmd/net.c net/Kconfig net/net.c net/ping.c include/net.h (2) net/tcp.c net/tcp.h net/Makefile (3) net/wget.c net/wget.h ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] ARM64 Allwinner Binary Size
From: Jagan Teki <jagannadh.t...@gmail.com> On Wed, Dec 20, 2017 at 11:22 PM, Duncan Hare <d...@synoia.com> wrote: >> An observation: The Banana PI boards, allwinner based, I've use have a >> boot.scr file on the fat partition to direct booting. >> A Suggestion: If this is widespread, the memory used by the u-boot image >> could be reduce by eliminating much of the >> pre-defined boot hush scripts. >not exactly are you trying to avoid env space to not define extra >variable instead scripts? which board from Bpi are you using? ___ Jagan We tried the B PI 2 and 3 believe. We dropped them, because of the inability to manage over-scan. If there is documentation on this we could not find it, nor could the board manufacturer send it to us. If u-boot is using boot.scr for a boot script, it appears nearly everything else in the environment, especially the predefined scripts, are not needed, and if there is a "size of u-boot issue", this might be a mechanism to reduce u-boot's overall size. It was a suggestion, Not a recommendation. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] ARM64 Allwinner Binary Size
An observation: The Banana PI boards, allwinner based, I've use have a boot.scr file on the fat partition to direct booting. A Suggestion: If this is widespread, the memory used by the u-boot image could be reduce by eliminating much of the pre-defined boot hush scripts. I offer this as an observation and suggestion. It may have no merit. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] TCP and wget implementation v3
>I'd like to see the shim and all changes to existing stack as a >separate patch to make review simpler. In this patch. >Also please make TCP and wget into 2 other separate patches. Yes, following. > Yes it should... you could have wget "selects" tcp. Please send a "how to" example. >> The rationale behind this change is that UDP file transfers elapsed >> time is twice the sum of network latency x number of pcckets, and >> TCP file transfer times are about 4x network latency plus data >> transit time. >What settings are used in this tftp benchmark for block size? It makes >a huge difference to the performance. We use the default blocksize. We decided on TCP becuse it is probably the best high performance, reliable protocol available, and the simplicity of the http protocol. UDP has its place. Relaible fast file transfer is a poor fit for UDP. We we lookin at a series of patches, or a concurrent set? The previous patch include all the pvarius change for setting up integration into u-boot. This patch standing by itself cannot be integrated. At a minimun it needs the slightly changed version of ping. Signed-off-by: Duncan Hare <d...@synoia.com> --- include/net.h | 32 ++ net/net.c | 102 +++--- 2 files changed, 108 insertions(+), 26 deletions(-) diff --git a/include/net.h b/include/net.h index 455b48f6c7..d231987e6e 100644 --- a/include/net.h +++ b/include/net.h @@ -15,17 +15,26 @@ #include #include /* for nton* / ntoh* stuff */ -#define DEBUG_LL_STATE 0 /* Link local state machine changes */ -#define DEBUG_DEV_PKT 0/* Packets or info directed to the device */ -#define DEBUG_NET_PKT 0 /* Packets on info on the network at large */ +#define DEBUG_LL_STATE 0 /* Link local state machine changes */ +#define DEBUG_DEV_PKT 0 /* Packets or info directed to the device */ +#define DEBUG_NET_PKT 0 /* Packets on info on the network at large */ #define DEBUG_INT_STATE 0 /* Internal network state changes */ /* * The number of receive packet buffers, and the required packet buffer * alignment in memory. * + * The nuber of buffers for TCP is used to calculate a static TCP window + * size, becuse TCP window size is a promise to the sending TCP to be able + * to buffer up to the window size of data. + * When the sending TCP has a window size of outstanding unacknowledged + * data, the sending TCP will stop sending. */ +#if defined(CONFIG_TCP) +#define CONFIG_SYS_RX_ETH_BUFFER 50/* For TCP */ +#endif + #ifdef CONFIG_SYS_RX_ETH_BUFFER # define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER #else @@ -354,6 +363,8 @@ struct vlan_ethernet_hdr { #define IPPROTO_ICMP1 /* Internet Control Message Protocol*/ #define IPPROTO_UDP 17 /* User Datagram Protocol */ +#define IPPROTO_TCP 6 /* Transmission Control Protocol*/ + /* * Internet Protocol (IP) header. @@ -538,7 +549,7 @@ extern int net_restart_wrap; /* Tried all network devices */ enum proto_t { BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP, - TFTPSRV, TFTPPUT, LINKLOCAL + TFTPSRV, TFTPPUT, LINKLOCAL, WGET }; extern charnet_boot_file_name[1024];/* Boot File name */ @@ -596,10 +607,10 @@ int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot); int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot); /* Set IP header */ -void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source); +void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source, + u16 pkt_len, u8 prot); void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, - int sport, int len); - + int sport, int len); /** * compute_ip_checksum() - Compute IP checksum * @@ -670,9 +681,16 @@ static inline void net_send_packet(uchar *pkt, int len) * @param sport Source UDP port * @param payload_len Length of data after the UDP header */ +int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport, + int payload_len, int proto, u8 action, u32 tcp_seq_num, + u32 tcp_ack_num); + int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport, int payload_len); +int net_send_tcp_packet(int payload_len, int dport, int sport, u8 action, + u32 tcp_seq_num, u32 tcp_ack_num); + /* Processes a received packet */ void net_process_received_packet(uchar *in_packet, int len); diff --git a/net/net.c b/net/net.c index 4259c9e321..79255c11eb 100644 --- a/net/net.c +++ b/net/net.c @@ -107,6 +107,12 @@ #if defined(CONFIG_CMD_SNTP) #include "sntp.h" #endif +#if defined(CONFIG_
[U-Boot] [PATCH] TCP and wget implementation.
The changes in u-boot to implement this were sent Nov 8, and I've see no mention of it, in the mailing list. What's the next step? Thanks Duncan Hare d...@synoia.com ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Fw: u-boot soft and hard ethernet addresses
Dear Duncan, In message <1814106598.1047276.1510787951...@mail.yahoo.com> you wrote: > > Many board manufacturers "assign" this unique MAC address by printing it on a > sticker and sticking that on the board somewhere. It's pretty darn hard to > read a printed sticker in software, so we have to revert to solutions that > actually work. Such solutions usually include a barcode reader attached to some PC which is used when you commission the board. And yes, in this case it is mandatory that the MAC address(es) stored in the environment (which gets initialized as part of the aforementioned commissioning procedure) takes precedence over any MAC address(es) that might be stored somewhere in the hardware. > In the "clever things" department, protocols like IPv6 merrily broadcast your > MAC address across gateways on the big bad internet, so if you value your > privacy, you'll appreciate the possibility to change your MAC address at will. Right, this is another of a list of reasons why changing the MAC address makes a lot of sense. Best regards, Wolfgang Denk -- Wolfgang I agree. Some Ethernet adapters/chip/cell libraries have burnt in Ethernet addresses. Some do not. I'm not saying anything is good or bad, I am, stating , if one wants to use the burnt in address, if it exists, there is a mechanism in U-Boot to do so. I carefully did not state an opinion. Having a soft coded mac address makes replication of software on units complex. Having a burnt in hardware address makes software replication simple, but addscomplexity to hardware manufacturing. Having stated that, there has to be a unique address for the device somewhere, either in the hardware or software. If in hardware the manufacturer provides the address, If in u-boot the unique address has to be managed by the customer, and passed to the OS launched by u-boot. IP is the second network architecture which I've used on which expanded its address space, the first wasIBM's SNA. The expansion in both architectures was curtailed, or delayed, by having gateways, in IP's case NAT gateways, in IBM's SNA it was SNI - SNA Network Interconnect. Because of the extensive use of gateways, the risk of a device's mac address being braodcast to, is hopefully,limited by the gateway. If it is not then one need to buy a better gateway which protect one's privacy. Regards Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] u-boot soft and hard ethernet addresses
Date: Tue, 14 Nov 2017 10:31:56 +0100 From: Mike Looijmans <mike.looijm...@topic.nl> To: Wolfgang Denk <w...@denx.de>, Prabhakar Kushwaha <prabhakar.kushw...@nxp.com> Cc: "u-boot@lists.denx.de" <u-boot@lists.denx.de>, "joe.hershber...@ni.com" <joe.hershber...@ni.com> Subject: Re: [U-Boot] ethernet: ROM MAC address vs env variable MAC address Message-ID: <45c912c9-ce5a-4ee0-326a-e1dadce04...@topic.nl> Content-Type: text/plain; charset="utf-8"; format=flowed On 13-11-17 20:49, Wolfgang Denk wrote: > Dear Prabhakar, > > In message > <he1pr04mb12410876e4ba09fc9cd7800c97...@he1pr04mb1241.eurprd04.prod.outlook.com> > you wrote: >> >> Why ROM MAC address getting overwritten by environment env MAC address. > > Because in U-Boot we give the user the freedom to do what he > needs/wants to do. Usually the environment value gets initialized > from the value in the ROM, so there is no difference anyway. But if > the user wants a specific setting, he can change it. > >> MAC address is something unique and assigned to a particular device. So one >> should never change its MAC address. > > U-Boot follows good old UNIX style here: > > "UNIX was not designed to stop you from doing stupid things, because > that would also stop you from doing clever things." - Doug Gwyn Many board manufacturers "assign" this unique MAC address by printing it on a sticker and sticking that on the board somewhere. It's pretty darn hard to read a printed sticker in software, so we have to revert to solutions that actually work. In the "clever things" department, protocols like IPv6 merrily broadcast your MAC address across gateways on the big bad internet, so if you value your privacy, you'll appreciate the possibility to change your MAC address at will. Kind regards, Mike Looijmans System Expert TOPIC Products Materiaalweg 4, NL-5681 RJ Best Postbus 440, NL-5680 AK Best Telefoon: +31 (0) 499 33 69 79 E-mail: mike.looijm...@topicproducts.com Website: www.topicproducts.com Please consider the environment before printing this e-mail P to get the real hardware address used delete the variable ethaddr before saving the environment. This forces the board code the load the actual hardware address, if there is one, into the environment at start time. Otherwise you will always boot with the Ethernet address from the first time the environment was saved. Which make the environment not portable to multiple boards. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] TCP and wget implementation.
his is the interface and Kconfig files for introducing TCP and wget into u-boot. Interfaces are in net.c and net.h, ping is modified to the new ip send interface, and UDP and TCP have shim procedures call map the protocol interface to the ip interface. The UDP interface is unchanged, and the existing UDP programs need no changes. All the code is new, and not copied from any source. The wget command and TCP stack are separately configured in Kconfig, and provisioning wget without TCP will result in a number of error messages. It might be possible to have Kconfig handle dependencies, if so advice is welcome. Makefile in the net directory is modified by hand. It appears not to be generated by Kconfig. Again advice is welcome. The rationale behind this change is that UDP file transfers elapsed time is twice the sum of network latency x number of pcckets, and TCP file transfer times are about 4x network latency plus data transit time. In tests this reduces kernel trnasfer time from about 15 to 20 seconds with tftp on a raspberry pi to about 0.4 seconds with wget. The raspberry pi as a sink for the kernel runs at about 10 Mbits/sec. Signed-off-by: Duncan Hare <d...@synoia.com> --- cmd/Kconfig | 5 +++ cmd/net.c | 13 include/net.h | 26 --- net/Kconfig | 5 +++ net/Makefile | 3 +- net/net.c | 100 -- net/ping.c| 9 ++ 7 files changed, 132 insertions(+), 29 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 5a6afab99b..4e5bac685e 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1035,6 +1035,11 @@ config CMD_ETHSW operations such as enabling / disabling a port and viewing/maintaining the filtering database (FDB) +config CMD_WGET + bool "wget" + help + Download a kernel, or other files, from a web server over TCP. + endmenu menu "Misc commands" diff --git a/cmd/net.c b/cmd/net.c index d7c776aacf..f5c2d0f8ed 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -110,6 +110,19 @@ U_BOOT_CMD( ); #endif +#if defined(CONFIG_CMD_WGET) +static int do_wget(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + return netboot_common(WGET, cmdtp, argc, argv); +} + +U_BOOT_CMD( + wget, 3, 1, do_wget, + "boot image via network using HTTP protocol", + "[loadAddress] [[hostIPaddr:]bootfilename]" +); +#endif + static void netboot_update_env(void) { char tmp[22]; diff --git a/include/net.h b/include/net.h index 455b48f6c7..7787413816 100644 --- a/include/net.h +++ b/include/net.h @@ -24,8 +24,17 @@ * The number of receive packet buffers, and the required packet buffer * alignment in memory. * + * The nuber of buffers for TCP is used to calculate a static TCP window + * size, becuse TCP window size is a promise to the sending TCP to be able + * to buffer up to the window size of data. + * When the sending TCP has a window size of outstanding unacknowledged + * data, the sending TCP will stop sending. */ +#if defined(CONFIG_TCP) +#define CONFIG_SYS_RX_ETH_BUFFER 50/* For TCP */ +#endif + #ifdef CONFIG_SYS_RX_ETH_BUFFER # define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER #else @@ -354,6 +363,8 @@ struct vlan_ethernet_hdr { #define IPPROTO_ICMP1 /* Internet Control Message Protocol*/ #define IPPROTO_UDP17 /* User Datagram Protocol */ +#define IPPROTO_TCP 6 /* Transmission Control Protocol*/ + /* * Internet Protocol (IP) header. @@ -538,7 +549,7 @@ extern int net_restart_wrap; /* Tried all network devices */ enum proto_t { BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP, - TFTPSRV, TFTPPUT, LINKLOCAL + TFTPSRV, TFTPPUT, LINKLOCAL, WGET }; extern charnet_boot_file_name[1024];/* Boot File name */ @@ -596,10 +607,10 @@ int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot); int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot); /* Set IP header */ -void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source); +void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source, + u16 pkt_len, u8 prot); void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, - int sport, int len); - + int sport, int len); /** * compute_ip_checksum() - Compute IP checksum * @@ -670,9 +681,16 @@ static inline void net_send_packet(uchar *pkt, int len) * @param sport Source UDP port * @param payload_len Length of data after the UDP header */ +int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport, + int payload_len, int proto, u8 action, u32 tcp_seq_num, + u32 tcp_ack_num); + int net_send_udp_packe
[U-Boot] Boot failure - Latest master and Raspberry Pi
Previous I've added these two definitions to use u-boot witht he raspberry pi, into include/configs/rpi.h #define CONFIG_SYS_MAXARGS 32 /* dch doubled from 16 */ #define CONFIG_SYS_BARGSIZE 1540 /* dch added, default 512 */ However on the most recent master, the raspberry pi fails to boot with or without these definitions. Two questions: 1. How to I determine where the pi's use of u-boot is failing? I don't even get the 2 second countdown before u-boot runs bootcmd. 2. Are these constants still effective in the current master? If not are there replacements? Thanks Duncan . ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Request For Comments: wget and TCP listener
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. Advice and suggestions welcome for the best implementation. Following is a phased approach to get from here to there. 1. tcp headers, constants and procedure calls. 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. and ping.c, and procedure definitions in include/net. Body of code. tcp could be a separate module, tcp.c Or integrated into the net.c source code. 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 Hare . ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Request For Comments: wget and TCP listener
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 . ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] wget and enough TCP stack for fast netboot
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, because the current Sept version of u-boot appears broken, rainbow screen of death, on raspberry pi. 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 eliminted from the build. All interfaces, funtion calls, in use are preserved. This reults in an ugly "repurposing" of varaibles in the packet-in calls to wget. This requires advice and guidence 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. Possible future additions include passing the TCP connection to the kernel to complete boot, adding SSH to improve security, and sending device MAC addresses or serial numbers (purportedly unique to a device) for registration purposes. Signed-off-by: Duncan Hare <d...@synoia.com> --- cmd/Kconfig | 5 + cmd/net.c | 13 + include/net.h | 241 +++- net/Kconfig | 5 + net/Makefile | 2 +- net/net.c | 871 ++ net/ping.c | 9 +- net/wget.c | 354 net/wget.h | 6 + 9 files changed, 1365 insertions(+), 141 deletions(-) create mode 100644 net/wget.c create mode 100644 net/wget.h diff --git a/cmd/Kconfig b/cmd/Kconfig index d6d130edfa..a1596260bf 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1022,6 +1022,11 @@ config CMD_ETHSW operations such as enabling / disabling a port and viewing/maintaining the filtering database (FDB) +config CMD_WGET + bool "wget" + help + Download a kernel, or other files, from a web server over TCP. + endmenu menu "Misc commands" diff --git a/cmd/net.c b/cmd/net.c index d7c776aacf..f5c2d0f8ed 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -110,6 +110,19 @@ U_BOOT_CMD( ); #endif +#if defined(CONFIG_CMD_WGET) +static int do_wget(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + return netboot_common(WGET, cmdtp, argc, argv); +} + +U_BOOT_CMD( + wget, 3, 1, do_wget, + "boot image via network using HTTP protocol", + "[loadAddress] [[hostIPaddr:]bootfilename]" +); +#endif + static void netboot_update_env(void) { char tmp[22]; diff --git a/include/net.h b/include/net.h index 455b48f6c7..bbf199e9f6 100644 --- a/include/net.h +++ b/include/net.h @@ -24,7 +24,15 @@ * The number of receive packet buffers, and the required packet buffer * alignment in memory. * + * The nuber of buffers for TCP is used to calculate a static TCP window + * size, becuse TCP window size is a promise to the sending TCP to be able + * to buffer up to the window size of data. + * When the sending TCP has a window size of outstanding unacknowledged + * data, the sending TCP will stop sending. */ +#if defined(CONFIG_TCP) +#define CONFIG_SYS_RX_ETH_BUFFER 50 /* For TCP */ +#endif #ifdef CONFIG_SYS_RX_ETH_BUFFER # define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER @@ -47,7 +55,7 @@ struct in_addr { __be32 s_addr; }; -/** +/* * An incoming packet handler. * @param pkt pointer to the application packet * @param dport destination UDP port @@ -59,7 +67,7 @@ typedef void rxhand_f(uchar *pkt, unsigned dport, struct in_addr sip, unsigned sport, unsigned len); -/** +/* * An incoming ICMP packet handler. * @param type ICMP type * @param code ICMP code @@ -308,7 +316,7 @@ struct ethernet_hdr { u8 et_dest[ARP_HLEN]; /* Destination node */ u8 et_src[ARP_HLEN]; /* Source node */ u16 et_protlen; /* Protocol or length */ -} __attribute__((packed)); +} __packed; /* Ethernet header size */ #define ETHER_HDR_SIZE (sizeof(struct ethernet_hdr)) @@ -326,7 +334,7 @@ struct e802_hdr { u8 et_snap2; u8 et_snap3; u16 et_prot; /* 802 protocol */ -} __attribute__((packed)); +} __packed; /* 802 + SNAP + ethernet header size */ #define E802_HDR_SIZE (sizeof(struct e802_hdr)) @@ -340,7 +348,7 @@ struct vlan_ethernet_hdr { u16 vet_vlan_type; /* PROT_VLAN */ u16 vet_tag; /* TAG of VLAN
[U-Boot] Patman - Submitting to mailing list
Get the following message from running tools/patman/pathan.py git: 'send-email' is not a git command. See 'git --help'. What do I need to do? Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Rainbow Screen of Death - Raspberry PI Current u-boot master
I pulled the latest master from git clone git://git.denx.de/u-boot.gitbuilt the raspberry pi imagemake r_3_32b_defconfigmakecopied the u-boot bin the a working sd cardand I get the rainbow screen of death from the pi. When I use a u-boot.bin build from a git clone of u-boot in about Jan 2017, it works. Just to reassure myself I was not doing something stupid, I did a second time.Deleted the u-boot directory and re-ran the git clone Suggestions? If you need a pi for testing, I'll send one. with sd card, fedex. ThanksDuncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Make Menuconfig Fails
make menuconfig HOSTCC scripts/kconfig/mconf.o In file included from scripts/kconfig/mconf.c:23:0: scripts/kconfig/lxdialog/dialog.h:26:20: fatal error: curses.h: No such file or directory #include CURSES_LOC Appears CURSES_LOC is undefined. Thanks. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Request For Comments: wget and TCP listener
Mods to: cmd/net.cnet/Makefilenet/net.cinclude/net.hnet/wget.cnet/wget.hnet/ping.c I do not know how to do patches, I'm a noobat this: cmd/net.c Additions static int do_wget(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]){ return netboot_common(WGET, cmdtp, argc, argv);} U_BOOT_CMD( wget, 3, 1, do_wget, "boot image via network using HTTP protocol", "[loadAddress] [[hostIPaddr:]bootfilename]"); net/Makefile addition obj-$(CONFIG_CMD_NFS) += wget.o net.c complete, look for #ifdef TCP /* * Copied from Linux Monitor (LiMon) - Networking. * * Copyright 1994 - 2000 Neil Russell. * (See License) * Copyright 2000 Roland Borde * Copyright 2000 Paolo Scaffardi * Copyright 2000-2002 Wolfgang Denk, w...@denx.de * Copyright 2017-2018 Duncan Hare, d...@synoia.com * SPDX-License-Identifier:GPL-2.0 */ #define TCP 1 /* * General Desription: * * The user interface supports commands for BOOTP, RARP, and TFTP. * Also, we support ARP internally. Depending on available data, * these interact as follows: * * BOOTP: * * Prerequisites: - own ethernet address * We want:- own IP address * - TFTP server IP address * - name of bootfile * Next step: ARP * * LINK_LOCAL: * * Prerequisites: - own ethernet address * We want:- own IP address * Next step: ARP * * RARP: * * Prerequisites: - own ethernet address * We want:- own IP address * - TFTP server IP address * Next step: ARP * * ARP: * * Prerequisites: - own ethernet address * - own IP address * - TFTP server IP address * We want:- TFTP server ethernet address * Next step: TFTP * * DHCP: * * Prerequisites: - own ethernet address * We want: - IP, Netmask, ServerIP, Gateway IP * - bootfilename, lease time * Next step: - TFTP * * TFTP: * * Prerequisites: - own ethernet address * - own IP address * - TFTP server IP address * - TFTP server ethernet address * - name of bootfile (if unknown, we use a default name *derived from our own IP address) * We want:- load the boot file * Next step: none * * NFS: * * Prerequisites: - own ethernet address * - own IP address * - name of bootfile (if unknown, we use a default name *derived from our own IP address) * We want:- load the boot file * Next step: none * * SNTP: * * Prerequisites: - own ethernet address * - own IP address * We want:- network time * Next step: none * * HTTP/TCP Receiver: * * Prequeisites: - own ethernet adress * - own IP address * - Server IP address * - HTP client * - Bootfile path & name * We want:- Load the Boot file * Next Step HTTPS? */ #define DEBUG_DCH_PKT 1 #define DEBUG_TCP_PKT 0 #include #include #include #include #include #include #include #if defined(CONFIG_STATUS_LED) #include #include #endif #include #include #include "arp.h" #include "bootp.h" #include "cdp.h" #if defined(CONFIG_CMD_DNS) #include "dns.h" #endif #include "link_local.h" #include "nfs.h" #include "wget.h" #include "ping.h" #include "rarp.h" #if defined(CONFIG_CMD_SNTP) #include "sntp.h" #endif DECLARE_GLOBAL_DATA_PTR; /** BOOTP EXTENTIONS **/ /* Our subnet mask (0=unknown) */ struct in_addr net_netmask; /* Our gateways IP address */ struct in_addr net_gateway; /* Our DNS IP address */ struct in_addr net_dns_server; #if defined(CONFIG_BOOTP_DNS2) /* Our 2nd DNS IP address */ struct in_addr net_dns_server2; #endif #ifdef CONFIG_MCAST_TFTP/* Multicast TFTP */ struct in_addr net_mcast_addr; #endif /** END OF BOOTP EXTENTIONS **/ /* Our ethernet address */ u8 net_ethaddr[6]; /* Boot server enet address */ u8 net_server_ethaddr[6]; /* Our IP addr (0 = unknown) */ struct in_addr net_ip; /* Server IP addr (0 = unknown) */ struct in_addr net_server_ip; /* Port numbers */ int dport; int sport; /* Current receive packet */ uchar *net_rx_packet; /* Current rx max packet length */ int net_rx_packet_len; /* IP packet ID */ static unsigned net_ip_id; /* Ethernet bcast address */ const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; const u8 net_null_ethaddr[6]; #if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER) void (*push_pack
[U-Boot] Adding new net command
I'm attempting to add a "wget" command. It mostly there by I cannot find out how to set the #define CONFIG_CMD_WGET 1 into u-boot cfg by handand got a terse message to use a Kconfig file. Which Konfig file should I used for defining the absence/presence of this new command? For development and testing I have not used the #ifdef method of including of excluding code, as I find it hard enough to write one set of code, two sets simultaneously, TCP and Kconfig-uration, exceeds my abilities. I have most of the TCP stack needed coded into in net.c, the sliding windows code being written now, with packet in and packet out the intersection of the new code and existing code. I can transferr small files. UDP function is not affected, and still works. Thanks Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Test Environment
1. Try to build the u-boot test environment with the command: ./test/py/test.py --bd sandbox --build Get the error ../include/image.h:1019:27: fatal error: openssl/evp.h: No such file or directory # include 2. Does the Sandbox support the dhcp, tftp and nfs commands so they can go over the network? Thanks Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Board file for Raspberry Pi, rpi.c and Setting MAC address
The code is: if(!getenv("ethaddr")) setenv("ethaddr",getenv("usbethaddr")); which if I read it correctly says, if the MAC address variable is not set, set from the board's mac address. If an environment is copies from one device to a second, this code prevents populating u-boot in the new device from getting the correct MAC address for the device. Is there a reason for protecting the MAC address variable in this manner? Or should the code be to alwys retrieve the MAC address from the device? For example: setenv("ethaddr",getenv("usbethaddr"); Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Revised NFS/TCP Tranfer measurement: Netboot Download times:: UDP vs TCP
Netboot Download times: u-boot NFS command (using UDP), 4 GB Linux kernel download - 16:20:45 to 16:24:07, elapsed download time 3m38 sec U-boot NFS download command. TCP Dump extract 16:20:45.666179 IP (tos 0x0, ttl 253, id 25842, offset 0, flags [DF], proto UDP (17), length 136) 192.168.1.129.1000 > 192.168.100.15.nfs: NFS request xid 8941 108 lookup fh Unknown/010001019200400029B29757 "kernel.img" .. 16:24:00.792228 IP (tos 0x0, ttl 253, id 29877, offset 0, flags [DF], proto UDP (17), length 88) 192.168.1.129.1000 > 192.168.100.15.46033: [udp sum ok] UDP, length 60 16:24:00.793398 IP (tos 0x0, ttl 64, id 60314, offset 0, flags [DF], proto UDP (17), length 52) 192.168.100.15.46033 > 192.168.1.129.1000: [bad udp cksum 0xe712 -> 0x2e62!] UDP, length 24 Revised measurement on file transfer with NFS/TCP Copy same file between same machines, using NFS and TCP - 16:28:03.376601 - 16:28:043, elapsed download time approx 1sec.16:28:03.376601 IP (tos 0x0, ttl 62, id 17722, offset 0, flags [DF], proto TCP (6), length 60) 192.168.1.129.810 > 192.168.100.15.nfs: Flags [S], cksum 0x161c (correct), seq 1941867141, win 29200, options [mss 1400,sackOK,TS val 4294954943 ecr 0,nop,wscale 7], length 0..16:28:04.36833 IP (tos 0x0, ttl 62, id 46637, offset 0, flags [DF], proto TCP (6), length 52) 192.168.1.129.860 > 192.168.100.15.nfs: Flags [.], cksum 0xc94b (correct), seq 1673, ack 4130701, win 7356, options [nop,nop,TS val 4294956923 ecr 215895745], length 0 Can the NFS command be enhanced to use TCP? TCP open source code exists in linux.kernel.org, the "net" directory. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Netboot Download times:: UDP vs TCP
Netboot Download times: u-boot NFS command (using UDP), 4 GB Linux kernel download - 16:20:45 to 16:24:07, elapsed download time 3m38 sec U-boot NFS download command. TCP Dump extract 16:20:45.666179 IP (tos 0x0, ttl 253, id 25842, offset 0, flags [DF], proto UDP (17), length 136) 192.168.1.129.1000 > 192.168.100.15.nfs: NFS request xid 8941 108 lookup fh Unknown/010001019200400029B29757 "kernel.img" .. 16:24:00.792228 IP (tos 0x0, ttl 253, id 29877, offset 0, flags [DF], proto UDP (17), length 88) 192.168.1.129.1000 > 192.168.100.15.46033: [udp sum ok] UDP, length 60 16:24:00.793398 IP (tos 0x0, ttl 64, id 60314, offset 0, flags [DF], proto UDP (17), length 52) 192.168.100.15.46033 > 192.168.1.129.1000: [bad udp cksum 0xe712 -> 0x2e62!] UDP, length 24 Copy same file between same machines, using NFS and TCP - 16:28:03 - 16:28:23, elapsed download time approx 20 secs, or possibly faster. 16:28:03.848450 IP (tos 0x0, ttl 62, id 17722, offset 0, flags [DF], proto TCP (6), length 60) 192.168.1.129.810 > 192.168.100.15.nfs: Flags [S], cksum 0x161c (correct), seq 1941867141, win 29200, options [mss 1400,sackOK,TS val 4294954943 ecr 0,nop,wscale 7], length 0..16:28:23.660278 IP (tos 0x0, ttl 62, id 46637, offset 0, flags [DF], proto TCP (6), length 52) 192.168.1.129.860 > 192.168.100.15.nfs: Flags [.], cksum 0xc94b (correct), seq 1673, ack 4130701, win 7356, options [nop,nop,TS val 4294956923 ecr 215895745], length 0 Can the NFS command be enhanced to use TCP? TCP open source code exists in linux.kernel.org, the "net" directory. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] DNS Lookup in UBoot
U-boot support DHCP, however beyond the initial set of results returned, many are optional, and even misused. Microsoft's DHCP server appears to have a limited mechanism to set DHCP responses. Because u-boot runs on "smart" devices and has a scripting language (a brilliant one if I may so so) Can we get a DNS lookup command to resolved names after the initial DHCP IP address setup. This is to get a flexible mechanism to set a bootserver address, consistent for Uboot across DHCP implementations. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Add ethernet support to Banana-Pi M2U
Banana Pi BPI-M2 Ultra is a quad-core mini single board computer built with Allwinner R40 SoC. It features 2GB of RAM and 8GB eMMC. Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Add Ethernet Support for Banana Pi M64
BPI-M64 is a 64-bit quad-core mini single board computer using the Allwinner A64 SOC. BPI-M64 features - 1.2 Ghz Quad-Core ARM Cortex A53 - 2GB DDR3 SDRAM with 733MHz - MicroSD/eMMC(8GB) - 10/100/1000Mbps ethernet (Realtek RTL8211E/D) - Wifi + BT - IR receiver - Audio In/Out - Video In/Out - 5V 2A DC power-supply Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] Konfig command for u-boot forn Intel NUC
Please could you let me know the correct config command for the Intekl NUC version of u-boot. Thanks Duncan Hare 714 931 7952 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot