DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] rawdev: fix device ID retrieval function prototype
@ 2025-09-24  5:56 Nawal Kishor
  0 siblings, 0 replies; only message in thread
From: Nawal Kishor @ 2025-09-24  5:56 UTC (permalink / raw)
  To: dev, Sachin Saxena, Hemant Agrawal, Shreyansh Jain
  Cc: jerinj, asekhar, Nawal Kishor

Fixed rte_rawdev_get_dev_id() function prototype and its usage.

Fixes: c88b3f2558ed ("rawdev: introduce raw device library")

Signed-off-by: Nawal Kishor <nkishor@marvell.com>
---
This patch fixes the return type of rte_rawdev_get_dev_id(). It would be good
to have it merged before the 25.11 release, as it corrects a user-visible API
bug and is a safe change.

 app/test/test_rawdev.c  | 11 +++++++++--
 lib/rawdev/rte_rawdev.c |  2 +-
 lib/rawdev/rte_rawdev.h |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/app/test/test_rawdev.c b/app/test/test_rawdev.c
index d34691dacf..d1d250c9ac 100644
--- a/app/test/test_rawdev.c
+++ b/app/test/test_rawdev.c
@@ -25,11 +25,18 @@ test_rawdev_selftests(void)
 static int
 test_rawdev_selftest_impl(const char *pmd, const char *opts)
 {
-	int ret;
+	int dev_id, ret;
 
 	printf("\n### Test rawdev infrastructure using skeleton driver\n");
 	rte_vdev_init(pmd, opts);
-	ret = rte_rawdev_selftest(rte_rawdev_get_dev_id(pmd));
+	dev_id = rte_rawdev_get_dev_id(pmd);
+	if (dev_id < 0) {
+		printf("Failed to get dev_id for %s\n", pmd);
+		ret = dev_id;
+		goto exit;
+	}
+	ret = rte_rawdev_selftest(dev_id);
+exit:
 	rte_vdev_uninit(pmd);
 	return ret;
 }
diff --git a/lib/rawdev/rte_rawdev.c b/lib/rawdev/rte_rawdev.c
index 4da7956d5a..f21d29114c 100644
--- a/lib/rawdev/rte_rawdev.c
+++ b/lib/rawdev/rte_rawdev.c
@@ -39,7 +39,7 @@ rte_rawdev_count(void)
 }
 
 RTE_EXPORT_SYMBOL(rte_rawdev_get_dev_id)
-uint16_t
+int
 rte_rawdev_get_dev_id(const char *name)
 {
 	uint16_t i;
diff --git a/lib/rawdev/rte_rawdev.h b/lib/rawdev/rte_rawdev.h
index 3fc471526e..ad849e5bea 100644
--- a/lib/rawdev/rte_rawdev.h
+++ b/lib/rawdev/rte_rawdev.h
@@ -44,7 +44,7 @@ rte_rawdev_count(void);
  *   Returns raw device identifier on success.
  *   - <0: Failure to find named raw device.
  */
-uint16_t
+int
 rte_rawdev_get_dev_id(const char *name);
 
 /**
-- 
2.48.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-24  5:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-24  5:56 [PATCH] rawdev: fix device ID retrieval function prototype Nawal Kishor

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