diff options
author | Jere Leppänen <jere.leppanen@nokia.com> | 2022-01-27 17:44:27 +0200 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2022-04-13 09:03:30 +0300 |
commit | 83e018a09bac9190fa34ec1b6c42c8565568c0d2 (patch) | |
tree | 6bfc6d113cbef671482512d3d53a2f56f1e2528f /include/odp/api/spec/classification.h | |
parent | 977f59792c19d6c45bdf3d835a0c141777298027 (diff) |
api: cls: add cos specific statistics counters
Add CoS specific statistics counters (odp_cls_cos_stats_t) and
matching capabilities (in odp_cls_stats_capability_t). Statistics
counters can be read with odp_cls_cos_stats().
Add capability for the maximum number of CoSes that can have
statistics enabled at the same time.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Kiran Kumar K <kirankumark@marvell.com>
Diffstat (limited to 'include/odp/api/spec/classification.h')
-rw-r--r-- | include/odp/api/spec/classification.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/include/odp/api/spec/classification.h b/include/odp/api/spec/classification.h index 8c9483a24..ed9fefed0 100644 --- a/include/odp/api/spec/classification.h +++ b/include/odp/api/spec/classification.h @@ -177,6 +177,30 @@ typedef struct odp_bp_param_t { } odp_bp_param_t; /** + * Classifier CoS specific statistics counters + * + * Counters are incremented per packet classified to the CoS. In a CoS chain, + * counters are incremented in every CoS for which counters are enabled. + */ +typedef struct odp_cls_cos_stats_t { + /** Number of octets in classified packets. In case of Ethernet, packet + * size includes MAC header. */ + uint64_t octets; + + /** Number of classified packets, including packets dropped due to drop + * action. */ + uint64_t packets; + + /** Number of discarded packets due to other reasons than packet + * errors or drop action. */ + uint64_t discards; + + /** Number of packets with errors. */ + uint64_t errors; + +} odp_cls_cos_stats_t; + +/** * Classifier queue specific statistics counters * * Counters are incremented per packet destined to the queue per originating @@ -204,6 +228,34 @@ typedef struct odp_cls_queue_stats_t { * Classifier statistics capabilities */ typedef struct odp_cls_stats_capability_t { + /** CoS level capabilities */ + struct { + /** Supported counters */ + union { + /** Statistics counters in a bit field structure */ + struct { + /** @see odp_cls_cos_stats_t::octets */ + uint64_t octets : 1; + + /** @see odp_cls_cos_stats_t::packets */ + uint64_t packets : 1; + + /** @see odp_cls_cos_stats_t::discards */ + uint64_t discards : 1; + + /** @see odp_cls_cos_stats_t::errors */ + uint64_t errors : 1; + + } counter; + + /** All bits of the bit field structure + * + * This field can be used to set/clear all flags, or + * for bitwise operations over the entire structure. */ + uint64_t all_counters; + }; + } cos; + /** Queue level capabilities */ struct { /** Supported counters */ @@ -253,6 +305,11 @@ typedef struct odp_cls_capability_t { /** Maximum number of CoS supported */ unsigned int max_cos; + /** Maximum number of CoSes that can have statistics enabled at the same + * time. If this value is zero, then CoS level statistics are not + * supported. */ + uint32_t max_cos_stats; + /** Maximun number of queues supported per CoS * if the value is 1, then hashing is not supported*/ unsigned int max_hash_queues; @@ -349,6 +406,12 @@ typedef struct odp_cls_cos_param { */ odp_cos_action_t action; + /** Enable statistics. If true, counters are incremented when packets + * are classified to the CoS. Default is false. @see + * odp_cls_cos_stats(). + */ + odp_bool_t stats_enable; + /** Number of queues to be linked to this CoS. * If the number is greater than 1 then hashing is enabled. * If number is equal to 1 then hashing is disabled. @@ -571,6 +634,25 @@ int odp_cos_with_l3_qos(odp_pktio_t pktio_in, odp_bool_t l3_preference); /** + * Get statistics for a CoS + * + * The statistics counters are incremented for packets classified to the + * given CoS. + * + * Counters that are not supported are set to zero. + * + * It's implementation defined if odp_pktio_stats_reset() call affects these + * counters. + * + * @param cos CoS handle + * @param[out] stats Statistics structure for output + * + * @retval 0 on success + * @retval <0 on failure + */ +int odp_cls_cos_stats(odp_cos_t cos, odp_cls_cos_stats_t *stats); + +/** * Get statistics for a queue assigned to a CoS * * The statistics counters are incremented only for packets originating from the |