U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Lin <jilin@nvidia.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/1] NET: Improve TFTP booting performance when CONFIG_USB_KEYBOARD
Date: Wed, 3 Jul 2013 18:34:27 +0800	[thread overview]
Message-ID: <1372847667-31928-1-git-send-email-jilin@nvidia.com> (raw)

TFTP booting is slow when a USB keyboard is installed and
CONFIG_USB_KEYBOARD is defined.
The fix is to change Ctrl-C polling to every second when NET transfer
is running.

Signed-off-by: Jim Lin <jilin@nvidia.com>
---
Changes in v2:
 1. Change configuration name from CONFIG_CTRLC_POLL_MS to CONFIG_CTRLC_POLL_S.
 2. New code will be executed only when CONFIG_CTRLC_POLL_S is defined in
    configuration header file.
 3. Add description in README.console.
Changes in v3:
 1. Move changes to common/usb_kbd.c and doc/README.usb
 2. Rename config setting to CONFIG_USBKB_TESTC_PERIOD.
 3. Remove slow response on USB-keyboard input when TFTP boot is not running.
Changes in v4:
 1. Remove changes in doc/README.usb, common/usb_kbd.c and
    CONFIG_USBKB_TESTC_PERIOD 
 2. Modify net/net.c

 net/net.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/net/net.c b/net/net.c
index df94789..06b41e0 100644
--- a/net/net.c
+++ b/net/net.c
@@ -322,6 +322,11 @@ int NetLoop(enum proto_t protocol)
 {
 	bd_t *bd = gd->bd;
 	int ret = -1;
+#ifdef CONFIG_USB_KEYBOARD
+	unsigned long kbd_ctrlc_tms = 0;
+	unsigned long ctrlc_t;
+	int ctrlc_result;
+#endif
 
 	NetRestarted = 0;
 	NetDevExists = 0;
@@ -472,7 +477,22 @@ restart:
 		/*
 		 *	Abort if ctrl-c was pressed.
 		 */
+#ifdef CONFIG_USB_KEYBOARD
+		/*
+		 * Reduce ctrl-c checking to 1 second once
+		 * to improve TFTP boot performance.
+		 */
+		ctrlc_t = get_timer(kbd_ctrlc_tms);
+		if (ctrlc_t > CONFIG_SYS_HZ) {
+			ctrlc_result = ctrlc();
+			kbd_ctrlc_tms = get_timer(0);
+		} else {
+			ctrlc_result = 0;
+		}
+		if (ctrlc_result) {
+#else
 		if (ctrlc()) {
+#endif
 			/* cancel any ARP that may not have completed */
 			NetArpWaitPacketIP = 0;
 
-- 
1.7.7

             reply	other threads:[~2013-07-03 10:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-03 10:34 Jim Lin [this message]
2013-07-03 11:20 ` [U-Boot] [PATCH v4 1/1] NET: Improve TFTP booting performance when CONFIG_USB_KEYBOARD Wolfgang Denk
2013-07-03 17:28   ` Stephen Warren
2013-07-03 22:48     ` Wolfgang Denk

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=1372847667-31928-1-git-send-email-jilin@nvidia.com \
    --to=jilin@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox