diff mbox series

[v2,1/2] net/virtio: reconfigure LSC handler when required

Message ID 20210831155411.17672-2-david.marchand@redhat.com (mailing list archive)
State Accepted
Delegated to: Maxime Coquelin
Headers show
Series virtio-user interrupt fixes | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Aug. 31, 2021, 3:54 p.m. UTC
There is no reason to re-register a interrupt handler for LSC if this
feature was not requested in the first place.
A simple usecase is when asking for Rx interrupts without LSC interrupt.

Fixes: 26b683b4f7d0 ("net/virtio: setup Rx queue interrupts")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/virtio/virtio_ethdev.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Comments

Maxime Coquelin Sept. 14, 2021, 8:36 a.m. UTC | #1
On 8/31/21 5:54 PM, David Marchand wrote:
> There is no reason to re-register a interrupt handler for LSC if this
> feature was not requested in the first place.
> A simple usecase is when asking for Rx interrupts without LSC interrupt.
> 
> Fixes: 26b683b4f7d0 ("net/virtio: setup Rx queue interrupts")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index e58085a2c9..314a291e8c 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1684,13 +1684,15 @@ virtio_configure_intr(struct rte_eth_dev *dev)
>  		}
>  	}
>  
> -	/* Re-register callback to update max_intr */
> -	rte_intr_callback_unregister(dev->intr_handle,
> -				     virtio_interrupt_handler,
> -				     dev);
> -	rte_intr_callback_register(dev->intr_handle,
> -				   virtio_interrupt_handler,
> -				   dev);
> +	if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
> +		/* Re-register callback to update max_intr */
> +		rte_intr_callback_unregister(dev->intr_handle,
> +					     virtio_interrupt_handler,
> +					     dev);
> +		rte_intr_callback_register(dev->intr_handle,
> +					   virtio_interrupt_handler,
> +					   dev);
> +	}
>  
>  	/* DO NOT try to remove this! This function will enable msix, or QEMU
>  	 * will encounter SIGSEGV when DRIVER_OK is sent.
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
diff mbox series

Patch

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index e58085a2c9..314a291e8c 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1684,13 +1684,15 @@  virtio_configure_intr(struct rte_eth_dev *dev)
 		}
 	}
 
-	/* Re-register callback to update max_intr */
-	rte_intr_callback_unregister(dev->intr_handle,
-				     virtio_interrupt_handler,
-				     dev);
-	rte_intr_callback_register(dev->intr_handle,
-				   virtio_interrupt_handler,
-				   dev);
+	if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
+		/* Re-register callback to update max_intr */
+		rte_intr_callback_unregister(dev->intr_handle,
+					     virtio_interrupt_handler,
+					     dev);
+		rte_intr_callback_register(dev->intr_handle,
+					   virtio_interrupt_handler,
+					   dev);
+	}
 
 	/* DO NOT try to remove this! This function will enable msix, or QEMU
 	 * will encounter SIGSEGV when DRIVER_OK is sent.