Exemplo n.º 1
0
static int qlcnic_set_flags(struct net_device *netdev, u32 data)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	int hw_lro;

	if ((ethtool_op_get_flags(netdev) & ~ETH_FLAG_LRO) !=
	    (data & ~ETH_FLAG_LRO))
		return -EINVAL;

	if (data & ETH_FLAG_LRO) {
		if (netdev->features & NETIF_F_LRO)
			return 0;

		if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO))
			return -EINVAL;

		if (!adapter->rx_csum) {
			dev_info(&adapter->pdev->dev, "rx csum is off, "
				"cannot toggle lro\n");
			return -EINVAL;
		}

		hw_lro = QLCNIC_LRO_ENABLED;
		netdev->features |= NETIF_F_LRO;
	} else {

		if (!(netdev->features & NETIF_F_LRO))
			return 0;

		hw_lro = 0;
		netdev->features &= ~NETIF_F_LRO;
	}

	if (qlcnic_config_hw_lro(adapter, hw_lro))
		return -EIO;

	if ((hw_lro == 0) && qlcnic_send_lro_cleanup(adapter))
		return -EIO;


	return 0;
}
static int qlcnic_set_flags(struct net_device *netdev, u32 data)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	int hw_lro;

	if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO))
		return -EINVAL;

	ethtool_op_set_flags(netdev, data);

	hw_lro = (data & ETH_FLAG_LRO) ? QLCNIC_LRO_ENABLED : 0;

	if (qlcnic_config_hw_lro(adapter, hw_lro))
		return -EIO;

	if ((hw_lro == 0) && qlcnic_send_lro_cleanup(adapter))
		return -EIO;


	return 0;
}
Exemplo n.º 3
0
static int qlcnic_set_rx_csum(struct net_device *dev, u32 data)
{
	struct qlcnic_adapter *adapter = netdev_priv(dev);

	if ((adapter->flags & QLCNIC_ESWITCH_ENABLED))
		return -EOPNOTSUPP;
	if (!!data) {
		adapter->rx_csum = !!data;
		return 0;
	}

	if (dev->features & NETIF_F_LRO) {
		if (qlcnic_config_hw_lro(adapter, QLCNIC_LRO_DISABLED))
			return -EIO;

		dev->features &= ~NETIF_F_LRO;
		qlcnic_send_lro_cleanup(adapter);
	}
	adapter->rx_csum = !!data;
	dev_info(&adapter->pdev->dev, "disabling LRO as rx_csum is off\n");
	return 0;
}