diff options
author | Yevgeny Petrilin <yevgenyp@mellanox.co.il> | 2009-04-20 00:34:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-21 04:47:07 -0400 |
commit | b1b243afac302d181d19c8024c355d9677beab49 (patch) | |
tree | 3e612f18402f010d18ffe90dc205d06d07dc524c | |
parent | 45b4d66d690600dac1aa805b75763331483acf22 (diff) |
mlx4_en: Move to SW counters for total bytes and packets
The per ring counters are implemented in SW. Now moving to have the total
counters as the sum of all rings. This way the numbers will always be consistent
and we no longer depend on HW buffer size limitations for those counters
that can be insufficient in some cases.
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/mlx4/en_port.c | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/drivers/net/mlx4/en_port.c b/drivers/net/mlx4/en_port.c index c5a4c0389752..a29abe845d2e 100644 --- a/drivers/net/mlx4/en_port.c +++ b/drivers/net/mlx4/en_port.c | |||
@@ -151,6 +151,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) | |||
151 | struct mlx4_cmd_mailbox *mailbox; | 151 | struct mlx4_cmd_mailbox *mailbox; |
152 | u64 in_mod = reset << 8 | port; | 152 | u64 in_mod = reset << 8 | port; |
153 | int err; | 153 | int err; |
154 | int i; | ||
154 | 155 | ||
155 | mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); | 156 | mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); |
156 | if (IS_ERR(mailbox)) | 157 | if (IS_ERR(mailbox)) |
@@ -165,38 +166,18 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) | |||
165 | 166 | ||
166 | spin_lock_bh(&priv->stats_lock); | 167 | spin_lock_bh(&priv->stats_lock); |
167 | 168 | ||
168 | stats->rx_packets = be32_to_cpu(mlx4_en_stats->RTOTFRMS) - | 169 | stats->rx_packets = 0; |
169 | be32_to_cpu(mlx4_en_stats->RDROP); | 170 | stats->rx_bytes = 0; |
170 | stats->tx_packets = be64_to_cpu(mlx4_en_stats->TTOT_prio_0) + | 171 | for (i = 0; i < priv->rx_ring_num; i++) { |
171 | be64_to_cpu(mlx4_en_stats->TTOT_prio_1) + | 172 | stats->rx_packets += priv->rx_ring[i].packets; |
172 | be64_to_cpu(mlx4_en_stats->TTOT_prio_2) + | 173 | stats->rx_bytes += priv->rx_ring[i].bytes; |
173 | be64_to_cpu(mlx4_en_stats->TTOT_prio_3) + | 174 | } |
174 | be64_to_cpu(mlx4_en_stats->TTOT_prio_4) + | 175 | stats->tx_packets = 0; |
175 | be64_to_cpu(mlx4_en_stats->TTOT_prio_5) + | 176 | stats->tx_bytes = 0; |
176 | be64_to_cpu(mlx4_en_stats->TTOT_prio_6) + | 177 | for (i = 0; i <= priv->tx_ring_num; i++) { |
177 | be64_to_cpu(mlx4_en_stats->TTOT_prio_7) + | 178 | stats->tx_packets += priv->tx_ring[i].packets; |
178 | be64_to_cpu(mlx4_en_stats->TTOT_novlan) + | 179 | stats->tx_bytes += priv->tx_ring[i].bytes; |
179 | be64_to_cpu(mlx4_en_stats->TTOT_loopbk); | 180 | } |
180 | stats->rx_bytes = be64_to_cpu(mlx4_en_stats->ROCT_prio_0) + | ||
181 | be64_to_cpu(mlx4_en_stats->ROCT_prio_1) + | ||
182 | be64_to_cpu(mlx4_en_stats->ROCT_prio_2) + | ||
183 | be64_to_cpu(mlx4_en_stats->ROCT_prio_3) + | ||
184 | be64_to_cpu(mlx4_en_stats->ROCT_prio_4) + | ||
185 | be64_to_cpu(mlx4_en_stats->ROCT_prio_5) + | ||
186 | be64_to_cpu(mlx4_en_stats->ROCT_prio_6) + | ||
187 | be64_to_cpu(mlx4_en_stats->ROCT_prio_7) + | ||
188 | be64_to_cpu(mlx4_en_stats->ROCT_novlan); | ||
189 | |||
190 | stats->tx_bytes = be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_0) + | ||
191 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_1) + | ||
192 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_2) + | ||
193 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_3) + | ||
194 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_4) + | ||
195 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_5) + | ||
196 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_6) + | ||
197 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_7) + | ||
198 | be64_to_cpu(mlx4_en_stats->TTTLOCT_novlan) + | ||
199 | be64_to_cpu(mlx4_en_stats->TTTLOCT_loopbk); | ||
200 | 181 | ||
201 | stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) + | 182 | stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) + |
202 | be32_to_cpu(mlx4_en_stats->RdropLength) + | 183 | be32_to_cpu(mlx4_en_stats->RdropLength) + |