[PATCH v10 48/48] net/sxe2: fix devargs parse error check for representors

liujie5 at linkdatatechnology.com liujie5 at linkdatatechnology.com
Thu Sep 3 03:58:32 CEST 2026


From: Jie Liu <liujie5 at linkdatatechnology.com>

rte_eth_devargs_parse() returns a positive value (the number of
representor ports) when a representor is specified in the device
string, and a negative value on error.  The old check treated any
non-zero return as an error, so probing a representor device always
failed.

Only treat a negative return as an error, so the positive
representor count is not misreported.

Fixes: d8e4e075acb4 ("net/sxe2: add probing skeleton")
Cc: stable at dpdk.org
Signed-off-by: Jie Liu <liujie5 at linkdatatechnology.com>
---
 drivers/net/sxe2/sxe2_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/sxe2/sxe2_ethdev.c b/drivers/net/sxe2/sxe2_ethdev.c
index 82ad6e660a..abbec09cc2 100644
--- a/drivers/net/sxe2/sxe2_ethdev.c
+++ b/drivers/net/sxe2/sxe2_ethdev.c
@@ -2316,10 +2316,10 @@ static int32_t sxe2_parse_eth_devargs(struct rte_device *dev,
 		ret = rte_eth_devargs_parse(dev->devargs->cls_str,
 					    eth_da,
 					    1);
-		if (ret) {
+		if (ret < 0) {
 			PMD_LOG_ERR(INIT, "Failed to parse device arguments: %s",
 				dev->devargs->cls_str);
-			return -rte_errno;
+			return ret;
 		}
 	}
 
@@ -2327,10 +2327,10 @@ static int32_t sxe2_parse_eth_devargs(struct rte_device *dev,
 		ret = rte_eth_devargs_parse(dev->devargs->args,
 					    eth_da,
 					    1);
-		if (ret) {
+		if (ret < 0) {
 			PMD_LOG_ERR(INIT, "Failed to parse device arguments: %s",
 				dev->devargs->args);
-			return -rte_errno;
+			return ret;
 		}
 	}
 
-- 
2.52.0



More information about the dev mailing list