diff options
| author | Jacob Keller <jacob.e.keller@intel.com> | 2016-09-12 17:18:44 -0400 |
|---|---|---|
| committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2016-09-25 01:50:23 -0400 |
| commit | 65e87c0398f542d5bd51cfd8a29b9dfd246b6a1c (patch) | |
| tree | 4614d718030e6ee50af55a1cabbc49220c19a2c7 /drivers/net/ethernet/intel/i40e | |
| parent | a4fa59cc5bb028ebb8048e8dcb6f92b2a1ea07f6 (diff) | |
i40evf: support queue-specific settings for interrupt moderation
In commit a75e8005d506f3 ("i40e: queue-specific settings for interrupt
moderation") the i40e driver gained support for setting interrupt
moderation values per queue. This patch adds support for this feature
to the i40evf driver as well. In addition, a few changes are made to
the i40e implementation to add function header documentation comments,
as well.
This behaves in a similar fashion to the implementation in i40e. Thus,
requesting the moderation value when no queue is provided will report
queue 0 value, while setting the value without a queue will set all
queues at once.
Change-ID: I1f310a57c8e6c84a8524c178d44d1b7a6d3a848e
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/i40e')
| -rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 72 | ||||
| -rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_txrx.c | 21 |
2 files changed, 85 insertions, 8 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 5cad80f157fb..92bc8846f1ba 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c | |||
| @@ -1970,11 +1970,22 @@ static int i40e_set_phys_id(struct net_device *netdev, | |||
| 1970 | * 125us (8000 interrupts per second) == ITR(62) | 1970 | * 125us (8000 interrupts per second) == ITR(62) |
| 1971 | */ | 1971 | */ |
| 1972 | 1972 | ||
| 1973 | /** | ||
| 1974 | * __i40e_get_coalesce - get per-queue coalesce settings | ||
| 1975 | * @netdev: the netdev to check | ||
| 1976 | * @ec: ethtool coalesce data structure | ||
| 1977 | * @queue: which queue to pick | ||
| 1978 | * | ||
| 1979 | * Gets the per-queue settings for coalescence. Specifically Rx and Tx usecs | ||
| 1980 | * are per queue. If queue is <0 then we default to queue 0 as the | ||
| 1981 | * representative value. | ||
| 1982 | **/ | ||
| 1973 | static int __i40e_get_coalesce(struct net_device *netdev, | 1983 | static int __i40e_get_coalesce(struct net_device *netdev, |
| 1974 | struct ethtool_coalesce *ec, | 1984 | struct ethtool_coalesce *ec, |
| 1975 | int queue) | 1985 | int queue) |
| 1976 | { | 1986 | { |
| 1977 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 1987 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
| 1988 | struct i40e_ring *rx_ring, *tx_ring; | ||
| 1978 | struct i40e_vsi *vsi = np->vsi; | 1989 | struct i40e_vsi *vsi = np->vsi; |
| 1979 | 1990 | ||
| 1980 | ec->tx_max_coalesced_frames_irq = vsi->work_limit; | 1991 | ec->tx_max_coalesced_frames_irq = vsi->work_limit; |
| @@ -1989,14 +2000,18 @@ static int __i40e_get_coalesce(struct net_device *netdev, | |||
| 1989 | return -EINVAL; | 2000 | return -EINVAL; |
| 1990 | } | 2001 | } |
| 1991 | 2002 | ||
| 1992 | if (ITR_IS_DYNAMIC(vsi->rx_rings[queue]->rx_itr_setting)) | 2003 | rx_ring = vsi->rx_rings[queue]; |
| 2004 | tx_ring = vsi->tx_rings[queue]; | ||
| 2005 | |||
| 2006 | if (ITR_IS_DYNAMIC(rx_ring->rx_itr_setting)) | ||
| 1993 | ec->use_adaptive_rx_coalesce = 1; | 2007 | ec->use_adaptive_rx_coalesce = 1; |
| 1994 | 2008 | ||
| 1995 | if (ITR_IS_DYNAMIC(vsi->tx_rings[queue]->tx_itr_setting)) | 2009 | if (ITR_IS_DYNAMIC(tx_ring->tx_itr_setting)) |
| 1996 | ec->use_adaptive_tx_coalesce = 1; | 2010 | ec->use_adaptive_tx_coalesce = 1; |
| 1997 | 2011 | ||
| 1998 | ec->rx_coalesce_usecs = vsi->rx_rings[queue]->rx_itr_setting & ~I40E_ITR_DYNAMIC; | 2012 | ec->rx_coalesce_usecs = rx_ring->rx_itr_setting & ~I40E_ITR_DYNAMIC; |
| 1999 | ec->tx_coalesce_usecs = vsi->tx_rings[queue]->tx_itr_setting & ~I40E_ITR_DYNAMIC; | 2013 | ec->tx_coalesce_usecs = tx_ring->tx_itr_setting & ~I40E_ITR_DYNAMIC; |
| 2014 | |||
| 2000 | 2015 | ||
| 2001 | /* we use the _usecs_high to store/set the interrupt rate limit | 2016 | /* we use the _usecs_high to store/set the interrupt rate limit |
| 2002 | * that the hardware supports, that almost but not quite | 2017 | * that the hardware supports, that almost but not quite |
| @@ -2010,18 +2025,44 @@ static int __i40e_get_coalesce(struct net_device *netdev, | |||
| 2010 | return 0; | 2025 | return 0; |
| 2011 | } | 2026 | } |
| 2012 | 2027 | ||
| 2028 | /** | ||
| 2029 | * i40e_get_coalesce - get a netdev's coalesce settings | ||
| 2030 | * @netdev: the netdev to check | ||
| 2031 | * @ec: ethtool coalesce data structure | ||
| 2032 | * | ||
| 2033 | * Gets the coalesce settings for a particular netdev. Note that if user has | ||
| 2034 | * modified per-queue settings, this only guarantees to represent queue 0. See | ||
| 2035 | * __i40e_get_coalesce for more details. | ||
| 2036 | **/ | ||
| 2013 | static int i40e_get_coalesce(struct net_device *netdev, | 2037 | static int i40e_get_coalesce(struct net_device *netdev, |
| 2014 | struct ethtool_coalesce *ec) | 2038 | struct ethtool_coalesce *ec) |
| 2015 | { | 2039 | { |
| 2016 | return __i40e_get_coalesce(netdev, ec, -1); | 2040 | return __i40e_get_coalesce(netdev, ec, -1); |
| 2017 | } | 2041 | } |
| 2018 | 2042 | ||
| 2043 | /** | ||
| 2044 | * i40e_get_per_queue_coalesce - gets coalesce settings for particular queue | ||
| 2045 | * @netdev: netdev structure | ||
| 2046 | * @ec: ethtool's coalesce settings | ||
| 2047 | * @queue: the particular queue to read | ||
| 2048 | * | ||
| 2049 | * Will read a specific queue's coalesce settings | ||
| 2050 | **/ | ||
| 2019 | static int i40e_get_per_queue_coalesce(struct net_device *netdev, u32 queue, | 2051 | static int i40e_get_per_queue_coalesce(struct net_device *netdev, u32 queue, |
| 2020 | struct ethtool_coalesce *ec) | 2052 | struct ethtool_coalesce *ec) |
| 2021 | { | 2053 | { |
| 2022 | return __i40e_get_coalesce(netdev, ec, queue); | 2054 | return __i40e_get_coalesce(netdev, ec, queue); |
| 2023 | } | 2055 | } |
| 2024 | 2056 | ||
| 2057 | /** | ||
| 2058 | * i40e_set_itr_per_queue - set ITR values for specific queue | ||
| 2059 | * @vsi: the VSI to set values for | ||
| 2060 | * @ec: coalesce settings from ethtool | ||
| 2061 | * @queue: the queue to modify | ||
| 2062 | * | ||
| 2063 | * Change the ITR settings for a specific queue. | ||
| 2064 | **/ | ||
| 2065 | |||
| 2025 | static void i40e_set_itr_per_queue(struct i40e_vsi *vsi, | 2066 | static void i40e_set_itr_per_queue(struct i40e_vsi *vsi, |
| 2026 | struct ethtool_coalesce *ec, | 2067 | struct ethtool_coalesce *ec, |
| 2027 | int queue) | 2068 | int queue) |
| @@ -2060,6 +2101,14 @@ static void i40e_set_itr_per_queue(struct i40e_vsi *vsi, | |||
| 2060 | i40e_flush(hw); | 2101 | i40e_flush(hw); |
| 2061 | } | 2102 | } |
| 2062 | 2103 | ||
| 2104 | /** | ||
| 2105 | * __i40e_set_coalesce - set coalesce settings for particular queue | ||
| 2106 | * @netdev: the netdev to change | ||
| 2107 | * @ec: ethtool coalesce settings | ||
| 2108 | * @queue: the queue to change | ||
| 2109 | * | ||
| 2110 | * Sets the coalesce settings for a particular queue. | ||
| 2111 | **/ | ||
| 2063 | static int __i40e_set_coalesce(struct net_device *netdev, | 2112 | static int __i40e_set_coalesce(struct net_device *netdev, |
| 2064 | struct ethtool_coalesce *ec, | 2113 | struct ethtool_coalesce *ec, |
| 2065 | int queue) | 2114 | int queue) |
| @@ -2120,12 +2169,27 @@ static int __i40e_set_coalesce(struct net_device *netdev, | |||
| 2120 | return 0; | 2169 | return 0; |
| 2121 | } | 2170 | } |
| 2122 | 2171 | ||
| 2172 | /** | ||
| 2173 | * i40e_set_coalesce - set coalesce settings for every queue on the netdev | ||
| 2174 | * @netdev: the netdev to change | ||
| 2175 | * @ec: ethtool coalesce settings | ||
| 2176 | * | ||
| 2177 | * This will set each queue to the same coalesce settings. | ||
| 2178 | **/ | ||
| 2123 | static int i40e_set_coalesce(struct net_device *netdev, | 2179 | static int i40e_set_coalesce(struct net_device *netdev, |
| 2124 | struct ethtool_coalesce *ec) | 2180 | struct ethtool_coalesce *ec) |
| 2125 | { | 2181 | { |
| 2126 | return __i40e_set_coalesce(netdev, ec, -1); | 2182 | return __i40e_set_coalesce(netdev, ec, -1); |
| 2127 | } | 2183 | } |
| 2128 | 2184 | ||
| 2185 | /** | ||
| 2186 | * i40e_set_per_queue_coalesce - set specific queue's coalesce settings | ||
| 2187 | * @netdev: the netdev to change | ||
| 2188 | * @ec: ethtool's coalesce settings | ||
| 2189 | * @queue: the queue to change | ||
| 2190 | * | ||
| 2191 | * Sets the specified queue's coalesce settings. | ||
| 2192 | **/ | ||
| 2129 | static int i40e_set_per_queue_coalesce(struct net_device *netdev, u32 queue, | 2193 | static int i40e_set_per_queue_coalesce(struct net_device *netdev, u32 queue, |
| 2130 | struct ethtool_coalesce *ec) | 2194 | struct ethtool_coalesce *ec) |
| 2131 | { | 2195 | { |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 5237c491af89..6287bf63c43c 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c | |||
| @@ -1877,6 +1877,15 @@ static u32 i40e_buildreg_itr(const int type, const u16 itr) | |||
| 1877 | 1877 | ||
| 1878 | /* a small macro to shorten up some long lines */ | 1878 | /* a small macro to shorten up some long lines */ |
| 1879 | #define INTREG I40E_PFINT_DYN_CTLN | 1879 | #define INTREG I40E_PFINT_DYN_CTLN |
| 1880 | static inline int get_rx_itr_enabled(struct i40e_vsi *vsi, int idx) | ||
| 1881 | { | ||
| 1882 | return !!(vsi->rx_rings[idx]->rx_itr_setting); | ||
| 1883 | } | ||
| 1884 | |||
| 1885 | static inline int get_tx_itr_enabled(struct i40e_vsi *vsi, int idx) | ||
| 1886 | { | ||
| 1887 | return !!(vsi->tx_rings[idx]->tx_itr_setting); | ||
| 1888 | } | ||
| 1880 | 1889 | ||
| 1881 | /** | 1890 | /** |
| 1882 | * i40e_update_enable_itr - Update itr and re-enable MSIX interrupt | 1891 | * i40e_update_enable_itr - Update itr and re-enable MSIX interrupt |
| @@ -1892,6 +1901,7 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi, | |||
| 1892 | u32 rxval, txval; | 1901 | u32 rxval, txval; |
| 1893 | int vector; | 1902 | int vector; |
| 1894 | int idx = q_vector->v_idx; | 1903 | int idx = q_vector->v_idx; |
| 1904 | int rx_itr_setting, tx_itr_setting; | ||
| 1895 | 1905 | ||
| 1896 | vector = (q_vector->v_idx + vsi->base_vector); | 1906 | vector = (q_vector->v_idx + vsi->base_vector); |
| 1897 | 1907 | ||
| @@ -1900,18 +1910,21 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi, | |||
| 1900 | */ | 1910 | */ |
| 1901 | rxval = txval = i40e_buildreg_itr(I40E_ITR_NONE, 0); | 1911 | rxval = txval = i40e_buildreg_itr(I40E_ITR_NONE, 0); |
| 1902 | 1912 | ||
| 1913 | rx_itr_setting = get_rx_itr_enabled(vsi, idx); | ||
| 1914 | tx_itr_setting = get_tx_itr_enabled(vsi, idx); | ||
| 1915 | |||
| 1903 | if (q_vector->itr_countdown > 0 || | 1916 | if (q_vector->itr_countdown > 0 || |
| 1904 | (!ITR_IS_DYNAMIC(vsi->rx_rings[idx]->rx_itr_setting) && | 1917 | (!ITR_IS_DYNAMIC(rx_itr_setting) && |
| 1905 | !ITR_IS_DYNAMIC(vsi->tx_rings[idx]->tx_itr_setting))) { | 1918 | !ITR_IS_DYNAMIC(tx_itr_setting))) { |
| 1906 | goto enable_int; | 1919 | goto enable_int; |
| 1907 | } | 1920 | } |
| 1908 | 1921 | ||
| 1909 | if (ITR_IS_DYNAMIC(vsi->rx_rings[idx]->rx_itr_setting)) { | 1922 | if (ITR_IS_DYNAMIC(tx_itr_setting)) { |
| 1910 | rx = i40e_set_new_dynamic_itr(&q_vector->rx); | 1923 | rx = i40e_set_new_dynamic_itr(&q_vector->rx); |
| 1911 | rxval = i40e_buildreg_itr(I40E_RX_ITR, q_vector->rx.itr); | 1924 | rxval = i40e_buildreg_itr(I40E_RX_ITR, q_vector->rx.itr); |
| 1912 | } | 1925 | } |
| 1913 | 1926 | ||
| 1914 | if (ITR_IS_DYNAMIC(vsi->tx_rings[idx]->tx_itr_setting)) { | 1927 | if (ITR_IS_DYNAMIC(tx_itr_setting)) { |
| 1915 | tx = i40e_set_new_dynamic_itr(&q_vector->tx); | 1928 | tx = i40e_set_new_dynamic_itr(&q_vector->tx); |
| 1916 | txval = i40e_buildreg_itr(I40E_TX_ITR, q_vector->tx.itr); | 1929 | txval = i40e_buildreg_itr(I40E_TX_ITR, q_vector->tx.itr); |
| 1917 | } | 1930 | } |
