@@ -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)
@@ -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 */
@@ -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);
};
@@ -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;
@@ -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);
@@ -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);
@@ -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);
+}
@@ -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;
}