From patchwork Tue Aug 22 09:36:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 715719 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp163806wrp; Tue, 22 Aug 2023 02:38:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGsFudPrq/wDWgxJmDNetIe3QYWsgz0iUVV3ahRfKsOBGCBgp0zsxC45lhfJC9wGw1mebO X-Received: by 2002:a5d:4a86:0:b0:319:642f:93ad with SMTP id o6-20020a5d4a86000000b00319642f93admr6134648wrq.13.1692697117826; Tue, 22 Aug 2023 02:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692697117; cv=none; d=google.com; s=arc-20160816; b=ZXJ05pzWmQWYuKqyN4A/6LTlSUtwIwjweCLzLhiwWVA0QTbL5Tv1MvAMTf9NlOEuw/ 9j6B7NEuYXnIOdMq995cVNUEmMiqO1+Us1plNywxTWn0m0vAa0lGjQ5y0ClMecp+kJ8H ewg7UneE3vDYLhBQ5/DvpP8CnvAMWe3o94DBDv0XmUPx/4cNAT5TEhqBJJLZ1eMamtQj 5EZ464NdofuQPO7vxlDW6TRKwM6dcKdCTgCwlRS+ngEgNd3V6iv2YyJpvR2Y/daqASvY CDnrpnHavGgon60J99t092lpjQDQ3RUJiowthJmaW/couLFoa6iMmZDXK3QonNma8enY RtaA== 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=8zF1z8x596ZFPGv6nhkRshR4N1Qx5hz0TD2Q54CzOIo=; fh=QPUiOtCllqqB67XUzmcyZieFBIC2XfAJhKfB5xMOZcM=; b=Lfjxh9Q+vcShXGHvCsxcO9Koz+q60n6UVPyHwguw4j0+84XjsZtiSLYEMvZ7icnD8b ZJ3emMMnDChnYEcdIbj9rMwnF9zxgKunC9y8TCbz1uPbCy50ZZZmhDPy6xX7Ki8JoLi6 3u8tL0C/v+0jkx5sU5igAVZLiIBQEqZ0WB19L8/3nazJsB8sPLM8QXxeezwfoGIFCf/5 Y4ZbvZ+O5ZFyjHdTBq2Z6e2TXuL5PCz49pN/zDW/X6IJcGsol2LFlAEvse7G1hK4U80R fxll9I/43z0uOJCWzA/CqL4c8F/1akMPLRu3xyvjTTHVfpyUHqSCCtb+CMHPRH4A9LV5 0GKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hoxg/+eX"; 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 t20-20020a0560001a5400b0031c2cf51df6si2387452wry.901.2023.08.22.02.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 02:38: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="hoxg/+eX"; 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 645108649C; Tue, 22 Aug 2023 11:38:29 +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="hoxg/+eX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2BB2F8649B; Tue, 22 Aug 2023 11:38:28 +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-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) (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 1191686485 for ; Tue, 22 Aug 2023 11:38:25 +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-x234.google.com with SMTP id 38308e7fff4ca-2b95d5ee18dso66644481fa.1 for ; Tue, 22 Aug 2023 02:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692697104; x=1693301904; 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=8zF1z8x596ZFPGv6nhkRshR4N1Qx5hz0TD2Q54CzOIo=; b=hoxg/+eXEc+rTeZkDXZDCBECs4043EXJ10qxSGe7/iytjYZ0W2VAuSWEUxZ3r8t98R g1sAR9aWW2TlFeIC8iCcEJ5oXmh6l7Ck2x1X3GCqGdgIPCShGStkPCBclxhl2tAIDMmC anAHd2lnRMH0JAqE6w+rjJmr+aWod+usPzMmJgTQB89Fv2s3YP8SyT/qlmKhlrdU2FVL T25/fD4S/zkYIDUuV5516k0UvgpjN4podCgE57yVyAdBO1DgxnONoJQv3/d6ztk7SOHv NHsQcskfRd8gyc9B8ToQRhIOgjtRLWaoIZByG11yiWDaxAt/vz4PYC+gxMjM93+nau/L Z9ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692697104; x=1693301904; 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=8zF1z8x596ZFPGv6nhkRshR4N1Qx5hz0TD2Q54CzOIo=; b=NmdvSyXGNatCh7koqzAUUNZzCJmRMReTqne4e5+PRFg2uFAb2HcAcDjuz3Kabb7A2v Hie09XRRe0WGGf2/rK2MKDxNVrRZDL0rO8RE2to3luAf1/Z2RXrM8IJd/V18yA5Jk+y+ 00tWufJ4F4Nfaj/Qr3vClTDtZs/epf8JNMwFcGoDyI4lnil3iMaV33db+Hgd0IuH4a1n /FrY1c+CEaR33p5gvBud6bJGdW+JK78+EbcTN2REayNMdyipyXCtOIWvFYd3lf0P/kyc ZC6Smh4hDuo0tAZnjpkE74kx6K/oxO9UXUn7/G9mmLBM5Z8IyVtBuQKWitD5qOl2AKOt bdFg== X-Gm-Message-State: AOJu0YzVziVz6pJuqBvyukeB9Kn41me4tEDN0qkd509mfqfg1uSePGOJ v8xv4bI33scZpKG+0KcZZK6QTSAWyyJoTyz3yPmYlA== X-Received: by 2002:a2e:740d:0:b0:2b9:df49:b818 with SMTP id p13-20020a2e740d000000b002b9df49b818mr6237873ljc.53.1692697104036; Tue, 22 Aug 2023 02:38:24 -0700 (PDT) Received: from localhost.localdomain ([45.82.14.220]) by smtp.gmail.com with ESMTPSA id i9-20020a2e8089000000b002b724063010sm2649637ljg.47.2023.08.22.02.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 02:38:23 -0700 (PDT) From: Maxim Uvarov To: u-boot@lists.denx.de Cc: pbrobinson@gmail.com, ilias.apalodimas@linaro.org, joe.hershberger@ni.com, rfried.dev@gmail.com, trini@konsulko.com, goldsimon@gmx.de, Maxim Uvarov , Simon Glass Subject: [PATCHv7 01/15] net/lwip: add doc/develop/net_lwip.rst Date: Tue, 22 Aug 2023 15:36:00 +0600 Message-Id: <20230822093614.4717-2-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230822093614.4717-1-maxim.uvarov@linaro.org> References: <20230822093614.4717-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 | 76 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 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..cd85de92a1 --- /dev/null +++ b/doc/develop/net_lwip.rst @@ -0,0 +1,76 @@ +.. 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 second variant was selected: 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. + +One example is the 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. That way we can leave the driver code unmodified and +consume packets once they are ready. So we do not touch any drivers code and +just eat packets when they are ready. + +U-Boot lwIP Applications +======================== + +.. kernel-doc:: include/net/lwip.h + :internal: + +lwIP API to control polling loop +================================ + +.. kernel-doc:: include/net/ulwip.h + :internal: