Example #1
0
static int
ixgb_set_pauseparam(struct net_device *netdev,
			 struct ethtool_pauseparam *pause)
{
	struct ixgb_adapter *adapter = netdev_priv(netdev);
	struct ixgb_hw *hw = &adapter->hw;

	if (pause->autoneg == AUTONEG_ENABLE)
		return -EINVAL;

	if (pause->rx_pause && pause->tx_pause)
		hw->fc.type = ixgb_fc_full;
	else if (pause->rx_pause && !pause->tx_pause)
		hw->fc.type = ixgb_fc_rx_pause;
	else if (!pause->rx_pause && pause->tx_pause)
		hw->fc.type = ixgb_fc_tx_pause;
	else if (!pause->rx_pause && !pause->tx_pause)
		hw->fc.type = ixgb_fc_none;

	if (netif_running(adapter->netdev)) {
		ixgb_down(adapter, true);
		ixgb_up(adapter);
		ixgb_set_speed_duplex(netdev);
	} else
		ixgb_reset(adapter);

	return 0;
}
Example #2
0
static int
ixgb_set_ringparam(struct net_device *netdev,
		struct ethtool_ringparam *ring)
{
	struct ixgb_adapter *adapter = netdev_priv(netdev);
	struct ixgb_desc_ring *txdr = &adapter->tx_ring;
	struct ixgb_desc_ring *rxdr = &adapter->rx_ring;
	struct ixgb_desc_ring tx_old, tx_new, rx_old, rx_new;
	int err;

	tx_old = adapter->tx_ring;
	rx_old = adapter->rx_ring;

	if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
		return -EINVAL;

	if (netif_running(adapter->netdev))
		ixgb_down(adapter, true);

	rxdr->count = max(ring->rx_pending,(u32)MIN_RXD);
	rxdr->count = min(rxdr->count,(u32)MAX_RXD);
	rxdr->count = ALIGN(rxdr->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE);

	txdr->count = max(ring->tx_pending,(u32)MIN_TXD);
	txdr->count = min(txdr->count,(u32)MAX_TXD);
	txdr->count = ALIGN(txdr->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);

	if (netif_running(adapter->netdev)) {
		/* Try to get new resources before deleting old */
		if ((err = ixgb_setup_rx_resources(adapter)))
			goto err_setup_rx;
		if ((err = ixgb_setup_tx_resources(adapter)))
			goto err_setup_tx;

		/* save the new, restore the old in order to free it,
		 * then restore the new back again */

		rx_new = adapter->rx_ring;
		tx_new = adapter->tx_ring;
		adapter->rx_ring = rx_old;
		adapter->tx_ring = tx_old;
		ixgb_free_rx_resources(adapter);
		ixgb_free_tx_resources(adapter);
		adapter->rx_ring = rx_new;
		adapter->tx_ring = tx_new;
		if ((err = ixgb_up(adapter)))
			return err;
		ixgb_set_speed_duplex(netdev);
	}

	return 0;
err_setup_tx:
	ixgb_free_rx_resources(adapter);
err_setup_rx:
	adapter->rx_ring = rx_old;
	adapter->tx_ring = tx_old;
	ixgb_up(adapter);
	return err;
}
Example #3
0
static int ixgb_set_rx_csum(struct net_device *dev, u32 sum)
{
	struct ixgb_adapter *adapter = dev->priv;
	adapter->rx_csum = sum;
	ixgb_down(adapter, TRUE);
	ixgb_up(adapter);
	return 0;
}
Example #4
0
static int ixgb_nway_reset(struct net_device *netdev)
{
	if (netif_running(netdev)) {
		struct ixgb_adapter *adapter = netdev->priv;
		ixgb_down(adapter, TRUE);
		ixgb_up(adapter);
	}
	return 0;
}
Example #5
0
static int
ixgb_ethtool_sset(struct net_device *netdev, struct ethtool_cmd *ecmd)
{
	struct ixgb_adapter *adapter = netdev->priv;
	if (ecmd->autoneg == AUTONEG_ENABLE ||
	    ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL)
		return -EINVAL;
	else {
		ixgb_down(adapter, TRUE);
		ixgb_up(adapter);
	}
	return 0;
}
static int
ixgb_set_rx_csum(struct net_device *netdev, uint32_t data)
{
	struct ixgb_adapter *adapter = netdev->priv;
	adapter->rx_csum = data;

	if(netif_running(netdev)) {
		ixgb_down(adapter,TRUE);
		ixgb_up(adapter);
	} else
		ixgb_reset(adapter);
	return 0;
}
Example #7
0
static int
ixgb_set_rx_csum(struct net_device *netdev, u32 data)
{
    struct ixgb_adapter *adapter = netdev_priv(netdev);

    adapter->rx_csum = data;

    if(netif_running(netdev)) {
        ixgb_down(adapter, true);
        ixgb_up(adapter);
        ixgb_set_speed_duplex(netdev);
    } else
        ixgb_reset(adapter);
    return 0;
}
static int
ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
{
	struct ixgb_adapter *adapter = netdev->priv;

	if(ecmd->autoneg == AUTONEG_ENABLE ||
	   ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL)
		return -EINVAL;
	
	if(netif_running(adapter->netdev)) {
		ixgb_down(adapter, TRUE);
		ixgb_reset(adapter);
		ixgb_up(adapter);
	} else
		ixgb_reset(adapter);

	return 0;
}
Example #9
0
static int
ixgb_set_link_ksettings(struct net_device *netdev,
			const struct ethtool_link_ksettings *cmd)
{
	struct ixgb_adapter *adapter = netdev_priv(netdev);
	u32 speed = cmd->base.speed;

	if (cmd->base.autoneg == AUTONEG_ENABLE ||
	    (speed + cmd->base.duplex != SPEED_10000 + DUPLEX_FULL))
		return -EINVAL;

	if (netif_running(adapter->netdev)) {
		ixgb_down(adapter, true);
		ixgb_reset(adapter);
		ixgb_up(adapter);
		ixgb_set_speed_duplex(netdev);
	} else
		ixgb_reset(adapter);

	return 0;
}
Example #10
0
static int
ixgb_ethtool_spause(struct net_device *dev,
		    struct ethtool_pauseparam *epause)
{
	struct ixgb_adapter *adapter = dev->priv;
	struct ixgb_hw *hw = &adapter->hw;

	if (epause->autoneg == AUTONEG_ENABLE)
		return -EINVAL;

	if (epause->rx_pause && epause->tx_pause)
		hw->fc.type = ixgb_fc_full;
	else if (epause->rx_pause && !epause->tx_pause)
		hw->fc.type = ixgb_fc_rx_pause;
	else if (!epause->rx_pause && epause->tx_pause)
		hw->fc.type = ixgb_fc_tx_pause;
	else if (!epause->rx_pause && !epause->tx_pause)
		hw->fc.type = ixgb_fc_none;

	ixgb_down(adapter, TRUE);
	ixgb_up(adapter);

	return 0;
}