Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2190160/?format=api
{ "id": 2190160, "url": "http://patchwork.ozlabs.org/api/patches/2190160/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260128234351.405945-1-marek.vasut+renesas@mailbox.org/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260128234351.405945-1-marek.vasut+renesas@mailbox.org>", "list_archive_url": null, "date": "2026-01-28T23:43:45", "name": "net: lwip: tftp: add support of tsize option to client", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "846d1c9a75f3a4cbe8760ae745a2f50df933a5cc", "submitter": { "id": 85650, "url": "http://patchwork.ozlabs.org/api/people/85650/?format=api", "name": "Marek Vasut", "email": "marek.vasut+renesas@mailbox.org" }, "delegate": { "id": 157425, "url": "http://patchwork.ozlabs.org/api/users/157425/?format=api", "username": "jforissier", "first_name": "Jerome", "last_name": "Forissier", "email": "jerome.forissier@linaro.org" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260128234351.405945-1-marek.vasut+renesas@mailbox.org/mbox/", "series": [ { "id": 490145, "url": "http://patchwork.ozlabs.org/api/series/490145/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=490145", "date": "2026-01-28T23:43:45", "name": "net: lwip: tftp: add support of tsize option to client", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/490145/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2190160/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2190160/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=mailbox.org header.i=@mailbox.org header.a=rsa-sha256\n header.s=mail20150812 header.b=ai14WP9r;\n\tdkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org\n header.a=rsa-sha256 header.s=mail20150812 header.b=cPewDd66;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)", "phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=mailbox.org", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n secure) header.d=mailbox.org header.i=@mailbox.org header.b=\"ai14WP9r\";\n\tdkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org\n header.b=\"cPewDd66\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=mailbox.org", "phobos.denx.de;\n spf=pass smtp.mailfrom=marek.vasut+renesas@mailbox.org", "outgoing_mbo_mout;\n dkim=pass header.d=mailbox.org header.s=mail20150812 header.b=cPewDd66;\n spf=pass (outgoing_mbo_mout: domain of marek.vasut+renesas@mailbox.org\n designates 2001:67c:2050:b231:465::202 as permitted sender)\n smtp.mailfrom=marek.vasut+renesas@mailbox.org" ], "Received": [ "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4f1f4n34sFz1xqf\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 29 Jan 2026 10:44:24 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 4FEB283BDD;\n\tThu, 29 Jan 2026 00:44:16 +0100 (CET)", "by phobos.denx.de (Postfix, from userid 109)\n id 25AB183BE1; Thu, 29 Jan 2026 00:44:14 +0100 (CET)", "from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id BFD0D83B5E\n for <u-boot@lists.denx.de>; Thu, 29 Jan 2026 00:43:57 +0100 (CET)", "from smtp202.mailbox.org (smtp202.mailbox.org\n [IPv6:2001:67c:2050:b231:465::202])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4f1f4F2Mxdz9sdB;\n Thu, 29 Jan 2026 00:43:57 +0100 (CET)" ], "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,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS\n autolearn=ham autolearn_force=no version=3.4.2", "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org;\n s=mail20150812; t=1769643837;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding;\n bh=0i67h6JpcZAkCSIAoq7C2wLGRJpFsFlz1qjctMesaZs=;\n b=ai14WP9rOJua8nOZfdMWmHsaR3ON5OoTE0mvGa27Lqy2ZHsxRg8PNgDPp974BJKwxbFij3\n Jqg5axlWc7DLJrU67riI+3twN7Lq2gQeKnniZWlF0085043WfSZY8X4gB4jUiYkL+qdvSA\n Degfx8H2QmYDZc5kr+zA1wArG6rkLMGluHHotURJaEHWS7/6j+moo8cq+QHaIw0gedAOBn\n +X2DYJv/D+g84FAAKO0Mcr4VaZW8kUjfkWshlAb5WOB58lQWtxo6JoZIk3NRkyn+p7xGi3\n 50b0g7YyswBlzkZ0fkXBwIgzaiywTfxsSZXdhDIig+X3VMFkcKYdHziYfKxs5g==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org;\n s=mail20150812; t=1769643835;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding;\n bh=0i67h6JpcZAkCSIAoq7C2wLGRJpFsFlz1qjctMesaZs=;\n b=cPewDd66ci8mD76EeBamFxoxXTGUDqNbQdcm3aDnyYTHb6yI7bE6PuLOoR0GzDKr4xPub6\n 3QW6nLAFmtAe1sxNmqNC6RyV+UEQzYsNHSvV2G4v7KCjPvZ4p4mQvnctIciqkNRPz9SjHE\n nvkss0ut6aS0HUxjccXly3rlk3HqQ+AcR0MBhcWemhqnuJ5zcPdvmrkQ4jUegemXMx5Ok5\n uPxr9fPBK33p/orr4ESXkeLrtRDzaW7ZqUSSViTcUd+TmFmL4m/aoG29O0QDVL8uxhZksr\n 6w+pKy/CuZ8UmLt4/XWkYW2ND9SZ0qdwkWN7rCJM5Voo4IokCZPpdOpAdS7EMg==" ], "From": "Marek Vasut <marek.vasut+renesas@mailbox.org>", "To": "u-boot@lists.denx.de", "Cc": "Marek Vasut <marek.vasut+renesas@mailbox.org>,\n Andrew Goodbody <andrew.goodbody@linaro.org>,\n Heinrich Schuchardt <xypron.glpk@gmx.de>,\n Ilias Apalodimas <ilias.apalodimas@linaro.org>,\n Jerome Forissier <jerome@forissier.org>,\n Joe Hershberger <joe.hershberger@ni.com>,\n Ramon Fried <rfried.dev@gmail.com>, Tim Harvey <tharvey@gateworks.com>,\n Tom Rini <trini@konsulko.com>,\n Wolfgang Wallner <wolfgang.wallner@at.abb.com>", "Subject": "[PATCH] net: lwip: tftp: add support of tsize option to client", "Date": "Thu, 29 Jan 2026 00:43:45 +0100", "Message-ID": "<20260128234351.405945-1-marek.vasut+renesas@mailbox.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-MBO-RS-ID": "39529374c0fe95994c6", "X-MBO-RS-META": "zwzdyybdzqkmyk7mwnun4t57tp6jd9si", "X-Rspamd-Queue-Id": "4f1f4F2Mxdz9sdB", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.39", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>", "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de", "X-Virus-Status": "Clean" }, "content": "The TFTP server can report the size of the entire file that is about to\nbe received in the Transfer Size Option, this is described in RFC 2349.\nThis functionality is optional and the server may not report tsize in\ncase it is not supported.\n\nAlways send tsize request to the server to query the transfer size,\nand in case the server does respond, cache that information locally\nin tftp_state.tsize, otherwise cache size 0. Introduce new function\ntftp_client_get_tsize() which returns the cached tftp_state.tsize so\nclients can determine the transfer size and use it.\n\nUpdate net/lwip/tftp.c to make use of tftp_client_get_tsize() and\navoid excessive printing of '#' during TFTP transfers in case the\ntransfer size is reported by the server.\n\nSubmitted upstream: https://savannah.nongnu.org/patch/index.php?item_id=10557\n\nSigned-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>\n---\nCc: Andrew Goodbody <andrew.goodbody@linaro.org>\nCc: Heinrich Schuchardt <xypron.glpk@gmx.de>\nCc: Ilias Apalodimas <ilias.apalodimas@linaro.org>\nCc: Jerome Forissier <jerome@forissier.org>\nCc: Joe Hershberger <joe.hershberger@ni.com>\nCc: Ramon Fried <rfried.dev@gmail.com>\nCc: Tim Harvey <tharvey@gateworks.com>\nCc: Tom Rini <trini@konsulko.com>\nCc: Wolfgang Wallner <wolfgang.wallner@at.abb.com>\nCc: u-boot@lists.denx.de\n---\n lib/lwip/lwip/src/apps/tftp/tftp.c | 51 +++++++++++++++----\n .../lwip/src/include/lwip/apps/tftp_client.h | 1 +\n net/lwip/tftp.c | 35 +++++++++++--\n 3 files changed, 74 insertions(+), 13 deletions(-)", "diff": "diff --git a/lib/lwip/lwip/src/apps/tftp/tftp.c b/lib/lwip/lwip/src/apps/tftp/tftp.c\nindex ecb6c55ae11..5061446b1cf 100644\n--- a/lib/lwip/lwip/src/apps/tftp/tftp.c\n+++ b/lib/lwip/lwip/src/apps/tftp/tftp.c\n@@ -98,6 +98,7 @@ struct tftp_state {\n int last_pkt;\n u16_t blknum;\n u16_t blksize;\n+ u32_t tsize;\n u8_t retries;\n u8_t mode_write;\n u8_t tftp_mode;\n@@ -167,6 +168,7 @@ send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname,\n {\n size_t fname_length = strlen(fname)+1;\n size_t mode_length = strlen(mode)+1;\n+ size_t tsize_length = strlen(\"tsize\")+3; /* \"tsize\\0\\0\\0\" */\n size_t blksize_length = 0;\n int blksize = tftp_state.blksize;\n struct pbuf* p;\n@@ -182,7 +184,7 @@ send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname,\n }\n }\n \n- p = init_packet(opcode, 0, fname_length + mode_length + blksize_length - 2);\n+ p = init_packet(opcode, 0, fname_length + mode_length + blksize_length + tsize_length - 2);\n if (p == NULL) {\n return ERR_MEM;\n }\n@@ -190,8 +192,9 @@ send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname,\n payload = (char*) p->payload;\n MEMCPY(payload+2, fname, fname_length);\n MEMCPY(payload+2+fname_length, mode, mode_length);\n+ sprintf(payload+2+fname_length+mode_length, \"tsize%c%u%c\", 0, 0, 0);\n if (tftp_state.blksize)\n- sprintf(payload+2+fname_length+mode_length, \"blksize%c%d%c\", 0, tftp_state.blksize, 0);\n+ sprintf(payload+2+fname_length+mode_length+tsize_length, \"blksize%c%d%c\", 0, tftp_state.blksize, 0);\n \n tftp_state.wait_oack = true;\n ret = udp_sendto(tftp_state.upcb, p, addr, port);\n@@ -450,14 +453,24 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr\n }\n \n blknum = lwip_ntohs(sbuf[1]);\n- if (tftp_state.blksize && tftp_state.wait_oack) {\n+ if (tftp_state.wait_oack) {\n /*\n- * Data received while we are expecting an OACK for our blksize option.\n+ * Data received while we are expecting an OACK for our tsize option.\n * This means the server doesn't support it, let's switch back to the\n * default block size.\n */\n- tftp_state.blksize = 0;\n- tftp_state.wait_oack = false;\n+ tftp_state.tsize = 0;\n+ tftp_state.wait_oack = false;\n+\n+ if (tftp_state.blksize) {\n+ /*\n+ * Data received while we are expecting an OACK for our blksize option.\n+ * This means the server doesn't support it, let's switch back to the\n+ * default block size.\n+ */\n+ tftp_state.blksize = 0;\n+ tftp_state.wait_oack = false;\n+ }\n }\n if (blknum == tftp_state.blknum) {\n pbuf_remove_header(p, TFTP_HEADER_LENGTH);\n@@ -527,21 +540,31 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr\n }\n break;\n case PP_HTONS(TFTP_OACK): {\n- const char *optval = find_option(p, \"blksize\");\n+ const char *blksizeoptval = find_option(p, \"blksize\");\n+ const char *tsizeoptval = find_option(p, \"tsize\");\n u16_t srv_blksize = 0;\n+ u32_t srv_tsize = 0;\n tftp_state.wait_oack = false;\n- if (optval) {\n+ if (blksizeoptval) {\n \tif (!tftp_state.blksize) {\n \t /* We did not request this option */\n send_error(addr, port, TFTP_ERROR_ILLEGAL_OPERATION, \"blksize unexpected\");\n \t}\n-\tsrv_blksize = atoi(optval);\n+\tsrv_blksize = atoi(blksizeoptval);\n \tif (srv_blksize <= 0 || srv_blksize > tftp_state.blksize) {\n \t send_error(addr, port, TFTP_ERROR_ILLEGAL_OPERATION, \"Invalid blksize\");\n \t}\n \tLWIP_DEBUGF(TFTP_DEBUG | LWIP_DBG_STATE, (\"tftp: accepting blksize=%d\\n\", srv_blksize));\n \ttftp_state.blksize = srv_blksize;\n }\n+ if (tsizeoptval) {\n+\tsrv_tsize = atoi(tsizeoptval);\n+\tif (srv_tsize <= 0) {\n+\t srv_tsize = 0; /* tsize is optional */\n+\t}\n+\tLWIP_DEBUGF(TFTP_DEBUG | LWIP_DBG_STATE, (\"tftp: accepting tsize=%d\\n\", srv_tsize));\n+\ttftp_state.tsize = srv_tsize;\n+ }\n send_ack(addr, port, 0);\n break;\n }\n@@ -655,6 +678,16 @@ tftp_init_client(const struct tftp_context *ctx)\n return tftp_init_common(LWIP_TFTP_MODE_CLIENT, ctx);\n }\n \n+/** @ingroup tftp\n+ * Get the transfer size used by the TFTP client. The server may\n+ * report zero in case this is unsupported.\n+ */\n+u32_t\n+tftp_client_get_tsize(void)\n+{\n+ return tftp_state.tsize;\n+}\n+\n /** @ingroup tftp\n * Set the block size to be used by the TFTP client. The server may choose to\n * accept a lower value.\ndiff --git a/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h b/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h\nindex e1e21d06b67..78de50f4924 100644\n--- a/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h\n+++ b/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h\n@@ -45,6 +45,7 @@ enum tftp_transfer_mode {\n \n err_t tftp_init_client(const struct tftp_context* ctx);\n void tftp_client_set_blksize(u16_t blksize);\n+u32_t tftp_client_get_tsize(void);\n err_t tftp_get(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode);\n err_t tftp_put(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode);\n \ndiff --git a/net/lwip/tftp.c b/net/lwip/tftp.c\nindex 6c7ffba661e..213c1292eb1 100644\n--- a/net/lwip/tftp.c\n+++ b/net/lwip/tftp.c\n@@ -31,6 +31,7 @@ struct tftp_ctx {\n \tulong daddr;\n \tulong size;\n \tulong block_count;\n+\tulong hash_count;\n \tulong start_time;\n \tenum done_state done;\n };\n@@ -49,6 +50,8 @@ struct tftp_ctx {\n static int store_block(struct tftp_ctx *ctx, void *src, u16_t len)\n {\n \tulong store_addr = ctx->daddr;\n+\tulong tftp_tsize;\n+\tulong pos;\n \tvoid *ptr;\n \n \tif (CONFIG_IS_ENABLED(LMB)) {\n@@ -67,10 +70,21 @@ static int store_block(struct tftp_ctx *ctx, void *src, u16_t len)\n \tctx->daddr += len;\n \tctx->size += len;\n \tctx->block_count++;\n-\tif (ctx->block_count % 10 == 0) {\n-\t\tputc('#');\n-\t\tif (ctx->block_count % (65 * 10) == 0)\n-\t\t\tputs(\"\\n\\t \");\n+\n+\ttftp_tsize = tftp_client_get_tsize();\n+\tif (tftp_tsize) {\n+\t\tpos = clamp(ctx->size, 0UL, tftp_tsize);\n+\n+\t\twhile (ctx->hash_count < pos * 50 / tftp_tsize) {\n+\t\t\tputc('#');\n+\t\t\tctx->hash_count++;\n+\t\t}\n+\t} else {\n+\t\tif (ctx->block_count % 10 == 0) {\n+\t\t\tputc('#');\n+\t\t\tif (ctx->block_count % (65 * 10) == 0)\n+\t\t\t\tputs(\"\\n\\t \");\n+\t\t}\n \t}\n \n \treturn 0;\n@@ -84,6 +98,7 @@ static void *tftp_open(const char *fname, const char *mode, u8_t is_write)\n static void tftp_close(void *handle)\n {\n \tstruct tftp_ctx *ctx = handle;\n+\tulong tftp_tsize;\n \tulong elapsed;\n \n \tif (ctx->done == FAILURE || ctx->done == ABORTED) {\n@@ -92,6 +107,17 @@ static void tftp_close(void *handle)\n \t}\n \tctx->done = SUCCESS;\n \n+\ttftp_tsize = tftp_client_get_tsize();\n+\tif (tftp_tsize) {\n+\t\t/* Print hash marks for the last packet received */\n+\t\twhile (ctx->hash_count < 49) {\n+\t\t\tputc('#');\n+\t\t\tctx->hash_count++;\n+\t\t}\n+\t\tputs(\" \");\n+\t\tprint_size(tftp_tsize, \"\");\n+\t}\n+\n \telapsed = get_timer(ctx->start_time);\n \tif (elapsed > 0) {\n \t\tputs(\"\\n\\t \");\t/* Line up with \"Loading: \" */\n@@ -176,6 +202,7 @@ static int tftp_loop(struct udevice *udev, ulong addr, char *fname,\n \tctx.done = NOT_DONE;\n \tctx.size = 0;\n \tctx.block_count = 0;\n+\tctx.hash_count = 0;\n \tctx.daddr = addr;\n \n \tprintf(\"Using %s device\\n\", udev->name);\n", "prefixes": [] }