public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH net-next v3 1/2] net: stmmac: remove extra newline from descriptors display
@ 2023-11-19  5:39 Baruch Siach
  2023-11-19  5:39 ` [PATCH net-next v3 2/2] net: stmmac: reduce dma ring display code duplication Baruch Siach
  2023-11-21 11:50 ` [PATCH net-next v3 1/2] net: stmmac: remove extra newline from descriptors display patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Baruch Siach @ 2023-11-19  5:39 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: netdev, Serge Semin, Paolo Abeni, Baruch Siach

One newline per line should be enough. Reduce the verbosity of
descriptors dump.

Reviewed-by: Serge Semin <fancer.lancer@gmail•com>
Signed-off-by: Baruch Siach <baruch@tkos•co.il>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 2afb2bd25977..8ab99c65ac59 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6203,7 +6203,6 @@ static void sysfs_display_ring(void *head, int size, int extend_desc,
 				   le32_to_cpu(p->des2), le32_to_cpu(p->des3));
 			p++;
 		}
-		seq_printf(seq, "\n");
 	}
 }
 
-- 
2.42.0


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

* [PATCH net-next v3 2/2] net: stmmac: reduce dma ring display code duplication
  2023-11-19  5:39 [PATCH net-next v3 1/2] net: stmmac: remove extra newline from descriptors display Baruch Siach
@ 2023-11-19  5:39 ` Baruch Siach
  2023-11-21 11:50 ` [PATCH net-next v3 1/2] net: stmmac: remove extra newline from descriptors display patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Baruch Siach @ 2023-11-19  5:39 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: netdev, Serge Semin, Paolo Abeni, Baruch Siach

The code to show extended descriptor is identical to normal one.
Consolidate the code to remove duplication.

Signed-off-by: Baruch Siach <baruch@tkos•co.il>
---
v3:
  Reorder variable declaration in reverse xmas (Paolo)

  Move desc_size initialization to function body (Serge, Paolo)

v2: Fix extended descriptor case, and properly test both cases
---
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 28 ++++++++-----------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8ab99c65ac59..97598c1497ea 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6180,29 +6180,23 @@ static struct dentry *stmmac_fs_dir;
 static void sysfs_display_ring(void *head, int size, int extend_desc,
 			       struct seq_file *seq, dma_addr_t dma_phy_addr)
 {
-	int i;
 	struct dma_extended_desc *ep = (struct dma_extended_desc *)head;
 	struct dma_desc *p = (struct dma_desc *)head;
+	unsigned int desc_size;
 	dma_addr_t dma_addr;
+	int i;
 
+	desc_size = extend_desc ? sizeof(*ep) : sizeof(*p);
 	for (i = 0; i < size; i++) {
-		if (extend_desc) {
-			dma_addr = dma_phy_addr + i * sizeof(*ep);
-			seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x\n",
-				   i, &dma_addr,
-				   le32_to_cpu(ep->basic.des0),
-				   le32_to_cpu(ep->basic.des1),
-				   le32_to_cpu(ep->basic.des2),
-				   le32_to_cpu(ep->basic.des3));
-			ep++;
-		} else {
-			dma_addr = dma_phy_addr + i * sizeof(*p);
-			seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x\n",
-				   i, &dma_addr,
-				   le32_to_cpu(p->des0), le32_to_cpu(p->des1),
-				   le32_to_cpu(p->des2), le32_to_cpu(p->des3));
+		dma_addr = dma_phy_addr + i * desc_size;
+		seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x\n",
+				i, &dma_addr,
+				le32_to_cpu(p->des0), le32_to_cpu(p->des1),
+				le32_to_cpu(p->des2), le32_to_cpu(p->des3));
+		if (extend_desc)
+			p = &(++ep)->basic;
+		else
 			p++;
-		}
 	}
 }
 
-- 
2.42.0


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

* Re: [PATCH net-next v3 1/2] net: stmmac: remove extra newline from descriptors display
  2023-11-19  5:39 [PATCH net-next v3 1/2] net: stmmac: remove extra newline from descriptors display Baruch Siach
  2023-11-19  5:39 ` [PATCH net-next v3 2/2] net: stmmac: reduce dma ring display code duplication Baruch Siach
@ 2023-11-21 11:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-11-21 11:50 UTC (permalink / raw)
  To: Baruch Siach; +Cc: alexandre.torgue, joabreu, netdev, fancer.lancer, pabeni

Hello:

This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat•com>:

On Sun, 19 Nov 2023 07:39:40 +0200 you wrote:
> One newline per line should be enough. Reduce the verbosity of
> descriptors dump.
> 
> Reviewed-by: Serge Semin <fancer.lancer@gmail•com>
> Signed-off-by: Baruch Siach <baruch@tkos•co.il>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 -
>  1 file changed, 1 deletion(-)

Here is the summary with links:
  - [net-next,v3,1/2] net: stmmac: remove extra newline from descriptors display
    https://git.kernel.org/netdev/net-next/c/7911deba293d
  - [net-next,v3,2/2] net: stmmac: reduce dma ring display code duplication
    https://git.kernel.org/netdev/net-next/c/79a4f4dfa69a

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

end of thread, other threads:[~2023-11-21 11:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-19  5:39 [PATCH net-next v3 1/2] net: stmmac: remove extra newline from descriptors display Baruch Siach
2023-11-19  5:39 ` [PATCH net-next v3 2/2] net: stmmac: reduce dma ring display code duplication Baruch Siach
2023-11-21 11:50 ` [PATCH net-next v3 1/2] net: stmmac: remove extra newline from descriptors display 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