diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2011-11-17 00:36:59 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-17 00:36:59 +0100 |
commit | 28011cf19b75df9d3f35489a7599a97ec0b3f1a0 (patch) | |
tree | cc058e15191db60adb45e426fc3d328e9d246b41 /drivers/net/ethernet/broadcom/bnx2.c | |
parent | Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsh... (diff) | |
download | linux-28011cf19b75df9d3f35489a7599a97ec0b3f1a0.tar.xz linux-28011cf19b75df9d3f35489a7599a97ec0b3f1a0.zip |
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/broadcom/bnx2.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 7203f37d2ef3..6b7cd1e80ada 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c @@ -2064,21 +2064,12 @@ __acquires(&bp->phy_lock) bnx2_read_phy(bp, MII_CTRL1000, &adv1000_reg); adv1000_reg &= PHY_ALL_1000_SPEED; - if (bp->advertising & ADVERTISED_10baseT_Half) - new_adv_reg |= ADVERTISE_10HALF; - if (bp->advertising & ADVERTISED_10baseT_Full) - new_adv_reg |= ADVERTISE_10FULL; - if (bp->advertising & ADVERTISED_100baseT_Half) - new_adv_reg |= ADVERTISE_100HALF; - if (bp->advertising & ADVERTISED_100baseT_Full) - new_adv_reg |= ADVERTISE_100FULL; - if (bp->advertising & ADVERTISED_1000baseT_Full) - new_adv1000_reg |= ADVERTISE_1000FULL; - + new_adv_reg = ethtool_adv_to_mii_100bt(bp->advertising); new_adv_reg |= ADVERTISE_CSMA; - new_adv_reg |= bnx2_phy_get_pause_adv(bp); + new_adv1000_reg |= ethtool_adv_to_mii_1000T(bp->advertising); + if ((adv1000_reg != new_adv1000_reg) || (adv_reg != new_adv_reg) || ((bmcr & BMCR_ANENABLE) == 0)) { |