src/dpdk/drivers/net/txgbe/base/txgbe_phy.c
void txgbe_autoc_write(struct txgbe_hw *hw, u64 autoc)
{
	bool autoneg;
	u32 speed;
	u32 mactxcfg = 0;

	speed = TXGBE_AUTOC_SPEED(autoc);
	autoc &= ~TXGBE_AUTOC_SPEED_MASK;
	autoneg = (autoc & TXGBE_AUTOC_AUTONEG ? true : false);
	autoc &= ~TXGBE_AUTOC_AUTONEG;

	if (hw->device_id == TXGBE_DEV_ID_RAPTOR_KR_KX_KX4) {
		if (!autoneg) {
			switch (hw->phy.link_mode) {
			case TXGBE_PHYSICAL_LAYER_10GBASE_KR:
				txgbe_set_link_to_kr(hw, autoneg);
				break;
			case TXGBE_PHYSICAL_LAYER_10GBASE_KX4:
				txgbe_set_link_to_kx4(hw, autoneg);
				break;
			case TXGBE_PHYSICAL_LAYER_1000BASE_KX:
				txgbe_set_link_to_kx(hw, speed, autoneg);
				break;
			default:
				return;
			}
		}
	} else if (hw->device_id == TXGBE_DEV_ID_RAPTOR_XAUI ||
		   hw->device_id == TXGBE_DEV_ID_RAPTOR_SGMII) {
		if (speed == TXGBE_LINK_SPEED_10GB_FULL) {
			txgbe_set_link_to_kx4(hw, autoneg);
		} else {
			txgbe_set_link_to_kx(hw, speed, 0);
			txgbe_set_sgmii_an37_ability(hw);
		}
	} else if (hw->device_id == TXGBE_DEV_ID_RAPTOR_SFP ||
		   hw->device_id == TXGBE_DEV_ID_WX1820_SFP) {
		txgbe_set_link_to_sfi(hw, speed);
	}

	if (speed == TXGBE_LINK_SPEED_10GB_FULL)
		mactxcfg = TXGBE_MACTXCFG_SPEED_10G;
	else if (speed == TXGBE_LINK_SPEED_1GB_FULL)
		mactxcfg = TXGBE_MACTXCFG_SPEED_1G;

	/* enable mac transmitter */
	wr32m(hw, TXGBE_MACTXCFG, TXGBE_MACTXCFG_SPEED_MASK, mactxcfg);
}
/**
 * txgbe_autoc_write - Hides MAC differences needed for AUTOC write
 * @hw: pointer to hardware structure
 * @autoc: value to write to AUTOC
 */
Hides MAC differences needed for AUTOC write
@hw: pointer to hardware structure
@autoc: value to write to AUTOC
Hides MAC differences needed for AUTOC write @hw : pointer to hardware structure @autoc : value to write to AUTOC
void txgbe_autoc_write(struct txgbe_hw *hw, u64 autoc)
{
	bool autoneg;
	u32 speed;
	u32 mactxcfg = 0;
	speed = TXGBE_AUTOC_SPEED(autoc);
	autoc &= ~TXGBE_AUTOC_SPEED_MASK;
	autoneg = (autoc & TXGBE_AUTOC_AUTONEG ? true : false);
	autoc &= ~TXGBE_AUTOC_AUTONEG;
	if (hw->device_id == TXGBE_DEV_ID_RAPTOR_KR_KX_KX4) {
		if (!autoneg) {
			switch (hw->phy.link_mode) {
			case TXGBE_PHYSICAL_LAYER_10GBASE_KR:
				txgbe_set_link_to_kr(hw, autoneg);
				break;
			case TXGBE_PHYSICAL_LAYER_10GBASE_KX4:
				txgbe_set_link_to_kx4(hw, autoneg);
				break;
			case TXGBE_PHYSICAL_LAYER_1000BASE_KX:
				txgbe_set_link_to_kx(hw, speed, autoneg);
				break;
			default:
				return;
			}
		}
	} else if (hw->device_id == TXGBE_DEV_ID_RAPTOR_XAUI ||
		   hw->device_id == TXGBE_DEV_ID_RAPTOR_SGMII) {
		if (speed == TXGBE_LINK_SPEED_10GB_FULL) {
			txgbe_set_link_to_kx4(hw, autoneg);
		} else {
			txgbe_set_link_to_kx(hw, speed, 0);
			txgbe_set_sgmii_an37_ability(hw);
		}
	} else if (hw->device_id == TXGBE_DEV_ID_RAPTOR_SFP ||
		   hw->device_id == TXGBE_DEV_ID_WX1820_SFP) {
		txgbe_set_link_to_sfi(hw, speed);
	}
	if (speed == TXGBE_LINK_SPEED_10GB_FULL)
		mactxcfg = TXGBE_MACTXCFG_SPEED_10G;
	else if (speed == TXGBE_LINK_SPEED_1GB_FULL)
		mactxcfg = TXGBE_MACTXCFG_SPEED_1G;
	wr32m(hw, TXGBE_MACTXCFG, TXGBE_MACTXCFG_SPEED_MASK, mactxcfg);
}
void txgbe_autoc_write ( struct txgbe_hw * hw , u64 autoc ) { bool autoneg ; u32 speed ; u32 mactxcfg = 0 ; speed = TXGBE_AUTOC_SPEED ( autoc ) ; autoc &= ~ TXGBE_AUTOC_SPEED_MASK ; autoneg = ( autoc & TXGBE_AUTOC_AUTONEG ? true : false ) ; autoc &= ~ TXGBE_AUTOC_AUTONEG ; if ( hw -> device_id == TXGBE_DEV_ID_RAPTOR_KR_KX_KX4 ) { if ( ! autoneg ) { switch ( hw -> phy . link_mode ) { case TXGBE_PHYSICAL_LAYER_10GBASE_KR : txgbe_set_link_to_kr ( hw , autoneg ) ; break ; case TXGBE_PHYSICAL_LAYER_10GBASE_KX4 : txgbe_set_link_to_kx4 ( hw , autoneg ) ; break ; case TXGBE_PHYSICAL_LAYER_1000BASE_KX : txgbe_set_link_to_kx ( hw , speed , autoneg ) ; break ; default : return ; } } } else if ( hw -> device_id == TXGBE_DEV_ID_RAPTOR_XAUI || hw -> device_id == TXGBE_DEV_ID_RAPTOR_SGMII ) { if ( speed == TXGBE_LINK_SPEED_10GB_FULL ) { txgbe_set_link_to_kx4 ( hw , autoneg ) ; } else { txgbe_set_link_to_kx ( hw , speed , 0 ) ; txgbe_set_sgmii_an37_ability ( hw ) ; } } else if ( hw -> device_id == TXGBE_DEV_ID_RAPTOR_SFP || hw -> device_id == TXGBE_DEV_ID_WX1820_SFP ) { txgbe_set_link_to_sfi ( hw , speed ) ; } if ( speed == TXGBE_LINK_SPEED_10GB_FULL ) mactxcfg = TXGBE_MACTXCFG_SPEED_10G ; else if ( speed == TXGBE_LINK_SPEED_1GB_FULL ) mactxcfg = TXGBE_MACTXCFG_SPEED_1G ; wr32m ( hw , TXGBE_MACTXCFG , TXGBE_MACTXCFG_SPEED_MASK , mactxcfg ) ; }
txgbe_autoc_write - Hides MAC differences needed for AUTOC write
 @hw: pointer to hardware structure
 @autoc: value to write to AUTOC
txgbe_autoc_write - Hides MAC differences needed for AUTOC write @hw : pointer to hardware structure @autoc : value to write to AUTOC
/* enable mac transmitter */