From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, stephen@networkplumber.org,
bruce.richardson@intel.com, fengchengwen@huawei.com,
longli@microsoft.com, hemant.agrawal@nxp.com,
Rosen Xu <rosen.xu@altera.com>
Subject: [PATCH v4 08/12] bus/ifpga: allocate interrupt during probing
Date: Wed, 24 Jun 2026 12:43:19 +0200 [thread overview]
Message-ID: <20260624104324.3576408-9-david.marchand@redhat.com> (raw)
In-Reply-To: <20260624104324.3576408-1-david.marchand@redhat.com>
Allocating the interrupt handle is a waste of memory if no device is
probed later (like for example, if a allowlist is passed).
Instead, allocate this handle at the time probe_device is called.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/bus/ifpga/ifpga_bus.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 2c22329f65..af77d69ef6 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -144,14 +144,6 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
afu_dev->id.uuid.uuid_high = 0;
afu_dev->id.port = afu_pr_conf.afu_id.port;
- /* Allocate interrupt instance */
- afu_dev->intr_handle =
- rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE);
- if (afu_dev->intr_handle == NULL) {
- IFPGA_BUS_ERR("Failed to allocate intr handle");
- goto end;
- }
-
if (rawdev->dev_ops && rawdev->dev_ops->dev_info_get)
rawdev->dev_ops->dev_info_get(rawdev, afu_dev, sizeof(*afu_dev));
@@ -177,10 +169,7 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
end:
rte_kvargs_free(kvlist);
free(path);
- if (afu_dev) {
- rte_intr_instance_free(afu_dev->intr_handle);
- free(afu_dev);
- }
+ free(afu_dev);
return NULL;
}
@@ -272,8 +261,22 @@ ifpga_probe_device(struct rte_driver *drv, struct rte_device *dev)
{
struct rte_afu_device *afu_dev = RTE_BUS_DEVICE(dev, *afu_dev);
struct rte_afu_driver *afu_drv = RTE_BUS_DRIVER(drv, *afu_drv);
+ int ret;
+
+ afu_dev->intr_handle =
+ rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE);
+ if (afu_dev->intr_handle == NULL) {
+ IFPGA_BUS_ERR("Failed to allocate intr handle");
+ return -ENOMEM;
+ }
+
+ ret = afu_drv->probe(afu_dev);
+ if (ret != 0) {
+ rte_intr_instance_free(afu_dev->intr_handle);
+ afu_dev->intr_handle = NULL;
+ }
- return afu_drv->probe(afu_dev);
+ return ret;
}
/*
--
2.54.0
next prev parent reply other threads:[~2026-06-24 10:44 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 9:45 [PATCH 00/13] Bus cleanup infrastructure and fixes David Marchand
2026-06-11 9:45 ` [PATCH 01/13] bus: fix reference to plug callback David Marchand
2026-06-11 9:45 ` [PATCH 02/13] dma/idxd: remove next pointer in bus specific device David Marchand
2026-06-11 9:45 ` [PATCH 03/13] bus/vdev: remove driver setting in probe David Marchand
2026-06-11 9:45 ` [PATCH 04/13] drivers/bus: cleanup device freeing in NXP bus David Marchand
2026-06-11 9:45 ` [PATCH 05/13] drivers/bus: allocate interrupt during probing " David Marchand
2026-06-11 9:45 ` [PATCH 06/13] bus/pci: fix mapping leak in bus cleanup David Marchand
2026-06-11 9:45 ` [PATCH 07/13] bus/vmbus: fix interrupt leak in cleanup David Marchand
2026-06-11 9:45 ` [PATCH 08/13] bus/vmbus: allocate interrupt during probing David Marchand
2026-06-15 19:13 ` [EXTERNAL] " Long Li
2026-06-11 9:45 ` [PATCH 09/13] bus: align unplug with device probe David Marchand
2026-06-11 9:45 ` [PATCH 10/13] bus: implement cleanup in EAL David Marchand
2026-06-11 9:45 ` [PATCH 11/13] bus/dpaa: support unplug David Marchand
2026-06-11 9:45 ` [PATCH 12/13] bus/vmbus: store name in bus specific device David Marchand
2026-06-11 9:45 ` [PATCH 13/13] bus/vmbus: support unplug David Marchand
2026-06-11 10:09 ` [PATCH 00/13] Bus cleanup infrastructure and fixes David Marchand
2026-06-15 19:14 ` [EXTERNAL] " Long Li
2026-06-15 23:55 ` Long Li
2026-06-16 6:55 ` David Marchand
2026-06-16 7:47 ` David Marchand
2026-06-17 9:16 ` Hemant Agrawal
2026-06-18 8:39 ` David Marchand
2026-06-18 15:28 ` David Marchand
2026-06-18 15:28 ` [PATCH v2 00/10] " David Marchand
2026-06-18 15:28 ` [PATCH v2 01/10] bus: fix reference to plug callback David Marchand
2026-06-22 9:49 ` Bruce Richardson
2026-06-18 15:28 ` [PATCH v2 02/10] dma/idxd: remove next pointer in bus specific device David Marchand
2026-06-22 9:48 ` Bruce Richardson
2026-06-18 15:28 ` [PATCH v2 03/10] bus/vdev: remove driver setting in probe David Marchand
2026-06-18 15:28 ` [PATCH v2 04/10] bus/pci: fix mapping leak in bus cleanup David Marchand
2026-06-18 15:28 ` [PATCH v2 05/10] bus/vmbus: fix interrupt leak in cleanup David Marchand
2026-06-19 22:04 ` [EXTERNAL] " Long Li
2026-06-18 15:28 ` [PATCH v2 06/10] bus/vmbus: allocate interrupt during probing David Marchand
2026-06-19 22:05 ` [EXTERNAL] " Long Li
2026-06-18 15:28 ` [PATCH v2 07/10] bus: align unplug with device probe David Marchand
2026-06-22 10:19 ` Bruce Richardson
2026-06-22 12:44 ` David Marchand
2026-06-18 15:28 ` [PATCH v2 08/10] bus: implement cleanup in EAL David Marchand
2026-06-22 10:26 ` Bruce Richardson
2026-06-18 15:28 ` [PATCH v2 09/10] bus/vmbus: store name in bus specific device David Marchand
2026-06-22 10:28 ` Bruce Richardson
2026-06-18 15:28 ` [PATCH v2 10/10] bus/vmbus: support unplug David Marchand
2026-06-23 10:54 ` [PATCH v3 00/11] Bus cleanup infrastructure and fixes David Marchand
2026-06-23 10:54 ` [PATCH v3 01/11] bus: fix reference to plug callback David Marchand
2026-06-24 1:14 ` fengchengwen
2026-06-23 10:54 ` [PATCH v3 02/11] dma/idxd: remove next pointer in bus specific device David Marchand
2026-06-23 10:54 ` [PATCH v3 03/11] bus/vdev: remove driver setting in probe David Marchand
2026-06-24 1:15 ` fengchengwen
2026-06-23 10:54 ` [PATCH v3 04/11] bus/pci: fix mapping leak in bus cleanup David Marchand
2026-06-24 1:24 ` fengchengwen
2026-06-24 6:51 ` David Marchand
2026-06-24 9:56 ` David Marchand
2026-06-23 10:54 ` [PATCH v3 05/11] bus/vmbus: fix interrupt leak in cleanup David Marchand
2026-06-23 10:54 ` [PATCH v3 06/11] bus/vmbus: allocate interrupt during probing David Marchand
2026-06-23 10:54 ` [PATCH v3 07/11] bus/ifpga: " David Marchand
2026-06-23 11:25 ` Bruce Richardson
2026-06-23 10:54 ` [PATCH v3 08/11] bus: align unplug with device probe David Marchand
2026-06-23 10:54 ` [PATCH v3 09/11] bus: implement cleanup in EAL David Marchand
2026-06-23 10:54 ` [PATCH v3 10/11] bus/vmbus: store name in bus specific device David Marchand
2026-06-23 21:30 ` [EXTERNAL] " Long Li
2026-06-23 10:54 ` [PATCH v3 11/11] bus/vmbus: support unplug David Marchand
2026-06-23 21:30 ` [EXTERNAL] " Long Li
2026-06-24 10:43 ` [PATCH v4 00/12] Bus cleanup infrastructure and fixes David Marchand
2026-06-24 10:43 ` [PATCH v4 01/12] bus: fix reference to plug callback David Marchand
2026-06-24 10:43 ` [PATCH v4 02/12] dma/idxd: remove next pointer in bus specific device David Marchand
2026-06-24 10:43 ` [PATCH v4 03/12] bus/vdev: remove driver setting in probe David Marchand
2026-06-24 10:43 ` [PATCH v4 04/12] vdpa/nfp: fix double PCI unmap on unplug David Marchand
2026-06-24 10:43 ` [PATCH v4 05/12] bus/pci: fix mapping leak in bus cleanup David Marchand
2026-06-24 10:43 ` [PATCH v4 06/12] bus/vmbus: fix interrupt leak in cleanup David Marchand
2026-06-24 10:43 ` [PATCH v4 07/12] bus/vmbus: allocate interrupt during probing David Marchand
2026-06-24 10:43 ` David Marchand [this message]
2026-06-24 10:43 ` [PATCH v4 09/12] bus: align unplug with device probe David Marchand
2026-06-24 10:43 ` [PATCH v4 10/12] bus: implement cleanup in EAL David Marchand
2026-06-24 10:43 ` [PATCH v4 11/12] bus/vmbus: store name in bus specific device David Marchand
2026-06-24 10:43 ` [PATCH v4 12/12] bus/vmbus: support unplug David Marchand
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=20260624104324.3576408-9-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=hemant.agrawal@nxp.com \
--cc=longli@microsoft.com \
--cc=rosen.xu@altera.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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