From patchwork Fri May 5 10:25:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 679297 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp283147wrs; Fri, 5 May 2023 03:50:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5pRWVAm47WYPxY73PupnjIPkExE1hxxSz8bZjBT4EMHiZGpy+J81XOyw1Jbzhuddfhie20 X-Received: by 2002:a05:6a21:99a5:b0:f0:515d:1742 with SMTP id ve37-20020a056a2199a500b000f0515d1742mr1393522pzb.53.1683283837911; Fri, 05 May 2023 03:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683283837; cv=none; d=google.com; s=arc-20160816; b=qZJVdJR2u1sx8l3kQ9jKrTjLN0oEQzDXDniJRAMQPs1/XwBwQmK2ZP3TGFOAiP3rL0 fOfBrSoaqJLlE59/wcy9erWPm3zbBtvK1vOo//b60VSqVHhHYNgao8DyDrJ/OiA+B/MG genBDTw63D1FeD9hsbHjqC2nvEG6MUrjXejDZDP6SBxOHm7MGuXPg1T0KvZoUdEKyGAX zTbWz7fG1+P3vs5aZRee4VrIPTDf52MsVx8/+g9snjRoY++hYAjxeEMeC0EYbbfLVdXz AMY7+oeOEpHlnjb4FEpqMSU/Spcrr1xsi0kLogVqY6DjFXAV8rxXF3eOCVzVw1YmH7cj JNDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=u0KqdhwIs6ohGUsRj2p8POdQd0K6c9NHgjTd4YYQv+g=; b=KWd+sEOq02J3MCmO1xfVb/6sEf065TTWVFBqLg2RfGwbcM3zYEiCQvr+0F+18wOB4T 9U6ERafZxJibWFKQ/9dO7O282FarJpp5Hxy0hZI7umq929XL+e27GPXMu33HVtm5Bzvm JictQw/JJ8Hl9FcI7O1dvl1V4OiVqGDWGXvJs6dFTH7D3/watueqI9tD25aJyhOe5YHG RQSO+vUsLtmCMGlWosg9AG7GvIn+i2n7cWBw5q8lW3yVJgaBd37G4KO+n4NBXHmEGlRU lKkgw/6qYiyiD/vm3G80KVRvffxv7hT422CNhkwf6zs5WzLsfskeO+N4EfsfkNfT1Gs1 nmyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YOYqhhVw; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id b15-20020a63714f000000b004dffd0e0409si1673768pgn.518.2023.05.05.03.50.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 03:50:37 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YOYqhhVw; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 648378477A; Fri, 5 May 2023 12:50:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YOYqhhVw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1940F8477A; Fri, 5 May 2023 12:25:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CD3C6846E7 for ; Fri, 5 May 2023 12:25:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=maxim.uvarov@linaro.org Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1928253dd95so686227fac.3 for ; Fri, 05 May 2023 03:25:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683282334; x=1685874334; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=u0KqdhwIs6ohGUsRj2p8POdQd0K6c9NHgjTd4YYQv+g=; b=YOYqhhVwYPZ1gS9oqeRzSweqhak77xu7LsLoUYBTh7AFEvbZFesV2ETgbutDVd3TVs fmNR0xzYJY5npRUBK1fwETwtKntGLDLIAF3el5DGhQlf0ZdFn5ojwlkfmKTdu6XWsGFT IlBmiIE6AJ5hbvC3V6+tJccPK27FU9PxjPk0nSywVkjuT5xEiICaol9kRABAGCYLfuCL KyXn5P+rtg5eaJfeovj9dcJOWbh5h0i9deV3ezKlNKckDBSCcj0edm7z9QYLfrqqIVYf 0bxtJLp/XnTrfutp6g/6BaunxtyGHAK+H/VkIvU8L4CQDjFd7GXBOhhU9ZG1EhiSGSfb +7sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683282334; x=1685874334; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=u0KqdhwIs6ohGUsRj2p8POdQd0K6c9NHgjTd4YYQv+g=; b=deuNXAmddF4LId5aiowQ8C9/QwqGlZ1+GOWGYDg2je8tc/J4JYcm0EwfHkQBmNCasD m4v2ThWWEqCY5Hgci4Sk6Di7iaPEZ+TP3lDmWi4Y8gGByUBEm0uE3MPKIKKaU/0IV3bs tyvlVvR/qI4uL5TpXikbmTrGp2/mrDkdhTwNO8qrQOV8B7LCZIW0Yhb6msnW4A2acagV QmF+7zwJXl1+CVtqmPmuO0S9lylIm2bt+7/TdJI6/N9DxLZ71GsxYXmwqPEFE/rgeruf v7A0Iy7BBMOmGcB3YrPuPaaSMmFE7xen2GweTxL4nEa1HBlLPTzDPzNUWqP+OH4H038f omuA== X-Gm-Message-State: AC+VfDwxwU5sgQPEmxTPRmSHDlkTE7ukpjqlRX49tzNbV44bny40a5Gx 4kwr2Ue4EGZE/DesDVvafhWoopLwMdE7gLOLS2Q= X-Received: by 2002:a05:6870:4501:b0:177:c0e4:1bd2 with SMTP id e1-20020a056870450100b00177c0e41bd2mr529797oao.52.1683282334029; Fri, 05 May 2023 03:25:34 -0700 (PDT) Received: from ledge.ozog.com ([2604:1380:4111:b700::1]) by smtp.gmail.com with ESMTPSA id b21-20020a056830105500b006a6169cf6b0sm635068otp.47.2023.05.05.03.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 03:25:33 -0700 (PDT) From: Maxim Uvarov To: u-boot@lists.denx.de Cc: pbrobinson@redhat.com, ilias.apalodimas@linaro.org, joe.hershberger@ni.com, rfried.dev@gmail.com, Maxim Uvarov Subject: [RFC PATCH 0/5] LWIP stack integration Date: Fri, 5 May 2023 10:25:24 +0000 Message-ID: <20230505102529.1254445-1-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.40.1.476.g69c786637d MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 05 May 2023 12:50:31 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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