From 541323a2470ad4f787316fc598a7cd146980ba0b Mon Sep 17 00:00:00 2001 From: David Wu Date: Sat, 18 Sep 2021 16:37:51 +0800 Subject: [PATCH] net: ethernet: stmmac: Add config option for stmmac ethtool Add this config option to reduce memory usage, if it was not necessary. ./ksize.sh drivers/net/ethernet/stmicro/ before size: 121861 Bytes after size: 109539 Bytes save size: 12322 Bytes Signed-off-by: David Wu Change-Id: I828130d961846a955b998d63afffbabcc9dd5925 --- drivers/net/ethernet/stmicro/stmmac/Kconfig | 6 ++++++ drivers/net/ethernet/stmicro/stmmac/Makefile | 3 ++- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index 8c1ab22c61bc..374a87541a42 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -25,6 +25,12 @@ config STMMAC_SELFTESTS feature if you are facing problems with your HW and submit the test results to the netdev Mailing List. +config STMMAC_ETHTOOL + bool "Ethtool feature for STMMAC" + default STMMAC_ETH + help + This selects the ethtool function, default is Y. + config STMMAC_PLATFORM tristate "STMMAC Platform bus support" depends on STMMAC_ETH diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index b4d6aac7cb84..60362977261f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_STMMAC_ETH) += stmmac.o -stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \ +stmmac-objs:= stmmac_main.o stmmac_mdio.o ring_mode.o \ chain_mode.o dwmac_lib.o dwmac1000_core.o dwmac1000_dma.o \ dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o \ mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o dwmac4_descs.o \ @@ -9,6 +9,7 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \ $(stmmac-y) stmmac-$(CONFIG_STMMAC_SELFTESTS) += stmmac_selftests.o +stmmac-$(CONFIG_STMMAC_ETHTOOL) += stmmac_ethtool.o # Ordering matters. Generic driver must be last. obj-$(CONFIG_STMMAC_PLATFORM) += stmmac-platform.o diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 727e68dfaf1c..8608984f7cf5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -256,7 +256,14 @@ enum stmmac_state { int stmmac_mdio_unregister(struct net_device *ndev); int stmmac_mdio_register(struct net_device *ndev); int stmmac_mdio_reset(struct mii_bus *mii); + +#ifdef CONFIG_STMMAC_ETHTOOL void stmmac_set_ethtool_ops(struct net_device *netdev); +#else +static inline void stmmac_set_ethtool_ops(struct net_device *netdev) +{ +} +#endif void stmmac_ptp_register(struct stmmac_priv *priv); void stmmac_ptp_unregister(struct stmmac_priv *priv);