From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: linux-kernel@vger.kernel.org, linux-embedded@vger.kernel.org
Cc: michael@free-electrons.com,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Matt Mackall <mpm@selenic.com>,
jgarzik@pobox.com, netdev@vger.kernel.org, davem@davemloft.net,
akpm@linux-foundation.org
Subject: [patch 3/4] Configure out ethtool support
Date: Thu, 31 Jul 2008 11:27:06 +0200 [thread overview]
Message-ID: <20080731093221.236840420@free-electrons.com> (raw)
In-Reply-To: 20080731092703.661994657@free-electrons.com
[-- Attachment #1: configure-out-ethtool-support --]
[-- Type: text/plain, Size: 5790 bytes --]
This patchs add the CONFIG_ETHTOOL option which allows to remove
support for ethtool, not necessarly used on embedded systems. As this
is a size-reduction option, it depends on CONFIG_EMBEDDED. It allows
to save ~6 kilobytes of kernel code:
text data bss dec hex filename
1258447 123592 212992 1595031 185697 vmlinux
1252147 123592 212992 1588731 183dfb vmlinux.new
-6300 0 0 -6300 -189C +/-
Bonding and bridging both depends on Ethtool functionnality, so
ETHTOOL is selected automatically when either bonding and bridging are
selected.
Question: should we also remove ethtool-related functions from all
network drivers ?
This patch has been originally written by Matt Mackall
<mpm@selenic.com>, and is part of the Linux Tiny project.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Matt Mackall <mpm@selenic.com>
Cc: jgarzik@pobox.com
Cc: netdev@vger.kernel.org
Cc: davem@davemloft.net
Cc: mpm@selenic.com
Cc: akpm@linux-foundation.org
---
drivers/net/Kconfig | 1 +
include/linux/ethtool.h | 16 ++++++++++++++++
init/Kconfig | 8 ++++++++
net/bridge/Kconfig | 1 +
net/core/Makefile | 3 ++-
net/core/dev.c | 4 ++++
6 files changed, 32 insertions(+), 1 deletion(-)
Index: linuxdev/drivers/net/Kconfig
===================================================================
--- linuxdev.orig/drivers/net/Kconfig
+++ linuxdev/drivers/net/Kconfig
@@ -61,6 +61,7 @@
config BONDING
tristate "Bonding driver support"
depends on INET
+ select ETHTOOL
---help---
Say 'Y' or 'M' if you wish to be able to 'bond' multiple Ethernet
Channels together. This is called 'Etherchannel' by Cisco,
Index: linuxdev/include/linux/ethtool.h
===================================================================
--- linuxdev.orig/include/linux/ethtool.h
+++ linuxdev/include/linux/ethtool.h
@@ -283,6 +283,7 @@
struct net_device;
/* Some generic methods drivers may use in their ethtool_ops */
+#ifdef CONFIG_ETHTOOL
u32 ethtool_op_get_link(struct net_device *dev);
u32 ethtool_op_get_tx_csum(struct net_device *dev);
int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
@@ -296,6 +297,21 @@
int ethtool_op_set_ufo(struct net_device *dev, u32 data);
u32 ethtool_op_get_flags(struct net_device *dev);
int ethtool_op_set_flags(struct net_device *dev, u32 data);
+#else
+static inline u32 ethtool_op_get_link(struct net_device *dev) { return 0; }
+static inline u32 ethtool_op_get_tx_csum(struct net_device *dev) { return 0; }
+static inline int ethtool_op_set_tx_csum(struct net_device *dev, u32 data) { return 0; }
+static inline int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data) { return 0; }
+static inline int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data) { return 0; }
+static inline u32 ethtool_op_get_sg(struct net_device *dev) { return 0; }
+static inline int ethtool_op_set_sg(struct net_device *dev, u32 data) { return 0; }
+static inline u32 ethtool_op_get_tso(struct net_device *dev) { return 0; }
+static inline int ethtool_op_set_tso(struct net_device *dev, u32 data) { return 0; }
+static inline u32 ethtool_op_get_ufo(struct net_device *dev) { return 0; }
+static inline int ethtool_op_set_ufo(struct net_device *dev, u32 data) { return 0; }
+static inline u32 ethtool_op_get_flags(struct net_device *dev) { return 0; }
+static inline int ethtool_op_set_flags(struct net_device *dev, u32 data) { return 0; }
+#endif
/**
* ðtool_ops - Alter and report network device settings
Index: linuxdev/init/Kconfig
===================================================================
--- linuxdev.orig/init/Kconfig
+++ linuxdev/init/Kconfig
@@ -740,6 +740,14 @@
for filesystems like NFS and for the flock() system
call. Disabling this option saves about 11k.
+config ETHTOOL
+ bool "Enable ethtool support" if EMBEDDED
+ depends on NET
+ default y
+ help
+ Disabling this option removes support for configuring
+ ethernet device features via ethtool. Saves about 6k.
+
config VM_EVENT_COUNTERS
default y
bool "Enable VM event counters for /proc/vmstat" if EMBEDDED
Index: linuxdev/net/bridge/Kconfig
===================================================================
--- linuxdev.orig/net/bridge/Kconfig
+++ linuxdev/net/bridge/Kconfig
@@ -6,6 +6,7 @@
tristate "802.1d Ethernet Bridging"
select LLC
select STP
+ select ETHTOOL
---help---
If you say Y here, then your Linux box will be able to act as an
Ethernet bridge, which means that the different Ethernet segments it
Index: linuxdev/net/core/Makefile
===================================================================
--- linuxdev.orig/net/core/Makefile
+++ linuxdev/net/core/Makefile
@@ -7,10 +7,11 @@
obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
-obj-y += dev.o ethtool.o dev_mcast.o dst.o netevent.o \
+obj-y += dev.o dev_mcast.o dst.o netevent.o \
neighbour.o rtnetlink.o utils.o link_watch.o filter.o
obj-$(CONFIG_XFRM) += flow.o
+obj-$(CONFIG_ETHTOOL) += ethtool.o
obj-y += net-sysfs.o
obj-$(CONFIG_NET_PKTGEN) += pktgen.o
obj-$(CONFIG_NETPOLL) += netpoll.o
Index: linuxdev/net/core/dev.c
===================================================================
--- linuxdev.orig/net/core/dev.c
+++ linuxdev/net/core/dev.c
@@ -3669,6 +3669,7 @@
return ret;
case SIOCETHTOOL:
+#ifdef CONFIG_ETHTOOL
dev_load(net, ifr.ifr_name);
rtnl_lock();
ret = dev_ethtool(net, &ifr);
@@ -3681,6 +3682,9 @@
ret = -EFAULT;
}
return ret;
+#else
+ return -EINVAL;
+#endif
/*
* These ioctl calls:
--
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2008-07-31 9:27 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-31 9:27 [patch 0/4] [resend] Add configuration options to disable features not needed on embedded devices Thomas Petazzoni
2008-07-31 9:27 ` [patch 1/4] Configure out AIO support Thomas Petazzoni
2008-07-31 10:09 ` Bernhard Fischer
2008-07-31 10:12 ` Adrian Bunk
2008-07-31 22:42 ` Bernhard Fischer
2008-08-05 18:15 ` Adrian Bunk
2008-08-05 18:26 ` Jamie Lokier
2008-08-05 18:36 ` Bernhard Fischer
2008-07-31 9:27 ` [patch 2/4] Configure out file locking features Thomas Petazzoni
2008-07-31 13:53 ` Adrian Bunk
2008-07-31 14:20 ` Thomas Petazzoni
2008-07-31 15:37 ` Adrian Bunk
2008-07-31 16:26 ` Thomas Petazzoni
2008-07-31 16:49 ` Adrian Bunk
2008-07-31 16:57 ` David Woodhouse
2008-07-31 17:32 ` Tim Bird
2008-07-31 18:12 ` Robert Schwebel
2008-07-31 19:31 ` Adrian Bunk
2008-08-01 7:28 ` Robert Schwebel
2008-07-31 19:16 ` Adrian Bunk
2008-07-31 20:37 ` Tim Bird
2008-08-02 16:38 ` J. Bruce Fields
2008-08-04 13:52 ` Thomas Petazzoni
2008-08-04 18:16 ` J. Bruce Fields
2008-08-04 18:24 ` Tim Bird
2008-08-04 18:25 ` J. Bruce Fields
2008-08-04 18:54 ` Matt Mackall
2008-08-04 19:42 ` J. Bruce Fields
2008-08-04 22:32 ` Tim Bird
2008-08-06 13:12 ` Thomas Petazzoni
2008-08-07 22:55 ` J. Bruce Fields
2008-07-31 9:27 ` Thomas Petazzoni [this message]
2008-07-31 10:40 ` [patch 3/4] Configure out ethtool support Ben Hutchings
2008-07-31 10:49 ` David Miller
2008-07-31 10:54 ` David Woodhouse
2008-07-31 10:57 ` David Miller
2008-07-31 10:42 ` David Woodhouse
2008-07-31 10:51 ` David Miller
2008-07-31 11:29 ` David Woodhouse
2008-07-31 11:33 ` David Miller
2008-07-31 11:46 ` David Woodhouse
2008-07-31 11:50 ` David Miller
2008-07-31 15:58 ` Adrian Bunk
2008-07-31 16:35 ` Thomas Petazzoni
2008-07-31 9:27 ` [patch 4/4] Configure out IGMP support Thomas Petazzoni
2008-08-01 19:41 ` David Woodhouse
2008-08-04 12:48 ` Thomas Petazzoni
2008-08-04 12:53 ` Adrian Bunk
2008-08-04 13:53 ` David Woodhouse
2008-07-31 9:40 ` [patch 0/4] [resend] Add configuration options to disable features not needed on embedded devices David Miller
2008-07-31 9:51 ` David Woodhouse
2008-07-31 9:55 ` David Miller
2008-07-31 9:59 ` David Woodhouse
2008-07-31 10:02 ` David Miller
2008-07-31 10:15 ` David Woodhouse
2008-07-31 10:25 ` David Miller
2008-07-31 17:59 ` Tim Bird
2008-07-31 18:50 ` [patch 0/4] [resend] Add configuration options to disable features Ulrich Teichert
2008-07-31 19:46 ` Josh Boyer
2008-07-31 19:55 ` David Woodhouse
2008-08-01 7:17 ` Robert Schwebel
2008-08-01 19:15 ` Linus Torvalds
2008-08-01 19:47 ` David Woodhouse
2008-07-31 16:42 ` [patch 0/4] [resend] Add configuration options to disable features not needed on embedded devices Tim Bird
2008-07-31 17:20 ` Tim Bird
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=20080731093221.236840420@free-electrons.com \
--to=thomas.petazzoni@free-electrons.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael@free-electrons.com \
--cc=mpm@selenic.com \
--cc=netdev@vger.kernel.org \
/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).