diff mbox series

[1/4] Convert CONFIG_KEEP_SERVERADDR to Kconfig

Message ID 20211218150805.1083645-1-sjg@chromium.org
State Superseded
Delegated to: Tom Rini
Headers show
Series [1/4] Convert CONFIG_KEEP_SERVERADDR to Kconfig | expand

Commit Message

Simon Glass Dec. 18, 2021, 3:08 p.m. UTC
This converts the following to Kconfig:
   CONFIG_KEEP_SERVERADDR

Drop the preprocessor usage also.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 README                       | 6 ------
 include/configs/sandbox.h    | 1 -
 net/Kconfig                  | 9 +++++++++
 net/arp.c                    | 5 ++---
 scripts/config_whitelist.txt | 1 -
 5 files changed, 11 insertions(+), 11 deletions(-)

Comments

Sean Anderson Dec. 18, 2021, 3:15 p.m. UTC | #1
On 12/18/21 10:08 AM, Simon Glass wrote:
> This converts the following to Kconfig:
>     CONFIG_KEEP_SERVERADDR
> 
> Drop the preprocessor usage also.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>   README                       | 6 ------
>   include/configs/sandbox.h    | 1 -
>   net/Kconfig                  | 9 +++++++++
>   net/arp.c                    | 5 ++---
>   scripts/config_whitelist.txt | 1 -
>   5 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/README b/README
> index 056b717557b..eaf9170e952 100644
> --- a/README
> +++ b/README
> @@ -1193,12 +1193,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
>   
>   		Defines a default value for the IP address of the
> diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
> index cd7d99ec69c..1dd21d5e925 100644
> --- a/include/configs/sandbox.h
> +++ b/include/configs/sandbox.h
> @@ -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
> diff --git a/net/Kconfig b/net/Kconfig
> index 7a2d1450188..fb6420f9bbe 100644
> --- a/net/Kconfig
> +++ b/net/Kconfig
> @@ -98,4 +98,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.
> +

This loses a bit of context originally present in the README. Can you note that
this is the TFTP server's address we are keeping?

--Sean

>   endif   # if NET
> diff --git a/net/arp.c b/net/arp.c
> index 1d06ed25722..0b086dc8d21 100644
> --- 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);
>   
> diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
> index 6d961ccb3e6..3285d3cd30e 100644
> --- a/scripts/config_whitelist.txt
> +++ b/scripts/config_whitelist.txt
> @@ -639,7 +639,6 @@ CONFIG_JFFS2_PART_SIZE
>   CONFIG_JFFS2_SUMMARY
>   CONFIG_JRSTARTR_JR0
>   CONFIG_JTAG_CONSOLE
> -CONFIG_KEEP_SERVERADDR
>   CONFIG_KEY_REVOCATION
>   CONFIG_KIRKWOOD_EGIGA_INIT
>   CONFIG_KIRKWOOD_GPIO
>
Tom Rini Dec. 18, 2021, 4:50 p.m. UTC | #2
On Sat, Dec 18, 2021 at 10:15:08AM -0500, Sean Anderson wrote:
> On 12/18/21 10:08 AM, Simon Glass wrote:
> > This converts the following to Kconfig:
> >     CONFIG_KEEP_SERVERADDR
> > 
> > Drop the preprocessor usage also.
> > 
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> > 
> >   README                       | 6 ------
> >   include/configs/sandbox.h    | 1 -
> >   net/Kconfig                  | 9 +++++++++
> >   net/arp.c                    | 5 ++---
> >   scripts/config_whitelist.txt | 1 -
> >   5 files changed, 11 insertions(+), 11 deletions(-)
> > 
> > diff --git a/README b/README
> > index 056b717557b..eaf9170e952 100644
> > --- a/README
> > +++ b/README
> > @@ -1193,12 +1193,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
> >   		Defines a default value for the IP address of the
> > diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
> > index cd7d99ec69c..1dd21d5e925 100644
> > --- a/include/configs/sandbox.h
> > +++ b/include/configs/sandbox.h
> > @@ -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
> > diff --git a/net/Kconfig b/net/Kconfig
> > index 7a2d1450188..fb6420f9bbe 100644
> > --- a/net/Kconfig
> > +++ b/net/Kconfig
> > @@ -98,4 +98,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.
> > +
> 
> This loses a bit of context originally present in the README. Can you note that
> this is the TFTP server's address we are keeping?

It also removes a wrong line in the README.  In general, you need to be
extra careful with moveconfig.py and README contents.
Simon Glass Dec. 18, 2021, 6:18 p.m. UTC | #3
Hi Sean, Tom,

On Sat, 18 Dec 2021 at 09:50, Tom Rini <trini@konsulko.com> wrote:
>
> On Sat, Dec 18, 2021 at 10:15:08AM -0500, Sean Anderson wrote:
> > On 12/18/21 10:08 AM, Simon Glass wrote:
> > > This converts the following to Kconfig:
> > >     CONFIG_KEEP_SERVERADDR
> > >
> > > Drop the preprocessor usage also.
> > >
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > ---
> > >
> > >   README                       | 6 ------
> > >   include/configs/sandbox.h    | 1 -
> > >   net/Kconfig                  | 9 +++++++++
> > >   net/arp.c                    | 5 ++---
> > >   scripts/config_whitelist.txt | 1 -
> > >   5 files changed, 11 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/README b/README
> > > index 056b717557b..eaf9170e952 100644
> > > --- a/README
> > > +++ b/README
> > > @@ -1193,12 +1193,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
> > >             Defines a default value for the IP address of the
> > > diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
> > > index cd7d99ec69c..1dd21d5e925 100644
> > > --- a/include/configs/sandbox.h
> > > +++ b/include/configs/sandbox.h
> > > @@ -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
> > > diff --git a/net/Kconfig b/net/Kconfig
> > > index 7a2d1450188..fb6420f9bbe 100644
> > > --- a/net/Kconfig
> > > +++ b/net/Kconfig
> > > @@ -98,4 +98,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.
> > > +
> >
> > This loses a bit of context originally present in the README. Can you note that
> > this is the TFTP server's address we are keeping?
>
> It also removes a wrong line in the README.  In general, you need to be
> extra careful with moveconfig.py and README contents.

Actually the problem is that I sent the wrong series, the one before
before I fixed it up and pushed to gitlab:

https://source.denx.de/u-boot/custodians/u-boot-dm/-/pipelines/10306

It is also missing a patch at the end. I suppose I forgot to select
the correct branch when sending (I send on a different machine).

I'll try again.

Regards,
Simon
diff mbox series

Patch

diff --git a/README b/README
index 056b717557b..eaf9170e952 100644
--- a/README
+++ b/README
@@ -1193,12 +1193,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
 
 		Defines a default value for the IP address of the
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index cd7d99ec69c..1dd21d5e925 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -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
diff --git a/net/Kconfig b/net/Kconfig
index 7a2d1450188..fb6420f9bbe 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -98,4 +98,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
diff --git a/net/arp.c b/net/arp.c
index 1d06ed25722..0b086dc8d21 100644
--- 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);
 
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 6d961ccb3e6..3285d3cd30e 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -639,7 +639,6 @@  CONFIG_JFFS2_PART_SIZE
 CONFIG_JFFS2_SUMMARY
 CONFIG_JRSTARTR_JR0
 CONFIG_JTAG_CONSOLE
-CONFIG_KEEP_SERVERADDR
 CONFIG_KEY_REVOCATION
 CONFIG_KIRKWOOD_EGIGA_INIT
 CONFIG_KIRKWOOD_GPIO