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 491A7C04A6A for ; Mon, 14 Aug 2023 14:10:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 74C288678A; Mon, 14 Aug 2023 16:10:57 +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="V3/axOXU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 00192867F7; Mon, 14 Aug 2023 16:10:55 +0200 (CEST) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 A1BA686679 for ; Mon, 14 Aug 2023 16:10:53 +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-x335.google.com with SMTP id 5b1f17b1804b1-3fea0640d7aso5008755e9.0 for ; Mon, 14 Aug 2023 07:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692022253; x=1692627053; 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=6qezRK6bmoIqiHnueDMMT57FaDN2BaWaS6KKTD5ZSWc=; b=V3/axOXUG+dKyJIGU+pXalZhULvuEnvzG6Jvy2h0liaGi0Uy7ZKPZpy3GWDViQUoku lKfJ6AJnyMmATv4C2moE4iWpxfQduQfy9eX9UfJHScQlOYCPqNkxihHmJcv5fUc1D6N2 WITZzpNULLceJlz3w9DqO1OaUqAjXRsX3egL1+tSrulgK1sh2ORj5gyDOFAz9qDfaKjR 4MwmwTU8tYHNoSFxFkU+xM6krPPN7Bz41RMoVqFurg+iz0Mc3zYsSwItlK6HUrlJwWGF tHPaxk/0nJ5uILnnhvhqF2zfkCPRuKEVDpRN0PKQOwuyNdXC5c4bswRJeqXhGQ3Yeavm ZTHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692022253; x=1692627053; 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=6qezRK6bmoIqiHnueDMMT57FaDN2BaWaS6KKTD5ZSWc=; b=EGsLSFl/UqGTTvl2Z/aVhR6h129YoIaBDRHC1jnayQct7JTtQd7LEnDPB2/EHhkn3l C9j0/zWKVPtECaFujwmM+t24SeB4yp80K/4UOeMm1WpSNIlxBxlapEU2ueNfuclKRFOu xNADQOKGAHA1I1rvB2+BYY8926OLL1DUGTvIP5yOLjtf9nL483BTflfYUwLjbo8EqFur Q4fhURNOzVSvHMEXyR85E0XGmRBtx/FDsoeCn9nRm06IHgiZ9JhwCDtLbo6x6oVVKCyp X8H2Qk72KfJ2Qtz6xGws5o62eF5F73wP16NnhHdn2Dwf9EwDW5eQfi/uuNv5eObxh8Je NKVw== X-Gm-Message-State: AOJu0YwAyRpq/FLvRg2C7t2RaZl4i+20PnsjH/aOzmB/mmRVH9ICVOeU kYlJU7rmg9JMaKEI8E7GO+nEY1rDF9mmiMLV0fs= X-Google-Smtp-Source: AGHT+IF5GqziQX072jhlBdqbRzU350qMez/w9IOwwDxmVvVI8zb4S8+A1mvJC0PpFjvVYCCQ92rPjA== X-Received: by 2002:a7b:c445:0:b0:3fe:3004:1ffd with SMTP id l5-20020a7bc445000000b003fe30041ffdmr7734152wmi.4.1692022252942; Mon, 14 Aug 2023 07:10:52 -0700 (PDT) Received: from hades (ppp089210246083.access.hol.gr. [89.210.246.83]) by smtp.gmail.com with ESMTPSA id t21-20020a1c7715000000b003fe0bb31a6asm14325100wmi.43.2023.08.14.07.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 07:10:52 -0700 (PDT) Date: Mon, 14 Aug 2023 17:10:50 +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, Simon Glass Subject: Re: [PATCHv6 01/14] net/lwip: add doc/develop/net_lwip.rst Message-ID: References: <20230814133253.4150-1-maxim.uvarov@linaro.org> <20230814133253.4150-2-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: <20230814133253.4150-2-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 On Mon, Aug 14, 2023 at 07:32:40PM +0600, Maxim Uvarov wrote: > 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 You can skip the 'I' here, it's not a personal project. Something along the lines of 'the second variant was chosen ...' would work > + 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 One example is the unmodified etc > +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. 'That way we can leave the driver code unmodified and consume packets once they are ready' Thanks /Ilias > -- > 2.30.2 >