mbox series

[PATCHv9,00/15] net/lwip: add lwip library for the network stack

Message ID 20230914161828.3662-1-maxim.uvarov@linaro.org
Headers show
Series net/lwip: add lwip library for the network stack | expand

Message

Maxim Uvarov Sept. 14, 2023, 4:18 p.m. UTC
changelog:
	v9: - added first patch describing git submodule for lwip. So
	      the build procedure is:
		git submodule init
		git submodule update
		make
	    - reworked a little bit dhcp cmd state polling
	    - fixed review comments for v8
	v8: - comments for previous review
	    - removed lwip timeout callback pointer
	    - made lwip timeouts works, that also allowed to remove
	      static vars.
	    - setenv for filesize tftp and wget has to be in hex.
	    - Makefile changes always compile it tftp,dns,wget,ping due
	      to it can be used not only by CONFIG_CMD_.
	    - Kconfig changes - simplify lwIP settings and support only
	      one configuration.
	    - tested with mini debian.iso load over http or tftp, mount
	      and boot it (qemu, arm64).
	v7: - more review fixes.
	    - support of multiply eth devices, were "ethact" selects the
	      active device.
	v6: - fixed review comments for v5 (thanks Ilias and Simon).
	v5: - fixed Iliases comments and split big patch on the small
		ones.
	v4: - tested with tests/py/ did some minor fixes (out of tree
		build, variables set after downloads).
	    - accounted review comments for documentation.
	    - implemented dns command
            - corrected wget command to not use serverip variable and use just
		url string.
	v3: - use lwip commands for ping,tftp,wget,dhcp if this patch
	      applied. Drop CONFIG_LIB_LWIP_REPLACE_<COMMAND> option.
	    - docs: use rst variant and drop references to RFC.


Maxim Uvarov (15):
  submodule: add lwIP as git submodule
  net/lwip: add doc/develop/net_lwip.rst
  net/lwip: integrate lwIP library
  net/lwip: implement dns cmd
  net/lwip: implement dhcp cmd
  net/lwip: implement tftp cmd
  net/lwip: implement wget cmd
  net/lwip: implement ping cmd
  net/lwip: add lwIP configuration
  net/lwip: implement lwIP port to U-Boot
  net/lwip: update .gitignore with lwIP
  net/lwip: connection between cmd and lwip apps
  net/lwip: replace original net commands with lwip
  net/lwip: split net.h to net.h, arp.h and eth.h
  net/lwip: drop old net/wget

 .gitmodules                           |   3 +
 boot/bootmeth_efi.c                   |  18 +-
 boot/bootmeth_pxe.c                   |  21 +-
 cmd/Makefile                          |   1 +
 cmd/net-lwip.c                        | 286 +++++++++++++++++
 cmd/net.c                             |  86 +----
 cmd/pxe.c                             |  19 +-
 doc/develop/index.rst                 |   1 +
 doc/develop/net_lwip.rst              |  75 +++++
 include/net.h                         | 197 +-----------
 include/net/arp.h                     |   7 +
 include/net/eth.h                     | 190 +++++++++++
 include/net/lwip.h                    |  73 +++++
 include/net/ulwip.h                   |  64 ++++
 include/net/wget.h                    |  22 --
 net/Kconfig                           |   3 +
 net/Makefile                          |   2 +-
 net/eth-uclass.c                      |   8 +
 net/lwip/.gitignore                   |   8 +
 net/lwip/Kconfig                      |  25 ++
 net/lwip/Makefile                     |  70 ++++
 net/lwip/apps/dhcp/lwip-dhcp.c        |  85 +++++
 net/lwip/apps/dns/lwip-dns.c          |  63 ++++
 net/lwip/apps/http/Makefile           |   6 +
 net/lwip/apps/http/lwip-wget.c        | 105 ++++++
 net/lwip/apps/ping/Makefile           |  12 +
 net/lwip/apps/ping/lwip_ping.c        |  38 +++
 net/lwip/apps/ping/lwip_ping.h        |  15 +
 net/lwip/apps/ping/ping.h             |  19 ++
 net/lwip/apps/tftp/Makefile           |   7 +
 net/lwip/apps/tftp/lwip-tftp.c        | 129 ++++++++
 net/lwip/lwip-external                |   1 +
 net/lwip/lwipopts.h                   | 178 +++++++++++
 net/lwip/port/if.c                    | 332 +++++++++++++++++++
 net/lwip/port/include/arch/cc.h       |  38 +++
 net/lwip/port/include/arch/sys_arch.h |  10 +
 net/lwip/port/include/limits.h        |   0
 net/lwip/port/sys-arch.c              |  13 +
 net/net.c                             |  26 +-
 net/wget.c                            | 440 --------------------------
 40 files changed, 1938 insertions(+), 758 deletions(-)
 create mode 100644 .gitmodules
 create mode 100644 cmd/net-lwip.c
 create mode 100644 doc/develop/net_lwip.rst
 create mode 100644 include/net/arp.h
 create mode 100644 include/net/eth.h
 create mode 100644 include/net/lwip.h
 create mode 100644 include/net/ulwip.h
 delete mode 100644 include/net/wget.h
 create mode 100644 net/lwip/.gitignore
 create mode 100644 net/lwip/Kconfig
 create mode 100644 net/lwip/Makefile
 create mode 100644 net/lwip/apps/dhcp/lwip-dhcp.c
 create mode 100644 net/lwip/apps/dns/lwip-dns.c
 create mode 100644 net/lwip/apps/http/Makefile
 create mode 100644 net/lwip/apps/http/lwip-wget.c
 create mode 100644 net/lwip/apps/ping/Makefile
 create mode 100644 net/lwip/apps/ping/lwip_ping.c
 create mode 100644 net/lwip/apps/ping/lwip_ping.h
 create mode 100644 net/lwip/apps/ping/ping.h
 create mode 100644 net/lwip/apps/tftp/Makefile
 create mode 100644 net/lwip/apps/tftp/lwip-tftp.c
 create mode 160000 net/lwip/lwip-external
 create mode 100644 net/lwip/lwipopts.h
 create mode 100644 net/lwip/port/if.c
 create mode 100644 net/lwip/port/include/arch/cc.h
 create mode 100644 net/lwip/port/include/arch/sys_arch.h
 create mode 100644 net/lwip/port/include/limits.h
 create mode 100644 net/lwip/port/sys-arch.c
 delete mode 100644 net/wget.c

Comments

Ilias Apalodimas Sept. 15, 2023, 8:07 a.m. UTC | #1
Hi Maxim,

On Thu, 14 Sept 2023 at 19:20, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>
> changelog:
>         v9: - added first patch describing git submodule for lwip. So
>               the build procedure is:
>                 git submodule init
>                 git submodule update
>                 make
>             - reworked a little bit dhcp cmd state polling
>             - fixed review comments for v8
>         v8: - comments for previous review
>             - removed lwip timeout callback pointer
>             - made lwip timeouts works, that also allowed to remove
>               static vars.
>             - setenv for filesize tftp and wget has to be in hex.
>             - Makefile changes always compile it tftp,dns,wget,ping due
>               to it can be used not only by CONFIG_CMD_.
>             - Kconfig changes - simplify lwIP settings and support only
>               one configuration.
>             - tested with mini debian.iso load over http or tftp, mount
>               and boot it (qemu, arm64).
>         v7: - more review fixes.
>             - support of multiply eth devices, were "ethact" selects the
>               active device.
>         v6: - fixed review comments for v5 (thanks Ilias and Simon).
>         v5: - fixed Iliases comments and split big patch on the small
>                 ones.
>         v4: - tested with tests/py/ did some minor fixes (out of tree
>                 build, variables set after downloads).
>             - accounted review comments for documentation.
>             - implemented dns command
>             - corrected wget command to not use serverip variable and use just
>                 url string.
>         v3: - use lwip commands for ping,tftp,wget,dhcp if this patch
>               applied. Drop CONFIG_LIB_LWIP_REPLACE_<COMMAND> option.
>             - docs: use rst variant and drop references to RFC.

Something is wrong with the current implementation and I suspect it's
partially due to callbacks.

If you spawn a qemu with '-device virtio-net-pci,netdev=net0 -netdev
tap,id=net0', assign ip addresses and try a tftp this initially works
=> tftp synquacer_fw.capsule
eth0: virtio-net#33 52:52:52:52:52:52 active
TFTP from server 10.10.10.2; our IP address is 10.10.10.1
Filename 'synquacer_fw.capsule'.
Load address: 0x40200000
Loading:#######################
[...]

However, if you do a ping first the output looks like this

=> ping 10.10.10.2
eth0: virtio-net#33 52:52:52:52:52:52 active
Using virtio-net#33 device
pinging addr: 10.10.10.2
host 10.10.10.2 a alive
 1 ms
=> tftp synquacer_fw.capsule
init already done for virtio-net#33
TFTP from server 10.10.10.2; our IP address is 10.10.10.1
Filename 'synquacer_fw.capsule'.
Load address: 0x40200000
Loading:ping failed; host �Hi> is not alive
host 10.10.10.2 a alive
 0 ms
=>

Thanks
/Ilias
>
>
> Maxim Uvarov (15):
>   submodule: add lwIP as git submodule
>   net/lwip: add doc/develop/net_lwip.rst
>   net/lwip: integrate lwIP library
>   net/lwip: implement dns cmd
>   net/lwip: implement dhcp cmd
>   net/lwip: implement tftp cmd
>   net/lwip: implement wget cmd
>   net/lwip: implement ping cmd
>   net/lwip: add lwIP configuration
>   net/lwip: implement lwIP port to U-Boot
>   net/lwip: update .gitignore with lwIP
>   net/lwip: connection between cmd and lwip apps
>   net/lwip: replace original net commands with lwip
>   net/lwip: split net.h to net.h, arp.h and eth.h
>   net/lwip: drop old net/wget
>
>  .gitmodules                           |   3 +
>  boot/bootmeth_efi.c                   |  18 +-
>  boot/bootmeth_pxe.c                   |  21 +-
>  cmd/Makefile                          |   1 +
>  cmd/net-lwip.c                        | 286 +++++++++++++++++
>  cmd/net.c                             |  86 +----
>  cmd/pxe.c                             |  19 +-
>  doc/develop/index.rst                 |   1 +
>  doc/develop/net_lwip.rst              |  75 +++++
>  include/net.h                         | 197 +-----------
>  include/net/arp.h                     |   7 +
>  include/net/eth.h                     | 190 +++++++++++
>  include/net/lwip.h                    |  73 +++++
>  include/net/ulwip.h                   |  64 ++++
>  include/net/wget.h                    |  22 --
>  net/Kconfig                           |   3 +
>  net/Makefile                          |   2 +-
>  net/eth-uclass.c                      |   8 +
>  net/lwip/.gitignore                   |   8 +
>  net/lwip/Kconfig                      |  25 ++
>  net/lwip/Makefile                     |  70 ++++
>  net/lwip/apps/dhcp/lwip-dhcp.c        |  85 +++++
>  net/lwip/apps/dns/lwip-dns.c          |  63 ++++
>  net/lwip/apps/http/Makefile           |   6 +
>  net/lwip/apps/http/lwip-wget.c        | 105 ++++++
>  net/lwip/apps/ping/Makefile           |  12 +
>  net/lwip/apps/ping/lwip_ping.c        |  38 +++
>  net/lwip/apps/ping/lwip_ping.h        |  15 +
>  net/lwip/apps/ping/ping.h             |  19 ++
>  net/lwip/apps/tftp/Makefile           |   7 +
>  net/lwip/apps/tftp/lwip-tftp.c        | 129 ++++++++
>  net/lwip/lwip-external                |   1 +
>  net/lwip/lwipopts.h                   | 178 +++++++++++
>  net/lwip/port/if.c                    | 332 +++++++++++++++++++
>  net/lwip/port/include/arch/cc.h       |  38 +++
>  net/lwip/port/include/arch/sys_arch.h |  10 +
>  net/lwip/port/include/limits.h        |   0
>  net/lwip/port/sys-arch.c              |  13 +
>  net/net.c                             |  26 +-
>  net/wget.c                            | 440 --------------------------
>  40 files changed, 1938 insertions(+), 758 deletions(-)
>  create mode 100644 .gitmodules
>  create mode 100644 cmd/net-lwip.c
>  create mode 100644 doc/develop/net_lwip.rst
>  create mode 100644 include/net/arp.h
>  create mode 100644 include/net/eth.h
>  create mode 100644 include/net/lwip.h
>  create mode 100644 include/net/ulwip.h
>  delete mode 100644 include/net/wget.h
>  create mode 100644 net/lwip/.gitignore
>  create mode 100644 net/lwip/Kconfig
>  create mode 100644 net/lwip/Makefile
>  create mode 100644 net/lwip/apps/dhcp/lwip-dhcp.c
>  create mode 100644 net/lwip/apps/dns/lwip-dns.c
>  create mode 100644 net/lwip/apps/http/Makefile
>  create mode 100644 net/lwip/apps/http/lwip-wget.c
>  create mode 100644 net/lwip/apps/ping/Makefile
>  create mode 100644 net/lwip/apps/ping/lwip_ping.c
>  create mode 100644 net/lwip/apps/ping/lwip_ping.h
>  create mode 100644 net/lwip/apps/ping/ping.h
>  create mode 100644 net/lwip/apps/tftp/Makefile
>  create mode 100644 net/lwip/apps/tftp/lwip-tftp.c
>  create mode 160000 net/lwip/lwip-external
>  create mode 100644 net/lwip/lwipopts.h
>  create mode 100644 net/lwip/port/if.c
>  create mode 100644 net/lwip/port/include/arch/cc.h
>  create mode 100644 net/lwip/port/include/arch/sys_arch.h
>  create mode 100644 net/lwip/port/include/limits.h
>  create mode 100644 net/lwip/port/sys-arch.c
>  delete mode 100644 net/wget.c
>
> --
> 2.30.2
>
Maxim Uvarov Sept. 15, 2023, 8:56 a.m. UTC | #2
On Fri, 15 Sept 2023 at 14:07, Ilias Apalodimas <ilias.apalodimas@linaro.org>
wrote:

> Hi Maxim,
>
> On Thu, 14 Sept 2023 at 19:20, Maxim Uvarov <maxim.uvarov@linaro.org>
> wrote:
> >
> > changelog:
> >         v9: - added first patch describing git submodule for lwip. So
> >               the build procedure is:
> >                 git submodule init
> >                 git submodule update
> >                 make
> >             - reworked a little bit dhcp cmd state polling
> >             - fixed review comments for v8
> >         v8: - comments for previous review
> >             - removed lwip timeout callback pointer
> >             - made lwip timeouts works, that also allowed to remove
> >               static vars.
> >             - setenv for filesize tftp and wget has to be in hex.
> >             - Makefile changes always compile it tftp,dns,wget,ping due
> >               to it can be used not only by CONFIG_CMD_.
> >             - Kconfig changes - simplify lwIP settings and support only
> >               one configuration.
> >             - tested with mini debian.iso load over http or tftp, mount
> >               and boot it (qemu, arm64).
> >         v7: - more review fixes.
> >             - support of multiply eth devices, were "ethact" selects the
> >               active device.
> >         v6: - fixed review comments for v5 (thanks Ilias and Simon).
> >         v5: - fixed Iliases comments and split big patch on the small
> >                 ones.
> >         v4: - tested with tests/py/ did some minor fixes (out of tree
> >                 build, variables set after downloads).
> >             - accounted review comments for documentation.
> >             - implemented dns command
> >             - corrected wget command to not use serverip variable and
> use just
> >                 url string.
> >         v3: - use lwip commands for ping,tftp,wget,dhcp if this patch
> >               applied. Drop CONFIG_LIB_LWIP_REPLACE_<COMMAND> option.
> >             - docs: use rst variant and drop references to RFC.
>
> Something is wrong with the current implementation and I suspect it's
> partially due to callbacks.
>
> If you spawn a qemu with '-device virtio-net-pci,netdev=net0 -netdev
> tap,id=net0', assign ip addresses and try a tftp this initially works
> => tftp synquacer_fw.capsule
> eth0: virtio-net#33 52:52:52:52:52:52 active
> TFTP from server 10.10.10.2; our IP address is 10.10.10.1
> Filename 'synquacer_fw.capsule'.
> Load address: 0x40200000
> Loading:#######################
> [...]
>
> However, if you do a ping first the output looks like this
>
> => ping 10.10.10.2
> eth0: virtio-net#33 52:52:52:52:52:52 active
> Using virtio-net#33 device
> pinging addr: 10.10.10.2
> host 10.10.10.2 a alive
>  1 ms
> => tftp synquacer_fw.capsule
> init already done for virtio-net#33
> TFTP from server 10.10.10.2; our IP address is 10.10.10.1
> Filename 'synquacer_fw.capsule'.
> Load address: 0x40200000
> Loading:ping failed; host �Hi> is not alive
> host 10.10.10.2 a alive
>  0 ms
> =>
>
> Thanks
> /Ilias
>


Thanks,  I will get it fixed.



> >
> >
> > Maxim Uvarov (15):
> >   submodule: add lwIP as git submodule
> >   net/lwip: add doc/develop/net_lwip.rst
> >   net/lwip: integrate lwIP library
> >   net/lwip: implement dns cmd
> >   net/lwip: implement dhcp cmd
> >   net/lwip: implement tftp cmd
> >   net/lwip: implement wget cmd
> >   net/lwip: implement ping cmd
> >   net/lwip: add lwIP configuration
> >   net/lwip: implement lwIP port to U-Boot
> >   net/lwip: update .gitignore with lwIP
> >   net/lwip: connection between cmd and lwip apps
> >   net/lwip: replace original net commands with lwip
> >   net/lwip: split net.h to net.h, arp.h and eth.h
> >   net/lwip: drop old net/wget
> >
> >  .gitmodules                           |   3 +
> >  boot/bootmeth_efi.c                   |  18 +-
> >  boot/bootmeth_pxe.c                   |  21 +-
> >  cmd/Makefile                          |   1 +
> >  cmd/net-lwip.c                        | 286 +++++++++++++++++
> >  cmd/net.c                             |  86 +----
> >  cmd/pxe.c                             |  19 +-
> >  doc/develop/index.rst                 |   1 +
> >  doc/develop/net_lwip.rst              |  75 +++++
> >  include/net.h                         | 197 +-----------
> >  include/net/arp.h                     |   7 +
> >  include/net/eth.h                     | 190 +++++++++++
> >  include/net/lwip.h                    |  73 +++++
> >  include/net/ulwip.h                   |  64 ++++
> >  include/net/wget.h                    |  22 --
> >  net/Kconfig                           |   3 +
> >  net/Makefile                          |   2 +-
> >  net/eth-uclass.c                      |   8 +
> >  net/lwip/.gitignore                   |   8 +
> >  net/lwip/Kconfig                      |  25 ++
> >  net/lwip/Makefile                     |  70 ++++
> >  net/lwip/apps/dhcp/lwip-dhcp.c        |  85 +++++
> >  net/lwip/apps/dns/lwip-dns.c          |  63 ++++
> >  net/lwip/apps/http/Makefile           |   6 +
> >  net/lwip/apps/http/lwip-wget.c        | 105 ++++++
> >  net/lwip/apps/ping/Makefile           |  12 +
> >  net/lwip/apps/ping/lwip_ping.c        |  38 +++
> >  net/lwip/apps/ping/lwip_ping.h        |  15 +
> >  net/lwip/apps/ping/ping.h             |  19 ++
> >  net/lwip/apps/tftp/Makefile           |   7 +
> >  net/lwip/apps/tftp/lwip-tftp.c        | 129 ++++++++
> >  net/lwip/lwip-external                |   1 +
> >  net/lwip/lwipopts.h                   | 178 +++++++++++
> >  net/lwip/port/if.c                    | 332 +++++++++++++++++++
> >  net/lwip/port/include/arch/cc.h       |  38 +++
> >  net/lwip/port/include/arch/sys_arch.h |  10 +
> >  net/lwip/port/include/limits.h        |   0
> >  net/lwip/port/sys-arch.c              |  13 +
> >  net/net.c                             |  26 +-
> >  net/wget.c                            | 440 --------------------------
> >  40 files changed, 1938 insertions(+), 758 deletions(-)
> >  create mode 100644 .gitmodules
> >  create mode 100644 cmd/net-lwip.c
> >  create mode 100644 doc/develop/net_lwip.rst
> >  create mode 100644 include/net/arp.h
> >  create mode 100644 include/net/eth.h
> >  create mode 100644 include/net/lwip.h
> >  create mode 100644 include/net/ulwip.h
> >  delete mode 100644 include/net/wget.h
> >  create mode 100644 net/lwip/.gitignore
> >  create mode 100644 net/lwip/Kconfig
> >  create mode 100644 net/lwip/Makefile
> >  create mode 100644 net/lwip/apps/dhcp/lwip-dhcp.c
> >  create mode 100644 net/lwip/apps/dns/lwip-dns.c
> >  create mode 100644 net/lwip/apps/http/Makefile
> >  create mode 100644 net/lwip/apps/http/lwip-wget.c
> >  create mode 100644 net/lwip/apps/ping/Makefile
> >  create mode 100644 net/lwip/apps/ping/lwip_ping.c
> >  create mode 100644 net/lwip/apps/ping/lwip_ping.h
> >  create mode 100644 net/lwip/apps/ping/ping.h
> >  create mode 100644 net/lwip/apps/tftp/Makefile
> >  create mode 100644 net/lwip/apps/tftp/lwip-tftp.c
> >  create mode 160000 net/lwip/lwip-external
> >  create mode 100644 net/lwip/lwipopts.h
> >  create mode 100644 net/lwip/port/if.c
> >  create mode 100644 net/lwip/port/include/arch/cc.h
> >  create mode 100644 net/lwip/port/include/arch/sys_arch.h
> >  create mode 100644 net/lwip/port/include/limits.h
> >  create mode 100644 net/lwip/port/sys-arch.c
> >  delete mode 100644 net/wget.c
> >
> > --
> > 2.30.2
> >
>