Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 194544
b: refs/heads/master
c: f8d1dca
h: refs/heads/master
v: v3
  • Loading branch information
Jesse Brandeburg authored and David S. Miller committed Apr 27, 2010
1 parent 20c24fb commit 8797f39
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ec857fd40da41d7c50d9a97e07e364c93b8b8e05
refs/heads/master: f8d1dcaf88bddc7f282722ec1fdddbcb06a72f18
87 changes: 78 additions & 9 deletions trunk/drivers/net/ixgbe/ixgbe_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2079,6 +2079,27 @@ static int ixgbe_get_coalesce(struct net_device *netdev,
return 0;
}

/*
* this function must be called before setting the new value of
* rx_itr_setting
*/
static void ixgbe_reenable_rsc(struct ixgbe_adapter *adapter,
struct ethtool_coalesce *ec)
{
/* check the old value and enable RSC if necessary */
if ((adapter->rx_itr_setting == 0) &&
(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) {
adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED;
adapter->netdev->features |= NETIF_F_LRO;
DPRINTK(PROBE, INFO, "rx-usecs set to %d, re-enabling RSC\n",
ec->rx_coalesce_usecs);
if (netif_running(adapter->netdev))
ixgbe_reinit_locked(adapter);
else
ixgbe_reset(adapter);
}
}

static int ixgbe_set_coalesce(struct net_device *netdev,
struct ethtool_coalesce *ec)
{
Expand All @@ -2095,11 +2116,20 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
adapter->tx_ring[0]->work_limit = ec->tx_max_coalesced_frames_irq;

if (ec->rx_coalesce_usecs > 1) {
u32 max_int;
if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
max_int = IXGBE_MAX_RSC_INT_RATE;
else
max_int = IXGBE_MAX_INT_RATE;

/* check the limits */
if ((1000000/ec->rx_coalesce_usecs > IXGBE_MAX_INT_RATE) ||
if ((1000000/ec->rx_coalesce_usecs > max_int) ||
(1000000/ec->rx_coalesce_usecs < IXGBE_MIN_INT_RATE))
return -EINVAL;

/* check the old value and enable RSC if necessary */
ixgbe_reenable_rsc(adapter, ec);

/* store the value in ints/second */
adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs;

Expand All @@ -2108,6 +2138,9 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
/* clear the lower bit as its used for dynamic state */
adapter->rx_itr_setting &= ~1;
} else if (ec->rx_coalesce_usecs == 1) {
/* check the old value and enable RSC if necessary */
ixgbe_reenable_rsc(adapter, ec);

/* 1 means dynamic mode */
adapter->rx_eitr_param = 20000;
adapter->rx_itr_setting = 1;
Expand All @@ -2116,14 +2149,34 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
* any other value means disable eitr, which is best
* served by setting the interrupt rate very high
*/
if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
adapter->rx_eitr_param = IXGBE_MAX_RSC_INT_RATE;
else
adapter->rx_eitr_param = IXGBE_MAX_INT_RATE;
adapter->rx_eitr_param = IXGBE_MAX_INT_RATE;
adapter->rx_itr_setting = 0;

/*
* if hardware RSC is enabled, disable it when
* setting low latency mode, to avoid errata, assuming
* that when the user set low latency mode they want
* it at the cost of anything else
*/
if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED;
netdev->features &= ~NETIF_F_LRO;
DPRINTK(PROBE, INFO,
"rx-usecs set to 0, disabling RSC\n");

if (netif_running(netdev))
ixgbe_reinit_locked(adapter);
else
ixgbe_reset(adapter);
return 0;
}
}

if (ec->tx_coalesce_usecs > 1) {
/*
* don't have to worry about max_int as above because
* tx vectors don't do hardware RSC (an rx function)
*/
/* check the limits */
if ((1000000/ec->tx_coalesce_usecs > IXGBE_MAX_INT_RATE) ||
(1000000/ec->tx_coalesce_usecs < IXGBE_MIN_INT_RATE))
Expand Down Expand Up @@ -2178,10 +2231,26 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data)
ethtool_op_set_flags(netdev, data);

/* if state changes we need to update adapter->flags and reset */
if ((!!(data & ETH_FLAG_LRO)) !=
(!!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))) {
adapter->flags2 ^= IXGBE_FLAG2_RSC_ENABLED;
need_reset = true;
if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) {
/*
* cast both to bool and verify if they are set the same
* but only enable RSC if itr is non-zero, as
* itr=0 and RSC are mutually exclusive
*/
if (((!!(data & ETH_FLAG_LRO)) !=
(!!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))) &&
adapter->rx_itr_setting) {
adapter->flags2 ^= IXGBE_FLAG2_RSC_ENABLED;
switch (adapter->hw.mac.type) {
case ixgbe_mac_82599EB:
need_reset = true;
break;
default:
break;
}
} else if (!adapter->rx_itr_setting) {
netdev->features &= ~ETH_FLAG_LRO;
}
}

/*
Expand Down
9 changes: 9 additions & 0 deletions trunk/drivers/net/ixgbe/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,15 @@ void ixgbe_write_eitr(struct ixgbe_q_vector *q_vector)
/* must write high and low 16 bits to reset counter */
itr_reg |= (itr_reg << 16);
} else if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
/*
* 82599 can support a value of zero, so allow it for
* max interrupt rate, but there is an errata where it can
* not be zero with RSC
*/
if (itr_reg == 8 &&
!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))
itr_reg = 0;

/*
* set the WDIS bit to not clear the timer bits and cause an
* immediate assertion of the interrupt
Expand Down

0 comments on commit 8797f39

Please sign in to comment.