Skip to content

Commit

Permalink
tg3: Fix advertisement handling
Browse files Browse the repository at this point in the history
Commit 28011cf (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,
and change default advertisement not including ADVERTISED_Pause.

Reported-by: Eric Dumazet <[email protected]>
Signed-off-by: Hiroaki SHIMODA <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
hiroa-ki authored and davem330 committed Nov 22, 2011
1 parent 570e57b commit 202ff1c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_adv_t(advertise);
new_adv |= ethtool_adv_to_mii_adv_t(advertise) & ADVERTISE_ALL;
new_adv |= tg3_advert_flowctrl_1000T(flowctrl);

err = tg3_writephy(tp, MII_ADVERTISE, new_adv);
Expand Down Expand Up @@ -3778,7 +3778,7 @@ static int tg3_copper_is_advertising_all(struct tg3 *tp, u32 mask)
{
u32 adv_reg, all_mask = 0;

all_mask = ethtool_adv_to_mii_adv_t(mask);
all_mask = ethtool_adv_to_mii_adv_t(mask) & ADVERTISE_ALL;

if (tg3_readphy(tp, MII_ADVERTISE, &adv_reg))
return 0;
Expand Down Expand Up @@ -13199,8 +13199,7 @@ static u32 __devinit tg3_read_otp_phycfg(struct tg3 *tp)

static void __devinit tg3_phy_init_link_config(struct tg3 *tp)
{
u32 adv = ADVERTISED_Autoneg |
ADVERTISED_Pause;
u32 adv = ADVERTISED_Autoneg;

if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY))
adv |= ADVERTISED_1000baseT_Half |
Expand Down

0 comments on commit 202ff1c

Please sign in to comment.