From patchwork Wed Oct 16 09:56:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835789 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp343295wru; Wed, 16 Oct 2024 02:57:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUSSkNn/0pt++1jTwcP2tGkUQElbyoWLP0LU5XCTJ4+G8w+0dhBtjb2YIaHrvU5H46O/0ASlQ==@linaro.org X-Google-Smtp-Source: AGHT+IEC3oD0rV+2iKzCkN6yT6HbSQrcSt+g+JbiAhLjRqsTWJ7qQ8ORauzTzi8iKNMBdqh0zzcr X-Received: by 2002:a05:6e02:1a4b:b0:3a0:52f9:9170 with SMTP id e9e14a558f8ab-3a3dc49c448mr32804905ab.1.1729072646074; Wed, 16 Oct 2024 02:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729072646; cv=none; d=google.com; s=arc-20240605; b=EdLnk95pQmfZhO8RU/Oya2jiKA5iRbeHGqIFDnRgf7oAEeHnRFmARizCcv0NCbxmSw xcUiVa21olkSRwcBqHN21O42+NQOPgl9ahSH5NCY99lpLNtq3mVM4yOo5OfOuFd5n8Er tHfH1UiWqmkrZwXjxUtmpYEg2PBl6pQJ1Kxjc3Nicwit8Rfw6FU9ls8d1qFjlWvjkliv 7Eph0Vm3DzGKYTM6fwETfzU3FD7QLJ3AjL7ndm5f+G5DryP3LFYhRbRlpla/G3KuSr8O PGNPLpSmsUOcjSKPCOCvcnGFqDlRhoOkam8LBWMw7yG0KzKU45Dr/U8tZDbMxNj9VZxO paoA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OwioewCs6QaiCUsMm4h2t49XeFssC0AFbOesP174Qbs=; fh=jsFXu3iLijXIN2uYmlfqKS6I1KzGXFCz88a7kH8+wjU=; b=ZLXCP6FrZh4L9hQXlT0sCKAnW7CkYKhkFLxeDwhh1qLt14vAqixyi1bMR6nNZvIR/a CvVVJlOGrASt05CyE4yD19121t91wgaYRRnBSfoZG/NctJirlUzd2k70vxSy5z7S+1F0 lTb1spBRbeIHjuRwgaMXyhZvcqejpe68k3yCAR3+2WrYzkYGXXUL3DnaI09xPNk+Na8A n2Irzc42GNE2BiBg6DOMU6NqPEettV6nmrSUy6OKVzv6zyzHeLHDctNuLmmoJmGWR8gc 8mvyNhY0K2PH/QS7xgfQebPKJo0Ci/Eap+R/PXAxesQrv3T+Wc2fVUJAbd/U7J680z/K GvtQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VS21M6wA; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id e9e14a558f8ab-3a3d71e2a0bsi15474235ab.188.2024.10.16.02.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:57:26 -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=VS21M6wA; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9D2D088F69; Wed, 16 Oct 2024 11:57:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="VS21M6wA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5AA6288D1B; Wed, 16 Oct 2024 11:57:13 +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-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 17FA388E02 for ; Wed, 16 Oct 2024 11:57: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-x330.google.com with SMTP id 5b1f17b1804b1-43055b43604so61474195e9.3 for ; Wed, 16 Oct 2024 02:57:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729072630; x=1729677430; 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=OwioewCs6QaiCUsMm4h2t49XeFssC0AFbOesP174Qbs=; b=VS21M6wA8BDma1EimXix3N8eLp/DaQ/WvZIuTfl9EF+iGX+dGiJ0jtSEoEZHgVDAdJ z0sKPbZU0JC6jAJavCli0s2ZaKAI6566kh1JoVVWnctBQjV65jZl7A+QLhJqEUSszAOq xq4vMqiR5JImlssPY3Ey7l9g5hdHh/Y09htgNDJEULR/0byMhDQNofzXf47wUBdewK5r eIOAGnGBnLrWymWYFBUai1f25cteCSIkWdhmSGA+F7a2op1wO17b9guEK4vdtoCFbFSJ 2bt2FwEcX0SqRD5xw959zhv+U1g8Y01UpD8KWtkxQ3A/5cqERmYaoQuIkI2N8ch8FQbk g0TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729072630; x=1729677430; 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=OwioewCs6QaiCUsMm4h2t49XeFssC0AFbOesP174Qbs=; b=OjedXXiZF3cjEq8mPiCOSSWlfQPy/JE4gzP8T9l8SofO6lV+LUvwcFsuB4NTDRU83Z Wf9L6ESE4ljGD9y325bbrAbIU8U9TSFDtOv8+nqEWKJqHRCY8MApaHBaKbIJiCsFF4aR vRRleyTeAhIQ4OtCyoUQ78MgPBOSMXMg+83ztXvO6mGg0gsFBJQ169xXRRpEc+oQm3gQ 7flHpZTrs+ohYmUj+2MJybYhme7sWP1E2WOc4ShMnCjy92DQF3DAwOuw1VE6BwitPvqF CIcFg5LJJF9AgUzvcIj3ySFTq0VUEGVnBN1Jcst8M5Hg8fsnw2moaxzSJYAAGVyaZ+S0 F1mg== X-Gm-Message-State: AOJu0YzgEM7nFMBwR39d4KOkyvfu/FpAHZ79tJ0/O/9i4wxiXW7ogWJK 8w3tudOeUTJN4hkTsgfOZ4HOEyU1movylPoebplELVYEvEDRGRhE0n8VVfL0Rzg9Lr2BFtaueh6 zKPy2eA== X-Received: by 2002:a05:600c:19c6:b0:430:54a4:5ad7 with SMTP id 5b1f17b1804b1-4314a295480mr30659055e9.1.1729072630288; Wed, 16 Oct 2024 02:57:10 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f6b1ebfsm45236335e9.34.2024.10.16.02.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:57:09 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Simon Glass Subject: [PATCH v13 01/21] configs: use syntax CONFIG_FOO=n in tools-only_defconfig Date: Wed, 16 Oct 2024 11:56:23 +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 The tools-only defconfig causes troubles on MacOSX due to the default C compiler being Clang (LLVM) rather than GCC and more specifically due to [1]. Therefore replace "# CONFIG_FOO is not set" with the equivalent "CONFIG_FOO=n" using the following command: $ sed -i -e 's/# \(CONFIG_[^ ]*\) is not set/\1=n/' \ configs/tools-only_defconfig This fixes the tools_only_macOS CI job on GitHub [2]. [1] https://github.com/llvm/llvm-project/issues/78778 [2] https://dev.azure.com/u-boot/u-boot/_build/results?buildId=9105&view=results Suggested-by: Tom Rini Signed-off-by: Jerome Forissier Reviewed-by: Tom Rini --- configs/tools-only_defconfig | 40 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig index 5a08563bec1..29554be7a65 100644 --- a/configs/tools-only_defconfig +++ b/configs/tools-only_defconfig @@ -4,27 +4,27 @@ CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox" CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y -# CONFIG_SANDBOX_SDL is not set -# CONFIG_EFI_LOADER is not set +CONFIG_SANDBOX_SDL=n +CONFIG_EFI_LOADER=n CONFIG_ANDROID_BOOT_IMAGE=y CONFIG_TIMESTAMP=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y -# CONFIG_BOOTSTD_FULL is not set -# CONFIG_BOOTMETH_CROS is not set -# CONFIG_BOOTMETH_VBE is not set +CONFIG_BOOTSTD_FULL=n +CONFIG_BOOTMETH_CROS=n +CONFIG_BOOTMETH_VBE=n CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run distro_bootcmd" -# CONFIG_CMD_BOOTD is not set -# CONFIG_CMD_BOOTM is not set -# CONFIG_CMD_BOOTI is not set -# CONFIG_CMD_ELF is not set -# CONFIG_CMD_EXTENSION is not set -# CONFIG_CMD_DATE is not set +CONFIG_CMD_BOOTD=n +CONFIG_CMD_BOOTM=n +CONFIG_CMD_BOOTI=n +CONFIG_CMD_ELF=n +CONFIG_CMD_EXTENSION=n +CONFIG_CMD_DATE=n CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set -# CONFIG_ACPIGEN is not set +CONFIG_NET=n +CONFIG_ACPIGEN=n CONFIG_AXI=y CONFIG_AXI_SANDBOX=y CONFIG_SANDBOX_GPIO=y @@ -33,8 +33,22 @@ CONFIG_DM_RTC=y CONFIG_SOUND=y CONFIG_SYSRESET=y CONFIG_TIMER=y +<<<<<<< HEAD # CONFIG_VIRTIO_MMIO is not set # CONFIG_VIRTIO_PCI is not set # CONFIG_VIRTIO_SANDBOX is not set # CONFIG_GENERATE_ACPI_TABLE is not set +||||||| parent of 7b58f8ee778 (configs: use syntax CONFIG_FOO=n in tools-only_defconfig) +# CONFIG_VIRTIO_MMIO is not set +# CONFIG_VIRTIO_PCI is not set +# CONFIG_VIRTIO_SANDBOX is not set +# CONFIG_GENERATE_ACPI_TABLE is not set +# CONFIG_EFI_LOADER is not set +======= +CONFIG_VIRTIO_MMIO=n +CONFIG_VIRTIO_PCI=n +CONFIG_VIRTIO_SANDBOX=n +CONFIG_GENERATE_ACPI_TABLE=n +CONFIG_EFI_LOADER=n +>>>>>>> 7b58f8ee778 (configs: use syntax CONFIG_FOO=n in tools-only_defconfig) CONFIG_TOOLS_MKEFICAPSULE=y From patchwork Wed Oct 16 09:56:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835790 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp343349wru; Wed, 16 Oct 2024 02:57:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWuwCxTAa62fP1UsvDRkVi8cfcxs14CCI+gfltGmZ8+6vhwKj8dqlgQSVHLy9z2sWs0gwt7Nw==@linaro.org X-Google-Smtp-Source: AGHT+IGhJYHwMU4e58RIT7AsIoATKg4QuCdnejTPoMLU4I45Ip+2m3HcBK/8/k4gHIhpd+whWIYk X-Received: by 2002:a05:6602:6107:b0:83a:a9e9:6dc9 with SMTP id ca18e2360f4ac-83aa9e96f1dmr49289039f.12.1729072655715; Wed, 16 Oct 2024 02:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729072655; cv=none; d=google.com; s=arc-20240605; b=liRNptmlHr+gI0tvT3PwlqukeD7fGNutcl8GKUln4WbCMHvQaDak3NpHD5LLiNFdVI DmHk6UMNW/qY7UUdbJj0ewwnY8h4t6/CoFwm6/YQ3Y378Qk87+woWqz3wy3Yl0W5t7VC 3aXyuRkXoND1SOZOPWHM7RLb9rVO4hRHuEr8grq64DC88EaHjSREXLSgLga1+KL8dye3 YBtFnwv4PFGPp4Bmoeq1ajSr3qx5xc2pfGidSEylakuTqNOT5+Xp6a2LtCMnBlcasaft 3dd2RPgIsgkeD4f1rYYDjT2LnqUu7uBhe+1000vUKemGK3OGROwQ7H2xJJbMtjtfgJWr +caQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yW9+uWzKDW7pJ5fTh0gM/qvqLk/B68shSksA84VS5Us=; fh=hK0nzEyOZj8gG9NXG1nyeonf3Djx8AG8ABxyb46yZU4=; b=f6fcyBq9PIfAsc5NozAGzJNLAanbqymiXEyBfIgdfHOMRxqMDslOOSEICfuJyrZ8Hg UYgNG9wPxg2t81DTsbqpDU3PFjl8T5hKa4eNA5ejeUF3NVGsa+E23mGmm34HOTEKSikZ NF/VugL2kLZiLuzGsTa5Yz1ypFlo+4LMs1YPidbCwtjlbMTbcpy3qaiohT9GMDo+1icS kK3FjskBhpBLl02Dy+KS+ObNxHSTBdDsw970mIbTn89OFV9EDFMfMpjfUz6ev2xALv+5 T8mBnojQrCygJel4gmjACQ2jCT2TK9lMWIsenB2N26bnwQKHGPrhz60pVvjU1ZgsCmQh mTJg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NdwkYT5y; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id ca18e2360f4ac-83a8b2ce2a8si155003439f.130.2024.10.16.02.57.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:57:35 -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=NdwkYT5y; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 247E588EE0; Wed, 16 Oct 2024 11:57: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="NdwkYT5y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4FAB888EE0; Wed, 16 Oct 2024 11:57:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 DA05F88EFA for ; Wed, 16 Oct 2024 11:57: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-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4311ae6426aso43645145e9.2 for ; Wed, 16 Oct 2024 02:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729072632; x=1729677432; 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=yW9+uWzKDW7pJ5fTh0gM/qvqLk/B68shSksA84VS5Us=; b=NdwkYT5yJeTqjyi6g7EhdYDl5SJDfNzVOmJ04miy1H2sWkGb8M6n8jMMSeTZCEZPAy VaSjeoob9AK9N+CHN4S45bbw3dhu1NaqwQyu/Juqg+mJsuYdexpEVfG/l4jeKEorYC19 PWjFtp7554KplDUtYLi9W8A4ks/VAT8V5F9+cUOytniAPH55weqBuRjnHZ+RRsxLfqEu qpS3x6IHp4j8Fwvb051G8ITuo3rmneZpfzySd+dvNS+kuXAoR4KmoPxqYHSd7sUTE6UN DrpS2D8x61fGiVuNYr6S2MptPXAMspYEeSFGk8AMlRaORtISc1fjO/mGX8ejGtwNOf10 6l2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729072632; x=1729677432; 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=yW9+uWzKDW7pJ5fTh0gM/qvqLk/B68shSksA84VS5Us=; b=Vv5tJEtsFgXBLk7gv+jKmPu56QIfymzzhsfMl8vS665J7yAeiC1VROpmI4FitCjAC3 80lHucYJ3kZaARGXvA5qxv1f8jm4lDlYx/yvmjVKFjGXIM8LZ2Jri9Pd2XLG4JhI0nwI w6PPprtgA+HHgxZCH+UcZ3ys7x2hZTu9uNUfLQtXIGQl2IFbHO/mRELHZ27tDZbQujr2 9vmKCHP8IcZZVGIbGluhdDMDtyqQYWAuTzH6xbVv5HJyQhHTYnlu8Edfy5QV4RwIrcOT hP+7pB9N5DmtfK4N/52z0wMzf2yoh6SJbA33ttMISl9FPdRGlNac3VD7YcmfE8HpATO4 9KYA== X-Gm-Message-State: AOJu0YyopfiP7NBUrgJVmtmgybjqFcydF2Cf9WK7eIA4ic3lDyVKf64U 8592feysa19fPqMWEqqtvr5vBPPNDN2GzA3B6q88lxBhMeUowh5zJQ4TLH/LtBw4odlaP/GHTXw w/BQH7g== X-Received: by 2002:a05:600c:1d10:b0:42f:8515:e482 with SMTP id 5b1f17b1804b1-4314a2b5a03mr25901305e9.9.1729072632020; Wed, 16 Oct 2024 02:57:12 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f6b1ebfsm45236335e9.34.2024.10.16.02.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:57:11 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Simon Glass , Tom Rini , Joe Hershberger , Ramon Fried , Yang Xiwen , Gabor Juhos , Neil Armstrong , Boon Khai Ng , Robert Marko , Patrice Chotard , Marek Vasut , Philip Oberfichtner Subject: [PATCH v13 02/21] sandbox: add dummy driver ETH_SANDBOX_LWIP Date: Wed, 16 Oct 2024 11:56:24 +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 Introduce ETH_SANDBOX_LWIP which enables a mock driver similar to ETH_SANDOX but without the dependencies on the legacy network stack (NET) so that it may be enabled when the lwIP stack (NET_LWIP) is introduced. The driver does nothing at this stage but its presence will allow dm_test_iommu_noiommu [1] to pass. [1] ./u-boot -T -c "ut dm dm_test_iommu_noiommu" Signed-off-by: Jerome Forissier Acked-by: Ilias Apalodimas Reviewed-by: Simon Glass --- drivers/net/Kconfig | 11 +++++ drivers/net/Makefile | 1 + drivers/net/sandbox-lwip.c | 85 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 drivers/net/sandbox-lwip.c diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 403d7e1c679..88ef674cd73 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -350,6 +350,17 @@ config ETH_SANDBOX This driver is particularly useful in the test/dm/eth.c tests +config ETH_SANDBOX_LWIP + depends on SANDBOX + depends on NET_LWIP + default y + bool "Sandbox: Mocked Ethernet driver (for NET_LWIP)" + help + This driver is meant as a replacement for ETH_SANDBOX when + the network stack is NET_LWIP rather than NET. It currently + does nothing, i.e. it drops the sent packets and never receives + data. + config ETH_SANDBOX_RAW depends on SANDBOX default y diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 4946a63f80f..f5ab1f5dedf 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -39,6 +39,7 @@ obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac_socfpga.o obj-$(CONFIG_ETH_SANDBOX) += sandbox.o obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw-bus.o obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw.o +obj-$(CONFIG_ETH_SANDBOX_LWIP) += sandbox-lwip.o obj-$(CONFIG_FEC_MXC) += fec_mxc.o obj-$(CONFIG_FMAN_ENET) += fm/ obj-$(CONFIG_FMAN_ENET) += fsl_mdio.o diff --git a/drivers/net/sandbox-lwip.c b/drivers/net/sandbox-lwip.c new file mode 100644 index 00000000000..3721033c310 --- /dev/null +++ b/drivers/net/sandbox-lwip.c @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2015 National Instruments + * + * (C) Copyright 2015 + * Joe Hershberger + */ + +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +static int sb_lwip_eth_start(struct udevice *dev) +{ + debug("eth_sandbox_lwip: Start\n"); + + return 0; +} + +static int sb_lwip_eth_send(struct udevice *dev, void *packet, int length) +{ + debug("eth_sandbox_lwip: Send packet %d\n", length); + + return -ENOTSUPP; +} + +static int sb_lwip_eth_recv(struct udevice *dev, int flags, uchar **packetp) +{ + return -EAGAIN; +} + +static int sb_lwip_eth_free_pkt(struct udevice *dev, uchar *packet, int length) +{ + return 0; +} + +static void sb_lwip_eth_stop(struct udevice *dev) +{ +} + +static int sb_lwip_eth_write_hwaddr(struct udevice *dev) +{ + return 0; +} + +static const struct eth_ops sb_eth_ops = { + .start = sb_lwip_eth_start, + .send = sb_lwip_eth_send, + .recv = sb_lwip_eth_recv, + .free_pkt = sb_lwip_eth_free_pkt, + .stop = sb_lwip_eth_stop, + .write_hwaddr = sb_lwip_eth_write_hwaddr, +}; + +static int sb_lwip_eth_remove(struct udevice *dev) +{ + return 0; +} + +static int sb_lwip_eth_of_to_plat(struct udevice *dev) +{ + return 0; +} + +static const struct udevice_id sb_eth_ids[] = { + { .compatible = "sandbox,eth" }, + { } +}; + +U_BOOT_DRIVER(eth_sandbox) = { + .name = "eth_lwip_sandbox", + .id = UCLASS_ETH, + .of_match = sb_eth_ids, + .of_to_plat = sb_lwip_eth_of_to_plat, + .remove = sb_lwip_eth_remove, + .ops = &sb_eth_ops, + .priv_auto = 0, + .plat_auto = sizeof(struct eth_pdata), +}; From patchwork Wed Oct 16 09:56:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835791 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp343399wru; Wed, 16 Oct 2024 02:57:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXs3qAJ8HiHn5R0OX1tTqUhu1oakCYYFZ384NMhCRWXK0p2N5RVPAvK+6IQqaFp2nsBkoiURA==@linaro.org X-Google-Smtp-Source: AGHT+IGPO465qus6j8HW8+5uhBv4yh7LgGybuqqLcgSCrc4p5OKuYuKoRBmE0KG9Oz1ezWmmOWyg X-Received: by 2002:a05:6602:2b87:b0:82c:eeaa:b1e0 with SMTP id ca18e2360f4ac-837947798bbmr1627499239f.11.1729072665742; Wed, 16 Oct 2024 02:57:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729072665; cv=none; d=google.com; s=arc-20240605; b=Q3myjw1O67a9u3fG1OJMlNJcizT/3bDIl0J4ssb/7XIzASpxuVmr7V/8VLWVHZbes0 /BBdQoGR/X1Kwb/9Rf2sQ0hsgfZMzEsCBNXKpU8QbWq1gRG+9uJkVY00Z4mWfut5W3im cUZT2DwJCaLMsA2ZYpX9AQB4X7ExmLEifTUDSWYRcd1b6it3FYrcfS4Z2uzDv0CSBhFp vCkhwbmu31yqRhWA4pr1cblIcaEQAPtCBjVe7kwuIiSVa1fHP23G7zYmeHm8iwHCAq0L 4nldqtTAdtdvYk7mFqHKzpw49wZIpDWL6EjnaDvhr1EgdVqk+EHnsnpkjYzGZOTb52W2 jP1A== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1f3amPh9ObQpkp4lRVh54Ids70l7HQ905iISzEE+AaE=; fh=nej+w6m9gbRnK6RkZbbY3buI7TuJ7nR0LerABlBlevs=; b=do622ebnu3JAPQvvFErkM7P+TCTU0NyeKD1W2awkbioYgtc9LuGQzh4UwAD57jeSg7 oc/xr8A1sAvmyqUNyHGX1Zm3obQZddimSc9DFL+3VSB6AO0OtoNozl8zovHohKEQz3yc 1xGTwMykBXr3ylhNsjxTdKcr/GQ53+pt3GGdE0jRDiuFp7JSKkuI7yw740IHLzGIhdPd gSq0JXfN03YgozCaVgqGmTNsIrKYxNrwT45uRqN6EJkrf+khC8GaJd29Ag9lKAUZQvGh ZdOBfASC0AQO2KgNH6uqKoBRE5KygEZcHWM0ZVRDgz0LI4l1Mi/0PG34s3YZ1gUJ8QOY TtvA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Lklod/5y"; 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 ca18e2360f4ac-83a8b2ce380si155021139f.111.2024.10.16.02.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:57:45 -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="Lklod/5y"; 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 858AD88F57; Wed, 16 Oct 2024 11:57: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="Lklod/5y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CBAFB88EE0; Wed, 16 Oct 2024 11:57:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D52E588D1B for ; Wed, 16 Oct 2024 11:57: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-wr1-x436.google.com with SMTP id ffacd0b85a97d-37d49ffaba6so4133998f8f.0 for ; Wed, 16 Oct 2024 02:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729072633; x=1729677433; 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=1f3amPh9ObQpkp4lRVh54Ids70l7HQ905iISzEE+AaE=; b=Lklod/5ykVBSCeEyHmapwwnmEuZA59m8z4j7bmoVv0EtLZST6i8tSxq47qSsqKkWKb pFiUpKRiTHogd1mOk5bL2/0TMF9JBkEExepLq2EyCD2Vu+YobQu1ZYkyXybfqujjXjMP npE+1i97z8onIyKlo9C1gYCnr2Mkf/AWt4YYWOj/Fhs7vQjseFQ+xyWavkeiODYMYE5h iG8s/Jlttzd/Ej5SvqDB+Nnjd8qoCEcbMJQGwusFm9TMEbdad/4++uWo4QXqMPQMF9A8 Gbq34JDGuZ8utNYzpb1J+3PC0sgTcufjlP2act7PIawU5KaTfBXoE51KDjNwgP6owsEV JdZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729072633; x=1729677433; 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=1f3amPh9ObQpkp4lRVh54Ids70l7HQ905iISzEE+AaE=; b=ZDHnDUwmQMy5Joqx3E5g78eRyemUa/0+K3Zwlp6TUhtsw9ljqghODXP3k7hJMzgFvv G3fTBDnk8jPcWxetTNs3OS0JXtphEOXpEwR4eWM2M29aGN2E/OHyvBJ2v8SEC4KQEDLs ePpDpJTg9DktDgEyW4On24gWnzxw5WBETkuxvWpt/HfXewAQKtamJhVtMlTnNuo1SGlD AM3MlcBjNi7HGwo5Ayb/uDOUE3R9SRpsSqm42qffa/Npm8n5j32BuQ/yiun3F9eoEBM1 nt9jNnG2m9HnoMHdoWlJ1UasreJf/+ZaxpGXC5ONXO1T+Tl14T+KKdNkJBC9Kr99vEhB xWww== X-Gm-Message-State: AOJu0YwgjtzsryZn8BQ0rTVxoyMspnL39OdRHi3IBsM6rAP8PxEQsIhA KjMyvVf+zdvOJGAX1drsyPe8cuhvXdvZ9r9px3lAqs12I0PLjToJAS+HZfYwzNPHwgMRQlI//8W nj69EbQ== X-Received: by 2002:adf:f3c9:0:b0:37d:3280:203a with SMTP id ffacd0b85a97d-37d55184cdbmr13538107f8f.10.1729072632996; Wed, 16 Oct 2024 02:57:12 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f6b1ebfsm45236335e9.34.2024.10.16.02.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:57:12 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Simon Glass , Tom Rini , Marek Vasut , Mattijs Korpershoek Subject: [PATCH v13 03/21] test: boot: fix bootdev_test_any for when DSA_SANDBOX is disabled Date: Wed, 16 Oct 2024 11:56:25 +0200 Message-Id: <37694587e362f96d2e5179c27fd7e75990eaf4f2.1729070678.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When DSA_SANDBOX is not set, the sandbox tests fail as follows: $ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any [...] Test: bootdev_test_any: bootdev.c test/boot/bootdev.c:156, bootdev_test_any(): "mmc2" = media->name: Expected "mmc2", got "mmc0" [...] This is due to the device list containing two less entries than expected. Therefore, adjust the expected index to be two less when DSA_SANDBOX is disabled. The actual use case is NET_LWIP=y (to be introduced in later patches) which implies DSA_SANDBOX=n for the time being. Signed-off-by: Jerome Forissier Reviewed-by: Simon Glass --- test/boot/bootdev.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c index c635d06ec25..369105ca4cf 100644 --- a/test/boot/bootdev.c +++ b/test/boot/bootdev.c @@ -128,6 +128,7 @@ BOOTSTD_TEST(bootdev_test_labels, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV); static int bootdev_test_any(struct unit_test_state *uts) { struct udevice *dev, *media; + char *seq; int mflags; /* @@ -147,8 +148,16 @@ static int bootdev_test_any(struct unit_test_state *uts) * 8 [ ] OK mmc mmc2.bootdev * 9 [ + ] OK mmc mmc1.bootdev * a [ ] OK mmc mmc0.bootdev + * + * However if DSA_SANDBOX is disabled the dsa-test@{0,1} devices + * are not there. */ - ut_assertok(bootdev_find_by_any("8", &dev, &mflags)); + if (CONFIG_IS_ENABLED(DSA_SANDBOX)) + seq = "8"; + else + seq = "6"; + + ut_assertok(bootdev_find_by_any(seq, &dev, &mflags)); ut_asserteq(UCLASS_BOOTDEV, device_get_uclass_id(dev)); ut_asserteq(BOOTFLOW_METHF_SINGLE_DEV, mflags); media = dev_get_parent(dev); From patchwork Wed Oct 16 09:56:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835792 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp343465wru; Wed, 16 Oct 2024 02:57:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWJTjdXBn9e33knWO8mOYbf+QmHXfqI2THsZRMAS3ef8iLWJRHMJz/zAuQCsRVAED6SU7isRA==@linaro.org X-Google-Smtp-Source: AGHT+IHkJ5SdDqOkqTHaozIe7N2Ch5hU9CE3FCzniSARCmVzDMQAJ7fek9oMWgUUrMSAS0WBs6lA X-Received: by 2002:a05:6602:27c3:b0:837:7f1a:40af with SMTP id ca18e2360f4ac-83a64d9734fmr1315020239f.14.1729072675817; Wed, 16 Oct 2024 02:57:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729072675; cv=none; d=google.com; s=arc-20240605; b=STUZS335xKSpvArMK1cDsuAlNwLdfc9leR304DS8+Ooh9zE8k5zfEVKwNp3PzMB2oi 5PgBUTuI15t5sbxCHCgfDmSTl/ZgtSrbH6iPmQlr7b49BMYRe3W2MHLcJ79czGnUVCEi +NbpMorgiDJFpR/4taIkXDNw+yFYVlp8ewaX9Q/rImgsw4CK4JURZVsbvmPh0pXIVaDd hwcbEOvLJsY6/hasyN5le0C/D2I+U7XPDvG4JzOohoqrM6/RZ0lPHaQgyUCUNwHdlFFh cwGChJfHRuxGJ1EY/1/K3dMDZJ18K6RGCJhTsbpaqx9OEOTmE5fsVDWlr1Zdd0LXor4Z 4oQw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kDutgpxnTxwKCYIiIQtKGwPjtjM6oNAFy+W630CdG0w=; fh=wEMi21KgBJesFM6dn9hReQOkJYiTKn1d3csebleuqj4=; b=Eh0qiYP1E0j0ENRyL7Ld6Sdjqv3ptJgQO01xijqfvb66ypZqn5hcgv/jBmx00fmA6Z uml9lfL+CME4DZxFhQ9l2AnWRwzf9Qpdtcr++0SgLj/xNHuWhvJrp8ugO1ja9Xj0u+Fu 8D6P5mfOWJ2q93CFu/48XUVw7aMfzMaPilq1qc+YW/W7nCVTGIrxn7f5BJALZmcIqSJ6 3qKwawcGlxl+jvpL6KaRl374AI6kN11NIATrQhMdbINeLwrQgbg8CnRTNXqzvKXA/B4T SqCEn1X0OXBpgptKlOfy+NpXU3kvbj4GSsbbl7oSYsSEFfhBuSwGRlaGjDZJ2RamGaCi Fh4Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rw+Yn9J0; 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 ca18e2360f4ac-83a8b210a1bsi152320339f.7.2024.10.16.02.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:57: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=Rw+Yn9J0; 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 E74CB88E02; Wed, 16 Oct 2024 11:57: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="Rw+Yn9J0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A6FCD88EE0; Wed, 16 Oct 2024 11:57: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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (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 AF74988F92 for ; Wed, 16 Oct 2024 11:57:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4314311959aso12611735e9.1 for ; Wed, 16 Oct 2024 02:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729072634; x=1729677434; 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=kDutgpxnTxwKCYIiIQtKGwPjtjM6oNAFy+W630CdG0w=; b=Rw+Yn9J0XifmOoF64muDMMZsCgi8HXi88WkSZ5+BZweWMMqNa1scevJThnfPjkyiBt yPwKlvEsOJC7p2I6if5kE83KBBW/6T0GUT50v97eIzIJi+72n9+oCCaA/CCDrUnKa9SA aHpvrPrcL/62NgeMGYjgRp0GqXnf1DTI3sQSoG5KNDLmwd31UN6geWz7UCZVKqNHRKgQ CLuEVBzAlZK/ZmyHiifcfH2f9Ga5SGh8dwEk+MRWfNLJGMUAAhPVsqqs9r9ejnLrsoSF zZQXfGxgZq50v+4pXE2CPsz7nB1hnPKaKzRYAeJ5VnMZXZD4+WC4xADFFc2R2orI++Nn WwiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729072634; x=1729677434; 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=kDutgpxnTxwKCYIiIQtKGwPjtjM6oNAFy+W630CdG0w=; b=nACaX3TYtIHgaPA7kde1WbYk4eOK/Gm8/U6UVNt/QkApYRF/dU8xNENIdyU4SfVY9m IsecpS6VKq/7sV7hN7rRkDwHXEJppD8Z4k6iZFnTt70JhchRVvdd/Ce2oTUbt1NSjFs9 RkYQ/MP/hAYx6r5floI/b2k2eUET/Qd0jDg+rsMdT3V9nMqMmkuDj+MwJlrx8Nn4naXP JFM6tmSO5RDAJoe+YKeF6H0kPI7FuMTctrm5oEn+G6wOyMywYjGU4kN90XqUUakHRkKX YuK8kzwSjpj//pLa/WiAyQX5VQ6VwsLRAGYi45R8bsMQ8r+WQVzky+Qg3xtMbluUcUwN 3jCA== X-Gm-Message-State: AOJu0YwhDk92Yn5v/gayx/nHigmbwQ8L5WLdgNt9pbBxpufI30RMykum ofvoxkvqcYoEKwP44XhjahyO0yIhiI8zJTn51OZbhomWi5rZ7tnVfZebS7xECMTszIizQLrbsu0 86wEREQ== X-Received: by 2002:a05:600c:468b:b0:42f:823d:dddd with SMTP id 5b1f17b1804b1-431256099e0mr106376265e9.27.1729072633991; Wed, 16 Oct 2024 02:57:13 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f6b1ebfsm45236335e9.34.2024.10.16.02.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:57:13 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Simon Glass , Tom Rini , Mattijs Korpershoek , Heinrich Schuchardt , AKASHI Takahiro , Francis Laniel Subject: [PATCH v13 04/21] test: boot: fix bootflow_cmd_label for when DSA_SANDBOX is disabled Date: Wed, 16 Oct 2024 11:56:26 +0200 Message-Id: <3baafbab154d05c19ce882ee0b23e426daaa231e.1729070678.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When DSA_SANDBOX is not set, the sandbox tests fail as follows: $ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any [...] Scanning for bootflows with label '9' [...] Cannot find '9' (err=-19) This is due to the device list containing two less entries than expected. Therefore, look for label '7' when DSA_SANDBOX is disabled. The actual use case is NET_LWIP=y (to be introduced in later patches) which implies DSA_SANDBOX=n for the time being. Signed-off-by: Jerome Forissier --- test/boot/bootflow.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 6ad63afe90a..154dea70a59 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -109,9 +109,17 @@ static int bootflow_cmd_label(struct unit_test_state *uts) * 8 [ ] OK mmc mmc2.bootdev * 9 [ + ] OK mmc mmc1.bootdev * a [ ] OK mmc mmc0.bootdev + * + * However with CONFIG_DSA_SANDBOX=n we have two fewer (dsa-test@0 and + * dsa-test@1). */ - ut_assertok(run_command("bootflow scan -lH 9", 0)); - ut_assert_nextline("Scanning for bootflows with label '9'"); + if (CONFIG_IS_ENABLED(DSA_SANDBOX)) { + ut_assertok(run_command("bootflow scan -lH 9", 0)); + ut_assert_nextline("Scanning for bootflows with label '9'"); + } else { + ut_assertok(run_command("bootflow scan -lH 7", 0)); + ut_assert_nextline("Scanning for bootflows with label '7'"); + } ut_assert_skip_to_line("(1 bootflow, 1 valid)"); ut_assertok(run_command("bootflow scan -lH 0", 0)); From patchwork Wed Oct 16 10:03: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: 835808 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp433511wru; Wed, 16 Oct 2024 06:33:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVEiAqjUDTe6PjEV3zD7/eTybp5BP1bmuCD+x1OwLkoxADbn7Xc6lXvti3jQA+mTjU2ExM4BA==@linaro.org X-Google-Smtp-Source: AGHT+IHXI9NRwNd3zuMntE6vefwhPqMDnzICk4p6gD4M1Qnve49BruIMNtQeYAjzum8U7Bqh9BAe X-Received: by 2002:a05:6e02:19cb:b0:3a3:3e17:994e with SMTP id e9e14a558f8ab-3a3bcdc0bdamr140523375ab.9.1729085622404; Wed, 16 Oct 2024 06:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729085622; cv=none; d=google.com; s=arc-20240605; b=R50b/RcAgEibd29EnAGugGxvvHJUy8Z7TwlLDLrs+iG17y+kkTWZKgkF0BmY2E8u6C lmGpgwflkWB9v6p4P5UwiVpQSs1O3xMTBAJZIDjF7k1CVUgIQltuiw12aZ8YIPOFSJCl 29iWbSajKtLeGKULcXti4GQGJ8K+xBjMFrKkycJeDdcNqr7uzgc+aczFjHHapYmzpJib nRUASaJxgxnQ74mb7DgHgMz/OucNxdxnUMoW4pwyjOVFvzrCy1v6FA5jH2Sa4Cd3HnC7 NUcpH2QhsiS1HvIt+8kGOBugG0F5sPyreFsMtcunBwbCkogz0w5f8CU17CkkJG/P03Uc L4mg== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9QPpRzjb2b/OGuG7gD3VjQERBdNVdjvohZYi2NpHSpE=; fh=deXQ6Q4hiwTwodOpV50/MOjsk3FoZm1riWyoXk4vDH4=; b=cGt3ZPjjOFuQVZkcHfRxNTqlAbJY5jBvWVqAfB5IYR2ShVxQCHKg/z9uTgZ+43qR3L b320iqy+eaji2ueGr5y8/jX9mu+zIlVz3a65t2hIbG+4bFAPmzZKg/f2+q2NVMmjH1FR OWWGedDV9FRb/W2pcUeTeIsMn7wvmUxfGYbUfw/Ktx0xagKuF0F/Ge4bhMmfE6bSphSG cYTvfF49svMiMNvfASBkKWn2OES4YSbqbsWB0nXiiIq75K+APbUxdzy/cAK2Uw+FSb+K Ua67SWLKhGygMZh9ftN+3zpInDI9a1t1Qg3rW5zZl8JAQINkokCnrkNrg1W3rk02WqnA GF5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BDra6dPm; 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 e9e14a558f8ab-3a3d7158409si17910455ab.84.2024.10.16.06.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 06:33:42 -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=BDra6dPm; 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 54A1288DB8; Wed, 16 Oct 2024 15:33: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="BDra6dPm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CF8E588FAF; Wed, 16 Oct 2024 12:04:49 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (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 83C7988FD2 for ; Wed, 16 Oct 2024 12:04:41 +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-x32e.google.com with SMTP id 5b1f17b1804b1-43055b43604so61545455e9.3 for ; Wed, 16 Oct 2024 03:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073081; x=1729677881; 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=9QPpRzjb2b/OGuG7gD3VjQERBdNVdjvohZYi2NpHSpE=; b=BDra6dPmqOj9A6ODRTmWEjIYqEHGsZ1zT5CmjkDPRmoTFFc31GIBb0zb7dvIAbM95y rQQtpmigpL96H8NuF0Hm1xT23xRp7mdAzwiPXJLLH34ssdNqFgs+FzRfykX5s07skr+X utxES2yeMWR5fqEBpY4Yn75LvEDLMRh2lPafNDnRnt0iONJkEJI9ALezrJaPnDOH1aMq c7S4aWLVWwiCVwoGb/FvTRpqd5t1DVKhohNKjzp/cgrAmE3Wj7tc32fo1Vx6zhPJzuwB vhDCMZzdtCp1mE9NeVT/KIAs+uIQ2a3Bdw+J4NCksH/yKFZNWvFGCxcFa5wdZ2vKk/tp 1SpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073081; x=1729677881; 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=9QPpRzjb2b/OGuG7gD3VjQERBdNVdjvohZYi2NpHSpE=; b=tnInBmitNNOasTE78IdeIeuGqSN4D5wvmyLGIMaKxe/I+ppeRoRMsdZ6u8+GiUm58j B7elvat7WCtjZEwSms7Ny/9DBr2+0OBbKz8TW4RrmvZka14u2Wmqw4nTlkG1pDJmOoFk Y5JE71avxFEvdkC6qfGyuPtjLsZhu9xAaUzxFNbT3PWeyT1V0r2w//xXrwEl5E5p9Kb1 66/uE/BUt4tM1F7Id+Xrrx5kN5V4kpvLFFsb1eeDg69/vFapYLbK3sy8GW8ttBpBWBuq pbT/WsaU12trGdUjrE7nugcS+7cslU0u8FJYJu/dR6xPTz5BGAdiNO5kQMFofRxHn7Ck fgGQ== X-Gm-Message-State: AOJu0YwaothR/V7a7+8oqvPW9Kh4UNAf+y6KvZFYovewCLGWDu9xdtto EnkPHDFqQ65S53ftYRN43MgSqAROQ0QoN1dAMhGvmOmDiBCmQwZYbmQktjKGzTclFSr3KU0YW5P vi73xYm86 X-Received: by 2002:a05:600c:1c97:b0:42c:bbd5:af60 with SMTP id 5b1f17b1804b1-4314a37ee4fmr29243835e9.24.1729073080079; Wed, 16 Oct 2024 03:04:40 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:04:39 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Lukasz Majewski , Mattijs Korpershoek , Joe Hershberger , Ramon Fried , Marek Vasut , Simon Glass , Paul Kocialkowski , Oliver Gaskell , Greg Malysa , Nathan Barrett-Morrison , Trevor Woerner , Hiago De Franco , Jonas Karlman , John Keeping , Heinrich Schuchardt , Bryan Brattlof , "Leon M. Busch-George" , Eddie James , Quentin Schulz , AKASHI Takahiro , Stefan Roese , Jagan Teki , Jiaxun Yang , Rasmus Villemoes , Joshua Watt , Sean Anderson , Andre Przywara , Samuel Holland , Lukas Funke , Jaehoon Chung , Ion Agorria , Alexey Romanov , Svyatoslav Ryhel , Yang Xiwen , Peter Robinson , Neil Armstrong , Philip Oberfichtner , Boon Khai Ng , Robert Marko , Miquel Raynal , Vitaliy Vasylskyy , Anand Moon , Baruch Siach , Alexander Gendin , Johan Jonker , Kever Yang Subject: [PATCH v13 05/21] net: introduce alternative implementation as net/lwip/ Date: Wed, 16 Oct 2024 12:03:59 +0200 Message-Id: <5096b12394071aea85b1ff3c505547efbe301dba.1729070678.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: Wed, 16 Oct 2024 15:33:18 +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 and FASTBOOT are not compatible with NET_LWIP because of dependencies on net_loop(), tftp_timeout_ms, tftp_timeout_count_max and other NET things. Let's add a dependency on !NET_LWIP for now. SANDBOX can select NET_LWIP but doing so will currently disable the eth dm tests as well as the wget tests which have strong dependencies on the NET code. Other adjustments to Kconfig files are made to fix "unmet direct dependencies detected" for USB_FUNCTION_SDP and CMD_FASTBOOT when the default networking stack is set to NET_LWIP ("default NET_LWIP" instead of "default NET" in Kconfig). The networking stack is now a choice between NO_NET, NET and NET_LWIP. Therefore '# CONFIG_NET is not set' should be 'CONFIG_NO_NET=y'. Adjust the defconfigs accordingly. Signed-off-by: Jerome Forissier --- Kconfig | 29 +++++++++ Makefile | 2 +- boot/Kconfig | 4 +- cmd/Kconfig | 1 + common/Kconfig | 2 +- common/spl/Kconfig | 1 + configs/LicheePi_Zero_defconfig | 2 +- configs/M5249EVB_defconfig | 2 +- configs/am335x_pdu001_defconfig | 2 +- configs/am62ax_evm_r5_defconfig | 2 +- configs/am62px_evm_r5_defconfig | 2 +- configs/am62x_beagleplay_r5_defconfig | 2 +- configs/amcore_defconfig | 2 +- configs/amd_versal2_mini_defconfig | 2 +- configs/amd_versal2_mini_emmc_defconfig | 2 +- configs/amd_versal2_mini_ospi_defconfig | 2 +- configs/amd_versal2_mini_qspi_defconfig | 2 +- configs/anbernic-rgxx3-rk3566_defconfig | 2 +- configs/ap143_defconfig | 2 +- configs/ap152_defconfig | 2 +- configs/apple_m1_defconfig | 2 +- configs/astro_mcf5373l_defconfig | 2 +- configs/at91sam9rlek_dataflash_defconfig | 2 +- configs/at91sam9rlek_mmc_defconfig | 2 +- configs/at91sam9rlek_nandflash_defconfig | 2 +- configs/bcm7260_defconfig | 2 +- configs/bcm7445_defconfig | 2 +- configs/bcm968380gerg_ram_defconfig | 2 +- configs/bcmns_defconfig | 2 +- configs/chromebook_samus_tpl_defconfig | 2 +- configs/cortina_presidio-asic-base_defconfig | 2 +- configs/cortina_presidio-asic-pnand_defconfig | 2 +- configs/durian_defconfig | 2 +- configs/e850-96_defconfig | 2 +- configs/ea-lpc3250devkitv2_defconfig | 2 +- configs/efi-x86_app32_defconfig | 2 +- configs/efi-x86_app64_defconfig | 2 +- configs/emsdp_defconfig | 2 +- configs/evb-px5_defconfig | 2 +- configs/generic-rk3568_defconfig | 2 +- configs/generic-rk3588_defconfig | 2 +- configs/hc2910_2aghd05_defconfig | 2 +- configs/igep00x0_defconfig | 2 +- configs/imx6q_bosch_acc_defconfig | 2 +- configs/imx6ulz_smm_m2_defconfig | 2 +- configs/iot_devkit_defconfig | 2 +- configs/j722s_evm_r5_defconfig | 2 +- configs/legoev3_defconfig | 2 +- configs/mk808_defconfig | 2 +- configs/mx23evk_defconfig | 2 +- configs/mx28evk_defconfig | 2 +- configs/mx6memcal_defconfig | 2 +- configs/mx6ulz_14x14_evk_defconfig | 2 +- configs/mx7ulp_com_defconfig | 2 +- configs/mx7ulp_evk_defconfig | 2 +- configs/mx7ulp_evk_plugin_defconfig | 2 +- configs/netgear_cg3100d_ram_defconfig | 2 +- configs/nsim_700_defconfig | 2 +- configs/nsim_700be_defconfig | 2 +- configs/nsim_hs38be_defconfig | 2 +- configs/openpiton_riscv64_defconfig | 2 +- configs/openpiton_riscv64_spl_defconfig | 2 +- configs/origen_defconfig | 2 +- configs/pe2201_defconfig | 2 +- configs/pinecube_defconfig | 2 +- configs/pm9261_defconfig | 2 +- configs/s5p4418_nanopi2_defconfig | 2 +- configs/s5p_goni_defconfig | 2 +- configs/s5pc210_universal_defconfig | 2 +- configs/sama5d27_giantboard_defconfig | 2 +- configs/sama5d29_curiosity_mmc1_defconfig | 2 +- configs/sama5d29_curiosity_mmc_defconfig | 2 +- .../sama5d29_curiosity_qspiflash_defconfig | 2 +- configs/sama7g54_curiosity_mmc_defconfig | 2 +- .../sama7g54_curiosity_nandflash_defconfig | 2 +- .../sama7g54_curiosity_qspiflash_defconfig | 2 +- configs/sipeed_maix_bitm_defconfig | 2 +- configs/sipeed_maix_smode_defconfig | 2 +- configs/stemmy_defconfig | 2 +- configs/stm32f429-discovery_defconfig | 2 +- configs/stm32f429-evaluation_defconfig | 2 +- configs/stm32f469-discovery_defconfig | 2 +- configs/stm32h743-disco_defconfig | 2 +- configs/stm32h743-eval_defconfig | 2 +- configs/stm32h750-art-pi_defconfig | 2 +- configs/stm32mp25_defconfig | 2 +- configs/stmark2_defconfig | 2 +- configs/th1520_lpi4a_defconfig | 2 +- configs/thunderx_88xx_defconfig | 2 +- configs/tools-only_defconfig | 2 +- configs/topic_miami_defconfig | 2 +- configs/topic_miamilite_defconfig | 2 +- configs/topic_miamiplus_defconfig | 2 +- configs/total_compute_defconfig | 2 +- configs/trats2_defconfig | 2 +- configs/trats_defconfig | 2 +- configs/xenguest_arm64_defconfig | 2 +- configs/xenguest_arm64_virtio_defconfig | 2 +- configs/xilinx_versal_mini_defconfig | 2 +- configs/xilinx_versal_mini_emmc0_defconfig | 2 +- configs/xilinx_versal_mini_emmc1_defconfig | 2 +- configs/xilinx_versal_mini_ospi_defconfig | 2 +- configs/xilinx_versal_mini_qspi_defconfig | 2 +- configs/xilinx_versal_net_mini_defconfig | 2 +- configs/xilinx_versal_net_mini_emmc_defconfig | 2 +- configs/xilinx_versal_net_mini_ospi_defconfig | 2 +- configs/xilinx_versal_net_mini_qspi_defconfig | 2 +- configs/xilinx_zynqmp_mini_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc0_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc1_defconfig | 2 +- configs/xilinx_zynqmp_mini_nand_defconfig | 2 +- .../xilinx_zynqmp_mini_nand_single_defconfig | 2 +- configs/xilinx_zynqmp_mini_qspi_defconfig | 2 +- configs/zynq_cse_nand_defconfig | 2 +- configs/zynq_cse_nor_defconfig | 2 +- configs/zynq_cse_qspi_defconfig | 2 +- drivers/dfu/Kconfig | 1 + drivers/fastboot/Kconfig | 1 + drivers/net/Kconfig | 3 + drivers/net/phy/Kconfig | 2 +- drivers/usb/gadget/Kconfig | 2 +- net/Kconfig | 61 ++++++++++--------- net/Makefile | 4 ++ net/lwip/Kconfig | 49 +++++++++++++++ test/cmd/Makefile | 2 + test/dm/Makefile | 2 + 126 files changed, 241 insertions(+), 145 deletions(-) create mode 100644 net/lwip/Kconfig diff --git a/Kconfig b/Kconfig index 74e8ce5edfd..a206d1f8124 100644 --- a/Kconfig +++ b/Kconfig @@ -758,8 +758,37 @@ source "dts/Kconfig" source "env/Kconfig" +menu Networking + +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 + source "net/Kconfig" +endmenu + source "drivers/Kconfig" source "fs/Kconfig" diff --git a/Makefile b/Makefile index 3267fb1c469..f203a4f59e0 100644 --- a/Makefile +++ b/Makefile @@ -865,7 +865,7 @@ libs-$(CONFIG_OF_EMBED) += dts/ libs-y += env/ libs-y += lib/ libs-y += fs/ -libs-y += net/ +libs-$(filter y,$(CONFIG_NET) $(CONFIG_NET_LWIP)) += net/ libs-y += disk/ libs-y += drivers/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ diff --git a/boot/Kconfig b/boot/Kconfig index 925afe06a19..1d50a83a2d2 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -503,7 +503,8 @@ config BOOTMETH_ANDROID select ANDROID_AB select ANDROID_BOOT_IMAGE select CMD_BCB - select CMD_FASTBOOT + imply CMD_FASTBOOT + imply FASTBOOT if !NET_LWIP select PARTITION_TYPE_GUID select PARTITION_UUIDS help @@ -559,6 +560,7 @@ config BOOTMETH_EXTLINUX_PXE config BOOTMETH_EFILOADER bool "Bootdev support for EFI boot" depends on EFI_BINARY_EXEC + imply CMD_TFTPBOOT if CMD_NET default y help Enables support for EFI boot using bootdevs. This makes the diff --git a/cmd/Kconfig b/cmd/Kconfig index 37894eb80d6..6d20d7597cb 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1653,6 +1653,7 @@ config CMD_USB config CMD_USB_SDP bool "sdp" + depends on USB_GADGET_DOWNLOAD select USB_FUNCTION_SDP help Enables the command "sdp" which is used to have U-Boot emulating the diff --git a/common/Kconfig b/common/Kconfig index 957de0c5c02..0339b9e4c84 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 2baf2ba7ccb..9a27eabd741 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -1083,6 +1083,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/configs/LicheePi_Zero_defconfig b/configs/LicheePi_Zero_defconfig index 009384eaf1b..c37c49ccbb1 100644 --- a/configs/LicheePi_Zero_defconfig +++ b/configs/LicheePi_Zero_defconfig @@ -5,4 +5,4 @@ CONFIG_SPL=y CONFIG_MACH_SUN8I_V3S=y CONFIG_DRAM_CLK=360 # CONFIG_HAS_ARMV7_SECURE_BASE is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y diff --git a/configs/M5249EVB_defconfig b/configs/M5249EVB_defconfig index eac85b9c2d5..ed1446d81cb 100644 --- a/configs/M5249EVB_defconfig +++ b/configs/M5249EVB_defconfig @@ -22,7 +22,7 @@ CONFIG_CMD_MX_CYCLIC=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_CACHE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y diff --git a/configs/am335x_pdu001_defconfig b/configs/am335x_pdu001_defconfig index 54da31f45f7..09753fdbd06 100644 --- a/configs/am335x_pdu001_defconfig +++ b/configs/am335x_pdu001_defconfig @@ -42,7 +42,7 @@ CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_OF_TRANSLATE=y diff --git a/configs/am62ax_evm_r5_defconfig b/configs/am62ax_evm_r5_defconfig index 2fe6c49b80f..f386875a89f 100644 --- a/configs/am62ax_evm_r5_defconfig +++ b/configs/am62ax_evm_r5_defconfig @@ -66,7 +66,7 @@ CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_PART=1 -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_REGMAP=y diff --git a/configs/am62px_evm_r5_defconfig b/configs/am62px_evm_r5_defconfig index 0cdbd30a760..5fed277d59d 100644 --- a/configs/am62px_evm_r5_defconfig +++ b/configs/am62px_evm_r5_defconfig @@ -70,7 +70,7 @@ CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_PART=1 -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_DEVICE_REMOVE=y CONFIG_SPL_DM_SEQ_ALIAS=y diff --git a/configs/am62x_beagleplay_r5_defconfig b/configs/am62x_beagleplay_r5_defconfig index 0038747155e..9daee2a38bb 100644 --- a/configs/am62x_beagleplay_r5_defconfig +++ b/configs/am62x_beagleplay_r5_defconfig @@ -67,7 +67,7 @@ CONFIG_SPL_OF_CONTROL=y CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_REGMAP=y diff --git a/configs/amcore_defconfig b/configs/amcore_defconfig index f1f5201b30a..94c5379590d 100644 --- a/configs/amcore_defconfig +++ b/configs/amcore_defconfig @@ -33,7 +33,7 @@ CONFIG_CMD_DIAG=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="AMCORE" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y diff --git a/configs/amd_versal2_mini_defconfig b/configs/amd_versal2_mini_defconfig index d4760e40223..ec1921aac39 100644 --- a/configs/amd_versal2_mini_defconfig +++ b/configs/amd_versal2_mini_defconfig @@ -62,7 +62,7 @@ CONFIG_CMD_CACHE=y # CONFIG_CMD_SLEEP is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set diff --git a/configs/amd_versal2_mini_emmc_defconfig b/configs/amd_versal2_mini_emmc_defconfig index d2de379d07c..6d4b261606f 100644 --- a/configs/amd_versal2_mini_emmc_defconfig +++ b/configs/amd_versal2_mini_emmc_defconfig @@ -54,7 +54,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_MMC_HS200_SUPPORT=y CONFIG_MMC_SDHCI=y diff --git a/configs/amd_versal2_mini_ospi_defconfig b/configs/amd_versal2_mini_ospi_defconfig index 22a8bfa8511..6c394432f5b 100644 --- a/configs/amd_versal2_mini_ospi_defconfig +++ b/configs/amd_versal2_mini_ospi_defconfig @@ -56,7 +56,7 @@ CONFIG_CMD_CACHE=y # CONFIG_CMD_SLEEP is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set diff --git a/configs/amd_versal2_mini_qspi_defconfig b/configs/amd_versal2_mini_qspi_defconfig index de404b0f658..5c770a7530a 100644 --- a/configs/amd_versal2_mini_qspi_defconfig +++ b/configs/amd_versal2_mini_qspi_defconfig @@ -56,7 +56,7 @@ CONFIG_CMD_CACHE=y # CONFIG_CMD_SLEEP is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set diff --git a/configs/anbernic-rgxx3-rk3566_defconfig b/configs/anbernic-rgxx3-rk3566_defconfig index 83337d68cc0..4dcf18e22ca 100644 --- a/configs/anbernic-rgxx3-rk3566_defconfig +++ b/configs/anbernic-rgxx3-rk3566_defconfig @@ -42,7 +42,7 @@ CONFIG_OF_LIVE=y # CONFIG_OF_UPSTREAM is not set CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_REGMAP=y CONFIG_SPL_SYSCON=y diff --git a/configs/ap143_defconfig b/configs/ap143_defconfig index 9d503bdf61f..9083bf293f5 100644 --- a/configs/ap143_defconfig +++ b/configs/ap143_defconfig @@ -46,7 +46,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-flash.0:256k(u-boot),64k(u-boot-env),6336k CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_SPI_MAX_HZ=25000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y diff --git a/configs/ap152_defconfig b/configs/ap152_defconfig index d830a85be69..0864bf46d54 100644 --- a/configs/ap152_defconfig +++ b/configs/ap152_defconfig @@ -46,7 +46,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-flash.0:256k(u-boot),64k(u-boot-env),6336k CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_SPI_MAX_HZ=25000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_BAR=y diff --git a/configs/apple_m1_defconfig b/configs/apple_m1_defconfig index 6a5affcaca9..2d685da8c9e 100644 --- a/configs/apple_m1_defconfig +++ b/configs/apple_m1_defconfig @@ -11,7 +11,7 @@ CONFIG_SYS_PBSIZE=276 CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_BOARD_LATE_INIT=y CONFIG_CMD_SELECT_FONT=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SYS_64BIT_LBA=y CONFIG_APPLE_SPI_KEYB=y # CONFIG_MMC is not set diff --git a/configs/astro_mcf5373l_defconfig b/configs/astro_mcf5373l_defconfig index d1942c28971..8dd369d68a1 100644 --- a/configs/astro_mcf5373l_defconfig +++ b/configs/astro_mcf5373l_defconfig @@ -27,7 +27,7 @@ CONFIG_CMD_I2C=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_CACHE=y CONFIG_CMD_JFFS2=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_FPGA_ALTERA=y CONFIG_FPGA_CYCLON2=y CONFIG_FPGA_XILINX=y diff --git a/configs/at91sam9rlek_dataflash_defconfig b/configs/at91sam9rlek_dataflash_defconfig index 141e83fe5fd..9ebe2de1f2c 100644 --- a/configs/at91sam9rlek_dataflash_defconfig +++ b/configs/at91sam9rlek_dataflash_defconfig @@ -41,7 +41,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_SPI_MAX_HZ=15000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_GPIO=y diff --git a/configs/at91sam9rlek_mmc_defconfig b/configs/at91sam9rlek_mmc_defconfig index d497d59a073..0fef493164e 100644 --- a/configs/at91sam9rlek_mmc_defconfig +++ b/configs/at91sam9rlek_mmc_defconfig @@ -39,7 +39,7 @@ CONFIG_CMD_FAT=y CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_FAT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_GPIO=y diff --git a/configs/at91sam9rlek_nandflash_defconfig b/configs/at91sam9rlek_nandflash_defconfig index 1bcdab8e5aa..c40e99817b9 100644 --- a/configs/at91sam9rlek_nandflash_defconfig +++ b/configs/at91sam9rlek_nandflash_defconfig @@ -40,7 +40,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_GPIO=y diff --git a/configs/bcm7260_defconfig b/configs/bcm7260_defconfig index aeb1f907199..ed026e58617 100644 --- a/configs/bcm7260_defconfig +++ b/configs/bcm7260_defconfig @@ -36,7 +36,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCMSTB=y CONFIG_MTD=y diff --git a/configs/bcm7445_defconfig b/configs/bcm7445_defconfig index 03012056fbb..07294451100 100644 --- a/configs/bcm7445_defconfig +++ b/configs/bcm7445_defconfig @@ -38,7 +38,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCMSTB=y CONFIG_MTD=y diff --git a/configs/bcm968380gerg_ram_defconfig b/configs/bcm968380gerg_ram_defconfig index 6c119eb42a6..053c459e05c 100644 --- a/configs/bcm968380gerg_ram_defconfig +++ b/configs/bcm968380gerg_ram_defconfig @@ -41,7 +41,7 @@ CONFIG_CMD_GPIO=y CONFIG_CMD_NAND=y # CONFIG_CMD_SLEEP is not set CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_BCM6345_GPIO=y CONFIG_LED=y diff --git a/configs/bcmns_defconfig b/configs/bcmns_defconfig index 989017b96d9..c53c6fffbc4 100644 --- a/configs/bcmns_defconfig +++ b/configs/bcmns_defconfig @@ -29,7 +29,7 @@ CONFIG_CMD_CACHE=y CONFIG_OF_EMBED=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="NS" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_MTD=y CONFIG_DM_MTD=y diff --git a/configs/chromebook_samus_tpl_defconfig b/configs/chromebook_samus_tpl_defconfig index 1be57560f89..075e3f192a3 100644 --- a/configs/chromebook_samus_tpl_defconfig +++ b/configs/chromebook_samus_tpl_defconfig @@ -74,7 +74,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="bzImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_REGMAP=y CONFIG_SYSCON=y # CONFIG_ACPIGEN is not set diff --git a/configs/cortina_presidio-asic-base_defconfig b/configs/cortina_presidio-asic-base_defconfig index 0cb33996fe7..d779e7d8e58 100644 --- a/configs/cortina_presidio-asic-base_defconfig +++ b/configs/cortina_presidio-asic-base_defconfig @@ -32,7 +32,7 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_SMC=y CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CORTINA_GPIO=y # CONFIG_MMC is not set CONFIG_DM_SERIAL=y diff --git a/configs/cortina_presidio-asic-pnand_defconfig b/configs/cortina_presidio-asic-pnand_defconfig index 093874d3023..cdb9681b32b 100644 --- a/configs/cortina_presidio-asic-pnand_defconfig +++ b/configs/cortina_presidio-asic-pnand_defconfig @@ -33,7 +33,7 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_SMC=y CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CORTINA_GPIO=y # CONFIG_MMC is not set CONFIG_MTD=y diff --git a/configs/durian_defconfig b/configs/durian_defconfig index 7765fe3a6a2..ea1d37e9db6 100644 --- a/configs/durian_defconfig +++ b/configs/durian_defconfig @@ -28,7 +28,7 @@ CONFIG_SYS_PROMPT="durian#" CONFIG_CMD_PCI=y CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SCSI_AHCI=y CONFIG_AHCI_PCI=y # CONFIG_MMC is not set diff --git a/configs/e850-96_defconfig b/configs/e850-96_defconfig index e5d90996234..5797c6cb1f9 100644 --- a/configs/e850-96_defconfig +++ b/configs/e850-96_defconfig @@ -20,7 +20,7 @@ CONFIG_CMD_MMC=y CONFIG_CMD_PART=y CONFIG_CMD_TIME=y CONFIG_CMD_RNG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK_EXYNOS850=y CONFIG_MMC_DW=y CONFIG_SOC_SAMSUNG=y diff --git a/configs/ea-lpc3250devkitv2_defconfig b/configs/ea-lpc3250devkitv2_defconfig index af9fc5f2f5c..c3af7afced1 100644 --- a/configs/ea-lpc3250devkitv2_defconfig +++ b/configs/ea-lpc3250devkitv2_defconfig @@ -25,7 +25,7 @@ CONFIG_SYS_PROMPT="EA-LPC3250v2=> " CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_OF_CONTROL=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_LPC32XX_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_LPC32XX=y diff --git a/configs/efi-x86_app32_defconfig b/configs/efi-x86_app32_defconfig index 0025e56b5d7..c730945f4f9 100644 --- a/configs/efi-x86_app32_defconfig +++ b/configs/efi-x86_app32_defconfig @@ -36,7 +36,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="bzImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_REGMAP=y CONFIG_SYSCON=y # CONFIG_GZIP is not set diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_defconfig index 1cc50b689c9..1831fb2d5a7 100644 --- a/configs/efi-x86_app64_defconfig +++ b/configs/efi-x86_app64_defconfig @@ -40,7 +40,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="bzImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_REGMAP=y CONFIG_SYSCON=y CONFIG_CONSOLE_SCROLL_LINES=5 diff --git a/configs/emsdp_defconfig b/configs/emsdp_defconfig index efa5eecad0d..376862ad300 100644 --- a/configs/emsdp_defconfig +++ b/configs/emsdp_defconfig @@ -30,7 +30,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="app.bin" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MMC=y CONFIG_MMC_DW=y CONFIG_MMC_DW_SNPS=y diff --git a/configs/evb-px5_defconfig b/configs/evb-px5_defconfig index 48f5b90a7dc..b08714437fd 100644 --- a/configs/evb-px5_defconfig +++ b/configs/evb-px5_defconfig @@ -57,7 +57,7 @@ CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names interrupt-parent" CONFIG_TPL_OF_PLATDATA=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_TPL_DM=y CONFIG_REGMAP=y CONFIG_SPL_REGMAP=y diff --git a/configs/generic-rk3568_defconfig b/configs/generic-rk3568_defconfig index 9b9eab6bad1..1d06f3411fe 100644 --- a/configs/generic-rk3568_defconfig +++ b/configs/generic-rk3568_defconfig @@ -41,7 +41,7 @@ CONFIG_OF_LIVE=y # CONFIG_OF_UPSTREAM is not set CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_REGMAP=y CONFIG_SPL_SYSCON=y diff --git a/configs/generic-rk3588_defconfig b/configs/generic-rk3588_defconfig index f22277f935d..ebe883ed597 100644 --- a/configs/generic-rk3588_defconfig +++ b/configs/generic-rk3588_defconfig @@ -35,7 +35,7 @@ CONFIG_OF_LIVE=y # CONFIG_OF_UPSTREAM is not set CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_REGMAP=y CONFIG_SPL_SYSCON=y diff --git a/configs/hc2910_2aghd05_defconfig b/configs/hc2910_2aghd05_defconfig index d06f922ba57..d7cc7d18ed8 100644 --- a/configs/hc2910_2aghd05_defconfig +++ b/configs/hc2910_2aghd05_defconfig @@ -37,7 +37,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_PARTITION_TYPE_GUID=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_GPIO is not set # CONFIG_I2C is not set # CONFIG_INPUT is not set diff --git a/configs/igep00x0_defconfig b/configs/igep00x0_defconfig index f1d9bb34aba..51c825d3fbe 100644 --- a/configs/igep00x0_defconfig +++ b/configs/igep00x0_defconfig @@ -60,7 +60,7 @@ CONFIG_ENV_UBI_VOLUME="config" CONFIG_ENV_UBI_VOLUME_REDUND="config_r" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_DM_I2C=y CONFIG_I2C_SET_DEFAULT_BUS_NUM=y diff --git a/configs/imx6q_bosch_acc_defconfig b/configs/imx6q_bosch_acc_defconfig index 354b73752ad..a46b3250b2e 100644 --- a/configs/imx6q_bosch_acc_defconfig +++ b/configs/imx6q_bosch_acc_defconfig @@ -82,7 +82,7 @@ CONFIG_SYS_MMC_ENV_PART=1 CONFIG_ENV_WRITEABLE_LIST=y CONFIG_ENV_ACCESS_IGNORE_FORCE=y CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_DM_BOOTCOUNT=y diff --git a/configs/imx6ulz_smm_m2_defconfig b/configs/imx6ulz_smm_m2_defconfig index 93ead4c373b..c2adff17abf 100644 --- a/configs/imx6ulz_smm_m2_defconfig +++ b/configs/imx6ulz_smm_m2_defconfig @@ -42,7 +42,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x82000000 diff --git a/configs/iot_devkit_defconfig b/configs/iot_devkit_defconfig index ba275d04a11..5b7e131c9ac 100644 --- a/configs/iot_devkit_defconfig +++ b/configs/iot_devkit_defconfig @@ -34,7 +34,7 @@ CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="app.bin" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MMC=y CONFIG_MMC_DW=y CONFIG_MMC_DW_SNPS=y diff --git a/configs/j722s_evm_r5_defconfig b/configs/j722s_evm_r5_defconfig index 74fbe52e588..e6a573d599d 100644 --- a/configs/j722s_evm_r5_defconfig +++ b/configs/j722s_evm_r5_defconfig @@ -70,7 +70,7 @@ CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_PART=1 -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_DEVICE_REMOVE=y CONFIG_SPL_DM_SEQ_ALIAS=y diff --git a/configs/legoev3_defconfig b/configs/legoev3_defconfig index 34ef3493cac..60b7a84205c 100644 --- a/configs/legoev3_defconfig +++ b/configs/legoev3_defconfig @@ -44,7 +44,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_DM_I2C=y CONFIG_SYS_I2C_DAVINCI=y diff --git a/configs/mk808_defconfig b/configs/mk808_defconfig index 0610b51748e..dc9b12e5d8c 100644 --- a/configs/mk808_defconfig +++ b/configs/mk808_defconfig @@ -68,7 +68,7 @@ CONFIG_OF_DTB_PROPS_REMOVE=y CONFIG_SPL_OF_PLATDATA=y CONFIG_TPL_OF_PLATDATA=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_TPL_DM=y CONFIG_REGMAP=y CONFIG_SPL_REGMAP=y diff --git a/configs/mx23evk_defconfig b/configs/mx23evk_defconfig index 793ba6add55..6152d930e3a 100644 --- a/configs/mx23evk_defconfig +++ b/configs/mx23evk_defconfig @@ -41,7 +41,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MXS_GPIO=y CONFIG_MMC_MXS=y CONFIG_PINCTRL=y diff --git a/configs/mx28evk_defconfig b/configs/mx28evk_defconfig index a94d34d2c4c..951d506cec2 100644 --- a/configs/mx28evk_defconfig +++ b/configs/mx28evk_defconfig @@ -47,7 +47,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_MXS_GPIO=y CONFIG_MMC_MXS=y diff --git a/configs/mx6memcal_defconfig b/configs/mx6memcal_defconfig index 0c98c685565..bfde8b0cfb3 100644 --- a/configs/mx6memcal_defconfig +++ b/configs/mx6memcal_defconfig @@ -39,7 +39,7 @@ CONFIG_CMD_MEMTEST=y CONFIG_CMD_CACHE=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y # CONFIG_MMC is not set CONFIG_FSL_USDHC=y diff --git a/configs/mx6ulz_14x14_evk_defconfig b/configs/mx6ulz_14x14_evk_defconfig index d57b47ef47a..2c13dd4dbc3 100644 --- a/configs/mx6ulz_14x14_evk_defconfig +++ b/configs/mx6ulz_14x14_evk_defconfig @@ -36,7 +36,7 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_DEV=1 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y CONFIG_DM_74X164=y CONFIG_DM_I2C=y diff --git a/configs/mx7ulp_com_defconfig b/configs/mx7ulp_com_defconfig index eba57dd5fb1..a49cb2a728f 100644 --- a/configs/mx7ulp_com_defconfig +++ b/configs/mx7ulp_com_defconfig @@ -33,7 +33,7 @@ CONFIG_CMD_FAT=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y CONFIG_IMX_RGPIO2P=y # CONFIG_MXC_GPIO is not set diff --git a/configs/mx7ulp_evk_defconfig b/configs/mx7ulp_evk_defconfig index 262ee671fa0..12f13112b63 100644 --- a/configs/mx7ulp_evk_defconfig +++ b/configs/mx7ulp_evk_defconfig @@ -33,7 +33,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y CONFIG_IMX_RGPIO2P=y # CONFIG_MXC_GPIO is not set diff --git a/configs/mx7ulp_evk_plugin_defconfig b/configs/mx7ulp_evk_plugin_defconfig index dc9fc50e150..8e05d394335 100644 --- a/configs/mx7ulp_evk_plugin_defconfig +++ b/configs/mx7ulp_evk_plugin_defconfig @@ -31,7 +31,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y CONFIG_IMX_RGPIO2P=y # CONFIG_MXC_GPIO is not set diff --git a/configs/netgear_cg3100d_ram_defconfig b/configs/netgear_cg3100d_ram_defconfig index 352b98fc0a5..377cc26f937 100644 --- a/configs/netgear_cg3100d_ram_defconfig +++ b/configs/netgear_cg3100d_ram_defconfig @@ -39,7 +39,7 @@ CONFIG_CMD_MEMINFO=y CONFIG_CMD_SPI=y # CONFIG_CMD_SLEEP is not set CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_BCM6345_GPIO=y CONFIG_LED=y diff --git a/configs/nsim_700_defconfig b/configs/nsim_700_defconfig index a46d2ee232a..d50e85a93fa 100644 --- a/configs/nsim_700_defconfig +++ b/configs/nsim_700_defconfig @@ -25,7 +25,7 @@ CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y diff --git a/configs/nsim_700be_defconfig b/configs/nsim_700be_defconfig index 8dc31819fa1..4832195f6b4 100644 --- a/configs/nsim_700be_defconfig +++ b/configs/nsim_700be_defconfig @@ -26,7 +26,7 @@ CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y diff --git a/configs/nsim_hs38be_defconfig b/configs/nsim_hs38be_defconfig index 5f21b31c84a..67de123d16b 100644 --- a/configs/nsim_hs38be_defconfig +++ b/configs/nsim_hs38be_defconfig @@ -27,7 +27,7 @@ CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y diff --git a/configs/openpiton_riscv64_defconfig b/configs/openpiton_riscv64_defconfig index a47214b0a42..1e693c621eb 100644 --- a/configs/openpiton_riscv64_defconfig +++ b/configs/openpiton_riscv64_defconfig @@ -62,7 +62,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y # CONFIG_DOS_PARTITION is not set CONFIG_OF_EMBED=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CPU=y CONFIG_MMC=y # CONFIG_MMC_WRITE is not set diff --git a/configs/openpiton_riscv64_spl_defconfig b/configs/openpiton_riscv64_spl_defconfig index d2eb891d69e..09054d93047 100644 --- a/configs/openpiton_riscv64_spl_defconfig +++ b/configs/openpiton_riscv64_spl_defconfig @@ -78,7 +78,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y # CONFIG_DOS_PARTITION is not set # CONFIG_SPL_PARTITION_UUIDS is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CPU=y CONFIG_MMC=y # CONFIG_MMC_WRITE is not set diff --git a/configs/origen_defconfig b/configs/origen_defconfig index 9fd7bc103c7..c6cc17a0e03 100644 --- a/configs/origen_defconfig +++ b/configs/origen_defconfig @@ -41,7 +41,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DFU_MMC=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x2000000 CONFIG_MMC_DW=y diff --git a/configs/pe2201_defconfig b/configs/pe2201_defconfig index c28ceac0d45..72f6274ec41 100644 --- a/configs/pe2201_defconfig +++ b/configs/pe2201_defconfig @@ -27,7 +27,7 @@ CONFIG_CMD_DM=y CONFIG_CMD_PCI=y CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SCSI_AHCI=y CONFIG_AHCI_PCI=y # CONFIG_MMC is not set diff --git a/configs/pinecube_defconfig b/configs/pinecube_defconfig index 7cc0a862949..7567a6aa739 100644 --- a/configs/pinecube_defconfig +++ b/configs/pinecube_defconfig @@ -9,7 +9,7 @@ CONFIG_DRAM_ODT_EN=y CONFIG_I2C0_ENABLE=y # CONFIG_HAS_ARMV7_SECURE_BASE is not set CONFIG_SPL_I2C=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_MVTWSI=y CONFIG_SYS_I2C_SLAVE=0x7f diff --git a/configs/pm9261_defconfig b/configs/pm9261_defconfig index 9f4d434f3e2..026c6de3109 100644 --- a/configs/pm9261_defconfig +++ b/configs/pm9261_defconfig @@ -37,7 +37,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=physmap-flash.0:256k(u-boot)ro,64k(u-boot-env) CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_FLASH=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_GPIO=y diff --git a/configs/s5p4418_nanopi2_defconfig b/configs/s5p4418_nanopi2_defconfig index 23862090df7..548963c933f 100644 --- a/configs/s5p4418_nanopi2_defconfig +++ b/configs/s5p4418_nanopi2_defconfig @@ -49,7 +49,7 @@ CONFIG_CMD_FAT=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_MMC_ENV_DEV=2 -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_NEXELL=y CONFIG_MMC_DW=y diff --git a/configs/s5p_goni_defconfig b/configs/s5p_goni_defconfig index 4316510541c..084e19e1258 100644 --- a/configs/s5p_goni_defconfig +++ b/configs/s5p_goni_defconfig @@ -44,7 +44,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DFU_MMC=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x2000000 CONFIG_DM_I2C_GPIO=y diff --git a/configs/s5pc210_universal_defconfig b/configs/s5pc210_universal_defconfig index 1607a31ce09..190ec961b97 100644 --- a/configs/s5pc210_universal_defconfig +++ b/configs/s5pc210_universal_defconfig @@ -41,7 +41,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DFU_MMC=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x2000000 CONFIG_SYS_I2C_S3C24X0=y diff --git a/configs/sama5d27_giantboard_defconfig b/configs/sama5d27_giantboard_defconfig index 4b29891d7d6..7cde865a12b 100644 --- a/configs/sama5d27_giantboard_defconfig +++ b/configs/sama5d27_giantboard_defconfig @@ -64,7 +64,7 @@ CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-parent dmas dma-names" CONFIG_ENV_IS_IN_FAT=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_CLK=y diff --git a/configs/sama5d29_curiosity_mmc1_defconfig b/configs/sama5d29_curiosity_mmc1_defconfig index 25ff38c94f3..c8976eec02d 100644 --- a/configs/sama5d29_curiosity_mmc1_defconfig +++ b/configs/sama5d29_curiosity_mmc1_defconfig @@ -72,7 +72,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA5D29" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_UTMI=y diff --git a/configs/sama5d29_curiosity_mmc_defconfig b/configs/sama5d29_curiosity_mmc_defconfig index e691839d1b9..7fe1a5b7552 100644 --- a/configs/sama5d29_curiosity_mmc_defconfig +++ b/configs/sama5d29_curiosity_mmc_defconfig @@ -71,7 +71,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA5D29" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_UTMI=y diff --git a/configs/sama5d29_curiosity_qspiflash_defconfig b/configs/sama5d29_curiosity_qspiflash_defconfig index f340423a46f..fd3551131db 100644 --- a/configs/sama5d29_curiosity_qspiflash_defconfig +++ b/configs/sama5d29_curiosity_qspiflash_defconfig @@ -71,7 +71,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA5D29" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_UTMI=y diff --git a/configs/sama7g54_curiosity_mmc_defconfig b/configs/sama7g54_curiosity_mmc_defconfig index 41c18452f9e..fec883e3c17 100644 --- a/configs/sama7g54_curiosity_mmc_defconfig +++ b/configs/sama7g54_curiosity_mmc_defconfig @@ -75,7 +75,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA7G54" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y diff --git a/configs/sama7g54_curiosity_nandflash_defconfig b/configs/sama7g54_curiosity_nandflash_defconfig index 59e8189287b..7a4cdb0d2ab 100644 --- a/configs/sama7g54_curiosity_nandflash_defconfig +++ b/configs/sama7g54_curiosity_nandflash_defconfig @@ -73,7 +73,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA7G54" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y diff --git a/configs/sama7g54_curiosity_qspiflash_defconfig b/configs/sama7g54_curiosity_qspiflash_defconfig index 20cd7143cb8..adf5f558e2e 100644 --- a/configs/sama7g54_curiosity_qspiflash_defconfig +++ b/configs/sama7g54_curiosity_qspiflash_defconfig @@ -74,7 +74,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA7G54" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y diff --git a/configs/sipeed_maix_bitm_defconfig b/configs/sipeed_maix_bitm_defconfig index 0d74d63786d..b2e21c7d7ae 100644 --- a/configs/sipeed_maix_bitm_defconfig +++ b/configs/sipeed_maix_bitm_defconfig @@ -19,7 +19,7 @@ CONFIG_BOARD_EARLY_INIT_F=y CONFIG_HUSH_PARSER=y CONFIG_MTDIDS_DEFAULT="nor0=spi3:0" CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK_K210_SET_RATE=y # CONFIG_INPUT is not set CONFIG_FS_EXT4=y diff --git a/configs/sipeed_maix_smode_defconfig b/configs/sipeed_maix_smode_defconfig index 4af6e3428ba..d838b252d53 100644 --- a/configs/sipeed_maix_smode_defconfig +++ b/configs/sipeed_maix_smode_defconfig @@ -20,7 +20,7 @@ CONFIG_SYS_PBSIZE=276 CONFIG_HUSH_PARSER=y CONFIG_MTDIDS_DEFAULT="nor0=spi3:0" CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)" -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_INPUT is not set CONFIG_FS_EXT4=y CONFIG_FS_FAT=y diff --git a/configs/stemmy_defconfig b/configs/stemmy_defconfig index 88e76087a69..631ccababf1 100644 --- a/configs/stemmy_defconfig +++ b/configs/stemmy_defconfig @@ -29,7 +29,7 @@ CONFIG_CMD_MMC=y CONFIG_CMD_PART=y CONFIG_CMD_GETTIME=y CONFIG_EFI_PARTITION=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x18100000 CONFIG_FASTBOOT_FLASH=y diff --git a/configs/stm32f429-discovery_defconfig b/configs/stm32f429-discovery_defconfig index 5199e542208..77889336147 100644 --- a/configs/stm32f429-discovery_defconfig +++ b/configs/stm32f429-discovery_defconfig @@ -27,7 +27,7 @@ CONFIG_CMD_IMLS=y CONFIG_CMD_TIMER=y CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_FLASH=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y diff --git a/configs/stm32f429-evaluation_defconfig b/configs/stm32f429-evaluation_defconfig index 412533e64f4..2fa8dc9faad 100644 --- a/configs/stm32f429-evaluation_defconfig +++ b/configs/stm32f429-evaluation_defconfig @@ -25,7 +25,7 @@ CONFIG_CMD_TIMER=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_ARM_PL180_MMCI=y CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y diff --git a/configs/stm32f469-discovery_defconfig b/configs/stm32f469-discovery_defconfig index 93420cb5bb1..98399416fa5 100644 --- a/configs/stm32f469-discovery_defconfig +++ b/configs/stm32f469-discovery_defconfig @@ -26,7 +26,7 @@ CONFIG_CMD_TIMER=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_ARM_PL180_MMCI=y CONFIG_MTD=y CONFIG_DM_MTD=y diff --git a/configs/stm32h743-disco_defconfig b/configs/stm32h743-disco_defconfig index 376edc271a1..40fc9383aee 100644 --- a/configs/stm32h743-disco_defconfig +++ b/configs/stm32h743-disco_defconfig @@ -30,6 +30,6 @@ CONFIG_CMD_EXT4_WRITE=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_STM32_SDMMC2=y # CONFIG_PINCTRL_FULL is not set diff --git a/configs/stm32h743-eval_defconfig b/configs/stm32h743-eval_defconfig index c249c4dd3d4..953e67e75bb 100644 --- a/configs/stm32h743-eval_defconfig +++ b/configs/stm32h743-eval_defconfig @@ -30,6 +30,6 @@ CONFIG_CMD_EXT4_WRITE=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_STM32_SDMMC2=y # CONFIG_PINCTRL_FULL is not set diff --git a/configs/stm32h750-art-pi_defconfig b/configs/stm32h750-art-pi_defconfig index d66f440fdb7..4ca2d30e44c 100644 --- a/configs/stm32h750-art-pi_defconfig +++ b/configs/stm32h750-art-pi_defconfig @@ -36,7 +36,7 @@ CONFIG_CMD_EXT4_WRITE=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_DMA=y CONFIG_STM32_SDMMC2=y # CONFIG_PINCTRL_FULL is not set diff --git a/configs/stm32mp25_defconfig b/configs/stm32mp25_defconfig index 85e6830d74e..d3f0c088157 100644 --- a/configs/stm32mp25_defconfig +++ b/configs/stm32mp25_defconfig @@ -32,7 +32,7 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_LOG=y CONFIG_OF_LIVE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_GPIO_HOG=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_STM32F7=y diff --git a/configs/stmark2_defconfig b/configs/stmark2_defconfig index f43a24c5b5e..79b21acd032 100644 --- a/configs/stmark2_defconfig +++ b/configs/stmark2_defconfig @@ -39,7 +39,7 @@ CONFIG_ENV_SPI_CS=1 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="stmark2" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_FSL=y CONFIG_MTD=y diff --git a/configs/th1520_lpi4a_defconfig b/configs/th1520_lpi4a_defconfig index 98bcb220392..a57cedbfd11 100644 --- a/configs/th1520_lpi4a_defconfig +++ b/configs/th1520_lpi4a_defconfig @@ -59,7 +59,7 @@ CONFIG_CMD_BOOTMENU=y CONFIG_PARTITION_TYPE_GUID=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_BLOCK_CACHE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set diff --git a/configs/thunderx_88xx_defconfig b/configs/thunderx_88xx_defconfig index 3cc04afe69b..24ad84bd114 100644 --- a/configs/thunderx_88xx_defconfig +++ b/configs/thunderx_88xx_defconfig @@ -33,7 +33,7 @@ CONFIG_SYS_PROMPT="ThunderX_88XX> " # CONFIG_CMD_SAVEENV is not set # CONFIG_CMD_ENV_EXISTS is not set CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_MMC is not set CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_SKIP_INIT=y diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig index 29554be7a65..8925e37e02a 100644 --- a/configs/tools-only_defconfig +++ b/configs/tools-only_defconfig @@ -23,7 +23,7 @@ CONFIG_CMD_EXTENSION=n CONFIG_CMD_DATE=n CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -CONFIG_NET=n +CONFIG_NO_NET=y CONFIG_ACPIGEN=n CONFIG_AXI=y CONFIG_AXI_SANDBOX=y diff --git a/configs/topic_miami_defconfig b/configs/topic_miami_defconfig index accdfe9a2ab..039ac710b38 100644 --- a/configs/topic_miami_defconfig +++ b/configs/topic_miami_defconfig @@ -52,7 +52,7 @@ CONFIG_CMD_CACHE=y CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_DFU_RAM=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x600000 diff --git a/configs/topic_miamilite_defconfig b/configs/topic_miamilite_defconfig index 1c65f6ef632..b53f3a7150e 100644 --- a/configs/topic_miamilite_defconfig +++ b/configs/topic_miamilite_defconfig @@ -52,7 +52,7 @@ CONFIG_CMD_CACHE=y CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_DFU_RAM=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x600000 diff --git a/configs/topic_miamiplus_defconfig b/configs/topic_miamiplus_defconfig index 53bf0afd4d1..ba7f248db3b 100644 --- a/configs/topic_miamiplus_defconfig +++ b/configs/topic_miamiplus_defconfig @@ -52,7 +52,7 @@ CONFIG_CMD_CACHE=y CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_DFU_RAM=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x600000 diff --git a/configs/total_compute_defconfig b/configs/total_compute_defconfig index 5f21d2e367a..b3d2e5c88a6 100644 --- a/configs/total_compute_defconfig +++ b/configs/total_compute_defconfig @@ -43,7 +43,7 @@ CONFIG_CMD_AVB=y CONFIG_CMD_UBI=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y # CONFIG_MMC_WRITE is not set CONFIG_ARM_PL180_MMCI=y diff --git a/configs/trats2_defconfig b/configs/trats2_defconfig index 3796aed1a93..f4afd373653 100644 --- a/configs/trats2_defconfig +++ b/configs/trats2_defconfig @@ -43,7 +43,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DFU_MMC=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x2000000 CONFIG_DM_I2C_GPIO=y diff --git a/configs/trats_defconfig b/configs/trats_defconfig index 91ad6b52297..14849d0e691 100644 --- a/configs/trats_defconfig +++ b/configs/trats_defconfig @@ -42,7 +42,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DFU_MMC=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x2000000 CONFIG_DM_I2C_GPIO=y diff --git a/configs/xenguest_arm64_defconfig b/configs/xenguest_arm64_defconfig index 64e8eb2d81f..e9a5219a7c4 100644 --- a/configs/xenguest_arm64_defconfig +++ b/configs/xenguest_arm64_defconfig @@ -37,7 +37,7 @@ CONFIG_CMD_PVBLOCK=y # CONFIG_CMD_SLEEP is not set CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_MMC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_DM_SERIAL=y diff --git a/configs/xenguest_arm64_virtio_defconfig b/configs/xenguest_arm64_virtio_defconfig index b5e9b390683..acf131fc837 100644 --- a/configs/xenguest_arm64_virtio_defconfig +++ b/configs/xenguest_arm64_virtio_defconfig @@ -42,7 +42,7 @@ CONFIG_CMD_PCI=y CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y CONFIG_PARTITION_TYPE_GUID=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_MMC is not set CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_REGION_MULTI_ENTRY=y diff --git a/configs/xilinx_versal_mini_defconfig b/configs/xilinx_versal_mini_defconfig index 229a38dc134..7388a787386 100644 --- a/configs/xilinx_versal_mini_defconfig +++ b/configs/xilinx_versal_mini_defconfig @@ -58,7 +58,7 @@ CONFIG_SYS_ALT_MEMTEST=y # CONFIG_CMD_SETEXPR is not set # CONFIG_CMD_SLEEP is not set CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_MMC is not set CONFIG_ARM_DCC=y diff --git a/configs/xilinx_versal_mini_emmc0_defconfig b/configs/xilinx_versal_mini_emmc0_defconfig index 8cd24f4ef81..a36e40dfbb3 100644 --- a/configs/xilinx_versal_mini_emmc0_defconfig +++ b/configs/xilinx_versal_mini_emmc0_defconfig @@ -56,7 +56,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ZYNQ=y diff --git a/configs/xilinx_versal_mini_emmc1_defconfig b/configs/xilinx_versal_mini_emmc1_defconfig index e868d476db5..3ae2115212a 100644 --- a/configs/xilinx_versal_mini_emmc1_defconfig +++ b/configs/xilinx_versal_mini_emmc1_defconfig @@ -56,7 +56,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ZYNQ=y diff --git a/configs/xilinx_versal_mini_ospi_defconfig b/configs/xilinx_versal_mini_ospi_defconfig index eecbc12f809..d0ea2b6aebd 100644 --- a/configs/xilinx_versal_mini_ospi_defconfig +++ b/configs/xilinx_versal_mini_ospi_defconfig @@ -52,7 +52,7 @@ CONFIG_SYS_PROMPT="Versal> " # CONFIG_CMD_ITEST is not set # CONFIG_CMD_SOURCE is not set # CONFIG_CMD_SETEXPR is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_MMC is not set CONFIG_MTD=y diff --git a/configs/xilinx_versal_mini_qspi_defconfig b/configs/xilinx_versal_mini_qspi_defconfig index 3c0adcde34e..ef6eec075d0 100644 --- a/configs/xilinx_versal_mini_qspi_defconfig +++ b/configs/xilinx_versal_mini_qspi_defconfig @@ -54,7 +54,7 @@ CONFIG_SYS_PROMPT="Versal> " # CONFIG_CMD_SOURCE is not set # CONFIG_CMD_SETEXPR is not set # CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set diff --git a/configs/xilinx_versal_net_mini_defconfig b/configs/xilinx_versal_net_mini_defconfig index ba656c9441f..1640dfaff9e 100644 --- a/configs/xilinx_versal_net_mini_defconfig +++ b/configs/xilinx_versal_net_mini_defconfig @@ -62,7 +62,7 @@ CONFIG_CMD_CACHE=y # CONFIG_CMD_SLEEP is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set diff --git a/configs/xilinx_versal_net_mini_emmc_defconfig b/configs/xilinx_versal_net_mini_emmc_defconfig index 61b0b2a1c97..4c6159a4df1 100644 --- a/configs/xilinx_versal_net_mini_emmc_defconfig +++ b/configs/xilinx_versal_net_mini_emmc_defconfig @@ -51,7 +51,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_MMC_HS200_SUPPORT=y CONFIG_MMC_SDHCI=y diff --git a/configs/xilinx_versal_net_mini_ospi_defconfig b/configs/xilinx_versal_net_mini_ospi_defconfig index 6dc82bc0d96..071eeb8197b 100644 --- a/configs/xilinx_versal_net_mini_ospi_defconfig +++ b/configs/xilinx_versal_net_mini_ospi_defconfig @@ -51,7 +51,7 @@ CONFIG_SYS_PROMPT="Versal NET> " # CONFIG_CMD_ITEST is not set # CONFIG_CMD_SOURCE is not set # CONFIG_CMD_SETEXPR is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_MMC is not set CONFIG_MTD=y diff --git a/configs/xilinx_versal_net_mini_qspi_defconfig b/configs/xilinx_versal_net_mini_qspi_defconfig index 8d05d99a627..227c45df28c 100644 --- a/configs/xilinx_versal_net_mini_qspi_defconfig +++ b/configs/xilinx_versal_net_mini_qspi_defconfig @@ -53,7 +53,7 @@ CONFIG_SYS_PROMPT="Versal NET> " # CONFIG_CMD_SOURCE is not set # CONFIG_CMD_SETEXPR is not set # CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set diff --git a/configs/xilinx_zynqmp_mini_defconfig b/configs/xilinx_zynqmp_mini_defconfig index 1e76692e4da..7aab69c9e46 100644 --- a/configs/xilinx_zynqmp_mini_defconfig +++ b/configs/xilinx_zynqmp_mini_defconfig @@ -54,7 +54,7 @@ CONFIG_CMD_CACHE=y # CONFIG_CMD_SLEEP is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_DM_MAILBOX is not set # CONFIG_MMC is not set diff --git a/configs/xilinx_zynqmp_mini_emmc0_defconfig b/configs/xilinx_zynqmp_mini_emmc0_defconfig index 391b6f4207c..c56b1e830d6 100644 --- a/configs/xilinx_zynqmp_mini_emmc0_defconfig +++ b/configs/xilinx_zynqmp_mini_emmc0_defconfig @@ -65,7 +65,7 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_SPL_OF_CONTROL=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_DM_MAILBOX is not set diff --git a/configs/xilinx_zynqmp_mini_emmc1_defconfig b/configs/xilinx_zynqmp_mini_emmc1_defconfig index 132210bee62..a8dbf0056da 100644 --- a/configs/xilinx_zynqmp_mini_emmc1_defconfig +++ b/configs/xilinx_zynqmp_mini_emmc1_defconfig @@ -65,7 +65,7 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_SPL_OF_CONTROL=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_DM_MAILBOX is not set diff --git a/configs/xilinx_zynqmp_mini_nand_defconfig b/configs/xilinx_zynqmp_mini_nand_defconfig index 1de6b00923d..ba8f02c5b11 100644 --- a/configs/xilinx_zynqmp_mini_nand_defconfig +++ b/configs/xilinx_zynqmp_mini_nand_defconfig @@ -49,7 +49,7 @@ CONFIG_CLOCKS=y # CONFIG_CMD_SETEXPR is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_DM_MAILBOX is not set # CONFIG_MMC is not set diff --git a/configs/xilinx_zynqmp_mini_nand_single_defconfig b/configs/xilinx_zynqmp_mini_nand_single_defconfig index 8c67786f68d..a8a0055f2e5 100644 --- a/configs/xilinx_zynqmp_mini_nand_single_defconfig +++ b/configs/xilinx_zynqmp_mini_nand_single_defconfig @@ -49,7 +49,7 @@ CONFIG_CLOCKS=y # CONFIG_CMD_SETEXPR is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_DM_MAILBOX is not set # CONFIG_MMC is not set diff --git a/configs/xilinx_zynqmp_mini_qspi_defconfig b/configs/xilinx_zynqmp_mini_qspi_defconfig index 1a2dafe4738..c08b10c6944 100644 --- a/configs/xilinx_zynqmp_mini_qspi_defconfig +++ b/configs/xilinx_zynqmp_mini_qspi_defconfig @@ -68,7 +68,7 @@ CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000 CONFIG_SPL_OF_CONTROL=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_FIRMWARE is not set diff --git a/configs/zynq_cse_nand_defconfig b/configs/zynq_cse_nand_defconfig index d95e69712b0..80852f3507d 100644 --- a/configs/zynq_cse_nand_defconfig +++ b/configs/zynq_cse_nand_defconfig @@ -70,7 +70,7 @@ CONFIG_SYS_MAXARGS=32 CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_MMC is not set diff --git a/configs/zynq_cse_nor_defconfig b/configs/zynq_cse_nor_defconfig index fbec4a6ab25..326e4e3f7d1 100644 --- a/configs/zynq_cse_nor_defconfig +++ b/configs/zynq_cse_nor_defconfig @@ -70,7 +70,7 @@ CONFIG_SYS_MAXARGS=32 CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_MMC is not set diff --git a/configs/zynq_cse_qspi_defconfig b/configs/zynq_cse_qspi_defconfig index 53c7edf8bb7..cd84df1e290 100644 --- a/configs/zynq_cse_qspi_defconfig +++ b/configs/zynq_cse_qspi_defconfig @@ -79,7 +79,7 @@ CONFIG_SYS_MAXARGS=32 CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_MMC is not set diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig index aadd7e8cf7f..604386bb734 100644 --- a/drivers/dfu/Kconfig +++ b/drivers/dfu/Kconfig @@ -20,6 +20,7 @@ config DFU_WRITE_ALT config DFU_TFTP bool "DFU via TFTP" depends on NETDEVICES + depends on !NET_LWIP select UPDATE_COMMON select DFU_OVER_TFTP help diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index 70207573de2..1eb460f5a02 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -1,5 +1,6 @@ menu "Fastboot support" depends on CMDLINE + depends on !NET_LWIP config FASTBOOT bool diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 88ef674cd73..fa6fc1cb8e4 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -48,6 +48,7 @@ config DM_DSA bool "Enable Driver Model for DSA switches" depends on DM_MDIO depends on PHY_FIXED + depends on !NET_LWIP help Enable driver model for DSA switches @@ -342,6 +343,7 @@ config ESSEDMA config ETH_SANDBOX depends on SANDBOX + depends on NET default y bool "Sandbox: Mocked Ethernet driver" help @@ -363,6 +365,7 @@ config ETH_SANDBOX_LWIP config ETH_SANDBOX_RAW depends on SANDBOX + depends on NET default y bool "Sandbox: Bridge to Linux Raw Sockets" help diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index a9efc509814..13e73810ad6 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 1694ad03183..010084ef7f3 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -233,7 +233,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/Kconfig b/net/Kconfig index 7cb80b880a9..16a9de47e94 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 @@ -26,15 +21,6 @@ config PROT_UDP Enable a generic udp framework that allows defining a custom handler for udp protocol. -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 operationg system over the network, using the PXE (Preboot - Execution Environment) protocol. - config BOOTP_SEND_HOSTNAME bool "Send hostname to DNS server" help @@ -45,15 +31,6 @@ config BOOTP_SEND_HOSTNAME of the "hostname" environment variable is passed as option 12 to the DHCP server. -config NET_RANDOM_ETHADDR - bool "Random ethaddr if unset" - help - Selecting this will allow the Ethernet interface to function even - when the ethaddr variable for that interface is unset. In this case, - a random MAC address in the locally administered address space is - generated. It will be saved to the appropriate environment variable, - too. - config NETCONSOLE bool "NetConsole support" help @@ -255,11 +232,35 @@ config IPV6 endif # if NET +source "net/lwip/Kconfig" + +if NET || NET_LWIP + +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. + +config NET_RANDOM_ETHADDR + bool "Random ethaddr if unset" + help + Selecting this will allow the Ethernet interface to function even + when the ethaddr variable for that interface is unset. In this case, + a random MAC address in the locally administered address space is + generated. It will be saved to the appropriate environment variable, + too. + +endif # if NET || NET_LWIP + 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. + 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. diff --git a/net/Makefile b/net/Makefile index a7075c36a04..33c82b5d229 100644 --- a/net/Makefile +++ b/net/Makefile @@ -5,6 +5,8 @@ #ccflags-y += -DDEBUG +ifeq ($(CONFIG_NET),y) + obj-$(CONFIG_NET) += arp.o obj-$(CONFIG_CMD_BOOTP) += bootp.o obj-$(CONFIG_CMD_CDP) += cdp.o @@ -38,3 +40,5 @@ obj-$(CONFIG_CMD_WGET) += wget.o # sprintf(buf, index ? "foo%d" : "foo", index) # and this is intentional usage. CFLAGS_eth_common.o += -Wno-format-extra-args + +endif diff --git a/net/lwip/Kconfig b/net/lwip/Kconfig new file mode 100644 index 00000000000..8a67de4cf33 --- /dev/null +++ b/net/lwip/Kconfig @@ -0,0 +1,49 @@ +# +# Network configuration (with lwIP stack) +# + +if NET_LWIP + +config LWIP_DEBUG + bool "Enable debug traces in the lwIP library" + +config LWIP_ASSERT + bool "Enable assertions in the lwIP library" + +config PROT_DHCP_LWIP + bool + select PROT_UDP_LWIP + +config PROT_DNS_LWIP + bool + select PROT_UDP_LWIP + +config PROT_RAW_LWIP + bool + +config PROT_TCP_LWIP + bool + +config PROT_TCP_SACK_LWIP + bool "TCP SACK support" + depends on PROT_TCP_LWIP + default y + help + TCP protocol with selective acknowledgements. Improves + file transfer speed in wget. + +config PROT_UDP_LWIP + bool + +config LWIP_TCP_WND + int "Value of TCP_WND" + default 8000 if ARCH_QEMU + default 3000000 + help + Default value for TCP_WND in the lwIP configuration + Lower values result in slower wget transfer speeds in + general, especially when the latency on the network is high, + but QEMU with "-net user" needs no more than a few KB or the + transfer will stall and eventually time out. + +endif # NET_LWIP diff --git a/test/cmd/Makefile b/test/cmd/Makefile index 8f2134998ad..dbee9b26405 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -30,7 +30,9 @@ ifdef CONFIG_SANDBOX obj-$(CONFIG_CMD_MBR) += mbr.o obj-$(CONFIG_CMD_READ) += rw.o obj-$(CONFIG_CMD_SETEXPR) += setexpr.o +ifdef CONFIG_NET obj-$(CONFIG_CMD_WGET) += wget.o +endif obj-$(CONFIG_ARM_FFA_TRANSPORT) += armffa.o endif obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o diff --git a/test/dm/Makefile b/test/dm/Makefile index 6c9ebb8d07c..bcb52ef1067 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -48,7 +48,9 @@ obj-$(CONFIG_VIDEO_MIPI_DSI) += dsi_host.o obj-$(CONFIG_DM_DSA) += dsa.o obj-$(CONFIG_ECDSA_VERIFY) += ecdsa.o obj-$(CONFIG_EFI_MEDIA_SANDBOX) += efi_media.o +ifdef CONFIG_NET obj-$(CONFIG_DM_ETH) += eth.o +endif obj-$(CONFIG_EXTCON) += extcon.o ifneq ($(CONFIG_EFI_PARTITION),) obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o From patchwork Wed Oct 16 10:04: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: 835793 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346206wru; Wed, 16 Oct 2024 03:04:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVZUq/CIe3zV5NY/6RMq7g6I071iJeL6RIjXSDVe+OEBD1kkwai2XxYirC7VedNWdNxdzBZcg==@linaro.org X-Google-Smtp-Source: AGHT+IHZ5R8aXrkIdxQO3xvKZy9fvL3+snB+sPVb98k/10FIl6FQmzR1dX5EnYv0yoNW+L/6Jjz2 X-Received: by 2002:a05:6e02:17ce:b0:3a2:6cd7:3250 with SMTP id e9e14a558f8ab-3a3dc4a6e0cmr34030745ab.10.1729073094278; Wed, 16 Oct 2024 03:04:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073094; cv=none; d=google.com; s=arc-20240605; b=ArpD1Zq18GU+kWyaS2c43gDF8+Tm0ryKxthrxV4T2LEtOwWtlQGZPSyuVG1/95glGK HsOQFPqAnny5bd/trnGUmP8vgCVXpMR1qXH2/GV37mfX8ZToPacD/I5rDQoO3ws7n/yn SHBstXMuVkU9V9kVsJK5IgF1P9uq96SVjKJVC7g2S1in4wjrt3PAqYqDbuaBZiGyVCr3 cEE4WwXrf8hH4KhYv+7sCDnuZ64QmfZ4M7m5yigfnW6/7Ez1IspjxI711XAGAagHMwhP d27Iey84e+H6Pz/aFWDRSIeOkST2XgoWXAEKznKuujMZk9davKbQWXga3v6Xq1LAVGaW ukzg== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZIhTvycSGpE4u6G0iQcauUoac2qyrEImhAn5uGzZFMA=; fh=wJRUvuTL/eOsbF0Jk1cgNVXxIuGVjJpKaSATlcGPx00=; b=ExthgbE5rauwN6azubrtZNJpelJxnWyf6EK21Sd4NWwhtpJ47Pyw3TuJlg6BckpWek u+nEdZrZxXia+E26jdfsddcz09Lvk5ac5HRiBTaQIL/bTdPd96ji/Dn0MO74YJB+Stfu eQnL010zyQ5qktywvJvBwhWicnd/jJsI3dhbzW83VSEG87PjVBJMReX59LrlfA+w4U4C 2OBBEFBdQy7wRDQLbvBDWhmt+7yaPfC/F60IrNzmwSqlbro9syY6uQ5jDnK9DzQHwMs7 FBgHGXozf6xprwNFBPz5lpHYHf/GRkZwjZ+lkN4MUeeKxLAP8E/9+S5xyRzDG20Ubnyy dzvg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=guRE3pUk; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id e9e14a558f8ab-3a3d71d3deesi16895985ab.170.2024.10.16.03.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:04:54 -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=guRE3pUk; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 372E988FC8; Wed, 16 Oct 2024 12:04:52 +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="guRE3pUk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BC02288FAF; Wed, 16 Oct 2024 12:04:50 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (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 9901B88FCC for ; Wed, 16 Oct 2024 12:04:45 +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-x32e.google.com with SMTP id 5b1f17b1804b1-4305413aec9so61566505e9.2 for ; Wed, 16 Oct 2024 03:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073085; x=1729677885; 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=ZIhTvycSGpE4u6G0iQcauUoac2qyrEImhAn5uGzZFMA=; b=guRE3pUkAprRGyHxyMqoI3ZvUprovTb6Nn/pFwVPGZpRSCn8BjkS2pBuZ52+paQ4Pz QdE46AbEjHfjPpQzQlZDEimklFB/ssepPBq7vNYDobZkQALreoDx81NKp60DUH3rXz/3 Sb6wDkFaJSXR3O3OY5Dfw2svwWMFsPjv7xnNJcdLlK7QWLxG8M+URnp2J3bDQ6dWuu11 bDtfkvD888ErmqHh2SjmiE93FIWGrW7n6B5iXmHuwREbcYZIlJDKWDi4toJCrbIThIDk 3qb9NaqRdAbpScFaqeCwnQQhb0WJP+rgwk+pOIGV5Qt9PfZYUxXQAm5wlwwmFQfxIFVc QDrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073085; x=1729677885; 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=ZIhTvycSGpE4u6G0iQcauUoac2qyrEImhAn5uGzZFMA=; b=fdvGp9FdSSkv1XKyq42Y6jp2gtGGjoGC1gYuNVQecZj9NfnvaYotq08VMSawB/t10e 3TagEu9zvLQ3GYhJfJlj2s3L0eahuZkC8yWxBAyrAnM51seskg06jfhvx+cDbYAvyRIJ jQsPjx0KiAXI6Xa8EP30Il69cLLd2DcwVG/S1fOUXK6qkYOhQcAjuOjmoRmrgiTesoPy ORYkJ52l+x95yVj5PxpGDyPUM+G0K2y9bISZM6don+NHDdI5HnoCjJ4+EIwsB0vGKL7w n39m1B8W2Zm5ERGF19vfpyP0rEYFj2FaVlyd3zYLOePKwjyj6tGok4FwhEv8UEImsgde fUWg== X-Gm-Message-State: AOJu0YyCMK2NPHpBiiHK5iIkoKZpvn4yhPwyE0XLv5rMcRAJvS+C+Lf/ M77NEJrKb0c3+Pqxx+6sgqmUf2jzACfSqOMyjGTXfcjSo/trHDZ9KqS+vwDeI/+qaXpxs3BiQjo ksMhWb1bx X-Received: by 2002:a05:600c:45ca:b0:42c:b905:2bf9 with SMTP id 5b1f17b1804b1-4314a31af18mr31003035e9.16.1729073083431; Wed, 16 Oct 2024 03:04:43 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:04:43 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Joe Hershberger , Ramon Fried , Simon Glass , Heinrich Schuchardt , Marek Vasut , Bryan Brattlof , "Leon M. Busch-George" , Masahisa Kojima , Sean Anderson , Christian Marangi Subject: [PATCH v13 06/21] net: split net into net{,-common,-legacy,-lwip} Date: Wed, 16 Oct 2024 12:04:00 +0200 Message-Id: <08336130c275d1f510336a2c7f9b69a50f44567c.1729070678.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 Make net.h a wrapper which includes net-common.h and either net-legacy.h or net-lwip.h based on NET_LWIP. The function copy_filename() can be useful when NET_LWIP is enabled, therefore move it out of net/net.c which is built only when networking choice is NET and create a new file net/net-common.c. Signed-off-by: Jerome Forissier Acked-by: Ilias Apalodimas --- Makefile | 4 +- include/net-common.h | 501 +++++++++++++++++++++++ include/net-legacy.h | 544 +++++++++++++++++++++++++ include/net-lwip.h | 14 + include/net.h | 943 +------------------------------------------ net/Makefile | 2 + net/net-common.c | 13 + net/net.c | 12 - 8 files changed, 1081 insertions(+), 952 deletions(-) create mode 100644 include/net-common.h create mode 100644 include/net-legacy.h create mode 100644 include/net-lwip.h create mode 100644 net/net-common.c diff --git a/Makefile b/Makefile index f203a4f59e0..a2e9435c4f8 100644 --- a/Makefile +++ b/Makefile @@ -842,7 +842,9 @@ UBOOTINCLUDE := \ -I$(srctree)/arch/arm/thumb1/include)) \ -I$(srctree)/arch/$(ARCH)/include \ -include $(srctree)/include/linux/kconfig.h \ - -I$(srctree)/dts/upstream/include + -I$(srctree)/dts/upstream/include \ + $(if $(CONFIG_NET_LWIP), -I$(srctree)/lib/lwip/lwip/src/include \ + -I$(srctree)/lib/lwip/u-boot) NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) diff --git a/include/net-common.h b/include/net-common.h new file mode 100644 index 00000000000..543f528a4a4 --- /dev/null +++ b/include/net-common.h @@ -0,0 +1,501 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __NET_COMMON_H__ +#define __NET_COMMON_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG_NET_PKT_TRACE 0 /* Trace all packet data */ + +/* + * 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 + +/* IPv4 addresses are always 32 bits in size */ +struct in_addr { + __be32 s_addr; +}; + +#define PROT_IP 0x0800 /* IP protocol */ +#define PROT_ARP 0x0806 /* IP ARP protocol */ +#define PROT_WOL 0x0842 /* ether-wake WoL protocol */ +#define PROT_RARP 0x8035 /* IP ARP protocol */ +#define PROT_VLAN 0x8100 /* IEEE 802.1q protocol */ +#define PROT_IPV6 0x86dd /* IPv6 over bluebook */ +#define PROT_PPP_SES 0x8864 /* PPPoE session messages */ +#define PROT_NCSI 0x88f8 /* NC-SI control packets */ + +#define IPPROTO_ICMP 1 /* Internet Control Message Protocol */ +#define IPPROTO_TCP 6 /* Transmission Control Protocol */ +#define IPPROTO_UDP 17 /* User Datagram Protocol */ + +#define IP_OFFS 0x1fff /* ip offset *= 8 */ +#define IP_FLAGS 0xe000 /* first 3 bits */ +#define IP_FLAGS_RES 0x8000 /* reserved */ +#define IP_FLAGS_DFRAG 0x4000 /* don't fragments */ +#define IP_FLAGS_MFRAG 0x2000 /* more fragments */ + +#define IP_HDR_SIZE (sizeof(struct ip_hdr)) + +#define IP_MIN_FRAG_DATAGRAM_SIZE (IP_HDR_SIZE + 8) + +/* + * Internet Protocol (IP) + UDP header. + */ +struct ip_udp_hdr { + u8 ip_hl_v; /* header length and version */ + u8 ip_tos; /* type of service */ + u16 ip_len; /* total length */ + u16 ip_id; /* identification */ + u16 ip_off; /* fragment offset field */ + u8 ip_ttl; /* time to live */ + u8 ip_p; /* protocol */ + u16 ip_sum; /* checksum */ + struct in_addr ip_src; /* Source IP address */ + struct in_addr ip_dst; /* Destination IP address */ + u16 udp_src; /* UDP source port */ + u16 udp_dst; /* UDP destination port */ + u16 udp_len; /* Length of UDP packet */ + u16 udp_xsum; /* Checksum */ +} __attribute__((packed)); + +#define IP_UDP_HDR_SIZE (sizeof(struct ip_udp_hdr)) +#define UDP_HDR_SIZE (IP_UDP_HDR_SIZE - IP_HDR_SIZE) + +/* Number of packets processed together */ +#define ETH_PACKETS_BATCH_RECV 32 + +/* ARP hardware address length */ +#define ARP_HLEN 6 +/* + * The size of a MAC address in string form, each digit requires two chars + * and five separator characters to form '00:00:00:00:00:00'. + */ +#define ARP_HLEN_ASCII (ARP_HLEN * 2) + (ARP_HLEN - 1) + +#define ARP_HDR_SIZE (8+20) /* Size assuming ethernet */ + +# define ARP_ETHER 1 /* Ethernet hardware address */ + +/* + * 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 + +/* + * Maximum receive ring size; that is, the number of packets + * we can buffer before overflow happens. Basically, this just + * needs to be enough to prevent a packet being discarded while + * we are processing the previous one. + * Used only in drivers/net/mvgbe.c. + */ +#define RINGSZ 4 +#define RINGSZ_LOG2 2 + +extern int net_restart_wrap; /* Tried all network devices */ +extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */ +extern const u8 net_bcast_ethaddr[ARP_HLEN]; /* Ethernet broadcast address */ +extern char net_boot_file_name[1024];/* Boot File name */ + +/** + * compute_ip_checksum() - Compute IP checksum + * + * @addr: Address to check (must be 16-bit aligned) + * @nbytes: Number of bytes to check (normally a multiple of 2) + * Return: 16-bit IP checksum + */ +unsigned compute_ip_checksum(const void *addr, unsigned nbytes); + +/** + * ip_checksum_ok() - check if a checksum is correct + * + * This works by making sure the checksum sums to 0 + * + * @addr: Address to check (must be 16-bit aligned) + * @nbytes: Number of bytes to check (normally a multiple of 2) + * Return: true if the checksum matches, false if not + */ +int ip_checksum_ok(const void *addr, unsigned nbytes); + +/** + * add_ip_checksums() - add two IP checksums + * + * @offset: Offset of first sum (if odd we do a byte-swap) + * @sum: First checksum + * @new_sum: New checksum to add + * Return: updated 16-bit IP checksum + */ +unsigned add_ip_checksums(unsigned offset, unsigned sum, unsigned new_sum); + +/* + * The devname can be either an exact name given by the driver or device tree + * or it can be an alias of the form "eth%d" + */ +struct udevice *eth_get_dev_by_name(const char *devname); +int eth_is_active(struct udevice *dev); /* Test device for active state */ + +/* + * 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); + +/** + * 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); + +/* + * Initialize USB ethernet device with CONFIG_DM_ETH + * Returns: + * 0 is success, non-zero is error status. + */ +int usb_ether_init(void); + +int eth_init(void); /* Initialize the device */ +int eth_send(void *packet, int length); /* Send a packet */ +#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER) +int eth_receive(void *packet, int length); /* Receive a packet*/ +extern void (*push_packet)(void *packet, int length); +#endif +int eth_rx(void); /* Check for received packets */ + +/** + * reset_phy() - Reset the Ethernet PHY + * + * This should be implemented by boards if CONFIG_RESET_PHY_R is enabled + */ +void reset_phy(void); + +#if CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP) +/** + * eth_set_enable_bootdevs() - Enable or disable binding of Ethernet bootdevs + * + * These get in the way of bootstd testing, so are normally disabled by tests. + * This provide control of this setting. It only affects binding of Ethernet + * devices, so if that has already happened, this flag does nothing. + * + * @enable: true to enable binding of bootdevs when binding new Ethernet + * devices, false to disable it + */ +void eth_set_enable_bootdevs(bool enable); +#else +static inline void eth_set_enable_bootdevs(bool enable) {} +#endif + +static inline void net_send_packet(uchar *pkt, int len) +{ + if (DEBUG_NET_PKT_TRACE) + print_hex_dump_bytes("tx: ", DUMP_PREFIX_OFFSET, pkt, len); + /* Currently no way to return errors from eth_send() */ + (void) eth_send(pkt, len); +} + +enum eth_recv_flags { + /* + * Check hardware device for new packets (otherwise only return those + * which are already in the memory buffer ready to process) + */ + ETH_RECV_CHECK_DEVICE = 1 << 0, +}; + +/** + * 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 */ +unsigned char *eth_get_ethaddr(void); /* get the current device MAC */ +int eth_rx(void); /* Check for received packets */ +void eth_halt(void); /* stop SCC */ +const char *eth_get_name(void); /* get name of current device */ +int eth_get_dev_index(void); + +int eth_initialize(void); /* Initialize network subsystem */ +void eth_try_another(int first_restart); /* Change the device */ +void eth_set_current(void); /* set nterface to ethcur var */ + +enum eth_state_t { + ETH_STATE_INIT, + ETH_STATE_PASSIVE, + ETH_STATE_ACTIVE +}; + +/** + * struct eth_pdata - Platform data for Ethernet MAC controllers + * + * @iobase: The base address of the hardware registers + * @enetaddr: The Ethernet MAC address that is loaded from EEPROM or env + * @phy_interface: PHY interface to use - see PHY_INTERFACE_MODE_... + * @max_speed: Maximum speed of Ethernet connection supported by MAC + * @priv_pdata: device specific plat + */ +struct eth_pdata { + phys_addr_t iobase; + unsigned char enetaddr[ARP_HLEN]; + int phy_interface; + int max_speed; + void *priv_pdata; +}; + +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)) + +/** + * net_random_ethaddr - Generate software assigned random Ethernet address + * @addr: Pointer to a six-byte array containing the Ethernet address + * + * Generate a random Ethernet address (MAC) that is not multicast + * and has the local assigned bit set. + */ +static inline void net_random_ethaddr(uchar *addr) +{ + int i; + unsigned int seed = get_ticks(); + + for (i = 0; i < 6; i++) + addr[i] = rand_r(&seed); + + addr[0] &= 0xfe; /* clear multicast bit */ + addr[0] |= 0x02; /* set local assignment bit (IEEE802) */ +} + +/** + * is_zero_ethaddr - Determine if give Ethernet address is all zeros. + * @addr: Pointer to a six-byte array containing the Ethernet address + * + * Return true if the address is all zeroes. + */ +static inline int is_zero_ethaddr(const u8 *addr) +{ + return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); +} + +/** + * is_multicast_ethaddr - Determine if the Ethernet address is a multicast. + * @addr: Pointer to a six-byte array containing the Ethernet address + * + * Return true if the address is a multicast address. + * By definition the broadcast address is also a multicast address. + */ +static inline int is_multicast_ethaddr(const u8 *addr) +{ + return 0x01 & addr[0]; +} + +/* + * is_broadcast_ethaddr - Determine if the Ethernet address is broadcast + * @addr: Pointer to a six-byte array containing the Ethernet address + * + * Return true if the address is the broadcast address. + */ +static inline int is_broadcast_ethaddr(const u8 *addr) +{ + return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == + 0xff; +} + +/* + * is_valid_ethaddr - Determine if the given Ethernet address is valid + * @addr: Pointer to a six-byte array containing the Ethernet address + * + * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not + * a multicast address, and is not FF:FF:FF:FF:FF:FF. + * + * Return true if the address is valid. + */ +static inline int is_valid_ethaddr(const u8 *addr) +{ + /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to + * explicitly check for it here. */ + return !is_multicast_ethaddr(addr) && !is_zero_ethaddr(addr); +} + +/** + * 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); + +/** + * string_to_ip() - Convert a string to ip address + * + * Implemented in lib/net_utils.c (built unconditionally) + * + * @s: Input string to parse + * @return: in_addr struct containing the parsed IP address + */ +struct in_addr string_to_ip(const char *s); + +/* copy a filename (allow for "..." notation, limit length) */ +void copy_filename(char *dst, const char *src, int size); + +/* Processes a received packet */ +void net_process_received_packet(uchar *in_packet, int len); + +/** + * update_tftp - Update firmware over TFTP (via DFU) + * + * This function updates board's firmware via TFTP + * + * @param addr - memory address where data is stored + * @param interface - the DFU medium name - e.g. "mmc" + * @param devstring - the DFU medium number - e.g. "1" + * + * Return: - 0 on success, other value on failure + */ +int update_tftp(ulong addr, char *interface, char *devstring); + +/** + * env_get_ip() - Convert an environment value to to an ip address + * + * @var: Environment variable to convert. The value of this variable must be + * in the format format a.b.c.d, where each value is a decimal number from + * 0 to 255 + * Return: IP address, or 0 if invalid + */ +static inline struct in_addr env_get_ip(char *var) +{ + return string_to_ip(env_get(var)); +} + +int net_init(void); + +/** + * dhcp_run() - Run DHCP on the current ethernet device + * + * This sets the autoload variable, then puts it back to similar to its original + * state (y, n or unset). + * + * @addr: Address to load the file into (0 if @autoload is false) + * @fname: Filename of file to load (NULL if @autoload is false or to use the + * default filename) + * @autoload: true to load the file, false to just get the network IP + * @return 0 if OK, -EINVAL if the environment failed, -ENOENT if ant file was + * not found + */ +int dhcp_run(ulong addr, const char *fname, bool autoload); + +/** + * do_tftpb - Run the tftpboot command + * + * @cmdtp: Command information for tftpboot + * @flag: Command flags (CMD_FLAG_...) + * @argc: Number of arguments + * @argv: List of arguments + * Return: result (see enum command_ret_t) + */ +int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); + +/** + * wget_with_dns() - runs dns host IP address resulution before wget + * + * @dst_addr: destination address to download the file + * @uri: uri string of target file of wget + * Return: downloaded file size, negative if failed + */ +int wget_with_dns(ulong dst_addr, char *uri); +/** + * wget_validate_uri() - varidate the uri + * + * @uri: uri string of target file of wget + * Return: true if uri is valid, false if uri is invalid + */ +bool wget_validate_uri(char *uri); +//int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]); + +#endif /* __NET_COMMON_H__ */ diff --git a/include/net-legacy.h b/include/net-legacy.h new file mode 100644 index 00000000000..ed286e3d326 --- /dev/null +++ b/include/net-legacy.h @@ -0,0 +1,544 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * LiMon Monitor (LiMon) - Network. + * + * Copyright 1994 - 2000 Neil Russell. + * (See License) + * + * History + * 9/16/00 bor adapted to TQM823L/STK8xxL board, RARP/TFTP boot added + */ + +#ifndef __NET_LEGACY_H__ +#define __NET_LEGACY_H__ + +#include +#include /* for nton* / ntoh* stuff */ +#include +#include +#include + +struct bd_info; +struct cmd_tbl; +struct udevice; + +#define DEBUG_LL_STATE 0 /* Link local state machine changes */ +#define DEBUG_DEV_PKT 0 /* Packets or info directed to the device */ +#define DEBUG_NET_PKT 0 /* Packets on info on the network at large */ +#define DEBUG_INT_STATE 0 /* Internal network state changes */ + +/* ARP hardware address length */ +#define ARP_HLEN 6 +/* + * The size of a MAC address in string form, each digit requires two chars + * and five separator characters to form '00:00:00:00:00:00'. + */ +#define ARP_HLEN_ASCII (ARP_HLEN * 2) + (ARP_HLEN - 1) + +/** + * An incoming packet handler. + * @param pkt pointer to the application packet + * @param dport destination UDP port + * @param sip source IP address + * @param sport source UDP port + * @param len packet length + */ +typedef void rxhand_f(uchar *pkt, unsigned dport, + struct in_addr sip, unsigned sport, + unsigned len); + +/** + * An incoming ICMP packet handler. + * @param type ICMP type + * @param code ICMP code + * @param dport destination UDP port + * @param sip source IP address + * @param sport source UDP port + * @param pkt pointer to the ICMP packet data + * @param len packet length + */ +typedef void rxhand_icmp_f(unsigned type, unsigned code, unsigned dport, + struct in_addr sip, unsigned sport, uchar *pkt, unsigned len); + +/* + * A timeout handler. Called after time interval has expired. + */ +typedef void thand_f(void); + +/* + * The devname can be either an exact name given by the driver or device tree + * or it can be an alias of the form "eth%d" + */ +struct udevice *eth_get_dev_by_name(const char *devname); +int eth_init_state_only(void); /* Set active state */ +void eth_halt_state_only(void); /* Set passive state */ + +/** + * 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); + +/* + * 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_send(void *packet, int length); /* Send a packet */ + +#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER) +int eth_receive(void *packet, int length); /* Receive a packet*/ +extern void (*push_packet)(void *packet, int length); +#endif +int eth_mcast_join(struct in_addr mcast_addr, int join); + +/**********************************************************************/ +/* + * Protocol headers. + */ + +#define ETH_FCS_LEN 4 /* Octets in the FCS */ + +struct e802_hdr { + u8 et_dest[ARP_HLEN]; /* Destination node */ + u8 et_src[ARP_HLEN]; /* Source node */ + u16 et_protlen; /* Protocol or length */ + u8 et_dsap; /* 802 DSAP */ + u8 et_ssap; /* 802 SSAP */ + u8 et_ctl; /* 802 control */ + u8 et_snap1; /* SNAP */ + u8 et_snap2; + u8 et_snap3; + u16 et_prot; /* 802 protocol */ +} __attribute__((packed)); + +/* 802 + SNAP + ethernet header size */ +#define E802_HDR_SIZE (sizeof(struct e802_hdr)) + +/* + * Virtual LAN Ethernet header + */ +struct vlan_ethernet_hdr { + u8 vet_dest[ARP_HLEN]; /* Destination node */ + u8 vet_src[ARP_HLEN]; /* Source node */ + u16 vet_vlan_type; /* PROT_VLAN */ + u16 vet_tag; /* TAG of VLAN */ + u16 vet_type; /* protocol type */ +} __attribute__((packed)); + +/* VLAN Ethernet header size */ +#define VLAN_ETHER_HDR_SIZE (sizeof(struct vlan_ethernet_hdr)) + +/* + * Internet Protocol (IP) header. + */ +struct ip_hdr { + u8 ip_hl_v; /* header length and version */ + u8 ip_tos; /* type of service */ + u16 ip_len; /* total length */ + u16 ip_id; /* identification */ + u16 ip_off; /* fragment offset field */ + u8 ip_ttl; /* time to live */ + u8 ip_p; /* protocol */ + u16 ip_sum; /* checksum */ + struct in_addr ip_src; /* Source IP address */ + struct in_addr ip_dst; /* Destination IP address */ +} __attribute__((packed)); + +#define IP_OFFS 0x1fff /* ip offset *= 8 */ +#define IP_FLAGS 0xe000 /* first 3 bits */ +#define IP_FLAGS_RES 0x8000 /* reserved */ +#define IP_FLAGS_DFRAG 0x4000 /* don't fragments */ +#define IP_FLAGS_MFRAG 0x2000 /* more fragments */ + +#define IP_HDR_SIZE (sizeof(struct ip_hdr)) + +#define IP_MIN_FRAG_DATAGRAM_SIZE (IP_HDR_SIZE + 8) + +/* + * Address Resolution Protocol (ARP) header. + */ +struct arp_hdr { + u16 ar_hrd; /* Format of hardware address */ +# define ARP_ETHER 1 /* Ethernet hardware address */ + u16 ar_pro; /* Format of protocol address */ + u8 ar_hln; /* Length of hardware address */ + u8 ar_pln; /* Length of protocol address */ +# define ARP_PLEN 4 + u16 ar_op; /* Operation */ +# define ARPOP_REQUEST 1 /* Request to resolve address */ +# define ARPOP_REPLY 2 /* Response to previous request */ + +# define RARPOP_REQUEST 3 /* Request to resolve address */ +# define RARPOP_REPLY 4 /* Response to previous request */ + + /* + * The remaining fields are variable in size, according to + * the sizes above, and are defined as appropriate for + * specific hardware/protocol combinations. + */ + u8 ar_data[0]; +#define ar_sha ar_data[0] +#define ar_spa ar_data[ARP_HLEN] +#define ar_tha ar_data[ARP_HLEN + ARP_PLEN] +#define ar_tpa ar_data[ARP_HLEN + ARP_PLEN + ARP_HLEN] +#if 0 + u8 ar_sha[]; /* Sender hardware address */ + u8 ar_spa[]; /* Sender protocol address */ + u8 ar_tha[]; /* Target hardware address */ + u8 ar_tpa[]; /* Target protocol address */ +#endif /* 0 */ +} __attribute__((packed)); + + +/* + * ICMP stuff (just enough to handle (host) redirect messages) + */ +#define ICMP_ECHO_REPLY 0 /* Echo reply */ +#define ICMP_NOT_REACH 3 /* Detination unreachable */ +#define ICMP_REDIRECT 5 /* Redirect (change route) */ +#define ICMP_ECHO_REQUEST 8 /* Echo request */ + +/* Codes for REDIRECT. */ +#define ICMP_REDIR_NET 0 /* Redirect Net */ +#define ICMP_REDIR_HOST 1 /* Redirect Host */ + +/* Codes for NOT_REACH */ +#define ICMP_NOT_REACH_PORT 3 /* Port unreachable */ + +struct icmp_hdr { + u8 type; + u8 code; + u16 checksum; + union { + struct { + u16 id; + u16 sequence; + } echo; + u32 gateway; + struct { + u16 unused; + u16 mtu; + } frag; + u8 data[0]; + } un; +} __attribute__((packed)); + +#define ICMP_HDR_SIZE (sizeof(struct icmp_hdr)) +#define IP_ICMP_HDR_SIZE (IP_HDR_SIZE + ICMP_HDR_SIZE) + +/* + * 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 + +/**********************************************************************/ +/* + * Globals. + * + * Note: + * + * All variables of type struct in_addr are stored in NETWORK byte order + * (big endian). + */ + +/* net.c */ +/** BOOTP EXTENTIONS **/ +extern struct in_addr net_gateway; /* Our gateway IP address */ +extern struct in_addr net_netmask; /* Our subnet mask (0 = unknown) */ +/* Our Domain Name Server (0 = unknown) */ +extern struct in_addr net_dns_server; +#if defined(CONFIG_BOOTP_DNS2) +/* Our 2nd Domain Name Server (0 = unknown) */ +extern struct in_addr net_dns_server2; +#endif +extern char net_nis_domain[32]; /* Our IS domain */ +extern char net_hostname[32]; /* Our hostname */ +#ifdef CONFIG_NET +extern char net_root_path[CONFIG_BOOTP_MAX_ROOT_PATH_LEN]; /* Our root path */ +#endif +/* Indicates whether the pxe path prefix / config file was specified in dhcp option */ +extern char *pxelinux_configfile; +/** END OF BOOTP EXTENTIONS **/ +extern u8 net_ethaddr[ARP_HLEN]; /* Our ethernet address */ +extern u8 net_server_ethaddr[ARP_HLEN]; /* Boot server enet address */ +extern struct in_addr net_ip; /* Our IP addr (0 = unknown) */ +extern struct in_addr net_server_ip; /* Server IP addr (0 = unknown) */ +extern uchar *net_tx_packet; /* THE transmit packet */ +extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */ +extern uchar *net_rx_packet; /* Current receive packet */ +extern int net_rx_packet_len; /* Current rx packet length */ +extern const u8 net_null_ethaddr[ARP_HLEN]; + +#define VLAN_NONE 4095 /* untagged */ +#define VLAN_IDMASK 0x0fff /* mask of valid vlan id */ +extern ushort net_our_vlan; /* Our VLAN */ +extern ushort net_native_vlan; /* Our Native VLAN */ + +extern int net_restart_wrap; /* Tried all network devices */ + +enum proto_t { + BOOTP, RARP, ARP, TFTPGET, DHCP, DHCP6, PING, PING6, DNS, NFS, CDP, + NETCONS, SNTP, TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT_UDP, FASTBOOT_TCP, + WOL, UDP, NCSI, WGET, RS +}; +/* Indicates whether the file name was specified on the command line */ +extern bool net_boot_file_name_explicit; +/* The actual transferred size of the bootfile (in bytes) */ +extern u32 net_boot_file_size; +/* Boot file size in blocks as reported by the DHCP server */ +extern u32 net_boot_file_expected_size_in_blocks; + +#if defined(CONFIG_CMD_DNS) +extern char *net_dns_resolve; /* The host to resolve */ +extern char *net_dns_env_var; /* the env var to put the ip into */ +#endif + +#if defined(CONFIG_CMD_PING) +extern struct in_addr net_ping_ip; /* the ip address to ping */ +#endif + +#if defined(CONFIG_CMD_CDP) +/* when CDP completes these hold the return values */ +extern ushort cdp_native_vlan; /* CDP returned native VLAN */ +extern ushort cdp_appliance_vlan; /* CDP returned appliance VLAN */ + +/* + * Check for a CDP packet by examining the received MAC address field + */ +static inline int is_cdp_packet(const uchar *ethaddr) +{ + extern const u8 net_cdp_ethaddr[ARP_HLEN]; + + return memcmp(ethaddr, net_cdp_ethaddr, ARP_HLEN) == 0; +} +#endif + +#if defined(CONFIG_CMD_SNTP) +extern struct in_addr net_ntp_server; /* the ip address to NTP */ +extern int net_ntp_time_offset; /* offset time from UTC */ +#endif + +int net_loop(enum proto_t); + +/* Load failed. Start again. */ +int net_start_again(void); + +/* Get size of the ethernet header when we send */ +int net_eth_hdr_size(void); + +/* Set ethernet header; returns the size of the header */ +int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot); +int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot); + +/* Set IP header */ +void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source, + u16 pkt_len, u8 proto); +void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, + int sport, int len); + +/* Callbacks */ +rxhand_f *net_get_udp_handler(void); /* Get UDP RX packet handler */ +void net_set_udp_handler(rxhand_f *); /* Set UDP RX packet handler */ +rxhand_f *net_get_arp_handler(void); /* Get ARP RX packet handler */ +void net_set_arp_handler(rxhand_f *); /* Set ARP RX packet handler */ +bool arp_is_waiting(void); /* Waiting for ARP reply? */ +void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */ +void net_set_timeout_handler(ulong, thand_f *);/* Set timeout handler */ + +/* Network loop state */ +enum net_loop_state { + NETLOOP_CONTINUE, + NETLOOP_RESTART, + NETLOOP_SUCCESS, + NETLOOP_FAIL +}; +extern enum net_loop_state net_state; + +static inline void net_set_state(enum net_loop_state state) +{ + debug_cond(DEBUG_INT_STATE, "--- NetState set to %d\n", state); + net_state = state; +} + +/* + * net_get_async_tx_pkt_buf - Get a packet buffer that is not in use for + * sending an asynchronous reply + * + * returns - ptr to packet buffer + */ +uchar * net_get_async_tx_pkt_buf(void); + +/** + * net_send_ip_packet() - Transmit "net_tx_packet" as UDP or TCP packet, + * send ARP request if needed (ether will be populated) + * @ether: Raw packet buffer + * @dest: IP address to send the datagram to + * @dport: Destination UDP port + * @sport: Source UDP port + * @payload_len: Length of data after the UDP header + * @action: TCP action to be performed + * @tcp_seq_num: TCP sequence number of this transmission + * @tcp_ack_num: TCP stream acknolegement number + * + * Return: 0 on success, other value on failure + */ +int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport, + int payload_len, int proto, u8 action, u32 tcp_seq_num, + u32 tcp_ack_num); +/** + * net_send_tcp_packet() - Transmit TCP packet. + * @payload_len: length of payload + * @dport: Destination TCP port + * @sport: Source TCP port + * @action: TCP action to be performed + * @tcp_seq_num: TCP sequence number of this transmission + * @tcp_ack_num: TCP stream acknolegement number + * + * Return: 0 on success, other value on failure + */ +int net_send_tcp_packet(int payload_len, int dport, int sport, u8 action, + u32 tcp_seq_num, u32 tcp_ack_num); +int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, + int sport, int payload_len); + +#if defined(CONFIG_NETCONSOLE) && !defined(CONFIG_XPL_BUILD) +void nc_start(void); +int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port, + unsigned src_port, unsigned len); +#endif + +static __always_inline int eth_is_on_demand_init(void) +{ +#if defined(CONFIG_NETCONSOLE) && !defined(CONFIG_XPL_BUILD) + extern enum proto_t net_loop_last_protocol; + + return net_loop_last_protocol != NETCONS; +#else + return 1; +#endif +} + +static inline void eth_set_last_protocol(int protocol) +{ +#if defined(CONFIG_NETCONSOLE) && !defined(CONFIG_XPL_BUILD) + extern enum proto_t net_loop_last_protocol; + + net_loop_last_protocol = protocol; +#endif +} + +/* + * Check if autoload is enabled. If so, use either NFS or TFTP to download + * the boot file. + */ +void net_auto_load(void); + +/* + * The following functions are a bit ugly, but necessary to deal with + * alignment restrictions on ARM. + * + * We're using inline functions, which had the smallest memory + * footprint in our tests. + */ +/* return IP *in network byteorder* */ +static inline struct in_addr net_read_ip(void *from) +{ + struct in_addr ip; + + memcpy((void *)&ip, (void *)from, sizeof(ip)); + return ip; +} + +/* return ulong *in network byteorder* */ +static inline u32 net_read_u32(void *from) +{ + u32 l; + + memcpy((void *)&l, (void *)from, sizeof(l)); + return l; +} + +/* write IP *in network byteorder* */ +static inline void net_write_ip(void *to, struct in_addr ip) +{ + memcpy(to, (void *)&ip, sizeof(ip)); +} + +/* copy IP */ +static inline void net_copy_ip(void *to, void *from) +{ + memcpy((void *)to, from, sizeof(struct in_addr)); +} + +/* copy ulong */ +static inline void net_copy_u32(void *to, void *from) +{ + memcpy((void *)to, (void *)from, sizeof(u32)); +} + +/* Convert an IP address to a string */ +void ip_to_string(struct in_addr x, char *s); + +/** + * string_to_ip() - Convert a string to ip address + * + * Implemented in lib/net_utils.c (built unconditionally) + * + * @s: Input string to parse + * @return: in_addr struct containing the parsed IP address + */ +struct in_addr string_to_ip(const char *s); + +/* Convert a VLAN id to a string */ +void vlan_to_string(ushort x, char *s); + +/* Convert a string to a vlan id */ +ushort string_to_vlan(const char *s); + +/* read a VLAN id from an environment variable */ +ushort env_get_vlan(char *); + +/* check if serverip is specified in filename from the command line */ +int is_serverip_in_cmd(void); + +/** + * net_parse_bootfile - Parse the bootfile env var / cmd line param + * + * @param ipaddr - a pointer to the ipaddr to populate if included in bootfile + * @param filename - a pointer to the string to save the filename part + * @param max_len - The longest - 1 that the filename part can be + * + * return 1 if parsed, 0 if bootfile is empty + */ +int net_parse_bootfile(struct in_addr *ipaddr, char *filename, int max_len); + +#endif /* __NET_LEGACY_H__ */ diff --git a/include/net-lwip.h b/include/net-lwip.h new file mode 100644 index 00000000000..5c3f9e7e86c --- /dev/null +++ b/include/net-lwip.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __NET_LWIP_H__ +#define __NET_LWIP_H__ + +#include +#include + +struct netif *net_lwip_new_netif(struct udevice *udev); +struct netif *net_lwip_new_netif_noip(struct udevice *udev); +void net_lwip_remove_netif(struct netif *netif); +struct netif *net_lwip_get_netif(void); + +#endif /* __NET_LWIP_H__ */ diff --git a/include/net.h b/include/net.h index dc8b5e9cc34..afa46f239ee 100644 --- a/include/net.h +++ b/include/net.h @@ -1,949 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0 */ -/* - * LiMon Monitor (LiMon) - Network. - * - * Copyright 1994 - 2000 Neil Russell. - * (See License) - * - * History - * 9/16/00 bor adapted to TQM823L/STK8xxL board, RARP/TFTP boot added - */ #ifndef __NET_H__ #define __NET_H__ -#include -#include -#include /* for nton* / ntoh* stuff */ -#include -#include -#include -#include -#include -#include +#include -struct bd_info; -struct cmd_tbl; -struct udevice; - -#define DEBUG_LL_STATE 0 /* Link local state machine changes */ -#define DEBUG_DEV_PKT 0 /* Packets or info directed to the device */ -#define DEBUG_NET_PKT 0 /* Packets on info on the network at large */ -#define DEBUG_INT_STATE 0 /* Internal network state changes */ -#define DEBUG_NET_PKT_TRACE 0 /* Trace all packet data */ - -/* - * 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 - -/* Number of packets processed together */ -#define ETH_PACKETS_BATCH_RECV 32 - -/* ARP hardware address length */ -#define ARP_HLEN 6 -/* - * The size of a MAC address in string form, each digit requires two chars - * and five separator characters to form '00:00:00:00:00:00'. - */ -#define ARP_HLEN_ASCII (ARP_HLEN * 2) + (ARP_HLEN - 1) - -/* IPv4 addresses are always 32 bits in size */ -struct in_addr { - __be32 s_addr; -}; - -/** - * do_tftpb - Run the tftpboot command - * - * @cmdtp: Command information for tftpboot - * @flag: Command flags (CMD_FLAG_...) - * @argc: Number of arguments - * @argv: List of arguments - * Return: result (see enum command_ret_t) - */ -int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); - -/** - * dhcp_run() - Run DHCP on the current ethernet device - * - * This sets the autoload variable, then puts it back to similar to its original - * state (y, n or unset). - * - * @addr: Address to load the file into (0 if @autoload is false) - * @fname: Filename of file to load (NULL if @autoload is false or to use the - * default filename) - * @autoload: true to load the file, false to just get the network IP - * @return 0 if OK, -EINVAL if the environment failed, -ENOENT if ant file was - * not found - */ -int dhcp_run(ulong addr, const char *fname, bool autoload); - -/** - * An incoming packet handler. - * @param pkt pointer to the application packet - * @param dport destination UDP port - * @param sip source IP address - * @param sport source UDP port - * @param len packet length - */ -typedef void rxhand_f(uchar *pkt, unsigned dport, - struct in_addr sip, unsigned sport, - unsigned len); - -/** - * An incoming ICMP packet handler. - * @param type ICMP type - * @param code ICMP code - * @param dport destination UDP port - * @param sip source IP address - * @param sport source UDP port - * @param pkt pointer to the ICMP packet data - * @param len packet length - */ -typedef void rxhand_icmp_f(unsigned type, unsigned code, unsigned dport, - struct in_addr sip, unsigned sport, uchar *pkt, unsigned len); - -/* - * A timeout handler. Called after time interval has expired. - */ -typedef void thand_f(void); - -enum eth_state_t { - ETH_STATE_INIT, - ETH_STATE_PASSIVE, - ETH_STATE_ACTIVE -}; - -/** - * struct eth_pdata - Platform data for Ethernet MAC controllers - * - * @iobase: The base address of the hardware registers - * @enetaddr: The Ethernet MAC address that is loaded from EEPROM or env - * @phy_interface: PHY interface to use - see PHY_INTERFACE_MODE_... - * @max_speed: Maximum speed of Ethernet connection supported by MAC - * @priv_pdata: device specific plat - */ -struct eth_pdata { - phys_addr_t iobase; - unsigned char enetaddr[ARP_HLEN]; - int phy_interface; - int max_speed; - void *priv_pdata; -}; - -enum eth_recv_flags { - /* - * Check hardware device for new packets (otherwise only return those - * which are already in the memory buffer ready to process) - */ - ETH_RECV_CHECK_DEVICE = 1 << 0, -}; - -/** - * 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 */ -/* - * The devname can be either an exact name given by the driver or device tree - * or it can be an alias of the form "eth%d" - */ -struct udevice *eth_get_dev_by_name(const char *devname); -unsigned char *eth_get_ethaddr(void); /* get the current device MAC */ - -/* Used only when NetConsole is enabled */ -int eth_is_active(struct udevice *dev); /* Test device for active state */ -int eth_init_state_only(void); /* Set active state */ -void eth_halt_state_only(void); /* Set passive state */ - -int eth_initialize(void); /* Initialize network subsystem */ -void eth_try_another(int first_restart); /* Change the device */ -void eth_set_current(void); /* set nterface to ethcur var */ - -int eth_get_dev_index(void); /* get the device index */ - -/** - * 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); - -/* - * Initialize USB ethernet device with CONFIG_DM_ETH - * Returns: - * 0 is success, non-zero is error status. - */ -int usb_ether_init(void); - -/* - * 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 */ - -#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER) -int eth_receive(void *packet, int length); /* Receive a packet*/ -extern void (*push_packet)(void *packet, int length); -#endif -int eth_rx(void); /* Check for received packets */ -void eth_halt(void); /* stop SCC */ -const char *eth_get_name(void); /* get name of current device */ -int eth_mcast_join(struct in_addr mcast_addr, int join); - -/**********************************************************************/ -/* - * Protocol headers. - */ - -/* - * Ethernet header - */ - -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)) - -#define ETH_FCS_LEN 4 /* Octets in the FCS */ - -struct e802_hdr { - u8 et_dest[ARP_HLEN]; /* Destination node */ - u8 et_src[ARP_HLEN]; /* Source node */ - u16 et_protlen; /* Protocol or length */ - u8 et_dsap; /* 802 DSAP */ - u8 et_ssap; /* 802 SSAP */ - u8 et_ctl; /* 802 control */ - u8 et_snap1; /* SNAP */ - u8 et_snap2; - u8 et_snap3; - u16 et_prot; /* 802 protocol */ -} __attribute__((packed)); - -/* 802 + SNAP + ethernet header size */ -#define E802_HDR_SIZE (sizeof(struct e802_hdr)) - -/* - * Virtual LAN Ethernet header - */ -struct vlan_ethernet_hdr { - u8 vet_dest[ARP_HLEN]; /* Destination node */ - u8 vet_src[ARP_HLEN]; /* Source node */ - u16 vet_vlan_type; /* PROT_VLAN */ - u16 vet_tag; /* TAG of VLAN */ - u16 vet_type; /* protocol type */ -} __attribute__((packed)); - -/* VLAN Ethernet header size */ -#define VLAN_ETHER_HDR_SIZE (sizeof(struct vlan_ethernet_hdr)) - -#define PROT_IP 0x0800 /* IP protocol */ -#define PROT_ARP 0x0806 /* IP ARP protocol */ -#define PROT_WOL 0x0842 /* ether-wake WoL protocol */ -#define PROT_RARP 0x8035 /* IP ARP protocol */ -#define PROT_VLAN 0x8100 /* IEEE 802.1q protocol */ -#define PROT_IPV6 0x86dd /* IPv6 over bluebook */ -#define PROT_PPP_SES 0x8864 /* PPPoE session messages */ -#define PROT_NCSI 0x88f8 /* NC-SI control packets */ - -#define IPPROTO_ICMP 1 /* Internet Control Message Protocol */ -#define IPPROTO_TCP 6 /* Transmission Control Protocol */ -#define IPPROTO_UDP 17 /* User Datagram Protocol */ - -/* - * Internet Protocol (IP) header. - */ -struct ip_hdr { - u8 ip_hl_v; /* header length and version */ - u8 ip_tos; /* type of service */ - u16 ip_len; /* total length */ - u16 ip_id; /* identification */ - u16 ip_off; /* fragment offset field */ - u8 ip_ttl; /* time to live */ - u8 ip_p; /* protocol */ - u16 ip_sum; /* checksum */ - struct in_addr ip_src; /* Source IP address */ - struct in_addr ip_dst; /* Destination IP address */ -} __attribute__((packed)); - -#define IP_OFFS 0x1fff /* ip offset *= 8 */ -#define IP_FLAGS 0xe000 /* first 3 bits */ -#define IP_FLAGS_RES 0x8000 /* reserved */ -#define IP_FLAGS_DFRAG 0x4000 /* don't fragments */ -#define IP_FLAGS_MFRAG 0x2000 /* more fragments */ - -#define IP_HDR_SIZE (sizeof(struct ip_hdr)) - -#define IP_MIN_FRAG_DATAGRAM_SIZE (IP_HDR_SIZE + 8) - -/* - * Internet Protocol (IP) + UDP header. - */ -struct ip_udp_hdr { - u8 ip_hl_v; /* header length and version */ - u8 ip_tos; /* type of service */ - u16 ip_len; /* total length */ - u16 ip_id; /* identification */ - u16 ip_off; /* fragment offset field */ - u8 ip_ttl; /* time to live */ - u8 ip_p; /* protocol */ - u16 ip_sum; /* checksum */ - struct in_addr ip_src; /* Source IP address */ - struct in_addr ip_dst; /* Destination IP address */ - u16 udp_src; /* UDP source port */ - u16 udp_dst; /* UDP destination port */ - u16 udp_len; /* Length of UDP packet */ - u16 udp_xsum; /* Checksum */ -} __attribute__((packed)); - -#define IP_UDP_HDR_SIZE (sizeof(struct ip_udp_hdr)) -#define UDP_HDR_SIZE (IP_UDP_HDR_SIZE - IP_HDR_SIZE) - -/* - * Address Resolution Protocol (ARP) header. - */ -struct arp_hdr { - u16 ar_hrd; /* Format of hardware address */ -# define ARP_ETHER 1 /* Ethernet hardware address */ - u16 ar_pro; /* Format of protocol address */ - u8 ar_hln; /* Length of hardware address */ - u8 ar_pln; /* Length of protocol address */ -# define ARP_PLEN 4 - u16 ar_op; /* Operation */ -# define ARPOP_REQUEST 1 /* Request to resolve address */ -# define ARPOP_REPLY 2 /* Response to previous request */ - -# define RARPOP_REQUEST 3 /* Request to resolve address */ -# define RARPOP_REPLY 4 /* Response to previous request */ - - /* - * The remaining fields are variable in size, according to - * the sizes above, and are defined as appropriate for - * specific hardware/protocol combinations. - */ - u8 ar_data[0]; -#define ar_sha ar_data[0] -#define ar_spa ar_data[ARP_HLEN] -#define ar_tha ar_data[ARP_HLEN + ARP_PLEN] -#define ar_tpa ar_data[ARP_HLEN + ARP_PLEN + ARP_HLEN] -#if 0 - u8 ar_sha[]; /* Sender hardware address */ - u8 ar_spa[]; /* Sender protocol address */ - u8 ar_tha[]; /* Target hardware address */ - u8 ar_tpa[]; /* Target protocol address */ -#endif /* 0 */ -} __attribute__((packed)); - -#define ARP_HDR_SIZE (8+20) /* Size assuming ethernet */ - -/* - * ICMP stuff (just enough to handle (host) redirect messages) - */ -#define ICMP_ECHO_REPLY 0 /* Echo reply */ -#define ICMP_NOT_REACH 3 /* Detination unreachable */ -#define ICMP_REDIRECT 5 /* Redirect (change route) */ -#define ICMP_ECHO_REQUEST 8 /* Echo request */ - -/* Codes for REDIRECT. */ -#define ICMP_REDIR_NET 0 /* Redirect Net */ -#define ICMP_REDIR_HOST 1 /* Redirect Host */ - -/* Codes for NOT_REACH */ -#define ICMP_NOT_REACH_PORT 3 /* Port unreachable */ - -struct icmp_hdr { - u8 type; - u8 code; - u16 checksum; - union { - struct { - u16 id; - u16 sequence; - } echo; - u32 gateway; - struct { - u16 unused; - u16 mtu; - } frag; - u8 data[0]; - } un; -} __attribute__((packed)); - -#define ICMP_HDR_SIZE (sizeof(struct icmp_hdr)) -#define IP_ICMP_HDR_SIZE (IP_HDR_SIZE + ICMP_HDR_SIZE) - -/* - * 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 +#if defined(CONFIG_NET_LWIP) +#include #else -/* Maximum DSA tagging overhead (headroom and/or tailroom) */ -#define DSA_MAX_OVR 256 -#define PKTSIZE_ALIGN (1536 + DSA_MAX_OVR) -#endif - -/* - * Maximum receive ring size; that is, the number of packets - * we can buffer before overflow happens. Basically, this just - * needs to be enough to prevent a packet being discarded while - * we are processing the previous one. - */ -#define RINGSZ 4 -#define RINGSZ_LOG2 2 - -/**********************************************************************/ -/* - * Globals. - * - * Note: - * - * All variables of type struct in_addr are stored in NETWORK byte order - * (big endian). - */ - -/* net.c */ -/** BOOTP EXTENTIONS **/ -extern struct in_addr net_gateway; /* Our gateway IP address */ -extern struct in_addr net_netmask; /* Our subnet mask (0 = unknown) */ -/* Our Domain Name Server (0 = unknown) */ -extern struct in_addr net_dns_server; -#if defined(CONFIG_BOOTP_DNS2) -/* Our 2nd Domain Name Server (0 = unknown) */ -extern struct in_addr net_dns_server2; +#include #endif -extern char net_nis_domain[32]; /* Our IS domain */ -extern char net_hostname[32]; /* Our hostname */ -#ifdef CONFIG_NET -extern char net_root_path[CONFIG_BOOTP_MAX_ROOT_PATH_LEN]; /* Our root path */ -#endif -/* Indicates whether the pxe path prefix / config file was specified in dhcp option */ -extern char *pxelinux_configfile; -/** END OF BOOTP EXTENTIONS **/ -extern u8 net_ethaddr[ARP_HLEN]; /* Our ethernet address */ -extern u8 net_server_ethaddr[ARP_HLEN]; /* Boot server enet address */ -extern struct in_addr net_ip; /* Our IP addr (0 = unknown) */ -extern struct in_addr net_server_ip; /* Server IP addr (0 = unknown) */ -extern uchar *net_tx_packet; /* THE transmit packet */ -extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */ -extern uchar *net_rx_packet; /* Current receive packet */ -extern int net_rx_packet_len; /* Current rx packet length */ -extern const u8 net_bcast_ethaddr[ARP_HLEN]; /* Ethernet broadcast address */ -extern const u8 net_null_ethaddr[ARP_HLEN]; - -#define VLAN_NONE 4095 /* untagged */ -#define VLAN_IDMASK 0x0fff /* mask of valid vlan id */ -extern ushort net_our_vlan; /* Our VLAN */ -extern ushort net_native_vlan; /* Our Native VLAN */ - -extern int net_restart_wrap; /* Tried all network devices */ - -enum proto_t { - BOOTP, RARP, ARP, TFTPGET, DHCP, DHCP6, PING, PING6, DNS, NFS, CDP, - NETCONS, SNTP, TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT_UDP, FASTBOOT_TCP, - WOL, UDP, NCSI, WGET, RS -}; - -extern char net_boot_file_name[1024];/* Boot File name */ -/* Indicates whether the file name was specified on the command line */ -extern bool net_boot_file_name_explicit; -/* The actual transferred size of the bootfile (in bytes) */ -extern u32 net_boot_file_size; -/* Boot file size in blocks as reported by the DHCP server */ -extern u32 net_boot_file_expected_size_in_blocks; - -#if defined(CONFIG_CMD_DNS) -extern char *net_dns_resolve; /* The host to resolve */ -extern char *net_dns_env_var; /* the env var to put the ip into */ -#endif - -#if defined(CONFIG_CMD_PING) -extern struct in_addr net_ping_ip; /* the ip address to ping */ -#endif - -#if defined(CONFIG_CMD_CDP) -/* when CDP completes these hold the return values */ -extern ushort cdp_native_vlan; /* CDP returned native VLAN */ -extern ushort cdp_appliance_vlan; /* CDP returned appliance VLAN */ - -/* - * Check for a CDP packet by examining the received MAC address field - */ -static inline int is_cdp_packet(const uchar *ethaddr) -{ - extern const u8 net_cdp_ethaddr[ARP_HLEN]; - - return memcmp(ethaddr, net_cdp_ethaddr, ARP_HLEN) == 0; -} -#endif - -#if defined(CONFIG_CMD_SNTP) -extern struct in_addr net_ntp_server; /* the ip address to NTP */ -extern int net_ntp_time_offset; /* offset time from UTC */ -#endif - -/* Initialize the network adapter */ -int net_init(void); -int net_loop(enum proto_t); - -/* Load failed. Start again. */ -int net_start_again(void); - -/* Get size of the ethernet header when we send */ -int net_eth_hdr_size(void); - -/* Set ethernet header; returns the size of the header */ -int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot); -int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot); - -/* Set IP header */ -void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source, - u16 pkt_len, u8 proto); -void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, - int sport, int len); - -/** - * compute_ip_checksum() - Compute IP checksum - * - * @addr: Address to check (must be 16-bit aligned) - * @nbytes: Number of bytes to check (normally a multiple of 2) - * Return: 16-bit IP checksum - */ -unsigned compute_ip_checksum(const void *addr, unsigned nbytes); - -/** - * add_ip_checksums() - add two IP checksums - * - * @offset: Offset of first sum (if odd we do a byte-swap) - * @sum: First checksum - * @new_sum: New checksum to add - * Return: updated 16-bit IP checksum - */ -unsigned add_ip_checksums(unsigned offset, unsigned sum, unsigned new_sum); - -/** - * ip_checksum_ok() - check if a checksum is correct - * - * This works by making sure the checksum sums to 0 - * - * @addr: Address to check (must be 16-bit aligned) - * @nbytes: Number of bytes to check (normally a multiple of 2) - * Return: true if the checksum matches, false if not - */ -int ip_checksum_ok(const void *addr, unsigned nbytes); - -/* Callbacks */ -rxhand_f *net_get_udp_handler(void); /* Get UDP RX packet handler */ -void net_set_udp_handler(rxhand_f *); /* Set UDP RX packet handler */ -rxhand_f *net_get_arp_handler(void); /* Get ARP RX packet handler */ -void net_set_arp_handler(rxhand_f *); /* Set ARP RX packet handler */ -bool arp_is_waiting(void); /* Waiting for ARP reply? */ -void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */ -void net_set_timeout_handler(ulong, thand_f *);/* Set timeout handler */ - -/* Network loop state */ -enum net_loop_state { - NETLOOP_CONTINUE, - NETLOOP_RESTART, - NETLOOP_SUCCESS, - NETLOOP_FAIL -}; -extern enum net_loop_state net_state; - -static inline void net_set_state(enum net_loop_state state) -{ - debug_cond(DEBUG_INT_STATE, "--- NetState set to %d\n", state); - net_state = state; -} - -/* - * net_get_async_tx_pkt_buf - Get a packet buffer that is not in use for - * sending an asynchronous reply - * - * returns - ptr to packet buffer - */ -uchar * net_get_async_tx_pkt_buf(void); - -/* Transmit a packet */ -static inline void net_send_packet(uchar *pkt, int len) -{ - if (DEBUG_NET_PKT_TRACE) - print_hex_dump_bytes("tx: ", DUMP_PREFIX_OFFSET, pkt, len); - /* Currently no way to return errors from eth_send() */ - (void) eth_send(pkt, len); -} - -/** - * net_send_ip_packet() - Transmit "net_tx_packet" as UDP or TCP packet, - * send ARP request if needed (ether will be populated) - * @ether: Raw packet buffer - * @dest: IP address to send the datagram to - * @dport: Destination UDP port - * @sport: Source UDP port - * @payload_len: Length of data after the UDP header - * @action: TCP action to be performed - * @tcp_seq_num: TCP sequence number of this transmission - * @tcp_ack_num: TCP stream acknolegement number - * - * Return: 0 on success, other value on failure - */ -int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport, - int payload_len, int proto, u8 action, u32 tcp_seq_num, - u32 tcp_ack_num); -/** - * net_send_tcp_packet() - Transmit TCP packet. - * @payload_len: length of payload - * @dport: Destination TCP port - * @sport: Source TCP port - * @action: TCP action to be performed - * @tcp_seq_num: TCP sequence number of this transmission - * @tcp_ack_num: TCP stream acknolegement number - * - * Return: 0 on success, other value on failure - */ -int net_send_tcp_packet(int payload_len, int dport, int sport, u8 action, - u32 tcp_seq_num, u32 tcp_ack_num); -int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, - int sport, int payload_len); - -/* Processes a received packet */ -void net_process_received_packet(uchar *in_packet, int len); - -#if defined(CONFIG_NETCONSOLE) && !defined(CONFIG_XPL_BUILD) -void nc_start(void); -int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port, - unsigned src_port, unsigned len); -#endif - -static __always_inline int eth_is_on_demand_init(void) -{ -#if defined(CONFIG_NETCONSOLE) && !defined(CONFIG_XPL_BUILD) - extern enum proto_t net_loop_last_protocol; - - return net_loop_last_protocol != NETCONS; -#else - return 1; -#endif -} - -static inline void eth_set_last_protocol(int protocol) -{ -#if defined(CONFIG_NETCONSOLE) && !defined(CONFIG_XPL_BUILD) - extern enum proto_t net_loop_last_protocol; - - net_loop_last_protocol = protocol; -#endif -} - -/* - * Check if autoload is enabled. If so, use either NFS or TFTP to download - * the boot file. - */ -void net_auto_load(void); - -/* - * The following functions are a bit ugly, but necessary to deal with - * alignment restrictions on ARM. - * - * We're using inline functions, which had the smallest memory - * footprint in our tests. - */ -/* return IP *in network byteorder* */ -static inline struct in_addr net_read_ip(void *from) -{ - struct in_addr ip; - - memcpy((void *)&ip, (void *)from, sizeof(ip)); - return ip; -} - -/* return ulong *in network byteorder* */ -static inline u32 net_read_u32(void *from) -{ - u32 l; - - memcpy((void *)&l, (void *)from, sizeof(l)); - return l; -} - -/* write IP *in network byteorder* */ -static inline void net_write_ip(void *to, struct in_addr ip) -{ - memcpy(to, (void *)&ip, sizeof(ip)); -} - -/* copy IP */ -static inline void net_copy_ip(void *to, void *from) -{ - memcpy((void *)to, from, sizeof(struct in_addr)); -} - -/* copy ulong */ -static inline void net_copy_u32(void *to, void *from) -{ - memcpy((void *)to, (void *)from, sizeof(u32)); -} - -/** - * is_zero_ethaddr - Determine if give Ethernet address is all zeros. - * @addr: Pointer to a six-byte array containing the Ethernet address - * - * Return true if the address is all zeroes. - */ -static inline int is_zero_ethaddr(const u8 *addr) -{ - return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); -} - -/** - * is_multicast_ethaddr - Determine if the Ethernet address is a multicast. - * @addr: Pointer to a six-byte array containing the Ethernet address - * - * Return true if the address is a multicast address. - * By definition the broadcast address is also a multicast address. - */ -static inline int is_multicast_ethaddr(const u8 *addr) -{ - return 0x01 & addr[0]; -} - -/* - * is_broadcast_ethaddr - Determine if the Ethernet address is broadcast - * @addr: Pointer to a six-byte array containing the Ethernet address - * - * Return true if the address is the broadcast address. - */ -static inline int is_broadcast_ethaddr(const u8 *addr) -{ - return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == - 0xff; -} - -/* - * is_valid_ethaddr - Determine if the given Ethernet address is valid - * @addr: Pointer to a six-byte array containing the Ethernet address - * - * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not - * a multicast address, and is not FF:FF:FF:FF:FF:FF. - * - * Return true if the address is valid. - */ -static inline int is_valid_ethaddr(const u8 *addr) -{ - /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to - * explicitly check for it here. */ - return !is_multicast_ethaddr(addr) && !is_zero_ethaddr(addr); -} - -/** - * net_random_ethaddr - Generate software assigned random Ethernet address - * @addr: Pointer to a six-byte array containing the Ethernet address - * - * Generate a random Ethernet address (MAC) that is not multicast - * and has the local assigned bit set. - */ -static inline void net_random_ethaddr(uchar *addr) -{ - int i; - unsigned int seed = get_ticks(); - - for (i = 0; i < 6; i++) - addr[i] = rand_r(&seed); - - addr[0] &= 0xfe; /* clear multicast bit */ - addr[0] |= 0x02; /* set local assignment bit (IEEE802) */ -} - -/** - * 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); - -/* Convert an IP address to a string */ -void ip_to_string(struct in_addr x, char *s); - -/** - * string_to_ip() - Convert a string to ip address - * - * Implemented in lib/net_utils.c (built unconditionally) - * - * @s: Input string to parse - * @return: in_addr struct containing the parsed IP address - */ -struct in_addr string_to_ip(const char *s); - -/* Convert a VLAN id to a string */ -void vlan_to_string(ushort x, char *s); - -/* Convert a string to a vlan id */ -ushort string_to_vlan(const char *s); - -/* read a VLAN id from an environment variable */ -ushort env_get_vlan(char *); - -/* copy a filename (allow for "..." notation, limit length) */ -void copy_filename(char *dst, const char *src, int size); - -/* check if serverip is specified in filename from the command line */ -int is_serverip_in_cmd(void); - -/** - * net_parse_bootfile - Parse the bootfile env var / cmd line param - * - * @param ipaddr - a pointer to the ipaddr to populate if included in bootfile - * @param filename - a pointer to the string to save the filename part - * @param max_len - The longest - 1 that the filename part can be - * - * return 1 if parsed, 0 if bootfile is empty - */ -int net_parse_bootfile(struct in_addr *ipaddr, char *filename, int max_len); - -/** - * update_tftp - Update firmware over TFTP (via DFU) - * - * This function updates board's firmware via TFTP - * - * @param addr - memory address where data is stored - * @param interface - the DFU medium name - e.g. "mmc" - * @param devstring - the DFU medium number - e.g. "1" - * - * Return: - 0 on success, other value on failure - */ -int update_tftp(ulong addr, char *interface, char *devstring); - -/** - * env_get_ip() - Convert an environment value to to an ip address - * - * @var: Environment variable to convert. The value of this variable must be - * in the format format a.b.c.d, where each value is a decimal number from - * 0 to 255 - * Return: IP address, or 0 if invalid - */ -static inline struct in_addr env_get_ip(char *var) -{ - return string_to_ip(env_get(var)); -} - -/** - * reset_phy() - Reset the Ethernet PHY - * - * This should be implemented by boards if CONFIG_RESET_PHY_R is enabled - */ -void reset_phy(void); - -#if CONFIG_IS_ENABLED(NET) -/** - * eth_set_enable_bootdevs() - Enable or disable binding of Ethernet bootdevs - * - * These get in the way of bootstd testing, so are normally disabled by tests. - * This provide control of this setting. It only affects binding of Ethernet - * devices, so if that has already happened, this flag does nothing. - * - * @enable: true to enable binding of bootdevs when binding new Ethernet - * devices, false to disable it - */ -void eth_set_enable_bootdevs(bool enable); -#else -static inline void eth_set_enable_bootdevs(bool enable) {} -#endif - -/** - * wget_with_dns() - runs dns host IP address resulution before wget - * - * @dst_addr: destination address to download the file - * @uri: uri string of target file of wget - * Return: downloaded file size, negative if failed - */ -int wget_with_dns(ulong dst_addr, char *uri); - -/** - * wget_validate_uri() - varidate the uri - * - * @uri: uri string of target file of wget - * Return: true if uri is valid, false if uri is invalid - */ -bool wget_validate_uri(char *uri); #endif /* __NET_H__ */ diff --git a/net/Makefile b/net/Makefile index 33c82b5d229..34fe50133a3 100644 --- a/net/Makefile +++ b/net/Makefile @@ -42,3 +42,5 @@ obj-$(CONFIG_CMD_WGET) += wget.o CFLAGS_eth_common.o += -Wno-format-extra-args endif + +obj-y += net-common.o diff --git a/net/net-common.c b/net/net-common.c new file mode 100644 index 00000000000..a7f767d5e9c --- /dev/null +++ b/net/net-common.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +void copy_filename(char *dst, const char *src, int size) +{ + if (src && *src && (*src == '"')) { + ++src; + --size; + } + + while ((--size > 0) && src && *src && (*src != '"')) + *dst++ = *src++; + *dst = '\0'; +} diff --git a/net/net.c b/net/net.c index 64bcf69d83f..f47e9fbe33a 100644 --- a/net/net.c +++ b/net/net.c @@ -1693,18 +1693,6 @@ void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, int sport, ip->udp_xsum = 0; } -void copy_filename(char *dst, const char *src, int size) -{ - if (src && *src && (*src == '"')) { - ++src; - --size; - } - - while ((--size > 0) && src && *src && (*src != '"')) - *dst++ = *src++; - *dst = '\0'; -} - int is_serverip_in_cmd(void) { return !!strchr(net_boot_file_name, ':'); From patchwork Wed Oct 16 10:04: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: 835794 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346257wru; Wed, 16 Oct 2024 03:05:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWlhpAPOT6r7H3hgIciy8aOaon7bdYZfEJOMfXRK4j2e35640WKwSJZUhk7p44B0fjJZG+D6g==@linaro.org X-Google-Smtp-Source: AGHT+IFG8ib2aRSQdqg9qbHTN36FVQu5/OK4+e0IVGpwJVb7n/FzDps8Yg3m8QkMivhtxBszJ0WE X-Received: by 2002:a05:6602:1489:b0:835:4d07:9d46 with SMTP id ca18e2360f4ac-8379531e3f3mr1691210339f.15.1729073104377; Wed, 16 Oct 2024 03:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073104; cv=none; d=google.com; s=arc-20240605; b=XRvKTloZ1kLeViJYHhYQst5C/AdAan+8f2KMDlZ50tzY3RCuSM0DkiTRvSYCfFl57U kezfrpl94+oS1jllR3sSZj9UiBJY3lCd0fpNFHlM6umBubCTl1Kgsce72VNyD7g5a39a CDpgbM7/CzdPD9GMuYpckNv4DV8g0MTxKXOWA7s2WneDRN/mnY5EJKIagYZVM94Sk7Su brEK4eZv2X7HxEe2Ueok/zssXte0THkBYlB3vkiR96xx5GbRnpRLnBxwSSXfa0Zuq6dB xwh1RvFC/ipqsmBh4QsCqUM6RtE9EpXhrDZngZsyuITFvZWH5jz9V+Vp7AumH1GJXSkI wwWQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vlz3ngfSd00AiIHBl1lrcajvkbsIxEryhXrcWbIeGOM=; fh=JyjtU8+8ky5xDrJcwNFCX4ST2DK8qQZ3G+fuSjy7LCs=; b=CyRIZ7whp7ef4OG+e9IR6BvNkL29B0RE95KpSFaGY4lcLVyANbIIwdWgtLJA31z6xH WUWb4Q/xRxzE2QmgN5Gs9nJEzxPqQAKKe2KhcOOqZjda0q11u/ELyrJRvW8rx5gJWMcX mLDIfp7U5mYl268y4kcGVc4K5mlUBwcq0I6oCsQuoex5ED+pVVJwu1GjMMtcP6Sn3MIB n+WEr3PFT03CkcT16gfqTOUaA5OMrwd8ZaRTLnuCfHx9MOi5VBmUUulgG1HFDc4cKmNK YudwcjCpZF8H+OCOJMwMMxQptmtdJK9ppyXANnJu/MhQLeLjHduwKV9LtemkxabC3O+N vJLw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xmS1GzFs; 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 ca18e2360f4ac-83a8b2b6d39si150156539f.78.2024.10.16.03.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:04 -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=xmS1GzFs; 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 A5FDF88FAF; Wed, 16 Oct 2024 12:04:54 +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="xmS1GzFs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B09F688FAF; Wed, 16 Oct 2024 12:04:51 +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=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 1B16F88FF1 for ; Wed, 16 Oct 2024 12:04:46 +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-4314311959aso12676575e9.1 for ; Wed, 16 Oct 2024 03:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073085; x=1729677885; 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=vlz3ngfSd00AiIHBl1lrcajvkbsIxEryhXrcWbIeGOM=; b=xmS1GzFsiAPkfcJH/AW3oWcAVn6iuAw1Fgf4S5y1B5qdqESlpwTUPW+osuKrZ1eFgn DB6TWzkC4ay6wUls3+KfviGGrx5rjOTWhpES/vm4wduUL3Fns7erximQ/2xfySA/92YP pbredQhl5Dd1MVn0N6Djhwfm61JSJLhTPA3/0JZhOG0UEFuq2Y07QGUy6V6fLPqcGjML SBrVYhCOYVnIABFtcXHqgUF3+w6nikmoIzZuHGFImeqITk0IPmM1EpGvoPYLKUKoKwpR wP0oy5OSVOghWBAYKtoGvPP4q8foO8EM7BA+o4hra81FXy0keu4NTDJD4WUY7hDd8yh6 pmAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073085; x=1729677885; 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=vlz3ngfSd00AiIHBl1lrcajvkbsIxEryhXrcWbIeGOM=; b=WknUQyXs4BSTIJ1AN0rpi/kJZwL3MwgtLfN7tpMAtsnU0KN/F4afNETrfRGg/DXTJg Tpa65DJENzLVoNRJJVxgHSsabD9nfay7+5srs4nxpkc1I3zPD7+lqyFJqp3+97ARRLk1 bl+qbo36FF2+k/4dpEkKjUVElzJEWDSuWekB/Ztkgs7WavKdOkE4sjEeQAhOCFxPxhxx X0P5ivsdUFz5tK8zf2PCyaZCxvAOljJ7vpAyAgw4TqZ99qPjc1mhnqekqpHuH0Tc338g /9kJV0We/u3X95DNv/OtvfuE9sHEVIsA9LLINo9aDeRc33LQKKGM1YTJKh3WeLfSRTsl 4kqA== X-Gm-Message-State: AOJu0YxmgYoeLhAgNII5jcedUg5PMHXIdocrWNPGSk7Q3Mia4MlDLXZ7 oER4NxCUHhvqODr1A52PwY9Cj+G2h3rnwtc/1jDseoEwsWMpGx633GXxzaimtqN/IQ0QbablRqn DDmMq7Mmo X-Received: by 2002:a05:600c:190f:b0:431:251a:9dc9 with SMTP id 5b1f17b1804b1-431256099fdmr127017025e9.25.1729073085266; Wed, 16 Oct 2024 03:04:45 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.04.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:04:44 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Joe Hershberger , Ramon Fried , Simon Glass , Masahisa Kojima , Marek Vasut , Sean Anderson , Fabio Estevam , Matthias Schiffer , Michal Simek Subject: [PATCH v13 07/21] net: eth-uclass: add function eth_start_udev() Date: Wed, 16 Oct 2024 12:04: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 a function to start a given network device, and update eth_init() to use it. Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- include/net-common.h | 1 + net/eth-uclass.c | 38 +++++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/include/net-common.h b/include/net-common.h index 543f528a4a4..6bc76658d9d 100644 --- a/include/net-common.h +++ b/include/net-common.h @@ -192,6 +192,7 @@ int eth_env_set_enetaddr_by_index(const char *base_name, int index, int usb_ether_init(void); int eth_init(void); /* Initialize the device */ +int eth_start_udev(struct udevice *dev); /* ->start() if not already running */ int eth_send(void *packet, int length); /* Send a packet */ #if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER) int eth_receive(void *packet, int length); /* Receive a packet*/ diff --git a/net/eth-uclass.c b/net/eth-uclass.c index e34d7af0229..5555f82f23e 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -284,6 +284,27 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op, } U_BOOT_ENV_CALLBACK(ethaddr, on_ethaddr); +int eth_start_udev(struct udevice *dev) +{ + struct eth_device_priv *priv = dev_get_uclass_priv(dev); + int ret; + + if (priv->running) + return 0; + + if (!device_active(dev)) + return -EINVAL; + + ret = eth_get_ops(dev)->start(dev); + if (ret < 0) + return ret; + + priv->state = ETH_STATE_ACTIVE; + priv->running = true; + + return 0; +} + int eth_init(void) { struct udevice *current = NULL; @@ -328,20 +349,11 @@ int eth_init(void) if (current) { debug("Trying %s\n", current->name); - if (device_active(current)) { - ret = eth_get_ops(current)->start(current); - if (ret >= 0) { - struct eth_device_priv *priv = - dev_get_uclass_priv(current); - - priv->state = ETH_STATE_ACTIVE; - priv->running = true; - ret = 0; - goto end; - } - } else { + ret = eth_start_udev(current); + if (ret < 0) ret = eth_errno; - } + else + break; debug("FAIL\n"); } else { From patchwork Wed Oct 16 10:04: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: 835795 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346327wru; Wed, 16 Oct 2024 03:05:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXJgbOAi7jA+bYS+osG8Y/8v6gDvUnYs199ae1h2CgcelmtWQDamYVlBahDkLf8G5gmraYmCw==@linaro.org X-Google-Smtp-Source: AGHT+IHvGm7kfOqws4VqFP+zd1HGdkdDVpYPbkatIldbcuJ1CFAdoH/ARC3iAXaGVcCGP9piyES5 X-Received: by 2002:a05:6602:1489:b0:835:4d07:9d46 with SMTP id ca18e2360f4ac-8379531e3f3mr1691249239f.15.1729073114437; Wed, 16 Oct 2024 03:05:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073114; cv=none; d=google.com; s=arc-20240605; b=NToaDnLaowqLfiig0YT+O5ptJQT4D4ZrLEOSwuXlAPUE/A0/mjECDCekYqVlk27djq Ek5cimDTHGQzgobPNnKaO5TnJCu8So3otoqJaGtiHHKjplc+RBvZy/9eo+iCyL8euVUK /rvZnMVPMKLiURg1scXFxjhuIrOi/HKUHIYgMRe5OF5NXdcQZLCCuSKpIJOLMOwYr9D7 CB/GXY1S5B68TFnr87ylfYM11eAW2m80wwgJyxaF7gf/PQ7ZdxuhNkyEBR1DHhUIe4Qs 3X1dhr0DgFdVnKqs0vtJO9uz/60qCTJkZn36EG4FDxUVtRvJUsnLyQZn6C/d5Ob6PGca QTAA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QcWim4LixNwlRjam6hi62awJG2tnYTTlG73yHuvVCwU=; fh=LgQ1tr75+GJ1vtX/spwosuVheCeemrNo1/slLRFrgtQ=; b=f5CS8R4jjfOzR8JR0ioPLubxlKXHPwPbq4bI1BA9dF+DV0j8UIhyuMc5bSt57rmzLu FKoF3EgR/X7dfQ0qFOJsL2M3xWD6b3f9FZVPdsABjg+OqQOYM4VNntzWNr1etnb4DRPQ WvAlX5pUnNIz4+tlohkfjKRu9NCoMBq3jqaHuoZi9fJY9Lz+tSm7PdtxVe8UbFP4S3dW P62YTv9BGoFfaOjkC7IpgvTJlbM+NokDUEQWN8brq6+WIdjVIctaPcmPMAMtDzRyEejy zgZaIZxyCyiWtU8IqUjEEv7sfo68o1DyMHs/8MvExx6XWnUzM45zsrdNAJeaIgKvVgyZ 50pg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FaUb/7Yv"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 8926c6da1cb9f-4dbecc674aasi1518070173.85.2024.10.16.03.05.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:14 -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="FaUb/7Yv"; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 244B688FF6; Wed, 16 Oct 2024 12:04:55 +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="FaUb/7Yv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9212C88FCF; Wed, 16 Oct 2024 12:04:52 +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-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 A8EF388FAC for ; Wed, 16 Oct 2024 12:04:48 +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-43152b79d25so3593465e9.1 for ; Wed, 16 Oct 2024 03:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073088; x=1729677888; 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=QcWim4LixNwlRjam6hi62awJG2tnYTTlG73yHuvVCwU=; b=FaUb/7YvbjjErz83mqBfzrkf5ibrSnpZQiemG4oHf/frJYFOo3pSf2pMme7FKyuyVD lWumDBrTM0BO2IoWbZ+s5fonF8NVFAVnsZJQYBM6srCKYwQP52W6uusJytVsORUEc2tO QRCM4dgsgkP3VyyWawKiFBAW6hoU9qmLZBO8f62+068bfJWjX+VpSufZbCc21o9czU+u SVipXkrQwKJQXVzcZ1Ex5NGMQvbSkmk3eYMH788Qf5vqlUfMX3JHsyiyAWAxhD68wPvV UHCYeywssrQrRhC1UPCyE51rB1CSdgmxTHDfcJ+PK3Ep/EZhpR/LAATvhheQb08zPdob pMXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073088; x=1729677888; 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=QcWim4LixNwlRjam6hi62awJG2tnYTTlG73yHuvVCwU=; b=VIwLfPEPOw/WJlczrIxe9B/5MP7ybcRnASopqeG5mNgdiG+fw1Hy/XyQT31ZGMzpB9 xpgz5ReRMYOmKW/waWfhADGmUmZqQTSLAby5ZKMxJuzdS/hTR9gh0C6DnmffNYXjsqYU XgMLOQHTF6ZaSmrmFWsa3cx38dNtP5LLVQq0FGlT4IT/hla22thB/yp2Bj+I2EyQa8Lz Hk/R6bBX+TEDdfk9x6sJOmSp2pftQTr9+nZgMkiGip943iPuBywB33GH/9oex+43TTOG xN6hqKif+fZfQN2fdXE0rEt0N7qic4NJqgYqvtCd9MjFbAL3P53kLkV2de8QWzAKTq31 U6qQ== X-Gm-Message-State: AOJu0Ywp52RdLB5/0e+OK5Bk/giDznjhQsVL9tpbXhd82A0WFc4oum6S jMHKN8M8+f1stUCjRxwwWBQZtXvBf1TXwCRLlF+l7th26eslhRxh1x5RAqSs8r7fmXC6R2fT2CW mpEGH9SX/ X-Received: by 2002:a05:600c:4f08:b0:42c:b950:680a with SMTP id 5b1f17b1804b1-4311df13433mr139685665e9.20.1729073087836; Wed, 16 Oct 2024 03:04:47 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:04:47 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Simon Glass , Sughosh Ganu Subject: [PATCH v13 08/21] net: lwip: build lwIP Date: Wed, 16 Oct 2024 12:04:02 +0200 Message-Id: <1ee0e687f79d6f5871dc9fa84961f9a5a662afe1.1729070678.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. The lwIP stack needs to be added as a Git subtree with the following command: $ git subtree add --squash --prefix lib/lwip/lwip \ https://github.com/lwip-tcpip/lwip.git STABLE-2_2_0_RELEASE Signed-off-by: Jerome Forissier Co-developed-by: Maxim Uvarov Cc: Maxim Uvarov Acked-by: Ilias Apalodimas --- lib/Makefile | 2 + lib/lwip/Makefile | 55 +++++++++++ lib/lwip/u-boot/arch/cc.h | 45 +++++++++ lib/lwip/u-boot/arch/sys_arch.h | 0 lib/lwip/u-boot/limits.h | 0 lib/lwip/u-boot/lwipopts.h | 157 ++++++++++++++++++++++++++++++++ 6 files changed, 259 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 3fc428cff1d..dbcfa87ebd6 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -99,6 +99,8 @@ obj-$(CONFIG_$(PHASE_)OF_REAL) += fdtdec_common.o fdtdec.o obj-$(CONFIG_MBEDTLS_LIB) += mbedtls/ +obj-$(CONFIG_NET_LWIP) += lwip/ + ifdef CONFIG_XPL_BUILD obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16-ccitt.o obj-$(CONFIG_$(PHASE_)HASH) += crc16-ccitt.o diff --git a/lib/lwip/Makefile b/lib/lwip/Makefile new file mode 100644 index 00000000000..dfcd700ca47 --- /dev/null +++ b/lib/lwip/Makefile @@ -0,0 +1,55 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2024 Linaro Ltd. + +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..563d3bfa98b --- /dev/null +++ b/lib/lwip/u-boot/arch/cc.h @@ -0,0 +1,45 @@ +/* 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()) +#else +#define LWIP_DNS_SECURE 0 +#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, c) strstr(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..9d618625fac --- /dev/null +++ b/lib/lwip/u-boot/lwipopts.h @@ -0,0 +1,157 @@ +/* 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 +#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 8 + +#define MEMP_NUM_TCP_SEG 16 +#define PBUF_POOL_SIZE 8 + +#define LWIP_ARP 1 +#define ARP_TABLE_SIZE 4 +#define ARP_QUEUEING 1 + +#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 +#define TCP_MSS 1460 +#define TCP_WND CONFIG_LWIP_TCP_WND +#define LWIP_WND_SCALE 1 +#define TCP_RCV_SCALE 0x7 +#define TCP_SND_BUF (2 * TCP_MSS) +#ifdef CONFIG_PROT_TCP_SACK_LWIP +#define LWIP_TCP_SACK_OUT 1 +#endif +#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 Wed Oct 16 10:04: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: 835809 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp433590wru; Wed, 16 Oct 2024 06:33:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUAHxIK/+3AWLl3baIh5q2mZKEzWKCx7f1EpcdzKYAninrqK3hudgjY0a8d05kYl3OqaCMjOQ==@linaro.org X-Google-Smtp-Source: AGHT+IEBR34kZP9zwrGKTKPA4IIA+mF/mVGRA+Ij/EEn5CZyXHETq+b+cm2mMWy2F+1uSetTMgLA X-Received: by 2002:a05:6e02:2167:b0:3a3:9801:b668 with SMTP id e9e14a558f8ab-3a3bcdccca0mr115190185ab.15.1729085633091; Wed, 16 Oct 2024 06:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729085633; cv=none; d=google.com; s=arc-20240605; b=lITGTIro6wZyI4lceUJYLom3sYYHNVzKApZRuEq8MwolSmqMj6E4wKvkU5dy2sIUVp LopzXChLHMjfKAcs/IDjg6baBblchgjlp9W9HApfvbkdPE8P40vkSm1kp5m9Hu7PDQE2 QaJa7BL2FVSboPK7MjDU9DOzvjV6Z2RUd4TvKYY/2tEIU/uimz6QMYm0jv4+i4ga/Qqt a98R2QnUFkYzbh8DJZaQLxkML+hAssO+LNyJtVS3t78th65c75BLcalTAR+sQ/F9F+EM wRmg2fPuyNqMDOBqku7wzeMgVw/3c7dxPEQOe8Sel4dTW2qrfNxnoK2kPmNDBYLE7yda zRMg== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lsMAHOHHZRi/aHl47rJpZjLPq4/Y1PUWpeND0mSAp90=; fh=bEP/XWusuQO8GKW4uv8FWNZ/tIwyliU2o7pFmLpeBr0=; b=L2yLhwcccBL2E+sjY8Hb9L4XRvKRAiWltz3C1RyLuWjAr3GCxez3dukhf9RWpBg6QV hds1SljHaYNFkUeLpspRol9F2UQkxznrCFz8nYTdbVrNPSYPkDvsET2zmMW+OICYPFop Tl+rpqy+Y3fVmNZVFsTupqKj9E9Lo8syUlwPajWfdxFUE9JhscuG7rNPwcUttpgxs6EI JaA7nNyBf/1fEgmy93xvEh0XjHTOLGo/MNnlAYZH/0v/LTfsYDBJ0NjDntt8GXGPCBJR O8Hn8AkOVsei//mdH6WvdKHMKt9KAirKGPWmwn4G8sK1kHRP2ubFXt+Lm3IGE64lTboX po8A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vWf+EHpn; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 8926c6da1cb9f-4dbecb3833dsi1857856173.32.2024.10.16.06.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 06:33:53 -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=vWf+EHpn; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B8AF988DDC; Wed, 16 Oct 2024 15:33: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="vWf+EHpn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DD97D89003; Wed, 16 Oct 2024 12:04: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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 06C8B88FE8 for ; Wed, 16 Oct 2024 12:04:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-430ee5c9570so75526475e9.3 for ; Wed, 16 Oct 2024 03:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073094; x=1729677894; 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=lsMAHOHHZRi/aHl47rJpZjLPq4/Y1PUWpeND0mSAp90=; b=vWf+EHpnzKDL5l9N1WMW0SQGGfPUOpVTT2/y8QZSHC1PJkAsillXKvkrU+2STfsuIa 9uc3+xk4JKMgNX6g1Nnx/xSZNRpGI3FXoV933OaGg5jaZDZrwEDEm38N/3o202ClJdVc bfKBBQ820gHvIH3Z4UvAVlLmt/t/zxUbTeSFR8QNJsSqhr6hV/FfbCoiv2OZiroJfWWc /7xphCtv9EMyNJ/xYUXtLgP+2eSkmPQdvTKKEniVqBuia3pGs6p3dKQiEsp7UMzg6RAt VsUkeagQ3KBD/TlCq8pBUGqTVxaunv1ZT9lkmP0cVKM+gEUdV7BnT7W1FwIQRRrK+/dA vJyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073094; x=1729677894; 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=lsMAHOHHZRi/aHl47rJpZjLPq4/Y1PUWpeND0mSAp90=; b=TudK+Qpoj2RguUTzcgF/GuNk5/Kd92NetmmB72NDV+Oby05NYmbUsEN97cJt5zMAR4 Y21eTJJyoZPHkYP9nm54HnlVWLAetF2KIWMcK0Njlto8kYSEdaXP/WpoWJIwSIQZ4RVI fboK80UwJFW9bIacUslacIxST5XCK/+ebUTjYZshAYoi4Bg4Z/CUwNCxv0kwAyv3Oh6J x838R5DSYoVrn5j4XyD3IhGOYMFvYCEV4TxMv40K8rfHygSj62XGU2jy+96b/CEMM7tN fXSJ64lejxouWH0AZQ9Hrh5T29JsQt50/tJYtUeSKHgUs0vODVJpK6IxvbNSSGY/qxqy rs1w== X-Gm-Message-State: AOJu0YzQGWQN6mz55ttXcduI43cmvC0aVqQAtnJU122Rse86eL/vLMuQ GKzEcB7V2vMrKW+7Qa7k2x5QfTzeoc1qoaKjz8AQyELZfiuBCQFrwdi1FGpuKOnDsw+MRFAVGqn QuhLd+C3V X-Received: by 2002:a05:600c:4fd3:b0:431:54f3:11ab with SMTP id 5b1f17b1804b1-43154f3151amr5850085e9.33.1729073093925; Wed, 16 Oct 2024 03:04:53 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:04:53 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Manoj Sai , Matteo Lisi , Tom Rini , Gilles Talis , Michal Simek , Marek Vasut , Joe Hershberger , Ramon Fried , Peng Fan , Simon Glass , Nishanth Menon , Sughosh Ganu , Padmarao Begari , James Hilliard , Venkatesh Yadav Abbarapu , Petr Zejdl , Mattijs Korpershoek , Heinrich Schuchardt , AKASHI Takahiro , Francis Laniel , Maxim Moskalets , Daniel Palmer , Artur Rojek , Rasmus Villemoes , Christian Marangi , Janne Grunau , Neal Gompa , Yang Xiwen , Peter Robinson , Gabor Juhos , Philip Oberfichtner , Neil Armstrong , Boon Khai Ng , Robert Marko , Masahisa Kojima , Sean Anderson Subject: [PATCH v13 09/21] net: lwip: add DHCP support and dhcp commmand Date: Wed, 16 Oct 2024 12:04:03 +0200 Message-Id: <1c29b962ebe40fcb33b7c192a648ac86818f53b2.1729070678.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: Wed, 16 Oct 2024 15:33:18 +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. CMD_TFTPBOOT is selected by BOOTMETH_EFI due to this code having an implicit dependency on do_tftpb(). Note that PXE is likely non-fonctional with NET_LWIP (or at least not 100% functional) because DHCP option 209 is not supported by the lwIP library. Therefore, BOOTP_PXE_DHCP_OPTION cannot be enabled. Signed-off-by: Jerome Forissier Tested-by: Ilias Apalodimas Acked-by: Ilias Apalodimas --- board/engicam/imx8mp/icore_mx8mp.c | 2 +- .../imx8mp_debix_model_a.c | 2 +- board/ti/am335x/board.c | 3 +- board/xilinx/common/board.c | 3 +- cmd/Kconfig | 100 +++--- cmd/Makefile | 6 +- cmd/elf.c | 2 +- cmd/net-lwip.c | 13 + common/board_r.c | 4 +- common/usb_kbd.c | 2 +- drivers/net/Kconfig | 2 +- include/net-common.h | 3 + include/net-legacy.h | 3 - include/net-lwip.h | 3 + lib/tiny-printf.c | 3 +- net/Makefile | 14 +- net/lwip/Makefile | 5 + net/lwip/dhcp.c | 130 ++++++++ net/lwip/eth_internal.h | 35 +++ net/lwip/net-lwip.c | 289 ++++++++++++++++++ net/lwip/tftp.c | 11 + 21 files changed, 573 insertions(+), 62 deletions(-) create mode 100644 cmd/net-lwip.c 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/board/engicam/imx8mp/icore_mx8mp.c b/board/engicam/imx8mp/icore_mx8mp.c index e2ed70caa43..bfdc447c478 100644 --- a/board/engicam/imx8mp/icore_mx8mp.c +++ b/board/engicam/imx8mp/icore_mx8mp.c @@ -33,7 +33,7 @@ static void setup_fec(void) setbits_le32(&gpr->gpr[1], BIT(22)); } -#if CONFIG_IS_ENABLED(NET) +#if CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP) int board_phy_config(struct phy_device *phydev) { if (phydev->drv->config) diff --git a/board/polyhex/imx8mp_debix_model_a/imx8mp_debix_model_a.c b/board/polyhex/imx8mp_debix_model_a/imx8mp_debix_model_a.c index 112770ba493..c709d017483 100644 --- a/board/polyhex/imx8mp_debix_model_a/imx8mp_debix_model_a.c +++ b/board/polyhex/imx8mp_debix_model_a/imx8mp_debix_model_a.c @@ -29,7 +29,7 @@ static void setup_fec(void) setbits_le32(&gpr->gpr[1], BIT(22)); } -#if CONFIG_IS_ENABLED(NET) +#if CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP) int board_phy_config(struct phy_device *phydev) { if (phydev->drv->config) diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 720bf2cb3e1..774ef7ac5e3 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -900,7 +900,8 @@ int board_late_init(void) #endif /* CPSW plat */ -#if CONFIG_IS_ENABLED(NET) && !CONFIG_IS_ENABLED(OF_CONTROL) +#if (CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP)) && \ + !CONFIG_IS_ENABLED(OF_CONTROL) struct cpsw_slave_data slave_data[] = { { .slave_reg_ofs = CPSW_SLAVE0_OFFSET, diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 68f401e4b34..38dd80533fa 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -491,7 +491,8 @@ int board_late_init_xilinx(void) ret |= env_set_by_index("uuid", id, uuid); } - if (!CONFIG_IS_ENABLED(NET)) + if (!(CONFIG_IS_ENABLED(NET) || + CONFIG_IS_ENABLED(NET_LWIP))) continue; for (i = 0; i < EEPROM_HDR_NO_OF_MAC_ADDR; i++) { diff --git a/cmd/Kconfig b/cmd/Kconfig index 6d20d7597cb..211be398937 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1789,12 +1789,16 @@ config CMD_AB_SELECT endmenu -if NET +if NET || NET_LWIP menuconfig CMD_NET bool "Network commands" default y +endif + +if NET + if CMD_NET config CMD_BOOTP @@ -1803,12 +1807,6 @@ config CMD_BOOTP help bootp - boot image via network using BOOTP/TFTP protocol -config CMD_DHCP - bool "dhcp" - depends on CMD_BOOTP - help - Boot image via network using DHCP/TFTP protocol - config CMD_DHCP6 bool "dhcp6" depends on IPV6 @@ -1952,12 +1950,6 @@ config BOOTP_VCI_STRING default "U-Boot.arm" if ARM default "U-Boot" -config CMD_TFTPBOOT - bool "tftpboot" - default y - help - tftpboot - load file via network using TFTP protocol - config CMD_TFTPPUT bool "tftp put" depends on CMD_TFTPBOOT @@ -2017,29 +2009,6 @@ config CMD_WGET wget is a simple command to download kernel, or other files, from a http server over TCP. -config CMD_MII - bool "mii" - imply CMD_MDIO - help - If set, allows 802.3(clause 22) MII Management functions interface access - The management interface specified in Clause 22 provides - a simple, two signal, serial interface to connect a - Station Management entity and a managed PHY for providing access - to management parameters and services. - The interface is referred to as the MII management interface. - -config MII_INIT - bool "Call mii_init() in the mii command" - depends on CMD_MII && (MPC8XX_FEC || FSLDMAFE || MCFFEC) - -config CMD_MDIO - bool "mdio" - depends on PHYLIB - help - If set, allows Enable 802.3(clause 45) MDIO interface registers access - The MDIO interface is orthogonal to the MII interface and extends - it by adding access to more registers through indirect addressing. - config CMD_PING bool "ping" help @@ -2088,7 +2057,7 @@ config IPV6_ROUTER_DISCOVERY help Will automatically perform router solicitation on first IPv6 network operation -endif +endif # if CMD_NET config CMD_ETHSW bool "ethsw" @@ -2098,6 +2067,56 @@ config CMD_ETHSW operations such as enabling / disabling a port and viewing/maintaining the filtering database (FDB) +config CMD_WOL + bool "wol" + help + Wait for wake-on-lan Magic Packet + +endif # if NET + +if NET || NET_LWIP + +if CMD_NET + +config CMD_DHCP + bool "dhcp" + select PROT_DHCP_LWIP if NET_LWIP + help + Boot image via network using DHCP/TFTP protocol + +config CMD_MII + bool "mii" + imply CMD_MDIO + help + If set, allows 802.3(clause 22) MII Management functions interface access + The management interface specified in Clause 22 provides + a simple, two signal, serial interface to connect a + Station Management entity and a managed PHY for providing access + to management parameters and services. + The interface is referred to as the MII management interface. + +config MII_INIT + bool "Call mii_init() in the mii command" + depends on CMD_MII && (MPC8XX_FEC || FSLDMAFE || MCFFEC) + +config CMD_MDIO + bool "mdio" + depends on PHYLIB + help + If set, allows Enable 802.3(clause 45) MDIO interface registers access + The MDIO interface is orthogonal to the MII interface and extends + it by adding access to more registers through indirect addressing. + +config CMD_TFTPBOOT + bool "tftp" + select PROT_UDP_LWIP if NET_LWIP + default n + help + tftpboot - load file via network using TFTP protocol + Currently a placeholder (not implemented) when NET_LWIP=y. + +endif # if CMD_NET + config CMD_PXE bool "pxe" select PXE_UTILS @@ -2105,12 +2124,7 @@ config CMD_PXE help Boot image via network using PXE protocol -config CMD_WOL - bool "wol" - help - Wait for wake-on-lan Magic Packet - -endif +endif # if NET || NET_LWIP menu "Misc commands" diff --git a/cmd/Makefile b/cmd/Makefile index 21d376309b9..94a3df41c6f 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -127,7 +127,11 @@ obj-y += legacy-mtd-utils.o endif obj-$(CONFIG_CMD_MUX) += mux.o obj-$(CONFIG_CMD_NAND) += nand.o -obj-$(CONFIG_CMD_NET) += net.o +ifdef CONFIG_CMD_NET +obj-$(CONFIG_NET) += net.o +obj-$(CONFIG_NET_LWIP) += net-lwip.o +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/elf.c b/cmd/elf.c index 114f2caf7fa..6b49c613703 100644 --- a/cmd/elf.c +++ b/cmd/elf.c @@ -133,7 +133,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) else addr = hextoul(argv[1], NULL); -#if defined(CONFIG_CMD_NET) +#if defined(CONFIG_CMD_NET) && !defined(CONFIG_NET_LWIP) /* * Check to see if we need to tftp the image ourselves * before starting diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c new file mode 100644 index 00000000000..82edb5fd2e6 --- /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 1acad069d92..e5f33f40643 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -484,7 +484,7 @@ static int initr_boot_led_on(void) return 0; } -#ifdef CONFIG_CMD_NET +#if defined(CONFIG_CMD_NET) static int initr_net(void) { puts("Net: "); @@ -749,7 +749,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) INIT_FUNC_WATCHDOG_RESET initr_net, #endif diff --git a/common/usb_kbd.c b/common/usb_kbd.c index bbfee23bc26..36107a3b278 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -423,7 +423,7 @@ static int usb_kbd_testc(struct stdio_dev *sdev) */ unsigned long poll_delay = CONFIG_SYS_HZ / 50; -#ifdef CONFIG_CMD_NET +#if defined(CONFIG_CMD_NET) && !defined(CONFIG_NET_LWIP) /* * If net_busy_flag is 1, NET transfer is running, * then we check key-pressed every second (first check may be diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index fa6fc1cb8e4..89f7411bdf3 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -97,7 +97,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-common.h b/include/net-common.h index 6bc76658d9d..cbcac178c82 100644 --- a/include/net-common.h +++ b/include/net-common.h @@ -118,6 +118,9 @@ extern int net_restart_wrap; /* Tried all network devices */ extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */ extern const u8 net_bcast_ethaddr[ARP_HLEN]; /* Ethernet broadcast address */ extern char net_boot_file_name[1024];/* Boot File name */ +extern struct in_addr net_ip; /* Our IP addr (0 = unknown) */ +/* Indicates whether the pxe path prefix / config file was specified in dhcp option */ +extern char *pxelinux_configfile; /** * compute_ip_checksum() - Compute IP checksum diff --git a/include/net-legacy.h b/include/net-legacy.h index ed286e3d326..ca1efd17af7 100644 --- a/include/net-legacy.h +++ b/include/net-legacy.h @@ -285,12 +285,9 @@ extern char net_hostname[32]; /* Our hostname */ #ifdef CONFIG_NET extern char net_root_path[CONFIG_BOOTP_MAX_ROOT_PATH_LEN]; /* Our root path */ #endif -/* Indicates whether the pxe path prefix / config file was specified in dhcp option */ -extern char *pxelinux_configfile; /** END OF BOOTP EXTENTIONS **/ extern u8 net_ethaddr[ARP_HLEN]; /* Our ethernet address */ extern u8 net_server_ethaddr[ARP_HLEN]; /* Boot server enet address */ -extern struct in_addr net_ip; /* Our IP addr (0 = unknown) */ extern struct in_addr net_server_ip; /* Server IP addr (0 = unknown) */ extern uchar *net_tx_packet; /* THE transmit packet */ extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */ diff --git a/include/net-lwip.h b/include/net-lwip.h index 5c3f9e7e86c..cfd06726577 100644 --- a/include/net-lwip.h +++ b/include/net-lwip.h @@ -10,5 +10,8 @@ struct netif *net_lwip_new_netif(struct udevice *udev); struct netif *net_lwip_new_netif_noip(struct udevice *udev); void net_lwip_remove_netif(struct netif *netif); struct netif *net_lwip_get_netif(void); +int net_lwip_rx(struct udevice *udev, struct netif *netif); + +int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); #endif /* __NET_LWIP_H__ */ diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c index 64dee779c4a..cc1dfe61cf7 100644 --- a/lib/tiny-printf.c +++ b/lib/tiny-printf.c @@ -269,7 +269,8 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va) } break; case 'p': - if (CONFIG_IS_ENABLED(NET) || _DEBUG) { + if (CONFIG_IS_ENABLED(NET) || + CONFIG_IS_ENABLED(NET_LWIP) || _DEBUG) { pointer(info, fmt, va_arg(va, void *)); /* * Skip this because it pulls in _ctype which is diff --git a/net/Makefile b/net/Makefile index 34fe50133a3..209377aeb26 100644 --- a/net/Makefile +++ b/net/Makefile @@ -12,11 +12,6 @@ obj-$(CONFIG_CMD_BOOTP) += bootp.o obj-$(CONFIG_CMD_CDP) += cdp.o obj-$(CONFIG_CMD_DNS) += dns.o obj-$(CONFIG_DM_DSA) += dsa-uclass.o -obj-$(CONFIG_$(XPL_)DM_ETH) += eth-uclass.o -obj-$(CONFIG_$(PHASE_)BOOTDEV_ETH) += eth_bootdev.o -obj-$(CONFIG_DM_MDIO) += mdio-uclass.o -obj-$(CONFIG_DM_MDIO_MUX) += mdio-mux-uclass.o -obj-$(CONFIG_$(XPL_)DM_ETH) += eth_common.o obj-$(CONFIG_CMD_LINK_LOCAL) += link_local.o obj-$(CONFIG_IPV6) += ndisc.o obj-$(CONFIG_$(XPL_)DM_ETH) += net.o @@ -43,4 +38,13 @@ CFLAGS_eth_common.o += -Wno-format-extra-args endif +ifeq ($(filter y,$(CONFIG_NET) $(CONFIG_NET_LWIP)),y) +obj-$(CONFIG_$(XPL_)DM_ETH) += eth-uclass.o +obj-$(CONFIG_$(PHASE_)BOOTDEV_ETH) += eth_bootdev.o +obj-$(CONFIG_DM_MDIO) += mdio-uclass.o +obj-$(CONFIG_DM_MDIO_MUX) += mdio-mux-uclass.o +obj-$(CONFIG_$(XPL_)DM_ETH) += eth_common.o obj-y += net-common.o +endif + +obj-$(CONFIG_NET_LWIP) += lwip/ diff --git a/net/lwip/Makefile b/net/lwip/Makefile new file mode 100644 index 00000000000..4e92a101ddb --- /dev/null +++ b/net/lwip/Makefile @@ -0,0 +1,5 @@ +ccflags-y += -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot + +obj-$(CONFIG_$(SPL_)DM_ETH) += net-lwip.o +obj-$(CONFIG_CMD_DHCP) += dhcp.o +obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o diff --git a/net/lwip/dhcp.c b/net/lwip/dhcp.c new file mode 100644 index 00000000000..a2cc25d88f5 --- /dev/null +++ b/net/lwip/dhcp.c @@ -0,0 +1,130 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024 Linaro Ltd. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DHCP_TIMEOUT_MS 10000 + +#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(); + sys_timeout(10, call_lwip_dhcp_fine_tmr, NULL); +} + +static int dhcp_loop(struct udevice *udev) +{ + char *ipstr = "ipaddr\0\0"; + char *maskstr = "netmask\0\0"; + char *gwstr = "gatewayip\0\0"; + unsigned long start; + struct netif *netif; + struct dhcp *dhcp; + bool bound; + int idx; + + idx = dev_seq(udev); + if (idx < 0 || idx > 99) { + log_err("unexpected idx %d\n", idx); + return CMD_RET_FAILURE; + } + + netif = net_lwip_new_netif_noip(udev); + if (!netif) + return CMD_RET_FAILURE; + + start = get_timer(0); + + if (dhcp_start(netif)) + return CMD_RET_FAILURE; + + call_lwip_dhcp_fine_tmr(NULL); + + /* Wait for DHCP to complete */ + do { + net_lwip_rx(udev, netif); + sys_check_timeouts(); + bound = dhcp_supplied_address(netif); + if (bound) + break; + if (ctrlc()) { + printf("Abort\n"); + break; + } + mdelay(1); + } while (get_timer(start) < DHCP_TIMEOUT_MS); + + sys_untimeout(call_lwip_dhcp_fine_tmr, NULL); + + if (!bound) { + net_lwip_remove_netif(netif); + return CMD_RET_FAILURE; + } + + dhcp = netif_dhcp_data(netif); + + env_set("bootfile", dhcp->boot_file_name); + + if (idx > 0) { + sprintf(ipstr, "ipaddr%d", idx); + sprintf(maskstr, "netmask%d", idx); + sprintf(gwstr, "gatewayip%d", idx); + } else { + net_ip.s_addr = dhcp->offered_ip_addr.addr; + } + + env_set(ipstr, ip4addr_ntoa(&dhcp->offered_ip_addr)); + env_set(maskstr, ip4addr_ntoa(&dhcp->offered_sn_mask)); + env_set("serverip", ip4addr_ntoa(&dhcp->server_ip_addr)); + if (dhcp->offered_gw_addr.addr != 0) + env_set(gwstr, ip4addr_ntoa(&dhcp->offered_gw_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)); + + net_lwip_remove_netif(netif); + return CMD_RET_SUCCESS; +} + +int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + eth_set_current(); + + return dhcp_loop(eth_get_dev()); +} + +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..3b08ffe3b74 --- /dev/null +++ b/net/lwip/net-lwip.c @@ -0,0 +1,289 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* Copyright (C) 2024 Linaro Ltd. */ + +#include +#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) * PKTSIZE_ALIGN + PKTALIGN]; +uchar *net_rx_packets[PKTBUFSRX]; +uchar *net_rx_packet; +const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +char *pxelinux_configfile; +/* Our IP addr (0 = unknown) */ +struct in_addr net_ip; + +static err_t linkoutput(struct netif *netif, struct pbuf *p) +{ + struct udevice *udev = netif->state; + void *pp = NULL; + int err; + + if ((unsigned long)p->payload % PKTALIGN) { + /* + * Some net drivers have strict alignment requirements and may + * fail or output invalid data if the packet is not aligned. + */ + pp = memalign(PKTALIGN, p->len); + if (!pp) + return ERR_ABRT; + memcpy(pp, p->payload, p->len); + } + + err = eth_get_ops(udev)->send(udev, pp ? pp : p->payload, p->len); + free(pp); + if (err) { + log_err("send error %d\n", err); + return ERR_ABRT; + } + + return ERR_OK; +} + +static err_t net_lwip_if_init(struct netif *netif) +{ + netif->output = etharp_output; + netif->linkoutput = linkoutput; + netif->mtu = 1500; + netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP; + + return ERR_OK; +} + +static void eth_init_rings(void) +{ + int i; + + for (i = 0; i < PKTBUFSRX; i++) + net_rx_packets[i] = net_pkt_buf + i * PKTSIZE_ALIGN; +} + +struct netif *net_lwip_get_netif(void) +{ + struct netif *netif, *found = NULL; + + NETIF_FOREACH(netif) { + if (!found) + found = netif; + else + printf("Error: more than one netif in lwIP\n"); + } + return found; +} + +static int get_udev_ipv4_info(struct udevice *dev, ip4_addr_t *ip, + ip4_addr_t *mask, ip4_addr_t *gw) +{ + char *ipstr = "ipaddr\0\0"; + char *maskstr = "netmask\0\0"; + char *gwstr = "gatewayip\0\0"; + int idx = dev_seq(dev); + char *env; + + if (idx < 0 || idx > 99) { + log_err("unexpected idx %d\n", idx); + return -1; + } + + if (idx) { + sprintf(ipstr, "ipaddr%d", idx); + sprintf(maskstr, "netmask%d", idx); + sprintf(gwstr, "gatewayip%d", idx); + } + + ip4_addr_set_zero(ip); + ip4_addr_set_zero(mask); + ip4_addr_set_zero(gw); + + env = env_get(ipstr); + if (env) + ip4addr_aton(env, ip); + + env = env_get(maskstr); + if (env) + ip4addr_aton(env, mask); + + env = env_get(gwstr); + if (env) + ip4addr_aton(env, gw); + + return 0; +} + +static struct netif *new_netif(struct udevice *udev, bool with_ip) +{ + unsigned char enetaddr[ARP_HLEN]; + char hwstr[MAC_ADDR_STRLEN]; + ip4_addr_t ip, mask, gw; + struct netif *netif; + int ret = 0; + static bool first_call = true; + + if (!udev) + return NULL; + + if (first_call) { + eth_init_rings(); + /* Pick a valid active device, if any */ + eth_init(); + lwip_init(); + first_call = false; + } + + if (eth_start_udev(udev) < 0) { + log_err("Could not start %s\n", udev->name); + return NULL; + } + + netif_remove(net_lwip_get_netif()); + + ip4_addr_set_zero(&ip); + ip4_addr_set_zero(&mask); + ip4_addr_set_zero(&gw); + + if (with_ip) + if (get_udev_ipv4_info(udev, &ip, &mask, &gw) < 0) + return NULL; + + eth_env_get_enetaddr_by_index("eth", dev_seq(udev), enetaddr); + ret = snprintf(hwstr, MAC_ADDR_STRLEN, "%pM", enetaddr); + if (ret < 0 || ret >= MAC_ADDR_STRLEN) + return NULL; + + netif = calloc(1, sizeof(struct netif)); + if (!netif) + return NULL; + + netif->name[0] = 'e'; + netif->name[1] = 't'; + + string_to_enetaddr(hwstr, netif->hwaddr); + netif->hwaddr_len = ETHARP_HWADDR_LEN; + debug("adding lwIP netif for %s with hwaddr:%s ip:%s ", udev->name, + hwstr, ip4addr_ntoa(&ip)); + debug("mask:%s ", ip4addr_ntoa(&mask)); + debug("gw:%s\n", ip4addr_ntoa(&gw)); + + if (!netif_add(netif, &ip, &mask, &gw, udev, net_lwip_if_init, + netif_input)) { + printf("error: netif_add() failed\n"); + free(netif); + return NULL; + } + + netif_set_up(netif); + netif_set_link_up(netif); + /* Routing: use this interface to reach the default gateway */ + netif_set_default(netif); + + return netif; +} + +struct netif *net_lwip_new_netif(struct udevice *udev) +{ + return new_netif(udev, true); +} + +struct netif *net_lwip_new_netif_noip(struct udevice *udev) +{ + + return new_netif(udev, false); +} + +void net_lwip_remove_netif(struct netif *netif) +{ + netif_remove(netif); + free(netif); +} + +int net_init(void) +{ + eth_set_current(); + + net_lwip_new_netif(eth_get_dev()); + + return 0; +} + +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; +} + +int net_lwip_rx(struct udevice *udev, struct netif *netif) +{ + struct pbuf *pbuf; + uchar *packet; + int flags; + int len; + int i; + + if (!eth_is_active(udev)) + return -EINVAL; + + flags = ETH_RECV_CHECK_DEVICE; + for (i = 0; i < ETH_PACKETS_BATCH_RECV; i++) { + len = eth_get_ops(udev)->recv(udev, flags, &packet); + flags = 0; + + if (len > 0) { + pbuf = alloc_pbuf_and_copy(packet, len); + if (pbuf) + netif->input(pbuf, netif); + } + if (len >= 0 && eth_get_ops(udev)->free_pkt) + eth_get_ops(udev)->free_pkt(udev, packet, len); + if (len <= 0) + break; + } + if (len == -EAGAIN) + len = 0; + + return len; +} + +void net_process_received_packet(uchar *in_packet, int len) +{ +#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER) + if (push_packet) + (*push_packet)(in_packet, len); +#endif +} + +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 Wed Oct 16 10:04: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: 835797 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346457wru; Wed, 16 Oct 2024 03:05:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVDiCHync0Pw4uBOZiBiOz63W4y2G2bbcLNo4cBQKHnoxlmEkr3gRsjilu12KluLStOJr+5dw==@linaro.org X-Google-Smtp-Source: AGHT+IGaltxlVign4DPJpunGMAwoyONw7vZHMISHLyI66tJ4ammG/cJGYWDU9nJcTjPdmxgwpwZ1 X-Received: by 2002:a05:6e02:1389:b0:3a2:6d54:33df with SMTP id e9e14a558f8ab-3a3dbe7bcc1mr26377265ab.4.1729073135428; Wed, 16 Oct 2024 03:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073135; cv=none; d=google.com; s=arc-20240605; b=kSR0Fb/d0WabnZNPQUAqfUzgR7+1GjbqOCRPvH7HtJ3sJ2NuGN0U5gVZmqespZUfy4 usLSDKfr5ZKWxVQQo/33T4rUxoAV2nUXv452aX+OCkRs2SoRwD1NkUoq3ONwCBH9abJc t1tWwL7lxMuIAMyp78S6GDZ2lCpCANSSLRkNnbVOUjnU5KKAhTKR86Ee4bX+H4ipSGBo udcDUkdUhYz7U8RZkIIQUPgLIShVgza+GVuuGVb2tnOZRtlIQWSH6AgoSsWegCz2uifn dwNFQBkvJ8z2u+bxU/Up7f5p7ORcAg5epMizdjwX9L03OT6DiU8dQZuVW23AlY5Tq8fh PZMg== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=faheA9ipuCMxyKpZyBroaFBcMuTa6BH6eUOSG4QJjNo=; fh=ThdVVZAeTRhYRIsitiRafY870JZ08RRoQKK9619Vak0=; b=VAUu06mgSN8rgG0VFJH5deMlDu/5U2MtC6hY7qHtCFDtBl5f4XX9vjHh8qASLc2msu pdxsSMpNa4JABMnTnkkRAU1p4sqbxlnYAdQBT3q3CB1dSKv/qa82Tp/5kDt7rXt2wME/ 6RPFZ/35XUnpRVaFxjxhBVQ63XMOhFab57ChUHpOQxO5wWV3bA/mEMrgbdT8fPqcRFbl 58Kp0lBP/V2bCkhhtShZAYyq69H2pjz1aKms7QW5mPC5dBSmY3BZUXyuD5H21iuIISzg DCmxRfGPSL9T3/4rc7NwezdPAow5TJvAhfpLsBzDZ7EO2izGvPKXyavei+9/iQ0NvWqr g5QQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Iqcmbf1i; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 8926c6da1cb9f-4dbecce0e69si1491021173.161.2024.10.16.03.05.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:35 -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=Iqcmbf1i; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7A2EF88FED; Wed, 16 Oct 2024 12:05:05 +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="Iqcmbf1i"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9ABB68900B; Wed, 16 Oct 2024 12:05:03 +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-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) (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 48FCC88FF1 for ; Wed, 16 Oct 2024 12:04: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-lf1-x12a.google.com with SMTP id 2adb3069b0e04-539f8490856so3392520e87.2 for ; Wed, 16 Oct 2024 03:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073095; x=1729677895; 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=faheA9ipuCMxyKpZyBroaFBcMuTa6BH6eUOSG4QJjNo=; b=Iqcmbf1iKDzvEvw/v8jhyQRJ090j9hxCOjyg8nX4rxF89o1kwSG7Z6g7E5H5zOqeH9 C0/a68sd6erL7iGPfn3bfQpmxgq/E/aZCuQqwPG29Y4qVQlOQikrONvOO893r+lUVF9p f1wWgISPWlQAe+YARKVnd3xWfeN8ThqGmFeQP0gj6drITkyQ1VYWArTHVg9BT3cEx6nD Df8EGnzQDgifvcdHv/VxmbrX2jYKufGNt33MauYREnQbrxr2UutcF+JkKqz4a89KcSyh xO8FLbw4cUV4NzTKI35f/rEFdS/cXn8jBbQuKGGAKw90w/RcaK7FLvJSDxihN/mabWed BP1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073095; x=1729677895; 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=faheA9ipuCMxyKpZyBroaFBcMuTa6BH6eUOSG4QJjNo=; b=ViclFH3Idnq9l9KTCaeUI0w4KTtWnQ5YtGatDG3qFUfTVKQ/fF0ONo8UzwRzQm/UTY EAnj6nXl17x2LtFkn4sbIvhi/KoUL9nRyyRh/XfphVh3A4nsJ7OssOfOX5yICbJ9u0j0 xfVggMoWujrf5o5+YxyjNiR5hkHh7LAlEVChXOTY7QB0NoGzyudyMEwycRYpZg3iWeYn 6L3fmBNedB9DdaFLaC/s8AiRpkE0Ze9rBiFCzbsaTzlMahZPTKDLY7DeG3A8eEuzcKGX St9lUeG4koApo1tlzhyYkUROqZTb6QlZw70S41RYrH8o6u+1cqGYlK7PuETems4LC90H DByQ== X-Gm-Message-State: AOJu0YzjFeXPBPDIEWSGVC8TCfvKOnGqFzIAKG2zOILcoFX34cLUBgBG Ny0YbbUrykGOjINM2uPxe6XarhvFxm/G2wU1H0tHX8/cdJ8Q7hmGbxaEL4MWhr1yeLF9BRLQGy9 5Xb6oqbQW X-Received: by 2002:a05:6512:114f:b0:535:6992:f2cb with SMTP id 2adb3069b0e04-539da586e45mr8919786e87.42.1729073095199; Wed, 16 Oct 2024 03:04:55 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:04:54 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini Subject: [PATCH v13 10/21] net: lwip: tftp: bind to TFTP port only when in server mode Date: Wed, 16 Oct 2024 12:04:04 +0200 Message-Id: <5484ceb32b3ddbe7cafd997a45cfddec5c8acbbd.1729070678.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 The TFTP app should not bind to the TFTP server port when configured as a client. Instead, the local port should be chosen from the dynamic range (49152 ~ 65535) so that if the application is stopped and started again, the remote server will not consider the new packets as part of the same context (which would cause an error since a new RRQ would be unexpected). Submitted upstream: https://savannah.nongnu.org/patch/?10480 Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- lib/lwip/lwip/src/apps/tftp/tftp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/lwip/lwip/src/apps/tftp/tftp.c b/lib/lwip/lwip/src/apps/tftp/tftp.c index ddfdbfc0c1b..74fc1fbe586 100644 --- a/lib/lwip/lwip/src/apps/tftp/tftp.c +++ b/lib/lwip/lwip/src/apps/tftp/tftp.c @@ -454,10 +454,12 @@ tftp_init_common(u8_t mode, const struct tftp_context *ctx) return ERR_MEM; } - ret = udp_bind(pcb, IP_ANY_TYPE, TFTP_PORT); - if (ret != ERR_OK) { - udp_remove(pcb); - return ret; + if (mode == LWIP_TFTP_MODE_SERVER) { + ret = udp_bind(pcb, IP_ANY_TYPE, TFTP_PORT); + if (ret != ERR_OK) { + udp_remove(pcb); + return ret; + } } tftp_state.handle = NULL; From patchwork Wed Oct 16 10:04: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: 835796 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346409wru; Wed, 16 Oct 2024 03:05:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWPCGXMuhPlaHN5yTIueBNaDM7j7ICTsLb4fMPYOcJKdggp4mV+iGWlcdfzlozL9Pn8q+sumQ==@linaro.org X-Google-Smtp-Source: AGHT+IHHh40CkBbHTt2pIiCFycY+9ngkFcuk6xU1AGDZsWLtoOu93o2TcJGOztxa0C767qE+cFd/ X-Received: by 2002:a05:6602:1489:b0:835:4d07:9d46 with SMTP id ca18e2360f4ac-8379531e3f3mr1691288239f.15.1729073125515; Wed, 16 Oct 2024 03:05:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073125; cv=none; d=google.com; s=arc-20240605; b=TpdEHvVyoqwdq4CUS64geGsViHFqYhdH3164Zr/V+fB3mDjm15iWdPWJ6jyHLxK+a0 I3uj9OKDHEP7whjWVSEnFkO759vtj8anyH75gsz2nYwWlGgYtg5mnD3jVK7cZRkdUcoC Dq2aPeIibyeBrO3lzeYBa0fjH0jX79sQgbG21xM5izu285wNBUT8JYkeRUGk3S9XPBMO +gjNTVbXhyaT2GittYOuPyf3C5Al0HQ38GKHkvoKfWuWMgoMXYd4GUbwRquRlSuj9Nzt j4yOeFG3g2nWPkNrlocwKvqREAkiyh3QpHetxSYgh5RIw3244BMwiWY/I2Ch9hnwPVkA X5Fg== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Oq/ytua7g803f9pLufOWH8O9AXAp7Vi9C+sYz9GE3+M=; fh=LmQ2BcpxDMkwhWoOIoRaOguVARqIdfL2wJ6Kz7KYbf4=; b=Yg8W2ld8/Yw9M+3rihTi7m28FgFMPvPpbb2V8XUOKNt84aoNf9G17eyFqCQ26bu/pe CZAoNaFLo52AJXDxFAh9iOVzaPFSxXHYaOb4wStJjqJI0fyyCFZxc3ZOTn+ir8vQvlBP BMUaNdhg83ClpqGR9yr8OTq2CP5YB8XHouWdZjDAEBzRyj3N3zae7Y08Kc/aUpAmFupr Djge1jRANlOjyPhYS92inK627X4FUapABw7L9d955vNn0gSDt+9F7z3P6GIMYUJNcUdG Ki43Hqxktg7zTkpO8mzNT9ZPtlsyr/eyLZMD6MyiZoR2JP0NEnHwuOCRwH8EPAzaUgDA mNog==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wAwU4KW1; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 8926c6da1cb9f-4dbecb381f7si1519760173.24.2024.10.16.03.05.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:25 -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=wAwU4KW1; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1551B88FE2; Wed, 16 Oct 2024 12:05: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=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="wAwU4KW1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C7D7D88FD8; Wed, 16 Oct 2024 12:05: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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8BD7788FE2 for ; Wed, 16 Oct 2024 12:04:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-43055b43604so61549325e9.3 for ; Wed, 16 Oct 2024 03:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073099; x=1729677899; 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=Oq/ytua7g803f9pLufOWH8O9AXAp7Vi9C+sYz9GE3+M=; b=wAwU4KW1oqUwhOgburrpwVoF9hhwDet5Ulf0t4coLdsmwTqWUjI5TvqKsEy/Ojr7Oi oZ5CIV0ma3CwhcW9RHX3xD+9Mkgjs22R9QbBbp4WSIgrv3uI2GWds+8qUnfyOnE2QEkM sY1vEIqmVrn+GTLbZbs0c344p5lPROxH6Zoqt192UrHArSP95X2sgIQrymc4ZW/ywZwn Z3bKC3PBBYkKfk60d8YKiYQ9kfhkVQBK0F0q1/PH4Q/MFH942aCeaw2G8acfvodPDOTy nfIRdQrex9wsils+tHgSGKF+JLfSNGsJHkzwKGsdUle4hKtewV4DsJZRa2wJOQ5uqXRw YTbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073099; x=1729677899; 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=Oq/ytua7g803f9pLufOWH8O9AXAp7Vi9C+sYz9GE3+M=; b=OxDHPhOVJPD0RCxLJzPUwbWxDDPxCGwBksck3jUGVRWceLNf831X/QO6C/BLiPraT4 qcjkMzV+3/hTkVTgN5RIn0+TlYZ6U9V7Er7pCKevPvsLUExVwEEcpQmuwRxO5NED9+4C kNY7Gst1tivXHhEFyufGbInHn3ZB87+FXiMxYo35pax1Vfe0TJWh0AgF1hP118eDVgcM ZRtHNS0Y6rzJGC1We7wcfScixxpH7vFr3jZ3FXG4DMsXydFwcHqgd9NlWCXJ+l6wLeHR btVxVvlqmuU0N4shm4I90qv031N1JdLD7zbqyObmlKOeAcPS37qp4VJYYZNnAsfQ+yDA jjDA== X-Gm-Message-State: AOJu0YzgeQ7/w3HvGMhkDKlSDYesW6EuFQTioVeNas4Vmx2/BAf69RIX NNfNjlrrAm1XaGAoMmM/gVjgTygGj03js0qkNjeBix9N1ns4JfH0YejdrWkxp9Ji78mcEzWkZMj lSB7LTn/+ X-Received: by 2002:a05:600c:45ce:b0:430:5356:ac92 with SMTP id 5b1f17b1804b1-4314a295475mr31046195e9.7.1729073098780; Wed, 16 Oct 2024 03:04:58 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.04.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:04:58 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Joe Hershberger , Ramon Fried , Simon Glass , Mattijs Korpershoek , Heinrich Schuchardt , AKASHI Takahiro , Masahisa Kojima , Sean Anderson , Marek Vasut Subject: [PATCH v13 11/21] net: lwip: add TFTP support and tftpboot command Date: Wed, 16 Oct 2024 12:04:05 +0200 Message-Id: <8c39fc77f1bf905645d701d21aee2482065f296c.1729070678.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(). This implementation of the tftp command supports an optional port number. For example: tftp 192.168.0.30:9069:file.bin It also supports taking the server IP from ${tftpserverip} if defined, before falling back to ${serverip}. Signed-off-by: Jerome Forissier Acked-by: Ilias Apalodimas Tested-by: Ilias Apalodimas --- cmd/Kconfig | 3 +- cmd/net-lwip.c | 8 ++ include/net-common.h | 4 + include/net-lwip.h | 4 + lib/binman.c | 1 + net/lwip/dhcp.c | 11 +- net/lwip/net-lwip.c | 16 +++ net/lwip/tftp.c | 283 ++++++++++++++++++++++++++++++++++++++++++- 8 files changed, 324 insertions(+), 6 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 211be398937..7173f3da0b0 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2110,10 +2110,9 @@ config CMD_MDIO config CMD_TFTPBOOT bool "tftp" select PROT_UDP_LWIP if NET_LWIP - default n + default y help tftpboot - load file via network using TFTP protocol - Currently a placeholder (not implemented) when NET_LWIP=y. endif # if CMD_NET diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c index 82edb5fd2e6..80f0872bb8f 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/include/net-common.h b/include/net-common.h index cbcac178c82..fd7c5e7b488 100644 --- a/include/net-common.h +++ b/include/net-common.h @@ -459,6 +459,10 @@ static inline struct in_addr env_get_ip(char *var) int net_init(void); +/* NET compatibility */ +enum proto_t; +int net_loop(enum proto_t protocol); + /** * dhcp_run() - Run DHCP on the current ethernet device * diff --git a/include/net-lwip.h b/include/net-lwip.h index cfd06726577..37744b0e2cd 100644 --- a/include/net-lwip.h +++ b/include/net-lwip.h @@ -6,6 +6,10 @@ #include #include +enum proto_t { + TFTPGET +}; + struct netif *net_lwip_new_netif(struct udevice *udev); struct netif *net_lwip_new_netif_noip(struct udevice *udev); void net_lwip_remove_netif(struct netif *netif); diff --git a/lib/binman.c b/lib/binman.c index 9047f5275f3..93d85548116 100644 --- a/lib/binman.c +++ b/lib/binman.c @@ -137,6 +137,7 @@ int binman_init(void) { int ret; + return 0; binman = malloc(sizeof(struct binman_info)); if (!binman) return log_msg_ret("space for binman", -ENOMEM); diff --git a/net/lwip/dhcp.c b/net/lwip/dhcp.c index a2cc25d88f5..23b56226921 100644 --- a/net/lwip/dhcp.c +++ b/net/lwip/dhcp.c @@ -119,11 +119,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/net-lwip.c b/net/lwip/net-lwip.c index 3b08ffe3b74..5c2bb2e0361 100644 --- a/net/lwip/net-lwip.c +++ b/net/lwip/net-lwip.c @@ -28,6 +28,7 @@ const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; char *pxelinux_configfile; /* Our IP addr (0 = unknown) */ struct in_addr net_ip; +char net_boot_file_name[1024]; static err_t linkoutput(struct netif *netif, struct pbuf *p) { @@ -283,6 +284,21 @@ void net_process_received_packet(uchar *in_packet, int len) #endif } +int net_loop(enum proto_t protocol) +{ + char *argv[1]; + + switch (protocol) { + case TFTPGET: + argv[0] = "tftpboot"; + return do_tftpb(NULL, 0, 1, argv); + default: + return -EINVAL; + } + + return -EINVAL; +} + u32_t sys_now(void) { return get_timer(0); diff --git a/net/lwip/tftp.c b/net/lwip/tftp.c index 1fa246f55d9..26978643313 100644 --- a/net/lwip/tftp.c +++ b/net/lwip/tftp.c @@ -2,10 +2,287 @@ /* Copyright (C) 2024 Linaro Ltd. */ #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PROGRESS_PRINT_STEP_BYTES (10 * 1024) + +enum done_state { + NOT_DONE = 0, + SUCCESS, + FAILURE, + ABORTED +}; + +struct tftp_ctx { + ulong daddr; + ulong size; + ulong block_count; + ulong start_time; + enum done_state done; +}; + +static void *tftp_open(const char *fname, const char *mode, u8_t is_write) +{ + return NULL; +} + +static void tftp_close(void *handle) +{ + struct tftp_ctx *ctx = handle; + ulong elapsed; + + if (ctx->done == FAILURE || ctx->done == ABORTED) { + /* Closing after an error or Ctrl-C */ + return; + } + ctx->done = SUCCESS; + + elapsed = get_timer(ctx->start_time); + if (elapsed > 0) { + puts("\n\t "); /* Line up with "Loading: " */ + print_size(ctx->size / elapsed * 1000, "/s"); + } + puts("\ndone\n"); + printf("Bytes transferred = %lu (%lx hex)\n", ctx->size, ctx->size); + + if (env_set_hex("filesize", ctx->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 tftp_ctx *ctx = handle; + struct pbuf *q; + + for (q = p; q != NULL; q = q->next) { + memcpy((void *)ctx->daddr, q->payload, q->len); + ctx->daddr += q->len; + ctx->size += q->len; + ctx->block_count++; + if (ctx->block_count % 10 == 0) { + putc('#'); + if (ctx->block_count % (65 * 10) == 0) + puts("\n\t "); + } + } + + return 0; +} + +static void tftp_error(void *handle, int err, const char *msg, int size) +{ + struct tftp_ctx *ctx = handle; + char message[100]; + + ctx->done = FAILURE; + memset(message, 0, sizeof(message)); + memcpy(message, msg, LWIP_MIN(sizeof(message) - 1, (size_t)size)); + + printf("\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_loop(struct udevice *udev, ulong addr, char *fname, + ip_addr_t srvip, uint16_t srvport) +{ + struct netif *netif; + struct tftp_ctx ctx; + err_t err; + + if (!fname || addr == 0) + return -1; + + if (!srvport) + srvport = TFTP_PORT; + + netif = net_lwip_new_netif(udev); + if (!netif) + return -1; + + ctx.done = NOT_DONE; + ctx.size = 0; + ctx.block_count = 0; + ctx.daddr = addr; + + printf("Using %s device\n", udev->name); + printf("TFTP from server %s; our IP address is %s\n", + ip4addr_ntoa(&srvip), env_get("ipaddr")); + printf("Filename '%s'.\n", fname); + printf("Load address: 0x%lx\n", ctx.daddr); + printf("Loading: "); + + err = tftp_init_client(&tftp_context); + if (!(err == ERR_OK || err == ERR_USE)) + log_err("tftp_init_client err: %d\n", err); + + ctx.start_time = get_timer(0); + err = tftp_get(&ctx, &srvip, srvport, fname, TFTP_MODE_OCTET); + /* might return different errors, like routing problems */ + if (err != ERR_OK) { + printf("tftp_get() error %d\n", err); + net_lwip_remove_netif(netif); + return -1; + } + + while (!ctx.done) { + net_lwip_rx(udev, netif); + sys_check_timeouts(); + if (ctrlc()) { + printf("\nAbort\n"); + ctx.done = ABORTED; + break; + } + } + + tftp_cleanup(); + + net_lwip_remove_netif(netif); + + if (ctx.done == SUCCESS) { + if (env_set_hex("fileaddr", addr)) { + log_err("fileaddr not updated\n"); + return -1; + } + efi_set_bootdev("Net", "", fname, map_sysmem(addr, 0), + ctx.size); + return 0; + } + + return -1; +} int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - /* Not implemented */ - return CMD_RET_FAILURE; + int ret = CMD_RET_SUCCESS; + char *arg = NULL; + char *words[3] = { }; + char *fname = NULL; + char *server_ip = NULL; + char *server_port = NULL; + char *end; + ip_addr_t srvip; + uint16_t port = TFTP_PORT; + ulong laddr; + ulong addr; + int i; + + laddr = 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]))) { + laddr = addr; + fname = env_get("bootfile"); + } else { + arg = strdup(argv[1]); + } + break; + case 3: + laddr = hextoul(argv[1], NULL); + arg = strdup(argv[2]); + break; + default: + ret = CMD_RET_USAGE; + goto out; + } + + if (!arg) + arg = net_boot_file_name; + + if (arg) { + /* Parse [ip:[port:]]fname */ + i = 0; + while ((*(words + i) = strsep(&arg,":"))) + i++; + + switch (i) { + case 3: + server_ip = words[0]; + server_port = words[1]; + fname = words[2]; + break; + case 2: + server_ip = words[0]; + fname = words[1]; + break; + case 1: + fname = words[0]; + break; + default: + break; + } + } + + if (!server_ip) + server_ip = env_get("tftpserverip"); + if (!server_ip) + server_ip = env_get("serverip"); + if (!server_ip) { + log_err("error: tftpserverip/serverip has to be set\n"); + ret = CMD_RET_FAILURE; + goto out; + } + + if (server_port) + port = dectoul(server_port, NULL); + + if (!ipaddr_aton(server_ip, &srvip)) { + log_err("error: ipaddr_aton\n"); + ret = CMD_RET_FAILURE; + goto out; + } + + if (!fname) { + log_err("error: no file name\n"); + ret = CMD_RET_FAILURE; + goto out; + } + + if (!laddr) { + log_err("error: no load address\n"); + ret = CMD_RET_FAILURE; + goto out; + } + + eth_set_current(); + + if (tftp_loop(eth_get_dev(), laddr, fname, srvip, port) < 0) + ret = CMD_RET_FAILURE; +out: + free(arg); + return ret; } From patchwork Wed Oct 16 10:04: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: 835798 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346513wru; Wed, 16 Oct 2024 03:05:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW9qXFgEcAteg+XcUYNfOWdw4pcGVhAcWdR1Jc+wQRAQUf3pc8ji9HjdxM0zgBN/UbSPIUbaA==@linaro.org X-Google-Smtp-Source: AGHT+IESvKllO+SwN4B00dYK1+RzdScdlNmQT2FhnHE76XxT+jtF2DPdGuiHOuWoNyhuF4i0gHFE X-Received: by 2002:a05:6e02:1446:b0:3a3:67b1:3080 with SMTP id e9e14a558f8ab-3a3bcdbb5acmr134454315ab.7.1729073146289; Wed, 16 Oct 2024 03:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073146; cv=none; d=google.com; s=arc-20240605; b=f78QZ87EB4c3Ttk8KQ7wRgvJaTXKDRUvkZg0F67pMJz1D6SIFUu7Xt4kaHS3a4vD9p CdGd5ZUk0SwGi2Mwf9LiU5i+rwEc++8q8hu/YdVMjfpQAmiZYh12hdoe3YYqwARzEN5r PtJsG5/fXq8ihWPo7j5wr4OCy+VzTrPeekzoQfm2B/Ng98AawIqkU1AQT8jEX8VIJK8o 2BOPIy7zhFFT/AzkrMhVo+pvPw4ifcimgjDNo1ZZdfX6gR3UgheqEwZsaOywHUDoDGIR qDIASR7CbX/hdHaJxVxPWqU/FHc0OYVFpib7ZYDeMSHeP6xj1FfDaPquOBIqOkJHu+NJ jrNA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lNwOzqBCK9jYuzc/LoQIeQK971HyqJTrb31QUlvxY10=; fh=M1S23L4OuXqF/0xVUVC1y8b6k04LnWuSUlGL53OIcXM=; b=TqMHOWyigryd0RFAbi59Ngo1YuPGMQE6XLCeavMKbC9/oNkvLEHf6oWsy09hHCTV4k 2lyX/rgNtAiYOQm9ICLfdzEP0SnJttgV7YTtaVDeCROoJfPrvABKmICWUYW7REz+eBwk F0awAJBAR2MNEc3wmRfk2P4UAXChUzbBE9ToFp/wbq4XQZmg920oFNyZF2jsDGUH1zL6 L7ZIPTfYiSRULRnAbDA1v0T5ZPlfC31ItdHEIWZx9SLuwHnjJNwuTNXm5w8B+TrMv3IH xjKgRUlEeI3J10eeRajqPoKmF9vGa4Cmv1IBdHR/QEBSDWCN+JLfMvKn1+vCIFTPDqiK tpPg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EbaCTMck; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 8926c6da1cb9f-4dbeccca8ddsi1691933173.124.2024.10.16.03.05.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:46 -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=EbaCTMck; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE51B89015; Wed, 16 Oct 2024 12:05:05 +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="EbaCTMck"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 478BA89009; Wed, 16 Oct 2024 12:05:04 +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-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (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 D5EA088FE1 for ; Wed, 16 Oct 2024 12:05:01 +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-x336.google.com with SMTP id 5b1f17b1804b1-43152b79d25so3595225e9.1 for ; Wed, 16 Oct 2024 03:05:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073101; x=1729677901; 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=lNwOzqBCK9jYuzc/LoQIeQK971HyqJTrb31QUlvxY10=; b=EbaCTMckTmL9iUeey6e3RVv/XZNXq+BP/JawvI9GwkN9J56DrppBnwG5DyxXPQvBvG haEo5tXOL2LIEWiSRfxEw3VfpCYcw995idWzaizTBC2LAZLt/QvmzzzYugB9zmgvKIbz tpucIyw7I6W0YVRVOqGNz3u7654EJYBDGoI81a3bLiJAyD5WoRTx2jFmtQBdJ8P5MgwR 7RvqatdXib/7Y5cPjoAtUfB/If0+f1qXYWFcoYepdecxYJxq+OUyxFHUaD9pBtYwNNed pnXZafBYPfSJvQAKWKU8HX6VTHT9Sc3EcrdXC37PdNYNUBjLX4FUUb3LrWK5sLKxVsTT DtNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073101; x=1729677901; 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=lNwOzqBCK9jYuzc/LoQIeQK971HyqJTrb31QUlvxY10=; b=Avod/mBWldlbnDEsmNWB7012VprFhXUPmQ9uMk2PX+uuo3T8HoDHNvbFDOZ/P3HoaW tZdDKHBb20jKEUa1pewwkcuEUvk8w1+6NyjVyoMamKo3jsX5a3fQepqli2vn2Atu6wWi pcx+16ilsiyhpgOLFvrbzq5ppel6JwgDnVH6DikaSG6+J55eSlkWxgWs/QSqp4SST6pT xWoIv5957LKQA+oKOoAq37kzgYysi8HbIuZwRByMcQbwxDW+0Putpq6wnsPpLsQG4iab oLbvKgEXQkr7774mI5PKRS5NiSkCtAeDASbdPPWYGl8j8jSUG8SkK6a5z4YsghOJ5I5C eGsg== X-Gm-Message-State: AOJu0YypQuvPOGEZMgA2k5IcjTyr1XRrfirfJNpMFfjX3f90czG2xsMZ kqFptw4noRmR6kljihY563amB6/5CAMQ/Nfm133dHPZn/MbESYuWbeVTzfZuZbsGlJsJ2Er0ORP NqTt6Xhnk X-Received: by 2002:a05:600c:3d88:b0:431:553f:ba7d with SMTP id 5b1f17b1804b1-431553fbbf7mr2093135e9.26.1729073101073; Wed, 16 Oct 2024 03:05:01 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:00 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Joe Hershberger , Ramon Fried , Simon Glass , Mattijs Korpershoek , Heinrich Schuchardt , AKASHI Takahiro Subject: [PATCH v13 12/21] net: lwip: add ping command Date: Wed, 16 Oct 2024 12:04:06 +0200 Message-Id: <631c3507a1b0e45ee86e40643864ead091e197d3.1729070678.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 Acked-by: Ilias Apalodimas --- cmd/Kconfig | 11 +-- cmd/net-lwip.c | 8 ++ include/net-lwip.h | 1 + net/lwip/Makefile | 1 + net/lwip/ping.c | 177 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 193 insertions(+), 5 deletions(-) create mode 100644 net/lwip/ping.c diff --git a/cmd/Kconfig b/cmd/Kconfig index 7173f3da0b0..b7d1dd028a1 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2009,11 +2009,6 @@ config CMD_WGET wget is a simple command to download kernel, or other files, from a http server over TCP. -config CMD_PING - bool "ping" - help - Send ICMP ECHO_REQUEST to network host - config CMD_PING6 bool "ping6" depends on IPV6 @@ -2107,6 +2102,12 @@ config CMD_MDIO The MDIO interface is orthogonal to the MII interface and extends it by adding access to more registers through indirect addressing. +config CMD_PING + bool "ping" + select PROT_RAW_LWIP if NET_LWIP + help + Send ICMP ECHO_REQUEST to network host + config CMD_TFTPBOOT bool "tftp" select PROT_UDP_LWIP if NET_LWIP diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c index 80f0872bb8f..feed719beef 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 37744b0e2cd..9aa371e962c 100644 --- a/include/net-lwip.h +++ b/include/net-lwip.h @@ -17,5 +17,6 @@ struct netif *net_lwip_get_netif(void); int net_lwip_rx(struct udevice *udev, struct netif *netif); 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[]); #endif /* __NET_LWIP_H__ */ diff --git a/net/lwip/Makefile b/net/lwip/Makefile index 4e92a101ddb..b5af37a9b18 100644 --- a/net/lwip/Makefile +++ b/net/lwip/Makefile @@ -2,4 +2,5 @@ ccflags-y += -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot 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 diff --git a/net/lwip/ping.c b/net/lwip/ping.c new file mode 100644 index 00000000000..8dafa25959f --- /dev/null +++ b/net/lwip/ping.c @@ -0,0 +1,177 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024 Linaro Ltd. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PING_DELAY_MS 1000 +#define PING_COUNT 5 +/* Ping identifier - must fit on a u16_t */ +#define PING_ID 0xAFAF + +struct ping_ctx { + ip_addr_t target; + struct raw_pcb *pcb; + struct icmp_echo_hdr *iecho; + uint16_t seq_num; + bool alive; +}; + +static u8_t ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, + const ip_addr_t *addr) +{ + struct ping_ctx *ctx = arg; + struct icmp_echo_hdr *iecho = ctx->iecho; + + if (addr->addr != ctx->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(ctx->seq_num))) { + ctx->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(struct ping_ctx *ctx) +{ + ctx->pcb = raw_new(IP_PROTO_ICMP); + if (!ctx->pcb) + return -ENOMEM; + + raw_recv(ctx->pcb, ping_recv, ctx); + raw_bind(ctx->pcb, IP_ADDR_ANY); + + return 0; +} + +static void ping_raw_stop(struct ping_ctx *ctx) +{ + if (ctx->pcb) + raw_remove(ctx->pcb); +} + +static void ping_prepare_echo(struct ping_ctx *ctx) +{ + struct icmp_echo_hdr *iecho = ctx->iecho; + + ICMPH_TYPE_SET(iecho, ICMP_ECHO); + ICMPH_CODE_SET(iecho, 0); + iecho->chksum = 0; + iecho->id = PING_ID; + iecho->seqno = lwip_htons(ctx->seq_num); + + iecho->chksum = inet_chksum(iecho, sizeof(*iecho)); +} + +static void ping_send_icmp(struct ping_ctx *ctx) +{ + struct pbuf *p; + 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) { + ctx->iecho = (struct icmp_echo_hdr *)p->payload; + ping_prepare_echo(ctx); + raw_sendto(ctx->pcb, p, &ctx->target); + } + + pbuf_free(p); +} + +static void ping_send(void *arg) +{ + struct ping_ctx *ctx = arg; + + ctx->seq_num++; + if (ctx->seq_num <= PING_COUNT) { + ping_send_icmp(ctx); + sys_timeout(PING_DELAY_MS, ping_send, ctx); + } +} + +static int ping_loop(struct udevice *udev, const ip_addr_t* addr) +{ + struct ping_ctx ctx = {}; + struct netif *netif; + int ret; + + netif = net_lwip_new_netif(udev); + if (!netif) + return CMD_RET_FAILURE; + + printf("Using %s device\n", udev->name); + + ret = ping_raw_init(&ctx); + if (ret < 0) { + net_lwip_remove_netif(netif); + return ret; + } + + ctx.target = *addr; + + ping_send(&ctx); + + do { + sys_check_timeouts(); + net_lwip_rx(udev, netif); + if (ctx.alive) + break; + if (ctrlc()) { + printf("\nAbort\n"); + break; + } + } while (ctx.seq_num <= PING_COUNT); + + sys_untimeout(ping_send, &ctx); + ping_raw_stop(&ctx); + + net_lwip_remove_netif(netif); + + if (ctx.alive) + 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; + + eth_set_current(); + + if (ping_loop(eth_get_dev(), &addr) < 0) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; +} From patchwork Wed Oct 16 10:04: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: 835799 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346593wru; Wed, 16 Oct 2024 03:05:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX2r57Rj073iF1KDfxr/bIXWIfBCig/+ghF+wz27yXHkFXTtq3qvacS0Xrl4KvXenVTwpxnwA==@linaro.org X-Google-Smtp-Source: AGHT+IGCnKLauz00m+3sWt4qhO3FOyitgNTOKcbP2X8Th192dM2MCSBucSka+DJ0+8Ds54qul8YA X-Received: by 2002:a05:6602:611b:b0:83a:9e45:cb20 with SMTP id ca18e2360f4ac-83a9e45d13bmr160927539f.13.1729073156711; Wed, 16 Oct 2024 03:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073156; cv=none; d=google.com; s=arc-20240605; b=SJL8AhTsDkSGsYoHjdBS9pVMuYHQceIajz6rDOh8tbJ+xZ0e/73+zOIbH5YDIppsHN AdtSlLXprw1zwGwsC4W+UPbIXQ8fHC8hkvyPrY1IBLlCv6n+Uffc4YSisw7YHDBjpSWw AlZNN7pAOWRuuO9VAXIivyR2s7w9UYgtV//SW5R9xLv7bs3ke348fH5wbXiXgKwMm3xy 6jTpdN8/HGMEU19tMDALVmvOtthX+RSa3NABxZeG/xUKLCJgfMzHbEZYRPkaW7v62RJZ GymO8exX4VbYUE2De9hUfeGmqqzHl/vWqqN7b0AlQevaWqT6lOcedWfu7unq0o/CYVb3 To+Q== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a16hgTGIRnm047tRjSQePaRdLFWpRxqync/ll9wn4W0=; fh=M1S23L4OuXqF/0xVUVC1y8b6k04LnWuSUlGL53OIcXM=; b=UuyR/w0By8nk+yEbwfuxyiwj5QYG/ohCRAUiqoR8MpIHNta0ZTck9sw8hW12Xsn74a yjjJm8M31ztsa7Lzc4bQ1m+xmAMjkUE1w9JX0cj4jEzCe8v1m39BEs+jR+GApGws0IOj 8aisezn7bxdmxWDeHhB8lQ87nc9aEAeYnfaLUOQB+TTHI2/gCdmDOy1A3eninWOiCDWC IavKJOJw8H9Wyt2DO2XTDX+HKpgtE9HUPAETm+XDD1jAX8+kf6mBL5zXzqIdAonYBMD5 X8qx+s+7RrMVgT7NfKr+oV84yH6Nqq4cVzDikRtFODXnO2gPo/nPn4I/bDbUhXGa8+UH jYnQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tqBKtzYv; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 8926c6da1cb9f-4dbeccdfeb3si1431411173.145.2024.10.16.03.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:56 -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=tqBKtzYv; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 549DA88FD8; Wed, 16 Oct 2024 12:05: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="tqBKtzYv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8230C88FF7; Wed, 16 Oct 2024 12:05: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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (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 7151388FCF for ; Wed, 16 Oct 2024 12:05: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-lf1-x12f.google.com with SMTP id 2adb3069b0e04-539f0f9ee49so3942520e87.1 for ; Wed, 16 Oct 2024 03:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073103; x=1729677903; 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=a16hgTGIRnm047tRjSQePaRdLFWpRxqync/ll9wn4W0=; b=tqBKtzYv0xnfdbrEMfLM91JBgGAKv9527ZoJVxwHiMvZdNbzmRtjDPeUkGG1l8VTJy sOIIpc4tJ5LczMLtVHUgLucOJeXSMImiCw88wlwW7xShmYyoqW+5iAGSpI4gzA5O/81y 6xLZ4M1mnIP/4WfJUBiwcRRJ+M0QzHvYg6FC6b7+CKUGGaJAF3fzWadj8x0Tzrxe9pR8 7lac8s8aICxx8fmr1EK1ToKCBXLD90c/AMuXlDfll9/l2gkRT6O5DW25bzkzZ8RfyOvx te1cU09vPFLEvRujutiRyCQ05+NkcJ3QPF0jm+Dta7MF9JvTkE3/TqB4TWpudGI+mU0g GTHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073103; x=1729677903; 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=a16hgTGIRnm047tRjSQePaRdLFWpRxqync/ll9wn4W0=; b=h9FahdqwOpfYH4wYkrHyTveGv1hjWyjBY1hjMVLNRyxpJWKZljOoravjG5oUwTGI1U 4GLGPWhmiAlMN6JFnxKWV2/ECKAokdo4R0FrNa/jw/lHMrRL5W8d3y0M/+L6EsrhKd4v n4AP43f8zNxKDeVvt9Bf39NFtEkIoPagc5cfEXzjCn/HMsS5IZjlXz63HcmX2rKR3pzd AebNEHREWAic18+eanFAzVIOFQQ2ANZk0viZ9HIQ2gCw6oH1lmJyphX52T9HuhlME2A2 NpX8M6Dxwq2im2ivIwZiZVWPax+nWSBaIaZ20rv1BL+u7AhldboUSadQt2bhDuyf/Dit u6Rg== X-Gm-Message-State: AOJu0YxECIoR9RjgGCzMup9o16bwPpnIuRRMitIYqBCY7CeR9oAdigbI ATnZz5lml5ksApV2H/k2qRZ9dUiFW3+WfBOsHB9a+nKihj2Dj6T29nCRRK0SU2ECQIJbH8f+nN+ kFq8Wj6X3 X-Received: by 2002:a05:6512:318b:b0:539:f699:bb29 with SMTP id 2adb3069b0e04-53a03f18c46mr2315203e87.15.1729073103396; Wed, 16 Oct 2024 03:05:03 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:03 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Joe Hershberger , Ramon Fried , Simon Glass , Mattijs Korpershoek , Heinrich Schuchardt , AKASHI Takahiro Subject: [PATCH v13 13/21] net: lwip: add dns command Date: Wed, 16 Oct 2024 12:04:07 +0200 Message-Id: <6a7582ab314aca691738c0a0ec68d45b9bf335eb.1729070678.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 CMD_DNS when NET_LWIP is enabled to provide the dns command using lwIP. Signed-off-by: Jerome Forissier Acked-by: Ilias Apalodimas --- cmd/Kconfig | 11 ++-- cmd/net-lwip.c | 8 +++ include/net-lwip.h | 1 + net/lwip/Makefile | 1 + net/lwip/dns.c | 127 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 net/lwip/dns.c diff --git a/cmd/Kconfig b/cmd/Kconfig index b7d1dd028a1..2791ad5393c 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2027,11 +2027,6 @@ config CMD_SNTP help Synchronize RTC via network -config CMD_DNS - bool "dns" - help - Lookup the IP of a hostname - config CMD_LINK_LOCAL bool "linklocal" select LIB_RAND @@ -2079,6 +2074,12 @@ config CMD_DHCP help Boot image via network using DHCP/TFTP protocol +config CMD_DNS + bool "dns" + select PROT_DNS_LWIP if NET_LWIP + help + Lookup the IP of a hostname + config CMD_MII bool "mii" imply CMD_MDIO diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c index feed719beef..c021da6a674 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 9aa371e962c..ff9d03b23e8 100644 --- a/include/net-lwip.h +++ b/include/net-lwip.h @@ -17,6 +17,7 @@ struct netif *net_lwip_get_netif(void); int net_lwip_rx(struct udevice *udev, struct netif *netif); 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[]); #endif /* __NET_LWIP_H__ */ diff --git a/net/lwip/Makefile b/net/lwip/Makefile index b5af37a9b18..645d8a8c457 100644 --- a/net/lwip/Makefile +++ b/net/lwip/Makefile @@ -2,5 +2,6 @@ ccflags-y += -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot 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..4b937feaee1 --- /dev/null +++ b/net/lwip/dns.c @@ -0,0 +1,127 @@ +// 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 + +struct dns_cb_arg { + ip_addr_t host_ipaddr; + const char *var; + 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) +{ + struct dns_cb_arg *dns_cb_arg = arg; + char *ipstr = ip4addr_ntoa(ipaddr); + + dns_cb_arg->done = true; + + if (!ipaddr) { + printf("DNS: host not found\n"); + dns_cb_arg->host_ipaddr.addr = 0; + return; + } + + if (dns_cb_arg->var) + env_set(dns_cb_arg->var, ipstr); + + printf("%s\n", ipstr); +} + +static int dns_loop(struct udevice *udev, const char *name, const char *var) +{ + struct dns_cb_arg dns_cb_arg = { }; + bool has_server = false; + struct netif *netif; + ip_addr_t ipaddr; + ip_addr_t ns; + ulong start; + char *nsenv; + int ret; + + dns_cb_arg.var = var; + + netif = net_lwip_new_netif(udev); + if (!netif) + return -1; + + 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"); + net_lwip_remove_netif(netif); + return CMD_RET_FAILURE; + } + + dns_cb_arg.done = false; + + ret = dns_gethostbyname(name, &ipaddr, dns_cb, &dns_cb_arg); + + if (ret == ERR_OK) { + dns_cb(name, &ipaddr, &dns_cb_arg); + } else if (ret == ERR_INPROGRESS) { + start = get_timer(0); + sys_timeout(DNS_RESEND_MS, do_dns_tmr, NULL); + do { + net_lwip_rx(udev, netif); + if (dns_cb_arg.done) + break; + sys_check_timeouts(); + if (ctrlc()) { + printf("\nAbort\n"); + break; + } + } while (get_timer(start) < DNS_TIMEOUT_MS); + sys_untimeout(do_dns_tmr, NULL); + } + + net_lwip_remove_netif(netif); + + if (dns_cb_arg.done && dns_cb_arg.host_ipaddr.addr != 0) + return CMD_RET_SUCCESS; + + return CMD_RET_FAILURE; +} + +int do_dns(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + char *name; + char *var = NULL; + + if (argc == 1 || argc > 3) + return CMD_RET_USAGE; + + name = argv[1]; + + if (argc == 3) + var = argv[2]; + + eth_set_current(); + + return dns_loop(eth_get_dev(), name, var); +} From patchwork Wed Oct 16 10:04:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835800 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346655wru; Wed, 16 Oct 2024 03:06:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVRUjc1kmpr8jzTfSK1t55wHjlIl2rSRwcoc7GUVF0pCyVfGDNgkuTml2hivyIYrqpw/XolRA==@linaro.org X-Google-Smtp-Source: AGHT+IEoMgVSxSSmH7vibtkw9V9ObLYUXxv9yWR7wNn80Q2mVJzBjTNuZr2WWn+jhUbWIe2Mnhws X-Received: by 2002:a05:6e02:1aa5:b0:39d:4c8a:370d with SMTP id e9e14a558f8ab-3a3dc4f147dmr33772585ab.18.1729073167364; Wed, 16 Oct 2024 03:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073167; cv=none; d=google.com; s=arc-20240605; b=jcRZGs579AiStxewMegTvQ3cVAxJm3TwmKEXUButyTvsESb0Vr/u8jyUlTUZcXH2Ik PARc6ijW21otv92nCrITPB0h9BIVQJdBGaY4vTnSB8YR3pVqLli4Y1eT550bLtqeCsdn mJwjakVAe9MhUfEyb4CXY1T+Ea/hWXYTh8gDI+9pRnzl7N4Hf8Jkv3uDWJ1TuB5ooTGq TOj70QInbuFEk3DQyI7ULjul25PYxsKTq+I1oKEwjWmX9zBzR9GG+KH/WuBow3vAvbbJ pq/Tp91wzKJPYFIi6IEHQs8LwcMknfCtwBM8T1BgyQBHhnm++UhNEsDTrs0FEO1CRhyc oGSQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=S8uolKWEOtK8Usk/3HnRqcpQzhbDn07JE0LHRhU+kLg=; fh=duDseGqdkK8moyCHwDev4NSoAoUqLF0mIR8IdrcJ7+U=; b=Q93wiknFxjw5wzfrGagnL2d7B874GG7M55j9IKfkkXMfUnTbQfdNmsCY/eoKbi3Yg/ hglSkixL0a0rnKnFXgia7xXNCnHizsgc/RFyixbRt2I+UorrzNwSYgQQJ5U4H41A0BMC SLt04Axd3CU86yeGUlU7P7+JUz3TZsQrLVeXJg7bqtwjtitk3e4IJkpQ9QbifAWUOEae GOJ5q4CIHIp1iQEiwCJ8sds/CAwmzuXG+AQ+jSSjaWp8zRbw8XlaQ/IJexWHn/MgO8XL F0ozrONtPRfNIwH5ngPK5YJ8kwxv6IfpHYagSwsGAZxQ6W9zjYadcp3mMgZMu5yH0mH0 FBLw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GwC65yY6; 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 e9e14a558f8ab-3a3d71d355asi16410245ab.165.2024.10.16.03.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:06:07 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GwC65yY6; 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 B4E7A8901E; Wed, 16 Oct 2024 12:05: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="GwC65yY6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 31C6F88FCF; Wed, 16 Oct 2024 12:05: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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 1799688FFD for ; Wed, 16 Oct 2024 12:05: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-431481433bdso12283205e9.3 for ; Wed, 16 Oct 2024 03:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073105; x=1729677905; 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=S8uolKWEOtK8Usk/3HnRqcpQzhbDn07JE0LHRhU+kLg=; b=GwC65yY6iVC+3z7tzf8MxG0w/c9XJsEkqf5rZMp5MDtEYifr6CWrx02F/mC0ApQvfJ vcjiF6O5vn/64Ac+drEvTXxZ4GoNvfXIJaHjlnctO3qh6O1cp9sT1/4IHGN47qLgThtz 65pkRC4nabW8FDI+0x/iIfPXhzp6weIDt9GpfMMl0RsrMZ6B4AE4gKQu6gVyMTPrfbBP U7bz6PVNjX3hMWVfACiCvbEFzX6SYNRgIcGxSlyKrLcUd0ohWbDxxuEi2y4pmYceZ2sl cPN36jjKHRPJNPlyi/KDkPB3GCpVc5UD02NhTgzLRmeuRcERrvoMXlONzd9teDRpveOT 07lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073105; x=1729677905; 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=S8uolKWEOtK8Usk/3HnRqcpQzhbDn07JE0LHRhU+kLg=; b=rTcV5hPp+n55CpBLVWOmvdN27gZD+fgrnEgk7qUgLyt1pVRknPmnljvcMJsjDmLxpH sXY7cEx6AlRVOU7xSCWGYPyuUSJpUnH0fmCXROjntHjiJvHODPUQNcsVG4yg2eDd4fh1 E432cWTMNQES6RAWoC6tbDSm4te2pCxOXOtP4h6yfv0fCx2RxHRX43J37YEI0QPJKy1l WvfA74ozu9wGg7wAaV3xJQ3/T0vwIvAAMNF/zTrQg44Y/52YAku9jiCMhksCY32vn1FS MK+3kA2eNDJm2+ZiF5XralCYaC+Q5J9gZsiFstxhvgLo/JVkVIL3EfKvm87yJkW92Da3 tSkg== X-Gm-Message-State: AOJu0YwBLSEP7jVadJKla6sGA41c6q/3o3d46ScVCwWkjb06y8ehgt9d zfChNNOfwZGRbfTj28mnKYQwnszGFsx9+96n13zjH1etrvCco1vofvT9qtEBwufrXfp8ixRFMrB b+CIJ6BRK X-Received: by 2002:a05:600c:3581:b0:430:5887:c238 with SMTP id 5b1f17b1804b1-4311decab1fmr160223915e9.11.1729073105258; Wed, 16 Oct 2024 03:05:05 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.05.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:04 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Simon Glass , Francis Laniel , Heinrich Schuchardt , Marek Vasut Subject: [PATCH v13 14/21] net: split cmd/net.c into cmd/net.c and cmd/net-common.c Date: Wed, 16 Oct 2024 12:04:08 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Extract some code from cmd/net.c that will be useful in a subsequent commit to implement wget with NET_LWIP. Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- cmd/Makefile | 5 ++- cmd/net-common.c | 109 ++++++++++++++++++++++++++++++++++++++++++++ cmd/net.c | 115 ----------------------------------------------- 3 files changed, 113 insertions(+), 116 deletions(-) create mode 100644 cmd/net-common.c diff --git a/cmd/Makefile b/cmd/Makefile index 94a3df41c6f..f3091405372 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -130,7 +130,10 @@ obj-$(CONFIG_CMD_NAND) += nand.o ifdef CONFIG_CMD_NET obj-$(CONFIG_NET) += net.o obj-$(CONFIG_NET_LWIP) += net-lwip.o -CFLAGS_net-lwip.o := -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot +obj-$(filter y,$(CONFIG_CMD_NET) $(CONFIG_CMD_NET_LWIP)) += net-common.o +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/net-common.c b/cmd/net-common.c new file mode 100644 index 00000000000..1c9fb83b896 --- /dev/null +++ b/cmd/net-common.c @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + */ + +#include +#include +#include +#include +#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.c b/cmd/net.c index 53ce2bc5d0c..c90578e1b9f 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -674,118 +674,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 */ From patchwork Wed Oct 16 10:04:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835801 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346730wru; Wed, 16 Oct 2024 03:06:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVvTcukPsnR5j1lWPhWR6vq9EXafaktw9px0BxOPc3c8Py7I5bkfP00H6bei6iPxL6BzKP0cQ==@linaro.org X-Google-Smtp-Source: AGHT+IG5Fo2GOl/cSkIeTwu2gp6IuSYsSHMF/5EVMqj0v4PpK9Vilt5GHKJngJpk8M2FVcLN8CBE X-Received: by 2002:a05:6602:2cca:b0:83a:9488:154c with SMTP id ca18e2360f4ac-83a94881e23mr414974739f.3.1729073177487; Wed, 16 Oct 2024 03:06:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073177; cv=none; d=google.com; s=arc-20240605; b=ir9em/N1LPjzXBEfDy2rmbLBdRUBDITWQDPiWsbyLYQtWdATapuCuRZZCu0i+e7qBF B2VIqNL/JwMi0Juti7f1v3YeASOL6RoaOtiEW6Qy0odtx7/e3un8/3nF7b2W6lWGD9oj GyrS4Rf2p3wj1A/PWqmJUmqk6kbf6BEKlMuZnvXhpLL0xCEFAGLt93LVHK+J2qiYz62g jbZOzfG94GWtyNwgkSs+YdlcgkO70cW8fBpo/119s+JdL43fpOYUEqgbKnXysD3yS+ll M8vC+e5MC+s1Jgn19FIatanbzIHwaZVBbi6Cs4QfLx61eAbGS4ov6K0umECdPX+lXDur TttA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bFzzp2wUIiZX0P/2Zc8ODt22VqnMDwqzE8j/C6YVQWI=; fh=M1S23L4OuXqF/0xVUVC1y8b6k04LnWuSUlGL53OIcXM=; b=OajFYMnzb0T5Kk6nc01HtIGXQRNhpBMdxHRyQZ/oC8qQUfCt8noH4ls6C70d3H5PcA N5cJ322G8u1PN1PvoaeIVYaIRrIrwdgpyh7xz7cPsnFkjfSEmYZAQGVOpHbSpjjmfm/v t7P/ygm/MP6DNkAS5UaQH5JymVuapuWodfEaXpuzLW6F3EMLKVrxB7QQULCporiZacr/ mnN0uX2hIboaf42IzjbWMda7Tt+qshE1sEfEgKRDbyMZaAx9IWBE2JAUQY1RQdh0qB/Z cRKOOjgYDPryW+pc5vSNidM+Sso/9qWTvNnJGxv4c2TM9AaPOVeiaxKvqRXkxxkbCvYj r/1A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XwpG7RwJ; 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 8926c6da1cb9f-4dbecb3819esi1732150173.18.2024.10.16.03.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:06: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=XwpG7RwJ; 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 23E5289026; Wed, 16 Oct 2024 12:05: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=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="XwpG7RwJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA3C188F35; Wed, 16 Oct 2024 12:05: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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (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 A518489003 for ; Wed, 16 Oct 2024 12:05: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-x336.google.com with SMTP id 5b1f17b1804b1-4314f38d274so9348055e9.1 for ; Wed, 16 Oct 2024 03:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073108; x=1729677908; 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=bFzzp2wUIiZX0P/2Zc8ODt22VqnMDwqzE8j/C6YVQWI=; b=XwpG7RwJH4/YMUF/YklFDUHQ0U9tCnv9d+9gZdNHFtfhMmLohqgCF2zsnAPWfyXXXz eBgnaCR+VTFqELZw3vr35NUZhRXVp/hR2GSXLPkcz/VUKxtDVfY6RjnhgrpU8bE9hEm8 Iuk7RltaEWdGy9T8z+gk5DQhCj3eR1eUv+V4mIg927sxgMu/nqkWkkj+LEP+dGsbzplb rSXxcZ4ZN9n487ahJ6dyFYnKJ7Xf6lsvIpije7XSig37CxRXBAUvb3yJTvWGTsjNDRMO 7iOVLVhKLCOM9+43PdFd7p7nJxyDIPjdwR5dWJqe3193b6FCGzfJUeV7ouHoIThq8w/D Rfww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073108; x=1729677908; 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=bFzzp2wUIiZX0P/2Zc8ODt22VqnMDwqzE8j/C6YVQWI=; b=SM1zAJ+U7cIMhDUu0yQur6Zc+ppRIAGrqBGNUEAmLhkE43BEVQwdhwxrT5Q97u0Xvp YO1pT5noDpkipBeEuDfAf4MF3GVASLv5isdoHaJ8IzU9PiL+uan7qG+vVI1xRromBG7Q BfBeR5VQ9YckkNigSKOWF5c61Mm2B5QnBGDSeE1LVw3zHi4e2NcAf4VGPLBFENChC4Oa oVsqfO1cpczP4zmSA3rzGSSieb1VBEU6G5H/gCOwquA2e98sQpmNecNlo77q6fCMS8lH x7w0yHnNkrxNdPiDJkc/fek7nXS4PGV6vbc8OhTDC6nEWNZsn1H2szRRoNU+ll6gvfs3 3/0g== X-Gm-Message-State: AOJu0Yzmt3eS6MyB9FBIqWsnSv5KBZUFmg3Jg/7QREhRV1CUICjUOTMT 8PG92Y1vX/Qv5jhYNcPhpn44Y3rWnAudnfSyuBSEmp0k5OJbUz4qjJzPJ273Hb2PYYT4gZHZtw+ a0TKUgBMk X-Received: by 2002:a05:600c:444f:b0:42c:b62c:9f0d with SMTP id 5b1f17b1804b1-431255e03d0mr184224675e9.17.1729073107678; Wed, 16 Oct 2024 03:05:07 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:07 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Joe Hershberger , Ramon Fried , Simon Glass , Mattijs Korpershoek , Heinrich Schuchardt , AKASHI Takahiro Subject: [PATCH v13 15/21] net: lwip: add wget command Date: Wed, 16 Oct 2024 12:04:09 +0200 Message-Id: <9e25008319d750258e6838fa193916a0351a8a0e.1729070678.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. The command normally expects a URL: wget [loadaddr] url, but it also accepts the legacy syntax: wget [loadaddr] [server:]file. The server IP may alternatively be supplied via ${httpserverip} which has higher priority than ${serverip}. Based on code initially developed by Maxim U. Signed-off-by: Jerome Forissier Co-developed-by: Maxim Uvarov Cc: Maxim Uvarov Signed-off-by: Jerome Forissier Acked-by: Ilias Apalodimas --- cmd/Kconfig | 18 ++- cmd/net-lwip.c | 8 + include/net-lwip.h | 18 +++ net/lwip/Makefile | 1 + net/lwip/wget.c | 357 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 394 insertions(+), 8 deletions(-) create mode 100644 net/lwip/wget.c diff --git a/cmd/Kconfig b/cmd/Kconfig index 2791ad5393c..8c677b1e486 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2001,14 +2001,6 @@ config SYS_DISABLE_AUTOLOAD is complete. Enable this option to disable this behavior and instead require files to be loaded over the network by subsequent commands. -config CMD_WGET - bool "wget" - select PROT_TCP - default y if SANDBOX - help - wget is a simple command to download kernel, or other files, - from a http server over TCP. - config CMD_PING6 bool "ping6" depends on IPV6 @@ -2116,6 +2108,16 @@ config CMD_TFTPBOOT help tftpboot - load file via network using TFTP protocol +config CMD_WGET + bool "wget" + default y if SANDBOX + select PROT_TCP if NET + select PROT_TCP_LWIP if NET_LWIP + select PROT_DNS_LWIP if NET_LWIP + help + wget is a simple command to download kernel, or other files, + from a http server over TCP. + endif # if CMD_NET config CMD_PXE diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c index c021da6a674..42f8bd6b259 100644 --- a/cmd/net-lwip.c +++ b/cmd/net-lwip.c @@ -35,3 +35,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/include/net-lwip.h b/include/net-lwip.h index ff9d03b23e8..1c3583f82a1 100644 --- a/include/net-lwip.h +++ b/include/net-lwip.h @@ -16,8 +16,26 @@ void net_lwip_remove_netif(struct netif *netif); struct netif *net_lwip_get_netif(void); int net_lwip_rx(struct udevice *udev, struct netif *netif); +/** + * wget_with_dns() - runs dns host IP address resulution before wget + * + * @dst_addr: destination address to download the file + * @uri: uri string of target file of wget + * Return: downloaded file size, negative if failed + */ + +int wget_with_dns(ulong dst_addr, char *uri); +/** + * wget_validate_uri() - varidate the uri + * + * @uri: uri string of target file of wget + * Return: true if uri is valid, false if uri is invalid + */ +bool wget_validate_uri(char *uri); + 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_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 645d8a8c457..f2558f8763a 100644 --- a/net/lwip/Makefile +++ b/net/lwip/Makefile @@ -5,3 +5,4 @@ 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 diff --git a/net/lwip/wget.c b/net/lwip/wget.c new file mode 100644 index 00000000000..b495ebd1aa9 --- /dev/null +++ b/net/lwip/wget.c @@ -0,0 +1,357 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024 Linaro Ltd. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SERVER_NAME_SIZE 200 +#define HTTP_PORT_DEFAULT 80 +#define PROGRESS_PRINT_STEP_BYTES (100 * 1024) + +enum done_state { + NOT_DONE = 0, + SUCCESS = 1, + FAILURE = 2 +}; + +struct wget_ctx { + char *path; + ulong daddr; + ulong saved_daddr; + ulong size; + ulong prevsize; + ulong start_time; + enum done_state done; +}; + +static int parse_url(char *url, char *host, u16 *port, char **path) +{ + char *p, *pp; + long lport; + + p = strstr(url, "http://"); + if (!p) { + log_err("only http:// is supported\n"); + 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] = '\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; +} + +/* + * Legacy syntax support + * Convert [:]filename into a URL if needed + */ +static int parse_legacy_arg(char *arg, char *nurl, size_t rem) +{ + char *p = nurl; + size_t n; + char *col = strchr(arg, ':'); + char *env; + char *server; + char *path; + + if (strstr(arg, "http") == arg) { + n = snprintf(nurl, rem, "%s", arg); + if (n < 0 || n > rem) + return -1; + return 0; + } + + n = snprintf(p, rem, "%s", "http://"); + if (n < 0 || n > rem) + return -1; + p += n; + rem -= n; + + if (col) { + n = col - arg; + server = arg; + path = col + 1; + } else { + env = env_get("httpserverip"); + if (!env) + env = env_get("serverip"); + if (!env) { + log_err("error: httpserver/serverip has to be set\n"); + return -1; + } + n = strlen(env); + server = env; + path = arg; + } + + if (rem < n) + return -1; + strncpy(p, server, n); + p += n; + rem -= n; + if (rem < 1) + return -1; + *p = '/'; + p++; + rem--; + n = strlen(path); + if (rem < n) + return -1; + strncpy(p, path, n); + p += n; + rem -= n; + if (rem < 1) + return -1; + *p = '\0'; + + return 0; +} + +static err_t httpc_recv_cb(void *arg, struct altcp_pcb *pcb, struct pbuf *pbuf, + err_t err) +{ + struct wget_ctx *ctx = arg; + struct pbuf *buf; + + if (!pbuf) + return ERR_BUF; + + if (!ctx->start_time) + ctx->start_time = get_timer(0); + + for (buf = pbuf; buf; buf = buf->next) { + memcpy((void *)ctx->daddr, buf->payload, buf->len); + ctx->daddr += buf->len; + ctx->size += buf->len; + if (ctx->size - ctx->prevsize > PROGRESS_PRINT_STEP_BYTES) { + printf("#"); + ctx->prevsize = ctx->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) +{ + struct wget_ctx *ctx = arg; + ulong elapsed; + + if (httpc_result != HTTPC_RESULT_OK) { + log_err("\nHTTP client error %d\n", httpc_result); + ctx->done = FAILURE; + return; + } + if (srv_res != 200) { + log_err("\nHTTP server error %d\n", srv_res); + ctx->done = FAILURE; + return; + } + + elapsed = get_timer(ctx->start_time); + if (!elapsed) + elapsed = 1; + if (rx_content_len > PROGRESS_PRINT_STEP_BYTES) + printf("\n"); + printf("%u bytes transferred in %lu ms (", rx_content_len, elapsed); + print_size(rx_content_len / elapsed * 1000, "/s)\n"); + printf("Bytes transferred = %lu (%lx hex)\n", ctx->size, ctx->size); + efi_set_bootdev("Net", "", ctx->path, map_sysmem(ctx->saved_daddr, 0), + rx_content_len); + if (env_set_hex("filesize", rx_content_len) || + env_set_hex("fileaddr", ctx->saved_daddr)) { + log_err("Could not set filesize or fileaddr\n"); + ctx->done = FAILURE; + return; + } + + ctx->done = SUCCESS; +} + +static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri) +{ + char server_name[SERVER_NAME_SIZE]; + httpc_connection_t conn; + httpc_state_t *state; + struct netif *netif; + struct wget_ctx ctx; + char *path; + u16 port; + + ctx.daddr = dst_addr; + ctx.saved_daddr = dst_addr; + ctx.done = NOT_DONE; + ctx.size = 0; + ctx.prevsize = 0; + ctx.start_time = 0; + + if (parse_url(uri, server_name, &port, &path)) + return CMD_RET_USAGE; + + netif = net_lwip_new_netif(udev); + if (!netif) + return -1; + + memset(&conn, 0, sizeof(conn)); + conn.result_fn = httpc_result_cb; + ctx.path = path; + if (httpc_get_file_dns(server_name, port, path, &conn, httpc_recv_cb, + &ctx, &state)) { + net_lwip_remove_netif(netif); + return CMD_RET_FAILURE; + } + + while (!ctx.done) { + net_lwip_rx(udev, netif); + sys_check_timeouts(); + if (ctrlc()) + break; + } + + net_lwip_remove_netif(netif); + + if (ctx.done == SUCCESS) + return 0; + + return -1; +} + +int wget_with_dns(ulong dst_addr, char *uri) +{ + eth_set_current(); + + return wget_loop(eth_get_dev(), dst_addr, uri); +} + +int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) +{ + char *end; + char *url; + ulong dst_addr; + char nurl[1024]; + + 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 (parse_legacy_arg(url, nurl, sizeof(nurl))) + return CMD_RET_FAILURE; + + if (wget_with_dns(dst_addr, nurl)) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; +} + +/** + * wget_validate_uri() - validate the uri for wget + * + * @uri: uri string + * + * This function follows the current U-Boot wget implementation. + * scheme: only "http:" is supported + * authority: + * - user information: not supported + * - host: supported + * - port: not supported(always use the default port) + * + * Uri is expected to be correctly percent encoded. + * This is the minimum check, control codes(0x1-0x19, 0x7F, except '\0') + * and space character(0x20) are not allowed. + * + * TODO: stricter uri conformance check + * + * Return: true on success, false on failure + */ +bool wget_validate_uri(char *uri) +{ + char c; + bool ret = true; + char *str_copy, *s, *authority; + + for (c = 0x1; c < 0x21; c++) { + if (strchr(uri, c)) { + log_err("invalid character is used\n"); + return false; + } + } + if (strchr(uri, 0x7f)) { + log_err("invalid character is used\n"); + return false; + } + + if (strncmp(uri, "http://", 7)) { + log_err("only http:// is supported\n"); + return false; + } + str_copy = strdup(uri); + if (!str_copy) + return false; + + s = str_copy + strlen("http://"); + authority = strsep(&s, "/"); + if (!s) { + log_err("invalid uri, no file path\n"); + ret = false; + goto out; + } + s = strchr(authority, '@'); + if (s) { + log_err("user information is not supported\n"); + ret = false; + goto out; + } + +out: + free(str_copy); + + return ret; +} From patchwork Wed Oct 16 10:04:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835802 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346783wru; Wed, 16 Oct 2024 03:06:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXz5HKCjywHgvQIPOcmbIvT1I81X6mGW7wG2jmjIv/ulxhM7ITZdjVk4mt3yXMOuIaC8Ajv4w==@linaro.org X-Google-Smtp-Source: AGHT+IEAsC0bWlRKrCsqjmA4u0OqJCAmNXROvIN8LvkFHpUuPKG/M55m+n0rRcEKmLCw65gAxTa3 X-Received: by 2002:a05:6e02:1a0b:b0:3a3:b4dd:4db with SMTP id e9e14a558f8ab-3a3b5c73b7fmr191967645ab.0.1729073187090; Wed, 16 Oct 2024 03:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073187; cv=none; d=google.com; s=arc-20240605; b=VlCaX0m/YGQ5lRumhsnpZspaVxVw7w0oC6gixIz2rbJuEHHxSC7eV5XKizkh3B6qgC 8oGAm/qM2Jx6IcmRK97QOaGPAC/vMErc0JQsV+ltJcuAmtHf89c4Ut+h8627q9WsMrcW mSd50plkRPXp2bl/6P/LhtOIcmp8iqaZqRskzEfQfbE+615XP8Px4kkC/x+G3G7Xk5nE xVsP3TG0XT4SZtztZkidC6Hd2vcY93Mhl43uE8zXuAyQWclHfigv2VBHdn01icMseJbt XnIO2cRuyvBmr/HTj9Kpd6u6Mgl1EMEgvVe7h4Gfxxau89dRX0J1pZaQd08eLfSVuxvG arjA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+9X+r8Q8NFzSd6Hb1M2hwnGKuGR3j9GDjlrMCZXXI9M=; fh=eGos3Vk2IgbznXK02juYbfSQo9F55l6bAOEVf1vmgKI=; b=AujYc6jDtnlP1/eadZkWutr6YTVeEVaMMSgoeFiZcRRF8kbZmu8erIboaN4VVWE9y/ LR5awhrEayw+sYUNr/1ioFHhLVl6vuS+ewhE8z3evSBXMtiygt+tl+3QoUneW3wisQSA lagkeIrHhNpFmemDjeSzk+yuac/XDAedtBkN7QMfdEYPaEQibwrp4OUqSZLUCUpM7f3L b7DGCrtZRWmMtnk2PgqTXZ1kaEAsvXpNfMJmmPNQsQzYf0d4tgIUMvxk5kcaAf1OptKK iu2OJfi/zbcP/YA1MYe1KEw7FSfBfVBuNPP6q52+Jz46PtAw1nA6YY6Z68xurHsxQa5K 1KsA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sl1tX3jQ; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id e9e14a558f8ab-3a3d714a859si15424945ab.58.2024.10.16.03.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:06: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=Sl1tX3jQ; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8858A89013; Wed, 16 Oct 2024 12:05:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Sl1tX3jQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D391089041; Wed, 16 Oct 2024 12:05:12 +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-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 A300189035 for ; Wed, 16 Oct 2024 12:05: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=jerome.forissier@linaro.org Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43117ed8adbso72469765e9.2 for ; Wed, 16 Oct 2024 03:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073109; x=1729677909; 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=+9X+r8Q8NFzSd6Hb1M2hwnGKuGR3j9GDjlrMCZXXI9M=; b=Sl1tX3jQYu3v5IRD2n0DEM6B+My6rdVygHnxlARTHySiusaLyauI9E8dRBQETfrfNf nIFPX6sDuJNdExCI3bGBuhKxTsg8nE3Q7itGvZ3YQXS/YWkvIFs0sC9xcycWJVd0QAZi RgkFWqamfFCp+qDqMjeLXQigHbTdAaw0uS2EZHfPkp4/IOdc5EPQrvDniHUc/j9iMT3n se2jWEgo+6r0hJnqCUdB6Ak8SCpNorVw96bdc6z6Akye+7Nfe08QwUvaHvimW1EP/6/W 0nd+sWem/6EyS3TGsCMBqlb6XYqzGsqJgWKMXZMlYJFZQlUaMg2mnZRrCdKty1m2uljp F4DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073109; x=1729677909; 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=+9X+r8Q8NFzSd6Hb1M2hwnGKuGR3j9GDjlrMCZXXI9M=; b=YCs5z95LZprzjkyIAQW2pZ7nIZiEcxY+FYjQ0aZml+yZ3iDUPZ6+DJAfpYxGYTsJWU WGj7qUOVDvs5DmVJFKV9SRXhtUHwsTZtnGWBvt9RSCwwQ3HaBBUnWiH0A/DUscnOZ18s 1vjh+1wQtseLFQG03twBrzzNLED/Dlozg4LlptUrEL3L6EsnjVVS7ggu2IpeSLP1osRl Jc/4gtbTqoKf1Sd+TXyD58qxL/7lThixGnP0OvcE/9+2a/Y41cF5aCKV5l0izY/YV8CW tGhn2uxvJMv8spDJKCkg21H5u1sAOrPkaV6fCn/FUtcP108TjTU9KXQukIYz3JgnY+au o7TQ== X-Gm-Message-State: AOJu0YyPeRfoJtZbptcXs8ZYJo++BnG+aH5d6FWqCPIT9xOOoD6iQ8Ue +lGkG/pzGb5HME6egtX5RKxpLP3vZY/xcZ/iZXfhgVYxPlESsaMj/u8lrLSelqVCFCcAue5onHG x48y3OG8T X-Received: by 2002:a05:600c:4f4f:b0:431:518a:6826 with SMTP id 5b1f17b1804b1-431518a6994mr12682345e9.19.1729073108885; Wed, 16 Oct 2024 03:05:08 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:08 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Simon Glass , Marek Vasut , Sughosh Ganu Subject: [PATCH v13 16/21] cmd: bdinfo: enable -e when CONFIG_CMD_NET_LWIP=y Date: Wed, 16 Oct 2024 12:04:10 +0200 Message-Id: <190ec5f585a987b350b62ef9a89b68cf942b54a1.1729070678.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 f6e534dd5bb..4c0e2adabc3 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -151,7 +151,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)); if (IS_ENABLED(CONFIG_VIDEO)) @@ -192,7 +192,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 Wed Oct 16 10:04:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835803 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346843wru; Wed, 16 Oct 2024 03:06:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWljswllVviIRJYxN2vK28B+StopVMm77rtqdaVqNrYaucXkxzC/Ll72fFsH2AEHzBLp2bfkQ==@linaro.org X-Google-Smtp-Source: AGHT+IGUscTMuAM9j+kV2ZUApUmCos94fekzVH/7Rs6TTNSZ3MM8o4LxsNR/3BLBkOTI7Z4ejuxY X-Received: by 2002:a05:6e02:194d:b0:3a2:4cc4:cfd with SMTP id e9e14a558f8ab-3a3b5faab6amr174336365ab.14.1729073197059; Wed, 16 Oct 2024 03:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073197; cv=none; d=google.com; s=arc-20240605; b=eNjho54UmomRUDx0hGV06Q8pnPgx/I9gkyX9cVrZKVzjLm4JYk/F19rCqZhTtwHtzZ Nls4lamFFxUY/c65oIKPQUUoldHXIDZe8jQHyZr6AgOabdmQwotk+6dJrat1OrmQSFct S/Nm4BSIO3ajJjuR6HaTUr/stwzQdUE4ZecSDNre83C6KSq2V294tEwZnuwPZdukY9Hs FHX0cJCJcctFDED7UwzH169zdIPKfhw1WYrfmJyhpFB4yoImt09omazFEybuCnqg/Eqf F0NlFfOG5x8WPGdBaBelpC1UdXu5CvsMGxcxxs+pd3iYIss9MrxDwLoibYaafTp1I1RK eV6w== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8WNv4mpJ6VyNsS2SIbAVCWQUZxVTVTsg01B6GTJaE+A=; fh=ThdVVZAeTRhYRIsitiRafY870JZ08RRoQKK9619Vak0=; b=PCEt6qA8GSWlg0ljS47um3xiwj+UQXzAva3hHQv7V5n2IWlsQZZgTXFvQUNIrRak8A dJfz4VB8o0C7p4h3sWUGYHXe+AZuCelvLfXdMfgoBdJgxJDXkMAXu7u29wdW99uamrxM rdYDE/Yamh63q3+hE/1/gk1ItrsPmauK5XM4a2U+gtRJxKnfoGid18x/dduoB1LoQj0a SnW37IGX+HM0hWQ3G+5W5ozRr2HljD+il7XMhNqXKc3wNoeGi7kgtacW7QPsfA4Li+tg qHRPbrViJJdtbU7xdUZw1x+dZhfAqCjIQjDUmDW1zhZ9XBhK2U00ylwzsV1nVyDmGASb UwMA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EX8J3Na/"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id e9e14a558f8ab-3a3d71c035asi15293745ab.105.2024.10.16.03.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:06:37 -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="EX8J3Na/"; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EA4D289034; Wed, 16 Oct 2024 12:05:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="EX8J3Na/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5F6E288F35; Wed, 16 Oct 2024 12:05:13 +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-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 969AB88D1B for ; Wed, 16 Oct 2024 12:05:10 +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-x431.google.com with SMTP id ffacd0b85a97d-37d533b5412so3254302f8f.2 for ; Wed, 16 Oct 2024 03:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073110; x=1729677910; 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=8WNv4mpJ6VyNsS2SIbAVCWQUZxVTVTsg01B6GTJaE+A=; b=EX8J3Na/Jgp1Si+4O7kQ3O9ci02ZzPJ2MbBKVKQeXr6bV4rxA5XUMQHhnq+q2rKAD7 GYO40wsOfb4xDoDXDK7Fbt0EveJLvL2cwUQxm2xOraHvCQUM1SJJb6dI7x/dIr+aBhJS dY2JQOL1GgQGnZUogLnvAc6KeX3mTv/s574dAllOzsM8fcv5ozqLtS868tepuiIG7y41 NlIgmLt0v/X4apWkChYDOIuzoz+pECvknnmCNZM5jd6etiP5Bt2WJ01OZi7W+3rEcb7V Ghm2v+jGYy20BkS3PQf9ba/r9eSOtFMEuHJsd9tA8t+djkS9GeTXzFV0TyNHidxe7/j+ 2tYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073110; x=1729677910; 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=8WNv4mpJ6VyNsS2SIbAVCWQUZxVTVTsg01B6GTJaE+A=; b=Qa/0kdKIhLjM64ylT7WFZl8u03wP+8uIO80s/C/YzguMiyzOxKaSNVPwLR+M08Ly2p lCbSMHyCwe6kYO5eN+Ms5DUFB0/pyX9dcuwGWU5U9+Tdqt5KROw8X37PlHC/4e/QRqOG s3M61CJV5kXkkTNNcOSZDWB71GPlcmKWzkmCmUy3D1TVEl1AyR6pBCf9jsxpvegLQjU2 IXLIYHedCRJaOxJz6NjV/ckMcufeiU8/94dkgCanVfYWF4q4PfFn4SSYu/8mpLmv8iMR WuEfkysAIXemrxXzcc1aMXDUOJOtQ/r0z5K/ovVqUAkHQxn92IN/WVGSBxX/ArbT6AlE +wVQ== X-Gm-Message-State: AOJu0YwxnYcryTo9rlpxYCbEJjldA+t2OEY0cUiB18Acka3ZLNO2UHb9 xsTo3TU4sW+UTcBa1N17ZDhtXavbfWRDhWPD0LwimxYZxIyLWNkVeYb198RDitds2/HLmfCnNNw aacD0huU6 X-Received: by 2002:a5d:5f93:0:b0:374:c640:8596 with SMTP id ffacd0b85a97d-37d86be330dmr2667582f8f.32.1729073109849; Wed, 16 Oct 2024 03:05:09 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:09 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini Subject: [PATCH v13 17/21] configs: add qemu_arm64_lwip_defconfig Date: Wed, 16 Oct 2024 12:04:11 +0200 Message-Id: <9f5ecedd572dea342ec8668b2712d8ea24037b64.1729070678.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 which #include's qemu_arm64_defconfig and selects NET_LWIP instead of NET. This config has all the supported net commands enabled. Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- configs/qemu_arm64_lwip_defconfig | 9 +++++++++ 1 file changed, 9 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..d3d8ef16e66 --- /dev/null +++ b/configs/qemu_arm64_lwip_defconfig @@ -0,0 +1,9 @@ +#include + +CONFIG_ARM=y +CONFIG_ARCH_QEMU=y + +CONFIG_NET_LWIP=y +CONFIG_CMD_DNS=y +CONFIG_CMD_WGET=y +CONFIG_EFI_HTTP_BOOT=y From patchwork Wed Oct 16 10:04:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835805 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346981wru; Wed, 16 Oct 2024 03:06:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW0xgiloSU3LyJ2QHg/6QHEDTyi0sPql+c2/bwfCSLmlxB2MSPznSOaJrEzh4DRjH9CNn61nw==@linaro.org X-Google-Smtp-Source: AGHT+IEIsgtJX7xZnqMg5uJ+Lmq0DWRC7zBQ2uxtOIg7arQ/giN0hPFNKdorqd6B0FX2QyZWKuX5 X-Received: by 2002:a92:cd8f:0:b0:3a3:983a:8741 with SMTP id e9e14a558f8ab-3a3dc4b5094mr33122785ab.11.1729073217582; Wed, 16 Oct 2024 03:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073217; cv=none; d=google.com; s=arc-20240605; b=R5xaBqYZzyT2wFDMIa4wCpOQsXG8L5DORMBsui1lKgxIVijuJVFomRZC4q8pA+SpZP b5BI6Q8Sul4Z2iyNLHDz/MljLF1RXzlvndWtv4ykF5P/rEY6rGe13tAIpUxL/EU/0o2K hAWRgthJmaEAtCdiXXRpKQvKsne+UbDpZBi7UPduAE1w2AXzw0kjlHyp1M3+vUDdxUyZ q5A8mrkzCAyqwoa1jUOLRg46b3N4XkHcxmn+pwT5iAafNM/7O9OOrnlurBA+5SU03Wh2 EMxXXCEBXGqq6WWYxGvCjn1jL+IXq2an+V7c2Psj6E4tSOnSaFahOWGIIyucHFAHmsvh Amvw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UstkIm+ijHllLvOXzkUy9wxcqEq/3TyBpF6CmLrmLFo=; fh=ThdVVZAeTRhYRIsitiRafY870JZ08RRoQKK9619Vak0=; b=ImlNi3IIwaQFpMlORqHAtED0NITdoxKBAlH/TztLhJUljxQPltYV2g0xES7+yf8XJr YSuo0dlGOy5IK/RDlHm67YBJ4w0o1IcFQYA4cQpuXYoJzxYchkTQpYyzF4Mu6A9OBjHm PTsCV2wKEoi1lqWXKerqdANR07w+9mKBsnVlMJQxzm6O9zgoE93VpZX8eYFqlpYcJcwv 6SHJM30Dndkjbpgsy+PqAwT2XIBviahXtwvRm+HHF3n2mMgrl68wIvyRZRzq26gPiWEo ZZldfaPCIUpSAjtcJ2OqOVhqwL6y6/7PBHqqY4kMs3YmkqnpkKW0KBwz877LjrgLnTgw Ratw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uch3A8BJ; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 8926c6da1cb9f-4dbf5be6af0si874801173.196.2024.10.16.03.06.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:06:57 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uch3A8BJ; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D00A889043; Wed, 16 Oct 2024 12:05:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Uch3A8BJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2D64288FCF; Wed, 16 Oct 2024 12:05:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) (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 1455F89005 for ; Wed, 16 Oct 2024 12:05: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-x12b.google.com with SMTP id 2adb3069b0e04-539e7e73740so3365357e87.3 for ; Wed, 16 Oct 2024 03:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073111; x=1729677911; 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=UstkIm+ijHllLvOXzkUy9wxcqEq/3TyBpF6CmLrmLFo=; b=Uch3A8BJQCRDbCQbEbjBOihrF+x3a2QUcc1oSqBpfIZ6Be3gBnaQ2NuUkboKdTwqvT gnikV+jSaFjb4DXxzY8CfNLJYAfFSXtNGtN8l96b6sP8udwT5+lVRlGlsNTqX9aMCBgt JsvhoV/oV6UutAMlFd6T+I48J6QN2DbagRFOAtInNVnReWy6o1PhXrfgvOm4n47dUmFF Eb2jFCiMB2QL8O5JF/vYDRC1+0shoijxDqNercUOBUK0hb94zfQWkInKTWDiosS5ODnf bPPQqGBs5S2zJYAmY4ys3ZmWmZ0n75eqtSb3WJYFZ2u0qslTVjGnAJFywzXi5igcWpyJ e04w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073111; x=1729677911; 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=UstkIm+ijHllLvOXzkUy9wxcqEq/3TyBpF6CmLrmLFo=; b=mkTLc1I+FAslRnY/tXqCPQ3TspJCUT+FvjQj4I/DGOjsxmul74LuXHwCPzD6QjBZvZ LEqxqqkdEH/Si/+QCXa3dFJDKQZBN6v4t/4fTpH4yj0jmCEXv8AoI01kDSVgINKeWTxs NOh3mtz70zM13+714YKLblV1UH1PTR5R7nprv9aWXxnkGV8Bn+LJ/KW0SuE9krZ8ug7+ CaO9ZhfJtdpENmrQ8DNQS7WR7ijZLMx/uHXLe+xrH1G97MtNC9+LJqivwetKldxvLIoj lprnype3/qm9oJ1y59ku2qUlD4NhEpPAqmIybk6Zwm8ew4OqBul3oe6WgAX37gC2BLOP RfvA== X-Gm-Message-State: AOJu0Yyi9+X41bWf6NUD0fXgNWCe/Pg8YrznVTXaG2oBQhjxVoAa07O/ sleCORlvU+9CufE+akFWOJaxyfRjZftk8kabpihT8Ueialk4IBilGwiLNN8B/r4w0XYxfx82vpq 4T49UzgFc X-Received: by 2002:a05:6512:104d:b0:539:e6bf:ca97 with SMTP id 2adb3069b0e04-539e6bfcc84mr7517311e87.32.1729073110980; Wed, 16 Oct 2024 03:05:10 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:10 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini Subject: [PATCH v13 18/21] net: lwip: tftp: add support of blksize option to client Date: Wed, 16 Oct 2024 12:04:12 +0200 Message-Id: <48a03b7edc450fbb754247152662a40f5bf23bf2.1729070678.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 The TFTP protocol uses a default block size of 512 bytes. This value is sub-optimal for ethernet devices, which have a MTU (Maximum Transmission Unit) of 1500 bytes. When taking into acount the overhead of the IP and UDP layers, this leaves 1468 bytes for the TFTP payload. This patch introduces a new function: tftp_client_set_blksize() which may be used to change the block size from the default. It has to be called after tftp_client_init() and before tftp_get(). If the server does not support the option, the client will still accept to receive 512-byte blocks. Submitted upstream: https://savannah.nongnu.org/patch/index.php?10462 Signed-off-by: Jerome Forissier Acked-by: Ilias Apalodimas --- lib/lwip/lwip/src/apps/tftp/tftp.c | 92 +++++++++++++++++-- .../lwip/src/include/lwip/apps/tftp_client.h | 1 + 2 files changed, 87 insertions(+), 6 deletions(-) diff --git a/lib/lwip/lwip/src/apps/tftp/tftp.c b/lib/lwip/lwip/src/apps/tftp/tftp.c index 74fc1fbe586..56aeabc4d73 100644 --- a/lib/lwip/lwip/src/apps/tftp/tftp.c +++ b/lib/lwip/lwip/src/apps/tftp/tftp.c @@ -57,7 +57,7 @@ #include "lwip/timeouts.h" #include "lwip/debug.h" -#define TFTP_MAX_PAYLOAD_SIZE 512 +#define TFTP_DEFAULT_BLOCK_SIZE 512 #define TFTP_HEADER_LENGTH 4 #define TFTP_RRQ 1 @@ -65,6 +65,7 @@ #define TFTP_DATA 3 #define TFTP_ACK 4 #define TFTP_ERROR 5 +#define TFTP_OACK 6 enum tftp_error { TFTP_ERROR_FILE_NOT_FOUND = 1, @@ -88,9 +89,11 @@ struct tftp_state { int timer; int last_pkt; u16_t blknum; + u16_t blksize; u8_t retries; u8_t mode_write; u8_t tftp_mode; + bool wait_oack; }; static struct tftp_state tftp_state; @@ -137,10 +140,22 @@ send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname, { size_t fname_length = strlen(fname)+1; size_t mode_length = strlen(mode)+1; - struct pbuf* p = init_packet(opcode, 0, fname_length + mode_length - 2); + size_t blksize_length = 0; + int blksize = tftp_state.blksize; + struct pbuf* p; char* payload; err_t ret; + if (blksize) { + /* 'blksize\0'.\0" with . = 1 digit */ + blksize_length = strlen("blksize") + 1 + 1 + 1; + while (blksize >= 10) { + blksize /= 10; + blksize_length++; + } + } + + p = init_packet(opcode, 0, fname_length + mode_length + blksize_length - 2); if (p == NULL) { return ERR_MEM; } @@ -148,7 +163,10 @@ send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname, payload = (char*) p->payload; MEMCPY(payload+2, fname, fname_length); MEMCPY(payload+2+fname_length, mode, mode_length); + if (tftp_state.blksize) + sprintf(payload+2+fname_length+mode_length, "blksize%c%d%c", 0, tftp_state.blksize, 0); + tftp_state.wait_oack = true; ret = udp_sendto(tftp_state.upcb, p, addr, port); pbuf_free(p); return ret; @@ -221,14 +239,14 @@ send_data(const ip_addr_t *addr, u16_t port) pbuf_free(tftp_state.last_data); } - tftp_state.last_data = init_packet(TFTP_DATA, tftp_state.blknum, TFTP_MAX_PAYLOAD_SIZE); + tftp_state.last_data = init_packet(TFTP_DATA, tftp_state.blknum, TFTP_DEFAULT_BLOCK_SIZE); if (tftp_state.last_data == NULL) { return; } payload = (u16_t *) tftp_state.last_data->payload; - ret = tftp_state.ctx->read(tftp_state.handle, &payload[2], TFTP_MAX_PAYLOAD_SIZE); + ret = tftp_state.ctx->read(tftp_state.handle, &payload[2], TFTP_DEFAULT_BLOCK_SIZE); if (ret < 0) { send_error(addr, port, TFTP_ERROR_ACCESS_VIOLATION, "Error occurred while reading the file."); close_handle(); @@ -239,6 +257,28 @@ send_data(const ip_addr_t *addr, u16_t port) resend_data(addr, port); } +static u16_t payload_size(void) +{ + if (tftp_state.blksize) + return tftp_state.blksize; + return TFTP_DEFAULT_BLOCK_SIZE; +} + +static const char * +find_option(struct pbuf *p, const char *option) +{ + int i; + u16_t optlen = strlen(option); + const char *b = p->payload; + + for (i = 0; i + optlen + 1 < p->len; i++) { + if (lwip_strnstr(b + i, option, optlen)) + return b + i + optlen + 2; + } + + return NULL; +} + static void tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port) { @@ -338,6 +378,15 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr } blknum = lwip_ntohs(sbuf[1]); + if (tftp_state.blksize && tftp_state.wait_oack) { + /* + * Data received while we are expecting an OACK for our blksize option. + * This means the server doesn't support it, let's switch back to the + * default block size. + */ + tftp_state.blksize = 0; + tftp_state.wait_oack = false; + } if (blknum == tftp_state.blknum) { pbuf_remove_header(p, TFTP_HEADER_LENGTH); @@ -349,7 +398,7 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr send_ack(addr, port, blknum); } - if (p->tot_len < TFTP_MAX_PAYLOAD_SIZE) { + if (p->tot_len < payload_size()) { close_handle(); } else { tftp_state.blknum++; @@ -386,7 +435,7 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr lastpkt = 0; if (tftp_state.last_data != NULL) { - lastpkt = tftp_state.last_data->tot_len != (TFTP_MAX_PAYLOAD_SIZE + TFTP_HEADER_LENGTH); + lastpkt = tftp_state.last_data->tot_len != (TFTP_DEFAULT_BLOCK_SIZE + TFTP_HEADER_LENGTH); } if (!lastpkt) { @@ -405,6 +454,25 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr close_handle(); } break; + case PP_HTONS(TFTP_OACK): { + const char *optval = find_option(p, "blksize"); + u16_t srv_blksize = 0; + tftp_state.wait_oack = false; + if (optval) { + if (!tftp_state.blksize) { + /* We did not request this option */ + send_error(addr, port, TFTP_ERROR_ILLEGAL_OPERATION, "blksize unexpected"); + } + srv_blksize = atoi(optval); + if (srv_blksize <= 0 || srv_blksize > tftp_state.blksize) { + send_error(addr, port, TFTP_ERROR_ILLEGAL_OPERATION, "Invalid blksize"); + } + LWIP_DEBUGF(TFTP_DEBUG | LWIP_DBG_STATE, ("tftp: accepting blksize=%d\n", srv_blksize)); + tftp_state.blksize = srv_blksize; + } + send_ack(addr, port, 0); + break; + } default: send_error(addr, port, TFTP_ERROR_ILLEGAL_OPERATION, "Unknown operation"); break; @@ -495,6 +563,18 @@ tftp_init_client(const struct tftp_context *ctx) return tftp_init_common(LWIP_TFTP_MODE_CLIENT, ctx); } +/** @ingroup tftp + * Set the block size to be used by the TFTP client. The server may choose to + * accept a lower value. + * @param blksize Block size in bytes + */ +void +tftp_client_set_blksize(u16_t blksize) +{ + if (blksize != TFTP_DEFAULT_BLOCK_SIZE) + tftp_state.blksize = blksize; +} + /** @ingroup tftp * Deinitialize ("turn off") TFTP client/server. */ diff --git a/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h b/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h index 24dbda6a8c9..e1e21d06b67 100644 --- a/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h +++ b/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h @@ -44,6 +44,7 @@ enum tftp_transfer_mode { }; err_t tftp_init_client(const struct tftp_context* ctx); +void tftp_client_set_blksize(u16_t blksize); err_t tftp_get(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode); err_t tftp_put(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode); From patchwork Wed Oct 16 10:04:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835804 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp346918wru; Wed, 16 Oct 2024 03:06:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVCH6LE7Nb5TAVGkLqkYu/a3CaXTb+/k+GvOJtjbnEdZuTSSAv3M+RlcrfgKINimAuhZpps7g==@linaro.org X-Google-Smtp-Source: AGHT+IGK5st4FxHNdh2pLuQ1tmWCkCTC77xf6FQCO3WXwRCPgW8x2HSKD7EypAXOoWY4pQHM8wrR X-Received: by 2002:a92:c24f:0:b0:3a3:449b:5989 with SMTP id e9e14a558f8ab-3a3dc4f635emr33445125ab.21.1729073207340; Wed, 16 Oct 2024 03:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073207; cv=none; d=google.com; s=arc-20240605; b=QkYCdYhux0agGOY3vzo9iCtmVWuRcTN2OPVfcRI4tneH8Ah8ggN9xXNXcn4yN1FELx eka6YpYdxlsfHueEzEvLKfAUjRErfwbysnPeOoMPWjZLsgjWiL348r6IOglMkW6YuQDl gFvFXqs+hOormIhffewJzHeAfVsC90z5kY3SvvynFB65pmArF8Rxgm8pVY9caZdT8PIT Y8gLVWn39CxEcb797RK7pG69rr89lY+u8rDMN6XJcBQg/ZrJR3zJBOovvKTCiyFIT/CE 3Uoof6FC4MqFKsWJZlos4O0zulAZ5A/v3lCwWcbbxN9atxks8tqWA0gDajO/ywNrwoHH uSbw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5G+9QtFQpBdFjhMWrV1vO4Z5+gjUnIBRwFl+FYgTv68=; fh=8LAzHPYFumYV4f2J8/2jQOtKLAr6TBnp6a+gbEwg0U4=; b=e9a8QyRvEDi3Cslp2Zzg+lMtK24GoyWGFmfghLE5ieJ56kEpr4ojbI7X+ObD0DkNJx gr6zxba58qA4I/2B5tfIfo5IwhG48G2WgVWDi+tYItKx3vTWCTbTC0qD/GyQczwN2qB+ 0tBXd1pkA3eN55BIvIcTq97XWrNM75CUlPuWQcvvctOkxzRe+r3ZxVTa8HXBmGq5Shwi qe96GPwRVVijCyCMv+TygRwkuIUr7i1sWpw9QRiiqibR3lFtVF1NoerpniOk2X8QysMs /F49agQAcOubOG4omUULjnH4rvTdnPCbAEot+IPW3hp6V+5OxH0mtQlpbP8sO9WhIsXN 2l4A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YZudyCAf; 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 e9e14a558f8ab-3a3d71d3203si16646115ab.164.2024.10.16.03.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:06: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=YZudyCAf; 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 68A9589024; Wed, 16 Oct 2024 12:05:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YZudyCAf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2300689043; Wed, 16 Oct 2024 12:05:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 22E0688FCF for ; Wed, 16 Oct 2024 12:05: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-x331.google.com with SMTP id 5b1f17b1804b1-43140a2f7f7so14955765e9.1 for ; Wed, 16 Oct 2024 03:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073112; x=1729677912; 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=5G+9QtFQpBdFjhMWrV1vO4Z5+gjUnIBRwFl+FYgTv68=; b=YZudyCAfJOvDLvDMeoQv1aCH0N/O8KmTz+TPs9AaJBMbLQSQQyMj8wtUcZmDLlHxtr GVkU3yaBwe+VAkcF5we7eOv65eW7nDPHKViczbaE7v0j+FGf6eWGk5e85AGnOwucAy9I Vbv7qCZ2Cw8unQipONzLuFSZekKZjbc2XajkXql0++WaRMJPoNFlZQBNVyYbD8Gb7rQ2 muCm+i+55MNoZ/R45UDtqZfBtZ37pwYFdTLgbTkPzbwuIr/TKjFiCCWW5GIlncgN/0CR hdjHJas+PGWFM6DGx/k9uo1hZdNQv5KwZt1tj3k9YuiBjVE0fZPnVErOO2y4qj6g4BDB hyeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073112; x=1729677912; 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=5G+9QtFQpBdFjhMWrV1vO4Z5+gjUnIBRwFl+FYgTv68=; b=eqz1aSJrHwub6qBxk7SriuHW2bV5RNnXjFWxWWG1X327I3ptBwwFcZmqcl4XIHLcpd M5DOHvAkh8yptPRNiuT1/taouaYlEU0GSDMrUXYlz3kv7IykgOMfveUqsAGSEhBteMf8 SrLTwQPlemADmP5gtK/11C/U27xn5mYJqI+mRy2n55AeXTbYSliHda6bDXXCpjv2d4SP lmWLcEBHMW+h1aNHZYAANDMd/e/ECtcqvmh2J07yzwi3MGH0PPDxUjyLxgiyCpbZlTrz fDebIl3vy1XngmhIovhHbjgFmnpAPkEmrtdlkOnMJ/omwEjvAEhtiMk0Z/+htaWsu+H8 NTfg== X-Gm-Message-State: AOJu0Yws2QpkimhgFh2pvLxFLnGVT/sUDR5mCly53XvFXvm/CCcEYSod Lk4fLT4SntvYJY3nodWo74s1srY1Xu0InGYC53TZBTxt9cI0qU4CSbnAfNOfkxWoSqimaFEPbka T1mqu5mlu X-Received: by 2002:a05:600c:348d:b0:42c:bb10:7292 with SMTP id 5b1f17b1804b1-4314a283c84mr32736995e9.1.1729073112357; Wed, 16 Oct 2024 03:05:12 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.05.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:12 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Joe Hershberger , Ramon Fried , Tom Rini , Baruch Siach , Simon Glass , Anand Moon Subject: [PATCH v13 19/21] net: lwip: add TFTP_BLOCKSIZE Date: Wed, 16 Oct 2024 12:04:13 +0200 Message-Id: <73f71d0e474d581a693e980ab95beccd23e8f646.1729070678.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 setting the TFTP block size. The default value (1468) is fine for Ethernet and allows a better throughput than the TFTP default (512), if the server supports the blksize option of course. I tested this change with qemu_arm64_lwip_defconfig. The throughput is now 875 KiB/s vs. 313 KiB/s before. That is still a low number, but I think we can't expect more without implementing the windowsize option. Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- net/Kconfig | 20 ++++++++++---------- net/lwip/tftp.c | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/net/Kconfig b/net/Kconfig index 16a9de47e94..76ab7d91eeb 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -60,16 +60,6 @@ config SYS_FAULT_ECHO_LINK_DOWN this option is active, then CONFIG_SYS_FAULT_MII_ADDR also needs to be configured. -config TFTP_BLOCKSIZE - int "TFTP block size" - default 1468 - help - Default TFTP block size. - The MTU is typically 1500 for ethernet, so a TFTP block of - 1468 (MTU minus eth.hdrs) provides a good throughput with - almost-MTU block sizes. - You can also activate CONFIG_IP_DEFRAG to set a larger block. - config TFTP_PORT bool "Set TFTP UDP source/destination ports via the environment" help @@ -254,6 +244,16 @@ config NET_RANDOM_ETHADDR generated. It will be saved to the appropriate environment variable, too. +config TFTP_BLOCKSIZE + int "TFTP block size" + default 1468 + help + Default TFTP block size. + The MTU is typically 1500 for ethernet, so a TFTP block of + 1468 (MTU minus eth.hdrs) provides a good throughput with + almost-MTU block sizes. + You can also activate CONFIG_IP_DEFRAG to set a larger block. + endif # if NET || NET_LWIP config SYS_RX_ETH_BUFFER diff --git a/net/lwip/tftp.c b/net/lwip/tftp.c index 26978643313..f4d0a6aa19a 100644 --- a/net/lwip/tftp.c +++ b/net/lwip/tftp.c @@ -139,6 +139,8 @@ static int tftp_loop(struct udevice *udev, ulong addr, char *fname, if (!(err == ERR_OK || err == ERR_USE)) log_err("tftp_init_client err: %d\n", err); + tftp_client_set_blksize(CONFIG_TFTP_BLOCKSIZE); + ctx.start_time = get_timer(0); err = tftp_get(&ctx, &srvip, srvport, fname, TFTP_MODE_OCTET); /* might return different errors, like routing problems */ From patchwork Wed Oct 16 10:04:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835806 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp347049wru; Wed, 16 Oct 2024 03:07:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWqqv9KgvTzi7wwurOXJDeMqXli08HujRpfpDWmiJ6PP8lyee1F0BmjbXNss9AkKI/Tuq696A==@linaro.org X-Google-Smtp-Source: AGHT+IHZiu7GmXXsLGxQb3m2I+R3oaYKs9KcgGISeLctY44BkcJy5HRInVckhCopt+N8m2UHOPA2 X-Received: by 2002:a05:6602:640a:b0:83a:97f6:db4 with SMTP id ca18e2360f4ac-83a97f60e4amr374209439f.10.1729073227554; Wed, 16 Oct 2024 03:07:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073227; cv=none; d=google.com; s=arc-20240605; b=FSBH8w0yEZG0xpPd2UDkwh3LHaf94YwFWj0zt9XAfMqZYwUywI64oRw5nA070ZIW1a q09qRz5jb8c8VVk91v4iRXJ8hM+WeqW6MkQHZt1BVXoQyXR0eU/MlawkLhwSZHsn1Prd xo+T6PN255UvSq3YnYyd3CSLiLV6meU6/3GQz3ZP1xBlMGEH0Ec6gGcnkdAR0dIBJPTp 73lAUSlZoU6LqTQDVEPfX1Ugar/x6b+9ESrt12llCbLedYFeuxTmYlroqErainqfX8cc o6yIkSjmNfVC9IFmfIaBDh/JxCT7PPYULEBAzY98E7szYk+oQPXXclnaCqT2bUu4wW/L cdbg== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RlEGcCckJebs0pW6biLF/S5mvNiFVZJ9cWiuKYi7FxI=; fh=ElZ1Qkp/XXUV92IeOM6Vn/mWDvCrIyBhXpASk2K2VMY=; b=MndhEjRp4QQUocxwZG8Cq6X5al7p0JvsRmZKKoUuvTqLgkakU9AbIx4ZHLPxWZxLc+ gahHVk86wq6tbbeYiQLcNGqCGLp55qPcCBL0o/TxITacSFKNnFa5607BJcsI1G41omXw wp4cz9CwU1CAI6tZNtczMMtulrAwYZSDJNLnFHU5u0zafomcnqgvK1Lkjbgw52HZpr1g NjaT8kifazYvMHUbT46Vt2CdhEa1A3sO0vZmpCM8GfipAbaNzLo6L4g3JEAmiEeoKla5 Ke56asjGpYKFYhabpvFLJOxpGV+SqvrUddcGnP9go/zwx9R8+/EDYsZQJv55mh45aSe9 wyyw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XHE4DjeG; 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 8926c6da1cb9f-4dbecc675dasi1477130173.86.2024.10.16.03.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:07:07 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XHE4DjeG; 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 475B48904B; Wed, 16 Oct 2024 12:05: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="XHE4DjeG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A09A389024; Wed, 16 Oct 2024 12:05: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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 394D088D1B for ; Wed, 16 Oct 2024 12:05:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43118c9a955so54055355e9.3 for ; Wed, 16 Oct 2024 03:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073113; x=1729677913; 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=RlEGcCckJebs0pW6biLF/S5mvNiFVZJ9cWiuKYi7FxI=; b=XHE4DjeG1lv/H/QM0yQ5HLCHE/u3dR1YJP4/Bb+uiLUZ8P1qOgwjOGz4045s6zciJx cUT+TF+8x0Rg7mPZv8jKWoKdkLoW1U7jsCeU4dpIzyUEYNrIloIiQtWt6J04CjUHHKCL 7YYtT7h90yPlO21KmdNCapPOKIokNnfd0j5JGYTjTcu9yNaYjlsDJGNUn+rd9EbzAITW tbXOoVwCqb+3JkxlrH3i0bg5nfLSwZQfbJG+ZohO1fxyW8FPtmVeHKDlPnvHlfOPGmz8 2Hle+3o3gvKsX4VBTLtrN5GJs23IBfyxyAW5jWE6G8jjYY6Tr/Q/kErEm/j0m3VZdmB7 FF6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073113; x=1729677913; 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=RlEGcCckJebs0pW6biLF/S5mvNiFVZJ9cWiuKYi7FxI=; b=r8J7xi2maHqIFLdkTdJImiWbNIgGqmY3FUYN9AVYnfTA1udedc87++BtY8BoPLO8Nh RaThJa/ag0ZlUcCU84ZjlcVW6Xm0pIUlIxLXZhCIT4vhf6sg4BuS55NXMN6JXI33sNZf 1SVCA2W0d5gjKZFzxvvISc4EnVCVBpm7N0jhEZ/XQ6NFpxI72Zt4q4XtY6ydefxM8pV5 hbeUCi0dbTBP5/NStSGJ1Pdguid+gKKVhNi8zT4zF8TsPivl1buLip6C4019AVhlUJIU wH6ElvxQ8/EpO2ZmyroAMKDJ97AvQ6SCPqzaoeyKMrXGQi8iyPPFUQmSofZx/qXpMOC4 4Liw== X-Gm-Message-State: AOJu0YwlUCBAa/Jn27jD5JRp9ANes0Prg6Dfg/FaBlIt+hzXUoLK0JbB hnC3WWUfzINlEOg2QL8VQRBkM8DH+g0WheSalZgiZkyPei5/IZ4PEAVoHsLTaYiqLNbbTiRn9ZT hQ+vHTETK X-Received: by 2002:a05:600c:1f0e:b0:42f:8515:e47d with SMTP id 5b1f17b1804b1-4311ded2340mr154723725e9.11.1729073113512; Wed, 16 Oct 2024 03:05:13 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:13 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Simon Glass , Jiaxun Yang , Heinrich Schuchardt , Sumit Garg , Sean Anderson Subject: [PATCH v13 20/21] CI: add qemu_arm64_lwip to the test matrix Date: Wed, 16 Oct 2024 12:04:14 +0200 Message-Id: <9d0144a953860094bec5f1278b5dd9b1c85245b2.1729070678.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 +++++++ .gitlab-ci.yml | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 11f1d5ad20a..813640df92c 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -239,6 +239,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 @@ -419,6 +423,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" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d938c7f31d6..d89657e28b3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,6 +27,9 @@ stages: # Clone uboot-test-hooks - git config --global --add safe.directory "${CI_PROJECT_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 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 @@ -348,6 +351,12 @@ qemu_arm64 test.py: TEST_PY_TEST_SPEC: "not sleep" <<: *buildman_and_testpy_dfn +qemu_arm64_lwip test.py: + variables: + TEST_PY_BD: "qemu_arm64_lwip" + TEST_PY_TEST_SPEC: "test_net_dhcp or test_net_ping or test_net_tftpboot" + <<: *buildman_and_testpy_dfn + qemu_m68k test.py: variables: TEST_PY_BD: "M5208EVBE" From patchwork Wed Oct 16 10:04:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 835807 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp347176wru; Wed, 16 Oct 2024 03:07:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWkojzHqoHqu13l/GrQzsTdITUaUOd5iV9VvZqqNwx2NY97j4qQYGrQ0fcaOhWWr78VPzULXw==@linaro.org X-Google-Smtp-Source: AGHT+IGToAHDZOU2mDJ2choWRBQUCVaXwGu8xGbgsh4MJ19XXhuNUxArEKqFRT3j1bl0usUOxlUg X-Received: by 2002:a05:6602:2c08:b0:82d:581:8860 with SMTP id ca18e2360f4ac-83a946fc657mr419535639f.12.1729073240465; Wed, 16 Oct 2024 03:07:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729073240; cv=none; d=google.com; s=arc-20240605; b=WV3Nh5khyYYGrLwEMPRHcKjlUFB/90YH6J91H7nugnVD3p8vLHvrU2jn9RMQPGkgaT b+6vYm7DHCeoPkqdfH4o90r/2U9wlCbQqHSUcmN7v0LExcADRukUAQFzYk8hprpXC9G+ Jmlxtk2Ru0LTKVZ2tjy5kwZIhkSbSQqXta4OJQZ+TL0cB1laDbkTfKYoiUzrlAwav+Al pQj7h8h0VIb9WLOjdC/4YWL6ZgUJzFJMEISNmrFG7LT9J77xxBbshaXEzY/iPBS5acg8 uuwcFAAQQv4gEcnW+KBGGaKz50jPOGML1ySSaxQGByXX0MpxToS5XHeGnUf6jevc6M3Z wd3w== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4h6VcNLv4Vpk88+08IBqjyDjb7puX0F1+ZOc2WycMgI=; fh=mroFudzAw/8Zz/19AF0ZNj7om2I2vrlhkivshQO76/U=; b=avnSASo7jk9ZWZI53TMOsbJcas0AhOfqms4UNAMArmWd4KotBVS2LCxpI/AO77C8wg bAXpt8s9qhJdcmcbw0nzwWJJWZpjvBhP2AGj/t+qr9dSawFDZyoIRJkTzK1izc+draVN ft64KJQWKN6yxZFCvXYdDfKn3HW3KxBSGIyDKYf9j6XAF3+8kwiAEtwi3C1sIxRHYGj5 iS6ADhoLhpYgCtwpqK6RoVTRR+QmqqUuamporcDBGErf5EiBAanaRr7+hTZ44Hd/fqQl GqDVOcUVUOMMnqSO2X/CMVNCLmI9lL6HtnhsWw9dRXfD7xNQsx85QIygOghLBozJr1MA cmVg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wf6ygkLJ; 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 8926c6da1cb9f-4dbecb382d5si1717323173.25.2024.10.16.03.07.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:07:20 -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=Wf6ygkLJ; 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 ABCF189067; Wed, 16 Oct 2024 12:05:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=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="Wf6ygkLJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7965C89059; Wed, 16 Oct 2024 12:05: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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 85DA288D1B for ; Wed, 16 Oct 2024 12:05: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=jerome.forissier@linaro.org Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-539f4d8ef84so3970004e87.0 for ; Wed, 16 Oct 2024 03:05:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729073115; x=1729677915; 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=4h6VcNLv4Vpk88+08IBqjyDjb7puX0F1+ZOc2WycMgI=; b=Wf6ygkLJByIPCKgetisk6M6v1r8TcV8fHWSBHMOtNZPEgSpihy1qZlbilLGx+Ai8Jg Ing9WcFh07N0+YfGA0Qm1fHMij4wsbt0QhByVX2KUD3TfiReAUSlopTS1hZJ8AK8Cpz7 +58oQn0gy+7SoFqxdwMStDMi41thFIrJRqVUIgoo7Ne03dmDjtz+KBazw8d5bp8x6HBv vT2uDLd0GHFS0wE0lGsqBfjqAGKZap2bBTbYXs3YU1XUMPp8+md1HEw29cPLDpPt7Cpa /LlKigXjm9vr1NlnGWvNOifk+BRNRUS4PqR2z+kt0INXusT77lekxcQYt1DmyrSK9ux5 rFaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729073115; x=1729677915; 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=4h6VcNLv4Vpk88+08IBqjyDjb7puX0F1+ZOc2WycMgI=; b=bkwhOOGLiOxNhbDrsod9/+B9dlxsKgzXclujvERPzXe1mj6gx11QZsQouj/fGmytkF wHQv1oi/XUJITru1ruRyRuyFWPhF0ejmAJfJGNmO1urh5qaoeXuPEbY9NgLcHrcx4x07 Y2bipcNwZy1YsmtrVqmKiubLRzcdHolhzQs4ds4NlPKGs5zktVHWf33+syRQdAtDXmzQ JEZtOvv+cUsrKE+g++/pMEd9T99ezXOGcZ/jwQBLx7NrE2OzKVcAIAzcN6wwIlcoh8h6 u6IV+VhaVuAu7r6mVgZajm3/kSuKOTTfHn8xrYd+wajrY57QIpUJhd2dV8POBTlhklLb sEnA== X-Gm-Message-State: AOJu0Yznvbn8pyGqlI3ndpUz9t/YucEJT5O35/E2oiJj0x0kdv35bjf3 D4TH7pHFT97l+c5Rsypsz+6yZF/TTK7N/cp4aUbNLvRw+twa8TZ3HI6kOu/tIJ6OKxAnwM9MpDg 4zVmOltbP X-Received: by 2002:a05:6512:401d:b0:539:f953:2da7 with SMTP id 2adb3069b0e04-539f953300cmr4593355e87.50.1729073114673; Wed, 16 Oct 2024 03:05:14 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56f241sm44634515e9.22.2024.10.16.03.05.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 03:05:14 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Simon Glass , Mattijs Korpershoek , Sumit Garg , Neil Armstrong , Caleb Connolly , Oliver Gaskell , Robert Marko , Sam Protsenko Subject: [PATCH v13 21/21] MAINTAINERS: net: lwip: add myself as a maintainer Date: Wed, 16 Oct 2024 12:04:15 +0200 Message-Id: <466ecc59448cff7f6479a47fb8ccf26a4674705d.1729070678.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add myself as a maintainer for the lwIP network stack integration code and network commands as well as the sandbox ethernet driver for lwIP. Signed-off-by: Jerome Forissier Acked-by: Ilias Apalodimas --- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 09298e6bc86..7c6c368285e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1359,6 +1359,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: drivers/net/sandbox-lwip.c +F: include/net-lwip.h +F: lib/lwip/Makefile +F: lib/lwip/u-boot/ +F: net/lwip/ + NIOS M: Thomas Chou S: Maintained