[v5,39/42] net/dpaa2: add API to get endpoint name

Message ID 20241023115955.1207617-40-vanshika.shukla@nxp.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series DPAA2 specific patches |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Vanshika Shukla Oct. 23, 2024, 11:59 a.m. UTC
From: Jun Yang <jun.yang@nxp.com>

Export API in rte_pmd_dpaa2.h

Signed-off-by: Jun Yang <jun.yang@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c  | 24 ++++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_ethdev.h  |  4 ++++
 drivers/net/dpaa2/rte_pmd_dpaa2.h |  3 +++
 drivers/net/dpaa2/version.map     |  1 +
 4 files changed, 32 insertions(+)
  

Patch

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 7a3937346c..137e116963 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -2903,6 +2903,30 @@  rte_pmd_dpaa2_dev_is_dpaa2(uint32_t eth_id)
 	return dev->device->driver == &rte_dpaa2_pmd.driver;
 }
 
+const char *
+rte_pmd_dpaa2_ep_name(uint32_t eth_id)
+{
+	struct rte_eth_dev *dev;
+	struct dpaa2_dev_priv *priv;
+
+	if (eth_id >= RTE_MAX_ETHPORTS)
+		return NULL;
+
+	if (!rte_pmd_dpaa2_dev_is_dpaa2(eth_id))
+		return NULL;
+
+	dev = &rte_eth_devices[eth_id];
+	if (!dev->data)
+		return NULL;
+
+	if (!dev->data->dev_private)
+		return NULL;
+
+	priv = dev->data->dev_private;
+
+	return priv->ep_name;
+}
+
 #if defined(RTE_LIBRTE_IEEE1588)
 int
 rte_pmd_dpaa2_get_one_step_ts(uint16_t port_id, bool mc_query)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index a2b9fc5678..fd6bad7f74 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -385,6 +385,10 @@  struct dpaa2_dev_priv {
 	uint8_t max_cgs;
 	uint8_t cgid_in_use[MAX_RX_QUEUES];
 
+	enum rte_dpaa2_dev_type ep_dev_type;   /**< Endpoint Device Type */
+	uint16_t ep_object_id;                 /**< Endpoint DPAA2 Object ID */
+	char ep_name[RTE_DEV_NAME_MAX_LEN];
+
 	struct extract_s extract;
 
 	uint16_t ss_offset;
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h b/drivers/net/dpaa2/rte_pmd_dpaa2.h
index fc52a9218e..f93af1c65f 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2.h
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h
@@ -130,6 +130,9 @@  rte_pmd_dpaa2_get_tlu_hash(uint8_t *key, int size);
 __rte_experimental
 int
 rte_pmd_dpaa2_dev_is_dpaa2(uint32_t eth_id);
+__rte_experimental
+const char *
+rte_pmd_dpaa2_ep_name(uint32_t eth_id);
 
 #if defined(RTE_LIBRTE_IEEE1588)
 __rte_experimental
diff --git a/drivers/net/dpaa2/version.map b/drivers/net/dpaa2/version.map
index 233c6e6b2c..35815f7777 100644
--- a/drivers/net/dpaa2/version.map
+++ b/drivers/net/dpaa2/version.map
@@ -18,6 +18,7 @@  EXPERIMENTAL {
 	rte_pmd_dpaa2_get_tlu_hash;
 	# added in 24.11
 	rte_pmd_dpaa2_dev_is_dpaa2;
+	rte_pmd_dpaa2_ep_name;
 	rte_pmd_dpaa2_set_one_step_ts;
 	rte_pmd_dpaa2_get_one_step_ts;
 	rte_pmd_dpaa2_mux_dump_counter;