summaryrefslogtreecommitdiffstats
path: root/sys/dev/utopia
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2003-07-30 08:35:58 +0000
committerharti <harti@FreeBSD.org>2003-07-30 08:35:58 +0000
commitfcbfc2b0dbd64f94a970b6e03358c5806b5a7d70 (patch)
tree4da61596f88c4489e045abbf86cf374f533afff9 /sys/dev/utopia
parent213f4e3d070599e11273dd054eb2b341b8acf3cf (diff)
downloadFreeBSD-src-fcbfc2b0dbd64f94a970b6e03358c5806b5a7d70.zip
FreeBSD-src-fcbfc2b0dbd64f94a970b6e03358c5806b5a7d70.tar.gz
Generate events when the carrier goes up or down.
Add two sysctl's that allow read-only access to the current state of the utopia interface and to the carrier state.
Diffstat (limited to 'sys/dev/utopia')
-rw-r--r--sys/dev/utopia/utopia.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/dev/utopia/utopia.c b/sys/dev/utopia/utopia.c
index 9cf412a..2d84c71 100644
--- a/sys/dev/utopia/utopia.c
+++ b/sys/dev/utopia/utopia.c
@@ -158,12 +158,14 @@ utopia_check_carrier(struct utopia *utp, u_int carr_ok)
utp->carrier = UTP_CARR_OK;
if (old != UTP_CARR_OK) {
if_printf(&utp->ifatm->ifnet, "carrier detected\n");
+ ATMEV_SEND_IFSTATE_CHANGED(utp->ifatm, 1);
}
} else {
/* no carrier */
utp->carrier = UTP_CARR_LOST;
if (old == UTP_CARR_OK) {
if_printf(&utp->ifatm->ifnet, "carrier lost\n");
+ ATMEV_SEND_IFSTATE_CHANGED(utp->ifatm, 0);
}
}
}
@@ -1435,6 +1437,14 @@ utopia_attach(struct utopia *utp, struct ifatm *ifatm, struct ifmedia *media,
"phy statistics") == NULL)
return (-1);
+ if (SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "phy_state",
+ CTLFLAG_RD, &utp->state, 0, "phy state") == NULL)
+ return (-1);
+
+ if (SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "phy_carrier",
+ CTLFLAG_RD, &utp->carrier, 0, "phy carrier") == NULL)
+ return (-1);
+
UTP_WLOCK_LIST();
LIST_INSERT_HEAD(&utopia_list, utp, link);
UTP_WUNLOCK_LIST();
OpenPOWER on IntegriCloud