Commit 2c8fe5120f8da013cbd789be2f10cce880972836

Authored by Joe Hershberger
1 parent dcd5a593f5

net: Make the netconsole buffer size configurable

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>

Showing 2 changed files with 8 additions and 2 deletions Side-by-side Diff

doc/README.NetConsole
... ... @@ -6,6 +6,8 @@
6 6 set either of these variables to "nc". Input and output can be
7 7 switched independently.
8 8  
  9 +CONFIG_NETCONSOLE_BUFFER_SIZE - Override the default buffer size
  10 +
9 11 We use an environment variable 'ncip' to set the IP address and the
10 12 port of the destination. The format is <ip_addr>:<port>. If <port> is
11 13 omitted, the value of 6666 is used. If the env var doesn't exist, the
drivers/net/netconsole.c
... ... @@ -28,7 +28,11 @@
28 28  
29 29 DECLARE_GLOBAL_DATA_PTR;
30 30  
31   -static char input_buffer[512];
  31 +#ifndef CONFIG_NETCONSOLE_BUFFER_SIZE
  32 +#define CONFIG_NETCONSOLE_BUFFER_SIZE 512
  33 +#endif
  34 +
  35 +static char input_buffer[CONFIG_NETCONSOLE_BUFFER_SIZE];
32 36 static int input_size; /* char count in input buffer */
33 37 static int input_offset; /* offset to valid chars in input buffer */
34 38 static int input_recursion;
... ... @@ -214,7 +218,7 @@
214 218  
215 219 len = strlen(s);
216 220 while (len) {
217   - int send_len = min(len, 512);
  221 + int send_len = min(len, sizeof(input_buffer));
218 222 nc_send_packet(s, send_len);
219 223 len -= send_len;
220 224 s += send_len;