From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by dpdk.org (Postfix) with ESMTP id 7D29B2C8 for ; Tue, 20 Jun 2017 13:37:14 +0200 (CEST) Received: by mail-pg0-f65.google.com with SMTP id u62so15042011pgb.0 for ; Tue, 20 Jun 2017 04:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KvLCeSaX1SgzNua3MKET4/13I0Ql+VPyR4atEP3FeTg=; b=nswl9hTV/PEycSPpci4GYcF6aQ/wsCcmAN3XhYRHEPU+T0I/joPI3JeJjP34xVaOkw TCkJN0PC4rd8QRb/DrLKj/vDtsCWfCT+J7Sd9vRW/nf5g6Jrbvn030Kx/Vt7EVhtfUbw Uugo5HJsgiLXJwWkcxG23dfm0z/BUtohIXZzsoveNtI0EDh9jA9cXwIrDMj19Y2zwGgC zZb8uVx0HiJN0Nnnbp+cawD0TLyXTTX75vsowi7JqppOLUfWV86EdPeJxR5K/86PpaWK XbkV5zHuHuOhPwxllwX4BVIjSdWwJ/P5PAjc1mmv7Dv2kqxYH0UA7JTen8BHuv08Sgr4 a5ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KvLCeSaX1SgzNua3MKET4/13I0Ql+VPyR4atEP3FeTg=; b=pEuOxJw/tOghKOKDGKroEo70yUTtjE2xsE4rN30aFNMmw9Pw1egSAOIfeFYpSIYfwe +atTnzx2vKkqeXyf8C0IxmJbYUkcOjkIPGrQZtrgZmj4/G0bBxnxVIk24ddw5qLJH/uw pCbHHFbDltYpEOrU0bOUbkqgjy9GdOlUFU/1wEfKYAAhLroTobEu3BFuM8HoPlmZKaTU 67ZTqombuLj2OCCkZDRsNAnTZpgvRwD/nX32UKyT3SW65vhhN+t+Cqh9FrlSOmFtFxH3 IDOJYBxhtxm7Mn1HqYTwuE98xM4dWLqbcc6sYp2Vfo7LWEJFzPtNZDuBM8CBSOYgXp2y 2Q6A== X-Gm-Message-State: AKS2vOwzg+BenPMsP4x1fm37zsy5KXCZ/UxEiDyp18Wv8fg4hd7W563W Pqs/77wqEMY4I09FTKRkqQ== X-Received: by 10.98.202.210 with SMTP id y79mr30927600pfk.230.1497958633780; Tue, 20 Jun 2017 04:37:13 -0700 (PDT) Received: from yliu-home.localdomain ([45.63.61.64]) by smtp.gmail.com with ESMTPSA id 25sm6104783pfj.59.2017.06.20.04.37.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 04:37:12 -0700 (PDT) From: Yuanhan Liu To: Rahul Lakkireddy Cc: Kumar Sanghvi , dpdk stable Date: Tue, 20 Jun 2017 19:35:28 +0800 Message-Id: <1497958550-13600-16-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497958550-13600-1-git-send-email-yliu@fridaylinux.org> References: <1497958550-13600-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/cxgbe: fix port statistics' has been queued to stable release 17.05.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jun 2017 11:37:14 -0000 Hi, FYI, your patch has been queued to stable release 17.05.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/22/17. So please shout if anyone has objections. Thanks. --yliu --- >>From a3618fd0dc87b4c6b936e0dd812a5352c31a4983 Mon Sep 17 00:00:00 2001 From: Rahul Lakkireddy 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 Signed-off-by: Kumar Sanghvi --- 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 88e568c..3a33fe6 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -657,8 +657,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 + @@ -678,6 +676,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