From: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, tziporet@mellanox.co.il
Subject: [PATCH 5/5] mlx4_en: Move to SW counters for total bytes and packets
Date: Mon, 20 Apr 2009 17:34:38 +0300 [thread overview]
Message-ID: <49EC87FE.4010000@mellanox.co.il> (raw)
In-Reply-To: <49EC87AB.1070009@mellanox.co.il>
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>
---
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 c5a4c03..a29abe8 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)
struct mlx4_cmd_mailbox *mailbox;
u64 in_mod = reset << 8 | port;
int err;
+ int i;
mailbox = mlx4_alloc_cmd_mailbox(mdev->dev);
if (IS_ERR(mailbox))
@@ -165,38 +166,18 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
spin_lock_bh(&priv->stats_lock);
- stats->rx_packets = be32_to_cpu(mlx4_en_stats->RTOTFRMS) -
- be32_to_cpu(mlx4_en_stats->RDROP);
- stats->tx_packets = be64_to_cpu(mlx4_en_stats->TTOT_prio_0) +
- be64_to_cpu(mlx4_en_stats->TTOT_prio_1) +
- be64_to_cpu(mlx4_en_stats->TTOT_prio_2) +
- be64_to_cpu(mlx4_en_stats->TTOT_prio_3) +
- be64_to_cpu(mlx4_en_stats->TTOT_prio_4) +
- be64_to_cpu(mlx4_en_stats->TTOT_prio_5) +
- be64_to_cpu(mlx4_en_stats->TTOT_prio_6) +
- be64_to_cpu(mlx4_en_stats->TTOT_prio_7) +
- be64_to_cpu(mlx4_en_stats->TTOT_novlan) +
- be64_to_cpu(mlx4_en_stats->TTOT_loopbk);
- stats->rx_bytes = be64_to_cpu(mlx4_en_stats->ROCT_prio_0) +
- be64_to_cpu(mlx4_en_stats->ROCT_prio_1) +
- be64_to_cpu(mlx4_en_stats->ROCT_prio_2) +
- be64_to_cpu(mlx4_en_stats->ROCT_prio_3) +
- be64_to_cpu(mlx4_en_stats->ROCT_prio_4) +
- be64_to_cpu(mlx4_en_stats->ROCT_prio_5) +
- be64_to_cpu(mlx4_en_stats->ROCT_prio_6) +
- be64_to_cpu(mlx4_en_stats->ROCT_prio_7) +
- be64_to_cpu(mlx4_en_stats->ROCT_novlan);
-
- stats->tx_bytes = be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_0) +
- be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_1) +
- be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_2) +
- be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_3) +
- be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_4) +
- be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_5) +
- be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_6) +
- be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_7) +
- be64_to_cpu(mlx4_en_stats->TTTLOCT_novlan) +
- be64_to_cpu(mlx4_en_stats->TTTLOCT_loopbk);
+ stats->rx_packets = 0;
+ stats->rx_bytes = 0;
+ for (i = 0; i < priv->rx_ring_num; i++) {
+ stats->rx_packets += priv->rx_ring[i].packets;
+ stats->rx_bytes += priv->rx_ring[i].bytes;
+ }
+ stats->tx_packets = 0;
+ stats->tx_bytes = 0;
+ for (i = 0; i <= priv->tx_ring_num; i++) {
+ stats->tx_packets += priv->tx_ring[i].packets;
+ stats->tx_bytes += priv->tx_ring[i].bytes;
+ }
stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) +
be32_to_cpu(mlx4_en_stats->RdropLength) +
--
1.5.4
next prev parent reply other threads:[~2009-04-20 14:35 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-20 14:24 [PATCH 1/5] mlx4_en: Fix error handling while activating RX rings Yevgeny Petrilin
2009-04-20 14:26 ` [PATCH 2/5]mlx4_en: Fix a race at restart task Yevgeny Petrilin
2009-04-21 4:32 ` [PATCH] mlx4_en: Fix cleanup if workqueue create in mlx4_en_add() fails Roland Dreier
2009-04-21 8:50 ` David Miller
2009-04-21 8:49 ` [PATCH 2/5]mlx4_en: Fix a race at restart task David Miller
2009-04-20 14:30 ` [PATCH 3/5] mlx4_en: Assign dummy event handler for TX queue Yevgeny Petrilin
2009-04-21 8:50 ` David Miller
2009-04-20 14:33 ` [PATCH 4/5] mlx4_en: use NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM for tx csum at initialization Yevgeny Petrilin
2009-04-20 14:34 ` Yevgeny Petrilin [this message]
2009-04-21 8:50 ` [PATCH 5/5] mlx4_en: Move to SW counters for total bytes and packets David Miller
2009-04-21 8:50 ` [PATCH 4/5] mlx4_en: use NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM for tx csum at initialization David Miller
2009-04-27 6:42 ` [PATCH 2/2] mlx4_en: Handle page allocation failure during receive Yevgeny Petrilin
2009-04-27 9:31 ` David Miller
2009-04-21 8:49 ` [PATCH 1/5] mlx4_en: Fix error handling while activating RX rings David Miller
2009-04-27 6:41 ` [PATCH 1/2] mlx4_en: Fix cleanup flow on cq activation Yevgeny Petrilin
2009-04-27 9:31 ` David Miller
2009-05-13 11:47 ` [PATCH] mlx4_en: Fix not deleted napi structures Yevgeny Petrilin
2009-05-18 3:49 ` David Miller
2009-05-24 13:16 ` [PATCH 1/2] mlx4_en: Removed redundant stride variable Yevgeny Petrilin
2009-05-25 7:36 ` David Miller
2009-05-24 13:17 ` [PATCH 2/2] mlx4_en: Fix partial rings feature Yevgeny Petrilin
2009-05-25 7:36 ` David Miller
2009-05-25 8:32 ` [net-2.6 PATCH] mlx4_en: Fix a kernel panic when waking tx queue Yevgeny Petrilin
2009-05-25 8:44 ` David Miller
2009-05-26 6:49 ` Yevgeny Petrilin
2009-06-02 9:20 ` [PATCH 2/8] mlx4_en: Moved all module parameters handling to en_main.c Yevgeny Petrilin
2009-06-02 9:21 ` [PATCH 3/8] mlx4_en renamed en_params.c to en_ethtool.c Yevgeny Petrilin
2009-06-02 9:22 ` [PATCH 4/8] mlx4_en: Work with part of the ports Yevgeny Petrilin
2009-06-02 9:23 ` [PATCH 5/8] mlx4_en: Coalescing target is equal for all mtu's Yevgeny Petrilin
2009-06-02 9:24 ` [PATCH 6/8] mlx4_en: multiqueue support Yevgeny Petrilin
2009-06-02 9:28 ` [PATCH 7/8] mlx4_en: Added vlan_features support Yevgeny Petrilin
2009-06-02 9:29 ` [PATCH 8/8] mlx4_en: Updated driver version Yevgeny Petrilin
2009-06-02 9:36 ` David Miller
2009-05-26 6:57 ` [net-2.6 PATCH V2] mlx4_en: Fix a kernel panic when waking tx queue Yevgeny Petrilin
2009-05-26 10:48 ` Eric Dumazet
2009-05-27 6:08 ` Yevgeny Petrilin
2009-05-30 5:00 ` David Miller
2009-06-02 6:27 ` [PATCH 1/8] mlx4_en: Giving interface name in debug messages Yevgeny Petrilin
2009-06-02 7:36 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49EC87FE.4010000@mellanox.co.il \
--to=yevgenyp@mellanox.co.il \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=tziporet@mellanox.co.il \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.