FreeBSD/sys/dev/e1000/if_igb.c
/*********************************************************************
 *
 *  Media Ioctl callback
 *
 *  This routine is called whenever the user queries the status of
 *  the interface using ifconfig.
 *
 **********************************************************************/
Media Ioctl callback
This routine is called whenever the user queries the status of
the interface using ifconfig.
Media Ioctl callback This routine is called whenever the user queries the status of the interface using ifconfig .
static void
igb_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
{
	struct adapter *adapter = ifp->if_softc;
	INIT_DEBUGOUT("igb_media_status: begin");
	IGB_CORE_LOCK(adapter);
	igb_update_link_status(adapter);
	ifmr->ifm_status = IFM_AVALID;
	ifmr->ifm_active = IFM_ETHER;
	if (!adapter->link_active) {
		IGB_CORE_UNLOCK(adapter);
		return;
	}
	ifmr->ifm_status |= IFM_ACTIVE;
	switch (adapter->link_speed) {
	case 10:
		ifmr->ifm_active |= IFM_10_T;
		break;
	case 100:
		if (adapter->hw.phy.media_type ==
		    e1000_media_type_internal_serdes)
			ifmr->ifm_active |= IFM_100_FX;
		else
			ifmr->ifm_active |= IFM_100_TX;
		break;
	case 1000:
		ifmr->ifm_active |= IFM_1000_T;
		break;
	case 2500:
		ifmr->ifm_active |= IFM_2500_SX;
		break;
	}
	if (adapter->link_duplex == FULL_DUPLEX)
		ifmr->ifm_active |= IFM_FDX;
	else
		ifmr->ifm_active |= IFM_HDX;
	IGB_CORE_UNLOCK(adapter);
}
static void igb_media_status ( struct ifnet * ifp , struct ifmediareq * ifmr ) { struct adapter * adapter = ifp -> if_softc ; INIT_DEBUGOUT ( " " ) ; IGB_CORE_LOCK ( adapter ) ; igb_update_link_status ( adapter ) ; ifmr -> ifm_status = IFM_AVALID ; ifmr -> ifm_active = IFM_ETHER ; if ( ! adapter -> link_active ) { IGB_CORE_UNLOCK ( adapter ) ; return ; } ifmr -> ifm_status |= IFM_ACTIVE ; switch ( adapter -> link_speed ) { case 10 : ifmr -> ifm_active |= IFM_10_T ; break ; case 100 : if ( adapter -> hw . phy . media_type == e1000_media_type_internal_serdes ) ifmr -> ifm_active |= IFM_100_FX ; else ifmr -> ifm_active |= IFM_100_TX ; break ; case 1000 : ifmr -> ifm_active |= IFM_1000_T ; break ; case 2500 : ifmr -> ifm_active |= IFM_2500_SX ; break ; } if ( adapter -> link_duplex == FULL_DUPLEX ) ifmr -> ifm_active |= IFM_FDX ; else ifmr -> ifm_active |= IFM_HDX ; IGB_CORE_UNLOCK ( adapter ) ; }
Media Ioctl callback
  This routine is called whenever the user queries the status of
  the interface using ifconfig.
Media Ioctl callback This routine is called whenever the user queries the status of the interface using ifconfig .
/*
		** Support for 100Mb SFP - these are Fiber 
		** but the media type appears as serdes
		*/