src/dpdk/drivers/net/ice/base/ice_common.c
enum ice_status
ice_get_link_default_override(struct ice_link_default_override_tlv *ldo,
			      struct ice_port_info *pi)
{
	u16 i, tlv, tlv_len, tlv_start, buf, offset;
	struct ice_hw *hw = pi->hw;
	enum ice_status status;

	status = ice_get_pfa_module_tlv(hw, &tlv, &tlv_len,
					ICE_SR_LINK_DEFAULT_OVERRIDE_PTR);
	if (status) {
		ice_debug(hw, ICE_DBG_INIT, "Failed to read link override TLV.\n");
		return status;
	}

	/* Each port has its own config; calculate for our port */
	tlv_start = tlv + pi->lport * ICE_SR_PFA_LINK_OVERRIDE_WORDS +
		ICE_SR_PFA_LINK_OVERRIDE_OFFSET;

	/* link options first */
	status = ice_read_sr_word(hw, tlv_start, &buf);
	if (status) {
		ice_debug(hw, ICE_DBG_INIT, "Failed to read override link options.\n");
		return status;
	}
	ldo->options = buf & ICE_LINK_OVERRIDE_OPT_M;
	ldo->phy_config = (buf & ICE_LINK_OVERRIDE_PHY_CFG_M) >>
		ICE_LINK_OVERRIDE_PHY_CFG_S;

	/* link PHY config */
	offset = tlv_start + ICE_SR_PFA_LINK_OVERRIDE_FEC_OFFSET;
	status = ice_read_sr_word(hw, offset, &buf);
	if (status) {
		ice_debug(hw, ICE_DBG_INIT, "Failed to read override phy config.\n");
		return status;
	}
	ldo->fec_options = buf & ICE_LINK_OVERRIDE_FEC_OPT_M;

	/* PHY types low */
	offset = tlv_start + ICE_SR_PFA_LINK_OVERRIDE_PHY_OFFSET;
	for (i = 0; i < ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS; i++) {
		status = ice_read_sr_word(hw, (offset + i), &buf);
		if (status) {
			ice_debug(hw, ICE_DBG_INIT, "Failed to read override link options.\n");
			return status;
		}
		/* shift 16 bits at a time to fill 64 bits */
		ldo->phy_type_low |= ((u64)buf << (i * 16));
	}

	/* PHY types high */
	offset = tlv_start + ICE_SR_PFA_LINK_OVERRIDE_PHY_OFFSET +
		ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS;
	for (i = 0; i < ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS; i++) {
		status = ice_read_sr_word(hw, (offset + i), &buf);
		if (status) {
			ice_debug(hw, ICE_DBG_INIT, "Failed to read override link options.\n");
			return status;
		}
		/* shift 16 bits at a time to fill 64 bits */
		ldo->phy_type_high |= ((u64)buf << (i * 16));
	}

	return status;
}
/**
 * ice_get_link_default_override
 * @ldo: pointer to the link default override struct
 * @pi: pointer to the port info struct
 *
 * Gets the link default override for a port
 */
ice_get_link_default_override
@ldo: pointer to the link default override struct
@pi: pointer to the port info struct

Gets the link default override for a port
ice_get_link_default_override @ldo : pointer to the link default override struct @pi : pointer to the port info struct Gets the link default override for a port
enum ice_status
ice_get_link_default_override(struct ice_link_default_override_tlv *ldo,
			      struct ice_port_info *pi)
{
	u16 i, tlv, tlv_len, tlv_start, buf, offset;
	struct ice_hw *hw = pi->hw;
	enum ice_status status;
	status = ice_get_pfa_module_tlv(hw, &tlv, &tlv_len,
					ICE_SR_LINK_DEFAULT_OVERRIDE_PTR);
	if (status) {
		ice_debug(hw, ICE_DBG_INIT, "Failed to read link override TLV.\n");
		return status;
	}
	tlv_start = tlv + pi->lport * ICE_SR_PFA_LINK_OVERRIDE_WORDS +
		ICE_SR_PFA_LINK_OVERRIDE_OFFSET;
	status = ice_read_sr_word(hw, tlv_start, &buf);
	if (status) {
		ice_debug(hw, ICE_DBG_INIT, "Failed to read override link options.\n");
		return status;
	}
	ldo->options = buf & ICE_LINK_OVERRIDE_OPT_M;
	ldo->phy_config = (buf & ICE_LINK_OVERRIDE_PHY_CFG_M) >>
		ICE_LINK_OVERRIDE_PHY_CFG_S;
	offset = tlv_start + ICE_SR_PFA_LINK_OVERRIDE_FEC_OFFSET;
	status = ice_read_sr_word(hw, offset, &buf);
	if (status) {
		ice_debug(hw, ICE_DBG_INIT, "Failed to read override phy config.\n");
		return status;
	}
	ldo->fec_options = buf & ICE_LINK_OVERRIDE_FEC_OPT_M;
	offset = tlv_start + ICE_SR_PFA_LINK_OVERRIDE_PHY_OFFSET;
	for (i = 0; i < ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS; i++) {
		status = ice_read_sr_word(hw, (offset + i), &buf);
		if (status) {
			ice_debug(hw, ICE_DBG_INIT, "Failed to read override link options.\n");
			return status;
		}
		ldo->phy_type_low |= ((u64)buf << (i * 16));
	}
	offset = tlv_start + ICE_SR_PFA_LINK_OVERRIDE_PHY_OFFSET +
		ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS;
	for (i = 0; i < ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS; i++) {
		status = ice_read_sr_word(hw, (offset + i), &buf);
		if (status) {
			ice_debug(hw, ICE_DBG_INIT, "Failed to read override link options.\n");
			return status;
		}
		ldo->phy_type_high |= ((u64)buf << (i * 16));
	}
	return status;
}
enum ice_status ice_get_link_default_override ( struct ice_link_default_override_tlv * ldo , struct ice_port_info * pi ) { u16 i , tlv , tlv_len , tlv_start , buf , offset ; struct ice_hw * hw = pi -> hw ; enum ice_status status ; status = ice_get_pfa_module_tlv ( hw , & tlv , & tlv_len , ICE_SR_LINK_DEFAULT_OVERRIDE_PTR ) ; if ( status ) { ice_debug ( hw , ICE_DBG_INIT , " \n " ) ; return status ; } tlv_start = tlv + pi -> lport * ICE_SR_PFA_LINK_OVERRIDE_WORDS + ICE_SR_PFA_LINK_OVERRIDE_OFFSET ; status = ice_read_sr_word ( hw , tlv_start , & buf ) ; if ( status ) { ice_debug ( hw , ICE_DBG_INIT , " \n " ) ; return status ; } ldo -> options = buf & ICE_LINK_OVERRIDE_OPT_M ; ldo -> phy_config = ( buf & ICE_LINK_OVERRIDE_PHY_CFG_M ) >> ICE_LINK_OVERRIDE_PHY_CFG_S ; offset = tlv_start + ICE_SR_PFA_LINK_OVERRIDE_FEC_OFFSET ; status = ice_read_sr_word ( hw , offset , & buf ) ; if ( status ) { ice_debug ( hw , ICE_DBG_INIT , " \n " ) ; return status ; } ldo -> fec_options = buf & ICE_LINK_OVERRIDE_FEC_OPT_M ; offset = tlv_start + ICE_SR_PFA_LINK_OVERRIDE_PHY_OFFSET ; for ( i = 0 ; i < ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS ; i ++ ) { status = ice_read_sr_word ( hw , ( offset + i ) , & buf ) ; if ( status ) { ice_debug ( hw , ICE_DBG_INIT , " \n " ) ; return status ; } ldo -> phy_type_low |= ( ( u64 ) buf << ( i * 16 ) ) ; } offset = tlv_start + ICE_SR_PFA_LINK_OVERRIDE_PHY_OFFSET + ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS ; for ( i = 0 ; i < ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS ; i ++ ) { status = ice_read_sr_word ( hw , ( offset + i ) , & buf ) ; if ( status ) { ice_debug ( hw , ICE_DBG_INIT , " \n " ) ; return status ; } ldo -> phy_type_high |= ( ( u64 ) buf << ( i * 16 ) ) ; } return status ; }
ice_get_link_default_override
 @ldo: pointer to the link default override struct
 @pi: pointer to the port info struct
ice_get_link_default_override @ldo : pointer to the link default override struct @pi : pointer to the port info struct
/* Each port has its own config; calculate for our port */ /* link options first */ /* link PHY config */ /* PHY types low */ /* shift 16 bits at a time to fill 64 bits */ /* PHY types high */ /* shift 16 bits at a time to fill 64 bits */