From patchwork Thu Jun 6 13:35:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 802015 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp399218wro; Thu, 6 Jun 2024 09:36:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVg762HrWFJnGHCWRlaiiKqaKfyTkaCDcF41uC69ehexkw/JTnSIAK8EgOSpJAMn+O2jKHZRyK26IRMhyzCJ4/T X-Google-Smtp-Source: AGHT+IHWxtyGG4j2MgMwRIqj9EtEJQy7tIZcC4UfbwxCJb9MvkL+iu3BJpu7/Cr9pQvFg3NgTczR X-Received: by 2002:a50:8ada:0:b0:57a:32df:98ee with SMTP id 4fb4d7f45d1cf-57a8b6f0f75mr4027659a12.22.1717691810568; Thu, 06 Jun 2024 09:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717691810; cv=none; d=google.com; s=arc-20160816; b=XN/6poQwb6dZJdp8Zqd6GYSF6fYun04zbeY1X1qbjKramMcNeO8LYk8yI3qBYOhKLQ mYPjizolXIatVJ8+IZL8eKAckmMd9TVxhXAuMohAQBbK8eGHK0cakown/PtS88hFgUqC DMa/eE08dtHGAiSneO038+vlpV2nTAQlNauSbsZN0yR/HYnHF4yNxDdFQ042jKN+xZWh t1/KHzeSdcmojFG5lP0gLGvLNuthHiDMXUMlVSsA2S8jREPjY9mON3xz8e4ZFvgboJkh txpiZHAvElSwRPL2s4aofkUsIMzHXYXeGnvDfb3A0AevVHC+1afHaRQZ41cVbgvrqqU2 tH/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2aIAacY4b9gwYMIGJldrbYZiYVcQ/I1Rb7nia3l7JOE=; fh=czYpH2hw9sf6CWzyn3nb5ufwCMY86z0dXJT9WcvsEso=; b=h8iaOZPEaH8tTrdJQgbUmbT7rZTJSnSfXOAa5GXW72zGzIqqJHYG7aOr8xZUZJo1PC O8XfE6h/XmITVJAG6HgB3XUK5Qd5ExtiGOYwVJB+d+UtviiSkrYd5nCX3Fsi6DMbaZwh xYZBbvb785cYRygaSi5r8X4nlRSD1U/2nF1QeZKDrNYj/cG0GvU8j1rRsa9ScAJHoEX7 ijS3+Z1MDGCSez3p+dBYJ3KSuNnOYZgAwWlE/d4tHkPWZm+yh3zTLYPx4FaW5fJqqqjk Kr1W+IU0uxTpk41pMNB3DiV8ifPomAw4C9H7FuNKGvGLcuijye80Er6m6WDIOX3Rkq4h YTmQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ptrsTEmJ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae0c70ccsi838964a12.43.2024.06.06.09.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 09:36:50 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ptrsTEmJ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 006248850D; Thu, 6 Jun 2024 18:34:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ptrsTEmJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1BF9688395; Thu, 6 Jun 2024 15:36:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 39CB3883AA for ; Thu, 6 Jun 2024 15:36:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4215b0c4b7dso10583885e9.0 for ; Thu, 06 Jun 2024 06:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681015; x=1718285815; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2aIAacY4b9gwYMIGJldrbYZiYVcQ/I1Rb7nia3l7JOE=; b=ptrsTEmJh7E2/aeer6tO87afDqOQaSRAZ3nKNQn84ACnNM17F5YdxFqKUPkbQMKP7F WLpXmogPsxIpZTYLPzn7e+q/g7VciaxmOf0i6XsJdaO85I3G7xn/7j1YTRqNEruwx9Oj YP2HGGfeuIT4KUz/Kp1B7NB2z58P3cPqqWVSE2Q0zskQ//Nstb4hxoVBrus+bRShC8l/ hGXzyAVSyiClyvlumJHRVVFSxMuVDSH5LKrM/N8/5i7eUBxx8FxQljoVU8J3u77JGapi ob+qXnQFGaXQwMp1RJEgEY1+tXq5x3IkLDKUKy0KCZCuqVdYqLZX8kmSV9MZLJzKIkDp XWsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681015; x=1718285815; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2aIAacY4b9gwYMIGJldrbYZiYVcQ/I1Rb7nia3l7JOE=; b=FTLNeBCIeCOI59d5uP+g8YxiPS4AnhnNf5ZUD35O+XaZ2Rw2uGiDqt+bVN0dAhmXPP TedU1/KMBX2dDueQFqq8WUtx4DE36VKJhRpCksNAR0VrBjBKzw8vMtMcVCXsv0Hl2XsV tadJrQARbxA6pRFw9UjeMrQvKnW3ncEvru4Z4TNEtJIIWrnvCTC/kC8on45gcrc/n/eJ l2lV+aLQ0d4/oJ/jxXTbUQnAZHjnGi43VnBTZzj1SMzSRN9CMVDwcPS8Im46B3g8n9MY tt0+cQCHAiDO+Z7msX6AtMF7Xdzd0jbANmLojo4ZPby0VerIt8LctnqmSiXkVXHEUOS4 bqfA== X-Gm-Message-State: AOJu0YxRit3B+dm9mabU8hzJjEvgIE1QWkdy7vCCGZJkqCcrlR33Mbf0 2bOWuNo4nG1aHBzkpML+DKgzIQXX3KXdUDaTLnMiSSZiv/+Ld14X55/myNXejnjanrqBTAWj8GP OF/Lkwkvj X-Received: by 2002:a05:600c:41c3:b0:41f:ec3e:9797 with SMTP id 5b1f17b1804b1-421562cf729mr42849475e9.16.1717681015379; Thu, 06 Jun 2024 06:36:55 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:36:55 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Lukasz Majewski , Mattijs Korpershoek , Joe Hershberger , Ramon Fried , Marek Vasut , Simon Glass , Nathan Barrett-Morrison , Shengyu Qu , Jesse Taube , Greg Malysa , Heinrich Schuchardt , Sumit Garg , Andrew Davis , Bryan Brattlof , "Leon M. Busch-George" , Samuel Dionne-Riel , Ying Sun , Jagan Teki , Bin Meng , Rasmus Villemoes , Joshua Watt , Sean Anderson , Andre Przywara , Mayuresh Chitale , Samuel Holland , Oleksandr Suvorov , Patrice Chotard , Ashok Reddy Soma , Patrick Delaunay , Jaehoon Chung , Svyatoslav Ryhel , Quentin Schulz , Alexey Romanov , Ion Agorria , Nicolas Frattaroli , Yanhong Wang , Miquel Raynal , Jonas Karlman , Baruch Siach Subject: [PATCH v3 01/12] net: introduce alternative implementation as net-lwip/ Date: Thu, 6 Jun 2024 15:35:56 +0200 Message-Id: <46becb46b92b6ea945112785b17a59c9ce7498d3.1717680809.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 06 Jun 2024 18:34:03 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Prepare the introduction of the lwIP (lightweight IP) TCP/IP stack by adding a new net-lwip/ directory and the NET_LWIP symbol. Network support is either NO_NET, NET (legacy stack) or NET_LWIP. Subsequent commits will introduce the lwIP code, re-work the NETDEVICE integration and port some of the NET commands and features to lwIP. SPL_NET cannot be enabled when NET_LWIP=y. SPL_NET pulls some symbols that are part of NET (such as arp_init(), arp_timeout_check(), arp_receive(), net_arp_wait_packet_ip()). lwIP support in SPL may be added later. Similarly, DFU_TFTP is not compatible with NET_LWIP because it depends on net_loop(), tftp_timeout_ms, tftp_timeout_count_max. Let's add a dependency of DFU_OVER_TFTP on !NET_LWIP for now. Signed-off-by: Jerome Forissier --- Kconfig | 40 ++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- common/Kconfig | 2 +- common/spl/Kconfig | 1 + drivers/dfu/Kconfig | 2 +- drivers/fastboot/Kconfig | 4 ++-- drivers/net/phy/Kconfig | 2 +- drivers/usb/gadget/Kconfig | 2 +- net-lwip/Kconfig | 37 +++++++++++++++++++++++++++++++++++ net/Kconfig | 14 ------------- 10 files changed, 85 insertions(+), 21 deletions(-) create mode 100644 net-lwip/Kconfig diff --git a/Kconfig b/Kconfig index 82df59f176e..b7304bd37c5 100644 --- a/Kconfig +++ b/Kconfig @@ -745,7 +745,47 @@ source "dts/Kconfig" source "env/Kconfig" +choice + prompt "Networking stack" + default NET + +config NO_NET + bool "No networking support" + +config NET + bool "Legacy U-Boot networking stack" + imply NETDEVICES + +config NET_LWIP + bool "Use lwIP for networking stack" + imply NETDEVICES + help + Include networking support based on the lwIP (lightweight IP) + TCP/IP stack (https://nongnu.org/lwip). This is a replacement for + the default U-Boot network stack and applications located in net/ + and enabled via CONFIG_NET as well as other pieces of code that + depend on CONFIG_NET (such as cmd/net.c enabled via CONFIG_CMD_NET). + Therefore the two symbols CONFIG_NET and CONFIG_NET_LWIP are mutually + exclusive. + +endchoice + +if NET source "net/Kconfig" +endif + +if NET_LWIP +source "net-lwip/Kconfig" +endif + +config SYS_RX_ETH_BUFFER + int "Number of receive packet buffers" + default 4 + help + Defines the number of Ethernet receive buffers. On some Ethernet + controllers it is recommended to set this value to 8 or even higher, + since all buffers can be full shortly after enabling the interface on + high Ethernet traffic. source "drivers/Kconfig" diff --git a/Makefile b/Makefile index f8206b2e30a..ceb99a2698e 100644 --- a/Makefile +++ b/Makefile @@ -859,7 +859,7 @@ libs-$(CONFIG_OF_EMBED) += dts/ libs-y += env/ libs-y += lib/ libs-y += fs/ -libs-y += net/ +libs-$(CONFIG_NET) += net/ libs-y += disk/ libs-y += drivers/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ diff --git a/common/Kconfig b/common/Kconfig index 5e3070e9253..807b726384d 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -424,7 +424,7 @@ config LOGF_FUNC_PAD config LOG_SYSLOG bool "Log output to syslog server" - depends on NET + depends on NET || NET_LWIP help Enables a log driver which broadcasts log records via UDP port 514 to syslog servers. diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 6405374bcc1..f67f0a859db 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -1055,6 +1055,7 @@ config SPL_DM_SPI_FLASH config SPL_NET bool "Support networking" + depends on !NET_LWIP help Enable support for network devices (such as Ethernet) in SPL. This permits SPL to load U-Boot over a network link rather than diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig index 0360d9da142..c6bce82eb10 100644 --- a/drivers/dfu/Kconfig +++ b/drivers/dfu/Kconfig @@ -11,7 +11,7 @@ config DFU_OVER_USB config DFU_OVER_TFTP bool - depends on NET + depends on NET && !NET_LWIP if DFU config DFU_WRITE_ALT diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index 70207573de2..05e988166fb 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -27,7 +27,7 @@ config USB_FUNCTION_FASTBOOT This enables the USB part of the fastboot gadget. config UDP_FUNCTION_FASTBOOT - depends on NET + depends on NET || NET_LWIP select FASTBOOT bool "Enable fastboot protocol over UDP" help @@ -41,7 +41,7 @@ config UDP_FUNCTION_FASTBOOT_PORT The fastboot protocol requires a UDP port number. config TCP_FUNCTION_FASTBOOT - depends on NET + depends on NET || NET_LWIP select FASTBOOT bool "Enable fastboot protocol over TCP" help diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 3d96938eaba..738752d29c2 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -11,7 +11,7 @@ config MV88E6352_SWITCH menuconfig PHYLIB bool "Ethernet PHY (physical media interface) support" - depends on NET + depends on NET || NET_LWIP help Enable Ethernet PHY (physical media interface) support. diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 4621a6fd5e6..03fe3bca197 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -224,7 +224,7 @@ endif # USB_GADGET_DOWNLOAD config USB_ETHER bool "USB Ethernet Gadget" - depends on NET + depends on NET || NET_LWIP default y if ARCH_SUNXI && USB_MUSB_GADGET help Creates an Ethernet network device through a USB peripheral diff --git a/net-lwip/Kconfig b/net-lwip/Kconfig new file mode 100644 index 00000000000..a0938964b51 --- /dev/null +++ b/net-lwip/Kconfig @@ -0,0 +1,37 @@ +# +# Network configuration (with lwIP stack) +# + +config LWIP_DEBUG + bool "Enable debug traces in the lwIP library" + +config LWIP_ASSERT + bool "Enable assertions in the lwIP library" + +config PROT_DHCP_LWIP + bool "DHCP support in lwIP" + depends on PROT_UDP_LWIP + help + Enable support for the DHCP protocol in lwIP. + +config PROT_DNS_LWIP + bool + depends on PROT_UDP_LWIP + +config PROT_RAW_LWIP + bool + +config PROT_TCP_LWIP + bool + +config PROT_UDP_LWIP + bool + +config BOOTDEV_ETH + bool "Enable bootdev for ethernet" + depends on BOOTSTD + default y + help + Provide a bootdev for ethernet so that is it possible to boot + an operating system over the network, using the PXE (Preboot + Execution Environment) protocol. diff --git a/net/Kconfig b/net/Kconfig index 5dff6336293..4929428d2a5 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -2,11 +2,6 @@ # Network configuration # -menuconfig NET - bool "Networking support" - default y - imply NETDEVICES - if NET config ARP_TIMEOUT @@ -254,12 +249,3 @@ config IPV6 address and find it, it will force using IPv6 in the network stack. endif # if NET - -config SYS_RX_ETH_BUFFER - int "Number of receive packet buffers" - default 4 - help - Defines the number of Ethernet receive buffers. On some Ethernet - controllers it is recommended to set this value to 8 or even higher, - since all buffers can be full shortly after enabling the interface on - high Ethernet traffic. From patchwork Thu Jun 6 13:35: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: 802005 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp305908wro; Thu, 6 Jun 2024 06:37:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXasXLTYiy21BOw8gS/KECC2qMw2eniDL+k3bPSEL7hRaAwwllJqBLyrAGTvqFT0iHGCHVTeoDLlxq89L3iTS7s X-Google-Smtp-Source: AGHT+IFjAZwFBxcQUS7tp2b1E4pTe/yd8f4ySwm5rionsNxrGGNlRUZzY3N+fXOls6jY0v9Rem9d X-Received: by 2002:a17:906:2352:b0:a67:907f:e68a with SMTP id a640c23a62f3a-a6c763bf3e4mr247512366b.27.1717681030656; Thu, 06 Jun 2024 06:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717681030; cv=none; d=google.com; s=arc-20160816; b=u7Pz0ugct7dkcKrz/D1h6FXKgk1z9nD25ge1Scle64Tt6eOn6NusQuxyE9UKpVNf34 idq5leau9jS/652Go4aE35esboBz2XEzkN2ep51KJOLv3dW0UA/17ogZVDjx/acFmZvR 25AduhM+GhS3B0TsrIV1z6PhvsADyNTLecFSKCTbfiLfR4Ey9cfLQ1at7FnJRQtHRUwr szxzq9wcsJe6zZC/mAGKgqbEfa0OQMk+16D7LHo0+orP18u9t6d7T21Pwd3rVjG7cmwZ grBtyFcdotI1hFn9txa986v5C8dfELzrgO7TCC6sXvtGOyZIzr/DJeWMUioXlc1TSbNP 3hVQ== 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=VSkqtxT+T85ROLkfBgiZkH9U7IUuwGGFNnXV77eml8U=; fh=ECog7FaK8QWb/BkRZjLo6i/s8VPf2Pglppj9enr2Fb4=; b=tsIM+4dD48dOy6hQQKyj/bSeu/Dp6sTI6GEH10g4hAVixn7bcx3BR8dBvyw+ceThAq DMa5b1t0U8i5hHGxHkqZSiKR9O2jXRNZn1yeneTqr1Hn6zC4lrbm96uE+TbZU7cKShRv DGLBXjQkFETMjtq4RwXda4NECuTDfw5Sq8fDkNw2UKIXojGd74uZbfAlZL6EPyDwBoxd OccRz21pgQ2znK+OUCAzNsV+KxmAjqKO9rPhqohS5x/hEMx+iYy9RXAQHihKkM3XcoYV InjXgDI4vWBzouRrJ5wUvwpBviHcf9e1mtR4p6YE+bJJZKyIXRsJvY79tcfYQ+bXuCg8 fvlg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=etRB7NbO; 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-a6c8074bd94si68386766b.1034.2024.06.06.06.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:10 -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=etRB7NbO; 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 BC1E4881CE; Thu, 6 Jun 2024 15:37:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="etRB7NbO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A324888247; Thu, 6 Jun 2024 15:37:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (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 4733988428 for ; Thu, 6 Jun 2024 15:36:58 +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-x32f.google.com with SMTP id 5b1f17b1804b1-4215b0bffe1so5712525e9.0 for ; Thu, 06 Jun 2024 06:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681017; x=1718285817; 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=VSkqtxT+T85ROLkfBgiZkH9U7IUuwGGFNnXV77eml8U=; b=etRB7NbO6J33vGKfi17fM7rHWyliV+q3Zpwc0rnGmUt3y3wRfQqzqBvHSMGMEumXxF 0oSI1KSSvE2G4gpA2DYRxJL+62LQ7TMYWCSfi9wpYEZzDk0tGZWSXXA+qrqM0o7li5Qn ye9ZjeuWrUpgfoxhzA9eJcLqbDEjzR+yZ3BczmUSBHA4BQd+vc616+eSIUxVsk5W+uGo I5LPIHisO19EKsIR9yLQ14gHpe8tTpYWX1wH25uPf9q03lLziVX9KP1VMvEfo3O18dZx oZZYzkbLRrRC5zZSyQOqQTI86/K4G9FX1yO/gB3RO2y4IcATQQFLQ1mg3dLYsQ8IwLx+ c12Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681017; x=1718285817; 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=VSkqtxT+T85ROLkfBgiZkH9U7IUuwGGFNnXV77eml8U=; b=Yc10xer++4PMWtCtWCQWyu2gxdWG3Qriw06hAKd85CweQpghUm5zMUqyqnzr/s6Sk7 QO+JP+tAWmQ7BpVJgjEUGqrOLrPYSpW3oBauTIM8V2foZ0WJP9QjTsAQvy0NiWwnL5UW 0SZMekpMnOe+uWZINXivm2guOwopFtUEfe8kiNpHT2W6sLt+KgWxUu4ZENJFG6J3/gsr h25s13kQfBMutRFCbG1oyX49KHf7xUIuOHWbW2xiElXbjqjNJyZ1FpLPp+ibXpH+QRi/ YXGY5BZ/Q3L+ponYIlGgk951yrPEcJm6kCHx+CmxBBVcaa4YfIlwB1cTMUT6vk3uXrUh DvMQ== X-Gm-Message-State: AOJu0Ywgo8QHnyGSN3Iv+JbNej25o83Pu2kA5kGfFr2yp9bkbNriGE5N LUF6JnSGyfaWcfgGUufRsxeTO+ztCYFKSrRLE5XfV3ZyZCUbysqUWHqk6iptAJ7ydC99Qpskc28 pGWzTVaqY X-Received: by 2002:a05:600c:444f:b0:421:1b8d:2df0 with SMTP id 5b1f17b1804b1-4215ace2a89mr25428385e9.7.1717681017556; Thu, 06 Jun 2024 06:36:57 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:36:57 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini , Simon Glass , Sean Anderson , Oleksandr Suvorov Subject: [PATCH v3 02/12] net-lwip: build lwIP Date: Thu, 6 Jun 2024 15:35:57 +0200 Message-Id: <834de4823c6d6cde1416c21e31999efdabdac19c.1717680809.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 Acked-by: Ilias Apalodimas --- 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 ++++++++++++++++++++++++++++++++ 6 files changed, 299 insertions(+) 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 */ From patchwork Thu Jun 6 13:35: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: 802016 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp399291wro; Thu, 6 Jun 2024 09:37:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXzRW6/qzNvghWHOIeDyRm/xmDTQP2+kuuwk56Woa8ocQyWtJOHY+1gnjhNwKQ69wUHKX7KMH3ssgMr7PK4pU4v X-Google-Smtp-Source: AGHT+IEcAI4lXBdnqlNO+HRGp4Wa0LBITj01iQ/0N1ol4C3l5qAcZMtS5zG+CkN+z01+B+jQ66l1 X-Received: by 2002:a05:6512:3b11:b0:52b:aa18:1c52 with SMTP id 2adb3069b0e04-52bb9f6376emr181998e87.4.1717691821109; Thu, 06 Jun 2024 09:37:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717691821; cv=none; d=google.com; s=arc-20160816; b=b0FcYvkhyZsQO+7HS3DNIR7XAqq25mzNJnNRdwVKHYQ8BRGYLn+hSN+M/lOVp8tSA6 VlcqMAfXMo2qxQ6aQk6L+q+5fCp4LNgLe4TAW/pgaeGk5J23anQsEvia/5CHjTR3HiNF WYIo4F4DEHKugaPJAxxY/g3mIpIs2BLcyP8CY9b5fxkiiwe+DFhptO+Ww8tWBxxX8sWr UcOKolPEDCoG3rCl5dERX+UX+ld3upl6j4QtZp/VElKKhdJtvKxhJWFBxQYJ/tbbgFKa XxJlmiObCnbVq3twsQGF4G9IlBWqIHieQ406QwmAzVssdqhgOKNsMTmxG3KzN/EoY2sA OLIw== 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=4RzFAA9LYOYXHC/Gax1OLSKwhVCmqlmkqrYorjPNo60=; fh=uuhH2aBDY6H/AZPbq4lKOutZqIpnTbxnVYGz++fNCPM=; b=k2plmuUbVH8JJxAoh1YSJZJS757zsZ3NJCXN/0PMUnVnCR1nkc6hwlQhuf+hJv7KwL QMgxMrA88uCyr+duU7IlNFPBM+Y7eymVYrWrMLo0iqG2C6C0z9L8LWr85ShWf8rs+lA8 a0UoIcOHuF4dVHZONhvEyEgLadcTPe1kHW8QAKeI8GNuXlHq8zIzSo5EVHOwnmAuHYVp lYE3HhKWk7VDUlRU/ycmkMPTDteCfm8E00YLYQ+kbqXrwD+hf0vgdPatX0hhIuQFqDvz 6hImbQYJNPi3grMlvInnQC3BgELlGYQ1OERaEUD/EyE2YIjaI/3I5C+8czyn+F1e5QLV 5oog==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iNMF5t7V; 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-a6c80749495si82181766b.1012.2024.06.06.09.37.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 09:37:01 -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=iNMF5t7V; 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 589708851A; Thu, 6 Jun 2024 18:34:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="iNMF5t7V"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 12F3588266; Thu, 6 Jun 2024 15:37:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 30BD0883E3 for ; Thu, 6 Jun 2024 15:37:03 +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-x335.google.com with SMTP id 5b1f17b1804b1-421396e3918so13067605e9.0 for ; Thu, 06 Jun 2024 06:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681022; x=1718285822; 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=4RzFAA9LYOYXHC/Gax1OLSKwhVCmqlmkqrYorjPNo60=; b=iNMF5t7VX5700e8W8FWIytooH9O7m6p6ABMZfnO50fm5rdgL+4Bmc0xB9RgHZUgFSk Rnuy7h0P8NuQhM6u4U1z0D9WIF9lDyJlKelRGn2ZTpBml85WCFmQv+xXCRktilFHmN65 CMB7if6kTrV6rDMdFi5BXHLbR+gO1ioDdW3j+i3rBeQVjYSZteGlpomskU9Gl0gyW8wM 3ecy5f8820BxOCE/QoMzF/vBVXRpLQawEAz8QJxMtXNvdKyi6UYmFJqawU/fgieJwqm3 4SUZbXn/wfWshrGjQ7dfE8Avk+j4EVT4wzU91oFuZo1QML1cS5Du4zo8uNtD1FHxrY2Z 8DIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681022; x=1718285822; 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=4RzFAA9LYOYXHC/Gax1OLSKwhVCmqlmkqrYorjPNo60=; b=fzi/NYhNLQI9H1LePJYHAP0WiUwqDIAGA6pzb0IjoRQlh26xw9pzen7Hpa/pHj6/hE FJcL9VmaL4YoHuYERZXJWvmAADer6AZ3Gw4RCLdGAFmlpRoj3saLxeq5Yt0JM08BMkMn IZY73ERTy7oumDyvrKD/DH0ZO4MTP8GTLHyaEeqypq8mIzsNITHMc8fBJ1733uIRlRZD VUileumytkPBnvaeEHCUb/SXnasa+JrSmM3mdmEmZCyUri16UPICWgbf6+UIjJ9Lkd69 wtR0yr853T2sH0JFvtVPGKc1aTkH/69qsfWr5ZzWb7EMVzUTH/IvhvVYc6bQYRgXPVX6 bx1g== X-Gm-Message-State: AOJu0Yx+Z/FEMVyRBLNH+SBZuz8RbyxrXGJrRAvGWHHP09XvTryp6twQ me1igAo6Stj11AYtN5KLe92s9YBLv5TnLQDbU9rpk8xnGO/SlYJTchWz6m8gTJjyXrdQI8J9q8N vaXDoaX6Z X-Received: by 2002:a05:600c:6a82:b0:421:54da:8dff with SMTP id 5b1f17b1804b1-42156357040mr55997215e9.41.1717681021627; Thu, 06 Jun 2024 06:37:01 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.37.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:01 -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 , Marek Vasut , Sumit Garg , Andrew Davis , Bryan Brattlof , Jesse Taube , "Leon M. Busch-George" , Eddie James , Mattijs Korpershoek , AKASHI Takahiro , Michal Simek , Francis Laniel , Peter Robinson , Abdellatif El Khlifi , Artur Rojek , Bin Meng , Shiji Yang , Yang Xiwen , Kever Yang , Eugen Hristev , Yanhong Wang , Jonas Karlman , Boon Khai Ng , Neil Armstrong , Masahisa Kojima , Ioana Ciornei , Sean Anderson Subject: [PATCH v3 03/12] net-lwip: add DHCP support and dhcp commmand Date: Thu, 6 Jun 2024 15:35:58 +0200 Message-Id: <02e13fa4f3a1779afaa16f55cff5fb3bf68ce903.1717680809.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 06 Jun 2024 18:34:03 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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/Makefile | 15 +++ net-lwip/dhcp.c | 105 +++++++++++++++++++ net-lwip/eth_internal.h | 35 +++++++ net-lwip/net-lwip.c | 224 ++++++++++++++++++++++++++++++++++++++++ net-lwip/tftp.c | 11 ++ 14 files changed, 525 insertions(+), 5 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 ceb99a2698e..d3c9e6775dc 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/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 Thu Jun 6 13:35: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: 802006 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp305995wro; Thu, 6 Jun 2024 06:37:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX4iLm5P2r06evsmmPNovi5UJPq86m2xQ7YgXXA7btEGDeeUJ97DQOawtPdClil790TBL9nq8p2qVUQUkuMTbGG X-Google-Smtp-Source: AGHT+IEdaabg1JrUYnOoANbpJJBMhAqwZbw7WpJYcUM0jAW+1+1IuyeEO/2H1fM6NRv8rdNYvf6G X-Received: by 2002:a50:baaf:0:b0:574:ecf3:f7d1 with SMTP id 4fb4d7f45d1cf-57aa5301729mr2441808a12.0.1717681042403; Thu, 06 Jun 2024 06:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717681042; cv=none; d=google.com; s=arc-20160816; b=SsnZolvDdANAZuhdB5pPGoub2ijujDiiNgunpWgYM/V5aAh/CidfpnCGygaYYNZmec pXNTLxhfUDzRe2/PDKAAgp511Bxaps7cxhbOY+7LQjJMUiRLKifHVt8rmkGbr+cOZaTA xeGGRlV+bUdcwWMdWIgkvd4/eKa/Fn1baglPcVbAZl34Ox9NCfQcwc2MQSi0uz28UCHc NKBHSLVKtW5+gr1qo4sRMbzudTFh0+QDbrsNL+pae3cstOLR9YINEpuWzOP3dfnJQH23 GdDYAMH8hgm/6tQQgoDHaCSPKHvZltfm5+oTRQPPkKxxGNjT/oNG/51N2AD+mg5OF6jb rMsw== 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=gixJyMqtgR/Ja9yTjknGq4WaI5xi6z803iO4UfDzWGo=; fh=y2nlSdy1rqA5NrxJUQRURuS/z+wpts0xge8v0NIVeLA=; b=GSa7zK42lsIGA6Vwu4uSyUxw8zFRQhhDue2VkslBnpOHx4Y4Q9BwyRYpDbihM9hhQK FRovQ4Lj3JXoYOm/nCvShqZ7fnBlyoR7tmdrij7ovpRq0kEQLFqKlpjkqo7ATclEGnZI YlVf4RXfsJBf0WSABFQ2+1S3XXP498GGVnhKkRW52CjZe0tyFErbV/7Ll9kttp76FvAZ 4n9NfaiJfwoP7tyeKICQfFIzQHudRySMM2GeFc9JbRayCrFy1zun1S9v8pLyWY7Su6ve YR8RUfsTxoCsB5itzoMxiBJKrPjL7+lvlIMVK8dRaGM9fJpmw/QFvilD2S6Tsdd3qAJL NidA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tDs0sYUB; 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-57aae25f96dsi711123a12.516.2024.06.06.06.37.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:22 -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=tDs0sYUB; 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 2E1C0883C2; Thu, 6 Jun 2024 15:37: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=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="tDs0sYUB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB3C2883C2; Thu, 6 Jun 2024 15:37:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (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 1DB978844E for ; Thu, 6 Jun 2024 15:37: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-x331.google.com with SMTP id 5b1f17b1804b1-42108856c33so12596085e9.1 for ; Thu, 06 Jun 2024 06:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681023; x=1718285823; 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=gixJyMqtgR/Ja9yTjknGq4WaI5xi6z803iO4UfDzWGo=; b=tDs0sYUB5abuuc7nzP9F1xE2q76RxWY4mLGiiF9MxzexMgeWU6i+LfUSdVC1qW8kJZ vZSALIz2ey/OtvpjpbTQVht5oo8LzxgvauTbhaFd8172XwojzHRmOPMMu2hzr+vtRJqw xfmWnx4CdhhfTqAifFQFyHCVLGA4TeO4gHEx7sen7TxEKWnomV+cAkdGdxHfLZL4cnjJ Q+WMmOCmMCJDpsLgfiRQaEXSY4OOIW+g+OPQ8jmU+38S1nLNxJGzdM4pcBX/re092I7F BpfQOe7tPOEAeJSA3pZXbfj09gi7AIZmERJBM1i+rRben67lWsoFMvHenK2NQyZwnDj8 thJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681023; x=1718285823; 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=gixJyMqtgR/Ja9yTjknGq4WaI5xi6z803iO4UfDzWGo=; b=HZXeuzFKetIw437XZeCxgUGN9RKCKUm1lUd3LgItmT30nXLnjH//s4euRKbZFXM7xR 2hBjvkp/eXcDZDA1u4lSCspf1IkwGulA9AsBdaxgebIe0glsgO5Hqj7U+TI28lETpsw2 5pBYaoMlMzSQwpx0/ulBNsp/J/JX2UzeVRAsCz0isOszXlAqKomDPo9UwXjpW5V5xpAR +pVbm7EcuyVuKbMs3u3HqdrR1OfcmnNft4Pd8V0lS+OSNiHezXaPLzzAXI/o+t1qF8L5 UL2msjLk+nLK24xm2Zfk4DFI/J7XL5sHt5xJENEyXLaZ2sXp1KBPanYKckmgY49dpVkM B0NA== X-Gm-Message-State: AOJu0YzKFf9GzwZE5tf3z9vfSczpi+iDIyIL+qmluSWxVA5t7N91GdR9 cweWd+Em/Yzi9SwLZYck+2TvFwIepmI05i0QTNfD9Un8xaY2XGPqb/aa0lMm2Dhl7Km2SfrAD4a wFuUJi8Dq X-Received: by 2002:a05:600c:1c28:b0:420:1a72:69dd with SMTP id 5b1f17b1804b1-4215acf92damr22605235e9.10.1717681023372; Thu, 06 Jun 2024 06:37:03 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.37.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:03 -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 v3 04/12] net-lwip: add TFTP support and tftpboot command Date: Thu, 6 Jun 2024 15:35:59 +0200 Message-Id: <805d51e8a6a2f54ae7fc20d9fbc599fb71866755.1717680809.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 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 | 202 +++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 219 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..02ee4aacca5 100644 --- a/net-lwip/tftp.c +++ b/net-lwip/tftp.c @@ -2,10 +2,208 @@ /* Copyright (C) 2024 Linaro Ltd. */ #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; + printf("\nBytes transferred = %lu (%lx hex)\n", size, size); + + 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 Thu Jun 6 13:36: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: 802007 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp306070wro; Thu, 6 Jun 2024 06:37:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUSxXfFUg7poAj6LnZcQEmCxcMbi0o47hfilRZ/xENRcj3zQQrBQi5b121CKXfWhwbqNWtoOS9GvjZ8k5vJ24Br X-Google-Smtp-Source: AGHT+IE9E9L84x7UF9ia+Qz99O3xw+9Ms52hYZe6NZEHAetNwmaSzDJk4Zu2kvb8YMWb0oQfYcmZ X-Received: by 2002:ac2:5b4c:0:b0:52b:61e7:29c5 with SMTP id 2adb3069b0e04-52bab4fbfdbmr3236581e87.66.1717681052697; Thu, 06 Jun 2024 06:37:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717681052; cv=none; d=google.com; s=arc-20160816; b=fbV3o3DirJRScfNzyHH6XI9yPCbukgcL1D2wlRJKgodXqQG7e950doJgISu9jNUbnt mmfFXR0iCOWr2sLjao8z9kyyYK4/6uXl0XAGESTZX50h+GIfU7jxZDEtmrlz33DJFQp/ 6q0VdXrJzB3MlnzFZKHNeYTla3ecRXDxZOu8dLVmBAPVM9DPIWQyrXfaCkRLTQijL65A TEki4e94kc9mv2lL7hGBX1C9X5dZgylbKAZkVOqS0rDFQFKHms1ssp0uaDehp7dlp8hK KxyPXwfiQmjfBn7iLD9yPNIfnplU4samTKuq9tLoy/4rdkdyCVZTVpjSq+JEH0Jy4ZoG Xe8Q== 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=iOKNHUQAF/z7uYw9BKC26r4hFcJWPHxgcCrB35CBXwE=; fh=Cip3napxigfa/Re1NVhENTTXbUoBAt1SH5qLNiPDDGU=; b=mgjntDnt12516ZMzHEVdtHZaOo4mopd04zlPAO6R+3ltdgmS21UHXNlUzc4izG1TRt EsXyiSA9Nv7z/F+hH3JCZKcLuQ8vSX6cNve7qJ+DN2bNmb088pz8tvK5K0IDoypZ8KqZ ozkzOODsbgWAcrIS4/1qo1Zpir+lzS8hWZ4OFvcj5EXSyac/yQUfE8k8duWdK08MQRPY MpRqoSv+ZASlh35/S58KwwXoH8cwLOARrCjbPqWq0Rh7NVCJOuO400ajXey5HIPjAaPS 6KCQuVtCKkX6dT6R+B0yU5fokRi3R0qmU8iC17WOeKIFxTk7YghlS6+K/k5/EJURYkwu 3Y+g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RAHnKjit; 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-a6c80727f8esi71158866b.746.2024.06.06.06.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:32 -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=RAHnKjit; 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 9947E8842C; Thu, 6 Jun 2024 15:37:09 +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="RAHnKjit"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A2B2E883F4; Thu, 6 Jun 2024 15:37: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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (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 922C1878E2 for ; Thu, 6 Jun 2024 15:37:06 +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-x333.google.com with SMTP id 5b1f17b1804b1-4215f694749so4439925e9.2 for ; Thu, 06 Jun 2024 06:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681026; x=1718285826; 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=iOKNHUQAF/z7uYw9BKC26r4hFcJWPHxgcCrB35CBXwE=; b=RAHnKjitxm+sPpJrJy8GPIoHXcvdkTUN6Nd9Col7uW5RIqG6GOdIkFyaOWr1d3Koy+ XKnXcMMs+3KHoFIypuZYv4qvJBwW/WKQdL5HJpU6tccDi0IG17ua/KgcT0pBRJsh8c3V brj+NudEmX5DcLSi+roPnDLDpkHb2d25hnBrK4qqFg9PGgQ11LomE5UqTV288d94y652 wyo1DWgoxlp/Iv4Thw3zjnUP5pk+BypMXd4iNlcGRKVhxG/D9POwVDNuzsFYD86M2cL+ 19/QSFrUK2itXcYGZlHo8IHjTErjARskVtJoEBf9SB0wP4MGFICtH1NK8PHwLfzW3q/a Xp2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681026; x=1718285826; 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=iOKNHUQAF/z7uYw9BKC26r4hFcJWPHxgcCrB35CBXwE=; b=Xw1LA4VHyMUiM38VDvdBJA1V/xMkd3O14CdbOSp4br+QlIQbrbOJK/glj7Fx2mFSOf uX86XH5rULmwPTYCbPqWkBlRFaSsrs2JJOr/aDaqnug+7DvoSa/esYP6WcmJC//h5rtN YXXILQwHZJ+Xws9dULPKoAmT4F4MdMa5cx0WspyvKJRq6rUgOmrzs7v2LpZy9A6j8JEy ZdDIZhCVb44qLVCgahnsQeuRubdIL67KF5tyPAhFW/ofqxg4fe/lyNdYyCT9XbvggUUO px4ULe6yHONBCpmBQlRKmtVeJ662TpjXet/pzB61bvdxSuZMZUimjR5VRNfkaAySplRW OXVQ== X-Gm-Message-State: AOJu0Yz2y2Ha83UmzlifsNUEcjbJU2Y9vAD+uTKm+WnTgCEd3hNOAvPX iyeRPzGMGZPewesQ33gtzMHubCc6qjAqeiBsF1wm1WZ8NZ0JuGUlwLAyLOkoAZeWbl03nk5ux3m UG5wkekJI X-Received: by 2002:a05:600c:470f:b0:421:e89:dd07 with SMTP id 5b1f17b1804b1-421562c66dcmr46477605e9.2.1717681025789; Thu, 06 Jun 2024 06:37:05 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:05 -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 v3 05/12] net-lwip: add ping command Date: Thu, 6 Jun 2024 15:36:00 +0200 Message-Id: <7ae6750ee1319cafa8b5b86f34394d597439b610.1717680809.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 | 163 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 182 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..51947d615ed --- /dev/null +++ b/net-lwip/ping.c @@ -0,0 +1,163 @@ +// 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 +/* 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 uint16_t ping_seq_num; + +static u8_t ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, + const ip_addr_t *addr) +{ + struct icmp_echo_hdr *iecho; + bool *alive = arg; + + 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))) { + *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 *recv_arg) +{ + ping_pcb = raw_new(IP_PROTO_ICMP); + if (!ping_pcb) + return -ENOMEM; + + raw_recv(ping_pcb, ping_recv, recv_arg); + 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) +{ + 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); + + iecho->chksum = inet_chksum(iecho, sizeof(*iecho)); +} + +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); + + 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); + 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) +{ + bool alive; + ulong start; + int ret; + + printf("Using %s device\n", eth_get_name()); + + ret = ping_raw_init(&alive); + if (ret < 0) + return ret; + ping_target = addr; + ping_seq_num = 0; + + start = get_timer(0); + ping_send(ping_pcb); + + do { + eth_rx(); + if (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 (alive) { + 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 Thu Jun 6 13:36: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: 802008 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp306170wro; Thu, 6 Jun 2024 06:37:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXMYYvaVxQ0fjB9Mh+ozZfKeQcCzWTdu6K1PU+BfPFu9FA6Prfgk3SKyeCIO2HF6sJn3gkuuzIyx3uANO3NfO26 X-Google-Smtp-Source: AGHT+IHKG7x8HghIAjqayBsYs7d20Bc1xUwLjaShFWjZwq0u3My2Pm7QX6oiowmywh9ZVp0a/xSx X-Received: by 2002:a17:906:c7c8:b0:a59:bdb7:73ec with SMTP id a640c23a62f3a-a69a002b03bmr465343066b.72.1717681063810; Thu, 06 Jun 2024 06:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717681063; cv=none; d=google.com; s=arc-20160816; b=BEQomLfUPsjqy0MmMM9fEFgNvcjaUcBXu0JjzwYGdXw2V5NaHv4BfiOQoB6ZvsIkKZ zQSyOjDUzwv1BCSX1mkKrZjlJqDuLIq+SL2L0Jjh3G3tb35WeXawwn28W+v1AR9NNV1z vvjlLh6OIMaK9SM2xuhMyK0jCBWHuEOvujArBq3OMEBnC7Dp1Gx6PMBNWqvP0+3Bl/M6 ItQdPfz2Pm9a8XWjY1YxJXvppQ1l786ewMnZgrLqQ96N4K/KNCgMXtodfNEGE8Z0q2Aa ooqkhfgNL77c9NG1ozZsiLVHZnNTT9f9B1TM5t9S97BWCfCOtxWsHdhcicXfh1j8AKQL h0BQ== 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=LDHlmzHpl+YHOey8NZnyOe5HApQ/zxd2XbG7XaVrT+8=; fh=y2nlSdy1rqA5NrxJUQRURuS/z+wpts0xge8v0NIVeLA=; b=OVeabl54ahTgAZlsZTuzdLTLXe8BR/acmhM99OyOxWz8nTzEKA29fzMrQubh3a+QtV LrCmEpaL362RRWkSrEe2ORM3dXcchrHgBlAbuWs6GF5M9vqI+ZWC4nYnLAi/GHSa6c5m yuVPSI8WLeOf1hA8y0vunMwyf9dF/1CSTJ6ovVpXN9DCAqd8M0cmh/VDNL2eqvlIv2kc 5ghIGMnTxFa7kX4LJKyvO/bsk79cKStGC8jeTuhbgY5hKEtQpYF5TkuzPS/lnveXEMRp LEx29ud9pBKTjuxkk9C7tWzxRZ8CvavqdcOd73yvHLyKq+DBB/kZ80oeiVquguI5xyxM p6lQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DtKKr3MT; 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-a6c80704831si67376666b.496.2024.06.06.06.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:43 -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=DtKKr3MT; 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 13BDD88266; Thu, 6 Jun 2024 15:37:11 +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="DtKKr3MT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A803C88266; Thu, 6 Jun 2024 15:37:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=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 ABE7D878E2 for ; Thu, 6 Jun 2024 15:37: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-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42133f8432aso6315245e9.3 for ; Thu, 06 Jun 2024 06:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681028; x=1718285828; 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=LDHlmzHpl+YHOey8NZnyOe5HApQ/zxd2XbG7XaVrT+8=; b=DtKKr3MTTJ/LheK6hY2BnwYXvAGrqTK50P2Kb6gY3SB75RY64vgcjidIdVvQ90WOxK /V75UvetYzX6TFqUY0QQDWqr4eySMElFPZTECTNu3bPhyhedKIn60JeOjMzKmm4tpbtW IV4jCQncCZyCyvxPXRLL3pKc+EEgruoMPL89ayygzZ2CRexe+nCkArULBkfIHStb3pbJ nkh/8aO5pPho7LVGJbTcpM9JAmSCajixBb6uZyIaKqNMNLRB3lp9bNgrCpYO9Ig3HKy1 em7SGIG/Ys28EwBR7nLopcFUuJ3tscQ3iOqxXQj1biSFuPzw7XqvpIOTWoj5xFNUvGWI +qgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681028; x=1718285828; 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=LDHlmzHpl+YHOey8NZnyOe5HApQ/zxd2XbG7XaVrT+8=; b=AHoJTO3nvsizYHkMwV4XVfHB7itEpt3ciG9wULBFKd+OkmfkKIKCTTTuHfp3c3+49Z RnTH1qGEHKr03TAP9WjmyqRxtiwjFiWfZwooQssXg+Skk5crD6Ai0gza5AX8LOlg+wFJ Qb8xv6r+PyjtclN9qFTih79KP5D9ZCnkDxeVteq9OtVsulAtHKUkEe4mla3l3PFHPYW7 Ivqzkyj7PihyZAirw+IrJiXIaGLQRa4GV4wMJNhPsP2cNomJrSsfgyIWtfwyDgZdqTK9 zzpayuKiee2B1ZkQBX/6Qb5fnwdU/qrlDSbAMg/Qcs6elbdXyi45uQm/Npxh7PpIiAI4 LPCQ== X-Gm-Message-State: AOJu0YzA7s9gZlbeFxX/9UC2ekY82Pue99nsOEFTMEYYne1jtLodbwhe pEV+H1mLi6ghoqQN9TM61qjwg+CkSodr02g7pbNEk92ZhHJV0H6cIcMxz1q3+Z09HpDkOLwKUy/ UO8z6MT8T X-Received: by 2002:a05:600c:4515:b0:416:7b2c:df0f with SMTP id 5b1f17b1804b1-421562cf4admr53805745e9.7.1717681028040; Thu, 06 Jun 2024 06:37:08 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.37.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37: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 , Mattijs Korpershoek , AKASHI Takahiro , Francis Laniel , Peter Robinson Subject: [PATCH v3 06/12] net-lwip: add dns command Date: Thu, 6 Jun 2024 15:36: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 CMD_DNS when NET_LWIP is enabled 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..24a5149343a --- /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) +{ + const char *var = 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 Thu Jun 6 13:36: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: 802009 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp306243wro; Thu, 6 Jun 2024 06:37:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVwhyjV5Y4AbgWVwtj1War70ueD5f1iZCHXB+lIS1G/c2IYYwg334bHKew8l8YuVgpfdcc0GHiFSkpM+EMBJYx7 X-Google-Smtp-Source: AGHT+IEnLE/EffRN1Sot8q90nc0EY+LNQ3AFhOlXN7wdPTbCjZJLxafBcTfGEAGRtNCOv6I1ljyF X-Received: by 2002:a17:906:a3d5:b0:a67:aa2b:1028 with SMTP id a640c23a62f3a-a699f363667mr498044366b.8.1717681075304; Thu, 06 Jun 2024 06:37:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717681075; cv=none; d=google.com; s=arc-20160816; b=BLiLqkkwZ5ll5pEZr70VtiH9zHlVQfmy5kHnBpcCJtGzpeV80EYXR+KLRmmXfhO80/ wiLIciL4Ex9KUtiugaqxxUYl9R4PBRkdXJ/fYUzzXFFVbLo9dhdPcvFeXuCEBfBbm3Ld vMB7YkZGNoYQORcZpB/i3dyTQjA37YUzRX9ncJoxBYq5+hVEsxMxlcRGB+HvMdaMFnUc GZKjb8ba38D67ARpfDjLHYiyshdSSCboLxuUi6WaJFsSMOOmSzL8YGOUBcctZq7cPKS6 IokD2FTrpVGuSeCPHZfoBpyv+b9LvXm4O5ut7IcpNPRKCoEGX84P+vSFWdAvvN5XMIr9 1Pkw== 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=OtoV3jzifw6rLkvypsu0OIFaVen0nzudNrCYRDRSCXw=; fh=xatEmtgbzABYUiOFzuxKhjYbdA7Oax94MfkcSGLerDE=; b=ltI/9dOqo28AWtHdDXbkslOSUZWdAtPP3MIEMqWlvdW7GzPFZN/gL7uFpBIfhtbBEe uZK7As+2QavjXxwE/V1cJdSiZ9dxsnYEKZn2204iMcnoQ8GVbzUmRjHpHADAjruKEUnc 4f/YS+eLru3DbM2IY95AgWLdZY5+a7l+ttKkPW+JwChN/nh3bSSh5irb58ypj0MNZOog DnoYfmnmzvEhZpHCb6oZfRdgqMGavA+ZSndbWXcNMAulYlAXt4XqCdw/4WsgAoppCKG3 rllw24JJuAOeCMakxy0gBCpQtnRyTfW9GsADQ6RedodpjQScQ88yI5fI+ibzOo74UaaX Dv5A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cD2dLD16; 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-a6c8072826fsi64224266b.807.2024.06.06.06.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:55 -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=cD2dLD16; 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 702F288468; Thu, 6 Jun 2024 15:37:15 +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="cD2dLD16"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4390E8845E; Thu, 6 Jun 2024 15:37:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (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 E320F88428 for ; Thu, 6 Jun 2024 15:37:11 +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-x333.google.com with SMTP id 5b1f17b1804b1-42147970772so6521945e9.0 for ; Thu, 06 Jun 2024 06:37:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681031; x=1718285831; 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=OtoV3jzifw6rLkvypsu0OIFaVen0nzudNrCYRDRSCXw=; b=cD2dLD16BKDmrVJBClpN7jUcclsmyRlLMJ5ssuv1E11p28XLAB+iwDOHBvqmTUZHpZ aKrnNHeP8jvtSm/w6d97BiaPbJQEhZnqgcqtLNE49Xu/SwuUEbSsCVYT1tRnyaO2aMA1 6VbTf6srswShHvXEEgqgrclKJlcHh1xmBymSVcovUKb76zbwoCXuPaNIMsPHNsxGIlKB RoxJXlwxPN0FGZ5tsctOUpOsPq4uhwtotccMUhn2/voNELUsB/ul/pBf1MOimihBIr8s Rl6rIPS9CFRDbDnYtLzaxY5Q0aSm0pHBiKZDNcguAzPiu5wKphWxLhjPcWTwTs+88HEU 9HfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681031; x=1718285831; 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=OtoV3jzifw6rLkvypsu0OIFaVen0nzudNrCYRDRSCXw=; b=RX0SgVOCKeuyKtzANNzfFADkyU9qZhvkY9gcTQfn6iTDptHgbcXaW/gcJu86gDl5VQ PcEqE0s1JrDJyv3Nxc9EMWtcB6MWxk4XVukP2A7aqJ+lMlHcHjRivIAnLIsb5/+Cntwk ph5nkHHm4/GWGSrQyUEstTAUIFFGMb2DvF8cmcQLpsxuoRGhYYMQEmQFY75IgyTcyms/ athh4T1puTbGdwT1ZOmrMgmjoGo8bVc0ueDc3PDm98/QumQ+MfJ7aEEoaVE7Yh7lOp1E fdf2/bvfhwDLD+DybRau8cnHMUEIDT3oxcHPvUFBfFDQHhOLZIXWRDNzJC1S2anGGtq6 PyLw== X-Gm-Message-State: AOJu0YzFr6+Zk6ug930yfFQganZNdl5cSAExvxjK/H8QdF32cAaL8UFY WItDTx44MoRzGfynHUr1oxjan1t+zFLbOZ/+lhvtsJsrhx1bCgaJ8v9/4GIiEUj37IDj+CBiZVd SnxTni3r5 X-Received: by 2002:a05:600c:4f83:b0:420:66e:4c31 with SMTP id 5b1f17b1804b1-4215634de43mr53010875e9.34.1717681031171; Thu, 06 Jun 2024 06:37:11 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:10 -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 , Ioana Ciornei , Peng Fan , Sean Edmond Subject: [PATCH v3 07/12] net-lwip: add wget command Date: Thu, 6 Jun 2024 15:36:02 +0200 Message-Id: <16eac9a19f8f6572ea111cc20cc5793bfb5e6f94.1717680809.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 | 115 +++++++++++++++++++++++++++++ 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, 375 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..f01d9e63998 --- /dev/null +++ b/cmd/net-common.c @@ -0,0 +1,115 @@ +// 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; + }; + + kfree(strings); + kfree(values); + + 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..e3e6f525674 --- /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 *end; + char *url; + ulong dst_addr; + + if (argc < 2 || argc > 3) + return CMD_RET_USAGE; + + dst_addr = hextoul(argv[1], &end); + if (end == (argv[1] + strlen(argv[1]))) { + if (argc < 3) + return CMD_RET_USAGE; + url = argv[2]; + } else { + dst_addr = image_load_addr; + url = argv[1]; + } + + if (wget_with_dns(dst_addr, url)) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; +} From patchwork Thu Jun 6 13:36: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: 802010 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp306332wro; Thu, 6 Jun 2024 06:38:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXoMR4ThZNgJ7sn/qY7TJC4mVatg4lVeF88KC8v0BZkVgDkwAqVYik9XrlQDzoEAJno6Pj9AGCSwdjMYRg7KTVg X-Google-Smtp-Source: AGHT+IGJbEIR9K4+1fcCz4Ohzd1rJgZJtLsFeNNcuvQ1T9xXhcn/yi8Ko4dDDGAOmZ1JJqEDKURV X-Received: by 2002:a17:907:5ca:b0:a69:edd:3339 with SMTP id a640c23a62f3a-a699f6822e5mr449811366b.10.1717681086276; Thu, 06 Jun 2024 06:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717681086; cv=none; d=google.com; s=arc-20160816; b=hKFH/GsKOwKRPH7YHlwVfHmcbXeZ331XMAglu0zldIlPWGywRGfsohVWG1jxTpZiVc EVYdjez2Q0DZCGSvGJnk283lCbFFnLPn6bBVgAaDcqnojBqn3kPZejw1XfY8y6pkqAqP l37VlEH++VaG3eC6fbcSPgnw5eyUWuefKoVYzC86hlS0N6kQ2BzU4EHuzjdAI3LUqRjO awfknt356LOB4GSdxqx1ezIay+w8SYP8bZnxJXK+ElaL5Cpe9GH+pJLybJHIfPQCsoh7 OxGtDQ6p0fkI+qkvleuX0RNMcX2gM/lmFV75ycOoYEnj7vaq6LsG6xns/Pbc1+7hcxOR ijkA== 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=m0hWmOYu0vnBkEHDXs+LGLgdIkIscW+41P/wWYJLCLXRkcUoOt3wMrXCNXfbT0OHVB U6l+/lsPuixxCnWlVvI3i5TqgmrEA0yF/gtU7ii62hbIlnM/cyENx227SY+lfmqvF2/8 WcD0Aj7FQZ+DKWiyfgLRpNFHEeX65vY6EATycWw4j5rC2VsarwHI7u/8ZtdkLu8egZeL T+90LvhQhPlpdh4bJEPZvskMXcYf33QKhlaZIeH9XC0uHIBj7nRohkT5K6AO0KrNsA59 PNmI7+dflxPq7pkYn97pZdQ3eBCEjPxEHt1z2gTaUg3dRJvrdj/ZECnWvXPJ+HHgXWE1 h0rA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=orXMkhJJ; 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-a6c805881e5si70762466b.115.2024.06.06.06.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:38:06 -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=orXMkhJJ; 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 D0ADC8848F; Thu, 6 Jun 2024 15:37:15 +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="orXMkhJJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EE0EB88444; Thu, 6 Jun 2024 15:37:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) (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 E79908844E for ; Thu, 6 Jun 2024 15:37: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-lf1-x132.google.com with SMTP id 2adb3069b0e04-52b7ffd9f6eso1108832e87.3 for ; Thu, 06 Jun 2024 06:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681032; x=1718285832; 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=orXMkhJJKxsHY/D+wCIFa+LhAAXfnbLLiH4wMzMmC3RgCrWCUst5i7faLfZ5Kql+Ig CC8J+pHtFHJTNVFH0awzNd6l7PuC9SX7ITlfjFKwpT6XbcrthDBIAE9ySsQJhhm/nkIj NxpBG4zlXH1yGTAofpGskomM1uEGII9UdNg9y4FtroQjdeXjlG8RjI1NLbTw+c6PYFy7 IeJ9qiDV09Rs2lC9XOyxMEiGqcjWYAs+0+fcj7skjSl/tpy3v2UReGvbltzpsPwTtznU LnI6bRYH5K6zxD8I8I69fgvscfmoFoow8ygi5mEtD70H1xrJoWkIlKtdsqDsuYJ0Cv9P 5Kpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681032; x=1718285832; 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=kCdZBA7XPJWQV9dA26wVD8pcVaCyQX66jywNFnqzttPDERKv8DMfEgAFuM3bi+zWKJ arT5au40edtL+mWRpeu4T/VOJxxJzAfFl1CxfBRG2m1oj6OlSQ2FTzQmMd7akSbVXH1V 0xfwiqYXNrFNpjrfsmn8ZflwClu4SNcTXU649aa2OTKewIGCMKzARuQ8TzAqCHQGuzVo Fc883lCfgXok3leSusMoMMHZdiHCNUSsQo1hBoFntpP99Z8jp0eFt5uih8iHGZn4gllh 2OHFAQmMSsHzZ40R/lMKodnQzWc9C3A8Inj/lCSncEe73uUbDCI/ioA0cC+3kQh2Wdpy z1Zg== X-Gm-Message-State: AOJu0Yw4Nlq8HWTfrE7Me+YjzA8Woe04+Dzg8ltF9UgqHjVK5Dr1uTOh wECxhdNMuUou8Q+PZYZ2ljq2dsnffau3cUhFZSuRej9/fo1pxK7XeMBIlXEhKQ1PlIib4aBnee2 k1Agjk1mY X-Received: by 2002:a05:6512:b92:b0:529:593f:3f3c with SMTP id 2adb3069b0e04-52bab4f4c6bmr4686858e87.53.1717681032046; Thu, 06 Jun 2024 06:37:12 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.37.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:11 -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 v3 08/12] test: dm: dsa, eth: disable tests when CONFIG_NET_LWIP=y Date: Thu, 6 Jun 2024 15:36:03 +0200 Message-Id: <43003c415732cd195239697c936ce080141a4573.1717680809.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 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 Thu Jun 6 13:36: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: 802011 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp306418wro; Thu, 6 Jun 2024 06:38:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUXx9Ak4jite+//APxjysFBDqurFNGvuW/5xWnJVseQfUUEZL5ILT5IL5ddtZXFmxj7irRvIRcmSvP1yohAa5jT X-Google-Smtp-Source: AGHT+IHRcBQUU8j+T6/30sr3iVpvel+ZHNHQ0moPVI+TKhI1yTwIQE+mrz7RxCTvpPiRqNOoPYFY X-Received: by 2002:a17:906:2759:b0:a58:eba0:6716 with SMTP id a640c23a62f3a-a69a002e87dmr329186066b.60.1717681097546; Thu, 06 Jun 2024 06:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717681097; cv=none; d=google.com; s=arc-20160816; b=yn9SB10gn4QHJN2rWzV3S50L7Il26YlyQ9hMH1G1OK7OyiRIWpuwQAgeQTV4gZ37sN yDO/mykgPI/9dmq9dJazFqZcJP5o3MefQmQEKHaUQu78Vq1LJvsVQSQkLD9fJsN3xUqM qqQM0jAsiqKsIo6mtUry7IL9BwrJMbmZRDM7vdvqXU4rhIsQ9nu7RXKc3tgKgnjqqH0J SXwAYpB5+1OjMHc+J0ea3A33ey4NaIOMD5pbzsj/wHn6mH8pRwuJR+/0mwQ3Ap621Yrr /OXt+AU0gXlegmOQqW2JpzYtA8zUhqFALW+Q/8AoGVgEhLLECrNWwZ5vds6m0pRyk5yV NeFg== 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=ry1KXrK7nEBSzxzaW/DplNeKTE03ds9cXsL2ZBDlWbHYO1NNt8/v3GPW8Bat+8VKYM /dxjSBL+i1HFXF0Tfx4imIndWKbcCSCFzYfbIy/c2wmIqDEgsPjomhICX/aIqs65pRak vVIESy75TPf49S+kdFjFGx4wlkPf+btVlCXMJtetggWUlgmhExM/jTxRZxFyyTiQJVlp pxuQFat1Q7CqAO3rKU7CVVhGo5RsMnpUGhpVz02jjKRGYWMIgg/L/1M4CdaUT8kqNLfW 4axORdL9g8Vz4ArTBVrwcC5RG7bbUUyvHV8qXjDhXSq91Xc2SMdRIvZI5V0Q/QgiyhzS cxdA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pKMkIDGG; 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-a6c8070858dsi71478866b.614.2024.06.06.06.38.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:38: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=pKMkIDGG; 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 3E6A08844E; Thu, 6 Jun 2024 15:37:17 +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="pKMkIDGG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2E4AF88453; Thu, 6 Jun 2024 15:37: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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A5A0C88459 for ; Thu, 6 Jun 2024 15:37:13 +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-x335.google.com with SMTP id 5b1f17b1804b1-421578c546eso10236375e9.0 for ; Thu, 06 Jun 2024 06:37:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681033; x=1718285833; 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=pKMkIDGGcW5NSFV8OgvokY7vTrcD7VWNmqJQXJ65fv6ZGWLLTjyy9HRQX17NlvBuJj p82qyaCUUp18ojtFlx0w/0eD8v7usa+BKMx6vQQBKHxK6y6jS/t84w8idAMW2VfMw3IR 7+fe0HwN9Ggg2cMBBtV6Cuj8pEa+OopwELkYoWMDTNRm2hXrinw7VefsvGsH094yH2Ap NrLo+lrkllEdJtpZDME4GmkoCpzDt9aaK1cyPfuS2gEOKK+0tZToeQuKAR0OpUrRGmNN bK6At+RKrNOrAJDZaoCjMe6BMSKERydwivIqFKeGk7U20aHBSNcOZlQmdsktdRIYe4AR ssEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681033; x=1718285833; 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=icctEPhj8VBhovJiJhkp9ecZa+UzXgHJjkVEkisB4LuLgE6XM6KNyTgWHDJTME5oLj U9jgrFiUK+D3+AeEu4d2QuFZeZMi0rww42iqLfggybDVXjE/lMeH4FDJFMvIQhjSRGOE 7ZwTNn3P5chTREgWYl9xGXL6DRRNoxwrsMJcoWHTgZQvqKT+CPVKakp/2CzPZ1bk24+M AzygBN3Fp26oeMqRpAnJLpkbLFOhl/RfuUR1eeuy1BGHgdDbN6qmWeot34Y8gRNYaeUC +JRdNvxuAYh7SRkNhmOEaHpqWCKujIBO/ZElUJhlSXXHRRbTcrHUG/RD3jmrzaUoJ7lF 4msQ== X-Gm-Message-State: AOJu0YzW5wW0JulRDBZpI1oKyAkirw6wiZHus5qqe9j19oSchbQeILfI bAskjTYwZlWjybL8xzXx4JmK6ZVQkG2emQ8Z4XILYNh2LAVo/l9bAKxnv8VEi3wdOlz7UmLrK6t /xppJfywk X-Received: by 2002:a05:600c:3795:b0:41b:e416:43d3 with SMTP id 5b1f17b1804b1-421563595a6mr48594185e9.35.1717681033049; Thu, 06 Jun 2024 06:37:13 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:12 -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 v3 09/12] cmd: bdinfo: enable -e when CONFIG_CMD_NET_LWIP=y Date: Thu, 6 Jun 2024 15:36:04 +0200 Message-Id: <58b4c5fe6618c18789d0839938aa0f4a265b97e1.1717680809.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 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 Thu Jun 6 13:36: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: 802012 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp306511wro; Thu, 6 Jun 2024 06:38:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUX83qJ2o9rEDvOfy3Jx9p6PmkVZuKDBKvagA3BJbdiuabwZyBjsQAYrfRFKUxHb24B7MWhKwKAbB/jEfWE8uCP X-Google-Smtp-Source: AGHT+IGH9Xhokjhi8hNOMnwb8aSDTNo1RLAqX99tc1VhCsT2HxEe5EXIiuSV6CpD/9Xcf5VbqNvi X-Received: by 2002:a05:6402:907:b0:57a:2a46:701 with SMTP id 4fb4d7f45d1cf-57a8b6b7e69mr3544424a12.19.1717681107134; Thu, 06 Jun 2024 06:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717681107; cv=none; d=google.com; s=arc-20160816; b=nQIFLKdgWyaRIlj/tSZi+yRj+RH9cd8sAk8zoQ73IVpjuXHMC3l5KKGWbjrO8q5soA z4mWmgKmGS4S+BmwpPl1Var7WciF/R7jMInG7YyTDurzm6eppVYMbrBu7/k0NDujhx9a 2GHGexHnVewd4TQnveYQmzn8R7SUzr51Z/PAJNDA1z00/2pTt1P8pzgy1vv6cfQplY6m yNdIk+OwcawEJFen/hgH3uoBfDwPLWiBWl39Li9YVRQmrINdg3pG1xp+L4TXv4gwM2Zc 4FxuhxaaXHrtGT7m8jtFC5mhH9a3X+G0HPcA5bC7vbEpRS/xRQ8oVPFPzqXnheiKLltz gk6g== 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=jbMRm/KnE79A7lsy/7kwhP2w6DrKnyYEC4cqafPFDpM=; fh=cQhI5/EgogSkJ9u4BlGz7zOe5FopWH3wQtCDJ7yi0Z8=; b=kxXA0rG5TpNdClfcqswhdK0OYSVZcfcpNSEzPUYt0oxQystXq2mojgfnCwgGAPzL8W EFI4rU6I9NRWrGRIjR10rx/7JO/fD9qfSn4tmLvI8VmLcYkfnfmNCDMNSY72t3AQH5d6 NcaEcBflsVHMYaIhYIBvpY00qWUb4hwhkUQ0HAXUoqZyJCREfnUKyb31/9EeaKLlRmDJ 8uCLmOuLyZ9XTj++e/0Z3pHW9K1PeoJPedzI3wPk1fcy9WBsiIcT20MpKZticDsgF3a5 kbCNxqeOxrYeTSLmMb+bRRqnuu/R4Wol8tfFFjYQ18p3z1b9N0+x/g3us2MdKTYzxK+l GODw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="UaNMO/eX"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae264ff1si714660a12.556.2024.06.06.06.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:38:27 -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="UaNMO/eX"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9D76F88453; Thu, 6 Jun 2024 15:37: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=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="UaNMO/eX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1094888464; Thu, 6 Jun 2024 15:37:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (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 798A98846E for ; Thu, 6 Jun 2024 15:37:15 +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-lf1-x12d.google.com with SMTP id 2adb3069b0e04-52b88335dd7so1214595e87.1 for ; Thu, 06 Jun 2024 06:37:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681034; x=1718285834; 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=jbMRm/KnE79A7lsy/7kwhP2w6DrKnyYEC4cqafPFDpM=; b=UaNMO/eXed8yITIWh91wYbEAgcUKvZrRl6NSbBpt/9+5alul4aMXh7ocZO50EHWV7Z EO9MoEWKShkfyUAo15vbgeeZ1CYCyHCLHaKEp9fY/XP8DR5lYZls/APynj9Kin+IdsiZ w4vfS3VHGGMPe2N4Nou9BTj3vRlNIA/HbnmgjPFnuVYe4TH+TvtJbws6vcXh+8n0Kehk keHv8IkMWC2sn2Owj21mHvr+B3wfifWvrP2kPS7eqAT/fLpKjTu5MvOuZZ6Kp/rrG+LB 2A1Nbs/NFiJ5CdLg9OtdB4zz0/7EGPyqGfWvxsvLQPbCd8L46R78Dh9FjPMb/pIq/W0E v6bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681034; x=1718285834; 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=jbMRm/KnE79A7lsy/7kwhP2w6DrKnyYEC4cqafPFDpM=; b=eFKwUY6vcXDN2vxejXj8N7Y4MinpvGy9vzH73MOX/3MPi+UYniyV+igjqYZOjnyU/P zWMahdzkAjmqnTx8LrViUBCaeHPMIFSfaudDxecM1+57DFgJ4RpbYcl2yetRj1YJaFkn ofNfQnM8fa7GflRdVEgsuIcifgISP4WLDFo8lebfhnvMLHjWNIUGNQB86syEg0sbH+nh FGjSL38qOBHFGV5AL5B9GXjdD64Yj9LqZRjqL5kUva8Er/3lIdCUx/nnB2ZQesciBHpm t5IKOrvTf7Rt+46kZzU9MPdvITIdbC72DxTtHWR5B0XEg0JyvoyqCjEDmwBiTV3bOxdp QcWA== X-Gm-Message-State: AOJu0YyZQLFlY7+LS0g+D5YmRAzYhbFONgDPkVM6vNYy2X4JZRqOys5y vV9MlwsBq6vXlzOhu4yHCbobU0NU1qryZ5xuKdCi+V3h7MsL9t6szcv26N8KzvZ7rU10AlHcQ2J Tvs6JKG85 X-Received: by 2002:a05:6512:3254:b0:526:92d7:52d4 with SMTP id 2adb3069b0e04-52bab4fb447mr2873511e87.61.1717681033975; Thu, 06 Jun 2024 06:37:13 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.37.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:13 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Maxim Uvarov , Jerome Forissier , Tom Rini Subject: [PATCH v3 10/12] configs: add qemu_arm64_lwip_defconfig Date: Thu, 6 Jun 2024 15:36:05 +0200 Message-Id: <908e69080417054ebe50ec67c803d0697e8b53c0.1717680809.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 qemu_arm64_lwip_defconfig based on qemu_arm64_defconfig but with NET_LWIP instead of NET. 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 Thu Jun 6 13:36: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: 802013 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp306566wro; Thu, 6 Jun 2024 06:38:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVHqgH3/gANvk6jkwLnUaVI1UjfFZxZtpRWXLO1cK4P4xyPrAg0WMG1/4s6n0XqzIBNn6tqckTHAxSve3U880hr X-Google-Smtp-Source: AGHT+IGF4MnIoRZMztOnf8Y8RR8tuxYz6aUCbfiUn5E2iQsmgLI54tUqhPaJEnKjPiO8maYYstYz X-Received: by 2002:a17:906:f191:b0:a63:3cd4:97d2 with SMTP id a640c23a62f3a-a69a02652ffmr338597766b.63.1717681117573; Thu, 06 Jun 2024 06:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717681117; cv=none; d=google.com; s=arc-20160816; b=qz2BVMU/QAd9JI9Y4KfdxIyZhPxIM9J2LkId2ixlQ/6KiZ0Z4HzszvXZgtQMZh/VKI PCbcDV9R6NZCeSEEBOpFso2JEZfxmtnXwWYp7hVWupvA3GQd4DZTQfRv2C2mAKhOcxzZ 51VOczrU+IH6ffMW2wOphkS6qYdRaHN2X1TMIM3kc01doS7JqhywZ1l2TM3TvBFp+MIQ B0RN89G6mnv4fghfCyHlM6+LsTU9w3EcnLgSdiowGy62jFiMllYnR8n8ESkPD0Yk557s Hsk+s39SB28SOjfn4/TXEVpTCpbYDVaUJzL28y86dqADJqGg4siFo55jjbDU+IE+UXVd LUZw== 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=qqVqLn066MM3njEiUrH9ehDx4F2etQZeP2c8uVrZpho=; fh=jXsJI1CutYQV2girDA0lni+UEd+fLGmhMDldvcp6Fys=; b=nJQ7Tdf4mtOMAcCYVXjt4r3eqv+j5MKZHt6jiAx3BDOK20lNyXagOdfr/r2kr9ajIv +PVLXkM6fHOSoVdMzcZWIOkhpCKkVUhZIk50Ip1C/4j1ys7/ZNIbi0n3Gt7DrDglPPoz j4P5BFWcAEtZ0A60XE2NLffmNg9sYCZYF0WB+njlj+cddYTsSRoYlQG7XrvbEVeW6/XH tgufIZNt/OAD2Umzj+FoT3b1x7WyP6k3Q/8SKmQIXpBim6bb1BIf+QbbYf03/+zaDOaQ ojZd7Wl9lqss7Qw2Ytcf1UbDwHhuVjqTb4AoCQaEB6yO1+sg1avsMIw29o8/uzFd/O5u pNyw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rWR5qizH; 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-a6c8074979asi68752366b.1010.2024.06.06.06.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:38:37 -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=rWR5qizH; 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 0A79988476; Thu, 6 Jun 2024 15:37: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="rWR5qizH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4184788464; Thu, 6 Jun 2024 15:37:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 0501088499 for ; Thu, 6 Jun 2024 15:37: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-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-421208c97a2so9855685e9.1 for ; Thu, 06 Jun 2024 06:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681035; x=1718285835; 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=qqVqLn066MM3njEiUrH9ehDx4F2etQZeP2c8uVrZpho=; b=rWR5qizHj5QNBMLvyCLySFdX+6E6OBw4q2zAdHUO/lYJMyL31hrlwl+lsqtL8GTAEw rmdtdbbrmHGMK8e+UoQMvu5fY2TmdgKqPuXtsfpx81yEo5zP1Kwu3n6It8zfuyO1evCZ 1mmBV6v0Xh0pmP0sWRTy3sJskqItC2nbodnpPZVy67psONE2i3hNU5hDWiSiO3chBoqh vni0bcaNrQDuHwevVwExBnMPT7T6eYnHDNZEFQL8Ym3b4E1eMqLkNetKeR1HsJ3frnMS tWKnSlGG/SSLJQfTeuNycO2wcr6YEkVGq6r12yBZCrP7GsFMbEbcZkGbRTWb2rFWI8ze Jpzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681035; x=1718285835; 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=qqVqLn066MM3njEiUrH9ehDx4F2etQZeP2c8uVrZpho=; b=pNVtjIRowxITW9HldlXWMhu0I1dt2AWUUaj0gCBmVU2aoT+L7XSXlxKpI9zMV6TTXB xuMyvUBabgudL1UGG+GbIcAM+jnUMu3ZWt2Oms+NW0q7Nxl4p4Av59gHHyalzk5u/YCr f4sZprioQP2gxP/1YpVDoeIwRZs38cKJ3giW5OegrFsoAu95ATN3nrrD719Ds1VQlBvh 6ILeT/rxhPkcSi4vKnlqBvCtR519QXBvLikGmy7ASghNUGGS6JsOryEJDyDszRdvacGp f6h6KiWkR3tWgqGtxwk+KmzaBYvEimB3anXjkzAY3xtONonUUPddiAdlOe16Et17oOwa BFcw== X-Gm-Message-State: AOJu0YxTgSK3tKsWd/UL/A78u/FCMzuzxEcbHUNKRHnNchBNAW68toJM J5Mr3teStaBlAdsuiTStceGVDkv3dpofGOpLIt/2w2D+ioa/ZBAxdUXt+DxzPzJ/SdWETHt3kwE jjVrAwZ4e X-Received: by 2002:a05:600c:458d:b0:420:2983:2229 with SMTP id 5b1f17b1804b1-421562e6358mr53315695e9.22.1717681035366; Thu, 06 Jun 2024 06:37:15 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:14 -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 , Sumit Garg , Neil Armstrong , Caleb Connolly , Sam Protsenko , Marek Vasut , Nathan Barrett-Morrison Subject: [PATCH v3 11/12] MAINTAINERS: net-lwip: add myself as a maintainer Date: Thu, 6 Jun 2024 15:36:06 +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 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 f8afd7d51e2..11105869304 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1310,6 +1310,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 Thu Jun 6 13:36: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: 802014 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp306651wro; Thu, 6 Jun 2024 06:38:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWS8WAceAKgSDYZs23GRPMzhX1URAEih7XuCq3VXp+nNt8qXvGvS8DgvUJl3aVzlA6X/jOK/iA7Vglg5hqcQ8Ae X-Google-Smtp-Source: AGHT+IGnMVP7rWKOLY3s/LsvPpIsDfBsxAWMs242TPivrBON3g3OeNj+ltiM8cyS6dNrk1BaOZ0H X-Received: by 2002:a50:d506:0:b0:57b:b511:cfdd with SMTP id 4fb4d7f45d1cf-57bb511d402mr1103136a12.39.1717681127943; Thu, 06 Jun 2024 06:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717681127; cv=none; d=google.com; s=arc-20160816; b=dy8wwsnzGJx80JvcyFzkHPsmUJV77ygBaNZ5IMKcpFVleVrpVcTbJdFJsXUbzG+0rr CQUmTIjzpdck8knifhpHpadwK3e1tZWUGZvM42t61j0Nw9YyiCzWugGIDbgHVOG3b74u rnOuHQAheJcQ1IhwrMKDQrqqsJcwrU1c9D2GCf3BG71i+CAbiYU/ef0nM96OojxwHVJL y0IDdTApOw02w5XJKDpd/4RzOGHMV9yrGzmfozMiJd7pwqnaFX9PcfdETj6eKfa3+Gwf 7Hdx7V+teu18eiifZBhDYCt/B3hbSPhgEKXhMPMaibDwhUNtV7I/r5myZ5bv/3x+d0+v gXXA== 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=Fzw6cP1XwfYMFz7w3gkwzemqCEoUwHZFS1rmul+vcRs=; fh=oTBAHDNBhKGwfAq3kwV7wX80Q2la/bGxSGjtAskMngo=; b=sMNhxk48KMGnFX8MzIuYSFEejT28CbJUIcHtyt4x+rsv41BcACPZ7QykFdLkO+bf1H ceiHWc78ZTtWIeLhu0GVFYgcdWYCyBCq7xJRCNMnJZdZlSvHJKWLOUcQW7Sk8XA7p+I5 XWlK3tLpMJ/KL+NmzNtGVQWscPwRy6cM1lPRp5MGvZtneZLtMFQVU2LCxGFdlSg07pPF 3KDNCejOLX8HwL9hYVBBcpuNbkx5a/qhO5cx4bCnY6tdiRAJKR66ZPpcsyTIGFXKoFx7 FLbsfZSMqNuNsmdpOfTjWlKos7ziNkA/IcY07TGNeCWgGcaRJr0UdIgHeLLzEg97JcpM +/3Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CKFtcCbf; 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-57aae0c714esi722703a12.117.2024.06.06.06.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:38: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=CKFtcCbf; 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 69D4588499; Thu, 6 Jun 2024 15:37: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="CKFtcCbf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4CDF888464; Thu, 6 Jun 2024 15:37: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, T_SCC_BODY_TEXT_LINE 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 D78FD88428 for ; Thu, 6 Jun 2024 15:37: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-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42158db03a7so10147685e9.2 for ; Thu, 06 Jun 2024 06:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717681036; x=1718285836; 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=Fzw6cP1XwfYMFz7w3gkwzemqCEoUwHZFS1rmul+vcRs=; b=CKFtcCbf0jmvruJb1ICGJIC9K/+czmcfFSTy1nuqUb7LKIs+hztfG87PMMcG+2pwHi ki/U+5Yh0BnUl0nY0pIeG4zDHKLIasTj+Uh7odK9EftigVeKIVCDNpjNkF5kcPLvIobN j5N4krF3jHwMGQgGAPDzQD4VIs042ZoOwhwiQTDJWKXi0ERLmjHaqfz0Hmf4WBgbOey1 +odARIQjMW27ndVD09H9Z9RIPZEeirSVpCNnFRUUkghIQNHfFwmJ8gnSyfnJs3SBAUF2 vT1Eto3xAPJJramdJXP+0cY65MpZWLZmAx2w4q/IIM67OF7yCNPKblHq4WY7z+ZRv6nm wTcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717681036; x=1718285836; 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=Fzw6cP1XwfYMFz7w3gkwzemqCEoUwHZFS1rmul+vcRs=; b=ArrmpISJk1zyeXmfyXw/oAW27oiqbOLeZgAN927xcMeFMJoqJT5kcFgmWWa3k6bapT jhGCjC78qepL8Oc6paNqhUK3sf8oP23O8uwVsB7M8SQA7FT1rH0sCaK6rJy6BsRRg1eQ 8m8LK1/hZf73fFhT6YKrkg2KuPVEAvYAHCznrTtddKU49FVla8Gc9QwN7ITLFU18cYrr u0k3CJH1+qmsehf1hcL3Edv/0rExG5M+Yotkec/brsVGGwiV5YNZNrHWbnl3kXNNkN+I sQe/Mzfux4b/2v9tB92K5i52NX77V6uzxRICUtKJ28KGkT5Y/fymfLSHCpVx/B9sdm3X OheA== X-Gm-Message-State: AOJu0YxOX3j4eRnjvgGDP24uJKn5RJVa9gG9JZfEhuqArGkUftkZtVPe S0qm79Fytb5lSIFPMXIU0TemCbjQrw4UFQhSawbSUdqpOim9VbYKn9qfJrtlP+MB40CGszr3rXL L+eT/5q+M X-Received: by 2002:a05:600c:1908:b0:421:29c6:e2ce with SMTP id 5b1f17b1804b1-421562d46b7mr51068015e9.7.1717681036191; Thu, 06 Jun 2024 06:37:16 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c19d52dsm23111955e9.8.2024.06.06.06.37.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:37:16 -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 v3 12/12] CI: add qemu_arm64_lwip to the test matrix Date: Thu, 6 Jun 2024 15:36:07 +0200 Message-Id: <8c875c0aa6c3a137478526e77cdc192d14116542.1717680809.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 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..4da1bb12fab 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 or test_net_ping or test_net_tftpboot" qemu_m68k: TEST_PY_BD: "M5208EVBE" TEST_PY_ID: "--id qemu"