diff options
author | Yuval Mintz <yuvalmin@broadcom.com> | 2012-01-23 02:31:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-01-23 13:58:18 -0500 |
commit | d5e836329bd836d24b168004827532426cad2f39 (patch) | |
tree | d839753a9d3d364f27e23b43ab0e7f07cb4de378 /drivers/net/ethernet | |
parent | 460a25cdaef1a2b6b8e14e371d868aa91b0e72e8 (diff) |
bnx2x: fixed ethtool statistics for MF modes
Previosuly, in MF modes `ethtool -S' lacked some of the statistics
which appeared in non-MF modes. This has been fixed.
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 106 |
1 files changed, 41 insertions, 65 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index f99c6e312a5d..7d32e0059966 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | |||
@@ -2121,18 +2121,16 @@ static int bnx2x_get_sset_count(struct net_device *dev, int stringset) | |||
2121 | case ETH_SS_STATS: | 2121 | case ETH_SS_STATS: |
2122 | if (is_multi(bp)) { | 2122 | if (is_multi(bp)) { |
2123 | num_stats = bnx2x_num_stat_queues(bp) * | 2123 | num_stats = bnx2x_num_stat_queues(bp) * |
2124 | BNX2X_NUM_Q_STATS; | 2124 | BNX2X_NUM_Q_STATS; |
2125 | if (!IS_MF_MODE_STAT(bp)) | 2125 | } else |
2126 | num_stats += BNX2X_NUM_STATS; | 2126 | num_stats = 0; |
2127 | } else { | 2127 | if (IS_MF_MODE_STAT(bp)) { |
2128 | if (IS_MF_MODE_STAT(bp)) { | 2128 | for (i = 0; i < BNX2X_NUM_STATS; i++) |
2129 | num_stats = 0; | 2129 | if (IS_FUNC_STAT(i)) |
2130 | for (i = 0; i < BNX2X_NUM_STATS; i++) | 2130 | num_stats++; |
2131 | if (IS_FUNC_STAT(i)) | 2131 | } else |
2132 | num_stats++; | 2132 | num_stats += BNX2X_NUM_STATS; |
2133 | } else | 2133 | |
2134 | num_stats = BNX2X_NUM_STATS; | ||
2135 | } | ||
2136 | return num_stats; | 2134 | return num_stats; |
2137 | 2135 | ||
2138 | case ETH_SS_TEST: | 2136 | case ETH_SS_TEST: |
@@ -2151,8 +2149,8 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) | |||
2151 | 2149 | ||
2152 | switch (stringset) { | 2150 | switch (stringset) { |
2153 | case ETH_SS_STATS: | 2151 | case ETH_SS_STATS: |
2152 | k = 0; | ||
2154 | if (is_multi(bp)) { | 2153 | if (is_multi(bp)) { |
2155 | k = 0; | ||
2156 | for_each_eth_queue(bp, i) { | 2154 | for_each_eth_queue(bp, i) { |
2157 | memset(queue_name, 0, sizeof(queue_name)); | 2155 | memset(queue_name, 0, sizeof(queue_name)); |
2158 | sprintf(queue_name, "%d", i); | 2156 | sprintf(queue_name, "%d", i); |
@@ -2163,20 +2161,17 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) | |||
2163 | queue_name); | 2161 | queue_name); |
2164 | k += BNX2X_NUM_Q_STATS; | 2162 | k += BNX2X_NUM_Q_STATS; |
2165 | } | 2163 | } |
2166 | if (IS_MF_MODE_STAT(bp)) | ||
2167 | break; | ||
2168 | for (j = 0; j < BNX2X_NUM_STATS; j++) | ||
2169 | strcpy(buf + (k + j)*ETH_GSTRING_LEN, | ||
2170 | bnx2x_stats_arr[j].string); | ||
2171 | } else { | ||
2172 | for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) { | ||
2173 | if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i)) | ||
2174 | continue; | ||
2175 | strcpy(buf + j*ETH_GSTRING_LEN, | ||
2176 | bnx2x_stats_arr[i].string); | ||
2177 | j++; | ||
2178 | } | ||
2179 | } | 2164 | } |
2165 | |||
2166 | |||
2167 | for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) { | ||
2168 | if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i)) | ||
2169 | continue; | ||
2170 | strcpy(buf + (k + j)*ETH_GSTRING_LEN, | ||
2171 | bnx2x_stats_arr[i].string); | ||
2172 | j++; | ||
2173 | } | ||
2174 | |||
2180 | break; | 2175 | break; |
2181 | 2176 | ||
2182 | case ETH_SS_TEST: | 2177 | case ETH_SS_TEST: |
@@ -2190,10 +2185,9 @@ static void bnx2x_get_ethtool_stats(struct net_device *dev, | |||
2190 | { | 2185 | { |
2191 | struct bnx2x *bp = netdev_priv(dev); | 2186 | struct bnx2x *bp = netdev_priv(dev); |
2192 | u32 *hw_stats, *offset; | 2187 | u32 *hw_stats, *offset; |
2193 | int i, j, k; | 2188 | int i, j, k = 0; |
2194 | 2189 | ||
2195 | if (is_multi(bp)) { | 2190 | if (is_multi(bp)) { |
2196 | k = 0; | ||
2197 | for_each_eth_queue(bp, i) { | 2191 | for_each_eth_queue(bp, i) { |
2198 | hw_stats = (u32 *)&bp->fp[i].eth_q_stats; | 2192 | hw_stats = (u32 *)&bp->fp[i].eth_q_stats; |
2199 | for (j = 0; j < BNX2X_NUM_Q_STATS; j++) { | 2193 | for (j = 0; j < BNX2X_NUM_Q_STATS; j++) { |
@@ -2214,46 +2208,28 @@ static void bnx2x_get_ethtool_stats(struct net_device *dev, | |||
2214 | } | 2208 | } |
2215 | k += BNX2X_NUM_Q_STATS; | 2209 | k += BNX2X_NUM_Q_STATS; |
2216 | } | 2210 | } |
2217 | if (IS_MF_MODE_STAT(bp)) | 2211 | } |
2218 | return; | 2212 | |
2219 | hw_stats = (u32 *)&bp->eth_stats; | 2213 | hw_stats = (u32 *)&bp->eth_stats; |
2220 | for (j = 0; j < BNX2X_NUM_STATS; j++) { | 2214 | for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) { |
2221 | if (bnx2x_stats_arr[j].size == 0) { | 2215 | if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i)) |
2222 | /* skip this counter */ | 2216 | continue; |
2223 | buf[k + j] = 0; | 2217 | if (bnx2x_stats_arr[i].size == 0) { |
2224 | continue; | 2218 | /* skip this counter */ |
2225 | } | 2219 | buf[k + j] = 0; |
2226 | offset = (hw_stats + bnx2x_stats_arr[j].offset); | 2220 | j++; |
2227 | if (bnx2x_stats_arr[j].size == 4) { | 2221 | continue; |
2228 | /* 4-byte counter */ | ||
2229 | buf[k + j] = (u64) *offset; | ||
2230 | continue; | ||
2231 | } | ||
2232 | /* 8-byte counter */ | ||
2233 | buf[k + j] = HILO_U64(*offset, *(offset + 1)); | ||
2234 | } | 2222 | } |
2235 | } else { | 2223 | offset = (hw_stats + bnx2x_stats_arr[i].offset); |
2236 | hw_stats = (u32 *)&bp->eth_stats; | 2224 | if (bnx2x_stats_arr[i].size == 4) { |
2237 | for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) { | 2225 | /* 4-byte counter */ |
2238 | if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i)) | 2226 | buf[k + j] = (u64) *offset; |
2239 | continue; | ||
2240 | if (bnx2x_stats_arr[i].size == 0) { | ||
2241 | /* skip this counter */ | ||
2242 | buf[j] = 0; | ||
2243 | j++; | ||
2244 | continue; | ||
2245 | } | ||
2246 | offset = (hw_stats + bnx2x_stats_arr[i].offset); | ||
2247 | if (bnx2x_stats_arr[i].size == 4) { | ||
2248 | /* 4-byte counter */ | ||
2249 | buf[j] = (u64) *offset; | ||
2250 | j++; | ||
2251 | continue; | ||
2252 | } | ||
2253 | /* 8-byte counter */ | ||
2254 | buf[j] = HILO_U64(*offset, *(offset + 1)); | ||
2255 | j++; | 2227 | j++; |
2228 | continue; | ||
2256 | } | 2229 | } |
2230 | /* 8-byte counter */ | ||
2231 | buf[k + j] = HILO_U64(*offset, *(offset + 1)); | ||
2232 | j++; | ||
2257 | } | 2233 | } |
2258 | } | 2234 | } |
2259 | 2235 | ||