patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yuanhan Liu <yliu@fridaylinux.org>
To: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Cc: Kumar Sanghvi <kumaras@chelsio.com>, dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'net/cxgbe: fix port statistics' has been queued to LTS release 16.11.3
Date: Fri, 14 Jul 2017 18:33:29 +0800	[thread overview]
Message-ID: <1500028450-25989-5-git-send-email-yliu@fridaylinux.org> (raw)
In-Reply-To: <1500028450-25989-1-git-send-email-yliu@fridaylinux.org>

Hi,

FYI, your patch has been queued to LTS release 16.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/19/17. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>From a7bd289f483c992d5159cf7359cf0e2b1f61a2ae Mon Sep 17 00:00:00 2001
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Date: Sat, 27 May 2017 09:16:27 +0530
Subject: [PATCH] net/cxgbe: fix port statistics

[ upstream commit ea6a99c077212c5b054b951ef0cc19520076f50d ]

Do not count pause frames as part of normal TX/RX Frame/Byte counts.
Also, switch to using software counters rather than hardware for RX
stats.

Fixes: 856505d303f4 ("cxgbe: add port statistics")

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
 drivers/net/cxgbe/base/t4_hw.c   | 20 ++++++++++++++++++++
 drivers/net/cxgbe/base/t4_regs.h | 18 ++++++++++++++++++
 drivers/net/cxgbe/cxgbe_ethdev.c |  4 ++--
 3 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 9dca8da..19afdac 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -2136,6 +2136,7 @@ unsigned int t4_get_mps_bg_map(struct adapter *adap, int idx)
 void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p)
 {
 	u32 bgmap = t4_get_mps_bg_map(adap, idx);
+	u32 stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL);
 
 #define GET_STAT(name) \
 	t4_read_reg64(adap, \
@@ -2168,6 +2169,15 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p)
 	p->tx_ppp6             = GET_STAT(TX_PORT_PPP6);
 	p->tx_ppp7             = GET_STAT(TX_PORT_PPP7);
 
+	if (CHELSIO_CHIP_VERSION(adap->params.chip) >= CHELSIO_T5) {
+		if (stat_ctl & F_COUNTPAUSESTATTX) {
+			p->tx_frames -= p->tx_pause;
+			p->tx_octets -= p->tx_pause * 64;
+		}
+		if (stat_ctl & F_COUNTPAUSEMCTX)
+			p->tx_mcast_frames -= p->tx_pause;
+	}
+
 	p->rx_octets           = GET_STAT(RX_PORT_BYTES);
 	p->rx_frames           = GET_STAT(RX_PORT_FRAMES);
 	p->rx_bcast_frames     = GET_STAT(RX_PORT_BCAST);
@@ -2195,6 +2205,16 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p)
 	p->rx_ppp5             = GET_STAT(RX_PORT_PPP5);
 	p->rx_ppp6             = GET_STAT(RX_PORT_PPP6);
 	p->rx_ppp7             = GET_STAT(RX_PORT_PPP7);
+
+	if (CHELSIO_CHIP_VERSION(adap->params.chip) >= CHELSIO_T5) {
+		if (stat_ctl & F_COUNTPAUSESTATRX) {
+			p->rx_frames -= p->rx_pause;
+			p->rx_octets -= p->rx_pause * 64;
+		}
+		if (stat_ctl & F_COUNTPAUSEMCRX)
+			p->rx_mcast_frames -= p->rx_pause;
+	}
+
 	p->rx_ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_MAC_DROP_FRAME) : 0;
 	p->rx_ovflow1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_MAC_DROP_FRAME) : 0;
 	p->rx_ovflow2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_MAC_DROP_FRAME) : 0;
diff --git a/drivers/net/cxgbe/base/t4_regs.h b/drivers/net/cxgbe/base/t4_regs.h
index 9057e40..9c132dc 100644
--- a/drivers/net/cxgbe/base/t4_regs.h
+++ b/drivers/net/cxgbe/base/t4_regs.h
@@ -553,6 +553,24 @@
 #define V_VF(x) ((x) << S_VF)
 #define G_VF(x) (((x) >> S_VF) & M_VF)
 
+#define A_MPS_STAT_CTL 0x9600
+
+#define S_COUNTPAUSEMCRX    5
+#define V_COUNTPAUSEMCRX(x) ((x) << S_COUNTPAUSEMCRX)
+#define F_COUNTPAUSEMCRX    V_COUNTPAUSEMCRX(1U)
+
+#define S_COUNTPAUSESTATRX    4
+#define V_COUNTPAUSESTATRX(x) ((x) << S_COUNTPAUSESTATRX)
+#define F_COUNTPAUSESTATRX    V_COUNTPAUSESTATRX(1U)
+
+#define S_COUNTPAUSEMCTX    3
+#define V_COUNTPAUSEMCTX(x) ((x) << S_COUNTPAUSEMCTX)
+#define F_COUNTPAUSEMCTX    V_COUNTPAUSEMCTX(1U)
+
+#define S_COUNTPAUSESTATTX    2
+#define V_COUNTPAUSESTATTX(x) ((x) << S_COUNTPAUSESTATTX)
+#define F_COUNTPAUSESTATTX    V_COUNTPAUSESTATTX(1U)
+
 #define A_MPS_PORT_STAT_TX_PORT_BYTES_L 0x400
 #define A_MPS_PORT_STAT_TX_PORT_BYTES_H 0x404
 #define A_MPS_PORT_STAT_TX_PORT_FRAMES_L 0x408
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index b7f28eb..06437c1 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -654,8 +654,6 @@ static void cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
 	cxgbe_stats_get(pi, &ps);
 
 	/* RX Stats */
-	eth_stats->ipackets = ps.rx_frames;
-	eth_stats->ibytes   = ps.rx_octets;
 	eth_stats->imissed  = ps.rx_ovflow0 + ps.rx_ovflow1 +
 			      ps.rx_ovflow2 + ps.rx_ovflow3 +
 			      ps.rx_trunc0 + ps.rx_trunc1 +
@@ -675,6 +673,8 @@ static void cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
 
 		eth_stats->q_ipackets[i] = rxq->stats.pkts;
 		eth_stats->q_ibytes[i] = rxq->stats.rx_bytes;
+		eth_stats->ipackets += eth_stats->q_ipackets[i];
+		eth_stats->ibytes += eth_stats->q_ibytes[i];
 	}
 
 	for (i = 0; i < pi->n_tx_qsets; i++) {
-- 
2.7.4

  parent reply	other threads:[~2017-07-14 10:35 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-14 10:33 [dpdk-stable] patch 'net/i40e: add return value checks' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/i40e/base: fix Tx error stats on VF' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/mlx5: fix completion buffer size' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/igb: fix add/delete of flex filters' " Yuanhan Liu
2017-07-14 10:33 ` Yuanhan Liu [this message]
2017-07-14 10:33 ` [dpdk-stable] patch 'net/mlx5: fix exception handling' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/mlx5: fix redundant free of Tx buffer' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/igb: fix checksum valid flags' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/i40e: exclude internal packet's byte count' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/i40e: fix VF statistics' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/bnxt: fix reporting of link status' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'kni: fix build with gcc 7.1' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/enic: " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/mlx5: " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'vhost: fix guest pages memory leak' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/virtio: zero the whole memory zone' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'lpm: fix index of tbl8' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'ip_frag: free mbufs on reassembly table destroy' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'mem: fix malloc element resize with padding' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix option parsing' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix application help' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'cryptodev: fix device stop function' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'test/crypto: fix overflow' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'mbuf: fix debug checks for headroom and tailroom' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'contigmem: free allocated memory on error' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'contigmem: do not zero pages during each mmap' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'eal: fix config file path when checking process' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/igb: fix flex filter length' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/fm10k: initialize link status in device start' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/bonding: fix when NTT flag updated' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/vmxnet3: fix receive queue memory leak' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/i40e: fix division by 0' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/bnxt: fix get link config' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/bnxt: fix autoneg on 10GBase-T links' " Yuanhan Liu
2017-07-14 10:34 ` [dpdk-stable] patch 'net/bnxt: fix set link config' " Yuanhan Liu
2017-07-14 10:34 ` [dpdk-stable] patch 'net/mlx4: fix mbuf poisoning in debug code' " Yuanhan Liu
2017-07-14 10:34 ` [dpdk-stable] patch 'test/bonding: fix mode 4 names' " Yuanhan Liu
2017-07-14 10:34 ` [dpdk-stable] patch 'vhost: fix checking of device features' " Yuanhan Liu
2017-07-14 10:34 ` [dpdk-stable] patch 'net/virtio-user: fix crash when detaching device' " Yuanhan Liu

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=1500028450-25989-5-git-send-email-yliu@fridaylinux.org \
    --to=yliu@fridaylinux.org \
    --cc=kumaras@chelsio.com \
    --cc=rahul.lakkireddy@chelsio.com \
    --cc=stable@dpdk.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).