From: Stephen Hemminger <shemminger@vyatta.com>
To: Mugunthan V N <mugunthanvnm@ti.com>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>
Subject: Re: [PATCH 2/2] netdev: driver: ethernet: Add TI CPSW driver
Date: Mon, 13 Feb 2012 09:34:21 -0800 [thread overview]
Message-ID: <20120213093421.06ca60a7@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <1329113061-13026-3-git-send-email-mugunthanvnm@ti.com>
On Mon, 13 Feb 2012 11:34:21 +0530
Mugunthan V N <mugunthanvnm@ti.com> wrote:
> +static ssize_t cpsw_hw_stats_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + struct net_device *ndev = to_net_dev(dev);
> + struct cpsw_priv *priv = netdev_priv(ndev);
> + int len = 0;
> + struct cpdma_chan_stats dma_stats;
> +
> +#define show_stat(x) do { \
> + len += __show_stat(buf + len, SZ_4K - len, #x, \
> + __raw_readl(&priv->hw_stats->x)); \
> +} while (0)
> +
> +#define show_dma_stat(x) do { \
> + len += __show_stat(buf + len, SZ_4K - len, #x, dma_stats.x); \
> +} while (0)
> +
> + len += snprintf(buf + len, SZ_4K - len, "CPSW Statistics:\n");
> + show_stat(rxgoodframes); show_stat(rxbroadcastframes);
> + show_stat(rxmulticastframes); show_stat(rxpauseframes);
> + show_stat(rxcrcerrors); show_stat(rxaligncodeerrors);
> + show_stat(rxoversizedframes); show_stat(rxjabberframes);
> + show_stat(rxundersizedframes); show_stat(rxfragments);
> + show_stat(rxoctets); show_stat(txgoodframes);
> + show_stat(txbroadcastframes); show_stat(txmulticastframes);
> + show_stat(txpauseframes); show_stat(txdeferredframes);
> + show_stat(txcollisionframes); show_stat(txsinglecollframes);
> + show_stat(txmultcollframes); show_stat(txexcessivecollisions);
> + show_stat(txlatecollisions); show_stat(txunderrun);
> + show_stat(txcarriersenseerrors); show_stat(txoctets);
> + show_stat(octetframes64); show_stat(octetframes65t127);
> + show_stat(octetframes128t255); show_stat(octetframes256t511);
> + show_stat(octetframes512t1023); show_stat(octetframes1024tup);
> + show_stat(netoctets); show_stat(rxsofoverruns);
> + show_stat(rxmofoverruns); show_stat(rxdmaoverruns);
> +
> + cpdma_chan_get_stats(priv->rxch, &dma_stats);
> + len += snprintf(buf + len, SZ_4K - len, "\nRX DMA Statistics:\n");
> + show_dma_stat(head_enqueue); show_dma_stat(tail_enqueue);
> + show_dma_stat(pad_enqueue); show_dma_stat(misqueued);
> + show_dma_stat(desc_alloc_fail); show_dma_stat(pad_alloc_fail);
> + show_dma_stat(runt_receive_buff); show_dma_stat(runt_transmit_buff);
> + show_dma_stat(empty_dequeue); show_dma_stat(busy_dequeue);
> + show_dma_stat(good_dequeue); show_dma_stat(teardown_dequeue);
> +
> + cpdma_chan_get_stats(priv->txch, &dma_stats);
> + len += snprintf(buf + len, SZ_4K - len, "\nTX DMA Statistics:\n");
> + show_dma_stat(head_enqueue); show_dma_stat(tail_enqueue);
> + show_dma_stat(pad_enqueue); show_dma_stat(misqueued);
> + show_dma_stat(desc_alloc_fail); show_dma_stat(pad_alloc_fail);
> + show_dma_stat(runt_receive_buff); show_dma_stat(runt_transmit_buff);
> + show_dma_stat(empty_dequeue); show_dma_stat(busy_dequeue);
> + show_dma_stat(good_dequeue); show_dma_stat(teardown_dequeue);
> +
> + return len;
> +}
> +
> +DEVICE_ATTR(hw_stats, S_IRUGO, cpsw_hw_stats_show, NULL);
> +
These stats belong in ethtool, not sysfs.
next prev parent reply other threads:[~2012-02-13 17:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-13 6:04 [PATCH 0/2] Adding new TI Common Platform ethernet SWitch driver Mugunthan V N
2012-02-13 6:04 ` [PATCH 1/2] netdev: driver: ethernet: add cpsw address lookup engine support Mugunthan V N
2012-02-13 17:31 ` Stephen Hemminger
2012-02-15 14:04 ` N, Mugunthan V
2012-02-13 6:04 ` [PATCH 2/2] netdev: driver: ethernet: Add TI CPSW driver Mugunthan V N
2012-02-13 17:34 ` Stephen Hemminger [this message]
2012-02-15 14:08 ` N, Mugunthan V
2012-02-13 18:15 ` Eric Dumazet
2012-02-17 7:17 ` N, Mugunthan V
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120213093421.06ca60a7@nehalam.linuxnetplumber.net \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=mugunthanvnm@ti.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).