[v2] net/virtio: fix link state interrupt vector setting

Message ID 20231023014613.930292-1-wenwux.ma@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series [v2] net/virtio: fix link state interrupt vector setting |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Ma, WenwuX Oct. 23, 2023, 1:46 a.m. UTC
  The settings of the vector for link state interrupts
should be done before the initialization of the device
is completed.

Fixes: ee85024cf5f7 ("net/virtio: complete init stage at the right place")
Cc: stable@dpdk.org

Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
Tested-by: Wei Ling <weix.ling@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
v2:
 - rewording of the title

---
 drivers/net/virtio/virtio_ethdev.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
  

Comments

Maxime Coquelin Oct. 25, 2023, 12:23 p.m. UTC | #1
On 10/23/23 03:46, Wenwu Ma wrote:
> The settings of the vector for link state interrupts
> should be done before the initialization of the device
> is completed.
> 
> Fixes: ee85024cf5f7 ("net/virtio: complete init stage at the right place")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> Tested-by: Wei Ling <weix.ling@intel.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> v2:
>   - rewording of the title
> 
> ---
>   drivers/net/virtio/virtio_ethdev.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 3ab56ef769..c2c0a1a111 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1912,6 +1912,14 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
>   		}
>   	}
>   
> +	if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
> +		/* Enable vector (0) for Link State Interrupt */
> +		if (VIRTIO_OPS(hw)->set_config_irq(hw, 0) ==
> +				VIRTIO_MSI_NO_VECTOR) {
> +			PMD_DRV_LOG(ERR, "failed to set config vector");
> +			return -EBUSY;
> +		}
> +
>   	virtio_reinit_complete(hw);
>   
>   	return 0;
> @@ -2237,14 +2245,6 @@ virtio_dev_configure(struct rte_eth_dev *dev)
>   	hw->has_tx_offload = tx_offload_enabled(hw);
>   	hw->has_rx_offload = rx_offload_enabled(hw);
>   
> -	if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
> -		/* Enable vector (0) for Link State Interrupt */
> -		if (VIRTIO_OPS(hw)->set_config_irq(hw, 0) ==
> -				VIRTIO_MSI_NO_VECTOR) {
> -			PMD_DRV_LOG(ERR, "failed to set config vector");
> -			return -EBUSY;
> -		}
> -
>   	if (virtio_with_packed_queue(hw)) {
>   #if defined(RTE_ARCH_X86_64) && defined(CC_AVX512_SUPPORT)
>   		if ((hw->use_vec_rx || hw->use_vec_tx) &&

Applied to next-virtio/for-next-net

Thanks,
Maxime
  

Patch

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 3ab56ef769..c2c0a1a111 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1912,6 +1912,14 @@  virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
 		}
 	}
 
+	if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
+		/* Enable vector (0) for Link State Interrupt */
+		if (VIRTIO_OPS(hw)->set_config_irq(hw, 0) ==
+				VIRTIO_MSI_NO_VECTOR) {
+			PMD_DRV_LOG(ERR, "failed to set config vector");
+			return -EBUSY;
+		}
+
 	virtio_reinit_complete(hw);
 
 	return 0;
@@ -2237,14 +2245,6 @@  virtio_dev_configure(struct rte_eth_dev *dev)
 	hw->has_tx_offload = tx_offload_enabled(hw);
 	hw->has_rx_offload = rx_offload_enabled(hw);
 
-	if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
-		/* Enable vector (0) for Link State Interrupt */
-		if (VIRTIO_OPS(hw)->set_config_irq(hw, 0) ==
-				VIRTIO_MSI_NO_VECTOR) {
-			PMD_DRV_LOG(ERR, "failed to set config vector");
-			return -EBUSY;
-		}
-
 	if (virtio_with_packed_queue(hw)) {
 #if defined(RTE_ARCH_X86_64) && defined(CC_AVX512_SUPPORT)
 		if ((hw->use_vec_rx || hw->use_vec_tx) &&