src/dpdk/drivers/net/ixgbe/base/ixgbe_x550.c
s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
{
	s32 status = IXGBE_SUCCESS;
	u32 an_cntl = 0;

	DEBUGFUNC("ixgbe_setup_fc_backplane_x550em_a");

	/* 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");
		return IXGBE_ERR_INVALID_LINK_SETTINGS;
	}

	if (hw->fc.requested_mode == ixgbe_fc_default)
		hw->fc.requested_mode = ixgbe_fc_full;

	/* Set up the 1G and 10G flow control advertisement registers so the
	 * HW will be able to do FC autoneg once the cable is plugged in.  If
	 * we link at 10G, the 1G advertisement is harmless and vice versa.
	 */
	status = hw->mac.ops.read_iosf_sb_reg(hw,
					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl);

	if (status != IXGBE_SUCCESS) {
		DEBUGOUT("Auto-Negotiation did not complete\n");
		return status;
	}

	/* The possible values of fc.requested_mode are:
	 * 0: Flow control is completely disabled
	 * 1: Rx flow control is enabled (we can receive pause frames,
	 *    but not send pause frames).
	 * 2: Tx flow control is enabled (we can send pause frames but
	 *    we do not support receiving pause frames).
	 * 3: Both Rx and Tx flow control (symmetric) are enabled.
	 * other: Invalid.
	 */
	switch (hw->fc.requested_mode) {
	case ixgbe_fc_none:
		/* Flow control completely disabled by software override. */
		an_cntl &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
			     IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
		break;
	case ixgbe_fc_tx_pause:
		/* Tx Flow control is enabled, and Rx Flow control is
		 * disabled by software override.
		 */
		an_cntl |= IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
		an_cntl &= ~IXGBE_KRM_AN_CNTL_1_SYM_PAUSE;
		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:
		/* Flow control (both Rx and Tx) is enabled by SW override. */
		an_cntl |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
			   IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
		break;
	default:
		ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
			      "Flow control param set incorrectly\n");
		return IXGBE_ERR_CONFIG;
	}

	status = hw->mac.ops.write_iosf_sb_reg(hw,
					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl);

	/* Restart auto-negotiation. */
	status = ixgbe_restart_an_internal_phy_x550em(hw);

	return status;
}
/**
 * ixgbe_setup_fc_backplane_x550em_a - 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_backplane_x550em_a(struct ixgbe_hw *hw)
{
	s32 status = IXGBE_SUCCESS;
	u32 an_cntl = 0;
	DEBUGFUNC("ixgbe_setup_fc_backplane_x550em_a");
	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");
		return IXGBE_ERR_INVALID_LINK_SETTINGS;
	}
	if (hw->fc.requested_mode == ixgbe_fc_default)
		hw->fc.requested_mode = ixgbe_fc_full;
	status = hw->mac.ops.read_iosf_sb_reg(hw,
					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl);
	if (status != IXGBE_SUCCESS) {
		DEBUGOUT("Auto-Negotiation did not complete\n");
		return status;
	}
	switch (hw->fc.requested_mode) {
	case ixgbe_fc_none:
		an_cntl &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
			     IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
		break;
	case ixgbe_fc_tx_pause:
		an_cntl |= IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
		an_cntl &= ~IXGBE_KRM_AN_CNTL_1_SYM_PAUSE;
		break;
	case ixgbe_fc_rx_pause:
	case ixgbe_fc_full:
		an_cntl |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
			   IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
		break;
	default:
		ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
			      "Flow control param set incorrectly\n");
		return IXGBE_ERR_CONFIG;
	}
	status = hw->mac.ops.write_iosf_sb_reg(hw,
					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl);
	status = ixgbe_restart_an_internal_phy_x550em(hw);
	return status;
}
s32 ixgbe_setup_fc_backplane_x550em_a ( struct ixgbe_hw * hw ) { s32 status = IXGBE_SUCCESS ; u32 an_cntl = 0 ; DEBUGFUNC ( " " ) ; if ( hw -> fc . strict_ieee && hw -> fc . requested_mode == ixgbe_fc_rx_pause ) { ERROR_REPORT1 ( IXGBE_ERROR_UNSUPPORTED , " \n " ) ; return IXGBE_ERR_INVALID_LINK_SETTINGS ; } if ( hw -> fc . requested_mode == ixgbe_fc_default ) hw -> fc . requested_mode = ixgbe_fc_full ; status = hw -> mac . ops . read_iosf_sb_reg ( hw , IXGBE_KRM_AN_CNTL_1 ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , & an_cntl ) ; if ( status != IXGBE_SUCCESS ) { DEBUGOUT ( " \n " ) ; return status ; } switch ( hw -> fc . requested_mode ) { case ixgbe_fc_none : an_cntl &= ~ ( IXGBE_KRM_AN_CNTL_1_SYM_PAUSE | IXGBE_KRM_AN_CNTL_1_ASM_PAUSE ) ; break ; case ixgbe_fc_tx_pause : an_cntl |= IXGBE_KRM_AN_CNTL_1_ASM_PAUSE ; an_cntl &= ~ IXGBE_KRM_AN_CNTL_1_SYM_PAUSE ; break ; case ixgbe_fc_rx_pause : case ixgbe_fc_full : an_cntl |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE | IXGBE_KRM_AN_CNTL_1_ASM_PAUSE ; break ; default : ERROR_REPORT1 ( IXGBE_ERROR_ARGUMENT , " \n " ) ; return IXGBE_ERR_CONFIG ; } status = hw -> mac . ops . write_iosf_sb_reg ( hw , IXGBE_KRM_AN_CNTL_1 ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , an_cntl ) ; status = ixgbe_restart_an_internal_phy_x550em ( hw ) ; return status ; }
ixgbe_setup_fc_backplane_x550em_a - Set up flow control
 @hw: pointer to hardware structure
ixgbe_setup_fc_backplane_x550em_a - Set up flow control @hw : pointer to hardware structure
/* Validate the requested mode */ /* Set up the 1G and 10G flow control advertisement registers so the
	 * HW will be able to do FC autoneg once the cable is plugged in.  If
	 * we link at 10G, the 1G advertisement is harmless and vice versa.
	 */ /* The possible values of fc.requested_mode are:
	 * 0: Flow control is completely disabled
	 * 1: Rx flow control is enabled (we can receive pause frames,
	 *    but not send pause frames).
	 * 2: Tx flow control is enabled (we can send pause frames but
	 *    we do not support receiving pause frames).
	 * 3: Both Rx and Tx flow control (symmetric) are enabled.
	 * other: Invalid.
	 */ /* Flow control completely disabled by software override. */ /* Tx Flow control is enabled, and Rx Flow control is
		 * disabled by software override.
		 */ /* 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.
		 */ /* Flow control (both Rx and Tx) is enabled by SW override. */ /* Restart auto-negotiation. */