diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2011-11-16 18:36:59 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-16 18:36:59 -0500 |
commit | 28011cf19b75df9d3f35489a7599a97ec0b3f1a0 (patch) | |
tree | cc058e15191db60adb45e426fc3d328e9d246b41 /drivers/net/ethernet/sun/niu.c | |
parent | f85fa279138489543206381883c8f67ef94aa912 (diff) |
net: Add ethtool to mii advertisment conversion helpers
Translating between ethtool advertisement settings and MII
advertisements are common operations for ethernet drivers. This patch
adds a set of helper functions that implements the conversion. The
patch then modifies a couple of the drivers to use the new functions.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sun/niu.c')
-rw-r--r-- | drivers/net/ethernet/sun/niu.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 3ebeb9d400fb..9997be525089 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c @@ -1151,19 +1151,8 @@ static int link_status_mii(struct niu *np, int *link_up_p) supported |= SUPPORTED_1000baseT_Full; lp->supported = supported; - advertising = 0; - if (advert & ADVERTISE_10HALF) - advertising |= ADVERTISED_10baseT_Half; - if (advert & ADVERTISE_10FULL) - advertising |= ADVERTISED_10baseT_Full; - if (advert & ADVERTISE_100HALF) - advertising |= ADVERTISED_100baseT_Half; - if (advert & ADVERTISE_100FULL) - advertising |= ADVERTISED_100baseT_Full; - if (ctrl1000 & ADVERTISE_1000HALF) - advertising |= ADVERTISED_1000baseT_Half; - if (ctrl1000 & ADVERTISE_1000FULL) - advertising |= ADVERTISED_1000baseT_Full; + advertising = mii_adv_to_ethtool_100bt(advert); + advertising |= mii_adv_to_ethtool_1000T(ctrl1000); if (bmcr & BMCR_ANENABLE) { int neg, neg1000; |