Patchwork [U-Boot,v1,1/1] netconsole loses 2nd character of input

login
register
mail settings
Submitter Suriyan Ramasami
Date Oct. 16, 2013, 4:54 p.m.
Message ID <1381942464-7482-1-git-send-email-suriyan.r@gmail.com>
Download mbox | patch
Permalink /patch/284005/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Suriyan Ramasami - Oct. 16, 2013, 4:54 p.m.
Netconsole loses the second character when used as input by
either setenv stdin nc or setenv stdin serial,nc if using CONSOLE_CONSOLE_MUX

Before a nc_send_packet() to echo the input, a check is done to see if
nc_ether is valid. If its not, it waits for an arp request and then sends
the packet (which contains the first character of line to be displayed as
output). As part of reaping the arp request, the second character is consumed.
We protect this by making the call to NetLoop(NETCONS) between 
input_recursion.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>
---
 drivers/net/netconsole.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Joe Hershberger - Oct. 17, 2013, 5:52 a.m.
On Wed, Oct 16, 2013 at 11:54 AM, Suriyan Ramasami <suriyan.r@gmail.com> wrote:
> Netconsole loses the second character when used as input by
> either setenv stdin nc or setenv stdin serial,nc if using CONSOLE_CONSOLE_MUX
>
> Before a nc_send_packet() to echo the input, a check is done to see if
> nc_ether is valid. If its not, it waits for an arp request and then sends
> the packet (which contains the first character of line to be displayed as
> output). As part of reaping the arp request, the second character is consumed.
> We protect this by making the call to NetLoop(NETCONS) between
> input_recursion.
>
> Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

This looks good to me... I'll pull it in shortly.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Tom Rini - Nov. 8, 2013, 10:27 p.m.
On Wed, Oct 16, 2013 at 09:54:24AM -0700, Suriyan Ramasami wrote:

> Netconsole loses the second character when used as input by
> either setenv stdin nc or setenv stdin serial,nc if using CONSOLE_CONSOLE_MUX
> 
> Before a nc_send_packet() to echo the input, a check is done to see if
> nc_ether is valid. If its not, it waits for an arp request and then sends
> the packet (which contains the first character of line to be displayed as
> output). As part of reaping the arp request, the second character is consumed.
> We protect this by making the call to NetLoop(NETCONS) between 
> input_recursion.
> 
> Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>

Applied to u-boot/master, thanks!

Patch

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index df8ab07..65c747e 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -184,7 +184,9 @@  static void nc_send_packet(const char *buf, int len)
 			return;	/* inside net loop */
 		output_packet = buf;
 		output_packet_len = len;
+		input_recursion = 1;
 		NetLoop(NETCONS); /* wait for arp reply and send packet */
+		input_recursion = 0;
 		output_packet_len = 0;
 		return;
 	}