aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netxen/netxen_nic_ethtool.c')
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c58
1 files changed, 14 insertions, 44 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 587498e140bb..653d308e0f5d 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -214,7 +214,6 @@ skip:
214 check_sfp_module = netif_running(dev) && 214 check_sfp_module = netif_running(dev) &&
215 adapter->has_link_events; 215 adapter->has_link_events;
216 } else { 216 } else {
217 ecmd->autoneg = AUTONEG_ENABLE;
218 ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg); 217 ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg);
219 ecmd->advertising |= 218 ecmd->advertising |=
220 (ADVERTISED_TP | ADVERTISED_Autoneg); 219 (ADVERTISED_TP | ADVERTISED_Autoneg);
@@ -252,53 +251,24 @@ static int
252netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) 251netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
253{ 252{
254 struct netxen_adapter *adapter = netdev_priv(dev); 253 struct netxen_adapter *adapter = netdev_priv(dev);
255 __u32 status; 254 int ret;
256 255
257 /* read which mode */ 256 if (adapter->ahw.port_type != NETXEN_NIC_GBE)
258 if (adapter->ahw.port_type == NETXEN_NIC_GBE) { 257 return -EOPNOTSUPP;
259 /* autonegotiation */
260 if (adapter->phy_write &&
261 adapter->phy_write(adapter,
262 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
263 ecmd->autoneg) != 0)
264 return -EIO;
265 else
266 adapter->link_autoneg = ecmd->autoneg;
267 258
268 if (adapter->phy_read && 259 if (!(adapter->capabilities & NX_FW_CAPABILITY_GBE_LINK_CFG))
269 adapter->phy_read(adapter, 260 return -EOPNOTSUPP;
270 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
271 &status) != 0)
272 return -EIO;
273 261
274 /* speed */ 262 ret = nx_fw_cmd_set_gbe_port(adapter, ecmd->speed, ecmd->duplex,
275 switch (ecmd->speed) { 263 ecmd->autoneg);
276 case SPEED_10: 264 if (ret == NX_RCODE_NOT_SUPPORTED)
277 netxen_set_phy_speed(status, 0);
278 break;
279 case SPEED_100:
280 netxen_set_phy_speed(status, 1);
281 break;
282 case SPEED_1000:
283 netxen_set_phy_speed(status, 2);
284 break;
285 }
286 /* set duplex mode */
287 if (ecmd->duplex == DUPLEX_HALF)
288 netxen_clear_phy_duplex(status);
289 if (ecmd->duplex == DUPLEX_FULL)
290 netxen_set_phy_duplex(status);
291 if (adapter->phy_write &&
292 adapter->phy_write(adapter,
293 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
294 *((int *)&status)) != 0)
295 return -EIO;
296 else {
297 adapter->link_speed = ecmd->speed;
298 adapter->link_duplex = ecmd->duplex;
299 }
300 } else
301 return -EOPNOTSUPP; 265 return -EOPNOTSUPP;
266 else if (ret)
267 return -EIO;
268
269 adapter->link_speed = ecmd->speed;
270 adapter->link_duplex = ecmd->duplex;
271 adapter->link_autoneg = ecmd->autoneg;
302 272
303 if (!netif_running(dev)) 273 if (!netif_running(dev))
304 return 0; 274 return 0;