aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorAyyappan Veeraiyan <ayyappan.veeraiyan@intel.com>2008-02-01 18:58:54 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-05 13:31:33 -0500
commit735441fb1a3b213d8cd12f641f5f1706a356b55c (patch)
tree8aea7b3ab09d4ee13d5648adfa731375d5018b1c /drivers/net/ixgbe
parente092be60b2292af91c55f085151d58dc8a76820a (diff)
ixbge: Make ethtool code account for media types
The i82598 can support various media types but this ethtool code only was coded for fiber just yet. Signed-off-by: Ayyappan Veeraiyan <ayyappan.veeraiyan@intel.com> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c52
1 files changed, 36 insertions, 16 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 9f3cdb873001..b447dd7de347 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -103,21 +103,41 @@ static int ixgbe_get_settings(struct net_device *netdev,
103 struct ethtool_cmd *ecmd) 103 struct ethtool_cmd *ecmd)
104{ 104{
105 struct ixgbe_adapter *adapter = netdev_priv(netdev); 105 struct ixgbe_adapter *adapter = netdev_priv(netdev);
106 struct ixgbe_hw *hw = &adapter->hw;
107 u32 link_speed = 0;
108 bool link_up;
106 109
107 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); 110 ecmd->supported = SUPPORTED_10000baseT_Full;
108 ecmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE); 111 ecmd->autoneg = AUTONEG_ENABLE;
109 ecmd->port = PORT_FIBRE;
110 ecmd->transceiver = XCVR_EXTERNAL; 112 ecmd->transceiver = XCVR_EXTERNAL;
113 if (hw->phy.media_type == ixgbe_media_type_copper) {
114 ecmd->supported |= (SUPPORTED_1000baseT_Full |
115 SUPPORTED_TP | SUPPORTED_Autoneg);
116
117 ecmd->advertising = (ADVERTISED_TP | ADVERTISED_Autoneg);
118 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL)
119 ecmd->advertising |= ADVERTISED_10000baseT_Full;
120 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL)
121 ecmd->advertising |= ADVERTISED_1000baseT_Full;
122
123 ecmd->port = PORT_TP;
124 } else {
125 ecmd->supported |= SUPPORTED_FIBRE;
126 ecmd->advertising = (ADVERTISED_10000baseT_Full |
127 ADVERTISED_FIBRE);
128 ecmd->port = PORT_FIBRE;
129 }
111 130
112 if (netif_carrier_ok(adapter->netdev)) { 131 adapter->hw.mac.ops.check_link(hw, &(link_speed), &link_up);
113 ecmd->speed = SPEED_10000; 132 if (link_up) {
133 ecmd->speed = (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ?
134 SPEED_10000 : SPEED_1000;
114 ecmd->duplex = DUPLEX_FULL; 135 ecmd->duplex = DUPLEX_FULL;
115 } else { 136 } else {
116 ecmd->speed = -1; 137 ecmd->speed = -1;
117 ecmd->duplex = -1; 138 ecmd->duplex = -1;
118 } 139 }
119 140
120 ecmd->autoneg = AUTONEG_DISABLE;
121 return 0; 141 return 0;
122} 142}
123 143
@@ -125,17 +145,17 @@ static int ixgbe_set_settings(struct net_device *netdev,
125 struct ethtool_cmd *ecmd) 145 struct ethtool_cmd *ecmd)
126{ 146{
127 struct ixgbe_adapter *adapter = netdev_priv(netdev); 147 struct ixgbe_adapter *adapter = netdev_priv(netdev);
148 struct ixgbe_hw *hw = &adapter->hw;
128 149
129 if (ecmd->autoneg == AUTONEG_ENABLE || 150 switch (hw->phy.media_type) {
130 ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL) 151 case ixgbe_media_type_fiber:
131 return -EINVAL; 152 if ((ecmd->autoneg == AUTONEG_ENABLE) ||
132 153 (ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL))
133 if (netif_running(adapter->netdev)) { 154 return -EINVAL;
134 ixgbe_down(adapter); 155 /* in this case we currently only support 10Gb/FULL */
135 ixgbe_reset(adapter); 156 break;
136 ixgbe_up(adapter); 157 default:
137 } else { 158 break;
138 ixgbe_reset(adapter);
139 } 159 }
140 160
141 return 0; 161 return 0;