From patchwork Sat Jul 18 20:03:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 51254 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EC5F922A28 for ; Sat, 18 Jul 2015 20:07:07 +0000 (UTC) Received: by wgqq19 with SMTP id q19sf3763379wgq.1 for ; Sat, 18 Jul 2015 13:07:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=75c7yKDLOjyw6tSzFodSlQqoM9Z7cSDEdKlbdOD7nwQ=; b=ACPcpeZOB1guYERLDsnytQdwLokYZZA0zSDe9KctvRaeicmSkaA5itmtdNrDvOUY11 Lvhd0jSFpW6Bndu/fNsa/yUCzPS5WTaVMZySCdugnluyiSz2iSRucsODN2Oyp0wMWVGk PiNVIRfK+iEzE4nO2GNHW4t9+R4vn3/EwuypaZKXCxKaN9c7bH4YlD48DKRuLjB641yD QP+eC15RHf1q2lHTdBeldfMCH8GuIhItPX0/QOMbIybqZbqJaVB1KsMn9X4f9mpdUirr bRbg3FbwD70aTW3D18OTFKE6Q7tdASdrgCA92HmagoMIxfRhMPN5Eda5TGokxMzqztoe LaiQ== X-Gm-Message-State: ALoCoQlB6kmFhCj9qYY0kPxbRURQrALVk9JkDGzoyCb5dgZ3DAbnd79SKgrcsmMjcxIubvXqfptp X-Received: by 10.112.189.131 with SMTP id gi3mr10935429lbc.6.1437250026959; Sat, 18 Jul 2015 13:07:06 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.163 with SMTP id c3ls535710laa.98.gmail; Sat, 18 Jul 2015 13:07:06 -0700 (PDT) X-Received: by 10.152.37.37 with SMTP id v5mr19967265laj.11.1437250026802; Sat, 18 Jul 2015 13:07:06 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id bc7si13389366lbc.144.2015.07.18.13.07.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Jul 2015 13:07:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbzr7 with SMTP id zr7so76828910lbb.1 for ; Sat, 18 Jul 2015 13:07:06 -0700 (PDT) X-Received: by 10.112.133.72 with SMTP id pa8mr20216004lbb.117.1437250026119; Sat, 18 Jul 2015 13:07:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp534320lbb; Sat, 18 Jul 2015 13:07:05 -0700 (PDT) X-Received: by 10.140.234.131 with SMTP id f125mr30220200qhc.30.1437250024565; Sat, 18 Jul 2015 13:07:04 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 33si7629507qkw.127.2015.07.18.13.07.03; Sat, 18 Jul 2015 13:07:04 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 9F71561D49; Sat, 18 Jul 2015 20:07:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 35EBB61D12; Sat, 18 Jul 2015 20:05:10 +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 7A86261CEC; Sat, 18 Jul 2015 20:04:25 +0000 (UTC) Received: from mail-ob0-f169.google.com (mail-ob0-f169.google.com [209.85.214.169]) by lists.linaro.org (Postfix) with ESMTPS id 3CF2B61D16 for ; Sat, 18 Jul 2015 20:04:01 +0000 (UTC) Received: by obnw1 with SMTP id w1so82844264obn.3 for ; Sat, 18 Jul 2015 13:04:00 -0700 (PDT) X-Received: by 10.60.93.168 with SMTP id cv8mr20104597oeb.82.1437249840830; Sat, 18 Jul 2015 13:04:00 -0700 (PDT) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by smtp.gmail.com with ESMTPSA id y5sm8537998oes.15.2015.07.18.13.04.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Jul 2015 13:04:00 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sat, 18 Jul 2015 15:03:40 -0500 Message-Id: <1437249827-578-6-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1437249827-578-1-git-send-email-bill.fischofer@linaro.org> References: <1437249827-578-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Cc: Barry Spinney Subject: [lng-odp] [RFC API-NEXT PATCH 05/12] linux-generic: tm: add include infrastructure for tm apis X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bill.fischofer@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Barry Spinney Signed-off-by: Mike Holmes Signed-off-by: Bill Fischofer --- platform/linux-generic/Makefile.am | 2 + .../include/odp/plat/traffic_mngr_types.h | 181 +++++++++++++++++++++ platform/linux-generic/include/odp/traffic_mngr.h | 35 ++++ 3 files changed, 218 insertions(+) create mode 100644 platform/linux-generic/include/odp/plat/traffic_mngr_types.h create mode 100644 platform/linux-generic/include/odp/traffic_mngr.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 52ef5c5..80c57de 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -43,6 +43,7 @@ odpinclude_HEADERS = \ $(srcdir)/include/odp/ticketlock.h \ $(srcdir)/include/odp/time.h \ $(srcdir)/include/odp/timer.h \ + $(srcdir)/include/odp/traffic_mngr.h \ $(srcdir)/include/odp/version.h odpplatincludedir= $(includedir)/odp/plat @@ -66,6 +67,7 @@ odpplatinclude_HEADERS = \ $(srcdir)/include/odp/plat/strong_types.h \ $(srcdir)/include/odp/plat/ticketlock_types.h \ $(srcdir)/include/odp/plat/timer_types.h \ + $(srcdir)/include/odp/plat/traffic_mngr_types.h \ $(srcdir)/include/odp/plat/version_types.h odpapiincludedir= $(includedir)/odp/api diff --git a/platform/linux-generic/include/odp/plat/traffic_mngr_types.h b/platform/linux-generic/include/odp/plat/traffic_mngr_types.h new file mode 100644 index 0000000..12c597c --- /dev/null +++ b/platform/linux-generic/include/odp/plat/traffic_mngr_types.h @@ -0,0 +1,181 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP traffic mngr + */ + +#ifndef ODP_TRAFFIC_MNGR_TYPES_H_ +#define ODP_TRAFFIC_MNGR_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/** @addtogroup odp_queue ODP TRAFFIC MANAGER + * Macros and operation on a queue. + * @{ + */ + +/**> @todo Fill this in with what it's supposed to be */ +#define ODP_CYCLES_PER_SEC 100 + +/** The ODP_TM_MAX_NUM_SYSTEMS constant specifies the maximum number of TM + * systems that may be created. On some platforms this might be much more + * limited to as little as one hardware TM system. + */ +#define ODP_TM_MAX_NUM_SYSTEMS 64 + +/** The ODP_TM_MAX_PRIORITIES constant specifies the largest range of + * priorities that any TM system can support. All strict priority values MUST + * in the range 0..ODP_TM_MAX_PRIORITIES-1. + */ +#define ODP_TM_MAX_PRIORITIES 16 + +/** The ODP_TM MAX_LEVELS constant specifies the largest range of + * tm_node levels that any TM system can support. Hence all tm_node level + * values MUST be in the range 0..ODP_TM_MAX_LEVELS-1. Smaller tm_node + * levels are associated with tm_nodes closer to the TM system egress. + */ +#define ODP_TM_MAX_LEVELS 8 + +/** + * The smallest SCHED weight is 1 (i.e. 0 is not a legal WFQ/WRR value). + */ +#define ODP_TM_MIN_SCHED_WEIGHT 1 + +/** The ODP_TM_MAX_SCHED_WEIGHT constant is the largest weight any TM system + * can support (at least from a configuration standpoint). A given TM system + * could have a smaller value. + */ +#define ODP_TM_MAX_SCHED_WEIGHT 255 + +/** The ODP_TM_MAX_TM_QUEUES constant is the largest number of tm_queues + * that can handled by any one TM system. + */ +#define ODP_TM_MAX_TM_QUEUES (64 * 1024 * 1024) + +/** The ODP_TM_MAX_NUM_OUTPUTS constant is the largest number of outputs that + * can be configured for any one TM system. + */ +#define ODP_TM_MAX_NUM_OUTPUTS 256 + +/** The ODP_TM_MAX_NUM_TM_NODES constant is the largest number of tm_nodes that + * can be in existence for any one TM system. + */ +#define ODP_TM_MAX_NUM_TM_NODES (1024 * 1024) + +/** The ODP_TM_MAX_TM_NODE_FANIN constant is the largest number of fan-in + * "inputs" that can be simultaneously connected to a single tm_node. + * *TBD* Does this need to be as large as ODP_TM_MAX_TM_QUEUES? *TBD* + */ +#define ODP_TM_MAX_TM_NODE_FANIN (1024 * 1024) + +/** The ODP_TM_MIN_SHAPER_BW constant is the smallest amount of bandwidth that + * can a shaper's peak or commit rate can be set to. It is in units of + * 1000 bytes/second so that it and the ODP_TM_MAX_SHAPER_BW can both fit in + * 32 bits. + */ +#define ODP_TM_MIN_SHAPER_BW 1 + +/** The ODP_TM_MAX_SHAPER_BW constant is the largest amound of bandwidth that + * any shaper's peak or commit rate can be set to. It is in units of + * 1000 bytes/second so that it and the ODP_TM_MIN_SHAPER_BW can both fit in + * 32 bits. + */ +#define ODP_TM_MAX_SHAPER_BW 12500000 + +/** The ODP_NUM_SHAPER_COLORS constant just counts the number of enumeration + * values defined in the odp_tm_shaper_color_t type. + */ +#define ODP_NUM_SHAPER_COLORS 3 + +/** The INVALID_PRIORITY constant is used when one needs to indicate an + * invalid priority value. + */ +#define ODP_TM_INVALID_PRIORITY 255 + +/** The odp_tm_percent_t type is used when specifying fields that are + * percentages. It is a fixed point integer whose units are 1/100 of a + * percent. Hence 100% is represented as the integer value 10000. Note + * that because it is often used as a ratio of the current queue value and + * maximum queue threshold, it can be > 100%, but in any event will never + * be larger than 500% (i.e. it MUST be capped at 50000). + */ +typedef uint16_t odp_tm_percent_t; + +/** The odp_tm_handle_t type is a generic type that can stand for any of the + * other ODP_TM handle types. + */ +typedef uint64_t odp_tm_handle_t; + +/** Each odp_tm_t value represents a specific TM system. Almost all + * functions in this API require a odp_tm_t value - either directly + * as a function parameter or indirectly by having another ODP TM handle value + * as a function parameter. + */ +typedef odp_tm_handle_t odp_tm_t; + +/** Each odp_tm_queue_t value is an opaque ODP handle representing a specific + * tm_queue within a specific TM system. + */ +typedef odp_tm_handle_t odp_tm_queue_t; + +/** Each odp_tm_node_t value is an opaque ODP handle representing a specific + * tm_node within a specific TM system. + */ +typedef odp_tm_handle_t odp_tm_node_t; + +/** Each odp_tm_shaper_t value is an opaque ODP handle representing a specific + * shaper profile usable across all TM systems described by this API. A given + * shaper profile can then be attached to any tm_queue or tm_node. + */ +typedef odp_tm_handle_t odp_tm_shaper_t; + +/** Each odp_tm_sched_t value is an opaque ODP handle representing a specific + * tm_node scheduler profile usable across all TM systems described by this + * API. A given tm_node scheduler profile can then be attached to any tm_node. + */ +typedef odp_tm_handle_t odp_tm_sched_t; + +/** Each odp_tm_threshold_t value is an opaque ODP handle representing a + * specific queue threshold profile usable across all TM systems described by + * this API. A given queue threshold profile can then be attached to any + * tm_queue or tm_node. + */ +typedef odp_tm_handle_t odp_tm_threshold_t; + +/** Each odp_tm_wred_t value is an opaque ODP handle representing a specific + * WRED profile usable across all TM systems described by this API. A given + * WRED profile can then be attached to any tm_queue or tm_node. + */ +typedef odp_tm_handle_t odp_tm_wred_t; + +/** The ODP_TM_INVALID constant can be used with any ODP TM handle type and + * indicates that this value does NOT represent a valid TM object. + */ +#define ODP_TM_INVALID 0 + +/** Get printable format of odp_queue_t */ +static inline uint64_t odp_tm_handle_to_u64(odp_tm_handle_t hdl) +{ + return hdl; +} + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp/traffic_mngr.h b/platform/linux-generic/include/odp/traffic_mngr.h new file mode 100644 index 0000000..3aa6267 --- /dev/null +++ b/platform/linux-generic/include/odp/traffic_mngr.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP Traffic manager + */ + +#ifndef ODP_PLAT_TRAFFIC_MNGR_H_ +#define ODP_PLAT_TRAFFIC_MNGR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup odp_traffic_mngr + * @{ + */ + +/** + * @} + */ + +#include +#include + +#ifdef __cplusplus +} +#endif + +#endif