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

Mike Frysinger vapier at gentoo.org
Fri Oct 7 19:26:30 CEST 2011


On Thursday 06 October 2011 18:23:38 Michael Walle wrote:
> --- a/drivers/net/netconsole.c
> +++ b/drivers/net/netconsole.c
> 
> -	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;
> +		}
> +	}

i know the existing code is broken, but when adding/changing lines, please use 
the correct style.  so this should be strlen(s) and such.

in terms of the actual content, this should be simpler:
	while (len) {
		int send_len = min(len, 512);
		nc_send_packet(s, send_len);
		len -= send_len;
		s += send_len;
	}
-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/a4053452/attachment.pgp 


More information about the U-Boot mailing list