diff options
Diffstat (limited to 'drivers/net/benet')
-rw-r--r-- | drivers/net/benet/be.h | 2 | ||||
-rw-r--r-- | drivers/net/benet/be_ethtool.c | 54 | ||||
-rw-r--r-- | drivers/net/benet/be_main.c | 3 |
3 files changed, 38 insertions, 21 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index d90cc015abb3..12247480a1f8 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -272,6 +272,8 @@ struct be_adapter { | |||
272 | u32 cap; | 272 | u32 cap; |
273 | u32 rx_fc; /* Rx flow control */ | 273 | u32 rx_fc; /* Rx flow control */ |
274 | u32 tx_fc; /* Tx flow control */ | 274 | u32 tx_fc; /* Tx flow control */ |
275 | int link_speed; | ||
276 | u8 port_type; | ||
275 | }; | 277 | }; |
276 | 278 | ||
277 | extern const struct ethtool_ops be_ethtool_ops; | 279 | extern const struct ethtool_ops be_ethtool_ops; |
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index 3c05f2b99ab6..329560f9e543 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c | |||
@@ -297,36 +297,48 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
297 | u8 mac_speed = 0, connector = 0; | 297 | u8 mac_speed = 0, connector = 0; |
298 | u16 link_speed = 0; | 298 | u16 link_speed = 0; |
299 | bool link_up = false; | 299 | bool link_up = false; |
300 | int status; | ||
300 | 301 | ||
301 | be_cmd_link_status_query(adapter, &link_up, &mac_speed, &link_speed); | 302 | if (adapter->link_speed < 0) { |
303 | status = be_cmd_link_status_query(adapter, &link_up, | ||
304 | &mac_speed, &link_speed); | ||
305 | |||
306 | /* link_speed is in units of 10 Mbps */ | ||
307 | if (link_speed) { | ||
308 | ecmd->speed = link_speed*10; | ||
309 | } else { | ||
310 | switch (mac_speed) { | ||
311 | case PHY_LINK_SPEED_1GBPS: | ||
312 | ecmd->speed = SPEED_1000; | ||
313 | break; | ||
314 | case PHY_LINK_SPEED_10GBPS: | ||
315 | ecmd->speed = SPEED_10000; | ||
316 | break; | ||
317 | } | ||
318 | } | ||
302 | 319 | ||
303 | /* link_speed is in units of 10 Mbps */ | 320 | status = be_cmd_read_port_type(adapter, adapter->port_num, |
304 | if (link_speed) { | 321 | &connector); |
305 | ecmd->speed = link_speed*10; | 322 | switch (connector) { |
306 | } else { | 323 | case 7: |
307 | switch (mac_speed) { | 324 | ecmd->port = PORT_FIBRE; |
308 | case PHY_LINK_SPEED_1GBPS: | ||
309 | ecmd->speed = SPEED_1000; | ||
310 | break; | 325 | break; |
311 | case PHY_LINK_SPEED_10GBPS: | 326 | default: |
312 | ecmd->speed = SPEED_10000; | 327 | ecmd->port = PORT_TP; |
313 | break; | 328 | break; |
314 | } | 329 | } |
330 | |||
331 | /* Save for future use */ | ||
332 | adapter->link_speed = ecmd->speed; | ||
333 | adapter->port_type = ecmd->port; | ||
334 | } else { | ||
335 | ecmd->speed = adapter->link_speed; | ||
336 | ecmd->port = adapter->port_type; | ||
315 | } | 337 | } |
338 | |||
316 | ecmd->duplex = DUPLEX_FULL; | 339 | ecmd->duplex = DUPLEX_FULL; |
317 | ecmd->autoneg = AUTONEG_DISABLE; | 340 | ecmd->autoneg = AUTONEG_DISABLE; |
318 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP); | 341 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP); |
319 | |||
320 | be_cmd_read_port_type(adapter, adapter->port_num, &connector); | ||
321 | switch (connector) { | ||
322 | case 7: | ||
323 | ecmd->port = PORT_FIBRE; | ||
324 | break; | ||
325 | default: | ||
326 | ecmd->port = PORT_TP; | ||
327 | break; | ||
328 | } | ||
329 | |||
330 | ecmd->phy_address = adapter->port_num; | 342 | ecmd->phy_address = adapter->port_num; |
331 | ecmd->transceiver = XCVR_INTERNAL; | 343 | ecmd->transceiver = XCVR_INTERNAL; |
332 | 344 | ||
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index f3e97ab3321d..e291b1b87532 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -220,6 +220,7 @@ void be_link_status_update(struct be_adapter *adapter, bool link_up) | |||
220 | 220 | ||
221 | /* If link came up or went down */ | 221 | /* If link came up or went down */ |
222 | if (adapter->link_up != link_up) { | 222 | if (adapter->link_up != link_up) { |
223 | adapter->link_speed = -1; | ||
223 | if (link_up) { | 224 | if (link_up) { |
224 | netif_start_queue(netdev); | 225 | netif_start_queue(netdev); |
225 | netif_carrier_on(netdev); | 226 | netif_carrier_on(netdev); |
@@ -1674,6 +1675,8 @@ static int be_setup(struct be_adapter *adapter) | |||
1674 | if (status != 0) | 1675 | if (status != 0) |
1675 | goto rx_qs_destroy; | 1676 | goto rx_qs_destroy; |
1676 | 1677 | ||
1678 | adapter->link_speed = -1; | ||
1679 | |||
1677 | return 0; | 1680 | return 0; |
1678 | 1681 | ||
1679 | rx_qs_destroy: | 1682 | rx_qs_destroy: |