From patchwork Tue Jun 17 10:03:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 897378 Delivered-To: patch@linaro.org Received: by 2002:adf:9b99:0:b0:3a4:ee3f:8f15 with SMTP id d25csp2132996wrc; Tue, 17 Jun 2025 06:02:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWeWLLi42C3TMHUB6baBNF0DtSa8IcEtSd5w4UE/Dx21Qjgs2IHVyEzC+E5pJ1dZvLDzUbIHQ==@linaro.org X-Google-Smtp-Source: AGHT+IHFJ3CQ3hJoz7MUuHBXe1PRKyBHoqQjg8CzCgi6CcuAGFTM7veElsaD/kcIVnPNW8pn+oYi X-Received: by 2002:a05:622a:1994:b0:49a:6859:1c10 with SMTP id d75a77b69052e-4a73b7afdd4mr227297901cf.24.1750165334401; Tue, 17 Jun 2025 06:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1750165334; cv=none; d=google.com; s=arc-20240605; b=SrIa1bviGOkG9wse9h+g4aQF8jmGHkp7Dh4hQKpGKE7bGIHvPTslPo5kA0rcTJnL2Z wIWyMNcDUnmfzJxsfBYc0mBJ7TD3kYpM+A7wA9I3dzUVwVgxozqy58naP/IQCYtnCFjw yem5Q7xo5pHb7NzBbniwaHwFO72p4W+dvFn4IOIzc1FJnyB4X9S0iMlhqgEJbJfS7gVi 4bGIMfAKhHYBwA4IoPpyjIc11/dANDCXFlqBKlRl+F/Ve/Cu34nGpPUl/iWfMvZEJU6u xH98ddNmWU0pnHngFKJ/YRnpbPuj/UQ7KaiY4KZgcyyoYV+Lz8wkpBGNkK8k2AVTKVub kMbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=sfrwT5MaZ1tnqfjhAOiXaWvwOv32c+4XxCpL48FlolI=; fh=AGueopBZEb/etMJXh31CDcABv/n66QYeKguV/fRf4Eg=; b=C/ihbIsd2y29BMCjRG9p5TMhTeqSYL1MCGIds71TMFrynRI+hFnXlKIT0CtBQZ+AGG 7C5Z1kaEq9MThtX9GmiNZSlCUD+5u/rODkwDjsCvXq2qg41mfLCM6gV05LAYLGG0bmhj YTzQ4ankSNBixtwvKEbKVfvGdTw8eC9UTbGKn0gOi3oDU+gQsENAxTBRx1i3WRzsw6AY +iE93BvcvOtpDCsT9YPCMHUxq0mQ1sv7AAnDEorKWaYnEgREk9FJueo9T1HE7QA/FVQT fTV6HqzDz+ZqsBu9aQ9s4imge3gkRQkyRljYS5lcGGTYLdvouLVf4lf6PMCwJ4ZP9YfX 2JfQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JjPScm6e; 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; dara=neutral header.i=@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 d75a77b69052e-4a72a4dd6c9si131175281cf.431.2025.06.17.06.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jun 2025 06:02:14 -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=JjPScm6e; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C15482E40; Tue, 17 Jun 2025 15:01:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="JjPScm6e"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4C7AC82CB6; Tue, 17 Jun 2025 12:07:45 +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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3B7B380C83 for ; Tue, 17 Jun 2025 12:07:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3a510432236so3992406f8f.0 for ; Tue, 17 Jun 2025 03:07:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1750154862; x=1750759662; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sfrwT5MaZ1tnqfjhAOiXaWvwOv32c+4XxCpL48FlolI=; b=JjPScm6eBj1ceYYAReHPxXg8yzF7PbfHtN2GRfRyW5uiz3K8uIzvy3ltI9zTe1L7HI l9XSgVZfInvjo8DV/7S9LztByrvdV6A2i3wqC8KhuoKKZx27kVHR3kYku89Wx38YCHlt b1cMw0obkT86OaRu4StsOd1W0hT7mWaHqNffSMmQrswWPKoT5jmss/jJU5wSfBk/Lmg9 Wiwnv0/Y39b7fftF6al+v03QINvuzYKFnwispMcQSqGHjnuxaQgozydr6xqnjxUgpecp 8hC6KEHcabWQg3pI4X1tSY3pZInPz7+2R0IzPHpjo6nTonk1sp0VH9c3Y9mFVk+rJCRH GM+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750154862; x=1750759662; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sfrwT5MaZ1tnqfjhAOiXaWvwOv32c+4XxCpL48FlolI=; b=BRGkQTSctmDwDrESLPitEr5Mn52mzqdD3cjF3PsuvFr80odBY6imBQEcwjG3k56keE 1cjgYN+S/R289HPsFikuVZi2NHYbB4VZ03If1R2qQxoH1GcsXbyL6xhoNAJYluDLb35j Uskpow0wLiYz6KstE21irMifa0FBlTMu9GKEUhDna2WvdwuG0bsSUzVxr/XNQmr+esti bKElRQH5plKJIKuzgxZ96C0PaKXx4fP60S8OUeKpdY2iMG/2Zx6ZAQv2ByNeFRi/UIK+ vvdIkQchSgfjPOU6783IfPPazLNz55auI5pSQJ12/438gmOUPo9qPNECCjXZICe63rIc JSjw== X-Gm-Message-State: AOJu0YzNM0nmsaMGpBe44IlY5C7yeFWH+Vxs1bjGMyz82v0xaFRSpvYx tlMBhRztQccvr1wbbuqBZrg955QGoIVV7tQIiWitxoEMZmiR7EPt4ol2sFE0Vp3XQWGr8gixeYK oSv4H X-Gm-Gg: ASbGncs/31jRNF51x3DJT2gsSwFG/gHWubLasQpNQxyi3MHZW1c/VjcLC04hi8Zq+JS cizv8RO8wv6nZtGqcPzPQzk+mxh2Og+MYrt1Tc8gjDfU2wvdYP/0nAG2PYhxCn7/oPQfbpEfu5x L1BDN0cdygbwJK3F3PTvXZByXofyDLcJSBFVUFchVDqB9175E48V4j6bhOHNYqkbwFb2lkozUdq C7o+Qp9br1hE4h1s1Tsz1rPOgBahUh0n36BCkAg2+KdQaP056xyp8Jh0ytneDegKrGJ2B25XZNJ VCyK07mYL3FMNvtzOy9ho42sqOI+lhH0aLtSS/0l0pgKDxe2rfrfyH8T18/SFZQOWGQGS7bk/oQ XP8x4mg== X-Received: by 2002:a05:6000:1a85:b0:3a4:f70d:a65e with SMTP id ffacd0b85a97d-3a572e6b9f4mr10683883f8f.37.1750154862272; Tue, 17 Jun 2025 03:07:42 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:d4f5:465a:56e7:e545]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a568b61071sm13582412f8f.90.2025.06.17.03.07.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jun 2025 03:07:41 -0700 (PDT) From: Jerome Forissier To: U-Boot mailing list Cc: Jerome Forissier , Adriano Cordova , Casey Connolly , Dmitry Rokosov , =?utf-8?q?Duje_Mihanovi=C4=87?= , Emil Kronborg , Greg Malysa , Harsha Vardhan V M , Heinrich Schuchardt , Hou Zhiqiang , Ibai Erkiaga , Ilias Apalodimas , Javier Tia , Joe Hershberger , Mattijs Korpershoek , Maxim Moskalets , Michael Walle , Michal Simek , Nathan Barrett-Morrison , Oliver Gaskell , Patrice Chotard , Peter Robinson , Ramon Fried , Robert Marko , Sebastian Reichel , Simon Glass , Sumit Garg , Tom Rini , Tuomas Tynkkynen , Venkatesh Yadav Abbarapu , Wang Jie Subject: [PATCH v3 00/13] sntp for NET_LWIP Date: Tue, 17 Jun 2025 12:03:50 +0200 Message-ID: <20250617100720.2544758-1-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 17 Jun 2025 15:01:33 +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 Implement the sntp command with lwIP (CONFIG_NET_LWIP=y). SNTP is supported as an app in lib/lwip/lwip/src/apps/sntp/sntp.c so this is mainly about adding that file to the build and writing do_sntp() to use the sntp_*() API and run the receive & timer loop. There is a patch to extract a small bit of common code from net/sntp.c to avoid duplication. The QEMU arm64 lwIP defconfig is updated to provide the sntp command by default for convenience. I could not test the case when the NTP server IP is provided by DHCP. If someone has access right away to such a configuration and in case it does not work, please let me know. Changes in v3: - Remove doc/README.SNTP and create proper documentation for the command in doc/usage/cmd/sntp.rst - Remove #if CONFIG_IS_ENABLED(WGET_CACERT) guard in include/net-lwip.h - Move files from net/lwip to cmd/lwip before splitting cmd/net-lwip.c Changes in v2: - Move the network commands from net/lwip to cmd/lwip. Some commands such as dns and ping can be moved entirely, others such as dhcp, tftp and wget need to remain partly in net/lwip because the protocol may be used even when the command is not enabled. - ping, sntp: accept host names in addtion to IP addresses - Update doc/README.sntp Jerome Forissier (13): lwip: remove net/lwip/eth_internal.h lwip: move net/lwip/dns.c to cmd/lwip lwip: move net/lwip/ping.c to cmd/lwip lwip: split cmd/net-lwip.c into one file per command lwip: split net/lwip/wget.c lwip: dns: do not return CMD_RET_FAILURE on successful resolution lwip: dns: do not print IP address when a variable is specified lwip: add net_lwip_dns_resolve() lwip: ping: accept host name when CONFIG_CMD_DNS=y net: extract function net_sntp_set_rtc() from sntp_handler() lwip: add sntp command doc: add doc/cmd/sntp.rst and remove doc/README.SNTP configs: qemu_arm64_lwip_defconfig: enable CMD_SNTP MAINTAINERS | 1 + cmd/Kconfig | 13 +- cmd/Makefile | 2 +- cmd/lwip/Makefile | 6 + cmd/lwip/dhcp.c | 9 ++ {net => cmd}/lwip/dns.c | 12 +- {net => cmd}/lwip/ping.c | 5 +- cmd/lwip/sntp.c | 133 ++++++++++++++++++ cmd/lwip/tftp.c | 9 ++ cmd/lwip/wget.c | 221 ++++++++++++++++++++++++++++++ cmd/net-lwip.c | 50 ------- configs/qemu_arm64_lwip_defconfig | 1 + doc/README.SNTP | 17 --- doc/usage/cmd/sntp.rst | 72 ++++++++++ doc/usage/index.rst | 1 + include/net-common.h | 13 ++ include/net-lwip.h | 15 ++ lib/lwip/Makefile | 1 + lib/lwip/u-boot/arch/cc.h | 4 + lib/lwip/u-boot/lwipopts.h | 4 + net/lwip/Makefile | 2 - net/lwip/eth_internal.h | 35 ----- net/lwip/net-lwip.c | 39 ++++++ net/lwip/wget.c | 202 +-------------------------- net/net-common.c | 23 ++++ net/sntp.c | 23 +--- 26 files changed, 578 insertions(+), 335 deletions(-) create mode 100644 cmd/lwip/Makefile create mode 100644 cmd/lwip/dhcp.c rename {net => cmd}/lwip/dns.c (90%) rename {net => cmd}/lwip/ping.c (95%) create mode 100644 cmd/lwip/sntp.c create mode 100644 cmd/lwip/tftp.c create mode 100644 cmd/lwip/wget.c delete mode 100644 cmd/net-lwip.c delete mode 100644 doc/README.SNTP create mode 100644 doc/usage/cmd/sntp.rst delete mode 100644 net/lwip/eth_internal.h