public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare•com>
To: Matt Carlson <mcarlson@broadcom•com>
Cc: "davem@davemloft•net" <davem@davemloft•net>,
	"netdev@vger•kernel.org" <netdev@vger•kernel.org>,
	Michael Chan <mchan@broadcom•com>
Subject: Re: [PATCH] Add ethtool to mii advertisment conversion helpers
Date: Thu, 17 Nov 2011 02:45:50 +0000	[thread overview]
Message-ID: <1321497950.2885.72.camel@deadeye> (raw)
In-Reply-To: <20111117020613.GA18232@mcarlson.broadcom.com>

On Wed, 2011-11-16 at 18:06 -0800, Matt Carlson wrote:
> On Wed, Nov 16, 2011 at 05:29:42PM -0800, Ben Hutchings wrote:
> > On Wed, 2011-11-16 at 17:16 -0800, Matt Carlson wrote:
> > > On Wed, Nov 16, 2011 at 04:34:37PM -0800, Ben Hutchings wrote:
> > [...]
> > > > > +#define mii_lpa_to_ethtool_100bt(lpa)	mii_adv_to_ethtool_100bt(lpa)
> > > > 
> > > > Shouldn't this additionally translate LPA_LPACK into ADVERTISED_Autoneg?
> > > 
> > > You mean, like this?
> > > 
> > > static inline u32 mii_lpa_to_ethtool_100bt(u32 lpa)
> > > {
> > > 	u32 result = 0;
> > > 
> > > 	if (lpa & LPA_LPACK)
> > > 		result |= ADVERTISED_Autoneg;
> > > 
> > > 	return result | mii_adv_to_ethtool_100bt(lpa);
> > > }
> > > 
> > > Yes, that looks like a better implementation.
> > 
> > Think so.
> > 
> > And I think the mii_adv_to_ethtool_* functions should add
> > ADVERTISED_Autoneg unconditionally.  But I'm not entirely sure that's
> > right.
> 
> The primary purpose of these functions is to translate the information
> between two representations.  It seems wise to be careful not to add
> from it or take anything away from it.  It is certainly possible to
> have a valid AN advertisement register configuration, but not have
> autoneg enabled.  Keeping the ADVERTISED_Autoneg out could prevent
> misuse.  Do you agree?

I'm not sure what you mean about misuse.  If autoneg is not enabled then
the register contents are not used and I don't think the
mii_adv_to_ethtool functions should be called at all.  But I'm not that
bothered either way.

> > > > Shouldn't there be mii_lpa_to_ethtool_1000X (or
> > > > mii_lpa_to_ethtool_lpa_x)?
> > > 
> > > Yes.  You're right.  Should it just be a preprocessor definition that
> > > points to mii_adv_to_ethtool_1000X()?
> > 
> > I think that would need to handle LPA_LPACK as well.
> 
> I was wondering if that was present in 1000Base-X mode.  I didn't see it
> in my passing glance at a spec.

IEEE 802.3-2005 §37.2.1.6 seems to define it similarly to the TP case.

Ben.

-- 
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:[~2011-11-17  2:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15 22:00 [PATCH] Add ethtool to mii advertisment conversion helpers Matt Carlson
2011-11-16 22:36 ` David Miller
2011-11-16 22:56   ` Matt Carlson
2011-11-17  0:34 ` Ben Hutchings
2011-11-17  1:16   ` Matt Carlson
2011-11-17  1:21     ` Michael Chan
2011-11-17  1:38       ` David Miller
2011-11-17  2:29         ` Ben Hutchings
2011-11-17  1:29     ` Ben Hutchings
2011-11-17  2:06       ` Matt Carlson
2011-11-17  2:45         ` Ben Hutchings [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=1321497950.2885.72.camel@deadeye \
    --to=bhutchings@solarflare$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=mcarlson@broadcom$(echo .)com \
    --cc=mchan@broadcom$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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