Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixgbe/if_ix.c
Show First 20 Lines • Show All 2,941 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct ixgbe_hw *hw = &adapter->hw; | struct ixgbe_hw *hw = &adapter->hw; | ||||
u32 autoneg, err = 0; | u32 autoneg, err = 0; | ||||
bool sfp, negotiate; | bool sfp, negotiate; | ||||
sfp = ixgbe_is_sfp(hw); | sfp = ixgbe_is_sfp(hw); | ||||
if (sfp) { | if (sfp) { | ||||
if (hw->phy.multispeed_fiber) { | |||||
hw->mac.ops.setup_sfp(hw); | |||||
ixgbe_enable_tx_laser(hw); | |||||
taskqueue_enqueue(adapter->tq, &adapter->msf_task); | |||||
} else | |||||
taskqueue_enqueue(adapter->tq, &adapter->mod_task); | taskqueue_enqueue(adapter->tq, &adapter->mod_task); | ||||
} else { | } else { | ||||
if (hw->mac.ops.check_link) | if (hw->mac.ops.check_link) | ||||
err = ixgbe_check_link(hw, &adapter->link_speed, | err = ixgbe_check_link(hw, &adapter->link_speed, | ||||
&adapter->link_up, FALSE); | &adapter->link_up, FALSE); | ||||
if (err) | if (err) | ||||
goto out; | goto out; | ||||
autoneg = hw->phy.autoneg_advertised; | autoneg = hw->phy.autoneg_advertised; | ||||
if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) | if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) | ||||
▲ Show 20 Lines • Show All 789 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
** Tasklet for handling SFP module interrupts | ** Tasklet for handling SFP module interrupts | ||||
*/ | */ | ||||
static void | static void | ||||
ixgbe_handle_mod(void *context, int pending) | ixgbe_handle_mod(void *context, int pending) | ||||
{ | { | ||||
struct adapter *adapter = context; | struct adapter *adapter = context; | ||||
struct ixgbe_hw *hw = &adapter->hw; | struct ixgbe_hw *hw = &adapter->hw; | ||||
enum ixgbe_phy_type orig_type = hw->phy.type; | |||||
device_t dev = adapter->dev; | device_t dev = adapter->dev; | ||||
u32 err; | u32 err; | ||||
IXGBE_CORE_LOCK(adapter); | |||||
/* Check to see if the PHY type changed */ | |||||
if (hw->phy.ops.identify) { | |||||
hw->phy.type = ixgbe_phy_unknown; | |||||
hw->phy.ops.identify(hw); | |||||
} | |||||
if (hw->phy.type != orig_type) { | |||||
device_printf(dev, "Detected phy_type %d\n", hw->phy.type); | |||||
if (hw->phy.type == ixgbe_phy_none) { | |||||
hw->phy.sfp_type = ixgbe_sfp_type_unknown; | |||||
goto out; | |||||
} | |||||
/* Try to do the initialization that was skipped before */ | |||||
if (hw->phy.ops.init) | |||||
hw->phy.ops.init(hw); | |||||
if (hw->phy.ops.reset) | |||||
hw->phy.ops.reset(hw); | |||||
} | |||||
err = hw->phy.ops.identify_sfp(hw); | err = hw->phy.ops.identify_sfp(hw); | ||||
if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | ||||
device_printf(dev, | device_printf(dev, | ||||
"Unsupported SFP+ module type was detected.\n"); | "Unsupported SFP+ module type was detected.\n"); | ||||
return; | goto out; | ||||
} | } | ||||
err = hw->mac.ops.setup_sfp(hw); | err = hw->mac.ops.setup_sfp(hw); | ||||
if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | ||||
device_printf(dev, | device_printf(dev, | ||||
"Setup failure - unsupported SFP+ module type.\n"); | "Setup failure - unsupported SFP+ module type.\n"); | ||||
return; | goto out; | ||||
} | } | ||||
if (hw->phy.multispeed_fiber) | |||||
taskqueue_enqueue(adapter->tq, &adapter->msf_task); | taskqueue_enqueue(adapter->tq, &adapter->msf_task); | ||||
out: | |||||
/* Update media type */ | |||||
switch (hw->mac.ops.get_media_type(hw)) { | |||||
case ixgbe_media_type_fiber: | |||||
adapter->optics = IFM_10G_SR; | |||||
break; | |||||
case ixgbe_media_type_copper: | |||||
adapter->optics = IFM_10G_TWINAX; | |||||
break; | |||||
case ixgbe_media_type_cx4: | |||||
adapter->optics = IFM_10G_CX4; | |||||
break; | |||||
default: | |||||
adapter->optics = 0; | |||||
break; | |||||
} | |||||
IXGBE_CORE_UNLOCK(adapter); | |||||
return; | return; | ||||
} | } | ||||
/* | /* | ||||
** Tasklet for handling MSF (multispeed fiber) interrupts | ** Tasklet for handling MSF (multispeed fiber) interrupts | ||||
*/ | */ | ||||
static void | static void | ||||
ixgbe_handle_msf(void *context, int pending) | ixgbe_handle_msf(void *context, int pending) | ||||
{ | { | ||||
struct adapter *adapter = context; | struct adapter *adapter = context; | ||||
struct ixgbe_hw *hw = &adapter->hw; | struct ixgbe_hw *hw = &adapter->hw; | ||||
u32 autoneg; | u32 autoneg; | ||||
bool negotiate; | bool negotiate; | ||||
IXGBE_CORE_LOCK(adapter); | |||||
/* get_supported_phy_layer will call hw->phy.ops.identify_sfp() */ | /* get_supported_phy_layer will call hw->phy.ops.identify_sfp() */ | ||||
adapter->phy_layer = ixgbe_get_supported_physical_layer(hw); | adapter->phy_layer = ixgbe_get_supported_physical_layer(hw); | ||||
autoneg = hw->phy.autoneg_advertised; | autoneg = hw->phy.autoneg_advertised; | ||||
if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) | if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) | ||||
hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiate); | hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiate); | ||||
if (hw->mac.ops.setup_link) | if (hw->mac.ops.setup_link) | ||||
hw->mac.ops.setup_link(hw, autoneg, TRUE); | hw->mac.ops.setup_link(hw, autoneg, TRUE); | ||||
/* Adjust media types shown in ifconfig */ | /* Adjust media types shown in ifconfig */ | ||||
ifmedia_removeall(&adapter->media); | ifmedia_removeall(&adapter->media); | ||||
ixgbe_add_media_types(adapter); | ixgbe_add_media_types(adapter); | ||||
IXGBE_CORE_UNLOCK(adapter); | |||||
return; | return; | ||||
} | } | ||||
/* | /* | ||||
** Tasklet for handling interrupts from an external PHY | ** Tasklet for handling interrupts from an external PHY | ||||
*/ | */ | ||||
static void | static void | ||||
ixgbe_handle_phy(void *context, int pending) | ixgbe_handle_phy(void *context, int pending) | ||||
▲ Show 20 Lines • Show All 2,090 Lines • Show Last 20 Lines |