DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/3] bitrate: change reg implementation to match API description
@ 2021-07-09 15:19 Kevin Traynor
  2021-07-09 15:19 ` [dpdk-dev] [PATCH 2/3] bitrate: change calc " Kevin Traynor
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kevin Traynor @ 2021-07-09 15:19 UTC (permalink / raw)
  To: dev; +Cc: mdr, Kevin Traynor

rte_stats_bitrate_reg() API states it returns 'Zero on success'.

However, the implementation directly returns the return of
rte_metrics_reg_names() which may be zero or positive on success,
with a positive value also indicating the index.

The user of rte_stats_bitrate_reg() should not care about the
index as it is stored in the opaque rte_stats_bitrates struct.

Change the implementation of rte_stats_bitrate_reg() to match
the API description by always returning zero on success.

Fixes: 2ad7ba9a6567 ("bitrate: add bitrate statistics library")

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 lib/bitratestats/rte_bitrate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/bitratestats/rte_bitrate.c b/lib/bitratestats/rte_bitrate.c
index 8fd9f47288..e23e38bc94 100644
--- a/lib/bitratestats/rte_bitrate.c
+++ b/lib/bitratestats/rte_bitrate.c
@@ -56,6 +56,8 @@ rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data)
 
 	return_value = rte_metrics_reg_names(&names[0], RTE_DIM(names));
-	if (return_value >= 0)
+	if (return_value >= 0) {
 		bitrate_data->id_stats_set = return_value;
+		return 0;
+	}
 	return return_value;
 }
-- 
2.31.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-01 13:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 15:19 [dpdk-dev] [PATCH 1/3] bitrate: change reg implementation to match API description Kevin Traynor
2021-07-09 15:19 ` [dpdk-dev] [PATCH 2/3] bitrate: change calc " Kevin Traynor
2021-07-09 15:19 ` [dpdk-dev] [PATCH 3/3] bitrate: promote rte_stats_bitrate_free() to stable Kevin Traynor
2021-07-22 19:46 ` [dpdk-dev] [PATCH 1/3] bitrate: change reg implementation to match API description Thomas Monjalon
2021-07-22 20:24   ` Kevin Traynor
2021-10-01 13:32     ` Thomas Monjalon

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