[PATCH v2 3/5] net: lwip: tftp: add support for setting blocksize at runtime
Tim Harvey
tharvey at gateworks.com
Fri May 30 17:38:24 CEST 2025
Add support for setting the blocksize at runtime via the tftpblocksize env
variable as such is done with the legacy stack (CONFIG_NET).
Signed-off-by: Tim Harvey <tharvey at gateworks.com>
Reviewed-by: Jerome Forissier <jerome.forissier at linaro.org>
---
v2:
- added tags
---
net/lwip/tftp.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/lwip/tftp.c b/net/lwip/tftp.c
index 7495dc077ba5..e7502a0cbab1 100644
--- a/net/lwip/tftp.c
+++ b/net/lwip/tftp.c
@@ -156,8 +156,10 @@ static void no_response(void *arg)
static int tftp_loop(struct udevice *udev, ulong addr, char *fname,
ip_addr_t srvip, uint16_t srvport)
{
+ int blksize = CONFIG_TFTP_BLOCKSIZE;
struct netif *netif;
struct tftp_ctx ctx;
+ const char *ep;
err_t err;
if (!fname || addr == 0)
@@ -186,7 +188,10 @@ 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);
+ ep = env_get("tftpblocksize");
+ if (ep)
+ blksize = simple_strtol(ep, NULL, 10);
+ tftp_client_set_blksize(blksize);
ctx.start_time = get_timer(0);
err = tftp_get(&ctx, &srvip, srvport, fname, TFTP_MODE_OCTET);
--
2.25.1
More information about the U-Boot
mailing list