[PATCH 1/3] staging: dpaa2-switch: export the 'no buffer' counter in ethtool
From: Ioana Ciornei
Date: Thu Nov 19 2020 - 11:51:04 EST
From: Ionut-robert Aron <ionut-robert.aron@xxxxxxx>
Export the DPSW_CNT_ING_NO_BUFFER_DISCARD counter in ethtool for each
switch interface. This is useful for debugging purposes.
Signed-off-by: Ionut-robert Aron <ionut-robert.aron@xxxxxxx>
Signed-off-by: Ioana Ciornei <ioana.ciornei@xxxxxxx>
---
drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h | 8 +++++---
drivers/staging/fsl-dpaa2/ethsw/dpsw.h | 6 ++++--
drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c | 2 +-
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
index f100d503bd17..c9fb688f387c 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright 2014-2016 Freescale Semiconductor Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2020 NXP
*
*/
@@ -10,12 +10,14 @@
/* DPSW Version */
#define DPSW_VER_MAJOR 8
-#define DPSW_VER_MINOR 1
+#define DPSW_VER_MINOR 5
#define DPSW_CMD_BASE_VERSION 1
+#define DPSW_CMD_VERSION_2 2
#define DPSW_CMD_ID_OFFSET 4
#define DPSW_CMD_ID(id) (((id) << DPSW_CMD_ID_OFFSET) | DPSW_CMD_BASE_VERSION)
+#define DPSW_CMD_V2(id) (((id) << DPSW_CMD_ID_OFFSET) | DPSW_CMD_VERSION_2)
/* Command IDs */
#define DPSW_CMDID_CLOSE DPSW_CMD_ID(0x800)
@@ -38,7 +40,7 @@
#define DPSW_CMDID_IF_SET_TCI DPSW_CMD_ID(0x030)
#define DPSW_CMDID_IF_SET_STP DPSW_CMD_ID(0x031)
-#define DPSW_CMDID_IF_GET_COUNTER DPSW_CMD_ID(0x034)
+#define DPSW_CMDID_IF_GET_COUNTER DPSW_CMD_V2(0x034)
#define DPSW_CMDID_IF_ENABLE DPSW_CMD_ID(0x03D)
#define DPSW_CMDID_IF_DISABLE DPSW_CMD_ID(0x03E)
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
index ab63ee4f5cb7..9cfd8a8e0197 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
@@ -334,9 +334,10 @@ enum dpsw_accepted_frames {
* @DPSW_CNT_ING_BCAST_FRAME: Counts ingress broadcast frames
* @DPSW_CNT_ING_BCAST_BYTES: Counts ingress broadcast bytes
* @DPSW_CNT_EGR_FRAME: Counts egress frames
- * @DPSW_CNT_EGR_BYTE: Counts eEgress bytes
+ * @DPSW_CNT_EGR_BYTE: Counts egress bytes
* @DPSW_CNT_EGR_FRAME_DISCARD: Counts discarded egress frames
* @DPSW_CNT_EGR_STP_FRAME_DISCARD: Counts egress STP discarded frames
+ * @DPSW_CNT_ING_NO_BUFF_DISCARD: Counts ingress no buffer discarded frames
*/
enum dpsw_counter {
DPSW_CNT_ING_FRAME = 0x0,
@@ -350,7 +351,8 @@ enum dpsw_counter {
DPSW_CNT_EGR_FRAME = 0x8,
DPSW_CNT_EGR_BYTE = 0x9,
DPSW_CNT_EGR_FRAME_DISCARD = 0xa,
- DPSW_CNT_EGR_STP_FRAME_DISCARD = 0xb
+ DPSW_CNT_EGR_STP_FRAME_DISCARD = 0xb,
+ DPSW_CNT_ING_NO_BUFF_DISCARD = 0xc,
};
int dpsw_if_get_counter(struct fsl_mc_io *mc_io,
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c
index ace4a6d28562..fb5a14ac3e4a 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c
@@ -24,7 +24,7 @@ static struct {
{DPSW_CNT_EGR_FRAME, "tx frames"},
{DPSW_CNT_EGR_BYTE, "tx bytes"},
{DPSW_CNT_EGR_FRAME_DISCARD, "tx discarded frames"},
-
+ {DPSW_CNT_ING_NO_BUFF_DISCARD, "rx discarded no buffer frames"},
};
#define DPAA2_SWITCH_NUM_COUNTERS ARRAY_SIZE(dpaa2_switch_ethtool_counters)
--
2.28.0