src/dpdk/drivers/net/ixgbe/base/ixgbe_82599.c
s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw)
{
	s32 ret_val;
	u32 anlp1_reg = 0;
	u32 i, autoc_reg, autoc2_reg;

	/* Enable link if disabled in NVM */
	autoc2_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
	if (autoc2_reg & IXGBE_AUTOC2_LINK_DISABLE_MASK) {
		autoc2_reg &= ~IXGBE_AUTOC2_LINK_DISABLE_MASK;
		IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2_reg);
		IXGBE_WRITE_FLUSH(hw);
	}

	autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
	autoc_reg |= IXGBE_AUTOC_AN_RESTART;
	/* Write AUTOC register with toggled LMS[2] bit and Restart_AN */
	IXGBE_WRITE_REG(hw, IXGBE_AUTOC,
			autoc_reg ^ (0x4 << IXGBE_AUTOC_LMS_SHIFT));
	/* Wait for AN to leave state 0 */
	for (i = 0; i < 10; i++) {
		msec_delay(4);
		anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1);
		if (anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK)
			break;
	}

	if (!(anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK)) {
		DEBUGOUT("auto negotiation not completed\n");
		ret_val = IXGBE_ERR_RESET_FAILED;
		goto reset_pipeline_out;
	}

	ret_val = IXGBE_SUCCESS;

reset_pipeline_out:
	/* Write AUTOC register with original LMS field and Restart_AN */
	IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
	IXGBE_WRITE_FLUSH(hw);

	return ret_val;
}
/**
 * ixgbe_reset_pipeline_82599 - perform pipeline reset
 *
 * @hw: pointer to hardware structure
 *
 * Reset pipeline by asserting Restart_AN together with LMS change to ensure
 * full pipeline reset.  This function assumes the SW/FW lock is held.
 **/
perform pipeline reset
@hw: pointer to hardware structure

Reset pipeline by asserting Restart_AN together with LMS change to ensure
full pipeline reset.  This function assumes the SW/FW lock is held.
perform pipeline reset @hw : pointer to hardware structure Reset pipeline by asserting Restart_AN together with LMS change to ensure full pipeline reset . This function assumes the SW / FW lock is held .
s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw)
{
	s32 ret_val;
	u32 anlp1_reg = 0;
	u32 i, autoc_reg, autoc2_reg;
	autoc2_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
	if (autoc2_reg & IXGBE_AUTOC2_LINK_DISABLE_MASK) {
		autoc2_reg &= ~IXGBE_AUTOC2_LINK_DISABLE_MASK;
		IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2_reg);
		IXGBE_WRITE_FLUSH(hw);
	}
	autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
	autoc_reg |= IXGBE_AUTOC_AN_RESTART;
	IXGBE_WRITE_REG(hw, IXGBE_AUTOC,
			autoc_reg ^ (0x4 << IXGBE_AUTOC_LMS_SHIFT));
	for (i = 0; i < 10; i++) {
		msec_delay(4);
		anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1);
		if (anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK)
			break;
	}
	if (!(anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK)) {
		DEBUGOUT("auto negotiation not completed\n");
		ret_val = IXGBE_ERR_RESET_FAILED;
		goto reset_pipeline_out;
	}
	ret_val = IXGBE_SUCCESS;
reset_pipeline_out:
	IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
	IXGBE_WRITE_FLUSH(hw);
	return ret_val;
}
s32 ixgbe_reset_pipeline_82599 ( struct ixgbe_hw * hw ) { s32 ret_val ; u32 anlp1_reg = 0 ; u32 i , autoc_reg , autoc2_reg ; autoc2_reg = IXGBE_READ_REG ( hw , IXGBE_AUTOC2 ) ; if ( autoc2_reg & IXGBE_AUTOC2_LINK_DISABLE_MASK ) { autoc2_reg &= ~ IXGBE_AUTOC2_LINK_DISABLE_MASK ; IXGBE_WRITE_REG ( hw , IXGBE_AUTOC2 , autoc2_reg ) ; IXGBE_WRITE_FLUSH ( hw ) ; } autoc_reg = IXGBE_READ_REG ( hw , IXGBE_AUTOC ) ; autoc_reg |= IXGBE_AUTOC_AN_RESTART ; IXGBE_WRITE_REG ( hw , IXGBE_AUTOC , autoc_reg ^ ( 0x4 << IXGBE_AUTOC_LMS_SHIFT ) ) ; for ( i = 0 ; i < 10 ; i ++ ) { msec_delay ( 4 ) ; anlp1_reg = IXGBE_READ_REG ( hw , IXGBE_ANLP1 ) ; if ( anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK ) break ; } if ( ! ( anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK ) ) { DEBUGOUT ( " \n " ) ; ret_val = IXGBE_ERR_RESET_FAILED ; goto reset_pipeline_out ; } ret_val = IXGBE_SUCCESS ; reset_pipeline_out : IXGBE_WRITE_REG ( hw , IXGBE_AUTOC , autoc_reg ) ; IXGBE_WRITE_FLUSH ( hw ) ; return ret_val ; }
ixgbe_reset_pipeline_82599 - perform pipeline reset
 @hw: pointer to hardware structure
ixgbe_reset_pipeline_82599 - perform pipeline reset @hw : pointer to hardware structure
/* Enable link if disabled in NVM */ /* Write AUTOC register with toggled LMS[2] bit and Restart_AN */ /* Wait for AN to leave state 0 */ /* Write AUTOC register with original LMS field and Restart_AN */