1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

net: Refactor to protect access to the NetState variable

Changes to NetState now go through an accessor function called
net_set_state()

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
Joe Hershberger
2012-05-23 07:59:14 +00:00
parent adf5d93e44
commit 22f6e99d5b
9 changed files with 48 additions and 37 deletions

View File

@@ -72,7 +72,7 @@ static int ping_send(void)
static void ping_timeout(void)
{
eth_halt();
NetState = NETLOOP_FAIL; /* we did not get the reply */
net_set_state(NETLOOP_FAIL); /* we did not get the reply */
}
void ping_start(void)
@@ -92,7 +92,7 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
case ICMP_ECHO_REPLY:
src_ip = NetReadIP((void *)&ip->ip_src);
if (src_ip == NetPingIP)
NetState = NETLOOP_SUCCESS;
net_set_state(NETLOOP_SUCCESS);
return;
case ICMP_ECHO_REQUEST:
debug("Got ICMP ECHO REQUEST, return "