diff mbox series

[API-NEXT,v1,2/7] api: threshold: add odp_threshold_t parameter

Message ID 1509973206-1972-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/7] api: std_types: add odp_percent_t data type | expand

Commit Message

Github ODP bot Nov. 6, 2017, 1 p.m. UTC
From: Balasubramanian Manoharan <bala.manoharan@linaro.org>


odp_threshold_t is used to configure different threshold types

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

---
/** Email created from pull request 277 (bala-manoharan:RED)
 ** https://github.com/Linaro/odp/pull/277
 ** Patch: https://github.com/Linaro/odp/pull/277.patch
 ** Base sha: d22c949cc466bf28de559855a1cb525740578137
 ** Merge commit sha: f8726f45026a85ce1dde794190c1eb35945dca3f
 **/
 include/odp/api/spec/threshold.h                   | 89 ++++++++++++++++++++++
 platform/linux-generic/include/odp/api/threshold.h | 34 +++++++++
 2 files changed, 123 insertions(+)
 create mode 100644 include/odp/api/spec/threshold.h
 create mode 100644 platform/linux-generic/include/odp/api/threshold.h
diff mbox series

Patch

diff --git a/include/odp/api/spec/threshold.h b/include/odp/api/spec/threshold.h
new file mode 100644
index 000000000..d9ee53aeb
--- /dev/null
+++ b/include/odp/api/spec/threshold.h
@@ -0,0 +1,89 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP threshold descriptor
+ */
+
+#ifndef ODP_API_THRESHOLD_H_
+#define ODP_API_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_type_t {
+	struct {
+		/** Percentage of the total size of pool or queue */
+		uint8_t percent:1;
+		/* Number of transient packets */
+		uint8_t pkt_cnt:1;
+		/* Total size of all transient packets in bytes */
+		uint8_t pkt_size:1;
+	};
+	/** All bits of the bit field structure */
+	uint8_t all_bits;
+} odp_threshold_type_t;
+
+/**
+ * ODP Threshold types
+ *
+ * Different types of threshold measurements
+ */
+typedef	enum {
+	/** Percentage of the total size of pool or queue */
+	odp_percent_e,
+	/** Number of transient packets */
+	odp_pkt_count_e,
+	/** Total size of all transient packets in bytes */
+	odp_pkt_size_e
+} odp_threshold_type_e;
+
+/**
+ * ODP Threshold
+ *
+ * Threshold configuration
+ */
+typedef struct odp_threshold_t {
+	/** Type of threshold */
+	odp_threshold_type_e type;
+	union {
+		struct {
+			/** Max percentage value */
+			odp_percent_t max;
+			/** Min percentage value */
+			odp_percent_t min;
+		} percent;
+		struct {
+			/** Max packet count */
+			uint64_t max;
+			/** Min packet count */
+			uint64_t min;
+		} pkt_count;
+		struct {
+			/** Max size of all packets */
+			uint64_t max;
+			/** Min size of all packets */
+			uint64_t min;
+		} pkt_size;
+	};
+} odp_threshold_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <odp/visibility_end.h>
+#endif
diff --git a/platform/linux-generic/include/odp/api/threshold.h b/platform/linux-generic/include/odp/api/threshold.h
new file mode 100644
index 000000000..f4f362852
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/threshold.h
@@ -0,0 +1,34 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP threshold API - platform specific header
+ */
+
+#ifndef ODP_PLAT_THRESHOLD_H_
+#define ODP_PLAT_THRESHOLD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @ingroup odp_threshold
+ *  @{
+ */
+
+/**
+ * @}
+ */
+
+#include <odp/api/spec/threshold.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif