From: Spike Du <spiked@nvidia.com>
To: <matan@nvidia.com>, <viacheslavo@nvidia.com>, <orika@nvidia.com>,
<thomas@monjalon.net>
Cc: <dev@dpdk.org>, <rasland@nvidia.com>
Subject: [PATCH] vdpa/mlx5: refactor with common interrupt management API
Date: Tue, 5 Jul 2022 16:44:51 +0300 [thread overview]
Message-ID: <20220705134452.479941-1-spiked@nvidia.com> (raw)
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(-)
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;
}
--
1.8.3.1
next reply other threads:[~2022-07-05 13:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 13:44 Spike Du [this message]
2022-07-05 18:17 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220705134452.479941-1-spiked@nvidia.com \
--to=spiked@nvidia.com \
--cc=dev@dpdk.org \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=rasland@nvidia.com \
--cc=thomas@monjalon.net \
--cc=viacheslavo@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).