diff options
author | Ajit Khaparde <ajitkhaparde@gmail.com> | 2012-04-21 14:53:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-23 17:23:29 -0400 |
commit | 42f11cf20cc5b76766fd1f0e591eda26283a38ec (patch) | |
tree | a5520b1b1fd26a30be075dd0da7f8eb476231ee1 | |
parent | ac807fa8e625aff58060876d70298c93a59c4252 (diff) |
be2net: fix ethtool get settings
ethtool get settings was not displaying all the settings correctly.
use the get_phy_info to get more information about the PHY to fix this.
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be.h | 23 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_cmds.c | 17 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_cmds.h | 36 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_ethtool.c | 245 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 20 |
5 files changed, 239 insertions, 102 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 9576ac002c23..ad69cf89491c 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -313,6 +313,23 @@ struct be_vf_cfg { | |||
313 | #define BE_UC_PMAC_COUNT 30 | 313 | #define BE_UC_PMAC_COUNT 30 |
314 | #define BE_VF_UC_PMAC_COUNT 2 | 314 | #define BE_VF_UC_PMAC_COUNT 2 |
315 | 315 | ||
316 | struct phy_info { | ||
317 | u8 transceiver; | ||
318 | u8 autoneg; | ||
319 | u8 fc_autoneg; | ||
320 | u8 port_type; | ||
321 | u16 phy_type; | ||
322 | u16 interface_type; | ||
323 | u32 misc_params; | ||
324 | u16 auto_speeds_supported; | ||
325 | u16 fixed_speeds_supported; | ||
326 | int link_speed; | ||
327 | int forced_port_speed; | ||
328 | u32 dac_cable_len; | ||
329 | u32 advertising; | ||
330 | u32 supported; | ||
331 | }; | ||
332 | |||
316 | struct be_adapter { | 333 | struct be_adapter { |
317 | struct pci_dev *pdev; | 334 | struct pci_dev *pdev; |
318 | struct net_device *netdev; | 335 | struct net_device *netdev; |
@@ -377,10 +394,6 @@ struct be_adapter { | |||
377 | u32 rx_fc; /* Rx flow control */ | 394 | u32 rx_fc; /* Rx flow control */ |
378 | u32 tx_fc; /* Tx flow control */ | 395 | u32 tx_fc; /* Tx flow control */ |
379 | bool stats_cmd_sent; | 396 | bool stats_cmd_sent; |
380 | int link_speed; | ||
381 | u8 port_type; | ||
382 | u8 transceiver; | ||
383 | u8 autoneg; | ||
384 | u8 generation; /* BladeEngine ASIC generation */ | 397 | u8 generation; /* BladeEngine ASIC generation */ |
385 | u32 flash_status; | 398 | u32 flash_status; |
386 | struct completion flash_compl; | 399 | struct completion flash_compl; |
@@ -392,6 +405,7 @@ struct be_adapter { | |||
392 | u32 sli_family; | 405 | u32 sli_family; |
393 | u8 hba_port_num; | 406 | u8 hba_port_num; |
394 | u16 pvid; | 407 | u16 pvid; |
408 | struct phy_info phy; | ||
395 | u8 wol_cap; | 409 | u8 wol_cap; |
396 | bool wol; | 410 | bool wol; |
397 | u32 max_pmac_cnt; /* Max secondary UC MACs programmable */ | 411 | u32 max_pmac_cnt; /* Max secondary UC MACs programmable */ |
@@ -583,4 +597,5 @@ extern void be_link_status_update(struct be_adapter *adapter, u8 link_status); | |||
583 | extern void be_parse_stats(struct be_adapter *adapter); | 597 | extern void be_parse_stats(struct be_adapter *adapter); |
584 | extern int be_load_fw(struct be_adapter *adapter, u8 *func); | 598 | extern int be_load_fw(struct be_adapter *adapter, u8 *func); |
585 | extern bool be_is_wol_supported(struct be_adapter *adapter); | 599 | extern bool be_is_wol_supported(struct be_adapter *adapter); |
600 | extern bool be_pause_supported(struct be_adapter *adapter); | ||
586 | #endif /* BE_H */ | 601 | #endif /* BE_H */ |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 67b030d72df1..22be08c03594 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -126,7 +126,7 @@ static void be_async_link_state_process(struct be_adapter *adapter, | |||
126 | struct be_async_event_link_state *evt) | 126 | struct be_async_event_link_state *evt) |
127 | { | 127 | { |
128 | /* When link status changes, link speed must be re-queried from FW */ | 128 | /* When link status changes, link speed must be re-queried from FW */ |
129 | adapter->link_speed = -1; | 129 | adapter->phy.link_speed = -1; |
130 | 130 | ||
131 | /* For the initial link status do not rely on the ASYNC event as | 131 | /* For the initial link status do not rely on the ASYNC event as |
132 | * it may not be received in some cases. | 132 | * it may not be received in some cases. |
@@ -153,7 +153,7 @@ static void be_async_grp5_qos_speed_process(struct be_adapter *adapter, | |||
153 | { | 153 | { |
154 | if (evt->physical_port == adapter->port_num) { | 154 | if (evt->physical_port == adapter->port_num) { |
155 | /* qos_link_speed is in units of 10 Mbps */ | 155 | /* qos_link_speed is in units of 10 Mbps */ |
156 | adapter->link_speed = evt->qos_link_speed * 10; | 156 | adapter->phy.link_speed = evt->qos_link_speed * 10; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
@@ -2136,8 +2136,7 @@ err: | |||
2136 | return status; | 2136 | return status; |
2137 | } | 2137 | } |
2138 | 2138 | ||
2139 | int be_cmd_get_phy_info(struct be_adapter *adapter, | 2139 | int be_cmd_get_phy_info(struct be_adapter *adapter) |
2140 | struct be_phy_info *phy_info) | ||
2141 | { | 2140 | { |
2142 | struct be_mcc_wrb *wrb; | 2141 | struct be_mcc_wrb *wrb; |
2143 | struct be_cmd_req_get_phy_info *req; | 2142 | struct be_cmd_req_get_phy_info *req; |
@@ -2170,9 +2169,15 @@ int be_cmd_get_phy_info(struct be_adapter *adapter, | |||
2170 | if (!status) { | 2169 | if (!status) { |
2171 | struct be_phy_info *resp_phy_info = | 2170 | struct be_phy_info *resp_phy_info = |
2172 | cmd.va + sizeof(struct be_cmd_req_hdr); | 2171 | cmd.va + sizeof(struct be_cmd_req_hdr); |
2173 | phy_info->phy_type = le16_to_cpu(resp_phy_info->phy_type); | 2172 | adapter->phy.phy_type = le16_to_cpu(resp_phy_info->phy_type); |
2174 | phy_info->interface_type = | 2173 | adapter->phy.interface_type = |
2175 | le16_to_cpu(resp_phy_info->interface_type); | 2174 | le16_to_cpu(resp_phy_info->interface_type); |
2175 | adapter->phy.auto_speeds_supported = | ||
2176 | le16_to_cpu(resp_phy_info->auto_speeds_supported); | ||
2177 | adapter->phy.fixed_speeds_supported = | ||
2178 | le16_to_cpu(resp_phy_info->fixed_speeds_supported); | ||
2179 | adapter->phy.misc_params = | ||
2180 | le32_to_cpu(resp_phy_info->misc_params); | ||
2176 | } | 2181 | } |
2177 | pci_free_consistent(adapter->pdev, cmd.size, | 2182 | pci_free_consistent(adapter->pdev, cmd.size, |
2178 | cmd.va, cmd.dma); | 2183 | cmd.va, cmd.dma); |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index d5b680c56af0..3c543610906a 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
@@ -1309,9 +1309,36 @@ enum { | |||
1309 | PHY_TYPE_KX4_10GB, | 1309 | PHY_TYPE_KX4_10GB, |
1310 | PHY_TYPE_BASET_10GB, | 1310 | PHY_TYPE_BASET_10GB, |
1311 | PHY_TYPE_BASET_1GB, | 1311 | PHY_TYPE_BASET_1GB, |
1312 | PHY_TYPE_BASEX_1GB, | ||
1313 | PHY_TYPE_SGMII, | ||
1312 | PHY_TYPE_DISABLED = 255 | 1314 | PHY_TYPE_DISABLED = 255 |
1313 | }; | 1315 | }; |
1314 | 1316 | ||
1317 | #define BE_SUPPORTED_SPEED_NONE 0 | ||
1318 | #define BE_SUPPORTED_SPEED_10MBPS 1 | ||
1319 | #define BE_SUPPORTED_SPEED_100MBPS 2 | ||
1320 | #define BE_SUPPORTED_SPEED_1GBPS 4 | ||
1321 | #define BE_SUPPORTED_SPEED_10GBPS 8 | ||
1322 | |||
1323 | #define BE_AN_EN 0x2 | ||
1324 | #define BE_PAUSE_SYM_EN 0x80 | ||
1325 | |||
1326 | /* MAC speed valid values */ | ||
1327 | #define SPEED_DEFAULT 0x0 | ||
1328 | #define SPEED_FORCED_10GB 0x1 | ||
1329 | #define SPEED_FORCED_1GB 0x2 | ||
1330 | #define SPEED_AUTONEG_10GB 0x3 | ||
1331 | #define SPEED_AUTONEG_1GB 0x4 | ||
1332 | #define SPEED_AUTONEG_100MB 0x5 | ||
1333 | #define SPEED_AUTONEG_10GB_1GB 0x6 | ||
1334 | #define SPEED_AUTONEG_10GB_1GB_100MB 0x7 | ||
1335 | #define SPEED_AUTONEG_1GB_100MB 0x8 | ||
1336 | #define SPEED_AUTONEG_10MB 0x9 | ||
1337 | #define SPEED_AUTONEG_1GB_100MB_10MB 0xa | ||
1338 | #define SPEED_AUTONEG_100MB_10MB 0xb | ||
1339 | #define SPEED_FORCED_100MB 0xc | ||
1340 | #define SPEED_FORCED_10MB 0xd | ||
1341 | |||
1315 | struct be_cmd_req_get_phy_info { | 1342 | struct be_cmd_req_get_phy_info { |
1316 | struct be_cmd_req_hdr hdr; | 1343 | struct be_cmd_req_hdr hdr; |
1317 | u8 rsvd0[24]; | 1344 | u8 rsvd0[24]; |
@@ -1321,7 +1348,11 @@ struct be_phy_info { | |||
1321 | u16 phy_type; | 1348 | u16 phy_type; |
1322 | u16 interface_type; | 1349 | u16 interface_type; |
1323 | u32 misc_params; | 1350 | u32 misc_params; |
1324 | u32 future_use[4]; | 1351 | u16 ext_phy_details; |
1352 | u16 rsvd; | ||
1353 | u16 auto_speeds_supported; | ||
1354 | u16 fixed_speeds_supported; | ||
1355 | u32 future_use[2]; | ||
1325 | }; | 1356 | }; |
1326 | 1357 | ||
1327 | struct be_cmd_resp_get_phy_info { | 1358 | struct be_cmd_resp_get_phy_info { |
@@ -1655,8 +1686,7 @@ extern int be_cmd_get_seeprom_data(struct be_adapter *adapter, | |||
1655 | struct be_dma_mem *nonemb_cmd); | 1686 | struct be_dma_mem *nonemb_cmd); |
1656 | extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, | 1687 | extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, |
1657 | u8 loopback_type, u8 enable); | 1688 | u8 loopback_type, u8 enable); |
1658 | extern int be_cmd_get_phy_info(struct be_adapter *adapter, | 1689 | extern int be_cmd_get_phy_info(struct be_adapter *adapter); |
1659 | struct be_phy_info *phy_info); | ||
1660 | extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); | 1690 | extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); |
1661 | extern void be_detect_dump_ue(struct be_adapter *adapter); | 1691 | extern void be_detect_dump_ue(struct be_adapter *adapter); |
1662 | extern int be_cmd_get_die_temperature(struct be_adapter *adapter); | 1692 | extern int be_cmd_get_die_temperature(struct be_adapter *adapter); |
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index c1ff73cb0e62..dc9f74c69c40 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c | |||
@@ -433,102 +433,193 @@ static int be_get_sset_count(struct net_device *netdev, int stringset) | |||
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
436 | static u32 be_get_port_type(u32 phy_type, u32 dac_cable_len) | ||
437 | { | ||
438 | u32 port; | ||
439 | |||
440 | switch (phy_type) { | ||
441 | case PHY_TYPE_BASET_1GB: | ||
442 | case PHY_TYPE_BASEX_1GB: | ||
443 | case PHY_TYPE_SGMII: | ||
444 | port = PORT_TP; | ||
445 | break; | ||
446 | case PHY_TYPE_SFP_PLUS_10GB: | ||
447 | port = dac_cable_len ? PORT_DA : PORT_FIBRE; | ||
448 | break; | ||
449 | case PHY_TYPE_XFP_10GB: | ||
450 | case PHY_TYPE_SFP_1GB: | ||
451 | port = PORT_FIBRE; | ||
452 | break; | ||
453 | case PHY_TYPE_BASET_10GB: | ||
454 | port = PORT_TP; | ||
455 | break; | ||
456 | default: | ||
457 | port = PORT_OTHER; | ||
458 | } | ||
459 | |||
460 | return port; | ||
461 | } | ||
462 | |||
463 | static u32 convert_to_et_setting(u32 if_type, u32 if_speeds) | ||
464 | { | ||
465 | u32 val = 0; | ||
466 | |||
467 | switch (if_type) { | ||
468 | case PHY_TYPE_BASET_1GB: | ||
469 | case PHY_TYPE_BASEX_1GB: | ||
470 | case PHY_TYPE_SGMII: | ||
471 | val |= SUPPORTED_TP; | ||
472 | if (if_speeds & BE_SUPPORTED_SPEED_1GBPS) | ||
473 | val |= SUPPORTED_1000baseT_Full; | ||
474 | if (if_speeds & BE_SUPPORTED_SPEED_100MBPS) | ||
475 | val |= SUPPORTED_100baseT_Full; | ||
476 | if (if_speeds & BE_SUPPORTED_SPEED_10MBPS) | ||
477 | val |= SUPPORTED_10baseT_Full; | ||
478 | break; | ||
479 | case PHY_TYPE_KX4_10GB: | ||
480 | val |= SUPPORTED_Backplane; | ||
481 | if (if_speeds & BE_SUPPORTED_SPEED_1GBPS) | ||
482 | val |= SUPPORTED_1000baseKX_Full; | ||
483 | if (if_speeds & BE_SUPPORTED_SPEED_10GBPS) | ||
484 | val |= SUPPORTED_10000baseKX4_Full; | ||
485 | break; | ||
486 | case PHY_TYPE_KR_10GB: | ||
487 | val |= SUPPORTED_Backplane | | ||
488 | SUPPORTED_10000baseKR_Full; | ||
489 | break; | ||
490 | case PHY_TYPE_SFP_PLUS_10GB: | ||
491 | case PHY_TYPE_XFP_10GB: | ||
492 | case PHY_TYPE_SFP_1GB: | ||
493 | val |= SUPPORTED_FIBRE; | ||
494 | if (if_speeds & BE_SUPPORTED_SPEED_10GBPS) | ||
495 | val |= SUPPORTED_10000baseT_Full; | ||
496 | if (if_speeds & BE_SUPPORTED_SPEED_1GBPS) | ||
497 | val |= SUPPORTED_1000baseT_Full; | ||
498 | break; | ||
499 | case PHY_TYPE_BASET_10GB: | ||
500 | val |= SUPPORTED_TP; | ||
501 | if (if_speeds & BE_SUPPORTED_SPEED_10GBPS) | ||
502 | val |= SUPPORTED_10000baseT_Full; | ||
503 | if (if_speeds & BE_SUPPORTED_SPEED_1GBPS) | ||
504 | val |= SUPPORTED_1000baseT_Full; | ||
505 | if (if_speeds & BE_SUPPORTED_SPEED_100MBPS) | ||
506 | val |= SUPPORTED_100baseT_Full; | ||
507 | break; | ||
508 | default: | ||
509 | val |= SUPPORTED_TP; | ||
510 | } | ||
511 | |||
512 | return val; | ||
513 | } | ||
514 | |||
515 | static int convert_to_et_speed(u32 be_speed) | ||
516 | { | ||
517 | int et_speed = SPEED_10000; | ||
518 | |||
519 | switch (be_speed) { | ||
520 | case PHY_LINK_SPEED_10MBPS: | ||
521 | et_speed = SPEED_10; | ||
522 | break; | ||
523 | case PHY_LINK_SPEED_100MBPS: | ||
524 | et_speed = SPEED_100; | ||
525 | break; | ||
526 | case PHY_LINK_SPEED_1GBPS: | ||
527 | et_speed = SPEED_1000; | ||
528 | break; | ||
529 | case PHY_LINK_SPEED_10GBPS: | ||
530 | et_speed = SPEED_10000; | ||
531 | break; | ||
532 | } | ||
533 | |||
534 | return et_speed; | ||
535 | } | ||
536 | |||
537 | bool be_pause_supported(struct be_adapter *adapter) | ||
538 | { | ||
539 | return (adapter->phy.interface_type == PHY_TYPE_SFP_PLUS_10GB || | ||
540 | adapter->phy.interface_type == PHY_TYPE_XFP_10GB) ? | ||
541 | false : true; | ||
542 | } | ||
543 | |||
436 | static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | 544 | static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) |
437 | { | 545 | { |
438 | struct be_adapter *adapter = netdev_priv(netdev); | 546 | struct be_adapter *adapter = netdev_priv(netdev); |
439 | struct be_phy_info phy_info; | 547 | u8 port_speed = 0; |
440 | u8 mac_speed = 0; | ||
441 | u16 link_speed = 0; | 548 | u16 link_speed = 0; |
442 | u8 link_status; | 549 | u8 link_status; |
550 | u32 et_speed = 0; | ||
443 | int status; | 551 | int status; |
444 | 552 | ||
445 | if ((adapter->link_speed < 0) || (!(netdev->flags & IFF_UP))) { | 553 | if (adapter->phy.link_speed < 0 || !(netdev->flags & IFF_UP)) { |
446 | status = be_cmd_link_status_query(adapter, &mac_speed, | 554 | if (adapter->phy.forced_port_speed < 0) { |
447 | &link_speed, &link_status, 0); | 555 | status = be_cmd_link_status_query(adapter, &port_speed, |
448 | if (!status) | 556 | &link_speed, &link_status, 0); |
449 | be_link_status_update(adapter, link_status); | 557 | if (!status) |
450 | 558 | be_link_status_update(adapter, link_status); | |
451 | /* link_speed is in units of 10 Mbps */ | 559 | if (link_speed) |
452 | if (link_speed) { | 560 | et_speed = link_speed; |
453 | ethtool_cmd_speed_set(ecmd, link_speed*10); | 561 | else |
562 | et_speed = convert_to_et_speed(port_speed); | ||
454 | } else { | 563 | } else { |
455 | switch (mac_speed) { | 564 | et_speed = adapter->phy.forced_port_speed; |
456 | case PHY_LINK_SPEED_10MBPS: | ||
457 | ethtool_cmd_speed_set(ecmd, SPEED_10); | ||
458 | break; | ||
459 | case PHY_LINK_SPEED_100MBPS: | ||
460 | ethtool_cmd_speed_set(ecmd, SPEED_100); | ||
461 | break; | ||
462 | case PHY_LINK_SPEED_1GBPS: | ||
463 | ethtool_cmd_speed_set(ecmd, SPEED_1000); | ||
464 | break; | ||
465 | case PHY_LINK_SPEED_10GBPS: | ||
466 | ethtool_cmd_speed_set(ecmd, SPEED_10000); | ||
467 | break; | ||
468 | case PHY_LINK_SPEED_ZERO: | ||
469 | ethtool_cmd_speed_set(ecmd, 0); | ||
470 | break; | ||
471 | } | ||
472 | } | 565 | } |
473 | 566 | ||
474 | status = be_cmd_get_phy_info(adapter, &phy_info); | 567 | ethtool_cmd_speed_set(ecmd, et_speed); |
475 | if (!status) { | 568 | |
476 | switch (phy_info.interface_type) { | 569 | status = be_cmd_get_phy_info(adapter); |
477 | case PHY_TYPE_XFP_10GB: | 570 | if (status) |
478 | case PHY_TYPE_SFP_1GB: | 571 | return status; |
479 | case PHY_TYPE_SFP_PLUS_10GB: | 572 | |
480 | ecmd->port = PORT_FIBRE; | 573 | ecmd->supported = |
481 | break; | 574 | convert_to_et_setting(adapter->phy.interface_type, |
482 | default: | 575 | adapter->phy.auto_speeds_supported | |
483 | ecmd->port = PORT_TP; | 576 | adapter->phy.fixed_speeds_supported); |
484 | break; | 577 | ecmd->advertising = |
485 | } | 578 | convert_to_et_setting(adapter->phy.interface_type, |
579 | adapter->phy.auto_speeds_supported); | ||
486 | 580 | ||
487 | switch (phy_info.interface_type) { | 581 | ecmd->port = be_get_port_type(adapter->phy.interface_type, |
488 | case PHY_TYPE_KR_10GB: | 582 | adapter->phy.dac_cable_len); |
489 | case PHY_TYPE_KX4_10GB: | 583 | |
490 | ecmd->autoneg = AUTONEG_ENABLE; | 584 | if (adapter->phy.auto_speeds_supported) { |
585 | ecmd->supported |= SUPPORTED_Autoneg; | ||
586 | ecmd->autoneg = AUTONEG_ENABLE; | ||
587 | ecmd->advertising |= ADVERTISED_Autoneg; | ||
588 | } | ||
589 | |||
590 | if (be_pause_supported(adapter)) { | ||
591 | ecmd->supported |= SUPPORTED_Pause; | ||
592 | ecmd->advertising |= ADVERTISED_Pause; | ||
593 | } | ||
594 | |||
595 | switch (adapter->phy.interface_type) { | ||
596 | case PHY_TYPE_KR_10GB: | ||
597 | case PHY_TYPE_KX4_10GB: | ||
491 | ecmd->transceiver = XCVR_INTERNAL; | 598 | ecmd->transceiver = XCVR_INTERNAL; |
492 | break; | 599 | break; |
493 | default: | 600 | default: |
494 | ecmd->autoneg = AUTONEG_DISABLE; | 601 | ecmd->transceiver = XCVR_EXTERNAL; |
495 | ecmd->transceiver = XCVR_EXTERNAL; | 602 | break; |
496 | break; | ||
497 | } | ||
498 | } | 603 | } |
499 | 604 | ||
500 | /* Save for future use */ | 605 | /* Save for future use */ |
501 | adapter->link_speed = ethtool_cmd_speed(ecmd); | 606 | adapter->phy.link_speed = ethtool_cmd_speed(ecmd); |
502 | adapter->port_type = ecmd->port; | 607 | adapter->phy.port_type = ecmd->port; |
503 | adapter->transceiver = ecmd->transceiver; | 608 | adapter->phy.transceiver = ecmd->transceiver; |
504 | adapter->autoneg = ecmd->autoneg; | 609 | adapter->phy.autoneg = ecmd->autoneg; |
610 | adapter->phy.advertising = ecmd->advertising; | ||
611 | adapter->phy.supported = ecmd->supported; | ||
505 | } else { | 612 | } else { |
506 | ethtool_cmd_speed_set(ecmd, adapter->link_speed); | 613 | ethtool_cmd_speed_set(ecmd, adapter->phy.link_speed); |
507 | ecmd->port = adapter->port_type; | 614 | ecmd->port = adapter->phy.port_type; |
508 | ecmd->transceiver = adapter->transceiver; | 615 | ecmd->transceiver = adapter->phy.transceiver; |
509 | ecmd->autoneg = adapter->autoneg; | 616 | ecmd->autoneg = adapter->phy.autoneg; |
617 | ecmd->advertising = adapter->phy.advertising; | ||
618 | ecmd->supported = adapter->phy.supported; | ||
510 | } | 619 | } |
511 | 620 | ||
512 | ecmd->duplex = DUPLEX_FULL; | 621 | ecmd->duplex = DUPLEX_FULL; |
513 | ecmd->phy_address = adapter->port_num; | 622 | ecmd->phy_address = adapter->port_num; |
514 | switch (ecmd->port) { | ||
515 | case PORT_FIBRE: | ||
516 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); | ||
517 | break; | ||
518 | case PORT_TP: | ||
519 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP); | ||
520 | break; | ||
521 | case PORT_AUI: | ||
522 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_AUI); | ||
523 | break; | ||
524 | } | ||
525 | |||
526 | if (ecmd->autoneg) { | ||
527 | ecmd->supported |= SUPPORTED_1000baseT_Full; | ||
528 | ecmd->supported |= SUPPORTED_Autoneg; | ||
529 | ecmd->advertising |= (ADVERTISED_10000baseT_Full | | ||
530 | ADVERTISED_1000baseT_Full); | ||
531 | } | ||
532 | 623 | ||
533 | return 0; | 624 | return 0; |
534 | } | 625 | } |
@@ -548,7 +639,7 @@ be_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd) | |||
548 | struct be_adapter *adapter = netdev_priv(netdev); | 639 | struct be_adapter *adapter = netdev_priv(netdev); |
549 | 640 | ||
550 | be_cmd_get_flow_control(adapter, &ecmd->tx_pause, &ecmd->rx_pause); | 641 | be_cmd_get_flow_control(adapter, &ecmd->tx_pause, &ecmd->rx_pause); |
551 | ecmd->autoneg = 0; | 642 | ecmd->autoneg = adapter->phy.fc_autoneg; |
552 | } | 643 | } |
553 | 644 | ||
554 | static int | 645 | static int |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 528a886bc2cd..a5bc6084be05 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -2571,11 +2571,12 @@ err: | |||
2571 | static void be_setup_init(struct be_adapter *adapter) | 2571 | static void be_setup_init(struct be_adapter *adapter) |
2572 | { | 2572 | { |
2573 | adapter->vlan_prio_bmap = 0xff; | 2573 | adapter->vlan_prio_bmap = 0xff; |
2574 | adapter->link_speed = -1; | 2574 | adapter->phy.link_speed = -1; |
2575 | adapter->if_handle = -1; | 2575 | adapter->if_handle = -1; |
2576 | adapter->be3_native = false; | 2576 | adapter->be3_native = false; |
2577 | adapter->promiscuous = false; | 2577 | adapter->promiscuous = false; |
2578 | adapter->eq_next_idx = 0; | 2578 | adapter->eq_next_idx = 0; |
2579 | adapter->phy.forced_port_speed = -1; | ||
2579 | } | 2580 | } |
2580 | 2581 | ||
2581 | static int be_add_mac_from_list(struct be_adapter *adapter, u8 *mac) | 2582 | static int be_add_mac_from_list(struct be_adapter *adapter, u8 *mac) |
@@ -2707,6 +2708,10 @@ static int be_setup(struct be_adapter *adapter) | |||
2707 | goto err; | 2708 | goto err; |
2708 | } | 2709 | } |
2709 | 2710 | ||
2711 | be_cmd_get_phy_info(adapter); | ||
2712 | if (be_pause_supported(adapter)) | ||
2713 | adapter->phy.fc_autoneg = 1; | ||
2714 | |||
2710 | schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); | 2715 | schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); |
2711 | adapter->flags |= BE_FLAGS_WORKER_SCHEDULED; | 2716 | adapter->flags |= BE_FLAGS_WORKER_SCHEDULED; |
2712 | 2717 | ||
@@ -2760,17 +2765,8 @@ static bool be_flash_redboot(struct be_adapter *adapter, | |||
2760 | 2765 | ||
2761 | static bool phy_flashing_required(struct be_adapter *adapter) | 2766 | static bool phy_flashing_required(struct be_adapter *adapter) |
2762 | { | 2767 | { |
2763 | int status = 0; | 2768 | return (adapter->phy.phy_type == TN_8022 && |
2764 | struct be_phy_info phy_info; | 2769 | adapter->phy.interface_type == PHY_TYPE_BASET_10GB); |
2765 | |||
2766 | status = be_cmd_get_phy_info(adapter, &phy_info); | ||
2767 | if (status) | ||
2768 | return false; | ||
2769 | if ((phy_info.phy_type == TN_8022) && | ||
2770 | (phy_info.interface_type == PHY_TYPE_BASET_10GB)) { | ||
2771 | return true; | ||
2772 | } | ||
2773 | return false; | ||
2774 | } | 2770 | } |
2775 | 2771 | ||
2776 | static int be_flash_data(struct be_adapter *adapter, | 2772 | static int be_flash_data(struct be_adapter *adapter, |