public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Matt Carlson" <mcarlson@broadcom.com>
To: "Joe Perches" <joe@perches.com>
Cc: "Matthew Carlson" <mcarlson@broadcom.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 1/7] tg3: Add 5720 ASIC rev
Date: Mon, 4 Apr 2011 16:05:06 -0700	[thread overview]
Message-ID: <20110404230506.GA8250@mcarlson.broadcom.com> (raw)
In-Reply-To: <1301942262.1941.60.camel@Joe-Laptop>

On Mon, Apr 04, 2011 at 11:37:42AM -0700, Joe Perches wrote:
> On Mon, 2011-04-04 at 11:24 -0700, Matt Carlson wrote:
> > This patch adds support for the 5720 ASIC rev.
> > 
> > Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
> > Reviewed-by: Michael Chan <mchan@broadcom.com>
> > ---
> >  drivers/net/tg3.c |   67 +++++++++++++++++++++++++++++++++++++---------------
> >  drivers/net/tg3.h |    5 ++++
> >  2 files changed, 52 insertions(+), 20 deletions(-)
> > 
> > diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
> > index b7e03a6..b105cdd 100644
> > --- a/drivers/net/tg3.c
> > +++ b/drivers/net/tg3.c
> > @@ -98,12 +98,14 @@
> >   */
> >  #define TG3_RX_STD_RING_SIZE(tp) \
> >  	((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || \
> > -	  GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) ? \
> > +	  GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || \
> > +	  GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) ? \
> 
> Maybe it'd be better to convert all of these:
> 
> 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
> 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
> 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
> 
> tests to a common functions something like:
> 
> static bool can_asic_<foo>(struct tg3 *tp)
> {
> 	int rev = GET_ASIC_REV(tp->pci_chip_rev_id);
> 	return (rev == ASIC_REV_5717) ||
> 	       (rev == ASIC_REV_5719) ||
> 	       (rev == ASIC_REV_5720);
> }

In general, we do try to do this.  We already have a TG3_FLG3_5717_PLUS
flag, but it includes the 57765 ASIC rev.  I thought :

	if ((tp->tg3_flags3 & TG3_FLG3_5717_PLUS) &&
	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_57765)

didn't look much cleaner.  Demoting the 57765 from that flag also
uglifies the code too much.

Let me think about this a little more.


      reply	other threads:[~2011-04-04 22:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 18:24 [PATCH net-next 1/7] tg3: Add 5720 ASIC rev Matt Carlson
2011-04-04 18:37 ` Joe Perches
2011-04-04 23:05   ` Matt Carlson [this message]

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=20110404230506.GA8250@mcarlson.broadcom.com \
    --to=mcarlson@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=joe@perches.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