aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2021-06-01 12:27:22 +0300
committerMatias Elo <matias.elo@nokia.com>2021-06-23 09:43:50 +0300
commitff4a48c0cda55351fed4972487c82af31568dcad (patch)
treebdcde5dae88391bb921daa8d79300ac4ecd70305
parent0d2e2c8cca346f4a453a116a69380f8833527ef1 (diff)
api: pktio: add implementation specific extra statistics counters
Add new functions for reading ODP implementation specific custom packet IO statistics counters. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Jerin Jacob <jerinj@marvell.com>
-rw-r--r--include/odp/api/abi-default/packet_io.h2
-rw-r--r--include/odp/api/spec/packet_io_stats.h87
-rw-r--r--platform/linux-generic/include-abi/odp/api/abi/packet_io.h2
3 files changed, 91 insertions, 0 deletions
diff --git a/include/odp/api/abi-default/packet_io.h b/include/odp/api/abi-default/packet_io.h
index d545b7074..74b9abef2 100644
--- a/include/odp/api/abi-default/packet_io.h
+++ b/include/odp/api/abi-default/packet_io.h
@@ -53,6 +53,8 @@ typedef struct odp_pktout_queue_t {
#define ODP_PKTIN_NO_WAIT 0
+#define ODP_PKTIO_STATS_EXTRA_NAME_LEN 64
+
/**
* @}
*/
diff --git a/include/odp/api/spec/packet_io_stats.h b/include/odp/api/spec/packet_io_stats.h
index 5d1ae65c1..a6bcbef23 100644
--- a/include/odp/api/spec/packet_io_stats.h
+++ b/include/odp/api/spec/packet_io_stats.h
@@ -27,6 +27,12 @@ extern "C" {
*/
/**
+ * @def ODP_PKTIO_STATS_EXTRA_NAME_LEN
+ * Maximum packet IO extra statistics counter name length in chars including
+ * null char
+ */
+
+/**
* Packet IO statistics counters
*
* In the counter definitions the term successfully refers to packets which were
@@ -263,6 +269,15 @@ typedef struct odp_pktio_stats_capability_t {
} odp_pktio_stats_capability_t;
/**
+ * Packet IO extra statistics counter information
+ */
+typedef struct odp_pktio_extra_stat_info_t {
+ /** Name of the counter */
+ char name[ODP_PKTIO_STATS_EXTRA_NAME_LEN];
+
+} odp_pktio_extra_stat_info_t;
+
+/**
* Get statistics for pktio handle
*
* Counters not supported by the interface are set to zero.
@@ -354,6 +369,78 @@ int odp_pktout_event_queue_stats(odp_pktio_t pktio, odp_queue_t queue,
int odp_pktio_stats_reset(odp_pktio_t pktio);
/**
+ * Get extra statistics counter information for a packet IO interface
+ *
+ * Returns the number of implementation specific packet IO extra statistics
+ * counters supported by the interface. Outputs up to 'num' extra statistics
+ * counter info structures when the 'info' array pointer is not NULL. If the
+ * return value is larger than 'num', there are more extra counters than the
+ * function was allowed to output. If the return value (N) is less than 'num',
+ * only info[0 ... N-1] have been written.
+ *
+ * The index of a counter in the 'info' array can be used to read the value of
+ * the individual counter with odp_pktio_extra_stat_counter(). The order of
+ * counters in the output array matches with odp_pktio_extra_stats().
+ *
+ * @param pktio Packet IO handle
+ * @param[out] info Array of extra statistics info structs for output
+ * @param num Maximum number of info structs to output
+ *
+ * @return Number of extra statistics
+ * @retval <0 on failure
+ */
+int odp_pktio_extra_stat_info(odp_pktio_t pktio,
+ odp_pktio_extra_stat_info_t info[], int num);
+
+/**
+ * Get extra statistics for a packet IO interface
+ *
+ * Returns the number of implementation specific packet IO extra statistics
+ * counters supported by the interface. Outputs up to 'num' counters when the
+ * 'stats' array pointer is not NULL. If the return value is larger than 'num',
+ * there are more counters than the function was allowed to output. If the
+ * return value (N) is less than 'num', only stats[0 ... N-1] have been written.
+ *
+ * The index of a counter in the 'stats' array can be used to read the value of
+ * the individual counter with odp_pktio_extra_stat_counter(). The order of
+ * counters in the output array matches with odp_pktio_extra_stat_info().
+ *
+ * @param pktio Packet IO handle
+ * @param[out] stats Array of extra statistics for output
+ * @param num Maximum number of extra statistics to output
+ *
+ * @return Number of extra statistics
+ * @retval <0 on failure
+ */
+int odp_pktio_extra_stats(odp_pktio_t pktio, uint64_t stats[], int num);
+
+/**
+ * Get extra statistic counter value
+ *
+ * 'id' is the index of the particular counter in the output array of
+ * odp_pktio_extra_stat_info() or odp_pktio_extra_stats().
+ *
+ *
+ * @param pktio Packet IO handle
+ * @param id ID of the extra statistics counter
+ * @param[out] stat Pointer for statistic counter output
+ *
+ * @retval 0 on success
+ * @retval <0 on failure
+ */
+int odp_pktio_extra_stat_counter(odp_pktio_t pktio, uint32_t id,
+ uint64_t *stat);
+
+/**
+ * Print extra statistics for a packet IO interface
+ *
+ * Print all packet IO device extra statistics to ODP log.
+ *
+ * @param pktio Packet IO handle
+ */
+void odp_pktio_extra_stats_print(odp_pktio_t pktio);
+
+/**
* @}
*/
diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet_io.h b/platform/linux-generic/include-abi/odp/api/abi/packet_io.h
index 45f06912c..48a847c07 100644
--- a/platform/linux-generic/include-abi/odp/api/abi/packet_io.h
+++ b/platform/linux-generic/include-abi/odp/api/abi/packet_io.h
@@ -50,6 +50,8 @@ typedef struct odp_pktout_queue_t {
#define ODP_PKTIN_NO_WAIT 0
#define ODP_PKTIN_WAIT UINT64_MAX
+#define ODP_PKTIO_STATS_EXTRA_NAME_LEN 64
+
/**
* @}
*/