diff options
author | Shahed Shaikh <shahed.shaikh@qlogic.com> | 2014-01-09 12:41:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-10 13:25:29 -0500 |
commit | d6e9c89a8d3cf0a5184badbcd50169179af27721 (patch) | |
tree | 969390a2222d317eed63b62ca07e76f103bc2c2a /drivers/net/ethernet | |
parent | 1ac6762a0b8f5f2dc35ea869a08da25c68d7a8ba (diff) |
qlcnic: Fix ethtool statistics length calculation
o Consider number of Tx queues while calculating the length of
Tx statistics as part of ethtool stats.
o Calculate statistics lenght properly for 82xx and 83xx adapter
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 7b36340a1b34..6b08194aa0d4 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -167,27 +167,35 @@ static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = { | |||
167 | 167 | ||
168 | #define QLCNIC_TEST_LEN ARRAY_SIZE(qlcnic_gstrings_test) | 168 | #define QLCNIC_TEST_LEN ARRAY_SIZE(qlcnic_gstrings_test) |
169 | 169 | ||
170 | static inline int qlcnic_82xx_statistics(void) | 170 | static inline int qlcnic_82xx_statistics(struct qlcnic_adapter *adapter) |
171 | { | 171 | { |
172 | return ARRAY_SIZE(qlcnic_device_gstrings_stats) + | 172 | return ARRAY_SIZE(qlcnic_gstrings_stats) + |
173 | ARRAY_SIZE(qlcnic_83xx_mac_stats_strings); | 173 | ARRAY_SIZE(qlcnic_83xx_mac_stats_strings) + |
174 | QLCNIC_TX_STATS_LEN * adapter->drv_tx_rings; | ||
174 | } | 175 | } |
175 | 176 | ||
176 | static inline int qlcnic_83xx_statistics(void) | 177 | static inline int qlcnic_83xx_statistics(struct qlcnic_adapter *adapter) |
177 | { | 178 | { |
178 | return ARRAY_SIZE(qlcnic_83xx_tx_stats_strings) + | 179 | return ARRAY_SIZE(qlcnic_gstrings_stats) + |
180 | ARRAY_SIZE(qlcnic_83xx_tx_stats_strings) + | ||
179 | ARRAY_SIZE(qlcnic_83xx_mac_stats_strings) + | 181 | ARRAY_SIZE(qlcnic_83xx_mac_stats_strings) + |
180 | ARRAY_SIZE(qlcnic_83xx_rx_stats_strings); | 182 | ARRAY_SIZE(qlcnic_83xx_rx_stats_strings) + |
183 | QLCNIC_TX_STATS_LEN * adapter->drv_tx_rings; | ||
181 | } | 184 | } |
182 | 185 | ||
183 | static int qlcnic_dev_statistics_len(struct qlcnic_adapter *adapter) | 186 | static int qlcnic_dev_statistics_len(struct qlcnic_adapter *adapter) |
184 | { | 187 | { |
185 | if (qlcnic_82xx_check(adapter)) | 188 | int len = -1; |
186 | return qlcnic_82xx_statistics(); | 189 | |
187 | else if (qlcnic_83xx_check(adapter)) | 190 | if (qlcnic_82xx_check(adapter)) { |
188 | return qlcnic_83xx_statistics(); | 191 | len = qlcnic_82xx_statistics(adapter); |
189 | else | 192 | if (adapter->flags & QLCNIC_ESWITCH_ENABLED) |
190 | return -1; | 193 | len += ARRAY_SIZE(qlcnic_device_gstrings_stats); |
194 | } else if (qlcnic_83xx_check(adapter)) { | ||
195 | len = qlcnic_83xx_statistics(adapter); | ||
196 | } | ||
197 | |||
198 | return len; | ||
191 | } | 199 | } |
192 | 200 | ||
193 | #define QLCNIC_TX_INTR_NOT_CONFIGURED 0X78563412 | 201 | #define QLCNIC_TX_INTR_NOT_CONFIGURED 0X78563412 |
@@ -920,18 +928,13 @@ static int qlcnic_eeprom_test(struct net_device *dev) | |||
920 | 928 | ||
921 | static int qlcnic_get_sset_count(struct net_device *dev, int sset) | 929 | static int qlcnic_get_sset_count(struct net_device *dev, int sset) |
922 | { | 930 | { |
923 | int len; | ||
924 | 931 | ||
925 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 932 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
926 | switch (sset) { | 933 | switch (sset) { |
927 | case ETH_SS_TEST: | 934 | case ETH_SS_TEST: |
928 | return QLCNIC_TEST_LEN; | 935 | return QLCNIC_TEST_LEN; |
929 | case ETH_SS_STATS: | 936 | case ETH_SS_STATS: |
930 | len = qlcnic_dev_statistics_len(adapter) + QLCNIC_STATS_LEN; | 937 | return qlcnic_dev_statistics_len(adapter); |
931 | if ((adapter->flags & QLCNIC_ESWITCH_ENABLED) || | ||
932 | qlcnic_83xx_check(adapter)) | ||
933 | return len; | ||
934 | return qlcnic_82xx_statistics(); | ||
935 | default: | 938 | default: |
936 | return -EOPNOTSUPP; | 939 | return -EOPNOTSUPP; |
937 | } | 940 | } |