netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
To: davem@davemloft.net, mcarlson@broadcom.com, mchan@broadcom.com
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next] tg3: Fix advertisement handling
Date: Mon, 21 Nov 2011 08:07:20 +0900	[thread overview]
Message-ID: <20111121080720.0e68f096.shimoda.hiroaki@gmail.com> (raw)

Commit 28011cf19b (net: Add ethtool to mii advertisment conversion
helpers) added a helper function ethtool_adv_to_mii_100bt() and
tg3_copper_is_advertising_all(), tg3_phy_autoneg_cfg() were
modified to use this.
Before that commit, ethtool to mii advertisement conversion was
done wrt speed, but now pause operation is also taken account.
So, in tg3_copper_is_advertising_all(), below condition becomes
true and this makes link up fails.

	if ((adv_reg & ADVERTISE_ALL) != all_mask)
		return 0;

To fix this add ADVERTISE_ALL bit and operation to cap speed.

Signed-off-by: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
---
 drivers/net/ethernet/broadcom/tg3.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 024ca1d..c00e648 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -3594,7 +3594,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl)
 	u32 val, new_adv;
 
 	new_adv = ADVERTISE_CSMA;
-	new_adv |= ethtool_adv_to_mii_100bt(advertise);
+	new_adv |= ethtool_adv_to_mii_100bt(advertise) & ADVERTISE_ALL;
 	new_adv |= tg3_advert_flowctrl_1000T(flowctrl);
 
 	err = tg3_writephy(tp, MII_ADVERTISE, new_adv);
@@ -3783,7 +3783,7 @@ static int tg3_copper_is_advertising_all(struct tg3 *tp, u32 mask)
 	if (tg3_readphy(tp, MII_ADVERTISE, &adv_reg))
 		return 0;
 
-	if ((adv_reg & ADVERTISE_ALL) != all_mask)
+	if ((adv_reg & ADVERTISE_ALL) != (all_mask & ADVERTISE_ALL))
 		return 0;
 
 	if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {

             reply	other threads:[~2011-11-20 23:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-20 23:07 Hiroaki SHIMODA [this message]
2011-11-21  6:38 ` [PATCH net-next] tg3: Fix advertisement handling Eric Dumazet
2011-11-21 19:29 ` Matt Carlson
2011-11-21 22:40   ` Hiroaki SHIMODA

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=20111121080720.0e68f096.shimoda.hiroaki@gmail.com \
    --to=shimoda.hiroaki@gmail.com \
    --cc=davem@davemloft.net \
    --cc=mcarlson@broadcom.com \
    --cc=mchan@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).