]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: lwip: tftp: add support for setting blocksize at runtime
authorTim Harvey <tharvey@gateworks.com>
Fri, 30 May 2025 15:38:24 +0000 (08:38 -0700)
committerJerome Forissier <jerome.forissier@linaro.org>
Tue, 8 Jul 2025 07:53:59 +0000 (09:53 +0200)
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@gateworks.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
net/lwip/tftp.c

index 279145227224559255b4245cf1490485c6d69b39..94bacf630752d20357cef40775a25cca39d811dc 100644 (file)
@@ -157,8 +157,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)
@@ -187,7 +189,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);