From patchwork Wed Aug 2 14:06:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 709165 Delivered-To: patch@linaro.org Received: by 2002:a5d:55c5:0:b0:317:2194:b2bc with SMTP id i5csp930444wrw; Wed, 2 Aug 2023 07:09:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlFCC8bkVXH4tDjw3axi1pR1pAz13HfXhbs1I0/9Wnh3Xeqk4nk3726y9FLEz94AvCTc9i7N X-Received: by 2002:a7b:c451:0:b0:3fe:18a3:b3c with SMTP id l17-20020a7bc451000000b003fe18a30b3cmr5089362wmi.12.1690985372575; Wed, 02 Aug 2023 07:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690985372; cv=none; d=google.com; s=arc-20160816; b=zObjwAguI1NG78o4lLrf8eUsu+pUYgGH1XJcWRF31XaedvTg9BPUsKtnzdLphNRdKp QRI1IAQXct3ovmtZct+Ry3lQhG02XRwZ0Y/jTMQUqZ1eL2RHpbq5PFQEuyT/2WhGny/U jccZpWmGFaAyJtEvxiWhZNzIIa7mWssU1fzZDGCGNIokrhfVcGwux1qIerwjkRFAUSGv Gy7NFoVBNRbTCc+ASfmxv6+mZrwfPX+26EeYn/S3qqEm2JOb2Hmb97C3S4v7YpQ8dMBw APq68lCkYJ1cpFcNh/0ebDi3yINneJUfXBNcoNCUkCjDwAelz38N/Tl4OXg920akHUZm vpTA== 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=mljaM4Sh5i59HZhlLD/mtdWWwR2wweqpm2Qji/1XzXo=; fh=KONqw1VFBW9nCv9imase+52c+XJ0MeVkzLj6SOLcJqQ=; b=u77a9VZ3hCMztOcgwuwrx/IaQTkeTa1vGnDdbytYb9bci88XqH8NqKKXSmnKE/rQyA B0lcaAqAgShNPxFRsubvgZB+BHxk93EX2GvUyLExOuSeTweAPjaYqLQnkuJYuOl8+xd9 tmpONJY0H2VOHVKHajxVvHy7ledtq7YfXaA/MbDvF/8MsMB/eORzPN99J5/W+6XaLCdP 49/OSiE2FejDkImib7xAYFhkzWa2vlfshX1E5gqGqQk+0yo5zXelckqTRJv62sBD11zb WAvhsTy60woSqY7ru8MJ4DPFkSYn267iLhuVbcCRv/Y7bet7GFc0DbFVtC6+LLitPSHf oP6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fY63hvdO; 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 h20-20020a05600c351400b003fd0e3c75a3si979176wmq.100.2023.08.02.07.09.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 07:09:32 -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=fY63hvdO; 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 1B87086899; Wed, 2 Aug 2023 16:09:24 +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="fY63hvdO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7553186898; Wed, 2 Aug 2023 16:09:22 +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-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) (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 CFF2C8686A for ; Wed, 2 Aug 2023 16:09:19 +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-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4fe1489ced6so11431929e87.0 for ; Wed, 02 Aug 2023 07:09:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690985359; x=1691590159; 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=mljaM4Sh5i59HZhlLD/mtdWWwR2wweqpm2Qji/1XzXo=; b=fY63hvdO+7z55A3Qu1iCRZRZXn0iatrT1L+dV+vwOekr0im8I7mhcdPgQ/2elEjhML bhFkNNN5Neso7ektfVI7OoIpfwBmRR8Fc/dNfDar2LpFConD8LtWHTqkv6gEcZB26UDt aLKBV0xo5ZkhpWnr+mIGdLiVWw4WO+z0wXuXM1uWd4pnOYfRcSbpefkUtNwEBFOf0f0P SYAnVp5w1heOXqxCFbxXKhcQTsdZhdBnj31JeSD4HDjUomL4NZ9vwYVxddZgrWeeGVIQ jCV4wan6k3SxKaTvD0czmh2KBZno4WJkSAKglUdL+PTvmJjOQ9U4CHT5aByfNCoJ26NN H/Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690985359; x=1691590159; 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=mljaM4Sh5i59HZhlLD/mtdWWwR2wweqpm2Qji/1XzXo=; b=HBJjSkudxnScQroQDINwVnQpH6X+uBZ1n/i3UASz63wZlfxKKlh04s8+ryUsH+AzP/ hnxFkHjWW7R/RyPgNFS6+TCZftcAPOiKs/8b0RCWOIBBCJc37/aNZ+W2yHFoQEaxohrJ BOEqSkBOm/njWQTmn8/yL4jsgDtaAYKcrF/gUuvOpRSYQ/mEPLdrZTF0S8dDPlF0PuY/ fV8MutlKqsmlTR5BbTYmFVaYHHy/R5zKo4biZ7DPollKaSx1LwkA697+/XxBF1J/Ctfc QDkw24x6qstkO+g4zFtl4zX1W/Bo7PDPnrSCqUQslbu98O0U0VySdtRT68gsBmxaNo8f J6Sw== X-Gm-Message-State: ABy/qLZq3kLCGANw2dDHn68G9KUuZRo0YU+8E69SuAE9yv8NLxSSwTnF KLB5i8y/vvuoRRzss8wURlNLcZ2XQCSvEPt4MUtI9w== X-Received: by 2002:a05:6512:20cd:b0:4f8:70d8:28f8 with SMTP id u13-20020a05651220cd00b004f870d828f8mr4228129lfr.55.1690985358836; Wed, 02 Aug 2023 07:09:18 -0700 (PDT) Received: from localhost.localdomain ([45.82.14.220]) by smtp.gmail.com with ESMTPSA id a12-20020a056512020c00b004fbbef8d4dbsm2982026lfo.121.2023.08.02.07.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 07:09:18 -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 Subject: [PATCHv5 01/13] net/lwip: add doc/develop/net_lwip.rst Date: Wed, 2 Aug 2023 20:06:46 +0600 Message-Id: <20230802140658.10319-2-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230802140658.10319-1-maxim.uvarov@linaro.org> References: <20230802140658.10319-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 Just add inital doc. Signed-off-by: Maxim Uvarov Reviewed-by: Simon Glass --- doc/develop/index.rst | 1 + doc/develop/net_lwip.rst | 55 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 doc/develop/net_lwip.rst diff --git a/doc/develop/index.rst b/doc/develop/index.rst index ddbf8dad4a..f8ab6cb56e 100644 --- a/doc/develop/index.rst +++ b/doc/develop/index.rst @@ -46,6 +46,7 @@ Implementation smbios spl 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..784b8f960c --- /dev/null +++ b/doc/develop/net_lwip.rst @@ -0,0 +1,55 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +LWIP IP stack intergation for U-Boot +==================================== + +Intro +----- + +LWIP is a library implementating 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 registeres 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.