diff options
Diffstat (limited to 'drivers/net/e1000/e1000_ethtool.c')
-rw-r--r-- | drivers/net/e1000/e1000_ethtool.c | 110 |
1 files changed, 48 insertions, 62 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 5cedc81786e3..ecccca35c6f4 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -32,19 +32,6 @@ | |||
32 | 32 | ||
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | 34 | ||
35 | extern char e1000_driver_name[]; | ||
36 | extern char e1000_driver_version[]; | ||
37 | |||
38 | extern int e1000_up(struct e1000_adapter *adapter); | ||
39 | extern void e1000_down(struct e1000_adapter *adapter); | ||
40 | extern void e1000_reset(struct e1000_adapter *adapter); | ||
41 | extern int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx); | ||
42 | extern int e1000_setup_all_rx_resources(struct e1000_adapter *adapter); | ||
43 | extern int e1000_setup_all_tx_resources(struct e1000_adapter *adapter); | ||
44 | extern void e1000_free_all_rx_resources(struct e1000_adapter *adapter); | ||
45 | extern void e1000_free_all_tx_resources(struct e1000_adapter *adapter); | ||
46 | extern void e1000_update_stats(struct e1000_adapter *adapter); | ||
47 | |||
48 | struct e1000_stats { | 35 | struct e1000_stats { |
49 | char stat_string[ETH_GSTRING_LEN]; | 36 | char stat_string[ETH_GSTRING_LEN]; |
50 | int sizeof_stat; | 37 | int sizeof_stat; |
@@ -60,7 +47,6 @@ static const struct e1000_stats e1000_gstrings_stats[] = { | |||
60 | { "tx_bytes", E1000_STAT(net_stats.tx_bytes) }, | 47 | { "tx_bytes", E1000_STAT(net_stats.tx_bytes) }, |
61 | { "rx_errors", E1000_STAT(net_stats.rx_errors) }, | 48 | { "rx_errors", E1000_STAT(net_stats.rx_errors) }, |
62 | { "tx_errors", E1000_STAT(net_stats.tx_errors) }, | 49 | { "tx_errors", E1000_STAT(net_stats.tx_errors) }, |
63 | { "rx_dropped", E1000_STAT(net_stats.rx_dropped) }, | ||
64 | { "tx_dropped", E1000_STAT(net_stats.tx_dropped) }, | 50 | { "tx_dropped", E1000_STAT(net_stats.tx_dropped) }, |
65 | { "multicast", E1000_STAT(net_stats.multicast) }, | 51 | { "multicast", E1000_STAT(net_stats.multicast) }, |
66 | { "collisions", E1000_STAT(net_stats.collisions) }, | 52 | { "collisions", E1000_STAT(net_stats.collisions) }, |
@@ -68,7 +54,6 @@ static const struct e1000_stats e1000_gstrings_stats[] = { | |||
68 | { "rx_over_errors", E1000_STAT(net_stats.rx_over_errors) }, | 54 | { "rx_over_errors", E1000_STAT(net_stats.rx_over_errors) }, |
69 | { "rx_crc_errors", E1000_STAT(net_stats.rx_crc_errors) }, | 55 | { "rx_crc_errors", E1000_STAT(net_stats.rx_crc_errors) }, |
70 | { "rx_frame_errors", E1000_STAT(net_stats.rx_frame_errors) }, | 56 | { "rx_frame_errors", E1000_STAT(net_stats.rx_frame_errors) }, |
71 | { "rx_fifo_errors", E1000_STAT(net_stats.rx_fifo_errors) }, | ||
72 | { "rx_no_buffer_count", E1000_STAT(stats.rnbc) }, | 57 | { "rx_no_buffer_count", E1000_STAT(stats.rnbc) }, |
73 | { "rx_missed_errors", E1000_STAT(net_stats.rx_missed_errors) }, | 58 | { "rx_missed_errors", E1000_STAT(net_stats.rx_missed_errors) }, |
74 | { "tx_aborted_errors", E1000_STAT(net_stats.tx_aborted_errors) }, | 59 | { "tx_aborted_errors", E1000_STAT(net_stats.tx_aborted_errors) }, |
@@ -97,14 +82,7 @@ static const struct e1000_stats e1000_gstrings_stats[] = { | |||
97 | { "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) }, | 82 | { "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) }, |
98 | }; | 83 | }; |
99 | 84 | ||
100 | #ifdef CONFIG_E1000_MQ | ||
101 | #define E1000_QUEUE_STATS_LEN \ | ||
102 | (((struct e1000_adapter *)netdev->priv)->num_tx_queues + \ | ||
103 | ((struct e1000_adapter *)netdev->priv)->num_rx_queues) \ | ||
104 | * (sizeof(struct e1000_queue_stats) / sizeof(uint64_t)) | ||
105 | #else | ||
106 | #define E1000_QUEUE_STATS_LEN 0 | 85 | #define E1000_QUEUE_STATS_LEN 0 |
107 | #endif | ||
108 | #define E1000_GLOBAL_STATS_LEN \ | 86 | #define E1000_GLOBAL_STATS_LEN \ |
109 | sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats) | 87 | sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats) |
110 | #define E1000_STATS_LEN (E1000_GLOBAL_STATS_LEN + E1000_QUEUE_STATS_LEN) | 88 | #define E1000_STATS_LEN (E1000_GLOBAL_STATS_LEN + E1000_QUEUE_STATS_LEN) |
@@ -346,6 +324,9 @@ e1000_set_tso(struct net_device *netdev, uint32_t data) | |||
346 | netdev->features |= NETIF_F_TSO; | 324 | netdev->features |= NETIF_F_TSO; |
347 | else | 325 | else |
348 | netdev->features &= ~NETIF_F_TSO; | 326 | netdev->features &= ~NETIF_F_TSO; |
327 | |||
328 | DPRINTK(PROBE, INFO, "TSO is %s\n", data ? "Enabled" : "Disabled"); | ||
329 | adapter->tso_force = TRUE; | ||
349 | return 0; | 330 | return 0; |
350 | } | 331 | } |
351 | #endif /* NETIF_F_TSO */ | 332 | #endif /* NETIF_F_TSO */ |
@@ -594,6 +575,7 @@ e1000_get_drvinfo(struct net_device *netdev, | |||
594 | case e1000_82571: | 575 | case e1000_82571: |
595 | case e1000_82572: | 576 | case e1000_82572: |
596 | case e1000_82573: | 577 | case e1000_82573: |
578 | case e1000_80003es2lan: | ||
597 | sprintf(firmware_version, "%d.%d-%d", | 579 | sprintf(firmware_version, "%d.%d-%d", |
598 | (eeprom_data & 0xF000) >> 12, | 580 | (eeprom_data & 0xF000) >> 12, |
599 | (eeprom_data & 0x0FF0) >> 4, | 581 | (eeprom_data & 0x0FF0) >> 4, |
@@ -642,6 +624,9 @@ e1000_set_ringparam(struct net_device *netdev, | |||
642 | struct e1000_rx_ring *rxdr, *rx_old, *rx_new; | 624 | struct e1000_rx_ring *rxdr, *rx_old, *rx_new; |
643 | int i, err, tx_ring_size, rx_ring_size; | 625 | int i, err, tx_ring_size, rx_ring_size; |
644 | 626 | ||
627 | if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) | ||
628 | return -EINVAL; | ||
629 | |||
645 | tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_tx_queues; | 630 | tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_tx_queues; |
646 | rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_rx_queues; | 631 | rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_rx_queues; |
647 | 632 | ||
@@ -669,9 +654,6 @@ e1000_set_ringparam(struct net_device *netdev, | |||
669 | txdr = adapter->tx_ring; | 654 | txdr = adapter->tx_ring; |
670 | rxdr = adapter->rx_ring; | 655 | rxdr = adapter->rx_ring; |
671 | 656 | ||
672 | if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) | ||
673 | return -EINVAL; | ||
674 | |||
675 | rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD); | 657 | rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD); |
676 | rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ? | 658 | rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ? |
677 | E1000_MAX_RXD : E1000_MAX_82544_RXD)); | 659 | E1000_MAX_RXD : E1000_MAX_82544_RXD)); |
@@ -767,6 +749,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) | |||
767 | /* there are several bits on newer hardware that are r/w */ | 749 | /* there are several bits on newer hardware that are r/w */ |
768 | case e1000_82571: | 750 | case e1000_82571: |
769 | case e1000_82572: | 751 | case e1000_82572: |
752 | case e1000_80003es2lan: | ||
770 | toggle = 0x7FFFF3FF; | 753 | toggle = 0x7FFFF3FF; |
771 | break; | 754 | break; |
772 | case e1000_82573: | 755 | case e1000_82573: |
@@ -1256,6 +1239,10 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1256 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x9140); | 1239 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x9140); |
1257 | /* autoneg off */ | 1240 | /* autoneg off */ |
1258 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x8140); | 1241 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x8140); |
1242 | } else if (adapter->hw.phy_type == e1000_phy_gg82563) { | ||
1243 | e1000_write_phy_reg(&adapter->hw, | ||
1244 | GG82563_PHY_KMRN_MODE_CTRL, | ||
1245 | 0x1CE); | ||
1259 | } | 1246 | } |
1260 | /* force 1000, set loopback */ | 1247 | /* force 1000, set loopback */ |
1261 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x4140); | 1248 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x4140); |
@@ -1325,6 +1312,7 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter) | |||
1325 | case e1000_82571: | 1312 | case e1000_82571: |
1326 | case e1000_82572: | 1313 | case e1000_82572: |
1327 | case e1000_82573: | 1314 | case e1000_82573: |
1315 | case e1000_80003es2lan: | ||
1328 | return e1000_integrated_phy_loopback(adapter); | 1316 | return e1000_integrated_phy_loopback(adapter); |
1329 | break; | 1317 | break; |
1330 | 1318 | ||
@@ -1405,6 +1393,11 @@ e1000_loopback_cleanup(struct e1000_adapter *adapter) | |||
1405 | case e1000_82546_rev_3: | 1393 | case e1000_82546_rev_3: |
1406 | default: | 1394 | default: |
1407 | hw->autoneg = TRUE; | 1395 | hw->autoneg = TRUE; |
1396 | if (hw->phy_type == e1000_phy_gg82563) { | ||
1397 | e1000_write_phy_reg(hw, | ||
1398 | GG82563_PHY_KMRN_MODE_CTRL, | ||
1399 | 0x180); | ||
1400 | } | ||
1408 | e1000_read_phy_reg(hw, PHY_CTRL, &phy_reg); | 1401 | e1000_read_phy_reg(hw, PHY_CTRL, &phy_reg); |
1409 | if (phy_reg & MII_CR_LOOPBACK) { | 1402 | if (phy_reg & MII_CR_LOOPBACK) { |
1410 | phy_reg &= ~MII_CR_LOOPBACK; | 1403 | phy_reg &= ~MII_CR_LOOPBACK; |
@@ -1640,10 +1633,26 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1640 | case E1000_DEV_ID_82546EB_QUAD_COPPER: | 1633 | case E1000_DEV_ID_82546EB_QUAD_COPPER: |
1641 | case E1000_DEV_ID_82545EM_FIBER: | 1634 | case E1000_DEV_ID_82545EM_FIBER: |
1642 | case E1000_DEV_ID_82545EM_COPPER: | 1635 | case E1000_DEV_ID_82545EM_COPPER: |
1636 | case E1000_DEV_ID_82546GB_QUAD_COPPER: | ||
1643 | wol->supported = 0; | 1637 | wol->supported = 0; |
1644 | wol->wolopts = 0; | 1638 | wol->wolopts = 0; |
1645 | return; | 1639 | return; |
1646 | 1640 | ||
1641 | case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: | ||
1642 | /* device id 10B5 port-A supports wol */ | ||
1643 | if (!adapter->ksp3_port_a) { | ||
1644 | wol->supported = 0; | ||
1645 | return; | ||
1646 | } | ||
1647 | /* KSP3 does not suppport UCAST wake-ups for any interface */ | ||
1648 | wol->supported = WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC; | ||
1649 | |||
1650 | if (adapter->wol & E1000_WUFC_EX) | ||
1651 | DPRINTK(DRV, ERR, "Interface does not support " | ||
1652 | "directed (unicast) frame wake-up packets\n"); | ||
1653 | wol->wolopts = 0; | ||
1654 | goto do_defaults; | ||
1655 | |||
1647 | case E1000_DEV_ID_82546EB_FIBER: | 1656 | case E1000_DEV_ID_82546EB_FIBER: |
1648 | case E1000_DEV_ID_82546GB_FIBER: | 1657 | case E1000_DEV_ID_82546GB_FIBER: |
1649 | case E1000_DEV_ID_82571EB_FIBER: | 1658 | case E1000_DEV_ID_82571EB_FIBER: |
@@ -1658,8 +1667,9 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1658 | default: | 1667 | default: |
1659 | wol->supported = WAKE_UCAST | WAKE_MCAST | | 1668 | wol->supported = WAKE_UCAST | WAKE_MCAST | |
1660 | WAKE_BCAST | WAKE_MAGIC; | 1669 | WAKE_BCAST | WAKE_MAGIC; |
1661 | |||
1662 | wol->wolopts = 0; | 1670 | wol->wolopts = 0; |
1671 | |||
1672 | do_defaults: | ||
1663 | if (adapter->wol & E1000_WUFC_EX) | 1673 | if (adapter->wol & E1000_WUFC_EX) |
1664 | wol->wolopts |= WAKE_UCAST; | 1674 | wol->wolopts |= WAKE_UCAST; |
1665 | if (adapter->wol & E1000_WUFC_MC) | 1675 | if (adapter->wol & E1000_WUFC_MC) |
@@ -1684,10 +1694,22 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1684 | case E1000_DEV_ID_82543GC_COPPER: | 1694 | case E1000_DEV_ID_82543GC_COPPER: |
1685 | case E1000_DEV_ID_82544EI_FIBER: | 1695 | case E1000_DEV_ID_82544EI_FIBER: |
1686 | case E1000_DEV_ID_82546EB_QUAD_COPPER: | 1696 | case E1000_DEV_ID_82546EB_QUAD_COPPER: |
1697 | case E1000_DEV_ID_82546GB_QUAD_COPPER: | ||
1687 | case E1000_DEV_ID_82545EM_FIBER: | 1698 | case E1000_DEV_ID_82545EM_FIBER: |
1688 | case E1000_DEV_ID_82545EM_COPPER: | 1699 | case E1000_DEV_ID_82545EM_COPPER: |
1689 | return wol->wolopts ? -EOPNOTSUPP : 0; | 1700 | return wol->wolopts ? -EOPNOTSUPP : 0; |
1690 | 1701 | ||
1702 | case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: | ||
1703 | /* device id 10B5 port-A supports wol */ | ||
1704 | if (!adapter->ksp3_port_a) | ||
1705 | return wol->wolopts ? -EOPNOTSUPP : 0; | ||
1706 | |||
1707 | if (wol->wolopts & WAKE_UCAST) { | ||
1708 | DPRINTK(DRV, ERR, "Interface does not support " | ||
1709 | "directed (unicast) frame wake-up packets\n"); | ||
1710 | return -EOPNOTSUPP; | ||
1711 | } | ||
1712 | |||
1691 | case E1000_DEV_ID_82546EB_FIBER: | 1713 | case E1000_DEV_ID_82546EB_FIBER: |
1692 | case E1000_DEV_ID_82546GB_FIBER: | 1714 | case E1000_DEV_ID_82546GB_FIBER: |
1693 | case E1000_DEV_ID_82571EB_FIBER: | 1715 | case E1000_DEV_ID_82571EB_FIBER: |
@@ -1799,11 +1821,6 @@ e1000_get_ethtool_stats(struct net_device *netdev, | |||
1799 | struct ethtool_stats *stats, uint64_t *data) | 1821 | struct ethtool_stats *stats, uint64_t *data) |
1800 | { | 1822 | { |
1801 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1823 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1802 | #ifdef CONFIG_E1000_MQ | ||
1803 | uint64_t *queue_stat; | ||
1804 | int stat_count = sizeof(struct e1000_queue_stats) / sizeof(uint64_t); | ||
1805 | int j, k; | ||
1806 | #endif | ||
1807 | int i; | 1824 | int i; |
1808 | 1825 | ||
1809 | e1000_update_stats(adapter); | 1826 | e1000_update_stats(adapter); |
@@ -1812,29 +1829,12 @@ e1000_get_ethtool_stats(struct net_device *netdev, | |||
1812 | data[i] = (e1000_gstrings_stats[i].sizeof_stat == | 1829 | data[i] = (e1000_gstrings_stats[i].sizeof_stat == |
1813 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; | 1830 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; |
1814 | } | 1831 | } |
1815 | #ifdef CONFIG_E1000_MQ | ||
1816 | for (j = 0; j < adapter->num_tx_queues; j++) { | ||
1817 | queue_stat = (uint64_t *)&adapter->tx_ring[j].tx_stats; | ||
1818 | for (k = 0; k < stat_count; k++) | ||
1819 | data[i + k] = queue_stat[k]; | ||
1820 | i += k; | ||
1821 | } | ||
1822 | for (j = 0; j < adapter->num_rx_queues; j++) { | ||
1823 | queue_stat = (uint64_t *)&adapter->rx_ring[j].rx_stats; | ||
1824 | for (k = 0; k < stat_count; k++) | ||
1825 | data[i + k] = queue_stat[k]; | ||
1826 | i += k; | ||
1827 | } | ||
1828 | #endif | ||
1829 | /* BUG_ON(i != E1000_STATS_LEN); */ | 1832 | /* BUG_ON(i != E1000_STATS_LEN); */ |
1830 | } | 1833 | } |
1831 | 1834 | ||
1832 | static void | 1835 | static void |
1833 | e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) | 1836 | e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) |
1834 | { | 1837 | { |
1835 | #ifdef CONFIG_E1000_MQ | ||
1836 | struct e1000_adapter *adapter = netdev_priv(netdev); | ||
1837 | #endif | ||
1838 | uint8_t *p = data; | 1838 | uint8_t *p = data; |
1839 | int i; | 1839 | int i; |
1840 | 1840 | ||
@@ -1849,20 +1849,6 @@ e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) | |||
1849 | ETH_GSTRING_LEN); | 1849 | ETH_GSTRING_LEN); |
1850 | p += ETH_GSTRING_LEN; | 1850 | p += ETH_GSTRING_LEN; |
1851 | } | 1851 | } |
1852 | #ifdef CONFIG_E1000_MQ | ||
1853 | for (i = 0; i < adapter->num_tx_queues; i++) { | ||
1854 | sprintf(p, "tx_queue_%u_packets", i); | ||
1855 | p += ETH_GSTRING_LEN; | ||
1856 | sprintf(p, "tx_queue_%u_bytes", i); | ||
1857 | p += ETH_GSTRING_LEN; | ||
1858 | } | ||
1859 | for (i = 0; i < adapter->num_rx_queues; i++) { | ||
1860 | sprintf(p, "rx_queue_%u_packets", i); | ||
1861 | p += ETH_GSTRING_LEN; | ||
1862 | sprintf(p, "rx_queue_%u_bytes", i); | ||
1863 | p += ETH_GSTRING_LEN; | ||
1864 | } | ||
1865 | #endif | ||
1866 | /* BUG_ON(p - data != E1000_STATS_LEN * ETH_GSTRING_LEN); */ | 1852 | /* BUG_ON(p - data != E1000_STATS_LEN * ETH_GSTRING_LEN); */ |
1867 | break; | 1853 | break; |
1868 | } | 1854 | } |