All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alessandro Rubini <rubini-list@gnudd.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3 V2] tftp: get tftpblocksize from cfg file and env
Date: Thu, 30 Jul 2009 11:25:57 +0200	[thread overview]
Message-ID: <20090730092557.GA7470@mail.gnudd.com> (raw)
In-Reply-To: <8124a390e4cbcfee291c7583a585c9d030aadf7a.1248943812.git.rubini @unipv.it>

Raising 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: Alessandro Rubini <rubini@gnudd.com>
---

V2: fixed a damned typo in CONFIG_ names

Also, I shortened the first line. Sorry for this bad V1.

 net/tftp.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/net/tftp.c b/net/tftp.c
index b0f1cca..34b79c4 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -86,8 +86,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)
  */
+#ifdef CONFIG_TFTP_BLOCKSIZE
+#define TFTP_MTU_BLOCKSIZE CONFIG_TFTP_BLOCKSIZE
+#else
 #define TFTP_MTU_BLOCKSIZE 1468
+#endif
+
 static unsigned short TftpBlkSize=TFTP_BLOCK_SIZE;
 static unsigned short TftpBlkSizeOption=TFTP_MTU_BLOCKSIZE;
 
@@ -475,9 +481,12 @@ TftpTimeout (void)
 void
 TftpStart (void)
 {
-#ifdef CONFIG_TFTP_PORT
 	char *ep;             /* Environment pointer */
-#endif
+
+	/* 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') {
-- 
1.6.0.2

  parent reply	other threads:[~2009-07-30  9:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-30  9:02 [U-Boot] [PATCH 0/3] Defragment IP packets Alessandro Rubini
2009-07-30  9:02 ` [U-Boot] [PATCH 1/3] net: defragment " Alessandro Rubini
2009-07-30  9:03 ` [U-Boot] [PATCH 2/3] tftp: get the tftp block size from config file and from the environment Alessandro Rubini
2009-07-30  9:03 ` [U-Boot] [PATCH 3/3] arm nomadik: select defrag and 4k tftp block size Alessandro Rubini
     [not found] ` <8124a390e4cbcfee291c7583a585c9d030aadf7a.1248943812.git.rubini @unipv.it>
2009-07-30  9:25   ` Alessandro Rubini [this message]
     [not found] ` <7b8035d1-8543-4b85-ba00-ac21ff1a60df@lists.denx.de>
2009-07-30 23:15   ` [U-Boot] [PATCH 1/3] net: defragment IP packets Robin Getz
2009-07-31  7:46     ` Alessandro Rubini
2009-07-31 11:50       ` Robin Getz
2009-07-31 12:16         ` Alessandro Rubini
2009-07-31 13:40           ` Robin Getz
2009-07-31 14:02             ` Alessandro Rubini
2009-07-31 15:14               ` Robin Getz
2009-07-31 15:44                 ` Alessandro Rubini
2009-07-31 15:33       ` Robin Getz
2009-08-05 16:59       ` Robin Getz
2009-08-05 17:18         ` Alessandro Rubini
2009-08-05 17:24           ` Ben Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090730092557.GA7470@mail.gnudd.com \
    --to=rubini-list@gnudd.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.