Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tg3: Fix advertisement handling

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,
and change default advertisement not including ADVERTISED_Pause.

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Hiroaki SHIMODA and committed by
David S. Miller
202ff1c2 570e57bc

+3 -4
+3 -4
drivers/net/ethernet/broadcom/tg3.c
··· 3594 3594 u32 val, new_adv; 3595 3595 3596 3596 new_adv = ADVERTISE_CSMA; 3597 - new_adv |= ethtool_adv_to_mii_adv_t(advertise); 3597 + new_adv |= ethtool_adv_to_mii_adv_t(advertise) & ADVERTISE_ALL; 3598 3598 new_adv |= tg3_advert_flowctrl_1000T(flowctrl); 3599 3599 3600 3600 err = tg3_writephy(tp, MII_ADVERTISE, new_adv); ··· 3778 3778 { 3779 3779 u32 adv_reg, all_mask = 0; 3780 3780 3781 - all_mask = ethtool_adv_to_mii_adv_t(mask); 3781 + all_mask = ethtool_adv_to_mii_adv_t(mask) & ADVERTISE_ALL; 3782 3782 3783 3783 if (tg3_readphy(tp, MII_ADVERTISE, &adv_reg)) 3784 3784 return 0; ··· 13199 13199 13200 13200 static void __devinit tg3_phy_init_link_config(struct tg3 *tp) 13201 13201 { 13202 - u32 adv = ADVERTISED_Autoneg | 13203 - ADVERTISED_Pause; 13202 + u32 adv = ADVERTISED_Autoneg; 13204 13203 13205 13204 if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) 13206 13205 adv |= ADVERTISED_1000baseT_Half |