Re: [PATCH v5 00/20] Introduce the lwIP network stack

Jerome Forissier
2024-08-01T14:40:12Z

On 7/26/24 00:34, Tom Rini wrote:
> On Thu, Jul 25, 2024 at 11:22:20AM -0600, Tom Rini wrote:
>> On Thu, Jul 25, 2024 at 02:57:21PM +0200, Jerome Forissier wrote:
>>
>>> This is a rework of a patch series by Maxim Uvarov: "net/lwip: add lwip
>>> library for the network stack" [1]. The goal is to introduce the lwIP TCP/IP
>>> stack [2] [3] as an alternative to the current implementation in net/,
>>> selectable with Kconfig, and ultimately keep only lwIP if possible. Some
>>> reasons for doing so are:
>>> - Make the support of HTTPS in the wget command easier. Javier T. and
>>> Raymond M. (CC'd) have some additional lwIP and Mbed TLS patches to do
>>> so. With that it becomes possible to fetch and launch a distro installer
>>> such as Debian etc. using a secure, authenticated connection directly
>>> from the U-Boot shell. Several use cases:
>>> * Authentication: prevent MITM attack (third party replacing the
>>> binary with a different one)
>>> * Confidentiality: prevent third parties from grabbing a copy of the
>>> image as it is being downloaded
>>> * Allow connection to servers that do not support plain HTTP anymore
>>> (this is becoming more and more common on the Internet these days)
>>> - Possibly benefit from additional features implemented in lwIP
>>> - Less code to maintain in U-Boot
>>>
>>> Prior to applying this series, the lwIP stack needs to be added as a
>>> Git subtree with the following command:
>>>
>>> $ git subtree add --squash --prefix lib/lwip/lwip https://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE
>>
>> This is better than v4, and on the hardware platforms I could build and
>> boot on (which was most of mine except the am62x_beagleplay), the tests
>> ran and completed, including the tftp+boot a Linux kernel.
>>
>> The bad news is CI blows up, a lot:
>> https://source.denx.de/u-boot/u-boot/-/pipelines/21764
>> And:
>> https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
>> which is another Kconfig dependency problem. I don't _think_ I
>> introduced that, but since this wasn't against top of tree, I had to
>> apply the cmd/Kconfig patch manually.
>>
>> I have my world build running still and may have more comments based on
>> that.
>
> First, with NET_LWIP being default rather than NET, there's a lot of
> other Kconfig dependency issues. Unfortunately I don't see an easy tool
> for making sure this is all clean aside from a shell loop like:
> for C in `(cd configs;ls)`;do make -s $C;done

I have run this loop successfully with the upcoming v6 version. Some
configs do print some warnings but there is no error.

> Once those are fixed, this is feeling pretty OK I think. I assume PXE
> support is high on the follow-up TODO list?

Certainly, although I'm not sure I'll be able to spend time on it in the
very near future.

> That said, after taking
> tiger-rk3588 as an example platform and hacking out PXE related stuff and
> turning on lwIP:
> aarch64: (for 1/1 boards) all +10144.0 bss -4040.0 data -64.0 rodata -100.0 text +14348.0
> tiger-rk3588 : all +10144 bss -4040 data -64 rodata -100 text +14348
> u-boot: add: 161/-115, grow: 8/-6 bytes: 24552/-14382 (10170)
[snip]

> Although I'm not 100% sure that config is functionally equivalent, so
> perhaps it would be helpful if you could take a board or two and
> reconfigure them with the legacy stack, but equivalent functionality to
> with lwIP, for comparison sake? Thanks!

I tried two boards and compared NET (u-boot.net) agains NET_LWIP
(u-boot). I will give more details on how to remove PXE from the NET
build and select/unselect the proper Kconfig symbols to obtain equivalent
functionality in the cover letter for v6. Note that dhcp, ping, dns, tftp
and wget are enabled in both builds. Here are the results.

- For imx8mp_evk_defconfig:

$ ~/work/linux/scripts/bloat-o-meter u-boot.net u-boot | sed -n '1p;$p'
add/remove: 228/162 grow/shrink: 49/4 up/down: 51217/-29078 (22139)
Total: Before=651990, After=674129, chg +3.40%

- For rpi_3_32b_defconfig:

$ ~/work/linux/scripts/bloat-o-meter u-boot.net u-boot | sed -n '1p;$p'
add/remove: 256/92 grow/shrink: 5/8 up/down: 50934/-16780 (34154)
Total: Before=418877, After=453031, chg +8.15%

I will post v6 soon.

Thanks,
--
Jerome