From patchwork Mon Aug 14 13:32:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 713470 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1241838wrp; Mon, 14 Aug 2023 06:35:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGdl0xbHDwXPPEVQMeMOMwYSvkiA286th8tLOgrB7vejrxDi4wkEIiqrWGA7Gi8WEIhGSw7 X-Received: by 2002:a7b:ce99:0:b0:3fe:1f70:9e54 with SMTP id q25-20020a7bce99000000b003fe1f709e54mr9771012wmj.4.1692020123930; Mon, 14 Aug 2023 06:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692020123; cv=none; d=google.com; s=arc-20160816; b=eXXAwPtiFOD/+Hpe8ye8KxAxNsHc+v94VSSwt67Y8dNLn6qEUWDr1anCFVkaFTfSIX AZwqHRbfpGVo9SKwpAl96NTek5KYSp2fL59bkZmTsav61gRrnGas6QtsonV1XRxW7Pw1 JYGcpUTrxgM9IRYDMhSZU7LV7lUItBtBmla3UUvL3TTAtoqwsNPDOgRvuT+A9N75HWge 74haF82M0n+wQ2XCqzX0pR1q0HDLlzZoTvhUkJsPYF6zveCOgLPCWTMa6esHXIJsU+t7 +sDEPUIo8U3ivk3OaRMr2CE6flu5FIVjFO3E7mMqct3PBiiyLQKPpr42kE4tUf4rcgcZ jBmQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hkIGeB291jB+1tGA8HrbTzhGbwVlxBLBG4XoLBsXRw0=; fh=GxT5DUgD3izNRwAKLYTQd/U1zCykdRvuqVJsmcrm2OQ=; b=By0lZPnAYsT+Cxc7JkIlAi/ywmMyyQorhYkZdKtzjjcQFu5ad4H+6Y3jJ3RvYylA9a s1gsiaxt1vywHhNPSeBGJakTr9ePVCUCXwAElLrXAp7g90TzoBhYUw4nXGq1DNiOoy5U Cy0K8bJdhbhG0hhdwfV4/JjnYeZlugxg1Zsooh+JVXtMo8iPVUwmekzjj7VMRKphuyum 2sJsDEwsQRMRRXYlrB0SUqi3wSqZkiU3Tha3Gnle4nEpfEPSBqP2bhhSWJV44UiHhmsn KsN3zegjYftGGqHw9PrWekTDXTZVbVSFPrSEW5+AH5/f98CaYRzLfeT3tZl8H9aIUClQ asYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GlESJvmS; 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 q16-20020adffed0000000b00317544258b5si5368606wrs.288.2023.08.14.06.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 06:35:23 -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=GlESJvmS; 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 CCAA386958; Mon, 14 Aug 2023 15:35:16 +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="GlESJvmS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B14CE86918; Mon, 14 Aug 2023 15:35:15 +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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) (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 7B418807B3 for ; Mon, 14 Aug 2023 15:35:13 +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-lj1-x235.google.com with SMTP id 38308e7fff4ca-2bb734a9081so13457191fa.1 for ; Mon, 14 Aug 2023 06:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692020112; x=1692624912; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hkIGeB291jB+1tGA8HrbTzhGbwVlxBLBG4XoLBsXRw0=; b=GlESJvmS2LQYy0/KSWNOOIOp6/VxGp7YeImtDIxZQd+Hkm+GndEnHdf2/bIQ/LAcNg e2PiysQW0F1S9Gpr5zAqS+KfiWCCUTDU9SffEUz0XLG72fxHZVJKCRz7KcO2aQcQranb HmOMuetZjGEmzxFBNeuCvUMCseYnl0zCPgsaAN785qUqHCSc5U+iu/sF3dTkZlSSJ+D0 yhYnshwp8UHmaCdv7dAPlhQqGk1WjeyjTDU3ivtc1JImW9aX5yEusAU9iJfNYEQNgLHD +jOcklr4NYh8TKau3AioG3pc1cRHDtMrQ6qzAV8Vx1AWn8ED269ShBm6LpC7NfyCIH+b W5Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692020112; x=1692624912; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hkIGeB291jB+1tGA8HrbTzhGbwVlxBLBG4XoLBsXRw0=; b=LinT55nro1S6G+34vooNmRZLD0gZ5/bEY47XsmX5amKVXe+znnclA1lGrKWvK6qwfP iDYS0W0ig1ftHWSyfOgevZ84xGSKipPcjD9OoucJF09y/Xcq34IUlBsvR2t6pKYcZlpf hk6ZTo6Gccp503IHC5Y2YGUBZBrhdIiZoszplAukK05OZfmqDRWED/GC4aJsK2IoX8Z8 vibobOKTvi7TLzfBKJM/chu2YyI+9Uk8K3KsIQrOEtNyDeYnfm8SHAeiBCtzq+9k5x8+ Vc848367CIxanMND8W7jvSG1qzsnUxWSpQHyE+sJc2Gyhih2kYiJSOwM4O1kqzcOdUzu 5l6g== X-Gm-Message-State: AOJu0YxMd028i1Rtm6mohJ0gQw6Gx5qkp5hI/tswFaMrvGwcabvIodIU h7jJi3EA9V4V7H0NX3r4ij7j/EF51gy2/rKbPyg= X-Received: by 2002:a2e:86d0:0:b0:2b9:a9d8:16a7 with SMTP id n16-20020a2e86d0000000b002b9a9d816a7mr3428223ljj.8.1692020112630; Mon, 14 Aug 2023 06:35:12 -0700 (PDT) Received: from localhost.localdomain ([45.82.14.220]) by smtp.gmail.com with ESMTPSA id z24-20020a2e9658000000b002b9415597d0sm2411102ljh.78.2023.08.14.06.35.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 06:35:12 -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, trini@konsulko.com, goldsimon@gmx.de, lwip-devel@nongnu.org, Maxim Uvarov , Simon Glass Subject: [PATCHv6 01/14] net/lwip: add doc/develop/net_lwip.rst Date: Mon, 14 Aug 2023 19:32:40 +0600 Message-Id: <20230814133253.4150-2-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230814133253.4150-1-maxim.uvarov@linaro.org> References: <20230814133253.4150-1-maxim.uvarov@linaro.org> MIME-Version: 1.0 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 Add initial documentation of lwIP network IP stack integration to the U-Boot (net_lwip.rst). Signed-off-by: Maxim Uvarov Reviewed-by: Simon Glass --- doc/develop/index.rst | 1 + doc/develop/net_lwip.rst | 64 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 doc/develop/net_lwip.rst diff --git a/doc/develop/index.rst b/doc/develop/index.rst index 5b230d0321..4764990f25 100644 --- a/doc/develop/index.rst +++ b/doc/develop/index.rst @@ -48,6 +48,7 @@ Implementation spl falcon uefi/index + net_lwip vbe version diff --git a/doc/develop/net_lwip.rst b/doc/develop/net_lwip.rst new file mode 100644 index 0000000000..bdd2c921b3 --- /dev/null +++ b/doc/develop/net_lwip.rst @@ -0,0 +1,64 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +LWIP IP stack intergation for U-Boot +==================================== + +Intro +----- + +LWIP is a library implementing network protocols, which is commonly used +on embedded devices. + +https://savannah.nongnu.org/projects/lwip/ + +LwIP  license: +LwIP is licensed under a BSD-style license: http://lwip.wikia.com/wiki/License. + +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 + +U-Boot implementation details +----------------------------- + +1. In general we can build lwIP as a library and link it against U-Boot or + compile it in the U-Boot tree in the same way as other U-Boot files. There + are few reasons why I selected the second variant: LwIP is very customizable + with defines for features, memory size, types of allocation, some internal + types and platform specific code. It turned out easier to enable/disable + debug which is also done with defines, and is needed periodically. + +2. lwIP has 2 APIs - raw mode and sequential (as lwIP names it, or socket API + as we name it in Linux). +For now only raw API is supported. + +In raw IP mode a callback function for RX path is registered and will be called +when packet is passed to the IP stack and is ready for the application. + +Example is unmodified working ping example from lwip sources which registered +the callback: + +.. code-block:: c + + ping_pcb = raw_new(IP_PROTO_ICMP); + raw_recv(ping_pcb, ping_recv, NULL); <- ping_recv is app callback. + raw_bind(ping_pcb, IP_ADDR_ANY) + +3.  Input and output + +RX packet path is injected to U-Boot eth_rx() polling loop and TX patch is in +eth_send() accordingly. So we do not touch any drivers code and just eat +packets when they are ready.