netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Matt Carlson <mcarlson@broadcom.com>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 4/6] tg3: Track LP advertising
Date: Thu, 8 Dec 2011 23:06:05 +0000	[thread overview]
Message-ID: <1323385565.3094.3.camel@bwh-desktop> (raw)
In-Reply-To: <1323381002-31565-5-git-send-email-mcarlson@broadcom.com>

On Thu, 2011-12-08 at 13:50 -0800, Matt Carlson wrote:
> This patch adds code to track the autonegotiation advertisements of the
> link partner and report them through ethtool.
> 
> Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
> Reviewed-by: Michael Chan <mchan@broadcom.com>
> ---
>  drivers/net/ethernet/broadcom/tg3.c |   41 ++++++++++++++++++++++++++++++++--
>  drivers/net/ethernet/broadcom/tg3.h |    1 +
>  2 files changed, 39 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index d1681db..ae1e838 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -3803,6 +3803,29 @@ static bool tg3_phy_copper_an_config_ok(struct tg3 *tp, u32 *lcladv)
>  	return true;
>  }
>  
> +static bool tg3_phy_copper_fetch_rmtadv(struct tg3 *tp, u32 *rmtadv)
> +{
> +	u32 val, lpeth = 0;
> +
> +	if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {
> +		if (tg3_readphy(tp, MII_STAT1000, &val))
> +			return false;
> +
> +		lpeth = mii_stat1000_to_ethtool_lpa_t(val);
> +	}
> +
> +	if (tg3_readphy(tp, MII_LPA, &val))
> +		return false;
> +
> +	lpeth |= mii_lpa_to_ethtool_lpa_t(val);
> +	tp->link_config.rmt_adv = lpeth;
> +
> +	if (tg3_flag(tp, PAUSE_AUTONEG))
> +		*rmtadv = val;

I assume that the caller only needs this information if pause autoneg is
enabled, but it's still very strange to put the condition here.

Ben.

> +	return true;
> +}
[...]

-- 
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-12-08 23:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08 21:50 [PATCH net-next 4/6] tg3: Track LP advertising Matt Carlson
2011-12-08 23:06 ` Ben Hutchings [this message]
2011-12-09  0:14   ` Matt Carlson

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=1323385565.3094.3.camel@bwh-desktop \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=mcarlson@broadcom.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).