diff options
author | Nelson, Shannon <shannon.nelson@intel.com> | 2009-09-18 05:46:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-21 14:32:31 -0400 |
commit | f7554a2bf2696daad25465734bb962d0184469f2 (patch) | |
tree | 368ef7fd5bd0a460b37553619be790b9d9c68683 /drivers/net/ixgbe/ixgbe_ethtool.c | |
parent | 0a1f87cbdbf26e1257b36cc5e9c00a08c2236ff2 (diff) |
ixgbe: Allow tx itr specific settings
Allow the user to set Tx specific itr values. This only makes sense
when there are separate vectors for Tx and Rx. When the queues are
doubled up RxTx on the vectors, we still only use the rx itr value.
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Acked-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_ethtool.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_ethtool.c | 75 |
1 files changed, 61 insertions, 14 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 026e94a99849..53b0a6680254 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -1929,7 +1929,7 @@ static int ixgbe_get_coalesce(struct net_device *netdev, | |||
1929 | ec->tx_max_coalesced_frames_irq = adapter->tx_ring[0].work_limit; | 1929 | ec->tx_max_coalesced_frames_irq = adapter->tx_ring[0].work_limit; |
1930 | 1930 | ||
1931 | /* only valid if in constant ITR mode */ | 1931 | /* only valid if in constant ITR mode */ |
1932 | switch (adapter->itr_setting) { | 1932 | switch (adapter->rx_itr_setting) { |
1933 | case 0: | 1933 | case 0: |
1934 | /* throttling disabled */ | 1934 | /* throttling disabled */ |
1935 | ec->rx_coalesce_usecs = 0; | 1935 | ec->rx_coalesce_usecs = 0; |
@@ -1940,9 +1940,25 @@ static int ixgbe_get_coalesce(struct net_device *netdev, | |||
1940 | break; | 1940 | break; |
1941 | default: | 1941 | default: |
1942 | /* fixed interrupt rate mode */ | 1942 | /* fixed interrupt rate mode */ |
1943 | ec->rx_coalesce_usecs = 1000000/adapter->eitr_param; | 1943 | ec->rx_coalesce_usecs = 1000000/adapter->rx_eitr_param; |
1944 | break; | 1944 | break; |
1945 | } | 1945 | } |
1946 | |||
1947 | /* only valid if in constant ITR mode */ | ||
1948 | switch (adapter->tx_itr_setting) { | ||
1949 | case 0: | ||
1950 | /* throttling disabled */ | ||
1951 | ec->tx_coalesce_usecs = 0; | ||
1952 | break; | ||
1953 | case 1: | ||
1954 | /* dynamic ITR mode */ | ||
1955 | ec->tx_coalesce_usecs = 1; | ||
1956 | break; | ||
1957 | default: | ||
1958 | ec->tx_coalesce_usecs = 1000000/adapter->tx_eitr_param; | ||
1959 | break; | ||
1960 | } | ||
1961 | |||
1946 | return 0; | 1962 | return 0; |
1947 | } | 1963 | } |
1948 | 1964 | ||
@@ -1953,6 +1969,14 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
1953 | struct ixgbe_q_vector *q_vector; | 1969 | struct ixgbe_q_vector *q_vector; |
1954 | int i; | 1970 | int i; |
1955 | 1971 | ||
1972 | /* | ||
1973 | * don't accept tx specific changes if we've got mixed RxTx vectors | ||
1974 | * test and jump out here if needed before changing the rx numbers | ||
1975 | */ | ||
1976 | if ((1000000/ec->tx_coalesce_usecs) != adapter->tx_eitr_param && | ||
1977 | adapter->q_vector[0]->txr_count && adapter->q_vector[0]->rxr_count) | ||
1978 | return -EINVAL; | ||
1979 | |||
1956 | if (ec->tx_max_coalesced_frames_irq) | 1980 | if (ec->tx_max_coalesced_frames_irq) |
1957 | adapter->tx_ring[0].work_limit = ec->tx_max_coalesced_frames_irq; | 1981 | adapter->tx_ring[0].work_limit = ec->tx_max_coalesced_frames_irq; |
1958 | 1982 | ||
@@ -1963,26 +1987,49 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
1963 | return -EINVAL; | 1987 | return -EINVAL; |
1964 | 1988 | ||
1965 | /* store the value in ints/second */ | 1989 | /* store the value in ints/second */ |
1966 | adapter->eitr_param = 1000000/ec->rx_coalesce_usecs; | 1990 | adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs; |
1967 | 1991 | ||
1968 | /* static value of interrupt rate */ | 1992 | /* static value of interrupt rate */ |
1969 | adapter->itr_setting = adapter->eitr_param; | 1993 | adapter->rx_itr_setting = adapter->rx_eitr_param; |
1970 | /* clear the lower bit as its used for dynamic state */ | 1994 | /* clear the lower bit as its used for dynamic state */ |
1971 | adapter->itr_setting &= ~1; | 1995 | adapter->rx_itr_setting &= ~1; |
1972 | } else if (ec->rx_coalesce_usecs == 1) { | 1996 | } else if (ec->rx_coalesce_usecs == 1) { |
1973 | /* 1 means dynamic mode */ | 1997 | /* 1 means dynamic mode */ |
1974 | adapter->eitr_param = 20000; | 1998 | adapter->rx_eitr_param = 20000; |
1975 | adapter->itr_setting = 1; | 1999 | adapter->rx_itr_setting = 1; |
1976 | } else { | 2000 | } else { |
1977 | /* | 2001 | /* |
1978 | * any other value means disable eitr, which is best | 2002 | * any other value means disable eitr, which is best |
1979 | * served by setting the interrupt rate very high | 2003 | * served by setting the interrupt rate very high |
1980 | */ | 2004 | */ |
1981 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) | 2005 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) |
1982 | adapter->eitr_param = IXGBE_MAX_RSC_INT_RATE; | 2006 | adapter->rx_eitr_param = IXGBE_MAX_RSC_INT_RATE; |
1983 | else | 2007 | else |
1984 | adapter->eitr_param = IXGBE_MAX_INT_RATE; | 2008 | adapter->rx_eitr_param = IXGBE_MAX_INT_RATE; |
1985 | adapter->itr_setting = 0; | 2009 | adapter->rx_itr_setting = 0; |
2010 | } | ||
2011 | |||
2012 | if (ec->tx_coalesce_usecs > 1) { | ||
2013 | /* check the limits */ | ||
2014 | if ((1000000/ec->tx_coalesce_usecs > IXGBE_MAX_INT_RATE) || | ||
2015 | (1000000/ec->tx_coalesce_usecs < IXGBE_MIN_INT_RATE)) | ||
2016 | return -EINVAL; | ||
2017 | |||
2018 | /* store the value in ints/second */ | ||
2019 | adapter->tx_eitr_param = 1000000/ec->tx_coalesce_usecs; | ||
2020 | |||
2021 | /* static value of interrupt rate */ | ||
2022 | adapter->tx_itr_setting = adapter->tx_eitr_param; | ||
2023 | |||
2024 | /* clear the lower bit as its used for dynamic state */ | ||
2025 | adapter->tx_itr_setting &= ~1; | ||
2026 | } else if (ec->tx_coalesce_usecs == 1) { | ||
2027 | /* 1 means dynamic mode */ | ||
2028 | adapter->tx_eitr_param = 10000; | ||
2029 | adapter->tx_itr_setting = 1; | ||
2030 | } else { | ||
2031 | adapter->tx_eitr_param = IXGBE_MAX_INT_RATE; | ||
2032 | adapter->tx_itr_setting = 0; | ||
1986 | } | 2033 | } |
1987 | 2034 | ||
1988 | /* MSI/MSIx Interrupt Mode */ | 2035 | /* MSI/MSIx Interrupt Mode */ |
@@ -1992,17 +2039,17 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
1992 | for (i = 0; i < num_vectors; i++) { | 2039 | for (i = 0; i < num_vectors; i++) { |
1993 | q_vector = adapter->q_vector[i]; | 2040 | q_vector = adapter->q_vector[i]; |
1994 | if (q_vector->txr_count && !q_vector->rxr_count) | 2041 | if (q_vector->txr_count && !q_vector->rxr_count) |
1995 | /* tx vector gets half the rate */ | 2042 | /* tx only */ |
1996 | q_vector->eitr = (adapter->eitr_param >> 1); | 2043 | q_vector->eitr = adapter->tx_eitr_param; |
1997 | else | 2044 | else |
1998 | /* rx only or mixed */ | 2045 | /* rx only or mixed */ |
1999 | q_vector->eitr = adapter->eitr_param; | 2046 | q_vector->eitr = adapter->rx_eitr_param; |
2000 | ixgbe_write_eitr(q_vector); | 2047 | ixgbe_write_eitr(q_vector); |
2001 | } | 2048 | } |
2002 | /* Legacy Interrupt Mode */ | 2049 | /* Legacy Interrupt Mode */ |
2003 | } else { | 2050 | } else { |
2004 | q_vector = adapter->q_vector[0]; | 2051 | q_vector = adapter->q_vector[0]; |
2005 | q_vector->eitr = adapter->eitr_param; | 2052 | q_vector->eitr = adapter->rx_eitr_param; |
2006 | ixgbe_write_eitr(q_vector); | 2053 | ixgbe_write_eitr(q_vector); |
2007 | } | 2054 | } |
2008 | 2055 | ||