vdpa/mlx5: refactor with common interrupt management API

Message ID 20220705134452.479941-1-spiked@nvidia.com (mailing list archive)
State Accepted, archived
Headers
Series vdpa/mlx5: refactor with common interrupt management API |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/intel-Testing success Testing PASS

Commit Message

Spike Du July 5, 2022, 1:44 p.m. UTC
  Replace vdpa interrupt handle creation logic with common interrupt
management API.

Signed-off-by: Spike Du <spiked@nvidia.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)
  

Comments

Thomas Monjalon July 5, 2022, 6:17 p.m. UTC | #1
05/07/2022 15:44, Spike Du:
> Replace vdpa interrupt handle creation logic with common interrupt
> management API.
> 
> Signed-off-by: Spike Du <spiked@nvidia.com>

Applied, thanks.
  

Patch

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index ed17fb5..607e290 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -492,30 +492,13 @@ 
 mlx5_vdpa_virtq_doorbell_setup(struct mlx5_vdpa_virtq *virtq,
 		struct rte_vhost_vring *vq, int index)
 {
-	virtq->intr_handle =
-		rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_SHARED);
+	virtq->intr_handle = mlx5_os_interrupt_handler_create(
+				  RTE_INTR_INSTANCE_F_SHARED, false,
+				  vq->kickfd, mlx5_vdpa_virtq_kick_handler, virtq);
 	if (virtq->intr_handle == NULL) {
-		DRV_LOG(ERR, "Fail to allocate intr_handle");
+		DRV_LOG(ERR, "Fail to allocate intr_handle for virtq %d.", index);
 		return -1;
 	}
-	if (rte_intr_fd_set(virtq->intr_handle, vq->kickfd))
-		return -1;
-	if (rte_intr_fd_get(virtq->intr_handle) == -1) {
-		DRV_LOG(WARNING, "Virtq %d kickfd is invalid.", index);
-	} else {
-		if (rte_intr_type_set(virtq->intr_handle,
-			RTE_INTR_HANDLE_EXT))
-			return -1;
-		if (rte_intr_callback_register(virtq->intr_handle,
-			mlx5_vdpa_virtq_kick_handler, virtq)) {
-			(void)rte_intr_fd_set(virtq->intr_handle, -1);
-			DRV_LOG(ERR, "Failed to register virtq %d interrupt.",
-				index);
-			return -1;
-		}
-		DRV_LOG(DEBUG, "Register fd %d interrupt for virtq %d.",
-			rte_intr_fd_get(virtq->intr_handle), index);
-	}
 	return 0;
 }