netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 net 0/2] fixes of interrupt moderation bugs
@ 2019-12-19 15:40 akiyano
  2019-12-19 15:40 ` [PATCH V2 net 1/2] net: ena: fix default tx interrupt moderation interval akiyano
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: akiyano @ 2019-12-19 15:40 UTC (permalink / raw)
  To: davem, netdev
  Cc: Arthur Kiyanovski, dwmw, zorik, matua, saeedb, msw, aliguori,
	nafea, gtzalik, netanel, alisaidi, benh, ndagan, shayagr,
	sameehj

From: Arthur Kiyanovski <akiyano@amazon.com>


Differences from V1:
1. Updated default tx interrupt moderation to 64us
2. Added "Fixes:" tags.
3. Removed cosmetic changes that are not relevant for these bug fixes

This patchset includes a couple of fixes of bugs in the implemenation of
interrupt moderation.

Arthur Kiyanovski (2):
  net: ena: fix default tx interrupt moderation interval
  net: ena: fix issues in setting interrupt moderation params in ethtool

 drivers/net/ethernet/amazon/ena/ena_com.h     |  2 +-
 drivers/net/ethernet/amazon/ena/ena_ethtool.c | 24 ++++++++++--------------
 2 files changed, 11 insertions(+), 15 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH V2 net 1/2] net: ena: fix default tx interrupt moderation interval
  2019-12-19 15:40 [PATCH V2 net 0/2] fixes of interrupt moderation bugs akiyano
@ 2019-12-19 15:40 ` akiyano
  2019-12-19 15:40 ` [PATCH V2 net 2/2] net: ena: fix issues in setting interrupt moderation params in ethtool akiyano
  2019-12-21  5:42 ` [PATCH V2 net 0/2] fixes of interrupt moderation bugs David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: akiyano @ 2019-12-19 15:40 UTC (permalink / raw)
  To: davem, netdev
  Cc: Arthur Kiyanovski, dwmw, zorik, matua, saeedb, msw, aliguori,
	nafea, gtzalik, netanel, alisaidi, benh, ndagan, shayagr,
	sameehj

From: Arthur Kiyanovski <akiyano@amazon.com>

Current default non-adaptive tx interrupt moderation interval is 196 us.
This value is too high and might cause the tx queue to fill up.

In this commit we set the default non-adaptive tx interrupt moderation
interval to 64 us in order to:
1. Reduce the probability of the queue filling-up (when compared to the
   current default value of 196 us).
2. Reduce unnecessary tx interrupt overhead (which happens if we set the
   default tx interval to 0).
   We determined experimentally that 64 us is an optimal value that
   reduces interrupt rate by more than 20% without affecting performance.

Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")

Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
---
 drivers/net/ethernet/amazon/ena/ena_com.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_com.h b/drivers/net/ethernet/amazon/ena/ena_com.h
index 7c941eb..0ce37d5 100644
--- a/drivers/net/ethernet/amazon/ena/ena_com.h
+++ b/drivers/net/ethernet/amazon/ena/ena_com.h
@@ -72,7 +72,7 @@
 /*****************************************************************************/
 /* ENA adaptive interrupt moderation settings */
 
-#define ENA_INTR_INITIAL_TX_INTERVAL_USECS		196
+#define ENA_INTR_INITIAL_TX_INTERVAL_USECS		64
 #define ENA_INTR_INITIAL_RX_INTERVAL_USECS		0
 #define ENA_DEFAULT_INTR_DELAY_RESOLUTION		1
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH V2 net 2/2] net: ena: fix issues in setting interrupt moderation params in ethtool
  2019-12-19 15:40 [PATCH V2 net 0/2] fixes of interrupt moderation bugs akiyano
  2019-12-19 15:40 ` [PATCH V2 net 1/2] net: ena: fix default tx interrupt moderation interval akiyano
@ 2019-12-19 15:40 ` akiyano
  2019-12-21  5:42 ` [PATCH V2 net 0/2] fixes of interrupt moderation bugs David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: akiyano @ 2019-12-19 15:40 UTC (permalink / raw)
  To: davem, netdev
  Cc: Arthur Kiyanovski, dwmw, zorik, matua, saeedb, msw, aliguori,
	nafea, gtzalik, netanel, alisaidi, benh, ndagan, shayagr,
	sameehj

From: Arthur Kiyanovski <akiyano@amazon.com>

Issue 1:
--------
Reproduction steps:
1. sudo ethtool -C eth0 rx-usecs 128
2. sudo ethtool -C eth0 adaptive-rx on
3. sudo ethtool -C eth0 adaptive-rx off
4. ethtool -c eth0

expected output: rx-usecs 128
actual output: rx-usecs 0

Reason for issue:
In stage 3, ethtool userspace calls first the ena_get_coalesce() handler
to get the current value of all properties, and then the ena_set_coalesce()
handler. When ena_get_coalesce() is called the adaptive interrupt
moderation is still on. There is an if in the code that returns the
rx_coalesce_usecs only if the adaptive interrupt moderation is off.
And since it is still on, rx_coalesce_usecs is not set, meaning it
stays 0.

Solution to issue:
Remove this if static interrupt moderation intervals have nothing to do
with dynamic ones.

Issue 2:
--------
Reproduction steps:
1. sudo ethtool -C eth0 adaptive-rx on
2. sudo ethtool -C eth0 rx-usecs 128
3. ethtool -c eth0

expected output: rx-usecs 128
actual output: rx-usecs 0

Reason for issue:
In stage 2, when ena_set_coalesce() is called, the handler tests if
rx adaptive interrupt moderation is on, and if it is, it returns before
getting to the part in the function that sets the rx non-adaptive
interrupt moderation interval.

Solution to issue:
Remove the return from the function when rx adaptive interrupt moderation
is on.

Also cleaned up the fixed code in ena_set_coalesce by grouping together
adaptive interrupt moderation toggling, and using && instead of nested
ifs.

Fixes: b3db86dc4b82 ("net: ena: reimplement set/get_coalesce()")
Fixes: 0eda847953d8 ("net: ena: fix retrieval of nonadaptive interrupt moderation intervals")
Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")

Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
---
 drivers/net/ethernet/amazon/ena/ena_ethtool.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
index a3250dc..fc96c66 100644
--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
+++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
@@ -315,10 +315,9 @@ static int ena_get_coalesce(struct net_device *net_dev,
 		ena_com_get_nonadaptive_moderation_interval_tx(ena_dev) *
 			ena_dev->intr_delay_resolution;
 
-	if (!ena_com_get_adaptive_moderation_enabled(ena_dev))
-		coalesce->rx_coalesce_usecs =
-			ena_com_get_nonadaptive_moderation_interval_rx(ena_dev)
-			* ena_dev->intr_delay_resolution;
+	coalesce->rx_coalesce_usecs =
+		ena_com_get_nonadaptive_moderation_interval_rx(ena_dev)
+		* ena_dev->intr_delay_resolution;
 
 	coalesce->use_adaptive_rx_coalesce =
 		ena_com_get_adaptive_moderation_enabled(ena_dev);
@@ -367,12 +366,6 @@ static int ena_set_coalesce(struct net_device *net_dev,
 
 	ena_update_tx_rings_intr_moderation(adapter);
 
-	if (coalesce->use_adaptive_rx_coalesce) {
-		if (!ena_com_get_adaptive_moderation_enabled(ena_dev))
-			ena_com_enable_adaptive_moderation(ena_dev);
-		return 0;
-	}
-
 	rc = ena_com_update_nonadaptive_moderation_interval_rx(ena_dev,
 							       coalesce->rx_coalesce_usecs);
 	if (rc)
@@ -380,10 +373,13 @@ static int ena_set_coalesce(struct net_device *net_dev,
 
 	ena_update_rx_rings_intr_moderation(adapter);
 
-	if (!coalesce->use_adaptive_rx_coalesce) {
-		if (ena_com_get_adaptive_moderation_enabled(ena_dev))
-			ena_com_disable_adaptive_moderation(ena_dev);
-	}
+	if (coalesce->use_adaptive_rx_coalesce &&
+	    !ena_com_get_adaptive_moderation_enabled(ena_dev))
+		ena_com_enable_adaptive_moderation(ena_dev);
+
+	if (!coalesce->use_adaptive_rx_coalesce &&
+	    ena_com_get_adaptive_moderation_enabled(ena_dev))
+		ena_com_disable_adaptive_moderation(ena_dev);
 
 	return 0;
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2 net 0/2] fixes of interrupt moderation bugs
  2019-12-19 15:40 [PATCH V2 net 0/2] fixes of interrupt moderation bugs akiyano
  2019-12-19 15:40 ` [PATCH V2 net 1/2] net: ena: fix default tx interrupt moderation interval akiyano
  2019-12-19 15:40 ` [PATCH V2 net 2/2] net: ena: fix issues in setting interrupt moderation params in ethtool akiyano
@ 2019-12-21  5:42 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-12-21  5:42 UTC (permalink / raw)
  To: akiyano
  Cc: netdev, dwmw, zorik, matua, saeedb, msw, aliguori, nafea,
	gtzalik, netanel, alisaidi, benh, ndagan, shayagr, sameehj

From: <akiyano@amazon.com>
Date: Thu, 19 Dec 2019 17:40:54 +0200

> From: Arthur Kiyanovski <akiyano@amazon.com>
> 
> 
> Differences from V1:
> 1. Updated default tx interrupt moderation to 64us
> 2. Added "Fixes:" tags.
> 3. Removed cosmetic changes that are not relevant for these bug fixes
> 
> This patchset includes a couple of fixes of bugs in the implemenation of
> interrupt moderation.

I'll apply this series, but... why do you put empty lines between the Fixes
and other tags?  Please don't do that.

When people do stuff like this I have to ask, where did you see someone else
do this?  Where did you pick up this convention?

Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-21  5:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-19 15:40 [PATCH V2 net 0/2] fixes of interrupt moderation bugs akiyano
2019-12-19 15:40 ` [PATCH V2 net 1/2] net: ena: fix default tx interrupt moderation interval akiyano
2019-12-19 15:40 ` [PATCH V2 net 2/2] net: ena: fix issues in setting interrupt moderation params in ethtool akiyano
2019-12-21  5:42 ` [PATCH V2 net 0/2] fixes of interrupt moderation bugs David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).