aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic/qlcnic_ethtool.c
diff options
context:
space:
mode:
authorSony Chacko <sony.chacko@qlogic.com>2011-04-28 07:48:19 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-29 16:00:00 -0400
commit7e610caaa5b32d3be9216f040f178e4a23b678b2 (patch)
tree993a027d6619dfe2ad3ca2d4e223a08a710e7260 /drivers/net/qlcnic/qlcnic_ethtool.c
parentf94bc1e70281c5a587049015af8f3e024d45ad66 (diff)
qlcnic: Support for GBE port settings
Enable setting speed and auto negotiation parameters for GbE ports. Hardware do not support half duplex setting currently. o Update driver version to 5.0.17. Signed-off-by: Sony Chacko <sony.chacko@qlogic.com> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_ethtool.c')
-rw-r--r--drivers/net/qlcnic/qlcnic_ethtool.c68
1 files changed, 31 insertions, 37 deletions
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 8db1d1983cf..27726ebfba2 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -284,50 +284,44 @@ skip:
284static int 284static int
285qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) 285qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
286{ 286{
287 u32 config = 0;
288 u32 ret = 0;
287 struct qlcnic_adapter *adapter = netdev_priv(dev); 289 struct qlcnic_adapter *adapter = netdev_priv(dev);
288 __u32 status; 290
291 if (adapter->ahw->port_type != QLCNIC_GBE)
292 return -EOPNOTSUPP;
289 293
290 /* read which mode */ 294 /* read which mode */
291 if (adapter->ahw->port_type == QLCNIC_GBE) { 295 if (ecmd->duplex)
292 /* autonegotiation */ 296 config |= 0x1;
293 if (qlcnic_fw_cmd_set_phy(adapter,
294 QLCNIC_NIU_GB_MII_MGMT_ADDR_AUTONEG,
295 ecmd->autoneg) != 0)
296 return -EIO;
297 else
298 adapter->link_autoneg = ecmd->autoneg;
299 297
300 if (qlcnic_fw_cmd_query_phy(adapter, 298 if (ecmd->autoneg)
301 QLCNIC_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 299 config |= 0x2;
302 &status) != 0)
303 return -EIO;
304 300
305 switch (ecmd->speed) { 301 switch (ethtool_cmd_speed(ecmd)) {
306 case SPEED_10: 302 case SPEED_10:
307 qlcnic_set_phy_speed(status, 0); 303 config |= (0 << 8);
308 break; 304 break;
309 case SPEED_100: 305 case SPEED_100:
310 qlcnic_set_phy_speed(status, 1); 306 config |= (1 << 8);
311 break; 307 break;
312 case SPEED_1000: 308 case SPEED_1000:
313 qlcnic_set_phy_speed(status, 2); 309 config |= (10 << 8);
314 break; 310 break;
315 } 311 default:
312 return -EIO;
313 }
316 314
317 if (ecmd->duplex == DUPLEX_HALF) 315 ret = qlcnic_fw_cmd_set_port(adapter, config);
318 qlcnic_clear_phy_duplex(status); 316
319 if (ecmd->duplex == DUPLEX_FULL) 317 if (ret == QLCNIC_RCODE_NOT_SUPPORTED)
320 qlcnic_set_phy_duplex(status);
321 if (qlcnic_fw_cmd_set_phy(adapter,
322 QLCNIC_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
323 *((int *)&status)) != 0)
324 return -EIO;
325 else {
326 adapter->link_speed = ecmd->speed;
327 adapter->link_duplex = ecmd->duplex;
328 }
329 } else
330 return -EOPNOTSUPP; 318 return -EOPNOTSUPP;
319 else if (ret)
320 return -EIO;
321
322 adapter->link_speed = ethtool_cmd_speed(ecmd);
323 adapter->link_duplex = ecmd->duplex;
324 adapter->link_autoneg = ecmd->autoneg;
331 325
332 if (!netif_running(dev)) 326 if (!netif_running(dev))
333 return 0; 327 return 0;