Commit 89ba81d1 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Ben Warren
Browse files

tftp: get the tftp block size from config file and from the environment

Increasing the block size is useful if CONFIG_IP_DEFRAG is
used. Howerver, the last fragments in a burst may overflow the
receiving ethernet, so the default is left at 1468, with thre new
CONFIG_TFTP_BLOCKSIZE for config files. Further, "tftpblocksize"
can be set in the environment.
Signed-off-by: default avatarAlessandro Rubini <>
Signed-off-by: default avatarBen Warren <>
parent 5cfaa4e5
......@@ -84,8 +84,14 @@ extern flash_info_t flash_info[];
/* 512 is poor choice for ethernet, MTU is typically 1500.
* Minus eth.hdrs thats 1468. Can get 2x better throughput with
* almost-MTU block sizes. At least try... fall back to 512 if need be.
* (but those using CONFIG_IP_DEFRAG may want to set a larger block in cfg file)
static unsigned short TftpBlkSize=TFTP_BLOCK_SIZE;
static unsigned short TftpBlkSizeOption=TFTP_MTU_BLOCKSIZE;
......@@ -466,9 +472,12 @@ TftpTimeout (void)
TftpStart (void)
char *ep; /* Environment pointer */
/* Allow the user to choose tftpblocksize */
if ((ep = getenv("tftpblocksize")) != NULL)
TftpBlkSizeOption = simple_strtol(ep, NULL, 10);
debug("tftp block size is %i\n", TftpBlkSizeOption);
TftpServerIP = NetServerIP;
if (BootFile[0] == '\0') {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment