From: Hariprasad Kelam <hkelam@marvell.com>
To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <kuba@kernel.org>, <davem@davemloft.net>, <pabeni@redhat.com>,
<edumazet@google.com>, <sgoutham@marvell.com>,
<lcherian@marvell.com>, <gakula@marvell.com>,
<jerinj@marvell.com>, <sbhatta@marvell.com>
Subject: [net-next PATCH 4/9] octeontx2-af: Show count of dropped packets by DMAC filters
Date: Sat, 12 Nov 2022 10:01:36 +0530 [thread overview]
Message-ID: <20221112043141.13291-5-hkelam@marvell.com> (raw)
In-Reply-To: <20221112043141.13291-1-hkelam@marvell.com>
Current mac_filter debugfs file only shows list of DMAC entries
added to CGX/RPM DMAC table, added count of packets dropped by CGX/RPM
due to DMAC filters.
Output of mac_filter file
PCI dev RVUPF BROADCAST MULTICAST FILTER-MODE
0002:03:00.0 PF2 ACCEPT ACCEPT UNICAST
DMAC-INDEX ADDRESS
0 6a:4e:f1:10:34:0f
1 1a:1b:1c:1d:1e:1f
DMAC filter drop count: 4
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
---
drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 13 ++++++++++++-
drivers/net/ethernet/marvell/octeontx2/af/cgx.h | 2 ++
.../ethernet/marvell/octeontx2/af/lmac_common.h | 1 +
drivers/net/ethernet/marvell/octeontx2/af/rpm.c | 16 ++++++++++++++++
drivers/net/ethernet/marvell/octeontx2/af/rpm.h | 3 ++-
drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 1 +
.../net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 15 +++++++++++++++
.../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 3 +++
8 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index f6ab85f01ee7..942ad87905e9 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -701,6 +701,16 @@ int cgx_get_tx_stats(void *cgxd, int lmac_id, int idx, u64 *tx_stat)
return 0;
}
+u64 cgx_get_dmacflt_dropped_pktcnt(void *cgxd, int lmac_id)
+{
+ struct cgx *cgx = cgxd;
+
+ if (!is_lmac_valid(cgx, lmac_id))
+ return 0;
+
+ return cgx_read(cgx, lmac_id, CGXX_CMRX_RX_STAT4);
+}
+
u64 cgx_features_get(void *cgxd)
{
return ((struct cgx *)cgxd)->hw_features;
@@ -1773,7 +1783,8 @@ static struct mac_ops cgx_mac_ops = {
.mac_tx_enable = cgx_lmac_tx_enable,
.pfc_config = cgx_lmac_pfc_config,
.mac_get_pfc_frm_cfg = cgx_lmac_get_pfc_frm_cfg,
- .mac_reset = cgx_lmac_reset,
+ .mac_reset = cgx_lmac_reset,
+ .get_dmacflt_dropped_pktcnt = cgx_get_dmacflt_dropped_pktcnt,
};
static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.h b/drivers/net/ethernet/marvell/octeontx2/af/cgx.h
index 9273b96f68d2..2bdf6de244c3 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.h
@@ -36,6 +36,7 @@
#define CGXX_CMRX_INT_ENA_W1S 0x058
#define CGXX_CMRX_RX_ID_MAP 0x060
#define CGXX_CMRX_RX_STAT0 0x070
+#define CGXX_CMRX_RX_STAT4 0x090
#define CGXX_CMRX_RX_LOGL_XON 0x100
#define CGXX_CMRX_RX_LMACS 0x128
#define CGXX_CMRX_RX_DMAC_CTL0 (0x1F8 + mac_ops->csr_offset)
@@ -184,4 +185,5 @@ int cgx_lmac_get_pfc_frm_cfg(void *cgxd, int lmac_id, u8 *tx_pause,
int verify_lmac_fc_cfg(void *cgxd, int lmac_id, u8 tx_pause, u8 rx_pause,
int pfvf_idx);
int cgx_lmac_reset(void *cgxd, int lmac_id);
+u64 cgx_get_dmacflt_dropped_pktcnt(void *cgx, int lmac_id);
#endif /* CGX_H */
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h b/drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h
index 152c50bf6d1e..18b03940b34b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h
@@ -126,6 +126,7 @@ struct mac_ops {
int (*mac_get_pfc_frm_cfg)(void *cgxd, int lmac_id,
u8 *tx_pause, u8 *rx_pause);
int (*mac_reset)(void *cgxd, int lmac_id);
+ u64 (*get_dmacflt_dropped_pktcnt)(void *cgxd, int lmac_id);
};
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
index d40aca0940bf..641d82000768 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
@@ -37,6 +37,7 @@ static struct mac_ops rpm_mac_ops = {
.pfc_config = rpm_lmac_pfc_config,
.mac_get_pfc_frm_cfg = rpm_lmac_get_pfc_frm_cfg,
.mac_reset = rpm_lmac_reset,
+ .get_dmacflt_dropped_pktcnt = rpm_get_dmacflt_dropped_pktcnt,
};
static struct mac_ops rpm2_mac_ops = {
@@ -68,6 +69,7 @@ static struct mac_ops rpm2_mac_ops = {
.pfc_config = rpm_lmac_pfc_config,
.mac_get_pfc_frm_cfg = rpm_lmac_get_pfc_frm_cfg,
.mac_reset = rpm_lmac_reset,
+ .get_dmacflt_dropped_pktcnt = rpm_get_dmacflt_dropped_pktcnt,
};
bool is_dev_rpm2(void *rpmd)
@@ -434,6 +436,20 @@ int rpm_get_tx_stats(void *rpmd, int lmac_id, int idx, u64 *tx_stat)
return 0;
}
+u64 rpm_get_dmacflt_dropped_pktcnt(void *rpmd, int lmac_id)
+{
+ rpm_t *rpm = rpmd;
+ u64 dmac_flt_stat;
+
+ if (!is_lmac_valid(rpm, lmac_id))
+ return 0;
+
+ dmac_flt_stat = is_dev_rpm2(rpm) ? RPM2_CMRX_RX_STAT2 :
+ RPMX_CMRX_RX_STAT2;
+
+ return rpm_read(rpm, lmac_id, dmac_flt_stat);
+}
+
u8 rpm_get_lmac_type(void *rpmd, int lmac_id)
{
rpm_t *rpm = rpmd;
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rpm.h b/drivers/net/ethernet/marvell/octeontx2/af/rpm.h
index 4b28b9879995..8ed2f9c9624b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rpm.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rpm.h
@@ -60,7 +60,7 @@
#define RPMX_MTI_STAT_RX_STAT_PAGES_COUNTERX 0x12000
#define RPMX_MTI_STAT_TX_STAT_PAGES_COUNTERX 0x13000
#define RPMX_MTI_STAT_DATA_HI_CDC 0x10038
-
+#define RPMX_CMRX_RX_STAT2 0x4010
#define RPM_LMAC_FWI 0xa
#define RPM_TX_EN BIT_ULL(0)
#define RPM_RX_EN BIT_ULL(1)
@@ -111,6 +111,7 @@ int rpm_lmac_enadis_pause_frm(void *rpmd, int lmac_id, u8 tx_pause,
u8 rx_pause);
int rpm_get_tx_stats(void *rpmd, int lmac_id, int idx, u64 *tx_stat);
int rpm_get_rx_stats(void *rpmd, int lmac_id, int idx, u64 *rx_stat);
+u64 rpm_get_dmacflt_dropped_pktcnt(void *rpmd, int lmac_id);
void rpm_lmac_ptp_config(void *rpmd, int lmac_id, bool enable);
int rpm_lmac_rx_tx_enable(void *rpmd, int lmac_id, bool enable);
int rpm_lmac_tx_enable(void *rpmd, int lmac_id, bool enable);
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
index 7423d50d99dd..7654c90f48df 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
@@ -848,6 +848,7 @@ int rvu_cgx_prio_flow_ctrl_cfg(struct rvu *rvu, u16 pcifunc, u8 tx_pause, u8 rx_
u16 pfc_en);
int rvu_cgx_cfg_pause_frm(struct rvu *rvu, u16 pcifunc, u8 tx_pause, u8 rx_pause);
void rvu_mac_reset(struct rvu *rvu, u16 pcifunc);
+u64 rvu_cgx_get_dmacflt_dropped_pktcnt(void *cgxd, int lmac_id);
u32 rvu_cgx_get_lmac_fifolen(struct rvu *rvu, int cgx, int lmac);
int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf,
int type);
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
index 3fa828feb6cd..3124aed1806f 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
@@ -1264,3 +1264,18 @@ void rvu_mac_reset(struct rvu *rvu, u16 pcifunc)
if (mac_ops->mac_reset(cgxd, lmac))
dev_err(rvu->dev, "Failed to reset MAC\n");
}
+
+u64 rvu_cgx_get_dmacflt_dropped_pktcnt(void *cgxd, int lmac_id)
+{
+ struct mac_ops *mac_ops;
+
+ if (!cgxd)
+ return 0;
+
+ mac_ops = get_mac_ops(cgxd);
+
+ if (!mac_ops->lmac_fifo_len)
+ return 0;
+
+ return mac_ops->get_dmacflt_dropped_pktcnt(cgxd, lmac_id);
+}
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
index 4bd131ee9cc0..c5a0076b8082 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
@@ -2566,6 +2566,9 @@ static int cgx_print_dmac_flt(struct seq_file *s, int lmac_id)
}
}
+ seq_printf(s, "\nDMAC filter drop count: %lld\n",
+ rvu_cgx_get_dmacflt_dropped_pktcnt(cgxd, lmac_id));
+
return 0;
}
--
2.17.1
next prev parent reply other threads:[~2022-11-12 4:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-12 4:31 [net-next PATCH 0/9] CN10KB MAC block support Hariprasad Kelam
2022-11-12 4:31 ` [net-next PATCH 1/9] octeontx2-af: Support More number of MAC blocks Hariprasad Kelam
2022-11-12 4:31 ` [net-next PATCH 2/9] octeontx2-af: CN10KB MAC RPM_100/USX support Hariprasad Kelam
2022-11-12 4:31 ` [net-next PATCH 3/9] octeontx2-af: Reset MAC specific csrs on FLR Hariprasad Kelam
2022-11-12 4:31 ` Hariprasad Kelam [this message]
2022-11-12 4:31 ` [net-next PATCH 5/9] octeontx2-af: Add support for RPM FEC stats Hariprasad Kelam
2022-11-12 18:28 ` Andrew Lunn
2022-11-12 4:31 ` [net-next PATCH 6/9] octeontx2-af: Reset MAC block RX/TX statistics Hariprasad Kelam
2022-11-12 4:31 ` [net-next PATCH 7/9] octeontx2-af: Add proper return codes for AF mbox handlers Hariprasad Kelam
2022-11-12 4:31 ` [net-next PATCH 8/9] octeontx2-af: physical link state change Hariprasad Kelam
2022-11-12 4:31 ` [net-next PATCH 9/9] octeontx2-af: Add programmed macaddr to RVU pfvf Hariprasad Kelam
2022-11-12 5:12 ` [net-next PATCH 0/9] CN10KB MAC block support Jakub Kicinski
2022-11-12 18:35 ` Andrew Lunn
2022-11-13 18:07 ` Hariprasad Kelam
2022-11-13 19:04 ` Andrew Lunn
2022-11-14 6:56 ` ] " Hariprasad Kelam
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=20221112043141.13291-5-hkelam@marvell.com \
--to=hkelam@marvell.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gakula@marvell.com \
--cc=jerinj@marvell.com \
--cc=kuba@kernel.org \
--cc=lcherian@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.com \
/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
all inboxes | Powered by JetHome®