diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2012-05-23 07:59:12 +0000 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2012-05-23 17:46:20 -0500 |
commit | 61da3c2af8ba7a06cb1f7e9e0db54b9ddea532ce (patch) | |
tree | 155ecfccdce94f21a183100984de28eac6b7cb6b /net | |
parent | f9623229fdc22e591f1bf63eada1c0c93a199426 (diff) |
net: Refactor ping receive handler
There is no need to call through the handler... inline it
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ping.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/net/ping.c b/net/ping.c index 939f8ff6fce..0f4d99088e0 100644 --- a/net/ping.c +++ b/net/ping.c @@ -75,20 +75,10 @@ static void ping_timeout(void) NetState = NETLOOP_FAIL; /* we did not get the reply */ } -static void ping_handler(uchar *pkt, unsigned dest, IPaddr_t sip, - unsigned src, unsigned len) -{ - if (sip != NetPingIP) - return; - - NetState = NETLOOP_SUCCESS; -} - void ping_start(void) { printf("Using %s device\n", eth_get_name()); NetSetTimeout(10000UL, ping_timeout); - NetSetHandler(ping_handler); ping_send(); } @@ -100,13 +90,9 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *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 " |