Esempio n. 1
0
/**
 * ixgbe_dcb_config_pfc_cee - Config priority flow control
 * @hw: pointer to hardware structure
 * @dcb_config: pointer to ixgbe_dcb_config structure
 *
 * Configure Priority Flow Control for each traffic class.
 */
s32 ixgbe_dcb_config_pfc_cee(struct ixgbe_hw *hw,
			 struct ixgbe_dcb_config *dcb_config)
{
	s32 ret = IXGBE_NOT_IMPLEMENTED;
	u8 pfc_en;
	u8 map[IXGBE_DCB_MAX_USER_PRIORITY] = { 0 };

	ixgbe_dcb_unpack_map_cee(dcb_config, IXGBE_DCB_TX_CONFIG, map);
	ixgbe_dcb_unpack_pfc_cee(dcb_config, map, &pfc_en);

	switch (hw->mac.type) {
	case ixgbe_mac_82598EB:
		ret = ixgbe_dcb_config_pfc_82598(hw, pfc_en);
		break;
	case ixgbe_mac_82599EB:
	case ixgbe_mac_X540:
	case ixgbe_mac_X550:
	case ixgbe_mac_X550EM_x:
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
		ret = ixgbe_dcb_config_pfc_82599(hw, pfc_en, map);
		break;
#endif
	default:
		break;
	}
	return ret;
}
s32 ixgbe_dcb_config_pfc(struct ixgbe_hw *hw,
                         struct ixgbe_dcb_config *dcb_config)
{
	s32 ret = 0;
	if (hw->mac.type == ixgbe_mac_82598EB)
		ret = ixgbe_dcb_config_pfc_82598(hw, dcb_config);
	else if (hw->mac.type == ixgbe_mac_82599EB)
		ret = ixgbe_dcb_config_pfc_82599(hw, dcb_config);
	return ret;
}
Esempio n. 3
0
/**
 * ixgbe_dcb_hw_config_82599 - Configure and enable DCB
 * @hw: pointer to hardware structure
 * @dcb_config: pointer to ixgbe_dcb_config structure
 *
 * Configure dcb settings and enable dcb mode.
 */
s32 ixgbe_dcb_hw_config_82599(struct ixgbe_hw *hw,
                              struct ixgbe_dcb_config *dcb_config)
{
	ixgbe_dcb_config_packet_buffers_82599(hw, dcb_config);
	ixgbe_dcb_config_82599(hw);
	ixgbe_dcb_config_rx_arbiter_82599(hw, dcb_config);
	ixgbe_dcb_config_tx_desc_arbiter_82599(hw, dcb_config);
	ixgbe_dcb_config_tx_data_arbiter_82599(hw, dcb_config);
	ixgbe_dcb_config_pfc_82599(hw, dcb_config);
	ixgbe_dcb_config_tc_stats_82599(hw);

	return 0;
}
/**
 * ixgbe_dcb_hw_config_82599 - Configure and enable DCB
 * @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
 * @pfc_en: enabled pfc bitmask
 *
 * Configure dcb settings and enable dcb mode.
 */
s32 ixgbe_dcb_hw_config_82599(struct ixgbe_hw *hw, u8 pfc_en, u16 *refill,
                              u16 *max, u8 *bwg_id, u8 *prio_type, u8 *prio_tc)
{
    ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max, bwg_id,
                                      prio_type, prio_tc);
    ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max,
                                           bwg_id, prio_type);
    ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max,
                                           bwg_id, prio_type, prio_tc);
    ixgbe_dcb_config_pfc_82599(hw, pfc_en, prio_tc);
    ixgbe_dcb_config_tc_stats_82599(hw);

    return 0;
}
Esempio n. 5
0
/**
 * ixgbe_dcb_hw_config_82599 - Configure and enable DCB
 * @hw: pointer to hardware structure
 * @dcb_config: pointer to ixgbe_dcb_config structure
 *
 * Configure dcb settings and enable dcb mode.
 */
s32 ixgbe_dcb_hw_config_82599(struct ixgbe_hw *hw, int link_speed, u8 pfc_en,
			      u16 *refill, u16 *max, u8 *bwg_id, u8 *tsa,
			      u8 *map)
{

	ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max, bwg_id, tsa,
					  map);
	ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max, bwg_id,
					       tsa);
	ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max, bwg_id,
					       tsa, map);
	ixgbe_dcb_config_pfc_82599(hw, pfc_en, map);


	return 0;
}
Esempio n. 6
0
/* Helper routines to abstract HW specifics from DCB netlink ops */
s32 ixgbe_dcb_config_pfc(struct ixgbe_hw *hw, u8 pfc_en, u8 *map)
{
	int ret = IXGBE_ERR_PARAM;

	switch (hw->mac.type) {
	case ixgbe_mac_82598EB:
		ret = ixgbe_dcb_config_pfc_82598(hw, pfc_en);
		break;
	case ixgbe_mac_82599EB:
	case ixgbe_mac_X540:
		ret = ixgbe_dcb_config_pfc_82599(hw, pfc_en, map);
		break;
	default:
		break;
	}
	return ret;
}
/* Helper routines to abstract HW specifics from DCB netlink ops */
s32 ixgbe_dcb_hw_pfc_config(struct ixgbe_hw *hw, u8 pfc_en, u8 *prio_tc)
{
	int ret = -EINVAL;

	switch (hw->mac.type) {
	case ixgbe_mac_82598EB:
		ret = ixgbe_dcb_config_pfc_82598(hw, pfc_en);
		break;
	case ixgbe_mac_82599EB:
	case ixgbe_mac_X540:
		ret = ixgbe_dcb_config_pfc_82599(hw, pfc_en, prio_tc);
		break;
	default:
		break;
	}
	return ret;
}
Esempio n. 8
0
/* Helper routines to abstract HW specifics from DCB netlink ops */
s32 ixgbe_dcb_config_pfc(struct ixgbe_hw *hw, u8 pfc_en, u8 *map)
{
	int ret = IXGBE_ERR_PARAM;

	switch (hw->mac.type) {
	case ixgbe_mac_82598EB:
		ret = ixgbe_dcb_config_pfc_82598(hw, pfc_en);
		break;
	case ixgbe_mac_82599EB:
	case ixgbe_mac_X540:
	case ixgbe_mac_X550:
	case ixgbe_mac_X550EM_x:
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
		ret = ixgbe_dcb_config_pfc_82599(hw, pfc_en, map);
		break;
#endif
	default:
		break;
	}
	return ret;
}
Esempio n. 9
0
static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
{
	struct ixgbe_adapter *adapter = netdev_priv(netdev);
	int ret;

	if (!adapter->dcb_set_bitmap)
		return DCB_NO_HW_CHG;

	
	if (adapter->dcb_set_bitmap & BIT_RESETLINK) {
		while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state))
			msleep(1);

		if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) {
			if (netif_running(netdev))
				netdev->netdev_ops->ndo_stop(netdev);
			ixgbe_clear_interrupt_scheme(adapter);
		} else {
			if (netif_running(netdev))
				ixgbe_down(adapter);
		}
	}

	ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg,
				 adapter->ring_feature[RING_F_DCB].indices);
	if (ret) {
		if (adapter->dcb_set_bitmap & BIT_RESETLINK)
			clear_bit(__IXGBE_RESETTING, &adapter->state);
		return DCB_NO_HW_CHG;
	}

	if (adapter->dcb_cfg.pfc_mode_enable) {
		if ((adapter->hw.mac.type != ixgbe_mac_82598EB) &&
			(adapter->hw.fc.current_mode != ixgbe_fc_pfc))
			adapter->last_lfc_mode = adapter->hw.fc.current_mode;
		adapter->hw.fc.requested_mode = ixgbe_fc_pfc;
	} else {
		if (adapter->hw.mac.type != ixgbe_mac_82598EB)
			adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
		else
			adapter->hw.fc.requested_mode = ixgbe_fc_none;
	}

	if (adapter->dcb_set_bitmap & BIT_RESETLINK) {
		if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) {
			ixgbe_init_interrupt_scheme(adapter);
			if (netif_running(netdev))
				netdev->netdev_ops->ndo_open(netdev);
		} else {
			if (netif_running(netdev))
				ixgbe_up(adapter);
		}
		ret = DCB_HW_CHG_RST;
	} else if (adapter->dcb_set_bitmap & BIT_PFC) {
		if (adapter->hw.mac.type == ixgbe_mac_82598EB)
			ixgbe_dcb_config_pfc_82598(&adapter->hw,
			                           &adapter->dcb_cfg);
		else if (adapter->hw.mac.type == ixgbe_mac_82599EB)
			ixgbe_dcb_config_pfc_82599(&adapter->hw,
			                           &adapter->dcb_cfg);
		ret = DCB_HW_CHG;
	}
	if (adapter->dcb_cfg.pfc_mode_enable)
		adapter->hw.fc.current_mode = ixgbe_fc_pfc;

	if (adapter->dcb_set_bitmap & BIT_RESETLINK)
		clear_bit(__IXGBE_RESETTING, &adapter->state);
	adapter->dcb_set_bitmap = 0x00;
	return ret;
}
Esempio n. 10
0
static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
{
	struct ixgbe_adapter *adapter = netdev_priv(netdev);
	bool do_reset;
	int ret;

	if (!adapter->dcb_set_bitmap)
		return DCB_NO_HW_CHG;

	ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg,
				 adapter->ring_feature[RING_F_DCB].indices);
	if (ret)
		return DCB_NO_HW_CHG;

	/* Only take down the adapter if the configuration change
	 * requires a reset.
	*/
	do_reset = adapter->dcb_set_bitmap & (BIT_RESETLINK | BIT_APP_UPCHG);

	if (do_reset) {
		while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state))
			msleep(1);

		if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) {
			if (netif_running(netdev))
#ifdef HAVE_NET_DEVICE_OPS
				netdev->netdev_ops->ndo_stop(netdev);
#else
				netdev->stop(netdev);
#endif
			ixgbe_clear_interrupt_scheme(adapter);
		} else {
			if (netif_running(netdev))
				ixgbe_down(adapter);
		}
	}

	if (adapter->dcb_cfg.pfc_mode_enable) {
		switch (adapter->hw.mac.type) {
		case ixgbe_mac_82599EB:
		case ixgbe_mac_X540:
			if (adapter->hw.fc.current_mode != ixgbe_fc_pfc)
				adapter->last_lfc_mode = adapter->hw.fc.current_mode;
			break;
		default:
			break;
		}
		adapter->hw.fc.requested_mode = ixgbe_fc_pfc;
	} else {
		switch (adapter->hw.mac.type) {
		case ixgbe_mac_82598EB:
			adapter->hw.fc.requested_mode = ixgbe_fc_none;
			break;
		case ixgbe_mac_82599EB:
		case ixgbe_mac_X540:
			adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
			break;
		default:
			break;
		}
	}

	if (do_reset) {
		if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) {
			ixgbe_init_interrupt_scheme(adapter);
			if (netif_running(netdev))
#ifdef HAVE_NET_DEVICE_OPS
				netdev->netdev_ops->ndo_open(netdev);
#else
				netdev->open(netdev);
#endif
		} else {
			if (netif_running(netdev))
				ixgbe_up(adapter);
		}
		ret = DCB_HW_CHG_RST;
	} else if (adapter->dcb_set_bitmap & BIT_PFC) {
		if (adapter->hw.mac.type == ixgbe_mac_82598EB)
			ixgbe_dcb_config_pfc_82598(&adapter->hw,
				&adapter->dcb_cfg);
		else if (adapter->hw.mac.type == ixgbe_mac_82599EB)
			ixgbe_dcb_config_pfc_82599(&adapter->hw,
				&adapter->dcb_cfg);
		ret = DCB_HW_CHG;
	}
	if (adapter->dcb_cfg.pfc_mode_enable)
		adapter->hw.fc.current_mode = ixgbe_fc_pfc;

	if (do_reset)
		clear_bit(__IXGBE_RESETTING, &adapter->state);
	adapter->dcb_set_bitmap = 0x00;
	return ret;
}