aboutsummaryrefslogtreecommitdiff
path: root/net/bridge/br_if.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-31 15:51:00 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-31 15:51:00 -0700
commit0d6caa1795090bd22ede96b84daa4600b63eee37 (patch)
tree7b69aa68f7f812bd1a13b0c5e73573a01e671ef8 /net/bridge/br_if.c
parent88c8199b9d2f5ec0a8468a0495ba4c9656846500 (diff)
parent8072f085d79a0a73cc5a0333ffa7f0c5d35f76e0 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (41 commits) [RTNETLINK]: Fix warning for !CONFIG_KMOD [IPV4] ip_options.c: kmalloc + memset conversion to kzalloc [DECNET]: kmalloc + memset conversion to kzalloc [NET]: ethtool_perm_addr only has one implementation [NET]: ethtool ops are the only way [PPPOE]: Improve hashing function in hash_item(). [XFRM]: State selection update to use inner addresses. [IPSEC]: Ensure that state inner family is set [TCP]: Bidir flow must not disregard SACK blocks for lost marking [TCP]: Fix ratehalving with bidirectional flows [PPPOL2TP]: Add CONFIG_INET Kconfig dependency. [NET]: Page offsets and lengths need to be __u32. [AF_UNIX]: Make code static. [NETFILTER]: Make nf_ct_ipv6_skip_exthdr() static. [PKTGEN]: make get_ipsec_sa() static and non-inline [PPPoE]: move lock_sock() in pppoe_sendmsg() to the right location [PPPoX/E]: return ENOTTY on unknown ioctl requests [IPV6]: ipv6_addr_type() doesn't know about RFC4193 addresses. [NET]: Fix prio_tune() handling of root qdisc. [NET]: Fix sch_api to properly set sch->parent on the root. ...
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r--net/bridge/br_if.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 7b4ce9113be..b40dada002b 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -29,35 +29,24 @@
* Determine initial path cost based on speed.
* using recommendations from 802.1d standard
*
- * Need to simulate user ioctl because not all device's that support
- * ethtool, use ethtool_ops. Also, since driver might sleep need to
- * not be holding any locks.
+ * Since driver might sleep need to not be holding any locks.
*/
static int port_cost(struct net_device *dev)
{
- struct ethtool_cmd ecmd = { ETHTOOL_GSET };
- struct ifreq ifr;
- mm_segment_t old_fs;
- int err;
-
- strncpy(ifr.ifr_name, dev->name, IFNAMSIZ);
- ifr.ifr_data = (void __user *) &ecmd;
-
- old_fs = get_fs();
- set_fs(KERNEL_DS);
- err = dev_ethtool(&ifr);
- set_fs(old_fs);
-
- if (!err) {
- switch(ecmd.speed) {
- case SPEED_100:
- return 19;
- case SPEED_1000:
- return 4;
- case SPEED_10000:
- return 2;
- case SPEED_10:
- return 100;
+ if (dev->ethtool_ops->get_settings) {
+ struct ethtool_cmd ecmd = { ETHTOOL_GSET };
+ int err = dev->ethtool_ops->get_settings(dev, &ecmd);
+ if (!err) {
+ switch(ecmd.speed) {
+ case SPEED_100:
+ return 19;
+ case SPEED_1000:
+ return 4;
+ case SPEED_10000:
+ return 2;
+ case SPEED_10:
+ return 100;
+ }
}
}