[PATCH net-next 5/7] net:fec: add support for dumping transmit ring on timeout
Frank Li
lznuaa at gmail.com
Tue Apr 29 06:57:20 PDT 2014
On Tue, Apr 29, 2014 at 8:38 AM, David Laight <David.Laight at aculab.com> wrote:
> From: Of Frank Li
> ...
>> 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.
> ...
>> +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);
>> +}
>> +
>
> You probably want the read and write indexes as well.
bdp == fep->cur_tx ? 'S' : ' ',
bdp == fep->dirty_tx ? 'H' : ' ',
Above code already print read and write index. 'S', 'H'
Frank Li
>
> David
>
>
>
More information about the linux-arm-kernel
mailing list