summaryrefslogtreecommitdiffstats
path: root/sys/dev/msk
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2010-03-01 22:55:35 +0000
committeryongari <yongari@FreeBSD.org>2010-03-01 22:55:35 +0000
commita6965976ffa08de0a3ef29785ea2664ea6d0367a (patch)
tree5f93af63147fbbf993e6cdceff1ed1322d59f3c9 /sys/dev/msk
parentc57263d124a64967b72e6e805c71c112a1da7aa5 (diff)
downloadFreeBSD-src-a6965976ffa08de0a3ef29785ea2664ea6d0367a.zip
FreeBSD-src-a6965976ffa08de0a3ef29785ea2664ea6d0367a.tar.gz
Make sure to enable flow-control only if established link is
full-duplex. Previously msk(4) used to allow flow-control on 1000baseT half-duplex media. Also GMAC pause is enabled if link partner is capable of handling it. While I'm here use IFM_OPTIONS instead of using IFM_GMASK to check optional flags of link.
Diffstat (limited to 'sys/dev/msk')
-rw-r--r--sys/dev/msk/if_msk.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/sys/dev/msk/if_msk.c b/sys/dev/msk/if_msk.c
index a177432..ce21037 100644
--- a/sys/dev/msk/if_msk.c
+++ b/sys/dev/msk/if_msk.c
@@ -532,28 +532,25 @@ msk_miibus_statchg(device_t dev)
break;
}
- if (((mii->mii_media_active & IFM_GMASK) & IFM_FDX) != 0)
- gmac |= GM_GPCR_DUP_FULL;
/* Disable Rx flow control. */
- if (((mii->mii_media_active & IFM_GMASK) & IFM_FLAG0) == 0)
+ if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) == 0)
gmac |= GM_GPCR_FC_RX_DIS;
/* Disable Tx flow control. */
- if (((mii->mii_media_active & IFM_GMASK) & IFM_FLAG1) == 0)
+ if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG1) == 0)
gmac |= GM_GPCR_FC_TX_DIS;
+ if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0)
+ gmac |= GM_GPCR_DUP_FULL;
+ else
+ gmac |= GM_GPCR_FC_RX_DIS | GM_GPCR_FC_TX_DIS;
gmac |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA;
GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac);
/* Read again to ensure writing. */
GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL);
-
- gmac = GMC_PAUSE_ON;
- if (((mii->mii_media_active & IFM_GMASK) &
- (IFM_FLAG0 | IFM_FLAG1)) == 0)
- gmac = GMC_PAUSE_OFF;
- /* Diable pause for 10/100 Mbps in half-duplex mode. */
- if ((((mii->mii_media_active & IFM_GMASK) & IFM_FDX) == 0) &&
- (IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX ||
- IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T))
- gmac = GMC_PAUSE_OFF;
+ gmac = GMC_PAUSE_OFF;
+ if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) {
+ if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) != 0)
+ gmac = GMC_PAUSE_ON;
+ }
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), gmac);
/* Enable PHY interrupt for FIFO underrun/overflow. */
OpenPOWER on IntegriCloud