[U-Boot] [PATCH v3 09/16] drivers/net/vsc9953: Add command to show/clear port counters

Codrin Ciubotariu codrin.ciubotariu at freescale.com
Fri Jul 24 15:55:29 CEST 2015


The new added command:
ethsw [port <port_no>] statistics { [help] | [clear] }

will print counters like the number of Rx/Tx frames,
number of Rx/Tx bytes, number of Rx/Tx unicast frames, etc.
This patch also adds this commnd in the genereric ethsw
parser from cmd_ethsw.c

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu at freescale.com>
---

Changes for v2:
	- removed Change-id field;

Changes for v3:
	- moved each variable declaration on a separate line, with one space only;
	- replaced magic numbers on functions called by the parser with CMD_RET_* macros;


 common/cmd_ethsw.c    |  42 +++++++++
 drivers/net/vsc9953.c | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/ethsw.h       |   4 +
 include/vsc9953.h     | 116 ++++++++++++++++++++++-
 4 files changed, 415 insertions(+), 3 deletions(-)

diff --git a/common/cmd_ethsw.c b/common/cmd_ethsw.c
index ebeaae0..57df603 100644
--- a/common/cmd_ethsw.c
+++ b/common/cmd_ethsw.c
@@ -13,6 +13,16 @@
 
 static const char *ethsw_name;
 
+#define ETHSW_PORT_STATS_HELP "ethsw [port <port_no>] statistics " \
+"{ [help] | [clear] } - show an l2 switch port's statistics"
+
+static int ethsw_port_stats_help_key_func(struct ethsw_command_def *parsed_cmd)
+{
+	printf(ETHSW_PORT_STATS_HELP"\n");
+
+	return CMD_RET_SUCCESS;
+}
+
 static struct keywords_to_function {
 	enum ethsw_keyword_id cmd_keyword[ETHSW_MAX_CMD_PARAMS];
 	int cmd_func_offset;
@@ -42,6 +52,31 @@ static struct keywords_to_function {
 			.cmd_func_offset = offsetof(struct ethsw_command_func,
 						    port_show),
 			.keyword_function = NULL,
+		}, {
+			.cmd_keyword = {
+					ethsw_id_statistics,
+					ethsw_id_help,
+					ethsw_id_key_end,
+			},
+			.cmd_func_offset = -1,
+			.keyword_function = &ethsw_port_stats_help_key_func,
+		}, {
+			.cmd_keyword = {
+					ethsw_id_statistics,
+					ethsw_id_key_end,
+			},
+			.cmd_func_offset = offsetof(struct ethsw_command_func,
+						    port_stats),
+			.keyword_function = NULL,
+		}, {
+			.cmd_keyword = {
+					ethsw_id_statistics,
+					ethsw_id_clear,
+					ethsw_id_key_end,
+			},
+			.cmd_func_offset = offsetof(struct ethsw_command_func,
+						    port_stats_clear),
+			.keyword_function = NULL,
 		},
 };
 
@@ -88,6 +123,12 @@ struct keyword_def {
 		}, {
 				.keyword_name = "disable",
 				.match = &keyword_match_gen,
+		}, {
+				.keyword_name = "statistics",
+				.match = &keyword_match_gen,
+		}, {
+				.keyword_name = "clear",
+				.match = &keyword_match_gen,
 		},
 };
 
@@ -343,4 +384,5 @@ static int do_ethsw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 U_BOOT_CMD(ethsw, ETHSW_MAX_CMD_PARAMS, 0, do_ethsw,
 	   "Ethernet l2 switch commands",
 	   ETHSW_PORT_CONF_HELP"\n"
+	   ETHSW_PORT_STATS_HELP"\n"
 );
diff --git a/drivers/net/vsc9953.c b/drivers/net/vsc9953.c
index bf53535..1dddb44 100644
--- a/drivers/net/vsc9953.c
+++ b/drivers/net/vsc9953.c
@@ -500,6 +500,223 @@ static void vsc9953_port_config_show(int port_no)
 	printf("%8s\n", duplex == DUPLEX_FULL ? "full" : "half");
 }
 
+/* Show VSC9953 ports' statistics */
+static void vsc9953_port_statistics_show(int port_no)
+{
+	u32 rx_val;
+	u32 tx_val;
+	struct vsc9953_system_reg *l2sys_reg;
+
+	/* Administrative down */
+	if (!vsc9953_l2sw.port[port_no].enabled) {
+		printf("Port %d is administrative down\n", port_no);
+		return;
+	}
+
+	l2sys_reg = (struct vsc9953_system_reg *)(VSC9953_OFFSET +
+			VSC9953_SYS_OFFSET);
+
+	printf("Statistics for L2 Switch port %d:\n", port_no);
+
+	/* Set counter view for our port */
+	out_le32(&l2sys_reg->sys.stat_cfg, port_no);
+
+#define VSC9953_STATS_PRINTF "%-15s %10u"
+
+	/* Get number of Rx and Tx frames */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_short) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_frag) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_jabber) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_long) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_64) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_65_127) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_128_255) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_256_511) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_512_1023) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_1024_1526) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_jumbo);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_64) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_65_127) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_128_255) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_256_511) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_512_1023) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_1024_1526) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_jumbo);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx frames:", rx_val, "Tx frames:", tx_val);
+
+	/* Get number of Rx and Tx bytes */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_oct);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_oct);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx bytes:", rx_val, "Tx bytes:", tx_val);
+
+	/* Get number of Rx frames received ok and Tx frames sent ok */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_0) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_1) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_2) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_3) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_4) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_5) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_6) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_yellow_prio_7) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_0) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_1) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_2) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_3) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_4) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_5) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_6) +
+		 in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_green_prio_7);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_64) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_65_127) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_128_255) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_256_511) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_512_1023) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_1024_1526) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_jumbo);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx frames ok:", rx_val, "Tx frames ok:", tx_val);
+
+	/* Get number of Rx and Tx unicast frames */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_uc);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_uc);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx unicast:", rx_val, "Tx unicast:", tx_val);
+
+	/* Get number of Rx and Tx broadcast frames */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_bc);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_bc);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx broadcast:", rx_val, "Tx broadcast:", tx_val);
+
+	/* Get number of Rx and Tx frames of 64B */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_64);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_64);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx 64B:", rx_val, "Tx 64B:", tx_val);
+
+	/* Get number of Rx and Tx frames with sizes between 65B and 127B */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_65_127);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_65_127);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx 65B-127B:", rx_val, "Tx 65B-127B:", tx_val);
+
+	/* Get number of Rx and Tx frames with sizes between 128B and 255B */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_128_255);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_128_255);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx 128B-255B:", rx_val, "Tx 128B-255B:", tx_val);
+
+	/* Get number of Rx and Tx frames with sizes between 256B and 511B */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_256_511);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_256_511);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx 256B-511B:", rx_val, "Tx 256B-511B:", tx_val);
+
+	/* Get number of Rx and Tx frames with sizes between 512B and 1023B */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_512_1023);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_512_1023);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx 512B-1023B:", rx_val, "Tx 512B-1023B:", tx_val);
+
+	/* Get number of Rx and Tx frames with sizes between 1024B and 1526B */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_1024_1526);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_1024_1526);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx 1024B-1526B:", rx_val, "Tx 1024B-1526B:", tx_val);
+
+	/* Get number of Rx and Tx jumbo frames */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_sz_jumbo);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_sz_jumbo);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx jumbo:", rx_val, "Tx jumbo:", tx_val);
+
+	/* Get number of Rx and Tx dropped frames */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_cat_drop) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_tail) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_0) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_1) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_2) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_3) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_4) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_5) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_6) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_yellow_prio_7) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_0) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_1) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_2) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_3) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_4) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_5) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_6) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_green_prio_7);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_drop) +
+		 in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_aged);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx drops:", rx_val, "Tx drops:", tx_val);
+
+	/*
+	 * Get number of Rx frames with CRC or alignment errors
+	 * and number of detected Tx collisions
+	 */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_crc);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_col);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx CRC&align:", rx_val, "Tx coll:", tx_val);
+
+	/*
+	 * Get number of Rx undersized frames and
+	 * number of Tx aged frames
+	 */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_short);
+	tx_val = in_le32(&l2sys_reg->stat.tx_cntrs.c_tx_aged);
+	printf(VSC9953_STATS_PRINTF"\t\t"VSC9953_STATS_PRINTF"\n",
+	       "Rx undersize:", rx_val, "Tx aged:", tx_val);
+
+	/* Get number of Rx oversized frames */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_long);
+	printf(VSC9953_STATS_PRINTF"\n", "Rx oversized:", rx_val);
+
+	/* Get number of Rx fragmented frames */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_frag);
+	printf(VSC9953_STATS_PRINTF"\n", "Rx fragments:", rx_val);
+
+	/* Get number of Rx jabber errors */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_jabber);
+	printf(VSC9953_STATS_PRINTF"\n", "Rx jabbers:", rx_val);
+
+	/*
+	 * Get number of Rx frames filtered due to classification rules or
+	 * no destination ports
+	 */
+	rx_val = in_le32(&l2sys_reg->stat.rx_cntrs.c_rx_cat_drop) +
+		 in_le32(&l2sys_reg->stat.drop_cntrs.c_dr_local);
+	printf(VSC9953_STATS_PRINTF"\n", "Rx filtered:", rx_val);
+
+	printf("\n");
+}
+
+/* Clear statistics for a VSC9953 port */
+static void vsc9953_port_statistics_clear(int port_no)
+{
+	struct vsc9953_system_reg *l2sys_reg;
+
+	/* Administrative down */
+	if (!vsc9953_l2sw.port[port_no].enabled) {
+		printf("Port %d is administrative down\n", port_no);
+		return;
+	}
+
+	l2sys_reg = (struct vsc9953_system_reg *)(VSC9953_OFFSET +
+			VSC9953_SYS_OFFSET);
+
+	/* Clear all counter groups for our ports */
+	out_le32(&l2sys_reg->sys.stat_cfg, port_no |
+		 VSC9953_STAT_CLEAR_RX | VSC9953_STAT_CLEAR_TX |
+		 VSC9953_STAT_CLEAR_DR);
+}
+
 static int vsc9953_port_status_key_func(struct ethsw_command_def *parsed_cmd)
 {
 	int i;
@@ -556,11 +773,50 @@ static int vsc9953_port_config_key_func(struct ethsw_command_def *parsed_cmd)
 	return CMD_RET_SUCCESS;
 }
 
+static int vsc9953_port_stats_key_func(struct ethsw_command_def *parsed_cmd)
+{
+	int i;
+
+	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
+		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
+			printf("Invalid port number: %d\n", parsed_cmd->port);
+			return CMD_RET_FAILURE;
+		}
+		vsc9953_port_statistics_show(parsed_cmd->port);
+	} else {
+		for (i = 0; i < VSC9953_MAX_PORTS; i++)
+			vsc9953_port_statistics_show(i);
+	}
+
+	return CMD_RET_SUCCESS;
+}
+
+static int vsc9953_port_stats_clear_key_func(struct ethsw_command_def
+					     *parsed_cmd)
+{
+	int i;
+
+	if (parsed_cmd->port != ETHSW_CMD_PORT_ALL) {
+		if (!VSC9953_PORT_CHECK(parsed_cmd->port)) {
+			printf("Invalid port number: %d\n", parsed_cmd->port);
+			return CMD_RET_FAILURE;
+		}
+		vsc9953_port_statistics_clear(parsed_cmd->port);
+	} else {
+		for (i = 0; i < VSC9953_MAX_PORTS; i++)
+			vsc9953_port_statistics_clear(i);
+	}
+
+	return CMD_RET_SUCCESS;
+}
+
 static struct ethsw_command_func vsc9953_cmd_func = {
 		.ethsw_name = "L2 Switch VSC9953",
 		.port_enable = &vsc9953_port_status_key_func,
 		.port_disable = &vsc9953_port_status_key_func,
 		.port_show = &vsc9953_port_config_key_func,
+		.port_stats = &vsc9953_port_stats_key_func,
+		.port_stats_clear = &vsc9953_port_stats_clear_key_func,
 };
 
 #endif /* CONFIG_CMD_ETHSW */
diff --git a/include/ethsw.h b/include/ethsw.h
index 9e80095..8f1c414 100644
--- a/include/ethsw.h
+++ b/include/ethsw.h
@@ -20,6 +20,8 @@ enum ethsw_keyword_id {
 	ethsw_id_port,
 	ethsw_id_enable,
 	ethsw_id_disable,
+	ethsw_id_statistics,
+	ethsw_id_clear,
 	ethsw_id_count,	/* keep last */
 };
 
@@ -41,6 +43,8 @@ struct ethsw_command_func {
 	int (*port_enable)(struct ethsw_command_def *parsed_cmd);
 	int (*port_disable)(struct ethsw_command_def *parsed_cmd);
 	int (*port_show)(struct ethsw_command_def *parsed_cmd);
+	int (*port_stats)(struct ethsw_command_def *parsed_cmd);
+	int (*port_stats_clear)(struct ethsw_command_def *parsed_cmd);
 };
 
 int ethsw_define_functions(const struct ethsw_command_func *cmd_func);
diff --git a/include/vsc9953.h b/include/vsc9953.h
index bb9e22d..83c4c89 100644
--- a/include/vsc9953.h
+++ b/include/vsc9953.h
@@ -77,6 +77,11 @@
 /* Macros for vsc9953_sys_pause_cfgtot_tail_drop_lvl register */
 #define VSC9953_TOT_TAIL_DROP_LVL	0x000003ff
 
+/* Macros for vsc9953_sys_sys.stat_cfg register */
+#define VSC9953_STAT_CLEAR_RX		0x00000400
+#define VSC9953_STAT_CLEAR_TX		0x00000800
+#define VSC9953_STAT_CLEAR_DR		0x00001000
+
 /* Macros for vsc9953_vcap_core_cfg.vcap_mv_cfg register */
 #define VSC9953_VCAP_MV_CFG		0x0000ffff
 #define VSC9953_VCAP_UPDATE_CTRL	0x01000004
@@ -332,10 +337,115 @@ struct vsc9953_qsys_reg {
 
 /* VSC9953 SYS structure */
 
+struct vsc9953_rx_cntrs {
+	u32	c_rx_oct;
+	u32	c_rx_uc;
+	u32	c_rx_mc;
+	u32	c_rx_bc;
+	u32	c_rx_short;
+	u32	c_rx_frag;
+	u32	c_rx_jabber;
+	u32	c_rx_crc;
+	u32	c_rx_symbol_err;
+	u32	c_rx_sz_64;
+	u32	c_rx_sz_65_127;
+	u32	c_rx_sz_128_255;
+	u32	c_rx_sz_256_511;
+	u32	c_rx_sz_512_1023;
+	u32	c_rx_sz_1024_1526;
+	u32	c_rx_sz_jumbo;
+	u32	c_rx_pause;
+	u32	c_rx_control;
+	u32	c_rx_long;
+	u32	c_rx_cat_drop;
+	u32	c_rx_red_prio_0;
+	u32	c_rx_red_prio_1;
+	u32	c_rx_red_prio_2;
+	u32	c_rx_red_prio_3;
+	u32	c_rx_red_prio_4;
+	u32	c_rx_red_prio_5;
+	u32	c_rx_red_prio_6;
+	u32	c_rx_red_prio_7;
+	u32	c_rx_yellow_prio_0;
+	u32	c_rx_yellow_prio_1;
+	u32	c_rx_yellow_prio_2;
+	u32	c_rx_yellow_prio_3;
+	u32	c_rx_yellow_prio_4;
+	u32	c_rx_yellow_prio_5;
+	u32	c_rx_yellow_prio_6;
+	u32	c_rx_yellow_prio_7;
+	u32	c_rx_green_prio_0;
+	u32	c_rx_green_prio_1;
+	u32	c_rx_green_prio_2;
+	u32	c_rx_green_prio_3;
+	u32	c_rx_green_prio_4;
+	u32	c_rx_green_prio_5;
+	u32	c_rx_green_prio_6;
+	u32	c_rx_green_prio_7;
+	u32	reserved[20];
+};
+
+struct vsc9953_tx_cntrs {
+	u32	c_tx_oct;
+	u32	c_tx_uc;
+	u32	c_tx_mc;
+	u32	c_tx_bc;
+	u32	c_tx_col;
+	u32	c_tx_drop;
+	u32	c_tx_pause;
+	u32	c_tx_sz_64;
+	u32	c_tx_sz_65_127;
+	u32	c_tx_sz_128_255;
+	u32	c_tx_sz_256_511;
+	u32	c_tx_sz_512_1023;
+	u32	c_tx_sz_1024_1526;
+	u32	c_tx_sz_jumbo;
+	u32	c_tx_yellow_prio_0;
+	u32	c_tx_yellow_prio_1;
+	u32	c_tx_yellow_prio_2;
+	u32	c_tx_yellow_prio_3;
+	u32	c_tx_yellow_prio_4;
+	u32	c_tx_yellow_prio_5;
+	u32	c_tx_yellow_prio_6;
+	u32	c_tx_yellow_prio_7;
+	u32	c_tx_green_prio_0;
+	u32	c_tx_green_prio_1;
+	u32	c_tx_green_prio_2;
+	u32	c_tx_green_prio_3;
+	u32	c_tx_green_prio_4;
+	u32	c_tx_green_prio_5;
+	u32	c_tx_green_prio_6;
+	u32	c_tx_green_prio_7;
+	u32	c_tx_aged;
+	u32	reserved[33];
+};
+
+struct vsc9953_drop_cntrs {
+	u32	c_dr_local;
+	u32	c_dr_tail;
+	u32	c_dr_yellow_prio_0;
+	u32	c_dr_yellow_prio_1;
+	u32	c_dr_yellow_prio_2;
+	u32	c_dr_yellow_prio_3;
+	u32	c_dr_yellow_prio_4;
+	u32	c_dr_yellow_prio_5;
+	u32	c_dr_yellow_prio_6;
+	u32	c_dr_yellow_prio_7;
+	u32	c_dr_green_prio_0;
+	u32	c_dr_green_prio_1;
+	u32	c_dr_green_prio_2;
+	u32	c_dr_green_prio_3;
+	u32	c_dr_green_prio_4;
+	u32	c_dr_green_prio_5;
+	u32	c_dr_green_prio_6;
+	u32	c_dr_green_prio_7;
+	u32	reserved[46];
+};
+
 struct vsc9953_sys_stat {
-	u32	rx_cntrs[64];
-	u32	tx_cntrs[64];
-	u32	drop_cntrs[64];
+	struct vsc9953_rx_cntrs	rx_cntrs;
+	struct vsc9953_tx_cntrs	tx_cntrs;
+	struct vsc9953_drop_cntrs	drop_cntrs;
 	u32	reserved1[6];
 };
 
-- 
1.9.3



More information about the U-Boot mailing list