netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v1 1/1] net: selftest: fix build issue if INET is disabled
@ 2021-04-28 13:09 Oleksij Rempel
  2021-04-28 15:31 ` Randy Dunlap
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Oleksij Rempel @ 2021-04-28 13:09 UTC (permalink / raw)
  To: Shawn Guo, Sascha Hauer, Andrew Lunn, Florian Fainelli,
	Heiner Kallweit, Fugang Duan
  Cc: Oleksij Rempel, Randy Dunlap, kernel, netdev, linux-arm-kernel,
	linux-kernel, linux-imx, Fabio Estevam, David Jander,
	Russell King, Philippe Schenker

In case ethernet driver is enabled and INET is disabled, selftest will
fail to build.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Fixes: 3e1e58d64c3d ("net: add generic selftest support")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/ethernet/atheros/Kconfig   |  2 +-
 drivers/net/ethernet/freescale/Kconfig |  2 +-
 include/net/selftests.h                | 19 +++++++++++++++++++
 net/Kconfig                            |  2 +-
 net/core/Makefile                      |  2 +-
 net/dsa/Kconfig                        |  2 +-
 6 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/atheros/Kconfig b/drivers/net/ethernet/atheros/Kconfig
index 6842b74b0696..482c58c4c584 100644
--- a/drivers/net/ethernet/atheros/Kconfig
+++ b/drivers/net/ethernet/atheros/Kconfig
@@ -20,8 +20,8 @@ if NET_VENDOR_ATHEROS
 config AG71XX
 	tristate "Atheros AR7XXX/AR9XXX built-in ethernet mac support"
 	depends on ATH79
-	select NET_SELFTESTS
 	select PHYLINK
+	imply NET_SELFTESTS
 	help
 	  If you wish to compile a kernel for AR7XXX/91XXX and enable
 	  ethernet support, then you should always answer Y to this.
diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
index 3d937b4650b2..2d1abdd58fab 100644
--- a/drivers/net/ethernet/freescale/Kconfig
+++ b/drivers/net/ethernet/freescale/Kconfig
@@ -26,8 +26,8 @@ config FEC
 		   ARCH_MXC || SOC_IMX28 || COMPILE_TEST)
 	default ARCH_MXC || SOC_IMX28 if ARM
 	select CRC32
-	select NET_SELFTESTS
 	select PHYLIB
+	imply NET_SELFTESTS
 	imply PTP_1588_CLOCK
 	help
 	  Say Y here if you want to use the built-in 10/100 Fast ethernet
diff --git a/include/net/selftests.h b/include/net/selftests.h
index 9993b9498cf3..61926c33a022 100644
--- a/include/net/selftests.h
+++ b/include/net/selftests.h
@@ -4,9 +4,28 @@
 
 #include <linux/ethtool.h>
 
+#if IS_ENABLED(CONFIG_NET_SELFTESTS)
+
 void net_selftest(struct net_device *ndev, struct ethtool_test *etest,
 		  u64 *buf);
 int net_selftest_get_count(void);
 void net_selftest_get_strings(u8 *data);
 
+#else
+
+static inline void net_selftest(struct net_device *ndev, struct ethtool_test *etest,
+		  u64 *buf)
+{
+}
+
+static inline int net_selftest_get_count(void)
+{
+	return 0;
+}
+
+static inline void net_selftest_get_strings(u8 *data)
+{
+}
+
+#endif
 #endif /* _NET_SELFTESTS */
diff --git a/net/Kconfig b/net/Kconfig
index 8d955195c069..f5ee7c65e6b4 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -431,7 +431,7 @@ config SOCK_VALIDATE_XMIT
 
 config NET_SELFTESTS
 	def_tristate PHYLIB
-	depends on PHYLIB
+	depends on PHYLIB && INET
 
 config NET_SOCK_MSG
 	bool
diff --git a/net/core/Makefile b/net/core/Makefile
index 1a6168d8f23b..f7f16650fe9e 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_NETPOLL) += netpoll.o
 obj-$(CONFIG_FIB_RULES) += fib_rules.o
 obj-$(CONFIG_TRACEPOINTS) += net-traces.o
 obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o
+obj-$(CONFIG_NET_SELFTESTS) += selftests.o
 obj-$(CONFIG_NETWORK_PHY_TIMESTAMPING) += timestamping.o
 obj-$(CONFIG_NET_PTP_CLASSIFY) += ptp_classifier.o
 obj-$(CONFIG_CGROUP_NET_PRIO) += netprio_cgroup.o
@@ -33,7 +34,6 @@ obj-$(CONFIG_NET_DEVLINK) += devlink.o
 obj-$(CONFIG_GRO_CELLS) += gro_cells.o
 obj-$(CONFIG_FAILOVER) += failover.o
 ifeq ($(CONFIG_INET),y)
-obj-$(CONFIG_NET_SELFTESTS) += selftests.o
 obj-$(CONFIG_NET_SOCK_MSG) += skmsg.o
 obj-$(CONFIG_BPF_SYSCALL) += sock_map.o
 endif
diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index cbc2bd643ab2..183e27b50202 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -9,7 +9,7 @@ menuconfig NET_DSA
 	select NET_SWITCHDEV
 	select PHYLINK
 	select NET_DEVLINK
-	select NET_SELFTESTS
+	imply NET_SELFTESTS
 	help
 	  Say Y if you want to enable support for the hardware switches supported
 	  by the Distributed Switch Architecture.
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v1 1/1] net: selftest: fix build issue if INET is disabled
  2021-04-28 13:09 [PATCH net-next v1 1/1] net: selftest: fix build issue if INET is disabled Oleksij Rempel
@ 2021-04-28 15:31 ` Randy Dunlap
  2021-04-28 15:45 ` Florian Fainelli
  2021-04-28 22:25 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2021-04-28 15:31 UTC (permalink / raw)
  To: Oleksij Rempel, Shawn Guo, Sascha Hauer, Andrew Lunn,
	Florian Fainelli, Heiner Kallweit, Fugang Duan
  Cc: kernel, netdev, linux-arm-kernel, linux-kernel, linux-imx,
	Fabio Estevam, David Jander, Russell King, Philippe Schenker

On 4/28/21 6:09 AM, Oleksij Rempel wrote:
> In case ethernet driver is enabled and INET is disabled, selftest will
> fail to build.
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Fixes: 3e1e58d64c3d ("net: add generic selftest support")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

> ---
>  drivers/net/ethernet/atheros/Kconfig   |  2 +-
>  drivers/net/ethernet/freescale/Kconfig |  2 +-
>  include/net/selftests.h                | 19 +++++++++++++++++++
>  net/Kconfig                            |  2 +-
>  net/core/Makefile                      |  2 +-
>  net/dsa/Kconfig                        |  2 +-
>  6 files changed, 24 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/atheros/Kconfig b/drivers/net/ethernet/atheros/Kconfig
> index 6842b74b0696..482c58c4c584 100644
> --- a/drivers/net/ethernet/atheros/Kconfig
> +++ b/drivers/net/ethernet/atheros/Kconfig
> @@ -20,8 +20,8 @@ if NET_VENDOR_ATHEROS
>  config AG71XX
>  	tristate "Atheros AR7XXX/AR9XXX built-in ethernet mac support"
>  	depends on ATH79
> -	select NET_SELFTESTS
>  	select PHYLINK
> +	imply NET_SELFTESTS
>  	help
>  	  If you wish to compile a kernel for AR7XXX/91XXX and enable
>  	  ethernet support, then you should always answer Y to this.
> diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
> index 3d937b4650b2..2d1abdd58fab 100644
> --- a/drivers/net/ethernet/freescale/Kconfig
> +++ b/drivers/net/ethernet/freescale/Kconfig
> @@ -26,8 +26,8 @@ config FEC
>  		   ARCH_MXC || SOC_IMX28 || COMPILE_TEST)
>  	default ARCH_MXC || SOC_IMX28 if ARM
>  	select CRC32
> -	select NET_SELFTESTS
>  	select PHYLIB
> +	imply NET_SELFTESTS
>  	imply PTP_1588_CLOCK
>  	help
>  	  Say Y here if you want to use the built-in 10/100 Fast ethernet
> diff --git a/include/net/selftests.h b/include/net/selftests.h
> index 9993b9498cf3..61926c33a022 100644
> --- a/include/net/selftests.h
> +++ b/include/net/selftests.h
> @@ -4,9 +4,28 @@
>  
>  #include <linux/ethtool.h>
>  
> +#if IS_ENABLED(CONFIG_NET_SELFTESTS)
> +
>  void net_selftest(struct net_device *ndev, struct ethtool_test *etest,
>  		  u64 *buf);
>  int net_selftest_get_count(void);
>  void net_selftest_get_strings(u8 *data);
>  
> +#else
> +
> +static inline void net_selftest(struct net_device *ndev, struct ethtool_test *etest,
> +		  u64 *buf)
> +{
> +}
> +
> +static inline int net_selftest_get_count(void)
> +{
> +	return 0;
> +}
> +
> +static inline void net_selftest_get_strings(u8 *data)
> +{
> +}
> +
> +#endif
>  #endif /* _NET_SELFTESTS */
> diff --git a/net/Kconfig b/net/Kconfig
> index 8d955195c069..f5ee7c65e6b4 100644
> --- a/net/Kconfig
> +++ b/net/Kconfig
> @@ -431,7 +431,7 @@ config SOCK_VALIDATE_XMIT
>  
>  config NET_SELFTESTS
>  	def_tristate PHYLIB
> -	depends on PHYLIB
> +	depends on PHYLIB && INET
>  
>  config NET_SOCK_MSG
>  	bool
> diff --git a/net/core/Makefile b/net/core/Makefile
> index 1a6168d8f23b..f7f16650fe9e 100644
> --- a/net/core/Makefile
> +++ b/net/core/Makefile
> @@ -21,6 +21,7 @@ obj-$(CONFIG_NETPOLL) += netpoll.o
>  obj-$(CONFIG_FIB_RULES) += fib_rules.o
>  obj-$(CONFIG_TRACEPOINTS) += net-traces.o
>  obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o
> +obj-$(CONFIG_NET_SELFTESTS) += selftests.o
>  obj-$(CONFIG_NETWORK_PHY_TIMESTAMPING) += timestamping.o
>  obj-$(CONFIG_NET_PTP_CLASSIFY) += ptp_classifier.o
>  obj-$(CONFIG_CGROUP_NET_PRIO) += netprio_cgroup.o
> @@ -33,7 +34,6 @@ obj-$(CONFIG_NET_DEVLINK) += devlink.o
>  obj-$(CONFIG_GRO_CELLS) += gro_cells.o
>  obj-$(CONFIG_FAILOVER) += failover.o
>  ifeq ($(CONFIG_INET),y)
> -obj-$(CONFIG_NET_SELFTESTS) += selftests.o
>  obj-$(CONFIG_NET_SOCK_MSG) += skmsg.o
>  obj-$(CONFIG_BPF_SYSCALL) += sock_map.o
>  endif
> diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
> index cbc2bd643ab2..183e27b50202 100644
> --- a/net/dsa/Kconfig
> +++ b/net/dsa/Kconfig
> @@ -9,7 +9,7 @@ menuconfig NET_DSA
>  	select NET_SWITCHDEV
>  	select PHYLINK
>  	select NET_DEVLINK
> -	select NET_SELFTESTS
> +	imply NET_SELFTESTS
>  	help
>  	  Say Y if you want to enable support for the hardware switches supported
>  	  by the Distributed Switch Architecture.
> 


-- 
~Randy


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v1 1/1] net: selftest: fix build issue if INET is disabled
  2021-04-28 13:09 [PATCH net-next v1 1/1] net: selftest: fix build issue if INET is disabled Oleksij Rempel
  2021-04-28 15:31 ` Randy Dunlap
@ 2021-04-28 15:45 ` Florian Fainelli
  2021-04-28 22:25 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2021-04-28 15:45 UTC (permalink / raw)
  To: Oleksij Rempel, Shawn Guo, Sascha Hauer, Andrew Lunn,
	Heiner Kallweit, Fugang Duan
  Cc: Randy Dunlap, kernel, netdev, linux-arm-kernel, linux-kernel,
	linux-imx, Fabio Estevam, David Jander, Russell King,
	Philippe Schenker



On 4/28/2021 6:09 AM, Oleksij Rempel wrote:
> In case ethernet driver is enabled and INET is disabled, selftest will
> fail to build.
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Fixes: 3e1e58d64c3d ("net: add generic selftest support")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v1 1/1] net: selftest: fix build issue if INET is disabled
  2021-04-28 13:09 [PATCH net-next v1 1/1] net: selftest: fix build issue if INET is disabled Oleksij Rempel
  2021-04-28 15:31 ` Randy Dunlap
  2021-04-28 15:45 ` Florian Fainelli
@ 2021-04-28 22:25 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2021-04-28 22:25 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Shawn Guo, Sascha Hauer, Andrew Lunn, Florian Fainelli,
	Heiner Kallweit, Fugang Duan, Randy Dunlap, kernel, netdev,
	linux-arm-kernel, linux-kernel, linux-imx, Fabio Estevam,
	David Jander, Russell King, Philippe Schenker

On Wed, 28 Apr 2021 15:09:46 +0200 Oleksij Rempel wrote:
> In case ethernet driver is enabled and INET is disabled, selftest will
> fail to build.
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Fixes: 3e1e58d64c3d ("net: add generic selftest support")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

Applied (after fixing a checkpatch warning), thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-28 22:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 13:09 [PATCH net-next v1 1/1] net: selftest: fix build issue if INET is disabled Oleksij Rempel
2021-04-28 15:31 ` Randy Dunlap
2021-04-28 15:45 ` Florian Fainelli
2021-04-28 22:25 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).