From patchwork Wed Oct 9 14:50: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: 833963 Delivered-To: patch@linaro.org Received: by 2002:adf:a1de:0:b0:37d:45d0:187 with SMTP id v30csp150610wrv; Wed, 9 Oct 2024 07:52:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXoSkw57UhVq32lPtPRVM6mHVrLBAwVXSVy4til2z93IynNoHA4nn4exvblYQmqlg+Xd3Yj3Q==@linaro.org X-Google-Smtp-Source: AGHT+IHwdqhskG5OtKqTQhP9xgL4nvKY2kVX9FEpglvv8g3F8w5jHSIhNhzDg28b/t4BwzzmUZUU X-Received: by 2002:a5d:4806:0:b0:37c:d1b6:a261 with SMTP id ffacd0b85a97d-37d3aae6ea3mr1804609f8f.59.1728485551538; Wed, 09 Oct 2024 07:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728485551; cv=none; d=google.com; s=arc-20240605; b=gjonaMGVhG139etD2VpmjjU/GSwhC48JXZDL4vhZ1yI1B5vM4oFYjaHtKzqkpBHDSW F8dkblgjHLd8b1Lsk6fKKSeZICkvnZBgaJLYTB0iPcMPEnhEd0uHZF3iAL3CWIjCASan GdwZVxO0wu/LOFrlW43JCgcn9mVSVGKLP5z3VP9qNiEGWY/V13Qy/2PlJdiMAchJbWZX 9/3RRkR2IBSWWAQbALwXRq1W08GI/+RSbUVJKJ4JTb5mGFVFYAC9XkAHViIbCjCBdKIr CvlI1SJucS2wfQQfNlLoQ5C+cQ6iDp/Zw/W3YfDZH2uzFTynVtqz53u5bXsdOzBVrHn4 E5bg== 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=d0mSM1jsVss7SUbfDBE8U6K5oLoJU0M/QPe43V35RwU=; b=CcUythbxZd2G4eXwkb/w9Z2DQfZ1I8dMk84N/6b+odrTGxt+r3tTuT2jvqVyMMw8aY NNd90N8vSjVcFLQ0cj87dkKWC03d6tYOzMG/3QdgwI23IwOCqGSfZY2K7jwXisSEpONw Yb2t7YYShcRyftXwnnI6Edbu/YtvUJ8XsLQiG/3ksQFcL6qFej1ulIRZVFNgR6nzCQr6 3eFUjY+ond/jk4nCq3YqgmXeC4tMEazNST38gV/8BM8dJiferyhwFpPe+k5Ir/DJepS4 vhDCpx1/mIpXrjP8GDPpo8eV4SYgBFEgYFZd66jtVSOMBeDy9BUHzw6mT9496k+d47dt A+Tw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cAYQ9PyU; 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 ffacd0b85a97d-37d1699671dsi4324442f8f.727.2024.10.09.07.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 07:52:31 -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=cAYQ9PyU; 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 2AD8D89196; Wed, 9 Oct 2024 16:50: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=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="cAYQ9PyU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1641C88CF1; Wed, 9 Oct 2024 16:50:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1F1F989189 for ; Wed, 9 Oct 2024 16:50: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-wr1-x434.google.com with SMTP id ffacd0b85a97d-37cc9aeb01dso4537068f8f.2 for ; Wed, 09 Oct 2024 07:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728485440; x=1729090240; 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=cAYQ9PyUa0uCVoE1YP+jGl1IEOriBSVOakVNhTEyYBJT8w77+E0CyESOx61C2KNdTw vlRGUzslXZgNErYbbTEjhTIVESvUC1NRz1k5AQUg2fvXwZDQQaUuCjuG37p1UBcOOBS9 lhxIdm/Tg9W6dXhf6tFiJkBLgASxKwRvqfmry8CvniyNFplGBnqReFQ19TDSDKP99Bno HiJ0656xP21ytTiS0CNlZhgC+OTPNhbWAa4N1vFd1TdtlU+Qt7vaQPggYo8Q1TgwjU7k SiThol/IBPeCGx5mHvk8i2xhWJntyPEI1hJKL3I0TcLRmuuZzS91QyCEPzd40UxL8xCf /N7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728485440; x=1729090240; 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=VA9PVBYWvZt6WlvU+WyC2D2kJTwSjS5ZP/o1WYMB7C/ZK6LOhKycixWxPtaCxxs5Ai WVrLmVUXDxAVCHYGBq36z6bgQUD3mbGF+2YQSXaoy1nlNXmI2kNOd4TvJARpX05IL8NG hCk0wsvLdiNkDNqfSpdHGGfnH/gklrczXbbNNoq0whP7zappEfFiLVTi+aUc7y9N1EPo Jh8LsS+/MgiJjNHZS7yi9uU358DIUuV8hq5RRMhHBDjORoL1GACPWgOOpmXZ571Oq7Xl jXUBFV5xwvKR9lfV1lGtc0FWPdCCVuqw9nN/9sMROwWXlQa76OKy4BN9K6RKQ2+Qcyfh ZHYQ== X-Gm-Message-State: AOJu0Yzh3eOUwKs0FZOV2J+MMvBLDvLUU3uXoYInkFQAPqoBEhGW0o9l lgzHz5IbguDsVMvcN0JUTeRLl5ZPguqm8luv1M1rVUMNduKS5x7allnG7/Mki7+sz5qVK51RHC0 b0utFmr+L X-Received: by 2002:a5d:4991:0:b0:37c:cc67:8b1f with SMTP id ffacd0b85a97d-37d3aab7873mr1726593f8f.48.1728485440347; Wed, 09 Oct 2024 07:50:40 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:9b46:2ad8:5153:1163]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d1691b5ddsm10700957f8f.47.2024.10.09.07.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 07:50:40 -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 , Anand Moon , Simon Glass , Baruch Siach Subject: [PATCH v12 19/21] net: lwip: add TFTP_BLOCKSIZE Date: Wed, 9 Oct 2024 16:50:00 +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 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 */