[U-Boot] [PATCH] netconsole: support packets longer than 512 bytes

Michael Walle michael at walle.cc
Fri Oct 7 00:23:38 CEST 2011


Esp. while printing the environment the output is usually longer than 512
bytes. Instead of cutting the message, send multiple 512 bytes packets.

Signed-off-by: Michael Walle <michael at walle.cc>
---
 drivers/net/netconsole.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index e40efb8..d54bc65 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -189,10 +189,17 @@ static void nc_puts(const char *s)
 		return;
 	output_recursion = 1;
 
-	if ((len = strlen (s)) > 512)
-		len = 512;
-
-	nc_send_packet (s, len);
+	len = strlen (s);
+	while (1) {
+		if (len > 512) {
+			nc_send_packet (s, 512);
+			len -= 512;
+			s += 512;
+		} else {
+			nc_send_packet (s, len);
+			break;
+		}
+	}
 
 	output_recursion = 0;
 }
-- 
1.7.2.5



More information about the U-Boot mailing list