Skip to contentSkip to conversation

PATCH: ethtool power manglement hooks

PATCH Applied Alan Cox 2 participants 4 messages Jun 7, 2004 – Jun 8, 2004

Subsystems (3)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

Several ethernet drivers have been broken by the ethtool support because the ioctl code used to power the interface up and down as needed. Rather than add this to each driver call Jeff Garzik suggested we add hooks for before/after ethtool processing.

This patch implements them which makes fixing the PM stuff easier, as the epic100 patch to follow will show. It also cleans up the via-velocity driver pm/ethtool logic a great deal. As per Jeff's request the before handler is allowed to fail the operation.

--

The contribution herein included is a creation of Red Hat Inc. It is hereby submitted under the license of the existing files and as a derivative work thereof. I know of no reason for not having the right to submit the work herein included.

(Bluff your way in legalese ;))

include/linux/ethtool.h +2 -0
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.6/include/linux/ethtool.h linux-2.6.6/include/linux/ethtool.h
@@ -351,6 +351,8 @@
 	int	(*phys_id)(struct net_device *, u32);
 	int	(*get_stats_count)(struct net_device *);
 	void	(*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
+	int	(*begin)(struct net_device *);
+	void	(*complete)(struct net_device *);
 };
 
 /* CMDs currently supported */
net/core/ethtool.c +71 -31

147 lines not on this page · raw message

#1 lore raw
Quoted 8 lines · Alan Cox

Several ethernet drivers have been broken by the ethtool support because the ioctl code used to power the interface up and down as needed. Rather than add this to each driver call Jeff Garzik suggested we add hooks for before/after ethtool processing.

This patch implements them which makes fixing the PM stuff easier,
as the epic100 patch to follow will show. It also cleans up the via-velocity driver pm/ethtool logic a great deal. As per Jeff's request the before handler is allowed to fail the operation.

Thanks A.

BTW, if you have a free moment, I don't think all your comments from your months-ago review of net/core/ethtool.c were addressed. A re-review would be appreciated. In the meantime, I'm hunting around for your original review.

Jeff

#2 lore raw
In reply to Alan Cox
Quoted 2 lines · Alan Cox

Several ethernet drivers have been broken by the ethtool support because the ioctl code used to power the interface up and down as needed. Rather

To be more specific, the new ethtool_ops feature bypasses code in net drivers which did one of two things:
* power up the hardware, perform the ioctl, and power down the hardware
or
* fail if netif_running() is false, indicating the driver's requirement that MII and ethtool operations only occur when the interface is up (thereby ignoring the power management issues)

Also, CC net driver patches to me and netdev, pretty please with sugar on it.

Jeff

Applied
#3 lore raw
In reply to Alan Cox

applied to 2.6 verbatim, applied to 2.4 slightly modified (2.4 patch attached, and DaveM CC added).

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/08 14:27:21-04:00 [email protected]
# [netdrvr] fix ethtool_ops design bug, sync with 2.6.x ethtool_ops code
#

#   In addition to merging Alan Cox's fix for an ethtool_ops design bug,
#   I took the opportunity to synchronize the source with 2.6.x, which
#   will make it easier to maintain in the long run.

#
# Description of the fix from Alan Cox <[email protected]>:
#
# [PATCH] ethtool power manglement hooks
#

#     Several ethernet drivers have been broken by the ethtool support because
#     the ioctl code used to power the interface up and down as needed. Rather
#     than add this to each driver call Jeff Garzik suggested we add hooks
#     for before/after ethtool processing.
#     
#     This patch implements them which makes fixing the PM stuff easier,
#     as the epic100 patch to follow will show. It also cleans up the
#     via-velocity driver pm/ethtool logic a great deal. As per Jeff's
#     request the before handler is allowed to fail the operation.
#     
#     --
#     
#     The contribution herein included is a creation of Red Hat Inc. It is hereby
#     submitted under the license of the existing files and as a derivative work
#     thereof. I know of no reason for not having the right to submit the
#     work herein included.

#
# (Bluff your way in legalese ;))
#

include/linux/ethtool.h +2 -0
diff -Nru a/include/linux/ethtool.h b/include/linux/ethtool.h
@@ -345,6 +345,8 @@
 	int	(*phys_id)(struct net_device *, u32);
 	int	(*get_stats_count)(struct net_device *);
 	void	(*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
+	int	(*begin)(struct net_device *);
+	void	(*complete)(struct net_device *);
 };
 
 /* CMDs currently supported */
net/core/Makefile +1 -1
diff -Nru a/net/core/Makefile b/net/core/Makefile
@@ -9,7 +9,7 @@
 
 O_TARGET := core.o
 
-export-objs := netfilter.o profile.o
+export-objs := netfilter.o profile.o ethtool.o
 
 obj-y := sock.o skbuff.o iovec.o datagram.o scm.o
 
net/core/ethtool.c +160 -57

434 lines not on this page · raw message

net/netsyms.c +0 -8
diff -Nru a/net/netsyms.c b/net/netsyms.c
@@ -18,7 +18,6 @@
 #include <linux/fcdevice.h>
 #include <linux/ioport.h>
 #include <linux/tty.h>
-#include <linux/ethtool.h>
 #include <net/neighbour.h>
 #include <net/snmp.h>
 #include <net/dst.h>
@@ -621,12 +620,5 @@
 EXPORT_SYMBOL(iw_handler_get_thrspy);
 EXPORT_SYMBOL(wireless_spy_update);
 #endif /* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */
-
-/* ethtool.c */
-EXPORT_SYMBOL(ethtool_op_get_link);
-EXPORT_SYMBOL(ethtool_op_get_tx_csum);
-EXPORT_SYMBOL(ethtool_op_set_tx_csum);
-EXPORT_SYMBOL(ethtool_op_get_sg);
-EXPORT_SYMBOL(ethtool_op_set_sg);
 
 #endif  /* CONFIG_NET */