From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 25BBBC001DC for ; Thu, 27 Jul 2023 12:34:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 289EC86768; Thu, 27 Jul 2023 14:34:02 +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="wEV0jRRn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D8A0A86604; Thu, 27 Jul 2023 14:33:59 +0200 (CEST) Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (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 73C7186604 for ; Thu, 27 Jul 2023 14:33:55 +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=ilias.apalodimas@linaro.org Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fbc6ab5ff5so9476675e9.1 for ; Thu, 27 Jul 2023 05:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690461235; x=1691066035; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=KeGnWPnPzgY2YWcx5qE65CfnqFHelmPwwy+zQJodb8k=; b=wEV0jRRn+XTd/5iHCtEw4am5vGFYa01KJWAdVsuJegreCCLVaiEf2QTP4seGc3dy/7 YUmuF1L/BsCnNlTO915qfOFeoQEoRx4+vYtb4ZF8htrozBDhv0KcPW7ehIMllcy51PbZ v573QsG+Pc+SJfSdUd5sq26MvjvtfQqYW0443c7NfzqUfkGGXC0Uca9cPR1UO34wheIe 2OYQCQtbNG3yVHcEYbcMjSQIRvJBRDn7w1jm7fCsoGj/pv6zdM7YaG7po5ZEXb21kEz4 tK0uSkNOSSBVfmZp3f2xgz0beJc3p+UI3a5cYJu2O9NtmHoO/cOb+AQlvLatdZSBZ/Sp u91Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690461235; x=1691066035; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KeGnWPnPzgY2YWcx5qE65CfnqFHelmPwwy+zQJodb8k=; b=EZS5hPMqiQFcbiSrmd6jq/87Tr3gwczNRZc8sXkrPtqMpfjIQxmyqbSUxT51MbrTe4 tK0zOfgqPJqXBu1xypMirFa/e9xAbqtFQ9ntZnvwmrNy10o9SHof/ywhMLmlImrNy1AF 6n7NN3fPZ66dAv/uSNZwrIyhFfYH7AXVmBdZHYftKC9tRG+bXRZAx9SOyMbiByrj363+ rGJZ94A4IRxznwAgufwrNCe9mih3GHH3Tq7QEFUKzysZ1I1K5qQTVFl9j+1uqLrL875w TRdF2IX5psv6RJxRMGqbU7aISyeM47AgMkcEYd/XC07bX4V0AYYxpCf2KlJI6SkqzPi2 RvMg== X-Gm-Message-State: ABy/qLbUT1iPNiHoWxA3Focr4XQmHsrYgem+v0yZOt0dJj45aGbB+lMC sGkbMkAA3XhfPJE3EHeruMiw4A== X-Google-Smtp-Source: APBJJlGjdE6K9UwmOVyiu+pH2OgkdoEIoypr3BQ7NzKYkkfFuTPF1smnHUAHgInDH9Fn1AKL3NxSLg== X-Received: by 2002:a1c:4c14:0:b0:3fa:96ae:fd78 with SMTP id z20-20020a1c4c14000000b003fa96aefd78mr1602279wmf.29.1690461234831; Thu, 27 Jul 2023 05:33:54 -0700 (PDT) Received: from hades (ppp089210088142.access.hol.gr. [89.210.88.142]) by smtp.gmail.com with ESMTPSA id n1-20020a5d4c41000000b0031764e85b91sm1943137wrt.68.2023.07.27.05.33.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 05:33:54 -0700 (PDT) Date: Thu, 27 Jul 2023 15:33:51 +0300 From: Ilias Apalodimas To: Maxim Uvarov Cc: u-boot@lists.denx.de, pbrobinson@redhat.com, joe.hershberger@ni.com, rfried.dev@gmail.com, trini@konsulko.com, goldsimon@gmx.de, lwip-devel@nongnu.org Subject: Re: [PATCHv4 3/5] net/lwip: add doc/develop/net_lwip.rst Message-ID: References: <20230714142000.5534-1-maxim.uvarov@linaro.org> <20230714142000.5534-4-maxim.uvarov@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230714142000.5534-4-maxim.uvarov@linaro.org> 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 Hi Maxim, On Fri, Jul 14, 2023 at 08:19:58PM +0600, Maxim Uvarov wrote: > Just add inital doc. > > Signed-off-by: Maxim Uvarov > --- > doc/develop/index.rst | 1 + > doc/develop/net_lwip.rst | 59 ++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 60 insertions(+) > create mode 100644 doc/develop/net_lwip.rst > > diff --git a/doc/develop/index.rst b/doc/develop/index.rst > index 97c526e997..a092c33df0 100644 > --- a/doc/develop/index.rst > +++ b/doc/develop/index.rst > @@ -43,6 +43,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..567234fff2 > --- /dev/null > +++ b/doc/develop/net_lwip.rst > @@ -0,0 +1,59 @@ > +.. SPDX-License-Identifier: GPL-2.0+ > + > +LWIP IP stack intergation for U-Boot > +==================================== > + > +Intro > +----- > + > +LWIP is a library for implementation network protocols, which is commonly used s/for implementation/implementing/ > +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. And it was more easy to enable/disable s/And it was more easy/it turned out easier to/ > +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. > + > +Raw IP means that the call back function for RX path is registered and will be called when packet s/Raw IP IP means/In raw IP mode a callback function etc > +data passes the IP stack and is ready for the application. is passed to the ip stack? > + > +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) > + > +Socket API also gives nice advantages due it will be easy to port linux socket applications to u-boot. > +I.e. LwIP sockets compatible with the linux ones. But that will require RX thread running in the background. > +So that means we need some kind of scheduler, locking and threading support or find some other solution. I think you can drop this entirely and we can add it if we ever want to support sockets > + > +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. > -- > 2.30.2 > Thanks /Ilias