From patchwork Thu Jun 6 13:35:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 802015 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp399218wro; Thu, 6 Jun 2024 09:36:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVg762HrWFJnGHCWRlaiiKqaKfyTkaCDcF41uC69ehexkw/JTnSIAK8EgOSpJAMn+O2jKHZRyK26IRMhyzCJ4/T X-Google-Smtp-Source: AGHT+IHWxtyGG4j2MgMwRIqj9EtEJQy7tIZcC4UfbwxCJb9MvkL+iu3BJpu7/Cr9pQvFg3NgTczR X-Received: by 2002:a50:8ada:0:b0:57a:32df:98ee with SMTP id 4fb4d7f45d1cf-57a8b6f0f75mr4027659a12.22.1717691810568; Thu, 06 Jun 2024 09:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717691810; cv=none; d=google.com; s=arc-20160816; b=XN/6poQwb6dZJdp8Zqd6GYSF6fYun04zbeY1X1qbjKramMcNeO8LYk8yI3qBYOhKLQ mYPjizolXIatVJ8+IZL8eKAckmMd9TVxhXAuMohAQBbK8eGHK0cakown/PtS88hFgUqC DMa/eE08dtHGAiSneO038+vlpV2nTAQlNauSbsZN0yR/HYnHF4yNxDdFQ042jKN+xZWh t1/KHzeSdcmojFG5lP0gLGvLNuthHiDMXUMlVSsA2S8jREPjY9mON3xz8e4ZFvgboJkh txpiZHAvElSwRPL2s4aofkUsIMzHXYXeGnvDfb3A0AevVHC+1afHaRQZ41cVbgvrqqU2 tH/Q== 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=2aIAacY4b9gwYMIGJldrbYZiYVcQ/I1Rb7nia3l7JOE=; fh=czYpH2hw9sf6CWzyn3nb5ufwCMY86z0dXJT9WcvsEso=; b=h8iaOZPEaH8tTrdJQgbUmbT7rZTJSnSfXOAa5GXW72zGzIqqJHYG7aOr8xZUZJo1PC O8XfE6h/XmITVJAG6HgB3XUK5Qd5ExtiGOYwVJB+d+UtviiSkrYd5nCX3Fsi6DMbaZwh xYZBbvb785cYRygaSi5r8X4nlRSD1U/2nF1QeZKDrNYj/cG0GvU8j1rRsa9ScAJHoEX7 ijS3+Z1MDGCSez3p+dBYJ3KSuNnOYZgAwWlE/d4tHkPWZm+yh3zTLYPx4FaW5fJqqqjk Kr1W+IU0uxTpk41pMNB3DiV8ifPomAw4C9H7FuNKGvGLcuijye80Er6m6WDIOX3Rkq4h YTmQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ptrsTEmJ; 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 4fb4d7f45d1cf-57aae0c70ccsi838964a12.43.2024.06.06.09.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 09:36:50 -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=ptrsTEmJ; 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 006248850D; Thu, 6 Jun 2024 18:34:04 +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="ptrsTEmJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1BF9688395; Thu, 6 Jun 2024 15:36:59 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (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 39CB3883AA for ; Thu, 6 Jun 2024 15:36:56 +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=jerome.forissier@linaro.org Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4215b0c4b7dso10583885e9.0 for ; Thu, 06 Jun 2024 06:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681015; x=1718285815; darn=lists.denx.de; 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=2aIAacY4b9gwYMIGJldrbYZiYVcQ/I1Rb7nia3l7JOE=; b=ptrsTEmJh7E2/aeer6tO87afDqOQaSRAZ3nKNQn84ACnNM17F5YdxFqKUPkbQMKP7F WLpXmogPsxIpZTYLPzn7e+q/g7VciaxmOf0i6XsJdaO85I3G7xn/7j1YTRqNEruwx9Oj YP2HGGfeuIT4KUz/Kp1B7NB2z58P3cPqqWVSE2Q0zskQ//Nstb4hxoVBrus+bRShC8l/ hGXzyAVSyiClyvlumJHRVVFSxMuVDSH5LKrM/N8/5i7eUBxx8FxQljoVU8J3u77JGapi ob+qXnQFGaXQwMp1RJEgEY1+tXq5x3IkLDKUKy0KCZCuqVdYqLZX8kmSV9MZLJzKIkDp XWsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681015; x=1718285815; 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=2aIAacY4b9gwYMIGJldrbYZiYVcQ/I1Rb7nia3l7JOE=; b=FTLNeBCIeCOI59d5uP+g8YxiPS4AnhnNf5ZUD35O+XaZ2Rw2uGiDqt+bVN0dAhmXPP TedU1/KMBX2dDueQFqq8WUtx4DE36VKJhRpCksNAR0VrBjBKzw8vMtMcVCXsv0Hl2XsV tadJrQARbxA6pRFw9UjeMrQvKnW3ncEvru4Z4TNEtJIIWrnvCTC/kC8on45gcrc/n/eJ l2lV+aLQ0d4/oJ/jxXTbUQnAZHjnGi43VnBTZzj1SMzSRN9CMVDwcPS8Im46B3g8n9MY tt0+cQCHAiDO+Z7msX6AtMF7Xdzd0jbANmLojo4ZPby0VerIt8LctnqmSiXkVXHEUOS4 bqfA== X-Gm-Message-State: AOJu0YxRit3B+dm9mabU8hzJjEvgIE1QWkdy7vCCGZJkqCcrlR33Mbf0 2bOWuNo4nG1aHBzkpML+DKgzIQXX3KXdUDaTLnMiSSZiv/+Ld14X55/myNXejnjanrqBTAWj8GP OF/Lkwkvj X-Received: by 2002:a05:600c:41c3:b0:41f:ec3e:9797 with SMTP id 5b1f17b1804b1-421562cf729mr42849475e9.16.1717681015379; Thu, 06 Jun 2024 06:36:55 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:36:55 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Lukasz Majewski , Mattijs Korpershoek , Joe Hershberger , Ramon Fried , Marek Vasut , Simon Glass , Nathan Barrett-Morrison , Shengyu Qu , Jesse Taube , Greg Malysa , Heinrich Schuchardt , Sumit Garg , Andrew Davis , Bryan Brattlof , "Leon M. Busch-George" , Samuel Dionne-Riel , Ying Sun , Jagan Teki , Bin Meng , Rasmus Villemoes , Joshua Watt , Sean Anderson , Andre Przywara , Mayuresh Chitale , Samuel Holland , Oleksandr Suvorov , Patrice Chotard , Ashok Reddy Soma , Patrick Delaunay , Jaehoon Chung , Svyatoslav Ryhel , Quentin Schulz , Alexey Romanov , Ion Agorria , Nicolas Frattaroli , Yanhong Wang , Miquel Raynal , Jonas Karlman , Baruch Siach Subject: [PATCH v3 01/12] net: introduce alternative implementation as net-lwip/ Date: Thu, 6 Jun 2024 15:35:56 +0200 Message-Id: <46becb46b92b6ea945112785b17a59c9ce7498d3.1717680809.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 06 Jun 2024 18:34:03 +0200 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 Prepare the introduction of the lwIP (lightweight IP) TCP/IP stack by adding a new net-lwip/ directory and the NET_LWIP symbol. Network support is either NO_NET, NET (legacy stack) or NET_LWIP. Subsequent commits will introduce the lwIP code, re-work the NETDEVICE integration and port some of the NET commands and features to lwIP. SPL_NET cannot be enabled when NET_LWIP=y. SPL_NET pulls some symbols that are part of NET (such as arp_init(), arp_timeout_check(), arp_receive(), net_arp_wait_packet_ip()). lwIP support in SPL may be added later. Similarly, DFU_TFTP is not compatible with NET_LWIP because it depends on net_loop(), tftp_timeout_ms, tftp_timeout_count_max. Let's add a dependency of DFU_OVER_TFTP on !NET_LWIP for now. Signed-off-by: Jerome Forissier --- Kconfig | 40 ++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- common/Kconfig | 2 +- common/spl/Kconfig | 1 + drivers/dfu/Kconfig | 2 +- drivers/fastboot/Kconfig | 4 ++-- drivers/net/phy/Kconfig | 2 +- drivers/usb/gadget/Kconfig | 2 +- net-lwip/Kconfig | 37 +++++++++++++++++++++++++++++++++++ net/Kconfig | 14 ------------- 10 files changed, 85 insertions(+), 21 deletions(-) create mode 100644 net-lwip/Kconfig diff --git a/Kconfig b/Kconfig index 82df59f176e..b7304bd37c5 100644 --- a/Kconfig +++ b/Kconfig @@ -745,7 +745,47 @@ source "dts/Kconfig" source "env/Kconfig" +choice + prompt "Networking stack" + default NET + +config NO_NET + bool "No networking support" + +config NET + bool "Legacy U-Boot networking stack" + imply NETDEVICES + +config NET_LWIP + bool "Use lwIP for networking stack" + imply NETDEVICES + help + Include networking support based on the lwIP (lightweight IP) + TCP/IP stack (https://nongnu.org/lwip). This is a replacement for + the default U-Boot network stack and applications located in net/ + and enabled via CONFIG_NET as well as other pieces of code that + depend on CONFIG_NET (such as cmd/net.c enabled via CONFIG_CMD_NET). + Therefore the two symbols CONFIG_NET and CONFIG_NET_LWIP are mutually + exclusive. + +endchoice + +if NET source "net/Kconfig" +endif + +if NET_LWIP +source "net-lwip/Kconfig" +endif + +config SYS_RX_ETH_BUFFER + int "Number of receive packet buffers" + default 4 + help + Defines the number of Ethernet receive buffers. On some Ethernet + controllers it is recommended to set this value to 8 or even higher, + since all buffers can be full shortly after enabling the interface on + high Ethernet traffic. source "drivers/Kconfig" diff --git a/Makefile b/Makefile index f8206b2e30a..ceb99a2698e 100644 --- a/Makefile +++ b/Makefile @@ -859,7 +859,7 @@ libs-$(CONFIG_OF_EMBED) += dts/ libs-y += env/ libs-y += lib/ libs-y += fs/ -libs-y += net/ +libs-$(CONFIG_NET) += net/ libs-y += disk/ libs-y += drivers/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ diff --git a/common/Kconfig b/common/Kconfig index 5e3070e9253..807b726384d 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -424,7 +424,7 @@ config LOGF_FUNC_PAD config LOG_SYSLOG bool "Log output to syslog server" - depends on NET + depends on NET || NET_LWIP help Enables a log driver which broadcasts log records via UDP port 514 to syslog servers. diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 6405374bcc1..f67f0a859db 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -1055,6 +1055,7 @@ config SPL_DM_SPI_FLASH config SPL_NET bool "Support networking" + depends on !NET_LWIP help Enable support for network devices (such as Ethernet) in SPL. This permits SPL to load U-Boot over a network link rather than diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig index 0360d9da142..c6bce82eb10 100644 --- a/drivers/dfu/Kconfig +++ b/drivers/dfu/Kconfig @@ -11,7 +11,7 @@ config DFU_OVER_USB config DFU_OVER_TFTP bool - depends on NET + depends on NET && !NET_LWIP if DFU config DFU_WRITE_ALT diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index 70207573de2..05e988166fb 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -27,7 +27,7 @@ config USB_FUNCTION_FASTBOOT This enables the USB part of the fastboot gadget. config UDP_FUNCTION_FASTBOOT - depends on NET + depends on NET || NET_LWIP select FASTBOOT bool "Enable fastboot protocol over UDP" help @@ -41,7 +41,7 @@ config UDP_FUNCTION_FASTBOOT_PORT The fastboot protocol requires a UDP port number. config TCP_FUNCTION_FASTBOOT - depends on NET + depends on NET || NET_LWIP select FASTBOOT bool "Enable fastboot protocol over TCP" help diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 3d96938eaba..738752d29c2 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -11,7 +11,7 @@ config MV88E6352_SWITCH menuconfig PHYLIB bool "Ethernet PHY (physical media interface) support" - depends on NET + depends on NET || NET_LWIP help Enable Ethernet PHY (physical media interface) support. diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 4621a6fd5e6..03fe3bca197 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -224,7 +224,7 @@ endif # USB_GADGET_DOWNLOAD config USB_ETHER bool "USB Ethernet Gadget" - depends on NET + depends on NET || NET_LWIP default y if ARCH_SUNXI && USB_MUSB_GADGET help Creates an Ethernet network device through a USB peripheral diff --git a/net-lwip/Kconfig b/net-lwip/Kconfig new file mode 100644 index 00000000000..a0938964b51 --- /dev/null +++ b/net-lwip/Kconfig @@ -0,0 +1,37 @@ +# +# Network configuration (with lwIP stack) +# + +config LWIP_DEBUG + bool "Enable debug traces in the lwIP library" + +config LWIP_ASSERT + bool "Enable assertions in the lwIP library" + +config PROT_DHCP_LWIP + bool "DHCP support in lwIP" + depends on PROT_UDP_LWIP + help + Enable support for the DHCP protocol in lwIP. + +config PROT_DNS_LWIP + bool + depends on PROT_UDP_LWIP + +config PROT_RAW_LWIP + bool + +config PROT_TCP_LWIP + bool + +config PROT_UDP_LWIP + bool + +config BOOTDEV_ETH + bool "Enable bootdev for ethernet" + depends on BOOTSTD + default y + help + Provide a bootdev for ethernet so that is it possible to boot + an operating system over the network, using the PXE (Preboot + Execution Environment) protocol. diff --git a/net/Kconfig b/net/Kconfig index 5dff6336293..4929428d2a5 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -2,11 +2,6 @@ # Network configuration # -menuconfig NET - bool "Networking support" - default y - imply NETDEVICES - if NET config ARP_TIMEOUT @@ -254,12 +249,3 @@ config IPV6 address and find it, it will force using IPv6 in the network stack. endif # if NET - -config SYS_RX_ETH_BUFFER - int "Number of receive packet buffers" - default 4 - help - Defines the number of Ethernet receive buffers. On some Ethernet - controllers it is recommended to set this value to 8 or even higher, - since all buffers can be full shortly after enabling the interface on - high Ethernet traffic.