From: Matt Carlson Date: Wed, 14 Dec 2011 11:10:00 +0000 (+0000) Subject: tg3: Use mii_advertise_flowctrl X-Git-Tag: v2.6.39-400.9.0~423^2~19^2~11^2~641 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a48c1cdb2f5707b29312595fa522fb2bb67d17a9;p=users%2Fjedix%2Flinux-maple.git tg3: Use mii_advertise_flowctrl This patch replaces tg3's internal tg3_advert_flowctrl_1000T function with mii_advertise_flowctrl provided by the kernel headers. (cherry picked from commit f88788f0da6326cbcaa837e12c8c074027891f07) Signed-off-by: Matt Carlson Reviewed-by: Michael Chan Reviewed-by: Benjamin Li Signed-off-by: David S. Miller Signed-off-by: Joe Jin --- diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 4de2fb2278c0..7b449074bcca 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -1669,22 +1669,6 @@ static void tg3_link_report(struct tg3 *tp) } } -static u16 tg3_advert_flowctrl_1000T(u8 flow_ctrl) -{ - u16 miireg; - - if ((flow_ctrl & FLOW_CTRL_TX) && (flow_ctrl & FLOW_CTRL_RX)) - miireg = ADVERTISE_PAUSE_CAP; - else if (flow_ctrl & FLOW_CTRL_TX) - miireg = ADVERTISE_PAUSE_ASYM; - else if (flow_ctrl & FLOW_CTRL_RX) - miireg = ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; - else - miireg = 0; - - return miireg; -} - static u16 tg3_advert_flowctrl_1000X(u8 flow_ctrl) { u16 miireg; @@ -1785,7 +1769,7 @@ static void tg3_adjust_link(struct net_device *dev) if (phydev->duplex == DUPLEX_HALF) mac_mode |= MAC_MODE_HALF_DUPLEX; else { - lcl_adv = tg3_advert_flowctrl_1000T( + lcl_adv = mii_advertise_flowctrl( tp->link_config.flowctrl); if (phydev->pause) @@ -3587,7 +3571,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl) new_adv = ADVERTISE_CSMA; new_adv |= ethtool_adv_to_mii_adv_t(advertise) & ADVERTISE_ALL; - new_adv |= tg3_advert_flowctrl_1000T(flowctrl); + new_adv |= mii_advertise_flowctrl(flowctrl); err = tg3_writephy(tp, MII_ADVERTISE, new_adv); if (err) @@ -3776,7 +3760,7 @@ static bool tg3_phy_copper_an_config_ok(struct tg3 *tp, u32 *lcladv) advmsk = ADVERTISE_ALL; if (tp->link_config.active_duplex == DUPLEX_FULL) { - tgtadv |= tg3_advert_flowctrl_1000T(tp->link_config.flowctrl); + tgtadv |= mii_advertise_flowctrl(tp->link_config.flowctrl); advmsk |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; }