src/dpdk/drivers/net/ixgbe/base/ixgbe_82599.c
s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw)
{
	s32 err;
	int i;
	u32 fdirctrl = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
	u32 fdircmd;
	fdirctrl &= ~IXGBE_FDIRCTRL_INIT_DONE;

	DEBUGFUNC("ixgbe_reinit_fdir_tables_82599");

	/*
	 * Before starting reinitialization process,
	 * FDIRCMD.CMD must be zero.
	 */
	err = ixgbe_fdir_check_cmd_complete(hw, &fdircmd);
	if (err) {
		DEBUGOUT("Flow Director previous command did not complete, aborting table re-initialization.\n");
		return err;
	}

	IXGBE_WRITE_REG(hw, IXGBE_FDIRFREE, 0);
	IXGBE_WRITE_FLUSH(hw);
	/*
	 * 82599 adapters flow director init flow cannot be restarted,
	 * Workaround 82599 silicon errata by performing the following steps
	 * before re-writing the FDIRCTRL control register with the same value.
	 * - write 1 to bit 8 of FDIRCMD register &
	 * - write 0 to bit 8 of FDIRCMD register
	 */
	IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD,
			(IXGBE_READ_REG(hw, IXGBE_FDIRCMD) |
			 IXGBE_FDIRCMD_CLEARHT));
	IXGBE_WRITE_FLUSH(hw);
	IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD,
			(IXGBE_READ_REG(hw, IXGBE_FDIRCMD) &
			 ~IXGBE_FDIRCMD_CLEARHT));
	IXGBE_WRITE_FLUSH(hw);
	/*
	 * Clear FDIR Hash register to clear any leftover hashes
	 * waiting to be programmed.
	 */
	IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, 0x00);
	IXGBE_WRITE_FLUSH(hw);

	IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl);
	IXGBE_WRITE_FLUSH(hw);

	/* Poll init-done after we write FDIRCTRL register */
	for (i = 0; i < IXGBE_FDIR_INIT_DONE_POLL; i++) {
		if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) &
				   IXGBE_FDIRCTRL_INIT_DONE)
			break;
		msec_delay(1);
	}
	if (i >= IXGBE_FDIR_INIT_DONE_POLL) {
		DEBUGOUT("Flow Director Signature poll time exceeded!\n");
		return IXGBE_ERR_FDIR_REINIT_FAILED;
	}

	/* Clear FDIR statistics registers (read to clear) */
	IXGBE_READ_REG(hw, IXGBE_FDIRUSTAT);
	IXGBE_READ_REG(hw, IXGBE_FDIRFSTAT);
	IXGBE_READ_REG(hw, IXGBE_FDIRMATCH);
	IXGBE_READ_REG(hw, IXGBE_FDIRMISS);
	IXGBE_READ_REG(hw, IXGBE_FDIRLEN);

	return IXGBE_SUCCESS;
}
/**
 * ixgbe_reinit_fdir_tables_82599 - Reinitialize Flow Director tables.
 * @hw: pointer to hardware structure
 **/
Reinitialize Flow Director tables.
@hw: pointer to hardware structure
Reinitialize Flow Director tables . @hw : pointer to hardware structure
s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw)
{
	s32 err;
	int i;
	u32 fdirctrl = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
	u32 fdircmd;
	fdirctrl &= ~IXGBE_FDIRCTRL_INIT_DONE;
	DEBUGFUNC("ixgbe_reinit_fdir_tables_82599");
	err = ixgbe_fdir_check_cmd_complete(hw, &fdircmd);
	if (err) {
		DEBUGOUT("Flow Director previous command did not complete, aborting table re-initialization.\n");
		return err;
	}
	IXGBE_WRITE_REG(hw, IXGBE_FDIRFREE, 0);
	IXGBE_WRITE_FLUSH(hw);
	IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD,
			(IXGBE_READ_REG(hw, IXGBE_FDIRCMD) |
			 IXGBE_FDIRCMD_CLEARHT));
	IXGBE_WRITE_FLUSH(hw);
	IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD,
			(IXGBE_READ_REG(hw, IXGBE_FDIRCMD) &
			 ~IXGBE_FDIRCMD_CLEARHT));
	IXGBE_WRITE_FLUSH(hw);
	IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, 0x00);
	IXGBE_WRITE_FLUSH(hw);
	IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl);
	IXGBE_WRITE_FLUSH(hw);
	for (i = 0; i < IXGBE_FDIR_INIT_DONE_POLL; i++) {
		if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) &
				   IXGBE_FDIRCTRL_INIT_DONE)
			break;
		msec_delay(1);
	}
	if (i >= IXGBE_FDIR_INIT_DONE_POLL) {
		DEBUGOUT("Flow Director Signature poll time exceeded!\n");
		return IXGBE_ERR_FDIR_REINIT_FAILED;
	}
	IXGBE_READ_REG(hw, IXGBE_FDIRUSTAT);
	IXGBE_READ_REG(hw, IXGBE_FDIRFSTAT);
	IXGBE_READ_REG(hw, IXGBE_FDIRMATCH);
	IXGBE_READ_REG(hw, IXGBE_FDIRMISS);
	IXGBE_READ_REG(hw, IXGBE_FDIRLEN);
	return IXGBE_SUCCESS;
}
s32 ixgbe_reinit_fdir_tables_82599 ( struct ixgbe_hw * hw ) { s32 err ; int i ; u32 fdirctrl = IXGBE_READ_REG ( hw , IXGBE_FDIRCTRL ) ; u32 fdircmd ; fdirctrl &= ~ IXGBE_FDIRCTRL_INIT_DONE ; DEBUGFUNC ( " " ) ; err = ixgbe_fdir_check_cmd_complete ( hw , & fdircmd ) ; if ( err ) { DEBUGOUT ( " \n " ) ; return err ; } IXGBE_WRITE_REG ( hw , IXGBE_FDIRFREE , 0 ) ; IXGBE_WRITE_FLUSH ( hw ) ; IXGBE_WRITE_REG ( hw , IXGBE_FDIRCMD , ( IXGBE_READ_REG ( hw , IXGBE_FDIRCMD ) | IXGBE_FDIRCMD_CLEARHT ) ) ; IXGBE_WRITE_FLUSH ( hw ) ; IXGBE_WRITE_REG ( hw , IXGBE_FDIRCMD , ( IXGBE_READ_REG ( hw , IXGBE_FDIRCMD ) & ~ IXGBE_FDIRCMD_CLEARHT ) ) ; IXGBE_WRITE_FLUSH ( hw ) ; IXGBE_WRITE_REG ( hw , IXGBE_FDIRHASH , 0x00 ) ; IXGBE_WRITE_FLUSH ( hw ) ; IXGBE_WRITE_REG ( hw , IXGBE_FDIRCTRL , fdirctrl ) ; IXGBE_WRITE_FLUSH ( hw ) ; for ( i = 0 ; i < IXGBE_FDIR_INIT_DONE_POLL ; i ++ ) { if ( IXGBE_READ_REG ( hw , IXGBE_FDIRCTRL ) & IXGBE_FDIRCTRL_INIT_DONE ) break ; msec_delay ( 1 ) ; } if ( i >= IXGBE_FDIR_INIT_DONE_POLL ) { DEBUGOUT ( " \n " ) ; return IXGBE_ERR_FDIR_REINIT_FAILED ; } IXGBE_READ_REG ( hw , IXGBE_FDIRUSTAT ) ; IXGBE_READ_REG ( hw , IXGBE_FDIRFSTAT ) ; IXGBE_READ_REG ( hw , IXGBE_FDIRMATCH ) ; IXGBE_READ_REG ( hw , IXGBE_FDIRMISS ) ; IXGBE_READ_REG ( hw , IXGBE_FDIRLEN ) ; return IXGBE_SUCCESS ; }
ixgbe_reinit_fdir_tables_82599 - Reinitialize Flow Director tables.
ixgbe_reinit_fdir_tables_82599 - Reinitialize Flow Director tables .
/*
	 * Before starting reinitialization process,
	 * FDIRCMD.CMD must be zero.
	 */ /*
	 * 82599 adapters flow director init flow cannot be restarted,
	 * Workaround 82599 silicon errata by performing the following steps
	 * before re-writing the FDIRCTRL control register with the same value.
	 * - write 1 to bit 8 of FDIRCMD register &
	 * - write 0 to bit 8 of FDIRCMD register
	 */ /*
	 * Clear FDIR Hash register to clear any leftover hashes
	 * waiting to be programmed.
	 */ /* Poll init-done after we write FDIRCTRL register */ /* Clear FDIR statistics registers (read to clear) */