[PATCH v8 2/8] pcapng: document return values

Stephen Hemminger
2026-02-16T21:43:32Z

Update the Doxygen comments for rte_pcapng_add_interface()
and rte_pcapng_write_stats() to document return values.

Return values management in this library is not as consistent
as other libraries like ethdev but fixing it would break
API and ABI compatibility.

Fixes: 8d23ce8f5ee9 ("pcapng: add new library for writing pcapng files")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/pcapng/rte_pcapng.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/pcapng/rte_pcapng.h b/lib/pcapng/rte_pcapng.h
index de1bf953e9..8d0974c3fd 100644
--- a/lib/pcapng/rte_pcapng.h
+++ b/lib/pcapng/rte_pcapng.h
@@ -89,6 +89,9 @@ rte_pcapng_close(rte_pcapng_t *self);
* Interfaces must be added to the output file after opening
* and before any packet record. All ports used in packet capture
* must be added.
+ *
+ * @return
+ * number of bytes written to file, -1 on failure
*/
int
rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port, uint16_t link_type,
@@ -128,7 +131,7 @@ enum rte_pcapng_direction {
*
* @return
* - The pointer to the new mbuf formatted for pcapng_write
- * - NULL if allocation fails.
+ * - NULL on error such as invalid port or out of memory.
*/
struct rte_mbuf *
rte_pcapng_copy(uint16_t port_id, uint32_t queue,
@@ -192,7 +195,9 @@ rte_pcapng_write_packets(rte_pcapng_t *self,
* @param comment
* Optional comment to add to statistics.
* @return
- * number of bytes written to file, -1 on failure to write file
+ * On success number of bytes written to file,
+ * -1 on failure to write file (and errno is set)
+ * - (-EINVAL) if bad parameter.
*/
ssize_t
rte_pcapng_write_stats(rte_pcapng_t *self, uint16_t port,
--
2.51.0