DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/5] Cleanup rte_dpaa2_device
@ 2025-11-08 15:32 David Marchand
  2025-11-08 15:32 ` [PATCH 1/5] crypto/dpaa2_sec: remove crypto device in bus device David Marchand
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: David Marchand @ 2025-11-08 15:32 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, maxime

The rte_dpaa2_device object keeps track of a device class object
(cryptodev, dmadev, ethdev, rawdev) which is a layer violation.

Make use of the device class respective infrastructure and remove those
back references.

Disclaimer: this series is untested as I don't have the hardware.
I only based those changes on look at the code and other drivers.


-- 
David Marchand

David Marchand (5):
  crypto/dpaa2_sec: remove crypto device in bus device
  dma/dpaa2: remove DMA device in bus device
  net/dpaa2: remove dead code in loopback mode
  net/dpaa2: remove ethdev device in bus device
  bus/fslmc: remove raw device in bus device

 drivers/bus/fslmc/bus_fslmc_driver.h        |  6 ---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c |  8 ++--
 drivers/dma/dpaa2/dpaa2_qdma.c              |  9 ++--
 drivers/net/dpaa2/dpaa2_ethdev.c            |  6 ++-
 drivers/net/dpaa2/dpaa2_ethdev.h            |  6 ---
 drivers/net/dpaa2/dpaa2_recycle.c           | 50 ---------------------
 6 files changed, 14 insertions(+), 71 deletions(-)

-- 
2.51.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] crypto/dpaa2_sec: remove crypto device in bus device
  2025-11-08 15:32 [PATCH 0/5] Cleanup rte_dpaa2_device David Marchand
@ 2025-11-08 15:32 ` David Marchand
  2025-11-08 15:32 ` [PATCH 2/5] dma/dpaa2: remove DMA " David Marchand
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2025-11-08 15:32 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, maxime, Sachin Saxena, Gagandeep Singh

Calling rte_cryptodev_pmd_get_named_dev() is enough to retrieve the
crypto device object.

This leaves no user of the cryptodev field in the fslmc device object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/fslmc/bus_fslmc_driver.h        | 1 -
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 8 +++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index b6a6238a01..45c7a519f9 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -99,7 +99,6 @@ struct rte_dpaa2_device {
 	struct rte_device device;           /**< Inherit core device */
 	union {
 		struct rte_eth_dev *eth_dev;        /**< ethernet device */
-		struct rte_cryptodev *cryptodev;    /**< Crypto Device */
 		struct rte_dma_dev *dmadev;          /**< DMA Device */
 		struct rte_rawdev *rawdev;          /**< Raw Device */
 	};
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index ca10d88da7..698548e6ea 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -4503,8 +4503,6 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
 		return -ENOMEM;
 	}
 
-	dpaa2_dev->cryptodev = cryptodev;
-
 	if (dpaa2_svr_family == SVR_LX2160A)
 		rta_set_sec_era(RTA_SEC_ERA_10);
 	else
@@ -4526,10 +4524,14 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
 static int
 cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
 {
+	char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
 	struct rte_cryptodev *cryptodev;
 	int ret;
 
-	cryptodev = dpaa2_dev->cryptodev;
+	snprintf(cryptodev_name, sizeof(cryptodev_name), "dpsec-%d",
+			dpaa2_dev->object_id);
+
+	cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
 	if (cryptodev == NULL)
 		return -ENODEV;
 
-- 
2.51.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/5] dma/dpaa2: remove DMA device in bus device
  2025-11-08 15:32 [PATCH 0/5] Cleanup rte_dpaa2_device David Marchand
  2025-11-08 15:32 ` [PATCH 1/5] crypto/dpaa2_sec: remove crypto device in bus device David Marchand
@ 2025-11-08 15:32 ` David Marchand
  2025-11-08 15:32 ` [PATCH 3/5] net/dpaa2: remove dead code in loopback mode David Marchand
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2025-11-08 15:32 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, maxime, Sachin Saxena, Gagandeep Singh

A driver .dev_close op is automatically called when releasing a dma
device.
Move device specific unitialisation in this driver .dev_close op.

This leaves no user of the dmadev field in the fslmc device object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/fslmc/bus_fslmc_driver.h | 1 -
 drivers/dma/dpaa2/dpaa2_qdma.c       | 9 +++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 45c7a519f9..efa88754a7 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -99,7 +99,6 @@ struct rte_dpaa2_device {
 	struct rte_device device;           /**< Inherit core device */
 	union {
 		struct rte_eth_dev *eth_dev;        /**< ethernet device */
-		struct rte_dma_dev *dmadev;          /**< DMA Device */
 		struct rte_rawdev *rawdev;          /**< Raw Device */
 	};
 	enum rte_dpaa2_dev_type dev_type;   /**< Device Type */
diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c
index 4be43d6bd9..beca464c72 100644
--- a/drivers/dma/dpaa2/dpaa2_qdma.c
+++ b/drivers/dma/dpaa2/dpaa2_qdma.c
@@ -1455,6 +1455,9 @@ dpaa2_qdma_stop(struct rte_dma_dev *dev)
 	return 0;
 }
 
+static int
+dpaa2_dpdmai_dev_uninit(struct rte_dma_dev *dev);
+
 static int
 dpaa2_qdma_close(struct rte_dma_dev *dev)
 {
@@ -1505,6 +1508,8 @@ dpaa2_qdma_close(struct rte_dma_dev *dev)
 	/* Reset QDMA device structure */
 	qdma_dev->num_vqs = 0;
 
+	dpaa2_dpdmai_dev_uninit(dev);
+
 	return 0;
 }
 
@@ -1703,7 +1708,6 @@ dpaa2_qdma_probe(struct rte_dpaa2_driver *dpaa2_drv,
 		return -EINVAL;
 	}
 
-	dpaa2_dev->dmadev = dmadev;
 	dmadev->dev_ops = &dpaa2_qdma_ops;
 	dmadev->device = &dpaa2_dev->device;
 	dmadev->fp_obj->dev_private = dmadev->data->dev_private;
@@ -1727,13 +1731,10 @@ dpaa2_qdma_probe(struct rte_dpaa2_driver *dpaa2_drv,
 static int
 dpaa2_qdma_remove(struct rte_dpaa2_device *dpaa2_dev)
 {
-	struct rte_dma_dev *dmadev = dpaa2_dev->dmadev;
 	int ret;
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	dpaa2_dpdmai_dev_uninit(dmadev);
-
 	ret = rte_dma_pmd_release(dpaa2_dev->device.name);
 	if (ret)
 		DPAA2_QDMA_ERR("Device cleanup failed");
-- 
2.51.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/5] net/dpaa2: remove dead code in loopback mode
  2025-11-08 15:32 [PATCH 0/5] Cleanup rte_dpaa2_device David Marchand
  2025-11-08 15:32 ` [PATCH 1/5] crypto/dpaa2_sec: remove crypto device in bus device David Marchand
  2025-11-08 15:32 ` [PATCH 2/5] dma/dpaa2: remove DMA " David Marchand
@ 2025-11-08 15:32 ` David Marchand
  2025-11-08 15:32 ` [PATCH 4/5] net/dpaa2: remove ethdev device in bus device David Marchand
  2025-11-08 15:32 ` [PATCH 5/5] bus/fslmc: remove raw " David Marchand
  4 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2025-11-08 15:32 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, maxime, Sachin Saxena, Jun Yang

This code was never used.

Fixes: f023d059769f ("net/dpaa2: support recycle loopback port")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.h  |  6 ----
 drivers/net/dpaa2/dpaa2_recycle.c | 50 -------------------------------
 2 files changed, 56 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 87a94bc15b..86b3022ddb 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -531,12 +531,6 @@ int dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev);
 int dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev);
 int dpaa2_soft_parser_loaded(void);
 
-int dpaa2_dev_recycle_qp_setup(struct rte_dpaa2_device *dpaa2_dev,
-	uint16_t qidx, uint64_t cntx,
-	eth_rx_burst_t tx_lpbk, eth_tx_burst_t rx_lpbk,
-	struct dpaa2_queue **txq,
-	struct dpaa2_queue **rxq);
-
 void
 dpaa2_dev_mac_setup_stats(struct rte_eth_dev *dev);
 
diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
index 94a7e2a020..d1e21dd4d1 100644
--- a/drivers/net/dpaa2/dpaa2_recycle.c
+++ b/drivers/net/dpaa2/dpaa2_recycle.c
@@ -730,53 +730,3 @@ dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev)
 
 	return ret;
 }
-
-int
-dpaa2_dev_recycle_qp_setup(struct rte_dpaa2_device *dpaa2_dev,
-	uint16_t qidx, uint64_t cntx,
-	eth_rx_burst_t tx_lpbk, eth_tx_burst_t rx_lpbk,
-	struct dpaa2_queue **txq,
-	struct dpaa2_queue **rxq)
-{
-	struct rte_eth_dev *dev;
-	struct rte_eth_dev_data *data;
-	struct dpaa2_queue *txq_tmp;
-	struct dpaa2_queue *rxq_tmp;
-	struct dpaa2_dev_priv *priv;
-
-	dev = dpaa2_dev->eth_dev;
-	data = dev->data;
-	priv = data->dev_private;
-
-	if (!(priv->flags & DPAA2_TX_LOOPBACK_MODE) &&
-		(tx_lpbk || rx_lpbk)) {
-		DPAA2_PMD_ERR("%s is NOT recycle device!", data->name);
-
-		return -EINVAL;
-	}
-
-	if (qidx >= data->nb_rx_queues || qidx >= data->nb_tx_queues)
-		return -EINVAL;
-
-	rte_spinlock_lock(&priv->lpbk_qp_lock);
-
-	if (tx_lpbk)
-		dev->tx_pkt_burst = tx_lpbk;
-
-	if (rx_lpbk)
-		dev->rx_pkt_burst = rx_lpbk;
-
-	txq_tmp = data->tx_queues[qidx];
-	txq_tmp->lpbk_cntx = cntx;
-	rxq_tmp = data->rx_queues[qidx];
-	rxq_tmp->lpbk_cntx = cntx;
-
-	if (txq)
-		*txq = txq_tmp;
-	if (rxq)
-		*rxq = rxq_tmp;
-
-	rte_spinlock_unlock(&priv->lpbk_qp_lock);
-
-	return 0;
-}
-- 
2.51.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/5] net/dpaa2: remove ethdev device in bus device
  2025-11-08 15:32 [PATCH 0/5] Cleanup rte_dpaa2_device David Marchand
                   ` (2 preceding siblings ...)
  2025-11-08 15:32 ` [PATCH 3/5] net/dpaa2: remove dead code in loopback mode David Marchand
@ 2025-11-08 15:32 ` David Marchand
  2025-11-08 15:32 ` [PATCH 5/5] bus/fslmc: remove raw " David Marchand
  4 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2025-11-08 15:32 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, maxime, Sachin Saxena

Calling rte_eth_dev_allocated() is enough to retrieve the
ethdev device object.

This leaves no user of the ethdev field in the fslmc device object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/fslmc/bus_fslmc_driver.h | 1 -
 drivers/net/dpaa2/dpaa2_ethdev.c     | 6 ++++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index efa88754a7..094f885f59 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -98,7 +98,6 @@ struct rte_dpaa2_device {
 	TAILQ_ENTRY(rte_dpaa2_device) next; /**< Next probed DPAA2 device. */
 	struct rte_device device;           /**< Inherit core device */
 	union {
-		struct rte_eth_dev *eth_dev;        /**< ethernet device */
 		struct rte_rawdev *rawdev;          /**< Raw Device */
 	};
 	enum rte_dpaa2_dev_type dev_type;   /**< Device Type */
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 7da32ce856..2a26a02cb4 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -3320,7 +3320,6 @@ rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,
 
 	eth_dev->device = &dpaa2_dev->device;
 
-	dpaa2_dev->eth_dev = eth_dev;
 	eth_dev->data->rx_mbuf_alloc_failed = 0;
 
 	if (dpaa2_drv->drv_flags & RTE_DPAA2_DRV_INTR_LSC)
@@ -3349,7 +3348,10 @@ rte_dpaa2_remove(struct rte_dpaa2_device *dpaa2_dev)
 	struct rte_eth_dev *eth_dev;
 	int ret;
 
-	eth_dev = dpaa2_dev->eth_dev;
+	eth_dev = rte_eth_dev_allocated(dpaa2_dev->device.name);
+	if (!eth_dev)
+		return 0;
+
 	dpaa2_dev_close(eth_dev);
 	dpaa2_valid_dev--;
 	if (!dpaa2_valid_dev)
-- 
2.51.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 5/5] bus/fslmc: remove raw device in bus device
  2025-11-08 15:32 [PATCH 0/5] Cleanup rte_dpaa2_device David Marchand
                   ` (3 preceding siblings ...)
  2025-11-08 15:32 ` [PATCH 4/5] net/dpaa2: remove ethdev device in bus device David Marchand
@ 2025-11-08 15:32 ` David Marchand
  4 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2025-11-08 15:32 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, maxime, Sachin Saxena

There is no user of this field.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/fslmc/bus_fslmc_driver.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 094f885f59..89abc3c486 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -97,9 +97,6 @@ enum rte_dpaa2_dev_type {
 struct rte_dpaa2_device {
 	TAILQ_ENTRY(rte_dpaa2_device) next; /**< Next probed DPAA2 device. */
 	struct rte_device device;           /**< Inherit core device */
-	union {
-		struct rte_rawdev *rawdev;          /**< Raw Device */
-	};
 	enum rte_dpaa2_dev_type dev_type;   /**< Device Type */
 	uint16_t object_id;                 /**< DPAA2 Object ID */
 	enum rte_dpaa2_dev_type ep_dev_type;   /**< Endpoint Device Type */
-- 
2.51.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-08 15:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-08 15:32 [PATCH 0/5] Cleanup rte_dpaa2_device David Marchand
2025-11-08 15:32 ` [PATCH 1/5] crypto/dpaa2_sec: remove crypto device in bus device David Marchand
2025-11-08 15:32 ` [PATCH 2/5] dma/dpaa2: remove DMA " David Marchand
2025-11-08 15:32 ` [PATCH 3/5] net/dpaa2: remove dead code in loopback mode David Marchand
2025-11-08 15:32 ` [PATCH 4/5] net/dpaa2: remove ethdev device in bus device David Marchand
2025-11-08 15:32 ` [PATCH 5/5] bus/fslmc: remove raw " David Marchand

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).