Skip to contentSkip to conversation

net: stmmac: Couple of debug prints improvements

PATCH In review Florian Fainelli 2 participants 4 messages Dec 30, 2017 – Jan 3, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover net: stmmac: Couple of debug prints improvements

Hi all,

While working on a particular problem, I had to turn on debug prints and found them to be useful, but could deserve some improvements in order to help debug situations.

Florian Fainelli (2):
net: stmmac: Pad ring number with zeroes in display_ring()
net: stmmac: Allow debug prints of frame_len/COE

 drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 2 +-
 drivers/net/ethernet/stmicro/stmmac/enh_desc.c     | 2 +-
 drivers/net/ethernet/stmicro/stmmac/norm_desc.c    | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 5 ++---
 4 files changed, 5 insertions(+), 6 deletions(-)
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/2 net: stmmac: Pad ring number with zeroes in display_ring()

Make the printing of the ring number consistent and properly aligned by padding the ring number with up to 3 zeroes, which covers the maximum ring size. This makes it a lot easier to see outliers in debug prints.

---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 2 +-
 drivers/net/ethernet/stmicro/stmmac/enh_desc.c     | 2 +-
 drivers/net/ethernet/stmicro/stmmac/norm_desc.c    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +1 -1
index 7e089bf906b4..2fd8456999f6 100644
@@ -406,7 +406,7 @@ static void dwmac4_display_ring(void *head, unsigned int size, bool rx)
 	pr_info("%s descriptor ring:\n", rx ? "RX" : "TX");
 
 	for (i = 0; i < size; i++) {
-		pr_info("%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
+		pr_info("%03d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
 			i, (unsigned int)virt_to_phys(p),
 			le32_to_cpu(p->des0), le32_to_cpu(p->des1),
 			le32_to_cpu(p->des2), le32_to_cpu(p->des3));
drivers/net/ethernet/stmicro/stmmac/enh_desc.c +1 -1
index 2a828a312814..b47cb5c4da51 100644
@@ -428,7 +428,7 @@ static void enh_desc_display_ring(void *head, unsigned int size, bool rx)
 		u64 x;
 
 		x = *(u64 *)ep;
-		pr_info("%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
+		pr_info("%03d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
 			i, (unsigned int)virt_to_phys(ep),
 			(unsigned int)x, (unsigned int)(x >> 32),
 			ep->basic.des2, ep->basic.des3);
drivers/net/ethernet/stmicro/stmmac/norm_desc.c +1 -1
index db4cee57bb24..ebd9e5e00f16 100644
@@ -288,7 +288,7 @@ static void ndesc_display_ring(void *head, unsigned int size, bool rx)
 		u64 x;
 
 		x = *(u64 *)p;
-		pr_info("%d [0x%x]: 0x%x 0x%x 0x%x 0x%x",
+		pr_info("%03d [0x%x]: 0x%x 0x%x 0x%x 0x%x",
 			i, (unsigned int)virt_to_phys(p),
 			(unsigned int)x, (unsigned int)(x >> 32),
 			p->des2, p->des3);
Signature · 1 line
2.14.1
#2 lore raw

PATCH 2/2 net: stmmac: Allow debug prints of frame_len/COE

In reply to Florian Fainelli

There is no reason not to allow printing the frame_len/COE value and put that under a check for ETH_FRAME_LEN, drop it so we can see what the descriptor reports.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -3
index 0323d672e1c5..d9c98fd810bb 100644
@@ -3436,9 +3436,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
 			if (netif_msg_rx_status(priv)) {
 				netdev_dbg(priv->dev, "\tdesc: %p [entry %d] buff=0x%x\n",
 					   p, entry, des);
-				if (frame_len > ETH_FRAME_LEN)
-					netdev_dbg(priv->dev, "frame size %d, COE: %d\n",
-						   frame_len, status);
+				netdev_dbg(priv->dev, "frame size %d, COE: %d\n",
+					   frame_len, status);
 			}
 
 			/* The zero-copy is always used for all the sizes
Signature · 1 line
2.14.1
maintainer
#3 lore raw
In reply to Florian Fainelli

From: Florian Fainelli <[email protected]>
Date: Fri, 29 Dec 2017 19:56:31 -0800

Quoted 3 lines

While working on a particular problem, I had to turn on debug prints and found them to be useful, but could deserve some improvements in order to help debug situations.

Series applied, thanks Florian.