From: Andi Kleen <andi@firstfloor.org>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, tom.zanussi@linux.intel.com,
Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 09/24] net, diet: Make ethtool optional
Date: Mon, 5 May 2014 15:25:58 -0700 [thread overview]
Message-ID: <1399328773-6531-10-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1399328773-6531-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
Small embedded systems don't need ethtool, so make it optional.
Right now the driver code is not removed, unless the driver
uses SET_ETHTOOL_OPS and LTO (which can eliminate unused code)
Saves about 10k text(without driver code):
text data bss dec hex filename
489877 19371 13480 522728 7f9e8 net/built-in.o
478967 19369 13480 511816 7cf48 net/built-in.o-wo-ethtool
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
include/linux/ethtool.h | 14 ++++++++++++++
include/linux/netdevice.h | 21 ++++++++++++++++++---
net/Kconfig | 6 ++++++
net/core/Makefile | 3 ++-
net/core/dev.c | 2 ++
5 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 0a114d0..e90c958 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -40,8 +40,14 @@ struct compat_ethtool_rxnfc {
#include <linux/rculist.h>
+#ifdef CONFIG_NET_ETHTOOL
extern int __ethtool_get_settings(struct net_device *dev,
struct ethtool_cmd *cmd);
+#else
+static inline int __ethtool_get_settings(struct net_device *dev,
+ struct ethtool_cmd *cmd)
+{ return -EINVAL; }
+#endif
/**
* enum ethtool_phys_id_state - indicator state for physical identification
@@ -61,9 +67,17 @@ enum ethtool_phys_id_state {
struct net_device;
+#ifdef CONFIG_NET_ETHTOOL
/* Some generic methods drivers may use in their ethtool_ops */
u32 ethtool_op_get_link(struct net_device *dev);
int ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti);
+#else
+/* Some generic methods drivers may use in their ethtool_ops */
+static inline u32 ethtool_op_get_link(struct net_device *dev) { return 0; }
+static inline int
+ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti)
+{ return -EINVAL; }
+#endif
/**
* ethtool_rxfh_indir_default - get default value for RX flow hash indirection
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7ed3a3a..29e0409 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -56,12 +56,28 @@ struct device;
struct phy_device;
/* 802.11 specific */
struct wireless_dev;
- /* source back-compat hooks */
+
+#ifdef CONFIG_NET_ETHTOOL
+
+/* When the driver uses this macro ethtool code can be optimized out
+ * when not needed. We still reference it to avoid unused static
+ * warnings.
+ */
#define SET_ETHTOOL_OPS(netdev,ops) \
- ( (netdev)->ethtool_ops = (ops) )
+ ( (void)(ops), (netdev)->ethtool_ops = (ops) )
void netdev_set_default_ethtool_ops(struct net_device *dev,
const struct ethtool_ops *ops);
+int dev_ethtool(struct net *net, struct ifreq *);
+
+#else
+#define SET_ETHTOOL_OPS(netdev,ops) do {} while(0)
+static inline void
+netdev_set_default_ethtool_ops(struct net_device *dev,
+ const struct ethtool_ops *ops) {}
+static inline int
+dev_ethtool(struct net *net, struct ifreq *ifr) { return -EINVAL; }
+#endif
/* Backlog congestion levels */
#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
@@ -2616,7 +2632,6 @@ void netdev_rx_handler_unregister(struct net_device *dev);
bool dev_valid_name(const char *name);
int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
-int dev_ethtool(struct net *net, struct ifreq *);
unsigned int dev_get_flags(const struct net_device *);
int __dev_change_flags(struct net_device *, unsigned int flags);
int dev_change_flags(struct net_device *, unsigned int);
diff --git a/net/Kconfig b/net/Kconfig
index d92afe4..281d172 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -82,6 +82,12 @@ source "net/netlabel/Kconfig"
endif # if INET
+config NET_ETHTOOL
+ bool "Ethtool support"
+ default y
+ help
+ Support changing ethernet driver parameters from user tools.
+
config NETWORK_SECMARK
bool "Security Marking"
help
diff --git a/net/core/Makefile b/net/core/Makefile
index 826b925..bfd28b1 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -7,12 +7,13 @@ obj-y := sock.o request_sock.o skbuff.o iovec.o datagram.o stream.o scm.o \
obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
-obj-y += dev.o ethtool.o dev_addr_lists.o dst.o netevent.o \
+obj-y += dev.o dev_addr_lists.o dst.o netevent.o \
neighbour.o rtnetlink.o utils.o link_watch.o filter.o \
sock_diag.o dev_ioctl.o
obj-$(CONFIG_XFRM) += flow.o
obj-y += net-sysfs.o
+obj-$(CONFIG_NET_ETHTOOL) += ethtool.o
obj-$(CONFIG_PROC_FS) += net-procfs.o
obj-$(CONFIG_NET_PKTGEN) += pktgen.o
obj-$(CONFIG_NETPOLL) += netpoll.o
diff --git a/net/core/dev.c b/net/core/dev.c
index c6cbe69..cf102a4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6310,6 +6310,7 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev)
static const struct ethtool_ops default_ethtool_ops;
+#ifdef CONFIG_NET_ETHTOOL
void netdev_set_default_ethtool_ops(struct net_device *dev,
const struct ethtool_ops *ops)
{
@@ -6317,6 +6318,7 @@ void netdev_set_default_ethtool_ops(struct net_device *dev,
dev->ethtool_ops = ops;
}
EXPORT_SYMBOL_GPL(netdev_set_default_ethtool_ops);
+#endif
void netdev_freemem(struct net_device *dev)
{
--
1.9.0
next prev parent reply other threads:[~2014-05-05 22:26 UTC|newest]
Thread overview: 124+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-05 22:25 RFC: A reduced Linux network stack for small systems Andi Kleen
2014-05-05 22:25 ` [PATCH 01/24] net, diet: Reduce netdev name hash table for CONFIG_BASE_SMALL Andi Kleen
2014-05-06 3:03 ` David Miller
2014-05-05 22:25 ` [PATCH 02/24] net, diet: Reduce NAPI " Andi Kleen
2014-05-05 22:25 ` [PATCH 03/24] net, diet: Decrease ip defrag hash tables and max length with BASE_SMALL Andi Kleen
2014-05-05 22:25 ` [PATCH 04/24] net, diet: Make FIB hash tables smaller with CONFIG_BASE_SMALL Andi Kleen
2014-05-06 3:10 ` David Miller
2014-05-05 22:25 ` [PATCH 05/24] net, diet: Default to small TCP hash tables on small kernels Andi Kleen
2014-05-06 3:12 ` David Miller
2014-05-05 22:25 ` [PATCH 06/24] net, diet: Use small UDP " Andi Kleen
2014-05-06 3:11 ` David Miller
2014-05-06 14:26 ` Eric Dumazet
2014-05-06 18:23 ` Andi Kleen
2014-05-06 19:25 ` Eric Dumazet
2014-05-05 22:25 ` [PATCH 07/24] net, diet: Make ping sockets optional Andi Kleen
2014-05-06 3:04 ` David Miller
2014-05-05 22:25 ` [PATCH 08/24] net, diet: Make TCP metrics optional Andi Kleen
2014-05-05 23:18 ` Yuchung Cheng
2014-05-05 23:28 ` Andi Kleen
2014-05-06 3:12 ` David Miller
2014-05-06 3:21 ` Andi Kleen
2014-05-06 3:23 ` David Miller
2014-05-06 4:39 ` Tom Zanussi
2014-05-07 13:59 ` One Thousand Gnomes
2014-05-07 17:20 ` David Miller
2014-05-07 22:19 ` Tim Bird
2014-05-07 22:52 ` David Miller
2014-05-06 15:57 ` josh
2014-05-06 15:59 ` David Miller
2014-05-06 16:41 ` josh
2014-05-06 17:12 ` Rick Jones
2014-05-06 18:09 ` josh
2014-05-06 17:16 ` David Miller
2014-05-06 17:55 ` josh
2014-05-06 18:33 ` Cong Wang
2014-05-06 18:48 ` Andi Kleen
2014-05-06 19:19 ` Richard Cochran
2014-05-06 20:44 ` David Miller
2014-05-06 21:08 ` josh
2014-05-06 21:11 ` David Miller
2014-05-06 22:50 ` josh
2014-05-06 23:27 ` Eric Dumazet
2014-06-14 20:33 ` Pavel Machek
2014-06-23 10:17 ` zhuyj
2014-05-06 19:14 ` Richard Cochran
2014-05-06 19:50 ` Andi Kleen
2014-05-06 20:07 ` Richard Cochran
2014-05-06 21:05 ` Andi Kleen
2014-05-06 23:29 ` Eric Dumazet
2014-05-07 4:33 ` Andi Kleen
2014-05-06 20:46 ` David Miller
2014-05-07 8:39 ` David Laight
2014-05-09 9:48 ` Pavel Machek
2014-05-06 16:39 ` Eric Dumazet
2014-05-06 16:45 ` josh
2014-05-06 17:03 ` Eric Dumazet
2014-05-06 17:30 ` josh
2014-05-06 17:17 ` David Miller
2014-05-06 17:21 ` josh
2014-05-06 17:25 ` David Miller
2014-05-06 20:06 ` Andi Kleen
2014-05-06 20:47 ` David Miller
2014-05-06 20:11 ` josh
2014-05-06 20:44 ` Andi Kleen
2014-05-06 17:14 ` David Miller
2014-05-06 18:32 ` Andi Kleen
2014-05-06 18:58 ` Tom Herbert
2014-05-06 19:37 ` josh
2014-05-06 19:57 ` Andi Kleen
2014-05-06 20:17 ` Eric Dumazet
2014-05-06 20:27 ` josh
2014-05-06 20:37 ` Andi Kleen
2014-05-06 20:48 ` David Miller
2014-05-07 13:35 ` One Thousand Gnomes
2014-05-13 16:22 ` Christer Weinigel
2014-05-09 7:38 ` Pavel Machek
2014-05-05 22:25 ` Andi Kleen [this message]
2014-05-06 3:11 ` [PATCH 09/24] net, diet: Make ethtool optional David Miller
2014-05-06 3:14 ` Andi Kleen
2014-05-06 3:22 ` David Miller
2014-05-05 22:25 ` [PATCH 10/24] net, diet: Make LPF filter optional Andi Kleen
2014-05-06 3:10 ` David Miller
2014-05-05 22:26 ` [PATCH 11/24] net, diet: Move rtnl_lock to separate file Andi Kleen
2014-05-05 22:26 ` [PATCH 12/24] net, diet: Make rtnetlink optional Andi Kleen
2014-05-06 3:08 ` David Miller
2014-05-06 3:11 ` Andi Kleen
2014-05-05 22:26 ` [PATCH 13/24] net, diet: Make GRO offload optional Andi Kleen
2014-05-06 3:01 ` David Miller
2014-05-06 3:03 ` Andi Kleen
2014-05-05 22:26 ` [PATCH 14/24] net, diet: Make MIB statistics collections depend on PROC_FS Andi Kleen
2014-05-06 3:05 ` David Miller
2014-05-05 22:26 ` [PATCH 15/24] net, diet: Make igmp and mcast ioctls depend on IP_MULTICAST Andi Kleen
2014-05-05 22:26 ` [PATCH 16/24] net, diet: Make TCP fastopen optional Andi Kleen
2014-05-06 3:06 ` David Miller
2014-05-05 22:26 ` [PATCH 17/24] net, diet: Make internal control sockets use UDP Andi Kleen
2014-05-05 22:26 ` [PATCH 18/24] net, diet: Make raw sockets optional Andi Kleen
2014-05-06 3:12 ` David Miller
2014-05-05 22:26 ` [PATCH 19/24] net, diet: Make RPS configurable Andi Kleen
2014-05-06 3:14 ` David Miller
2014-05-06 3:16 ` Andi Kleen
2014-05-06 8:32 ` Bjørn Mork
2014-05-05 22:26 ` [PATCH 20/24] net, diet: Make XPS configurable Andi Kleen
2014-05-05 22:26 ` [PATCH 21/24] net, diet: Make packet tpacket/mmap/fanout/rings optional Andi Kleen
2014-05-06 3:09 ` David Miller
2014-05-05 22:26 ` [PATCH 22/24] net, diet: Support simpler routing table Andi Kleen
2014-05-06 3:02 ` David Miller
2014-05-06 3:08 ` Andi Kleen
2014-05-06 3:21 ` David Miller
2014-05-05 22:26 ` [PATCH 23/24] net, diet: Add coccinelle script to convert drivers to ETHTOOL_OPS Andi Kleen
2014-05-06 9:27 ` Nicolas Palix
2014-05-06 15:05 ` David Miller
2014-05-07 0:18 ` Wilfried Klaebe
2014-05-05 22:26 ` [PATCH 24/24] net, diet: Convert all drivers to use SET_ETHTOOL_OPS Andi Kleen
2014-05-06 7:25 ` RFC: A reduced Linux network stack for small systems Richard Weinberger
2014-05-06 13:34 ` Tom Zanussi
2014-05-06 15:20 ` Alexei Starovoitov
2014-05-06 15:34 ` Tom Zanussi
2014-05-06 17:20 ` Alexei Starovoitov
2014-05-06 20:00 ` Andi Kleen
2014-05-06 21:05 ` Alexei Starovoitov
2014-05-09 7:39 ` Pavel Machek
2014-05-09 7:38 ` Pavel Machek
2014-05-06 9:18 ` David Laight
2014-05-07 13:20 ` One Thousand Gnomes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399328773-6531-10-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=ak@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tom.zanussi@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).