Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixgbe/ixgbe_phy.c
Show First 20 Lines • Show All 1,296 Lines • ▼ Show 20 Lines | s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) | ||||
enum ixgbe_sfp_type stored_sfp_type = hw->phy.sfp_type; | enum ixgbe_sfp_type stored_sfp_type = hw->phy.sfp_type; | ||||
u8 identifier = 0; | u8 identifier = 0; | ||||
u8 comp_codes_1g = 0; | u8 comp_codes_1g = 0; | ||||
u8 comp_codes_10g = 0; | u8 comp_codes_10g = 0; | ||||
u8 oui_bytes[3] = {0, 0, 0}; | u8 oui_bytes[3] = {0, 0, 0}; | ||||
u8 cable_tech = 0; | u8 cable_tech = 0; | ||||
u8 cable_spec = 0; | u8 cable_spec = 0; | ||||
u16 enforce_sfp = 0; | u16 enforce_sfp = 0; | ||||
static bool warned_once = false; | |||||
markj: You could move this into the block where it's used. | |||||
DEBUGFUNC("ixgbe_identify_sfp_module_generic"); | DEBUGFUNC("ixgbe_identify_sfp_module_generic"); | ||||
if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber) { | if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber) { | ||||
hw->phy.sfp_type = ixgbe_sfp_type_not_present; | hw->phy.sfp_type = ixgbe_sfp_type_not_present; | ||||
status = IXGBE_ERR_SFP_NOT_PRESENT; | status = IXGBE_ERR_SFP_NOT_PRESENT; | ||||
goto out; | goto out; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) && | ||||
hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || | hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || | ||||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || | hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || | ||||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) { | hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) { | ||||
/* Make sure we're a supported PHY type */ | /* Make sure we're a supported PHY type */ | ||||
if (hw->phy.type == ixgbe_phy_sfp_intel) { | if (hw->phy.type == ixgbe_phy_sfp_intel) { | ||||
status = IXGBE_SUCCESS; | status = IXGBE_SUCCESS; | ||||
} else { | } else { | ||||
if (hw->allow_unsupported_sfp == true) { | if (hw->allow_unsupported_sfp == true) { | ||||
if (!warned_once) | |||||
EWARN(hw, | EWARN(hw, | ||||
Not Done Inline ActionsEWARN() seems to only be used for these two unsupported SFP link up messages -- you could add something to the hw struct (or add something to the ixgbe driver struct and look at it via hw->back) and have the EWARN macro check that. That way, you wouldn't run into a code conflict if this code gets updated later in the future (though I doubt it will). erj: EWARN() seems to only be used for these two unsupported SFP link up messages -- you could add… | |||||
"WARNING: Intel (R) Network Connections are quality tested using Intel (R) Ethernet Optics. " | "WARNING: Intel (R) Network Connections are quality tested using Intel (R) Ethernet Optics. " | ||||
"Using untested modules is not supported and may cause unstable operation or damage to the module or the adapter. " | "Using untested modules is not supported and may cause unstable operation or damage to the module or the adapter. " | ||||
"Intel Corporation is not responsible for any harm caused by using untested modules.\n"); | "Intel Corporation is not responsible for any harm caused by using untested modules.\n"); | ||||
warned_once = true; | |||||
status = IXGBE_SUCCESS; | status = IXGBE_SUCCESS; | ||||
} else { | } else { | ||||
DEBUGOUT("SFP+ module not supported\n"); | DEBUGOUT | ||||
("SFP+ module not supported\n"); | |||||
hw->phy.type = | hw->phy.type = | ||||
ixgbe_phy_sfp_unsupported; | ixgbe_phy_sfp_unsupported; | ||||
status = IXGBE_ERR_SFP_NOT_SUPPORTED; | status = IXGBE_ERR_SFP_NOT_SUPPORTED; | ||||
} | } | ||||
} | } | ||||
} else { | } else { | ||||
status = IXGBE_SUCCESS; | status = IXGBE_SUCCESS; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw) | ||||
u8 comp_codes_1g = 0; | u8 comp_codes_1g = 0; | ||||
u8 comp_codes_10g = 0; | u8 comp_codes_10g = 0; | ||||
u8 oui_bytes[3] = {0, 0, 0}; | u8 oui_bytes[3] = {0, 0, 0}; | ||||
u16 enforce_sfp = 0; | u16 enforce_sfp = 0; | ||||
u8 connector = 0; | u8 connector = 0; | ||||
u8 cable_length = 0; | u8 cable_length = 0; | ||||
u8 device_tech = 0; | u8 device_tech = 0; | ||||
bool active_cable = false; | bool active_cable = false; | ||||
static bool warned_once = false; | |||||
Not Done Inline ActionsDitto. markj: Ditto. | |||||
DEBUGFUNC("ixgbe_identify_qsfp_module_generic"); | DEBUGFUNC("ixgbe_identify_qsfp_module_generic"); | ||||
if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber_qsfp) { | if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber_qsfp) { | ||||
hw->phy.sfp_type = ixgbe_sfp_type_not_present; | hw->phy.sfp_type = ixgbe_sfp_type_not_present; | ||||
status = IXGBE_ERR_SFP_NOT_PRESENT; | status = IXGBE_ERR_SFP_NOT_PRESENT; | ||||
goto out; | goto out; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | if (comp_codes_10g & (IXGBE_SFF_10GBASESR_CAPABLE | | ||||
ixgbe_get_device_caps(hw, &enforce_sfp); | ixgbe_get_device_caps(hw, &enforce_sfp); | ||||
if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP)) { | if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP)) { | ||||
/* Make sure we're a supported PHY type */ | /* Make sure we're a supported PHY type */ | ||||
if (hw->phy.type == ixgbe_phy_qsfp_intel) { | if (hw->phy.type == ixgbe_phy_qsfp_intel) { | ||||
status = IXGBE_SUCCESS; | status = IXGBE_SUCCESS; | ||||
} else { | } else { | ||||
if (hw->allow_unsupported_sfp == true) { | if (hw->allow_unsupported_sfp == true) { | ||||
if (!warned_once) | |||||
EWARN(hw, | EWARN(hw, | ||||
"WARNING: Intel (R) Network Connections are quality tested using Intel (R) Ethernet Optics. " | "WARNING: Intel (R) Network Connections are quality tested using Intel (R) Ethernet Optics. " | ||||
"Using untested modules is not supported and may cause unstable operation or damage to the module or the adapter. " | "Using untested modules is not supported and may cause unstable operation or damage to the module or the adapter. " | ||||
"Intel Corporation is not responsible for any harm caused by using untested modules.\n"); | "Intel Corporation is not responsible for any harm caused by using untested modules.\n"); | ||||
warned_once = true; | |||||
status = IXGBE_SUCCESS; | status = IXGBE_SUCCESS; | ||||
} else { | } else { | ||||
DEBUGOUT("QSFP module not supported\n"); | DEBUGOUT("QSFP module not supported\n"); | ||||
hw->phy.type = | hw->phy.type = | ||||
ixgbe_phy_sfp_unsupported; | ixgbe_phy_sfp_unsupported; | ||||
status = IXGBE_ERR_SFP_NOT_SUPPORTED; | status = IXGBE_ERR_SFP_NOT_SUPPORTED; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 889 Lines • Show Last 20 Lines |
You could move this into the block where it's used.