netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Mugunthan V N <mugunthanvnm@ti.com>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>,
	<linux-omap@vger.kernel.org>
Subject: Re: [PATCH 1/1] drivers: net: cpsw: add support to show hw stats via ethtool
Date: Mon, 22 Jul 2013 18:05:41 +0100	[thread overview]
Message-ID: <1374512741.1635.12.camel@bwh-desktop.uk.level5networks.com> (raw)
In-Reply-To: <1374482231-8201-1-git-send-email-mugunthanvnm@ti.com>

On Mon, 2013-07-22 at 14:07 +0530, Mugunthan V N wrote:
> Add support to show CPSW hardware statistics to user via ethtool
> so user can find if there were any error reported by hardware or
> the system is over loaded duing high data rate transfer.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> ---
>  drivers/net/ethernet/ti/cpsw.c | 202 ++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 200 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index 05a1674..f344c05 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
[...]
> +static const struct cpsw_stats cpsw_gstrings_stats[] = {
> +	{ "Good Rx Frames", CPSW_STAT(rxgoodframes) },
> +	{ "Broadcast Rx Frames", CPSW_STAT(rxbroadcastframes) },
> +	{ "Multicast Rx Frames", CPSW_STAT(rxmulticastframes) },
> +	{ "Pause Rx Frames", CPSW_STAT(rxpauseframes) },
> +	{ "Rx CRC Errors", CPSW_STAT(rxcrcerrors) },
[...]

Statistic names usually don't contain spaces, though I can accept this
is probably more readable.

> +static void cpsw_get_ethtool_stats(struct net_device *ndev,
> +				    struct ethtool_stats *stats, u64 *data)
> +{
> +	struct cpsw_priv *priv = netdev_priv(ndev);
> +	struct cpdma_chan_stats rx_stats;
> +	struct cpdma_chan_stats tx_stats;
> +	u32 val;
> +	u8 *p;
> +	int i;
> +
> +	/* Collect Davinci CPDMA stats for Rx and Tx Channel */
> +	cpdma_chan_get_stats(priv->rxch, &rx_stats);
> +	cpdma_chan_get_stats(priv->txch, &tx_stats);
> +
> +	for (i = 0; i < CPSW_STATS_LEN; i++) {
> +		switch (cpsw_gstrings_stats[i].type) {
> +		case CPSW_STATS:
> +			val = readl((u8 *)priv->hw_stats +

Shouldn't this cast use 'u8 __iomem *'?

Ben.

> +				    cpsw_gstrings_stats[i].stat_offset);
> +			data[i] = val;
> +			break;
[...]

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


  reply	other threads:[~2013-07-22 17:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22  8:37 [PATCH 1/1] drivers: net: cpsw: add support to show hw stats via ethtool Mugunthan V N
2013-07-22 17:05 ` Ben Hutchings [this message]
2013-07-23  8:51   ` Mugunthan V N

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=1374512741.1635.12.camel@bwh-desktop.uk.level5networks.com \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-omap@vger.kernel.org \
    --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).