FreeBSD/sys/dev/utopia/utopia.c
/*
 * Look at the carrier status.
 */
Look at the carrier status.
Look at the carrier status .
static void
utopia_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
{
	struct utopia *utp = IFP2IFATM(ifp)->phy;
	UTP_LOCK(utp);
	if (utp->chip->type != UTP_TYPE_UNKNOWN && utp->state & UTP_ST_ACTIVE) {
		ifmr->ifm_active = IFM_ATM | utp->ifatm->mib.media;
		switch (utp->carrier) {
		  case UTP_CARR_OK:
			ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE;
			break;
		  case UTP_CARR_LOST:
			ifmr->ifm_status = IFM_AVALID;
			break;
		  default:
			ifmr->ifm_status = 0;
			break;
		}
		if (utp->state & UTP_ST_SDH) {
			ifmr->ifm_active |= IFM_ATM_SDH;
			ifmr->ifm_current |= IFM_ATM_SDH;
		}
		if (utp->state & UTP_ST_UNASS) {
			ifmr->ifm_active |= IFM_ATM_UNASSIGNED;
			ifmr->ifm_current |= IFM_ATM_UNASSIGNED;
		}
		if (utp->state & UTP_ST_NOSCRAMB) {
			ifmr->ifm_active |= IFM_ATM_NOSCRAMB;
			ifmr->ifm_current |= IFM_ATM_NOSCRAMB;
		}
	} else {
		ifmr->ifm_active = 0;
		ifmr->ifm_status = 0;
	}
	UTP_UNLOCK(utp);
}
static void utopia_media_status ( struct ifnet * ifp , struct ifmediareq * ifmr ) { struct utopia * utp = IFP2IFATM ( ifp ) -> phy ; UTP_LOCK ( utp ) ; if ( utp -> chip -> type != UTP_TYPE_UNKNOWN && utp -> state & UTP_ST_ACTIVE ) { ifmr -> ifm_active = IFM_ATM | utp -> ifatm -> mib . media ; switch ( utp -> carrier ) { case UTP_CARR_OK : ifmr -> ifm_status = IFM_AVALID | IFM_ACTIVE ; break ; case UTP_CARR_LOST : ifmr -> ifm_status = IFM_AVALID ; break ; default : ifmr -> ifm_status = 0 ; break ; } if ( utp -> state & UTP_ST_SDH ) { ifmr -> ifm_active |= IFM_ATM_SDH ; ifmr -> ifm_current |= IFM_ATM_SDH ; } if ( utp -> state & UTP_ST_UNASS ) { ifmr -> ifm_active |= IFM_ATM_UNASSIGNED ; ifmr -> ifm_current |= IFM_ATM_UNASSIGNED ; } if ( utp -> state & UTP_ST_NOSCRAMB ) { ifmr -> ifm_active |= IFM_ATM_NOSCRAMB ; ifmr -> ifm_current |= IFM_ATM_NOSCRAMB ; } } else { ifmr -> ifm_active = 0 ; ifmr -> ifm_status = 0 ; } UTP_UNLOCK ( utp ) ; }
Look at the carrier status.
Look at the carrier status .