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.
This commit is contained in:
Hartmut Brandt 2003-07-30 08:35:58 +00:00
parent 7b4bd98ad5
commit 223e90573f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118202

View file

@ -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();