[RFC PATCH 0/5] LWIP stack integration

Maxim Uvarov maxim.uvarov at linaro.org
Fri May 5 12:25:24 CEST 2023


Greetings,

This RFC patchset is an attempt to try to use an already existing IP network stack inside U-boot.
U-Boot recently got basic TCP/IP support, implementing wget, but in order to get a full IP stack
with new features (e.g ipv6), it would be preferable to use an established embedded ip library,
instead of rewriting the code from scratch.

For this experiment LWIP network stack was selected:
https://savannah.nongnu.org/git/?group=lwip

LWIP main features include:
- Protocols: IP, IPv6, ICMP, ND, MLD, UDP, TCP, IGMP, ARP, PPPoS, PPPoE
- DHCP client, DNS client (incl. mDNS hostname resolver), AutoIP/APIPA (Zeroconf),
  SNMP agent (v1, v2c, v3, private MIB support & MIB compiler)
- APIs: specialized APIs for enhanced performance, optional Berkeley-alike socket API
- Extended features: IP forwarding over multiple network interfaces, TCP congestion control,
  RTT estimation and fast recovery/fast retransmit
- Addon applications: HTTP(S) server, SNTP client, SMTP(S) client, ping, NetBIOS nameserver,
  mDNS responder, MQTT client, TFTP server.

This RFC work is a demo to enable lwIP (lightweight IP) which is a widely used open-source 
TCP/IP stack designed for embedded systems for U-boot. That will allow using already 
written network applications for microcontrollers.

lwIP is licensed under a BSD-style license: http://lwip.wikia.com/wiki/License.
Which should be compatible with u-boot.

In the current RFC I tried to use minimal changes to better see how LWIP code can be embedded into
U-boot. Patches implement ping and wget commands work. Both commands are currently copy pasting and
reusing lwIP examples.  Whether we want to add the final application in U-Boot or lwIP is up to 
discussion, but the current approach was the easiest one for an RFC.

Looking for your comments,
Best regards,
Maxim.

Maxim Uvarov (5):
  add lwip-external submodule
  lib/lwip: compile-in core files
  add doc/README.lwip
  add doc/README.lwip.size
  lwip: implement wget command from http_client.c example

 .gitignore                             |   5 +
 .gitmodules                            |   3 +
 doc/README.lwip                        |  90 +++++
 doc/README.lwip.size                   | 291 +++++++++++++++
 include/net.h                          |   2 +-
 lib/Kconfig                            |   2 +
 lib/Makefile                           |   2 +
 lib/lwip/Kconfig                       |  12 +
 lib/lwip/Makefile                      |  86 +++++
 lib/lwip/apps/http/lwip-wget.c         |  67 ++++
 lib/lwip/apps/http/rmstatic.patch      |  47 +++
 lib/lwip/apps/ping/lwip_ping.c         |  33 ++
 lib/lwip/apps/ping/lwip_ping.h         |  19 +
 lib/lwip/apps/ping/ping.h              |   0
 lib/lwip/apps/ping/rmstatic.patch      |  32 ++
 lib/lwip/cmd-lwip.c                    | 129 +++++++
 lib/lwip/lwip-external                 |   1 +
 lib/lwip/lwipopts.h                    | 484 +++++++++++++++++++++++++
 lib/lwip/port/if.c                     | 256 +++++++++++++
 lib/lwip/port/include/arch/cc.h        |  41 +++
 lib/lwip/port/include/arch/sys_arch.h  |  78 ++++
 lib/lwip/port/include/arch/u-sockets.h |  26 ++
 lib/lwip/port/include/limits.h         |   0
 lib/lwip/port/sys-arch.c               |   7 +
 net/eth-uclass.c                       |   4 +-
 net/net.c                              |  14 +
 26 files changed, 1729 insertions(+), 2 deletions(-)
 create mode 100644 .gitmodules
 create mode 100644 doc/README.lwip
 create mode 100644 doc/README.lwip.size
 create mode 100644 lib/lwip/Kconfig
 create mode 100644 lib/lwip/Makefile
 create mode 100644 lib/lwip/apps/http/lwip-wget.c
 create mode 100644 lib/lwip/apps/http/rmstatic.patch
 create mode 100644 lib/lwip/apps/ping/lwip_ping.c
 create mode 100644 lib/lwip/apps/ping/lwip_ping.h
 create mode 100644 lib/lwip/apps/ping/ping.h
 create mode 100644 lib/lwip/apps/ping/rmstatic.patch
 create mode 100644 lib/lwip/cmd-lwip.c
 create mode 160000 lib/lwip/lwip-external
 create mode 100644 lib/lwip/lwipopts.h
 create mode 100644 lib/lwip/port/if.c
 create mode 100644 lib/lwip/port/include/arch/cc.h
 create mode 100644 lib/lwip/port/include/arch/sys_arch.h
 create mode 100644 lib/lwip/port/include/arch/u-sockets.h
 create mode 100644 lib/lwip/port/include/limits.h
 create mode 100644 lib/lwip/port/sys-arch.c

-- 
2.30.2



More information about the U-Boot mailing list