diff options
author | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2006-01-12 19:50:41 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-17 07:40:11 -0500 |
commit | 7bfa48162d4924e8cc7fb8eccc8c8f66cc111eb4 (patch) | |
tree | 906365b7e1c17f15fa470dbad448cafa3310f011 /drivers/net/e1000/e1000_ethtool.c | |
parent | f56799ea39a85a6f3760a134aa0e6d1c17eea369 (diff) |
[PATCH] e1000: Fix mulitple queues
Fixed stats when using multiple queues.
When multiple queues are enabled, log a message in syslog.
Fixed memory allocation for multiple queues.
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: John Ronciak <john.ronciak@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/e1000/e1000_ethtool.c')
-rw-r--r-- | drivers/net/e1000/e1000_ethtool.c | 65 |
1 files changed, 57 insertions, 8 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index fa9a4659369a..ffdf76b725bc 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -96,8 +96,18 @@ static const struct e1000_stats e1000_gstrings_stats[] = { | |||
96 | { "rx_header_split", E1000_STAT(rx_hdr_split) }, | 96 | { "rx_header_split", E1000_STAT(rx_hdr_split) }, |
97 | { "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) }, | 97 | { "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) }, |
98 | }; | 98 | }; |
99 | #define E1000_STATS_LEN \ | 99 | |
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 | ||
107 | #endif | ||
108 | #define E1000_GLOBAL_STATS_LEN \ | ||
100 | sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats) | 109 | sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats) |
110 | #define E1000_STATS_LEN (E1000_GLOBAL_STATS_LEN + E1000_QUEUE_STATS_LEN) | ||
101 | static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = { | 111 | static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = { |
102 | "Register test (offline)", "Eeprom test (offline)", | 112 | "Register test (offline)", "Eeprom test (offline)", |
103 | "Interrupt test (offline)", "Loopback test (offline)", | 113 | "Interrupt test (offline)", "Loopback test (offline)", |
@@ -1746,19 +1756,43 @@ e1000_get_ethtool_stats(struct net_device *netdev, | |||
1746 | struct ethtool_stats *stats, uint64_t *data) | 1756 | struct ethtool_stats *stats, uint64_t *data) |
1747 | { | 1757 | { |
1748 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1758 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1759 | #ifdef CONFIG_E1000_MQ | ||
1760 | uint64_t *queue_stat; | ||
1761 | int stat_count = sizeof(struct e1000_queue_stats) / sizeof(uint64_t); | ||
1762 | int j, k; | ||
1763 | #endif | ||
1749 | int i; | 1764 | int i; |
1750 | 1765 | ||
1751 | e1000_update_stats(adapter); | 1766 | e1000_update_stats(adapter); |
1752 | for(i = 0; i < E1000_STATS_LEN; i++) { | 1767 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
1753 | char *p = (char *)adapter+e1000_gstrings_stats[i].stat_offset; | 1768 | char *p = (char *)adapter+e1000_gstrings_stats[i].stat_offset; |
1754 | data[i] = (e1000_gstrings_stats[i].sizeof_stat == | 1769 | data[i] = (e1000_gstrings_stats[i].sizeof_stat == |
1755 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; | 1770 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; |
1756 | } | 1771 | } |
1772 | #ifdef CONFIG_E1000_MQ | ||
1773 | for (j = 0; j < adapter->num_tx_queues; j++) { | ||
1774 | queue_stat = (uint64_t *)&adapter->tx_ring[j].tx_stats; | ||
1775 | for (k = 0; k < stat_count; k++) | ||
1776 | data[i + k] = queue_stat[k]; | ||
1777 | i += k; | ||
1778 | } | ||
1779 | for (j = 0; j < adapter->num_rx_queues; j++) { | ||
1780 | queue_stat = (uint64_t *)&adapter->rx_ring[j].rx_stats; | ||
1781 | for (k = 0; k < stat_count; k++) | ||
1782 | data[i + k] = queue_stat[k]; | ||
1783 | i += k; | ||
1784 | } | ||
1785 | #endif | ||
1786 | /* BUG_ON(i != E1000_STATS_LEN); */ | ||
1757 | } | 1787 | } |
1758 | 1788 | ||
1759 | static void | 1789 | static void |
1760 | e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) | 1790 | e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) |
1761 | { | 1791 | { |
1792 | #ifdef CONFIG_E1000_MQ | ||
1793 | struct e1000_adapter *adapter = netdev_priv(netdev); | ||
1794 | #endif | ||
1795 | uint8_t *p = data; | ||
1762 | int i; | 1796 | int i; |
1763 | 1797 | ||
1764 | switch(stringset) { | 1798 | switch(stringset) { |
@@ -1767,11 +1801,26 @@ e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) | |||
1767 | E1000_TEST_LEN*ETH_GSTRING_LEN); | 1801 | E1000_TEST_LEN*ETH_GSTRING_LEN); |
1768 | break; | 1802 | break; |
1769 | case ETH_SS_STATS: | 1803 | case ETH_SS_STATS: |
1770 | for (i=0; i < E1000_STATS_LEN; i++) { | 1804 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
1771 | memcpy(data + i * ETH_GSTRING_LEN, | 1805 | memcpy(p, e1000_gstrings_stats[i].stat_string, |
1772 | e1000_gstrings_stats[i].stat_string, | 1806 | ETH_GSTRING_LEN); |
1773 | ETH_GSTRING_LEN); | 1807 | p += ETH_GSTRING_LEN; |
1808 | } | ||
1809 | #ifdef CONFIG_E1000_MQ | ||
1810 | for (i = 0; i < adapter->num_tx_queues; i++) { | ||
1811 | sprintf(p, "tx_queue_%u_packets", i); | ||
1812 | p += ETH_GSTRING_LEN; | ||
1813 | sprintf(p, "tx_queue_%u_bytes", i); | ||
1814 | p += ETH_GSTRING_LEN; | ||
1774 | } | 1815 | } |
1816 | for (i = 0; i < adapter->num_rx_queues; i++) { | ||
1817 | sprintf(p, "rx_queue_%u_packets", i); | ||
1818 | p += ETH_GSTRING_LEN; | ||
1819 | sprintf(p, "rx_queue_%u_bytes", i); | ||
1820 | p += ETH_GSTRING_LEN; | ||
1821 | } | ||
1822 | #endif | ||
1823 | /* BUG_ON(p - data != E1000_STATS_LEN * ETH_GSTRING_LEN); */ | ||
1775 | break; | 1824 | break; |
1776 | } | 1825 | } |
1777 | } | 1826 | } |