diff options
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_ethtool.c | 152 |
1 files changed, 30 insertions, 122 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index c3143da..151e00c 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -146,7 +146,6 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) struct e1000_sfp_flags *eth_flags = &dev_spec->eth_flags; u32 status; - status = rd32(E1000_STATUS); if (hw->phy.media_type == e1000_media_type_copper) { ecmd->supported = (SUPPORTED_10baseT_Half | @@ -170,22 +169,13 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ecmd->transceiver = XCVR_INTERNAL; } else { ecmd->supported = (SUPPORTED_FIBRE | - SUPPORTED_1000baseKX_Full | SUPPORTED_Autoneg | SUPPORTED_Pause); - ecmd->advertising = (ADVERTISED_FIBRE | - ADVERTISED_1000baseKX_Full); - if (hw->mac.type == e1000_i354) { - if ((hw->device_id == - E1000_DEV_ID_I354_BACKPLANE_2_5GBPS) && - !(status & E1000_STATUS_2P5_SKU_OVER)) { - ecmd->supported |= SUPPORTED_2500baseX_Full; - ecmd->supported &= - ~SUPPORTED_1000baseKX_Full; - ecmd->advertising |= ADVERTISED_2500baseX_Full; - ecmd->advertising &= - ~ADVERTISED_1000baseKX_Full; - } + ecmd->advertising = ADVERTISED_FIBRE; + + if ((eth_flags->e1000_base_lx) || (eth_flags->e1000_base_sx)) { + ecmd->supported |= SUPPORTED_1000baseT_Full; + ecmd->advertising |= ADVERTISED_1000baseT_Full; } if (eth_flags->e100_base_fx) { ecmd->supported |= SUPPORTED_100baseT_Full; @@ -197,29 +187,35 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ecmd->port = PORT_FIBRE; ecmd->transceiver = XCVR_EXTERNAL; } + if (hw->mac.autoneg != 1) ecmd->advertising &= ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause); - switch (hw->fc.requested_mode) { - case e1000_fc_full: + if (hw->fc.requested_mode == e1000_fc_full) ecmd->advertising |= ADVERTISED_Pause; - break; - case e1000_fc_rx_pause: + else if (hw->fc.requested_mode == e1000_fc_rx_pause) ecmd->advertising |= (ADVERTISED_Pause | ADVERTISED_Asym_Pause); - break; - case e1000_fc_tx_pause: + else if (hw->fc.requested_mode == e1000_fc_tx_pause) ecmd->advertising |= ADVERTISED_Asym_Pause; - break; - default: + else ecmd->advertising &= ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause); - } + + status = rd32(E1000_STATUS); + if (status & E1000_STATUS_LU) { - if ((status & E1000_STATUS_2P5_SKU) && - !(status & E1000_STATUS_2P5_SKU_OVER)) { - ecmd->speed = SPEED_2500; + if (hw->mac.type == e1000_i354) { + if ((status & E1000_STATUS_2P5_SKU) && + !(status & E1000_STATUS_2P5_SKU_OVER)) { + ecmd->supported = SUPPORTED_2500baseX_Full; + ecmd->advertising = ADVERTISED_2500baseX_Full; + ecmd->speed = SPEED_2500; + } else { + ecmd->supported = SUPPORTED_1000baseT_Full; + ecmd->advertising = ADVERTISED_1000baseT_Full; + } } else if (status & E1000_STATUS_SPEED_1000) { ecmd->speed = SPEED_1000; } else if (status & E1000_STATUS_SPEED_100) { @@ -236,6 +232,7 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ecmd->speed = -1; ecmd->duplex = -1; } + if ((hw->phy.media_type == e1000_media_type_fiber) || hw->mac.autoneg) ecmd->autoneg = AUTONEG_ENABLE; @@ -774,10 +771,8 @@ static int igb_set_eeprom(struct net_device *netdev, if (eeprom->len == 0) return -EOPNOTSUPP; - if ((hw->mac.type >= e1000_i210) && - !igb_get_flash_presence_i210(hw)) { + if (hw->mac.type == e1000_i211) return -EOPNOTSUPP; - } if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) return -EFAULT; @@ -1664,8 +1659,7 @@ static int igb_setup_loopback_test(struct igb_adapter *adapter) if ((hw->device_id == E1000_DEV_ID_DH89XXCC_SGMII) || (hw->device_id == E1000_DEV_ID_DH89XXCC_SERDES) || (hw->device_id == E1000_DEV_ID_DH89XXCC_BACKPLANE) || - (hw->device_id == E1000_DEV_ID_DH89XXCC_SFP) || - (hw->device_id == E1000_DEV_ID_I354_SGMII)) { + (hw->device_id == E1000_DEV_ID_DH89XXCC_SFP)) { /* Enable DH89xxCC MPHY for near end loopback */ reg = rd32(E1000_MPHY_ADDR_CTL); @@ -1731,8 +1725,7 @@ static void igb_loopback_cleanup(struct igb_adapter *adapter) if ((hw->device_id == E1000_DEV_ID_DH89XXCC_SGMII) || (hw->device_id == E1000_DEV_ID_DH89XXCC_SERDES) || (hw->device_id == E1000_DEV_ID_DH89XXCC_BACKPLANE) || - (hw->device_id == E1000_DEV_ID_DH89XXCC_SFP) || - (hw->device_id == E1000_DEV_ID_I354_SGMII)) { + (hw->device_id == E1000_DEV_ID_DH89XXCC_SFP)) { u32 reg; /* Disable near end loopback on DH89xxCC */ @@ -2062,15 +2055,14 @@ static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct igb_adapter *adapter = netdev_priv(netdev); + wol->supported = WAKE_UCAST | WAKE_MCAST | + WAKE_BCAST | WAKE_MAGIC | + WAKE_PHY; wol->wolopts = 0; if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED)) return; - wol->supported = WAKE_UCAST | WAKE_MCAST | - WAKE_BCAST | WAKE_MAGIC | - WAKE_PHY; - /* apply any specific unsupported masks here */ switch (adapter->hw.device_id) { default: @@ -2885,88 +2877,6 @@ static int igb_set_rxfh_indir(struct net_device *netdev, const u32 *indir) return 0; } -static unsigned int igb_max_channels(struct igb_adapter *adapter) -{ - struct e1000_hw *hw = &adapter->hw; - unsigned int max_combined = 0; - - switch (hw->mac.type) { - case e1000_i211: - max_combined = IGB_MAX_RX_QUEUES_I211; - break; - case e1000_82575: - case e1000_i210: - max_combined = IGB_MAX_RX_QUEUES_82575; - break; - case e1000_i350: - if (!!adapter->vfs_allocated_count) { - max_combined = 1; - break; - } - /* fall through */ - case e1000_82576: - if (!!adapter->vfs_allocated_count) { - max_combined = 2; - break; - } - /* fall through */ - case e1000_82580: - case e1000_i354: - default: - max_combined = IGB_MAX_RX_QUEUES; - break; - } - - return max_combined; -} - -static void igb_get_channels(struct net_device *netdev, - struct ethtool_channels *ch) -{ - struct igb_adapter *adapter = netdev_priv(netdev); - - /* Report maximum channels */ - ch->max_combined = igb_max_channels(adapter); - - /* Report info for other vector */ - if (adapter->msix_entries) { - ch->max_other = NON_Q_VECTORS; - ch->other_count = NON_Q_VECTORS; - } - - ch->combined_count = adapter->rss_queues; -} - -static int igb_set_channels(struct net_device *netdev, - struct ethtool_channels *ch) -{ - struct igb_adapter *adapter = netdev_priv(netdev); - unsigned int count = ch->combined_count; - - /* Verify they are not requesting separate vectors */ - if (!count || ch->rx_count || ch->tx_count) - return -EINVAL; - - /* Verify other_count is valid and has not been changed */ - if (ch->other_count != NON_Q_VECTORS) - return -EINVAL; - - /* Verify the number of channels doesn't exceed hw limits */ - if (count > igb_max_channels(adapter)) - return -EINVAL; - - if (count != adapter->rss_queues) { - adapter->rss_queues = count; - - /* Hardware has to reinitialize queues and interrupts to - * match the new configuration. - */ - return igb_reinit_queues(adapter); - } - - return 0; -} - static const struct ethtool_ops igb_ethtool_ops = { .get_settings = igb_get_settings, .set_settings = igb_set_settings, @@ -3003,8 +2913,6 @@ static const struct ethtool_ops igb_ethtool_ops = { .get_rxfh_indir_size = igb_get_rxfh_indir_size, .get_rxfh_indir = igb_get_rxfh_indir, .set_rxfh_indir = igb_set_rxfh_indir, - .get_channels = igb_get_channels, - .set_channels = igb_set_channels, .begin = igb_ethtool_begin, .complete = igb_ethtool_complete, }; |