aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/emulex/benet/be_ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/emulex/benet/be_ethtool.c')
-rw-r--r--drivers/net/ethernet/emulex/benet/be_ethtool.c57
1 files changed, 12 insertions, 45 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index c0e700653f9..8e6fb0ba6aa 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -512,28 +512,6 @@ static u32 convert_to_et_setting(u32 if_type, u32 if_speeds)
512 return val; 512 return val;
513} 513}
514 514
515static 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
537bool be_pause_supported(struct be_adapter *adapter) 515bool be_pause_supported(struct be_adapter *adapter)
538{ 516{
539 return (adapter->phy.interface_type == PHY_TYPE_SFP_PLUS_10GB || 517 return (adapter->phy.interface_type == PHY_TYPE_SFP_PLUS_10GB ||
@@ -544,27 +522,16 @@ bool be_pause_supported(struct be_adapter *adapter)
544static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) 522static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
545{ 523{
546 struct be_adapter *adapter = netdev_priv(netdev); 524 struct be_adapter *adapter = netdev_priv(netdev);
547 u8 port_speed = 0;
548 u16 link_speed = 0;
549 u8 link_status; 525 u8 link_status;
550 u32 et_speed = 0; 526 u16 link_speed = 0;
551 int status; 527 int status;
552 528
553 if (adapter->phy.link_speed < 0 || !(netdev->flags & IFF_UP)) { 529 if (adapter->phy.link_speed < 0) {
554 if (adapter->phy.forced_port_speed < 0) { 530 status = be_cmd_link_status_query(adapter, &link_speed,
555 status = be_cmd_link_status_query(adapter, &port_speed, 531 &link_status, 0);
556 &link_speed, &link_status, 0); 532 if (!status)
557 if (!status) 533 be_link_status_update(adapter, link_status);
558 be_link_status_update(adapter, link_status); 534 ethtool_cmd_speed_set(ecmd, link_speed);
559 if (link_speed)
560 et_speed = link_speed * 10;
561 else if (link_status)
562 et_speed = convert_to_et_speed(port_speed);
563 } else {
564 et_speed = adapter->phy.forced_port_speed;
565 }
566
567 ethtool_cmd_speed_set(ecmd, et_speed);
568 535
569 status = be_cmd_get_phy_info(adapter); 536 status = be_cmd_get_phy_info(adapter);
570 if (status) 537 if (status)
@@ -773,8 +740,8 @@ static void
773be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) 740be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
774{ 741{
775 struct be_adapter *adapter = netdev_priv(netdev); 742 struct be_adapter *adapter = netdev_priv(netdev);
776 u8 mac_speed = 0; 743 int status;
777 u16 qos_link_speed = 0; 744 u8 link_status = 0;
778 745
779 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); 746 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
780 747
@@ -798,11 +765,11 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
798 test->flags |= ETH_TEST_FL_FAILED; 765 test->flags |= ETH_TEST_FL_FAILED;
799 } 766 }
800 767
801 if (be_cmd_link_status_query(adapter, &mac_speed, 768 status = be_cmd_link_status_query(adapter, NULL, &link_status, 0);
802 &qos_link_speed, NULL, 0) != 0) { 769 if (status) {
803 test->flags |= ETH_TEST_FL_FAILED; 770 test->flags |= ETH_TEST_FL_FAILED;
804 data[4] = -1; 771 data[4] = -1;
805 } else if (!mac_speed) { 772 } else if (!link_status) {
806 test->flags |= ETH_TEST_FL_FAILED; 773 test->flags |= ETH_TEST_FL_FAILED;
807 data[4] = 1; 774 data[4] = 1;
808 } 775 }