aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_if.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-08-31 01:16:22 -0400
committerDavid S. Miller <davem@davemloft.net>2007-08-31 01:16:22 -0400
commitb4a488d1824a2cc3514f9ee1298d805bd5edc893 (patch)
tree7198cc4ce2146b16e595f5dbbb222f5f6ebf982e /net/bridge/br_if.c
parentdf1c0b8468b34628ed12b103804a4576cd9af8bb (diff)
[BRIDGE]: Fix OOPS when bridging device without ethtool.
Bridge code calls ethtool to get speed. The conversion to using only ethtool_ops broke the case of devices without ethtool_ops. This is a new regression in 2.6.23. Rearranged the switch to a logical order, and use gcc initializer. Ps: speed should have been part of the network device structure from the start rather than burying it in ethtool. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Acked-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r--net/bridge/br_if.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 749f0e8f541d..9272f12f664c 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -33,17 +33,17 @@
33 */ 33 */
34static int port_cost(struct net_device *dev) 34static int port_cost(struct net_device *dev)
35{ 35{
36 if (dev->ethtool_ops->get_settings) { 36 if (dev->ethtool_ops && dev->ethtool_ops->get_settings) {
37 struct ethtool_cmd ecmd = { ETHTOOL_GSET }; 37 struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET, };
38 int err = dev->ethtool_ops->get_settings(dev, &ecmd); 38
39 if (!err) { 39 if (!dev->ethtool_ops->get_settings(dev, &ecmd)) {
40 switch(ecmd.speed) { 40 switch(ecmd.speed) {
41 case SPEED_100:
42 return 19;
43 case SPEED_1000:
44 return 4;
45 case SPEED_10000: 41 case SPEED_10000:
46 return 2; 42 return 2;
43 case SPEED_1000:
44 return 4;
45 case SPEED_100:
46 return 19;
47 case SPEED_10: 47 case SPEED_10:
48 return 100; 48 return 100;
49 } 49 }