From patchwork Fri May 24 16:19:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798703 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp817156wrw; Fri, 24 May 2024 10:01:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVCY0TFj1qNwxA9wQw69jPBMh7Pc9jhuRDEqQiaNZMxsmhfKoJFbSjNTvKjqkIRpKYjHMuWz5C6CaF18bsRVvYH X-Google-Smtp-Source: AGHT+IEqL6pmU5mNj0Kx2ag6Xrtuitcx3w1H6jvAk7XiQjsjN1/xYRks6JxJeN96DJRIDDa+IVjR X-Received: by 2002:a19:f017:0:b0:51b:4df3:540e with SMTP id 2adb3069b0e04-52967465414mr2180884e87.65.1716570090671; Fri, 24 May 2024 10:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716570090; cv=none; d=google.com; s=arc-20160816; b=vF+QSaHULaEi5SDU0qfJX9sMQ4aSiCI5OqjT+Hxo+GH0P6CaGWdWAbwn3kAE7XAjGK LNGNmouOET09avC0zj/tMBs0fdgmdXryrycSwvVZgFCh19ZMte4xG7cpi/wS4ae4ezH7 U47K1rBeSAYYOS103mi9rg0JCzW9UEbHnyMb53Q/fgPso5cQ+7+Dh6LORAMRneTolOs2 huGp5POknAXA6Z1mCwPfcG95ZOiCTb4C/Ybg5+6pUWHjvri8tb9v7pZ8lAOtZMVyPzw8 7RCAk6BELZtBalNtxVRxHZU/PFUSPzQF9vgwAoAMDOf9fVhX7mDEz0wqBX1akirwxdKL bSog== 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=mVSTvCb9mHLT4m5gAOBEeMp0FwU4GhFgqC+puOBNS/M=; fh=HXoCox9VIgWDv9R0X4OhDbmEfljfuKVkyrStP1BkrLI=; b=ShlUTAgUQJo/ukjZaKNNyYniWTptnLxiTHTUXSoRZpRtnOpNhNilDTsmT45pVSVLh+ 3ICaxXDB+tK3xI9Wa3hHtNHy1/CUqf2476AGe+9PzcFP8681YPRGKAs3wc5lDGeA8Fb+ tTlUIdIGoQUeMroeMhXr9DlaBe+hriLwCdP+DH9aWs4qItJLnLBYs+vAa8UFStOK0Cvo WRd9wmolP90giJy04ZGDQqyr4bWQiVSnh6RVgzCHqqvNcky0rXwVm0oWTWpTpDCXLAFc leT5biucu85iROniQtXUni0PwwAX5YDFunZ4x5n1gcZpW/y3pVuf0cZeYYuBHNLoTJXw PeYg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nSfbigZa; 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 a640c23a62f3a-a626cc36d8bsi96289166b.469.2024.05.24.10.01.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 10:01:30 -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=nSfbigZa; 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 DE4CE888FF; Fri, 24 May 2024 19:00:32 +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="nSfbigZa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 38C0888647; Fri, 24 May 2024 18:21:08 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 6DCDD8884D for ; Fri, 24 May 2024 18:21: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=jerome.forissier@linaro.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-420180b5838so47040035e9.2 for ; Fri, 24 May 2024 09:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567663; x=1717172463; 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=mVSTvCb9mHLT4m5gAOBEeMp0FwU4GhFgqC+puOBNS/M=; b=nSfbigZaRiEXgEtfMbAiFPWWk3UvGjPow832M+JfoysMCtLt4NVXOD4/cdVjAf7piF +IH3T1Xn8/YJ0w4H0lQRzGtk/TNFVHrk4IKTN+TBygjElFunoMu3S4oGgTa18+XvB5Ta 5jbYcKuWXSV3dsgRtfOgOXLNOt5/jS7sIoBC5WqOf80q01QIPVyeF/UY/d2ErfsWNDlO DG9lGuETh+U8QQ7G96PJCJJbcX07ubWqEHcx09koCBZ0EskRPyvPTNUtL8DmnDA0cryV EmyDtDvuvQKHvVitJE4h6e+/JYkr4AtQl+/FyEpLobIp9Hjahtsqa43xY+LA0eIUft/b WCwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567663; x=1717172463; 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=mVSTvCb9mHLT4m5gAOBEeMp0FwU4GhFgqC+puOBNS/M=; b=IAjSHfR/BfaBtx9Nkd8SO70OGX1W8O/2V9Qj3TZszzwNAwY7TbHZGMNfDv6zeA4qMG pXQC15nYAOELkXdybrBsirVWg3MVDsU3uxKicadadaz35hs3AyyL1STaa9z9J9f1v01o V/Yh5w4Fh0efFHf+9cKjfjmBNgYpP5/DQpa16Fy/1hY0ipK+s/VfUHEKn3PHk8YHHTBy faJqkGHc4Eaz30oUI/i4QNjcB/hEncuMJy5VbZ1t9BhwSdixQgwWj9fzSGJsHTH86+aX oPlB1P1RIuVpft1F2U1xglqJr0ew6X0MhKrTJW+IKWEAHTn2lG7KVXz6c93VW615Mc6+ 74bQ== X-Gm-Message-State: AOJu0YyI041mM6/0vOMCQlIt5fdOsctpcf/85/G3FtCdy/MOJM74rohR AqUxNgzzPgYB1A09n6Zv+Wp+THwIQfi8wPTpt97xkLhrtISb4OvWmP4u5bEL/a0qFsYR8zfeHG9 Czt+nHsqd X-Received: by 2002:a05:600c:54ca:b0:41c:12c:aaa2 with SMTP id 5b1f17b1804b1-42108a17bcfmr21478195e9.33.1716567663543; Fri, 24 May 2024 09:21:03 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:21:03 -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 , Greg Malysa , Heinrich Schuchardt , Jonas Karlman , Svyatoslav Ryhel , Shengyu Qu , John Keeping , Jesse Taube , Sumit Garg , Bryan Brattlof , "Leon M. Busch-George" , Rasmus Villemoes , Samuel Dionne-Riel , Joshua Watt , Sean Anderson , Andre Przywara , Mayuresh Chitale , Oleksandr Suvorov , Samuel Holland , Jaehoon Chung , Patrice Chotard , Ashok Reddy Soma , Patrick Delaunay , Alexey Romanov , Quentin Schulz , Ion Agorria , Yanhong Wang , Nicolas Frattaroli , Miquel Raynal , Baruch Siach Subject: [PATCH v2 01/14] net: introduce alternative implementation as net-lwip/ Date: Fri, 24 May 2024 18:19:55 +0200 Message-Id: <923f66b4a74d9c91c6d661e96dced8e1cbcdc7e0.1716566960.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: Fri, 24 May 2024 19:00:29 +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. At this point, enabling NET_LWIP simply disables NET. 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 on !NET_LWIP for now. Signed-off-by: Jerome Forissier --- Kconfig | 2 ++ 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 | 15 +++++++++++++++ net/Kconfig | 1 + 10 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 net-lwip/Kconfig diff --git a/Kconfig b/Kconfig index 82df59f176e..758256ab121 100644 --- a/Kconfig +++ b/Kconfig @@ -747,6 +747,8 @@ source "env/Kconfig" source "net/Kconfig" +source "net-lwip/Kconfig" + source "drivers/Kconfig" source "fs/Kconfig" diff --git a/Makefile b/Makefile index 79b28c2d81f..3df9c45a17c 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..f8e0481964f --- /dev/null +++ b/net-lwip/Kconfig @@ -0,0 +1,15 @@ +# +# Network configuration (with lwIP stack) +# + +menuconfig NET_LWIP + bool "Networking support (lwIP stack) -- EXPERIMENTAL" + 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. + NOTE: This is currently a placeholder. diff --git a/net/Kconfig b/net/Kconfig index 5dff6336293..04b81dd4976 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -6,6 +6,7 @@ menuconfig NET bool "Networking support" default y imply NETDEVICES + depends on !NET_LWIP if NET From patchwork Fri May 24 16:19:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798692 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp800139wrw; Fri, 24 May 2024 09:22:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW+y8QGrTyAfn4DmB/C/YPjcaLzp9jvjEOJkMeWXtjh2y2BdV6q+eK93Iybzxu4gMOo2A+7a7beX+4WJWINRfgq X-Google-Smtp-Source: AGHT+IEkM0sKHqIPNH0X0RPM1ix0nQ5g8xbd9NwGdQmls6dHQSEGTayIsSy2XwXzzJVNleVNSHuF X-Received: by 2002:a17:906:39cb:b0:a59:a979:2b03 with SMTP id a640c23a62f3a-a626250ce27mr262496866b.23.1716567735736; Fri, 24 May 2024 09:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716567735; cv=none; d=google.com; s=arc-20160816; b=DU7fNcKuSuqotKBtIpUn4JTRaHgPtZlMwCgtChDav8DvZPDwrHAPMQDt9sfxp/wH+V u1ZHCyMLijnDfBdn28erLVdXifHRJV/xcX9hfHRP8UBR2N3feBuCaP9hINEXScBvIIjX VU9PwuCXc8BEW+ZkPW4MAuJFaVMb3aUpw1A4Q8pMxGXAI3ZlF3NBbkGRn6Ytt+48k1t+ 5y+JHN7DFiOZm4yuAa8uwQCFZwFduV6FmK7RSTnhOvUxry1wwCcX709HJAhWFRcmD5sk sePJCXljA/YCpEGQAeSIG+9FOGg4rDzxlE8TQ+Oxi41zd0J6PZ+mIhINEuyU0AXpSRZC 6OfQ== 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=cGhRi4GHirVvBh6qVqnUJfANp4fq2hNYMViO1y9rlTo=; fh=ekXsUQPhZdr3j4yJ9xR4wW90wSJ6ZxPoTiiDogoheA0=; b=GP3elIcJFSHrow3htlcf5z+aHhY8w+onQLNFfiHx8dKABq23LogxaHtL+IpXVyT3N0 dbapVt0H4EscdRhXq+RR3MsAeETLm21VJrbr20DVLDTADqFgN5jt5jvpH4AGyZp8Wbk6 +e/hhvdWCv97QrtFDgnXNFwGKdJY/om+3ymqdl006SoCwyiSih9IkvEVEhv7g1yg1M/P TAMLTy1wdFPUTXWXsG1iqUPJ+rDiIbTtfROHtqdhXCw0dVVKGtJJ1K++XZiBy5LIrY0Z I+GPM3cawzWGJjwlWW7XRL9fRazI2A/xiVVGFKDV/dZoPku1uB0/IMyFQckI1vZfAAwi WRNQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KPFPWcY4; 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 a640c23a62f3a-a626cc3651fsi92457266b.384.2024.05.24.09.22.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:15 -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=KPFPWcY4; 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 CFE968884D; Fri, 24 May 2024 18:22:14 +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="KPFPWcY4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DEB9A88552; Fri, 24 May 2024 18:22:11 +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-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (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 1E2DC88647 for ; Fri, 24 May 2024 18:22:08 +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-wr1-x42d.google.com with SMTP id ffacd0b85a97d-35507de9853so603828f8f.0 for ; Fri, 24 May 2024 09:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567727; x=1717172527; 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=cGhRi4GHirVvBh6qVqnUJfANp4fq2hNYMViO1y9rlTo=; b=KPFPWcY449djEU4PMZatGLnwc0l52R6sfutZfOENj2c2hNmlcQJe8PN4PcKHupO0X+ eFNgNl6Vmj7/xpVoGoCzTLKhB0fi1SoFWnXoY+ZgdqmqcEXDPzAbDqONkybGz2lf8b8k xKweLVTkKdUBKxS3uaGHBzoYIZQFcKDpdMuwIMkqayHVSdxI3hleranAoBspe6EP4kkI lyLgnDa7841ed7xtAyyMNDDYEsazHmWex1CdNxKv/cj0IkBpoT8jILWZAxjhhWAv7Uf2 Doi8uCW8FCZn0sUDyYINS9EIOjBu9K9kQ7pPhcZcfCa45UJ2jlLZ3zbCfSz/TARlsdM1 5+8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567727; x=1717172527; 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=cGhRi4GHirVvBh6qVqnUJfANp4fq2hNYMViO1y9rlTo=; b=sSQgZLndLT7MjBIl2xlPZEef6XskSciUgu/o9gaMNeKhJ1hWL/PF3XUd+YVdDDO24h uGE14g77Ie30hVsKtb8UfBL1Wnn0c7Y10Vr9n61jqMt+6USMbWxSDEO3hvZhHZ3tOsG8 UaB3DcDLxaBzR/yw5kLXsdp2eJWtbSvalXHPMmPLQ4f0jHZHZFYv4kj9gTfsZDnpZ1cd CihHhBf6/Up60iiwnVWgisLpnCsuQsXFTy1YhyjvkXYMoMXu8fxwbx9kvuYRhCege3JU M6UiMJbKQHwGvJEpq+fV/va+tpuIoGQtq+bmxGO3xPQZT1QBa0ZimbUEE95M0uThxSv0 6tNw== X-Gm-Message-State: AOJu0YxwHWlcrNFqkmI6Y7VuO21w7lswmN5ts8pqg6a/AjcJ7AchCdRs ZghatTOmfnjfbdRDeJ4c5SM+MHZJmPiCSg/vHH6cTz3OQffShOv+rhI0HxmCjknlgeeVp44P3QA TCohL4NJW X-Received: by 2002:a05:6000:1151:b0:354:ece6:d9b9 with SMTP id ffacd0b85a97d-35506d5bfd3mr2707859f8f.15.1716567727428; Fri, 24 May 2024 09:22:07 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:07 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Simon Glass , Oleksandr Suvorov , Sean Anderson Subject: [PATCH v2 03/14] net-lwip: build lwIP Date: Fri, 24 May 2024 18:19:57 +0200 Message-Id: <3bfe6c3c2da0f15a0c5ccfcce21d9aedbb9a4ca1.1716566960.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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 Build the lwIP library when NET_LWIP is enabled. The following files are adaptation layers written specially for U-Boot: lib/lwip/u-boot/arch/cc.h lib/lwip/u-boot/arch/sys_arch.h (empty) lib/lwip/u-boot/limits.h (empty) lib/lwip/u-boot/lwipopts.h They were initially contributed by Maxim in a previous RFC patch series. Signed-off-by: Jerome Forissier Co-developed-by: Maxim Uvarov Cc: Maxim Uvarov --- lib/Makefile | 2 + lib/lwip/Makefile | 57 +++++++++ lib/lwip/u-boot/arch/cc.h | 43 +++++++ lib/lwip/u-boot/arch/sys_arch.h | 0 lib/lwip/u-boot/limits.h | 0 lib/lwip/u-boot/lwipopts.h | 197 ++++++++++++++++++++++++++++++++ net-lwip/Kconfig | 3 +- 7 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 lib/lwip/Makefile create mode 100644 lib/lwip/u-boot/arch/cc.h create mode 100644 lib/lwip/u-boot/arch/sys_arch.h create mode 100644 lib/lwip/u-boot/limits.h create mode 100644 lib/lwip/u-boot/lwipopts.h diff --git a/lib/Makefile b/lib/Makefile index 2a76acf100d..c35786a0576 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -94,6 +94,8 @@ obj-$(CONFIG_LIBAVB) += libavb/ obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += libfdt/ obj-$(CONFIG_$(SPL_TPL_)OF_REAL) += fdtdec_common.o fdtdec.o +obj-$(CONFIG_NET_LWIP) += lwip/ + ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16-ccitt.o obj-$(CONFIG_$(SPL_TPL_)HASH) += crc16-ccitt.o diff --git a/lib/lwip/Makefile b/lib/lwip/Makefile new file mode 100644 index 00000000000..158e59b91fc --- /dev/null +++ b/lib/lwip/Makefile @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2024 Linaro Ltd. + +ccflags-y += -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot + +obj-y += \ + lwip/src/api/api_lib.o \ + lwip/src/api/api_msg.o \ + lwip/src/api/err.o \ + lwip/src/api/if_api.o \ + lwip/src/api/netbuf.o \ + lwip/src/api/netdb.o \ + lwip/src/api/netifapi.o \ + lwip/src/api/sockets.o \ + lwip/src/api/tcpip.o \ + lwip/src/apps/http/http_client.o \ + lwip/src/apps/tftp/tftp.o \ + lwip/src/core/altcp_alloc.o \ + lwip/src/core/altcp.o \ + lwip/src/core/altcp_tcp.o \ + lwip/src/core/def.o \ + lwip/src/core/dns.o \ + lwip/src/core/inet_chksum.o \ + lwip/src/core/init.o \ + lwip/src/core/ip.o \ + lwip/src/core/ipv4/acd.o \ + lwip/src/core/ipv4/autoip.o \ + lwip/src/core/ipv4/dhcp.o \ + lwip/src/core/ipv4/etharp.o \ + lwip/src/core/ipv4/icmp.o \ + lwip/src/core/ipv4/igmp.o \ + lwip/src/core/ipv4/ip4_addr.o \ + lwip/src/core/ipv4/ip4.o \ + lwip/src/core/ipv4/ip4_frag.o \ + lwip/src/core/ipv6/dhcp6.o \ + lwip/src/core/ipv6/ethip6.o \ + lwip/src/core/ipv6/icmp6.o \ + lwip/src/core/ipv6/inet6.o \ + lwip/src/core/ipv6/ip6_addr.o \ + lwip/src/core/ipv6/ip6.o \ + lwip/src/core/ipv6/ip6_frag.o \ + lwip/src/core/ipv6/mld6.o \ + lwip/src/core/ipv6/nd6.o \ + lwip/src/core/mem.o \ + lwip/src/core/memp.o \ + lwip/src/core/netif.o \ + lwip/src/core/pbuf.o \ + lwip/src/core/raw.o \ + lwip/src/core/stats.o \ + lwip/src/core/sys.o \ + lwip/src/core/tcp.o \ + lwip/src/core/tcp_in.o \ + lwip/src/core/tcp_out.o \ + lwip/src/core/timeouts.o \ + lwip/src/core/udp.o \ + lwip/src/netif/ethernet.o diff --git a/lib/lwip/u-boot/arch/cc.h b/lib/lwip/u-boot/arch/cc.h new file mode 100644 index 00000000000..31c036dc0c5 --- /dev/null +++ b/lib/lwip/u-boot/arch/cc.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2023 Linaro Ltd. */ + +#ifndef LWIP_ARCH_CC_H +#define LWIP_ARCH_CC_H + +#include +#include +#include +#include + +#define LWIP_ERRNO_INCLUDE + +#define LWIP_ERRNO_STDINCLUDE 1 +#define LWIP_NO_UNISTD_H 1 +#define LWIP_TIMEVAL_PRIVATE 1 + +#ifdef CONFIG_LIB_RAND +#define LWIP_RAND() ((u32_t)rand()) +#endif + +/* different handling for unit test, normally not needed */ +#ifdef LWIP_NOASSERT_ON_ERROR +#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ + handler; }} while (0) +#endif + +#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS + +#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \ + x, __LINE__, __FILE__); } while (0) + +#define atoi(str) (int)dectoul(str, NULL) +#define lwip_strnstr(a, b) strnstr(a, b) + +#define LWIP_ERR_T int +#define LWIP_CONST_CAST(target_type, val) ((target_type)((uintptr_t)val)) + +#if defined(CONFIG_SYS_BIG_ENDIAN) +#define BYTE_ORDER BIG_ENDIAN +#endif + +#endif /* LWIP_ARCH_CC_H */ diff --git a/lib/lwip/u-boot/arch/sys_arch.h b/lib/lwip/u-boot/arch/sys_arch.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/lwip/u-boot/limits.h b/lib/lwip/u-boot/limits.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/lwip/u-boot/lwipopts.h b/lib/lwip/u-boot/lwipopts.h new file mode 100644 index 00000000000..aac0a6259fd --- /dev/null +++ b/lib/lwip/u-boot/lwipopts.h @@ -0,0 +1,197 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +/* Copyright (C) 2023 Linaro Ltd. */ + +#ifndef LWIP_UBOOT_LWIPOPTS_H +#define LWIP_UBOOT_LWIPOPTS_H + +#if defined(CONFIG_LWIP_DEBUG) +#define LWIP_DEBUG 1 +#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL +#define LWIP_DBG_TYPES_ON LWIP_DBG_ON +#define ETHARP_DEBUG LWIP_DBG_ON +#define NETIF_DEBUG LWIP_DBG_ON +#define PBUF_DEBUG LWIP_DBG_OFF +#define API_LIB_DEBUG LWIP_DBG_ON +#define API_MSG_DEBUG LWIP_DBG_OFF +#define SOCKETS_DEBUG LWIP_DBG_OFF +#define ICMP_DEBUG LWIP_DBG_OFF +#define IGMP_DEBUG LWIP_DBG_OFF +#define INET_DEBUG LWIP_DBG_OFF +#define IP_DEBUG LWIP_DBG_ON +#define IP_REASS_DEBUG LWIP_DBG_OFF +#define RAW_DEBUG LWIP_DBG_OFF +#define MEM_DEBUG LWIP_DBG_OFF +#define MEMP_DEBUG LWIP_DBG_OFF +#define SYS_DEBUG LWIP_DBG_OFF +#define TIMERS_DEBUG LWIP_DBG_ON +#define TCP_DEBUG LWIP_DBG_OFF +#define TCP_INPUT_DEBUG LWIP_DBG_OFF +#define TCP_FR_DEBUG LWIP_DBG_OFF +#define TCP_RTO_DEBUG LWIP_DBG_OFF +#define TCP_CWND_DEBUG LWIP_DBG_OFF +#define TCP_WND_DEBUG LWIP_DBG_OFF +#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF +#define TCP_RST_DEBUG LWIP_DBG_OFF +#define TCP_QLEN_DEBUG LWIP_DBG_OFF +#define UDP_DEBUG LWIP_DBG_OFF +#define TCPIP_DEBUG LWIP_DBG_OFF +#define SLIP_DEBUG LWIP_DBG_OFF +#define DHCP_DEBUG LWIP_DBG_ON +#define AUTOIP_DEBUG LWIP_DBG_ON +#define DNS_DEBUG LWIP_DBG_ON +#define IP6_DEBUG LWIP_DBG_OFF +#define DHCP6_DEBUG LWIP_DBG_OFF +#else +#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL +#define LWIP_DBG_TYPES_ON LWIP_DBG_OFF +#define ETHARP_DEBUG LWIP_DBG_OFF +#define NETIF_DEBUG LWIP_DBG_OFF +#define PBUF_DEBUG LWIP_DBG_OFF +#define API_LIB_DEBUG LWIP_DBG_OFF +#define API_MSG_DEBUG LWIP_DBG_OFF +#define SOCKETS_DEBUG LWIP_DBG_OFF +#define ICMP_DEBUG LWIP_DBG_OFF +#define IGMP_DEBUG LWIP_DBG_OFF +#define INET_DEBUG LWIP_DBG_OFF +#define IP_DEBUG LWIP_DBG_OFF +#define IP_REASS_DEBUG LWIP_DBG_OFF +#define RAW_DEBUG LWIP_DBG_OFF +#define MEM_DEBUG LWIP_DBG_OFF +#define MEMP_DEBUG LWIP_DBG_OFF +#define SYS_DEBUG LWIP_DBG_OFF +#define TIMERS_DEBUG LWIP_DBG_OFF +#define TCP_DEBUG LWIP_DBG_OFF +#define TCP_INPUT_DEBUG LWIP_DBG_OFF +#define TCP_FR_DEBUG LWIP_DBG_OFF +#define TCP_RTO_DEBUG LWIP_DBG_OFF +#define TCP_CWND_DEBUG LWIP_DBG_OFF +#define TCP_WND_DEBUG LWIP_DBG_OFF +#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF +#define TCP_RST_DEBUG LWIP_DBG_OFF +#define TCP_QLEN_DEBUG LWIP_DBG_OFF +#define UDP_DEBUG LWIP_DBG_OFF +#define TCPIP_DEBUG LWIP_DBG_OFF +#define SLIP_DEBUG LWIP_DBG_OFF +#define DHCP_DEBUG LWIP_DBG_OFF +#define AUTOIP_DEBUG LWIP_DBG_OFF +#define DNS_DEBUG LWIP_DBG_OFF +#define IP6_DEBUG LWIP_DBG_OFF +#define DHCP6_DEBUG LWIP_DBG_OFF +#endif +#define LWIP_TESTMODE 0 + +#if !defined(CONFIG_LWIP_ASSERT) +#define LWIP_NOASSERT 1 +#define LWIP_ASSERT(message, assertion) +#endif + +#include "lwip/debug.h" + +#define SYS_LIGHTWEIGHT_PROT 0 +#define NO_SYS 1 + +#define LWIP_IPV4 1 +#define LWIP_IPV6 0 + +#define MEM_ALIGNMENT 1 +#define MEM_SIZE 1600 + +#define MEMP_NUM_PBUF 4 +#define MEMP_NUM_RAW_PCB 2 +#define MEMP_NUM_UDP_PCB 4 +#define MEMP_NUM_TCP_PCB 2 +#define MEMP_NUM_TCP_PCB_LISTEN 2 +#define MEMP_NUM_TCP_SEG 16 +#define MEMP_NUM_REASSDATA 1 +#define MEMP_NUM_ARP_QUEUE 2 +#define MEMP_NUM_SYS_TIMEOUT 4 +#define MEMP_NUM_NETBUF 2 +#define MEMP_NUM_NETCONN 32 +#define MEMP_NUM_TCPIP_MSG_API 8 +#define MEMP_NUM_TCPIP_MSG_INPKT 8 +#define PBUF_POOL_SIZE 8 + +#define LWIP_ARP 1 +#define ARP_TABLE_SIZE 1 +#define ARP_QUEUEING 0 + +#define IP_FORWARD 0 +#define IP_OPTIONS_ALLOWED 1 +#define IP_REASSEMBLY 0 +#define IP_FRAG 0 +#define IP_REASS_MAXAGE 3 +#define IP_REASS_MAX_PBUFS 4 +#define IP_FRAG_USES_STATIC_BUF 0 + +#define IP_DEFAULT_TTL 255 + +#define LWIP_ICMP 0 + +#if defined(CONFIG_PROT_RAW_LWIP) +#define LWIP_RAW 1 +#else +#define LWIP_RAW 0 +#endif + +#if defined(CONFIG_PROT_DHCP_LWIP) +#define LWIP_DHCP 1 +#define LWIP_DHCP_BOOTP_FILE 1 +#else +#define LWIP_DHCP 0 +#endif + +#define LWIP_DHCP_DOES_ACD_CHECK 0 + +#define LWIP_AUTOIP 0 + +#define LWIP_SNMP 0 + +#define LWIP_IGMP 0 + +#if defined(CONFIG_PROT_DNS_LWIP) +#define LWIP_DNS 1 +#define DNS_TABLE_SIZE 1 +#else +#define LWIP_DNS 0 +#endif + +#if defined(CONFIG_PROT_UDP_LWIP) +#define LWIP_UDP 1 +#else +#define LWIP_UDP 0 +#endif + +#if defined(CONFIG_PROT_TCP_LWIP) +#define LWIP_TCP 1 +#else +#define LWIP_TCP 0 +#endif + +#define LWIP_LISTEN_BACKLOG 0 + +#define PBUF_LINK_HLEN 14 +#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS + 40 + PBUF_LINK_HLEN) + +#define LWIP_HAVE_LOOPIF 0 + +#define LWIP_NETCONN 0 +#define LWIP_DISABLE_MEMP_SANITY_CHECKS 1 + +#define LWIP_SOCKET 0 +#define SO_REUSE 0 + +#define LWIP_STATS 0 + +#define PPP_SUPPORT 0 + +#define LWIP_TCPIP_CORE_LOCKING 0 + +#define LWIP_NETIF_LOOPBACK 0 + +/* use malloc instead of pool */ +#define MEMP_MEM_MALLOC 1 +#define MEMP_MEM_INIT 1 +#define MEM_LIBC_MALLOC 1 + +#endif /* LWIP_UBOOT_LWIPOPTS_H */ diff --git a/net-lwip/Kconfig b/net-lwip/Kconfig index f8e0481964f..7d9ec8fdfbd 100644 --- a/net-lwip/Kconfig +++ b/net-lwip/Kconfig @@ -12,4 +12,5 @@ menuconfig NET_LWIP 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. - NOTE: This is currently a placeholder. + NOTE: This currently only builds the lwIP library but does not add + any functionality to U-Boot. From patchwork Fri May 24 16:19:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798704 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp817714wrw; Fri, 24 May 2024 10:02:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU+4sol9Za2kOWXuApNLpKtoBmL0ZhdLzO3RPgNGUwgpAJqkIFFykbXw7tFf/U8rlCx4PgC8Ee13xTMl/cKI/+0 X-Google-Smtp-Source: AGHT+IGFuMtJrIKBWKcIlr82NBv2qByGs57kh2g9/zJ6Mls+Vcz3b7kpwJSK1YqrbkewS7AKGLVB X-Received: by 2002:a50:c054:0:b0:56d:c40d:b921 with SMTP id 4fb4d7f45d1cf-57851962dffmr2145331a12.20.1716570141656; Fri, 24 May 2024 10:02:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716570141; cv=none; d=google.com; s=arc-20160816; b=UCLZ1shS3jDA/w4Vx6WnuA5V751Uo+8qtdGOgscCJupajr2Fy0hmUv2zpS74a9hbG7 ZqEWEwyNQ9mP3o+MFeqWIg2AFwPmhEfHIMHaw8S/zBVnc2zarNZTSUEhzRZD7nqRxpQ0 EEu3BrThkpxivTYVVFcpJrvujVYPAQMb/xm0+59UUnd2Qa/7nyaqKnD7qDW0RVm1u0wn Avg63mG4F4zL9/to25d0bUEMeK+mIkP9JDt66rH7Vu7DPA0ILxYLfLa7r6WUTz0di0Ev P/RpvFaXBu3k3krp6pdf/UopDJPjK7KHRbW8RIcyiY1Ek9vtTID2c5sLzvol5GjQ7k// MkWQ== 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=ayJduGaWWigtCP+yfXqA4I1YEc6Kvo5I/NYHbpijggA=; fh=O9D25WorwpUP51c+S/KdgSQopyI5kIPhPX9d8KjSZiw=; b=XFNxU65A6zZRe9kFZ1zDyG7ZwkJOgTkf2ZjVVS9onxExROC7XM4kxiohRGsMYmsX96 CQ8Dzi05hJFLI7Fjh4sCUwKSm7dPHSIjnNrKKqi5FbINX0nJQNTEbWUG7jBzNv9RWyJQ cU3sGZKOBfCb6wofR6swnhHV90YzwbCx9lPcV5qPxPtGzKybmb4VJDsdJF2sdyxElqVN KX7b63QOleUCJMdc0+AVuvJ/ZR/hd8rn4nEZvRYtrWbl4NiwP1qzxBwFfoBaNnjem2YP Nk+I1vKi3lIDdgEcrfiITPyiwWF0Mc7ufXWh/nLgUNITGX52TDMORoUME+CStFreZNaR D6hg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="p/MNy4Ch"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-578524680b6si1030351a12.277.2024.05.24.10.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 10:02:21 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="p/MNy4Ch"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 66EB08890D; Fri, 24 May 2024 19:00:36 +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="p/MNy4Ch"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EA9ED888B2; Fri, 24 May 2024 18:22:15 +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-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (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 BCDC488640 for ; Fri, 24 May 2024 18:22:12 +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-wr1-x430.google.com with SMTP id ffacd0b85a97d-351d309bbcfso2270028f8f.3 for ; Fri, 24 May 2024 09:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567732; x=1717172532; 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=ayJduGaWWigtCP+yfXqA4I1YEc6Kvo5I/NYHbpijggA=; b=p/MNy4ChG2pT8Vn9qa2veDQwouUU+Zgv6Msu88/AJxziKm6tfZxWjLkln+P3VToECq tphpNcO+Rr+SFOxO/xqJ9JS9ps7GcNZYE7U/sH7NXtGjEzFNfU/vjjyTN77/nHbJc/Ia waCfqcR+7kt3mqKXrtl0CMirJ8F5vAOglJC23adzhVvl3Y5CmKXVvW5IXXzacWRUih1Z kb6Z232q9nj+0+RHckVl2meL1fNpxWwmSB0GRJ4ooPhiSDmeCxUoOffTpja+/ML+mZoi jOyXnwg+FNdsa+i4lAqFXGvoI04q75tt9sXeKGsUf97wSt0RwZB7XeMIZz6wYOMpa6LD 2t/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567732; x=1717172532; 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=ayJduGaWWigtCP+yfXqA4I1YEc6Kvo5I/NYHbpijggA=; b=wOawJiefZ26X6hQtmR52FEQcp7FhlLWIPExfRqFh8UwGktJRHL4BrKS2RrhcgXXNV1 uv6KXiCrtffGM+8gGVWhMbIbabemdM4IHEEiaPCEERdHaDLN0NKFVSI08x1CACnPWbwV kclSQNY1df6iikWcTKOjuIPeDz25Hwqvzm4mphoaA75vdyshC8A/MxM7lbWTwVXB9EmD OPEF2kquZAdpbNFX+Fj3HO6os40hT9cACqnD9NhNC0CS4L5zZ0pPrW1f8ECqFX54iDOk Y0V6qo6G6+YUSamwyrWLv9mkGhvwuQmOqt51gQGBOKBZQAi20PuE6sq0cYNp8RRW8cIM gdcA== X-Gm-Message-State: AOJu0Yxaim0PGWvF233+P8u33jPP8Tlxz0Y8f3TmqZnhtPDdgLm73i/f CQXObghfKMqYYP73LPPPQItYHwg1Of+qAbXAj4C/dGguT2KhcmxpHqNxoJuZNQSSYZ/2wB7sqIk wyJWPY8ig X-Received: by 2002:a5d:4607:0:b0:346:14d2:fef6 with SMTP id ffacd0b85a97d-3552fe021camr1728118f8f.62.1716567731763; Fri, 24 May 2024 09:22:11 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:11 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Joe Hershberger , Ramon Fried , Simon Glass , Heinrich Schuchardt , Sumit Garg , Bryan Brattlof , Jesse Taube , "Leon M. Busch-George" , Eddie James , Mattijs Korpershoek , AKASHI Takahiro , Francis Laniel , Peter Robinson , Abdellatif El Khlifi , Marek Vasut , Bin Meng , Sean Anderson , Shiji Yang , Artur Rojek , Yang Xiwen , Kever Yang , Eugen Hristev , Boon Khai Ng , Jonas Karlman , Neil Armstrong , Yanhong Wang , Masahisa Kojima , Ioana Ciornei Subject: [PATCH v2 04/14] net-lwip: add DHCP support and dhcp commmand Date: Fri, 24 May 2024 18:19:58 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 24 May 2024 19:00:29 +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 Add what it takes to enable NETDEVICES with NET_LWIP and enable DHCP as well as the dhcp command. - net-lwip/net-lwip.c is mostly empty for now. It will provide functions similar to net/net.c except based on the lwIP stack - include/net-lwip.h is a replacement for include/net.h which is unused when NET_LWIP is enabled. Declarations from the latter will be transferred to the former as needed when new network commands are ported on top of lwIP. - CMD_TFTPBOOT is selected by BOOTMETH_EFI due to this code having an implicit dependency on do_tftpb(). Signed-off-by: Jerome Forissier --- Makefile | 1 + boot/Kconfig | 3 +- cmd/Kconfig | 26 +++++ cmd/Makefile | 4 + cmd/net-lwip.c | 13 +++ common/board_r.c | 4 +- drivers/net/Kconfig | 2 +- include/net-lwip.h | 85 +++++++++++++++ include/net.h | 2 +- net-lwip/Kconfig | 41 +++++++- net-lwip/Makefile | 15 +++ net-lwip/dhcp.c | 105 +++++++++++++++++++ net-lwip/eth_internal.h | 35 +++++++ net-lwip/net-lwip.c | 224 ++++++++++++++++++++++++++++++++++++++++ net-lwip/tftp.c | 11 ++ 15 files changed, 564 insertions(+), 7 deletions(-) create mode 100644 cmd/net-lwip.c create mode 100644 include/net-lwip.h create mode 100644 net-lwip/Makefile create mode 100644 net-lwip/dhcp.c create mode 100644 net-lwip/eth_internal.h create mode 100644 net-lwip/net-lwip.c create mode 100644 net-lwip/tftp.c diff --git a/Makefile b/Makefile index 3df9c45a17c..d59b914071f 100644 --- a/Makefile +++ b/Makefile @@ -860,6 +860,7 @@ libs-y += env/ libs-y += lib/ libs-y += fs/ libs-$(CONFIG_NET) += net/ +libs-$(CONFIG_NET_LWIP) += net-lwip/ libs-y += disk/ libs-y += drivers/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ diff --git a/boot/Kconfig b/boot/Kconfig index 6f3096c15a6..004e69dd92a 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -378,7 +378,7 @@ config BOOT_DEFAULTS_CMDS select CMD_FAT select CMD_FS_GENERIC select CMD_PART if PARTITIONS - select CMD_DHCP if CMD_NET + select CMD_DHCP if CMD_NET || CMD_NET_LWIP select CMD_PING if CMD_NET select CMD_PXE if CMD_NET select CMD_BOOTI if ARM64 @@ -540,6 +540,7 @@ config BOOTMETH_EXTLINUX_PXE config BOOTMETH_EFILOADER bool "Bootdev support for EFI boot" depends on EFI_BINARY_EXEC + select CMD_TFTPBOOT if CMD_NET_LWIP default y help Enables support for EFI boot using bootdevs. This makes the diff --git a/cmd/Kconfig b/cmd/Kconfig index b026439c773..1bfa528e945 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2084,6 +2084,32 @@ config CMD_WOL endif +if NET_LWIP + +menuconfig CMD_NET_LWIP + bool "Network commands (lwIP)" + default y + +if CMD_NET_LWIP + +config CMD_DHCP + bool "dhcp" + select PROT_DHCP_LWIP + help + Boot image via network using DHCP/TFTP protocol + +config CMD_TFTPBOOT + bool "tftp" + select PROT_UDP_LWIP + default n + help + tftpboot - load file via network using TFTP protocol + Currently a placeholder (not implemented) + +endif + +endif + menu "Misc commands" config CMD_2048 diff --git a/cmd/Makefile b/cmd/Makefile index 87133cc27a8..535b6838ca5 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -128,6 +128,10 @@ endif obj-$(CONFIG_CMD_MUX) += mux.o obj-$(CONFIG_CMD_NAND) += nand.o obj-$(CONFIG_CMD_NET) += net.o +obj-$(CONFIG_CMD_NET_LWIP) += net-lwip.o +ifdef CONFIG_CMD_NET_LWIP +CFLAGS_net-lwip.o := -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot +endif obj-$(CONFIG_ENV_SUPPORT) += nvedit.o obj-$(CONFIG_CMD_NVEDIT_EFI) += nvedit_efi.o obj-$(CONFIG_CMD_ONENAND) += onenand.o diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c new file mode 100644 index 00000000000..966d7226eda --- /dev/null +++ b/cmd/net-lwip.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024 Linaro Ltd. */ + +#include +#include + +#if defined(CONFIG_CMD_DHCP) +U_BOOT_CMD( + dhcp, 3, 1, do_dhcp, + "boot image via network using DHCP/TFTP protocol", + "[loadAddress] [[hostIPaddr:]bootfilename]" +); +#endif diff --git a/common/board_r.c b/common/board_r.c index da0b80f24ff..6548eb8fdd5 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -472,7 +472,7 @@ static int initr_status_led(void) } #endif -#ifdef CONFIG_CMD_NET +#if defined(CONFIG_CMD_NET) || defined(CONFIG_CMD_NET_LWIP) static int initr_net(void) { puts("Net: "); @@ -727,7 +727,7 @@ static init_fnc_t init_sequence_r[] = { #ifdef CONFIG_PCI_ENDPOINT pci_ep_init, #endif -#ifdef CONFIG_CMD_NET +#if defined(CONFIG_CMD_NET) || defined(CONFIG_CMD_NET_LWIP) INIT_FUNC_WATCHDOG_RESET initr_net, #endif diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index b2d7b499766..4ba09c9d6f8 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -96,7 +96,7 @@ config DSA_SANDBOX menuconfig NETDEVICES bool "Network device support" - depends on NET + depends on NET || NET_LWIP select DM_ETH help You must select Y to enable any network device support diff --git a/include/net-lwip.h b/include/net-lwip.h new file mode 100644 index 00000000000..2308703e46b --- /dev/null +++ b/include/net-lwip.h @@ -0,0 +1,85 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __NET_LWIP_H__ +#define __NET_LWIP_H__ + +#include +#include +#include +#include + +/* + * The number of receive packet buffers, and the required packet buffer + * alignment in memory. + * + */ +#define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER +#define PKTALIGN ARCH_DMA_MINALIGN + +/* ARP hardware address length */ +#define ARP_HLEN 6 + +/* + * Maximum packet size; used to allocate packet storage. Use + * the maxium Ethernet frame size as specified by the Ethernet + * standard including the 802.1Q tag (VLAN tagging). + * maximum packet size = 1522 + * maximum packet size and multiple of 32 bytes = 1536 + */ +#define PKTSIZE 1522 +#ifndef CONFIG_DM_DSA +#define PKTSIZE_ALIGN 1536 +#else +/* Maximum DSA tagging overhead (headroom and/or tailroom) */ +#define DSA_MAX_OVR 256 +#define PKTSIZE_ALIGN (1536 + DSA_MAX_OVR) +#endif + +struct udevice *eth_get_dev(void); /* get the current device */ +/* + * Get the hardware address for an ethernet interface . + * Args: + * base_name - base name for device (normally "eth") + * index - device index number (0 for first) + * enetaddr - returns 6 byte hardware address + * Returns: + * Return true if the address is valid. + */ +int eth_env_get_enetaddr_by_index(const char *base_name, int index, + uchar *enetaddr); +int eth_init(void); /* Initialize the device */ +int eth_send(void *packet, int length); /* Send a packet */ +int eth_rx(void); +int eth_get_dev_index(void); +int eth_init_state_only(void); /* Set active state */ +void eth_set_current(void); /* set nterface to ethcur var */ + +struct ethernet_hdr { + u8 et_dest[ARP_HLEN]; /* Destination node */ + u8 et_src[ARP_HLEN]; /* Source node */ + u16 et_protlen; /* Protocol or length */ +} __attribute__((packed)); + +/* Ethernet header size */ +#define ETHER_HDR_SIZE (sizeof(struct ethernet_hdr)) + +/** + * string_to_enetaddr() - Parse a MAC address + * + * Convert a string MAC address + * + * Implemented in lib/net_utils.c (built unconditionally) + * + * @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 2-digit + * hex value + * @enetaddr: Place to put MAC address (6 bytes) + */ +void string_to_enetaddr(const char *addr, uint8_t *enetaddr); + +int net_lwip_init(void); +struct netif *net_lwip_get_netif(void); + +int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); +int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); + +#endif /* __NET_LWIP_H__ */ diff --git a/include/net.h b/include/net.h index ac511eab103..330bc6bf66c 100644 --- a/include/net.h +++ b/include/net.h @@ -914,7 +914,7 @@ static inline struct in_addr env_get_ip(char *var) */ void reset_phy(void); -#if CONFIG_IS_ENABLED(NET) +#if CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP) /** * eth_set_enable_bootdevs() - Enable or disable binding of Ethernet bootdevs * diff --git a/net-lwip/Kconfig b/net-lwip/Kconfig index 7d9ec8fdfbd..9e611f805ad 100644 --- a/net-lwip/Kconfig +++ b/net-lwip/Kconfig @@ -4,6 +4,7 @@ menuconfig NET_LWIP bool "Networking support (lwIP stack) -- EXPERIMENTAL" + imply NETDEVICES help Include networking support based on the lwIP (lightweight IP) TCP/IP stack (https://nongnu.org/lwip). This is a replacement for @@ -12,5 +13,41 @@ menuconfig NET_LWIP 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. - NOTE: This currently only builds the lwIP library but does not add - any functionality to U-Boot. + +if NET_LWIP + +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. + +endif diff --git a/net-lwip/Makefile b/net-lwip/Makefile new file mode 100644 index 00000000000..a56c32bfa74 --- /dev/null +++ b/net-lwip/Makefile @@ -0,0 +1,15 @@ +ccflags-y += -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot + +obj-$(CONFIG_$(SPL_TPL_)BOOTDEV_ETH) += ../net/eth_bootdev.o +obj-$(CONFIG_DM_MDIO) += ../net/mdio-uclass.o +obj-$(CONFIG_DM_MDIO_MUX) += ../net/mdio-mux-uclass.o +obj-$(CONFIG_$(SPL_)DM_ETH) += ../net/eth_common.o +obj-$(CONFIG_$(SPL_)DM_ETH) += ../net/eth-uclass.o +obj-$(CONFIG_$(SPL_)DM_ETH) += net-lwip.o +obj-$(CONFIG_CMD_DHCP) += dhcp.o +obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o + +# Disable this warning as it is triggered by: +# sprintf(buf, index ? "foo%d" : "foo", index) +# and this is intentional usage. +CFLAGS_eth_common.o += -Wno-format-extra-args diff --git a/net-lwip/dhcp.c b/net-lwip/dhcp.c new file mode 100644 index 00000000000..d1d35999b04 --- /dev/null +++ b/net-lwip/dhcp.c @@ -0,0 +1,105 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024 Linaro Ltd. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define DHCP_TIMEOUT_MS 2000 + +#ifdef CONFIG_CMD_TFTPBOOT +/* Boot file obtained from DHCP (if present) */ +static char boot_file_name[DHCP_BOOT_FILE_LEN]; +#endif + +static void call_lwip_dhcp_fine_tmr(void *ctx) +{ + dhcp_fine_tmr(); +} + +int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + unsigned long start; + struct netif *netif; + struct dhcp *dhcp; + bool bound; + + /* Running DHCP on the primary interface only */ + if (eth_get_dev_index() != 0) + return -EINVAL; + + net_lwip_init(); + + netif = net_lwip_get_netif(); + if (!netif) + return CMD_RET_FAILURE; + + /* + * The fine timer is half a second, it deals with the initial DHCP + * request. + * We don't bother with the coarse timer (1 minute) which handles the + * DHCP lease renewal. + */ + sys_timeout(500, call_lwip_dhcp_fine_tmr, NULL); + start = get_timer(0); + dhcp_start(netif); + + /* Wait for DHCP to complete */ + do { + eth_rx(); + sys_check_timeouts(); + bound = dhcp_supplied_address(netif); + if (bound) + break; + } while (get_timer(start) < DHCP_TIMEOUT_MS); + + sys_untimeout(call_lwip_dhcp_fine_tmr, NULL); + + if (!bound) + return CMD_RET_FAILURE; + + dhcp = netif_dhcp_data(netif); + + env_set("bootfile", dhcp->boot_file_name); + if (dhcp->offered_gw_addr.addr != 0) { + + env_set("gatewayip", ip4addr_ntoa(&dhcp->offered_gw_addr)); + /* Set this interface as the default for IP routing */ + netif_set_default(netif); + } + env_set("ipaddr", ip4addr_ntoa(&dhcp->offered_ip_addr)); + env_set("netmask", ip4addr_ntoa(&dhcp->offered_sn_mask)); + env_set("serverip", ip4addr_ntoa(&dhcp->server_ip_addr)); +#ifdef CONFIG_PROT_DNS_LWIP + env_set("dnsip", ip4addr_ntoa(dns_getserver(0))); + env_set("dnsip2", ip4addr_ntoa(dns_getserver(1))); +#endif +#ifdef CONFIG_CMD_TFTPBOOT + if (dhcp->boot_file_name[0] != '\0') + strncpy(boot_file_name, dhcp->boot_file_name, + sizeof(boot_file_name)); +#endif + + printf("DHCP client bound to address %pI4 (%lu ms)\n", + &dhcp->offered_ip_addr, get_timer(start)); + + return CMD_RET_SUCCESS; +} + +int dhcp_run(ulong addr, const char *fname, bool autoload) +{ + char *dhcp_argv[] = {"dhcp", NULL, }; + struct cmd_tbl cmdtp = {}; /* dummy */ + + if (autoload) { + /* Will be supported when TFTP is added */ + return -EOPNOTSUPP; + } + + return do_dhcp(&cmdtp, 0, 1, dhcp_argv); +} diff --git a/net-lwip/eth_internal.h b/net-lwip/eth_internal.h new file mode 100644 index 00000000000..0b829a8d388 --- /dev/null +++ b/net-lwip/eth_internal.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * (C) Copyright 2001-2015 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * Joe Hershberger, National Instruments + */ + +#ifndef __ETH_INTERNAL_H +#define __ETH_INTERNAL_H + +/* Do init that is common to driver model and legacy networking */ +void eth_common_init(void); + +/** + * eth_env_set_enetaddr_by_index() - set the MAC address environment variable + * + * This sets up an environment variable with the given MAC address (@enetaddr). + * The environment variable to be set is defined by <@base_name><@index>addr. + * If @index is 0 it is omitted. For common Ethernet this means ethaddr, + * eth1addr, etc. + * + * @base_name: Base name for variable, typically "eth" + * @index: Index of interface being updated (>=0) + * @enetaddr: Pointer to MAC address to put into the variable + * Return: 0 if OK, other value on error + */ +int eth_env_set_enetaddr_by_index(const char *base_name, int index, + uchar *enetaddr); + +int eth_mac_skip(int index); +void eth_current_changed(void); +void eth_set_dev(struct udevice *dev); +void eth_set_current_to_next(void); + +#endif diff --git a/net-lwip/net-lwip.c b/net-lwip/net-lwip.c new file mode 100644 index 00000000000..886028b68c3 --- /dev/null +++ b/net-lwip/net-lwip.c @@ -0,0 +1,224 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* Copyright (C) 2024 Linaro Ltd. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* xx:xx:xx:xx:xx:xx\0 */ +#define MAC_ADDR_STRLEN 18 + +#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER) +void (*push_packet)(void *, int len) = 0; +#endif +int net_restart_wrap; +static uchar net_pkt_buf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN]; +uchar *net_rx_packets[PKTBUFSRX]; +uchar *net_rx_packet; +uchar *net_tx_packet; + +static err_t low_level_output(struct netif *netif, struct pbuf *p) +{ + int err; + + /* switch dev to active state */ + eth_init_state_only(); + + err = eth_send(p->payload, p->len); + if (err) { + log_err("eth_send error %d\n", err); + return ERR_ABRT; + } + return ERR_OK; +} + +static err_t net_lwip_if_init(struct netif *netif) +{ +#if LWIP_IPV4 + netif->output = etharp_output; +#endif + netif->linkoutput = low_level_output; + netif->mtu = 1500; + netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP; + + return ERR_OK; +} + +static void eth_init_rings(void) +{ + static bool called; + int i; + + if (called) + return; + called = true; + + net_tx_packet = &net_pkt_buf[0] + (PKTALIGN - 1); + net_tx_packet -= (ulong)net_tx_packet % PKTALIGN; + for (i = 0; i < PKTBUFSRX; i++) + net_rx_packets[i] = net_tx_packet + (i + 1) * PKTSIZE_ALIGN; +} + +int net_lwip_init(void) +{ + ip4_addr_t ipaddr, netmask, gw; + struct netif *unetif; + struct udevice *udev; + int ret; + unsigned char env_enetaddr[ARP_HLEN]; + const struct udevice *dev; + struct uclass *uc; + + eth_set_current(); + + udev = eth_get_dev(); + if (!udev) { + log_err("no active eth device\n"); + return ERR_IF; + } + + eth_init_rings(); + + ret = eth_init(); + if (ret) { + log_err("eth_init error %d\n", ret); + return ERR_IF; + } + + uclass_id_foreach_dev(UCLASS_ETH, dev, uc) { + char ipstr[IP4ADDR_STRLEN_MAX]; + char maskstr[IP4ADDR_STRLEN_MAX]; + char gwstr[IP4ADDR_STRLEN_MAX]; + char hwstr[MAC_ADDR_STRLEN]; + char *env; + + eth_env_get_enetaddr_by_index("eth", dev_seq(dev), env_enetaddr); + log_info("eth%d: %s %pM %s\n", dev_seq(dev), dev->name, env_enetaddr, + udev == dev ? "active" : ""); + + unetif = malloc(sizeof(struct netif)); + if (!unetif) + return ERR_MEM; + memset(unetif, 0, sizeof(struct netif)); + + ip4_addr_set_zero(&gw); + ip4_addr_set_zero(&ipaddr); + ip4_addr_set_zero(&netmask); + + if (dev_seq(dev) == 0) { + snprintf(ipstr, IP4ADDR_STRLEN_MAX, "ipaddr"); + snprintf(maskstr, IP4ADDR_STRLEN_MAX, "netmask"); + snprintf(gwstr, IP4ADDR_STRLEN_MAX, "gw"); + } else { + snprintf(ipstr, IP4ADDR_STRLEN_MAX, "ipaddr%d", dev_seq(dev)); + snprintf(maskstr, IP4ADDR_STRLEN_MAX, "netmask%d", dev_seq(dev)); + snprintf(gwstr, IP4ADDR_STRLEN_MAX, "gw%d", dev_seq(dev)); + } + snprintf(hwstr, MAC_ADDR_STRLEN, "%pM", env_enetaddr); + snprintf(unetif->name, 2, "%d", dev_seq(dev)); + + string_to_enetaddr(hwstr, unetif->hwaddr); + unetif->hwaddr_len = ETHARP_HWADDR_LEN; + + env = env_get(ipstr); + if (env) + ipaddr_aton(env, &ipaddr); + + env = env_get(maskstr); + if (env) + ipaddr_aton(env, &netmask); + + if (!netif_add(unetif, &ipaddr, &netmask, &gw, + unetif, net_lwip_if_init, netif_input)) { + log_err("err: netif_add failed!\n"); + free(unetif); + return ERR_IF; + } + + netif_set_up(unetif); + netif_set_link_up(unetif); + } + + return CMD_RET_SUCCESS; +} + +/* + * Return the current network interface for lwIP. In other words, the struct + * netif that corresponds to eth_get_dev(). + */ +struct netif *net_lwip_get_netif(void) +{ + int idx; + + idx = eth_get_dev_index(); + if (idx < 0) + return NULL; + + return netif_get_by_index(idx + 1); +} + +int net_init(void) +{ + return net_lwip_init(); +} + +static struct pbuf *alloc_pbuf_and_copy(uchar *data, int len) +{ + struct pbuf *p, *q; + + /* We allocate a pbuf chain of pbufs from the pool. */ + p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL); + if (!p) { + LINK_STATS_INC(link.memerr); + LINK_STATS_INC(link.drop); + return NULL; + } + + for (q = p; q != NULL; q = q->next) { + memcpy(q->payload, data, q->len); + data += q->len; + } + + LINK_STATS_INC(link.recv); + + return p; +} + +void net_process_received_packet(uchar *in_packet, int len) +{ + struct netif *netif; + struct pbuf *pbuf; + + if (len < ETHER_HDR_SIZE) + return; + +#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER) + if (push_packet) { + (*push_packet)(in_packet, len); + return; + } +#endif + + netif = net_lwip_get_netif(); + if (!netif) + return; + + pbuf = alloc_pbuf_and_copy(in_packet, len); + if (!pbuf) + return; + + netif->input(pbuf, netif); +} + +u32_t sys_now(void) +{ + return get_timer(0); +} diff --git a/net-lwip/tftp.c b/net-lwip/tftp.c new file mode 100644 index 00000000000..1fa246f55d9 --- /dev/null +++ b/net-lwip/tftp.c @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024 Linaro Ltd. */ + +#include +#include + +int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + /* Not implemented */ + return CMD_RET_FAILURE; +} From patchwork Fri May 24 16:19:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798693 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp800216wrw; Fri, 24 May 2024 09:22:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXpUAzT/Gf1SfSFe9OrBHK/xfZfV46TxpPURbYKVNdsOEFwwuR5nZEUFqh7WS7le/1spxfYCgRHAvxyA8ALYzPF X-Google-Smtp-Source: AGHT+IGuf2duKNfppUpKkgAmR2pJt75MQUaRMKS3gwmA1A+6+0X7SxiN8JfBFqtoVQNrdyyWTduq X-Received: by 2002:a50:cdc2:0:b0:578:37a4:c67d with SMTP id 4fb4d7f45d1cf-578519908fcmr1960352a12.22.1716567744715; Fri, 24 May 2024 09:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716567744; cv=none; d=google.com; s=arc-20160816; b=w5txL40+EVzAavYyl2UQmMbMmmJeofQ9G9oueSI+AaBq3zY9JfE/6VOURkx31l+8W3 AbplJOZXO26XbEZQv+Bwiix3bmZnCL1JFchfK+SImZgJc3COrQ2ILoBKBfeOE00oi/4/ 4ww7Keo3RjDIQyQej8lcfT2VIz2E97Cv3zu9D6TjEuS4hbIo+2KOB5EHur9WRJm0rDue RsLrkFSyTzLR+wXitgRekdG4WRs+/xIRoLf7/ZWcTnyCVXvAoHxsD+J7fYWbrCbRT5kd w9gSsPYuA/o3ZmixGOmG5W0BS/ujLjS4lOkRUs3r1QZBjCmDvZMYd/VOz9AtookGHt51 UGcQ== 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=R00WIUp7S/NsY8Gw7Sp0lsVx5QNHhMW2f0XZWPnOEDw=; fh=y2nlSdy1rqA5NrxJUQRURuS/z+wpts0xge8v0NIVeLA=; b=dHL5Mj3qTkBuWlT5OOjZgY9udtD/HLz97ApTFPtkg9eDHRGMWkuQykQru4bFaPL6si Fo85HZCccuDzoGoTA+ck0hHF0nthGrXFFqa+jxpZky857hurTs37yy2zzuS+RmsK6BfU /bGOMZY3J+ltCsi0LUIqhptqKJ/G8MUZ6PZd0BX93PxlBm1qX63DLTukafb5wmF+yBCO Yh/pY3WrhHpVj7+GWD9iF73VNsV1a2FbzjC1no/XSrR9+S5vIG9sOWctBfP2EDxslTne BSPX2hEgIHXLhNcn7xHMlYTw3hiwMaFz9S/UbfgakXX6QQvAtIwnduuLHF0e3GWQ+hX+ 1GDg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XLN0fxA1; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57852495ee0si963206a12.382.2024.05.24.09.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:24 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XLN0fxA1; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 D28F6888C7; Fri, 24 May 2024 18:22:18 +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="XLN0fxA1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E0A26888B7; Fri, 24 May 2024 18:22:16 +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-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 48B3C88552 for ; Fri, 24 May 2024 18:22:14 +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-wr1-x429.google.com with SMTP id ffacd0b85a97d-351da5838fcso7124495f8f.1 for ; Fri, 24 May 2024 09:22:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567733; x=1717172533; 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=R00WIUp7S/NsY8Gw7Sp0lsVx5QNHhMW2f0XZWPnOEDw=; b=XLN0fxA1GARbDfYQix/iInQn6Xrh2OS+vylu3HTHxWb8Pbn0TJTTK98AuBZyeufuEq LDzHCA19UTdRzunBzsmSEVdZgH0v5GVyT3OYV0ZBv5D33tyckUzvGXf9S3oQp8OqMiI4 mNJTunej97w7lPBzn1H6rN/aEBdHYvZ6SqD3eq8kmguip9Zg/H8k51BQyEK62JNgrD/L d1nmpyr1RyzQuUH1q2m8mYiWbeLP02vp3WAIiJ7eacjtR2HJT0NjJdT4vFOK0wkFKFxm zTiKyBFl5Xl1RDF6V7zyEwquK+qHz4xX/SGefc5oxm51gqF6AqOUl9nZJcHiU+wvIaw2 fl/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567733; x=1717172533; 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=R00WIUp7S/NsY8Gw7Sp0lsVx5QNHhMW2f0XZWPnOEDw=; b=wUEeNTFw5T7ZicDRyWREnsPBUJgI0UdQjsoDwCiHVVGLlfoTTCEfHRanj07ayaeaX+ PPuoc7guB72nVSkS3NNR7X6ykVlCBaciHNeUWFeV93nomarjESR6NFChzCIQ1O/jh5m7 3qwxxFsjNz82kXKzdFPIxFJDGRD4S//hqHkVvoqjuk9Zz+gcFhfaHEUEltaNMJKDNKgp lLL+2ERlf3jTo9v3fmXq2KRXKgzlF3yediIiyZhXsCDVDqOth9JqWEQrVRsVk3nsm+pF HmefO16o9GWKt+bJDZgd9QzlqnXBS1uJlbfo3nCeNxQJvKuNZP/XP7WJYyMJAg3IlhFB xynA== X-Gm-Message-State: AOJu0Yy1EvI5EqSa+MZd+wQ8OMfAZkmQpx0VHJxceIwhI5ufP72y8kzW bFZPlKRv1jELm44Q+zox8rqYq6FzPp7VkM1Q1lW5RSjnqc4myJHgdt2vIEwHShmbhfRgolmNIZF i2Mz32d9c X-Received: by 2002:a5d:68c1:0:b0:354:e0e8:e8bd with SMTP id ffacd0b85a97d-35527056169mr1827286f8f.49.1716567733494; Fri, 24 May 2024 09:22:13 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:13 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Simon Glass , Mattijs Korpershoek , AKASHI Takahiro , Francis Laniel , Peter Robinson Subject: [PATCH v2 05/14] net-lwip: add TFTP support and tftpboot command Date: Fri, 24 May 2024 18:19:59 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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 Implement do_tftpb(). Signed-off-by: Jerome Forissier --- cmd/Kconfig | 3 +- cmd/net-lwip.c | 8 ++ net-lwip/dhcp.c | 11 ++- net-lwip/tftp.c | 206 +++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 223 insertions(+), 5 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 1bfa528e945..94a8de266f6 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2101,10 +2101,9 @@ config CMD_DHCP config CMD_TFTPBOOT bool "tftp" select PROT_UDP_LWIP - default n + default y help tftpboot - load file via network using TFTP protocol - Currently a placeholder (not implemented) endif diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c index 966d7226eda..490a2e4ac5c 100644 --- a/cmd/net-lwip.c +++ b/cmd/net-lwip.c @@ -11,3 +11,11 @@ U_BOOT_CMD( "[loadAddress] [[hostIPaddr:]bootfilename]" ); #endif + +#if defined(CONFIG_CMD_TFTPBOOT) +U_BOOT_CMD( + tftpboot, 3, 0, do_tftpb, + "boot image via network using TFTP protocol\n", + "[loadAddress] [[hostIPaddr:]bootfilename]" +); +#endif diff --git a/net-lwip/dhcp.c b/net-lwip/dhcp.c index d1d35999b04..7bacc234f1e 100644 --- a/net-lwip/dhcp.c +++ b/net-lwip/dhcp.c @@ -94,11 +94,20 @@ int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) int dhcp_run(ulong addr, const char *fname, bool autoload) { char *dhcp_argv[] = {"dhcp", NULL, }; +#ifdef CONFIG_CMD_TFTPBOOT + char *tftp_argv[] = {"tftpboot", boot_file_name, NULL, }; +#endif struct cmd_tbl cmdtp = {}; /* dummy */ if (autoload) { - /* Will be supported when TFTP is added */ +#ifdef CONFIG_CMD_TFTPBOOT + /* Assume DHCP was already performed */ + if (boot_file_name[0]) + return do_tftpb(&cmdtp, 0, 2, tftp_argv); + return 0; +#else return -EOPNOTSUPP; +#endif } return do_dhcp(&cmdtp, 0, 1, dhcp_argv); diff --git a/net-lwip/tftp.c b/net-lwip/tftp.c index 1fa246f55d9..19bf083d995 100644 --- a/net-lwip/tftp.c +++ b/net-lwip/tftp.c @@ -2,10 +2,212 @@ /* Copyright (C) 2024 Linaro Ltd. */ #include +#include +#include +#include +#include +#include +#include #include +#include + +static ulong daddr; +static ulong size; +static ulong prevsize; +#define PROGRESS_PRINT_STEP_BYTES (100 * 1024) +static ulong start_time; +static enum done_state { + NOT_DONE = 0, + SUCCESS = 1, + FAILURE = 2 +} done; + +static void *tftp_open(const char *fname, const char *mode, u8_t is_write) +{ + return NULL; +} + +static void tftp_close(void *handle) +{ + ulong elapsed; + + if (done == FAILURE) { + /* Closing after an error */ + return; + } + + elapsed = get_timer(start_time); + done = SUCCESS; + log_info("\n%lu bytes transferred in %lu ms (", size, + get_timer(start_time)); + print_size(size / elapsed * 1000, "/s)\n"); + + + if (env_set_hex("filesize", size)) { + log_err("filesize not updated\n"); + return; + } +} + +static int tftp_read(void *handle, void *buf, int bytes) +{ + return 0; +} + +static int tftp_write(void *handle, struct pbuf *p) +{ + struct pbuf *q; + + for (q = p; q != NULL; q = q->next) { + memcpy((void *)daddr, q->payload, q->len); + daddr += q->len; + size += q->len; + if (size - prevsize > PROGRESS_PRINT_STEP_BYTES) { + printf("#"); + prevsize = size; + } + } + + return 0; +} + +static void tftp_error(void *handle, int err, const char *msg, int size) +{ + char message[100]; + + done = FAILURE; + memset(message, 0, sizeof(message)); + memcpy(message, msg, LWIP_MIN(sizeof(message) - 1, (size_t)size)); + + log_info("\nTFTP error: %d (%s)\n", err, message); +} + +static const struct tftp_context tftp_context = { + tftp_open, + tftp_close, + tftp_read, + tftp_write, + tftp_error +}; + +static int tftp_run(ulong addr, char *fname, ip_addr_t srvip) +{ + void *f = (void *)0x1; /* unused fake file handle*/ + err_t err; + + if (!fname || addr == 0) + return -1; + + done = NOT_DONE; + size = 0; + prevsize = 0; + daddr = addr; + + log_info("TFTP from server %s; our IP address is %s\n", + ip4addr_ntoa(&srvip), env_get("ipaddr")); + log_info("Filename '%s'.\n", fname); + log_info("Load address: 0x%lx\n", daddr); + log_info("Loading: "); + + err = tftp_init_client(&tftp_context); + if (!(err == ERR_OK || err == ERR_USE)) + log_err("tftp_init_client err: %d\n", err); + + start_time = get_timer(0); + err = tftp_get(f, &srvip, TFTP_PORT, fname, TFTP_MODE_OCTET); + /* might return different errors, like routing problems */ + if (err != ERR_OK) { + log_err("tftp_get err=%d\n", err); + return -1; + } + + while (!done) { + eth_rx(); + sys_check_timeouts(); + if (ctrlc()) + break; + } + + tftp_cleanup(); + + if (done == SUCCESS) { + if (env_set_hex("fileaddr", addr)) { + log_err("fileaddr not updated\n"); + return -1; + } + return 0; + } + + return -1; +} int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - /* Not implemented */ - return CMD_RET_FAILURE; + char *fname; + char *server_ip; + ip_addr_t srvip; + ulong addr; + char *end; + char *col; + + image_load_addr = env_get_ulong("loadaddr", 16, image_load_addr); + + switch (argc) { + case 1: + fname = env_get("bootfile"); + break; + case 2: + /* + * Only one arg - accept two forms: + * Just load address, or just boot file name. The latter + * form must be written in a format which can not be + * mis-interpreted as a valid number. + */ + addr = hextoul(argv[1], &end); + if (end == (argv[1] + strlen(argv[1]))) { + image_load_addr = addr; + fname = env_get("bootfile"); + } else { + fname = argv[1]; + } + break; + case 3: + image_load_addr = hextoul(argv[1], NULL); + fname = argv[2]; + break; + default: + return CMD_RET_USAGE; + } + + col = strchr(fname, ':'); + if (col) { + server_ip = fname; + *col = '\0'; + fname = col + 1; + } else { + server_ip = env_get("serverip"); + if (!server_ip) { + log_err("error: serverip variable has to be set\n"); + return CMD_RET_FAILURE; + } + } + if (!ipaddr_aton(server_ip, &srvip)) { + log_err("error: ipaddr_aton\n"); + return CMD_RET_FAILURE; + } + + if (!fname) { + log_err("error: no file name\n"); + return CMD_RET_FAILURE; + } + + if (!image_load_addr) { + log_err("error: no load address\n"); + return CMD_RET_FAILURE; + } + + if (tftp_run(image_load_addr, fname, srvip) < 0) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; } From patchwork Fri May 24 16:20:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798694 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp800295wrw; Fri, 24 May 2024 09:22:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXWjcQ4Yg4xFFw2PIsAloO5mx/+/O8zbsQ6LDwgkSpJ7FO0u5RHCiGIRzMvsqkXY3xRdeu3j83b5I7tweFKaSaa X-Google-Smtp-Source: AGHT+IHc3d7KHw57hZqDFSRnIqOzwIVE1Bbl65afwVlX25MMgIwR8qkeOGP9gQD24rC511aerO0C X-Received: by 2002:a05:6512:4010:b0:51d:4c8a:bbdb with SMTP id 2adb3069b0e04-529652905b0mr2907867e87.3.1716567754993; Fri, 24 May 2024 09:22:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716567754; cv=none; d=google.com; s=arc-20160816; b=VF8DAEEtUFMXZKGmNDQifDS26zZX1WqN/EQ0Nz+QMuqZ3tPlThbXSX1plw4wYToysB dGwihQmIg3LcjfNV7o45njuIDOASWoDNlVPJCL56f+5IxtEw05+tYo7gAsK8Mg6f1D26 OGz5sTxBKl1uhhOUk+pShav7mGfwSWZwn7cvcqvSiRucmCc0DnN9uK2KjIce7jeAc5vr Ci18P8I+biY7LNqvHh9VsA3G9vJEr1UT/59CxHQ6fZfo4dx5npA/naEbBnzuwghU5xf3 WznZlq+v2oWYGKcCBxNVn/8djJwp/SUUrAO8ls3hIO1l++7Jh/ENESc7Egx1v7XauQVg i9Aw== 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=KPSo6ax9gRpD4wFrRQ8eVep44TzYcZH73cIZqamJ2Y8=; fh=Cip3napxigfa/Re1NVhENTTXbUoBAt1SH5qLNiPDDGU=; b=T8h4O4pZv5sOlpmFnkiP4xRW3kd0kT5YEanzj4bA1W9YK3ISVnXfUx3ms63fj2sHtj wlt/qgpDEB9FHgHpdWqJYorBUq72D4pE0c2RuwRw8mg1fY+Vs4/VNsHN6qW8sc/LacS9 o3JT0D4XEd4btrRoJ8eDZinolnxpLctq9+7+AYyTwFoN4d07asRr7v6kGuV2m6YZ69k7 TblvkNhmzBi7o4ql9wJ+9KlFW5XeNENFPI5AMkJ0MuYJk06MyOTqq7sphPc8kxS9Stmm XbxMMA9hgOHfGpQrIjINTTkJNwdflX9Dvn2IGkqKrmoIUxlpGYgJqCuYynuXFBa6o0qX OocA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LluGMCPJ; 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 a640c23a62f3a-a626cdd5566si94797566b.1030.2024.05.24.09.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:34 -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=LluGMCPJ; 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 437B9888B5; Fri, 24 May 2024 18:22:20 +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="LluGMCPJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2E67B888D6; Fri, 24 May 2024 18:22:19 +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-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 AC8A8888B2 for ; Fri, 24 May 2024 18:22:16 +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-wr1-x42c.google.com with SMTP id ffacd0b85a97d-354f51ac110so2723264f8f.0 for ; Fri, 24 May 2024 09:22:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567736; x=1717172536; 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=KPSo6ax9gRpD4wFrRQ8eVep44TzYcZH73cIZqamJ2Y8=; b=LluGMCPJ1yAuEdr1hO0CeQODkJbWip2LgHeSEkVSLcS0UBE0EFjcEa7G6cvoDHpgLu myehcaVYi7g+Zco9SZBaN5yeX0Bg5ZpLRGSpCNJT9/SXX/kqM+kw96laYLq88Jt5gNCv e0n/hxWbvmImFMtDsFQ2+GtSfPtXppGUWyfo7twe+ztF1aR0ANIgg26E5efOER+ZK+6R FqSllx75BGTZ1wcfBK+/gqAULpZpX58kQWsOVrGFUj9ouhhBELkz40iWuXNnEzFQAbuh Wtwf9XIRQME834QZKmgWBGPrX3nIu3X3Tc0XJ5yJel/nHaUqLJiC1gFBlxXsa5pIwxbr YlXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567736; x=1717172536; 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=KPSo6ax9gRpD4wFrRQ8eVep44TzYcZH73cIZqamJ2Y8=; b=lfmsJCcginAG8fe2mGHalwotx+tNKKVHVaFfVvlktSoHt0PpWvq6kOMUU5ZZjH8KEM 78BShcTbM9FJ8AXljWGLCG+cOvcfAsNeUbpbuHg9wwZvwYRlP10L52ij/4MnFWQFrbRn n+3td36ppmm6+9wDzWhhBWGoWtM+oawn5tdzmy7FgewmUaDiUjwvDm71c8n+iGRioq75 6dBUnLEXmOw+YgkEOwPBUFLhv4dsab3DDeInB6obMRx//Ouz1Oe+7wX3hre8vJqqmnAR MO7cPir/wbmOXkJXm2C6DWIl1Vo39ACw8dabmw/LiRzN4z5K5a6d1foQpKjUCtVTqJ+M y6zA== X-Gm-Message-State: AOJu0YyrcIFoHysXamCN49ylt3iDl1vBhkegrayRk4Z6mbEGhxx0jOXf M7HQfKhsBo3nkmA5LbZ0ybVRiVBDLO7FieOmXaLM/Ao3Y57DJIRwu2iaXbSHdV0GCxpnpAS7jSA s3NeCcObx X-Received: by 2002:a5d:5254:0:b0:355:1bf:98c7 with SMTP id ffacd0b85a97d-3552fda9edcmr2272816f8f.34.1716567736014; Fri, 24 May 2024 09:22:16 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:15 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Simon Glass , Eddie James , Mattijs Korpershoek , AKASHI Takahiro , Michal Simek , Francis Laniel , Peter Robinson Subject: [PATCH v2 06/14] net-lwip: add ping command Date: Fri, 24 May 2024 18:20:00 +0200 Message-Id: <284076d79cd331cf1a4923e0cea32fefc4c14fba.1716566960.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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 support for the the ping command with NET_LWIP. The implementation is derived from lwIP's contrib/apps/ping/ping.c. Signed-off-by: Jerome Forissier --- boot/Kconfig | 2 +- cmd/Kconfig | 6 ++ cmd/net-lwip.c | 8 +++ include/net-lwip.h | 3 + net-lwip/Makefile | 1 + net-lwip/ping.c | 171 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 190 insertions(+), 1 deletion(-) create mode 100644 net-lwip/ping.c diff --git a/boot/Kconfig b/boot/Kconfig index 004e69dd92a..983a284ec52 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -379,7 +379,7 @@ config BOOT_DEFAULTS_CMDS select CMD_FS_GENERIC select CMD_PART if PARTITIONS select CMD_DHCP if CMD_NET || CMD_NET_LWIP - select CMD_PING if CMD_NET + select CMD_PING if CMD_NET || CMD_NET_LWIP select CMD_PXE if CMD_NET select CMD_BOOTI if ARM64 select CMD_BOOTZ if ARM && !ARM64 diff --git a/cmd/Kconfig b/cmd/Kconfig index 94a8de266f6..07cfe824e3f 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2098,6 +2098,12 @@ config CMD_DHCP help Boot image via network using DHCP/TFTP protocol +config CMD_PING + bool "ping" + select PROT_RAW_LWIP + help + Send ICMP ECHO_REQUEST to network host + config CMD_TFTPBOOT bool "tftp" select PROT_UDP_LWIP diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c index 490a2e4ac5c..13856703fcf 100644 --- a/cmd/net-lwip.c +++ b/cmd/net-lwip.c @@ -12,6 +12,14 @@ U_BOOT_CMD( ); #endif +#if defined(CONFIG_CMD_PING) +U_BOOT_CMD( + ping, 2, 1, do_ping, + "send ICMP ECHO_REQUEST to network host", + "pingAddress" +); +#endif + #if defined(CONFIG_CMD_TFTPBOOT) U_BOOT_CMD( tftpboot, 3, 0, do_tftpb, diff --git a/include/net-lwip.h b/include/net-lwip.h index 2308703e46b..2abaaa3b4e3 100644 --- a/include/net-lwip.h +++ b/include/net-lwip.h @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -50,6 +51,7 @@ int eth_env_get_enetaddr_by_index(const char *base_name, int index, int eth_init(void); /* Initialize the device */ int eth_send(void *packet, int length); /* Send a packet */ int eth_rx(void); +const char *eth_get_name(void); int eth_get_dev_index(void); int eth_init_state_only(void); /* Set active state */ void eth_set_current(void); /* set nterface to ethcur var */ @@ -80,6 +82,7 @@ int net_lwip_init(void); struct netif *net_lwip_get_netif(void); int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); +int do_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); #endif /* __NET_LWIP_H__ */ diff --git a/net-lwip/Makefile b/net-lwip/Makefile index a56c32bfa74..e68d4e24197 100644 --- a/net-lwip/Makefile +++ b/net-lwip/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_$(SPL_)DM_ETH) += ../net/eth_common.o obj-$(CONFIG_$(SPL_)DM_ETH) += ../net/eth-uclass.o obj-$(CONFIG_$(SPL_)DM_ETH) += net-lwip.o obj-$(CONFIG_CMD_DHCP) += dhcp.o +obj-$(CONFIG_CMD_PING) += ping.o obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o # Disable this warning as it is triggered by: diff --git a/net-lwip/ping.c b/net-lwip/ping.c new file mode 100644 index 00000000000..763a9bb1e38 --- /dev/null +++ b/net-lwip/ping.c @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024 Linaro Ltd. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PING_DELAY_MS 1000 +#define PING_TIMEOUT_MS 10000 +/* Additional data size to include in the packet */ +#define PING_DATA_SIZE 32 +/* Ping identifier - must fit on a u16_t */ +#define PING_ID 0xAFAF + +static const ip_addr_t *ping_target; +static struct raw_pcb *ping_pcb; +static u16_t ping_seq_num; +static bool ping_target_alive; + +static u8_t ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, + const ip_addr_t *addr) +{ + struct icmp_echo_hdr *iecho; + + if (addr->addr != ping_target->addr) + return 0; + + if ((p->tot_len >= (IP_HLEN + sizeof(struct icmp_echo_hdr))) && + pbuf_remove_header(p, IP_HLEN) == 0) { + iecho = (struct icmp_echo_hdr *)p->payload; + + if ((iecho->id == PING_ID) && + (iecho->seqno == lwip_htons(ping_seq_num))) { + ping_target_alive = true; + printf("host %s is alive\n", ipaddr_ntoa(addr)); + pbuf_free(p); + return 1; /* eat the packet */ + } + /* not eaten, restore original packet */ + pbuf_add_header(p, IP_HLEN); + } + + return 0; /* don't eat the packet */ +} + +static int ping_raw_init(void) +{ + ping_pcb = raw_new(IP_PROTO_ICMP); + if (!ping_pcb) + return -ENOMEM; + + raw_recv(ping_pcb, ping_recv, NULL); + raw_bind(ping_pcb, IP_ADDR_ANY); + + return 0; +} + +static void ping_raw_stop(void) +{ + if (ping_pcb != NULL) { + raw_remove(ping_pcb); + ping_pcb = NULL; + } +} + +static void ping_prepare_echo(struct icmp_echo_hdr *iecho, u16_t len) +{ + size_t i; + size_t data_len = len - sizeof(struct icmp_echo_hdr); + + ICMPH_TYPE_SET(iecho, ICMP_ECHO); + ICMPH_CODE_SET(iecho, 0); + iecho->chksum = 0; + iecho->id = PING_ID; + iecho->seqno = lwip_htons(++ping_seq_num); + + /* Fill the additional data buffer with some data */ + for(i = 0; i < data_len; i++) { + ((char *)iecho)[sizeof(struct icmp_echo_hdr) + i] = (char)i; + } + + iecho->chksum = inet_chksum(iecho, len); +} + +static void ping_send_icmp(struct raw_pcb *raw, const ip_addr_t *addr) +{ + struct pbuf *p; + struct icmp_echo_hdr *iecho; + size_t ping_size = sizeof(struct icmp_echo_hdr) + PING_DATA_SIZE; + + p = pbuf_alloc(PBUF_IP, (u16_t)ping_size, PBUF_RAM); + if (!p) + return; + + if ((p->len == p->tot_len) && (p->next == NULL)) { + iecho = (struct icmp_echo_hdr *)p->payload; + ping_prepare_echo(iecho, (u16_t)ping_size); + raw_sendto(raw, p, addr); + } + + pbuf_free(p); +} + +static void ping_send(void *arg) +{ + struct raw_pcb *pcb = (struct raw_pcb *)arg; + + ping_send_icmp(pcb, ping_target); + sys_timeout(PING_DELAY_MS, ping_send, ping_pcb); +} + +static int ping_loop(const ip_addr_t* addr) +{ + ulong start; + int ret; + + printf("Using %s device\n", eth_get_name()); + + ret = ping_raw_init(); + if (ret < 0) + return ret; + ping_target = addr; + + start = get_timer(0); + ping_send(ping_pcb); + + do { + eth_rx(); + if (ping_target_alive) + break; + sys_check_timeouts(); + if (ctrlc()) { + printf("\nAbort\n"); + break; + } + } while (get_timer(start) < PING_TIMEOUT_MS); + + sys_untimeout(ping_send, ping_pcb); + ping_raw_stop(); + ping_target = NULL; + + if (ping_target_alive) { + ping_target_alive = false; + return 0; + } + printf("ping failed; host %s is not alive\n", ipaddr_ntoa(addr)); + return -1; +} + +int do_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + ip_addr_t addr; + + if (argc < 2) + return CMD_RET_USAGE; + + if (!ipaddr_aton(argv[1], &addr)) + return CMD_RET_USAGE; + + if (ping_loop(&addr) < 0) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; +} From patchwork Fri May 24 16:20:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798695 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp800394wrw; Fri, 24 May 2024 09:22:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVozI+CC87/nvAeNY4lMvpQgjAc2ODSUZAd9YMvlQCyzocytVng8RmUCT9EscR/4RoSwe82vt6F7SLe0KdieW0f X-Google-Smtp-Source: AGHT+IHNDQ/tXVNzeLibnRz+vdlr1f8GKzd/byMXaMU8BF8wuUrPfX1rytJ7k1Hpb4e17ue2x3Sj X-Received: by 2002:a17:906:1c55:b0:a59:af4c:c7d1 with SMTP id a640c23a62f3a-a6265119d48mr253337866b.49.1716567766009; Fri, 24 May 2024 09:22:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716567765; cv=none; d=google.com; s=arc-20160816; b=R9NDYakmXlJOTgL61249SWhoT4/clR/9ub8Kf+b7Jndp3fPEv8RFOPOnmWQd/nX49X /HPOvoIyhu9DoY6QocseqDKTFc25qiOJZLagjSQpgoeUmV40bvEKoie98g0Si19cOskf bqBM8UITMdqQMf2+oTAg2ruw9/izamLdO0+PwzNE+qhyEmNyQkTywLw56zrIHGpZSM1V 2UP0BUMCORSG41toAko6tiUzpAAjKbJTt5irc2jNtt3LtiFyz5/JsGPCDyAzSgatiOWa 3KE+R806qmRQar/Osb4mrr+oBILt0YFA55VS0RdtjWrrM5OL9AJsLP6APoMbWQ2K8ya/ 1gSA== 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=tdSfps2fKSJsIeliASQk2uK2thYMlYneoUXH3RnVAhk=; fh=y2nlSdy1rqA5NrxJUQRURuS/z+wpts0xge8v0NIVeLA=; b=bjnK6byavRPdHdZww05zcEUvrXsG5njk3/Zs0ZkF6pSdVYadAQnHvYJpHReghn4bT4 yXuTzNaw66TYVWw8tOm4shtgcur4PwqDDzZQsI6PWv/haD2LL0QqOX44HaJzSQBWJxrj E0nCgaW2VDtXR3K0vsRaZCA2doisEMnXk99FYlj3RLcE1ebJcMne7pMD+ButVh6BbOnA yVXH4crbt9yRJfLL2b5cWuKfzYCCkbURzNAYAiwzzEPgajVvhn2wDPnDrHORYSrOJG4W 2lcbiGImdjeUCw4i7pQlPag4CTRy5dxSsKfZCMl2gR/KOXSa3YfXpAkFMk+8qMRknv+b MPKg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wm+cwLgw; 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 a640c23a62f3a-a626cdcfbe3si96930566b.936.2024.05.24.09.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:45 -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=wm+cwLgw; 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 A6636888C1; Fri, 24 May 2024 18:22:27 +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="wm+cwLgw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 693FA888D0; Fri, 24 May 2024 18:22:26 +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-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 08D2E888CF for ; Fri, 24 May 2024 18:22: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=jerome.forissier@linaro.org Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-354be94c874so2454354f8f.3 for ; Fri, 24 May 2024 09:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567738; x=1717172538; 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=tdSfps2fKSJsIeliASQk2uK2thYMlYneoUXH3RnVAhk=; b=wm+cwLgwEp0LN9cOKQkWLyICtn5sVsvHMXYwA/z/T3bie/DVIVidQumjajrOy28X58 1mVnMrjHk1L4Xev0bV492W9tdA2Rw5gL0amw6h5NTY7XYhFyknj3vdARLEXFpARlAgzC OtjW+dWKQVPed1xiPKpetxOcCc0TYZDIjcl56aTGl4e99y/FfndWc1Q6fQjVT2AebxLM 5+9yQMXFJQAzh8druIPzlSvbLausCxDaZV99EC/UcsIRAAzTdDz0+48KnpRv5PBTX8eu KrPrc/E0H+cQSKQqkp9r6yDExZTkNEeUGOwLRGZUqk/XYLEw8WYFc9+Q6wvoKTT8xCMU B5yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567738; x=1717172538; 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=tdSfps2fKSJsIeliASQk2uK2thYMlYneoUXH3RnVAhk=; b=RstmXPdW4s0ZX3J1I+3ezSp3/ilASCjUEKrDXrE2Hmm3Rr7968FMic+cZZXPne/qTh C2wAGghyQ1mK8gqJfgI8tMWMK5n7rFqHIvOHORuXVpwWcgNINTkRu95EML/m1Q6x8uk3 WEVlgR9b2zgJ+Zmatxd0Pczc2z1IcQrd4sxJmtjgFZ+HoPjvHKk8Du6ix9MFw0joJIqG k1dw67923EspS2JFSuVyeB0YSeQWYtfXWkPLRdUV6yVC/aAH++Q3P7JzJjzxBScV5gHR 5BQ33GCflXm7y8JmuoiFM9fKph7VQ3H8+b5UuvRgKvLpcoYKAz7VmmcDjKFGR/kl+qju AIsA== X-Gm-Message-State: AOJu0YzQa218IRkCJcXsU4u89JtqQ4LcQ/i1JwmTfKZtEdUjZBYRf63q 9Ueu8Va1+af0s8jfJffqw4UODX3zqpVHEpG2vf0v5Uc5RHNtAXYXVFxN7/lSH/IvbaEJY5YS7DX Ht38OrDLg X-Received: by 2002:adf:a35d:0:b0:354:de30:bc1a with SMTP id ffacd0b85a97d-3552fdc6e97mr2554200f8f.46.1716567738224; Fri, 24 May 2024 09:22:18 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:18 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Simon Glass , Mattijs Korpershoek , AKASHI Takahiro , Francis Laniel , Peter Robinson Subject: [PATCH v2 07/14] net-lwip: add dns command Date: Fri, 24 May 2024 18:20:01 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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 CONFIG_CMD_DNS_LWIP depending on CONFIG_NET_LWIP to provide the dns command using lwIP. Signed-off-by: Jerome Forissier --- cmd/Kconfig | 6 +++ cmd/net-lwip.c | 8 ++++ include/net-lwip.h | 1 + net-lwip/Makefile | 1 + net-lwip/dns.c | 107 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 123 insertions(+) create mode 100644 net-lwip/dns.c diff --git a/cmd/Kconfig b/cmd/Kconfig index 07cfe824e3f..6ef0b52cd34 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2098,6 +2098,12 @@ config CMD_DHCP help Boot image via network using DHCP/TFTP protocol +config CMD_DNS + bool "dns" + select PROT_DNS_LWIP + help + Lookup the IP of a hostname + config CMD_PING bool "ping" select PROT_RAW_LWIP diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c index 13856703fcf..3abafdf7969 100644 --- a/cmd/net-lwip.c +++ b/cmd/net-lwip.c @@ -27,3 +27,11 @@ U_BOOT_CMD( "[loadAddress] [[hostIPaddr:]bootfilename]" ); #endif + +#if defined(CONFIG_CMD_DNS) +U_BOOT_CMD( + dns, 3, 1, do_dns, + "lookup the IP of a hostname", + "hostname [envvar]" +); +#endif diff --git a/include/net-lwip.h b/include/net-lwip.h index 2abaaa3b4e3..0019d1524e5 100644 --- a/include/net-lwip.h +++ b/include/net-lwip.h @@ -82,6 +82,7 @@ int net_lwip_init(void); struct netif *net_lwip_get_netif(void); int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); +int do_dns(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); diff --git a/net-lwip/Makefile b/net-lwip/Makefile index e68d4e24197..aa247859483 100644 --- a/net-lwip/Makefile +++ b/net-lwip/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_$(SPL_)DM_ETH) += ../net/eth_common.o obj-$(CONFIG_$(SPL_)DM_ETH) += ../net/eth-uclass.o obj-$(CONFIG_$(SPL_)DM_ETH) += net-lwip.o obj-$(CONFIG_CMD_DHCP) += dhcp.o +obj-$(CONFIG_CMD_DNS) += dns.o obj-$(CONFIG_CMD_PING) += ping.o obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o diff --git a/net-lwip/dns.c b/net-lwip/dns.c new file mode 100644 index 00000000000..6ef9d0b510b --- /dev/null +++ b/net-lwip/dns.c @@ -0,0 +1,107 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024 Linaro Ltd. */ + +#include +#include +#include +#include +#include +#include + +#define DNS_RESEND_MS 1000 +#define DNS_TIMEOUT_MS 10000 + +static ulong start; +static ip_addr_t host_ipaddr; +static bool done; + +static void do_dns_tmr(void *arg) +{ + dns_tmr(); +} + +static void dns_cb(const char *name, const ip_addr_t *ipaddr, void *arg) +{ + char *var = (char *)arg; + char *ipstr = ip4addr_ntoa(ipaddr); + + done = true; + + if (!ipaddr) { + printf("DNS: host not found\n"); + host_ipaddr.addr = 0; + return; + } + + if (var) + env_set(var, ipstr); + + printf("%s\n", ipstr); +} + +int do_dns(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + bool has_server = false; + ip_addr_t ipaddr; + ip_addr_t ns; + char *nsenv; + char *name; + char *var; + int ret; + + if (argc == 1 || argc > 3) + return CMD_RET_USAGE; + + if (argc >= 2) + name = argv[1]; + + if (argc == 3) + var = argv[2]; + + dns_init(); + + nsenv = env_get("dnsip"); + if (nsenv && ipaddr_aton(nsenv, &ns)) { + dns_setserver(0, &ns); + has_server = true; + } + + nsenv = env_get("dnsip2"); + if (nsenv && ipaddr_aton(nsenv, &ns)) { + dns_setserver(1, &ns); + has_server = true; + } + + if (!has_server) { + log_err("No valid name server (dnsip/dnsip2)\n"); + return CMD_RET_FAILURE; + } + + done = false; + + ret = dns_gethostbyname(name, &ipaddr, dns_cb, var); + + if (ret == ERR_OK) { + dns_cb(name, &ipaddr, var); + } else if (ret == ERR_INPROGRESS) { + start = get_timer(0); + sys_timeout(DNS_RESEND_MS, do_dns_tmr, NULL); + do { + eth_rx(); + if (done) + break; + sys_check_timeouts(); + if (ctrlc()) { + printf("\nAbort\n"); + break; + } + } while (get_timer(start) < DNS_TIMEOUT_MS); + sys_untimeout(do_dns_tmr, NULL); + } + + if (done && host_ipaddr.addr != 0) + return CMD_RET_SUCCESS; + + return CMD_RET_FAILURE; +} + From patchwork Fri May 24 16:20:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798697 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp800567wrw; Fri, 24 May 2024 09:23:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWYMb17imDGy48+e3mGHw7vSgxCzDWTAS8Q1G9TSsY95Pf9J4zYhH0LHaFNX2wTx9W3KS9DgQ7E8jANv/rpCCxt X-Google-Smtp-Source: AGHT+IEP7vksA/g0XbzagOGjSRsQNzFdhu5/yPRiBaDwHJ69s/oY/zniOQd/iwnU6F9mIFFrMv+p X-Received: by 2002:a50:8ad1:0:b0:578:5b30:8bfd with SMTP id 4fb4d7f45d1cf-5785b3098cemr1845543a12.21.1716567787670; Fri, 24 May 2024 09:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716567787; cv=none; d=google.com; s=arc-20160816; b=efsGq+qHONciEJlmjoSxIUdPaJeazRrN4Kr8adAdMJAhbAvd6eSJp9lxwySHj8SJDo Vq9CGRcX73clklJ4n1Eqn8Puk9oPV1Oz99n8T+syzM8lLrJIQ+GFn1EpZU2ZNK9pmTV7 quCzxx+WtFq5f2VWHVo3uryuyg2gEpIkNA6jVIp49RVmL5YWKgOopoDXlPV0StqRZLEu J6MlYxjLqpmgJShyNr/v5CGvvj6j1wfDm1zHGRskECfODjaxUiWprO6wEm4ZWWf3JRs+ 5P7ONqdUoQiV8/rcEIGEF+d8eXiApzPkYA+gV17BOQm4TOswKaSWGyPBwl3XsNF81uLQ eX8g== 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=7R29ssZiVYabGuas6GnCUzoUE+PofSMjHPlEXTrhK7s=; fh=1AmNUSOubV+cen/s+13l+ZHMEV9UL00rH4RY61e5eLo=; b=IZVM0M0848arOuWq1ssOpRl92mcvfAjVG6YQ7wJKv+WtEXLmvm1ZEThcYiRhrzhYGx otWWK3kL5DRw2x+ignjaqAXFPJKYeVytcFfxsYXI7VwqmKEsm3vl6C4YzsorK8WkHoQf vqumC5BH9ICZ8c+++R5FSfxG50QhZgCHKKF5Nkmxrcmit7/957UC1u7ULIaadWnsmGU8 83lmigaRbEofXimgcrM2TrJk8IYOjBTJduWd3jhTILHhopjIyo31VLrbdFzrgBONgcrK SrIrSfI134AAEIQEOQTs0xK4I7WZcCJm8dtolEZNgiVTP/4mnYWe3y1npSal/kLFfgYz opkw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qt2Io4+h; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5785247fe85si1026267a12.353.2024.05.24.09.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:23:07 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qt2Io4+h; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 66F0B88640; Fri, 24 May 2024 18:22:30 +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="Qt2Io4+h"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 02D72888B2; Fri, 24 May 2024 18:22:27 +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-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (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 6593E888B9 for ; Fri, 24 May 2024 18:22:22 +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-wr1-x42d.google.com with SMTP id ffacd0b85a97d-35502a992c9so1578350f8f.3 for ; Fri, 24 May 2024 09:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567742; x=1717172542; 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=7R29ssZiVYabGuas6GnCUzoUE+PofSMjHPlEXTrhK7s=; b=Qt2Io4+h2mhJ1WssiF4p09jl1TrMiTM1G5xUAFk8q5PMWzuxj9NJ7MfXedO6jNIWsC khKImbL1A/k3UCGxOVfPeZeZC+NoaspFBnfpcOBMJY71+XQeMAsCuVuFanX4JGldZNs0 m6G23MKkKLyX0nQ0ry54cZzOc/CkwQ6NItnes+cl5024okgqyZLf4+4hMj0AnUeBg7iQ sG37lBE40lLn5SJZX5/qjPiVrvJW3WmmKMlKVQ11wKK9rcdDi5mCOxuqpLLI7L33da4s YnPZKAaznRISSGz5/N2FjEypWLrGoHv2vgrgrZGswqMVr92eTIngPW1AHiv7JbEOf3ee OEnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567742; x=1717172542; 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=7R29ssZiVYabGuas6GnCUzoUE+PofSMjHPlEXTrhK7s=; b=xEbgz9eOO/hYbgMt24kp4jA8r1JYUh0FbTtjic4LtwaNiHJ7mxiwDYveaudROBDO5q IAWyQxLRRXAKlvEHEpP6683lJteEYgYDhqqglKRSjZT6lJ8P2OzLCjACk+DIfdu/53dX vKBzWOLE6MsUBx45j7RzTU+ilqT1Nl4fWUIc5r63/PIgNSUZGjdyJgLlCTX9WcFe2YrL e3ifobJckuH5KbP3gZ6kOd1uoQfWQvyLPplkf/uZ4e7PKaLX0fUYnBFrjivbjlHBR6So JlDKOI5Ff8m33U8WweTSeVdPMBdyeKUsA7WCgX5RSnoGeI9ECNxhE4YnPm1qPo1VrfQM Q/mA== X-Gm-Message-State: AOJu0YxbPluBx6K6YOGR2fnyaBfZmlwlI+I78wX3u6YDy2v/IY5wrOnJ 30g/fFgBvkvNhXUQ4uNI6NKsQeJJ+Ih5IARJ5f6jZSrtsrRG/rWcpFKvG+S+2oHGIOcR8RcKTkK o6h5yIF/T X-Received: by 2002:a5d:6809:0:b0:34c:4d98:d6f7 with SMTP id ffacd0b85a97d-3552f4fe961mr2459162f8f.26.1716567741592; Fri, 24 May 2024 09:22:21 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:21 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Heinrich Schuchardt , Simon Glass , Mattijs Korpershoek , AKASHI Takahiro , Michal Simek , Francis Laniel , Peter Robinson , Abdellatif El Khlifi , Masahisa Kojima , Ramon Fried , Peng Fan , Sean Edmond , Ioana Ciornei Subject: [PATCH v2 08/14] net-lwip: add wget command Date: Fri, 24 May 2024 18:20:02 +0200 Message-Id: <98a1de5f01dad1ad55b68ebadcbad1f6357246a6.1716566960.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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 support for the wget command with NET_LWIP. About the small change in cmd/efidebug.c: when the wget command based on the lwIP stack is used the wget command has a built-in URL validation function since it needs to parse it anyways (in parse_url()). Therefore wget_validate_uri() doesn't exist. So, guard the call in efidebug.c with CONFIG_CMD_WGET. Based on code initially developed by Maxim U. Signed-off-by: Jerome Forissier Co-developed-by: Maxim Uvarov Cc: Maxim Uvarov --- cmd/Kconfig | 7 ++ cmd/Makefile | 5 +- cmd/efidebug.c | 8 +- cmd/net-common.c | 112 ++++++++++++++++++++++++++++ cmd/net-lwip.c | 12 +++ cmd/net.c | 115 ----------------------------- include/net-lwip.h | 51 +++++++++++++ net-lwip/Makefile | 1 + net-lwip/wget.c | 180 +++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 372 insertions(+), 119 deletions(-) create mode 100644 cmd/net-common.c create mode 100644 net-lwip/wget.c diff --git a/cmd/Kconfig b/cmd/Kconfig index 6ef0b52cd34..d9a86540be6 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2117,6 +2117,13 @@ config CMD_TFTPBOOT help tftpboot - load file via network using TFTP protocol +config CMD_WGET + bool "wget" + select PROT_TCP_LWIP + help + wget is a simple command to download kernel, or other files, + from a http server over TCP. + endif endif diff --git a/cmd/Makefile b/cmd/Makefile index 535b6838ca5..e90f2f68211 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -129,8 +129,11 @@ obj-$(CONFIG_CMD_MUX) += mux.o obj-$(CONFIG_CMD_NAND) += nand.o obj-$(CONFIG_CMD_NET) += net.o obj-$(CONFIG_CMD_NET_LWIP) += net-lwip.o +obj-$(filter y,$(CONFIG_CMD_NET) $(CONFIG_CMD_NET_LWIP)) += net-common.o ifdef CONFIG_CMD_NET_LWIP -CFLAGS_net-lwip.o := -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot +lwip-includes := -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot +CFLAGS_net-lwip.o := $(lwip-includes) +CFLAGS_net-common.o := $(lwip-includes) endif obj-$(CONFIG_ENV_SUPPORT) += nvedit.o obj-$(CONFIG_CMD_NVEDIT_EFI) += nvedit_efi.o diff --git a/cmd/efidebug.c b/cmd/efidebug.c index c2c525f2351..d80e91ecadd 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -741,9 +741,11 @@ static int efi_boot_add_uri(int argc, char *const argv[], u16 *var_name16, if (!label) return CMD_RET_FAILURE; - if (!wget_validate_uri(argv[3])) { - printf("ERROR: invalid URI\n"); - return CMD_RET_FAILURE; + if (IS_ENABLED(CONFIG_CMD_WGET)) { + if (!wget_validate_uri(argv[3])) { + printf("ERROR: invalid URI\n"); + return CMD_RET_FAILURE; + } } efi_create_indexed_name(var_name16, var_name16_size, "Boot", id); diff --git a/cmd/net-common.c b/cmd/net-common.c new file mode 100644 index 00000000000..b5dfd2c8866 --- /dev/null +++ b/cmd/net-common.c @@ -0,0 +1,112 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + */ + +#include +#include +#include +#ifdef CONFIG_NET +#include +#elif defined CONFIG_NET_LWIP +#include +#else +#error Either NET or NET_LWIP must be enabled +#endif +#include +#include + +static int do_net_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + const struct udevice *current = eth_get_dev(); + unsigned char env_enetaddr[ARP_HLEN]; + const struct udevice *dev; + struct uclass *uc; + + uclass_id_foreach_dev(UCLASS_ETH, dev, uc) { + eth_env_get_enetaddr_by_index("eth", dev_seq(dev), env_enetaddr); + printf("eth%d : %s %pM %s\n", dev_seq(dev), dev->name, env_enetaddr, + current == dev ? "active" : ""); + } + return CMD_RET_SUCCESS; +} + +static int do_net_stats(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + int nstats, err, i, off; + struct udevice *dev; + u64 *values; + u8 *strings; + + if (argc < 2) + return CMD_RET_USAGE; + + err = uclass_get_device_by_name(UCLASS_ETH, argv[1], &dev); + if (err) { + printf("Could not find device %s\n", argv[1]); + return CMD_RET_FAILURE; + } + + if (!eth_get_ops(dev)->get_sset_count || + !eth_get_ops(dev)->get_strings || + !eth_get_ops(dev)->get_stats) { + printf("Driver does not implement stats dump!\n"); + return CMD_RET_FAILURE; + } + + nstats = eth_get_ops(dev)->get_sset_count(dev); + strings = kcalloc(nstats, ETH_GSTRING_LEN, GFP_KERNEL); + if (!strings) + return CMD_RET_FAILURE; + + values = kcalloc(nstats, sizeof(u64), GFP_KERNEL); + if (!values) + goto err_free_strings; + + eth_get_ops(dev)->get_strings(dev, strings); + eth_get_ops(dev)->get_stats(dev, values); + + off = 0; + for (i = 0; i < nstats; i++) { + printf(" %s: %llu\n", &strings[off], values[i]); + off += ETH_GSTRING_LEN; + }; + + return CMD_RET_SUCCESS; + +err_free_strings: + kfree(strings); + + return CMD_RET_FAILURE; +} + +static struct cmd_tbl cmd_net[] = { + U_BOOT_CMD_MKENT(list, 1, 0, do_net_list, "", ""), + U_BOOT_CMD_MKENT(stats, 2, 0, do_net_stats, "", ""), +}; + +static int do_net(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + struct cmd_tbl *cp; + + cp = find_cmd_tbl(argv[1], cmd_net, ARRAY_SIZE(cmd_net)); + + /* Drop the net command */ + argc--; + argv++; + + if (!cp || argc > cp->maxargs) + return CMD_RET_USAGE; + if (flag == CMD_FLAG_REPEAT && !cmd_is_repeatable(cp)) + return CMD_RET_SUCCESS; + + return cp->cmd(cmdtp, flag, argc, argv); +} + +U_BOOT_CMD( + net, 3, 1, do_net, + "NET sub-system", + "list - list available devices\n" + "stats - dump statistics for specified device\n" +); diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c index 3abafdf7969..b80375c831e 100644 --- a/cmd/net-lwip.c +++ b/cmd/net-lwip.c @@ -2,6 +2,10 @@ /* Copyright (C) 2024 Linaro Ltd. */ #include +#include +#include +#include +#include #include #if defined(CONFIG_CMD_DHCP) @@ -35,3 +39,11 @@ U_BOOT_CMD( "hostname [envvar]" ); #endif + +#if defined(CONFIG_CMD_WGET) +U_BOOT_CMD( + wget, 3, 1, do_wget, + "boot image via network using HTTP protocol", + "[loadAddress] URL" +); +#endif diff --git a/cmd/net.c b/cmd/net.c index d407d8320a3..03b4582204f 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -676,118 +676,3 @@ U_BOOT_CMD( ); #endif /* CONFIG_CMD_LINK_LOCAL */ - -static int do_net_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - const struct udevice *current = eth_get_dev(); - unsigned char env_enetaddr[ARP_HLEN]; - const struct udevice *dev; - struct uclass *uc; - - uclass_id_foreach_dev(UCLASS_ETH, dev, uc) { - eth_env_get_enetaddr_by_index("eth", dev_seq(dev), env_enetaddr); - printf("eth%d : %s %pM %s\n", dev_seq(dev), dev->name, env_enetaddr, - current == dev ? "active" : ""); - } - return CMD_RET_SUCCESS; -} - -static int do_net_stats(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - int nstats, err, i, off; - struct udevice *dev; - u64 *values; - u8 *strings; - - if (argc < 2) - return CMD_RET_USAGE; - - err = uclass_get_device_by_name(UCLASS_ETH, argv[1], &dev); - if (err) { - printf("Could not find device %s\n", argv[1]); - return CMD_RET_FAILURE; - } - - if (!eth_get_ops(dev)->get_sset_count || - !eth_get_ops(dev)->get_strings || - !eth_get_ops(dev)->get_stats) { - printf("Driver does not implement stats dump!\n"); - return CMD_RET_FAILURE; - } - - nstats = eth_get_ops(dev)->get_sset_count(dev); - strings = kcalloc(nstats, ETH_GSTRING_LEN, GFP_KERNEL); - if (!strings) - return CMD_RET_FAILURE; - - values = kcalloc(nstats, sizeof(u64), GFP_KERNEL); - if (!values) - goto err_free_strings; - - eth_get_ops(dev)->get_strings(dev, strings); - eth_get_ops(dev)->get_stats(dev, values); - - off = 0; - for (i = 0; i < nstats; i++) { - printf(" %s: %llu\n", &strings[off], values[i]); - off += ETH_GSTRING_LEN; - }; - - return CMD_RET_SUCCESS; - -err_free_strings: - kfree(strings); - - return CMD_RET_FAILURE; -} - -static struct cmd_tbl cmd_net[] = { - U_BOOT_CMD_MKENT(list, 1, 0, do_net_list, "", ""), - U_BOOT_CMD_MKENT(stats, 2, 0, do_net_stats, "", ""), -}; - -static int do_net(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -{ - struct cmd_tbl *cp; - - cp = find_cmd_tbl(argv[1], cmd_net, ARRAY_SIZE(cmd_net)); - - /* Drop the net command */ - argc--; - argv++; - - if (!cp || argc > cp->maxargs) - return CMD_RET_USAGE; - if (flag == CMD_FLAG_REPEAT && !cmd_is_repeatable(cp)) - return CMD_RET_SUCCESS; - - return cp->cmd(cmdtp, flag, argc, argv); -} - -U_BOOT_CMD( - net, 3, 1, do_net, - "NET sub-system", - "list - list available devices\n" - "stats - dump statistics for specified device\n" -); - -#if defined(CONFIG_CMD_NCSI) -static int do_ncsi(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) -{ - if (!phy_interface_is_ncsi() || !ncsi_active()) { - printf("Device not configured for NC-SI\n"); - return CMD_RET_FAILURE; - } - - if (net_loop(NCSI) < 0) - return CMD_RET_FAILURE; - - return CMD_RET_SUCCESS; -} - -U_BOOT_CMD( - ncsi, 1, 1, do_ncsi, - "Configure attached NIC via NC-SI", - "" -); -#endif /* CONFIG_CMD_NCSI */ diff --git a/include/net-lwip.h b/include/net-lwip.h index 0019d1524e5..6fda940fec2 100644 --- a/include/net-lwip.h +++ b/include/net-lwip.h @@ -51,6 +51,56 @@ int eth_env_get_enetaddr_by_index(const char *base_name, int index, int eth_init(void); /* Initialize the device */ int eth_send(void *packet, int length); /* Send a packet */ int eth_rx(void); + +/** + * struct eth_ops - functions of Ethernet MAC controllers + * + * start: Prepare the hardware to send and receive packets + * send: Send the bytes passed in "packet" as a packet on the wire + * recv: Check if the hardware received a packet. If so, set the pointer to the + * packet buffer in the packetp parameter. If not, return an error or 0 to + * indicate that the hardware receive FIFO is empty. If 0 is returned, the + * network stack will not process the empty packet, but free_pkt() will be + * called if supplied + * free_pkt: Give the driver an opportunity to manage its packet buffer memory + * when the network stack is finished processing it. This will only be + * called when no error was returned from recv - optional + * stop: Stop the hardware from looking for packets - may be called even if + * state == PASSIVE + * mcast: Join or leave a multicast group (for TFTP) - optional + * write_hwaddr: Write a MAC address to the hardware (used to pass it to Linux + * on some platforms like ARM). This function expects the + * eth_pdata::enetaddr field to be populated. The method can + * return -ENOSYS to indicate that this is not implemented for + this hardware - optional. + * read_rom_hwaddr: Some devices have a backup of the MAC address stored in a + * ROM on the board. This is how the driver should expose it + * to the network stack. This function should fill in the + * eth_pdata::enetaddr field - optional + * set_promisc: Enable or Disable promiscuous mode + * get_sset_count: Number of statistics counters + * get_string: Names of the statistic counters + * get_stats: The values of the statistic counters + */ +struct eth_ops { + int (*start)(struct udevice *dev); + int (*send)(struct udevice *dev, void *packet, int length); + int (*recv)(struct udevice *dev, int flags, uchar **packetp); + int (*free_pkt)(struct udevice *dev, uchar *packet, int length); + void (*stop)(struct udevice *dev); + int (*mcast)(struct udevice *dev, const u8 *enetaddr, int join); + int (*write_hwaddr)(struct udevice *dev); + int (*read_rom_hwaddr)(struct udevice *dev); + int (*set_promisc)(struct udevice *dev, bool enable); + int (*get_sset_count)(struct udevice *dev); + void (*get_strings)(struct udevice *dev, u8 *data); + void (*get_stats)(struct udevice *dev, u64 *data); +}; + +#define eth_get_ops(dev) ((struct eth_ops *)(dev)->driver->ops) + +struct udevice *eth_get_dev(void); /* get the current device */ +int eth_get_dev_index(void); const char *eth_get_name(void); int eth_get_dev_index(void); int eth_init_state_only(void); /* Set active state */ @@ -85,5 +135,6 @@ int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_dns(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); +int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]); #endif /* __NET_LWIP_H__ */ diff --git a/net-lwip/Makefile b/net-lwip/Makefile index aa247859483..bc011bb0e32 100644 --- a/net-lwip/Makefile +++ b/net-lwip/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_CMD_DHCP) += dhcp.o obj-$(CONFIG_CMD_DNS) += dns.o obj-$(CONFIG_CMD_PING) += ping.o obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o +obj-$(CONFIG_CMD_WGET) += wget.o # Disable this warning as it is triggered by: # sprintf(buf, index ? "foo%d" : "foo", index) diff --git a/net-lwip/wget.c b/net-lwip/wget.c new file mode 100644 index 00000000000..25b75040806 --- /dev/null +++ b/net-lwip/wget.c @@ -0,0 +1,180 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024 Linaro Ltd. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define SERVER_NAME_SIZE 200 +#define HTTP_PORT_DEFAULT 80 + +static ulong daddr; +static ulong saved_daddr; +static ulong size; +static ulong prevsize; +#define PROGRESS_PRINT_STEP_BYTES (100 * 1024) +static ulong start_time; +static enum done_state { + NOT_DONE = 0, + SUCCESS = 1, + FAILURE = 2 +} done; + +static int parse_url(char *url, char *host, u16 *port, char **path) +{ + char *p, *pp; + long lport; + + p = strstr(url, "http://"); + if (!p) + return -EINVAL; + + p += strlen("http://"); + + /* Parse hostname */ + pp = strchr(p, ':'); + if (!pp) + pp = strchr(p, '/'); + if (!pp) + return -EINVAL; + + if (p + SERVER_NAME_SIZE <= pp) + return -EINVAL; + + memcpy(host, p, pp - p); + host[pp - p + 1] = '\0'; + + if (*pp == ':') { + /* Parse port number */ + p = pp + 1; + lport = simple_strtol(p, &pp, 10); + if (pp && *pp != '/') + return -EINVAL; + if (lport > 65535) + return -EINVAL; + *port = (u16)lport; + } else { + *port = HTTP_PORT_DEFAULT; + } + if (*pp != '/') + return -EINVAL; + *path = pp; + + return 0; +} + +static err_t httpc_recv_cb(void *arg, struct altcp_pcb *pcb, struct pbuf *pbuf, + err_t err) +{ + struct pbuf *buf; + + if (!pbuf) + return ERR_BUF; + + for (buf = pbuf; buf; buf = buf->next) { + memcpy((void *)daddr, buf->payload, buf->len); + daddr += buf->len; + size += buf->len; + if (size - prevsize > PROGRESS_PRINT_STEP_BYTES) { + printf("#"); + prevsize = size; + } + } + + altcp_recved(pcb, pbuf->tot_len); + pbuf_free(pbuf); + return ERR_OK; +} + +static void httpc_result_cb(void *arg, httpc_result_t httpc_result, + u32_t rx_content_len, u32_t srv_res, err_t err) +{ + ulong elapsed; + + if (httpc_result != HTTPC_RESULT_OK) { + log_err("\nHTTP client error %d\n", httpc_result); + done = FAILURE; + return; + } + + elapsed = get_timer(start_time); + log_info("\n%u bytes transferred in %lu ms (", rx_content_len, + get_timer(start_time)); + print_size(rx_content_len / elapsed * 1000, "/s)\n"); + + if (env_set_hex("filesize", rx_content_len) || + env_set_hex("fileaddr", saved_daddr)) { + log_err("Could not set filesize or fileaddr\n"); + done = FAILURE; + return; + } + + done = SUCCESS; +} + +int wget_with_dns(ulong dst_addr, char *uri) +{ + char server_name[SERVER_NAME_SIZE]; + httpc_connection_t conn; + httpc_state_t *state; + char *path; + u16 port; + + daddr = dst_addr; + saved_daddr = dst_addr; + done = NOT_DONE; + size = 0; + prevsize = 0; + + if (parse_url(uri, server_name, &port, &path)) + return CMD_RET_USAGE; + + memset(&conn, 0, sizeof(conn)); + conn.result_fn = httpc_result_cb; + start_time = get_timer(0); + if (httpc_get_file_dns(server_name, port, path, &conn, httpc_recv_cb, + NULL, &state)) + return CMD_RET_FAILURE; + + while (!done) { + eth_rx(); + sys_check_timeouts(); + if (ctrlc()) + break; + } + + if (done == SUCCESS) + return 0; + + return -1; +} + +int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) +{ + char *url; + ulong dst_addr; + + if (argc < 2 || argc > 3) + return CMD_RET_USAGE; + + dst_addr = image_load_addr; + + if (!strncmp(argv[1], "0x", 2)) { + if (argc < 3) + return CMD_RET_USAGE; + dst_addr = hextoul(argv[1], NULL); + url = argv[2]; + } else { + url = argv[1]; + } + + if (wget_with_dns(dst_addr, url)) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; +} From patchwork Fri May 24 16:20:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798696 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp800487wrw; Fri, 24 May 2024 09:22:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWINMKSIF80HgrBHws0G31zOAguPYFh6mW74bCmPZkIBA9m/d8eS+xAz86vVOWBByOFhocAEtVAucicQbtfiFkx X-Google-Smtp-Source: AGHT+IGGEDDivOVn4C1zrOGLuc/r2AO6kmVK1Jzmicx7Qoj3fcczp/4YrBp0efWigbcjpIo8MjVu X-Received: by 2002:a17:906:69c9:b0:a59:a033:3e2 with SMTP id a640c23a62f3a-a626524e0aamr288536266b.74.1716567776494; Fri, 24 May 2024 09:22:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716567776; cv=none; d=google.com; s=arc-20160816; b=HyXuCNzNZrgW7CKGfb+qhHDmIP7MUYAt7YNICfRDfheIVve7kLEqDv52aV9GYWaQ5W JVBXkcFeijjxHBfbhsV59WhcrADj21JOvHw4H3rCulcrmv99kiacOQuVylN995E7+fcH OPZoXDJHOx/IQMnVXuzOooigsEtQY7EhmhgWoPp4nT6JXc+ah3CdsAAh4K1M4Nnj4DmA 2t0hZxTcQGPWEOkfqzSjOK+pfGzjhWxFC8hYhZjAXp/YenV2zXNyh6EtN9r25bsazmE+ XMQmuytMKo4xPt/XD52DLPwKLEAnkETN/r927hlXLRmjnn2m8J5o5ODZggaRHTWadrhS CSVA== 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=OnvqlAEbho+IzIup+Qq858vYmcqDE+ViS7jBu54Zv0c=; fh=GmE4cvJuFGlN2lAgZp/vjxn9tRV0hvmbJs+0T1jfp6E=; b=rJn7Y88EQ6K1OqtsFnSKajqEX3ewOkqGkE7oRzfsbCFiNl8TutKQOsTnw87crbL76Z at3Lwd8m+R8X5WGeMomXSbvpMYwgkFLzWcyYJ5tos3MB9fzb5xy4F7BWPlcyuiEe5fc1 kM1qrx6xpvf3Kcn6Btoj+akZ5OSelplfKE9nB8k31/TY7oup0FBkCXPp2+VcOuWxZJmg Ub+aSY6aA3H6OnGC+spBJ7T+NtAIR/dr3RCHQ1fcOezId/7LSKJcgMlhmyDqwJy6qJeh Kuuz2d8Z24/GPgAGdyWKMYXrDvbEV2oEDHonE/8jJIrKeOKvnygCRHeSXfSz8paC1DsB kl0w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UKVAcdIE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cc36ae3si94206866b.447.2024.05.24.09.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:56 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UKVAcdIE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 0AACD888DB; Fri, 24 May 2024 18:22:28 +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="UKVAcdIE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6F5A9888CF; Fri, 24 May 2024 18:22:26 +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-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (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 1A0C2888B2 for ; Fri, 24 May 2024 18:22:23 +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-wr1-x436.google.com with SMTP id ffacd0b85a97d-354be94c874so2454384f8f.3 for ; Fri, 24 May 2024 09:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567742; x=1717172542; 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=OnvqlAEbho+IzIup+Qq858vYmcqDE+ViS7jBu54Zv0c=; b=UKVAcdIEYfeLUIl/TD5r6qhdtL5qC1DOo7TjSDyWXsXyrDCPdCcC6vREUo4c/XistU e4mIycjXGMuk+IfSUSACItzBm/h9V9r3gBicCtO4oDUGp5PX2Y6duerbYREAx9J9nrY1 O2CVlBbWfan0u5sWd+UCE/OhCAYMDU62knwIsYmfM+NVZEu5cerhLpy1uC7n36DGaHK/ qvHEHBIMLoaULfTNGdT2TRQPm0T7YO5RDi+NRdVZMhGaBUose/hKal+MUjAkqrBJ1VVj vN+H+b8FCrrpwT60e67UNRoI0GfG8dAvofVwF6HzSUeGczlYYwo9REoNonT0KCA5u63x DDYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567742; x=1717172542; 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=OnvqlAEbho+IzIup+Qq858vYmcqDE+ViS7jBu54Zv0c=; b=b9Y1q4y9Yd7rzglRzf+N8RJs7yAe+66YgXsR1ZwdR0FQl8PqjyaXgYM/UkSd0kbrui 4bGANghmDm1yk+BRVWKUDT0OH90fpSErWQ9MGRCc+JBQiT+yEEW7aNZQNFm6iiIkJU8a t1uA+r1/txxDa1sNsuUZkKjPoPu1Lo+HJLUmea3rsTd+cXhc4izykF1yFtuswYdSyivb zrbCq51osajKVJOjZ89DSxkeS/NRpBa2gW1BPdCis6Kw+DyxuDtIhED/JT0DyKGKT2Zw sqZOT2CWUP6f9P4sIUoTo8UYa/0WURPYlf0TU0yM82iy7DBbzPOjHOY8YWgIy6zDV/9r 51hg== X-Gm-Message-State: AOJu0Yyf7XBQzBKRi2cLxEnTha/df1HiZ1+CgSN12QqtFlafecrfrlkf izKIYs88sRleeMkRKzjDcuM0gjroJeD0yqdOgpmkYaRa+2QStzWtCbiWW/Cl0BX/cTxD9LEEn7b l+ytLzhia X-Received: by 2002:a5d:4950:0:b0:355:454:12e3 with SMTP id ffacd0b85a97d-355245deaabmr2524993f8f.11.1716567742512; Fri, 24 May 2024 09:22:22 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:22 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Simon Glass , Tom Rini , Sean Anderson Subject: [PATCH v2 09/14] test: dm: dsa, eth: disable tests when CONFIG_NET_LWIP=y Date: Fri, 24 May 2024 18:20:03 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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 Some sandbox tests make strong assumptions on how the network stack is implemented. For example, the ping tests assume that ARP resolution occurs upon sending out the ICMP packet. This is not always the case with the lwIP stack which can cache ARP information. Therefore, disable these tests when CONFIG_NET_LWIP is enabled. Signed-off-by: Jerome Forissier --- test/dm/dsa.c | 2 ++ test/dm/eth.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/test/dm/dsa.c b/test/dm/dsa.c index c857106eaf4..147e2a4afe2 100644 --- a/test/dm/dsa.c +++ b/test/dm/dsa.c @@ -59,6 +59,7 @@ static int dm_test_dsa_probe(struct unit_test_state *uts) DM_TEST(dm_test_dsa_probe, UT_TESTF_SCAN_FDT); +#if !defined(CONFIG_NET_LWIP) /* This test sends ping requests with the local address through each DSA port * via the sandbox DSA master Eth. */ @@ -80,3 +81,4 @@ static int dm_test_dsa(struct unit_test_state *uts) } DM_TEST(dm_test_dsa, UT_TESTF_SCAN_FDT); +#endif /* !defined(CONFIG_NET_LWIP) */ diff --git a/test/dm/eth.c b/test/dm/eth.c index bb3dcc6b954..cf97b1c1ab3 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -170,6 +170,7 @@ static int dm_test_ip6_make_lladdr(struct unit_test_state *uts) DM_TEST(dm_test_ip6_make_lladdr, UT_TESTF_SCAN_FDT); #endif +#if !defined(CONFIG_NET_LWIP) static int dm_test_eth(struct unit_test_state *uts) { net_ping_ip = string_to_ip("1.1.2.2"); @@ -298,6 +299,7 @@ static int dm_test_eth_act(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_eth_act, UT_TESTF_SCAN_FDT); +#endif /* !CONFIG_NET_LWIP */ /* Ensure that all addresses are loaded properly */ static int dm_test_ethaddr(struct unit_test_state *uts) @@ -332,6 +334,7 @@ static int dm_test_ethaddr(struct unit_test_state *uts) } DM_TEST(dm_test_ethaddr, UT_TESTF_SCAN_FDT); +#if !defined(CONFIG_NET_LWIP) /* The asserts include a return on fail; cleanup in the caller */ static int _dm_test_eth_rotate1(struct unit_test_state *uts) { @@ -616,6 +619,7 @@ static int dm_test_eth_async_ping_reply(struct unit_test_state *uts) } DM_TEST(dm_test_eth_async_ping_reply, UT_TESTF_SCAN_FDT); +#endif /* !CONFIG_NET_LWIP */ #if IS_ENABLED(CONFIG_IPV6_ROUTER_DISCOVERY) From patchwork Fri May 24 16:20:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798698 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp800649wrw; Fri, 24 May 2024 09:23:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVgicluBwZfPVT58Zr8NFdsIHvKuhwksPr3Rx1AlI2cXUdijsDBm1jwb6mhOCl1HvV9JCIwwOiOCahYzS7pzE4l X-Google-Smtp-Source: AGHT+IGgMhKAPxCFklz02AjfT1M3Gz+szCYwjmxJss4OISzcRScgzXNp2knqhoa2U+hD2N1mz1wW X-Received: by 2002:a17:906:aada:b0:a59:9eab:1630 with SMTP id a640c23a62f3a-a6265134cc0mr178785666b.69.1716567797882; Fri, 24 May 2024 09:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716567797; cv=none; d=google.com; s=arc-20160816; b=pus6GKPc8FOi3WxnQL7oKyzHbSqvuSYw+BBClT9kxI878Ky+ibHKHND1B86t8vfpvN qdI7KGMCh+z2o4TIXc8Gu/h4e2kOqGEd+zoBX6m0vH2a4iBlR8YKWxx1puFZ6Pz9Jvqu nKKlWsd8n8WYt9tf6U/8bhggCKyFZWTI4N+MZ9eXp1uNkPgNANEs6Wr0PgsmxGL7NfzY Dwh6YTjW5w4/mwEuumzeVhk1jlWTTBszpJAockJQVxBquk8UzqmFb06vrEEDKxhi6Yfq qyzxL8+LnWCgB8zKDv0c3pB/Pim1AP34OOMt4TL7SZvsnUA3xlI85NkKnx5wsqKjuGUO xrZQ== 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=wXawjeJXnycfE5xaoF+bqShNCUQW4mVfN0nOrxfadqA=; fh=8WQpMpm1L/fodCJFfYPhjZxaHfYgyB8wvAxF0Mcvg2A=; b=aTNd1EGPWsE/67nW2CGN44xgIUI5zr7pQW8o1gGZVbH6D1m0wRKNiTUtn0I46zBhds FYGjOoIAsikHApeZb5Jpb6Bw9ZuCzZqwXyAYPNZfXEvhGVQbe5nwBQVNqUs4DrLrFXSt +I5A8q+QnKn2faaVsNU37gI8jKcyAwz0BQfb9dAcijKyHhs/7Bdms+8OmVh2bXcG38WJ RisuR1HZ92+ysm//lY2Li9CfJq1uc4nQgCUODD726w+Biw0c45qe7jui3I+7IY1k+3J1 RDWEkZVDAarBcCn95po0U2VUhoFG/urtUTmK1Gg9rnSrpeWJnGmOahbY6BAvVl06urc4 Wl7Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cYWdbN5t; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cc37a56si96527066b.295.2024.05.24.09.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cYWdbN5t; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 D15E8888E6; Fri, 24 May 2024 18:22:30 +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="cYWdbN5t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 72AEC888CF; Fri, 24 May 2024 18:22:27 +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-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (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 DFAC8888B7 for ; Fri, 24 May 2024 18:22:23 +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-wr1-x434.google.com with SMTP id ffacd0b85a97d-354de3c5c61so2671792f8f.0 for ; Fri, 24 May 2024 09:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567743; x=1717172543; 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=wXawjeJXnycfE5xaoF+bqShNCUQW4mVfN0nOrxfadqA=; b=cYWdbN5ttX7nvcNP0rFVKwNUWKweEwVkq/hq6RdQj8kpK7sHAFKY8ct7k9Y4JGGAw0 zAXUBcZChaGRTkkw1LHWzQSTKA8cyNHP9/h9f1956HPY0IWdNrTEaZjr+hKCdXfhL+kK L8wGHd8Dr/SBb695FiA7cRIySuOftBm5nIL3uRNmxDQLggkxGmJJzQuj7T0v0IE3bRj+ ky8sAoQG+lq8HVL0/9hpCagE3krHqoOEnDpkRL2aiKCBU4CFQm2sS83WbI+ePOppJUxN ijr0xULvNk+cbvrF4PrLzaCABlLgZ2jKk6MIfLvdMob1/4HSVj5RNKlWhhK3avR5Gd4n khqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567743; x=1717172543; 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=wXawjeJXnycfE5xaoF+bqShNCUQW4mVfN0nOrxfadqA=; b=gzzjLQaeDKDWc21i3/VFW06ftcQjv3aMaaP0ZSc4KaxUJyWm8wGD1gz5yMB08t9ubX 7P6S+Jdt0L63Oz4ihHhaYu61pVYei2Yk/df0Pz36aeM/gxKPqUupU84MVPRlONAyHwyR 9NyEO+o4sI1sVYPeIvA1uqs6bJndWqSNzfkTfZbnanG3DSP0/+3EQdZLRbcwS59hQfbA weu2s+JUDIhUTzyocFLmFLvurZ9DGsEUf4OXbFm2DVGcelMssZerVAO3Kj/ncydoNghY X7o63+gn2bcDQJqL+3/JWpz5X23FlIE4/Qpb8F6AQZR3d9Yq8DqCVj47nEMgiM9+QFaR CXqA== X-Gm-Message-State: AOJu0Yz1gbneJkY4PRNpA9y42iBH49DCcAqjAPLmdqUhG4KNkJYQ/2Y6 rQI9s4QB+MxKKGvW0BXZiUiTpUZ3LTHojao6T0c4rM5JvuVnRWcc7OkUcGbPUWCYqOw93k/0DJZ rIXEvxl+a X-Received: by 2002:adf:f4ce:0:b0:355:2db:a0e with SMTP id ffacd0b85a97d-35526c19221mr1779655f8f.13.1716567743318; Fri, 24 May 2024 09:22:23 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:23 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Simon Glass , Bin Meng , Marek Vasut , Nikhil M Jain Subject: [PATCH v2 10/14] cmd: bdinfo: enable -e when CONFIG_CMD_NET_LWIP=y Date: Fri, 24 May 2024 18:20:04 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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 Support "bdinfo -e" when lwIP is selected. Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas Reviewed-by: Tom Rini --- cmd/bdinfo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 79106caeec2..690fb894bf6 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -152,7 +152,7 @@ static int bdinfo_print_all(struct bd_info *bd) bdinfo_print_num_l("relocaddr", gd->relocaddr); bdinfo_print_num_l("reloc off", gd->reloc_off); printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); - if (IS_ENABLED(CONFIG_CMD_NET)) + if (IS_ENABLED(CONFIG_CMD_NET) || IS_ENABLED(CONFIG_CMD_NET_LWIP)) print_eth(); bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob)); bdinfo_print_num_l("new_fdt", (ulong)map_to_sysmem(gd->new_fdt)); @@ -198,7 +198,8 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) case 'a': return bdinfo_print_all(bd); case 'e': - if (!IS_ENABLED(CONFIG_CMD_NET)) + if (!IS_ENABLED(CONFIG_CMD_NET) && + !IS_ENABLED(CONFIG_CMD_NET_LWIP)) return CMD_RET_USAGE; print_eth(); return CMD_RET_SUCCESS; From patchwork Fri May 24 16:20:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798699 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp800734wrw; Fri, 24 May 2024 09:23:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVpSIn/AjYOhTOww+FHJWMQrLdRLbo95NQ0F2e1rhqBwYkfXHiJ4UsQ+gsuCMZ4/i20s62MvcduD7j0Hgz8J2bU X-Google-Smtp-Source: AGHT+IFOzxV9pQjkBgjGnCBsQUGalIQoz2a4t+bZ5Oc7w2yT6+mcL1XyihJTAQ7yO67ljGAche3O X-Received: by 2002:a17:906:714e:b0:a5a:6f71:7bd9 with SMTP id a640c23a62f3a-a623e8db7c7mr512712966b.14.1716567808104; Fri, 24 May 2024 09:23:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716567808; cv=none; d=google.com; s=arc-20160816; b=g+TOLzPIVlqRCEEJc/5M8hZeeJMM+dZms8FGpyOrJnM0+31I7Wxs0IRcY+7NnZlzUw XApJcEGBZFtVoZRtjtObRNknnIrs92drfdv68+D2Asq0Hl/ADwLHCwnn5srf60qvsTrB esDHY3P690fH2Zg85YpB4toGoH7fr+3guxR/QsdlAdRWjfVTyZgBznDYfkQEBrIaF1dL 4kwdwLzie/sE67fzcasaTI531k4wBVJAZF9o8KcRdjmJ+C03RnQz3DloHcyIOH5wbKQM ocODtV3jW0fC3ugFxiC1UNWJxjVWgmmp1L3muxvotfQRGzdsI+Vj7/+DbxvLo2oaGf83 QmoQ== 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=GdzXC49XiXlNi3mFqaZsgVg+eyG60zpTDzLw8C3mfyw=; fh=cQhI5/EgogSkJ9u4BlGz7zOe5FopWH3wQtCDJ7yi0Z8=; b=Bi7J8740Rmti6DE246SxYuL8QUKJ0iSQy8t19s+B4LNnVpOGalpZg32HSJ/L6MFQ82 UgprHMPwdQnQhMEu9wP/1kWbP9m6i7bn5pTu1RJh9+rN/i4SsRex6AW/GWU70zkuBzTb dYbt8+pcvhOoV4KwzBYTFetcU04seQD4pz8FP+oyf4j58461kiVdif5D6ILbEvmvEh64 DGK5eAiiv6+bcBMWTAkoCM74ACBEXKb3r+OXxNxx6QK+QbISQQXA9vqQjLKKPKhvuUVe zbbBY3Xo+dZeF8rBy0TgtE0WGhkVDgQ1NJ76lRbxpMHJfa0rgGRATTcdy8p+ctE5UtAY 2daQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bI0DP0Tp; 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 a640c23a62f3a-a626c80114dsi96431266b.23.2024.05.24.09.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:23:28 -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=bI0DP0Tp; 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 48BCD888D9; Fri, 24 May 2024 18:22:31 +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="bI0DP0Tp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E33CD88640; Fri, 24 May 2024 18:22: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-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 B4C538866B for ; Fri, 24 May 2024 18:22: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=jerome.forissier@linaro.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42108822e3cso5593685e9.0 for ; Fri, 24 May 2024 09:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567744; x=1717172544; 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=GdzXC49XiXlNi3mFqaZsgVg+eyG60zpTDzLw8C3mfyw=; b=bI0DP0TpuosFfZemp0hKoUfgSB+K3fdnb6CnklJvtmQdly4PVTNOTSPcUFpD9DFspF +9NpgVdhBdpc5VpetKp0C0UvQSZ1YoFNLWSVc68QlphNcFNytdcwX+d20GwOmPKemQIF 7FWAIfnN8cXoYmZyR/TiwWXlb4UW4GGKg+izFdTTHlWrYeBW7wXa+a0RF6GxrHIIkHiW PM6ydrnPA29Bn7BS3aGrPYExMPkXf0INUUItm8QwX/7sX6XJKbErMhwF0e+iu5OZOgpV CePbvyY5DoRaLqVgP2TM5wkuWJWAysqH5DduBSdLfArENZUK4396CSPuExJsoBjONsUr bElQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567744; x=1717172544; 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=GdzXC49XiXlNi3mFqaZsgVg+eyG60zpTDzLw8C3mfyw=; b=MLBbmdOFoYj0ybqBvCRNUFjGesfhOPvUXK5ndKxQM/bYWp57CRDD0EgZznXJnf3oKD 10K5gaPicCNvGsypLba6m+GK6gdKBOWn8XCjd+ALLLq8VZTmIFpMGY/NYzqLvl+2pLdy LVOggoiW3wlW+eRwNamBo+OIBqr/H17OkZHr1DQ+Sp9i+0akceXIssCIofM24w4omyJP JPii3WAqYUmlGujmcRrJbajU1Mojni04CJcWKpsql8Wmp9H2AbJTd4Ja9omYgYruQPvi rladDZ6HU+EM8bUBqIkeCsK1NyqRwyfJxJIJUKG9Legku/WiiA1YXJ1ri+64J2/jXebx vB2Q== X-Gm-Message-State: AOJu0YzsmbDDWm6nGI8Wg4B36R2MM5fC4/ziHh4UpRRfCe14rN4a7KeH FW7Bl5FUcStyyinWIolVcT7HKN+YwmGT0Z1iIub+DOpOjh9Z/VZIduakn/LdRAWZ4y4Dza5eWSL Z22OXosk6 X-Received: by 2002:adf:f805:0:b0:34d:85f4:9485 with SMTP id ffacd0b85a97d-354f74ff703mr5387477f8f.7.1716567744203; Fri, 24 May 2024 09:22:24 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:24 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini Subject: [PATCH v2 11/14] configs: add qemu_arm64_lwip_defconfig Date: Fri, 24 May 2024 18:20:05 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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 qemu_arm64_lwip_defconfig based on qemu_arm64_defconfig but with NET_LWIP instead of NET. The new file was obtained by doing: 1. make qemu_arm64_defconfig 2. make menuconfig Select NET_LWIP 3. make savedefconfig 4. diff -u defconfig configs/qemu_arm64_defconfig 5. Create configs/qemu_arm64_lwip_defconfig, use #include <> to inherit from configs/qemu_arm64_defconfig, append 'CONFIG_NET_LWIP=y' and '# CONFIG_DFU_TFTP is not set' to reflect the diff. Signed-off-by: Jerome Forissier --- configs/qemu_arm64_lwip_defconfig | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 configs/qemu_arm64_lwip_defconfig diff --git a/configs/qemu_arm64_lwip_defconfig b/configs/qemu_arm64_lwip_defconfig new file mode 100644 index 00000000000..050c93ff97b --- /dev/null +++ b/configs/qemu_arm64_lwip_defconfig @@ -0,0 +1,3 @@ +#include +CONFIG_NET_LWIP=y +# CONFIG_DFU_TFTP is not set From patchwork Fri May 24 16:20:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798700 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp800813wrw; Fri, 24 May 2024 09:23:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWXBo1N0DtdvOqS+7EedHYEe67bIJhCGaQI74F+kccvlacIXROQjZLtb308HPQoIq4cG0Y3irz0WV2OTJW1IvXe X-Google-Smtp-Source: AGHT+IHqYJ+OBNubdQENglEVXGgDqqz0dq5XYBp8FAqhBMLvMY/ToIHyus7I6fItOPGEbrVmwmY8 X-Received: by 2002:a17:906:c4c3:b0:a62:2ef9:12c with SMTP id a640c23a62f3a-a62646d575dmr159882566b.32.1716567818036; Fri, 24 May 2024 09:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716567818; cv=none; d=google.com; s=arc-20160816; b=RJSG4J/HZCYGrKAyyPYVoAoWiAwvxeUwBQ4UBZMWuUEIX6N0S4jC7IUKML7RF7XTkk U815PICJk9IF2AziSuP1DTF2uLbO41dpmdChVLMe6MbQkF1YKRNKNs2RDvSCW3y0Jgih kL3+iLUpj5xEgK6KoLiu/JN/oIFtaeNEu2OxCUrXgMiYDETism9+AlGDrdNCYo12jPOT NVqPogBSKxk8fuaTcmlVrRf3O53Z1wRZ68vplbMmUPwactVDHP3SQW+W7Qcyncvs7Cis MKqbmwH0TYDfQ34Iw2nCcdNCU+0fedU+SnVHjioB4rX+hUz7wAt3Rx+xFa5ilMo1BBXk jEJg== 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=kO0B51aoveaGtlk1f5Aam2nRiGQYJIZdbHMlcXi4I4M=; fh=9oOVjfAF8Can4wJwp/37T7rS88wy4xqeXklRp67q80o=; b=bj+FzdY7l5SWySc4Ey09hQdJDYfPS8Oatswt4VjZDEJmfhfMynTn9vRmSU3XcJqP/s TiZVA+qAkFsrQm12xKRd66I2cBhbWUy3JcZk9Dytfa6Ey7s/K8nhRsYRUFbdR6Brs5vn 1Qi2NPFXE4J27NgOGvuTjz0lqgfCAVJGRokHWHh/+2Dtn31Pz0QyLZ0QubiOxo1DbcOx 5N89bnLRugDyuak5AyfaLnyQIHqnVt6FoUwjDdwENWHSxl1Vq7FgnKmLSlRgTz0gv2yr jwOzp1hmqM1VgcpWKPYwb7gt5nrzog/P42wO7+iI65gFXUfLXT2OmZMhqAgL7Mklw86q 4YRQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jDCWuhRx; 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 a640c23a62f3a-a626c91842fsi95101366b.227.2024.05.24.09.23.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:23:38 -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=jDCWuhRx; 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 A63358866B; Fri, 24 May 2024 18:22:33 +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="jDCWuhRx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 372ED88640; Fri, 24 May 2024 18:22:30 +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-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 9040088682 for ; Fri, 24 May 2024 18:22: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=jerome.forissier@linaro.org Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-354fb2d8f51so1518821f8f.3 for ; Fri, 24 May 2024 09:22:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567745; x=1717172545; 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=kO0B51aoveaGtlk1f5Aam2nRiGQYJIZdbHMlcXi4I4M=; b=jDCWuhRxPbVAGETQ1rblz25S9ck2hdKorMaAjeddheHSRfEGSd+N/Ijq9tV01PLpGp cDdnr24r3W/ypzEN9KOOG92IBVqNwcgbahRMu7c7HtTJY9g24cAFSsx+5738alll8Uik lNZS6PwuRINHd4da+7hwFj9VxsBX7CYsAv4wi1bLbBNk6U5rUkrX9qY36fadfyoEPWKH ceSH2d7r4Am6cCSfUqTLBuBdNeGqIjKKnsFEs4AdeoAT3yVMrpXum33uikjiXI004mr/ 6slFadD+gClSdD4xfGrDT/YGsP/oIsaQY0BZDfSVKr9qCiz1y5GzKoxiUKo+y+J+hu5I ALGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567745; x=1717172545; 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=kO0B51aoveaGtlk1f5Aam2nRiGQYJIZdbHMlcXi4I4M=; b=niaA8aR5fQaBLlIngTRFA5C/vIu+UoH8V0dLj19cDXoURhAhUrcKX60Fm6ojN40ytE z/Pj3XuF7/Lh643Y0/4vUonnz3TiBdA3QN1cjzP8p/fVz29mFK35Bpv14+BROafLLUye /NTka+tfP8HuYhir11SNX2aE3BZQHgk1hlZN2+1SXAkJHOeQgqOjee3f/GE6O5PmswSH zzNpVjzFRtA6HrUDy4y8pKHuqwAd8Xsksl6PSvBwsw7dCFsLDRKzXjiuKOQefkHyYuAV kuaxL8T4tpq8JYi4m+3hGPPQoGH1gHIWMa30GKuQmO4i1Ng+2pc8Lx1/jvkZWjXEwneC lXww== X-Gm-Message-State: AOJu0YyX2XKwI9A+14MqHMJDagvOIDACQhZWGOfJTTzLtvszFhxeMlgY YRYFTy1fgplpJ8+azH/JoGTzO40g1qdpMN7nnhCeFAUcfqEkRzw6WNh2V7Tl2JHC2eDigMmG8yA vKQIP6rZ7 X-Received: by 2002:a5d:6106:0:b0:355:42b:820c with SMTP id ffacd0b85a97d-35538b56d55mr1861759f8f.63.1716567744983; Fri, 24 May 2024 09:22:24 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:24 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Love Kumar , Maxim Uvarov , Michal Simek , Simon Glass Subject: [PATCH v2 12/14] test/py: net: add _lwip variants of dhcp, ping and tftpboot tests Date: Fri, 24 May 2024 18:20:06 +0200 Message-Id: <9acc7630e5768ab9af673981a78ffb84b47aa62e.1716566960.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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 WHen NET_LWIP is enabled, the dhcp/ping/tftpboot commands are enabled via CMD_DHCP_LWIP, CMD_PING_LWIP and CMD_TFTPBOOT_LWIP, respectively; therefore the config annotations in the Python test scripts need to be cmd_dhcp_lwip, cmd_ping_lwip and cmd_tftpboot_lwip. The console output of the tftpboot command with lwIP is slightly different from the non-lwIP implementation. This is taken care of in test_net_tftpboot(). Signed-off-by: Jerome Forissier Reviewed-by: Love Kumar --- test/py/tests/test_net.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py index 038a473b239..ba30780903f 100644 --- a/test/py/tests/test_net.py +++ b/test/py/tests/test_net.py @@ -127,6 +127,10 @@ def test_net_dhcp(u_boot_console): global net_set_up net_set_up = True +@pytest.mark.buildconfigspec('cmd_dhcp_lwip') +def test_net_dhcp_lwip(u_boot_console): + test_net_dhcp(u_boot_console) + @pytest.mark.buildconfigspec('cmd_dhcp') @pytest.mark.buildconfigspec('cmd_mii') def test_net_dhcp_abort(u_boot_console): @@ -230,6 +234,10 @@ def test_net_ping(u_boot_console): output = u_boot_console.run_command('ping $serverip') assert 'is alive' in output +@pytest.mark.buildconfigspec('cmd_ping_lwip') +def test_net_ping_lwip(u_boot_console): + test_net_ping(u_boot_console) + @pytest.mark.buildconfigspec('IPV6_ROUTER_DISCOVERY') def test_net_network_discovery(u_boot_console): """Test the network discovery feature of IPv6. @@ -255,7 +263,7 @@ def test_net_network_discovery(u_boot_console): assert '0000:0000:0000:0000:0000:0000:0000:0000' not in output @pytest.mark.buildconfigspec('cmd_net') -def test_net_tftpboot(u_boot_console): +def test_net_tftpboot(u_boot_console, lwip = False): """Test the tftpboot command. A file is downloaded from the TFTP server, its size and optionally its @@ -279,10 +287,11 @@ def test_net_tftpboot(u_boot_console): output = u_boot_console.run_command('tftpboot %s' % (fn)) else: output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn)) - expected_text = 'Bytes transferred = ' sz = f.get('size', None) - if sz: - expected_text += '%d' % sz + if lwip: + expected_text = f'{sz} bytes transferred' + else: + expected_text = f'Bytes transferred = {sz}' assert expected_text in output expected_crc = f.get('crc32', None) @@ -295,6 +304,10 @@ def test_net_tftpboot(u_boot_console): output = u_boot_console.run_command('crc32 $fileaddr $filesize') assert expected_crc in output +@pytest.mark.buildconfigspec("cmd_net_lwip") +def test_net_tftpboot_lwip(u_boot_console): + test_net_tftpboot(u_boot_console, True) + @pytest.mark.buildconfigspec('cmd_nfs') def test_net_nfs(u_boot_console): """Test the nfs command. From patchwork Fri May 24 16:20:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798701 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp800877wrw; Fri, 24 May 2024 09:23:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXkc4j1xcsEMnAARMuj3uhu/mi7YNIhTSPduOscRZTxZNq7M8KgkESuvFQ3DSm7qmA+lJZ5k3V5o4irvaIhnrmW X-Google-Smtp-Source: AGHT+IG7Eu5LCWgzyENPe+hfbsVln2LzxCFQk++jJt/OIdpwqooPAk1w3aNXIgfI69vEBZcnhjt2 X-Received: by 2002:a50:cd46:0:b0:574:eba7:4741 with SMTP id 4fb4d7f45d1cf-57851a98632mr1482231a12.42.1716567827826; Fri, 24 May 2024 09:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716567827; cv=none; d=google.com; s=arc-20160816; b=xR9vHk2ISwBLfDPCnHV3AGqC0zRvMQEExkvKONx8KErVwiDtveH5xDMnuZIXdBxxOF j08bq6ForpUXUWqoJoXjZ69tHjXb7wGVPvOucOKUyBbDzVrYtHCZ7dW/HlnWJJ+YSVma FM/bnii0VTjpuZDi8zcExEZNj8ktCcfUdn4KcdeZ152Jb8CXu04v8dAFHEBHNE6/7777 NKqDc2kcy8rTs8SOHAVtsksMAfQjlVtfF+eoGLO8tsCfjwuMLtX2ppsXdTQtTa3xnTzU 98xZgvigUWck/MsMr12keZb0r/V3lcGiszesUB8yO73kd5fklQDVnygg3omnDOGHQY9S R6IA== 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=kT3oU3/pHxg3AWot0a+7qppqiU0nm7SvBEuR9n3PDyM=; fh=YAVwb4g7jaT/n1hIOCekMOhh+C/mBia9SPLA2fvZmTA=; b=xxRDPAFYNnTanBgEa7DUwZkIsMbsiWBcdlJfp0oUN26c8stc4c2qytpinzcADk8G/W eoGTud6DPGlSZ1pxmFqe1mmlz6NyJEMz1OCtvl2AOLLiL5IxD4uSJjLoNLCOvwp0N/Ix fxkoWtzseo9ZTgtO6b+0js+5oSKMq04T44ahIk705ssDw1bRkGzLQbt2kjRvXtY3rLvE ZAuvpss7go+xCGY8xhM5tCCLYrkk+Lb66Q2NVo5dRY7S2LsyU6fXJ+pPUE2TaIFTQVgx jxR20C2JHKfL3k4b/rVzG9WX8OmnC/gTzz211o2xCr5RMLMyKIbCNOJ/OqvrhqTJEBhd nEYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FyZQOz/N"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5785238a73esi1018146a12.157.2024.05.24.09.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:23:47 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FyZQOz/N"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 20AB4888D2; Fri, 24 May 2024 18:22:34 +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="FyZQOz/N"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C048C888C6; Fri, 24 May 2024 18:22:30 +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-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (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 05B5B888B9 for ; Fri, 24 May 2024 18:22:27 +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-x32a.google.com with SMTP id 5b1f17b1804b1-4202cea9941so66065475e9.1 for ; Fri, 24 May 2024 09:22:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567746; x=1717172546; 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=kT3oU3/pHxg3AWot0a+7qppqiU0nm7SvBEuR9n3PDyM=; b=FyZQOz/NZ6+wVytt29/Yf/Lli60zSJaWSq+rO0AXLB0sCeTOl6e/z5ByLGLva3PN1X krrFPcKcnQFfaBNNd4DRpi5minRdoULayEMd4RPVT5h+cKETskyKyiKmQQnjvdWLR0oJ aoTZBhXZePK3UIypWvg7HME4FkkpWY53qXpr7qhWJySzsMaC0PBR/Tm0DNxCl324vSae f2jgU29wpd1Vrbt/lcItxQcPHRu7P3Ha5o4dsxGt6BEBQbfGqobVtyeREYBwl6NvQSlr Un8C2Gp6yToixzMwtfhvaoyBV/HxkSA73fL83casjwy5Bba8dr8AV6MT0H5tIeM0p+Xa IwMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567746; x=1717172546; 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=kT3oU3/pHxg3AWot0a+7qppqiU0nm7SvBEuR9n3PDyM=; b=wqE2xDOr0CqE4abNXtbjFtYtvNbzHpOs9TvLAX57LWP997Vx/8dQlc23Dbn8PkGcUL O+TkdgQXPkew5oKCqlY4/ZuLMNxmVmA+Jnitbl410lUM7k2xQysQ1SeiI/8QfBIXzlmO q6+Ijeyh2brRNUvDHTECQQ7lkw6ugX4mpdW5aj7pqQvb2rqvFZFbDhrxTTIbKC4YM9kM XZ/24HJQc22sWg/5KxadpVrcAWwSk92ZlobkV8682eNUKjgRVveTVv1cvmY2W/WvOY13 e9oZcZTmD8F8iawBIC5tYituLveLKdM36RqROBub3oSI3Kq11s57P3788IIrke3VZ9I3 I/Yw== X-Gm-Message-State: AOJu0YwWn5tm9s6EX3IugTNYThU29utnmCjW6qzk4oKP2EJ8QLFlputK dv/wocRJfDjW8405UNWTagMN3iKD4Qla8EOWW97dyQ9N4HJxCDLPxfPJx8Y5rMoq0O9wI3nLse+ YEAhA9Epe X-Received: by 2002:adf:e9ce:0:b0:354:dd23:9dae with SMTP id ffacd0b85a97d-3552fdfa2ffmr1898547f8f.62.1716567746316; Fri, 24 May 2024 09:22:26 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:26 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Simon Glass , Mattijs Korpershoek , Abdellatif El Khlifi , Marek Vasut , Sumit Garg , Caleb Connolly , Sam Protsenko , Nathan Barrett-Morrison Subject: [PATCH v2 13/14] MAINTAINERS: net-lwip: add myself as a maintainer Date: Fri, 24 May 2024 18:20:07 +0200 Message-Id: <41c1758e85e90ec4fb34d56ee4c5434ccf26750c.1716566960.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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 myself as a maintainer for the lwIP network stack integration code and network commands. The library code itself (i.e., most files under lib/lwip/ except README, Makefile and integration files in u-boot) is unmodified from upstream and therefore does not need a maintainer. Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 638b2fdd442..737c73cab34 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1315,6 +1315,17 @@ F: drivers/net/ F: include/net.h F: net/ +NETWORK (LWIP) +M: Jerome Forissier +S: Maintained +F: cmd/net-lwip.c +F: configs/qemu_arm64_lwip_defconfig +F: include/net-lwip.h +F: lib/lwip/Makefile +F: lib/lwip/README +F: lib/lwip/u-boot/ +F: net-lwip/ + NIOS M: Thomas Chou S: Maintained From patchwork Fri May 24 16:20:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 798702 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp800958wrw; Fri, 24 May 2024 09:23:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV+mOmJKMfGbzO5xiz62ZR0X325aQScR4Fs8NggRCu8YFJtVN7lOViwi4udik121RfPrfY6GRnLuJ+jaqkB0RIT X-Google-Smtp-Source: AGHT+IElUDRk1bLWHesIFV53qkI+v5XTi/MBP6vTGEkWB1PJ8bP7RzVWiijo9TUIQRtToPq/AiRX X-Received: by 2002:a17:906:4f16:b0:a59:c7d7:8b0f with SMTP id a640c23a62f3a-a62646cf8e5mr178563366b.29.1716567837613; Fri, 24 May 2024 09:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716567837; cv=none; d=google.com; s=arc-20160816; b=c52fM613htpPJhbcqa2ckvFKCuEdh/6XKr0tF8Ef/4BUVO5lE0D4Qy2NbTAE2iAQb/ yd3YOkk8a6xLHoNG4TJ0lji/I1bGCpoKwseDZMUI9X8pxL6KOPv9DibRNTHdEtvFqXza 6v2OUpmMVYZwZCqbke2sq0m1fk8+l98o57sUR1ZnMWOlleO6FjF9IaHraTKBcxoUuoym K9RohDWMHfiXmLkmpVfg8SWQsqgw2qw3xzezH4mdlUdx3Mwvb+zQ6npM+3mwvdoc4Htb wtIPmWBk4Xy+Eq2prG6hFCP2gIyIfgkWyPH3oQuOmO/e7MPyvrz7sjFx42EI0daAzFqN Md+g== 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=g5LQ34e0u0fQ4V1UZEMkRab/H5C2HjlEu6IA+JOTL3U=; fh=oTBAHDNBhKGwfAq3kwV7wX80Q2la/bGxSGjtAskMngo=; b=ciUCGwkfE/C+Ntmh5OJCPnJR4B2bGnJk9z6y6DoHNuzNcnZmwf2jwYk1P9XBHlDqZP cenX/Q6CVQCkDJw66IZpMRqGODzutNOUB3pcqks07OavNf5PTIHphNEZTcrBqNh+ecrt xmsq7+Sq/+8wrvFKMXDreAQ15dkUtVS1EguFdWz4ajD6lN5CG6sqzQ7QxDG/hnqn33wF hCSB3wjZDCC5e3pdgHsvLttkV7smEQ22VRE+bmbwNb+uVkTnbSlDHLggDDb9IgPQXj3t NKxDrDojgfoA4qDRXtcsrzUGil2rxzoNuV+0WYE06HOwRvGCL6CV7VZg0x49Wdm4xfbf nWjQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="acJg/H8m"; 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 a640c23a62f3a-a626cc37600si97968966b.289.2024.05.24.09.23.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:23:57 -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="acJg/H8m"; 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 80987888BB; Fri, 24 May 2024 18:22:36 +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="acJg/H8m"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 06C0788552; Fri, 24 May 2024 18:22:33 +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-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 ADADB888CF for ; Fri, 24 May 2024 18:22:27 +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-wr1-x433.google.com with SMTP id ffacd0b85a97d-351da5838fcso7124669f8f.1 for ; Fri, 24 May 2024 09:22:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716567747; x=1717172547; 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=g5LQ34e0u0fQ4V1UZEMkRab/H5C2HjlEu6IA+JOTL3U=; b=acJg/H8mamvnwALPzhpVB/UHqYU6CX99xFuMZjFWDU7WN0ca7g3plMTIvOO9gFmSlI H54bSToNse2E81UsRLQltL8F+1I9nEYuVGMb83HK//u5jHu8kqinu9GIUL9sRZaLq2QS IUiBC6kZrBx5LGHG3njZFSCo+Innh+zfh1hD9IYAv/Ce8DZO/M2+Q5L2d+ahVjwKIDiM aOrIbPak02WmaG1D8roZjMmb/m89zYSoKTvvodwnau55AFVPNjY+0N6HUvoPdrtTTwFw p3fI+RbsZ9p2vH1LCVzGUp1b23SoOauTsubgx/CW7GtFIXl6UGqKndJf6cDO/OTz2xor JPhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716567747; x=1717172547; 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=g5LQ34e0u0fQ4V1UZEMkRab/H5C2HjlEu6IA+JOTL3U=; b=vNOZO1QgMqYWHlc/J4R9V57W5jzuscY7W4lJ5ggMuxlB3mjvyL3lIHmlSc2+r+NdkU LnrWaXCzJkGm/6R365nc4mh3bQgb/ej+VwRs+YcpK3C1hl7eziTkmHrDGjYjRbE/YCWj OFDbrc7lxiS/M6vtLe76do/PmlCjQDR5t2Iei7apno3RdxsSJbof4WhyuaRy1neageOE mo4FIpIZNEixdDWFnRWWwTINAZp+Iy/AeTh8XEC/w3DQCS7Tnx4d7/b45Hq3TL1C7/E+ U0uUrrkympVT891HDMdDdmurNgixSBWFbcF+yJchw4VmTlU+Uz3j7ZVZCh9x35hLuht1 RQ/g== X-Gm-Message-State: AOJu0YxQIhoG9MwpDh/OSK+bHzCggHSZotPdepSk8l3yc7g3u3kIEcxf 8rTbWtD9YapDxeAYuY/afEJiuA6B4TBkJqKCPg9WNUD1xLnMgrQYvwGGiRvJPJGGT6uFz0GtBbC RtrLp430z X-Received: by 2002:adf:f38f:0:b0:352:9e0c:f9d3 with SMTP id ffacd0b85a97d-3552219d081mr1789472f8f.31.1716567747100; Fri, 24 May 2024 09:22:27 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:80fe:af01:c137:b43b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c918csm1928465f8f.77.2024.05.24.09.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:22:26 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Simon Glass , Leo Yu-Chi Liang Subject: [PATCH v2 14/14] CI: add qemu_arm64_lwip to the test matrix Date: Fri, 24 May 2024 18:20:08 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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 Build and run qemu_arm64_lwip_defconfig in CI. This tests the lightweight IP (lwIP) implementation of the dhcp, tftpboot and ping commands. Signed-off-by: Jerome Forissier --- .azure-pipelines.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 27f69583c65..b036999210f 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -199,6 +199,10 @@ stages: cd \${WORK_DIR} git config --global --add safe.directory \${WORK_DIR} git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks + # qemu_arm64_lwip_defconfig is the same as qemu_arm64 but with NET_LWIP enabled. + # The test config and the boardenv file from qemu_arm64 can be re-used so create symlinks + ln -s conf.qemu_arm64_na /tmp/uboot-test-hooks/bin/travis-ci/conf.qemu_arm64_lwip_na + ln -s u_boot_boardenv_qemu_arm64_na.py /tmp/uboot-test-hooks/py/travis-ci/u_boot_boardenv_qemu_arm64_lwip_na.py ln -s travis-ci /tmp/uboot-test-hooks/bin/\`hostname\` ln -s travis-ci /tmp/uboot-test-hooks/py/\`hostname\` grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd @@ -371,6 +375,9 @@ stages: qemu_arm64: TEST_PY_BD: "qemu_arm64" TEST_PY_TEST_SPEC: "not sleep" + qemu_arm64_lwip: + TEST_PY_BD: "qemu_arm64_lwip" + TEST_PY_TEST_SPEC: "test_net_dhcp_lwip or test_net_ping_lwip or test_net_tftpboot_lwip" qemu_m68k: TEST_PY_BD: "M5208EVBE" TEST_PY_ID: "--id qemu"