]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Convert CONFIG_KEEP_SERVERADDR to Kconfig
authorSimon Glass <sjg@chromium.org>
Sat, 18 Dec 2021 18:27:48 +0000 (11:27 -0700)
committerTom Rini <trini@konsulko.com>
Fri, 21 Jan 2022 19:01:34 +0000 (14:01 -0500)
This converts the following to Kconfig:
   CONFIG_KEEP_SERVERADDR

Drop the preprocessor usage also.

Signed-off-by: Simon Glass <sjg@chromium.org>
README
include/configs/sandbox.h
net/Kconfig
net/arp.c

diff --git a/README b/README
index 5549849d29919619af6a86644bc84334edfa233b..560a18177c2246cbd7cee335553aab19894e6437 100644 (file)
--- a/README
+++ b/README
@@ -1138,11 +1138,6 @@ The following options need to be configured:
                server to contact when using the "tftboot" command.
                (Environment variable "serverip")
 
-               CONFIG_KEEP_SERVERADDR
-
-               Keeps the server's MAC address, in the env 'serveraddr'
-               for passing to bootargs (like Linux's netconsole option)
-
 - Gateway IP address:
                CONFIG_GATEWAYIP
 
index cd7d99ec69c0e8a62ac876c64e99053f109e3172..1dd21d5e9251713f3f096f7d7b58f50f219bd7d8 100644 (file)
@@ -25,7 +25,6 @@
 #define CONFIG_SYS_BAUDRATE_TABLE      {4800, 9600, 19200, 38400, 57600,\
                                        115200}
 
-#define CONFIG_KEEP_SERVERADDR
 #define CONFIG_UDP_CHECKSUM
 #define CONFIG_TIMESTAMP
 #define CONFIG_BOOTP_SERVERIP
index cabe93c6bd296b2744ac46930870351c096fe600..8e9579afb2bada131d0874d0a79d242131eb7211 100644 (file)
@@ -99,4 +99,13 @@ config SERVERIP_FROM_PROXYDHCP_DELAY_MS
                receiving response from main DHCP server. Has no effect if
                SERVERIP_FROM_PROXYDHCP is false.
 
+config KEEP_SERVERADDR
+       bool "Write the server's MAC address to 'serveraddr'"
+       default y if SANDBOX
+       help
+         Keeps the server's MAC address, in the env 'serveraddr'
+         for passing to bootargs (like Linux's netconsole option). If this is
+         enabled, when an ARP reply is received, the server's IP address is
+         written there.
+
 endif   # if NET
index 1d06ed25722b4ba4c15044c025a4a4568deae819..0b086dc8d2108e59ff034dd4be8c316777914404 100644 (file)
--- a/net/arp.c
+++ b/net/arp.c
@@ -196,13 +196,12 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
                if (!arp_is_waiting())
                        break;
 
-#ifdef CONFIG_KEEP_SERVERADDR
-               if (net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) {
+               if (IS_ENABLED(CONFIG_KEEP_SERVERADDR) &&
+                   net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) {
                        char buf[20];
                        sprintf(buf, "%pM", &arp->ar_sha);
                        env_set("serveraddr", buf);
                }
-#endif
 
                reply_ip_addr = net_read_ip(&arp->ar_spa);