src/dpdk/drivers/net/ixgbe/base/ixgbe_x550.c
s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
				       ixgbe_link_speed *speed,
				       bool *autoneg)
{
	DEBUGFUNC("ixgbe_get_link_capabilities_X550em");


	if (hw->phy.type == ixgbe_phy_fw) {
		*autoneg = true;
		*speed = hw->phy.speeds_supported;
		return 0;
	}

	/* SFP */
	if (hw->phy.media_type == ixgbe_media_type_fiber) {

		/* CS4227 SFP must not enable auto-negotiation */
		*autoneg = false;

		/* Check if 1G SFP module. */
		if (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_lha_core0 ||
		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1
		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {
			*speed = IXGBE_LINK_SPEED_1GB_FULL;
			return IXGBE_SUCCESS;
		}

		/* Link capabilities are based on SFP */
		if (hw->phy.multispeed_fiber)
			*speed = IXGBE_LINK_SPEED_10GB_FULL |
				 IXGBE_LINK_SPEED_1GB_FULL;
		else
			*speed = IXGBE_LINK_SPEED_10GB_FULL;
	} else {
		*autoneg = true;

		switch (hw->phy.type) {
		case ixgbe_phy_x550em_xfi:
			*speed = IXGBE_LINK_SPEED_1GB_FULL |
				 IXGBE_LINK_SPEED_10GB_FULL;
			*autoneg = false;
			break;
		case ixgbe_phy_ext_1g_t:
		case ixgbe_phy_sgmii:
			*speed = IXGBE_LINK_SPEED_1GB_FULL;
			break;
		case ixgbe_phy_x550em_kr:
			if (hw->mac.type == ixgbe_mac_X550EM_a) {
				/* check different backplane modes */
				if (hw->phy.nw_mng_if_sel &
					   IXGBE_NW_MNG_IF_SEL_PHY_SPEED_2_5G) {
					*speed = IXGBE_LINK_SPEED_2_5GB_FULL;
					break;
				} else if (hw->device_id ==
						   IXGBE_DEV_ID_X550EM_A_KR_L) {
					*speed = IXGBE_LINK_SPEED_1GB_FULL;
					break;
				}
			}
			/* fall through */
		default:
			*speed = IXGBE_LINK_SPEED_10GB_FULL |
				 IXGBE_LINK_SPEED_1GB_FULL;
			break;
		}
	}

	return IXGBE_SUCCESS;
}
/**
 * ixgbe_get_link_capabilities_x550em - Determines link capabilities
 * @hw: pointer to hardware structure
 * @speed: pointer to link speed
 * @autoneg: true when autoneg or autotry is enabled
 */
Determines link capabilities
@hw: pointer to hardware structure
@speed: pointer to link speed
@autoneg: true when autoneg or autotry is enabled
Determines link capabilities @hw : pointer to hardware structure @speed : pointer to link speed @autoneg : true when autoneg or autotry is enabled
s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
				       ixgbe_link_speed *speed,
				       bool *autoneg)
{
	DEBUGFUNC("ixgbe_get_link_capabilities_X550em");
	if (hw->phy.type == ixgbe_phy_fw) {
		*autoneg = true;
		*speed = hw->phy.speeds_supported;
		return 0;
	}
	if (hw->phy.media_type == ixgbe_media_type_fiber) {
		*autoneg = false;
		if (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_lha_core0 ||
		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1
		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {
			*speed = IXGBE_LINK_SPEED_1GB_FULL;
			return IXGBE_SUCCESS;
		}
		if (hw->phy.multispeed_fiber)
			*speed = IXGBE_LINK_SPEED_10GB_FULL |
				 IXGBE_LINK_SPEED_1GB_FULL;
		else
			*speed = IXGBE_LINK_SPEED_10GB_FULL;
	} else {
		*autoneg = true;
		switch (hw->phy.type) {
		case ixgbe_phy_x550em_xfi:
			*speed = IXGBE_LINK_SPEED_1GB_FULL |
				 IXGBE_LINK_SPEED_10GB_FULL;
			*autoneg = false;
			break;
		case ixgbe_phy_ext_1g_t:
		case ixgbe_phy_sgmii:
			*speed = IXGBE_LINK_SPEED_1GB_FULL;
			break;
		case ixgbe_phy_x550em_kr:
			if (hw->mac.type == ixgbe_mac_X550EM_a) {
				if (hw->phy.nw_mng_if_sel &
					   IXGBE_NW_MNG_IF_SEL_PHY_SPEED_2_5G) {
					*speed = IXGBE_LINK_SPEED_2_5GB_FULL;
					break;
				} else if (hw->device_id ==
						   IXGBE_DEV_ID_X550EM_A_KR_L) {
					*speed = IXGBE_LINK_SPEED_1GB_FULL;
					break;
				}
			}
		default:
			*speed = IXGBE_LINK_SPEED_10GB_FULL |
				 IXGBE_LINK_SPEED_1GB_FULL;
			break;
		}
	}
	return IXGBE_SUCCESS;
}
s32 ixgbe_get_link_capabilities_X550em ( struct ixgbe_hw * hw , ixgbe_link_speed * speed , bool * autoneg ) { DEBUGFUNC ( " " ) ; if ( hw -> phy . type == ixgbe_phy_fw ) { * autoneg = true ; * speed = hw -> phy . speeds_supported ; return 0 ; } if ( hw -> phy . media_type == ixgbe_media_type_fiber ) { * autoneg = false ; if ( 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_lha_core0 || hw -> phy . sfp_type == ixgbe_sfp_type_1g_lha_core1 || hw -> phy . sfp_type == ixgbe_sfp_type_1g_lx_core0 || hw -> phy . sfp_type == ixgbe_sfp_type_1g_lx_core1 ) { * speed = IXGBE_LINK_SPEED_1GB_FULL ; return IXGBE_SUCCESS ; } if ( hw -> phy . multispeed_fiber ) * speed = IXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL ; else * speed = IXGBE_LINK_SPEED_10GB_FULL ; } else { * autoneg = true ; switch ( hw -> phy . type ) { case ixgbe_phy_x550em_xfi : * speed = IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_10GB_FULL ; * autoneg = false ; break ; case ixgbe_phy_ext_1g_t : case ixgbe_phy_sgmii : * speed = IXGBE_LINK_SPEED_1GB_FULL ; break ; case ixgbe_phy_x550em_kr : if ( hw -> mac . type == ixgbe_mac_X550EM_a ) { if ( hw -> phy . nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_PHY_SPEED_2_5G ) { * speed = IXGBE_LINK_SPEED_2_5GB_FULL ; break ; } else if ( hw -> device_id == IXGBE_DEV_ID_X550EM_A_KR_L ) { * speed = IXGBE_LINK_SPEED_1GB_FULL ; break ; } } default : * speed = IXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL ; break ; } } return IXGBE_SUCCESS ; }
ixgbe_get_link_capabilities_x550em - Determines link capabilities
 @hw: pointer to hardware structure
 @speed: pointer to link speed
 @autoneg: true when autoneg or autotry is enabled
ixgbe_get_link_capabilities_x550em - Determines link capabilities @hw : pointer to hardware structure @speed : pointer to link speed @autoneg : true when autoneg or autotry is enabled
/* SFP */ /* CS4227 SFP must not enable auto-negotiation */ /* Check if 1G SFP module. */ /* Link capabilities are based on SFP */ /* check different backplane modes */ /* fall through */