Skip to content

Commit 4a52dd8

Browse files
oleremkuba-moo
authored andcommitted
net: selftest: fix build issue if INET is disabled
In case ethernet driver is enabled and INET is disabled, selftest will fail to build. Reported-by: Randy Dunlap <[email protected]> Fixes: 3e1e58d ("net: add generic selftest support") Signed-off-by: Oleksij Rempel <[email protected]> Acked-by: Randy Dunlap <[email protected]> # build-tested Reviewed-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 15c0a64 commit 4a52dd8

File tree

6 files changed

+24
-5
lines changed

6 files changed

+24
-5
lines changed

drivers/net/ethernet/atheros/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ if NET_VENDOR_ATHEROS
2020
config AG71XX
2121
tristate "Atheros AR7XXX/AR9XXX built-in ethernet mac support"
2222
depends on ATH79
23-
select NET_SELFTESTS
2423
select PHYLINK
24+
imply NET_SELFTESTS
2525
help
2626
If you wish to compile a kernel for AR7XXX/91XXX and enable
2727
ethernet support, then you should always answer Y to this.

drivers/net/ethernet/freescale/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ config FEC
2626
ARCH_MXC || SOC_IMX28 || COMPILE_TEST)
2727
default ARCH_MXC || SOC_IMX28 if ARM
2828
select CRC32
29-
select NET_SELFTESTS
3029
select PHYLIB
30+
imply NET_SELFTESTS
3131
imply PTP_1588_CLOCK
3232
help
3333
Say Y here if you want to use the built-in 10/100 Fast ethernet

include/net/selftests.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,28 @@
44

55
#include <linux/ethtool.h>
66

7+
#if IS_ENABLED(CONFIG_NET_SELFTESTS)
8+
79
void net_selftest(struct net_device *ndev, struct ethtool_test *etest,
810
u64 *buf);
911
int net_selftest_get_count(void);
1012
void net_selftest_get_strings(u8 *data);
1113

14+
#else
15+
16+
static inline void net_selftest(struct net_device *ndev, struct ethtool_test *etest,
17+
u64 *buf)
18+
{
19+
}
20+
21+
static inline int net_selftest_get_count(void)
22+
{
23+
return 0;
24+
}
25+
26+
static inline void net_selftest_get_strings(u8 *data)
27+
{
28+
}
29+
30+
#endif
1231
#endif /* _NET_SELFTESTS */

net/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ config SOCK_VALIDATE_XMIT
431431

432432
config NET_SELFTESTS
433433
def_tristate PHYLIB
434-
depends on PHYLIB
434+
depends on PHYLIB && INET
435435

436436
config NET_SOCK_MSG
437437
bool

net/core/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ obj-$(CONFIG_NETPOLL) += netpoll.o
2121
obj-$(CONFIG_FIB_RULES) += fib_rules.o
2222
obj-$(CONFIG_TRACEPOINTS) += net-traces.o
2323
obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o
24+
obj-$(CONFIG_NET_SELFTESTS) += selftests.o
2425
obj-$(CONFIG_NETWORK_PHY_TIMESTAMPING) += timestamping.o
2526
obj-$(CONFIG_NET_PTP_CLASSIFY) += ptp_classifier.o
2627
obj-$(CONFIG_CGROUP_NET_PRIO) += netprio_cgroup.o
@@ -33,7 +34,6 @@ obj-$(CONFIG_NET_DEVLINK) += devlink.o
3334
obj-$(CONFIG_GRO_CELLS) += gro_cells.o
3435
obj-$(CONFIG_FAILOVER) += failover.o
3536
ifeq ($(CONFIG_INET),y)
36-
obj-$(CONFIG_NET_SELFTESTS) += selftests.o
3737
obj-$(CONFIG_NET_SOCK_MSG) += skmsg.o
3838
obj-$(CONFIG_BPF_SYSCALL) += sock_map.o
3939
endif

net/dsa/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ menuconfig NET_DSA
99
select NET_SWITCHDEV
1010
select PHYLINK
1111
select NET_DEVLINK
12-
select NET_SELFTESTS
12+
imply NET_SELFTESTS
1313
help
1414
Say Y if you want to enable support for the hardware switches supported
1515
by the Distributed Switch Architecture.

0 commit comments

Comments
 (0)