Commit b98deb2f authored by Florian Fainelli's avatar Florian Fainelli Committed by Jakub Kicinski

net: systemport: Add support for RDMA overflow statistic counter

RDMA overflows can happen if the Ethernet controller does not have
enough bandwidth allocated at the memory controller level, report RDMA
overflows and deal with saturation, similar to the RBUF overflow
counter.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20221028222141.3208429-1-f.fainelli@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 37c84890
...@@ -295,6 +295,8 @@ static const struct bcm_sysport_stats bcm_sysport_gstrings_stats[] = { ...@@ -295,6 +295,8 @@ static const struct bcm_sysport_stats bcm_sysport_gstrings_stats[] = {
/* RBUF misc statistics */ /* RBUF misc statistics */
STAT_RBUF("rbuf_ovflow_cnt", mib.rbuf_ovflow_cnt, RBUF_OVFL_DISC_CNTR), STAT_RBUF("rbuf_ovflow_cnt", mib.rbuf_ovflow_cnt, RBUF_OVFL_DISC_CNTR),
STAT_RBUF("rbuf_err_cnt", mib.rbuf_err_cnt, RBUF_ERR_PKT_CNTR), STAT_RBUF("rbuf_err_cnt", mib.rbuf_err_cnt, RBUF_ERR_PKT_CNTR),
/* RDMA misc statistics */
STAT_RDMA("rdma_ovflow_cnt", mib.rdma_ovflow_cnt, RDMA_OVFL_DISC_CNTR),
STAT_MIB_SOFT("alloc_rx_buff_failed", mib.alloc_rx_buff_failed), STAT_MIB_SOFT("alloc_rx_buff_failed", mib.alloc_rx_buff_failed),
STAT_MIB_SOFT("rx_dma_failed", mib.rx_dma_failed), STAT_MIB_SOFT("rx_dma_failed", mib.rx_dma_failed),
STAT_MIB_SOFT("tx_dma_failed", mib.tx_dma_failed), STAT_MIB_SOFT("tx_dma_failed", mib.tx_dma_failed),
...@@ -333,6 +335,7 @@ static inline bool bcm_sysport_lite_stat_valid(enum bcm_sysport_stat_type type) ...@@ -333,6 +335,7 @@ static inline bool bcm_sysport_lite_stat_valid(enum bcm_sysport_stat_type type)
case BCM_SYSPORT_STAT_NETDEV64: case BCM_SYSPORT_STAT_NETDEV64:
case BCM_SYSPORT_STAT_RXCHK: case BCM_SYSPORT_STAT_RXCHK:
case BCM_SYSPORT_STAT_RBUF: case BCM_SYSPORT_STAT_RBUF:
case BCM_SYSPORT_STAT_RDMA:
case BCM_SYSPORT_STAT_SOFT: case BCM_SYSPORT_STAT_SOFT:
return true; return true;
default: default:
...@@ -436,6 +439,14 @@ static void bcm_sysport_update_mib_counters(struct bcm_sysport_priv *priv) ...@@ -436,6 +439,14 @@ static void bcm_sysport_update_mib_counters(struct bcm_sysport_priv *priv)
if (val == ~0) if (val == ~0)
rbuf_writel(priv, 0, s->reg_offset); rbuf_writel(priv, 0, s->reg_offset);
break; break;
case BCM_SYSPORT_STAT_RDMA:
if (!priv->is_lite)
continue;
val = rdma_readl(priv, s->reg_offset);
if (val == ~0)
rdma_writel(priv, 0, s->reg_offset);
break;
} }
j += s->stat_sizeof; j += s->stat_sizeof;
......
...@@ -290,6 +290,7 @@ struct bcm_rsb { ...@@ -290,6 +290,7 @@ struct bcm_rsb {
#define RDMA_WRITE_PTR_HI 0x1010 #define RDMA_WRITE_PTR_HI 0x1010
#define RDMA_WRITE_PTR_LO 0x1014 #define RDMA_WRITE_PTR_LO 0x1014
#define RDMA_OVFL_DISC_CNTR 0x1018
#define RDMA_PROD_INDEX 0x1018 #define RDMA_PROD_INDEX 0x1018
#define RDMA_PROD_INDEX_MASK 0xffff #define RDMA_PROD_INDEX_MASK 0xffff
...@@ -565,6 +566,7 @@ struct bcm_sysport_mib { ...@@ -565,6 +566,7 @@ struct bcm_sysport_mib {
u32 rxchk_other_pkt_disc; u32 rxchk_other_pkt_disc;
u32 rbuf_ovflow_cnt; u32 rbuf_ovflow_cnt;
u32 rbuf_err_cnt; u32 rbuf_err_cnt;
u32 rdma_ovflow_cnt;
u32 alloc_rx_buff_failed; u32 alloc_rx_buff_failed;
u32 rx_dma_failed; u32 rx_dma_failed;
u32 tx_dma_failed; u32 tx_dma_failed;
...@@ -581,6 +583,7 @@ enum bcm_sysport_stat_type { ...@@ -581,6 +583,7 @@ enum bcm_sysport_stat_type {
BCM_SYSPORT_STAT_RUNT, BCM_SYSPORT_STAT_RUNT,
BCM_SYSPORT_STAT_RXCHK, BCM_SYSPORT_STAT_RXCHK,
BCM_SYSPORT_STAT_RBUF, BCM_SYSPORT_STAT_RBUF,
BCM_SYSPORT_STAT_RDMA,
BCM_SYSPORT_STAT_SOFT, BCM_SYSPORT_STAT_SOFT,
}; };
...@@ -627,6 +630,14 @@ enum bcm_sysport_stat_type { ...@@ -627,6 +630,14 @@ enum bcm_sysport_stat_type {
.reg_offset = ofs, \ .reg_offset = ofs, \
} }
#define STAT_RDMA(str, m, ofs) { \
.stat_string = str, \
.stat_sizeof = sizeof(((struct bcm_sysport_priv *)0)->m), \
.stat_offset = offsetof(struct bcm_sysport_priv, m), \
.type = BCM_SYSPORT_STAT_RDMA, \
.reg_offset = ofs, \
}
/* TX bytes and packets */ /* TX bytes and packets */
#define NUM_SYSPORT_TXQ_STAT 2 #define NUM_SYSPORT_TXQ_STAT 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment