예제 #1
0
/**
 * ixgbe_dcb_config_tx_desc_arbiter_82599 - Config Tx Desc. arbiter
 * @hw: pointer to hardware structure
 * @dcb_config: pointer to ixgbe_dcb_config structure
 *
 * Configure Tx Descriptor Arbiter and credits for each traffic class.
 */
s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *hw,
                                           struct ixgbe_dcb_config *dcb_config)
{
	struct tc_bw_alloc *p;
	u32    reg, max_credits;
	u8     i;

	/* Disable the arbiter before changing parameters */
	IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, IXGBE_RTTDCS_ARBDIS);

	/* Clear the per-Tx queue credits; we use per-TC instead */
	for (i = 0; i < 128; i++) {
		IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, i);
		IXGBE_WRITE_REG(hw, IXGBE_RTTDT1C, 0);
	}

	/* Configure traffic class credits and priority */
	for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
		p = &dcb_config->tc_config[i].path[DCB_TX_CONFIG];
		max_credits = dcb_config->tc_config[i].desc_credits_max;
		reg = max_credits << IXGBE_RTTDT2C_MCL_SHIFT;
		reg |= p->data_credits_refill;
		reg |= (u32)(p->bwg_id) << IXGBE_RTTDT2C_BWG_SHIFT;

		if (p->prio_type == prio_group)
			reg |= IXGBE_RTTDT2C_GSP;

		if (p->prio_type == prio_link)
			reg |= IXGBE_RTTDT2C_LSP;

		IXGBE_WRITE_REG(hw, IXGBE_RTTDT2C(i), reg);
	}

	/*
	 * Configure Tx descriptor plane (recycle mode; WSP) and
	 * enable arbiter
	 */
	reg = IXGBE_RTTDCS_TDPAC | IXGBE_RTTDCS_TDRM;
	IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, reg);

	return 0;
}
/**
 * ixgbe_dcb_config_tx_desc_arbiter_82599 - Config Tx Desc. arbiter
 * @hw: pointer to hardware structure
 * @refill: refill credits index by traffic class
 * @max: max credits index by traffic class
 * @bwg_id: bandwidth grouping indexed by traffic class
 * @prio_type: priority type indexed by traffic class
 *
 * Configure Tx Descriptor Arbiter and credits for each traffic class.
 */
s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *hw,
        u16 *refill,
        u16 *max,
        u8 *bwg_id,
        u8 *prio_type)
{
    u32    reg, max_credits;
    u8     i;

    /* Clear the per-Tx queue credits; we use per-TC instead */
    for (i = 0; i < 128; i++) {
        IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, i);
        IXGBE_WRITE_REG(hw, IXGBE_RTTDT1C, 0);
    }

    /* Configure traffic class credits and priority */
    for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
        max_credits = max[i];
        reg = max_credits << IXGBE_RTTDT2C_MCL_SHIFT;
        reg |= refill[i];
        reg |= (u32)(bwg_id[i]) << IXGBE_RTTDT2C_BWG_SHIFT;

        if (prio_type[i] == prio_group)
            reg |= IXGBE_RTTDT2C_GSP;

        if (prio_type[i] == prio_link)
            reg |= IXGBE_RTTDT2C_LSP;

        IXGBE_WRITE_REG(hw, IXGBE_RTTDT2C(i), reg);
    }

    /*
     * Configure Tx descriptor plane (recycle mode; WSP) and
     * enable arbiter
     */
    reg = IXGBE_RTTDCS_TDPAC | IXGBE_RTTDCS_TDRM;
    IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, reg);

    return 0;
}