FreeBSD/sys/dev/utopia/utopia.c
/*
 * Callbacks for the ifmedia infrastructure.
 */
Callbacks for the ifmedia infrastructure.
Callbacks for the ifmedia infrastructure .
static int
utopia_media_change(struct ifnet *ifp)
{
	struct ifatm *ifatm = IFP2IFATM(ifp);
	struct utopia *utp = ifatm->phy;
	int error = 0;
	UTP_LOCK(utp);
	if (utp->chip->type != UTP_TYPE_UNKNOWN && utp->state & UTP_ST_ACTIVE) {
		if (utp->media->ifm_media & IFM_ATM_SDH) {
			if (!(utp->state & UTP_ST_SDH))
				error = utopia_set_sdh(utp, 1);
		} else {
			if (utp->state & UTP_ST_SDH)
				error = utopia_set_sdh(utp, 0);
		}
		if (utp->media->ifm_media & IFM_ATM_UNASSIGNED) {
			if (!(utp->state & UTP_ST_UNASS))
				error = utopia_set_unass(utp, 1);
		} else {
			if (utp->state & UTP_ST_UNASS)
				error = utopia_set_unass(utp, 0);
		}
		if (utp->media->ifm_media & IFM_ATM_NOSCRAMB) {
			if (!(utp->state & UTP_ST_NOSCRAMB))
				error = utopia_set_noscramb(utp, 1);
		} else {
			if (utp->state & UTP_ST_NOSCRAMB)
				error = utopia_set_noscramb(utp, 0);
		}
	} else
		error = EIO;
	UTP_UNLOCK(utp);
	return (error);
}
static int utopia_media_change ( struct ifnet * ifp ) { struct ifatm * ifatm = IFP2IFATM ( ifp ) ; struct utopia * utp = ifatm -> phy ; int error = 0 ; UTP_LOCK ( utp ) ; if ( utp -> chip -> type != UTP_TYPE_UNKNOWN && utp -> state & UTP_ST_ACTIVE ) { if ( utp -> media -> ifm_media & IFM_ATM_SDH ) { if ( ! ( utp -> state & UTP_ST_SDH ) ) error = utopia_set_sdh ( utp , 1 ) ; } else { if ( utp -> state & UTP_ST_SDH ) error = utopia_set_sdh ( utp , 0 ) ; } if ( utp -> media -> ifm_media & IFM_ATM_UNASSIGNED ) { if ( ! ( utp -> state & UTP_ST_UNASS ) ) error = utopia_set_unass ( utp , 1 ) ; } else { if ( utp -> state & UTP_ST_UNASS ) error = utopia_set_unass ( utp , 0 ) ; } if ( utp -> media -> ifm_media & IFM_ATM_NOSCRAMB ) { if ( ! ( utp -> state & UTP_ST_NOSCRAMB ) ) error = utopia_set_noscramb ( utp , 1 ) ; } else { if ( utp -> state & UTP_ST_NOSCRAMB ) error = utopia_set_noscramb ( utp , 0 ) ; } } else error = EIO ; UTP_UNLOCK ( utp ) ; return ( error ) ; }
Callbacks for the ifmedia infrastructure.
Callbacks for the ifmedia infrastructure .