From patchwork Mon Nov 6 13:00:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 118028 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2739201qgn; Mon, 6 Nov 2017 05:02:12 -0800 (PST) X-Google-Smtp-Source: ABhQp+SbBoIyDjeqC2RcQMZs+e9wxFt11l0IGXr3kFNKLb+3NogZtQ8Rj0Aou5jJxU6pDD51mzvm X-Received: by 10.55.92.195 with SMTP id q186mr20158811qkb.154.1509973332561; Mon, 06 Nov 2017 05:02:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509973332; cv=none; d=google.com; s=arc-20160816; b=SnyECD7TSs/NwYOvqBIWfNZibMHWCy2y62ClQlxNEz5ky1N47wB52AYtaju1jr4DJn GtrZ9Pl3d9p3eZojwFr2VrQLjv0LRAXyg9gsVsYKe+mlrg7fajqGwgE312VIKNSoBLXQ E8qj3v77NV1+U+45cFCiW9FD3wkGY9i9cvGU+DXjfHUfE0eQnvr9TgrUnxRRhQKQWyeY 456QemHy+hhi+Nz+36b2lSZptXquDvEvDgMJ4QTKRkEdD9yE4inS5LfMECZenfB2mICd 6OLXHVjYOJx3Rh5T95/NHFxS4knifqc682BVmXRjDVU1JPXcNvfJr9fwcpGjl69W4kG5 6gqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=1mUB9L5VsZiVwTYVV7IpUWj7Km3zh/Rg2uCfVvs2GVQ=; b=dIpxnWLf3SzuC2VgzFFtQNbD/Iz+Qk8r2tjkFnrodtEtxLrYKR1qw4Nn55W++oMweT d3ckIYP2/xrvFDVfSGaOYwjxxTeo1uZbWZu9WY76BHrPU0xlpjKDCGgrPL4+L+sKR75s aX9b9lqaMr1+h1tPYKv0kqHRIc5o3WjGLCL6UzeRUBu39edfg2dEk2VCgFCE6RIYjmUM cPxiRqlHzRPmkdm4yr86v3m4Ddycdm/607G0gvTmHypBC7Yx4/7IQ1XwxbsLU8XO3KNm K79cjZUyem0Z0W/vPxa+nCjdi85SP+Nl5T/Yrkz7Go0cpRQcgGs+3wId5oNWE7HKxpq/ utSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id n59si3329709qtd.474.2017.11.06.05.02.12; Mon, 06 Nov 2017 05:02:12 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id E64086069B; Mon, 6 Nov 2017 13:02:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 573A16069F; Mon, 6 Nov 2017 13:00:31 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 350DA60996; Mon, 6 Nov 2017 13:00:14 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id EC8D86069F for ; Mon, 6 Nov 2017 13:00:10 +0000 (UTC) Received: from mxback17j.mail.yandex.net (mxback17j.mail.yandex.net [IPv6:2a02:6b8:0:1619::93]) by forward103j.mail.yandex.net (Yandex) with ESMTP id 8CDCC34C4D11 for ; Mon, 6 Nov 2017 16:00:09 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback17j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id ouSkDJc0U4-0938m0L1; Mon, 06 Nov 2017 16:00:09 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id nU8zA9xMmR-08hSOgvK; Mon, 06 Nov 2017 16:00:08 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 6 Nov 2017 16:00:01 +0300 Message-Id: <1509973206-1972-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509973206-1972-1-git-send-email-odpbot@yandex.ru> References: <1509973206-1972-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 277 Subject: [lng-odp] [PATCH API-NEXT v1 2/7] api: threshold: add odp_threshold_t parameter X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Balasubramanian Manoharan odp_threshold_t is used to configure different threshold types Signed-off-by: Balasubramanian Manoharan --- /** 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 --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 +#include + +#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 +#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 + +#ifdef __cplusplus +} +#endif + +#endif