Example #1
0
static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
{
	u8 err = 0;
	struct ixgbe_adapter *adapter = netdev_priv(netdev);

	if (state > 0) {
		
		if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
			goto out;

		if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
			DPRINTK(DRV, ERR, "Enable failed, needs MSI-X\n");
			err = 1;
			goto out;
		}

		if (netif_running(netdev))
			netdev->netdev_ops->ndo_stop(netdev);
		ixgbe_clear_interrupt_scheme(adapter);

		if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
			adapter->last_lfc_mode = adapter->hw.fc.current_mode;
			adapter->hw.fc.requested_mode = ixgbe_fc_none;
		}
		adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED;
		if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
			adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
			adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
		}
		adapter->flags |= IXGBE_FLAG_DCB_ENABLED;
		ixgbe_init_interrupt_scheme(adapter);
		if (netif_running(netdev))
			netdev->netdev_ops->ndo_open(netdev);
	} else {
		
		if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
			if (netif_running(netdev))
				netdev->netdev_ops->ndo_stop(netdev);
			ixgbe_clear_interrupt_scheme(adapter);

			adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
			adapter->temp_dcb_cfg.pfc_mode_enable = false;
			adapter->dcb_cfg.pfc_mode_enable = false;
			adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
			adapter->flags |= IXGBE_FLAG_RSS_ENABLED;
			if (adapter->hw.mac.type == ixgbe_mac_82599EB)
				adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;

			ixgbe_init_interrupt_scheme(adapter);
			if (netif_running(netdev))
				netdev->netdev_ops->ndo_open(netdev);
		}
	}
out:
	return err;
}
Example #2
0
static void ixgbe_dcbnl_devreset(struct net_device *dev)
{
	struct ixgbe_adapter *adapter = netdev_priv(dev);

	while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state))
		usleep_range(1000, 2000);

	if (netif_running(dev))
#ifdef HAVE_NET_DEVICE_OPS
		dev->netdev_ops->ndo_stop(dev);
#else
		dev->stop(dev);
#endif

	ixgbe_clear_interrupt_scheme(adapter);
	ixgbe_init_interrupt_scheme(adapter);

	if (netif_running(dev))
#ifdef HAVE_NET_DEVICE_OPS
		dev->netdev_ops->ndo_open(dev);
#else
		dev->open(dev);
#endif

	clear_bit(__IXGBE_RESETTING, &adapter->state);
}
Example #3
0
static void ixgbe_dcbnl_devreset(struct net_device *dev)
{
	struct ixgbe_adapter *adapter = netdev_priv(dev);

	if (netif_running(dev))
		dev->netdev_ops->ndo_stop(dev);

	ixgbe_clear_interrupt_scheme(adapter);
	ixgbe_init_interrupt_scheme(adapter);

	if (netif_running(dev))
		dev->netdev_ops->ndo_open(dev);
}
Example #4
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;
}
static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
{
	struct ixgbe_adapter *adapter = netdev_priv(netdev);
	int ret;

	if (!adapter->dcb_set_bitmap ||
	    !(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
		return DCB_NO_HW_CHG;

	ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg,
				 MAX_TRAFFIC_CLASS);

	if (ret)
		return DCB_NO_HW_CHG;

	/*
	 * Only take down the adapter if an app change occurred. FCoE
	 * may shuffle tx rings in this case and this can not be done
	 * without a reset currently.
	 */
	if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) {
		while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state))
			msleep(1);

		if (netif_running(netdev))
			netdev->netdev_ops->ndo_stop(netdev);
		ixgbe_clear_interrupt_scheme(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 (adapter->dcb_set_bitmap & BIT_APP_UPCHG) {
		ixgbe_init_interrupt_scheme(adapter);
		if (netif_running(netdev))
			netdev->netdev_ops->ndo_open(netdev);
		ret = DCB_HW_CHG_RST;
	}

	if (adapter->dcb_set_bitmap & BIT_PFC) {
		u8 pfc_en;
		ixgbe_dcb_unpack_pfc(&adapter->dcb_cfg, &pfc_en);
		ixgbe_dcb_hw_pfc_config(&adapter->hw, pfc_en);
		ret = DCB_HW_CHG;
	}

	if (adapter->dcb_set_bitmap & (BIT_PG_TX|BIT_PG_RX)) {
		u16 refill[MAX_TRAFFIC_CLASS], max[MAX_TRAFFIC_CLASS];
		u8 bwg_id[MAX_TRAFFIC_CLASS], prio_type[MAX_TRAFFIC_CLASS];
		/* Priority to TC mapping in CEE case default to 1:1 */
		u8 prio_tc[MAX_TRAFFIC_CLASS] = {0, 1, 2, 3, 4, 5, 6, 7};
		int max_frame = adapter->netdev->mtu + ETH_HLEN + ETH_FCS_LEN;

#ifdef CONFIG_FCOE
		if (adapter->netdev->features & NETIF_F_FCOE_MTU)
			max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
#endif

		ixgbe_dcb_calculate_tc_credits(&adapter->hw, &adapter->dcb_cfg,
					       max_frame, DCB_TX_CONFIG);
		ixgbe_dcb_calculate_tc_credits(&adapter->hw, &adapter->dcb_cfg,
					       max_frame, DCB_RX_CONFIG);

		ixgbe_dcb_unpack_refill(&adapter->dcb_cfg,
					DCB_TX_CONFIG, refill);
		ixgbe_dcb_unpack_max(&adapter->dcb_cfg, max);
		ixgbe_dcb_unpack_bwgid(&adapter->dcb_cfg,
				       DCB_TX_CONFIG, bwg_id);
		ixgbe_dcb_unpack_prio(&adapter->dcb_cfg,
				      DCB_TX_CONFIG, prio_type);

		ixgbe_dcb_hw_ets_config(&adapter->hw, refill, max,
					bwg_id, prio_type, prio_tc);
	}

	if (adapter->dcb_cfg.pfc_mode_enable)
		adapter->hw.fc.current_mode = ixgbe_fc_pfc;

	if (adapter->dcb_set_bitmap & BIT_APP_UPCHG)
		clear_bit(__IXGBE_RESETTING, &adapter->state);
	adapter->dcb_set_bitmap = 0x00;
	return ret;
}
static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
{
	u8 err = 0;
	struct ixgbe_adapter *adapter = netdev_priv(netdev);

	if (state > 0) {
		/* Turn on DCB */
		if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
			goto out;

		if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
			e_err(drv, "Enable failed, needs MSI-X\n");
			err = 1;
			goto out;
		}

		if (netif_running(netdev))
			netdev->netdev_ops->ndo_stop(netdev);
		ixgbe_clear_interrupt_scheme(adapter);

		switch (adapter->hw.mac.type) {
		case ixgbe_mac_82598EB:
			adapter->last_lfc_mode = adapter->hw.fc.current_mode;
			adapter->hw.fc.requested_mode = ixgbe_fc_none;
			break;
		case ixgbe_mac_82599EB:
		case ixgbe_mac_X540:
			adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
			adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
			break;
		default:
			break;
		}

		adapter->flags |= IXGBE_FLAG_DCB_ENABLED;
		if (!netdev_get_num_tc(netdev))
			ixgbe_setup_tc(netdev, MAX_TRAFFIC_CLASS);

		ixgbe_init_interrupt_scheme(adapter);
		if (netif_running(netdev))
			netdev->netdev_ops->ndo_open(netdev);
	} else {
		/* Turn off DCB */
		if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
			if (netif_running(netdev))
				netdev->netdev_ops->ndo_stop(netdev);
			ixgbe_clear_interrupt_scheme(adapter);

			adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
			adapter->temp_dcb_cfg.pfc_mode_enable = false;
			adapter->dcb_cfg.pfc_mode_enable = false;
			adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
			switch (adapter->hw.mac.type) {
			case ixgbe_mac_82599EB:
			case ixgbe_mac_X540:
				adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
				break;
			default:
				break;
			}

			ixgbe_setup_tc(netdev, 0);

			ixgbe_init_interrupt_scheme(adapter);
			if (netif_running(netdev))
				netdev->netdev_ops->ndo_open(netdev);
		}
	}
out:
	return err;
}
Example #7
0
static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
{
	struct ixgbe_adapter *adapter = netdev_priv(netdev);
	int ret, i;
#ifdef IXGBE_FCOE
	struct dcb_app app = {
			      .selector = DCB_APP_IDTYPE_ETHTYPE,
			      .protocol = ETH_P_FCOE,
			     };
	u8 up = dcb_getapp(netdev, &app);
#endif

	/* Fail command if not in CEE mode */
	if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
		return 1;

	ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg,
				 MAX_TRAFFIC_CLASS);
	if (ret)
		return DCB_NO_HW_CHG;

#ifdef IXGBE_FCOE
	if (up && (up != (1 << adapter->fcoe.up)))
		adapter->dcb_set_bitmap |= BIT_APP_UPCHG;

	/*
	 * Only take down the adapter if an app change occurred. FCoE
	 * may shuffle tx rings in this case and this can not be done
	 * without a reset currently.
	 */
	if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) {
		while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state))
			usleep_range(1000, 2000);

		adapter->fcoe.up = ffs(up) - 1;

		if (netif_running(netdev))
			netdev->netdev_ops->ndo_stop(netdev);
		ixgbe_clear_interrupt_scheme(adapter);
	}
#endif

	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;
		}
	}

#ifdef IXGBE_FCOE
	if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) {
		ixgbe_init_interrupt_scheme(adapter);
		if (netif_running(netdev))
			netdev->netdev_ops->ndo_open(netdev);
		ret = DCB_HW_CHG_RST;
	}
#endif

	if (adapter->dcb_set_bitmap & (BIT_PG_TX|BIT_PG_RX)) {
		u16 refill[MAX_TRAFFIC_CLASS], max[MAX_TRAFFIC_CLASS];
		u8 bwg_id[MAX_TRAFFIC_CLASS], prio_type[MAX_TRAFFIC_CLASS];
		/* Priority to TC mapping in CEE case default to 1:1 */
		u8 prio_tc[MAX_USER_PRIORITY];
		int max_frame = adapter->netdev->mtu + ETH_HLEN + ETH_FCS_LEN;

#ifdef IXGBE_FCOE
		if (adapter->netdev->features & NETIF_F_FCOE_MTU)
			max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
#endif

		ixgbe_dcb_calculate_tc_credits(&adapter->hw, &adapter->dcb_cfg,
					       max_frame, DCB_TX_CONFIG);
		ixgbe_dcb_calculate_tc_credits(&adapter->hw, &adapter->dcb_cfg,
					       max_frame, DCB_RX_CONFIG);

		ixgbe_dcb_unpack_refill(&adapter->dcb_cfg,
					DCB_TX_CONFIG, refill);
		ixgbe_dcb_unpack_max(&adapter->dcb_cfg, max);
		ixgbe_dcb_unpack_bwgid(&adapter->dcb_cfg,
				       DCB_TX_CONFIG, bwg_id);
		ixgbe_dcb_unpack_prio(&adapter->dcb_cfg,
				      DCB_TX_CONFIG, prio_type);
		ixgbe_dcb_unpack_map(&adapter->dcb_cfg,
				     DCB_TX_CONFIG, prio_tc);

		ixgbe_dcb_hw_ets_config(&adapter->hw, refill, max,
					bwg_id, prio_type, prio_tc);

		for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
			netdev_set_prio_tc_map(netdev, i, prio_tc[i]);
	}

	if (adapter->dcb_set_bitmap & BIT_PFC) {
		u8 pfc_en;
		u8 prio_tc[MAX_USER_PRIORITY];

		ixgbe_dcb_unpack_map(&adapter->dcb_cfg,
				     DCB_TX_CONFIG, prio_tc);
		ixgbe_dcb_unpack_pfc(&adapter->dcb_cfg, &pfc_en);
		ixgbe_dcb_hw_pfc_config(&adapter->hw, pfc_en, prio_tc);
		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_APP_UPCHG)
		clear_bit(__IXGBE_RESETTING, &adapter->state);
	adapter->dcb_set_bitmap = 0x00;
	return ret;
}
Example #8
0
static int ixgbe_dcb_sstate(struct sk_buff *skb, struct genl_info *info)
{
	struct net_device *netdev = NULL;
	struct ixgbe_adapter *adapter = NULL;
	int ret = -EINVAL;
	u8 value;

	if (!info->attrs[DCB_A_IFNAME] || !info->attrs[DCB_A_STATE])
		goto err;

	netdev = dev_get_by_name(&init_net,
				 nla_data(info->attrs[DCB_A_IFNAME]));
	if (!netdev)
		goto err;

	ret = ixgbe_dcb_check_adapter(netdev);
	if (ret)
		goto err_out;
	else
		adapter = netdev_priv(netdev);

	value = nla_get_u8(info->attrs[DCB_A_STATE]);
	if ((value & 1) != value) {
		DPRINTK(DRV, ERR, "Value is not 1 or 0, it is %d.\n", value);
	} else {
		switch (value) {
		case 0:
			if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
				if (netdev->flags & IFF_UP)
#ifdef HAVE_NET_DEVICE_OPS
					netdev->netdev_ops->ndo_stop(netdev);
#else
					netdev->stop(netdev);
#endif
				ixgbe_clear_interrupt_scheme(adapter);

				adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
				if (adapter->flags & IXGBE_FLAG_RSS_CAPABLE)
					adapter->flags |=
					                 IXGBE_FLAG_RSS_ENABLED;
				ixgbe_init_interrupt_scheme(adapter);
				ixgbe_reset(adapter);
				if (netdev->flags & IFF_UP)
#ifdef HAVE_NET_DEVICE_OPS
					netdev->netdev_ops->ndo_open(netdev);
#else
					netdev->open(netdev);
#endif
				break;
			} else {
				/* Nothing to do, already off */
				goto out;
			}
		case 1:
			if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
				/* Nothing to do, already on */
				goto out;
			} else if (!(adapter->flags & IXGBE_FLAG_DCB_CAPABLE)) {
				DPRINTK(DRV, ERR, "Enable failed.  Make sure "
				        "the driver can enable MSI-X.\n");
				ret = -EINVAL;
				goto err_out;
			} else {
				if (netdev->flags & IFF_UP)
#ifdef HAVE_NET_DEVICE_OPS
					netdev->netdev_ops->ndo_stop(netdev);
#else
					netdev->stop(netdev);
#endif
				ixgbe_clear_interrupt_scheme(adapter);

				adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED;
				adapter->flags |= IXGBE_FLAG_DCB_ENABLED;
				adapter->dcb_cfg.support.capabilities =
				 (IXGBE_DCB_PG_SUPPORT | IXGBE_DCB_PFC_SUPPORT |
				  IXGBE_DCB_GSP_SUPPORT);
				if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
					DPRINTK(DRV, INFO, "DCB enabled, "
					        "disabling Flow Director\n");
					adapter->flags &=
					          ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
					adapter->flags &=
					       ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
					adapter->dcb_cfg.support.capabilities |=
					                IXGBE_DCB_UP2TC_SUPPORT;
				}
				adapter->ring_feature[RING_F_DCB].indices = 8;
				ixgbe_init_interrupt_scheme(adapter);
				ixgbe_reset(adapter);
				if (netdev->flags & IFF_UP)
#ifdef HAVE_NET_DEVICE_OPS
					netdev->netdev_ops->ndo_open(netdev);
#else
					netdev->open(netdev);
#endif
				break;
			}
		}
	}

out:
	ret = ixgbe_nl_reply(0, DCB_C_SSTATE, DCB_A_STATE, info);
	if (ret)
		goto err_out;

err_out:
	dev_put(netdev);
err:
	return ret;
}
Example #9
0
static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
{
	u8 err = 0;
	struct ixgbe_adapter *adapter = netdev_priv(netdev);

	if (state > 0) {
		/* Turn on DCB */
		if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
			goto out;

		if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
			DPRINTK(DRV, ERR, "Enable failed, needs MSI-X\n");
			err = 1;
			goto out;
		}

		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);
		switch (adapter->hw.mac.type) {
		case ixgbe_mac_82598EB:
			adapter->last_lfc_mode = adapter->hw.fc.current_mode;
			adapter->hw.fc.requested_mode = ixgbe_fc_none;
			break;
		case ixgbe_mac_82599EB:
		case ixgbe_mac_X540:
			DPRINTK(DRV, INFO, "DCB enabled, "
                                "disabling Flow Director\n");
			adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
			adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
			break;
		default:
			break;
		}
		adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED;
		adapter->flags |= IXGBE_FLAG_DCB_ENABLED;
		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 {
		/* Turn off DCB */
		if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
			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);
			adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
			adapter->temp_dcb_cfg.pfc_mode_enable = false;
			adapter->dcb_cfg.pfc_mode_enable = false;
			adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
			adapter->flags |= IXGBE_FLAG_RSS_ENABLED;
			switch (adapter->hw.mac.type) {
			case ixgbe_mac_82599EB:
			case ixgbe_mac_X540:
				adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
				break;
			default:
				break;
			}
			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
		}
	}
out:
	return err;
}
Example #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;
}