aboutsummaryrefslogtreecommitdiff
path: root/include/odp/api/spec/proto_stats_types.h
blob: 4c08e60ab63ada03782eb020137e00120c7347c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright (c) 2021 Marvell
 * Copyright (c) 2021 Nokia
 */

/**
 * @file
 *
 * ODP proto stats types
 */

#ifndef ODP_API_SPEC_PROTO_STATS_TYPES_H_
#define ODP_API_SPEC_PROTO_STATS_TYPES_H_
#include <odp/visibility_begin.h>

#ifdef __cplusplus
extern "C" {
#endif

#include <odp/api/std_types.h>

/** @defgroup odp_proto_stats ODP PROTO STATS
 *  @{
 */

/**
 * @typedef odp_proto_stats_t
 * ODP proto stats handle
 */

/**
 * @def ODP_PROTO_STATS_INVALID
 * Invalid proto stats handle
 */

/** ODP proto stats counters
 *
 * Statistics that can be enabled in proto stats object. For Tx stats counters,
 * Pktout config `odp_pktout_config_opt_t::bit::proto_stats_ena` needs to be
 * enabled.
 *
 * Tx packet and octet sent/drop statistics might include packets sent/dropped via
 * Traffic Manager or Tx packet Aging or due to any other Tx errors. It is
 * implementation specific as to what all Tx sent/drop events are accounted for.
 */
typedef union odp_proto_stats_counters_t {
	/** Option flags */
	struct {
		/** Tx packet sent count */
		uint64_t tx_pkts : 1;

		/** Tx packet drop count */
		uint64_t tx_pkt_drops : 1;

		/** Tx packet sent Octet counter 0 */
		uint64_t tx_oct_count0 : 1;

		/** Tx packet drop Octet counter 0 */
		uint64_t tx_oct_count0_drops : 1;

		/** Tx packet sent octet counter 1 */
		uint64_t tx_oct_count1 : 1;

		/** Tx packet drop octet counter 1 */
		uint64_t tx_oct_count1_drops : 1;
	} bit;

	/** All bits of the bit field structure
	 *
	 * This field can be used to set/clear all flags, or bitwise
	 * operations over the entire structure.
	 */
	uint64_t all_bits;
} odp_proto_stats_counters_t;

/** ODP proto stats params */
typedef struct odp_proto_stats_param_t {
	/** Stats counters to enable */
	odp_proto_stats_counters_t counters;
} odp_proto_stats_param_t;

/**
 * Proto stats capabilities
 */
typedef struct odp_proto_stats_capability_t {
	/** Tx capabilities */
	struct {
		/** Stats counters supported */
		odp_proto_stats_counters_t counters;

		/** Packet adjust support for Octet counter 0 */
		odp_bool_t oct_count0_adj;

		/** Packet adjust support for Octet counter 1 */
		odp_bool_t oct_count1_adj;
	} tx;
} odp_proto_stats_capability_t;

/** ODP proto stats counters */
typedef struct odp_proto_stats_data_t {
	/** Packet sent count */
	uint64_t tx_pkts;

	/** Packet drop count */
	uint64_t tx_pkt_drops;

	/** Packet sent Octet counter 0 */
	uint64_t tx_oct_count0;

	/** Packet drop Octet counter 0 */
	uint64_t tx_oct_count0_drops;

	/** Packet sent octet counter 1 */
	uint64_t tx_oct_count1;

	/** Packet drop octet counter 1 */
	uint64_t tx_oct_count1_drops;
} odp_proto_stats_data_t;

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#include <odp/visibility_end.h>
#endif