From patchwork Wed Nov 8 14:00:12 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: 118261 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5328318qgn; Wed, 8 Nov 2017 06:03:52 -0800 (PST) X-Google-Smtp-Source: ABhQp+RWcTv1ngRyXRmSjdzMiDK1VhFTHH5PvA5/uQ17J2qrOkd0DJtCMJrSDwgxZWHxf5lKGaoz X-Received: by 10.237.61.49 with SMTP id g46mr913877qtf.239.1510149831913; Wed, 08 Nov 2017 06:03:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510149831; cv=none; d=google.com; s=arc-20160816; b=otd75PvLnaXUWVA79TlMGdQuo21NvMwbspUAei63VmnGsY5YhPQZpF3O1jKkvjsnUK 6aSg35l9FjffJ0Zs1GoPYLFySwvMGmEBiltgxGO9cPY7paAUsDSg97Pnf2RCry+iXEJx +6gam+LRztckMVJzWHQ75W6B7Xa6y+3mhg5WnsvPGqfrWreD3EUMdzh2g2aRSVb4er6X xmoYo+yk8U36Q1T4bPJSQjZXPQj6H/g5tZWLoPHhiSs+dRkvfnmPpv3D/uV7exfq97Ez klr0zwFS9Sd8IZRMgA3MAVLrNBFpT2MTuAUf+MY1RueuBdpHMjGQEdZID78DaYCQBREs KrSw== 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=QG+WNvOECbuwGNu3EG8Kp4wf2pLlZ0MpScSmdVFT56Q=; b=yD94CLY+bAzO6jrcvn9z43xmwqazWKhQFzdfOl+vJrdpgVmSxUHFKmBYXrlp1yrEDL /RtFPSoVj8j+Mx0z+RxmDfN0JUIDo0yPWkeiM71w0OFzsBUFMWwrWBBagBj2HE7jMXs5 CRc9VJRBh5YGSR3zJi9eORgvDbQmE38sh53q9dhA+OPcN6fsLXW+MNJfiB81jcN9f+sI 55LZmVXWe1T2cbtbbgAfkSf3PFnmsQNT6jNyhsTuoYn3xu1p7j02RRE2FQlUko/OjQfI 3TxgDSL1e7DhDzONh8E6MEgqAF/0AEg1OkH1UN6X9A+X6w+M7C/fLYcdnxo+J5Yfg12W pHdg== 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 d130si78899qka.400.2017.11.08.06.03.51; Wed, 08 Nov 2017 06:03:51 -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 5FCFE6101A; Wed, 8 Nov 2017 14:03:51 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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 38E0260C88; Wed, 8 Nov 2017 14:00:50 +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 B38F0606A1; Wed, 8 Nov 2017 14:00:27 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id DCF6560890 for ; Wed, 8 Nov 2017 14:00:18 +0000 (UTC) Received: from mxback17j.mail.yandex.net (mxback17j.mail.yandex.net [IPv6:2a02:6b8:0:1619::93]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 631024443517 for ; Wed, 8 Nov 2017 17:00:17 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback17j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id H55QiBzvJI-0HvG8OcS; Wed, 08 Nov 2017 17:00:17 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id YHHquvKMKk-0GhqMvud; Wed, 08 Nov 2017 17:00:16 +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: Wed, 8 Nov 2017 17:00:12 +0300 Message-Id: <1510149614-31459-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510149614-31459-1-git-send-email-odpbot@yandex.ru> References: <1510149614-31459-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 277 Subject: [lng-odp] [PATCH API-NEXT v2 2/4] 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: 4c2f383b93c80fa98e8e676897db02dbc8b56112 **/ include/Makefile.am | 1 + include/odp/api/spec/threshold.h | 102 +++++++++++++++++++++ platform/linux-generic/Makefile.am | 1 + platform/linux-generic/include/odp/api/threshold.h | 34 +++++++ 4 files changed, 138 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/Makefile.am b/include/Makefile.am index d53181ceb..8ab150ad9 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -44,6 +44,7 @@ odpapispecinclude_HEADERS = \ odp/api/spec/sync.h \ odp/api/spec/system_info.h \ odp/api/spec/thread.h \ + odp/api/spec/threshold.h \ odp/api/spec/thrmask.h \ odp/api/spec/ticketlock.h \ odp/api/spec/time.h \ diff --git a/include/odp/api/spec/threshold.h b/include/odp/api/spec/threshold.h new file mode 100644 index 000000000..54502e9e0 --- /dev/null +++ b/include/odp/api/spec/threshold.h @@ -0,0 +1,102 @@ +/* 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 { + /** 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 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, + + /* Total number of all 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; + + /* Different threshold types */ + union { + struct { + /** Max percentage value */ + odp_percent_t max; + + /** Min percentage value */ + odp_percent_t min; + } percent; /** Percentage */ + + struct { + /** Max packet count */ + uint64_t max; + + /** Min packet count */ + uint64_t min; + } pkt_count; /** Packet count */ + + struct { + /** Max size of all packets */ + uint64_t max; + + /** Min size of all packets */ + uint64_t min; + } pkt_size; /** Packet size */ + }; +} odp_threshold_t; + +#ifdef __cplusplus +} +#endif + +#include +#endif diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index c54067609..2b5056e4d 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -65,6 +65,7 @@ odpapiinclude_HEADERS = \ include/odp/api/sync.h \ include/odp/api/system_info.h \ include/odp/api/thread.h \ + include/odp/api/threshold.h \ include/odp/api/thrmask.h \ include/odp/api/ticketlock.h \ include/odp/api/time.h \ 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