From 223e90573fc2cb893d5143ff30abb2162e65e735 Mon Sep 17 00:00:00 2001 From: Hartmut Brandt Date: Wed, 30 Jul 2003 08:35:58 +0000 Subject: [PATCH] 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. --- sys/dev/utopia/utopia.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/dev/utopia/utopia.c b/sys/dev/utopia/utopia.c index 9cf412a253a7..2d84c713e777 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();