Skip to contentSkip to conversation

net: Make the netconsole buffer size configurable

PATCH Superseded Joe Hershberger 2 participants 4 messages Jul 24, 2012 – Aug 1, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Make the netconsole buffer size configurable

Allow a board to configure a larger buffer for netconsole, but leave the default.

---
 doc/README.NetConsole    |    2 ++
 drivers/net/netconsole.c |   10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
doc/README.NetConsole +2 -0
index c8bcb90..73543e5 100644
@@ -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
drivers/net/netconsole.c +8 -2
index 14243b8..6b4390e 100644
@@ -28,7 +28,13 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static char input_buffer[512];
+#ifdef CONFIG_NETCONSOLE_BUFFER_SIZE
+#define BUFFER_SIZE CONFIG_NETCONSOLE_BUFFER_SIZE
+#else
+#define BUFFER_SIZE 512
+#endif
+
+static char input_buffer[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;
@@ -203,7 +209,7 @@ static void nc_puts(const char *s)
 
 	len = strlen(s);
 	while (len) {
-		int send_len = min(len, 512);
+		int send_len = min(len, BUFFER_SIZE);
 		nc_send_packet(s, send_len);
 		len -= send_len;
 		s += send_len;
Signature · 1 line
1.6.0.2
#1 lore raw

PATCH 1/1 net: Make the netconsole buffer size configurable

drivers/net/netconsole.c line 37

Quoted 11 lines · On Tuesday 24 July 2012 16:10:56 Joe Hershberger wrote:
drivers/net/netconsole.c +7 -1
 
-static char input_buffer[512];
+#ifdef CONFIG_NETCONSOLE_BUFFER_SIZE
+#define BUFFER_SIZE CONFIG_NETCONSOLE_BUFFER_SIZE
+#else
+#define BUFFER_SIZE 512
+#endif
+
+static char input_buffer[BUFFER_SIZE];

#ifndef CONFIG_NETCONSOLE_BUFFER_SIZE

# define CONFIG_NETCONSOLE_BUFFER_SIZE 512
#endif
static char input_buffer[CONFIG_NETCONSOLE_BUFFER_SIZE];

drivers/net/netconsole.c static void nc_puts(const char *s) · line 212

Quoted 3 lines
drivers/net/netconsole.c +1 -1
 	while (len) {
-		int send_len = min(len, 512);
+		int send_len = min(len, BUFFER_SIZE);
	int send_len = min(len, sizeof(input_buffer));

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120725/2c9e5b61/attachment.pgp>

#2 lore raw

PATCH v2 1/1 net: Make the netconsole buffer size configurable

In reply to Joe Hershberger

Allow a board to configure a larger buffer for netconsole, but leave the default.

---
 doc/README.NetConsole    |    2 ++
 drivers/net/netconsole.c |    8 ++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
doc/README.NetConsole +2 -0
index c8bcb90..73543e5 100644
@@ -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
drivers/net/netconsole.c +6 -2
index 14243b8..c68ca4f 100644
@@ -28,7 +28,11 @@
 
 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;
@@ -203,7 +207,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;
Signature · 1 line
1.6.0.2