diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2018-09-26 16:48:58 -0500 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2018-10-10 12:28:58 -0500 |
commit | 3f02c98bd1000fc26ee2700fd5a75112cdeaca6c (patch) | |
tree | 89ce7087f91b06e5ad12442dd6487ab5d3f0c149 /net | |
parent | c67a420781012abb5c888e2857efde12cf27284b (diff) |
net: Add an accessor to know if waiting for ARP
This single-sources the state of the ARP.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/arp.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -100,7 +100,7 @@ int arp_timeout_check(void) { ulong t; - if (!net_arp_wait_packet_ip.s_addr) + if (!arp_is_waiting()) return 0; t = get_timer(0); @@ -187,8 +187,8 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) return; case ARPOP_REPLY: /* arp reply */ - /* are we waiting for a reply */ - if (!net_arp_wait_packet_ip.s_addr) + /* are we waiting for a reply? */ + if (!arp_is_waiting()) break; #ifdef CONFIG_KEEP_SERVERADDR @@ -233,3 +233,8 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) return; } } + +bool arp_is_waiting(void) +{ + return !!net_arp_wait_packet_ip.s_addr; +} |