[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1398773350-7293-5-git-send-email-Frank.Li@freescale.com>
Date: Tue, 29 Apr 2014 20:09:08 +0800
From: Frank Li <Frank.Li@...escale.com>
To: <lznuaa@...il.com>, <shawn.guo@...aro.org>, <B38611@...escale.com>,
<davem@...emloft.net>, <rmk+kernel@....linux.org.uk>
CC: <linux-arm-kernel@...ts.infradead.org>, <netdev@...r.kernel.org>,
Frank Li <Frank.Li@...escale.com>
Subject: [PATCH net-next 5/7] net:fec: add support for dumping transmit ring on timeout
From: Russell King <rmk+kernel@....linux.org.uk>
When we timeout on transmit, it would be useful to dump the transmit
ring, so we can see the ring state. This can be helpful to diagnose
the cause of transmit timeouts.
Signed-off-by: Russell King <rmk+kernel@....linux.org.uk>
Signed-off-by: Frank Li <Frank.Li@...escale.com>
---
drivers/net/ethernet/freescale/fec_main.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 9de899e..7d506ae 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -291,6 +291,27 @@ static void *swap_buffer(void *bufaddr, int len)
return bufaddr;
}
+static void fec_dump(struct net_device *ndev)
+{
+ struct fec_enet_private *fep = netdev_priv(ndev);
+ struct bufdesc *bdp = fep->tx_bd_base;
+ unsigned index = 0;
+
+ netdev_info(ndev, "TX ring dump\n");
+ pr_info("Nr SC addr len SKB\n");
+
+ do {
+ pr_info("%3u %c%c 0x%04x 0x%08lx %4u %p\n",
+ index,
+ bdp == fep->cur_tx ? 'S' : ' ',
+ bdp == fep->dirty_tx ? 'H' : ' ',
+ bdp->cbd_sc, bdp->cbd_bufaddr, bdp->cbd_datlen,
+ fep->tx_skbuff[index]);
+ bdp = fec_enet_get_nextdesc(bdp, fep);
+ index++;
+ } while (bdp != fep->tx_bd_base);
+}
+
static int
fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev)
{
@@ -717,6 +738,8 @@ fec_timeout(struct net_device *ndev)
{
struct fec_enet_private *fep = netdev_priv(ndev);
+ fec_dump(ndev);
+
ndev->stats.tx_errors++;
fep->delay_work.timeout = true;
--
1.7.8
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists