diff mbox

[U-Boot,14/28] net: Refactor ping recieve handler

Message ID 1327020811-1538-15-git-send-email-joe.hershberger@ni.com
State Superseded
Delegated to: Joe Hershberger
Headers show

Commit Message

Joe Hershberger Jan. 20, 2012, 12:53 a.m. UTC
There is no need to call through the handler when we can handle
it inline

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
---
 net/ping.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)

Comments

Mike Frysinger Feb. 3, 2012, 12:07 p.m. UTC | #1
Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
diff mbox

Patch

diff --git a/net/ping.c b/net/ping.c
index 12f9185..e4a7a21 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -76,22 +76,11 @@  PingTimeout(void)
 	NetState = NETLOOP_FAIL;	/* we did not get the reply */
 }
 
-static void
-PingHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-	    unsigned len)
-{
-	if (sip != NetPingIP)
-		return;
-
-	NetState = NETLOOP_SUCCESS;
-}
-
 void
 PingStart(void)
 {
 	printf("Using %s device\n", eth_get_name());
 	NetSetTimeout(10000UL, PingTimeout);
-	NetSetHandler(PingHandler);
 
 	PingSend();
 }
@@ -103,13 +92,9 @@  void PingReceive(struct Ethernet_t *et, struct IP_UDP_t *ip, int len)
 
 	switch (icmph->type) {
 	case ICMP_ECHO_REPLY:
-		/*
-		 * IP header OK.  Pass the packet to the
-		 * current handler.
-		 */
-		/* XXX point to ip packet */
 		src_ip = NetReadIP((void *)&ip->ip_src);
-		NetGetHandler()((uchar *)ip, 0, src_ip, 0, 0);
+		if (src_ip == NetPingIP)
+			NetState = NETLOOP_SUCCESS;
 		return;
 	case ICMP_ECHO_REQUEST:
 		debug("Got ICMP ECHO REQUEST, return "