diff mbox series

[f/j/m/n:linux-aws,1/1] net: ena: Enable DIM by default

Message ID 20240307183213.106423-2-philip.cox@canonical.com
State New
Headers show
Series aws: Backport latest ENA driver in upstream Linux to enable IRQ moderation | expand

Commit Message

Philip Cox March 7, 2024, 6:32 p.m. UTC
From: David Arinzon <darinzon@amazon.com>

BugLink: https://bugs.launchpad.net/bugs/2056475

Dynamic Interrupt Moderation (DIM) is a technique
designed to balance the need for timely data processing
with the desire to minimize CPU overhead.
Instead of generating an interrupt for every received
packet, the system can dynamically adjust the rate at
which interrupts are generated based on the incoming
traffic patterns.

Enabling DIM by default to improve the user experience.

DIM can be turned on/off through ethtool:
`ethtool -C <interface> adaptive-rx <on/off>`

Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: Osama Abboud <osamaabb@amazon.com>
Signed-off-by: David Arinzon <darinzon@amazon.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
(cherry picked from net-next commit 50d7a2660579889fba28b7e4543d4ce85aa2311b)
Signed-off-by: Philip Cox <philip.cox@canonical.com>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Andrei Gherzan March 18, 2024, 10:47 a.m. UTC | #1
On 24/03/07 01:32PM, Philip Cox wrote:
> From: David Arinzon <darinzon@amazon.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2056475
> 
> Dynamic Interrupt Moderation (DIM) is a technique
> designed to balance the need for timely data processing
> with the desire to minimize CPU overhead.
> Instead of generating an interrupt for every received
> packet, the system can dynamically adjust the rate at
> which interrupts are generated based on the incoming
> traffic patterns.
> 
> Enabling DIM by default to improve the user experience.
> 
> DIM can be turned on/off through ethtool:
> `ethtool -C <interface> adaptive-rx <on/off>`
> 
> Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
> Signed-off-by: Osama Abboud <osamaabb@amazon.com>
> Signed-off-by: David Arinzon <darinzon@amazon.com>
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> (cherry picked from net-next commit 50d7a2660579889fba28b7e4543d4ce85aa2311b)

The "cherry picked" line doesn't match the expected format in the docs:

(backported from commit <sha1> <upstream repo name>)

> Signed-off-by: Philip Cox <philip.cox@canonical.com>
> ---
>  drivers/net/ethernet/amazon/ena/ena_netdev.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> index 1c0a7828d397..adca474828e8 100644
> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> @@ -2134,6 +2134,12 @@ int ena_up(struct ena_adapter *adapter)
>  	 */
>  	ena_init_napi_in_range(adapter, 0, io_queue_count);
>  
> +	/* Enabling DIM needs to happen before enabling IRQs since DIM
> +	 * is run from napi routine
> +	 */
> +	if (ena_com_interrupt_moderation_supported(adapter->ena_dev))
> +		ena_com_enable_adaptive_moderation(adapter->ena_dev);
> +
>  	rc = ena_request_io_irq(adapter);
>  	if (rc)
>  		goto err_req_irq;
diff mbox series

Patch

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 1c0a7828d397..adca474828e8 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -2134,6 +2134,12 @@  int ena_up(struct ena_adapter *adapter)
 	 */
 	ena_init_napi_in_range(adapter, 0, io_queue_count);
 
+	/* Enabling DIM needs to happen before enabling IRQs since DIM
+	 * is run from napi routine
+	 */
+	if (ena_com_interrupt_moderation_supported(adapter->ena_dev))
+		ena_com_enable_adaptive_moderation(adapter->ena_dev);
+
 	rc = ena_request_io_irq(adapter);
 	if (rc)
 		goto err_req_irq;