All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v1 0/3] net: stmmac: Add ethtool per-queue statistic
@ 2021-08-16  6:15 ` Vijayakannan Ayyathurai
  0 siblings, 0 replies; 16+ messages in thread
From: Vijayakannan Ayyathurai @ 2021-08-16  6:15 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba, mcoquelin.stm32
  Cc: vee.khee.wong, weifeng.voon, vijayakannan.ayyathurai, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

Adding generic ethtool per-queue statistic framework to display the
statistics for each rx/tx queue. In future, users can avail it to add
more per-queue specific counters. Number of rx/tx queues displayed is
depending on the available rx/tx queues in that particular MAC config
and this number is limited up to the MTL_MAX_{RX|TX}_QUEUES defined
in the driver.

Ethtool per-queue statistic display will look like below, when users
start adding more counters.

Example - 1:
 q0_tx_statA:
 q0_tx_statB:
 q0_tx_statC:
 |
 q0_tx_statX:
 .
 .
 .
 qMAX_tx_statA:
 qMAX_tx_statB:
 qMAX_tx_statC:
 |
 qMAX_tx_statX:

 q0_rx_statA:
 q0_rx_statB:
 q0_rx_statC:
 |
 q0_rx_statX:
 .
 .
 .
 qMAX_rx_statA:
 qMAX_rx_statB:
 qMAX_rx_statC:
 |
 qMAX_rx_statX:

Example - 2: Ping test using the tx queue 3.

$ tc qdisc add dev enp0s30f4 root mqprio num_tc 2 map 1 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 queues 3@0 1@3 hw 0

Statistic before ping:
---------------------
$ ethtool -S enp0s30f4

[ snip ]
     q3_tx_pkt_n: 7916
     q3_tx_irq_n: 316
[ snip ]

$ cat /proc/interrupts

[ snip ]
 143:          0          0          0        316          0          0

         0          0  IR-PCI-MSI 499719-edge      enp0s30f4:tx-3
[ snip ]

$ ping -I enp0s30f4 192.168.1.10 -i 0.01 -c 100 > /dev/null

Statistic after ping:
---------------------
$ ethtool -S enp0s30f4

[ snip ]
     q3_tx_pkt_n: 8016
     q3_tx_irq_n: 320
[ snip ]

$ cat /proc/interrupts

[ snip ]
143:          0          0          0        320          0          0

         0          0  IR-PCI-MSI 499719-edge      enp0s30f4:tx-3
[ snip ]

Vijayakannan Ayyathurai (2):
  net: stmmac: add ethtool per-queue statistic framework
  net: stmmac: add ethtool per-queue irq statistic support

Voon Weifeng (1):
  net: stmmac: fix INTR TBU status affecting irq count statistic

 drivers/net/ethernet/stmicro/stmmac/common.h  | 13 ++++
 .../net/ethernet/stmicro/stmmac/dwmac4_lib.c  |  7 +-
 .../ethernet/stmicro/stmmac/stmmac_ethtool.c  | 67 ++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  5 ++
 4 files changed, 89 insertions(+), 3 deletions(-)


base-commit: e4637f621203cb482f3ddb590cfe9f65045d92a6
-- 
2.17.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH net-next v1 0/3] net: stmmac: Add ethtool per-queue statistic
@ 2021-08-16  6:15 ` Vijayakannan Ayyathurai
  0 siblings, 0 replies; 16+ messages in thread
From: Vijayakannan Ayyathurai @ 2021-08-16  6:15 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba, mcoquelin.stm32
  Cc: vee.khee.wong, weifeng.voon, vijayakannan.ayyathurai, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

Adding generic ethtool per-queue statistic framework to display the
statistics for each rx/tx queue. In future, users can avail it to add
more per-queue specific counters. Number of rx/tx queues displayed is
depending on the available rx/tx queues in that particular MAC config
and this number is limited up to the MTL_MAX_{RX|TX}_QUEUES defined
in the driver.

Ethtool per-queue statistic display will look like below, when users
start adding more counters.

Example - 1:
 q0_tx_statA:
 q0_tx_statB:
 q0_tx_statC:
 |
 q0_tx_statX:
 .
 .
 .
 qMAX_tx_statA:
 qMAX_tx_statB:
 qMAX_tx_statC:
 |
 qMAX_tx_statX:

 q0_rx_statA:
 q0_rx_statB:
 q0_rx_statC:
 |
 q0_rx_statX:
 .
 .
 .
 qMAX_rx_statA:
 qMAX_rx_statB:
 qMAX_rx_statC:
 |
 qMAX_rx_statX:

Example - 2: Ping test using the tx queue 3.

$ tc qdisc add dev enp0s30f4 root mqprio num_tc 2 map 1 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 queues 3@0 1@3 hw 0

Statistic before ping:
---------------------
$ ethtool -S enp0s30f4

[ snip ]
     q3_tx_pkt_n: 7916
     q3_tx_irq_n: 316
[ snip ]

$ cat /proc/interrupts

[ snip ]
 143:          0          0          0        316          0          0

         0          0  IR-PCI-MSI 499719-edge      enp0s30f4:tx-3
[ snip ]

$ ping -I enp0s30f4 192.168.1.10 -i 0.01 -c 100 > /dev/null

Statistic after ping:
---------------------
$ ethtool -S enp0s30f4

[ snip ]
     q3_tx_pkt_n: 8016
     q3_tx_irq_n: 320
[ snip ]

$ cat /proc/interrupts

[ snip ]
143:          0          0          0        320          0          0

         0          0  IR-PCI-MSI 499719-edge      enp0s30f4:tx-3
[ snip ]

Vijayakannan Ayyathurai (2):
  net: stmmac: add ethtool per-queue statistic framework
  net: stmmac: add ethtool per-queue irq statistic support

Voon Weifeng (1):
  net: stmmac: fix INTR TBU status affecting irq count statistic

 drivers/net/ethernet/stmicro/stmmac/common.h  | 13 ++++
 .../net/ethernet/stmicro/stmmac/dwmac4_lib.c  |  7 +-
 .../ethernet/stmicro/stmmac/stmmac_ethtool.c  | 67 ++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  5 ++
 4 files changed, 89 insertions(+), 3 deletions(-)


base-commit: e4637f621203cb482f3ddb590cfe9f65045d92a6
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH net-next v1 1/3] net: stmmac: fix INTR TBU status affecting irq count statistic
  2021-08-16  6:15 ` Vijayakannan Ayyathurai
@ 2021-08-16  6:15   ` Vijayakannan Ayyathurai
  -1 siblings, 0 replies; 16+ messages in thread
From: Vijayakannan Ayyathurai @ 2021-08-16  6:15 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba, mcoquelin.stm32
  Cc: vee.khee.wong, weifeng.voon, vijayakannan.ayyathurai, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

From: Voon Weifeng <weifeng.voon@intel.com>

DMA channel status "Transmit buffer unavailable(TBU)" bit is not
considered as a successful dma tx. Hence, it should not affect
all the irq count statistic.

Fixes: 1103d3a5531c ("net: stmmac: dwmac4: Also use TBU interrupt to clean TX path")
Signed-off-by: Voon Weifeng <weifeng.voon@intel.com>
Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
index e63270267578..f83db62938dd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
@@ -172,11 +172,12 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,
 		x->rx_normal_irq_n++;
 		ret |= handle_rx;
 	}
-	if (likely(intr_status & (DMA_CHAN_STATUS_TI |
-		DMA_CHAN_STATUS_TBU))) {
+	if (likely(intr_status & DMA_CHAN_STATUS_TI)) {
 		x->tx_normal_irq_n++;
 		ret |= handle_tx;
 	}
+	if (unlikely(intr_status & DMA_CHAN_STATUS_TBU))
+		ret |= handle_tx;
 	if (unlikely(intr_status & DMA_CHAN_STATUS_ERI))
 		x->rx_early_irq++;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH net-next v1 1/3] net: stmmac: fix INTR TBU status affecting irq count statistic
@ 2021-08-16  6:15   ` Vijayakannan Ayyathurai
  0 siblings, 0 replies; 16+ messages in thread
From: Vijayakannan Ayyathurai @ 2021-08-16  6:15 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba, mcoquelin.stm32
  Cc: vee.khee.wong, weifeng.voon, vijayakannan.ayyathurai, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

From: Voon Weifeng <weifeng.voon@intel.com>

DMA channel status "Transmit buffer unavailable(TBU)" bit is not
considered as a successful dma tx. Hence, it should not affect
all the irq count statistic.

Fixes: 1103d3a5531c ("net: stmmac: dwmac4: Also use TBU interrupt to clean TX path")
Signed-off-by: Voon Weifeng <weifeng.voon@intel.com>
Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
index e63270267578..f83db62938dd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
@@ -172,11 +172,12 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,
 		x->rx_normal_irq_n++;
 		ret |= handle_rx;
 	}
-	if (likely(intr_status & (DMA_CHAN_STATUS_TI |
-		DMA_CHAN_STATUS_TBU))) {
+	if (likely(intr_status & DMA_CHAN_STATUS_TI)) {
 		x->tx_normal_irq_n++;
 		ret |= handle_tx;
 	}
+	if (unlikely(intr_status & DMA_CHAN_STATUS_TBU))
+		ret |= handle_tx;
 	if (unlikely(intr_status & DMA_CHAN_STATUS_ERI))
 		x->rx_early_irq++;
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH net-next v1 2/3] net: stmmac: add ethtool per-queue statistic framework
  2021-08-16  6:15 ` Vijayakannan Ayyathurai
@ 2021-08-16  6:15   ` Vijayakannan Ayyathurai
  -1 siblings, 0 replies; 16+ messages in thread
From: Vijayakannan Ayyathurai @ 2021-08-16  6:15 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba, mcoquelin.stm32
  Cc: vee.khee.wong, weifeng.voon, vijayakannan.ayyathurai, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

Adding generic ethtool per-queue statistic framework to display the
statistics for each rx/tx queue. In future, users can avail it to add
more per-queue specific counters. Number of rx/tx queues displayed is
depending on the available rx/tx queues in that particular MAC config
and this number is limited up to the MTL_MAX_{RX|TX}_QUEUES defined
in the driver.

Ethtool per-queue statistic display will look like below, when users
start adding more counters.

Example:
 q0_tx_statA:
 q0_tx_statB:
 q0_tx_statC:
 |
 q0_tx_statX:
 .
 .
 .
 qMAX_tx_statA:
 qMAX_tx_statB:
 qMAX_tx_statC:
 |
 qMAX_tx_statX:

 q0_rx_statA:
 q0_rx_statB:
 q0_rx_statC:
 |
 q0_rx_statX:
 .
 .
 .
 qMAX_rx_statA:
 qMAX_rx_statB:
 qMAX_rx_statC:
 |
 qMAX_rx_statX:

In addition, this patch has the support on displaying the number of
packets received and transmitted per queue.

Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/common.h  | 11 ++++
 .../ethernet/stmicro/stmmac/stmmac_ethtool.c  | 65 ++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  5 ++
 3 files changed, 80 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 5fecc83f175b..79333deef2e2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -58,6 +58,14 @@
 #undef FRAME_FILTER_DEBUG
 /* #define FRAME_FILTER_DEBUG */
 
+struct stmmac_txq_stats {
+	unsigned long tx_pkt_n;
+};
+
+struct stmmac_rxq_stats {
+	unsigned long rx_pkt_n;
+};
+
 /* Extra statistic and debug information exposed by ethtool */
 struct stmmac_extra_stats {
 	/* Transmit errors */
@@ -189,6 +197,9 @@ struct stmmac_extra_stats {
 	unsigned long mtl_est_hlbf;
 	unsigned long mtl_est_btre;
 	unsigned long mtl_est_btrlm;
+	/* per queue statistics */
+	struct stmmac_txq_stats txq_stats[MTL_MAX_TX_QUEUES];
+	struct stmmac_rxq_stats rxq_stats[MTL_MAX_RX_QUEUES];
 };
 
 /* Safety Feature statistics exposed by ethtool */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index d0ce608b81c3..10c0895d0b43 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -261,6 +261,16 @@ static const struct stmmac_stats stmmac_mmc[] = {
 };
 #define STMMAC_MMC_STATS_LEN ARRAY_SIZE(stmmac_mmc)
 
+static const char stmmac_qstats_tx_string[][ETH_GSTRING_LEN] = {
+	"tx_pkt_n",
+#define STMMAC_TXQ_STATS ARRAY_SIZE(stmmac_qstats_tx_string)
+};
+
+static const char stmmac_qstats_rx_string[][ETH_GSTRING_LEN] = {
+	"rx_pkt_n",
+#define STMMAC_RXQ_STATS ARRAY_SIZE(stmmac_qstats_rx_string)
+};
+
 static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
 				      struct ethtool_drvinfo *info)
 {
@@ -510,6 +520,31 @@ stmmac_set_pauseparam(struct net_device *netdev,
 	}
 }
 
+static void stmmac_get_per_qstats(struct stmmac_priv *priv, u64 *data)
+{
+	u32 tx_cnt = priv->plat->tx_queues_to_use;
+	u32 rx_cnt = priv->plat->rx_queues_to_use;
+	int q, stat;
+	char *p;
+
+	for (q = 0; q < tx_cnt; q++) {
+		p = (char *)priv + offsetof(struct stmmac_priv,
+					    xstats.txq_stats[q].tx_pkt_n);
+		for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) {
+			*data++ = (*(u64 *)p);
+			p += sizeof(u64 *);
+		}
+	}
+	for (q = 0; q < rx_cnt; q++) {
+		p = (char *)priv + offsetof(struct stmmac_priv,
+					    xstats.rxq_stats[q].rx_pkt_n);
+		for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) {
+			*data++ = (*(u64 *)p);
+			p += sizeof(u64 *);
+		}
+	}
+}
+
 static void stmmac_get_ethtool_stats(struct net_device *dev,
 				 struct ethtool_stats *dummy, u64 *data)
 {
@@ -560,16 +595,21 @@ static void stmmac_get_ethtool_stats(struct net_device *dev,
 		data[j++] = (stmmac_gstrings_stats[i].sizeof_stat ==
 			     sizeof(u64)) ? (*(u64 *)p) : (*(u32 *)p);
 	}
+	stmmac_get_per_qstats(priv, &data[j]);
 }
 
 static int stmmac_get_sset_count(struct net_device *netdev, int sset)
 {
 	struct stmmac_priv *priv = netdev_priv(netdev);
+	u32 tx_cnt = priv->plat->tx_queues_to_use;
+	u32 rx_cnt = priv->plat->rx_queues_to_use;
 	int i, len, safety_len = 0;
 
 	switch (sset) {
 	case ETH_SS_STATS:
-		len = STMMAC_STATS_LEN;
+		len = STMMAC_STATS_LEN +
+		      STMMAC_TXQ_STATS * tx_cnt +
+		      STMMAC_RXQ_STATS * rx_cnt;
 
 		if (priv->dma_cap.rmon)
 			len += STMMAC_MMC_STATS_LEN;
@@ -592,6 +632,28 @@ static int stmmac_get_sset_count(struct net_device *netdev, int sset)
 	}
 }
 
+static void stmmac_get_qstats_string(struct stmmac_priv *priv, u8 *data)
+{
+	u32 tx_cnt = priv->plat->tx_queues_to_use;
+	u32 rx_cnt = priv->plat->rx_queues_to_use;
+	int q, stat;
+
+	for (q = 0; q < tx_cnt; q++) {
+		for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) {
+			snprintf(data, ETH_GSTRING_LEN, "q%d_%s", q,
+				 stmmac_qstats_tx_string[stat]);
+			data += ETH_GSTRING_LEN;
+		}
+	}
+	for (q = 0; q < rx_cnt; q++) {
+		for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) {
+			snprintf(data, ETH_GSTRING_LEN, "q%d_%s", q,
+				 stmmac_qstats_rx_string[stat]);
+			data += ETH_GSTRING_LEN;
+		}
+	}
+}
+
 static void stmmac_get_strings(struct net_device *dev, u32 stringset, u8 *data)
 {
 	int i;
@@ -622,6 +684,7 @@ static void stmmac_get_strings(struct net_device *dev, u32 stringset, u8 *data)
 				ETH_GSTRING_LEN);
 			p += ETH_GSTRING_LEN;
 		}
+		stmmac_get_qstats_string(priv, p);
 		break;
 	case ETH_SS_TEST:
 		stmmac_selftest_get_strings(priv, p);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a2aa75cb184e..7b3fcf558603 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2500,6 +2500,7 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue)
 			} else {
 				priv->dev->stats.tx_packets++;
 				priv->xstats.tx_pkt_n++;
+				priv->xstats.txq_stats[queue].tx_pkt_n++;
 			}
 			if (skb)
 				stmmac_get_tx_hwtstamp(priv, p, skb);
@@ -5000,6 +5001,9 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
 
 	stmmac_finalize_xdp_rx(priv, xdp_status);
 
+	priv->xstats.rx_pkt_n += count;
+	priv->xstats.rxq_stats[queue].rx_pkt_n += count;
+
 	if (xsk_uses_need_wakeup(rx_q->xsk_pool)) {
 		if (failure || stmmac_rx_dirty(priv, queue) > 0)
 			xsk_set_rx_need_wakeup(rx_q->xsk_pool);
@@ -5287,6 +5291,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
 	stmmac_rx_refill(priv, queue);
 
 	priv->xstats.rx_pkt_n += count;
+	priv->xstats.rxq_stats[queue].rx_pkt_n += count;
 
 	return count;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH net-next v1 2/3] net: stmmac: add ethtool per-queue statistic framework
@ 2021-08-16  6:15   ` Vijayakannan Ayyathurai
  0 siblings, 0 replies; 16+ messages in thread
From: Vijayakannan Ayyathurai @ 2021-08-16  6:15 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba, mcoquelin.stm32
  Cc: vee.khee.wong, weifeng.voon, vijayakannan.ayyathurai, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

Adding generic ethtool per-queue statistic framework to display the
statistics for each rx/tx queue. In future, users can avail it to add
more per-queue specific counters. Number of rx/tx queues displayed is
depending on the available rx/tx queues in that particular MAC config
and this number is limited up to the MTL_MAX_{RX|TX}_QUEUES defined
in the driver.

Ethtool per-queue statistic display will look like below, when users
start adding more counters.

Example:
 q0_tx_statA:
 q0_tx_statB:
 q0_tx_statC:
 |
 q0_tx_statX:
 .
 .
 .
 qMAX_tx_statA:
 qMAX_tx_statB:
 qMAX_tx_statC:
 |
 qMAX_tx_statX:

 q0_rx_statA:
 q0_rx_statB:
 q0_rx_statC:
 |
 q0_rx_statX:
 .
 .
 .
 qMAX_rx_statA:
 qMAX_rx_statB:
 qMAX_rx_statC:
 |
 qMAX_rx_statX:

In addition, this patch has the support on displaying the number of
packets received and transmitted per queue.

Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/common.h  | 11 ++++
 .../ethernet/stmicro/stmmac/stmmac_ethtool.c  | 65 ++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  5 ++
 3 files changed, 80 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 5fecc83f175b..79333deef2e2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -58,6 +58,14 @@
 #undef FRAME_FILTER_DEBUG
 /* #define FRAME_FILTER_DEBUG */
 
+struct stmmac_txq_stats {
+	unsigned long tx_pkt_n;
+};
+
+struct stmmac_rxq_stats {
+	unsigned long rx_pkt_n;
+};
+
 /* Extra statistic and debug information exposed by ethtool */
 struct stmmac_extra_stats {
 	/* Transmit errors */
@@ -189,6 +197,9 @@ struct stmmac_extra_stats {
 	unsigned long mtl_est_hlbf;
 	unsigned long mtl_est_btre;
 	unsigned long mtl_est_btrlm;
+	/* per queue statistics */
+	struct stmmac_txq_stats txq_stats[MTL_MAX_TX_QUEUES];
+	struct stmmac_rxq_stats rxq_stats[MTL_MAX_RX_QUEUES];
 };
 
 /* Safety Feature statistics exposed by ethtool */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index d0ce608b81c3..10c0895d0b43 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -261,6 +261,16 @@ static const struct stmmac_stats stmmac_mmc[] = {
 };
 #define STMMAC_MMC_STATS_LEN ARRAY_SIZE(stmmac_mmc)
 
+static const char stmmac_qstats_tx_string[][ETH_GSTRING_LEN] = {
+	"tx_pkt_n",
+#define STMMAC_TXQ_STATS ARRAY_SIZE(stmmac_qstats_tx_string)
+};
+
+static const char stmmac_qstats_rx_string[][ETH_GSTRING_LEN] = {
+	"rx_pkt_n",
+#define STMMAC_RXQ_STATS ARRAY_SIZE(stmmac_qstats_rx_string)
+};
+
 static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
 				      struct ethtool_drvinfo *info)
 {
@@ -510,6 +520,31 @@ stmmac_set_pauseparam(struct net_device *netdev,
 	}
 }
 
+static void stmmac_get_per_qstats(struct stmmac_priv *priv, u64 *data)
+{
+	u32 tx_cnt = priv->plat->tx_queues_to_use;
+	u32 rx_cnt = priv->plat->rx_queues_to_use;
+	int q, stat;
+	char *p;
+
+	for (q = 0; q < tx_cnt; q++) {
+		p = (char *)priv + offsetof(struct stmmac_priv,
+					    xstats.txq_stats[q].tx_pkt_n);
+		for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) {
+			*data++ = (*(u64 *)p);
+			p += sizeof(u64 *);
+		}
+	}
+	for (q = 0; q < rx_cnt; q++) {
+		p = (char *)priv + offsetof(struct stmmac_priv,
+					    xstats.rxq_stats[q].rx_pkt_n);
+		for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) {
+			*data++ = (*(u64 *)p);
+			p += sizeof(u64 *);
+		}
+	}
+}
+
 static void stmmac_get_ethtool_stats(struct net_device *dev,
 				 struct ethtool_stats *dummy, u64 *data)
 {
@@ -560,16 +595,21 @@ static void stmmac_get_ethtool_stats(struct net_device *dev,
 		data[j++] = (stmmac_gstrings_stats[i].sizeof_stat ==
 			     sizeof(u64)) ? (*(u64 *)p) : (*(u32 *)p);
 	}
+	stmmac_get_per_qstats(priv, &data[j]);
 }
 
 static int stmmac_get_sset_count(struct net_device *netdev, int sset)
 {
 	struct stmmac_priv *priv = netdev_priv(netdev);
+	u32 tx_cnt = priv->plat->tx_queues_to_use;
+	u32 rx_cnt = priv->plat->rx_queues_to_use;
 	int i, len, safety_len = 0;
 
 	switch (sset) {
 	case ETH_SS_STATS:
-		len = STMMAC_STATS_LEN;
+		len = STMMAC_STATS_LEN +
+		      STMMAC_TXQ_STATS * tx_cnt +
+		      STMMAC_RXQ_STATS * rx_cnt;
 
 		if (priv->dma_cap.rmon)
 			len += STMMAC_MMC_STATS_LEN;
@@ -592,6 +632,28 @@ static int stmmac_get_sset_count(struct net_device *netdev, int sset)
 	}
 }
 
+static void stmmac_get_qstats_string(struct stmmac_priv *priv, u8 *data)
+{
+	u32 tx_cnt = priv->plat->tx_queues_to_use;
+	u32 rx_cnt = priv->plat->rx_queues_to_use;
+	int q, stat;
+
+	for (q = 0; q < tx_cnt; q++) {
+		for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) {
+			snprintf(data, ETH_GSTRING_LEN, "q%d_%s", q,
+				 stmmac_qstats_tx_string[stat]);
+			data += ETH_GSTRING_LEN;
+		}
+	}
+	for (q = 0; q < rx_cnt; q++) {
+		for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) {
+			snprintf(data, ETH_GSTRING_LEN, "q%d_%s", q,
+				 stmmac_qstats_rx_string[stat]);
+			data += ETH_GSTRING_LEN;
+		}
+	}
+}
+
 static void stmmac_get_strings(struct net_device *dev, u32 stringset, u8 *data)
 {
 	int i;
@@ -622,6 +684,7 @@ static void stmmac_get_strings(struct net_device *dev, u32 stringset, u8 *data)
 				ETH_GSTRING_LEN);
 			p += ETH_GSTRING_LEN;
 		}
+		stmmac_get_qstats_string(priv, p);
 		break;
 	case ETH_SS_TEST:
 		stmmac_selftest_get_strings(priv, p);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a2aa75cb184e..7b3fcf558603 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2500,6 +2500,7 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue)
 			} else {
 				priv->dev->stats.tx_packets++;
 				priv->xstats.tx_pkt_n++;
+				priv->xstats.txq_stats[queue].tx_pkt_n++;
 			}
 			if (skb)
 				stmmac_get_tx_hwtstamp(priv, p, skb);
@@ -5000,6 +5001,9 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
 
 	stmmac_finalize_xdp_rx(priv, xdp_status);
 
+	priv->xstats.rx_pkt_n += count;
+	priv->xstats.rxq_stats[queue].rx_pkt_n += count;
+
 	if (xsk_uses_need_wakeup(rx_q->xsk_pool)) {
 		if (failure || stmmac_rx_dirty(priv, queue) > 0)
 			xsk_set_rx_need_wakeup(rx_q->xsk_pool);
@@ -5287,6 +5291,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
 	stmmac_rx_refill(priv, queue);
 
 	priv->xstats.rx_pkt_n += count;
+	priv->xstats.rxq_stats[queue].rx_pkt_n += count;
 
 	return count;
 }
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH net-next v1 3/3] net: stmmac: add ethtool per-queue irq statistic support
  2021-08-16  6:15 ` Vijayakannan Ayyathurai
@ 2021-08-16  6:16   ` Vijayakannan Ayyathurai
  -1 siblings, 0 replies; 16+ messages in thread
From: Vijayakannan Ayyathurai @ 2021-08-16  6:16 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba, mcoquelin.stm32
  Cc: vee.khee.wong, weifeng.voon, vijayakannan.ayyathurai, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

Adding ethtool per-queue statistics support to show number of interrupts
generated at DMA tx and DMA rx. All the counters are incremented at
dwmac4_dma_interrupt function.

Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/common.h         | 2 ++
 drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c     | 2 ++
 drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 79333deef2e2..b6d945ea903d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -60,10 +60,12 @@
 
 struct stmmac_txq_stats {
 	unsigned long tx_pkt_n;
+	unsigned long tx_normal_irq_n;
 };
 
 struct stmmac_rxq_stats {
 	unsigned long rx_pkt_n;
+	unsigned long rx_normal_irq_n;
 };
 
 /* Extra statistic and debug information exposed by ethtool */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
index f83db62938dd..9292a1fab7d3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
@@ -170,10 +170,12 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,
 		x->normal_irq_n++;
 	if (likely(intr_status & DMA_CHAN_STATUS_RI)) {
 		x->rx_normal_irq_n++;
+		x->rxq_stats[chan].rx_normal_irq_n++;
 		ret |= handle_rx;
 	}
 	if (likely(intr_status & DMA_CHAN_STATUS_TI)) {
 		x->tx_normal_irq_n++;
+		x->txq_stats[chan].tx_normal_irq_n++;
 		ret |= handle_tx;
 	}
 	if (unlikely(intr_status & DMA_CHAN_STATUS_TBU))
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 10c0895d0b43..595c3ccdcbb7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -263,11 +263,13 @@ static const struct stmmac_stats stmmac_mmc[] = {
 
 static const char stmmac_qstats_tx_string[][ETH_GSTRING_LEN] = {
 	"tx_pkt_n",
+	"tx_irq_n",
 #define STMMAC_TXQ_STATS ARRAY_SIZE(stmmac_qstats_tx_string)
 };
 
 static const char stmmac_qstats_rx_string[][ETH_GSTRING_LEN] = {
 	"rx_pkt_n",
+	"rx_irq_n",
 #define STMMAC_RXQ_STATS ARRAY_SIZE(stmmac_qstats_rx_string)
 };
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH net-next v1 3/3] net: stmmac: add ethtool per-queue irq statistic support
@ 2021-08-16  6:16   ` Vijayakannan Ayyathurai
  0 siblings, 0 replies; 16+ messages in thread
From: Vijayakannan Ayyathurai @ 2021-08-16  6:16 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba, mcoquelin.stm32
  Cc: vee.khee.wong, weifeng.voon, vijayakannan.ayyathurai, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

Adding ethtool per-queue statistics support to show number of interrupts
generated at DMA tx and DMA rx. All the counters are incremented at
dwmac4_dma_interrupt function.

Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/common.h         | 2 ++
 drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c     | 2 ++
 drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 79333deef2e2..b6d945ea903d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -60,10 +60,12 @@
 
 struct stmmac_txq_stats {
 	unsigned long tx_pkt_n;
+	unsigned long tx_normal_irq_n;
 };
 
 struct stmmac_rxq_stats {
 	unsigned long rx_pkt_n;
+	unsigned long rx_normal_irq_n;
 };
 
 /* Extra statistic and debug information exposed by ethtool */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
index f83db62938dd..9292a1fab7d3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
@@ -170,10 +170,12 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,
 		x->normal_irq_n++;
 	if (likely(intr_status & DMA_CHAN_STATUS_RI)) {
 		x->rx_normal_irq_n++;
+		x->rxq_stats[chan].rx_normal_irq_n++;
 		ret |= handle_rx;
 	}
 	if (likely(intr_status & DMA_CHAN_STATUS_TI)) {
 		x->tx_normal_irq_n++;
+		x->txq_stats[chan].tx_normal_irq_n++;
 		ret |= handle_tx;
 	}
 	if (unlikely(intr_status & DMA_CHAN_STATUS_TBU))
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 10c0895d0b43..595c3ccdcbb7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -263,11 +263,13 @@ static const struct stmmac_stats stmmac_mmc[] = {
 
 static const char stmmac_qstats_tx_string[][ETH_GSTRING_LEN] = {
 	"tx_pkt_n",
+	"tx_irq_n",
 #define STMMAC_TXQ_STATS ARRAY_SIZE(stmmac_qstats_tx_string)
 };
 
 static const char stmmac_qstats_rx_string[][ETH_GSTRING_LEN] = {
 	"rx_pkt_n",
+	"rx_irq_n",
 #define STMMAC_RXQ_STATS ARRAY_SIZE(stmmac_qstats_rx_string)
 };
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v1 1/3] net: stmmac: fix INTR TBU status affecting irq count statistic
  2021-08-16  6:15   ` Vijayakannan Ayyathurai
@ 2021-08-16 10:47     ` Wong Vee Khee
  -1 siblings, 0 replies; 16+ messages in thread
From: Wong Vee Khee @ 2021-08-16 10:47 UTC (permalink / raw)
  To: Vijayakannan Ayyathurai
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	mcoquelin.stm32, vee.khee.wong, weifeng.voon, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

On Mon, Aug 16, 2021 at 02:15:58PM +0800, Vijayakannan Ayyathurai wrote:
> From: Voon Weifeng <weifeng.voon@intel.com>
> 
> DMA channel status "Transmit buffer unavailable(TBU)" bit is not
> considered as a successful dma tx. Hence, it should not affect
> all the irq count statistic.
>

Acked-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
 
> Fixes: 1103d3a5531c ("net: stmmac: dwmac4: Also use TBU interrupt to clean TX path")
> Signed-off-by: Voon Weifeng <weifeng.voon@intel.com>
> Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> index e63270267578..f83db62938dd 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> @@ -172,11 +172,12 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,
>  		x->rx_normal_irq_n++;
>  		ret |= handle_rx;
>  	}
> -	if (likely(intr_status & (DMA_CHAN_STATUS_TI |
> -		DMA_CHAN_STATUS_TBU))) {
> +	if (likely(intr_status & DMA_CHAN_STATUS_TI)) {
>  		x->tx_normal_irq_n++;
>  		ret |= handle_tx;
>  	}
> +	if (unlikely(intr_status & DMA_CHAN_STATUS_TBU))
> +		ret |= handle_tx;
>  	if (unlikely(intr_status & DMA_CHAN_STATUS_ERI))
>  		x->rx_early_irq++;
>  

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v1 1/3] net: stmmac: fix INTR TBU status affecting irq count statistic
@ 2021-08-16 10:47     ` Wong Vee Khee
  0 siblings, 0 replies; 16+ messages in thread
From: Wong Vee Khee @ 2021-08-16 10:47 UTC (permalink / raw)
  To: Vijayakannan Ayyathurai
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	mcoquelin.stm32, vee.khee.wong, weifeng.voon, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

On Mon, Aug 16, 2021 at 02:15:58PM +0800, Vijayakannan Ayyathurai wrote:
> From: Voon Weifeng <weifeng.voon@intel.com>
> 
> DMA channel status "Transmit buffer unavailable(TBU)" bit is not
> considered as a successful dma tx. Hence, it should not affect
> all the irq count statistic.
>

Acked-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
 
> Fixes: 1103d3a5531c ("net: stmmac: dwmac4: Also use TBU interrupt to clean TX path")
> Signed-off-by: Voon Weifeng <weifeng.voon@intel.com>
> Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> index e63270267578..f83db62938dd 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> @@ -172,11 +172,12 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,
>  		x->rx_normal_irq_n++;
>  		ret |= handle_rx;
>  	}
> -	if (likely(intr_status & (DMA_CHAN_STATUS_TI |
> -		DMA_CHAN_STATUS_TBU))) {
> +	if (likely(intr_status & DMA_CHAN_STATUS_TI)) {
>  		x->tx_normal_irq_n++;
>  		ret |= handle_tx;
>  	}
> +	if (unlikely(intr_status & DMA_CHAN_STATUS_TBU))
> +		ret |= handle_tx;
>  	if (unlikely(intr_status & DMA_CHAN_STATUS_ERI))
>  		x->rx_early_irq++;
>  

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v1 2/3] net: stmmac: add ethtool per-queue statistic framework
  2021-08-16  6:15   ` Vijayakannan Ayyathurai
@ 2021-08-16 10:50     ` Wong Vee Khee
  -1 siblings, 0 replies; 16+ messages in thread
From: Wong Vee Khee @ 2021-08-16 10:50 UTC (permalink / raw)
  To: Vijayakannan Ayyathurai
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	mcoquelin.stm32, vee.khee.wong, weifeng.voon, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

On Mon, Aug 16, 2021 at 02:15:59PM +0800, Vijayakannan Ayyathurai wrote:
> Adding generic ethtool per-queue statistic framework to display the
> statistics for each rx/tx queue. In future, users can avail it to add
> more per-queue specific counters. Number of rx/tx queues displayed is
> depending on the available rx/tx queues in that particular MAC config
> and this number is limited up to the MTL_MAX_{RX|TX}_QUEUES defined
> in the driver.
> 
> Ethtool per-queue statistic display will look like below, when users
> start adding more counters.
> 
> Example:
>  q0_tx_statA:
>  q0_tx_statB:
>  q0_tx_statC:
>  |
>  q0_tx_statX:
>  .
>  .
>  .
>  qMAX_tx_statA:
>  qMAX_tx_statB:
>  qMAX_tx_statC:
>  |
>  qMAX_tx_statX:
> 
>  q0_rx_statA:
>  q0_rx_statB:
>  q0_rx_statC:
>  |
>  q0_rx_statX:
>  .
>  .
>  .
>  qMAX_rx_statA:
>  qMAX_rx_statB:
>  qMAX_rx_statC:
>  |
>  qMAX_rx_statX:
> 
> In addition, this patch has the support on displaying the number of
> packets received and transmitted per queue.
>

Acked-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>

> Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
> ---

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v1 2/3] net: stmmac: add ethtool per-queue statistic framework
@ 2021-08-16 10:50     ` Wong Vee Khee
  0 siblings, 0 replies; 16+ messages in thread
From: Wong Vee Khee @ 2021-08-16 10:50 UTC (permalink / raw)
  To: Vijayakannan Ayyathurai
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	mcoquelin.stm32, vee.khee.wong, weifeng.voon, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

On Mon, Aug 16, 2021 at 02:15:59PM +0800, Vijayakannan Ayyathurai wrote:
> Adding generic ethtool per-queue statistic framework to display the
> statistics for each rx/tx queue. In future, users can avail it to add
> more per-queue specific counters. Number of rx/tx queues displayed is
> depending on the available rx/tx queues in that particular MAC config
> and this number is limited up to the MTL_MAX_{RX|TX}_QUEUES defined
> in the driver.
> 
> Ethtool per-queue statistic display will look like below, when users
> start adding more counters.
> 
> Example:
>  q0_tx_statA:
>  q0_tx_statB:
>  q0_tx_statC:
>  |
>  q0_tx_statX:
>  .
>  .
>  .
>  qMAX_tx_statA:
>  qMAX_tx_statB:
>  qMAX_tx_statC:
>  |
>  qMAX_tx_statX:
> 
>  q0_rx_statA:
>  q0_rx_statB:
>  q0_rx_statC:
>  |
>  q0_rx_statX:
>  .
>  .
>  .
>  qMAX_rx_statA:
>  qMAX_rx_statB:
>  qMAX_rx_statC:
>  |
>  qMAX_rx_statX:
> 
> In addition, this patch has the support on displaying the number of
> packets received and transmitted per queue.
>

Acked-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>

> Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
> ---

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v1 3/3] net: stmmac: add ethtool per-queue irq statistic support
  2021-08-16  6:16   ` Vijayakannan Ayyathurai
@ 2021-08-16 10:53     ` Wong Vee Khee
  -1 siblings, 0 replies; 16+ messages in thread
From: Wong Vee Khee @ 2021-08-16 10:53 UTC (permalink / raw)
  To: Vijayakannan Ayyathurai
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	mcoquelin.stm32, vee.khee.wong, weifeng.voon, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

On Mon, Aug 16, 2021 at 02:16:00PM +0800, Vijayakannan Ayyathurai wrote:
> Adding ethtool per-queue statistics support to show number of interrupts
> generated at DMA tx and DMA rx. All the counters are incremented at
> dwmac4_dma_interrupt function.
>

Acked-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
 
> Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/common.h         | 2 ++
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c     | 2 ++
>  drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 ++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
> index 79333deef2e2..b6d945ea903d 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/common.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
> @@ -60,10 +60,12 @@
>  
>  struct stmmac_txq_stats {
>  	unsigned long tx_pkt_n;
> +	unsigned long tx_normal_irq_n;
>  };
>  
>  struct stmmac_rxq_stats {
>  	unsigned long rx_pkt_n;
> +	unsigned long rx_normal_irq_n;
>  };
>  
>  /* Extra statistic and debug information exposed by ethtool */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> index f83db62938dd..9292a1fab7d3 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> @@ -170,10 +170,12 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,
>  		x->normal_irq_n++;
>  	if (likely(intr_status & DMA_CHAN_STATUS_RI)) {
>  		x->rx_normal_irq_n++;
> +		x->rxq_stats[chan].rx_normal_irq_n++;
>  		ret |= handle_rx;
>  	}
>  	if (likely(intr_status & DMA_CHAN_STATUS_TI)) {
>  		x->tx_normal_irq_n++;
> +		x->txq_stats[chan].tx_normal_irq_n++;
>  		ret |= handle_tx;
>  	}
>  	if (unlikely(intr_status & DMA_CHAN_STATUS_TBU))
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> index 10c0895d0b43..595c3ccdcbb7 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> @@ -263,11 +263,13 @@ static const struct stmmac_stats stmmac_mmc[] = {
>  
>  static const char stmmac_qstats_tx_string[][ETH_GSTRING_LEN] = {
>  	"tx_pkt_n",
> +	"tx_irq_n",
>  #define STMMAC_TXQ_STATS ARRAY_SIZE(stmmac_qstats_tx_string)
>  };
>  
>  static const char stmmac_qstats_rx_string[][ETH_GSTRING_LEN] = {
>  	"rx_pkt_n",
> +	"rx_irq_n",
>  #define STMMAC_RXQ_STATS ARRAY_SIZE(stmmac_qstats_rx_string)
>  };
>  

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v1 3/3] net: stmmac: add ethtool per-queue irq statistic support
@ 2021-08-16 10:53     ` Wong Vee Khee
  0 siblings, 0 replies; 16+ messages in thread
From: Wong Vee Khee @ 2021-08-16 10:53 UTC (permalink / raw)
  To: Vijayakannan Ayyathurai
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	mcoquelin.stm32, vee.khee.wong, weifeng.voon, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

On Mon, Aug 16, 2021 at 02:16:00PM +0800, Vijayakannan Ayyathurai wrote:
> Adding ethtool per-queue statistics support to show number of interrupts
> generated at DMA tx and DMA rx. All the counters are incremented at
> dwmac4_dma_interrupt function.
>

Acked-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
 
> Signed-off-by: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/common.h         | 2 ++
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c     | 2 ++
>  drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 ++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
> index 79333deef2e2..b6d945ea903d 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/common.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
> @@ -60,10 +60,12 @@
>  
>  struct stmmac_txq_stats {
>  	unsigned long tx_pkt_n;
> +	unsigned long tx_normal_irq_n;
>  };
>  
>  struct stmmac_rxq_stats {
>  	unsigned long rx_pkt_n;
> +	unsigned long rx_normal_irq_n;
>  };
>  
>  /* Extra statistic and debug information exposed by ethtool */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> index f83db62938dd..9292a1fab7d3 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
> @@ -170,10 +170,12 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,
>  		x->normal_irq_n++;
>  	if (likely(intr_status & DMA_CHAN_STATUS_RI)) {
>  		x->rx_normal_irq_n++;
> +		x->rxq_stats[chan].rx_normal_irq_n++;
>  		ret |= handle_rx;
>  	}
>  	if (likely(intr_status & DMA_CHAN_STATUS_TI)) {
>  		x->tx_normal_irq_n++;
> +		x->txq_stats[chan].tx_normal_irq_n++;
>  		ret |= handle_tx;
>  	}
>  	if (unlikely(intr_status & DMA_CHAN_STATUS_TBU))
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> index 10c0895d0b43..595c3ccdcbb7 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> @@ -263,11 +263,13 @@ static const struct stmmac_stats stmmac_mmc[] = {
>  
>  static const char stmmac_qstats_tx_string[][ETH_GSTRING_LEN] = {
>  	"tx_pkt_n",
> +	"tx_irq_n",
>  #define STMMAC_TXQ_STATS ARRAY_SIZE(stmmac_qstats_tx_string)
>  };
>  
>  static const char stmmac_qstats_rx_string[][ETH_GSTRING_LEN] = {
>  	"rx_pkt_n",
> +	"rx_irq_n",
>  #define STMMAC_RXQ_STATS ARRAY_SIZE(stmmac_qstats_rx_string)
>  };
>  

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v1 0/3] net: stmmac: Add ethtool per-queue statistic
  2021-08-16  6:15 ` Vijayakannan Ayyathurai
@ 2021-08-16 12:50   ` patchwork-bot+netdevbpf
  -1 siblings, 0 replies; 16+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-16 12:50 UTC (permalink / raw)
  To: Vijayakannan Ayyathurai
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	mcoquelin.stm32, vee.khee.wong, weifeng.voon, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Mon, 16 Aug 2021 14:15:57 +0800 you wrote:
> Adding generic ethtool per-queue statistic framework to display the
> statistics for each rx/tx queue. In future, users can avail it to add
> more per-queue specific counters. Number of rx/tx queues displayed is
> depending on the available rx/tx queues in that particular MAC config
> and this number is limited up to the MTL_MAX_{RX|TX}_QUEUES defined
> in the driver.
> 
> [...]

Here is the summary with links:
  - [net-next,v1,1/3] net: stmmac: fix INTR TBU status affecting irq count statistic
    https://git.kernel.org/netdev/net-next/c/1975df880b95
  - [net-next,v1,2/3] net: stmmac: add ethtool per-queue statistic framework
    https://git.kernel.org/netdev/net-next/c/68e9c5dee1cf
  - [net-next,v1,3/3] net: stmmac: add ethtool per-queue irq statistic support
    https://git.kernel.org/netdev/net-next/c/af9bf70154eb

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] 16+ messages in thread

* Re: [PATCH net-next v1 0/3] net: stmmac: Add ethtool per-queue statistic
@ 2021-08-16 12:50   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 16+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-16 12:50 UTC (permalink / raw)
  To: Vijayakannan Ayyathurai
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	mcoquelin.stm32, vee.khee.wong, weifeng.voon, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Mon, 16 Aug 2021 14:15:57 +0800 you wrote:
> Adding generic ethtool per-queue statistic framework to display the
> statistics for each rx/tx queue. In future, users can avail it to add
> more per-queue specific counters. Number of rx/tx queues displayed is
> depending on the available rx/tx queues in that particular MAC config
> and this number is limited up to the MTL_MAX_{RX|TX}_QUEUES defined
> in the driver.
> 
> [...]

Here is the summary with links:
  - [net-next,v1,1/3] net: stmmac: fix INTR TBU status affecting irq count statistic
    https://git.kernel.org/netdev/net-next/c/1975df880b95
  - [net-next,v1,2/3] net: stmmac: add ethtool per-queue statistic framework
    https://git.kernel.org/netdev/net-next/c/68e9c5dee1cf
  - [net-next,v1,3/3] net: stmmac: add ethtool per-queue irq statistic support
    https://git.kernel.org/netdev/net-next/c/af9bf70154eb

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-08-16 12:52 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16  6:15 [PATCH net-next v1 0/3] net: stmmac: Add ethtool per-queue statistic Vijayakannan Ayyathurai
2021-08-16  6:15 ` Vijayakannan Ayyathurai
2021-08-16  6:15 ` [PATCH net-next v1 1/3] net: stmmac: fix INTR TBU status affecting irq count statistic Vijayakannan Ayyathurai
2021-08-16  6:15   ` Vijayakannan Ayyathurai
2021-08-16 10:47   ` Wong Vee Khee
2021-08-16 10:47     ` Wong Vee Khee
2021-08-16  6:15 ` [PATCH net-next v1 2/3] net: stmmac: add ethtool per-queue statistic framework Vijayakannan Ayyathurai
2021-08-16  6:15   ` Vijayakannan Ayyathurai
2021-08-16 10:50   ` Wong Vee Khee
2021-08-16 10:50     ` Wong Vee Khee
2021-08-16  6:16 ` [PATCH net-next v1 3/3] net: stmmac: add ethtool per-queue irq statistic support Vijayakannan Ayyathurai
2021-08-16  6:16   ` Vijayakannan Ayyathurai
2021-08-16 10:53   ` Wong Vee Khee
2021-08-16 10:53     ` Wong Vee Khee
2021-08-16 12:50 ` [PATCH net-next v1 0/3] net: stmmac: Add ethtool per-queue statistic patchwork-bot+netdevbpf
2021-08-16 12:50   ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.