src/dpdk/drivers/net/ixgbe/base/ixgbe_x550.c
s32 ixgbe_setup_fc_X550em(struct ixgbe_hw *hw)
{
	s32 ret_val = IXGBE_SUCCESS;
	u32 pause, asm_dir, reg_val;

	DEBUGFUNC("ixgbe_setup_fc_X550em");

	/* Validate the requested mode */
	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
			"ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
		ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS;
		goto out;
	}

	/* 10gig parts do not have a word in the EEPROM to determine the
	 * default flow control setting, so we explicitly set it to full.
	 */
	if (hw->fc.requested_mode == ixgbe_fc_default)
		hw->fc.requested_mode = ixgbe_fc_full;

	/* Determine PAUSE and ASM_DIR bits. */
	switch (hw->fc.requested_mode) {
	case ixgbe_fc_none:
		pause = 0;
		asm_dir = 0;
		break;
	case ixgbe_fc_tx_pause:
		pause = 0;
		asm_dir = 1;
		break;
	case ixgbe_fc_rx_pause:
		/* Rx Flow control is enabled and Tx Flow control is
		 * disabled by software override. Since there really
		 * isn't a way to advertise that we are capable of RX
		 * Pause ONLY, we will advertise that we support both
		 * symmetric and asymmetric Rx PAUSE, as such we fall
		 * through to the fc_full statement.  Later, we will
		 * disable the adapter's ability to send PAUSE frames.
		 */
	case ixgbe_fc_full:
		pause = 1;
		asm_dir = 1;
		break;
	default:
		ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
			"Flow control param set incorrectly\n");
		ret_val = IXGBE_ERR_CONFIG;
		goto out;
	}

	switch (hw->device_id) {
	case IXGBE_DEV_ID_X550EM_X_KR:
	case IXGBE_DEV_ID_X550EM_A_KR:
	case IXGBE_DEV_ID_X550EM_A_KR_L:
		ret_val = hw->mac.ops.read_iosf_sb_reg(hw,
					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
		if (ret_val != IXGBE_SUCCESS)
			goto out;
		reg_val &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
			IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
		if (pause)
			reg_val |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE;
		if (asm_dir)
			reg_val |= IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
		ret_val = hw->mac.ops.write_iosf_sb_reg(hw,
					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);

		/* This device does not fully support AN. */
		hw->fc.disable_fc_autoneg = true;
		break;
	case IXGBE_DEV_ID_X550EM_X_XFI:
		hw->fc.disable_fc_autoneg = true;
		break;
	default:
		break;
	}

out:
	return ret_val;
}
/**
 * ixgbe_setup_fc_X550em - Set up flow control
 * @hw: pointer to hardware structure
 *
 * Called at init time to set up flow control.
 **/
Set up flow control
@hw: pointer to hardware structure

Called at init time to set up flow control.
Set up flow control @hw : pointer to hardware structure Called at init time to set up flow control .
s32 ixgbe_setup_fc_X550em(struct ixgbe_hw *hw)
{
	s32 ret_val = IXGBE_SUCCESS;
	u32 pause, asm_dir, reg_val;
	DEBUGFUNC("ixgbe_setup_fc_X550em");
	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
			"ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
		ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS;
		goto out;
	}
	if (hw->fc.requested_mode == ixgbe_fc_default)
		hw->fc.requested_mode = ixgbe_fc_full;
	switch (hw->fc.requested_mode) {
	case ixgbe_fc_none:
		pause = 0;
		asm_dir = 0;
		break;
	case ixgbe_fc_tx_pause:
		pause = 0;
		asm_dir = 1;
		break;
	case ixgbe_fc_rx_pause:
	case ixgbe_fc_full:
		pause = 1;
		asm_dir = 1;
		break;
	default:
		ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
			"Flow control param set incorrectly\n");
		ret_val = IXGBE_ERR_CONFIG;
		goto out;
	}
	switch (hw->device_id) {
	case IXGBE_DEV_ID_X550EM_X_KR:
	case IXGBE_DEV_ID_X550EM_A_KR:
	case IXGBE_DEV_ID_X550EM_A_KR_L:
		ret_val = hw->mac.ops.read_iosf_sb_reg(hw,
					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
		if (ret_val != IXGBE_SUCCESS)
			goto out;
		reg_val &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
			IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
		if (pause)
			reg_val |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE;
		if (asm_dir)
			reg_val |= IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
		ret_val = hw->mac.ops.write_iosf_sb_reg(hw,
					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
		hw->fc.disable_fc_autoneg = true;
		break;
	case IXGBE_DEV_ID_X550EM_X_XFI:
		hw->fc.disable_fc_autoneg = true;
		break;
	default:
		break;
	}
out:
	return ret_val;
}
s32 ixgbe_setup_fc_X550em ( struct ixgbe_hw * hw ) { s32 ret_val = IXGBE_SUCCESS ; u32 pause , asm_dir , reg_val ; DEBUGFUNC ( " " ) ; if ( hw -> fc . strict_ieee && hw -> fc . requested_mode == ixgbe_fc_rx_pause ) { ERROR_REPORT1 ( IXGBE_ERROR_UNSUPPORTED , " \n " ) ; ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS ; goto out ; } if ( hw -> fc . requested_mode == ixgbe_fc_default ) hw -> fc . requested_mode = ixgbe_fc_full ; switch ( hw -> fc . requested_mode ) { case ixgbe_fc_none : pause = 0 ; asm_dir = 0 ; break ; case ixgbe_fc_tx_pause : pause = 0 ; asm_dir = 1 ; break ; case ixgbe_fc_rx_pause : case ixgbe_fc_full : pause = 1 ; asm_dir = 1 ; break ; default : ERROR_REPORT1 ( IXGBE_ERROR_ARGUMENT , " \n " ) ; ret_val = IXGBE_ERR_CONFIG ; goto out ; } switch ( hw -> device_id ) { case IXGBE_DEV_ID_X550EM_X_KR : case IXGBE_DEV_ID_X550EM_A_KR : case IXGBE_DEV_ID_X550EM_A_KR_L : ret_val = hw -> mac . ops . read_iosf_sb_reg ( hw , IXGBE_KRM_AN_CNTL_1 ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , & reg_val ) ; if ( ret_val != IXGBE_SUCCESS ) goto out ; reg_val &= ~ ( IXGBE_KRM_AN_CNTL_1_SYM_PAUSE | IXGBE_KRM_AN_CNTL_1_ASM_PAUSE ) ; if ( pause ) reg_val |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE ; if ( asm_dir ) reg_val |= IXGBE_KRM_AN_CNTL_1_ASM_PAUSE ; ret_val = hw -> mac . ops . write_iosf_sb_reg ( hw , IXGBE_KRM_AN_CNTL_1 ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , reg_val ) ; hw -> fc . disable_fc_autoneg = true ; break ; case IXGBE_DEV_ID_X550EM_X_XFI : hw -> fc . disable_fc_autoneg = true ; break ; default : break ; } out : return ret_val ; }
ixgbe_setup_fc_X550em - Set up flow control
 @hw: pointer to hardware structure
ixgbe_setup_fc_X550em - Set up flow control @hw : pointer to hardware structure
/* Validate the requested mode */ /* 10gig parts do not have a word in the EEPROM to determine the
	 * default flow control setting, so we explicitly set it to full.
	 */ /* Determine PAUSE and ASM_DIR bits. */ /* Rx Flow control is enabled and Tx Flow control is
		 * disabled by software override. Since there really
		 * isn't a way to advertise that we are capable of RX
		 * Pause ONLY, we will advertise that we support both
		 * symmetric and asymmetric Rx PAUSE, as such we fall
		 * through to the fc_full statement.  Later, we will
		 * disable the adapter's ability to send PAUSE frames.
		 */ /* This device does not fully support AN. */