From: Hemant Agrawal <hemant.agra...@nxp.com> This patch add supports to dump dpdmux counters as they are required to identify the reasons for packet drop in dpdmux.
Signed-off-by: Hemant Agrawal <hemant.agra...@nxp.com> Signed-off-by: Rohit Raj <rohit....@nxp.com> --- drivers/net/dpaa2/dpaa2_mux.c | 84 +++++++++++++++++++++++++++++++ drivers/net/dpaa2/rte_pmd_dpaa2.h | 18 +++++++ drivers/net/dpaa2/version.map | 1 + 3 files changed, 103 insertions(+) diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c index 2ff1a98fda..d682a61e52 100644 --- a/drivers/net/dpaa2/dpaa2_mux.c +++ b/drivers/net/dpaa2/dpaa2_mux.c @@ -259,6 +259,90 @@ rte_pmd_dpaa2_mux_rx_frame_len(uint32_t dpdmux_id, uint16_t max_rx_frame_len) return ret; } +/* dump the status of the dpaa2_mux counters on the console */ +void +rte_pmd_dpaa2_mux_dump_counter(FILE *f, uint32_t dpdmux_id, int num_if) +{ + struct dpaa2_dpdmux_dev *dpdmux; + uint64_t counter; + int ret; + int if_id; + + /* Find the DPDMUX from dpdmux_id in our list */ + dpdmux = get_dpdmux_from_id(dpdmux_id); + if (!dpdmux) { + DPAA2_PMD_ERR("Invalid dpdmux_id: %d", dpdmux_id); + return; + } + + for (if_id = 0; if_id < num_if; if_id++) { + fprintf(f, "dpdmux.%d\n", if_id); + + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_FRAME, &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_FRAME %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_BYTE, &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_BYTE %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_FLTR_FRAME, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_FLTR_FRAME %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_FRAME_DISCARD, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_FRAME_DISCARD %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_MCAST_FRAME, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_MCAST_FRAME %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_MCAST_BYTE, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_MCAST_BYTE %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_BCAST_FRAME, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_BCAST_FRAME %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_BCAST_BYTES, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_BCAST_BYTES %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_EGR_FRAME, &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_EGR_FRAME %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_EGR_BYTE, &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_EGR_BYTE %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_EGR_FRAME_DISCARD, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_EGR_FRAME_DISCARD %" PRIu64 "\n", + counter); + } +} + static int dpaa2_create_dpdmux_device(int vdev_fd __rte_unused, struct vfio_device_info *obj_info __rte_unused, diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h b/drivers/net/dpaa2/rte_pmd_dpaa2.h index aea9bae905..fd9acd841b 100644 --- a/drivers/net/dpaa2/rte_pmd_dpaa2.h +++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h @@ -33,6 +33,24 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, struct rte_flow_item *pattern[], struct rte_flow_action *actions[]); +/** + * @warning + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice + * + * Dump demultiplex ethernet traffic counters + * + * @param f + * output stream + * @param dpdmux_id + * ID of the DPDMUX MC object. + * @param num_if + * number of interface in dpdmux object + * + */ +__rte_experimental +void +rte_pmd_dpaa2_mux_dump_counter(FILE *f, uint32_t dpdmux_id, int num_if); + /** * @warning * @b EXPERIMENTAL: this API may change, or be removed, without prior notice diff --git a/drivers/net/dpaa2/version.map b/drivers/net/dpaa2/version.map index 2d95303e27..7323fc8869 100644 --- a/drivers/net/dpaa2/version.map +++ b/drivers/net/dpaa2/version.map @@ -19,6 +19,7 @@ EXPERIMENTAL { # added in 24.11 rte_pmd_dpaa2_set_one_step_ts; rte_pmd_dpaa2_get_one_step_ts; + rte_pmd_dpaa2_mux_dump_counter; }; INTERNAL { -- 2.25.1