bitrate: change reg implementation to match API description
PATCH 1/3 bitrate: change reg implementation to match API description
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.
--- lib/bitratestats/rte_bitrate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/bitratestats/rte_bitrate.c +3 -1
@@ -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; }
Signature · 1 line
2.31.1
PATCH 2/3 bitrate: change calc implementation to match API description
rte_stats_bitrate_calc() API states it returns 'Negative value on error'.
However, the implementation will return the error code from rte_eth_stats_get() which may be non-zero on error.
Change the implementation of rte_stats_bitrate_calc() to match the API description by always returning a negative value on error.
--- lib/bitratestats/rte_bitrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bitratestats/rte_bitrate.c +1 -1
@@ -81,5 +81,5 @@ rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data, ret_code =rte_eth_stats_get (port_id, ð_stats);if (ret_code !=0 ) -return ret_code; +return ret_code <0 ? ret_code : -ret_code; port_data = &bitrate_data->port_stats[port_id];
Signature · 1 line
2.31.1
PATCH 3/3 bitrate: promote rte_stats_bitrate_free() to stable
In reply to Kevin Traynorrte_stats_bitrate_free() has been in DPDK since 20.11.
Its signature is very basic as it just frees an opaque data struct allocated in rte_stats_bitrate_create() and returns void.
It's unlikely that such a basic signature would need to change so might as well promote it to stable for the next major ABI.
--- lib/bitratestats/rte_bitrate.h | 3 --- lib/bitratestats/version.map | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-)
lib/bitratestats/rte_bitrate.h +0 -3
@@ -8,6 +8,4 @@#include <stdint.h> -#include <rte_compat.h> -#ifdef __cplusplusextern "C" {
@@ -36,5 +34,4 @@ struct rte_stats_bitrates *rte_stats_bitrate_create(void);* Pointer allocated by rte_stats_bitrate_create() */ -__rte_experimental void rte_stats_bitrate_free (struct rte_stats_bitrates *bitrate_data);
lib/bitratestats/version.map +2 -2
@@ -9,7 +9,7 @@ DPDK_21 { }; -EXPERIMENTAL { +DPDK_22 { global: rte_stats_bitrate_free; -}; +} DPDK_21;
Signature · 1 line
2.31.1
09/07/2021 17:19, Kevin Traynor:
Quoted 9 lines
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 opaquerte_stats_bitratesstruct.
Quoted 6 lines
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 <[email protected]>
Does it require a deprecation notice?
At least I suggest a release note in API section.
What is the target for this series? 21.11?
Quoted 10 lines · Thomas Monjalon
09/07/2021 17:19, Kevin Traynor:
Quoted 9 lines
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 opaquerte_stats_bitratesstruct.
Quoted 8 lines
Quoted 6 lines
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 <[email protected]>Does it require a deprecation notice?
I'm not certain, but I don't think it does. It is fixing the implementation so it behaves as the API is documented to.
Quoted 4 lines
At least I suggest a release note in API section.
What is the target for this series? 21.11?
No urgency, 21.11 is fine for this set.
Quoted 2 lines
Thomas Monjalon
Applied22/07/2021 22:24, Kevin Traynor:
Quoted 23 lines · Thomas Monjalon
Quoted 10 lines
09/07/2021 17:19, Kevin Traynor:
Quoted 9 lines
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 opaquerte_stats_bitratesstruct.Quoted 8 lines
Quoted 6 lines
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 <[email protected]>Does it require a deprecation notice?
I'm not certain, but I don't think it does. It is fixing the implementation so it behaves as the API is documented to.
Quoted 6 lines
Quoted 4 lines
At least I suggest a release note in API section.
What is the target for this series? 21.11?
No urgency, 21.11 is fine for this set.
Applied, thanks.