aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorNelson, Shannon <shannon.nelson@intel.com>2009-09-18 05:46:06 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-21 14:32:31 -0400
commitf7554a2bf2696daad25465734bb962d0184469f2 (patch)
tree368ef7fd5bd0a460b37553619be790b9d9c68683 /drivers/net/ixgbe
parent0a1f87cbdbf26e1257b36cc5e9c00a08c2236ff2 (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')
-rw-r--r--drivers/net/ixgbe/ixgbe.h6
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c75
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c31
3 files changed, 83 insertions, 29 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index dd688d45e9cd..385be6016667 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -267,7 +267,8 @@ struct ixgbe_adapter {
267 enum ixgbe_fc_mode last_lfc_mode; 267 enum ixgbe_fc_mode last_lfc_mode;
268 268
269 /* Interrupt Throttle Rate */ 269 /* Interrupt Throttle Rate */
270 u32 itr_setting; 270 u32 rx_itr_setting;
271 u32 tx_itr_setting;
271 u16 eitr_low; 272 u16 eitr_low;
272 u16 eitr_high; 273 u16 eitr_high;
273 274
@@ -351,7 +352,8 @@ struct ixgbe_adapter {
351 struct ixgbe_hw_stats stats; 352 struct ixgbe_hw_stats stats;
352 353
353 /* Interrupt Throttle Rate */ 354 /* Interrupt Throttle Rate */
354 u32 eitr_param; 355 u32 rx_eitr_param;
356 u32 tx_eitr_param;
355 357
356 unsigned long state; 358 unsigned long state;
357 u64 tx_busy; 359 u64 tx_busy;
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
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 056434c9831c..1aa9f6a5adf1 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -926,12 +926,12 @@ static void ixgbe_configure_msix(struct ixgbe_adapter *adapter)
926 r_idx + 1); 926 r_idx + 1);
927 } 927 }
928 928
929 /* if this is a tx only vector halve the interrupt rate */
930 if (q_vector->txr_count && !q_vector->rxr_count) 929 if (q_vector->txr_count && !q_vector->rxr_count)
931 q_vector->eitr = (adapter->eitr_param >> 1); 930 /* tx only */
931 q_vector->eitr = adapter->tx_eitr_param;
932 else if (q_vector->rxr_count) 932 else if (q_vector->rxr_count)
933 /* rx only */ 933 /* rx or mixed */
934 q_vector->eitr = adapter->eitr_param; 934 q_vector->eitr = adapter->rx_eitr_param;
935 935
936 ixgbe_write_eitr(q_vector); 936 ixgbe_write_eitr(q_vector);
937 } 937 }
@@ -1359,7 +1359,7 @@ static int ixgbe_clean_rxonly(struct napi_struct *napi, int budget)
1359 /* If all Rx work done, exit the polling mode */ 1359 /* If all Rx work done, exit the polling mode */
1360 if (work_done < budget) { 1360 if (work_done < budget) {
1361 napi_complete(napi); 1361 napi_complete(napi);
1362 if (adapter->itr_setting & 1) 1362 if (adapter->rx_itr_setting & 1)
1363 ixgbe_set_itr_msix(q_vector); 1363 ixgbe_set_itr_msix(q_vector);
1364 if (!test_bit(__IXGBE_DOWN, &adapter->state)) 1364 if (!test_bit(__IXGBE_DOWN, &adapter->state))
1365 ixgbe_irq_enable_queues(adapter, 1365 ixgbe_irq_enable_queues(adapter,
@@ -1420,7 +1420,7 @@ static int ixgbe_clean_rxtx_many(struct napi_struct *napi, int budget)
1420 /* If all Rx work done, exit the polling mode */ 1420 /* If all Rx work done, exit the polling mode */
1421 if (work_done < budget) { 1421 if (work_done < budget) {
1422 napi_complete(napi); 1422 napi_complete(napi);
1423 if (adapter->itr_setting & 1) 1423 if (adapter->rx_itr_setting & 1)
1424 ixgbe_set_itr_msix(q_vector); 1424 ixgbe_set_itr_msix(q_vector);
1425 if (!test_bit(__IXGBE_DOWN, &adapter->state)) 1425 if (!test_bit(__IXGBE_DOWN, &adapter->state))
1426 ixgbe_irq_enable_queues(adapter, 1426 ixgbe_irq_enable_queues(adapter,
@@ -1458,10 +1458,10 @@ static int ixgbe_clean_txonly(struct napi_struct *napi, int budget)
1458 if (!ixgbe_clean_tx_irq(q_vector, tx_ring)) 1458 if (!ixgbe_clean_tx_irq(q_vector, tx_ring))
1459 work_done = budget; 1459 work_done = budget;
1460 1460
1461 /* If all Rx work done, exit the polling mode */ 1461 /* If all Tx work done, exit the polling mode */
1462 if (work_done < budget) { 1462 if (work_done < budget) {
1463 napi_complete(napi); 1463 napi_complete(napi);
1464 if (adapter->itr_setting & 1) 1464 if (adapter->tx_itr_setting & 1)
1465 ixgbe_set_itr_msix(q_vector); 1465 ixgbe_set_itr_msix(q_vector);
1466 if (!test_bit(__IXGBE_DOWN, &adapter->state)) 1466 if (!test_bit(__IXGBE_DOWN, &adapter->state))
1467 ixgbe_irq_enable_queues(adapter, ((u64)1 << q_vector->v_idx)); 1467 ixgbe_irq_enable_queues(adapter, ((u64)1 << q_vector->v_idx));
@@ -1848,7 +1848,7 @@ static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter)
1848 struct ixgbe_hw *hw = &adapter->hw; 1848 struct ixgbe_hw *hw = &adapter->hw;
1849 1849
1850 IXGBE_WRITE_REG(hw, IXGBE_EITR(0), 1850 IXGBE_WRITE_REG(hw, IXGBE_EITR(0),
1851 EITR_INTS_PER_SEC_TO_REG(adapter->eitr_param)); 1851 EITR_INTS_PER_SEC_TO_REG(adapter->rx_eitr_param));
1852 1852
1853 ixgbe_set_ivar(adapter, 0, 0, 0); 1853 ixgbe_set_ivar(adapter, 0, 0, 0);
1854 ixgbe_set_ivar(adapter, 1, 0, 0); 1854 ixgbe_set_ivar(adapter, 1, 0, 0);
@@ -2991,7 +2991,7 @@ static int ixgbe_poll(struct napi_struct *napi, int budget)
2991 /* If budget not fully consumed, exit the polling mode */ 2991 /* If budget not fully consumed, exit the polling mode */
2992 if (work_done < budget) { 2992 if (work_done < budget) {
2993 napi_complete(napi); 2993 napi_complete(napi);
2994 if (adapter->itr_setting & 1) 2994 if (adapter->rx_itr_setting & 1)
2995 ixgbe_set_itr(adapter); 2995 ixgbe_set_itr(adapter);
2996 if (!test_bit(__IXGBE_DOWN, &adapter->state)) 2996 if (!test_bit(__IXGBE_DOWN, &adapter->state))
2997 ixgbe_irq_enable_queues(adapter, IXGBE_EIMS_RTX_QUEUE); 2997 ixgbe_irq_enable_queues(adapter, IXGBE_EIMS_RTX_QUEUE);
@@ -3601,7 +3601,10 @@ static int ixgbe_alloc_q_vectors(struct ixgbe_adapter *adapter)
3601 if (!q_vector) 3601 if (!q_vector)
3602 goto err_out; 3602 goto err_out;
3603 q_vector->adapter = adapter; 3603 q_vector->adapter = adapter;
3604 q_vector->eitr = adapter->eitr_param; 3604 if (q_vector->txr_count && !q_vector->rxr_count)
3605 q_vector->eitr = adapter->tx_eitr_param;
3606 else
3607 q_vector->eitr = adapter->rx_eitr_param;
3605 q_vector->v_idx = q_idx; 3608 q_vector->v_idx = q_idx;
3606 netif_napi_add(adapter->netdev, &q_vector->napi, (*poll), 64); 3609 netif_napi_add(adapter->netdev, &q_vector->napi, (*poll), 64);
3607 adapter->q_vector[q_idx] = q_vector; 3610 adapter->q_vector[q_idx] = q_vector;
@@ -3870,8 +3873,10 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
3870 hw->fc.disable_fc_autoneg = false; 3873 hw->fc.disable_fc_autoneg = false;
3871 3874
3872 /* enable itr by default in dynamic mode */ 3875 /* enable itr by default in dynamic mode */
3873 adapter->itr_setting = 1; 3876 adapter->rx_itr_setting = 1;
3874 adapter->eitr_param = 20000; 3877 adapter->rx_eitr_param = 20000;
3878 adapter->tx_itr_setting = 1;
3879 adapter->tx_eitr_param = 10000;
3875 3880
3876 /* set defaults for eitr in MegaBytes */ 3881 /* set defaults for eitr in MegaBytes */
3877 adapter->eitr_low = 10; 3882 adapter->eitr_low = 10;