The register functions returned positive rte_errno on failure.
The caller only checks for negative values, so a failed Rx enable
fell through to Tx, and the positive value sent back to the client
was negated into rte_errno, giving messages like "Unknown error -22".
Fixes: 278f945402c5 ("pdump: add new library for packet capture")
Cc: [email protected]
Signed-off-by: Stephen Hemminger <[email protected]>
---
lib/pdump/rte_pdump.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index ac94efe7ff..9c368bcfd7 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -283,7 +283,7 @@ pdump_register_rx_callbacks(enum pdump_version ver,
PDUMP_LOG_LINE(ERR,
"failed to add rx callback, errno=%d",
rte_errno);
- return rte_errno;
+ return -rte_errno;
}
memset(&pdump_stats->rx[port][qid], 0, sizeof(struct
rte_pdump_stats));
@@ -345,7 +345,7 @@ pdump_register_tx_callbacks(enum pdump_version ver,
PDUMP_LOG_LINE(ERR,
"failed to add tx callback, errno=%d",
rte_errno);
- return rte_errno;
+ return -rte_errno;
}
memset(&pdump_stats->tx[port][qid], 0, sizeof(struct
rte_pdump_stats));
} else if (operation == DISABLE) {
--
2.53.0