Skip to contentSkip to conversation

Add support for ICSSG PA_STATS

PATCH Superseded MD Danish Anwar 4 participants 7 messages Aug 14, 2024 – Aug 19, 2024

Subsystems (5)

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

MD Danish Anwar

author reviewer
#0 lore raw

v5 cover Add support for ICSSG PA_STATS

Hi,

This series adds support for PA_STATS. Previously this series was a standalone patch adding documentation for PA_STATS in dt-bindings file ti,pruss.yaml.

As discussed in v4, posting driver and binding patch together.

Changes since v4:
*) Added net-next to both driver and binding patch as they are both now
meant to be merged via net-next.
*) Added Acked by tag of Nishanth Menon <[email protected]>
*) Dropped device tree patches as they don't need merge now. *) Modified patch 2 to use ethtool_puts() as suggested by Jakub Kicinski
<[email protected]>

Changes since v3:
*) Added full series as asked by Nishanth Menon <[email protected]>

Changes from v2 to v3:
*) Added RB tag of Krzysztof Kozlowski <[email protected]> to
patch 2/2
*) Added patch 1/2 to the series as the binding file is orphan.

Changes from v1 to v2:
*) Added ^ in pa-stats as suggested by Krzysztof Kozlowski
<[email protected]>
*) Moved additionalProperties: false to right after type:object as
suggested by Krzysztof Kozlowski <[email protected]>
*) Updated description of pa-stats to explain the purpose of PA_STATS
module in context of ICSSG.

v1 https://lore.kernel.org/all/[email protected]/
v2 https://lore.kernel.org/all/[email protected]/
v3 https://lore.kernel.org/all/[email protected]/
v4 https://lore.kernel.org/all/[email protected]/

MD Danish Anwar (2):
dt-bindings: soc: ti: pruss: Add documentation for PA_STATS support
net: ti: icssg-prueth: Add support for PA Stats

 .../devicetree/bindings/soc/ti/ti,pruss.yaml  | 20 ++++++++++++
 drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 17 +++++-----
 drivers/net/ethernet/ti/icssg/icssg_prueth.c  |  6 ++++
 drivers/net/ethernet/ti/icssg/icssg_prueth.h  |  5 ++-
 drivers/net/ethernet/ti/icssg/icssg_stats.c   | 19 +++++++++--
 drivers/net/ethernet/ti/icssg/icssg_stats.h   | 32 +++++++++++++++++++
 6 files changed, 87 insertions(+), 12 deletions(-)

base-commit: 712f585ab8b2cc2ff4e441b14a4907f764d78f2b

Signature · 1 line
2.34.1
author reviewer
#1 lore raw

PATCH v5 1/2 dt-bindings: soc: ti: pruss: Add documentation for PA_STATS support

Add documentation for pa-stats node which is syscon regmap for PA_STATS registers. This will be used to dump statistics maintained by ICSSG firmware.

---
 .../devicetree/bindings/soc/ti/ti,pruss.yaml  | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml +20 -0
index c402cb2928e8..3cb1471cc6b6 100644
@@ -278,6 +278,26 @@ patternProperties:
 
     additionalProperties: false
 
+  ^pa-stats@[a-f0-9]+$:
+    description: |
+      PA-STATS sub-module represented as a SysCon. PA_STATS is a set of
+      registers where different statistics related to ICSSG, are dumped by
+      ICSSG firmware. This syscon sub-module will help the device to
+      access/read/write those statistics.
+
+    type: object
+
+    additionalProperties: false
+
+    properties:
+      compatible:
+        items:
+          - const: ti,pruss-pa-st
+          - const: syscon
+
+      reg:
+        maxItems: 1
+
   interrupt-controller@[a-f0-9]+$:
     description: |
       PRUSS INTC Node. Each PRUSS has a single interrupt controller instance
Signature · 1 line
2.34.1
author reviewer
#2 lore raw

PATCH v5 2/2 net: ti: icssg-prueth: Add support for PA Stats

In reply to MD Danish Anwar

Add support for dumping PA stats registers via ethtool. Firmware maintained stats are stored at PA Stats registers. Also modify emac_get_strings() API to use ethtool_puts().

---
 drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 17 +++++-----
 drivers/net/ethernet/ti/icssg/icssg_prueth.c  |  6 ++++
 drivers/net/ethernet/ti/icssg/icssg_prueth.h  |  5 ++-
 drivers/net/ethernet/ti/icssg/icssg_stats.c   | 19 +++++++++--
 drivers/net/ethernet/ti/icssg/icssg_stats.h   | 32 +++++++++++++++++++
 5 files changed, 67 insertions(+), 12 deletions(-)
drivers/net/ethernet/ti/icssg/icssg_ethtool.c +9 -8
index 5688f054cec5..51bb509d37c7 100644
@@ -83,13 +83,11 @@ static void emac_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
 
 	switch (stringset) {
 	case ETH_SS_STATS:
-		for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++) {
-			if (!icssg_all_stats[i].standard_stats) {
-				memcpy(p, icssg_all_stats[i].name,
-				       ETH_GSTRING_LEN);
-				p += ETH_GSTRING_LEN;
-			}
-		}
+		for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++)
+			if (!icssg_all_stats[i].standard_stats)
+				ethtool_puts(&p, icssg_all_stats[i].name);
+		for (i = 0; i < ICSSG_NUM_PA_STATS; i++)
+			ethtool_puts(&p, icssg_all_pa_stats[i].name);
 		break;
 	default:
 		break;
@@ -100,13 +98,16 @@ static void emac_get_ethtool_stats(struct net_device *ndev,
 				   struct ethtool_stats *stats, u64 *data)
 {
 	struct prueth_emac *emac = netdev_priv(ndev);
-	int i;
+	int i, j;
 
 	emac_update_hardware_stats(emac);
 
 	for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++)
 		if (!icssg_all_stats[i].standard_stats)
 			*(data++) = emac->stats[i];
+
+	for (j = 0; j < ICSSG_NUM_PA_STATS; j++)
+		*(data++) = emac->stats[i + j];
 }
 
 static int emac_get_ts_info(struct net_device *ndev,
drivers/net/ethernet/ti/icssg/icssg_prueth.c +6 -0
index 53a3e44b99a2..f623a0f603fc 100644
@@ -1182,6 +1182,12 @@ static int prueth_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
+	prueth->pa_stats = syscon_regmap_lookup_by_phandle(np, "ti,pa-stats");
+	if (IS_ERR(prueth->pa_stats)) {
+		dev_err(dev, "couldn't get ti,pa-stats syscon regmap\n");
+		return -ENODEV;
+	}
+
 	if (eth0_node) {
 		ret = prueth_get_cores(prueth, ICSS_SLICE0, false);
 		if (ret)
drivers/net/ethernet/ti/icssg/icssg_prueth.h +4 -1
index f678d656a3ed..ac2291d22c42 100644
@@ -50,8 +50,10 @@
 
 #define ICSSG_MAX_RFLOWS	8	/* per slice */
 
+#define ICSSG_NUM_PA_STATS 4
+#define ICSSG_NUM_MII_G_RT_STATS 60
 /* Number of ICSSG related stats */
-#define ICSSG_NUM_STATS 60
+#define ICSSG_NUM_STATS (ICSSG_NUM_MII_G_RT_STATS + ICSSG_NUM_PA_STATS)
 #define ICSSG_NUM_STANDARD_STATS 31
 #define ICSSG_NUM_ETHTOOL_STATS (ICSSG_NUM_STATS - ICSSG_NUM_STANDARD_STATS)
 
@@ -263,6 +265,7 @@ struct prueth {
 	struct net_device *registered_netdevs[PRUETH_NUM_MACS];
 	struct regmap *miig_rt;
 	struct regmap *mii_rt;
+	struct regmap *pa_stats;
 
 	enum pruss_pru_id pru_id[PRUSS_NUM_PRUS];
 	struct platform_device *pdev;
drivers/net/ethernet/ti/icssg/icssg_stats.c +16 -3
index 2fb150c13078..ce6606e4a369 100644
@@ -11,6 +11,7 @@
 
 #define ICSSG_TX_PACKET_OFFSET	0xA0
 #define ICSSG_TX_BYTE_OFFSET	0xEC
+#define ICSSG_FW_STATS_BASE	0x0248
 
 static u32 stats_base[] = {	0x54c,	/* Slice 0 stats start */
 				0xb18,	/* Slice 1 stats start */
@@ -22,8 +23,8 @@ void emac_update_hardware_stats(struct prueth_emac *emac)
 	int slice = prueth_emac_slice(emac);
 	u32 base = stats_base[slice];
 	u32 tx_pkt_cnt = 0;
-	u32 val;
-	int i;
+	u32 val, reg;
+	int i, j;
 
 	for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++) {
 		regmap_read(prueth->miig_rt,
@@ -40,6 +41,13 @@ void emac_update_hardware_stats(struct prueth_emac *emac)
 		if (icssg_all_stats[i].offset == ICSSG_TX_BYTE_OFFSET)
 			emac->stats[i] -= tx_pkt_cnt * 8;
 	}
+
+	for (j = 0; j < ICSSG_NUM_PA_STATS; j++) {
+		reg = ICSSG_FW_STATS_BASE + icssg_all_pa_stats[j].offset *
+		      PRUETH_NUM_MACS + slice * sizeof(u32);
+		regmap_read(prueth->pa_stats, reg, &val);
+		emac->stats[i + j] += val;
+	}
 }
 
 void icssg_stats_work_handler(struct work_struct *work)
@@ -55,13 +63,18 @@ EXPORT_SYMBOL_GPL(icssg_stats_work_handler);
 
 int emac_get_stat_by_name(struct prueth_emac *emac, char *stat_name)
 {
-	int i;
+	int i, j;
 
 	for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++) {
 		if (!strcmp(icssg_all_stats[i].name, stat_name))
 			return emac->stats[icssg_all_stats[i].offset / sizeof(u32)];
 	}
 
+	for (j = 0; j < ICSSG_NUM_PA_STATS; j++) {
+		if (!strcmp(icssg_all_pa_stats[j].name, stat_name))
+			return emac->stats[i + icssg_all_pa_stats[j].offset / sizeof(u32)];
+	}
+
 	netdev_err(emac->ndev, "Invalid stats %s\n", stat_name);
 	return -EINVAL;
 }
drivers/net/ethernet/ti/icssg/icssg_stats.h +32 -0
index 999a4a91276c..e834316092c9 100644
@@ -77,6 +77,20 @@ struct miig_stats_regs {
 	u32 tx_bytes;
 };
 
+/**
+ * struct pa_stats_regs - ICSSG Firmware maintained PA Stats register
+ * @u32 fw_rx_cnt: Number of valid packets sent by Rx PRU to Host on PSI
+ * @u32 fw_tx_cnt: Number of valid packets copied by RTU0 to Tx queues
+ * @u32 fw_tx_pre_overflow: Host Egress Q (Pre-emptible) Overflow Counter
+ * @u32 fw_tx_exp_overflow: Host Egress Q (Express) Overflow Counter
+ */
+struct pa_stats_regs {
+	u32 fw_rx_cnt;
+	u32 fw_tx_cnt;
+	u32 fw_tx_pre_overflow;
+	u32 fw_tx_exp_overflow;
+};
+
 #define ICSSG_STATS(field, stats_type)			\
 {							\
 	#field,						\
@@ -84,12 +98,23 @@ struct miig_stats_regs {
 	stats_type					\
 }
 
+#define ICSSG_PA_STATS(field)			\
+{						\
+	#field,					\
+	offsetof(struct pa_stats_regs, field),	\
+}
+
 struct icssg_stats {
 	char name[ETH_GSTRING_LEN];
 	u32 offset;
 	bool standard_stats;
 };
 
+struct icssg_pa_stats {
+	char name[ETH_GSTRING_LEN];
+	u32 offset;
+};
+
 static const struct icssg_stats icssg_all_stats[] = {
 	/* Rx */
 	ICSSG_STATS(rx_packets, true),
@@ -155,4 +180,11 @@ static const struct icssg_stats icssg_all_stats[] = {
 	ICSSG_STATS(tx_bytes, true),
 };
 
+static const struct icssg_pa_stats icssg_all_pa_stats[] = {
+	ICSSG_PA_STATS(fw_rx_cnt),
+	ICSSG_PA_STATS(fw_tx_cnt),
+	ICSSG_PA_STATS(fw_tx_pre_overflow),
+	ICSSG_PA_STATS(fw_tx_exp_overflow),
+};
+
 #endif /* __NET_TI_ICSSG_STATS_H */
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH net-next v5 2/2] net: ti: icssg-prueth: Add support for PA Stats

Quoted 22 lines · MD Danish Anwar

Add support for dumping PA stats registers via ethtool. Firmware maintained stats are stored at PA Stats registers. Also modify emac_get_strings() API to use ethtool_puts().

---
 drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 17 +++++-----
 drivers/net/ethernet/ti/icssg/icssg_prueth.c  |  6 ++++
 drivers/net/ethernet/ti/icssg/icssg_prueth.h  |  5 ++-
 drivers/net/ethernet/ti/icssg/icssg_stats.c   | 19 +++++++++--
 drivers/net/ethernet/ti/icssg/icssg_stats.h   | 32 +++++++++++++++++++
 5 files changed, 67 insertions(+), 12 deletions(-)
drivers/net/ethernet/ti/icssg/icssg_ethtool.c +0 -1
index 5688f054cec5..51bb509d37c7 100644
@@ -83,13 +83,11 @@ static void emac_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
 
 	switch (stringset) {
 	case ETH_SS_STATS:
-		for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++) {

drivers/net/ethernet/ti/icssg/icssg_ethtool.c static void emac_get_strings(struct net_device *ndev, u32 stringset, u8 *data) · line 89

Quoted 10 lines
drivers/net/ethernet/ti/icssg/icssg_ethtool.c +4 -6
-			if (!icssg_all_stats[i].standard_stats) {
-				memcpy(p, icssg_all_stats[i].name,
-				       ETH_GSTRING_LEN);
-				p += ETH_GSTRING_LEN;
-			}
-		}
+		for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++)
+			if (!icssg_all_stats[i].standard_stats)
+				ethtool_puts(&p, icssg_all_stats[i].name);
+		for (i = 0; i < ICSSG_NUM_PA_STATS; i++)

It would probably be better to use ARRAY_SIZE(icssg_all_pa_stats) so that it's consistent with the loop right before.

Quoted 9 lines
drivers/net/ethernet/ti/icssg/icssg_ethtool.c +1 -1
+			ethtool_puts(&p, icssg_all_pa_stats[i].name);
 		break;
 	default:
 		break;
@@ -100,13 +98,16 @@ static void emac_get_ethtool_stats(struct net_device *ndev,
 				   struct ethtool_stats *stats, u64 *data)
 {
 	struct prueth_emac *emac = netdev_priv(ndev);
-	int i;

drivers/net/ethernet/ti/icssg/icssg_ethtool.c static void emac_get_ethtool_stats(struct net_device *ndev, · line 110

Quoted 10 lines
drivers/net/ethernet/ti/icssg/icssg_ethtool.c +4 -0
+	int i, j;
 
 	emac_update_hardware_stats(emac);
 
 	for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++)
 		if (!icssg_all_stats[i].standard_stats)
 			*(data++) = emac->stats[i];
+
+	for (j = 0; j < ICSSG_NUM_PA_STATS; j++)
+		*(data++) = emac->stats[i + j];

Here i is not an iterator. It's a stand in for ARRAY_SIZE(icssg_all_stats). It would be more readable to do that directly.

	for (i = 0; i < ICSSG_NUM_PA_STATS; i++)
		*(data++) = emac->stats[ARRAY_SIZE(icssg_all_stats) + i];

To be honest, putting the pa_stats at the end of ->stats would have made sense if we could have looped over the whole array, but since they have to be treated differently we should probably just put them into their own ->pa_stats array.

I haven't tested this so maybe I've missed something obvious.

The "all" in "icssg_all_stats" doesn't really make sense anymore btw...

Sorry for being so nit picky on a v5 patch. :(

regards,
dan carpenter

#4 lore raw

Re: [PATCH net-next v5 2/2] net: ti: icssg-prueth: Add support for PA Stats

Quoted 20 lines · Dan Carpenter
Quoted 19 lines · MD Danish Anwar

Add support for dumping PA stats registers via ethtool. Firmware maintained stats are stored at PA Stats registers. Also modify emac_get_strings() API to use ethtool_puts().

---
 drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 17 +++++-----
 drivers/net/ethernet/ti/icssg/icssg_prueth.c  |  6 ++++
 drivers/net/ethernet/ti/icssg/icssg_prueth.h  |  5 ++-
 drivers/net/ethernet/ti/icssg/icssg_stats.c   | 19 +++++++++--
 drivers/net/ethernet/ti/icssg/icssg_stats.h   | 32 +++++++++++++++++++
 5 files changed, 67 insertions(+), 12 deletions(-)
drivers/net/ethernet/ti/icssg/icssg_ethtool.c +0 -0
index 5688f054cec5..51bb509d37c7 100644
@@ -83,13 +83,11 @@ static void emac_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
 
Quoted 16 lines

drivers/net/ethernet/ti/icssg/icssg_ethtool.c static void emac_get_strings(struct net_device *ndev, u32 stringset, u8 *data) · line 89

Quoted 13 lines
drivers/net/ethernet/ti/icssg/icssg_ethtool.c +4 -7
 	switch (stringset) {
 	case ETH_SS_STATS:
-		for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++) {
-			if (!icssg_all_stats[i].standard_stats) {
-				memcpy(p, icssg_all_stats[i].name,
-				       ETH_GSTRING_LEN);
-				p += ETH_GSTRING_LEN;
-			}
-		}
+		for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++)
+			if (!icssg_all_stats[i].standard_stats)
+				ethtool_puts(&p, icssg_all_stats[i].name);
+		for (i = 0; i < ICSSG_NUM_PA_STATS; i++)

It would probably be better to use ARRAY_SIZE(icssg_all_pa_stats) so that it's consistent with the loop right before.

Sure Dan.

Quoted 24 lines
Quoted 10 lines
drivers/net/ethernet/ti/icssg/icssg_ethtool.c +1 -1
+			ethtool_puts(&p, icssg_all_pa_stats[i].name);
 		break;
 	default:
 		break;
@@ -100,13 +98,16 @@ static void emac_get_ethtool_stats(struct net_device *ndev,
 				   struct ethtool_stats *stats, u64 *data)
 {
 	struct prueth_emac *emac = netdev_priv(ndev);
-	int i;

drivers/net/ethernet/ti/icssg/icssg_ethtool.c static void emac_get_ethtool_stats(struct net_device *ndev, · line 110

Quoted 10 lines
drivers/net/ethernet/ti/icssg/icssg_ethtool.c +4 -0
+	int i, j;
 
 	emac_update_hardware_stats(emac);
 
 	for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++)
 		if (!icssg_all_stats[i].standard_stats)
 			*(data++) = emac->stats[i];
+
+	for (j = 0; j < ICSSG_NUM_PA_STATS; j++)
+		*(data++) = emac->stats[i + j];

Here i is not an iterator. It's a stand in for ARRAY_SIZE(icssg_all_stats). It would be more readable to do that directly.

Quoted 7 lines
	for (i = 0; i < ICSSG_NUM_PA_STATS; i++)
		*(data++) = emac->stats[ARRAY_SIZE(icssg_all_stats) + i];

To be honest, putting the pa_stats at the end of ->stats would have made sense if we could have looped over the whole array, but since they have to be treated differently we should probably just put them into their own ->pa_stats array.

Sure Dan. It will make more sense to have different array for pa_stats. I will do this change and update.

Quoted 4 lines

I haven't tested this so maybe I've missed something obvious.

The "all" in "icssg_all_stats" doesn't really make sense anymore btw...

Correct, the "icssg_all_stats" should be renamed to "icssg_mii_g_rt_stats".

Quoted 2 lines

Sorry for being so nit picky on a v5 patch. :(

It's okay. Thanks for the review. I will address all these comments and send out a v6.

Quoted 3 lines

regards,
dan carpenter

Signature · 2 lines
Thanks and Regards,
Md Danish Anwar
reviewer
#5 lore raw

Re: [PATCH net-next v5 2/2] net: ti: icssg-prueth: Add support for PA Stats

In reply to MD Danish Anwar

On Wed, Aug 14, 2024 at 02:50:33PM +0530, MD Danish Anwar wrote:

...

Quoted 17 lines
drivers/net/ethernet/ti/icssg/icssg_prueth.h +3 -1
index f678d656a3ed..ac2291d22c42 100644
@@ -50,8 +50,10 @@
 
 #define ICSSG_MAX_RFLOWS	8	/* per slice */
 
+#define ICSSG_NUM_PA_STATS 4
+#define ICSSG_NUM_MII_G_RT_STATS 60
 /* Number of ICSSG related stats */
-#define ICSSG_NUM_STATS 60
+#define ICSSG_NUM_STATS (ICSSG_NUM_MII_G_RT_STATS + ICSSG_NUM_PA_STATS)
 #define ICSSG_NUM_STANDARD_STATS 31
 #define ICSSG_NUM_ETHTOOL_STATS (ICSSG_NUM_STATS - ICSSG_NUM_STANDARD_STATS)
 

drivers/net/ethernet/ti/icssg/icssg_prueth.h struct prueth { · line 268

Quoted 4 lines
drivers/net/ethernet/ti/icssg/icssg_prueth.h +1 -0
@@ -263,6 +265,7 @@ struct prueth {
 	struct net_device *registered_netdevs[PRUETH_NUM_MACS];
 	struct regmap *miig_rt;
 	struct regmap *mii_rt;
+	struct regmap *pa_stats;

Please add an entry for pa_stats to the Kernel doc for this structure.

Quoted 3 lines
drivers/net/ethernet/ti/icssg/icssg_prueth.h +0 -0
 	enum pruss_pru_id pru_id[PRUSS_NUM_PRUS];
 	struct platform_device *pdev;

...

Quoted 5 lines
drivers/net/ethernet/ti/icssg/icssg_stats.h +0 -0
index 999a4a91276c..e834316092c9 100644

drivers/net/ethernet/ti/icssg/icssg_stats.h struct miig_stats_regs { · line 86

Quoted 10 lines
drivers/net/ethernet/ti/icssg/icssg_stats.h +7 -0
@@ -77,6 +77,20 @@ struct miig_stats_regs {
 	u32 tx_bytes;
 };
 
+/**
+ * struct pa_stats_regs - ICSSG Firmware maintained PA Stats register
+ * @u32 fw_rx_cnt: Number of valid packets sent by Rx PRU to Host on PSI
+ * @u32 fw_tx_cnt: Number of valid packets copied by RTU0 to Tx queues
+ * @u32 fw_tx_pre_overflow: Host Egress Q (Pre-emptible) Overflow Counter
+ * @u32 fw_tx_exp_overflow: Host Egress Q (Express) Overflow Counter
+ */

./scripts/kernel-doc -none doesn't seem to like the syntax above. Perhaps s/u32 // ?

Quoted 10 lines
drivers/net/ethernet/ti/icssg/icssg_stats.h +7 -0
+struct pa_stats_regs {
+	u32 fw_rx_cnt;
+	u32 fw_tx_cnt;
+	u32 fw_tx_pre_overflow;
+	u32 fw_tx_exp_overflow;
+};
+
 #define ICSSG_STATS(field, stats_type)			\
 {							\
 	#field,						\

...

#6 lore raw

Re: [PATCH net-next v5 2/2] net: ti: icssg-prueth: Add support for PA Stats

Quoted 42 lines · Simon Horman

On Wed, Aug 14, 2024 at 02:50:33PM +0530, MD Danish Anwar wrote:

...

Quoted 17 lines
drivers/net/ethernet/ti/icssg/icssg_prueth.h +3 -1
index f678d656a3ed..ac2291d22c42 100644
@@ -50,8 +50,10 @@
 
 #define ICSSG_MAX_RFLOWS	8	/* per slice */
 
+#define ICSSG_NUM_PA_STATS 4
+#define ICSSG_NUM_MII_G_RT_STATS 60
 /* Number of ICSSG related stats */
-#define ICSSG_NUM_STATS 60
+#define ICSSG_NUM_STATS (ICSSG_NUM_MII_G_RT_STATS + ICSSG_NUM_PA_STATS)
 #define ICSSG_NUM_STANDARD_STATS 31
 #define ICSSG_NUM_ETHTOOL_STATS (ICSSG_NUM_STATS - ICSSG_NUM_STANDARD_STATS)
 

drivers/net/ethernet/ti/icssg/icssg_prueth.h struct prueth { · line 268

Quoted 4 lines
drivers/net/ethernet/ti/icssg/icssg_prueth.h +1 -0
@@ -263,6 +265,7 @@ struct prueth {
 	struct net_device *registered_netdevs[PRUETH_NUM_MACS];
 	struct regmap *miig_rt;
 	struct regmap *mii_rt;
+	struct regmap *pa_stats;

Please add an entry for pa_stats to the Kernel doc for this structure.

Quoted 3 lines
drivers/net/ethernet/ti/icssg/icssg_prueth.h +0 -0
 	enum pruss_pru_id pru_id[PRUSS_NUM_PRUS];
 	struct platform_device *pdev;

...

Quoted 8 lines
drivers/net/ethernet/ti/icssg/icssg_stats.h +0 -0
index 999a4a91276c..e834316092c9 100644
@@ -77,6 +77,20 @@ struct miig_stats_regs {
 	u32 tx_bytes;
 };
 
Quoted 10 lines

drivers/net/ethernet/ti/icssg/icssg_stats.h struct miig_stats_regs { · line 86

Quoted 7 lines
drivers/net/ethernet/ti/icssg/icssg_stats.h +7 -0
+/**
+ * struct pa_stats_regs - ICSSG Firmware maintained PA Stats register
+ * @u32 fw_rx_cnt: Number of valid packets sent by Rx PRU to Host on PSI
+ * @u32 fw_tx_cnt: Number of valid packets copied by RTU0 to Tx queues
+ * @u32 fw_tx_pre_overflow: Host Egress Q (Pre-emptible) Overflow Counter
+ * @u32 fw_tx_exp_overflow: Host Egress Q (Express) Overflow Counter
+ */

./scripts/kernel-doc -none doesn't seem to like the syntax above. Perhaps s/u32 // ?

Sure, I will drop u32 from comment.

Quoted 13 lines
Quoted 11 lines
drivers/net/ethernet/ti/icssg/icssg_stats.h +7 -0
+struct pa_stats_regs {
+	u32 fw_rx_cnt;
+	u32 fw_tx_cnt;
+	u32 fw_tx_pre_overflow;
+	u32 fw_tx_exp_overflow;
+};
+
 #define ICSSG_STATS(field, stats_type)			\
 {							\
 	#field,						\

...

Signature · 2 lines
Thanks and Regards,
Md Danish Anwar