* [PATCH net-next v7 0/2] Add support for ICSSG PA_STATS
@ 2024-08-22 12:26 MD Danish Anwar
2024-08-22 12:26 ` [PATCH net-next v7 1/2] dt-bindings: soc: ti: pruss: Add documentation for PA_STATS support MD Danish Anwar
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: MD Danish Anwar @ 2024-08-22 12:26 UTC (permalink / raw)
To: Suman Anna, Sai Krishna, Jan Kiszka, Dan Carpenter,
Heiner Kallweit, Diogo Ivo, Kory Maincent, Andrew Lunn,
Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller,
Roger Quadros, MD Danish Anwar, Conor Dooley, Krzysztof Kozlowski,
Rob Herring, Santosh Shilimkar, Nishanth Menon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel, srk,
Vignesh Raghavendra
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 isnce v6:
*) Addressed Roger's comments and renamed stats related data strcutures
and array so that they remain consitent.
*) Re-ordered data structures and arrays related to stats type as asked
by Roger.
*) Modified commit message to state these additional changes
Changes since v5:
*) Used ARRAY_SIZE(icssg_all_pa_stats) instead of ICSSG_NUM_PA_STATS so
that it's consistent with the loop as suggested by Dan Carpenter
<dan.carpenter@linaro.org>
*) Created emac->pa_stats array for storing pa_stats as suggested by
Dan Carpenter <dan.carpenter@linaro.org>
*) Renamed `icssg_all_stats` to `icssg_mii_g_rt_stats`.
*) Added entry for pa_stats in kernel doc for structure prueth as asked by
Simon Horman <horms@kernel.org>.
*) Improved syntax for kernel doc of pa_stats_regs register by dropping
u32 from kernel doc.
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 <nm@ti.com>
*) Dropped device tree patches as they don't need merge now.
*) Modified patch 2 to use ethtool_puts() as suggested by Jakub Kicinski
<kuba@kernel.org>
Changes since v3:
*) Added full series as asked by Nishanth Menon <nm@ti.com>
Changes from v2 to v3:
*) Added RB tag of Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> 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
<krzk@kernel.org>
*) Moved additionalProperties: false to right after type:object as
suggested by Krzysztof Kozlowski <krzk@kernel.org>
*) Updated description of pa-stats to explain the purpose of PA_STATS
module in context of ICSSG.
v1 https://lore.kernel.org/all/20240430121915.1561359-1-danishanwar@ti.com/
v2 https://lore.kernel.org/all/20240529115149.630273-1-danishanwar@ti.com/
v3 https://lore.kernel.org/all/20240625153319.795665-1-danishanwar@ti.com/
v4 https://lore.kernel.org/all/20240729113226.2905928-1-danishanwar@ti.com/
v5 https://lore.kernel.org/all/20240814092033.2984734-1-danishanwar@ti.com/
v6 https://lore.kernel.org/all/20240820091657.4068304-1-danishanwar@ti.com/
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 | 19 ++-
drivers/net/ethernet/ti/icssg/icssg_prueth.c | 6 +
drivers/net/ethernet/ti/icssg/icssg_prueth.h | 9 +-
drivers/net/ethernet/ti/icssg/icssg_stats.c | 31 +++-
drivers/net/ethernet/ti/icssg/icssg_stats.h | 158 +++++++++++-------
6 files changed, 160 insertions(+), 83 deletions(-)
base-commit: 812a2751e827fa1eb01f3bd268b4d74c23f4226a
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next v7 1/2] dt-bindings: soc: ti: pruss: Add documentation for PA_STATS support
2024-08-22 12:26 [PATCH net-next v7 0/2] Add support for ICSSG PA_STATS MD Danish Anwar
@ 2024-08-22 12:26 ` MD Danish Anwar
2024-08-22 12:26 ` [PATCH net-next v7 2/2] net: ti: icssg-prueth: Add support for PA Stats MD Danish Anwar
2024-08-26 16:40 ` [PATCH net-next v7 0/2] Add support for ICSSG PA_STATS patchwork-bot+netdevbpf
2 siblings, 0 replies; 8+ messages in thread
From: MD Danish Anwar @ 2024-08-22 12:26 UTC (permalink / raw)
To: Suman Anna, Sai Krishna, Jan Kiszka, Dan Carpenter,
Heiner Kallweit, Diogo Ivo, Kory Maincent, Andrew Lunn,
Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller,
Roger Quadros, MD Danish Anwar, Conor Dooley, Krzysztof Kozlowski,
Rob Herring, Santosh Shilimkar, Nishanth Menon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel, srk,
Vignesh Raghavendra, Krzysztof Kozlowski
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.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
---
.../devicetree/bindings/soc/ti/ti,pruss.yaml | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml b/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
index c402cb2928e8..3cb1471cc6b6 100644
--- a/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
+++ b/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
@@ -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
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next v7 2/2] net: ti: icssg-prueth: Add support for PA Stats
2024-08-22 12:26 [PATCH net-next v7 0/2] Add support for ICSSG PA_STATS MD Danish Anwar
2024-08-22 12:26 ` [PATCH net-next v7 1/2] dt-bindings: soc: ti: pruss: Add documentation for PA_STATS support MD Danish Anwar
@ 2024-08-22 12:26 ` MD Danish Anwar
2024-09-02 7:22 ` Jan Kiszka
2024-08-26 16:40 ` [PATCH net-next v7 0/2] Add support for ICSSG PA_STATS patchwork-bot+netdevbpf
2 siblings, 1 reply; 8+ messages in thread
From: MD Danish Anwar @ 2024-08-22 12:26 UTC (permalink / raw)
To: Suman Anna, Sai Krishna, Jan Kiszka, Dan Carpenter,
Heiner Kallweit, Diogo Ivo, Kory Maincent, Andrew Lunn,
Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller,
Roger Quadros, MD Danish Anwar, Conor Dooley, Krzysztof Kozlowski,
Rob Herring, Santosh Shilimkar, Nishanth Menon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel, srk,
Vignesh Raghavendra
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().
This commit also maintains consistency between miig_stats and pa_stats by
- renaming the array icssg_all_stats to icssg_all_miig_stats
- renaming the structure icssg_stats to icssg_miig_stats
- renaming ICSSG_STATS() to ICSSG_MIIG_STATS()
- changing order of stats related data structures and arrays so that data
structures of a certain stats type is clubbed together.
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
---
drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 19 ++-
drivers/net/ethernet/ti/icssg/icssg_prueth.c | 6 +
drivers/net/ethernet/ti/icssg/icssg_prueth.h | 9 +-
drivers/net/ethernet/ti/icssg/icssg_stats.c | 31 +++-
drivers/net/ethernet/ti/icssg/icssg_stats.h | 158 +++++++++++-------
5 files changed, 140 insertions(+), 83 deletions(-)
diff --git a/drivers/net/ethernet/ti/icssg/icssg_ethtool.c b/drivers/net/ethernet/ti/icssg/icssg_ethtool.c
index 5688f054cec5..5073ec195854 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_ethtool.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_ethtool.c
@@ -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_miig_stats); i++)
+ if (!icssg_all_miig_stats[i].standard_stats)
+ ethtool_puts(&p, icssg_all_miig_stats[i].name);
+ for (i = 0; i < ARRAY_SIZE(icssg_all_pa_stats); i++)
+ ethtool_puts(&p, icssg_all_pa_stats[i].name);
break;
default:
break;
@@ -104,9 +102,12 @@ static void emac_get_ethtool_stats(struct net_device *ndev,
emac_update_hardware_stats(emac);
- for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++)
- if (!icssg_all_stats[i].standard_stats)
+ for (i = 0; i < ARRAY_SIZE(icssg_all_miig_stats); i++)
+ if (!icssg_all_miig_stats[i].standard_stats)
*(data++) = emac->stats[i];
+
+ for (i = 0; i < ARRAY_SIZE(icssg_all_pa_stats); i++)
+ *(data++) = emac->pa_stats[i];
}
static int emac_get_ts_info(struct net_device *ndev,
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index 53a3e44b99a2..f623a0f603fc 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -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)
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.h b/drivers/net/ethernet/ti/icssg/icssg_prueth.h
index f678d656a3ed..786bd1ba34ab 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.h
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.h
@@ -50,8 +50,10 @@
#define ICSSG_MAX_RFLOWS 8 /* per slice */
+#define ICSSG_NUM_PA_STATS 4
+#define ICSSG_NUM_MIIG_STATS 60
/* Number of ICSSG related stats */
-#define ICSSG_NUM_STATS 60
+#define ICSSG_NUM_STATS (ICSSG_NUM_MIIG_STATS + ICSSG_NUM_PA_STATS)
#define ICSSG_NUM_STANDARD_STATS 31
#define ICSSG_NUM_ETHTOOL_STATS (ICSSG_NUM_STATS - ICSSG_NUM_STANDARD_STATS)
@@ -190,7 +192,8 @@ struct prueth_emac {
int port_vlan;
struct delayed_work stats_work;
- u64 stats[ICSSG_NUM_STATS];
+ u64 stats[ICSSG_NUM_MIIG_STATS];
+ u64 pa_stats[ICSSG_NUM_PA_STATS];
/* RX IRQ Coalescing Related */
struct hrtimer rx_hrtimer;
@@ -230,6 +233,7 @@ struct icssg_firmwares {
* @registered_netdevs: list of registered netdevs
* @miig_rt: regmap to mii_g_rt block
* @mii_rt: regmap to mii_rt block
+ * @pa_stats: regmap to pa_stats block
* @pru_id: ID for each of the PRUs
* @pdev: pointer to ICSSG platform device
* @pdata: pointer to platform data for ICSSG driver
@@ -263,6 +267,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;
diff --git a/drivers/net/ethernet/ti/icssg/icssg_stats.c b/drivers/net/ethernet/ti/icssg/icssg_stats.c
index 2fb150c13078..06a15c0b2acc 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_stats.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_stats.c
@@ -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,24 +23,31 @@ 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;
+ u32 val, reg;
int i;
- for (i = 0; i < ARRAY_SIZE(icssg_all_stats); i++) {
+ for (i = 0; i < ARRAY_SIZE(icssg_all_miig_stats); i++) {
regmap_read(prueth->miig_rt,
- base + icssg_all_stats[i].offset,
+ base + icssg_all_miig_stats[i].offset,
&val);
regmap_write(prueth->miig_rt,
- base + icssg_all_stats[i].offset,
+ base + icssg_all_miig_stats[i].offset,
val);
- if (icssg_all_stats[i].offset == ICSSG_TX_PACKET_OFFSET)
+ if (icssg_all_miig_stats[i].offset == ICSSG_TX_PACKET_OFFSET)
tx_pkt_cnt = val;
emac->stats[i] += val;
- if (icssg_all_stats[i].offset == ICSSG_TX_BYTE_OFFSET)
+ if (icssg_all_miig_stats[i].offset == ICSSG_TX_BYTE_OFFSET)
emac->stats[i] -= tx_pkt_cnt * 8;
}
+
+ for (i = 0; i < ARRAY_SIZE(icssg_all_pa_stats); i++) {
+ reg = ICSSG_FW_STATS_BASE + icssg_all_pa_stats[i].offset *
+ PRUETH_NUM_MACS + slice * sizeof(u32);
+ regmap_read(prueth->pa_stats, reg, &val);
+ emac->pa_stats[i] += val;
+ }
}
void icssg_stats_work_handler(struct work_struct *work)
@@ -57,9 +65,14 @@ int emac_get_stat_by_name(struct prueth_emac *emac, char *stat_name)
{
int i;
- 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 (i = 0; i < ARRAY_SIZE(icssg_all_miig_stats); i++) {
+ if (!strcmp(icssg_all_miig_stats[i].name, stat_name))
+ return emac->stats[icssg_all_miig_stats[i].offset / sizeof(u32)];
+ }
+
+ for (i = 0; i < ARRAY_SIZE(icssg_all_pa_stats); i++) {
+ if (!strcmp(icssg_all_pa_stats[i].name, stat_name))
+ return emac->pa_stats[icssg_all_pa_stats[i].offset / sizeof(u32)];
}
netdev_err(emac->ndev, "Invalid stats %s\n", stat_name);
diff --git a/drivers/net/ethernet/ti/icssg/icssg_stats.h b/drivers/net/ethernet/ti/icssg/icssg_stats.h
index 999a4a91276c..e88b919f532c 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_stats.h
+++ b/drivers/net/ethernet/ti/icssg/icssg_stats.h
@@ -77,82 +77,114 @@ struct miig_stats_regs {
u32 tx_bytes;
};
-#define ICSSG_STATS(field, stats_type) \
+#define ICSSG_MIIG_STATS(field, stats_type) \
{ \
#field, \
offsetof(struct miig_stats_regs, field), \
stats_type \
}
-struct icssg_stats {
+struct icssg_miig_stats {
char name[ETH_GSTRING_LEN];
u32 offset;
bool standard_stats;
};
-static const struct icssg_stats icssg_all_stats[] = {
+static const struct icssg_miig_stats icssg_all_miig_stats[] = {
/* Rx */
- ICSSG_STATS(rx_packets, true),
- ICSSG_STATS(rx_broadcast_frames, false),
- ICSSG_STATS(rx_multicast_frames, true),
- ICSSG_STATS(rx_crc_errors, true),
- ICSSG_STATS(rx_mii_error_frames, false),
- ICSSG_STATS(rx_odd_nibble_frames, false),
- ICSSG_STATS(rx_frame_max_size, true),
- ICSSG_STATS(rx_max_size_error_frames, false),
- ICSSG_STATS(rx_frame_min_size, true),
- ICSSG_STATS(rx_min_size_error_frames, false),
- ICSSG_STATS(rx_over_errors, true),
- ICSSG_STATS(rx_class0_hits, false),
- ICSSG_STATS(rx_class1_hits, false),
- ICSSG_STATS(rx_class2_hits, false),
- ICSSG_STATS(rx_class3_hits, false),
- ICSSG_STATS(rx_class4_hits, false),
- ICSSG_STATS(rx_class5_hits, false),
- ICSSG_STATS(rx_class6_hits, false),
- ICSSG_STATS(rx_class7_hits, false),
- ICSSG_STATS(rx_class8_hits, false),
- ICSSG_STATS(rx_class9_hits, false),
- ICSSG_STATS(rx_class10_hits, false),
- ICSSG_STATS(rx_class11_hits, false),
- ICSSG_STATS(rx_class12_hits, false),
- ICSSG_STATS(rx_class13_hits, false),
- ICSSG_STATS(rx_class14_hits, false),
- ICSSG_STATS(rx_class15_hits, false),
- ICSSG_STATS(rx_smd_frags, false),
- ICSSG_STATS(rx_bucket1_size, true),
- ICSSG_STATS(rx_bucket2_size, true),
- ICSSG_STATS(rx_bucket3_size, true),
- ICSSG_STATS(rx_bucket4_size, true),
- ICSSG_STATS(rx_64B_frames, true),
- ICSSG_STATS(rx_bucket1_frames, true),
- ICSSG_STATS(rx_bucket2_frames, true),
- ICSSG_STATS(rx_bucket3_frames, true),
- ICSSG_STATS(rx_bucket4_frames, true),
- ICSSG_STATS(rx_bucket5_frames, true),
- ICSSG_STATS(rx_bytes, true),
- ICSSG_STATS(rx_tx_total_bytes, false),
+ ICSSG_MIIG_STATS(rx_packets, true),
+ ICSSG_MIIG_STATS(rx_broadcast_frames, false),
+ ICSSG_MIIG_STATS(rx_multicast_frames, true),
+ ICSSG_MIIG_STATS(rx_crc_errors, true),
+ ICSSG_MIIG_STATS(rx_mii_error_frames, false),
+ ICSSG_MIIG_STATS(rx_odd_nibble_frames, false),
+ ICSSG_MIIG_STATS(rx_frame_max_size, true),
+ ICSSG_MIIG_STATS(rx_max_size_error_frames, false),
+ ICSSG_MIIG_STATS(rx_frame_min_size, true),
+ ICSSG_MIIG_STATS(rx_min_size_error_frames, false),
+ ICSSG_MIIG_STATS(rx_over_errors, true),
+ ICSSG_MIIG_STATS(rx_class0_hits, false),
+ ICSSG_MIIG_STATS(rx_class1_hits, false),
+ ICSSG_MIIG_STATS(rx_class2_hits, false),
+ ICSSG_MIIG_STATS(rx_class3_hits, false),
+ ICSSG_MIIG_STATS(rx_class4_hits, false),
+ ICSSG_MIIG_STATS(rx_class5_hits, false),
+ ICSSG_MIIG_STATS(rx_class6_hits, false),
+ ICSSG_MIIG_STATS(rx_class7_hits, false),
+ ICSSG_MIIG_STATS(rx_class8_hits, false),
+ ICSSG_MIIG_STATS(rx_class9_hits, false),
+ ICSSG_MIIG_STATS(rx_class10_hits, false),
+ ICSSG_MIIG_STATS(rx_class11_hits, false),
+ ICSSG_MIIG_STATS(rx_class12_hits, false),
+ ICSSG_MIIG_STATS(rx_class13_hits, false),
+ ICSSG_MIIG_STATS(rx_class14_hits, false),
+ ICSSG_MIIG_STATS(rx_class15_hits, false),
+ ICSSG_MIIG_STATS(rx_smd_frags, false),
+ ICSSG_MIIG_STATS(rx_bucket1_size, true),
+ ICSSG_MIIG_STATS(rx_bucket2_size, true),
+ ICSSG_MIIG_STATS(rx_bucket3_size, true),
+ ICSSG_MIIG_STATS(rx_bucket4_size, true),
+ ICSSG_MIIG_STATS(rx_64B_frames, true),
+ ICSSG_MIIG_STATS(rx_bucket1_frames, true),
+ ICSSG_MIIG_STATS(rx_bucket2_frames, true),
+ ICSSG_MIIG_STATS(rx_bucket3_frames, true),
+ ICSSG_MIIG_STATS(rx_bucket4_frames, true),
+ ICSSG_MIIG_STATS(rx_bucket5_frames, true),
+ ICSSG_MIIG_STATS(rx_bytes, true),
+ ICSSG_MIIG_STATS(rx_tx_total_bytes, false),
/* Tx */
- ICSSG_STATS(tx_packets, true),
- ICSSG_STATS(tx_broadcast_frames, false),
- ICSSG_STATS(tx_multicast_frames, false),
- ICSSG_STATS(tx_odd_nibble_frames, false),
- ICSSG_STATS(tx_underflow_errors, false),
- ICSSG_STATS(tx_frame_max_size, true),
- ICSSG_STATS(tx_max_size_error_frames, false),
- ICSSG_STATS(tx_frame_min_size, true),
- ICSSG_STATS(tx_min_size_error_frames, false),
- ICSSG_STATS(tx_bucket1_size, true),
- ICSSG_STATS(tx_bucket2_size, true),
- ICSSG_STATS(tx_bucket3_size, true),
- ICSSG_STATS(tx_bucket4_size, true),
- ICSSG_STATS(tx_64B_frames, true),
- ICSSG_STATS(tx_bucket1_frames, true),
- ICSSG_STATS(tx_bucket2_frames, true),
- ICSSG_STATS(tx_bucket3_frames, true),
- ICSSG_STATS(tx_bucket4_frames, true),
- ICSSG_STATS(tx_bucket5_frames, true),
- ICSSG_STATS(tx_bytes, true),
+ ICSSG_MIIG_STATS(tx_packets, true),
+ ICSSG_MIIG_STATS(tx_broadcast_frames, false),
+ ICSSG_MIIG_STATS(tx_multicast_frames, false),
+ ICSSG_MIIG_STATS(tx_odd_nibble_frames, false),
+ ICSSG_MIIG_STATS(tx_underflow_errors, false),
+ ICSSG_MIIG_STATS(tx_frame_max_size, true),
+ ICSSG_MIIG_STATS(tx_max_size_error_frames, false),
+ ICSSG_MIIG_STATS(tx_frame_min_size, true),
+ ICSSG_MIIG_STATS(tx_min_size_error_frames, false),
+ ICSSG_MIIG_STATS(tx_bucket1_size, true),
+ ICSSG_MIIG_STATS(tx_bucket2_size, true),
+ ICSSG_MIIG_STATS(tx_bucket3_size, true),
+ ICSSG_MIIG_STATS(tx_bucket4_size, true),
+ ICSSG_MIIG_STATS(tx_64B_frames, true),
+ ICSSG_MIIG_STATS(tx_bucket1_frames, true),
+ ICSSG_MIIG_STATS(tx_bucket2_frames, true),
+ ICSSG_MIIG_STATS(tx_bucket3_frames, true),
+ ICSSG_MIIG_STATS(tx_bucket4_frames, true),
+ ICSSG_MIIG_STATS(tx_bucket5_frames, true),
+ ICSSG_MIIG_STATS(tx_bytes, true),
+};
+
+/**
+ * struct pa_stats_regs - ICSSG Firmware maintained PA Stats register
+ * @fw_rx_cnt: Number of valid packets sent by Rx PRU to Host on PSI
+ * @fw_tx_cnt: Number of valid packets copied by RTU0 to Tx queues
+ * @fw_tx_pre_overflow: Host Egress Q (Pre-emptible) Overflow Counter
+ * @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_PA_STATS(field) \
+{ \
+ #field, \
+ offsetof(struct pa_stats_regs, field), \
+}
+
+struct icssg_pa_stats {
+ char name[ETH_GSTRING_LEN];
+ u32 offset;
+};
+
+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 */
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v7 0/2] Add support for ICSSG PA_STATS
2024-08-22 12:26 [PATCH net-next v7 0/2] Add support for ICSSG PA_STATS MD Danish Anwar
2024-08-22 12:26 ` [PATCH net-next v7 1/2] dt-bindings: soc: ti: pruss: Add documentation for PA_STATS support MD Danish Anwar
2024-08-22 12:26 ` [PATCH net-next v7 2/2] net: ti: icssg-prueth: Add support for PA Stats MD Danish Anwar
@ 2024-08-26 16:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-26 16:40 UTC (permalink / raw)
To: MD Danish Anwar
Cc: nm, andrew, vigneshr, jan.kiszka, edumazet, dan.carpenter, robh,
saikrishnag, diogo.ivo, kuba, pabeni, devicetree, conor+dt,
rogerq, ssantosh, linux-arm-kernel, srk, kory.maincent, netdev,
linux-kernel, krzk+dt, davem, hkallweit1
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 22 Aug 2024 17:56:50 +0530 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net-next,v7,1/2] dt-bindings: soc: ti: pruss: Add documentation for PA_STATS support
https://git.kernel.org/netdev/net-next/c/be91edc81b09
- [net-next,v7,2/2] net: ti: icssg-prueth: Add support for PA Stats
https://git.kernel.org/netdev/net-next/c/550ee90ac61c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v7 2/2] net: ti: icssg-prueth: Add support for PA Stats
2024-08-22 12:26 ` [PATCH net-next v7 2/2] net: ti: icssg-prueth: Add support for PA Stats MD Danish Anwar
@ 2024-09-02 7:22 ` Jan Kiszka
2024-09-02 7:28 ` Anwar, Md Danish
0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2024-09-02 7:22 UTC (permalink / raw)
To: MD Danish Anwar, Suman Anna, Sai Krishna, Dan Carpenter,
Heiner Kallweit, Diogo Ivo, Kory Maincent, Andrew Lunn,
Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller,
Roger Quadros, Conor Dooley, Krzysztof Kozlowski, Rob Herring,
Santosh Shilimkar, Nishanth Menon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel, srk,
Vignesh Raghavendra
On 22.08.24 14:26, MD Danish Anwar wrote:
> 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().
>
> This commit also maintains consistency between miig_stats and pa_stats by
> - renaming the array icssg_all_stats to icssg_all_miig_stats
> - renaming the structure icssg_stats to icssg_miig_stats
> - renaming ICSSG_STATS() to ICSSG_MIIG_STATS()
> - changing order of stats related data structures and arrays so that data
> structures of a certain stats type is clubbed together.
>
> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
> ---
> drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 19 ++-
> drivers/net/ethernet/ti/icssg/icssg_prueth.c | 6 +
> drivers/net/ethernet/ti/icssg/icssg_prueth.h | 9 +-
> drivers/net/ethernet/ti/icssg/icssg_stats.c | 31 +++-
> drivers/net/ethernet/ti/icssg/icssg_stats.h | 158 +++++++++++-------
> 5 files changed, 140 insertions(+), 83 deletions(-)
>
...
> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
> index 53a3e44b99a2..f623a0f603fc 100644
> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
> @@ -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;
I was just beaten for potentially not being backward compatible, but
this is definitely not working with existing DTs, just ran into it.
Jan
--
Siemens AG, Technology
Linux Expert Center
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v7 2/2] net: ti: icssg-prueth: Add support for PA Stats
2024-09-02 7:22 ` Jan Kiszka
@ 2024-09-02 7:28 ` Anwar, Md Danish
2024-09-02 7:34 ` Jan Kiszka
0 siblings, 1 reply; 8+ messages in thread
From: Anwar, Md Danish @ 2024-09-02 7:28 UTC (permalink / raw)
To: Jan Kiszka, MD Danish Anwar, Suman Anna, Sai Krishna,
Dan Carpenter, Heiner Kallweit, Diogo Ivo, Kory Maincent,
Andrew Lunn, Paolo Abeni, Jakub Kicinski, Eric Dumazet,
David S. Miller, Roger Quadros, Conor Dooley, Krzysztof Kozlowski,
Rob Herring, Santosh Shilimkar, Nishanth Menon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel, srk,
Vignesh Raghavendra
On 9/2/2024 12:52 PM, Jan Kiszka wrote:
> On 22.08.24 14:26, MD Danish Anwar wrote:
>> 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().
>>
>> This commit also maintains consistency between miig_stats and pa_stats by
>> - renaming the array icssg_all_stats to icssg_all_miig_stats
>> - renaming the structure icssg_stats to icssg_miig_stats
>> - renaming ICSSG_STATS() to ICSSG_MIIG_STATS()
>> - changing order of stats related data structures and arrays so that data
>> structures of a certain stats type is clubbed together.
>>
>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
>> ---
>> drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 19 ++-
>> drivers/net/ethernet/ti/icssg/icssg_prueth.c | 6 +
>> drivers/net/ethernet/ti/icssg/icssg_prueth.h | 9 +-
>> drivers/net/ethernet/ti/icssg/icssg_stats.c | 31 +++-
>> drivers/net/ethernet/ti/icssg/icssg_stats.h | 158 +++++++++++-------
>> 5 files changed, 140 insertions(+), 83 deletions(-)
>>
>
> ...
>
>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>> index 53a3e44b99a2..f623a0f603fc 100644
>> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>> @@ -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;
>
> I was just beaten for potentially not being backward compatible, but
> this is definitely not working with existing DTs, just ran into it.
>
Jan, I had posted the DT patch needed for this [1]. But the DT patch
goes to different tree and it was dependent on binding patch of this
series. My intention was once the binding is in, I will post the DT
patch in the next window. Till then ICSSG driver will break here but
once DT gets merged it will be alright. If that's not the best solution,
I can post DT here, but it will need to get merged via net-next.
[1] https://lore.kernel.org/all/20240729113226.2905928-4-danishanwar@ti.com/
> Jan
>
--
Thanks and Regards,
Md Danish Anwar
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v7 2/2] net: ti: icssg-prueth: Add support for PA Stats
2024-09-02 7:28 ` Anwar, Md Danish
@ 2024-09-02 7:34 ` Jan Kiszka
2024-09-02 7:51 ` Anwar, Md Danish
0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2024-09-02 7:34 UTC (permalink / raw)
To: Anwar, Md Danish, MD Danish Anwar, Suman Anna, Sai Krishna,
Dan Carpenter, Heiner Kallweit, Diogo Ivo, Kory Maincent,
Andrew Lunn, Paolo Abeni, Jakub Kicinski, Eric Dumazet,
David S. Miller, Roger Quadros, Conor Dooley, Krzysztof Kozlowski,
Rob Herring, Santosh Shilimkar, Nishanth Menon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel, srk,
Vignesh Raghavendra
On 02.09.24 09:28, Anwar, Md Danish wrote:
>
>
> On 9/2/2024 12:52 PM, Jan Kiszka wrote:
>> On 22.08.24 14:26, MD Danish Anwar wrote:
>>> 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().
>>>
>>> This commit also maintains consistency between miig_stats and pa_stats by
>>> - renaming the array icssg_all_stats to icssg_all_miig_stats
>>> - renaming the structure icssg_stats to icssg_miig_stats
>>> - renaming ICSSG_STATS() to ICSSG_MIIG_STATS()
>>> - changing order of stats related data structures and arrays so that data
>>> structures of a certain stats type is clubbed together.
>>>
>>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
>>> ---
>>> drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 19 ++-
>>> drivers/net/ethernet/ti/icssg/icssg_prueth.c | 6 +
>>> drivers/net/ethernet/ti/icssg/icssg_prueth.h | 9 +-
>>> drivers/net/ethernet/ti/icssg/icssg_stats.c | 31 +++-
>>> drivers/net/ethernet/ti/icssg/icssg_stats.h | 158 +++++++++++-------
>>> 5 files changed, 140 insertions(+), 83 deletions(-)
>>>
>>
>> ...
>>
>>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>>> index 53a3e44b99a2..f623a0f603fc 100644
>>> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>>> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>>> @@ -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;
>>
>> I was just beaten for potentially not being backward compatible, but
>> this is definitely not working with existing DTs, just ran into it.
>>
>
> Jan, I had posted the DT patch needed for this [1]. But the DT patch
> goes to different tree and it was dependent on binding patch of this
> series. My intention was once the binding is in, I will post the DT
> patch in the next window. Till then ICSSG driver will break here but
> once DT gets merged it will be alright. If that's not the best solution,
> I can post DT here, but it will need to get merged via net-next.
>
> [1] https://lore.kernel.org/all/20240729113226.2905928-4-danishanwar@ti.com/
>
Why not respect in the driver that the dtbinding says this property is
only optional?
Jan
--
Siemens AG, Technology
Linux Expert Center
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v7 2/2] net: ti: icssg-prueth: Add support for PA Stats
2024-09-02 7:34 ` Jan Kiszka
@ 2024-09-02 7:51 ` Anwar, Md Danish
0 siblings, 0 replies; 8+ messages in thread
From: Anwar, Md Danish @ 2024-09-02 7:51 UTC (permalink / raw)
To: Jan Kiszka, MD Danish Anwar, Suman Anna, Sai Krishna,
Dan Carpenter, Heiner Kallweit, Diogo Ivo, Kory Maincent,
Andrew Lunn, Paolo Abeni, Jakub Kicinski, Eric Dumazet,
David S. Miller, Roger Quadros, Conor Dooley, Krzysztof Kozlowski,
Rob Herring, Santosh Shilimkar, Nishanth Menon
Cc: netdev, devicetree, linux-arm-kernel, linux-kernel, srk,
Vignesh Raghavendra
On 9/2/2024 1:04 PM, Jan Kiszka wrote:
> On 02.09.24 09:28, Anwar, Md Danish wrote:
>>
>>
>> On 9/2/2024 12:52 PM, Jan Kiszka wrote:
>>> On 22.08.24 14:26, MD Danish Anwar wrote:
>>>> 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().
>>>>
>>>> This commit also maintains consistency between miig_stats and pa_stats by
>>>> - renaming the array icssg_all_stats to icssg_all_miig_stats
>>>> - renaming the structure icssg_stats to icssg_miig_stats
>>>> - renaming ICSSG_STATS() to ICSSG_MIIG_STATS()
>>>> - changing order of stats related data structures and arrays so that data
>>>> structures of a certain stats type is clubbed together.
>>>>
>>>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
>>>> ---
>>>> drivers/net/ethernet/ti/icssg/icssg_ethtool.c | 19 ++-
>>>> drivers/net/ethernet/ti/icssg/icssg_prueth.c | 6 +
>>>> drivers/net/ethernet/ti/icssg/icssg_prueth.h | 9 +-
>>>> drivers/net/ethernet/ti/icssg/icssg_stats.c | 31 +++-
>>>> drivers/net/ethernet/ti/icssg/icssg_stats.h | 158 +++++++++++-------
>>>> 5 files changed, 140 insertions(+), 83 deletions(-)
>>>>
>>>
>>> ...
>>>
>>>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>>>> index 53a3e44b99a2..f623a0f603fc 100644
>>>> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>>>> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>>>> @@ -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;
>>>
>>> I was just beaten for potentially not being backward compatible, but
>>> this is definitely not working with existing DTs, just ran into it.
>>>
>>
>> Jan, I had posted the DT patch needed for this [1]. But the DT patch
>> goes to different tree and it was dependent on binding patch of this
>> series. My intention was once the binding is in, I will post the DT
>> patch in the next window. Till then ICSSG driver will break here but
>> once DT gets merged it will be alright. If that's not the best solution,
>> I can post DT here, but it will need to get merged via net-next.
>>
>> [1] https://lore.kernel.org/all/20240729113226.2905928-4-danishanwar@ti.com/
>>
>
> Why not respect in the driver that the dtbinding says this property is
> only optional?
>
Sure Jan, In that case, I will send out a fix making this optional in
driver.
--
Thanks and Regards,
Md Danish Anwar
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-09-02 8:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22 12:26 [PATCH net-next v7 0/2] Add support for ICSSG PA_STATS MD Danish Anwar
2024-08-22 12:26 ` [PATCH net-next v7 1/2] dt-bindings: soc: ti: pruss: Add documentation for PA_STATS support MD Danish Anwar
2024-08-22 12:26 ` [PATCH net-next v7 2/2] net: ti: icssg-prueth: Add support for PA Stats MD Danish Anwar
2024-09-02 7:22 ` Jan Kiszka
2024-09-02 7:28 ` Anwar, Md Danish
2024-09-02 7:34 ` Jan Kiszka
2024-09-02 7:51 ` Anwar, Md Danish
2024-08-26 16:40 ` [PATCH net-next v7 0/2] Add support for ICSSG PA_STATS patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).