diff options
author | Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com> | 2012-10-20 02:03:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-21 22:15:36 -0400 |
commit | db15dfa957c6b904e88d70f2f3f1c0b95cafd6b9 (patch) | |
tree | 802354b81b3a980eafc86b99850bf933b0e7987f /drivers/net/ethernet/emulex/benet | |
parent | f25b119c6c19bbe70a27f7e439ef26ed8acd42ea (diff) |
be2net: Fix ethtool get_settings output for VF
Return default values for fields for which VFs dont have privilege to get the
required information from FW.
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/emulex/benet')
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_ethtool.c | 73 |
1 files changed, 42 insertions, 31 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index 2496123f35a6..00454a10f88d 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c | |||
@@ -528,6 +528,10 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
528 | u8 link_status; | 528 | u8 link_status; |
529 | u16 link_speed = 0; | 529 | u16 link_speed = 0; |
530 | int status; | 530 | int status; |
531 | u32 auto_speeds; | ||
532 | u32 fixed_speeds; | ||
533 | u32 dac_cable_len; | ||
534 | u16 interface_type; | ||
531 | 535 | ||
532 | if (adapter->phy.link_speed < 0) { | 536 | if (adapter->phy.link_speed < 0) { |
533 | status = be_cmd_link_status_query(adapter, &link_speed, | 537 | status = be_cmd_link_status_query(adapter, &link_speed, |
@@ -537,39 +541,46 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
537 | ethtool_cmd_speed_set(ecmd, link_speed); | 541 | ethtool_cmd_speed_set(ecmd, link_speed); |
538 | 542 | ||
539 | status = be_cmd_get_phy_info(adapter); | 543 | status = be_cmd_get_phy_info(adapter); |
540 | if (status) | 544 | if (!status) { |
541 | return status; | 545 | interface_type = adapter->phy.interface_type; |
542 | 546 | auto_speeds = adapter->phy.auto_speeds_supported; | |
543 | ecmd->supported = | 547 | fixed_speeds = adapter->phy.fixed_speeds_supported; |
544 | convert_to_et_setting(adapter->phy.interface_type, | 548 | dac_cable_len = adapter->phy.dac_cable_len; |
545 | adapter->phy.auto_speeds_supported | | 549 | |
546 | adapter->phy.fixed_speeds_supported); | 550 | ecmd->supported = |
547 | ecmd->advertising = | 551 | convert_to_et_setting(interface_type, |
548 | convert_to_et_setting(adapter->phy.interface_type, | 552 | auto_speeds | |
549 | adapter->phy.auto_speeds_supported); | 553 | fixed_speeds); |
550 | 554 | ecmd->advertising = | |
551 | ecmd->port = be_get_port_type(adapter->phy.interface_type, | 555 | convert_to_et_setting(interface_type, |
552 | adapter->phy.dac_cable_len); | 556 | auto_speeds); |
553 | 557 | ||
554 | if (adapter->phy.auto_speeds_supported) { | 558 | ecmd->port = be_get_port_type(interface_type, |
555 | ecmd->supported |= SUPPORTED_Autoneg; | 559 | dac_cable_len); |
556 | ecmd->autoneg = AUTONEG_ENABLE; | 560 | |
557 | ecmd->advertising |= ADVERTISED_Autoneg; | 561 | if (adapter->phy.auto_speeds_supported) { |
558 | } | 562 | ecmd->supported |= SUPPORTED_Autoneg; |
563 | ecmd->autoneg = AUTONEG_ENABLE; | ||
564 | ecmd->advertising |= ADVERTISED_Autoneg; | ||
565 | } | ||
559 | 566 | ||
560 | if (be_pause_supported(adapter)) { | ||
561 | ecmd->supported |= SUPPORTED_Pause; | 567 | ecmd->supported |= SUPPORTED_Pause; |
562 | ecmd->advertising |= ADVERTISED_Pause; | 568 | if (be_pause_supported(adapter)) |
563 | } | 569 | ecmd->advertising |= ADVERTISED_Pause; |
564 | 570 | ||
565 | switch (adapter->phy.interface_type) { | 571 | switch (adapter->phy.interface_type) { |
566 | case PHY_TYPE_KR_10GB: | 572 | case PHY_TYPE_KR_10GB: |
567 | case PHY_TYPE_KX4_10GB: | 573 | case PHY_TYPE_KX4_10GB: |
568 | ecmd->transceiver = XCVR_INTERNAL; | 574 | ecmd->transceiver = XCVR_INTERNAL; |
569 | break; | 575 | break; |
570 | default: | 576 | default: |
571 | ecmd->transceiver = XCVR_EXTERNAL; | 577 | ecmd->transceiver = XCVR_EXTERNAL; |
572 | break; | 578 | break; |
579 | } | ||
580 | } else { | ||
581 | ecmd->port = PORT_OTHER; | ||
582 | ecmd->autoneg = AUTONEG_DISABLE; | ||
583 | ecmd->transceiver = XCVR_DUMMY1; | ||
573 | } | 584 | } |
574 | 585 | ||
575 | /* Save for future use */ | 586 | /* Save for future use */ |