aboutsummaryrefslogtreecommitdiff
path: root/include/odp/api/spec/threshold.h
blob: 732da727443018b820f1870e14b89122ff56f535 (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
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright (c) 2017-2018 Linaro Limited
 */

/**
 * @file
 *
 * ODP threshold descriptor
 */

#ifndef ODP_API_SPEC_THRESHOLD_H_
#define ODP_API_SPEC_THRESHOLD_H_

#include <odp/visibility_begin.h>
#include <odp/api/std_types.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Supported threshold types
 *
 * Supported threshold types in a bit field structure.
 */
typedef union odp_threshold_types_t {
	/** bitfields for different threshold types */
	struct {
		/** Percentage of the total size of pool or queue */
		uint8_t percent:1;

		/** Total number of all transient packets */
		uint8_t packet:1;

		/** Total size of all transient packets in bytes */
		uint8_t bytes:1;
	};

	/** All bits of the bit field structure */
	uint8_t all_bits;
} odp_threshold_types_t;

/**
 * ODP Threshold types
 *
 * Different types of threshold measurements
 */
typedef enum odp_threshold_type_t {
	/** Percentage of the total size of pool or queue */
	ODP_THRESHOLD_PERCENT,

	/** Total number of all transient packets */
	ODP_THRESHOLD_PACKET,

	/** Total size of all transient packets in bytes */
	ODP_THRESHOLD_BYTE
} odp_threshold_type_t;

/**
 * ODP Threshold
 *
 * Threshold configuration
 */
typedef struct odp_threshold_t {
	/** Type of threshold */
	odp_threshold_type_t type;

	/** Different threshold types */
	union {
		/** Percentage */
		struct {
			/** Max percentage value */
			odp_percent_t max;

			/** Min percentage value */
			odp_percent_t min;
		} percent;

		/** Packet count */
		struct {
			/** Max packet count */
			uint64_t max;

			/** Min packet count */
			uint64_t min;
		} packet;

		/** Sum of all data bytes of all packets */
		struct {
			/** Max byte count */
			uint64_t max;

			/** Min byte count */
			uint64_t min;
		} byte;
	};
} odp_threshold_t;

#ifdef __cplusplus
}
#endif

#include <odp/visibility_end.h>
#endif