public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] netconsole: support packets longer than 512 bytes
@ 2011-10-07 22:27 Michael Walle
  2011-10-07 22:53 ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Walle @ 2011-10-07 22:27 UTC (permalink / raw)
  To: u-boot

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@walle.cc>
---
 drivers/net/netconsole.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index e40efb8..56ba64f 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -189,10 +189,13 @@ 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 (len) {
+		int send_len = min(len, 512);
+		nc_send_packet(s, send_len);
+		len -= send_len;
+		s += send_len;
+	}
 
 	output_recursion = 0;
 }
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] netconsole: support packets longer than 512 bytes
  2011-10-07 22:27 [U-Boot] [PATCH v2] netconsole: support packets longer than 512 bytes Michael Walle
@ 2011-10-07 22:53 ` Mike Frysinger
  2011-10-07 23:22   ` Michael Walle
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2011-10-07 22:53 UTC (permalink / raw)
  To: u-boot

On Friday 07 October 2011 18:27:50 Michael Walle wrote:
> Esp. while printing the environment the output is usually longer than 512
> bytes. Instead of cutting the message, send multiple 512 bytes packets.

sorry, i probably should have looked closer earlier.  this isn't really your 
fault, but i'm guessing this 512 limit is due to the size of the static 
input_buffer ?  if so, let's use sizeof(input_buffer) instead of 512.  or add a 
define at the top like NETCONSOLE_BUFFER_SIZE and use that everywhere.
-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/20111007/1d8a5eb9/attachment.pgp 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] netconsole: support packets longer than 512 bytes
  2011-10-07 22:53 ` Mike Frysinger
@ 2011-10-07 23:22   ` Michael Walle
  2011-10-08  1:08     ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Walle @ 2011-10-07 23:22 UTC (permalink / raw)
  To: u-boot

Am Samstag 08 Oktober 2011, 00:53:13 schrieb Mike Frysinger:
> On Friday 07 October 2011 18:27:50 Michael Walle wrote:
> > Esp. while printing the environment the output is usually longer than 512
> > bytes. Instead of cutting the message, send multiple 512 bytes packets.
> 
> sorry, i probably should have looked closer earlier.  this isn't really
> your fault, but i'm guessing this 512 limit is due to the size of the
> static input_buffer ?  if so, let's use sizeof(input_buffer) instead of
> 512.  or add a define at the top like NETCONSOLE_BUFFER_SIZE and use that
> everywhere. -mike

i don't think the input buffer has sth to do with the output. of course it 
could be intended, that the input buffer has the same size as the max output 
size. if i didn't miss sth, the output size is only limited by the maximum 
packet size (minus headers) defined by PKTSIZE.

I don't know why the input buffer and max output size has this particular 
size. Well, the input buffer could be some arbitrary number to. not too big to 
save some space :)

The max output size should be PKTSIZE-NetEthHdrSize()-IP_HDR_SIZE.

-- 
Michael

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] netconsole: support packets longer than 512 bytes
  2011-10-07 23:22   ` Michael Walle
@ 2011-10-08  1:08     ` Mike Frysinger
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2011-10-08  1:08 UTC (permalink / raw)
  To: u-boot

On Friday 07 October 2011 19:22:22 Michael Walle wrote:
> Am Samstag 08 Oktober 2011, 00:53:13 schrieb Mike Frysinger:
> > On Friday 07 October 2011 18:27:50 Michael Walle wrote:
> > > Esp. while printing the environment the output is usually longer than
> > > 512 bytes. Instead of cutting the message, send multiple 512 bytes
> > > packets.
> > 
> > sorry, i probably should have looked closer earlier.  this isn't really
> > your fault, but i'm guessing this 512 limit is due to the size of the
> > static input_buffer ?  if so, let's use sizeof(input_buffer) instead of
> > 512.  or add a define at the top like NETCONSOLE_BUFFER_SIZE and use that
> > everywhere.
> 
> i don't think the input buffer has sth to do with the output. of course it
> could be intended, that the input buffer has the same size as the max
> output size. if i didn't miss sth, the output size is only limited by the
> maximum packet size (minus headers) defined by PKTSIZE.
> 
> I don't know why the input buffer and max output size has this particular
> size. Well, the input buffer could be some arbitrary number to. not too big
> to save some space :)
> 
> The max output size should be PKTSIZE-NetEthHdrSize()-IP_HDR_SIZE.

yeah, i think you're right.  best to keep the 512 for now until someone gets 
up the courage to look it over.

Acked-by: Mike Frysinger <vapier@gentoo.org>
-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/20111007/0aa58bc0/attachment.pgp 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-08  1:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-07 22:27 [U-Boot] [PATCH v2] netconsole: support packets longer than 512 bytes Michael Walle
2011-10-07 22:53 ` Mike Frysinger
2011-10-07 23:22   ` Michael Walle
2011-10-08  1:08     ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox