net: Make the netconsole buffer size configurable
authorJoe Hershberger <joe.hershberger@ni.com>
Tue, 31 Jul 2012 06:09:17 +0000 (06:09 +0000)
committerJoe Hershberger <joe.hershberger@ni.com>
Mon, 24 Sep 2012 18:55:43 +0000 (13:55 -0500)
Allow a board to configure a larger buffer for netconsole, but leave
the default.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
doc/README.NetConsole
drivers/net/netconsole.c

index 070e86a..af7fc60 100644 (file)
@@ -6,6 +6,8 @@ serial and network input/output devices by adjusting the 'stdin' and
 set either of these variables to "nc". Input and output can be
 switched independently.
 
+CONFIG_NETCONSOLE_BUFFER_SIZE - Override the default buffer size
+
 We use an environment variable 'ncip' to set the IP address and the
 port of the destination. The format is <ip_addr>:<port>. If <port> is
 omitted, the value of 6666 is used. If the env var doesn't exist, the
index 86f5301..8fcf31c 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static char input_buffer[512];
+#ifndef CONFIG_NETCONSOLE_BUFFER_SIZE
+#define CONFIG_NETCONSOLE_BUFFER_SIZE 512
+#endif
+
+static char input_buffer[CONFIG_NETCONSOLE_BUFFER_SIZE];
 static int input_size; /* char count in input buffer */
 static int input_offset; /* offset to valid chars in input buffer */
 static int input_recursion;
@@ -214,7 +218,7 @@ static void nc_puts(const char *s)
 
        len = strlen(s);
        while (len) {
-               int send_len = min(len, 512);
+               int send_len = min(len, sizeof(input_buffer));
                nc_send_packet(s, send_len);
                len -= send_len;
                s += send_len;