netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Mugunthan V N <mugunthanvnm@ti.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [ethtool PATCH 1/1] ethtool: Support cpsw ale-table registers in -d
Date: Sun, 21 Sep 2014 23:58:46 +0100	[thread overview]
Message-ID: <1411340326.20019.32.camel@decadent.org.uk> (raw)
In-Reply-To: <1406107764-1737-1-git-send-email-mugunthanvnm@ti.com>

[-- Attachment #1: Type: text/plain, Size: 1560 bytes --]

Sorry I didn't respond to this earlier.

On Wed, 2014-07-23 at 14:59 +0530, Mugunthan V N wrote:
[...]
> --- /dev/null
> +++ b/cpsw.c
[...]
> +static inline void cpsw_ale_set_field(u32 *ale_entry, u32 start, u32 bits,
> +				      u32 value)
> +{
> +	int idx;
> +
> +	value &= BITMASK(bits);
> +	idx    = start / 32;
> +	start -= idx * 32;
> +	idx    = 2 - idx; /* flip */
> +	ale_entry[idx] &= ~(BITMASK(bits) << start);
> +	ale_entry[idx] |=  (value << start);
> +}
> +
> +#define DEFINE_ALE_FIELD(name, start, bits)				\
> +static inline int cpsw_ale_get_##name(u32 *ale_entry)			\
> +{									\
> +	return cpsw_ale_get_field(ale_entry, start, bits);		\
> +}									\
> +static inline void cpsw_ale_set_##name(u32 *ale_entry, u32 value)	\
> +{									\
> +	cpsw_ale_set_field(ale_entry, start, bits, value);		\
> +}

The setter functions are unused.

[...]
> +int cpsw_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
> +{
> +	u32 *reg = (u8 *)regs->data;
> +	u32 len = regs->len / 3;
> +	int i;
> +
> +	fprintf(stdout, "cpsw hw version %d.%d (%d)\n",
> +		CPSW_MAJOR_VERSION(regs->version),
> +		CPSW_MINOR_VERSION(regs->version),
> +		CPSW_RTL_VERSION(regs->version));
[...]

There needs to be a version check here.  Some future version of the
hardware or driver may introduce an incompatible dump format.

Ben.

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  parent reply	other threads:[~2014-09-21 22:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23  9:29 [ethtool PATCH 1/1] ethtool: Support cpsw ale-table registers in -d Mugunthan V N
2014-07-23  9:35 ` Mugunthan V N
2014-09-21 22:58 ` Ben Hutchings [this message]
2014-09-24  5:32   ` 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=1411340326.20019.32.camel@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --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).