From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org
Cc: stephen@networkplumber.org, Hemant Agrawal <hemant.agrawal@nxp.com>
Subject: [PATCH 3/3] bus/fslmc: add support for hotplug of dpni
Date: Thu, 6 Nov 2025 22:08:07 +0530 [thread overview]
Message-ID: <20251106163807.201451-3-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20251106163807.201451-1-hemant.agrawal@nxp.com>
This patch implements the plug and unplug function to support
attach/detach of dpni interfaces.
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
drivers/bus/fslmc/fslmc_bus.c | 56 +++++++++++++++++++++++++++++++----
1 file changed, 50 insertions(+), 6 deletions(-)
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 49c61c9d2d..4529ec5085 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -589,17 +589,61 @@ rte_dpaa2_get_iommu_class(void)
}
static int
-fslmc_bus_plug(struct rte_device *dev __rte_unused)
+fslmc_bus_plug(struct rte_device *rte_dev)
{
- /* No operation is performed while plugging the device */
- return 0;
+ int ret = 0;
+ struct rte_dpaa2_device *dev = container_of(rte_dev,
+ struct rte_dpaa2_device, device);
+ struct rte_dpaa2_driver *drv;
+
+ TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
+ ret = rte_fslmc_match(drv, dev);
+ if (ret)
+ continue;
+
+ if (!drv->probe)
+ continue;
+
+ if (rte_dev_is_probed(&dev->device))
+ continue;
+
+ if (dev->device.devargs &&
+ dev->device.devargs->policy == RTE_DEV_BLOCKED) {
+ DPAA2_BUS_DEBUG("%s Blocked, skipping",
+ dev->device.name);
+ continue;
+ }
+
+ ret = drv->probe(drv, dev);
+ if (ret) {
+ DPAA2_BUS_ERR("Unable to probe");
+ } else {
+ dev->driver = drv;
+ dev->device.driver = &drv->driver;
+ DPAA2_BUS_INFO("%s Plugged", dev->device.name);
+ }
+ break;
+ }
+
+ return ret;
}
static int
-fslmc_bus_unplug(struct rte_device *dev __rte_unused)
+fslmc_bus_unplug(struct rte_device *rte_dev)
{
- /* No operation is performed while unplugging the device */
- return 0;
+ struct rte_dpaa2_device *dev = container_of(rte_dev,
+ struct rte_dpaa2_device, device);
+ struct rte_dpaa2_driver *drv = dev->driver;
+
+ if (drv && drv->remove) {
+ drv->remove(dev);
+ dev->driver = NULL;
+ dev->device.driver = NULL;
+ DPAA2_BUS_INFO("%s Un-Plugged", dev->device.name);
+ return 0;
+ }
+
+ return -ENODEV;
}
static void *
--
2.25.1
prev parent reply other threads:[~2025-11-06 16:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 16:38 [PATCH 1/3] net/dpaa2: fix duplicate calling of dpaa2 dev close Hemant Agrawal
2025-11-06 16:38 ` [PATCH 2/3] net/dpaa2: clear active VDQ state when freeing Rx queues Hemant Agrawal
2025-11-06 19:29 ` Stephen Hemminger
2025-11-06 16:38 ` Hemant Agrawal [this message]
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=20251106163807.201451-3-hemant.agrawal@nxp.com \
--to=hemant.agrawal@nxp.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
/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).