summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2006-12-30 09:36:22 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2006-12-30 09:36:22 +0000
commit8117da2105cf8345680f0d7babb667e689957a21 (patch)
tree120afcdcbb4b5753c66db11dd08e6a7c611e216e /sys
parent829e706d5c07ed869195a399b71563d6a3280552 (diff)
Make mii_phy_auto() advertise flow control if MIIF_DOPAUSE is set.
ok jsg@, brad@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/mii/mii_physubr.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c
index 0fe41652334..6e2858e5045 100644
--- a/sys/dev/mii/mii_physubr.c
+++ b/sys/dev/mii/mii_physubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mii_physubr.c,v 1.30 2006/12/28 09:24:27 kettenis Exp $ */
+/* $OpenBSD: mii_physubr.c,v 1.31 2006/12/30 09:36:21 kettenis Exp $ */
/* $NetBSD: mii_physubr.c,v 1.20 2001/04/13 23:30:09 thorpej Exp $ */
/*-
@@ -147,12 +147,27 @@ mii_phy_auto(struct mii_softc *sc, int waitfor)
if (sc->mii_extcapabilities & EXTSR_1000XHDX)
anar |= ANAR_X_HD;
+ if (sc->mii_flags & MIIF_DOPAUSE &&
+ sc->mii_extcapabilities & EXTSR_1000XFDX)
+ anar |= ANAR_X_PAUSE_TOWARDS;
+
PHY_WRITE(sc, MII_ANAR, anar);
} else {
uint16_t anar;
anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) |
ANAR_CSMA;
+ /*
+ * Most 100baseTX PHY's only support symmetric
+ * PAUSE, so we don't advertise asymmetric
+ * PAUSE unless we also have 1000baseT capability.
+ */
+ if (sc->mii_flags & MIIF_DOPAUSE) {
+ if (sc->mii_capabilities & BMSR_100TXFDX)
+ anar |= ANAR_FC;
+ if (sc->mii_extcapabilities & EXTSR_1000TFDX)
+ anar |= ANAR_X_PAUSE_TOWARDS;
+ }
PHY_WRITE(sc, MII_ANAR, anar);
if (sc->mii_flags & MIIF_HAVE_GTCR) {
uint16_t gtcr = 0;