From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: dev@dpdk.org
Subject: [PATCH 4/5] net/cxgbe: track packets dropped by TP due to congestion
Date: Tue, 19 Apr 2022 03:54:21 +0530 [thread overview]
Message-ID: <323a4fe735f784ec49c6c93b18a2b21cde1d05c3.1650297776.git.rahul.lakkireddy@chelsio.com> (raw)
In-Reply-To: <cover.1650297776.git.rahul.lakkireddy@chelsio.com>
Rx packets can get dropped at TP due to congestion and this info
will not get propagated to MPS. Track these Rx dropped packets
in imissed counter. Also add xstats for these counters.
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
drivers/net/cxgbe/base/common.h | 2 ++
drivers/net/cxgbe/base/t4_hw.c | 14 ++++++++++++--
drivers/net/cxgbe/base/t4_regs.h | 4 ++++
drivers/net/cxgbe/cxgbe_ethdev.c | 11 +++++++++++
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h
index 980d78e4a4..4482ddbf56 100644
--- a/drivers/net/cxgbe/base/common.h
+++ b/drivers/net/cxgbe/base/common.h
@@ -101,6 +101,8 @@ struct port_stats {
u64 rx_trunc1; /* buffer-group 1 truncated packets */
u64 rx_trunc2; /* buffer-group 2 truncated packets */
u64 rx_trunc3; /* buffer-group 3 truncated packets */
+
+ u64 rx_tp_tnl_cong_drops[NCHAN]; /* TP frame drops due to congestion */
};
struct sge_params {
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 84c4316e68..384080e6d3 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -3040,8 +3040,10 @@ unsigned int t4_get_tp_ch_map(struct adapter *adapter, unsigned int pidx)
*/
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);
+ u32 bgmap = t4_get_mps_bg_map(adap, idx);
+ u32 val[NCHAN] = { 0 };
+ u8 i;
#define GET_STAT(name) \
t4_read_reg64(adap, \
@@ -3129,6 +3131,11 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p)
p->rx_trunc2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_MAC_TRUNC_FRAME) : 0;
p->rx_trunc3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_MAC_TRUNC_FRAME) : 0;
+ t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, &val[idx], 1,
+ A_TP_MIB_TNL_CNG_DROP_0 + idx);
+
+ for (i = 0; i < NCHAN; i++)
+ p->rx_tp_tnl_cong_drops[i] = val[i];
#undef GET_STAT
#undef GET_STAT_COM
}
@@ -3163,9 +3170,10 @@ void t4_get_port_stats_offset(struct adapter *adap, int idx,
*/
void t4_clr_port_stats(struct adapter *adap, int idx)
{
- unsigned int i;
u32 bgmap = t4_get_mps_bg_map(adap, idx);
u32 port_base_addr;
+ unsigned int i;
+ u32 val = 0;
if (is_t4(adap->params.chip))
port_base_addr = PORT_BASE(idx);
@@ -3187,6 +3195,8 @@ void t4_clr_port_stats(struct adapter *adap, int idx)
A_MPS_STAT_RX_BG_0_MAC_TRUNC_FRAME_L +
i * 8, 0);
}
+ t4_write_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA,
+ &val, 1, A_TP_MIB_TNL_CNG_DROP_0 + idx);
}
/**
diff --git a/drivers/net/cxgbe/base/t4_regs.h b/drivers/net/cxgbe/base/t4_regs.h
index 8a14d09a15..ff60dc1bb3 100644
--- a/drivers/net/cxgbe/base/t4_regs.h
+++ b/drivers/net/cxgbe/base/t4_regs.h
@@ -525,6 +525,8 @@
#define A_TP_PIO_ADDR 0x7e40
#define A_TP_PIO_DATA 0x7e44
+#define A_TP_MIB_INDEX 0x7e50
+#define A_TP_MIB_DATA 0x7e54
#define A_TP_RSS_SECRET_KEY0 0x40
@@ -587,6 +589,8 @@
#define S_RM_OVLAN 9
#define V_RM_OVLAN(x) ((x) << S_RM_OVLAN)
+#define A_TP_MIB_TNL_CNG_DROP_0 0x18
+
/* registers for module MA */
#define A_MA_EDRAM0_BAR 0x77c0
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index e7ea76180f..cf9a2fdc19 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -709,6 +709,9 @@ static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
ps.rx_ovflow2 + ps.rx_ovflow3 +
ps.rx_trunc0 + ps.rx_trunc1 +
ps.rx_trunc2 + ps.rx_trunc3;
+ for (i = 0; i < NCHAN; i++)
+ eth_stats->imissed += ps.rx_tp_tnl_cong_drops[i];
+
eth_stats->ierrors = ps.rx_symbol_err + ps.rx_fcs_err +
ps.rx_jabber + ps.rx_too_long + ps.rx_runt +
ps.rx_len_err;
@@ -851,6 +854,14 @@ static const struct cxgbe_dev_xstats_name_off cxgbe_dev_port_stats_strings[] = {
{"rx_bg1_truncated_packets", offsetof(struct port_stats, rx_trunc1)},
{"rx_bg2_truncated_packets", offsetof(struct port_stats, rx_trunc2)},
{"rx_bg3_truncated_packets", offsetof(struct port_stats, rx_trunc3)},
+ {"rx_tp_tnl_cong_drops0",
+ offsetof(struct port_stats, rx_tp_tnl_cong_drops[0])},
+ {"rx_tp_tnl_cong_drops1",
+ offsetof(struct port_stats, rx_tp_tnl_cong_drops[1])},
+ {"rx_tp_tnl_cong_drops2",
+ offsetof(struct port_stats, rx_tp_tnl_cong_drops[2])},
+ {"rx_tp_tnl_cong_drops3",
+ offsetof(struct port_stats, rx_tp_tnl_cong_drops[3])},
};
static const struct cxgbe_dev_xstats_name_off
--
2.27.0
next prev parent reply other threads:[~2022-04-18 22:24 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-18 22:24 [PATCH 0/5] net/cxgbe: updates and bug fixes Rahul Lakkireddy
2022-04-18 22:24 ` [PATCH 1/5] net/cxgbe: fill correct port info in mbufs for Rx Rahul Lakkireddy
2022-04-18 22:24 ` [PATCH 2/5] net/cxgbe: fix Tx queue stuck with mbuf chain coalescing Rahul Lakkireddy
2022-04-18 22:24 ` [PATCH 3/5] net/cxgbe: simplify Rx payload buffer size posting Rahul Lakkireddy
2022-04-18 22:24 ` Rahul Lakkireddy [this message]
2022-05-05 16:28 ` [PATCH 4/5] net/cxgbe: track packets dropped by TP due to congestion Ferruh Yigit
2022-05-06 11:09 ` Rahul Lakkireddy
2022-05-06 12:32 ` Ferruh Yigit
2022-05-06 13:18 ` [PATCH v2] " Rahul Lakkireddy
2022-05-17 16:52 ` Ferruh Yigit
2022-04-18 22:24 ` [PATCH 5/5] net/cxgbe: read firmware configuration file from filesystem Rahul Lakkireddy
2022-05-05 16:29 ` Ferruh Yigit
2022-05-05 16:36 ` Ferruh Yigit
2022-05-06 11:36 ` Rahul Lakkireddy
2022-05-10 9:02 ` Thomas Monjalon
2022-05-10 14:11 ` Rahul Lakkireddy
2022-05-10 14:30 ` Thomas Monjalon
2022-05-10 15:05 ` Rahul Lakkireddy
2022-05-10 16:20 ` Thomas Monjalon
2022-05-16 10:27 ` [PATCH v2] " Rahul Lakkireddy
2022-05-16 11:06 ` Ferruh Yigit
2022-05-16 11:56 ` Rahul Lakkireddy
2022-05-16 14:05 ` Ferruh Yigit
2022-05-16 19:34 ` [PATCH v3] " Rahul Lakkireddy
2022-05-17 16:52 ` Ferruh Yigit
2022-05-05 16:29 ` [PATCH 0/5] net/cxgbe: updates and bug fixes Ferruh Yigit
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=323a4fe735f784ec49c6c93b18a2b21cde1d05c3.1650297776.git.rahul.lakkireddy@chelsio.com \
--to=rahul.lakkireddy@chelsio.com \
--cc=dev@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).