Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixgbe/ixgbe.c
Show First 20 Lines • Show All 1,692 Lines • ▼ Show 20 Lines | |||||
* This routine is called whenever the user queries the status of | * This routine is called whenever the user queries the status of | ||||
* the interface using ifconfig. | * the interface using ifconfig. | ||||
* | * | ||||
**********************************************************************/ | **********************************************************************/ | ||||
static void | static void | ||||
ixgbe_media_status(struct ifnet * ifp, struct ifmediareq * ifmr) | ixgbe_media_status(struct ifnet * ifp, struct ifmediareq * ifmr) | ||||
{ | { | ||||
struct adapter *adapter = ifp->if_softc; | struct adapter *adapter = ifp->if_softc; | ||||
struct ixgbe_hw *hw = &adapter->hw; | |||||
INIT_DEBUGOUT("ixgbe_media_status: begin"); | INIT_DEBUGOUT("ixgbe_media_status: begin"); | ||||
IXGBE_CORE_LOCK(adapter); | IXGBE_CORE_LOCK(adapter); | ||||
ixgbe_update_link_status(adapter); | ixgbe_update_link_status(adapter); | ||||
ifmr->ifm_status = IFM_AVALID; | ifmr->ifm_status = IFM_AVALID; | ||||
ifmr->ifm_active = IFM_ETHER; | ifmr->ifm_active = IFM_ETHER; | ||||
if (!adapter->link_active) { | if (!adapter->link_active) { | ||||
IXGBE_CORE_UNLOCK(adapter); | IXGBE_CORE_UNLOCK(adapter); | ||||
return; | return; | ||||
} | } | ||||
ifmr->ifm_status |= IFM_ACTIVE; | ifmr->ifm_status |= IFM_ACTIVE; | ||||
switch (adapter->link_speed) { | /* | ||||
case IXGBE_LINK_SPEED_100_FULL: | * Not all NIC are 1000baseSX as an example X540T. | ||||
* We must set properly the media based on NIC model. | |||||
*/ | |||||
switch (hw->device_id) { | |||||
case IXGBE_DEV_ID_X540T: | |||||
if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL) | |||||
ifmr->ifm_active |= IFM_100_TX | IFM_FDX; | ifmr->ifm_active |= IFM_100_TX | IFM_FDX; | ||||
else if (adapter->link_speed == IXGBE_LINK_SPEED_1GB_FULL) | |||||
ifmr->ifm_active |= IFM_1000_T | IFM_FDX; | |||||
else if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL) | |||||
ifmr->ifm_active |= adapter->optics | IFM_FDX; | |||||
break; | break; | ||||
case IXGBE_LINK_SPEED_1GB_FULL: | default: | ||||
if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL) | |||||
ifmr->ifm_active |= IFM_100_TX | IFM_FDX; | |||||
else if (adapter->link_speed == IXGBE_LINK_SPEED_1GB_FULL) | |||||
ifmr->ifm_active |= IFM_1000_SX | IFM_FDX; | ifmr->ifm_active |= IFM_1000_SX | IFM_FDX; | ||||
break; | else if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL) | ||||
case IXGBE_LINK_SPEED_10GB_FULL: | |||||
ifmr->ifm_active |= adapter->optics | IFM_FDX; | ifmr->ifm_active |= adapter->optics | IFM_FDX; | ||||
break; | break; | ||||
} | } | ||||
IXGBE_CORE_UNLOCK(adapter); | IXGBE_CORE_UNLOCK(adapter); | ||||
return; | return; | ||||
} | } | ||||
/********************************************************************* | /********************************************************************* | ||||
* | * | ||||
▲ Show 20 Lines • Show All 4,290 Lines • Show Last 20 Lines |