fp@1360: /******************************************************************************* fp@1360: fp@1360: Intel PRO/1000 Linux driver fp@1360: Copyright(c) 1999 - 2006 Intel Corporation. fp@1360: fp@1360: This program is free software; you can redistribute it and/or modify it fp@1360: under the terms and conditions of the GNU General Public License, fp@1360: version 2, as published by the Free Software Foundation. fp@1360: fp@1360: This program is distributed in the hope it will be useful, but WITHOUT fp@1360: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or fp@1360: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for fp@1360: more details. fp@1360: fp@1360: You should have received a copy of the GNU General Public License along with fp@1360: this program; if not, write to the Free Software Foundation, Inc., fp@1360: 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. fp@1360: fp@1360: The full GNU General Public License is included in this distribution in fp@1360: the file called "COPYING". fp@1360: fp@1360: Contact Information: fp@1360: Linux NICS fp@1360: e1000-devel Mailing List fp@1360: Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 fp@1360: fp@1360: *******************************************************************************/ fp@1360: fp@1360: /* ethtool support for e1000 */ fp@1360: fp@1360: #include "e1000-2.6.26-ethercat.h" fp@1360: fp@1360: #include fp@1360: fp@1360: extern int e1000_up(struct e1000_adapter *adapter); fp@1360: extern void e1000_down(struct e1000_adapter *adapter); fp@1360: extern void e1000_reinit_locked(struct e1000_adapter *adapter); fp@1360: extern void e1000_reset(struct e1000_adapter *adapter); fp@1360: extern int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx); fp@1360: extern int e1000_setup_all_rx_resources(struct e1000_adapter *adapter); fp@1360: extern int e1000_setup_all_tx_resources(struct e1000_adapter *adapter); fp@1360: extern void e1000_free_all_rx_resources(struct e1000_adapter *adapter); fp@1360: extern void e1000_free_all_tx_resources(struct e1000_adapter *adapter); fp@1360: extern void e1000_update_stats(struct e1000_adapter *adapter); fp@1360: fp@1360: fp@1360: struct e1000_stats { fp@1360: char stat_string[ETH_GSTRING_LEN]; fp@1360: int sizeof_stat; fp@1360: int stat_offset; fp@1360: }; fp@1360: fp@1360: #define E1000_STAT(m) FIELD_SIZEOF(struct e1000_adapter, m), \ fp@1360: offsetof(struct e1000_adapter, m) fp@1360: static const struct e1000_stats e1000_gstrings_stats[] = { fp@1360: { "rx_packets", E1000_STAT(stats.gprc) }, fp@1360: { "tx_packets", E1000_STAT(stats.gptc) }, fp@1360: { "rx_bytes", E1000_STAT(stats.gorcl) }, fp@1360: { "tx_bytes", E1000_STAT(stats.gotcl) }, fp@1360: { "rx_broadcast", E1000_STAT(stats.bprc) }, fp@1360: { "tx_broadcast", E1000_STAT(stats.bptc) }, fp@1360: { "rx_multicast", E1000_STAT(stats.mprc) }, fp@1360: { "tx_multicast", E1000_STAT(stats.mptc) }, fp@1360: { "rx_errors", E1000_STAT(stats.rxerrc) }, fp@1360: { "tx_errors", E1000_STAT(stats.txerrc) }, fp@1360: { "tx_dropped", E1000_STAT(net_stats.tx_dropped) }, fp@1360: { "multicast", E1000_STAT(stats.mprc) }, fp@1360: { "collisions", E1000_STAT(stats.colc) }, fp@1360: { "rx_length_errors", E1000_STAT(stats.rlerrc) }, fp@1360: { "rx_over_errors", E1000_STAT(net_stats.rx_over_errors) }, fp@1360: { "rx_crc_errors", E1000_STAT(stats.crcerrs) }, fp@1360: { "rx_frame_errors", E1000_STAT(net_stats.rx_frame_errors) }, fp@1360: { "rx_no_buffer_count", E1000_STAT(stats.rnbc) }, fp@1360: { "rx_missed_errors", E1000_STAT(stats.mpc) }, fp@1360: { "tx_aborted_errors", E1000_STAT(stats.ecol) }, fp@1360: { "tx_carrier_errors", E1000_STAT(stats.tncrs) }, fp@1360: { "tx_fifo_errors", E1000_STAT(net_stats.tx_fifo_errors) }, fp@1360: { "tx_heartbeat_errors", E1000_STAT(net_stats.tx_heartbeat_errors) }, fp@1360: { "tx_window_errors", E1000_STAT(stats.latecol) }, fp@1360: { "tx_abort_late_coll", E1000_STAT(stats.latecol) }, fp@1360: { "tx_deferred_ok", E1000_STAT(stats.dc) }, fp@1360: { "tx_single_coll_ok", E1000_STAT(stats.scc) }, fp@1360: { "tx_multi_coll_ok", E1000_STAT(stats.mcc) }, fp@1360: { "tx_timeout_count", E1000_STAT(tx_timeout_count) }, fp@1360: { "tx_restart_queue", E1000_STAT(restart_queue) }, fp@1360: { "rx_long_length_errors", E1000_STAT(stats.roc) }, fp@1360: { "rx_short_length_errors", E1000_STAT(stats.ruc) }, fp@1360: { "rx_align_errors", E1000_STAT(stats.algnerrc) }, fp@1360: { "tx_tcp_seg_good", E1000_STAT(stats.tsctc) }, fp@1360: { "tx_tcp_seg_failed", E1000_STAT(stats.tsctfc) }, fp@1360: { "rx_flow_control_xon", E1000_STAT(stats.xonrxc) }, fp@1360: { "rx_flow_control_xoff", E1000_STAT(stats.xoffrxc) }, fp@1360: { "tx_flow_control_xon", E1000_STAT(stats.xontxc) }, fp@1360: { "tx_flow_control_xoff", E1000_STAT(stats.xofftxc) }, fp@1360: { "rx_long_byte_count", E1000_STAT(stats.gorcl) }, fp@1360: { "rx_csum_offload_good", E1000_STAT(hw_csum_good) }, fp@1360: { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) }, fp@1360: { "rx_header_split", E1000_STAT(rx_hdr_split) }, fp@1360: { "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) }, fp@1360: { "tx_smbus", E1000_STAT(stats.mgptc) }, fp@1360: { "rx_smbus", E1000_STAT(stats.mgprc) }, fp@1360: { "dropped_smbus", E1000_STAT(stats.mgpdc) }, fp@1360: }; fp@1360: fp@1360: #define E1000_QUEUE_STATS_LEN 0 fp@1360: #define E1000_GLOBAL_STATS_LEN ARRAY_SIZE(e1000_gstrings_stats) fp@1360: #define E1000_STATS_LEN (E1000_GLOBAL_STATS_LEN + E1000_QUEUE_STATS_LEN) fp@1360: static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = { fp@1360: "Register test (offline)", "Eeprom test (offline)", fp@1360: "Interrupt test (offline)", "Loopback test (offline)", fp@1360: "Link test (on/offline)" fp@1360: }; fp@1360: #define E1000_TEST_LEN ARRAY_SIZE(e1000_gstrings_test) fp@1360: fp@1360: static int fp@1360: e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: struct e1000_hw *hw = &adapter->hw; fp@1360: fp@1360: if (hw->media_type == e1000_media_type_copper) { fp@1360: fp@1360: ecmd->supported = (SUPPORTED_10baseT_Half | fp@1360: SUPPORTED_10baseT_Full | fp@1360: SUPPORTED_100baseT_Half | fp@1360: SUPPORTED_100baseT_Full | fp@1360: SUPPORTED_1000baseT_Full| fp@1360: SUPPORTED_Autoneg | fp@1360: SUPPORTED_TP); fp@1360: if (hw->phy_type == e1000_phy_ife) fp@1360: ecmd->supported &= ~SUPPORTED_1000baseT_Full; fp@1360: ecmd->advertising = ADVERTISED_TP; fp@1360: fp@1360: if (hw->autoneg == 1) { fp@1360: ecmd->advertising |= ADVERTISED_Autoneg; fp@1360: /* the e1000 autoneg seems to match ethtool nicely */ fp@1360: ecmd->advertising |= hw->autoneg_advertised; fp@1360: } fp@1360: fp@1360: ecmd->port = PORT_TP; fp@1360: ecmd->phy_address = hw->phy_addr; fp@1360: fp@1360: if (hw->mac_type == e1000_82543) fp@1360: ecmd->transceiver = XCVR_EXTERNAL; fp@1360: else fp@1360: ecmd->transceiver = XCVR_INTERNAL; fp@1360: fp@1360: } else { fp@1360: ecmd->supported = (SUPPORTED_1000baseT_Full | fp@1360: SUPPORTED_FIBRE | fp@1360: SUPPORTED_Autoneg); fp@1360: fp@1360: ecmd->advertising = (ADVERTISED_1000baseT_Full | fp@1360: ADVERTISED_FIBRE | fp@1360: ADVERTISED_Autoneg); fp@1360: fp@1360: ecmd->port = PORT_FIBRE; fp@1360: fp@1360: if (hw->mac_type >= e1000_82545) fp@1360: ecmd->transceiver = XCVR_INTERNAL; fp@1360: else fp@1360: ecmd->transceiver = XCVR_EXTERNAL; fp@1360: } fp@1360: fp@1360: if ((adapter->ecdev && ecdev_get_link(adapter->ecdev)) fp@1360: || (!adapter->ecdev && (E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU))) { fp@1360: fp@1360: e1000_get_speed_and_duplex(hw, &adapter->link_speed, fp@1360: &adapter->link_duplex); fp@1360: ecmd->speed = adapter->link_speed; fp@1360: fp@1360: /* unfortunatly FULL_DUPLEX != DUPLEX_FULL fp@1360: * and HALF_DUPLEX != DUPLEX_HALF */ fp@1360: fp@1360: if (adapter->link_duplex == FULL_DUPLEX) fp@1360: ecmd->duplex = DUPLEX_FULL; fp@1360: else fp@1360: ecmd->duplex = DUPLEX_HALF; fp@1360: } else { fp@1360: ecmd->speed = -1; fp@1360: ecmd->duplex = -1; fp@1360: } fp@1360: fp@1360: ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) || fp@1360: hw->autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE; fp@1360: return 0; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: struct e1000_hw *hw = &adapter->hw; fp@1360: fp@1360: if (adapter->ecdev) fp@1360: return -EBUSY; fp@1360: fp@1360: /* When SoL/IDER sessions are active, autoneg/speed/duplex fp@1360: * cannot be changed */ fp@1360: if (e1000_check_phy_reset_block(hw)) { fp@1360: DPRINTK(DRV, ERR, "Cannot change link characteristics " fp@1360: "when SoL/IDER is active.\n"); fp@1360: return -EINVAL; fp@1360: } fp@1360: fp@1360: while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) fp@1360: msleep(1); fp@1360: fp@1360: if (ecmd->autoneg == AUTONEG_ENABLE) { fp@1360: hw->autoneg = 1; fp@1360: if (hw->media_type == e1000_media_type_fiber) fp@1360: hw->autoneg_advertised = ADVERTISED_1000baseT_Full | fp@1360: ADVERTISED_FIBRE | fp@1360: ADVERTISED_Autoneg; fp@1360: else fp@1360: hw->autoneg_advertised = ecmd->advertising | fp@1360: ADVERTISED_TP | fp@1360: ADVERTISED_Autoneg; fp@1360: ecmd->advertising = hw->autoneg_advertised; fp@1360: } else fp@1360: if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) { fp@1360: clear_bit(__E1000_RESETTING, &adapter->flags); fp@1360: return -EINVAL; fp@1360: } fp@1360: fp@1360: /* reset the link */ fp@1360: fp@1360: if (netif_running(adapter->netdev)) { fp@1360: e1000_down(adapter); fp@1360: e1000_up(adapter); fp@1360: } else fp@1360: e1000_reset(adapter); fp@1360: fp@1360: clear_bit(__E1000_RESETTING, &adapter->flags); fp@1360: return 0; fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_get_pauseparam(struct net_device *netdev, fp@1360: struct ethtool_pauseparam *pause) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: struct e1000_hw *hw = &adapter->hw; fp@1360: fp@1360: pause->autoneg = fp@1360: (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); fp@1360: fp@1360: if (hw->fc == E1000_FC_RX_PAUSE) fp@1360: pause->rx_pause = 1; fp@1360: else if (hw->fc == E1000_FC_TX_PAUSE) fp@1360: pause->tx_pause = 1; fp@1360: else if (hw->fc == E1000_FC_FULL) { fp@1360: pause->rx_pause = 1; fp@1360: pause->tx_pause = 1; fp@1360: } fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_set_pauseparam(struct net_device *netdev, fp@1360: struct ethtool_pauseparam *pause) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: struct e1000_hw *hw = &adapter->hw; fp@1360: int retval = 0; fp@1360: fp@1360: if (adapter->ecdev) fp@1360: return -EBUSY; fp@1360: fp@1360: adapter->fc_autoneg = pause->autoneg; fp@1360: fp@1360: while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) fp@1360: msleep(1); fp@1360: fp@1360: if (pause->rx_pause && pause->tx_pause) fp@1360: hw->fc = E1000_FC_FULL; fp@1360: else if (pause->rx_pause && !pause->tx_pause) fp@1360: hw->fc = E1000_FC_RX_PAUSE; fp@1360: else if (!pause->rx_pause && pause->tx_pause) fp@1360: hw->fc = E1000_FC_TX_PAUSE; fp@1360: else if (!pause->rx_pause && !pause->tx_pause) fp@1360: hw->fc = E1000_FC_NONE; fp@1360: fp@1360: hw->original_fc = hw->fc; fp@1360: fp@1360: if (adapter->fc_autoneg == AUTONEG_ENABLE) { fp@1360: if (netif_running(adapter->netdev)) { fp@1360: e1000_down(adapter); fp@1360: e1000_up(adapter); fp@1360: } else fp@1360: e1000_reset(adapter); fp@1360: } else fp@1360: retval = ((hw->media_type == e1000_media_type_fiber) ? fp@1360: e1000_setup_link(hw) : e1000_force_mac_fc(hw)); fp@1360: fp@1360: clear_bit(__E1000_RESETTING, &adapter->flags); fp@1360: return retval; fp@1360: } fp@1360: fp@1360: static u32 fp@1360: e1000_get_rx_csum(struct net_device *netdev) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: return adapter->rx_csum; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_set_rx_csum(struct net_device *netdev, u32 data) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: fp@1360: if (adapter->ecdev) fp@1360: return -EBUSY; fp@1360: fp@1360: adapter->rx_csum = data; fp@1360: fp@1360: if (netif_running(netdev)) fp@1360: e1000_reinit_locked(adapter); fp@1360: else fp@1360: e1000_reset(adapter); fp@1360: return 0; fp@1360: } fp@1360: fp@1360: static u32 fp@1360: e1000_get_tx_csum(struct net_device *netdev) fp@1360: { fp@1360: return (netdev->features & NETIF_F_HW_CSUM) != 0; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_set_tx_csum(struct net_device *netdev, u32 data) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: fp@1360: if (adapter->hw.mac_type < e1000_82543) { fp@1360: if (!data) fp@1360: return -EINVAL; fp@1360: return 0; fp@1360: } fp@1360: fp@1360: if (data) fp@1360: netdev->features |= NETIF_F_HW_CSUM; fp@1360: else fp@1360: netdev->features &= ~NETIF_F_HW_CSUM; fp@1360: fp@1360: return 0; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_set_tso(struct net_device *netdev, u32 data) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: if ((adapter->hw.mac_type < e1000_82544) || fp@1360: (adapter->hw.mac_type == e1000_82547)) fp@1360: return data ? -EINVAL : 0; fp@1360: fp@1360: if (data) fp@1360: netdev->features |= NETIF_F_TSO; fp@1360: else fp@1360: netdev->features &= ~NETIF_F_TSO; fp@1360: fp@1360: if (data && (adapter->hw.mac_type > e1000_82547_rev_2)) fp@1360: netdev->features |= NETIF_F_TSO6; fp@1360: else fp@1360: netdev->features &= ~NETIF_F_TSO6; fp@1360: fp@1360: DPRINTK(PROBE, INFO, "TSO is %s\n", data ? "Enabled" : "Disabled"); fp@1360: adapter->tso_force = true; fp@1360: return 0; fp@1360: } fp@1360: fp@1360: static u32 fp@1360: e1000_get_msglevel(struct net_device *netdev) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: return adapter->msg_enable; fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_set_msglevel(struct net_device *netdev, u32 data) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: adapter->msg_enable = data; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_get_regs_len(struct net_device *netdev) fp@1360: { fp@1360: #define E1000_REGS_LEN 32 fp@1360: return E1000_REGS_LEN * sizeof(u32); fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_get_regs(struct net_device *netdev, fp@1360: struct ethtool_regs *regs, void *p) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: struct e1000_hw *hw = &adapter->hw; fp@1360: u32 *regs_buff = p; fp@1360: u16 phy_data; fp@1360: fp@1360: memset(p, 0, E1000_REGS_LEN * sizeof(u32)); fp@1360: fp@1360: regs->version = (1 << 24) | (hw->revision_id << 16) | hw->device_id; fp@1360: fp@1360: regs_buff[0] = E1000_READ_REG(hw, CTRL); fp@1360: regs_buff[1] = E1000_READ_REG(hw, STATUS); fp@1360: fp@1360: regs_buff[2] = E1000_READ_REG(hw, RCTL); fp@1360: regs_buff[3] = E1000_READ_REG(hw, RDLEN); fp@1360: regs_buff[4] = E1000_READ_REG(hw, RDH); fp@1360: regs_buff[5] = E1000_READ_REG(hw, RDT); fp@1360: regs_buff[6] = E1000_READ_REG(hw, RDTR); fp@1360: fp@1360: regs_buff[7] = E1000_READ_REG(hw, TCTL); fp@1360: regs_buff[8] = E1000_READ_REG(hw, TDLEN); fp@1360: regs_buff[9] = E1000_READ_REG(hw, TDH); fp@1360: regs_buff[10] = E1000_READ_REG(hw, TDT); fp@1360: regs_buff[11] = E1000_READ_REG(hw, TIDV); fp@1360: fp@1360: regs_buff[12] = adapter->hw.phy_type; /* PHY type (IGP=1, M88=0) */ fp@1360: if (hw->phy_type == e1000_phy_igp) { fp@1360: e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, fp@1360: IGP01E1000_PHY_AGC_A); fp@1360: e1000_read_phy_reg(hw, IGP01E1000_PHY_AGC_A & fp@1360: IGP01E1000_PHY_PAGE_SELECT, &phy_data); fp@1360: regs_buff[13] = (u32)phy_data; /* cable length */ fp@1360: e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, fp@1360: IGP01E1000_PHY_AGC_B); fp@1360: e1000_read_phy_reg(hw, IGP01E1000_PHY_AGC_B & fp@1360: IGP01E1000_PHY_PAGE_SELECT, &phy_data); fp@1360: regs_buff[14] = (u32)phy_data; /* cable length */ fp@1360: e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, fp@1360: IGP01E1000_PHY_AGC_C); fp@1360: e1000_read_phy_reg(hw, IGP01E1000_PHY_AGC_C & fp@1360: IGP01E1000_PHY_PAGE_SELECT, &phy_data); fp@1360: regs_buff[15] = (u32)phy_data; /* cable length */ fp@1360: e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, fp@1360: IGP01E1000_PHY_AGC_D); fp@1360: e1000_read_phy_reg(hw, IGP01E1000_PHY_AGC_D & fp@1360: IGP01E1000_PHY_PAGE_SELECT, &phy_data); fp@1360: regs_buff[16] = (u32)phy_data; /* cable length */ fp@1360: regs_buff[17] = 0; /* extended 10bt distance (not needed) */ fp@1360: e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 0x0); fp@1360: e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS & fp@1360: IGP01E1000_PHY_PAGE_SELECT, &phy_data); fp@1360: regs_buff[18] = (u32)phy_data; /* cable polarity */ fp@1360: e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, fp@1360: IGP01E1000_PHY_PCS_INIT_REG); fp@1360: e1000_read_phy_reg(hw, IGP01E1000_PHY_PCS_INIT_REG & fp@1360: IGP01E1000_PHY_PAGE_SELECT, &phy_data); fp@1360: regs_buff[19] = (u32)phy_data; /* cable polarity */ fp@1360: regs_buff[20] = 0; /* polarity correction enabled (always) */ fp@1360: regs_buff[22] = 0; /* phy receive errors (unavailable) */ fp@1360: regs_buff[23] = regs_buff[18]; /* mdix mode */ fp@1360: e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 0x0); fp@1360: } else { fp@1360: e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); fp@1360: regs_buff[13] = (u32)phy_data; /* cable length */ fp@1360: regs_buff[14] = 0; /* Dummy (to align w/ IGP phy reg dump) */ fp@1360: regs_buff[15] = 0; /* Dummy (to align w/ IGP phy reg dump) */ fp@1360: regs_buff[16] = 0; /* Dummy (to align w/ IGP phy reg dump) */ fp@1360: e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); fp@1360: regs_buff[17] = (u32)phy_data; /* extended 10bt distance */ fp@1360: regs_buff[18] = regs_buff[13]; /* cable polarity */ fp@1360: regs_buff[19] = 0; /* Dummy (to align w/ IGP phy reg dump) */ fp@1360: regs_buff[20] = regs_buff[17]; /* polarity correction */ fp@1360: /* phy receive errors */ fp@1360: regs_buff[22] = adapter->phy_stats.receive_errors; fp@1360: regs_buff[23] = regs_buff[13]; /* mdix mode */ fp@1360: } fp@1360: regs_buff[21] = adapter->phy_stats.idle_errors; /* phy idle errors */ fp@1360: e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); fp@1360: regs_buff[24] = (u32)phy_data; /* phy local receiver status */ fp@1360: regs_buff[25] = regs_buff[24]; /* phy remote receiver status */ fp@1360: if (hw->mac_type >= e1000_82540 && fp@1360: hw->mac_type < e1000_82571 && fp@1360: hw->media_type == e1000_media_type_copper) { fp@1360: regs_buff[26] = E1000_READ_REG(hw, MANC); fp@1360: } fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_get_eeprom_len(struct net_device *netdev) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: return adapter->hw.eeprom.word_size * 2; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_get_eeprom(struct net_device *netdev, fp@1360: struct ethtool_eeprom *eeprom, u8 *bytes) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: struct e1000_hw *hw = &adapter->hw; fp@1360: u16 *eeprom_buff; fp@1360: int first_word, last_word; fp@1360: int ret_val = 0; fp@1360: u16 i; fp@1360: fp@1360: if (eeprom->len == 0) fp@1360: return -EINVAL; fp@1360: fp@1360: eeprom->magic = hw->vendor_id | (hw->device_id << 16); fp@1360: fp@1360: first_word = eeprom->offset >> 1; fp@1360: last_word = (eeprom->offset + eeprom->len - 1) >> 1; fp@1360: fp@1360: eeprom_buff = kmalloc(sizeof(u16) * fp@1360: (last_word - first_word + 1), GFP_KERNEL); fp@1360: if (!eeprom_buff) fp@1360: return -ENOMEM; fp@1360: fp@1360: if (hw->eeprom.type == e1000_eeprom_spi) fp@1360: ret_val = e1000_read_eeprom(hw, first_word, fp@1360: last_word - first_word + 1, fp@1360: eeprom_buff); fp@1360: else { fp@1360: for (i = 0; i < last_word - first_word + 1; i++) fp@1360: if ((ret_val = e1000_read_eeprom(hw, first_word + i, 1, fp@1360: &eeprom_buff[i]))) fp@1360: break; fp@1360: } fp@1360: fp@1360: /* Device's eeprom is always little-endian, word addressable */ fp@1360: for (i = 0; i < last_word - first_word + 1; i++) fp@1360: le16_to_cpus(&eeprom_buff[i]); fp@1360: fp@1360: memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1), fp@1360: eeprom->len); fp@1360: kfree(eeprom_buff); fp@1360: fp@1360: return ret_val; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_set_eeprom(struct net_device *netdev, fp@1360: struct ethtool_eeprom *eeprom, u8 *bytes) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: struct e1000_hw *hw = &adapter->hw; fp@1360: u16 *eeprom_buff; fp@1360: void *ptr; fp@1360: int max_len, first_word, last_word, ret_val = 0; fp@1360: u16 i; fp@1360: fp@1360: if (eeprom->len == 0) fp@1360: return -EOPNOTSUPP; fp@1360: fp@1360: if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) fp@1360: return -EFAULT; fp@1360: fp@1360: max_len = hw->eeprom.word_size * 2; fp@1360: fp@1360: first_word = eeprom->offset >> 1; fp@1360: last_word = (eeprom->offset + eeprom->len - 1) >> 1; fp@1360: eeprom_buff = kmalloc(max_len, GFP_KERNEL); fp@1360: if (!eeprom_buff) fp@1360: return -ENOMEM; fp@1360: fp@1360: ptr = (void *)eeprom_buff; fp@1360: fp@1360: if (eeprom->offset & 1) { fp@1360: /* need read/modify/write of first changed EEPROM word */ fp@1360: /* only the second byte of the word is being modified */ fp@1360: ret_val = e1000_read_eeprom(hw, first_word, 1, fp@1360: &eeprom_buff[0]); fp@1360: ptr++; fp@1360: } fp@1360: if (((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) { fp@1360: /* need read/modify/write of last changed EEPROM word */ fp@1360: /* only the first byte of the word is being modified */ fp@1360: ret_val = e1000_read_eeprom(hw, last_word, 1, fp@1360: &eeprom_buff[last_word - first_word]); fp@1360: } fp@1360: fp@1360: /* Device's eeprom is always little-endian, word addressable */ fp@1360: for (i = 0; i < last_word - first_word + 1; i++) fp@1360: le16_to_cpus(&eeprom_buff[i]); fp@1360: fp@1360: memcpy(ptr, bytes, eeprom->len); fp@1360: fp@1360: for (i = 0; i < last_word - first_word + 1; i++) fp@1360: eeprom_buff[i] = cpu_to_le16(eeprom_buff[i]); fp@1360: fp@1360: ret_val = e1000_write_eeprom(hw, first_word, fp@1360: last_word - first_word + 1, eeprom_buff); fp@1360: fp@1360: /* Update the checksum over the first part of the EEPROM if needed fp@1360: * and flush shadow RAM for 82573 conrollers */ fp@1360: if ((ret_val == 0) && ((first_word <= EEPROM_CHECKSUM_REG) || fp@1360: (hw->mac_type == e1000_82573))) fp@1360: e1000_update_eeprom_checksum(hw); fp@1360: fp@1360: kfree(eeprom_buff); fp@1360: return ret_val; fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_get_drvinfo(struct net_device *netdev, fp@1360: struct ethtool_drvinfo *drvinfo) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: char firmware_version[32]; fp@1360: u16 eeprom_data; fp@1360: fp@1360: strncpy(drvinfo->driver, e1000_driver_name, 32); fp@1360: strncpy(drvinfo->version, e1000_driver_version, 32); fp@1360: fp@1360: /* EEPROM image version # is reported as firmware version # for fp@1360: * 8257{1|2|3} controllers */ fp@1360: e1000_read_eeprom(&adapter->hw, 5, 1, &eeprom_data); fp@1360: switch (adapter->hw.mac_type) { fp@1360: case e1000_82571: fp@1360: case e1000_82572: fp@1360: case e1000_82573: fp@1360: case e1000_80003es2lan: fp@1360: case e1000_ich8lan: fp@1360: sprintf(firmware_version, "%d.%d-%d", fp@1360: (eeprom_data & 0xF000) >> 12, fp@1360: (eeprom_data & 0x0FF0) >> 4, fp@1360: eeprom_data & 0x000F); fp@1360: break; fp@1360: default: fp@1360: sprintf(firmware_version, "N/A"); fp@1360: } fp@1360: fp@1360: strncpy(drvinfo->fw_version, firmware_version, 32); fp@1360: strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); fp@1360: drvinfo->regdump_len = e1000_get_regs_len(netdev); fp@1360: drvinfo->eedump_len = e1000_get_eeprom_len(netdev); fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_get_ringparam(struct net_device *netdev, fp@1360: struct ethtool_ringparam *ring) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: e1000_mac_type mac_type = adapter->hw.mac_type; fp@1360: struct e1000_tx_ring *txdr = adapter->tx_ring; fp@1360: struct e1000_rx_ring *rxdr = adapter->rx_ring; fp@1360: fp@1360: ring->rx_max_pending = (mac_type < e1000_82544) ? E1000_MAX_RXD : fp@1360: E1000_MAX_82544_RXD; fp@1360: ring->tx_max_pending = (mac_type < e1000_82544) ? E1000_MAX_TXD : fp@1360: E1000_MAX_82544_TXD; fp@1360: ring->rx_mini_max_pending = 0; fp@1360: ring->rx_jumbo_max_pending = 0; fp@1360: ring->rx_pending = rxdr->count; fp@1360: ring->tx_pending = txdr->count; fp@1360: ring->rx_mini_pending = 0; fp@1360: ring->rx_jumbo_pending = 0; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_set_ringparam(struct net_device *netdev, fp@1360: struct ethtool_ringparam *ring) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: e1000_mac_type mac_type = adapter->hw.mac_type; fp@1360: struct e1000_tx_ring *txdr, *tx_old; fp@1360: struct e1000_rx_ring *rxdr, *rx_old; fp@1360: int i, err; fp@1360: fp@1360: if (adapter->ecdev) fp@1360: return -EBUSY; fp@1360: fp@1360: if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) fp@1360: return -EINVAL; fp@1360: fp@1360: while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) fp@1360: msleep(1); fp@1360: fp@1360: if (netif_running(adapter->netdev)) fp@1360: e1000_down(adapter); fp@1360: fp@1360: tx_old = adapter->tx_ring; fp@1360: rx_old = adapter->rx_ring; fp@1360: fp@1360: err = -ENOMEM; fp@1360: txdr = kcalloc(adapter->num_tx_queues, sizeof(struct e1000_tx_ring), GFP_KERNEL); fp@1360: if (!txdr) fp@1360: goto err_alloc_tx; fp@1360: fp@1360: rxdr = kcalloc(adapter->num_rx_queues, sizeof(struct e1000_rx_ring), GFP_KERNEL); fp@1360: if (!rxdr) fp@1360: goto err_alloc_rx; fp@1360: fp@1360: adapter->tx_ring = txdr; fp@1360: adapter->rx_ring = rxdr; fp@1360: fp@1360: rxdr->count = max(ring->rx_pending,(u32)E1000_MIN_RXD); fp@1360: rxdr->count = min(rxdr->count,(u32)(mac_type < e1000_82544 ? fp@1360: E1000_MAX_RXD : E1000_MAX_82544_RXD)); fp@1360: rxdr->count = ALIGN(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE); fp@1360: fp@1360: txdr->count = max(ring->tx_pending,(u32)E1000_MIN_TXD); fp@1360: txdr->count = min(txdr->count,(u32)(mac_type < e1000_82544 ? fp@1360: E1000_MAX_TXD : E1000_MAX_82544_TXD)); fp@1360: txdr->count = ALIGN(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); fp@1360: fp@1360: for (i = 0; i < adapter->num_tx_queues; i++) fp@1360: txdr[i].count = txdr->count; fp@1360: for (i = 0; i < adapter->num_rx_queues; i++) fp@1360: rxdr[i].count = rxdr->count; fp@1360: fp@1360: if (netif_running(adapter->netdev)) { fp@1360: /* Try to get new resources before deleting old */ fp@1360: if ((err = e1000_setup_all_rx_resources(adapter))) fp@1360: goto err_setup_rx; fp@1360: if ((err = e1000_setup_all_tx_resources(adapter))) fp@1360: goto err_setup_tx; fp@1360: fp@1360: /* save the new, restore the old in order to free it, fp@1360: * then restore the new back again */ fp@1360: fp@1360: adapter->rx_ring = rx_old; fp@1360: adapter->tx_ring = tx_old; fp@1360: e1000_free_all_rx_resources(adapter); fp@1360: e1000_free_all_tx_resources(adapter); fp@1360: kfree(tx_old); fp@1360: kfree(rx_old); fp@1360: adapter->rx_ring = rxdr; fp@1360: adapter->tx_ring = txdr; fp@1360: if ((err = e1000_up(adapter))) fp@1360: goto err_setup; fp@1360: } fp@1360: fp@1360: clear_bit(__E1000_RESETTING, &adapter->flags); fp@1360: return 0; fp@1360: err_setup_tx: fp@1360: e1000_free_all_rx_resources(adapter); fp@1360: err_setup_rx: fp@1360: adapter->rx_ring = rx_old; fp@1360: adapter->tx_ring = tx_old; fp@1360: kfree(rxdr); fp@1360: err_alloc_rx: fp@1360: kfree(txdr); fp@1360: err_alloc_tx: fp@1360: e1000_up(adapter); fp@1360: err_setup: fp@1360: clear_bit(__E1000_RESETTING, &adapter->flags); fp@1360: return err; fp@1360: } fp@1360: fp@1360: static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data, fp@1360: int reg, u32 mask, u32 write) fp@1360: { fp@1360: static const u32 test[] = fp@1360: {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; fp@1360: u8 __iomem *address = adapter->hw.hw_addr + reg; fp@1360: u32 read; fp@1360: int i; fp@1360: fp@1360: for (i = 0; i < ARRAY_SIZE(test); i++) { fp@1360: writel(write & test[i], address); fp@1360: read = readl(address); fp@1360: if (read != (write & test[i] & mask)) { fp@1360: DPRINTK(DRV, ERR, "pattern test reg %04X failed: " fp@1360: "got 0x%08X expected 0x%08X\n", fp@1360: reg, read, (write & test[i] & mask)); fp@1360: *data = reg; fp@1360: return true; fp@1360: } fp@1360: } fp@1360: return false; fp@1360: } fp@1360: fp@1360: static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data, fp@1360: int reg, u32 mask, u32 write) fp@1360: { fp@1360: u8 __iomem *address = adapter->hw.hw_addr + reg; fp@1360: u32 read; fp@1360: fp@1360: writel(write & mask, address); fp@1360: read = readl(address); fp@1360: if ((read & mask) != (write & mask)) { fp@1360: DPRINTK(DRV, ERR, "set/check reg %04X test failed: " fp@1360: "got 0x%08X expected 0x%08X\n", fp@1360: reg, (read & mask), (write & mask)); fp@1360: *data = reg; fp@1360: return true; fp@1360: } fp@1360: return false; fp@1360: } fp@1360: fp@1360: #define REG_PATTERN_TEST(reg, mask, write) \ fp@1360: do { \ fp@1360: if (reg_pattern_test(adapter, data, \ fp@1360: (adapter->hw.mac_type >= e1000_82543) \ fp@1360: ? E1000_##reg : E1000_82542_##reg, \ fp@1360: mask, write)) \ fp@1360: return 1; \ fp@1360: } while (0) fp@1360: fp@1360: #define REG_SET_AND_CHECK(reg, mask, write) \ fp@1360: do { \ fp@1360: if (reg_set_and_check(adapter, data, \ fp@1360: (adapter->hw.mac_type >= e1000_82543) \ fp@1360: ? E1000_##reg : E1000_82542_##reg, \ fp@1360: mask, write)) \ fp@1360: return 1; \ fp@1360: } while (0) fp@1360: fp@1360: static int fp@1360: e1000_reg_test(struct e1000_adapter *adapter, u64 *data) fp@1360: { fp@1360: u32 value, before, after; fp@1360: u32 i, toggle; fp@1360: fp@1360: /* The status register is Read Only, so a write should fail. fp@1360: * Some bits that get toggled are ignored. fp@1360: */ fp@1360: switch (adapter->hw.mac_type) { fp@1360: /* there are several bits on newer hardware that are r/w */ fp@1360: case e1000_82571: fp@1360: case e1000_82572: fp@1360: case e1000_80003es2lan: fp@1360: toggle = 0x7FFFF3FF; fp@1360: break; fp@1360: case e1000_82573: fp@1360: case e1000_ich8lan: fp@1360: toggle = 0x7FFFF033; fp@1360: break; fp@1360: default: fp@1360: toggle = 0xFFFFF833; fp@1360: break; fp@1360: } fp@1360: fp@1360: before = E1000_READ_REG(&adapter->hw, STATUS); fp@1360: value = (E1000_READ_REG(&adapter->hw, STATUS) & toggle); fp@1360: E1000_WRITE_REG(&adapter->hw, STATUS, toggle); fp@1360: after = E1000_READ_REG(&adapter->hw, STATUS) & toggle; fp@1360: if (value != after) { fp@1360: DPRINTK(DRV, ERR, "failed STATUS register test got: " fp@1360: "0x%08X expected: 0x%08X\n", after, value); fp@1360: *data = 1; fp@1360: return 1; fp@1360: } fp@1360: /* restore previous status */ fp@1360: E1000_WRITE_REG(&adapter->hw, STATUS, before); fp@1360: fp@1360: if (adapter->hw.mac_type != e1000_ich8lan) { fp@1360: REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF); fp@1360: REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF); fp@1360: REG_PATTERN_TEST(FCT, 0x0000FFFF, 0xFFFFFFFF); fp@1360: REG_PATTERN_TEST(VET, 0x0000FFFF, 0xFFFFFFFF); fp@1360: } fp@1360: fp@1360: REG_PATTERN_TEST(RDTR, 0x0000FFFF, 0xFFFFFFFF); fp@1360: REG_PATTERN_TEST(RDBAH, 0xFFFFFFFF, 0xFFFFFFFF); fp@1360: REG_PATTERN_TEST(RDLEN, 0x000FFF80, 0x000FFFFF); fp@1360: REG_PATTERN_TEST(RDH, 0x0000FFFF, 0x0000FFFF); fp@1360: REG_PATTERN_TEST(RDT, 0x0000FFFF, 0x0000FFFF); fp@1360: REG_PATTERN_TEST(FCRTH, 0x0000FFF8, 0x0000FFF8); fp@1360: REG_PATTERN_TEST(FCTTV, 0x0000FFFF, 0x0000FFFF); fp@1360: REG_PATTERN_TEST(TIPG, 0x3FFFFFFF, 0x3FFFFFFF); fp@1360: REG_PATTERN_TEST(TDBAH, 0xFFFFFFFF, 0xFFFFFFFF); fp@1360: REG_PATTERN_TEST(TDLEN, 0x000FFF80, 0x000FFFFF); fp@1360: fp@1360: REG_SET_AND_CHECK(RCTL, 0xFFFFFFFF, 0x00000000); fp@1360: fp@1360: before = (adapter->hw.mac_type == e1000_ich8lan ? fp@1360: 0x06C3B33E : 0x06DFB3FE); fp@1360: REG_SET_AND_CHECK(RCTL, before, 0x003FFFFB); fp@1360: REG_SET_AND_CHECK(TCTL, 0xFFFFFFFF, 0x00000000); fp@1360: fp@1360: if (adapter->hw.mac_type >= e1000_82543) { fp@1360: fp@1360: REG_SET_AND_CHECK(RCTL, before, 0xFFFFFFFF); fp@1360: REG_PATTERN_TEST(RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); fp@1360: if (adapter->hw.mac_type != e1000_ich8lan) fp@1360: REG_PATTERN_TEST(TXCW, 0xC000FFFF, 0x0000FFFF); fp@1360: REG_PATTERN_TEST(TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); fp@1360: REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF); fp@1360: value = (adapter->hw.mac_type == e1000_ich8lan ? fp@1360: E1000_RAR_ENTRIES_ICH8LAN : E1000_RAR_ENTRIES); fp@1360: for (i = 0; i < value; i++) { fp@1360: REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF, fp@1360: 0xFFFFFFFF); fp@1360: } fp@1360: fp@1360: } else { fp@1360: fp@1360: REG_SET_AND_CHECK(RCTL, 0xFFFFFFFF, 0x01FFFFFF); fp@1360: REG_PATTERN_TEST(RDBAL, 0xFFFFF000, 0xFFFFFFFF); fp@1360: REG_PATTERN_TEST(TXCW, 0x0000FFFF, 0x0000FFFF); fp@1360: REG_PATTERN_TEST(TDBAL, 0xFFFFF000, 0xFFFFFFFF); fp@1360: fp@1360: } fp@1360: fp@1360: value = (adapter->hw.mac_type == e1000_ich8lan ? fp@1360: E1000_MC_TBL_SIZE_ICH8LAN : E1000_MC_TBL_SIZE); fp@1360: for (i = 0; i < value; i++) fp@1360: REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF); fp@1360: fp@1360: *data = 0; fp@1360: return 0; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_eeprom_test(struct e1000_adapter *adapter, u64 *data) fp@1360: { fp@1360: u16 temp; fp@1360: u16 checksum = 0; fp@1360: u16 i; fp@1360: fp@1360: *data = 0; fp@1360: /* Read and add up the contents of the EEPROM */ fp@1360: for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { fp@1360: if ((e1000_read_eeprom(&adapter->hw, i, 1, &temp)) < 0) { fp@1360: *data = 1; fp@1360: break; fp@1360: } fp@1360: checksum += temp; fp@1360: } fp@1360: fp@1360: /* If Checksum is not Correct return error else test passed */ fp@1360: if ((checksum != (u16) EEPROM_SUM) && !(*data)) fp@1360: *data = 2; fp@1360: fp@1360: return *data; fp@1360: } fp@1360: fp@1360: static irqreturn_t fp@1360: e1000_test_intr(int irq, void *data) fp@1360: { fp@1360: struct net_device *netdev = (struct net_device *) data; fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: fp@1360: adapter->test_icr |= E1000_READ_REG(&adapter->hw, ICR); fp@1360: fp@1360: return IRQ_HANDLED; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_intr_test(struct e1000_adapter *adapter, u64 *data) fp@1360: { fp@1360: struct net_device *netdev = adapter->netdev; fp@1360: u32 mask, i = 0; fp@1360: bool shared_int = true; fp@1360: u32 irq = adapter->pdev->irq; fp@1360: fp@1360: *data = 0; fp@1360: fp@1360: /* NOTE: we don't test MSI interrupts here, yet */ fp@1360: /* Hook up test interrupt handler just for this test */ fp@1360: if (!request_irq(irq, &e1000_test_intr, IRQF_PROBE_SHARED, netdev->name, fp@1360: netdev)) fp@1360: shared_int = false; fp@1360: else if (request_irq(irq, &e1000_test_intr, IRQF_SHARED, fp@1360: netdev->name, netdev)) { fp@1360: *data = 1; fp@1360: return -1; fp@1360: } fp@1360: DPRINTK(HW, INFO, "testing %s interrupt\n", fp@1360: (shared_int ? "shared" : "unshared")); fp@1360: fp@1360: /* Disable all the interrupts */ fp@1360: E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF); fp@1360: msleep(10); fp@1360: fp@1360: /* Test each interrupt */ fp@1360: for (; i < 10; i++) { fp@1360: fp@1360: if (adapter->hw.mac_type == e1000_ich8lan && i == 8) fp@1360: continue; fp@1360: fp@1360: /* Interrupt to test */ fp@1360: mask = 1 << i; fp@1360: fp@1360: if (!shared_int) { fp@1360: /* Disable the interrupt to be reported in fp@1360: * the cause register and then force the same fp@1360: * interrupt and see if one gets posted. If fp@1360: * an interrupt was posted to the bus, the fp@1360: * test failed. fp@1360: */ fp@1360: adapter->test_icr = 0; fp@1360: E1000_WRITE_REG(&adapter->hw, IMC, mask); fp@1360: E1000_WRITE_REG(&adapter->hw, ICS, mask); fp@1360: msleep(10); fp@1360: fp@1360: if (adapter->test_icr & mask) { fp@1360: *data = 3; fp@1360: break; fp@1360: } fp@1360: } fp@1360: fp@1360: /* Enable the interrupt to be reported in fp@1360: * the cause register and then force the same fp@1360: * interrupt and see if one gets posted. If fp@1360: * an interrupt was not posted to the bus, the fp@1360: * test failed. fp@1360: */ fp@1360: adapter->test_icr = 0; fp@1360: E1000_WRITE_REG(&adapter->hw, IMS, mask); fp@1360: E1000_WRITE_REG(&adapter->hw, ICS, mask); fp@1360: msleep(10); fp@1360: fp@1360: if (!(adapter->test_icr & mask)) { fp@1360: *data = 4; fp@1360: break; fp@1360: } fp@1360: fp@1360: if (!shared_int) { fp@1360: /* Disable the other interrupts to be reported in fp@1360: * the cause register and then force the other fp@1360: * interrupts and see if any get posted. If fp@1360: * an interrupt was posted to the bus, the fp@1360: * test failed. fp@1360: */ fp@1360: adapter->test_icr = 0; fp@1360: E1000_WRITE_REG(&adapter->hw, IMC, ~mask & 0x00007FFF); fp@1360: E1000_WRITE_REG(&adapter->hw, ICS, ~mask & 0x00007FFF); fp@1360: msleep(10); fp@1360: fp@1360: if (adapter->test_icr) { fp@1360: *data = 5; fp@1360: break; fp@1360: } fp@1360: } fp@1360: } fp@1360: fp@1360: /* Disable all the interrupts */ fp@1360: E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF); fp@1360: msleep(10); fp@1360: fp@1360: /* Unhook test interrupt handler */ fp@1360: free_irq(irq, netdev); fp@1360: fp@1360: return *data; fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_free_desc_rings(struct e1000_adapter *adapter) fp@1360: { fp@1360: struct e1000_tx_ring *txdr = &adapter->test_tx_ring; fp@1360: struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; fp@1360: struct pci_dev *pdev = adapter->pdev; fp@1360: int i; fp@1360: fp@1360: if (txdr->desc && txdr->buffer_info) { fp@1360: for (i = 0; i < txdr->count; i++) { fp@1360: if (txdr->buffer_info[i].dma) fp@1366: pci_unmap_single(pdev, txdr->buffer_info[i].dma, fp@1360: txdr->buffer_info[i].length, fp@1360: PCI_DMA_TODEVICE); fp@1360: if (txdr->buffer_info[i].skb) fp@1360: dev_kfree_skb(txdr->buffer_info[i].skb); fp@1360: } fp@1360: } fp@1360: fp@1360: if (rxdr->desc && rxdr->buffer_info) { fp@1360: for (i = 0; i < rxdr->count; i++) { fp@1360: if (rxdr->buffer_info[i].dma) fp@1366: pci_unmap_single(pdev, rxdr->buffer_info[i].dma, fp@1360: rxdr->buffer_info[i].length, fp@1360: PCI_DMA_FROMDEVICE); fp@1360: if (rxdr->buffer_info[i].skb) fp@1360: dev_kfree_skb(rxdr->buffer_info[i].skb); fp@1360: } fp@1360: } fp@1360: fp@1360: if (txdr->desc) { fp@1360: pci_free_consistent(pdev, txdr->size, txdr->desc, txdr->dma); fp@1360: txdr->desc = NULL; fp@1360: } fp@1360: if (rxdr->desc) { fp@1360: pci_free_consistent(pdev, rxdr->size, rxdr->desc, rxdr->dma); fp@1360: rxdr->desc = NULL; fp@1360: } fp@1360: fp@1360: kfree(txdr->buffer_info); fp@1360: txdr->buffer_info = NULL; fp@1360: kfree(rxdr->buffer_info); fp@1360: rxdr->buffer_info = NULL; fp@1360: fp@1360: return; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_setup_desc_rings(struct e1000_adapter *adapter) fp@1360: { fp@1360: struct e1000_tx_ring *txdr = &adapter->test_tx_ring; fp@1360: struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; fp@1360: struct pci_dev *pdev = adapter->pdev; fp@1360: u32 rctl; fp@1360: int i, ret_val; fp@1360: fp@1360: /* Setup Tx descriptor ring and Tx buffers */ fp@1360: fp@1360: if (!txdr->count) fp@1360: txdr->count = E1000_DEFAULT_TXD; fp@1360: fp@1360: if (!(txdr->buffer_info = kcalloc(txdr->count, fp@1360: sizeof(struct e1000_buffer), fp@1360: GFP_KERNEL))) { fp@1360: ret_val = 1; fp@1360: goto err_nomem; fp@1360: } fp@1360: fp@1360: txdr->size = txdr->count * sizeof(struct e1000_tx_desc); fp@1360: txdr->size = ALIGN(txdr->size, 4096); fp@1360: if (!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, fp@1360: &txdr->dma))) { fp@1360: ret_val = 2; fp@1360: goto err_nomem; fp@1360: } fp@1360: memset(txdr->desc, 0, txdr->size); fp@1360: txdr->next_to_use = txdr->next_to_clean = 0; fp@1360: fp@1360: E1000_WRITE_REG(&adapter->hw, TDBAL, fp@1360: ((u64) txdr->dma & 0x00000000FFFFFFFF)); fp@1360: E1000_WRITE_REG(&adapter->hw, TDBAH, ((u64) txdr->dma >> 32)); fp@1360: E1000_WRITE_REG(&adapter->hw, TDLEN, fp@1360: txdr->count * sizeof(struct e1000_tx_desc)); fp@1360: E1000_WRITE_REG(&adapter->hw, TDH, 0); fp@1360: E1000_WRITE_REG(&adapter->hw, TDT, 0); fp@1360: E1000_WRITE_REG(&adapter->hw, TCTL, fp@1360: E1000_TCTL_PSP | E1000_TCTL_EN | fp@1360: E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT | fp@1360: E1000_FDX_COLLISION_DISTANCE << E1000_COLD_SHIFT); fp@1360: fp@1360: for (i = 0; i < txdr->count; i++) { fp@1360: struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*txdr, i); fp@1360: struct sk_buff *skb; fp@1360: unsigned int size = 1024; fp@1360: fp@1360: if (!(skb = alloc_skb(size, GFP_KERNEL))) { fp@1360: ret_val = 3; fp@1360: goto err_nomem; fp@1360: } fp@1360: skb_put(skb, size); fp@1360: txdr->buffer_info[i].skb = skb; fp@1360: txdr->buffer_info[i].length = skb->len; fp@1360: txdr->buffer_info[i].dma = fp@1360: pci_map_single(pdev, skb->data, skb->len, fp@1360: PCI_DMA_TODEVICE); fp@1360: tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); fp@1360: tx_desc->lower.data = cpu_to_le32(skb->len); fp@1360: tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | fp@1360: E1000_TXD_CMD_IFCS | fp@1360: E1000_TXD_CMD_RPS); fp@1360: tx_desc->upper.data = 0; fp@1360: } fp@1360: fp@1360: /* Setup Rx descriptor ring and Rx buffers */ fp@1360: fp@1360: if (!rxdr->count) fp@1360: rxdr->count = E1000_DEFAULT_RXD; fp@1360: fp@1360: if (!(rxdr->buffer_info = kcalloc(rxdr->count, fp@1360: sizeof(struct e1000_buffer), fp@1360: GFP_KERNEL))) { fp@1360: ret_val = 4; fp@1360: goto err_nomem; fp@1360: } fp@1360: fp@1360: rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); fp@1360: if (!(rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma))) { fp@1360: ret_val = 5; fp@1360: goto err_nomem; fp@1360: } fp@1360: memset(rxdr->desc, 0, rxdr->size); fp@1360: rxdr->next_to_use = rxdr->next_to_clean = 0; fp@1360: fp@1360: rctl = E1000_READ_REG(&adapter->hw, RCTL); fp@1360: E1000_WRITE_REG(&adapter->hw, RCTL, rctl & ~E1000_RCTL_EN); fp@1360: E1000_WRITE_REG(&adapter->hw, RDBAL, fp@1360: ((u64) rxdr->dma & 0xFFFFFFFF)); fp@1360: E1000_WRITE_REG(&adapter->hw, RDBAH, ((u64) rxdr->dma >> 32)); fp@1360: E1000_WRITE_REG(&adapter->hw, RDLEN, rxdr->size); fp@1360: E1000_WRITE_REG(&adapter->hw, RDH, 0); fp@1360: E1000_WRITE_REG(&adapter->hw, RDT, 0); fp@1360: rctl = E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_SZ_2048 | fp@1360: E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | fp@1360: (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT); fp@1360: E1000_WRITE_REG(&adapter->hw, RCTL, rctl); fp@1360: fp@1360: for (i = 0; i < rxdr->count; i++) { fp@1360: struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i); fp@1360: struct sk_buff *skb; fp@1360: fp@1360: if (!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, fp@1360: GFP_KERNEL))) { fp@1360: ret_val = 6; fp@1360: goto err_nomem; fp@1360: } fp@1360: skb_reserve(skb, NET_IP_ALIGN); fp@1360: rxdr->buffer_info[i].skb = skb; fp@1360: rxdr->buffer_info[i].length = E1000_RXBUFFER_2048; fp@1360: rxdr->buffer_info[i].dma = fp@1360: pci_map_single(pdev, skb->data, E1000_RXBUFFER_2048, fp@1360: PCI_DMA_FROMDEVICE); fp@1360: rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); fp@1360: memset(skb->data, 0x00, skb->len); fp@1360: } fp@1360: fp@1360: return 0; fp@1360: fp@1360: err_nomem: fp@1360: e1000_free_desc_rings(adapter); fp@1360: return ret_val; fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_phy_disable_receiver(struct e1000_adapter *adapter) fp@1360: { fp@1360: /* Write out to PHY registers 29 and 30 to disable the Receiver. */ fp@1360: e1000_write_phy_reg(&adapter->hw, 29, 0x001F); fp@1360: e1000_write_phy_reg(&adapter->hw, 30, 0x8FFC); fp@1360: e1000_write_phy_reg(&adapter->hw, 29, 0x001A); fp@1360: e1000_write_phy_reg(&adapter->hw, 30, 0x8FF0); fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_phy_reset_clk_and_crs(struct e1000_adapter *adapter) fp@1360: { fp@1360: u16 phy_reg; fp@1360: fp@1360: /* Because we reset the PHY above, we need to re-force TX_CLK in the fp@1360: * Extended PHY Specific Control Register to 25MHz clock. This fp@1360: * value defaults back to a 2.5MHz clock when the PHY is reset. fp@1360: */ fp@1360: e1000_read_phy_reg(&adapter->hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg); fp@1360: phy_reg |= M88E1000_EPSCR_TX_CLK_25; fp@1360: e1000_write_phy_reg(&adapter->hw, fp@1360: M88E1000_EXT_PHY_SPEC_CTRL, phy_reg); fp@1360: fp@1360: /* In addition, because of the s/w reset above, we need to enable fp@1360: * CRS on TX. This must be set for both full and half duplex fp@1360: * operation. fp@1360: */ fp@1360: e1000_read_phy_reg(&adapter->hw, M88E1000_PHY_SPEC_CTRL, &phy_reg); fp@1360: phy_reg |= M88E1000_PSCR_ASSERT_CRS_ON_TX; fp@1360: e1000_write_phy_reg(&adapter->hw, fp@1360: M88E1000_PHY_SPEC_CTRL, phy_reg); fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_nonintegrated_phy_loopback(struct e1000_adapter *adapter) fp@1360: { fp@1360: u32 ctrl_reg; fp@1360: u16 phy_reg; fp@1360: fp@1360: /* Setup the Device Control Register for PHY loopback test. */ fp@1360: fp@1360: ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL); fp@1360: ctrl_reg |= (E1000_CTRL_ILOS | /* Invert Loss-Of-Signal */ fp@1360: E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ fp@1360: E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ fp@1360: E1000_CTRL_SPD_1000 | /* Force Speed to 1000 */ fp@1360: E1000_CTRL_FD); /* Force Duplex to FULL */ fp@1360: fp@1360: E1000_WRITE_REG(&adapter->hw, CTRL, ctrl_reg); fp@1360: fp@1360: /* Read the PHY Specific Control Register (0x10) */ fp@1360: e1000_read_phy_reg(&adapter->hw, M88E1000_PHY_SPEC_CTRL, &phy_reg); fp@1360: fp@1360: /* Clear Auto-Crossover bits in PHY Specific Control Register fp@1360: * (bits 6:5). fp@1360: */ fp@1360: phy_reg &= ~M88E1000_PSCR_AUTO_X_MODE; fp@1360: e1000_write_phy_reg(&adapter->hw, M88E1000_PHY_SPEC_CTRL, phy_reg); fp@1360: fp@1360: /* Perform software reset on the PHY */ fp@1360: e1000_phy_reset(&adapter->hw); fp@1360: fp@1360: /* Have to setup TX_CLK and TX_CRS after software reset */ fp@1360: e1000_phy_reset_clk_and_crs(adapter); fp@1360: fp@1360: e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x8100); fp@1360: fp@1360: /* Wait for reset to complete. */ fp@1360: udelay(500); fp@1360: fp@1360: /* Have to setup TX_CLK and TX_CRS after software reset */ fp@1360: e1000_phy_reset_clk_and_crs(adapter); fp@1360: fp@1360: /* Write out to PHY registers 29 and 30 to disable the Receiver. */ fp@1360: e1000_phy_disable_receiver(adapter); fp@1360: fp@1360: /* Set the loopback bit in the PHY control register. */ fp@1360: e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg); fp@1360: phy_reg |= MII_CR_LOOPBACK; fp@1360: e1000_write_phy_reg(&adapter->hw, PHY_CTRL, phy_reg); fp@1360: fp@1360: /* Setup TX_CLK and TX_CRS one more time. */ fp@1360: e1000_phy_reset_clk_and_crs(adapter); fp@1360: fp@1360: /* Check Phy Configuration */ fp@1360: e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg); fp@1360: if (phy_reg != 0x4100) fp@1360: return 9; fp@1360: fp@1360: e1000_read_phy_reg(&adapter->hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg); fp@1360: if (phy_reg != 0x0070) fp@1360: return 10; fp@1360: fp@1360: e1000_read_phy_reg(&adapter->hw, 29, &phy_reg); fp@1360: if (phy_reg != 0x001A) fp@1360: return 11; fp@1360: fp@1360: return 0; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_integrated_phy_loopback(struct e1000_adapter *adapter) fp@1360: { fp@1360: u32 ctrl_reg = 0; fp@1360: u32 stat_reg = 0; fp@1360: fp@1360: adapter->hw.autoneg = false; fp@1360: fp@1360: if (adapter->hw.phy_type == e1000_phy_m88) { fp@1360: /* Auto-MDI/MDIX Off */ fp@1360: e1000_write_phy_reg(&adapter->hw, fp@1360: M88E1000_PHY_SPEC_CTRL, 0x0808); fp@1360: /* reset to update Auto-MDI/MDIX */ fp@1360: e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x9140); fp@1360: /* autoneg off */ fp@1360: e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x8140); fp@1360: } else if (adapter->hw.phy_type == e1000_phy_gg82563) fp@1360: e1000_write_phy_reg(&adapter->hw, fp@1360: GG82563_PHY_KMRN_MODE_CTRL, fp@1360: 0x1CC); fp@1360: fp@1360: ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL); fp@1360: fp@1360: if (adapter->hw.phy_type == e1000_phy_ife) { fp@1360: /* force 100, set loopback */ fp@1360: e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x6100); fp@1360: fp@1360: /* Now set up the MAC to the same speed/duplex as the PHY. */ fp@1360: ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ fp@1360: ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ fp@1360: E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ fp@1360: E1000_CTRL_SPD_100 |/* Force Speed to 100 */ fp@1360: E1000_CTRL_FD); /* Force Duplex to FULL */ fp@1360: } else { fp@1360: /* force 1000, set loopback */ fp@1360: e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x4140); fp@1360: fp@1360: /* Now set up the MAC to the same speed/duplex as the PHY. */ fp@1360: ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL); fp@1360: ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ fp@1360: ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ fp@1360: E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ fp@1360: E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */ fp@1360: E1000_CTRL_FD); /* Force Duplex to FULL */ fp@1360: } fp@1360: fp@1360: if (adapter->hw.media_type == e1000_media_type_copper && fp@1360: adapter->hw.phy_type == e1000_phy_m88) fp@1360: ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ fp@1360: else { fp@1360: /* Set the ILOS bit on the fiber Nic is half fp@1360: * duplex link is detected. */ fp@1360: stat_reg = E1000_READ_REG(&adapter->hw, STATUS); fp@1360: if ((stat_reg & E1000_STATUS_FD) == 0) fp@1360: ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); fp@1360: } fp@1360: fp@1360: E1000_WRITE_REG(&adapter->hw, CTRL, ctrl_reg); fp@1360: fp@1360: /* Disable the receiver on the PHY so when a cable is plugged in, the fp@1360: * PHY does not begin to autoneg when a cable is reconnected to the NIC. fp@1360: */ fp@1360: if (adapter->hw.phy_type == e1000_phy_m88) fp@1360: e1000_phy_disable_receiver(adapter); fp@1360: fp@1360: udelay(500); fp@1360: fp@1360: return 0; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_set_phy_loopback(struct e1000_adapter *adapter) fp@1360: { fp@1360: u16 phy_reg = 0; fp@1360: u16 count = 0; fp@1360: fp@1360: switch (adapter->hw.mac_type) { fp@1360: case e1000_82543: fp@1360: if (adapter->hw.media_type == e1000_media_type_copper) { fp@1360: /* Attempt to setup Loopback mode on Non-integrated PHY. fp@1360: * Some PHY registers get corrupted at random, so fp@1360: * attempt this 10 times. fp@1360: */ fp@1360: while (e1000_nonintegrated_phy_loopback(adapter) && fp@1360: count++ < 10); fp@1360: if (count < 11) fp@1360: return 0; fp@1360: } fp@1360: break; fp@1360: fp@1360: case e1000_82544: fp@1360: case e1000_82540: fp@1360: case e1000_82545: fp@1360: case e1000_82545_rev_3: fp@1360: case e1000_82546: fp@1360: case e1000_82546_rev_3: fp@1360: case e1000_82541: fp@1360: case e1000_82541_rev_2: fp@1360: case e1000_82547: fp@1360: case e1000_82547_rev_2: fp@1360: case e1000_82571: fp@1360: case e1000_82572: fp@1360: case e1000_82573: fp@1360: case e1000_80003es2lan: fp@1360: case e1000_ich8lan: fp@1360: return e1000_integrated_phy_loopback(adapter); fp@1360: break; fp@1360: fp@1360: default: fp@1360: /* Default PHY loopback work is to read the MII fp@1360: * control register and assert bit 14 (loopback mode). fp@1360: */ fp@1360: e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg); fp@1360: phy_reg |= MII_CR_LOOPBACK; fp@1360: e1000_write_phy_reg(&adapter->hw, PHY_CTRL, phy_reg); fp@1360: return 0; fp@1360: break; fp@1360: } fp@1360: fp@1360: return 8; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_setup_loopback_test(struct e1000_adapter *adapter) fp@1360: { fp@1360: struct e1000_hw *hw = &adapter->hw; fp@1360: u32 rctl; fp@1360: fp@1360: if (hw->media_type == e1000_media_type_fiber || fp@1360: hw->media_type == e1000_media_type_internal_serdes) { fp@1360: switch (hw->mac_type) { fp@1360: case e1000_82545: fp@1360: case e1000_82546: fp@1360: case e1000_82545_rev_3: fp@1360: case e1000_82546_rev_3: fp@1360: return e1000_set_phy_loopback(adapter); fp@1360: break; fp@1360: case e1000_82571: fp@1360: case e1000_82572: fp@1360: #define E1000_SERDES_LB_ON 0x410 fp@1360: e1000_set_phy_loopback(adapter); fp@1360: E1000_WRITE_REG(hw, SCTL, E1000_SERDES_LB_ON); fp@1360: msleep(10); fp@1360: return 0; fp@1360: break; fp@1360: default: fp@1360: rctl = E1000_READ_REG(hw, RCTL); fp@1360: rctl |= E1000_RCTL_LBM_TCVR; fp@1360: E1000_WRITE_REG(hw, RCTL, rctl); fp@1360: return 0; fp@1360: } fp@1360: } else if (hw->media_type == e1000_media_type_copper) fp@1360: return e1000_set_phy_loopback(adapter); fp@1360: fp@1360: return 7; fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_loopback_cleanup(struct e1000_adapter *adapter) fp@1360: { fp@1360: struct e1000_hw *hw = &adapter->hw; fp@1360: u32 rctl; fp@1360: u16 phy_reg; fp@1360: fp@1360: rctl = E1000_READ_REG(hw, RCTL); fp@1360: rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC); fp@1360: E1000_WRITE_REG(hw, RCTL, rctl); fp@1360: fp@1360: switch (hw->mac_type) { fp@1360: case e1000_82571: fp@1360: case e1000_82572: fp@1360: if (hw->media_type == e1000_media_type_fiber || fp@1360: hw->media_type == e1000_media_type_internal_serdes) { fp@1360: #define E1000_SERDES_LB_OFF 0x400 fp@1360: E1000_WRITE_REG(hw, SCTL, E1000_SERDES_LB_OFF); fp@1360: msleep(10); fp@1360: break; fp@1360: } fp@1360: /* Fall Through */ fp@1360: case e1000_82545: fp@1360: case e1000_82546: fp@1360: case e1000_82545_rev_3: fp@1360: case e1000_82546_rev_3: fp@1360: default: fp@1360: hw->autoneg = true; fp@1360: if (hw->phy_type == e1000_phy_gg82563) fp@1360: e1000_write_phy_reg(hw, fp@1360: GG82563_PHY_KMRN_MODE_CTRL, fp@1360: 0x180); fp@1360: e1000_read_phy_reg(hw, PHY_CTRL, &phy_reg); fp@1360: if (phy_reg & MII_CR_LOOPBACK) { fp@1360: phy_reg &= ~MII_CR_LOOPBACK; fp@1360: e1000_write_phy_reg(hw, PHY_CTRL, phy_reg); fp@1360: e1000_phy_reset(hw); fp@1360: } fp@1360: break; fp@1360: } fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_create_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) fp@1360: { fp@1360: memset(skb->data, 0xFF, frame_size); fp@1360: frame_size &= ~1; fp@1360: memset(&skb->data[frame_size / 2], 0xAA, frame_size / 2 - 1); fp@1360: memset(&skb->data[frame_size / 2 + 10], 0xBE, 1); fp@1360: memset(&skb->data[frame_size / 2 + 12], 0xAF, 1); fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) fp@1360: { fp@1360: frame_size &= ~1; fp@1360: if (*(skb->data + 3) == 0xFF) { fp@1360: if ((*(skb->data + frame_size / 2 + 10) == 0xBE) && fp@1360: (*(skb->data + frame_size / 2 + 12) == 0xAF)) { fp@1360: return 0; fp@1360: } fp@1360: } fp@1360: return 13; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_run_loopback_test(struct e1000_adapter *adapter) fp@1360: { fp@1360: struct e1000_tx_ring *txdr = &adapter->test_tx_ring; fp@1360: struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; fp@1360: struct pci_dev *pdev = adapter->pdev; fp@1360: int i, j, k, l, lc, good_cnt, ret_val=0; fp@1360: unsigned long time; fp@1360: fp@1360: E1000_WRITE_REG(&adapter->hw, RDT, rxdr->count - 1); fp@1360: fp@1360: /* Calculate the loop count based on the largest descriptor ring fp@1360: * The idea is to wrap the largest ring a number of times using 64 fp@1360: * send/receive pairs during each loop fp@1360: */ fp@1360: fp@1360: if (rxdr->count <= txdr->count) fp@1360: lc = ((txdr->count / 64) * 2) + 1; fp@1360: else fp@1360: lc = ((rxdr->count / 64) * 2) + 1; fp@1360: fp@1360: k = l = 0; fp@1360: for (j = 0; j <= lc; j++) { /* loop count loop */ fp@1360: for (i = 0; i < 64; i++) { /* send the packets */ fp@1360: e1000_create_lbtest_frame(txdr->buffer_info[i].skb, fp@1360: 1024); fp@1360: pci_dma_sync_single_for_device(pdev, fp@1360: txdr->buffer_info[k].dma, fp@1360: txdr->buffer_info[k].length, fp@1360: PCI_DMA_TODEVICE); fp@1360: if (unlikely(++k == txdr->count)) k = 0; fp@1360: } fp@1360: E1000_WRITE_REG(&adapter->hw, TDT, k); fp@1360: msleep(200); fp@1360: time = jiffies; /* set the start time for the receive */ fp@1360: good_cnt = 0; fp@1360: do { /* receive the sent packets */ fp@1360: pci_dma_sync_single_for_cpu(pdev, fp@1360: rxdr->buffer_info[l].dma, fp@1360: rxdr->buffer_info[l].length, fp@1360: PCI_DMA_FROMDEVICE); fp@1360: fp@1360: ret_val = e1000_check_lbtest_frame( fp@1360: rxdr->buffer_info[l].skb, fp@1360: 1024); fp@1360: if (!ret_val) fp@1360: good_cnt++; fp@1360: if (unlikely(++l == rxdr->count)) l = 0; fp@1360: /* time + 20 msecs (200 msecs on 2.4) is more than fp@1360: * enough time to complete the receives, if it's fp@1360: * exceeded, break and error off fp@1360: */ fp@1360: } while (good_cnt < 64 && jiffies < (time + 20)); fp@1360: if (good_cnt != 64) { fp@1360: ret_val = 13; /* ret_val is the same as mis-compare */ fp@1360: break; fp@1360: } fp@1360: if (jiffies >= (time + 2)) { fp@1360: ret_val = 14; /* error code for time out error */ fp@1360: break; fp@1360: } fp@1360: } /* end loop count loop */ fp@1360: return ret_val; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_loopback_test(struct e1000_adapter *adapter, u64 *data) fp@1360: { fp@1360: /* PHY loopback cannot be performed if SoL/IDER fp@1360: * sessions are active */ fp@1360: if (e1000_check_phy_reset_block(&adapter->hw)) { fp@1360: DPRINTK(DRV, ERR, "Cannot do PHY loopback test " fp@1360: "when SoL/IDER is active.\n"); fp@1360: *data = 0; fp@1360: goto out; fp@1360: } fp@1360: fp@1360: if ((*data = e1000_setup_desc_rings(adapter))) fp@1360: goto out; fp@1360: if ((*data = e1000_setup_loopback_test(adapter))) fp@1360: goto err_loopback; fp@1360: *data = e1000_run_loopback_test(adapter); fp@1360: e1000_loopback_cleanup(adapter); fp@1360: fp@1360: err_loopback: fp@1360: e1000_free_desc_rings(adapter); fp@1360: out: fp@1360: return *data; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_link_test(struct e1000_adapter *adapter, u64 *data) fp@1360: { fp@1360: *data = 0; fp@1360: if (adapter->hw.media_type == e1000_media_type_internal_serdes) { fp@1360: int i = 0; fp@1360: adapter->hw.serdes_link_down = true; fp@1360: fp@1360: /* On some blade server designs, link establishment fp@1360: * could take as long as 2-3 minutes */ fp@1360: do { fp@1360: e1000_check_for_link(&adapter->hw); fp@1360: if (!adapter->hw.serdes_link_down) fp@1360: return *data; fp@1360: msleep(20); fp@1360: } while (i++ < 3750); fp@1360: fp@1360: *data = 1; fp@1360: } else { fp@1360: e1000_check_for_link(&adapter->hw); fp@1360: if (adapter->hw.autoneg) /* if auto_neg is set wait for it */ fp@1360: msleep(4000); fp@1360: fp@1360: if (!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) { fp@1360: *data = 1; fp@1360: } fp@1360: } fp@1360: return *data; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_get_sset_count(struct net_device *netdev, int sset) fp@1360: { fp@1360: switch (sset) { fp@1360: case ETH_SS_TEST: fp@1360: return E1000_TEST_LEN; fp@1360: case ETH_SS_STATS: fp@1360: return E1000_STATS_LEN; fp@1360: default: fp@1360: return -EOPNOTSUPP; fp@1360: } fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_diag_test(struct net_device *netdev, fp@1360: struct ethtool_test *eth_test, u64 *data) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: bool if_running; fp@1360: fp@1360: if (adapter->ecdev) fp@1360: return; fp@1360: fp@1360: if_running = netif_running(netdev); fp@1360: fp@1360: set_bit(__E1000_TESTING, &adapter->flags); fp@1360: if (eth_test->flags == ETH_TEST_FL_OFFLINE) { fp@1360: /* Offline tests */ fp@1360: fp@1360: /* save speed, duplex, autoneg settings */ fp@1360: u16 autoneg_advertised = adapter->hw.autoneg_advertised; fp@1360: u8 forced_speed_duplex = adapter->hw.forced_speed_duplex; fp@1360: u8 autoneg = adapter->hw.autoneg; fp@1360: fp@1360: DPRINTK(HW, INFO, "offline testing starting\n"); fp@1360: fp@1360: /* Link test performed before hardware reset so autoneg doesn't fp@1360: * interfere with test result */ fp@1360: if (e1000_link_test(adapter, &data[4])) fp@1360: eth_test->flags |= ETH_TEST_FL_FAILED; fp@1360: fp@1360: if (if_running) fp@1360: /* indicate we're in test mode */ fp@1360: dev_close(netdev); fp@1360: else fp@1360: e1000_reset(adapter); fp@1360: fp@1360: if (e1000_reg_test(adapter, &data[0])) fp@1360: eth_test->flags |= ETH_TEST_FL_FAILED; fp@1360: fp@1360: e1000_reset(adapter); fp@1360: if (e1000_eeprom_test(adapter, &data[1])) fp@1360: eth_test->flags |= ETH_TEST_FL_FAILED; fp@1360: fp@1360: e1000_reset(adapter); fp@1360: if (e1000_intr_test(adapter, &data[2])) fp@1360: eth_test->flags |= ETH_TEST_FL_FAILED; fp@1360: fp@1360: e1000_reset(adapter); fp@1360: /* make sure the phy is powered up */ fp@1360: e1000_power_up_phy(adapter); fp@1360: if (e1000_loopback_test(adapter, &data[3])) fp@1360: eth_test->flags |= ETH_TEST_FL_FAILED; fp@1360: fp@1360: /* restore speed, duplex, autoneg settings */ fp@1360: adapter->hw.autoneg_advertised = autoneg_advertised; fp@1360: adapter->hw.forced_speed_duplex = forced_speed_duplex; fp@1360: adapter->hw.autoneg = autoneg; fp@1360: fp@1360: e1000_reset(adapter); fp@1360: clear_bit(__E1000_TESTING, &adapter->flags); fp@1360: if (if_running) fp@1360: dev_open(netdev); fp@1360: } else { fp@1360: DPRINTK(HW, INFO, "online testing starting\n"); fp@1360: /* Online tests */ fp@1360: if (e1000_link_test(adapter, &data[4])) fp@1360: eth_test->flags |= ETH_TEST_FL_FAILED; fp@1360: fp@1360: /* Online tests aren't run; pass by default */ fp@1360: data[0] = 0; fp@1360: data[1] = 0; fp@1360: data[2] = 0; fp@1360: data[3] = 0; fp@1360: fp@1360: clear_bit(__E1000_TESTING, &adapter->flags); fp@1360: } fp@1360: msleep_interruptible(4 * 1000); fp@1360: } fp@1360: fp@1360: static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wolinfo *wol) fp@1360: { fp@1360: struct e1000_hw *hw = &adapter->hw; fp@1360: int retval = 1; /* fail by default */ fp@1360: fp@1360: switch (hw->device_id) { fp@1360: case E1000_DEV_ID_82542: fp@1360: case E1000_DEV_ID_82543GC_FIBER: fp@1360: case E1000_DEV_ID_82543GC_COPPER: fp@1360: case E1000_DEV_ID_82544EI_FIBER: fp@1360: case E1000_DEV_ID_82546EB_QUAD_COPPER: fp@1360: case E1000_DEV_ID_82545EM_FIBER: fp@1360: case E1000_DEV_ID_82545EM_COPPER: fp@1360: case E1000_DEV_ID_82546GB_QUAD_COPPER: fp@1360: case E1000_DEV_ID_82546GB_PCIE: fp@1360: case E1000_DEV_ID_82571EB_SERDES_QUAD: fp@1360: /* these don't support WoL at all */ fp@1360: wol->supported = 0; fp@1360: break; fp@1360: case E1000_DEV_ID_82546EB_FIBER: fp@1360: case E1000_DEV_ID_82546GB_FIBER: fp@1360: case E1000_DEV_ID_82571EB_FIBER: fp@1360: case E1000_DEV_ID_82571EB_SERDES: fp@1360: case E1000_DEV_ID_82571EB_COPPER: fp@1360: /* Wake events not supported on port B */ fp@1360: if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) { fp@1360: wol->supported = 0; fp@1360: break; fp@1360: } fp@1360: /* return success for non excluded adapter ports */ fp@1360: retval = 0; fp@1360: break; fp@1360: case E1000_DEV_ID_82571EB_QUAD_COPPER: fp@1360: case E1000_DEV_ID_82571EB_QUAD_FIBER: fp@1360: case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: fp@1360: case E1000_DEV_ID_82571PT_QUAD_COPPER: fp@1360: case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: fp@1360: /* quad port adapters only support WoL on port A */ fp@1360: if (!adapter->quad_port_a) { fp@1360: wol->supported = 0; fp@1360: break; fp@1360: } fp@1360: /* return success for non excluded adapter ports */ fp@1360: retval = 0; fp@1360: break; fp@1360: default: fp@1360: /* dual port cards only support WoL on port A from now on fp@1360: * unless it was enabled in the eeprom for port B fp@1360: * so exclude FUNC_1 ports from having WoL enabled */ fp@1360: if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1 && fp@1360: !adapter->eeprom_wol) { fp@1360: wol->supported = 0; fp@1360: break; fp@1360: } fp@1360: fp@1360: retval = 0; fp@1360: } fp@1360: fp@1360: return retval; fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: fp@1360: wol->supported = WAKE_UCAST | WAKE_MCAST | fp@1360: WAKE_BCAST | WAKE_MAGIC; fp@1360: wol->wolopts = 0; fp@1360: fp@1360: /* this function will set ->supported = 0 and return 1 if wol is not fp@1360: * supported by this hardware */ fp@1360: if (e1000_wol_exclusion(adapter, wol)) fp@1360: return; fp@1360: fp@1360: /* apply any specific unsupported masks here */ fp@1360: switch (adapter->hw.device_id) { fp@1360: case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: fp@1360: /* KSP3 does not suppport UCAST wake-ups */ fp@1360: wol->supported &= ~WAKE_UCAST; fp@1360: fp@1360: if (adapter->wol & E1000_WUFC_EX) fp@1360: DPRINTK(DRV, ERR, "Interface does not support " fp@1360: "directed (unicast) frame wake-up packets\n"); fp@1360: break; fp@1360: default: fp@1360: break; fp@1360: } fp@1360: fp@1360: if (adapter->wol & E1000_WUFC_EX) fp@1360: wol->wolopts |= WAKE_UCAST; fp@1360: if (adapter->wol & E1000_WUFC_MC) fp@1360: wol->wolopts |= WAKE_MCAST; fp@1360: if (adapter->wol & E1000_WUFC_BC) fp@1360: wol->wolopts |= WAKE_BCAST; fp@1360: if (adapter->wol & E1000_WUFC_MAG) fp@1360: wol->wolopts |= WAKE_MAGIC; fp@1360: fp@1360: return; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: struct e1000_hw *hw = &adapter->hw; fp@1360: fp@1360: if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) fp@1360: return -EOPNOTSUPP; fp@1360: fp@1360: if (e1000_wol_exclusion(adapter, wol)) fp@1360: return wol->wolopts ? -EOPNOTSUPP : 0; fp@1360: fp@1360: switch (hw->device_id) { fp@1360: case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: fp@1360: if (wol->wolopts & WAKE_UCAST) { fp@1360: DPRINTK(DRV, ERR, "Interface does not support " fp@1360: "directed (unicast) frame wake-up packets\n"); fp@1360: return -EOPNOTSUPP; fp@1360: } fp@1360: break; fp@1360: default: fp@1360: break; fp@1360: } fp@1360: fp@1360: /* these settings will always override what we currently have */ fp@1360: adapter->wol = 0; fp@1360: fp@1360: if (wol->wolopts & WAKE_UCAST) fp@1360: adapter->wol |= E1000_WUFC_EX; fp@1360: if (wol->wolopts & WAKE_MCAST) fp@1360: adapter->wol |= E1000_WUFC_MC; fp@1360: if (wol->wolopts & WAKE_BCAST) fp@1360: adapter->wol |= E1000_WUFC_BC; fp@1360: if (wol->wolopts & WAKE_MAGIC) fp@1360: adapter->wol |= E1000_WUFC_MAG; fp@1360: fp@1360: return 0; fp@1360: } fp@1360: fp@1360: /* toggle LED 4 times per second = 2 "blinks" per second */ fp@1360: #define E1000_ID_INTERVAL (HZ/4) fp@1360: fp@1360: /* bit defines for adapter->led_status */ fp@1360: #define E1000_LED_ON 0 fp@1360: fp@1360: static void fp@1360: e1000_led_blink_callback(unsigned long data) fp@1360: { fp@1360: struct e1000_adapter *adapter = (struct e1000_adapter *) data; fp@1360: fp@1360: if (test_and_change_bit(E1000_LED_ON, &adapter->led_status)) fp@1360: e1000_led_off(&adapter->hw); fp@1360: else fp@1360: e1000_led_on(&adapter->hw); fp@1360: fp@1360: mod_timer(&adapter->blink_timer, jiffies + E1000_ID_INTERVAL); fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_phys_id(struct net_device *netdev, u32 data) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: fp@1360: if (!data) fp@1360: data = INT_MAX; fp@1360: fp@1360: if (adapter->hw.mac_type < e1000_82571) { fp@1360: if (!adapter->blink_timer.function) { fp@1360: init_timer(&adapter->blink_timer); fp@1360: adapter->blink_timer.function = e1000_led_blink_callback; fp@1360: adapter->blink_timer.data = (unsigned long) adapter; fp@1360: } fp@1360: e1000_setup_led(&adapter->hw); fp@1360: mod_timer(&adapter->blink_timer, jiffies); fp@1360: msleep_interruptible(data * 1000); fp@1360: del_timer_sync(&adapter->blink_timer); fp@1360: } else if (adapter->hw.phy_type == e1000_phy_ife) { fp@1360: if (!adapter->blink_timer.function) { fp@1360: init_timer(&adapter->blink_timer); fp@1360: adapter->blink_timer.function = e1000_led_blink_callback; fp@1360: adapter->blink_timer.data = (unsigned long) adapter; fp@1360: } fp@1360: mod_timer(&adapter->blink_timer, jiffies); fp@1360: msleep_interruptible(data * 1000); fp@1360: del_timer_sync(&adapter->blink_timer); fp@1360: e1000_write_phy_reg(&(adapter->hw), IFE_PHY_SPECIAL_CONTROL_LED, 0); fp@1360: } else { fp@1360: e1000_blink_led_start(&adapter->hw); fp@1360: msleep_interruptible(data * 1000); fp@1360: } fp@1360: fp@1360: e1000_led_off(&adapter->hw); fp@1360: clear_bit(E1000_LED_ON, &adapter->led_status); fp@1360: e1000_cleanup_led(&adapter->hw); fp@1360: fp@1360: return 0; fp@1360: } fp@1360: fp@1360: static int fp@1360: e1000_nway_reset(struct net_device *netdev) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: fp@1360: if (adapter->ecdev) fp@1360: return -EBUSY; fp@1360: fp@1360: if (netif_running(netdev)) fp@1360: e1000_reinit_locked(adapter); fp@1360: return 0; fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_get_ethtool_stats(struct net_device *netdev, fp@1360: struct ethtool_stats *stats, u64 *data) fp@1360: { fp@1360: struct e1000_adapter *adapter = netdev_priv(netdev); fp@1360: int i; fp@1360: fp@1360: e1000_update_stats(adapter); fp@1360: for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { fp@1360: char *p = (char *)adapter+e1000_gstrings_stats[i].stat_offset; fp@1360: data[i] = (e1000_gstrings_stats[i].sizeof_stat == fp@1360: sizeof(u64)) ? *(u64 *)p : *(u32 *)p; fp@1360: } fp@1360: /* BUG_ON(i != E1000_STATS_LEN); */ fp@1360: } fp@1360: fp@1360: static void fp@1360: e1000_get_strings(struct net_device *netdev, u32 stringset, u8 *data) fp@1360: { fp@1360: u8 *p = data; fp@1360: int i; fp@1360: fp@1360: switch (stringset) { fp@1360: case ETH_SS_TEST: fp@1360: memcpy(data, *e1000_gstrings_test, fp@1360: sizeof(e1000_gstrings_test)); fp@1360: break; fp@1360: case ETH_SS_STATS: fp@1360: for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { fp@1360: memcpy(p, e1000_gstrings_stats[i].stat_string, fp@1360: ETH_GSTRING_LEN); fp@1360: p += ETH_GSTRING_LEN; fp@1360: } fp@1360: /* BUG_ON(p - data != E1000_STATS_LEN * ETH_GSTRING_LEN); */ fp@1360: break; fp@1360: } fp@1360: } fp@1360: fp@1360: static const struct ethtool_ops e1000_ethtool_ops = { fp@1360: .get_settings = e1000_get_settings, fp@1360: .set_settings = e1000_set_settings, fp@1360: .get_drvinfo = e1000_get_drvinfo, fp@1360: .get_regs_len = e1000_get_regs_len, fp@1360: .get_regs = e1000_get_regs, fp@1360: .get_wol = e1000_get_wol, fp@1360: .set_wol = e1000_set_wol, fp@1360: .get_msglevel = e1000_get_msglevel, fp@1360: .set_msglevel = e1000_set_msglevel, fp@1360: .nway_reset = e1000_nway_reset, fp@1360: .get_link = ethtool_op_get_link, fp@1360: .get_eeprom_len = e1000_get_eeprom_len, fp@1360: .get_eeprom = e1000_get_eeprom, fp@1360: .set_eeprom = e1000_set_eeprom, fp@1360: .get_ringparam = e1000_get_ringparam, fp@1360: .set_ringparam = e1000_set_ringparam, fp@1360: .get_pauseparam = e1000_get_pauseparam, fp@1360: .set_pauseparam = e1000_set_pauseparam, fp@1360: .get_rx_csum = e1000_get_rx_csum, fp@1360: .set_rx_csum = e1000_set_rx_csum, fp@1360: .get_tx_csum = e1000_get_tx_csum, fp@1360: .set_tx_csum = e1000_set_tx_csum, fp@1360: .set_sg = ethtool_op_set_sg, fp@1360: .set_tso = e1000_set_tso, fp@1360: .self_test = e1000_diag_test, fp@1360: .get_strings = e1000_get_strings, fp@1360: .phys_id = e1000_phys_id, fp@1360: .get_ethtool_stats = e1000_get_ethtool_stats, fp@1360: .get_sset_count = e1000_get_sset_count, fp@1360: }; fp@1360: fp@1360: void e1000_set_ethtool_ops(struct net_device *netdev) fp@1360: { fp@1360: SET_ETHTOOL_OPS(netdev, &e1000_ethtool_ops); fp@1360: }